diff --git a/.gitignore b/.gitignore index 8d3437b..200996b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,15 @@ EXTRACTED-text-*.md # Generated technical reference /docs/jsdoc/ -# Fake-webcam fixtures and measurements built by scripts-dev/build-face-fixtures.cjs -/tests/fixtures/synthetic-faces/y4m/ +# Local research videos. The small synthetic MP4 remains committed for CI. +/tests/fixtures/*.mp4 +/tests/fixtures/*.webm +/tests/fixtures/*.mkv +/tests/fixtures/*.mov +/tests/fixtures/*.m4v +!/tests/fixtures/my-moving-face.mp4 + +# Local measurements produced while calibrating model thresholds. /tests/fixtures/synthetic-faces/lab-measurements.json # scripts-dev/lab-capture.cjs render writes candidate pictures here. They are diff --git a/JSDOC_index.md b/JSDOC_index.md index 21d82b0..0bebdf5 100644 --- a/JSDOC_index.md +++ b/JSDOC_index.md @@ -1,7 +1,7 @@ # Ghostmaxxing technical reference -> Version 0.9.11 -> Last updated: September 2026 +> Version 0.9.11 +> Last updated: October 2026 > Functional documentation: [use the tools and understand the results](/docs/) Ghostmaxxing is a static browser lab for testing how selected face-analysis models respond to visible interventions. This site is the generated developer reference. It documents runtime modules, functions, parameters, events, and the Ghostyle extension contract. @@ -12,7 +12,7 @@ If you want to operate an interface, begin with the functional guides. If you ar | Question | Documentation | |---|---| -| How do I use the Lab, Video Loader, Transfer, or Face Brush? | [Functional guides](/docs/) | +| How do I use the Lab, Video Loader, Latent Space Visualizer, or Face Brush? | [Functional guides](/docs/) | | What does a match state, threshold, descriptor, or landmark mean? | [Understand the results](/docs/understand/) and [technical glossary](/docs/glossary/) | | How do I create a Ghostyle? | [Ghostyle Authoring Guide](tutorial-ghostyle-authoring.html), then [`ghostyles/00-template.js`](module-ghostyles_00-template.html) | | Which module, function, parameter, or event do I need? | Generated API reference in this site's sidebar | @@ -34,7 +34,17 @@ Use it when exact media time matters more than a live webcam. Use it to explore appearance transfer. A visually successful transfer is not evidence that the target image evades recognition. -`realtime.html` is not part of the initial released documentation set. +### Latent Space Visualizer + +`realtime.html` loads `lab-js/realtime/realtime.js`. It captures a temporal 2D +face-api baseline, filters frames whose 2D pose, framing, or ambient light is not +comparable, and lets the operator mark and aggregate successive makeup steps. +The input may be a live camera or a local video. The timeline, equalizer, and +radial fingerprint are different views of the same descriptor-distance session. + +Begin with the [functional guide](/docs/guides/realtime.html), then use the +[combined operating guide and methodology](/docs/jsdoc/tutorials/realtime) before +interpreting the threshold, noise floor, or per-coordinate plots. ## Runtime architecture @@ -53,6 +63,13 @@ lab.html loader.html └─ lab-js/loader.js +realtime.html + └─ lab-js/realtime/realtime.js + ├─ realtime-capture.js (quality, temporal collectors, spike/frame buffer) + ├─ realtime-graph.js + realtime-radial.js + ├─ realtime-settings.js + └─ realtime-gallery.js + ``` ### Core state and lifecycle diff --git a/README.md b/README.md index 4eec4f3..4d1fac1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ghostmaxxing -[![Unit Test Coverage](https://img.shields.io/badge/coverage-96.79%25-green)](coverage/) +[![Unit Test Coverage](https://img.shields.io/badge/coverage-88.94%25-green)](coverage/) [![CI](https://github.com/vecna/ghostmaxxing/actions/workflows/ci.yml/badge.svg)](https://github.com/vecna/ghostmaxxing/actions/workflows/ci.yml) @@ -76,6 +76,7 @@ npm run check # validator + unit tests (run before proposing change npm run test:unit # Vitest unit tests npm run test:unit -- --coverage npm run test:e2e # Playwright browser tests +npm run test:e2e:realtime # Focused realtime camera/video workflow npm run docs # generate the JSDoc site into docs/jsdoc/ npm run validate:ghostyles # validate every ghostyle in ghostyles/ npm run validate:ghostyle -- ghostyles/your-slug.js # validate one diff --git a/about.html b/about.html index f341307..4e485fa 100644 --- a/about.html +++ b/about.html @@ -472,6 +472,7 @@

About the project

Technical documentation Code Video Loader + Latent Space Visualizer diff --git a/coverage/FOLDER-DESCRIPTION.md b/coverage/FOLDER-DESCRIPTION.md deleted file mode 100644 index 01a2f99..0000000 --- a/coverage/FOLDER-DESCRIPTION.md +++ /dev/null @@ -1,7 +0,0 @@ -# coverage - -This folder contains generated Vitest coverage output. - -It is produced by `npm run test:coverage` and includes HTML reports, coverage JSON, `lcov.info`, and static report assets. The README coverage badge links here for local inspection. - -Coverage output is excluded from code2prompt because it is generated test-report data. The chatbot should infer that coverage exists from this summary and from the package scripts. diff --git a/docs-src/en/develop.body.html b/docs-src/en/develop.body.html index db83df0..0446702 100644 --- a/docs-src/en/develop.body.html +++ b/docs-src/en/develop.body.html @@ -22,6 +22,7 @@

Choose a starting point

Call or integrate a runtime moduleGenerated JSDoclab-js/ source Understand imports, pages, and eventsCode mapModule headers and event-bus source Use the public browser APIGhostmaxxing.d.tswindow.gstmxx in main.js + Run and inspect the realtime measurement methodRealtime guide and methodologylab-js/realtime/ source Regenerate or package the projectMaintainer guidescripts-dev/ @@ -36,14 +37,9 @@

Available interfaces

lab.htmllab-js/main.jsLive camera, local baseline, 2D and mesh views, Ghostyles, composite analysis. loader.htmllab-js/loader.jsRepeatable comparison of frames from a local MP4. + realtime.htmllab-js/realtime/realtime.jsTemporal baseline and operator-declared makeup-step measurements from a camera or local video. -
@@ -58,6 +54,7 @@

Runtime modules

Mesh and visual embeddingmediapipe-loop.js, engine-3d.js478-point geometry and the separate experimental ImageEmbedder path. Composite feedbackauto-find-loop.js, bbox-overlay.js, analyze-panel.jsSlower modified-image pass, live scaffold, status, metrics, report text. Extensionsghostyles-manager.js, plugins3d-loader.js, ghostyle3d-uv-renderer.jsLoad 2D, UV, and hybrid Ghostyles and expose their controls. + Realtime experimentrealtime.js, realtime-capture.js, realtime-graph.js, realtime-radial.js2D-only temporal capture, comparable-condition filtering, phase timeline, and 128-value descriptor views.
diff --git a/docs-src/en/index.body.html b/docs-src/en/index.body.html index 14c53d6..2a90cea 100644 --- a/docs-src/en/index.body.html +++ b/docs-src/en/index.body.html @@ -33,6 +33,16 @@

Video Loader

+
+ Tool 03 [Experimental!] +

Latent Space Visualizer

+

Mark makeup steps and measure face-descriptor drift over short, comparable time windows using a camera or local video.

+
+ Open the Visualizer ↗ + Read the guide +
+
+
diff --git a/docs-src/en/maintain.body.html b/docs-src/en/maintain.body.html index 8431f46..6ef46f3 100644 --- a/docs-src/en/maintain.body.html +++ b/docs-src/en/maintain.body.html @@ -24,6 +24,7 @@

Implemented in packages.json

Validate all Ghostylesnpm run validate:ghostylesReports errors and warnings; stops on the first failed file. Run fast checksnpm run checkValidates Ghostyles, then runs unit tests. Run all testsnpm testRuns unit tests, then Playwright end-to-end tests. + Test the realtime workflownpm run test:e2e:realtimeRuns the focused Chromium suite, including local-video upload and declared-step measurement. Build architecture mapnpm run codemapWrites the JSON graph and standalone HTML viewer. Extract translationsnpm run i18n:extractOverwrites POT and pipe-delimited summary files. diff --git a/docs-src/en/pages.json b/docs-src/en/pages.json index 87d9d2d..270ed81 100644 --- a/docs-src/en/pages.json +++ b/docs-src/en/pages.json @@ -21,6 +21,13 @@ "description": "Use a local MP4 and exact timestamps to record and compare faces with the Ghostmaxxing Video Loader.", "section": "tools" }, + { + "source": "realtime.body.html", + "output": "docs/guides/realtime.html", + "title": "Measure a makeup session over time — Ghostmaxxing", + "description": "Capture a temporal baseline, mark makeup steps, and inspect local face-descriptor drift with the Ghostmaxxing Latent Space Visualizer.", + "section": "tools" + }, { "source": "face-brush.body.html", "output": "docs/guides/face-brush.html", diff --git a/docs-src/en/realtime.body.html b/docs-src/en/realtime.body.html new file mode 100644 index 0000000..7d9f4c1 --- /dev/null +++ b/docs-src/en/realtime.body.html @@ -0,0 +1,88 @@ +
+ Functional guide · Latent Space Visualizer +

Measure a makeup session over time.

+

Capture a clean baseline, mark each application interval, and aggregate the descriptor change after every finished step.

+

The visualizer uses only the 2D face-api/dlib path. It excludes sufficiently different pose, framing, and ambient-light frames; it does not mathematically correct them or predict another recognition system.

+ +
+ +
+
+
+ Input +

Use the camera or a local video.

+

The camera is the default. Open Source to select a local video; the file remains on this device and can be paused, sought, and replayed. Changing source invalidates the current baseline.

+

Source → Brightness changes only how bright the video looks on screen. The model reads the original video pixels, so this control cannot improve lighting or change a measurement.

+
+ +
+ Session workflow +

Baseline, application, measurement.

+
+
01

Set the baseline

Use a neutral frontal pose and stable light, then press Set baseline. Hold still and follow the centre target while five accepted samples are distributed across at least two seconds.

+
02

Start one makeup step

Press Start makeup step before applying one change. The timeline marks the event and shades the application interval.

+
03

Return to comparable conditions

Finish the change, then return to the baseline pose, framing, and room light. Leaving the frame during application produces a marked no-face interval without an invented distance line.

+
04

Measure the step

Press Measure this step and hold still. Eight comparable frames over at least three seconds become one temporal snapshot.

+
05

Read and repeat

Record the distance, baseline noise floor, and step temporal spread together. Use Start next step for the next cumulative change.

+
+
+ +
+ Nuisance control +

Different pose and light are omitted, not normalised.

+

Baseline capture checks confidence, scale, framing, 2D roll/yaw, and face-crop exposure. After makeup starts, confidence and face-crop exposure may legitimately change, so they no longer reject a frame. Scale, framing, roll, and yaw still apply, followed by a comparison with the baseline's averaged 2D conditions and ambient luminance outside the face box.

+

The gate reduces obvious confounds; it cannot prove that makeup caused the remaining distance. It does not estimate pitch and cannot separate every intervention from every shadow.

+
+ +
+ Feedback +

Read the trace and the 128-value fingerprints.

+ + + + + + + + +
ViewWhat it showsDo not infer
Distance timelineSmoothed live distance, gaps, phase backgrounds, event lines, measured noise floor, and the cited 0.60 dlib reference.That the space between the two reference lines has a calibrated meaning.
EqualizerAbsolute change for each of 128 descriptor coordinates.That one row corresponds to a facial region.
Radial distributionAll 128 deltas sorted into 16 ranked RMS bands, with the live reading as an outline and the latest measured step as a filled shape.That a spoke or direction identifies a makeup line, cheek, or eyebrow.
Step captureThe sharpest accepted frame from the measurement window, watermarked with local result metadata.That one model-local result transfers to a deployed system.
+
+ +
+ Recorded sessions +

Use video as a repeatable fixture.

+

Local-video event labels include media time. Pause or seek to inspect the recording, then mark application and measurement moments. Starting either interval resumes a paused video so the temporal collector does not repeatedly inspect one frozen frame.

+
+ +
+ Data +

Local does not mean insignificant.

+
    +
  • Camera baselines persist in localStorage; local-video baselines exist only for the current page session.
  • +
  • Manual, sustained-spike, and declared-step JPEG captures use browser IndexedDB.
  • +
  • The selected video is neither uploaded nor persisted by the page.
  • +
  • Delete baseline does not erase the gallery. Delete captures separately when they are no longer needed.
  • +
+
+ + +
+ + +
diff --git a/fediverse.html b/fediverse.html index ded72f3..1b0f4e5 100644 --- a/fediverse.html +++ b/fediverse.html @@ -407,6 +407,7 @@

On this page

Technical documentation Code Video Loader + Latent Space Visualizer
diff --git a/genealogy.html b/genealogy.html index fb29741..66bd9f3 100644 --- a/genealogy.html +++ b/genealogy.html @@ -1099,6 +1099,7 @@

Wearable readers

Technical documentation Code Video Loader + Latent Space Visualizer diff --git a/images/gif/bouncing-animation-green.gif b/images/gif/bouncing-animation-green.gif new file mode 100644 index 0000000..250905c Binary files /dev/null and b/images/gif/bouncing-animation-green.gif differ diff --git a/index.html b/index.html index 4529af3..898f0d9 100644 --- a/index.html +++ b/index.html @@ -542,6 +542,7 @@

Disrupt Face Recognition, one Ghostyle Technical documentation Code Video Loader + Latent Space Visualizer diff --git a/lab-js/FOLDER-DESCRIPTION.md b/lab-js/FOLDER-DESCRIPTION.md index 86dcc26..5dbaecc 100644 --- a/lab-js/FOLDER-DESCRIPTION.md +++ b/lab-js/FOLDER-DESCRIPTION.md @@ -10,6 +10,6 @@ Face analysis is split across several modules. `engine.js` owns the primary face Ghostyle execution is handled by `ghostyles-manager.js` for 2D plugin loading and by `plugins3d-loader.js` plus `ghostyle3d-uv-renderer.js` for UV/3D rendering. `utils.js` supplies geometry, canvas, logging, and public helper functions exposed to plugin authors through `window.gstmxx`. `Ghostmaxxing.d.ts` documents that public API for editor support. -Standalone page scripts include `loader.js` for repeatable MP4/video fixture analysis, `mobile-ui.js` for mobile drawer/fullscreen controls, `lab-ui.js` for shared lab-page UI wiring, `export-makeup.js` for PNG clipboard/share export, and `upload-consent.js` for the local clip consent and receipt flow. +Standalone page scripts include `loader.js` for the seekable local-video report UI, with its analysis core in `video-loader/`; `mobile-ui.js` for mobile drawer/fullscreen controls; `lab-ui.js` for shared lab-page UI wiring; `export-makeup.js` for PNG clipboard/share export; and `upload-consent.js` for the local clip consent and receipt flow. `lab-js/i18n.js` is intentionally excluded from code2prompt output. It is the runtime localization catalog containing the English baseline plus Italian and Portuguese translations. The project has localization support via `initI18n()`, `applyI18n()`, and `setupLocaleSelect()`, with the selected locale stored in `localStorage` under `ghostmaxxing-locale`; the message catalog itself is omitted from prompt uploads by policy. diff --git a/lab-js/loader.js b/lab-js/loader.js index 346ca77..9523919 100644 --- a/lab-js/loader.js +++ b/lab-js/loader.js @@ -1,630 +1,1075 @@ -import { state } from './state.js'; -import { loadDb, loadDb3d, renderDbStats } from './db.js'; -import { detectFaceInCam, saveFace, seekFaceInDb } from './engine.js'; -import { cosineSimilarity, getFaceEmbedding, loadMobileNet, saveFace3d } from './engine-3d.js'; -import { MODEL_URLS, DETECTOR_OPTIONS } from './config.js'; -import { els, setStatus, clearOverlay } from './dom.js'; -import { resizeCanvas } from './camera.js'; -import { distance, setLog } from './utils.js'; -import { applyI18n, initI18n, setupLocaleSelect, t } from './i18n.js'; -import { captureThumbnail, saveThumbnail } from './face-thumbnails.js'; - -const fileInput = document.getElementById('videoFile'); -const seekInput = document.getElementById('videoSeek'); -const currentTimeLabel = document.getElementById('currentTimeLabel'); -const durationLabel = document.getElementById('durationLabel'); -const recordFaceBtn = document.getElementById('recordFaceBtn'); -const seekFaceBtn = document.getElementById('seekFaceBtn'); -const loaderLog = document.getElementById('loaderLog'); - -let objectUrl = null; -let entryCounter = 0; -let modelsReady = false; -let actionInFlight = false; -let currentStatus = { kind: 'init', key: 'loader_loading_models_status' }; +/** + * @module loader + * @description + * User-interface adapter for the seekable Video Loader. This page analyses + * existing local videos only; live camera assistance belongs to realtime.html. + * The model pipeline and the serialisable session live in dedicated modules so + * Playwright can drive exactly the same behaviour as a person using the page. + */ + +import { applyI18n, initI18n, setupLocaleSelect } from './i18n.js'; +import { createVideoAnalysisController } from './video-loader/controller.js'; +import { + applyEditorialCommand, + redoEditorialCommand, + undoEditorialCommand, +} from './video-loader/session.js'; + +const elements = { + file: document.getElementById('videoFile'), + video: document.getElementById('video'), + viewer: document.getElementById('viewer'), + viewerLock: document.getElementById('analysisLockNotice'), + sourceControls: document.querySelector('.loader-source-controls'), + analysisSettings: document.getElementById('analysisSettings'), + sourceFileAction: document.getElementById('sourceFileAction'), + sourceFileName: document.getElementById('sourceFileName'), + sourceFileMeta: document.getElementById('sourceFileMeta'), + placeholder: document.getElementById('placeholder'), + seek: document.getElementById('videoSeek'), + currentTime: document.getElementById('currentTimeLabel'), + duration: document.getElementById('durationLabel'), + statusDot: document.getElementById('statusDot'), + statusText: document.getElementById('statusText'), + start: document.getElementById('startAnalysisBtn'), + cancel: document.getElementById('cancelAnalysisBtn'), + sampleInterval: document.getElementById('sampleInterval'), + selectBase: document.getElementById('selectBaseBtn'), + selectedBaseLabel: document.getElementById('selectedBaseLabel'), + analyzeFrame: document.getElementById('analyzeFrameBtn'), + progress: document.getElementById('analysisProgress'), + progressLabel: document.getElementById('analysisProgressLabel'), + analysisMessage: document.getElementById('analysisMessage'), + analysisMessageTitle: document.getElementById('analysisMessageTitle'), + analysisMessageBody: document.getElementById('analysisMessageBody'), + baselineSummary: document.getElementById('baselineSummary'), + timeline: document.getElementById('analysisTimeline'), + eventList: document.getElementById('eventList'), + emptyReport: document.getElementById('emptyReport'), + reportSummary: document.getElementById('reportSummary'), + downloadReport: document.getElementById('downloadReportBtn'), + downloadLog: document.getElementById('downloadLogBtn'), + undo: document.getElementById('undoEditBtn'), + redo: document.getElementById('redoEditBtn'), +}; + +const controller = createVideoAnalysisController(elements.video); +let pendingSourceMetadata = {}; +let sourceLoaded = false; +let analysisRunning = false; +let selectedBaseTime = null; +let lastProgressState = { scanSampleIndex: 0, scanSampleTotal: null, mediaTime: null }; /** - * Runtime bridge used by diagnostic overlays, tests, and loader-adjacent tools. + * Formats a media timestamp as `mm:ss.mmm` or `hh:mm:ss.mmm`. * - * @type {object} + * @param {number} seconds Media timestamp in seconds. + * @returns {string} Human-readable timestamp. */ -window.gstmxx = { - /** - * Writes a message into the shared loader log. - * - * @param {string} message Message to display. - * @param {string} sourcePlugin Source label for the log entry. - * @returns {void} - */ - log: (message, sourcePlugin) => setLog(message, sourcePlugin), - events: state.gstmxxEvents, - /** - * Returns a defensive copy of the 2D face archive. - * - * @returns {object} Cloned 2D face database state. - */ - getDb: () => structuredClone(state.db), - /** - * Returns a defensive copy of the 3D face archive. - * - * @returns {object} Cloned 3D face database state. - */ - getDb3d: () => structuredClone(state.db3d), - /** - * Returns the active 2D effect tracked by shared state. - * - * @returns {*} Active effect metadata, or null when no effect is active. - */ - getActiveEffect: () => state.activeEffect, - /** - * Returns the last known 2D detection result. - * - * @returns {*} Last face-api detection result, or null when unavailable. - */ - getLastResult: () => state.lastKnownEffectResult, - /** - * Returns the active 2D match threshold. - * - * @returns {number} 2D descriptor distance threshold. - */ - getMatchThreshold: () => state.MATCH_THRESHOLD, - /** - * Returns the active 3D match threshold. - * - * @returns {number} 3D embedding similarity threshold. - */ - getMatchThreshold3d: () => state.MATCH_THRESHOLD_3D, - /** - * Reports that the standalone loader has no active 3D Ghostyle effect. - * - * @returns {null} Always null in the MP4 loader. - */ - getActiveEffect3d: () => null, - detectorOptions: DETECTOR_OPTIONS, - get lastLandmarks3d() { return state.lastLandmarks3d; }, - set lastLandmarks3d(v) { state.lastLandmarks3d = v; }, -}; +function formatMediaTime(seconds) { + if (!Number.isFinite(seconds)) return '00:00.000'; + const hours = Math.floor(seconds / 3600); + const minutes = Math.floor((seconds % 3600) / 60); + const rest = seconds % 60; + const prefix = hours ? `${String(hours).padStart(2, '0')}:` : ''; + return `${prefix}${String(minutes).padStart(2, '0')}:${rest.toFixed(3).padStart(6, '0')}`; +} /** - * Updates the loader status label from a translation key and remembers the - * active status so it can be refreshed after a locale change. + * Formats source byte size for the compact file identity line. * - * @param {string} kind Status class hint passed to the shared status widget. - * @param {string} key Translation key for the status text. - * @returns {void} + * @param {number} bytes Source file size. + * @returns {string} Human-readable binary size. */ -function setLoaderStatus(kind, key) { - currentStatus = { kind, key }; - setStatus(kind, t(key)); +function formatFileSize(bytes) { + if (!Number.isFinite(bytes) || bytes < 0) return 'unknown size'; + const units = ['B', 'KiB', 'MiB', 'GiB']; + let value = bytes; + let unitIndex = 0; + while (value >= 1024 && unitIndex < units.length - 1) { + value /= 1024; + unitIndex += 1; + } + return `${value.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`; } /** - * Formats a floating-point video timestamp as `mm:ss.mmm`. + * Shows or clears the persistent analysis notice beside the run controls. * - * @param {number} seconds Video time in seconds. - * @returns {string} Zero-padded display time. + * @param {'error'|'success'|null} kind Notice kind, or null to clear it. + * @param {string} [title] Short notice heading. + * @param {string} [body] Actionable explanation. + * @returns {void} */ -function formatVideoTime(seconds) { - if (!Number.isFinite(seconds)) return '00:00.000'; - const minutes = Math.floor(seconds / 60); - const rest = seconds - minutes * 60; - return `${String(minutes).padStart(2, '0')}:${rest.toFixed(3).padStart(6, '0')}`; +function renderAnalysisMessage(kind, title = '', body = '') { + elements.analysisMessage.hidden = kind === null; + if (kind === null) { + elements.analysisMessage.removeAttribute('data-kind'); + elements.analysisMessageTitle.textContent = ''; + elements.analysisMessageBody.textContent = ''; + return; + } + elements.analysisMessage.dataset.kind = kind; + elements.analysisMessageTitle.textContent = title; + elements.analysisMessageBody.textContent = body; } /** - * Reads the current video playhead, duration, percentage, and display label. + * Converts a stable controller failure reason into baseline guidance that can + * be understood without reading the technical log. * - * @returns {{current: number, duration: number, percent: number, label: string}} Current timeline position. + * @param {object} update Controller failure update. + * @returns {{title: string, body: string}} Visible baseline diagnostic. */ -function currentPosition() { - const current = els.video.currentTime || 0; - const duration = Number.isFinite(els.video.duration) ? els.video.duration : 0; - const percent = duration > 0 ? (current / duration) * 100 : 0; +function baselineFailureCopy(update) { + const time = formatMediaTime(update.baselineTime); + if (update.reason === 'selected-frame-neighbours-insufficient') { + const windowSeconds = Math.max(0, update.baselineSearchEnd - update.baselineTime).toFixed(1); + return { + title: `Baseline not created at ${time}`, + body: `The selected frame may be usable, but only ${update.acceptedEmbeddings} of ${update.requiredEmbeddings} comparable nearby frames were found within ${windowSeconds} seconds. Rapid pose, hand, crop, or makeup changes prevented stable local calibration. Select a steadier moment and retry. Makeup already being present is not itself an error.`, + }; + } + if (update.reason === 'selected-frame-is-not-comparable') { + return { + title: `Baseline frame is not comparable at ${time}`, + body: 'MediaPipe could not produce a usable aligned face crop. Select a frame with the complete face visible, sufficiently large, evenly exposed, and closer to a frontal pose.', + }; + } + if (update.reason === 'face-api-could-not-describe-the-selected-frame') { + return { + title: `No face-api reference at ${time}`, + body: 'MediaPipe found usable face geometry, but face-api could not create a descriptor for the selected frame. Select a clearer frame with less occlusion or motion and retry.', + }; + } + if (update.reason === 'selected-frame-descriptors-insufficient') { + return { + title: `Not enough face-api references near ${time}`, + body: `MediaPipe calibration succeeded, but only ${update.acceptedDescriptors} of ${update.requiredDescriptors} nearby frames returned a face-api descriptor. The selected frame may be usable; choose an interval with a clearer, less occluded face and retry.`, + }; + } + if (update.reason === 'selected-frame-descriptors-are-not-stable') { + return { + title: `Baseline readings are unstable at ${time}`, + body: 'Nearby face-api descriptors varied too much to define one trustworthy reference. Select a steadier interval and retry.', + }; + } return { - current, - duration, - percent, - label: `${formatVideoTime(current)} / ${formatVideoTime(duration)} (${percent.toFixed(2)}%)`, + title: `Baseline not created at ${time}`, + body: 'The selected point did not provide enough stable, comparable face observations. Choose a clearer and steadier moment; the technical log retains the precise rejection reasons.', }; } /** - * Enables or disables face actions based on model, video, and lock state. + * Seeks the source player from report evidence when analysis is idle. During + * analysis the controller owns media time, so evidence links remain disabled. * - * @param {boolean} enabled Whether the caller wants actions to be available. + * @param {number} mediaTime Source timestamp. * @returns {void} */ -function setActionButtonsEnabled(enabled) { - const ready = enabled && modelsReady && els.video.readyState >= 2 && !actionInFlight; - recordFaceBtn.disabled = !ready; - seekFaceBtn.disabled = !ready; +function seekToMediaTime(mediaTime) { + if (analysisRunning || !sourceLoaded) return; + elements.video.pause(); + elements.video.currentTime = Math.max(0, Math.min(elements.video.duration || mediaTime, mediaTime)); + syncVideoTimeline(); } /** - * Synchronizes timeline labels and the seek input with the video element. + * Creates a timestamp that acts as a source-video seek control. * - * @returns {void} + * @param {number} mediaTime Source timestamp. + * @param {string} [extraClass] Optional presentation class. + * @returns {HTMLButtonElement} Clickable media-time control. */ -function updateTimelineFromVideo() { - const position = currentPosition(); - currentTimeLabel.textContent = formatVideoTime(position.current); - durationLabel.textContent = formatVideoTime(position.duration); - if (!seekInput.matches(':active')) seekInput.value = String(position.current); +function createMediaTimeButton(mediaTime, extraClass = '') { + const button = document.createElement('button'); + button.type = 'button'; + button.className = `loader-time-link ${extraClass}`.trim(); + button.dataset.mediaTime = String(mediaTime); + button.textContent = formatMediaTime(mediaTime); + button.setAttribute('aria-label', `Show source video at ${formatMediaTime(mediaTime)}`); + button.disabled = analysisRunning; + button.addEventListener('click', () => seekToMediaTime(mediaTime)); + return button; } /** - * Resizes all diagnostic overlay canvases to match the active video surface. + * Renders baseline calibration or scan-sample progress without pretending + * that browser media time is a reliable encoded-frame number. * + * @param {object} update Controller update. * @returns {void} */ -function syncCanvasSize() { - resizeCanvas(); - for (const canvas of [document.getElementById('mesh3dOverlay'), document.getElementById('bboxOverlay')]) { - if (!canvas) continue; - canvas.width = els.overlay.width; - canvas.height = els.overlay.height; +function renderAnalysisProgress(update) { + if (update.phase === 'baseline') { + const accepted = update.baselineAcceptedSamples ?? 0; + const required = update.baselineRequiredSamples ?? 0; + const acceptedDescriptors = update.baselineAcceptedDescriptors ?? 0; + const requiredDescriptors = update.baselineRequiredDescriptors ?? 0; + const descriptorStage = required > 0 && accepted >= required; + elements.progress.max = Math.max(1, descriptorStage ? requiredDescriptors : required); + elements.progress.value = descriptorStage ? acceptedDescriptors : Math.min(accepted, required); + elements.progressLabel.textContent = descriptorStage + ? `baseline face-api ${acceptedDescriptors} / ${requiredDescriptors}` + : `baseline MediaPipe ${accepted} / ${required}`; + return; + } + + const index = update.scanSampleIndex ?? lastProgressState.scanSampleIndex; + const total = update.scanSampleTotal ?? lastProgressState.scanSampleTotal; + const mediaTime = update.mediaTime ?? update.sample?.mediaTime ?? lastProgressState.mediaTime; + lastProgressState = { scanSampleIndex: index, scanSampleTotal: total, mediaTime }; + elements.progress.max = Math.max(1, total || 1); + elements.progress.value = Math.min(index, total || index); + const percentage = Math.max(0, Math.min(100, Math.round((update.progress ?? 0) * 100))); + const count = total ? `${index} / ${total} samples` : `${index} samples`; + if (update.type === 'analysis-cancelled') { + elements.progressLabel.textContent = `${count} · paused at ${formatMediaTime(mediaTime)}`; + } else if (update.type === 'analysis-complete') { + elements.progressLabel.textContent = `${count} · complete`; + } else { + elements.progressLabel.textContent = `${count} · ${percentage}%`; } } /** - * Captures the current video frame plus diagnostic overlays into a canvas. + * Updates the visible application status. * - * @returns {HTMLCanvasElement} Snapshot canvas used in activity-log entries. + * @param {'init'|'ready'|'working'|'error'} kind Status kind. + * @param {string} message Human-readable status. + * @returns {void} */ -function snapshotCanvas() { - const canvas = document.createElement('canvas'); - const width = els.video.videoWidth || els.overlay.width || 1280; - const height = els.video.videoHeight || els.overlay.height || 720; - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext('2d'); - ctx.fillStyle = '#050505'; - ctx.fillRect(0, 0, width, height); - try { - ctx.drawImage(els.video, 0, 0, width, height); - if (els.overlay.width && els.overlay.height) ctx.drawImage(els.overlay, 0, 0, width, height); - const bbox = document.getElementById('bboxOverlay'); - if (bbox?.width && bbox?.height) ctx.drawImage(bbox, 0, 0, width, height); - } catch (err) { - ctx.fillStyle = '#ffe7a8'; - ctx.font = '700 24px system-ui, sans-serif'; - ctx.fillText(err.message || String(err), 24, 48); - } - return canvas; +function setStatus(kind, message) { + elements.statusDot.className = 'status-dot'; + if (kind === 'ready') elements.statusDot.classList.add('live'); + if (kind === 'working') elements.statusDot.classList.add('working'); + if (kind === 'error') elements.statusDot.classList.add('error'); + elements.statusText.textContent = message; } /** - * Captures and persists the same saved-face preview used by lab.html's history - * drawer. The loader already has the successful face-api result, so reuse its - * box instead of running a second detection pass. + * Dispatches a stable browser event consumed by Playwright and optional tools. * - * @param {number} id Saved face id shared by the 2D and 3D stores. - * @param {*} result face-api detection result returned by saveFace(). - * @returns {Promise} Whether a thumbnail was saved. + * @param {string} type Event suffix. + * @param {object} [detail={}] Serializable detail. + * @returns {void} */ -async function saveFacePreview(id, result) { - const box = result?.detection?.box; - if (!box) return false; +function dispatchLoaderEvent(type, detail = {}) { + window.dispatchEvent(new CustomEvent(`gstmxx-video-loader:${type}`, { detail })); +} - try { - const dataUrl = await captureThumbnail(els.video, box); - if (!dataUrl) return false; - saveThumbnail(id, dataUrl); - return true; - } catch (err) { - setLog(t('thumbnail_capture_failed_log', { message: err.message || String(err) }), 'thumbnails'); - return false; +/** + * Starts a browser download without coupling the report and technical log. + * + * @param {string} filename Suggested filename. + * @param {string} contents Text contents. + * @param {string} mimeType MIME type. + * @returns {void} + */ +function downloadText(filename, contents, mimeType) { + const url = URL.createObjectURL(new Blob([contents], { type: mimeType })); + const anchor = document.createElement('a'); + anchor.href = url; + anchor.download = filename; + anchor.click(); + window.setTimeout(() => URL.revokeObjectURL(url), 0); +} + +/** + * Downloads a selected evidence frame from its data URL. + * + * @param {string} filename Suggested filename. + * @param {string} dataUrl JPEG data URL. + * @returns {void} + */ +function downloadFrame(filename, dataUrl) { + const anchor = document.createElement('a'); + anchor.href = dataUrl; + anchor.download = filename; + anchor.click(); +} + +/** + * Synchronises video labels and the manual seek control. + * + * @returns {void} + */ +function syncVideoTimeline() { + const duration = Number.isFinite(elements.video.duration) ? elements.video.duration : 0; + elements.currentTime.textContent = formatMediaTime(elements.video.currentTime); + elements.duration.textContent = formatMediaTime(duration); + elements.seek.max = String(duration); + if (!elements.seek.matches(':active')) elements.seek.value = String(elements.video.currentTime || 0); + elements.analyzeFrame.textContent = `Analyse frame at ${formatMediaTime(elements.video.currentTime || 0)}`; + renderBaseSelection(); +} + +/** + * Shows the current scrub position as an explicit baseline action and keeps + * the already selected reference visible while the person reviews the video. + * + * @returns {void} + */ +function renderBaseSelection() { + const currentTime = Number(elements.video.currentTime) || 0; + const currentLabel = formatMediaTime(currentTime); + if (selectedBaseTime === null) { + elements.selectBase.textContent = `Select base at ${currentLabel}`; + elements.selectedBaseLabel.textContent = 'No base selected. Scrub the video, then select the displayed frame.'; + return; } + + const selectedLabel = formatMediaTime(selectedBaseTime); + const isAtSelectedFrame = Math.abs(currentTime - selectedBaseTime) < 0.001; + elements.selectBase.textContent = isAtSelectedFrame + ? `Base selected at ${selectedLabel}` + : `Replace base with ${currentLabel}`; + elements.selectedBaseLabel.textContent = `Distance reference selected at ${selectedLabel}. It will be the first evidence-story entry.`; } /** - * Appends a compact metadata chip to an activity-log container. + * Selects the currently displayed video position as the exact computational + * and visual baseline. Nearby frames may calibrate noise but cannot replace + * the selected source timestamp. * - * @param {HTMLElement} parent Element that receives the chip. - * @param {string} label Chip label. - * @param {*} value Chip value rendered as text. * @returns {void} */ -function appendChip(parent, label, value) { - const chip = document.createElement('span'); - chip.className = 'loader-chip'; - chip.textContent = `${label}: ${value}`; - parent.appendChild(chip); +function selectCurrentBase() { + selectedBaseTime = Number(elements.video.currentTime) || 0; + renderAnalysisMessage(null); + renderBaseSelection(); + syncControls(); } /** - * Prepends a diagnostic activity entry with snapshot, summary chips, and JSON details. + * Draws three separate evidence lanes: MediaPipe presence, ImageEmbedder drift, + * and sparse face-api distances. Values from different models are never + * merged into one scale. * - * @param {string} kind Human-readable action name. - * @param {HTMLCanvasElement} snapshot Canvas snapshot for the entry. - * @param {{position: object, metrics: Object.}} summary Position and headline metrics. - * @param {*} details Structured details rendered in the entry body. + * @param {object|null} session Current analysis session. * @returns {void} */ -function appendEntry(kind, snapshot, summary, details) { - entryCounter += 1; - const entry = document.createElement('article'); - entry.className = 'loader-entry'; +function drawTimeline(session) { + const canvas = elements.timeline; + const context = canvas.getContext('2d'); + if (!context || typeof context.setTransform !== 'function') return; + const cssWidth = Math.max(320, canvas.clientWidth || 960); + const cssHeight = 210; + const ratio = window.devicePixelRatio || 1; + canvas.width = Math.round(cssWidth * ratio); + canvas.height = Math.round(cssHeight * ratio); + context.setTransform(ratio, 0, 0, ratio, 0, 0); + context.clearRect(0, 0, cssWidth, cssHeight); + context.fillStyle = '#17130f'; + context.fillRect(0, 0, cssWidth, cssHeight); - entry.appendChild(snapshot); + const left = 150; + const right = 14; + const plotWidth = cssWidth - left - right; + const rangeStart = session?.config?.analysisRange?.start ?? 0; + const rangeEnd = session?.config?.analysisRange?.end ?? session?.source?.duration ?? 1; + const duration = Math.max(0.001, rangeEnd - rangeStart); + const x = (mediaTime) => left + ((mediaTime - rangeStart) / duration) * plotWidth; + const lanes = { + presence: { top: 18, height: 34, label: 'MediaPipe coverage' }, + drift: { top: 74, height: 50, label: 'ImageEmbedder drift' }, + face: { top: 146, height: 48, label: 'face-api L2' }, + }; - const body = document.createElement('div'); - body.className = 'loader-entry__body'; + context.font = '700 11px ui-monospace, monospace'; + context.textBaseline = 'middle'; + for (const lane of Object.values(lanes)) { + context.fillStyle = '#b8aa96'; + context.fillText(lane.label, 10, lane.top + lane.height / 2); + context.strokeStyle = 'rgba(255, 231, 168, 0.12)'; + context.strokeRect(left, lane.top, plotWidth, lane.height); + } + if (!session?.samples?.length) return; + const timelineSamples = session.samples + .filter((sample) => sample.phase !== 'baseline') + .sort((leftSample, rightSample) => leftSample.mediaTime - rightSample.mediaTime); + if (!timelineSamples.length) return; + + const threshold = session.baseline?.visualTriggerThreshold || 0.1; + const driftMax = Math.max(0.1, threshold * 3, ...timelineSamples.map((sample) => sample.visualDrift || 0)); + context.lineWidth = 2; + context.strokeStyle = '#7fe3b0'; + context.beginPath(); + timelineSamples.forEach((sample, index) => { + const px = x(sample.mediaTime); + const py = lanes.presence.top + (sample.comparable + ? 7 + : sample.facePresent ? lanes.presence.height / 2 : lanes.presence.height - 7); + if (index === 0) context.moveTo(px, py); + else context.lineTo(px, py); + }); + context.stroke(); + for (const sample of timelineSamples) { + context.fillStyle = sample.comparable ? '#7fe3b0' : sample.facePresent ? '#f3c747' : '#756b60'; + const py = lanes.presence.top + (sample.comparable + ? 7 + : sample.facePresent ? lanes.presence.height / 2 : lanes.presence.height - 7); + context.beginPath(); + context.arc(x(sample.mediaTime), py, 2.25, 0, Math.PI * 2); + context.fill(); + } + context.strokeStyle = '#f3c747'; + context.beginPath(); + let started = false; + for (const sample of timelineSamples) { + if (sample.visualDrift === null) { + started = false; + continue; + } + const px = x(sample.mediaTime); + const py = lanes.drift.top + lanes.drift.height - (sample.visualDrift / driftMax) * lanes.drift.height; + if (!started) context.moveTo(px, py); + else context.lineTo(px, py); + started = true; + } + context.stroke(); + + if (session.baseline) { + const thresholdY = lanes.drift.top + lanes.drift.height + - (session.baseline.visualTriggerThreshold / driftMax) * lanes.drift.height; + context.strokeStyle = 'rgba(243, 199, 71, 0.65)'; + context.setLineDash([4, 4]); + context.beginPath(); + context.moveTo(left, thresholdY); + context.lineTo(left + plotWidth, thresholdY); + context.stroke(); + context.setLineDash([]); + context.fillStyle = '#d8c9b5'; + context.font = '700 9px ui-monospace, monospace'; + context.textAlign = 'right'; + context.fillText( + `trigger ${session.baseline.visualTriggerThreshold.toFixed(4)}`, + left + plotWidth - 6, + thresholdY - 7, + ); + context.textAlign = 'left'; + } + + const faceApiEntries = session.journal.filter((entry) => entry.type === 'face-api-result'); + const numericFaceDistances = faceApiEntries + .map((entry) => entry.faceDistance) + .filter(Number.isFinite); + const faceThreshold = session.config?.faceDistanceThreshold ?? 0.6; + const faceMax = Math.max(0.8, faceThreshold * 1.25, ...numericFaceDistances.map((value) => value * 1.1)); + context.fillStyle = '#ff8e72'; + for (const entry of faceApiEntries) { + const px = x(entry.mediaTime); + if (Number.isFinite(entry.faceDistance)) { + const py = lanes.face.top + lanes.face.height - (entry.faceDistance / faceMax) * lanes.face.height; + context.beginPath(); + context.arc(px, py, 3.5, 0, Math.PI * 2); + context.fill(); + } else { + const py = lanes.face.top + 7; + context.strokeStyle = '#ff8e72'; + context.lineWidth = 1.6; + context.beginPath(); + context.moveTo(px - 3, py - 3); + context.lineTo(px + 3, py + 3); + context.moveTo(px + 3, py - 3); + context.lineTo(px - 3, py + 3); + context.stroke(); + } + } + const faceThresholdY = lanes.face.top + lanes.face.height - (faceThreshold / faceMax) * lanes.face.height; + context.strokeStyle = 'rgba(255, 142, 114, 0.7)'; + context.setLineDash([4, 4]); + context.beginPath(); + context.moveTo(left, faceThresholdY); + context.lineTo(left + plotWidth, faceThresholdY); + context.stroke(); + context.setLineDash([]); + context.fillStyle = '#d8c9b5'; + context.font = '700 9px ui-monospace, monospace'; + context.textAlign = 'right'; + context.fillText('× no 2D face', left + plotWidth - 6, faceThresholdY - 7); + context.fillText(`threshold ${faceThreshold.toFixed(4)}`, left + plotWidth - 6, faceThresholdY + 12); + context.textAlign = 'left'; +} + +/** + * Builds one editable evidence card. + * + * @param {object} event Session evidence event. + * @param {object} session Current session. + * @returns {HTMLElement} Event card. + */ +function createEventCard(event, session) { + const card = document.createElement('article'); + card.className = [ + 'loader-event', + `loader-event--${event.status}`, + event.origin === 'manual' ? 'loader-event--manual' : '', + ].filter(Boolean).join(' '); + card.dataset.eventId = event.id; + + if (event.selectedFrame) { + const image = document.createElement('img'); + image.src = event.selectedFrame.dataUrl; + image.alt = `Selected video frame at ${formatMediaTime(event.selectedFrame.mediaTime)}`; + card.appendChild(image); + } + + const body = document.createElement('div'); + body.className = 'loader-event__body'; const title = document.createElement('h3'); - title.textContent = `#${entryCounter} ${kind}`; + const eventLabel = event.classification === 'manual-frame-check' + ? 'Manual frame check' + : event.classification === 'identity-distance' + ? 'Identity-distance transition' + : event.classification === 'detector-divergence' + ? 'Detector divergence — review' + : event.status === 'confirmed' ? 'Mixed transition — review' : 'Candidate'; + title.append(`${eventLabel} · `, createMediaTimeButton(event.anchorMediaTime)); body.appendChild(title); - const meta = document.createElement('div'); - meta.className = 'loader-entry__meta'; - appendChip(meta, t('loader_chip_pressed'), new Date().toLocaleString()); - appendChip(meta, t('loader_chip_video'), summary.position.label); - body.appendChild(meta); - - const metrics = document.createElement('div'); - metrics.className = 'loader-entry__metrics'; - for (const [label, value] of Object.entries(summary.metrics)) appendChip(metrics, label, value); + const best = event.observations.at(-1); + const metrics = document.createElement('p'); + metrics.className = 'loader-event__metrics'; + metrics.textContent = [ + best?.faceDistance === null ? 'face-api: no face' : `face-api: ${best?.faceDistance?.toFixed(4) ?? 'n/a'}`, + best?.visualDrift === null ? 'ImageEmbedder drift: n/a' : `ImageEmbedder drift: ${best.visualDrift.toFixed(4)}`, + ].join(' · '); body.appendChild(metrics); - const pre = document.createElement('pre'); - pre.textContent = JSON.stringify(details, null, 2); - body.appendChild(pre); + const reasons = document.createElement('p'); + reasons.className = 'loader-event__reasons'; + reasons.textContent = event.origin === 'manual' + ? 'Requested manually from the source position. This is one explicit check, not a repeated automatic transition.' + : `Trigger: ${(best?.reasons || []).join(', ') || 'verification'}`; + body.appendChild(reasons); - entry.appendChild(body); - loaderLog.prepend(entry); + if (event.origin === 'manual') { + const interpretation = document.createElement('p'); + interpretation.className = 'loader-event__warning'; + interpretation.textContent = event.interpretation === 'above-threshold' + ? `The face-api distance is at or above the ${(best?.faceThreshold ?? 0.6).toFixed(4)} threshold.` + : event.interpretation === 'below-threshold' + ? `The face-api distance is below the ${(best?.faceThreshold ?? 0.6).toFixed(4)} threshold.` + : event.interpretation === 'no-2d-face' + ? 'MediaPipe retained a comparable crop, but face-api returned no 2D face.' + : 'This frame did not meet MediaPipe comparability limits; any face-api value is shown only as diagnostic context.'; + body.appendChild(interpretation); + } + + const caption = document.createElement('textarea'); + caption.value = event.caption; + caption.placeholder = 'Explain why this before/after moment matters…'; + caption.setAttribute('aria-label', 'Event caption'); + caption.addEventListener('change', () => { + applyEditorialCommand(session, { type: 'caption', eventId: event.id, value: caption.value }); + renderSession(session); + }); + body.appendChild(caption); + + const actions = document.createElement('div'); + actions.className = 'loader-event__actions'; + appendStoryOrderButtons(actions, event.id, session); + const promote = document.createElement('button'); + promote.type = 'button'; + promote.textContent = event.promoted ? 'Selected for story' : 'Select for story'; + promote.disabled = event.promoted; + promote.addEventListener('click', () => { + applyEditorialCommand(session, { type: 'promote', eventId: event.id }); + renderSession(session); + }); + actions.appendChild(promote); + + const reject = document.createElement('button'); + reject.type = 'button'; + reject.textContent = 'Reject'; + reject.addEventListener('click', () => { + applyEditorialCommand(session, { type: 'reject', eventId: event.id }); + renderSession(session); + }); + actions.appendChild(reject); + + if (event.selectedFrame) { + const save = document.createElement('button'); + save.type = 'button'; + save.textContent = 'Download frame'; + save.addEventListener('click', () => downloadFrame( + `ghostmaxxing-${formatMediaTime(event.selectedFrame.mediaTime).replaceAll(':', '-')}.jpg`, + event.selectedFrame.dataUrl, + )); + actions.appendChild(save); + } + body.appendChild(actions); + card.appendChild(body); + return card; } /** - * Extracts stable 2D and 3D face-detection details for logging. + * Returns report items in human-controlled story order. Source timestamps are + * never changed by an editorial move. * - * @param {*} result face-api detection result. - * @returns {object} Serializable face summary. + * @param {object} session Current session. + * @returns {Array<{id: string, kind: 'baseline'|'event', value: object}>} Ordered items. */ -function summarizeFace(result) { - const landmarks = result?.landmarks; - const box = result?.detection?.box; - return { - detectionScore: result?.detection?.score ?? null, - descriptorLength: result?.descriptor?.length ?? 0, - landmarks2d: landmarks?.positions?.length ?? landmarks?.getPositions?.()?.length ?? 0, - age: Number.isFinite(result?.age) ? Math.round(result.age) : null, - gender: result?.gender || null, - genderProbability: Number.isFinite(result?.genderProbability) ? result.genderProbability : null, - box: box ? { - x: Math.round(box.x), - y: Math.round(box.y), - width: Math.round(box.width), - height: Math.round(box.height), - } : null, - landmarks3d: Array.isArray(state.lastLandmarks3d) ? state.lastLandmarks3d.length : 0, - }; +function orderedStoryItems(session) { + if (!session) return []; + const events = new Map(session.events + .filter((event) => event.status === 'confirmed') + .map((event) => [event.id, event])); + const ordered = []; + for (const id of session.editorial.storyOrder) { + if (id === 'baseline' && session.baseline) { + ordered.push({ id, kind: 'baseline', value: session.baseline }); + } else if (events.has(id)) { + ordered.push({ id, kind: 'event', value: events.get(id) }); + events.delete(id); + } + } + for (const event of events.values()) ordered.push({ id: event.id, kind: 'event', value: event }); + return ordered; } /** - * Computes sorted descriptor distances between a live 2D result and saved faces. + * Adds reversible story-order controls to one evidence card. * - * @param {*} result face-api detection result containing a descriptor. - * @returns {Array} Distances sorted from nearest to farthest. + * @param {HTMLElement} actions Action container. + * @param {string} itemId Event identifier. + * @param {object} session Current session. + * @returns {void} */ -function get2dDistances(result) { - const descriptor = result?.descriptor; - return (state.db?.faces || []).map((face) => { - const faceDistance = distance(descriptor, face.descriptor); - return { - id: face.id, - distance: faceDistance, - threshold: state.MATCH_THRESHOLD, - match: faceDistance <= state.MATCH_THRESHOLD, - }; - }).sort((a, b) => a.distance - b.distance); +function appendStoryOrderButtons(actions, itemId, session) { + const order = orderedStoryItems(session).map((item) => item.id); + const index = order.indexOf(itemId); + const earlier = document.createElement('button'); + earlier.type = 'button'; + earlier.textContent = 'Move earlier'; + earlier.disabled = index <= 0 || order[index - 1] === 'baseline'; + earlier.addEventListener('click', () => { + applyEditorialCommand(session, { type: 'move-earlier', eventId: itemId }); + renderSession(session); + }); + actions.appendChild(earlier); + + const later = document.createElement('button'); + later.type = 'button'; + later.textContent = 'Move later'; + later.disabled = index < 0 || index >= order.length - 1; + later.addEventListener('click', () => { + applyEditorialCommand(session, { type: 'move-later', eventId: itemId }); + renderSession(session); + }); + actions.appendChild(later); } /** - * Computes sorted cosine-similarity matches for a live 3D embedding. + * Builds the pinned computational reference as the first story item. Its + * source timestamp and role in the distance calculation remain unchanged. * - * @param {Float32Array|number[]|null} embedding Live MediaPipe embedding. - * @returns {Array} Matches sorted from highest to lowest similarity. + * @param {object} baseline Session baseline. + * @param {object} session Current session. + * @returns {HTMLElement} Reference card. */ -function get3dDistances(embedding) { - if (!embedding) return []; - return (state.db3d?.faces || []).map((face) => { - const similarity = cosineSimilarity(embedding, face.descriptor3d); - return { - id: face.id, - similarity, - distance: 1 - similarity, - threshold: state.MATCH_THRESHOLD_3D, - match: similarity >= state.MATCH_THRESHOLD_3D, - }; - }).sort((a, b) => b.similarity - a.similarity); +function createBaselineCard(baseline, session) { + const card = document.createElement('article'); + card.className = 'loader-event loader-event--reference'; + card.dataset.eventId = 'baseline'; + + if (baseline.frame) { + const image = document.createElement('img'); + image.src = baseline.frame.dataUrl; + image.alt = `Computational reference frame at ${formatMediaTime(baseline.mediaTime)}`; + card.appendChild(image); + } + + const body = document.createElement('div'); + body.className = 'loader-event__body'; + const title = document.createElement('h3'); + title.append('Baseline · distance reference · ', createMediaTimeButton(baseline.mediaTime)); + body.appendChild(title); + + const metrics = document.createElement('p'); + metrics.className = 'loader-event__metrics'; + metrics.textContent = [ + `ImageEmbedder trigger ${baseline.visualTriggerThreshold.toFixed(4)}`, + `face-api baseline spread ${baseline.faceSpread.toFixed(4)}`, + `face-api decision threshold ${(session.config?.faceDistanceThreshold ?? 0.6).toFixed(4)}`, + ].join(' · '); + body.appendChild(metrics); + + const explanation = document.createElement('p'); + explanation.className = 'loader-event__reasons'; + explanation.textContent = 'This frame anchors the distances and remains the first story entry. Its source timestamp and computational role never change.'; + body.appendChild(explanation); + + if (baseline.faceSpread > (session.config?.maximumBaselineFaceSpread ?? 0.3)) { + const warning = document.createElement('p'); + warning.className = 'loader-event__warning'; + warning.textContent = 'The selected baseline has elevated face-api variation. Treat distances near the decision threshold as review evidence.'; + body.appendChild(warning); + } + + const actions = document.createElement('div'); + actions.className = 'loader-event__actions'; + const save = document.createElement('button'); + save.type = 'button'; + save.textContent = 'Download frame'; + save.addEventListener('click', () => downloadFrame( + `ghostmaxxing-reference-${formatMediaTime(baseline.mediaTime).replaceAll(':', '-')}.jpg`, + baseline.frame.dataUrl, + )); + actions.appendChild(save); + body.appendChild(actions); + card.appendChild(body); + return card; } /** - * Collapses 2D and 3D detection states into the shared overall match state. + * Re-renders report summary, timeline, and evidence cards from session state. * - * @param {?object} faceapiSection 2D match section. - * @param {?object} mediapipeSection 3D match section. - * @returns {string} Overall state used by the readout event bus. + * @param {object|null} session Current analysis session. + * @returns {void} */ -function buildOverall(faceapiSection, mediapipeSection) { - const f = faceapiSection?.detectionState; - const m = mediapipeSection?.detectionState; - if (!f || !m) return 'unknown'; - return f === m ? f : 'partial-elusion'; +function renderSession(session) { + drawTimeline(session); + elements.eventList.replaceChildren(); + const storyItems = orderedStoryItems(session); + elements.emptyReport.hidden = storyItems.length > 0; + for (const item of storyItems) { + elements.eventList.appendChild(item.kind === 'baseline' + ? createBaselineCard(item.value, session) + : createEventCard(item.value, session)); + } + + if (session?.baseline) { + elements.baselineSummary.replaceChildren( + document.createTextNode('Reference '), + createMediaTimeButton(session.baseline.mediaTime, 'loader-time-link--summary'), + document.createTextNode([ + ` · visual trigger ${session.baseline.visualTriggerThreshold.toFixed(4)}`, + `face noise ${session.baseline.faceSpread.toFixed(4)}`, + ].join(' · ')), + ); + } else { + elements.baselineSummary.textContent = 'Distance reference not acquired yet.'; + } + + if (session) { + elements.reportSummary.textContent = [ + `${session.summary.sampledFrames} samples`, + `${session.summary.faceApiRuns} face-api checks`, + `${session.summary.confirmedEvents} confirmed events`, + `${session.summary.manualChecks || 0} manual checks`, + ].join(' · '); + elements.downloadReport.disabled = session.status !== 'complete'; + elements.downloadLog.disabled = session.samples.length === 0; + elements.undo.disabled = session.editorial.undo.length === 0; + elements.redo.disabled = session.editorial.redo.length === 0; + } } /** - * Runs a face action while preventing concurrent Record/Seek operations. + * Compares paused-run settings with the editable UI values. It prevents a + * changed cadence or reference from being presented as a lossless resume. * - * @param {Function} fn Action callback to execute under the lock. - * @returns {Promise} + * @param {object|null} session Current analysis session. + * @param {number} requestedSampleInterval Sampling interval requested by the UI or API. + * @param {number|null} requestedBaselineTime Baseline timestamp requested by the UI or API. + * @returns {{samplingChanged: boolean, baselineChanged: boolean}} Restart reasons. */ -async function withActionLock(fn) { - if (actionInFlight) return; - actionInFlight = true; - setActionButtonsEnabled(false); - try { - await fn(); - } catch (err) { - setLoaderStatus('error', 'loader_status_action_failed'); - appendEntry(t('loader_action_error'), snapshotCanvas(), { - position: currentPosition(), - metrics: { error: err.message || String(err) }, - }, { error: err.stack || err.message || String(err) }); - } finally { - actionInFlight = false; - setActionButtonsEnabled(true); - } +function getPausedSettingsChanges(session, requestedSampleInterval, requestedBaselineTime) { + if (session?.status !== 'cancelled') return { samplingChanged: false, baselineChanged: false }; + const pausedSampleInterval = Number(session.config?.sampleIntervalSeconds); + const pausedBaselineTime = Number( + session.baseline?.selectedMediaTime + ?? session.baseline?.mediaTime + ?? session.config?.baselineSearchStart, + ); + return { + samplingChanged: Number.isFinite(pausedSampleInterval) + && requestedSampleInterval !== pausedSampleInterval, + baselineChanged: requestedBaselineTime !== null + && Number.isFinite(pausedBaselineTime) + && Math.abs(Number(requestedBaselineTime) - pausedBaselineTime) >= 0.001, + }; } /** - * Saves the face visible at the current video frame into the 2D and 3D archives. + * Updates controls after model, file, and analysis state changes. * - * @returns {Promise} + * @returns {void} */ -async function recordFace() { - await withActionLock(async () => { - syncCanvasSize(); - const position = currentPosition(); - const saved2d = await saveFace(); - if (!saved2d) { - appendEntry(t('loader_action_record_face'), snapshotCanvas(), { - position, - metrics: { result: t('loader_no_face_result') }, - }, { message: t('loader_no_2d_face_message') }); - return; - } - - const previewSaved = await saveFacePreview(saved2d.id, saved2d.result); - const saved3d = await saveFace3d(saved2d.id); - const embedding = saved3d ? (state.db3d.faces.find((face) => face.id === saved2d.id)?.descriptor3d || null) : null; - const features = summarizeFace(saved2d.result); - - const faceapiSection = { - detectionState: 'matched', - distance: 0, - matchedId: saved2d.id, - liveMinDist: 0, - liveMinId: saved2d.id, - }; - const mediapipeSection = saved3d ? { - detectionState: 'matched', - similarity: saved3d.liveInfo3d?.liveMaxSim ?? 1, - matchedId: saved2d.id, - liveMaxSim: saved3d.liveInfo3d?.liveMaxSim ?? 1, - liveMaxId: saved2d.id, - } : null; - - state.gstmxxEvents.dispatchEvent(new CustomEvent('detection', { - detail: { result: saved2d.result, activeEffect: null } - })); - state.gstmxxEvents.dispatchEvent(new CustomEvent('matchStateChanged', { - detail: { - source: 'save', - ghostylePresent: false, - faceapi: faceapiSection, - mediapipe: mediapipeSection, - overall: buildOverall(faceapiSection, mediapipeSection), - } - })); - - appendEntry(t('loader_action_record_face'), snapshotCanvas(), { - position, - metrics: { - id: saved2d.id, - '2D score': features.detectionScore?.toFixed(4) ?? 'n/a', - '2D landmarks': features.landmarks2d, - '3D vector': embedding ? embedding.length : 'unavailable', - preview: previewSaved ? 'saved' : 'unavailable', - }, - }, { - action: 'record face', - savedId: saved2d.id, - previewSaved, - video: position, - faceapi: features, - mediapipe: { - saved: !!saved3d, - embeddingLength: embedding ? embedding.length : 0, - selfSimilarity: saved3d?.liveInfo3d?.liveMaxSim ?? null, - }, - }); +function syncControls() { + const session = controller.getSession(); + const resumable = session?.status === 'cancelled'; + const changes = getPausedSettingsChanges( + session, + Number(elements.sampleInterval.value), + selectedBaseTime, + ); + const restartLabel = changes.samplingChanged && changes.baselineChanged + ? 'Restart with new settings' + : changes.samplingChanged + ? 'Restart with new sampling' + : 'Restart with new baseline'; + const restartRequired = changes.samplingChanged || changes.baselineChanged; + elements.start.disabled = !sourceLoaded + || !controller.isModelsReady() + || (!resumable && selectedBaseTime === null) + || analysisRunning; + elements.start.textContent = resumable + ? restartRequired ? restartLabel : 'Resume analysis' + : session?.status === 'complete' + ? 'Analyse again' + : session?.status === 'failed' ? 'Retry analysis' : 'Analyse video'; + elements.cancel.disabled = !analysisRunning; + elements.start.hidden = analysisRunning; + elements.cancel.hidden = !analysisRunning; + elements.file.disabled = analysisRunning; + elements.sampleInterval.disabled = analysisRunning; + elements.selectBase.disabled = !sourceLoaded || analysisRunning; + elements.analyzeFrame.disabled = !sourceLoaded || !session?.baseline || analysisRunning; + elements.seek.disabled = !sourceLoaded || analysisRunning; + elements.video.inert = analysisRunning; + elements.video.setAttribute('aria-disabled', String(analysisRunning)); + elements.viewer.classList.toggle('is-analysis-locked', analysisRunning); + elements.viewerLock.hidden = !analysisRunning; + elements.sourceControls.classList.toggle('is-muted', analysisRunning); + elements.analysisSettings.classList.toggle('is-muted', analysisRunning); + document.querySelectorAll('.loader-time-link').forEach((button) => { + button.disabled = analysisRunning; }); } /** - * Searches the saved 2D and 3D face archives for the face in the current frame. + * Loads the file currently selected in the input. * - * @returns {Promise} + * @returns {Promise} Loaded session, or null when no file exists. */ -async function seekFace() { - await withActionLock(async () => { - syncCanvasSize(); - const position = currentPosition(); - const result = await detectFaceInCam(true); - if (!result) { - appendEntry(t('loader_action_seek_face'), snapshotCanvas(), { - position, - metrics: { result: t('loader_no_face_result') }, - }, { message: t('loader_no_2d_face_message') }); - return; - } - - const liveInfo = seekFaceInDb(result); - const embedding = await getFaceEmbedding(els.video).catch(() => null); - const distances2d = get2dDistances(result); - const distances3d = get3dDistances(embedding); - const best3d = distances3d[0] || null; - - const faceapiSection = { - detectionState: liveInfo.liveMinDist != null && liveInfo.liveMinDist <= state.MATCH_THRESHOLD ? 'matched' : 'eluded', - distance: liveInfo.liveMinDist, - matchedId: liveInfo.liveMinDist != null && liveInfo.liveMinDist <= state.MATCH_THRESHOLD ? liveInfo.liveMinId : null, - liveMinDist: liveInfo.liveMinDist, - liveMinId: liveInfo.liveMinId, - }; - const mediapipeSection = best3d ? { - detectionState: best3d.similarity >= state.MATCH_THRESHOLD_3D ? 'matched' : 'eluded', - similarity: best3d.similarity, - matchedId: best3d.similarity >= state.MATCH_THRESHOLD_3D ? best3d.id : null, - liveMaxSim: best3d.similarity, - liveMaxId: best3d.id, - } : null; - - state.gstmxxEvents.dispatchEvent(new CustomEvent('detection', { - detail: { result, activeEffect: null } - })); - state.gstmxxEvents.dispatchEvent(new CustomEvent('matchStateChanged', { - detail: { - source: 'find', - ghostylePresent: false, - faceapi: faceapiSection, - mediapipe: mediapipeSection, - overall: buildOverall(faceapiSection, mediapipeSection), - } - })); - - appendEntry(t('loader_action_seek_face'), snapshotCanvas(), { - position, - metrics: { - '2D closest': distances2d[0] ? `ID ${distances2d[0].id} / ${distances2d[0].distance.toFixed(4)}` : 'empty DB', - '3D closest': best3d ? `ID ${best3d.id} / ${best3d.similarity.toFixed(4)}` : 'empty DB', - 'faces compared': Math.max(distances2d.length, distances3d.length), - }, - }, { - action: 'seek face', - video: position, - features: summarizeFace(result), - faceapi: { - threshold: state.MATCH_THRESHOLD, - nearest: liveInfo, - distances: distances2d, - }, - mediapipe: { - threshold: state.MATCH_THRESHOLD_3D, - embeddingLength: embedding ? embedding.length : 0, - distances: distances3d, - }, - }); - }); +async function loadSelectedFile() { + const file = elements.file.files?.[0]; + if (!file) return null; + setStatus('working', 'loading video'); + const session = await controller.loadFile(file, pendingSourceMetadata); + pendingSourceMetadata = {}; + sourceLoaded = true; + selectedBaseTime = null; + elements.sourceFileAction.textContent = 'Replace local video'; + elements.sourceFileName.textContent = session.source.name; + elements.sourceFileName.title = session.source.name; + elements.sourceFileMeta.textContent = [ + session.source.width && session.source.height ? `${session.source.width} × ${session.source.height}` : null, + formatMediaTime(session.source.duration), + formatFileSize(session.source.size), + ].filter(Boolean).join(' · '); + renderAnalysisMessage(null); + elements.placeholder.hidden = true; + elements.seek.disabled = false; + syncVideoTimeline(); + renderSession(session); + setStatus('ready', 'ready to analyse'); + syncControls(); + dispatchLoaderEvent('source-loaded', { source: session.source }); + return session; } /** - * Loads face-api model weights and the MediaPipe 3D embedder required by the loader. + * Runs analysis using the currently selected sampling interval. * - * @returns {Promise} + * @param {object} [options] Optional API-provided range and cadence overrides. + * @returns {Promise} Completed session. */ -async function loadModels() { - setLoaderStatus('init', 'loader_status_loading_faceapi'); - await Promise.all([ - faceapi.nets.tinyFaceDetector.loadFromUri(MODEL_URLS.tiny), - faceapi.nets.faceLandmark68Net.loadFromUri(MODEL_URLS.landmarks), - faceapi.nets.faceRecognitionNet.loadFromUri(MODEL_URLS.recognition), - faceapi.nets.ageGenderNet.loadFromUri(MODEL_URLS.ageGender), - ]); - - setLoaderStatus('init', 'loader_status_loading_3d_embedder'); - await loadMobileNet(); +async function startAnalysis(options = {}) { + const currentSession = controller.getSession(); + const requestedSampleInterval = Number(options.sampleIntervalSeconds ?? elements.sampleInterval.value); + const requestedBaselineValue = options.baselineTime ?? selectedBaseTime; + const changes = getPausedSettingsChanges(currentSession, requestedSampleInterval, requestedBaselineValue); + const restartRequired = changes.samplingChanged || changes.baselineChanged; + const resume = options.resume ?? (currentSession?.status === 'cancelled' && !restartRequired); + const baselineWasExplicitlySelected = options.baselineTime !== undefined && options.baselineTime !== null + || selectedBaseTime !== null; + analysisRunning = true; + renderAnalysisMessage(null); + syncControls(); + setStatus('working', resume ? 'resuming analysis' : 'analysing video'); + if (!resume) { + lastProgressState = { scanSampleIndex: 0, scanSampleTotal: null, mediaTime: null }; + elements.progress.max = 1; + elements.progress.value = 0; + elements.progressLabel.textContent = 'building baseline'; + } + try { + const session = await controller.analyze({ + resume, + sampleIntervalSeconds: requestedSampleInterval, + baselineTime: Number(options.baselineTime ?? selectedBaseTime ?? options.start ?? 0), + baselineSelectionMode: options.baselineSelectionMode + ?? (baselineWasExplicitlySelected ? 'anchored' : 'search'), + start: options.start, + end: options.end, + }); + renderSession(session); + setStatus('ready', session.status === 'complete' ? 'analysis complete' : 'analysis paused'); + return session; + } catch (error) { + const failedBaseline = controller.getSession()?.status === 'failed'; + setStatus('error', failedBaseline ? 'baseline not created' : error.message || String(error)); + if (!failedBaseline) { + renderAnalysisMessage('error', 'Analysis stopped', error.message || String(error)); + } + dispatchLoaderEvent('error', { message: error.message || String(error) }); + throw error; + } finally { + analysisRunning = false; + syncControls(); + } } /** - * Wires file input, video timeline, seek, playback, and resize event handlers. + * Runs an explicit comparison for the frame currently shown by the source + * player and adds the result to the editable evidence story. * - * @returns {void} + * @param {number} [mediaTime] Optional timestamp supplied by automation. + * @returns {Promise} Created manual evidence event. */ -function bindVideo() { - fileInput.addEventListener('change', () => { - const file = fileInput.files?.[0]; - if (!file) return; - if (objectUrl) URL.revokeObjectURL(objectUrl); - objectUrl = URL.createObjectURL(file); - clearOverlay(); - els.video.srcObject = null; - els.video.src = objectUrl; - els.video.load(); - els.placeholder.style.display = 'none'; - setLog(t('loader_log_loaded_local_video', { name: file.name }), 'loader'); - }); +async function analyzeCurrentFrame(mediaTime = Number(elements.video.currentTime) || 0) { + analysisRunning = true; + renderAnalysisMessage(null); + syncControls(); + setStatus('working', 'analysing selected frame'); + try { + const event = await controller.analyzeFrame(mediaTime); + renderSession(controller.getSession()); + setStatus('ready', 'manual frame check added'); + return event; + } catch (error) { + setStatus('error', 'frame check failed'); + renderAnalysisMessage('error', 'Frame check failed', error.message || String(error)); + dispatchLoaderEvent('error', { message: error.message || String(error) }); + throw error; + } finally { + analysisRunning = false; + syncControls(); + } +} - els.video.addEventListener('loadedmetadata', () => { - seekInput.max = String(Number.isFinite(els.video.duration) ? els.video.duration : 0); - seekInput.disabled = false; - syncCanvasSize(); - updateTimelineFromVideo(); - setActionButtonsEnabled(true); - }); - els.video.addEventListener('loadeddata', () => { - syncCanvasSize(); - setActionButtonsEnabled(true); - }); - els.video.addEventListener('timeupdate', updateTimelineFromVideo); - els.video.addEventListener('seeked', () => { - syncCanvasSize(); - updateTimelineFromVideo(); +controller.subscribe((update) => { + if (update.type === 'models-ready') { + setStatus(sourceLoaded ? 'ready' : 'init', sourceLoaded ? 'ready to analyse' : 'select a local video'); + syncControls(); + dispatchLoaderEvent('models-ready'); + return; + } + if (update.type === 'sample' || update.type === 'analysis-cancelled' || update.type === 'analysis-complete') { + renderAnalysisProgress(update); + } + if (update.type === 'sample') { + renderSession(update.session); + } + if (update.type === 'analysis-failed') { + const copy = baselineFailureCopy(update); + renderAnalysisMessage('error', copy.title, copy.body); + setStatus('error', 'baseline not created'); + } + if (update.type === 'manual-frame-checked') { + const observation = update.event.observations.at(-1); + const distance = Number.isFinite(observation?.faceDistance) + ? `face-api distance ${observation.faceDistance.toFixed(4)}` + : 'face-api returned no numeric distance'; + renderAnalysisMessage( + 'success', + `Frame added at ${formatMediaTime(update.event.anchorMediaTime)}`, + `${distance}. Review the new manual card in the evidence story.`, + ); + renderSession(update.session); + } + if (update.type === 'baseline-ready' || update.type === 'event-confirmed') { + renderSession(update.session); + syncControls(); + } + dispatchLoaderEvent(update.type, { + progress: update.progress, + eventId: update.event?.id, }); - els.video.addEventListener('play', () => setActionButtonsEnabled(true)); - els.video.addEventListener('pause', () => setActionButtonsEnabled(true)); +}); - seekInput.addEventListener('input', () => { - els.video.currentTime = Number(seekInput.value) || 0; - updateTimelineFromVideo(); - }); +elements.file.addEventListener('change', () => { + loadSelectedFile().catch((error) => setStatus('error', error.message || String(error))); +}); +elements.video.addEventListener('timeupdate', syncVideoTimeline); +elements.video.addEventListener('seeked', syncVideoTimeline); +elements.video.addEventListener('loadedmetadata', syncVideoTimeline); +elements.seek.addEventListener('input', () => { + elements.video.currentTime = Number(elements.seek.value) || 0; + syncVideoTimeline(); +}); +elements.sampleInterval.addEventListener('change', syncControls); +elements.selectBase.addEventListener('click', selectCurrentBase); +elements.start.addEventListener('click', () => startAnalysis().catch(() => {})); +elements.cancel.addEventListener('click', () => controller.cancel()); +elements.analyzeFrame.addEventListener('click', () => analyzeCurrentFrame().catch(() => {})); +elements.undo.addEventListener('click', () => { + const session = controller.getSession(); + if (session && undoEditorialCommand(session)) renderSession(session); +}); +elements.redo.addEventListener('click', () => { + const session = controller.getSession(); + if (session && redoEditorialCommand(session)) renderSession(session); +}); +elements.downloadReport.addEventListener('click', () => { + const bundle = controller.exportBundle(); + downloadText('ghostmaxxing-video-report.json', JSON.stringify(bundle.report, null, 2), 'application/json'); +}); +elements.downloadLog.addEventListener('click', () => { + const bundle = controller.exportBundle(); + downloadText('ghostmaxxing-analysis.ndjson', bundle.technicalLog, 'application/x-ndjson'); +}); - window.addEventListener('resize', syncCanvasSize); -} +/** + * Stable automation API shared by the UI and the Playwright CLI. + * + * @type {object} + */ +window.gstmxxVideoLoader = { + /** @returns {boolean} Whether vendored models are ready. */ + isModelsReady: () => controller.isModelsReady(), + /** @returns {boolean} Whether a source has loaded metadata. */ + isSourceLoaded: () => sourceLoaded, + /** @returns {boolean} Whether an analysis is in progress. */ + isAnalysisRunning: () => analysisRunning, + /** @returns {object|null} Current mutable session for diagnostic automation. */ + getSession: () => controller.getSession(), + /** @returns {object} Report, technical log, and selected frame artifacts. */ + exportBundle: () => controller.exportBundle(), + /** @param {object} metadata Source provenance supplied before setInputFiles(). */ + setSourceMetadata(metadata) { pendingSourceMetadata = { ...metadata }; }, + /** @param {object} options Analysis range and cadence. */ + analyze: (options = {}) => startAnalysis(options), + /** @param {number} mediaTime Source timestamp to compare with the baseline. */ + analyzeFrame: (mediaTime) => analyzeCurrentFrame(mediaTime), + /** @returns {Promise} Resumes the current cancelled analysis. */ + resume: () => startAnalysis({ resume: true }), + /** @returns {void} Requests a resumable pause at the next sample boundary. */ + cancel: () => controller.cancel(), +}; /** - * Initializes localization, local databases, video bindings, models, and actions. + * Initialises localisation and model loading without requesting a camera. * - * @returns {Promise} + * @returns {Promise} Resolves after model loading succeeds or fails. */ async function init() { initI18n(); - setupLocaleSelect(document.getElementById('localeSelect'), () => { - applyI18n(); - setLoaderStatus(currentStatus.kind, currentStatus.key); - }); + setupLocaleSelect(document.getElementById('localeSelect'), applyI18n); applyI18n(); - state.db = loadDb(); - state.db3d = loadDb3d(); - state.isMirrored = false; - renderDbStats(); - bindVideo(); - - recordFaceBtn.addEventListener('click', recordFace); - seekFaceBtn.addEventListener('click', seekFace); - + renderSession(null); + syncControls(); + setStatus('init', 'loading models'); try { - await loadModels(); - modelsReady = true; - setLoaderStatus('live', 'loader_status_ready'); - setLog(t('loader_ready_log'), 'loader'); - state.gstmxxEvents.dispatchEvent(new CustomEvent('ready', { detail: {} })); - window.dispatchEvent(new CustomEvent('gstmxxReady')); - setActionButtonsEnabled(true); - } catch (err) { - setLoaderStatus('error', 'loader_status_model_load_failed'); - setLog(t('loader_model_error_log', { message: err.message || err }), 'loader'); + await controller.loadModels(); + } catch (error) { + setStatus('error', `model loading failed: ${error.message || String(error)}`); + dispatchLoaderEvent('error', { message: error.message || String(error) }); } } diff --git a/lab-js/realtime/realtime-capture.js b/lab-js/realtime/realtime-capture.js new file mode 100644 index 0000000..f50ea0f --- /dev/null +++ b/lab-js/realtime/realtime-capture.js @@ -0,0 +1,832 @@ +/** + * @module realtime-capture + * @description + * Everything that decides whether a frame is good enough to believe. + * + * The baseline is captured once and every number for the rest of the session + * is measured against it, so it is worth being slow and picky about. The + * prototype took the first frame that returned a descriptor — no confidence + * check, no framing check, no pose check — which meant a blurred half-turned + * frame could silently become the reference for an hour of work. + * + * The same gate is reused for spike captures, for the same reason: a single + * frame at 0.50 is as likely to be motion blur as a result, and "the makeup is + * working" is not a claim you want resting on a photo of someone moving. + */ + +/** Landmark indices in face-api's 68-point model. */ +const LM_LEFT_EYE_OUTER = 36; +const LM_RIGHT_EYE_OUTER = 45; +const LM_NOSE_TIP = 30; + +const DEFAULT_GATE = { + minScore: 0.85, + minBoxWidthRatio: 0.25, + edgeMarginRatio: 0.02, + maxRollDegrees: 8, + maxYawOffset: 0.12, + minLuma: 0.18, + maxLuma: 0.86, + maxClippedRatio: 0.02, +}; + +const DEFAULT_COMPARISON = { + maxRollDelta: 4, + maxYawDelta: 0.055, + maxScaleDelta: 0.08, + maxCenterDelta: 0.065, + maxLumaDelta: 0.1, +}; + +const CONDITION_KEYS = [ + 'rollDegrees', + 'yawOffset', + 'boxWidthRatio', + 'centerXRatio', + 'centerYRatio', + 'luma', +]; + +/** + * Averages the capture conditions accepted during one temporal window. + * + * @param {object[]} readings Per-frame 2D pose, framing and light metrics. + * @returns {object|null} Mean condition profile, or null when unavailable. + */ +export function summarizeConditions(readings) { + const usable = readings.filter(Boolean); + if (!usable.length) return null; + const profile = {}; + for (const key of CONDITION_KEYS) { + const values = usable.map((reading) => reading[key]).filter(Number.isFinite); + if (values.length) profile[key] = values.reduce((sum, value) => sum + value, 0) / values.length; + } + return Object.keys(profile).length ? profile : null; +} + +/** Returns the median finite value from a list, or zero for an empty list. */ +function median(values) { + const sorted = values.filter(Number.isFinite).sort((a, b) => a - b); + if (!sorted.length) return 0; + const middle = Math.floor(sorted.length / 2); + return sorted.length % 2 + ? sorted[middle] + : (sorted[middle - 1] + sorted[middle]) / 2; +} + +/** + * Builds one robust, normalized 2D reference guide from accepted frames. + * This geometry is deliberately separate from the descriptor medoid: it is + * only a visual alignment aid and never participates in distance arithmetic. + * + * @param {object[]} guides Per-frame normalized face boxes and 68 landmarks. + * @returns {object|null} Coordinate-wise median guide. + */ +export function summarizeGuides(guides) { + const usable = guides.filter((guide) => + guide && + Number.isFinite(guide.aspectRatio) && + Array.isArray(guide.landmarks) && + guide.landmarks.length === 68, + ); + if (!usable.length) return null; + const coordinate = (read) => median(usable.map(read)); + return { + aspectRatio: coordinate((guide) => guide.aspectRatio), + box: { + x: coordinate((guide) => guide.box.x), + y: coordinate((guide) => guide.box.y), + width: coordinate((guide) => guide.box.width), + height: coordinate((guide) => guide.box.height), + }, + landmarks: Array.from({ length: 68 }, (_, index) => ({ + x: coordinate((guide) => guide.landmarks[index].x), + y: coordinate((guide) => guide.landmarks[index].y), + })), + }; +} + +/** + * Checks whether a live frame is comparable with the baseline conditions. + * This is deliberately a 2D nuisance gate, not pose correction: rejected + * frames are omitted rather than mathematically transformed into a result. + * + * @param {object|null} baseline Baseline condition profile. + * @param {object|null} current Current frame conditions. + * @param {object} [overrides] Partial tolerance overrides. + * @returns {{ok: boolean, reason: string, reasons: string[], differences: object}} Comparison verdict. + */ +export function compareConditions(baseline, current, overrides = {}) { + if (!baseline || !current) return { ok: true, reason: '', reasons: [], differences: {} }; + const limits = { ...DEFAULT_COMPARISON, ...overrides }; + const difference = (key) => Math.abs((current[key] ?? 0) - (baseline[key] ?? 0)); + const differences = Object.fromEntries(CONDITION_KEYS.map((key) => [key, difference(key)])); + const reasons = []; + + if ( + differences.rollDegrees > limits.maxRollDelta || + differences.yawOffset > limits.maxYawDelta + ) { + const details = []; + if (differences.rollDegrees > limits.maxRollDelta) { + details.push(`roll Δ${differences.rollDegrees.toFixed(1)}°; limit ${limits.maxRollDelta}°`); + } + if (differences.yawOffset > limits.maxYawDelta) { + details.push( + `yaw proxy Δ${differences.yawOffset.toFixed(3)}; limit ${limits.maxYawDelta.toFixed(3)}`, + ); + } + reasons.push(`Head angle differs from the baseline pose (${details.join(', ')}).`); + } + if (differences.boxWidthRatio > limits.maxScaleDelta) { + reasons.push( + current.boxWidthRatio > baseline.boxWidthRatio + ? 'Face size differs from the baseline framing. Move slightly farther from the camera.' + : 'Face size differs from the baseline framing. Move slightly closer to the camera.', + ); + } + if ( + differences.centerXRatio > limits.maxCenterDelta || + differences.centerYRatio > limits.maxCenterDelta + ) { + reasons.push('Face position differs from the baseline framing. Re-centre it in the frame.'); + } + if (differences.luma > limits.maxLumaDelta) { + reasons.push( + `Room lighting differs from the baseline (luma Δ${differences.luma.toFixed(2)}; limit ${limits.maxLumaDelta.toFixed(2)}).`, + ); + } + if (reasons.length) { + return { ok: false, reason: reasons[0], reasons, differences }; + } + return { ok: true, reason: '', reasons: [], differences }; +} + +/** + * Euclidean distance between two descriptors. + * + * Kept local rather than reaching for the global `faceapi` so this module can + * be imported and unit tested without the vendor bundle present. + * + * @param {Float32Array|number[]} a First descriptor. + * @param {Float32Array|number[]} b Second descriptor. + * @returns {number} Euclidean distance. + */ +export function euclidean(a, b) { + let sum = 0; + for (let i = 0; i < a.length; i += 1) { + const d = a[i] - b[i]; + sum += d * d; + } + return Math.sqrt(sum); +} + +/** + * Picks the medoid of a descriptor set and reports its spread. + * + * The medoid — the member with the smallest summed distance to the others — is + * used rather than the mean because it stays a real point in the embedding. + * Averaging near-unit vectors that are not perfectly aligned yields something + * slightly shorter than its inputs, which bakes a small systematic offset into + * every distance measured for the rest of the session. + * + * The returned spread is the session's NOISE FLOOR: how far the descriptor + * moves when nothing about the face has changed. It is the only empirical + * reference line this tool draws. + * + * @param {Array} descriptors Collected descriptors. + * @returns {{descriptor: number[], spread: number, index: number}} Medoid result. + */ +export function medoid(descriptors) { + if (!descriptors.length) throw new Error('medoid() needs at least one descriptor'); + if (descriptors.length === 1) { + return { descriptor: Array.from(descriptors[0]), spread: 0, index: 0 }; + } + + const n = descriptors.length; + const matrix = Array.from({ length: n }, () => new Float64Array(n)); + + for (let i = 0; i < n; i += 1) { + for (let j = i + 1; j < n; j += 1) { + const d = euclidean(descriptors[i], descriptors[j]); + matrix[i][j] = d; + matrix[j][i] = d; + } + } + + let bestIndex = 0; + let bestSum = Infinity; + for (let i = 0; i < n; i += 1) { + let sum = 0; + for (let j = 0; j < n; j += 1) sum += matrix[i][j]; + if (sum < bestSum) { + bestSum = sum; + bestIndex = i; + } + } + + const spread = bestSum / (n - 1); + return { descriptor: Array.from(descriptors[bestIndex]), spread, index: bestIndex }; +} + +/** + * Creates a reusable scratch canvas for crop analysis. + * + * @param {number} size Square edge length in pixels. + * @returns {{canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D}} Scratch surface. + */ +function createScratch(size) { + const canvas = document.createElement('canvas'); + canvas.width = size; + canvas.height = size; + return { canvas, ctx: canvas.getContext('2d', { willReadFrequently: true }) }; +} + +/** + * Measures relative sharpness and exposure of a face crop. + * + * Sharpness is gradient energy and is used only for RANKING candidates against + * each other, never against a fixed floor — an absolute threshold would be one + * more magic number that varies with every camera and lighting setup. + * + * @param {HTMLVideoElement} video Source video element. + * @param {{x: number, y: number, width: number, height: number}} box Face box in video pixels. + * @param {{canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D}} scratch Scratch surface. + * @returns {{sharpness: number, luma: number, clipped: number}} Crop statistics. + */ +function analyseCrop(video, box, scratch) { + const size = scratch.canvas.width; + scratch.ctx.drawImage( + video, + Math.max(0, box.x), + Math.max(0, box.y), + Math.max(1, box.width), + Math.max(1, box.height), + 0, + 0, + size, + size, + ); + + const { data } = scratch.ctx.getImageData(0, 0, size, size); + const gray = new Float32Array(size * size); + let lumaSum = 0; + let clipped = 0; + + for (let i = 0, p = 0; i < data.length; i += 4, p += 1) { + const value = (data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114) / 255; + gray[p] = value; + lumaSum += value; + if (value > 0.98) clipped += 1; + } + + let energy = 0; + for (let y = 1; y < size - 1; y += 1) { + for (let x = 1; x < size - 1; x += 1) { + const idx = y * size + x; + const gx = gray[idx + 1] - gray[idx - 1]; + const gy = gray[idx + size] - gray[idx - size]; + energy += gx * gx + gy * gy; + } + } + + const pixels = size * size; + return { + sharpness: energy / pixels, + luma: lumaSum / pixels, + clipped: clipped / pixels, + }; +} + +/** + * Estimates illumination from pixels outside the detected face box. Makeup can + * legitimately darken the face crop; using the surrounding frame makes the + * light comparison less likely to erase the very intervention being studied. + * + * @param {HTMLVideoElement} video Source video element. + * @param {{x: number, y: number, width: number, height: number}} box Face box. + * @param {{canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D}} scratch Scratch surface. + * @returns {number} Mean normalized luma outside the face box. + */ +function analyseAmbientLuma(video, box, scratch) { + const size = scratch.canvas.width; + scratch.ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, size, size); + const { data } = scratch.ctx.getImageData(0, 0, size, size); + const left = (box.x / video.videoWidth) * size; + const right = ((box.x + box.width) / video.videoWidth) * size; + const top = (box.y / video.videoHeight) * size; + const bottom = ((box.y + box.height) / video.videoHeight) * size; + let sum = 0; + let count = 0; + + for (let y = 0; y < size; y += 1) { + for (let x = 0; x < size; x += 1) { + if (x >= left && x <= right && y >= top && y <= bottom) continue; + const offset = (y * size + x) * 4; + sum += (data[offset] * 0.299 + data[offset + 1] * 0.587 + data[offset + 2] * 0.114) / 255; + count += 1; + } + } + return count ? sum / count : Number.NaN; +} + +/** + * Creates the frame quality gate. + * + * @param {HTMLVideoElement} video Source video element. + * @param {object} [overrides] Partial gate threshold overrides. + * @returns {{evaluate: Function}} Quality gate. + */ +export function createQualityGate(video, overrides = {}) { + const limits = { ...DEFAULT_GATE, ...overrides }; + const scratch = createScratch(96); + + return { + /** + * Judges one detection against every framing and quality rule. + * + * @param {*} detection face-api detection with landmarks and descriptor. + * @param {object} [options] Evaluation mode. + * @param {boolean} [options.allowAppearanceChanges=false] Do not let face-crop + * exposure or detector-score changes reject an intervention frame. + * @returns {{ok: boolean, reason: string, reasons: string[], code: string, sharpness: number}} Verdict. + */ + evaluate(detection, options = {}) { + const { allowAppearanceChanges = false } = options; + const reject = (code, reason) => ({ + ok: false, + code, + reason, + reasons: [reason], + failures: [{ code, reason }], + sharpness: 0, + }); + + const box = detection?.detection?.box; + const score = detection?.detection?.score ?? 0; + const points = detection?.landmarks?.positions; + if (!box || !points) return reject('detection', 'No usable face detection.'); + + const videoW = video.videoWidth || 1; + const videoH = video.videoHeight || 1; + const guide = { + aspectRatio: videoW / videoH, + box: { + x: box.x / videoW, + y: box.y / videoH, + width: box.width / videoW, + height: box.height / videoH, + }, + landmarks: points.map((point) => ({ x: point.x / videoW, y: point.y / videoH })), + }; + + const failures = []; + const fail = (code, reason) => failures.push({ code, reason }); + + if (!allowAppearanceChanges && score < limits.minScore) { + fail( + 'confidence', + `Face detected, but confidence is low (${score.toFixed(2)}; target ${limits.minScore.toFixed(2)}). Hold still and check glare or shadows.`, + ); + } + if (box.width < videoW * limits.minBoxWidthRatio) { + fail('scale', 'Face detected, but it is too small in the frame. Move closer.'); + } + + const marginX = videoW * limits.edgeMarginRatio; + const marginY = videoH * limits.edgeMarginRatio; + const clipsFrame = + box.x < marginX || + box.y < marginY || + box.x + box.width > videoW - marginX || + box.y + box.height > videoH - marginY; + if (clipsFrame) fail('framing', 'Face detected, but it is too close to an edge. Centre it in the frame.'); + + const leftEye = points[LM_LEFT_EYE_OUTER]; + const rightEye = points[LM_RIGHT_EYE_OUTER]; + const nose = points[LM_NOSE_TIP]; + if (!leftEye || !rightEye || !nose) return reject('landmarks', 'Face detected, but its landmarks are incomplete.'); + + const rollDegrees = + (Math.atan2(rightEye.y - leftEye.y, rightEye.x - leftEye.x) * 180) / Math.PI; + if (Math.abs(rollDegrees) > limits.maxRollDegrees) { + fail( + 'roll', + `Face detected, but the head is tilted (${Math.abs(rollDegrees).toFixed(1)}°; target ≤ ${limits.maxRollDegrees}°). Level it and hold still.`, + ); + } + + const interocular = Math.hypot(rightEye.x - leftEye.x, rightEye.y - leftEye.y) || 1; + const eyeMidX = (leftEye.x + rightEye.x) / 2; + const yawOffset = (nose.x - eyeMidX) / interocular; + if (Math.abs(yawOffset) > limits.maxYawOffset) { + fail( + 'yaw', + `Face detected, but the head is turned (yaw proxy ${Math.abs(yawOffset).toFixed(2)}; target ≤ ${limits.maxYawOffset.toFixed(2)}). Face the camera and hold still.`, + ); + } + + const ambientLuma = analyseAmbientLuma(video, box, scratch); + const crop = analyseCrop(video, box, scratch); + if (!allowAppearanceChanges) { + if (crop.luma < limits.minLuma) { + fail('underexposed', 'Face detected, but the face crop is too dark. Add some light.'); + } + if (crop.luma > limits.maxLuma || crop.clipped > limits.maxClippedRatio) { + fail( + 'overexposed', + `Face detected, but the face crop is overexposed (clipped ${(crop.clipped * 100).toFixed(1)}%; target ≤ ${(limits.maxClippedRatio * 100).toFixed(1)}%). Reduce glare or direct light.`, + ); + } + } + + const metrics = { + rollDegrees, + yawOffset, + boxWidthRatio: box.width / videoW, + centerXRatio: (box.x + box.width / 2) / videoW, + centerYRatio: (box.y + box.height / 2) / videoH, + luma: Number.isFinite(ambientLuma) ? ambientLuma : crop.luma, + faceLuma: crop.luma, + clippedRatio: crop.clipped, + detectorScore: score, + }; + + if (failures.length) { + return { + ok: false, + code: failures[0].code, + reason: failures[0].reason, + reasons: failures.map((failure) => failure.reason), + failures, + sharpness: crop.sharpness, + metrics, + guide, + }; + } + + return { + ok: true, + code: '', + reason: '', + reasons: [], + failures: [], + sharpness: crop.sharpness, + metrics, + guide, + }; + }, + }; +} + +/** + * Creates the baseline collector. + * + * Progress advances on ACCEPTED samples only, never on elapsed time. A stalled + * ring means frames are being rejected, and the reason is reported alongside — + * so the control diagnoses itself instead of silently timing out. + * + * @param {object} options Collector options. + * @param {number} options.targetSamples Accepted samples required. + * @param {number} options.minDurationMs Floor on capture duration. + * @param {number} options.timeoutMs Abandon threshold. + * @param {number} options.maxSpread Largest acceptable noise floor. + * @returns {object} Baseline collector. + */ +export function createBaselineCollector(options) { + const { targetSamples, minDurationMs, timeoutMs, maxSpread } = options; + + let descriptors = []; + let conditions = []; + let guides = []; + let startedAt = 0; + let lastAcceptedAt = 0; + let firstAcceptedAt = 0; + let lastObservationId = null; + let attempted = 0; + let rejected = 0; + let duplicates = 0; + let active = false; + + return { + /** + * Begins a fresh collection run. + * + * @returns {void} + */ + start() { + descriptors = []; + conditions = []; + guides = []; + startedAt = Date.now(); + lastAcceptedAt = 0; + firstAcceptedAt = 0; + lastObservationId = null; + attempted = 0; + rejected = 0; + duplicates = 0; + active = true; + }, + + /** + * Ends the current run without producing a baseline. + * + * @returns {void} + */ + cancel() { + active = false; + descriptors = []; + conditions = []; + guides = []; + lastAcceptedAt = 0; + firstAcceptedAt = 0; + lastObservationId = null; + attempted = 0; + rejected = 0; + duplicates = 0; + }, + + /** + * Reports whether a run is in progress. + * + * @returns {boolean} True while collecting. + */ + isActive() { + return active; + }, + + /** + * Offers one gated frame to the collector. + * + * @param {object} verdict Quality gate verdict. + * @param {Float32Array|number[]} descriptor Descriptor for the frame. + * @param {object} [observation] Source timing and identity. + * @param {number} [observation.sourceTimeMs] Media time for a local video. + * @param {string|number} [observation.id] Stable id for one source frame. + * @returns {object} Collector progress and, when complete, the temporal medoid. + */ + offer(verdict, descriptor, observation = {}) { + if (!active) return { status: 'idle', accepted: 0, target: targetSamples }; + + const now = Date.now(); + const elapsed = now - startedAt; + attempted += 1; + + const progress = (status, extra = {}) => ({ + status, + accepted: descriptors.length, + target: targetSamples, + attempted, + rejected, + duplicates, + ...extra, + }); + + if (!verdict.ok) { + rejected += 1; + if (elapsed > timeoutMs) { + active = false; + return progress('failed', { + reason: `Not enough clean frames before the capture timed out. Last rejection: ${verdict.reason}`, + reasons: verdict.reasons || [verdict.reason], + }); + } + return progress('blocked', { + reason: verdict.reason, + reasons: verdict.reasons || [verdict.reason], + }); + } + + if (observation.id != null && observation.id === lastObservationId) { + duplicates += 1; + return progress('waiting', { reason: 'Waiting for the video to advance to a new frame.' }); + } + if (observation.id != null) lastObservationId = observation.id; + + const sampleTime = Number.isFinite(observation.sourceTimeMs) + ? observation.sourceTimeMs + : now; + + // Space observations across the whole requested window. Without this, + // a fast detector could fill the array in one short burst and merely + // wait out minDurationMs without observing the rest of the interval. + const sampleIntervalMs = targetSamples > 1 ? minDurationMs / (targetSamples - 1) : 0; + const sampleDue = descriptors.length === 0 || sampleTime - lastAcceptedAt >= sampleIntervalMs; + if (descriptors.length < targetSamples && sampleDue) { + descriptors.push(Array.from(descriptor)); + if (verdict.metrics) conditions.push(verdict.metrics); + if (verdict.guide) guides.push(verdict.guide); + lastAcceptedAt = sampleTime; + if (descriptors.length === 1) firstAcceptedAt = sampleTime; + } + + const enoughSamples = descriptors.length >= targetSamples; + const enoughTime = + descriptors.length > 0 && lastAcceptedAt - firstAcceptedAt >= minDurationMs; + + if (!enoughSamples || !enoughTime) { + if (elapsed > timeoutMs) { + active = false; + return progress('failed', { + reason: 'Not enough clean frames before the capture timed out.', + }); + } + return progress('collecting'); + } + + const result = medoid(descriptors); + active = false; + + // A spread this wide means the subject moved or the lighting flickered + // during collection. Accepting it would set a noise floor so high that + // real results disappear underneath it. + if (result.spread > maxSpread) { + return progress('failed', { + reason: 'Too much movement during capture.', + }); + } + + return progress('done', { + baseline: { + descriptor: result.descriptor, + noiseFloor: result.spread, + capturedAt: Date.now(), + samples: descriptors.length, + conditions: summarizeConditions(conditions), + guide: summarizeGuides(guides), + }, + }); + }, + }; +} + +/** + * Creates the sustained-spike detector. + * + * Capture triggers on a reading that HOLDS, not on an instantaneous value, and + * the frame written to disk is the sharpest one observed across the sustain + * window rather than whichever frame happened to trip the trigger. + * + * Two conditions fire a capture: + * personal best — a new session maximum by a real margin, which is what you + * iterate against between makeup passes + * crossing — the first time the run clears the cited match threshold + * + * @param {object} options Detector options. + * @param {number} options.sustainMs Time a reading must hold. + * @param {number} options.bestMargin Margin over the session best. + * @param {number} options.threshold Cited match threshold. + * @param {number} options.cooldownMs Minimum spacing between captures. + * @returns {object} Spike detector. + */ +export function createSpikeDetector(options) { + const { sustainMs, bestMargin, threshold, cooldownMs } = options; + + let sessionBest = 0; + let crossedThreshold = false; + let runStartedAt = 0; + let runValueFloor = 0; + let lastCaptureAt = 0; + + return { + /** + * Clears session state after a new baseline is set. + * + * @returns {void} + */ + reset() { + sessionBest = 0; + crossedThreshold = false; + runStartedAt = 0; + runValueFloor = 0; + lastCaptureAt = 0; + }, + + /** + * Marks a capture as taken so the cooldown applies. + * + * @param {number} value Distance at capture time. + * @returns {void} + */ + noteCapture(value) { + lastCaptureAt = Date.now(); + sessionBest = Math.max(sessionBest, value); + if (value >= threshold) crossedThreshold = true; + runStartedAt = 0; + }, + + /** + * Feeds one live distance reading to the detector. + * + * @param {number} value Live distance for this frame. + * @returns {{capture: boolean, kind: string, candidate: boolean}} Verdict. + */ + update(value) { + const now = Date.now(); + const beatsBest = value >= sessionBest + bestMargin; + const crosses = !crossedThreshold && value >= threshold; + const interesting = beatsBest || crosses; + + if (!interesting) { + runStartedAt = 0; + return { capture: false, kind: '', candidate: false }; + } + + if (!runStartedAt) { + runStartedAt = now; + runValueFloor = value; + return { capture: false, kind: '', candidate: true }; + } + + // A dip below where the run started means the reading did not hold. + if (value < runValueFloor - bestMargin) { + runStartedAt = 0; + return { capture: false, kind: '', candidate: false }; + } + + if (now - runStartedAt < sustainMs) { + return { capture: false, kind: '', candidate: true }; + } + + if (now - lastCaptureAt < cooldownMs) { + return { capture: false, kind: '', candidate: true }; + } + + return { capture: true, kind: crosses ? 'crossing' : 'best', candidate: true }; + }, + }; +} + +/** + * Creates a rotating buffer of full video frames. + * + * Snapshots are only taken while a spike candidate is live, so the buffer costs + * nothing during ordinary tracking. + * + * @param {HTMLVideoElement} video Source video element. + * @param {number} slots Number of frames retained. + * @param {number} maxWidth Longest edge written to a snapshot. + * @returns {object} Frame buffer. + */ +export function createFrameBuffer(video, slots, maxWidth) { + const buffer = []; + let cursor = 0; + + return { + /** + * Empties the buffer. + * + * @returns {void} + */ + clear() { + buffer.length = 0; + cursor = 0; + }, + + /** + * Records the current video frame with its measured sharpness. + * + * @param {number} sharpness Relative sharpness of this frame. + * @param {number} distance Distance reading at this frame. + * @returns {void} + */ + push(sharpness, distance) { + const videoW = video.videoWidth || 0; + const videoH = video.videoHeight || 0; + if (!videoW || !videoH) return; + + const scale = Math.min(1, maxWidth / videoW); + const width = Math.round(videoW * scale); + const height = Math.round(videoH * scale); + + let slot = buffer[cursor]; + if (!slot) { + slot = { canvas: document.createElement('canvas'), sharpness: 0, distance: 0, t: 0 }; + buffer[cursor] = slot; + } + if (slot.canvas.width !== width || slot.canvas.height !== height) { + slot.canvas.width = width; + slot.canvas.height = height; + } + + slot.canvas.getContext('2d').drawImage(video, 0, 0, width, height); + slot.sharpness = sharpness; + slot.distance = distance; + slot.t = Date.now(); + cursor = (cursor + 1) % slots; + }, + + /** + * Returns the sharpest retained frame. + * + * @returns {{canvas: HTMLCanvasElement, sharpness: number, distance: number, t: number}|null} Best frame. + */ + best() { + let winner = null; + for (const slot of buffer) { + if (slot && (!winner || slot.sharpness > winner.sharpness)) winner = slot; + } + return winner; + }, + }; +} diff --git a/lab-js/realtime/realtime-gallery.js b/lab-js/realtime/realtime-gallery.js new file mode 100644 index 0000000..dbe958e --- /dev/null +++ b/lab-js/realtime/realtime-gallery.js @@ -0,0 +1,579 @@ +/** + * @module realtime-gallery + * @description + * Stores, renders and exports spike captures. + * + * STORAGE. IndexedDB, not localStorage. localStorage caps around 5MB per + * origin, is shared with the baseline, the settings and the existing thumbnail + * store, and inflates binary by a third on the way through base64 — a 640x480 + * JPEG lands near 70KB encoded, so the quota starts evicting things you care + * about after roughly fifty frames. IndexedDB takes Blobs natively. + * + * PRIVACY. This module is the point where the tool starts holding photographs + * of a face rather than a 128-d template. Everything stays on the device, the + * count is always visible in the settings bar, and "Delete all" really empties + * the store. Deleting the baseline deliberately does NOT clear captures: the + * gallery is expected to outlive a re-baseline, and that is stated in the UI + * rather than left to be inferred. + * + * EXPORT. Store-only ZIP written here in ~70 lines. JPEGs do not compress, so + * DEFLATE would buy nothing, and pulling in JSZip would put a third-party + * script on a page whose whole point is that it makes no third-party requests. + */ + +const DB_NAME = 'gstmxx-realtime'; +const DB_VERSION = 1; +const STORE = 'captures'; + +/** + * Opens (and upgrades) the capture database. + * + * @returns {Promise} Open database handle. + */ +function openDb() { + return new Promise((resolve, reject) => { + const request = indexedDB.open(DB_NAME, DB_VERSION); + request.onupgradeneeded = () => { + const db = request.result; + if (!db.objectStoreNames.contains(STORE)) { + const store = db.createObjectStore(STORE, { keyPath: 'id' }); + store.createIndex('t', 't'); + } + }; + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); +} + +/** + * Runs one transaction against the capture store. + * + * @param {IDBDatabase} db Open database. + * @param {IDBTransactionMode} mode Transaction mode. + * @param {function(IDBObjectStore): IDBRequest} work Callback issuing the request. + * @returns {Promise<*>} Request result. + */ +function run(db, mode, work) { + return new Promise((resolve, reject) => { + const tx = db.transaction(STORE, mode); + const request = work(tx.objectStore(STORE)); + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); +} + +/** + * Formats a timestamp for filenames. + * + * @param {number} timestamp Epoch milliseconds. + * @param {boolean} [fileSafe] Whether to avoid characters illegal in filenames. + * @returns {string} Formatted stamp. + */ +function stamp(timestamp, fileSafe = false) { + const d = new Date(timestamp); + const pad = (n) => String(n).padStart(2, '0'); + const date = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; + const time = `${pad(d.getHours())}${fileSafe ? '' : ':'}${pad(d.getMinutes())}${fileSafe ? '' : ':'}${pad(d.getSeconds())}`; + return fileSafe ? `${date}_${time}` : `${date} ${time}`; +} + +/** + * Formats the only measurement claim shown with a saved frame. + * + * @param {object} meta Measurement metadata. + * @param {number} meta.distance Distance at capture. + * @param {number} meta.threshold Match threshold used for the verdict. + * @returns {string} Human-readable distance and verdict. + */ +export function formatCaptureMeasurement(meta) { + const threshold = Number.isFinite(meta.threshold) ? meta.threshold : 0.6; + const distance = Number.isFinite(meta.distance) ? meta.distance : NaN; + const formattedDistance = Number.isFinite(distance) ? distance.toFixed(3) : '—'; + const verdict = Number.isFinite(distance) && distance <= threshold + ? 'still match' + : 'different person'; + return `distance ${formattedDistance}/${threshold.toFixed(2)} · ${verdict}`; +} + +/** Draws the project mark using the same geometry as mark-small-mono-cream.svg. */ +function drawLogoMark(ctx, x, y, size) { + ctx.save(); + ctx.translate(x, y); + ctx.scale(size / 64, size / 64); + ctx.strokeStyle = '#fff1cf'; + ctx.fillStyle = '#fff1cf'; + ctx.lineCap = 'round'; + ctx.lineJoin = 'round'; + + ctx.save(); + ctx.translate(1, 10); + ctx.scale(0.45, 0.45); + ctx.lineWidth = 7.5; + ctx.beginPath(); + ctx.moveTo(8, 44); + ctx.lineTo(2, 32); + ctx.moveTo(92, 44); + ctx.lineTo(98, 32); + ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(50, 45); + ctx.bezierCurveTo(65, 25, 90, 25, 90, 45); + ctx.bezierCurveTo(90, 65, 65, 65, 50, 45); + ctx.bezierCurveTo(35, 25, 10, 25, 10, 45); + ctx.bezierCurveTo(10, 65, 35, 65, 50, 45); + ctx.closePath(); + ctx.stroke(); + for (const cx of [28, 72]) { + ctx.beginPath(); + ctx.arc(cx, 45, 8, 0, Math.PI * 2); + ctx.fill(); + } + ctx.restore(); + + ctx.save(); + ctx.translate(13, 36); + ctx.scale(0.4, 0.4); + ctx.lineWidth = 9; + ctx.beginPath(); + ctx.moveTo(80, 26); + ctx.lineTo(80, 84); + ctx.moveTo(80, 30); + ctx.lineTo(44, 30); + ctx.moveTo(52, 30); + ctx.lineTo(52, 40); + ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(17, 40); + ctx.lineTo(75, 40); + ctx.arcTo(82, 40, 82, 47, 7); + ctx.lineTo(82, 63); + ctx.arcTo(82, 70, 75, 70, 7); + ctx.lineTo(17, 70); + ctx.arcTo(10, 70, 10, 63, 7); + ctx.lineTo(10, 47); + ctx.arcTo(10, 40, 17, 40, 7); + ctx.closePath(); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(32, 55, 11.5, 0, Math.PI * 2); + ctx.fill(); + ctx.restore(); + ctx.restore(); +} + +/** + * Burns the project mark and the distance verdict into the frame. + * + * @param {HTMLCanvasElement} source Frame to watermark. + * @param {object} meta Measurement metadata. + * @param {number} meta.distance Distance at capture. + * @param {number} meta.threshold Cited match threshold. + * @returns {HTMLCanvasElement} Watermarked canvas. + */ +export function watermark(source, meta) { + const barHeight = Math.max(26, Math.round(source.height * 0.062)); + const canvas = document.createElement('canvas'); + canvas.width = source.width; + canvas.height = source.height + barHeight; + + const ctx = canvas.getContext('2d'); + ctx.drawImage(source, 0, 0); + + ctx.fillStyle = '#0c0906'; + ctx.fillRect(0, source.height, canvas.width, barHeight); + + const markSize = Math.max(24, Math.round(barHeight * 0.82)); + const markX = 12; + const markY = source.height + (barHeight - markSize) / 2; + drawLogoMark(ctx, markX, markY, markSize); + + const detail = formatCaptureMeasurement(meta); + const textX = markX + markSize + 12; + const availableWidth = Math.max(0, canvas.width - textX - 12); + let fontSize = Math.max(9, Math.round(barHeight * 0.36)); + ctx.font = `${fontSize}px ui-monospace, SFMono-Regular, Menlo, monospace`; + while (fontSize > 8 && ctx.measureText(detail).width > availableWidth) { + fontSize -= 1; + ctx.font = `${fontSize}px ui-monospace, SFMono-Regular, Menlo, monospace`; + } + ctx.textBaseline = 'middle'; + ctx.textAlign = 'left'; + + const y = source.height + barHeight / 2; + ctx.fillStyle = '#ffe7a8'; + ctx.fillText(detail, textX, y, availableWidth); + + return canvas; +} + +/** + * Encodes a canvas to a Blob. + * + * @param {HTMLCanvasElement} canvas Canvas to encode. + * @param {string} type MIME type. + * @param {number} [quality] Encoder quality for lossy types. + * @returns {Promise} Encoded blob. + */ +function toBlob(canvas, type, quality) { + return new Promise((resolve, reject) => { + canvas.toBlob( + (blob) => (blob ? resolve(blob) : reject(new Error('Encoding failed'))), + type, + quality, + ); + }); +} + +/* --- Store-only ZIP -------------------------------------------------------- */ + +const CRC_TABLE = (() => { + const table = new Uint32Array(256); + for (let n = 0; n < 256; n += 1) { + let c = n; + for (let k = 0; k < 8; k += 1) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; + table[n] = c >>> 0; + } + return table; +})(); + +/** + * Computes a CRC-32 checksum. + * + * @param {Uint8Array} bytes Input bytes. + * @returns {number} Unsigned checksum. + */ +function crc32(bytes) { + let c = 0xffffffff; + for (let i = 0; i < bytes.length; i += 1) { + c = CRC_TABLE[(c ^ bytes[i]) & 0xff] ^ (c >>> 8); + } + return (c ^ 0xffffffff) >>> 0; +} + +/** + * Encodes a date as a DOS time/date pair. + * + * @param {Date} date Source date. + * @returns {{time: number, date: number}} DOS fields. + */ +function dosDate(date) { + return { + time: (date.getHours() << 11) | (date.getMinutes() << 5) | (date.getSeconds() >> 1), + date: ((date.getFullYear() - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate(), + }; +} + +/** + * Builds an uncompressed ZIP archive. + * + * @param {Array<{name: string, bytes: Uint8Array, date: Date}>} files Archive members. + * @returns {Blob} ZIP blob. + */ +export function buildZip(files) { + const encoder = new TextEncoder(); + const locals = []; + const centrals = []; + let offset = 0; + + for (const file of files) { + const nameBytes = encoder.encode(file.name); + const checksum = crc32(file.bytes); + const { time, date } = dosDate(file.date); + + const local = new Uint8Array(30 + nameBytes.length); + const lv = new DataView(local.buffer); + lv.setUint32(0, 0x04034b50, true); + lv.setUint16(4, 20, true); + lv.setUint16(6, 0, true); + lv.setUint16(8, 0, true); + lv.setUint16(10, time, true); + lv.setUint16(12, date, true); + lv.setUint32(14, checksum, true); + lv.setUint32(18, file.bytes.length, true); + lv.setUint32(22, file.bytes.length, true); + lv.setUint16(26, nameBytes.length, true); + lv.setUint16(28, 0, true); + local.set(nameBytes, 30); + + const central = new Uint8Array(46 + nameBytes.length); + const cv = new DataView(central.buffer); + cv.setUint32(0, 0x02014b50, true); + cv.setUint16(4, 20, true); + cv.setUint16(6, 20, true); + cv.setUint16(8, 0, true); + cv.setUint16(10, 0, true); + cv.setUint16(12, time, true); + cv.setUint16(14, date, true); + cv.setUint32(16, checksum, true); + cv.setUint32(20, file.bytes.length, true); + cv.setUint32(24, file.bytes.length, true); + cv.setUint16(28, nameBytes.length, true); + cv.setUint32(42, offset, true); + central.set(nameBytes, 46); + + locals.push(local, file.bytes); + centrals.push(central); + offset += local.length + file.bytes.length; + } + + const centralSize = centrals.reduce((sum, part) => sum + part.length, 0); + const end = new Uint8Array(22); + const ev = new DataView(end.buffer); + ev.setUint32(0, 0x06054b50, true); + ev.setUint16(8, files.length, true); + ev.setUint16(10, files.length, true); + ev.setUint32(12, centralSize, true); + ev.setUint32(16, offset, true); + + return new Blob([...locals, ...centrals, end], { type: 'application/zip' }); +} + +/** + * Triggers a browser download for a blob. + * + * @param {Blob} blob Payload. + * @param {string} filename Suggested filename. + * @returns {void} + */ +function download(blob, filename) { + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = filename; + document.body.appendChild(link); + link.click(); + link.remove(); + window.setTimeout(() => URL.revokeObjectURL(url), 2000); +} + +/** + * Creates the gallery controller. + * + * @param {object} options Wiring options. + * @param {HTMLElement} options.viewerEl Viewer overlay root. + * @param {HTMLImageElement} options.imageEl Viewer image element. + * @param {HTMLElement} options.metaEl Viewer metadata line. + * @param {HTMLElement} options.countEl Settings-bar count element. + * @param {function(number): void} options.onCountChange Count change callback. + * @param {function(string): void} options.onDelete Deletion callback. + * @param {function(string): void} options.onStatus Status message callback. + * @returns {object} Gallery controller. + */ +export function createGallery(options) { + const { viewerEl, imageEl, metaEl, countEl, onCountChange, onDelete, onStatus } = options; + + let db = null; + let count = 0; + let openId = null; + let openUrl = null; + + /** + * Publishes the current capture count. + * + * @returns {void} + */ + function publishCount() { + if (countEl) countEl.textContent = String(count); + if (typeof onCountChange === 'function') onCountChange(count); + } + + /** + * Opens the database and reads the current count. + * + * @returns {Promise} + */ + async function init() { + db = await openDb(); + count = await run(db, 'readonly', (store) => store.count()); + publishCount(); + } + + /** + * Watermarks, encodes and stores one captured frame. + * + * @param {HTMLCanvasElement} frame Raw captured frame. + * @param {object} meta Measurement metadata. + * @returns {Promise} Stored capture id. + */ + async function save(frame, meta) { + if (!db) throw new Error('Gallery not ready'); + const marked = watermark(frame, meta); + const blob = await toBlob(marked, 'image/jpeg', 0.85); + const id = `cap_${meta.t}_${Math.random().toString(36).slice(2, 7)}`; + + await run(db, 'readwrite', (store) => + store.put({ + id, + t: meta.t, + distance: meta.distance, + noiseFloor: meta.noiseFloor, + threshold: meta.threshold, + kind: meta.kind || 'manual', + blob, + }), + ); + + count += 1; + publishCount(); + return id; + } + + /** + * Displays one stored capture over the video stage. + * + * @param {string} id Capture id. + * @returns {Promise} + */ + async function open(id) { + if (!db) return; + const record = await run(db, 'readonly', (store) => store.get(id)); + if (!record) return; + + if (openUrl) URL.revokeObjectURL(openUrl); + openUrl = URL.createObjectURL(record.blob); + openId = id; + + imageEl.src = openUrl; + metaEl.textContent = formatCaptureMeasurement(record); + viewerEl.hidden = false; + } + + /** + * Closes the viewer overlay and releases its object URL. + * + * @returns {void} + */ + function close() { + viewerEl.hidden = true; + imageEl.removeAttribute('src'); + if (openUrl) { + URL.revokeObjectURL(openUrl); + openUrl = null; + } + openId = null; + } + + /** + * Copies the open capture to the clipboard. + * + * The Clipboard API only reliably accepts PNG, so the JPEG is re-encoded on + * the way out. Falls back to a download where the API is unavailable. + * + * @returns {Promise} + */ + async function copyOpen() { + if (!db || !openId) return; + const record = await run(db, 'readonly', (store) => store.get(openId)); + if (!record) return; + + try { + const bitmap = await createImageBitmap(record.blob); + const canvas = document.createElement('canvas'); + canvas.width = bitmap.width; + canvas.height = bitmap.height; + canvas.getContext('2d').drawImage(bitmap, 0, 0); + const png = await toBlob(canvas, 'image/png'); + await navigator.clipboard.write([new ClipboardItem({ 'image/png': png })]); + onStatus('Capture copied to the clipboard.'); + } catch { + download(record.blob, `ghostmaxxing_${stamp(record.t, true)}.jpg`); + onStatus('Clipboard unavailable — downloaded instead.'); + } + } + + /** + * Downloads the open capture. + * + * @returns {Promise} + */ + async function downloadOpen() { + if (!db || !openId) return; + const record = await run(db, 'readonly', (store) => store.get(openId)); + if (!record) return; + download(record.blob, `ghostmaxxing_${stamp(record.t, true)}.jpg`); + } + + /** + * Deletes the open capture. + * + * @returns {Promise} + */ + async function deleteOpen() { + if (!db || !openId) return; + const id = openId; + await run(db, 'readwrite', (store) => store.delete(id)); + count = Math.max(0, count - 1); + publishCount(); + close(); + if (typeof onDelete === 'function') onDelete(id); + onStatus('Capture deleted.'); + } + + /** + * Exports every stored capture as one uncompressed archive. + * + * @returns {Promise} + */ + async function downloadAll() { + if (!db || !count) return; + onStatus('Building archive…'); + const records = await run(db, 'readonly', (store) => store.getAll()); + records.sort((a, b) => a.t - b.t); + + const files = []; + for (const record of records) { + const bytes = new Uint8Array(await record.blob.arrayBuffer()); + files.push({ + name: `ghostmaxxing_${stamp(record.t, true)}_d${record.distance.toFixed(3)}.jpg`, + bytes, + date: new Date(record.t), + }); + } + + download(buildZip(files), `ghostmaxxing_captures_${stamp(Date.now(), true)}.zip`); + onStatus(`Exported ${files.length} capture${files.length === 1 ? '' : 's'}.`); + } + + /** + * Empties the capture store. + * + * @returns {Promise} + */ + async function deleteAll() { + if (!db) return; + await run(db, 'readwrite', (store) => store.clear()); + count = 0; + publishCount(); + close(); + if (typeof onDelete === 'function') onDelete(null); + onStatus('All captures deleted from this device.'); + } + + return { + init, + save, + open, + close, + copyOpen, + downloadOpen, + deleteOpen, + downloadAll, + deleteAll, + /** + * Reports how many captures are stored. + * + * @returns {number} Capture count. + */ + size() { + return count; + }, + /** + * Reports whether the viewer overlay is showing. + * + * @returns {boolean} True while open. + */ + isOpen() { + return !viewerEl.hidden; + }, + }; +} diff --git a/lab-js/realtime/realtime-graph.js b/lab-js/realtime/realtime-graph.js new file mode 100644 index 0000000..a2a8a9a --- /dev/null +++ b/lab-js/realtime/realtime-graph.js @@ -0,0 +1,848 @@ +/** + * @module realtime-graph + * @description + * The left column: a scrollable distance plot with a FIXED time scale. + * + * Two things here are load-bearing and easy to undo by accident. + * + * 1. FIXED SCALE. The prototype stretched whatever history it had across the + * full canvas height, so ten points and two hundred points both filled the + * panel and a trace's steepness meant nothing. Every sample now occupies + * the same number of pixels. The visible window is 60 seconds, always. + * + * 2. CONTINUOUS QUALITY STATES. Descriptor values keep flowing when pose, + * framing or light are not comparable, but their background says why they + * are excluded from measurements. No-face ticks keep time without inventing + * a value. Each state can be hidden non-destructively from the legend. + * + * Rendering is virtualised: the canvas is sticky and sized to the scroll + * viewport, a spacer supplies the scroll height, and only the visible slice is + * drawn. Render work and canvas memory stay bounded; compact timeline entries + * grow with the session. Growing one tall canvas instead would hit the ~32k px + * dimension cap after ~45 minutes and hold ~30MB on the way there. + */ + +const GAP_BLOCK_PX = 30; +const EVENT_BLOCK_PX = 24; +const AXIS_STRIP_PX = 17; +const PAD_LEFT = 6; +const GUTTER_RIGHT = 24; +const MARKER_RADIUS = 7; +const FOLLOW_SLACK_PX = 10; + +/** + * Formats a duration in milliseconds as a compact human string. + * + * @param {number} ms Duration in milliseconds. + * @returns {string} Compact duration such as "8m 12s" or "4s". + */ +export function formatDuration(ms) { + const totalSeconds = Math.max(0, Math.round(ms / 1000)); + const hours = Math.floor(totalSeconds / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + if (hours) return `${hours}h ${minutes}m`; + if (minutes) return `${minutes}m ${seconds}s`; + return `${seconds}s`; +} + +/** + * Formats a timestamp as a zero-padded wall clock label. + * + * @param {number} timestamp Epoch milliseconds. + * @returns {string} Clock label such as "14:32:07". + */ +function formatClock(timestamp) { + const date = new Date(timestamp); + const hh = String(date.getHours()).padStart(2, '0'); + const mm = String(date.getMinutes()).padStart(2, '0'); + const ss = String(date.getSeconds()).padStart(2, '0'); + return `${hh}:${mm}:${ss}`; +} + +/** + * Reads a resolved CSS custom property from an element with a fallback. + * + * @param {Element} el Element whose computed style is read. + * @param {string} name Custom property name including leading dashes. + * @param {string} fallback Value used when the property resolves empty. + * @returns {string} Resolved colour string. + */ +function token(el, name, fallback) { + const value = getComputedStyle(el).getPropertyValue(name).trim(); + return value || fallback; +} + +/** + * Creates the virtualised distance graph controller. + * + * @param {object} options Wiring and tuning options. + * @param {HTMLElement} options.scrollEl Scroll container element. + * @param {HTMLElement} options.spacerEl Spacer element supplying scroll height. + * @param {HTMLCanvasElement} options.canvasEl Sticky canvas element. + * @param {HTMLElement} options.followEl "Jump to now" button. + * @param {number} options.windowSeconds Seconds visible in one viewport. + * @param {number} options.samplesPerSecond Sample cadence used for layout. + * @param {number} options.maxDistance Right edge of the distance axis. + * @param {number} options.threshold Cited match threshold line. + * @param {function(string): void} options.onMarkerClick Marker click handler. + * @returns {object} Graph controller. + */ +export function createGraph(options) { + const { + scrollEl, + spacerEl, + canvasEl, + followEl, + windowSeconds, + samplesPerSecond, + maxDistance, + threshold, + onMarkerClick, + } = options; + + const ctx = canvasEl.getContext('2d'); + + /** @type {Array} */ + let entries = []; + /** @type {number[]} */ + let tops = []; + let contentHeight = 0; + let sampleSeq = 0; + let openGapIndex = -1; + + let noiseFloor = null; + const qualityVisible = new Map([ + ['valid', true], + ['outside-guide', true], + ['lighting', true], + ['no-face', true], + ]); + let follow = true; + let programmaticScroll = false; + + let viewportH = 0; + let viewportW = 0; + let pxPerSample = 4; + let labelEvery = samplesPerSecond * 10; + + /** + * Height in CSS pixels contributed by one timeline entry. + * + * @param {object} entry Timeline entry. + * @returns {number} Entry height. + */ + function entryHeight(entry) { + if (entry.kind === 'gap') return GAP_BLOCK_PX; + if (entry.kind === 'event') return EVENT_BLOCK_PX; + if (qualityVisible.get(entry.status || 'valid') === false) return 0; + return pxPerSample; + } + + /** + * Rebuilds cumulative offsets. O(n), called only on resize. + * + * @returns {void} + */ + function relayout() { + tops = new Array(entries.length); + let acc = 0; + for (let i = 0; i < entries.length; i += 1) { + tops[i] = acc; + acc += entryHeight(entries[i]); + } + contentHeight = acc; + syncSpacer(); + } + + /** + * Applies the current virtual height to the scroll spacer. + * + * @returns {void} + */ + function syncSpacer() { + spacerEl.style.height = `${Math.round(Math.max(contentHeight, viewportH))}px`; + } + + /** + * Scrolls to the live edge without tripping the follow-disengage handler. + * + * @returns {void} + */ + function scrollToNow() { + programmaticScroll = true; + scrollEl.scrollTop = scrollEl.scrollHeight; + window.requestAnimationFrame(() => { + programmaticScroll = false; + }); + } + + /** + * Shows or hides the "Jump to now" affordance. + * + * @returns {void} + */ + function syncFollowButton() { + followEl.hidden = follow; + } + + /** + * Binary search for the last entry whose top is at or above a virtual y. + * + * @param {number} y Virtual y offset in CSS pixels. + * @returns {number} Index of the entry containing y. + */ + function indexAt(y) { + let lo = 0; + let hi = tops.length - 1; + let best = 0; + while (lo <= hi) { + const mid = (lo + hi) >> 1; + if (tops[mid] <= y) { + best = mid; + lo = mid + 1; + } else { + hi = mid - 1; + } + } + return best; + } + + /** + * Maps a distance value to a canvas x coordinate, clamped to the axis. + * + * @param {number} value Distance value. + * @returns {number} Canvas x in CSS pixels. + */ + function xFor(value) { + const plotWidth = viewportW - PAD_LEFT - GUTTER_RIGHT; + const normalized = Math.max(0, Math.min(1, value / maxDistance)); + return PAD_LEFT + normalized * plotWidth; + } + + /** + * Repaints the visible slice of the timeline. + * + * @returns {void} + */ + function draw() { + if (!ctx || viewportW <= 0 || viewportH <= 0) return; + + const colors = { + plotBg: token(canvasEl, '--rt-plot-bg', '#2c2318'), + trace: token(canvasEl, '--rt-trace', '#ffe7a8'), + thresholdLine: token(canvasEl, '--rt-threshold', '#f3c747'), + noise: token(canvasEl, '--rt-noise', '#7fe3b0'), + grid: token(canvasEl, '--rt-grid', 'rgba(255,231,168,0.08)'), + gap: token(canvasEl, '--rt-gap', '#8a7b6a'), + faint: token(canvasEl, '--rt-gap', '#8a7b6a'), + applying: token(canvasEl, '--rt-phase-applying', 'rgba(242,106,27,0.13)'), + measuring: token(canvasEl, '--rt-phase-measuring', 'rgba(127,227,176,0.13)'), + eventApplying: token(canvasEl, '--rt-event-applying', '#f26a1b'), + eventMeasuring: token(canvasEl, '--rt-event-measuring', '#7fe3b0'), + outsideGuide: token(canvasEl, '--rt-quality-outside', 'rgba(242,106,27,0.22)'), + lighting: token(canvasEl, '--rt-quality-light', 'rgba(243,199,71,0.20)'), + noFace: token(canvasEl, '--rt-quality-no-face', 'rgba(138,123,106,0.24)'), + }; + + const scrollTop = scrollEl.scrollTop; + const plotWidth = viewportW - PAD_LEFT - GUTTER_RIGHT; + + ctx.clearRect(0, 0, viewportW, viewportH); + ctx.fillStyle = colors.plotBg; + ctx.fillRect(0, 0, viewportW, viewportH); + + // Axis ticks. These carry no claim; they exist so a value can be read off + // the trace. Kept at hairline weight so they never compete with the two + // reference lines below, which do carry claims. + ctx.strokeStyle = colors.grid; + ctx.lineWidth = 1; + for (const value of [0.25, 0.5, 0.75, 1.0, 1.25]) { + if (value > maxDistance) continue; + const x = Math.round(xFor(value)) + 0.5; + ctx.beginPath(); + ctx.moveTo(x, 0); + ctx.lineTo(x, viewportH); + ctx.stroke(); + } + + if (noiseFloor !== null) { + const x = Math.round(xFor(noiseFloor)) + 0.5; + ctx.strokeStyle = colors.noise; + ctx.lineWidth = 1.5; + ctx.setLineDash([3, 3]); + ctx.beginPath(); + ctx.moveTo(x, 0); + ctx.lineTo(x, viewportH); + ctx.stroke(); + ctx.setLineDash([]); + } + + const thresholdX = Math.round(xFor(threshold)) + 0.5; + ctx.strokeStyle = colors.thresholdLine; + ctx.lineWidth = 2; + ctx.beginPath(); + ctx.moveTo(thresholdX, 0); + ctx.lineTo(thresholdX, viewportH); + ctx.stroke(); + + if (entries.length) { + const firstIndex = indexAt(Math.max(0, scrollTop - GAP_BLOCK_PX)); + const limit = scrollTop + viewportH; + + // Session phases remain visible behind the trace. They are declared by + // the operator and therefore describe workflow, not an inferred cause. + for (let i = firstIndex; i < entries.length; i += 1) { + const top = tops[i]; + if (top > limit) break; + const entry = entries[i]; + const y = top - scrollTop; + if (entry.kind === 'sample' && qualityVisible.get(entry.status || 'valid') === false) { + continue; + } + if (entry.kind === 'sample' && entry.phase === 'applying') { + ctx.fillStyle = colors.applying; + ctx.fillRect(PAD_LEFT, y, plotWidth, pxPerSample); + } else if (entry.kind === 'sample' && entry.phase === 'measuring') { + ctx.fillStyle = colors.measuring; + ctx.fillRect(PAD_LEFT, y, plotWidth, pxPerSample); + } else if (entry.kind === 'event') { + drawEvent(entry, y, colors, plotWidth); + } + if (entry.kind === 'sample' && qualityVisible.get(entry.status) !== false) { + const qualityColor = { + 'outside-guide': colors.outsideGuide, + lighting: colors.lighting, + 'no-face': colors.noFace, + }[entry.status]; + if (qualityColor) { + ctx.fillStyle = qualityColor; + ctx.fillRect(PAD_LEFT, y, plotWidth, pxPerSample); + } + } + } + + ctx.lineWidth = 2; + ctx.strokeStyle = colors.trace; + ctx.lineJoin = 'round'; + + let penDown = false; + ctx.beginPath(); + + for (let i = firstIndex; i < entries.length; i += 1) { + const top = tops[i]; + if (top > limit) break; + const entry = entries[i]; + const y = top - scrollTop; + + const hiddenQuality = entry.kind === 'sample' && qualityVisible.get(entry.status || 'valid') === false; + if (hiddenQuality) continue; + if (entry.kind === 'gap' || entry.kind === 'event' || entry.value == null) { + if (penDown) { + ctx.stroke(); + ctx.beginPath(); + penDown = false; + } + // Events were already painted in the phase-background pass. They + // interrupt the trace, but they are not absence blocks. + if (entry.kind === 'gap') drawGap(entry, y, colors, plotWidth); + continue; + } + + const x = xFor(entry.value); + const yMid = y + pxPerSample / 2; + if (!penDown) { + ctx.moveTo(x, yMid); + penDown = true; + } else { + ctx.lineTo(x, yMid); + } + + if (entry.value > maxDistance) { + ctx.stroke(); + drawOverflow(yMid, colors.trace); + ctx.beginPath(); + ctx.moveTo(x, yMid); + } + } + + if (penDown) ctx.stroke(); + + // Second pass so markers and labels sit above the trace. + for (let i = firstIndex; i < entries.length; i += 1) { + const top = tops[i]; + if (top > limit) break; + const entry = entries[i]; + if (entry.kind !== 'sample') continue; + if (qualityVisible.get(entry.status || 'valid') === false) continue; + const yMid = top - scrollTop + pxPerSample / 2; + + if (entry.seq % labelEvery === 0) { + ctx.fillStyle = colors.faint; + ctx.font = '9px ui-monospace, SFMono-Regular, Menlo, monospace'; + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + ctx.fillText(formatClock(entry.t), PAD_LEFT + 2, yMid); + } + + if (entry.captureId && entry.value != null && qualityVisible.get(entry.status) !== false) { + drawMarker(yMid, colors); + } + } + } + + drawAxisStrip(colors); + } + + /** + * Draws a collapsed absence block with its true duration. + * + * @param {object} entry Gap entry. + * @param {number} y Canvas y of the block top. + * @param {object} colors Resolved palette. + * @param {number} plotWidth Usable plot width in CSS pixels. + * @returns {void} + */ + function drawGap(entry, y, colors, plotWidth) { + const endT = entry.endT ?? Date.now(); + ctx.save(); + ctx.beginPath(); + ctx.rect(PAD_LEFT, y, plotWidth, GAP_BLOCK_PX); + ctx.clip(); + + ctx.strokeStyle = colors.gap; + ctx.globalAlpha = 0.32; + ctx.lineWidth = 1; + for (let hx = -GAP_BLOCK_PX; hx < plotWidth + GAP_BLOCK_PX; hx += 7) { + ctx.beginPath(); + ctx.moveTo(PAD_LEFT + hx, y + GAP_BLOCK_PX); + ctx.lineTo(PAD_LEFT + hx + GAP_BLOCK_PX, y); + ctx.stroke(); + } + ctx.restore(); + + ctx.strokeStyle = colors.gap; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.moveTo(PAD_LEFT, Math.round(y) + 0.5); + ctx.lineTo(PAD_LEFT + plotWidth, Math.round(y) + 0.5); + ctx.moveTo(PAD_LEFT, Math.round(y + GAP_BLOCK_PX) + 0.5); + ctx.lineTo(PAD_LEFT + plotWidth, Math.round(y + GAP_BLOCK_PX) + 0.5); + ctx.stroke(); + + const label = `${entry.label || 'no face'} · ${formatDuration(endT - entry.t)}`; + ctx.font = '9px ui-monospace, SFMono-Regular, Menlo, monospace'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + const metrics = ctx.measureText(label); + const cx = PAD_LEFT + plotWidth / 2; + const cy = y + GAP_BLOCK_PX / 2; + + ctx.fillStyle = token(canvasEl, '--rt-plot-bg', '#2c2318'); + ctx.fillRect(cx - metrics.width / 2 - 5, cy - 7, metrics.width + 10, 14); + ctx.fillStyle = colors.gap; + ctx.fillText(label, cx, cy); + } + + /** + * Draws an operator-declared session event. + * + * @param {object} entry Timeline event. + * @param {number} y Canvas y. + * @param {object} colors Resolved palette. + * @param {number} plotWidth Plot width. + * @returns {void} + */ + function drawEvent(entry, y, colors, plotWidth) { + // Opaque base deliberately masks the vertical threshold/noise/grid lines; + // event labels must remain readable where those references cross them. + ctx.fillStyle = colors.plotBg; + ctx.fillRect(PAD_LEFT, y, plotWidth, EVENT_BLOCK_PX); + ctx.fillStyle = entry.phase === 'measuring' ? colors.measuring : colors.applying; + ctx.fillRect(PAD_LEFT, y, plotWidth, EVENT_BLOCK_PX); + const eventColor = entry.phase === 'measuring' + ? colors.eventMeasuring + : colors.eventApplying; + ctx.strokeStyle = eventColor; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.moveTo(PAD_LEFT, Math.round(y) + 0.5); + ctx.lineTo(PAD_LEFT + plotWidth, Math.round(y) + 0.5); + ctx.moveTo(PAD_LEFT, Math.round(y + EVENT_BLOCK_PX) + 0.5); + ctx.lineTo(PAD_LEFT + plotWidth, Math.round(y + EVENT_BLOCK_PX) + 0.5); + ctx.stroke(); + ctx.fillStyle = eventColor; + ctx.font = '9px ui-monospace, SFMono-Regular, Menlo, monospace'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.fillText(entry.label, PAD_LEFT + plotWidth / 2, y + EVENT_BLOCK_PX / 2); + } + + /** + * Draws the off-axis indicator for a sample beyond the plotted ceiling. + * + * @param {number} y Canvas y of the sample. + * @param {string} color Trace colour. + * @returns {void} + */ + function drawOverflow(y, color) { + const x = viewportW - GUTTER_RIGHT; + ctx.fillStyle = color; + ctx.beginPath(); + ctx.moveTo(x, y - 3.5); + ctx.lineTo(x + 5, y); + ctx.lineTo(x, y + 3.5); + ctx.closePath(); + ctx.fill(); + } + + /** + * Draws a saved-capture marker in the right gutter with a connector. + * + * @param {number} y Canvas y of the marked sample. + * @param {object} colors Resolved palette. + * @returns {void} + */ + function drawMarker(y, colors) { + const cx = viewportW - GUTTER_RIGHT / 2; + + ctx.strokeStyle = colors.grid; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.moveTo(viewportW - GUTTER_RIGHT, y); + ctx.lineTo(cx - MARKER_RADIUS, y); + ctx.stroke(); + + ctx.fillStyle = token(canvasEl, '--rt-plot-bg', '#2c2318'); + ctx.strokeStyle = colors.trace; + ctx.lineWidth = 1.25; + ctx.beginPath(); + ctx.arc(cx, y, MARKER_RADIUS, 0, Math.PI * 2); + ctx.fill(); + ctx.stroke(); + + ctx.fillStyle = colors.trace; + ctx.fillRect(cx - 3.5, y - 2, 7, 4.5); + ctx.fillStyle = token(canvasEl, '--rt-plot-bg', '#2c2318'); + ctx.beginPath(); + ctx.arc(cx, y + 0.25, 1.4, 0, Math.PI * 2); + ctx.fill(); + } + + /** + * Draws the pinned scale strip. The canvas is sticky, so anything painted at + * fixed canvas coordinates behaves as a fixed overlay while content scrolls. + * + * @param {object} colors Resolved palette. + * @returns {void} + */ + function drawAxisStrip(colors) { + ctx.fillStyle = token(canvasEl, '--rt-surface-solid', 'rgba(12,9,6,0.86)'); + ctx.fillRect(0, 0, viewportW, AXIS_STRIP_PX); + ctx.strokeStyle = colors.grid; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.moveTo(0, AXIS_STRIP_PX + 0.5); + ctx.lineTo(viewportW, AXIS_STRIP_PX + 0.5); + ctx.stroke(); + + ctx.font = '9px ui-monospace, SFMono-Regular, Menlo, monospace'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = colors.faint; + + const ticks = [0, 0.5, 1.0]; + for (const value of ticks) { + if (value > maxDistance) continue; + const x = xFor(value); + ctx.textAlign = value === 0 ? 'left' : 'center'; + ctx.fillText(value.toFixed(1), x, AXIS_STRIP_PX / 2); + } + + ctx.textAlign = 'center'; + ctx.fillStyle = colors.thresholdLine; + ctx.fillText('0.6', xFor(threshold), AXIS_STRIP_PX / 2); + } + + /** + * Recomputes canvas backing store and layout for the current viewport. + * + * @returns {void} + */ + function resize() { + const rect = scrollEl.getBoundingClientRect(); + const nextW = Math.max(Math.floor(rect.width), 1); + const nextH = Math.max(Math.floor(rect.height), 1); + const dpr = Math.max(window.devicePixelRatio || 1, 1); + + viewportW = nextW; + viewportH = nextH; + pxPerSample = viewportH / (windowSeconds * samplesPerSecond); + labelEvery = samplesPerSecond * 10; + + canvasEl.style.height = `${nextH}px`; + canvasEl.width = Math.floor(nextW * dpr); + canvasEl.height = Math.floor(nextH * dpr); + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + + relayout(); + if (follow) scrollToNow(); + draw(); + } + + /** + * Appends one measured sample at the live edge. + * + * @param {number} t Epoch milliseconds of the sample. + * @param {number|null} value Averaged raw distance, or null when no face exists. + * @param {string} [phase] Operator-declared session phase. + * @param {'valid'|'outside-guide'|'lighting'|'no-face'} [status] Comparability state. + * @returns {number} Index of the appended entry. + */ + function pushSample(t, value, phase = 'ready', status = 'valid') { + openGapIndex = -1; + const entry = { kind: 'sample', t, value, phase, status, seq: sampleSeq }; + sampleSeq += 1; + tops.push(contentHeight); + entries.push(entry); + contentHeight += pxPerSample; + syncSpacer(); + if (follow) scrollToNow(); + draw(); + return entries.length - 1; + } + + /** + * Opens an absence block, or extends the one already open. + * + * @param {number} t Epoch milliseconds when the face was last seen. + * @param {string} [label] Human-readable exclusion reason. + * @returns {void} + */ + function beginGap(t, label = 'no face') { + if (openGapIndex !== -1) { + const open = entries[openGapIndex]; + if (open.label !== label) { + endGap(t); + beginGap(t, label); + return; + } + draw(); + return; + } + const entry = { kind: 'gap', t, endT: null, label }; + tops.push(contentHeight); + entries.push(entry); + contentHeight += GAP_BLOCK_PX; + openGapIndex = entries.length - 1; + syncSpacer(); + if (follow) scrollToNow(); + draw(); + } + + /** + * Closes the open absence block. + * + * @param {number} t Epoch milliseconds when the face returned. + * @returns {void} + */ + function endGap(t) { + if (openGapIndex === -1) return; + entries[openGapIndex].endT = t; + openGapIndex = -1; + draw(); + } + + /** + * Adds an operator-declared phase marker to the timeline. + * + * @param {number} t Epoch milliseconds. + * @param {string} phase Session phase. + * @param {string} label Visible marker label. + * @returns {void} + */ + function addEvent(t, phase, label) { + endGap(t); + const entry = { kind: 'event', t, phase, label }; + tops.push(contentHeight); + entries.push(entry); + contentHeight += EVENT_BLOCK_PX; + syncSpacer(); + if (follow) scrollToNow(); + draw(); + } + + /** + * Attaches a saved capture to the most recent sample. + * + * @param {string} captureId Identifier of the stored capture. + * @returns {void} + */ + function markLatestCapture(captureId) { + for (let i = entries.length - 1; i >= 0; i -= 1) { + if (entries[i].kind === 'sample') { + entries[i].captureId = captureId; + draw(); + return; + } + } + } + + /** + * Removes a capture marker after the capture is deleted. + * + * @param {string} captureId Identifier of the removed capture. + * @returns {void} + */ + function clearCapture(captureId) { + for (const entry of entries) { + if (entry.captureId === captureId) delete entry.captureId; + } + draw(); + } + + /** + * Sets the measured noise floor drawn as the lower reference line. + * + * @param {number|null} value Measured noise floor, or null to hide it. + * @returns {void} + */ + function setNoiseFloor(value) { + noiseFloor = value; + draw(); + } + + /** Shows or hides one quality state without deleting its samples. */ + function setQualityVisible(status, visible) { + if (!qualityVisible.has(status)) return; + qualityVisible.set(status, Boolean(visible)); + relayout(); + if (follow) scrollToNow(); + draw(); + } + + /** + * Clears the timeline and returns to the live edge. + * + * @returns {void} + */ + function reset() { + entries = []; + tops = []; + contentHeight = 0; + sampleSeq = 0; + openGapIndex = -1; + follow = true; + syncFollowButton(); + syncSpacer(); + scrollToNow(); + draw(); + } + + /** + * Resolves a pointer event to a capture marker, if one was hit. + * + * @param {PointerEvent|MouseEvent} event Pointer event on the canvas. + * @returns {string|null} Capture id, or null when nothing was hit. + */ + function markerAt(event) { + const rect = canvasEl.getBoundingClientRect(); + const x = event.clientX - rect.left; + if (x < viewportW - GUTTER_RIGHT - MARKER_RADIUS) return null; + + const virtualY = scrollEl.scrollTop + (event.clientY - rect.top); + const index = indexAt(virtualY); + + for (let i = Math.max(0, index - 3); i <= Math.min(entries.length - 1, index + 3); i += 1) { + const entry = entries[i]; + if (entry.kind !== 'sample' || !entry.captureId) continue; + if (qualityVisible.get(entry.status || 'valid') === false) continue; + const centre = tops[i] + pxPerSample / 2; + if (Math.abs(centre - virtualY) <= MARKER_RADIUS + 3) return entry.captureId; + } + return null; + } + + scrollEl.addEventListener('scroll', () => { + if (programmaticScroll) { + draw(); + return; + } + const distanceFromBottom = + scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight; + follow = distanceFromBottom <= FOLLOW_SLACK_PX; + syncFollowButton(); + draw(); + }); + + canvasEl.addEventListener('click', (event) => { + const captureId = markerAt(event); + if (captureId && typeof onMarkerClick === 'function') onMarkerClick(captureId); + }); + + canvasEl.addEventListener('pointermove', (event) => { + canvasEl.classList.toggle('is-clickable', Boolean(markerAt(event))); + }); + + followEl.addEventListener('click', () => { + follow = true; + syncFollowButton(); + scrollToNow(); + draw(); + }); + + const observer = new ResizeObserver(() => resize()); + observer.observe(scrollEl); + + return { + resize, + draw, + reset, + pushSample, + beginGap, + endGap, + addEvent, + markLatestCapture, + clearCapture, + setNoiseFloor, + setQualityVisible, + /** + * Reports timeline size for diagnostics and tests. + * + * @returns {object} Timeline counts and filter state. + */ + stats() { + let samples = 0; + let visibleSamples = 0; + let gaps = 0; + let events = 0; + const quality = { valid: 0, 'outside-guide': 0, lighting: 0, 'no-face': 0 }; + for (const entry of entries) { + if (entry.kind === 'gap') gaps += 1; + else if (entry.kind === 'event') events += 1; + else { + samples += 1; + if (qualityVisible.get(entry.status || 'valid') !== false) visibleSamples += 1; + quality[entry.status || 'valid'] = (quality[entry.status || 'valid'] || 0) + 1; + } + } + return { + samples, + visibleSamples, + virtualHeight: contentHeight, + gaps, + events, + following: follow, + quality, + qualityVisible: Object.fromEntries(qualityVisible), + }; + }, + /** + * Disconnects observers held by the graph. + * + * @returns {void} + */ + destroy() { + observer.disconnect(); + }, + }; +} diff --git a/lab-js/realtime/realtime-guide.js b/lab-js/realtime/realtime-guide.js new file mode 100644 index 0000000..e578915 --- /dev/null +++ b/lab-js/realtime/realtime-guide.js @@ -0,0 +1,159 @@ +/** + * @module realtime-guide + * @description Draws the baseline's normalized face geometry over the video. + * The overlay is a positioning memory aid, not a mask or a measurement. + */ + +const JAW = Array.from({ length: 17 }, (_, index) => index); +const LEFT_EYE = [36, 37, 38, 39, 40, 41]; +const RIGHT_EYE = [42, 43, 44, 45, 46, 47]; + +/** True when Space belongs to the page rather than a focused control. */ +export function canUseGuideShortcut(target) { + if (!(target instanceof Element)) return true; + if (target.closest('button, input, select, textarea, summary, video, [contenteditable="true"], [role="dialog"]')) { + return false; + } + return true; +} + +/** + * Creates a temporary baseline-guide overlay. + * + * @param {object} options Controller wiring. + * @param {HTMLCanvasElement} options.canvasEl Overlay canvas. + * @param {HTMLVideoElement} options.videoEl Video whose object-fit is mirrored. + * @param {HTMLElement} options.stageEl Canvas positioning container. + * @returns {object} Guide controller. + */ +export function createBaselineGuide({ canvasEl, videoEl, stageEl }) { + const ctx = canvasEl.getContext('2d'); + let guide = null; + let fadeTimer = null; + let hideTimer = null; + + function clearTimers() { + if (fadeTimer) window.clearTimeout(fadeTimer); + if (hideTimer) window.clearTimeout(hideTimer); + fadeTimer = null; + hideTimer = null; + } + + function pointMapper(width, height) { + const stageRect = stageEl.getBoundingClientRect(); + const videoRect = videoEl.getBoundingClientRect(); + const sourceW = guide.aspectRatio; + const sourceH = 1; + const fit = getComputedStyle(videoEl).objectFit || 'fill'; + const scale = fit === 'cover' + ? Math.max(videoRect.width / sourceW, videoRect.height / sourceH) + : Math.min(videoRect.width / sourceW, videoRect.height / sourceH); + const renderedW = sourceW * scale; + const renderedH = sourceH * scale; + const offsetX = videoRect.left - stageRect.left + (videoRect.width - renderedW) / 2; + const offsetY = videoRect.top - stageRect.top + (videoRect.height - renderedH) / 2; + const mirrored = videoEl.classList.contains('source-camera'); + return ({ x, y }) => ({ + x: mirrored ? width - (offsetX + x * sourceW * scale) : offsetX + x * sourceW * scale, + y: Math.min(height, Math.max(0, offsetY + y * sourceH * scale)), + }); + } + + function strokePath(points, close = false) { + if (!points.length) return; + ctx.beginPath(); + ctx.moveTo(points[0].x, points[0].y); + for (let index = 1; index < points.length; index += 1) ctx.lineTo(points[index].x, points[index].y); + if (close) ctx.closePath(); + ctx.stroke(); + } + + /** Paints the guide using the current stage geometry. */ + function draw() { + const rect = stageEl.getBoundingClientRect(); + const width = Math.max(1, Math.floor(rect.width)); + const height = Math.max(1, Math.floor(rect.height)); + const dpr = Math.max(1, window.devicePixelRatio || 1); + canvasEl.width = Math.floor(width * dpr); + canvasEl.height = Math.floor(height * dpr); + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + ctx.clearRect(0, 0, width, height); + if (!guide) return; + + const map = pointMapper(width, height); + const landmarks = guide.landmarks.map(map); + const box = guide.box; + const boxTopLeft = map({ x: box.x, y: box.y }); + const boxTopRight = map({ x: box.x + box.width, y: box.y }); + const jaw = JAW.map((index) => landmarks[index]); + const leftEye = LEFT_EYE.map((index) => landmarks[index]); + const rightEye = RIGHT_EYE.map((index) => landmarks[index]); + const nose = landmarks[30]; + + ctx.strokeStyle = getComputedStyle(canvasEl).getPropertyValue('--rt-guide').trim() || '#ffe7a8'; + ctx.fillStyle = ctx.strokeStyle; + ctx.lineWidth = 1.5; + ctx.setLineDash([6, 5]); + strokePath(jaw); + + // face-api has no scalp landmarks. The upper reference is therefore an + // explicit detector-box arc, connected to the jaw endpoints. + const leftJaw = jaw[0]; + const rightJaw = jaw[jaw.length - 1]; + const topY = Math.min(boxTopLeft.y, boxTopRight.y); + const centerX = (leftJaw.x + rightJaw.x) / 2; + const radiusX = Math.abs(rightJaw.x - leftJaw.x) / 2; + const radiusY = Math.max(12, Math.max(leftJaw.y, rightJaw.y) - topY); + ctx.beginPath(); + ctx.ellipse(centerX, Math.max(leftJaw.y, rightJaw.y), radiusX, radiusY, 0, Math.PI, Math.PI * 2); + ctx.stroke(); + + ctx.setLineDash([]); + strokePath(leftEye, true); + strokePath(rightEye, true); + const eyeA = landmarks[36]; + const eyeB = landmarks[45]; + strokePath([eyeA, eyeB]); + ctx.beginPath(); + ctx.arc(nose.x, nose.y, 3.5, 0, Math.PI * 2); + ctx.fill(); + } + + function hide() { + clearTimers(); + canvasEl.classList.remove('is-visible', 'is-fading'); + } + + function show() { + if (!guide) return false; + clearTimers(); + draw(); + canvasEl.classList.remove('is-fading'); + canvasEl.classList.add('is-visible'); + fadeTimer = window.setTimeout(() => canvasEl.classList.add('is-fading'), 1000); + hideTimer = window.setTimeout(hide, 1600); + return true; + } + + const observer = new ResizeObserver(() => { + if (canvasEl.classList.contains('is-visible')) draw(); + }); + observer.observe(stageEl); + + return { + draw, + show, + hide, + setGuide(value) { + guide = value || null; + if (!guide) hide(); + }, + hasGuide() { + return Boolean(guide); + }, + destroy() { + clearTimers(); + observer.disconnect(); + }, + }; +} diff --git a/lab-js/realtime/realtime-radial.js b/lab-js/realtime/realtime-radial.js new file mode 100644 index 0000000..d3a24c7 --- /dev/null +++ b/lab-js/realtime/realtime-radial.js @@ -0,0 +1,166 @@ +/** + * @module realtime-radial + * @description + * A compact distribution of descriptor change. Absolute deltas are ranked, + * then reduced into 16 RMS bands. The spokes are magnitudes, not stable latent + * coordinates or facial regions. + */ + +/** + * Sorts absolute descriptor deltas and reduces them to equal-sized RMS bands. + * Ranking makes the plot legible while deliberately discarding coordinate + * identity: it compares the distribution of change, not where change lives. + * + * @param {Float32Array|number[]} values Descriptor deltas. + * @param {number} [bandCount=16] Number of ranked bands. + * @returns {number[]} Ascending RMS magnitudes. + */ +export function rankedDeltaBands(values, bandCount = 16) { + const ranked = Array.from(values || [], (value) => Number.isFinite(value) ? Math.abs(value) : 0) + .sort((a, b) => a - b); + if (!ranked.length || bandCount < 1) return []; + return Array.from({ length: Math.min(bandCount, ranked.length) }, (_, index) => { + const start = Math.floor((index * ranked.length) / bandCount); + const end = Math.max(start + 1, Math.floor(((index + 1) * ranked.length) / bandCount)); + const band = ranked.slice(start, end); + return Math.sqrt(band.reduce((sum, value) => sum + value * value, 0) / band.length); + }); +} + +/** + * Converts descriptor deltas to radial points. + * + * @param {Float32Array|number[]} values Signed descriptor deltas. + * @param {object} [options] Geometry and scale. + * @param {number} [options.centerX=0] Plot centre x. + * @param {number} [options.centerY=0] Plot centre y. + * @param {number} [options.radius=1] Maximum radius. + * @param {number} [options.maxValue=0.15] Delta mapped to the outer ring. + * @returns {Array<{x: number, y: number, value: number, index: number}>} Points in descriptor order. + */ +export function radialPoints(values, options = {}) { + const { + centerX = 0, + centerY = 0, + radius = 1, + maxValue = 0.15, + } = options; + const count = values?.length || 0; + if (!count) return []; + + return Array.from(values, (raw, index) => { + const value = Number.isFinite(raw) ? Math.abs(raw) : 0; + const magnitude = Math.min(1, value / maxValue) * radius; + const angle = -Math.PI / 2 + (index / count) * Math.PI * 2; + return { + x: centerX + Math.cos(angle) * magnitude, + y: centerY + Math.sin(angle) * magnitude, + value, + index, + }; + }); +} + +/** + * Creates the live/snapshot radial descriptor plot. + * + * @param {object} options Controller options. + * @param {HTMLCanvasElement} options.canvasEl Plot canvas. + * @param {number} [options.maxDelta=0.15] Delta mapped to the outer ring. + * @returns {object} Plot controller. + */ +export function createRadialGraph({ canvasEl, maxDelta = 0.15 }) { + const ctx = canvasEl.getContext('2d'); + let live = null; + let measured = null; + + function css(name, fallback) { + const value = getComputedStyle(canvasEl).getPropertyValue(name).trim(); + return value || fallback; + } + + function path(points) { + if (!points.length) return; + ctx.beginPath(); + ctx.moveTo(points[0].x, points[0].y); + for (let index = 1; index < points.length; index += 1) { + ctx.lineTo(points[index].x, points[index].y); + } + ctx.closePath(); + } + + /** Repaints the plot from the current live and measured deltas. */ + function draw() { + const rect = canvasEl.getBoundingClientRect(); + const width = Math.max(1, Math.floor(rect.width)); + const height = Math.max(1, Math.floor(rect.height)); + const dpr = Math.max(1, window.devicePixelRatio || 1); + if (canvasEl.width !== Math.floor(width * dpr) || canvasEl.height !== Math.floor(height * dpr)) { + canvasEl.width = Math.floor(width * dpr); + canvasEl.height = Math.floor(height * dpr); + } + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + ctx.clearRect(0, 0, width, height); + + const centerX = width / 2; + const centerY = height / 2; + const radius = Math.max(4, Math.min(width, height) / 2 - 10); + const grid = css('--rt-grid', 'rgba(255,231,168,0.12)'); + + ctx.strokeStyle = grid; + ctx.lineWidth = 1; + for (const fraction of [0.25, 0.5, 0.75, 1]) { + ctx.beginPath(); + ctx.arc(centerX, centerY, radius * fraction, 0, Math.PI * 2); + ctx.stroke(); + } + for (let index = 0; index < 16; index += 1) { + const angle = -Math.PI / 2 + (index / 16) * Math.PI * 2; + ctx.beginPath(); + ctx.moveTo(centerX, centerY); + ctx.lineTo(centerX + Math.cos(angle) * radius, centerY + Math.sin(angle) * radius); + ctx.stroke(); + } + + if (measured?.length) { + const points = radialPoints(measured, { centerX, centerY, radius, maxValue: maxDelta }); + path(points); + ctx.fillStyle = css('--rt-radial-measured-fill', 'rgba(242,106,27,0.25)'); + ctx.strokeStyle = css('--rt-radial-measured', '#f26a1b'); + ctx.lineWidth = 1.5; + ctx.fill(); + ctx.stroke(); + } + + if (live?.length) { + const points = radialPoints(live, { centerX, centerY, radius, maxValue: maxDelta }); + path(points); + ctx.strokeStyle = css('--rt-radial-live', '#ffe7a8'); + ctx.lineWidth = 1; + ctx.stroke(); + } + } + + const observer = new ResizeObserver(draw); + observer.observe(canvasEl); + + return { + draw, + setLive(values) { + live = values ? rankedDeltaBands(values) : null; + draw(); + }, + setMeasured(values) { + measured = values ? rankedDeltaBands(values) : null; + draw(); + }, + reset() { + live = null; + measured = null; + draw(); + }, + destroy() { + observer.disconnect(); + }, + }; +} diff --git a/lab-js/realtime/realtime-settings.js b/lab-js/realtime/realtime-settings.js new file mode 100644 index 0000000..0716a53 --- /dev/null +++ b/lab-js/realtime/realtime-settings.js @@ -0,0 +1,263 @@ +/** + * @module realtime-settings + * @description + * The bottom bar over the video stage, plus the persistence behind it. + * + * The match threshold is deliberately NOT adjustable here. 0.60 is the one + * number on this page with a citable provenance — dlib's default, measured on + * LFW — and a moved threshold means nothing at all. The information lives in + * the measured noise floor and in how far the trace climbs above it, not in + * where an operator decided to drag a line. + * + * The brightness control is display only. face-api reads raw frames from the + * video element and CSS filters apply at composite, so turning this dial cannot + * change a descriptor. That is stated in the control's tooltip so nobody later + * reads an exposure change as a lighting-robustness result. + */ + +const SETTINGS_KEY = 'gstmxx.realtime.settings'; +const BASELINE_KEY = 'gstmxx.realtime.baseline'; +const BASELINE_FORMAT = 3; +const CONDITION_KEYS = [ + 'rollDegrees', + 'yawOffset', + 'boxWidthRatio', + 'centerXRatio', + 'centerYRatio', + 'luma', +]; + +const DEFAULT_SETTINGS = { + brightness: 0.85, + equalizer: true, +}; + +/** + * Reads persisted view settings. + * + * @returns {{brightness: number, equalizer: boolean}} Stored or default settings. + */ +export function loadSettings() { + try { + const raw = window.localStorage.getItem(SETTINGS_KEY); + if (!raw) return { ...DEFAULT_SETTINGS }; + const parsed = JSON.parse(raw); + return { + brightness: Number.isFinite(parsed.brightness) ? parsed.brightness : DEFAULT_SETTINGS.brightness, + equalizer: typeof parsed.equalizer === 'boolean' ? parsed.equalizer : DEFAULT_SETTINGS.equalizer, + }; + } catch { + return { ...DEFAULT_SETTINGS }; + } +} + +/** + * Persists view settings. + * + * @param {object} settings Settings to store. + * @returns {void} + */ +export function saveSettings(settings) { + try { + window.localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings)); + } catch { + /* Storage disabled or full; settings simply do not persist. */ + } +} + +/** + * Reads a persisted baseline. + * + * The baseline is a biometric template. It never leaves the device, and + * "Reset baseline" removes it outright rather than flipping a flag. + * + * @returns {{descriptor: number[], noiseFloor: number, capturedAt: number, sourceKind: 'camera', conditions: object, guide: object}|null} Stored baseline. + */ +export function loadBaseline() { + try { + const raw = window.localStorage.getItem(BASELINE_KEY); + if (!raw) return null; + const parsed = JSON.parse(raw); + if (parsed.format !== BASELINE_FORMAT) return null; + if (!Array.isArray(parsed.descriptor) || parsed.descriptor.length !== 128) return null; + if (parsed.descriptor.some((value) => !Number.isFinite(value))) return null; + if (!Number.isFinite(parsed.noiseFloor)) return null; + if (!Number.isFinite(parsed.capturedAt)) return null; + if (parsed.sourceKind !== 'camera') return null; + if (!parsed.conditions || CONDITION_KEYS.some((key) => !Number.isFinite(parsed.conditions[key]))) { + return null; + } + if ( + !parsed.guide || + !Number.isFinite(parsed.guide.aspectRatio) || + !parsed.guide.box || + ['x', 'y', 'width', 'height'].some((key) => !Number.isFinite(parsed.guide.box[key])) || + !Array.isArray(parsed.guide.landmarks) || + parsed.guide.landmarks.length !== 68 || + parsed.guide.landmarks.some((point) => !Number.isFinite(point?.x) || !Number.isFinite(point?.y)) + ) { + return null; + } + return parsed; + } catch { + return null; + } +} + +/** + * Persists a baseline. + * + * @param {object} baseline Baseline record to store. + * @returns {void} + */ +export function saveBaseline(baseline) { + try { + window.localStorage.setItem( + BASELINE_KEY, + JSON.stringify({ ...baseline, format: BASELINE_FORMAT }), + ); + } catch { + /* Storage disabled; the baseline holds for this session only. */ + } +} + +/** + * Removes the persisted baseline. + * + * @returns {void} + */ +export function clearBaseline() { + try { + window.localStorage.removeItem(BASELINE_KEY); + } catch { + /* Nothing to clear. */ + } +} + +/** + * Wraps a destructive button in a two-step confirmation. + * + * Deleting a baseline mid-session costs the whole session, and "Delete all" + * costs every capture on the device. Neither should be one stray click. + * + * @param {HTMLButtonElement} button Button to guard. + * @param {string} idleLabel Label in the resting state. + * @param {string} confirmLabel Label while awaiting confirmation. + * @param {function(): void} onConfirm Action to run on the second click. + * @param {number} [timeoutMs] Time before the button reverts. + * @returns {object} Guard handle exposing `reset()`. + */ +export function guardDestructive(button, idleLabel, confirmLabel, onConfirm, timeoutMs = 4000) { + let armed = false; + let timer = null; + + /** + * Returns the button to its resting label. + * + * @returns {void} + */ + function reset() { + armed = false; + button.textContent = idleLabel; + button.classList.remove('is-confirming'); + if (timer) window.clearTimeout(timer); + timer = null; + } + + button.addEventListener('click', () => { + if (!armed) { + armed = true; + button.textContent = confirmLabel; + button.classList.add('is-confirming'); + timer = window.setTimeout(reset, timeoutMs); + return; + } + reset(); + onConfirm(); + }); + + return { reset }; +} + +/** + * Creates the settings bar controller. + * + * @param {object} options Wiring options. + * @param {HTMLElement} options.rootEl Element carrying the --rt-* custom properties. + * @param {HTMLInputElement} options.brightnessEl Brightness range input. + * @param {HTMLElement} options.brightnessValueEl Brightness readout. + * @param {HTMLButtonElement} options.equalizerEl Equalizer switch. + * @param {HTMLElement} options.layoutEl Grid root toggled by the equalizer switch. + * @param {function(): void} options.onLayoutChange Called after a layout-affecting change. + * @returns {object} Settings controller. + */ +export function createSettings(options) { + const { + rootEl, + brightnessEl, + brightnessValueEl, + equalizerEl, + layoutEl, + onLayoutChange, + } = options; + + const settings = loadSettings(); + + /** + * Applies the brightness value to the stage and the readout. + * + * @returns {void} + */ + function applyBrightness() { + rootEl.style.setProperty('--rt-brightness', String(settings.brightness)); + brightnessEl.value = String(settings.brightness); + brightnessValueEl.textContent = settings.brightness.toFixed(2); + } + + /** + * Applies equalizer visibility to the grid. + * + * Hiding the right column resizes the left one without firing a window + * resize event, which is why the graph observes its own container rather + * than listening on window alone. + * + * @returns {void} + */ + function applyEqualizer() { + layoutEl.classList.toggle('hide-equalizer', !settings.equalizer); + equalizerEl.setAttribute('aria-checked', String(settings.equalizer)); + } + + brightnessEl.addEventListener('input', () => { + settings.brightness = Number(brightnessEl.value); + applyBrightness(); + saveSettings(settings); + }); + + equalizerEl.addEventListener('click', () => { + settings.equalizer = !settings.equalizer; + applyEqualizer(); + saveSettings(settings); + if (typeof onLayoutChange === 'function') onLayoutChange(); + }); + + equalizerEl.addEventListener('keydown', (event) => { + if (event.key !== ' ' && event.key !== 'Enter') return; + event.preventDefault(); + equalizerEl.click(); + }); + + applyBrightness(); + applyEqualizer(); + + return { + /** + * Returns the live settings object. + * + * @returns {{brightness: number, equalizer: boolean}} Current settings. + */ + values() { + return settings; + }, + }; +} diff --git a/lab-js/realtime/realtime.js b/lab-js/realtime/realtime.js new file mode 100644 index 0000000..d854814 --- /dev/null +++ b/lab-js/realtime/realtime.js @@ -0,0 +1,1618 @@ +/** + * @module realtime + * @description + * Entry point for the latent space visualizer. Owns the detection loop, the + * descriptor equalizer, the presence state machine and the page lifecycle; + * everything else lives in the sibling realtime-* modules. + * + * The page measures one thing: how far a face has moved from a reference + * captured before the makeup session. Two lines on the plot carry claims and + * they are different kinds of claim — the noise floor is measured here, on this + * camera, from this face; 0.60 is dlib's LFW default and is a property of a + * benchmark, not of anyone's face. Nothing is drawn between them, because + * nothing between them has been measured. + */ + +import { MODEL_URLS, DETECTOR_OPTIONS } from '../config.js'; +import { createGraph, formatDuration } from './realtime-graph.js'; +import { + createQualityGate, + createBaselineCollector, + createSpikeDetector, + createFrameBuffer, + compareConditions, + euclidean, +} from './realtime-capture.js'; +import { createGallery } from './realtime-gallery.js'; +import { createRadialGraph } from './realtime-radial.js'; +import { canUseGuideShortcut, createBaselineGuide } from './realtime-guide.js'; +import { + createSettings, + guardDestructive, + loadBaseline, + saveBaseline, + clearBaseline, +} from './realtime-settings.js'; + +const APP_STATES = { + NO_BASELINE: 'NO BASELINE', + CAPTURING: 'CAPTURING', + TRACKING: 'TRACKING', +}; + +const SESSION_PHASES = { + IDLE: 'idle', + READY: 'ready', + APPLYING: 'applying', + MEASURING: 'measuring', +}; + +const DESCRIPTOR_SIZE = 128; +const CELLS_PER_ROW = 10; +const MAX_DELTA = 0.15; + +/** dlib's documented default, measured on LFW. Cited, not tuned, not movable. */ +const MATCH_THRESHOLD = 0.6; + +/** Impostor pairs live below this; the ceiling exists so success has headroom. */ +const GRAPH_MAX_DISTANCE = 1.25; +const GRAPH_WINDOW_SECONDS = 60; +const SAMPLES_PER_SECOND = 3; + +/** Long enough that a blink does not put controls into a paused UI state. */ +const NO_FACE_DEBOUNCE_MS = 1500; + +const BASELINE_TARGET_SAMPLES = 5; +const BASELINE_MIN_MS = 2000; +const BASELINE_TIMEOUT_MS = 30000; +const BASELINE_MAX_SPREAD = 0.2; +const MEASUREMENT_TARGET_SAMPLES = 8; +const MEASUREMENT_MIN_MS = 3000; +const MEASUREMENT_TIMEOUT_MS = 30000; +const MEASUREMENT_MAX_SPREAD = 0.2; + +const SPIKE_SUSTAIN_MS = 1500; +const SPIKE_BEST_MARGIN = 0.05; +const SPIKE_COOLDOWN_MS = 8000; +const FRAME_BUFFER_SLOTS = 5; +const CAPTURE_MAX_WIDTH = 960; +const STATUS_MIN_DWELL_MS = 1500; + +/** Grace period before a hidden tab loses the camera entirely. */ +const HIDDEN_STOP_DELAY_MS = 45000; + +const RING_RADIUS = 54; +const RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS; + +const runtime = { + appState: APP_STATES.NO_BASELINE, + baseline: null, + equalizerRows: [], + equalizerLit: new Int16Array(DESCRIPTOR_SIZE).fill(-1), + distanceBuffer: [], + frameRequestId: null, + flushTimerId: null, + hiddenStopTimerId: null, + detectorBusy: false, + initialized: false, + running: false, + streamStopped: false, + faceMissing: false, + timelineNoFace: false, + lastFaceAt: 0, + stream: null, + sourceKind: 'camera', + sourceEpoch: 0, + sourceObjectUrl: null, + lastDetectionScore: null, + lastDescriptorLength: 0, + comparisonExcluded: false, + sessionPhase: SESSION_PHASES.IDLE, + sessionStep: 0, + lastMeasurement: null, + hasValidDescriptorView: false, +}; + +const els = { + layer: document.getElementById('ui-layer'), + video: document.getElementById('webcam'), + centerView: document.getElementById('center-view'), + embeddingBar: document.getElementById('embedding-bar'), + graphScroll: document.getElementById('graph-scroll'), + graphSpacer: document.getElementById('graph-spacer'), + graphCanvas: document.getElementById('distance-graph'), + graphFollow: document.getElementById('graph-follow'), + radialCanvas: document.getElementById('radial-graph'), + radialValidity: document.getElementById('radial-validity'), + guideCanvas: document.getElementById('baseline-guide'), + legendNoise: document.getElementById('legend-noise'), + calibrationUi: document.getElementById('calibration-ui'), + captureRing: document.getElementById('capture-ring'), + captureRingArc: document.getElementById('capture-ring-arc'), + captureRingCount: document.getElementById('capture-ring-count'), + captureHint: document.getElementById('capture-hint'), + captureProgressDetail: document.getElementById('capture-progress-detail'), + btnBaselineStart: document.getElementById('btn-baseline-start'), + btnBaseline: document.getElementById('btn-baseline'), + btnShutter: document.getElementById('btn-shutter'), + btnDownloadAll: document.getElementById('btn-download-all'), + btnDeleteAll: document.getElementById('btn-delete-all'), + galleryCount: document.getElementById('gallery-count'), + brightness: document.getElementById('brightness-input'), + brightnessValue: document.getElementById('brightness-value'), + toggleEqualizer: document.getElementById('toggle-equalizer'), + sessionBar: document.getElementById('session-bar'), + sessionStep: document.getElementById('session-step'), + sessionResult: document.getElementById('session-result'), + btnStartChange: document.getElementById('btn-start-change'), + btnMeasureChange: document.getElementById('btn-measure-change'), + btnShowGuide: document.getElementById('btn-show-guide'), + videoUpload: document.getElementById('video-upload'), + btnOpenVideo: document.getElementById('btn-open-video'), + btnUseCamera: document.getElementById('btn-use-camera'), + sourceState: document.getElementById('source-state'), + statusPill: document.getElementById('status-pill'), + statusText: document.getElementById('status-text'), + statusSwatch: document.getElementById('status-swatch'), + thresholdHelp: document.getElementById('threshold-help'), + thresholdTooltip: document.getElementById('threshold-tooltip'), + distanceValue: document.getElementById('distance-value'), + distanceQuality: document.getElementById('distance-quality'), + distanceQualityMain: document.getElementById('distance-quality-main'), + distanceQualityDetail: document.getElementById('distance-quality-detail'), + trackingState: document.getElementById('tracking-state'), + viewer: document.getElementById('photo-viewer'), + viewerImage: document.getElementById('viewer-image'), + viewerMeta: document.getElementById('viewer-meta'), + viewerCopy: document.getElementById('viewer-copy'), + viewerDownload: document.getElementById('viewer-download'), + viewerDelete: document.getElementById('viewer-delete'), + viewerClose: document.getElementById('viewer-close'), +}; + +let graph = null; +let radialGraph = null; +let gallery = null; +let qualityGate = null; +let baselineCollector = null; +let measurementCollector = null; +let spikeDetector = null; +let frameBuffer = null; +let baselineGuide = null; + +const statusDisplay = { + key: '', + quality: 'neutral', + shownAt: 0, + pending: null, + timer: null, +}; + +/** + * Writes the floating status message over the video stage. + * + * @param {string} message Message to display. + * @param {boolean} [warn] Whether the message needs emphasis. + * @param {'neutral'|'valid'|'outside-guide'|'lighting'|'no-face'} [quality] Timeline state. + * @param {string} [key] Stable state identity; numeric details may vary per frame. + * @param {string} [details] Full text exposed as a native tooltip. + * @returns {void} + */ +function setStatus(message, warn = false, quality = 'neutral', key = message, details = message) { + if (!els.statusPill || !els.statusText || !els.statusSwatch) return; + + const render = (next) => { + statusDisplay.key = next.key; + statusDisplay.quality = next.quality; + statusDisplay.shownAt = Date.now(); + statusDisplay.pending = null; + statusDisplay.timer = null; + els.statusText.textContent = next.message; + els.statusPill.title = next.details; + els.statusPill.classList.toggle('is-warn', next.warn); + els.statusSwatch.dataset.quality = next.quality; + }; + + const next = { message, warn, quality, key, details }; + if (quality === 'neutral' || !statusDisplay.key || statusDisplay.quality === 'neutral') { + if (statusDisplay.timer) window.clearTimeout(statusDisplay.timer); + render(next); + return; + } + + if (statusDisplay.key === key && statusDisplay.quality === quality) { + return; + } + + const remaining = STATUS_MIN_DWELL_MS - (Date.now() - statusDisplay.shownAt); + if (remaining <= 0) { + if (statusDisplay.timer) window.clearTimeout(statusDisplay.timer); + render(next); + return; + } + + statusDisplay.pending = next; + if (statusDisplay.timer) window.clearTimeout(statusDisplay.timer); + statusDisplay.timer = window.setTimeout(() => { + if (statusDisplay.pending) render(statusDisplay.pending); + }, remaining); +} + +/** Shows or hides the threshold explainer without occupying persistent space. */ +function setThresholdTooltipVisible(visible) { + if (!els.thresholdHelp || !els.thresholdTooltip) return; + els.thresholdTooltip.hidden = !visible; + els.thresholdHelp.setAttribute('aria-expanded', String(visible)); + if (visible) els.thresholdTooltip.focus(); +} + +/** + * Writes the right-panel state label. + * + * @param {string} state Current app state. + * @returns {void} + */ +function setTrackingState(state) { + if (els.trackingState) els.trackingState.textContent = state; +} + +/** + * Writes the numeric distance readout. + * + * @param {number} value Distance to display. + * @returns {void} + */ +function setDistanceValue(value) { + if (!els.distanceValue) return; + els.distanceValue.textContent = Number.isFinite(value) ? value.toFixed(3) : '—'; +} + +/** Labels whether the numeric readout is measurement-grade or raw context. */ +function setDistanceQuality(status) { + if (!els.distanceQuality || !els.distanceQualityMain || !els.distanceQualityDetail) return; + const labels = { + valid: { main: 'VALID DISTANCE', detail: '' }, + 'outside-guide': { main: 'NO DISTANCE', detail: 'OUTSIDE GUIDE' }, + lighting: { main: 'NO DISTANCE', detail: 'LIGHTING CHANGED' }, + 'no-face': { main: 'NO DISTANCE', detail: 'NO FACE' }, + }; + const label = labels[status] || labels.valid; + els.distanceQualityMain.textContent = label.main; + els.distanceQualityDetail.textContent = label.detail; + els.distanceQualityDetail.hidden = !label.detail; + els.distanceQuality.dataset.quality = status; +} + +/** Marks whether the descriptor panels show a current or frozen valid frame. */ +function setDescriptorValidity(valid) { + if (!els.radialValidity) return; + if (valid) { + runtime.hasValidDescriptorView = true; + els.radialValidity.textContent = 'LIVE VALID'; + els.radialValidity.dataset.validity = 'live'; + } else if (runtime.hasValidDescriptorView) { + els.radialValidity.textContent = 'LAST VALID FRAME'; + els.radialValidity.dataset.validity = 'stale'; + } else { + els.radialValidity.textContent = 'WAITING FOR VALID FRAME'; + delete els.radialValidity.dataset.validity; + } +} + +/** + * Computes signed per-coordinate descriptor deltas. + * + * @param {Float32Array|number[]} baseline Baseline descriptor. + * @param {Float32Array|number[]} current Current descriptor. + * @returns {Float32Array} Signed deltas in descriptor order. + */ +function descriptorDelta(baseline, current) { + const delta = new Float32Array(DESCRIPTOR_SIZE); + for (let index = 0; index < DESCRIPTOR_SIZE; index += 1) { + delta[index] = current[index] - baseline[index]; + } + return delta; +} + +/** Returns a compact local-video time suffix for timeline events. */ +function mediaTimeSuffix() { + if (runtime.sourceKind !== 'video' || !Number.isFinite(els.video.currentTime)) return ''; + const total = Math.max(0, els.video.currentTime); + const minutes = Math.floor(total / 60); + const seconds = (total % 60).toFixed(1).padStart(4, '0'); + return ` · ${minutes}:${seconds}`; +} + +/** Reflects the declared experiment phase in the workflow controls. */ +function syncSessionControls() { + const hasBaseline = Boolean(runtime.baseline); + const applying = runtime.sessionPhase === SESSION_PHASES.APPLYING; + const measuring = runtime.sessionPhase === SESSION_PHASES.MEASURING; + els.sessionBar.hidden = !hasBaseline; + els.btnStartChange.disabled = !hasBaseline || applying || measuring; + els.btnStartChange.classList.toggle('is-status', applying); + els.btnMeasureChange.disabled = !applying; + + if (!hasBaseline) { + els.sessionStep.textContent = 'Ready'; + els.sessionResult.textContent = 'Capture a clean baseline first.'; + return; + } + + if (runtime.sessionPhase === SESSION_PHASES.APPLYING) { + els.sessionStep.textContent = `Step ${runtime.sessionStep + 1} · applying`; + els.sessionResult.textContent = 'Live readings continue, but this interval is marked as application time.'; + els.btnStartChange.textContent = 'Applying…'; + } else if (runtime.sessionPhase === SESSION_PHASES.MEASURING) { + els.sessionStep.textContent = `Step ${runtime.sessionStep + 1} · measuring`; + els.sessionResult.textContent = 'Collecting a comparable temporal window…'; + els.btnStartChange.textContent = 'Start makeup step'; + } else { + els.sessionStep.textContent = runtime.sessionStep ? `Step ${runtime.sessionStep} measured` : 'Ready'; + els.sessionResult.textContent = runtime.lastMeasurement + ? `Snapshot d=${runtime.lastMeasurement.distance.toFixed(3)} · spread ±${runtime.lastMeasurement.spread.toFixed(3)}` + : 'Mark when you begin applying a change.'; + els.btnStartChange.textContent = runtime.sessionStep ? 'Start next step' : 'Start makeup step'; + } +} + +/** Changes the declared experiment phase and redraws its controls. */ +function setSessionPhase(phase) { + runtime.sessionPhase = phase; + syncSessionControls(); +} + +/** + * Builds the descriptor equalizer. + * + * Level is baked into each cell at build time so the runtime loop only toggles + * .is-on for cells that actually changed. The prototype rewrote all 1,280 + * className strings on every detection frame. + * + * @returns {void} + */ +function initEqualizer() { + if (!els.embeddingBar) return; + els.embeddingBar.textContent = ''; + runtime.equalizerRows = []; + runtime.equalizerLit = new Int16Array(DESCRIPTOR_SIZE).fill(0); + + for (let rowIndex = 0; rowIndex < DESCRIPTOR_SIZE; rowIndex += 1) { + const row = document.createElement('div'); + row.className = 'descriptor-row'; + + for (let cellIndex = 0; cellIndex < CELLS_PER_ROW; cellIndex += 1) { + const cell = document.createElement('div'); + let level = 'lvl-high'; + if (cellIndex < 3) level = 'lvl-low'; + else if (cellIndex < 7) level = 'lvl-med'; + cell.className = `cell ${level}`; + row.appendChild(cell); + } + + els.embeddingBar.appendChild(row); + runtime.equalizerRows.push(row); + } +} + +/** + * Updates the equalizer from per-index baseline deltas. + * + * @param {number[]} baseline Baseline descriptor. + * @param {Float32Array|number[]} current Live descriptor. + * @returns {void} + */ +function updateEqualizer(baseline, current) { + if (!runtime.equalizerRows.length) return; + + for (let i = 0; i < DESCRIPTOR_SIZE; i += 1) { + const delta = Math.abs(baseline[i] - current[i]); + const scaled = Math.floor((delta / MAX_DELTA) * CELLS_PER_ROW); + const lit = Math.max(0, Math.min(CELLS_PER_ROW, scaled)); + const previous = runtime.equalizerLit[i]; + if (lit === previous) continue; + + const cells = runtime.equalizerRows[i].children; + if (lit > previous) { + for (let c = previous; c < lit; c += 1) cells[c].classList.add('is-on'); + } else { + for (let c = lit; c < previous; c += 1) cells[c].classList.remove('is-on'); + } + runtime.equalizerLit[i] = lit; + } + if (radialGraph) radialGraph.setLive(descriptorDelta(baseline, current)); +} + +/** + * Returns the equalizer to its unlit state. + * + * @returns {void} + */ +function resetEqualizer() { + for (let i = 0; i < runtime.equalizerRows.length; i += 1) { + const cells = runtime.equalizerRows[i].children; + for (const cell of cells) cell.classList.remove('is-on'); + runtime.equalizerLit[i] = 0; + } + if (radialGraph) radialGraph.setLive(null); +} + +/** + * Updates the baseline capture ring. + * + * @param {number} accepted Accepted samples so far. + * @param {number} target Samples required. + * @returns {void} + */ +function setRingProgress(accepted, target) { + if (!els.captureRingArc) return; + const ratio = Math.max(0, Math.min(1, accepted / target)); + els.captureRingArc.style.strokeDasharray = String(RING_CIRCUMFERENCE); + els.captureRingArc.style.strokeDashoffset = String(RING_CIRCUMFERENCE * (1 - ratio)); + if (els.captureRingCount) els.captureRingCount.textContent = `${accepted}/${target}`; + if (els.captureRing) { + const previous = Number(els.captureRing.dataset.accepted || 0); + els.captureRing.setAttribute('aria-valuenow', String(accepted)); + els.captureRing.setAttribute('aria-valuemax', String(target)); + els.captureRing.dataset.accepted = String(accepted); + if (accepted > previous) { + els.captureRing.classList.remove('is-sampled'); + void els.captureRing.offsetWidth; + els.captureRing.classList.add('is-sampled'); + } + } +} + +/** Returns source-relative timing so a paused video cannot be sampled twice. */ +function currentObservation() { + if (runtime.sourceKind !== 'video' || !Number.isFinite(els.video.currentTime)) return {}; + const sourceTimeMs = els.video.currentTime * 1000; + return { + sourceTimeMs, + id: `${runtime.sourceEpoch}:${sourceTimeMs.toFixed(3)}`, + }; +} + +/** Updates the diagnostic line below the baseline target. */ +function setCaptureProgressDetail(progress, faceDetected = true) { + if (!els.captureProgressDetail || !progress) return; + els.captureProgressDetail.hidden = false; + const state = faceDetected ? 'face detected' : 'no face'; + const excluded = progress.rejected || 0; + const duplicate = progress.duplicates ? ` · ${progress.duplicates} repeated video frames ignored` : ''; + els.captureProgressDetail.textContent = + `${state} · ${progress.accepted}/${progress.target} clean · ${excluded} excluded${duplicate}`; +} + +/** Joins every failed quality check instead of hiding all but the first one. */ +function qualityMessage(progress) { + const reasons = progress?.reasons?.filter(Boolean) || []; + if (!reasons.length) return progress?.reason || 'This frame is not usable.'; + return reasons.join(' Also: '); +} + +/** + * Shows or hides the baseline capture overlay. + * + * @param {boolean} visible Whether the overlay should show. + * @returns {void} + */ +function setCalibrationVisible(visible) { + if (els.calibrationUi) els.calibrationUi.hidden = !visible; +} + +/** + * Reflects baseline presence across the controls that depend on it. + * + * @returns {void} + */ +function syncBaselineControls() { + const hasBaseline = Boolean(runtime.baseline); + if (els.btnBaseline) els.btnBaseline.hidden = !hasBaseline; + if (els.btnShutter) els.btnShutter.disabled = !hasBaseline; + if (els.btnShowGuide) els.btnShowGuide.disabled = !hasBaseline || !baselineGuide?.hasGuide(); + setCalibrationVisible(!hasBaseline); + if (els.btnBaselineStart) els.btnBaselineStart.hidden = false; + + if (els.legendNoise) { + els.legendNoise.textContent = hasBaseline ? runtime.baseline.noiseFloor.toFixed(3) : '—'; + } + if (graph) graph.setNoiseFloor(hasBaseline ? runtime.baseline.noiseFloor : null); + syncSessionControls(); +} + +/** + * Starts or resumes a selected local video before a declared session action. + * + * @param {string} failureMessage Status shown when autoplay is rejected. + * @returns {Promise} Whether the action may continue. + */ +async function ensureLocalVideoPlaying(failureMessage) { + if (runtime.sourceKind !== 'video' || !els.video.paused) return true; + try { + if (els.video.ended) els.video.currentTime = 0; + await els.video.play(); + return true; + } catch { + setStatus(failureMessage, true); + return false; + } +} + +/** + * Begins a baseline capture run. + * + * @returns {Promise} + */ +async function startBaselineCapture() { + const playing = await ensureLocalVideoPlaying( + 'Play the local video before capturing a baseline.', + ); + if (!playing) return; + runtime.appState = APP_STATES.CAPTURING; + runtime.baseline = null; + runtime.distanceBuffer = []; + runtime.comparisonExcluded = false; + runtime.sessionStep = 0; + runtime.lastMeasurement = null; + runtime.hasValidDescriptorView = false; + setSessionPhase(SESSION_PHASES.IDLE); + clearBaseline(); + + setTrackingState(APP_STATES.CAPTURING); + setDistanceValue(0); + resetEqualizer(); + graph.reset(); + graph.setNoiseFloor(null); + spikeDetector.reset(); + frameBuffer.clear(); + if (radialGraph) radialGraph.reset(); + if (baselineGuide) baselineGuide.setGuide(null); + setDistanceQuality('valid'); + setDescriptorValidity(false); + + setCalibrationVisible(true); + if (els.captureRing) els.captureRing.classList.add('is-active'); + if (els.btnBaselineStart) els.btnBaselineStart.hidden = true; + if (els.btnBaseline) els.btnBaseline.hidden = true; + if (els.btnShutter) els.btnShutter.disabled = true; + if (els.legendNoise) els.legendNoise.textContent = '—'; + + setRingProgress(0, BASELINE_TARGET_SAMPLES); + if (els.captureProgressDetail) { + els.captureProgressDetail.hidden = false; + els.captureProgressDetail.textContent = `face not sampled yet · 0/${BASELINE_TARGET_SAMPLES} clean · 0 excluded`; + } + setHint('Keep your face still and look at the centre dot for 2 seconds.', true); + setStatus('Capturing baseline…'); + baselineCollector.start(); +} + +/** + * Writes the capture overlay hint line. + * + * @param {string} text Hint text. + * @param {boolean} [blocking] Whether the hint is an instruction to act on. + * @returns {void} + */ +function setHint(text, blocking = false) { + if (!els.captureHint) return; + els.captureHint.textContent = text; + els.captureHint.classList.toggle('is-blocking', blocking); +} + +/** + * Adopts a captured or restored baseline and enters tracking. + * + * @param {object} baseline Baseline record. + * @param {boolean} [restored] Whether the baseline came from storage. + * @returns {void} + */ +function adoptBaseline(baseline, restored = false) { + runtime.baseline = baseline; + runtime.appState = APP_STATES.TRACKING; + runtime.distanceBuffer = []; + runtime.faceMissing = false; + runtime.timelineNoFace = false; + runtime.comparisonExcluded = false; + runtime.sessionStep = 0; + runtime.lastMeasurement = null; + runtime.hasValidDescriptorView = false; + setSessionPhase(SESSION_PHASES.READY); + + setTrackingState(APP_STATES.TRACKING); + setDistanceValue(0); + resetEqualizer(); + spikeDetector.reset(); + frameBuffer.clear(); + if (radialGraph) radialGraph.reset(); + if (baselineGuide) { + baselineGuide.setGuide(baseline.guide); + baselineGuide.show(); + } + setDistanceQuality('valid'); + setDescriptorValidity(false); + + if (els.captureRing) els.captureRing.classList.remove('is-active'); + if (els.captureProgressDetail) els.captureProgressDetail.hidden = true; + syncBaselineControls(); + + if (restored) { + const age = formatDuration(Date.now() - baseline.capturedAt); + setStatus(`Baseline restored, captured ${age} ago. Noise floor ${baseline.noiseFloor.toFixed(3)}.`); + } else { + setStatus(`Baseline set. Noise floor ${baseline.noiseFloor.toFixed(3)} — readings below it are within baseline variation.`); + } +} + +/** + * Discards the current baseline and returns to the capture prompt. + * + * @returns {void} + */ +function deleteBaseline() { + runtime.baseline = null; + runtime.appState = APP_STATES.NO_BASELINE; + runtime.comparisonExcluded = false; + runtime.sessionStep = 0; + runtime.lastMeasurement = null; + runtime.hasValidDescriptorView = false; + setSessionPhase(SESSION_PHASES.IDLE); + clearBaseline(); + baselineCollector.cancel(); + measurementCollector.cancel(); + + setTrackingState(APP_STATES.NO_BASELINE); + setDistanceValue(0); + resetEqualizer(); + graph.reset(); + spikeDetector.reset(); + frameBuffer.clear(); + if (radialGraph) radialGraph.reset(); + if (baselineGuide) baselineGuide.setGuide(null); + setDistanceQuality('valid'); + setDescriptorValidity(false); + + if (els.captureRing) els.captureRing.classList.remove('is-active'); + if (els.captureProgressDetail) els.captureProgressDetail.hidden = true; + syncBaselineControls(); + setHint('Capture a reference of your bare face before you start.'); + setStatus('Baseline deleted. Saved captures are kept.'); +} + +/** + * Feeds one detection into the baseline collector. + * + * @param {*} detection face-api detection result. + * @returns {void} + */ +function processBaselineFrame(detection) { + const verdict = qualityGate.evaluate(detection); + const progress = baselineCollector.offer(verdict, detection.descriptor, currentObservation()); + + setRingProgress(progress.accepted, progress.target); + setCaptureProgressDetail(progress, true); + + if (progress.status === 'blocked') { + setHint(qualityMessage(progress), true); + return; + } + if (progress.status === 'waiting') { + setHint(progress.reason, true); + return; + } + if (progress.status === 'collecting') { + setHint('Keep your face still and look at the centre dot.', true); + return; + } + if (progress.status === 'failed') { + if (els.captureRing) els.captureRing.classList.remove('is-active'); + if (els.btnBaselineStart) els.btnBaselineStart.hidden = false; + runtime.appState = APP_STATES.NO_BASELINE; + setTrackingState(APP_STATES.NO_BASELINE); + setHint(`Could not get a clean read. ${progress.reason}`, true); + setStatus('Baseline capture abandoned.', true); + return; + } + if (progress.status === 'done') { + // Camera baselines can be restored against the same physical source. A + // local video's blob URL disappears on reload, so persisting that template + // would silently compare the next camera session with the wrong source. + if (runtime.sourceKind === 'camera') { + saveBaseline({ ...progress.baseline, sourceKind: 'camera' }); + } else { + clearBaseline(); + } + adoptBaseline(progress.baseline, false); + } +} + +/** Marks the beginning of one operator-declared makeup change. */ +async function startMakeupStep() { + if (!runtime.baseline || runtime.appState !== APP_STATES.TRACKING) return; + const playing = await ensureLocalVideoPlaying( + 'Play the local video before marking the makeup step.', + ); + if (!playing) return; + measurementCollector.cancel(); + frameBuffer.clear(); + setSessionPhase(SESSION_PHASES.APPLYING); + graph.addEvent( + Date.now(), + SESSION_PHASES.APPLYING, + `step ${runtime.sessionStep + 1}: applying${mediaTimeSuffix()}`, + ); + setStatus('Application interval marked. When this piece is finished, measure the result.'); +} + +/** Starts a temporal measurement window for the current declared change. */ +async function startStepMeasurement() { + if (!runtime.baseline || runtime.sessionPhase !== SESSION_PHASES.APPLYING) return; + const playing = await ensureLocalVideoPlaying( + 'Play the local video before measuring this step.', + ); + if (!playing) return; + measurementCollector.start(); + frameBuffer.clear(); + setSessionPhase(SESSION_PHASES.MEASURING); + graph.addEvent( + Date.now(), + SESSION_PHASES.MEASURING, + `step ${runtime.sessionStep + 1}: measuring${mediaTimeSuffix()}`, + ); + setStatus('Measuring this step — hold the baseline pose and lighting.'); +} + +/** + * Publishes an aggregated step measurement and saves its sharpest frame. + * + * @param {object} snapshot Temporal-window result returned by the collector. + * @returns {Promise} + */ +async function completeStepMeasurement(snapshot) { + const distance = euclidean(runtime.baseline.descriptor, snapshot.descriptor); + const delta = descriptorDelta(runtime.baseline.descriptor, snapshot.descriptor); + runtime.sessionStep += 1; + runtime.lastMeasurement = { + distance, + spread: snapshot.noiseFloor, + descriptor: snapshot.descriptor, + conditions: snapshot.conditions, + capturedAt: snapshot.capturedAt, + }; + + if (radialGraph) radialGraph.setMeasured(delta); + updateEqualizer(runtime.baseline.descriptor, snapshot.descriptor); + graph.addEvent( + Date.now(), + SESSION_PHASES.MEASURING, + `step ${runtime.sessionStep}: snapshot d=${distance.toFixed(3)}${mediaTimeSuffix()}`, + ); + + const best = frameBuffer.best(); + if (best) await storeCapture(best.canvas, distance, `step-${runtime.sessionStep}`); + frameBuffer.clear(); + setSessionPhase(SESSION_PHASES.READY); + setStatus( + `Step ${runtime.sessionStep} measured: d=${distance.toFixed(3)}, temporal spread ±${snapshot.noiseFloor.toFixed(3)}.`, + ); +} + +/** + * Measures one tracking frame and evaluates it for a spike capture. + * + * @param {*} detection face-api detection result. + * @returns {Promise} + */ +async function processTrackingFrame(detection) { + // Makeup may legitimately change detector confidence and the exposure inside + // the face crop. Comparability is based on pose, framing and ambient light so + // the intervention itself is not filtered away. + const quality = qualityGate.evaluate(detection, { allowAppearanceChanges: true }); + const comparable = quality.ok + ? compareConditions(runtime.baseline.conditions, quality.metrics) + : quality; + const distance = euclidean(runtime.baseline.descriptor, detection.descriptor); + + if (!comparable.ok) { + const exclusionReason = qualityMessage(comparable); + const hasLightDifference = comparable.reasons?.some((reason) => + /light|luma/i.test(reason), + ); + const hasGeometryDifference = comparable.reasons?.some((reason) => + !/light|luma/i.test(reason), + ); + const timelineStatus = hasLightDifference && !hasGeometryDifference + ? 'lighting' + : 'outside-guide'; + runtime.distanceBuffer.push({ value: distance, status: timelineStatus }); + runtime.comparisonExcluded = true; + setDistanceValue(distance); + setDistanceQuality(timelineStatus); + setDescriptorValidity(false); + els.btnShutter.disabled = true; + setStatus( + comparable.reason || exclusionReason, + true, + timelineStatus, + `excluded:${timelineStatus}`, + `${exclusionReason} Raw distance is shown, but this frame is excluded from measurements.`, + ); + + if (runtime.sessionPhase === SESSION_PHASES.MEASURING) { + const progress = measurementCollector.offer( + { ok: false, reason: comparable.reason, reasons: comparable.reasons }, + detection.descriptor, + currentObservation(), + ); + els.sessionResult.textContent = `Waiting for comparable frames: ${exclusionReason}`; + if (progress.status === 'failed') { + measurementCollector.cancel(); + setSessionPhase(SESSION_PHASES.APPLYING); + setStatus(`Measurement paused. ${progress.reason}`, true); + } + } + return; + } + + runtime.comparisonExcluded = false; + els.btnShutter.disabled = false; + + runtime.distanceBuffer.push({ value: distance, status: 'valid' }); + setDistanceValue(distance); + setDistanceQuality('valid'); + updateEqualizer(runtime.baseline.descriptor, detection.descriptor); + setDescriptorValidity(true); + + if (runtime.sessionPhase === SESSION_PHASES.MEASURING) { + const progress = measurementCollector.offer(quality, detection.descriptor, currentObservation()); + if (quality.ok) frameBuffer.push(quality.sharpness, distance); + if (progress.status === 'collecting') { + els.sessionResult.textContent = `Comparable samples ${progress.accepted}/${progress.target}`; + } else if (progress.status === 'done') { + await completeStepMeasurement(progress.baseline); + } else if (progress.status === 'failed') { + setSessionPhase(SESSION_PHASES.APPLYING); + setStatus(`Could not measure this step. ${progress.reason}`, true); + } + return; + } + + if (distance > MATCH_THRESHOLD) { + setStatus( + 'Past the 0.60 match threshold — reads as a different person.', + false, + 'valid', + 'valid:threshold', + ); + } else if (distance <= runtime.baseline.noiseFloor) { + setStatus( + 'Inside baseline variation — no change is distinguishable from the baseline noise.', + false, + 'valid', + 'valid:noise', + ); + } else { + setStatus( + 'Above the noise floor, below 0.60 — still reads as a match.', + false, + 'valid', + 'valid:between', + ); + } + + // Declared application intervals use an explicit temporal snapshot. Automatic + // "best" captures remain available only while the experiment is otherwise idle. + if (runtime.sessionPhase === SESSION_PHASES.APPLYING) return; + + const verdict = spikeDetector.update(distance); + if (!verdict.candidate) return; + + if (quality.ok) frameBuffer.push(quality.sharpness, distance); + + if (!verdict.capture) return; + + const best = frameBuffer.best(); + if (!best) return; + + await storeCapture(best.canvas, best.distance, verdict.kind); + spikeDetector.noteCapture(best.distance); + frameBuffer.clear(); +} + +/** + * Watermarks and stores one frame, then marks it on the timeline. + * + * @param {HTMLCanvasElement} frame Frame to store. + * @param {number} distance Distance at capture time. + * @param {string} kind Capture trigger. + * @returns {Promise} + */ +async function storeCapture(frame, distance, kind) { + try { + const id = await gallery.save(frame, { + t: Date.now(), + distance, + noiseFloor: runtime.baseline ? runtime.baseline.noiseFloor : 0, + threshold: MATCH_THRESHOLD, + kind, + }); + graph.markLatestCapture(id); + setStatus(`Capture saved at ${distance.toFixed(3)}.`); + } catch (err) { + console.error('capture save failed:', err); + setStatus('Could not save the capture.', true); + } +} + +/** + * Captures the current frame on demand. + * + * @returns {Promise} + */ +async function captureNow() { + if (!runtime.baseline || !els.video || els.video.readyState < 2) return; + + const videoW = els.video.videoWidth; + const scale = Math.min(1, CAPTURE_MAX_WIDTH / videoW); + const canvas = document.createElement('canvas'); + canvas.width = Math.round(videoW * scale); + canvas.height = Math.round(els.video.videoHeight * scale); + canvas.getContext('2d').drawImage(els.video, 0, 0, canvas.width, canvas.height); + + const distance = Number(els.distanceValue.textContent) || 0; + await storeCapture(canvas, distance, 'manual'); +} + +/** + * Handles a frame in which no face was found. + * + * The timeline marks absence immediately with a no-value quality tick. The UI + * waits through a short debounce before disabling controls or announcing a + * pause, so a blink remains harmless without erasing elapsed time. + * + * @returns {void} + */ +function processNoFace() { + const now = Date.now(); + runtime.timelineNoFace = true; + runtime.distanceBuffer = []; + if (!runtime.lastFaceAt) runtime.lastFaceAt = now; + if (now - runtime.lastFaceAt < NO_FACE_DEBOUNCE_MS) return; + + if (!runtime.faceMissing) { + runtime.faceMissing = true; + setDistanceValue(Number.NaN); + setDistanceQuality('no-face'); + setDescriptorValidity(false); + if (els.btnShutter) els.btnShutter.disabled = true; + if (runtime.appState === APP_STATES.CAPTURING) { + setStatus('No face detected — baseline capture is waiting.'); + } else if (runtime.appState === APP_STATES.TRACKING) { + setStatus('No face — measurement paused.', false, 'no-face', 'no-face'); + } else { + setStatus('No face detected. Enter the frame, then set a baseline.'); + } + } + + if (runtime.sessionPhase === SESSION_PHASES.MEASURING) { + els.sessionResult.textContent = 'Waiting for the face to return.'; + } + + if (runtime.appState === APP_STATES.CAPTURING) { + const progress = baselineCollector.offer( + { ok: false, reason: 'No face detected.', reasons: ['No face detected.'] }, + null, + currentObservation(), + ); + setRingProgress(progress.accepted, progress.target); + setCaptureProgressDetail(progress, false); + if (progress.status === 'failed') { + if (els.captureRing) els.captureRing.classList.remove('is-active'); + if (els.btnBaselineStart) els.btnBaselineStart.hidden = false; + runtime.appState = APP_STATES.NO_BASELINE; + setTrackingState(APP_STATES.NO_BASELINE); + setHint(`Could not get a clean read. ${progress.reason}`, true); + setStatus('Baseline capture abandoned.', true); + } else { + setHint('No face detected. Centre your face on the target and hold still.', true); + } + } +} + +/** + * Handles a face reappearing after an absence. + * + * @returns {void} + */ +function processFaceReturned() { + const now = Date.now(); + runtime.timelineNoFace = false; + if (runtime.faceMissing) { + runtime.faceMissing = false; + setStatus('Face back — reading resuming.', false, 'valid', 'face-returned'); + } + runtime.lastFaceAt = now; +} + +/** + * Runs one detection pass and schedules the next frame. + * + * @returns {Promise} + */ +async function onFrame() { + if (!runtime.running) return; + runtime.frameRequestId = window.requestAnimationFrame(onFrame); + if (runtime.detectorBusy) return; + if (!els.video || els.video.readyState < 2) return; + + runtime.detectorBusy = true; + const sourceEpoch = runtime.sourceEpoch; + try { + const detection = await faceapi + .detectSingleFace(els.video, DETECTOR_OPTIONS) + .withFaceLandmarks() + .withFaceDescriptor(); + + // A camera detection can still be resolving while a local file is being + // selected. Never publish results produced for the previous source. + if (sourceEpoch !== runtime.sourceEpoch) return; + + if (!detection || !detection.descriptor) { + runtime.lastDetectionScore = null; + runtime.lastDescriptorLength = 0; + processNoFace(); + return; + } + + runtime.lastDetectionScore = detection.detection?.score ?? null; + runtime.lastDescriptorLength = detection.descriptor.length; + + processFaceReturned(); + + if (runtime.appState === APP_STATES.CAPTURING) { + processBaselineFrame(detection); + } else if (runtime.appState === APP_STATES.TRACKING && runtime.baseline) { + await processTrackingFrame(detection); + } + } catch (err) { + console.error('realtime detection loop error:', err); + setStatus('Detection error. Check the console.', true); + } finally { + runtime.detectorBusy = false; + } +} + +/** + * Averages buffered readings into one timeline sample. + * + * @returns {void} + */ +function flushDistanceBuffer() { + if (runtime.appState !== APP_STATES.TRACKING) return; + if (runtime.timelineNoFace) { + graph.pushSample(Date.now(), null, runtime.sessionPhase, 'no-face'); + return; + } + if (!runtime.distanceBuffer.length) return; + + const status = runtime.distanceBuffer[runtime.distanceBuffer.length - 1].status; + const matching = runtime.distanceBuffer.filter((reading) => reading.status === status); + const sum = matching.reduce((acc, reading) => acc + reading.value, 0); + const average = sum / matching.length; + runtime.distanceBuffer = []; + graph.pushSample(Date.now(), average, runtime.sessionPhase, status); +} + +/** + * Starts the detection and sampling loops. + * + * @returns {void} + */ +function startLoops() { + if (runtime.running) return; + runtime.running = true; + if (runtime.flushTimerId) window.clearInterval(runtime.flushTimerId); + runtime.flushTimerId = window.setInterval(flushDistanceBuffer, 1000 / SAMPLES_PER_SECOND); + onFrame(); +} + +/** + * Stops the detection and sampling loops without touching the camera. + * + * @returns {void} + */ +function stopLoops() { + runtime.running = false; + if (runtime.frameRequestId) window.cancelAnimationFrame(runtime.frameRequestId); + runtime.frameRequestId = null; + if (runtime.flushTimerId) window.clearInterval(runtime.flushTimerId); + runtime.flushTimerId = null; +} + +/** + * Releases the camera. + * + * Only stopping the tracks turns the hardware indicator off. Pausing the video + * element leaves the light on, which on this project is exactly the wrong + * impression to give. + * + * @returns {void} + */ +function stopStream() { + if (runtime.stream) { + for (const track of runtime.stream.getTracks()) track.stop(); + } + runtime.stream = null; + runtime.streamStopped = true; + if (els.video?.srcObject) els.video.srcObject = null; +} + +/** Releases the object URL used by a local-video source. */ +function releaseLocalVideo() { + if (runtime.sourceObjectUrl) URL.revokeObjectURL(runtime.sourceObjectUrl); + runtime.sourceObjectUrl = null; +} + +/** + * Requests the camera and binds it to the video element. + * + * @returns {Promise} + */ +async function initWebcam() { + if (!els.video) throw new Error('Missing #webcam element'); + + runtime.sourceEpoch += 1; + runtime.lastDetectionScore = null; + runtime.lastDescriptorLength = 0; + releaseLocalVideo(); + els.video.pause(); + els.video.removeAttribute('src'); + els.video.load(); + els.video.controls = false; + els.video.classList.remove('source-video'); + els.video.classList.add('source-camera'); + + runtime.stream = await navigator.mediaDevices.getUserMedia({ + video: { facingMode: 'user', + width: { ideal: 1080 }, + height: { ideal: 1920 } + }, + audio: false, + }); + runtime.streamStopped = false; + runtime.sourceKind = 'camera'; + els.video.srcObject = runtime.stream; + await els.video.play(); + els.sourceState.textContent = 'camera'; + els.btnUseCamera.hidden = true; +} + +/** + * Replaces the camera with a local, seekable video. The file never leaves the + * browser; changing source invalidates the source-specific baseline. + * + * @param {File} file Local video chosen by the operator. + * @returns {Promise} + */ +async function useLocalVideo(file) { + if (!file) return; + runtime.sourceEpoch += 1; + runtime.lastDetectionScore = null; + runtime.lastDescriptorLength = 0; + stopLoops(); + stopStream(); + releaseLocalVideo(); + deleteBaseline(); + + runtime.sourceKind = 'video'; + runtime.sourceObjectUrl = URL.createObjectURL(file); + els.video.srcObject = null; + els.video.src = runtime.sourceObjectUrl; + els.video.controls = true; + els.video.loop = false; + els.video.classList.remove('source-camera'); + els.video.classList.add('source-video'); + els.sourceState.textContent = `local video · ${file.name}`; + els.btnUseCamera.hidden = false; + + await new Promise((resolve, reject) => { + const ready = () => { + cleanup(); + resolve(); + }; + const failed = () => { + cleanup(); + reject(new Error('The selected video could not be decoded.')); + }; + const cleanup = () => { + els.video.removeEventListener('loadeddata', ready); + els.video.removeEventListener('error', failed); + }; + els.video.addEventListener('loadeddata', ready, { once: true }); + els.video.addEventListener('error', failed, { once: true }); + els.video.load(); + }); + + startLoops(); + setStatus('Local video ready. Play or seek it, then capture a clean baseline.'); +} + +/** Returns from a local-video experiment to the live camera. */ +async function useCameraSource() { + stopLoops(); + deleteBaseline(); + setStatus('Connecting the camera…'); + try { + await initWebcam(); + startLoops(); + setStatus('Camera ready. Capture a baseline to start measuring.'); + } catch (err) { + console.error('failed to switch to camera:', err); + setStatus('Camera unavailable. You can still open a local video.', true); + } +} + +/** + * Loads the vendored face-api models. + * + * Every shard lives under /lab-js/vendor, so the page makes no third-party + * request and runs with the network unplugged. MODEL_URLS.tiny, .landmarks and + * .recognition all resolve to that one directory. + * + * @returns {Promise} + */ +async function loadModels() { + const vendorRoot = MODEL_URLS.recognition; + await Promise.all([ + faceapi.nets.tinyFaceDetector.loadFromUri(vendorRoot), + faceapi.nets.faceLandmark68Net.loadFromUri(vendorRoot), + faceapi.nets.faceRecognitionNet.loadFromUri(vendorRoot), + ]); + setStatus('Models loaded. Preparing camera…'); +} + +/** + * Suspends work while the tab is hidden. + * + * Window blur is deliberately not the trigger: it fires when another window is + * clicked while this tab is still on screen, which would kill the camera while + * the person is looking straight at it. + * + * @returns {void} + */ +function handleHidden() { + stopLoops(); + if (els.video) els.video.pause(); + if (runtime.hiddenStopTimerId) window.clearTimeout(runtime.hiddenStopTimerId); + runtime.hiddenStopTimerId = window.setTimeout(stopStream, HIDDEN_STOP_DELAY_MS); +} + +/** + * Resumes work when the tab becomes visible again. + * + * @returns {Promise} + */ +async function handleVisible() { + if (runtime.hiddenStopTimerId) { + window.clearTimeout(runtime.hiddenStopTimerId); + runtime.hiddenStopTimerId = null; + } + + try { + if (runtime.sourceKind === 'camera' && runtime.streamStopped) { + setStatus('Reconnecting the camera…'); + await initWebcam(); + } else if (runtime.sourceKind === 'camera' && els.video) { + await els.video.play(); + } + if (runtime.appState === APP_STATES.TRACKING) runtime.lastFaceAt = Date.now(); + startLoops(); + setStatus(runtime.sourceKind === 'camera' ? 'Camera live.' : 'Local video ready.'); + } catch (err) { + console.error('failed to resume camera:', err); + setStatus('Could not reconnect the camera.', true); + } +} + +/** + * Fully releases every resource held by the page. + * + * @returns {void} + */ +function teardown() { + stopLoops(); + stopStream(); + if (statusDisplay.timer) window.clearTimeout(statusDisplay.timer); + statusDisplay.timer = null; + statusDisplay.pending = null; + if (runtime.hiddenStopTimerId) window.clearTimeout(runtime.hiddenStopTimerId); + runtime.hiddenStopTimerId = null; + if (graph) graph.destroy(); + if (radialGraph) radialGraph.destroy(); + if (baselineGuide) baselineGuide.destroy(); + releaseLocalVideo(); +} + +/** + * Binds interaction and lifecycle listeners. + * + * @returns {void} + */ +function bindListeners() { + els.btnBaselineStart.addEventListener('click', startBaselineCapture); + els.btnStartChange.addEventListener('click', startMakeupStep); + els.btnMeasureChange.addEventListener('click', startStepMeasurement); + els.btnOpenVideo.addEventListener('click', () => els.videoUpload.click()); + els.btnShowGuide.addEventListener('click', () => baselineGuide?.show()); + + for (const toggle of document.querySelectorAll('.quality-toggle')) { + toggle.addEventListener('click', () => { + const visible = toggle.getAttribute('aria-pressed') !== 'true'; + toggle.setAttribute('aria-pressed', String(visible)); + graph.setQualityVisible(toggle.dataset.quality, visible); + }); + } + + els.videoUpload.addEventListener('change', async () => { + const [file] = els.videoUpload.files || []; + if (!file) return; + try { + await useLocalVideo(file); + } catch (err) { + console.error('failed to open local video:', err); + setStatus(err.message || 'Could not open the selected video.', true); + } finally { + els.videoUpload.value = ''; + } + }); + els.btnUseCamera.addEventListener('click', useCameraSource); + + guardDestructive(els.btnBaseline, 'Reset baseline', 'Reset — sure?', deleteBaseline); + guardDestructive(els.btnDeleteAll, 'Delete all', 'Delete all — sure?', () => gallery.deleteAll()); + + els.thresholdHelp.addEventListener('click', () => { + setThresholdTooltipVisible(els.thresholdTooltip.hidden); + }); + els.thresholdTooltip.addEventListener('click', () => setThresholdTooltipVisible(false)); + els.thresholdTooltip.addEventListener('keydown', (event) => { + if (event.key === 'Enter' || event.key === ' ') setThresholdTooltipVisible(false); + }); + + els.btnShutter.addEventListener('click', captureNow); + els.btnDownloadAll.addEventListener('click', () => gallery.downloadAll()); + + els.viewerClose.addEventListener('click', () => gallery.close()); + els.viewerCopy.addEventListener('click', () => gallery.copyOpen()); + els.viewerDownload.addEventListener('click', () => gallery.downloadOpen()); + els.viewerDelete.addEventListener('click', () => gallery.deleteOpen()); + + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && gallery.isOpen()) gallery.close(); + if (event.key === 'Escape') setThresholdTooltipVisible(false); + if ( + event.code === 'Space' && + !event.repeat && + runtime.baseline && + canUseGuideShortcut(event.target) + ) { + event.preventDefault(); + baselineGuide?.show(); + } + }); + + document.addEventListener('visibilitychange', () => { + if (document.hidden) handleHidden(); + else handleVisible(); + }); + + window.addEventListener('pagehide', teardown); +} + +/** + * Runtime bridge for diagnostics and Playwright checks. + * + * @type {object} + */ +window.gstmxxRealtime = { + /** + * Returns a serialisable snapshot of runtime state. + * + * @returns {object} State snapshot. + */ + getState() { + const stats = graph ? graph.stats() : { samples: 0, gaps: 0, events: 0, following: true }; + return { + appState: runtime.appState, + hasBaseline: Boolean(runtime.baseline), + noiseFloor: runtime.baseline ? runtime.baseline.noiseFloor : null, + threshold: MATCH_THRESHOLD, + graphMaxDistance: GRAPH_MAX_DISTANCE, + windowSeconds: GRAPH_WINDOW_SECONDS, + faceMissing: runtime.faceMissing, + distanceBufferLength: runtime.distanceBuffer.length, + sampleCount: stats.samples, + visibleSampleCount: stats.visibleSamples, + timelineVirtualHeight: stats.virtualHeight, + gapCount: stats.gaps, + eventCount: stats.events, + qualityCounts: stats.quality, + qualityVisible: stats.qualityVisible, + statusQuality: statusDisplay.quality, + statusKey: statusDisplay.key, + following: stats.following, + captureCount: gallery ? gallery.size() : 0, + running: runtime.running, + streamStopped: runtime.streamStopped, + sourceKind: runtime.sourceKind, + lastDetectionScore: runtime.lastDetectionScore, + lastDescriptorLength: runtime.lastDescriptorLength, + sessionPhase: runtime.sessionPhase, + sessionStep: runtime.sessionStep, + lastMeasurement: runtime.lastMeasurement + ? { + distance: runtime.lastMeasurement.distance, + spread: runtime.lastMeasurement.spread, + capturedAt: runtime.lastMeasurement.capturedAt, + } + : null, + }; + }, + /** + * Starts a baseline capture run without pressing UI controls. + * + * @returns {void} + */ + triggerCalibration() { + startBaselineCapture(); + }, + /** Marks the beginning of a declared makeup step. */ + startMakeupStep, + /** Starts the temporal snapshot for the declared makeup step. */ + measureStep: startStepMeasurement, + /** + * Releases camera and loops. + * + * @returns {void} + */ + teardown, + /** + * Restarts camera and loops after a teardown. + * + * @returns {Promise} + */ + resume: handleVisible, +}; + +/** + * Initialises the visualizer and starts its loops. + * + * @returns {Promise} + */ +export async function initRealtime() { + if (runtime.initialized) return; + runtime.initialized = true; + + setStatus('Loading models…'); + setTrackingState(APP_STATES.NO_BASELINE); + initEqualizer(); + + graph = createGraph({ + scrollEl: els.graphScroll, + spacerEl: els.graphSpacer, + canvasEl: els.graphCanvas, + followEl: els.graphFollow, + windowSeconds: GRAPH_WINDOW_SECONDS, + samplesPerSecond: SAMPLES_PER_SECOND, + maxDistance: GRAPH_MAX_DISTANCE, + threshold: MATCH_THRESHOLD, + onMarkerClick: (captureId) => gallery.open(captureId), + }); + + radialGraph = createRadialGraph({ + canvasEl: els.radialCanvas, + maxDelta: MAX_DELTA, + }); + + baselineGuide = createBaselineGuide({ + canvasEl: els.guideCanvas, + videoEl: els.video, + stageEl: els.centerView, + }); + + gallery = createGallery({ + viewerEl: els.viewer, + imageEl: els.viewerImage, + metaEl: els.viewerMeta, + countEl: els.galleryCount, + onCountChange: (count) => { + els.btnDownloadAll.disabled = count === 0; + els.btnDeleteAll.disabled = count === 0; + }, + onDelete: (captureId) => { + if (captureId) graph.clearCapture(captureId); + else graph.reset(); + }, + onStatus: (message) => setStatus(message), + }); + + createSettings({ + rootEl: els.layer, + brightnessEl: els.brightness, + brightnessValueEl: els.brightnessValue, + equalizerEl: els.toggleEqualizer, + layoutEl: els.layer, + onLayoutChange: () => graph.resize(), + }); + + qualityGate = createQualityGate(els.video); + baselineCollector = createBaselineCollector({ + targetSamples: BASELINE_TARGET_SAMPLES, + minDurationMs: BASELINE_MIN_MS, + timeoutMs: BASELINE_TIMEOUT_MS, + maxSpread: BASELINE_MAX_SPREAD, + }); + measurementCollector = createBaselineCollector({ + targetSamples: MEASUREMENT_TARGET_SAMPLES, + minDurationMs: MEASUREMENT_MIN_MS, + timeoutMs: MEASUREMENT_TIMEOUT_MS, + maxSpread: MEASUREMENT_MAX_SPREAD, + }); + spikeDetector = createSpikeDetector({ + sustainMs: SPIKE_SUSTAIN_MS, + bestMargin: SPIKE_BEST_MARGIN, + threshold: MATCH_THRESHOLD, + cooldownMs: SPIKE_COOLDOWN_MS, + }); + frameBuffer = createFrameBuffer(els.video, FRAME_BUFFER_SLOTS, CAPTURE_MAX_WIDTH); + + bindListeners(); + graph.resize(); + + try { + await gallery.init(); + } catch (err) { + console.error('capture store unavailable:', err); + setStatus('Capture storage unavailable — measurement still works.', true); + } + + await loadModels(); + let sourceReady = false; + try { + await initWebcam(); + sourceReady = true; + } catch (err) { + runtime.streamStopped = true; + console.error('camera unavailable:', err); + els.sourceState.textContent = 'camera unavailable'; + setStatus('Camera unavailable. Open a local video from Source.', true); + } + + // A stored baseline skips straight to tracking. The trace itself is not + // restored: replaying old history and appending new samples would draw one + // continuous line across a discontinuity that could be days wide. + const stored = sourceReady ? loadBaseline() : null; + if (stored) adoptBaseline(stored, true); + else { + syncBaselineControls(); + if (sourceReady) setStatus('Camera ready. Capture a baseline to start measuring.'); + } + + startLoops(); +} + +/** + * Bootstraps the page and reports startup failures in the status pill. + * + * @returns {Promise} + */ +async function boot() { + try { + await initRealtime(); + } catch (err) { + console.error('Failed to initialize realtime visualizer:', err); + setStatus(`Initialization failed: ${err.message || String(err)}`, true); + } +} + +boot(); diff --git a/lab-js/vendor/FOLDER-DESCRIPTION.md b/lab-js/vendor/FOLDER-DESCRIPTION.md index 4b02d30..4ecce84 100644 --- a/lab-js/vendor/FOLDER-DESCRIPTION.md +++ b/lab-js/vendor/FOLDER-DESCRIPTION.md @@ -4,6 +4,6 @@ This folder contains third-party browser runtime assets mirrored into the reposi The files come from face-api.js, MediaPipe Tasks Vision, face-api model weights, MediaPipe model files, and the local refresh helper `fetch-sources.sh`. They are used by the detection, recognition, landmarking, and MediaPipe/3D paths at runtime. -`face-api.js` is loaded as a classic script before the ES modules that call the global `faceapi` object. The model shards and manifests provide TinyFaceDetector, 68-point landmarks, recognition descriptors, age/gender, and expression models. `tasks-vision@0.10.35.js`, `face_landmarker.task`, `mobilenet_v3_small.tflite`, and the nested `wasm/` runtime support the MediaPipe face-landmark and ImageEmbedder paths. +`face-api.js` is loaded as a classic script before the ES modules that call the global `faceapi` object. The model shards and manifests provide TinyFaceDetector, 68-point landmarks, recognition descriptors, age/gender, and expression models. `tasks-vision@0.10.35.js`, its `vision_bundle_mjs.js.map` source map, `face_landmarker.task`, `mobilenet_v3_small.tflite`, and the nested `wasm/` runtime support the MediaPipe face-landmark and ImageEmbedder paths. -These files are excluded from code2prompt because they are vendored libraries, model weights, WASM support files, and generated manifests. Their exact source URLs and refresh rules are documented in `lab-js/vendor/README.md` in the repository, but only this summary and the nested folder description are uploaded to the chatbot. +These files are excluded from code2prompt because they are vendored libraries, source maps, model weights, WASM support files, and generated manifests. Their exact source URLs and refresh rules are documented in `lab-js/vendor/scripts-vendor-README.md` in the repository, but only this summary and the nested folder description are uploaded to the chatbot. diff --git a/lab-js/vendor/fetch-sources.sh b/lab-js/vendor/fetch-sources.sh index bde6341..511e571 100755 --- a/lab-js/vendor/fetch-sources.sh +++ b/lab-js/vendor/fetch-sources.sh @@ -27,7 +27,11 @@ fetch "https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js-models@master/f fetch "https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js-models@master/face_expression/face_expression_model-shard1" "face_expression_model-shard1" fetch "https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js-models@master/age_gender_model/age_gender_model-shard1" "age_gender_model-shard1" -# MediaPipe Tasks Vision @ 0.10.35 runtime files. +# MediaPipe Tasks Vision @ 0.10.35 bundle, source map, and runtime files. +# Keep the bundle byte-for-byte aligned with the upstream file: the source map +# describes the minified one-line bundle and is invalid after pretty-printing. +fetch "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/vision_bundle.mjs" "tasks-vision@0.10.35.js" +fetch "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/vision_bundle.mjs.map" "vision_bundle_mjs.js.map" fetch "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/wasm/vision_wasm_internal.js" "wasm/vision_wasm_internal.js" fetch "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/wasm/vision_wasm_internal.wasm" "wasm/vision_wasm_internal.wasm" diff --git a/lab-js/vendor/scripts-vendor-README.md b/lab-js/vendor/scripts-vendor-README.md index 01d8a5c..99ffce5 100644 --- a/lab-js/vendor/scripts-vendor-README.md +++ b/lab-js/vendor/scripts-vendor-README.md @@ -7,7 +7,6 @@ Use `lab-js/vendor/fetch-sources.sh` to refresh the assets it manages. | Local file | Source URL | Upstream version/reference | Notes | |---|---|---|---| | `face-api.js` | `https://cdn.jsdelivr.net/npm/@vladmandic/face-api/dist/face-api.js` | floating (no `@x.y.z` in URL) | Main `faceapi` browser bundle used by the Lab pages. | -| `tasks-vision@0.10.35.js` | `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35` | `0.10.35` | ESM bundle imported by 3D/embedder paths. | ## URLs synced by `fetch-sources.sh` @@ -32,9 +31,17 @@ Source reference for this block is currently `justadudewhohacks/face-api.js-mode | Local file | Source URL | |---|---| +| `tasks-vision@0.10.35.js` | `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/vision_bundle.mjs` | +| `vision_bundle_mjs.js.map` | `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/vision_bundle.mjs.map` | | `wasm/vision_wasm_internal.js` | `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/wasm/vision_wasm_internal.js` | | `wasm/vision_wasm_internal.wasm` | `https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.35/wasm/vision_wasm_internal.wasm` | +The source map is stored as `vision_bundle_mjs.js.map` because that is the +relative filename declared by the upstream bundle. Keep +`tasks-vision@0.10.35.js` byte-for-byte aligned with `vision_bundle.mjs`: +pretty-printing the generated JavaScript changes line and column positions and +invalidates the upstream mappings. + ### MediaPipe model files | Local file | Source URL | Version segment | diff --git a/lab-js/vendor/tasks-vision@0.10.35.js b/lab-js/vendor/tasks-vision@0.10.35.js index d704ee3..f2aa30d 100644 --- a/lab-js/vendor/tasks-vision@0.10.35.js +++ b/lab-js/vendor/tasks-vision@0.10.35.js @@ -1,9218 +1,2 @@ -/** - * Skipped minification because the original files appears to be already minified. - * Original file: /npm/@mediapipe/tasks-vision@0.10.35/vision_bundle.mjs - * - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -var t = "undefined" != typeof self ? self : {}; -function e(e, n) { - t: { - for (var r = ["CLOSURE_FLAGS"], i = t, s = 0; s < r.length; s++) - if (null == (i = i[r[s]])) { - r = null; - break t; - } - r = i; - } - return null != (e = r && r[e]) ? e : n; -} -function n() { - throw Error("Invalid UTF8"); -} -function r(t, e) { - return ((e = String.fromCharCode.apply(null, e)), null == t ? e : t + e); -} -let i, s; -const o = "undefined" != typeof TextDecoder; -let a; -const c = "undefined" != typeof TextEncoder; -function h(t) { - if (c) t = (a ||= new TextEncoder()).encode(t); - else { - let n = 0; - const r = new Uint8Array(3 * t.length); - for (let i = 0; i < t.length; i++) { - var e = t.charCodeAt(i); - if (e < 128) r[n++] = e; - else { - if (e < 2048) r[n++] = (e >> 6) | 192; - else { - if (e >= 55296 && e <= 57343) { - if (e <= 56319 && i < t.length) { - const s = t.charCodeAt(++i); - if (s >= 56320 && s <= 57343) { - ((e = 1024 * (e - 55296) + s - 56320 + 65536), - (r[n++] = (e >> 18) | 240), - (r[n++] = ((e >> 12) & 63) | 128), - (r[n++] = ((e >> 6) & 63) | 128), - (r[n++] = (63 & e) | 128)); - continue; - } - i--; - } - e = 65533; - } - ((r[n++] = (e >> 12) | 224), (r[n++] = ((e >> 6) & 63) | 128)); - } - r[n++] = (63 & e) | 128; - } - } - t = n === r.length ? r : r.subarray(0, n); - } - return t; -} -function u(e) { - t.setTimeout(() => { - throw e; - }, 0); -} -var l, - f = e(610401301, !1), - d = e(748402147, !0); -function p() { - var e = t.navigator; - return e && (e = e.userAgent) ? e : ""; -} -const g = t.navigator; -function m(t) { - return (m[" "](t), t); -} -((l = (g && g.userAgentData) || null), (m[" "] = function () {})); -const y = {}; -let _ = null; -function v(t) { - const e = t.length; - let n = (3 * e) / 4; - n % 3 - ? (n = Math.floor(n)) - : -1 != "=.".indexOf(t[e - 1]) && - (n = -1 != "=.".indexOf(t[e - 2]) ? n - 2 : n - 1); - const r = new Uint8Array(n); - let i = 0; - return ( - (function (t, e) { - function n(e) { - for (; r < t.length; ) { - const e = t.charAt(r++), - n = _[e]; - if (null != n) return n; - if (!/^[\s\xa0]*$/.test(e)) - throw Error("Unknown base64 encoding at char: " + e); - } - return e; - } - E(); - let r = 0; - for (;;) { - const t = n(-1), - r = n(0), - i = n(64), - s = n(64); - if (64 === s && -1 === t) break; - (e((t << 2) | (r >> 4)), - 64 != i && - (e(((r << 4) & 240) | (i >> 2)), - 64 != s && e(((i << 6) & 192) | s))); - } - })(t, function (t) { - r[i++] = t; - }), - i !== n ? r.subarray(0, i) : r - ); -} -function E() { - if (!_) { - _ = {}; - var t = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split( - "", - ), - e = ["+/=", "+/", "-_=", "-_.", "-_"]; - for (let n = 0; n < 5; n++) { - const r = t.concat(e[n].split("")); - y[n] = r; - for (let t = 0; t < r.length; t++) { - const e = r[t]; - void 0 === _[e] && (_[e] = t); - } - } - } -} -var w = "undefined" != typeof Uint8Array, - T = - !( - !(f && l && l.brands.length > 0) && - (-1 != p().indexOf("Trident") || -1 != p().indexOf("MSIE")) - ) && "function" == typeof btoa; -const A = /[-_.]/g, - b = { "-": "+", _: "/", ".": "=" }; -function k(t) { - return b[t] || ""; -} -function S(t) { - if (!T) return v(t); - ((t = A.test(t) ? t.replace(A, k) : t), (t = atob(t))); - const e = new Uint8Array(t.length); - for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n); - return e; -} -function x(t) { - return w && null != t && t instanceof Uint8Array; -} -var L = {}; -function R() { - return (M ||= new F(null, L)); -} -function I(t) { - C(L); - var e = t.g; - return null == - (e = null == e || x(e) ? e : "string" == typeof e ? S(e) : null) - ? e - : (t.g = e); -} -var F = class { - h() { - return new Uint8Array(I(this) || 0); - } - constructor(t, e) { - if ((C(e), (this.g = t), null != t && 0 === t.length)) - throw Error("ByteString should be constructed with non-empty values"); - } -}; -let M, P; -function C(t) { - if (t !== L) throw Error("illegal external caller"); -} -function O(t, e) { - (t.__closure__error__context__984382 || - (t.__closure__error__context__984382 = {}), - (t.__closure__error__context__984382.severity = e)); -} -function N(t) { - return (O((t = Error(t)), "warning"), t); -} -function U(t, e) { - if (null != t) { - var n = (P ??= {}), - r = n[t] || 0; - r >= e || ((n[t] = r + 1), O((t = Error()), "incident"), u(t)); - } -} -function D() { - return "function" == typeof BigInt; -} -var B = "function" == typeof Symbol && "symbol" == typeof Symbol(); -function G(t, e, n = !1) { - return "function" == typeof Symbol && "symbol" == typeof Symbol() - ? n && Symbol.for && t - ? Symbol.for(t) - : null != t - ? Symbol(t) - : Symbol() - : e; -} -var j = G("jas", void 0, !0), - V = G(void 0, "0di"), - X = G(void 0, "1oa"), - H = G(void 0, Symbol()), - W = G(void 0, "0ub"), - z = G(void 0, "0ubs"), - K = G(void 0, "0ubsb"), - Y = G(void 0, "0actk"), - q = G("m_m", "Pa", !0), - $ = G(); -const J = { Ga: { value: 0, configurable: !0, writable: !0, enumerable: !1 } }, - Z = Object.defineProperties, - Q = B ? j : "Ga"; -var tt; -const et = []; -function nt(t, e) { - (B || Q in t || Z(t, J), (t[Q] |= e)); -} -function rt(t, e) { - (B || Q in t || Z(t, J), (t[Q] = e)); -} -function it(t) { - return (nt(t, 34), t); -} -function st(t) { - return (nt(t, 8192), t); -} -(rt(et, 7), (tt = Object.freeze(et))); -var ot = {}; -function at(t, e) { - return void 0 === e - ? t.h !== ct && !!(2 & (0 | t.v[Q])) - : !!(2 & e) && t.h !== ct; -} -const ct = {}; -function ht(t, e) { - if (null != t) - if ("string" == typeof t) t = t ? new F(t, L) : R(); - else if (t.constructor !== F) - if (x(t)) t = t.length ? new F(new Uint8Array(t), L) : R(); - else { - if (!e) throw Error(); - t = void 0; - } - return t; -} -class ut { - constructor(t, e, n) { - ((this.g = t), (this.h = e), (this.l = n)); - } - next() { - const t = this.g.next(); - return (t.done || (t.value = this.h.call(this.l, t.value)), t); - } - [Symbol.iterator]() { - return this; - } -} -var lt = Object.freeze({}); -function ft(t, e, n) { - const r = 128 & e ? 0 : -1, - i = t.length; - var s; - (s = !!i) && - (s = - null != (s = t[i - 1]) && - "object" == typeof s && - s.constructor === Object); - const o = i + (s ? -1 : 0); - for (e = 128 & e ? 1 : 0; e < o; e++) n(e - r, t[e]); - if (s) { - t = t[i - 1]; - for (const e in t) !isNaN(e) && n(+e, t[e]); - } -} -var dt = {}; -function pt(t) { - return 128 & t ? dt : void 0; -} -function gt(t) { - return ((t.Na = !0), t); -} -var mt = gt((t) => "number" == typeof t), - yt = gt((t) => "string" == typeof t), - _t = gt((t) => "boolean" == typeof t), - vt = "function" == typeof t.BigInt && "bigint" == typeof t.BigInt(0); -function Et(t) { - var e = t; - if (yt(e)) { - if (!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e)) throw Error(String(e)); - } else if (mt(e) && !Number.isSafeInteger(e)) throw Error(String(e)); - return vt - ? BigInt(t) - : (t = _t(t) ? (t ? "1" : "0") : yt(t) ? t.trim() || "0" : String(t)); -} -var wt = gt((t) => - vt ? t >= At && t <= kt : "-" === t[0] ? St(t, Tt) : St(t, bt), -); -const Tt = Number.MIN_SAFE_INTEGER.toString(), - At = vt ? BigInt(Number.MIN_SAFE_INTEGER) : void 0, - bt = Number.MAX_SAFE_INTEGER.toString(), - kt = vt ? BigInt(Number.MAX_SAFE_INTEGER) : void 0; -function St(t, e) { - if (t.length > e.length) return !1; - if (t.length < e.length || t === e) return !0; - for (let n = 0; n < t.length; n++) { - const r = t[n], - i = e[n]; - if (r > i) return !1; - if (r < i) return !0; - } -} -const xt = "function" == typeof Uint8Array.prototype.slice; -let Lt, - Rt = 0, - It = 0; -function Ft(t) { - const e = t >>> 0; - ((Rt = e), (It = ((t - e) / 4294967296) >>> 0)); -} -function Mt(t) { - if (t < 0) { - Ft(-t); - const [e, n] = jt(Rt, It); - ((Rt = e >>> 0), (It = n >>> 0)); - } else Ft(t); -} -function Pt(t) { - const e = (Lt ||= new DataView(new ArrayBuffer(8))); - (e.setFloat32(0, +t, !0), (It = 0), (Rt = e.getUint32(0, !0))); -} -function Ct(t, e) { - const n = 4294967296 * e + (t >>> 0); - return Number.isSafeInteger(n) ? n : Ut(t, e); -} -function Ot(t, e) { - return Et( - D() - ? BigInt.asUintN(64, (BigInt(e >>> 0) << BigInt(32)) + BigInt(t >>> 0)) - : Ut(t, e), - ); -} -function Nt(t, e) { - return D() - ? Et( - BigInt.asIntN( - 64, - (BigInt.asUintN(32, BigInt(e)) << BigInt(32)) + - BigInt.asUintN(32, BigInt(t)), - ), - ) - : Et(Bt(t, e)); -} -function Ut(t, e) { - if (((t >>>= 0), (e >>>= 0) <= 2097151)) var n = "" + (4294967296 * e + t); - else - D() - ? (n = "" + ((BigInt(e) << BigInt(32)) | BigInt(t))) - : ((t = - (16777215 & t) + - 6777216 * (n = 16777215 & ((t >>> 24) | (e << 8))) + - 6710656 * (e = (e >> 16) & 65535)), - (n += 8147497 * e), - (e *= 2), - t >= 1e7 && ((n += (t / 1e7) >>> 0), (t %= 1e7)), - n >= 1e7 && ((e += (n / 1e7) >>> 0), (n %= 1e7)), - (n = e + Dt(n) + Dt(t))); - return n; -} -function Dt(t) { - return ((t = String(t)), "0000000".slice(t.length) + t); -} -function Bt(t, e) { - if (2147483648 & e) - if (D()) t = "" + ((BigInt(0 | e) << BigInt(32)) | BigInt(t >>> 0)); - else { - const [n, r] = jt(t, e); - t = "-" + Ut(n, r); - } - else t = Ut(t, e); - return t; -} -function Gt(t) { - if (t.length < 16) Mt(Number(t)); - else if (D()) - ((t = BigInt(t)), - (Rt = Number(t & BigInt(4294967295)) >>> 0), - (It = Number((t >> BigInt(32)) & BigInt(4294967295)))); - else { - const e = +("-" === t[0]); - It = Rt = 0; - const n = t.length; - for (let r = e, i = ((n - e) % 6) + e; i <= n; r = i, i += 6) { - const e = Number(t.slice(r, i)); - ((It *= 1e6), - (Rt = 1e6 * Rt + e), - Rt >= 4294967296 && - ((It += Math.trunc(Rt / 4294967296)), (It >>>= 0), (Rt >>>= 0))); - } - if (e) { - const [t, e] = jt(Rt, It); - ((Rt = t), (It = e)); - } - } -} -function jt(t, e) { - return ((e = ~e), t ? (t = 1 + ~t) : (e += 1), [t, e]); -} -function Vt(t) { - return Array.prototype.slice.call(t); -} -const Xt = "function" == typeof BigInt ? BigInt.asIntN : void 0, - Ht = "function" == typeof BigInt ? BigInt.asUintN : void 0, - Wt = Number.isSafeInteger, - zt = Number.isFinite, - Kt = Math.trunc, - Yt = Et(0); -function qt(t) { - if (null != t && "number" != typeof t) - throw Error( - `Value of float/double field must be a number, found ${typeof t}: ${t}`, - ); - return t; -} -function $t(t) { - return null == t || "number" == typeof t - ? t - : "NaN" === t || "Infinity" === t || "-Infinity" === t - ? Number(t) - : void 0; -} -function Jt(t) { - if (null != t && "boolean" != typeof t) { - var e = typeof t; - throw Error( - `Expected boolean but got ${"object" != e ? e : t ? (Array.isArray(t) ? "array" : e) : "null"}: ${t}`, - ); - } - return t; -} -function Zt(t) { - return null == t || "boolean" == typeof t - ? t - : "number" == typeof t - ? !!t - : void 0; -} -const Qt = /^-?([1-9][0-9]*|0)(\.[0-9]+)?$/; -function te(t) { - switch (typeof t) { - case "bigint": - return !0; - case "number": - return zt(t); - case "string": - return Qt.test(t); - default: - return !1; - } -} -function ee(t) { - if (null == t) return t; - if ("string" == typeof t && t) t = +t; - else if ("number" != typeof t) return; - return zt(t) ? 0 | t : void 0; -} -function ne(t) { - if (null == t) return t; - if ("string" == typeof t && t) t = +t; - else if ("number" != typeof t) return; - return zt(t) ? t >>> 0 : void 0; -} -function re(t) { - const e = t.length; - return ( - "-" === t[0] - ? e < 20 || (20 === e && t <= "-9223372036854775808") - : e < 19 || (19 === e && t <= "9223372036854775807") - ) - ? t - : (Gt(t), Bt(Rt, It)); -} -function ie(t) { - if (((t = Kt(t)), !Wt(t))) { - Mt(t); - var e = Rt, - n = It; - ((t = 2147483648 & n) && - ((n = ~n >>> 0), 0 == (e = (1 + ~e) >>> 0) && (n = (n + 1) >>> 0)), - (t = "number" == typeof (e = Ct(e, n)) ? (t ? -e : e) : t ? "-" + e : e)); - } - return t; -} -function se(t) { - var e = Kt(Number(t)); - return Wt(e) - ? String(e) - : (-1 !== (e = t.indexOf(".")) && (t = t.substring(0, e)), re(t)); -} -function oe(t) { - var e = Kt(Number(t)); - return Wt(e) - ? Et(e) - : (-1 !== (e = t.indexOf(".")) && (t = t.substring(0, e)), - D() ? Et(Xt(64, BigInt(t))) : Et(re(t))); -} -function ae(t) { - return ( - Wt(t) - ? (t = Et(ie(t))) - : ((t = Kt(t)), - Wt(t) ? (t = String(t)) : (Mt(t), (t = Bt(Rt, It))), - (t = Et(t))), - t - ); -} -function ce(t) { - const e = typeof t; - return null == t - ? t - : "bigint" === e - ? Et(Xt(64, t)) - : te(t) - ? "string" === e - ? oe(t) - : ae(t) - : void 0; -} -function he(t) { - if ("string" != typeof t) throw Error(); - return t; -} -function ue(t) { - if (null != t && "string" != typeof t) throw Error(); - return t; -} -function le(t) { - return null == t || "string" == typeof t ? t : void 0; -} -function fe(t, e, n, r) { - return null != t && t[q] === ot - ? t - : Array.isArray(t) - ? ((r = (n = 0 | t[Q]) | (32 & r) | (2 & r)) !== n && rt(t, r), new e(t)) - : (n - ? 2 & r - ? ((t = e[V]) || (it((t = new e()).v), (t = e[V] = t)), (e = t)) - : (e = new e()) - : (e = void 0), - e); -} -function de(t, e, n) { - if (e) - t: { - if (!te((e = t))) throw N("int64"); - switch (typeof e) { - case "string": - e = oe(e); - break t; - case "bigint": - e = Et(Xt(64, e)); - break t; - default: - e = ae(e); - } - } - else e = ce(t); - return null == (t = e) ? (n ? Yt : void 0) : t; -} -const pe = {}; -let ge = (function () { - try { - return ( - m( - new (class extends Map { - constructor() { - super(); - } - })(), - ), - !1 - ); - } catch { - return !0; - } -})(); -class me { - constructor() { - this.g = new Map(); - } - get(t) { - return this.g.get(t); - } - set(t, e) { - return (this.g.set(t, e), (this.size = this.g.size), this); - } - delete(t) { - return ((t = this.g.delete(t)), (this.size = this.g.size), t); - } - clear() { - (this.g.clear(), (this.size = this.g.size)); - } - has(t) { - return this.g.has(t); - } - entries() { - return this.g.entries(); - } - keys() { - return this.g.keys(); - } - values() { - return this.g.values(); - } - forEach(t, e) { - return this.g.forEach(t, e); - } - [Symbol.iterator]() { - return this.entries(); - } -} -const ye = ge - ? (Object.setPrototypeOf(me.prototype, Map.prototype), - Object.defineProperties(me.prototype, { - size: { value: 0, configurable: !0, enumerable: !0, writable: !0 }, - }), - me) - : class extends Map { - constructor() { - super(); - } - }; -function _e(t) { - return t; -} -function ve(t) { - if (2 & t.J) throw Error("Cannot mutate an immutable Map"); -} -var Ee = class extends ye { - constructor(t, e, n = _e, r = _e) { - (super(), - (this.J = 0 | t[Q]), - (this.K = e), - (this.S = n), - (this.fa = this.K ? we : r)); - for (let i = 0; i < t.length; i++) { - const s = t[i], - o = n(s[0], !1, !0); - let a = s[1]; - (e - ? void 0 === a && (a = null) - : (a = r(s[1], !1, !0, void 0, void 0, this.J)), - super.set(o, a)); - } - } - V(t) { - return st(Array.from(super.entries(), t)); - } - clear() { - (ve(this), super.clear()); - } - delete(t) { - return (ve(this), super.delete(this.S(t, !0, !1))); - } - entries() { - if (this.K) { - var t = super.keys(); - t = new ut(t, Te, this); - } else t = super.entries(); - return t; - } - values() { - if (this.K) { - var t = super.keys(); - t = new ut(t, Ee.prototype.get, this); - } else t = super.values(); - return t; - } - forEach(t, e) { - this.K - ? super.forEach((n, r, i) => { - t.call(e, i.get(r), r, i); - }) - : super.forEach(t, e); - } - set(t, e) { - return ( - ve(this), - null == (t = this.S(t, !0, !1)) - ? this - : null == e - ? (super.delete(t), this) - : super.set(t, this.fa(e, !0, !0, this.K, !1, this.J)) - ); - } - Ma(t) { - const e = this.S(t[0], !1, !0); - ((t = t[1]), - (t = this.K - ? void 0 === t - ? null - : t - : this.fa(t, !1, !0, void 0, !1, this.J)), - super.set(e, t)); - } - has(t) { - return super.has(this.S(t, !1, !1)); - } - get(t) { - t = this.S(t, !1, !1); - const e = super.get(t); - if (void 0 !== e) { - var n = this.K; - return n - ? ((n = this.fa(e, !1, !0, n, this.ra, this.J)) !== e && - super.set(t, n), - n) - : e; - } - } - [Symbol.iterator]() { - return this.entries(); - } -}; -function we(t, e, n, r, i, s) { - return ((t = fe(t, r, n, s)), i && (t = Xe(t)), t); -} -function Te(t) { - return [t, this.get(t)]; -} -let Ae; -function be() { - return (Ae ||= new Ee(it([]), void 0, void 0, void 0, pe)); -} -function ke(t) { - return H ? t[H] : void 0; -} -function Se(t, e) { - for (const n in t) !isNaN(n) && e(t, +n, t[n]); -} -Ee.prototype.toJSON = void 0; -var xe = class {}; -const Le = { Ka: !0 }; -function Re(t, e) { - e < 100 || U(z, 1); -} -function Ie(t, e, n, r) { - const i = void 0 !== r; - r = !!r; - var s, - o = H; - (!i && B && o && (s = t[o]) && Se(s, Re), (o = [])); - var a = t.length; - let c; - s = 4294967295; - let h = !1; - const u = !!(64 & e), - l = u ? (128 & e ? 0 : -1) : void 0; - (1 & e || - ((c = a && t[a - 1]), - null != c && "object" == typeof c && c.constructor === Object - ? (s = --a) - : (c = void 0), - !u || 128 & e || i || ((h = !0), (s = s - l + l))), - (e = void 0)); - for (var f = 0; f < a; f++) { - let i = t[f]; - if (null != i && null != (i = n(i, r))) - if (u && f >= s) { - const t = f - l; - (e ??= {})[t] = i; - } else o[f] = i; - } - if (c) - for (let t in c) { - if (null == (a = c[t]) || null == (a = n(a, r))) continue; - let i; - ((f = +t), - u && !Number.isNaN(f) && (i = f + l) < s - ? (o[i] = a) - : ((e ??= {})[t] = a)); - } - return ( - e && (h ? o.push(e) : (o[s] = e)), - i && - H && - (t = ke(t)) && - t instanceof xe && - (o[H] = (function (t) { - const e = new xe(); - return ( - Se(t, (t, n, r) => { - e[n] = Vt(r); - }), - (e.da = t.da), - e - ); - })(t)), - o - ); -} -function Fe(t) { - return ((t[0] = Me(t[0])), (t[1] = Me(t[1])), t); -} -function Me(t) { - switch (typeof t) { - case "number": - return Number.isFinite(t) ? t : "" + t; - case "bigint": - return wt(t) ? Number(t) : "" + t; - case "boolean": - return t ? 1 : 0; - case "object": - if (Array.isArray(t)) { - var e = 0 | t[Q]; - return 0 === t.length && 1 & e ? void 0 : Ie(t, e, Me); - } - if (null != t && t[q] === ot) return Oe(t); - if (t instanceof F) { - if (null == (e = t.g)) t = ""; - else if ("string" == typeof e) t = e; - else { - if (T) { - for (var n = "", r = 0, i = e.length - 10240; r < i; ) - n += String.fromCharCode.apply(null, e.subarray(r, (r += 10240))); - ((n += String.fromCharCode.apply(null, r ? e.subarray(r) : e)), - (e = btoa(n))); - } else { - (void 0 === n && (n = 0), - E(), - (n = y[n]), - (r = Array(Math.floor(e.length / 3))), - (i = n[64] || "")); - let t = 0, - h = 0; - for (; t < e.length - 2; t += 3) { - var s = e[t], - o = e[t + 1], - a = e[t + 2], - c = n[s >> 2]; - ((s = n[((3 & s) << 4) | (o >> 4)]), - (o = n[((15 & o) << 2) | (a >> 6)]), - (a = n[63 & a]), - (r[h++] = c + s + o + a)); - } - switch (((c = 0), (a = i), e.length - t)) { - case 2: - a = n[(15 & (c = e[t + 1])) << 2] || i; - case 1: - ((e = e[t]), - (r[h] = n[e >> 2] + n[((3 & e) << 4) | (c >> 4)] + a + i)); - } - e = r.join(""); - } - t = t.g = e; - } - return t; - } - return t instanceof Ee ? (t = 0 !== t.size ? t.V(Fe) : void 0) : void 0; - } - return t; -} -let Pe, Ce; -function Oe(t) { - return Ie((t = t.v), 0 | t[Q], Me); -} -function Ne(t, e) { - return Ue(t, e[0], e[1]); -} -function Ue(t, e, n, r = 0) { - if (null == t) { - var i = 32; - (n ? ((t = [n]), (i |= 128)) : (t = []), - e && (i = (-16760833 & i) | ((1023 & e) << 14))); - } else { - if (!Array.isArray(t)) throw Error("narr"); - if (((i = 0 | t[Q]), d && 1 & i)) throw Error("rfarr"); - if ( - (2048 & i && - !(2 & i) && - (function () { - if (d) throw Error("carr"); - U(Y, 5); - })(), - 256 & i) - ) - throw Error("farr"); - if (64 & i) return ((i | r) !== i && rt(t, i | r), t); - if (n && ((i |= 128), n !== t[0])) throw Error("mid"); - t: { - i |= 64; - var s = (n = t).length; - if (s) { - var o = s - 1; - const t = n[o]; - if (null != t && "object" == typeof t && t.constructor === Object) { - if ((o -= e = 128 & i ? 0 : -1) >= 1024) throw Error("pvtlmt"); - for (var a in t) (s = +a) < o && ((n[s + e] = t[a]), delete t[a]); - i = (-16760833 & i) | ((1023 & o) << 14); - break t; - } - } - if (e) { - if ((a = Math.max(e, s - (128 & i ? 0 : -1))) > 1024) - throw Error("spvt"); - i = (-16760833 & i) | ((1023 & a) << 14); - } - } - } - return (rt(t, 64 | i | r), t); -} -function De(t, e) { - if ("object" != typeof t) return t; - if (Array.isArray(t)) { - var n = 0 | t[Q]; - return 0 === t.length && 1 & n ? void 0 : Be(t, n, e); - } - if (null != t && t[q] === ot) return je(t); - if (t instanceof Ee) { - if (2 & (e = t.J)) return t; - if (!t.size) return; - if (((n = it(t.V())), t.K)) - for (t = 0; t < n.length; t++) { - const r = n[t]; - let i = r[1]; - ((i = - null == i || "object" != typeof i - ? void 0 - : null != i && i[q] === ot - ? je(i) - : Array.isArray(i) - ? Be(i, 0 | i[Q], !!(32 & e)) - : void 0), - (r[1] = i)); - } - return n; - } - return t instanceof F ? t : void 0; -} -function Be(t, e, n) { - return ( - 2 & e || - (!n || 4096 & e || 16 & e - ? (t = Ve(t, e, !1, n && !(16 & e))) - : (nt(t, 34), 4 & e && Object.freeze(t))), - t - ); -} -function Ge(t, e, n) { - return ((t = new t.constructor(e)), n && (t.h = ct), (t.m = ct), t); -} -function je(t) { - const e = t.v, - n = 0 | e[Q]; - return at(t, n) ? t : Ke(t, e, n) ? Ge(t, e) : Ve(e, n); -} -function Ve(t, e, n, r) { - return ( - (r ??= !!(34 & e)), - (t = Ie(t, e, De, r)), - (r = 32), - n && (r |= 2), - rt(t, (e = (16769217 & e) | r)), - t - ); -} -function Xe(t) { - const e = t.v, - n = 0 | e[Q]; - return at(t, n) - ? Ke(t, e, n) - ? Ge(t, e, !0) - : new t.constructor(Ve(e, n, !1)) - : t; -} -function He(t) { - if (t.h !== ct) return !1; - var e = t.v; - return ( - nt((e = Ve(e, 0 | e[Q])), 2048), - (t.v = e), - (t.h = void 0), - (t.m = void 0), - !0 - ); -} -function We(t) { - if (!He(t) && at(t, 0 | t.v[Q])) throw Error(); -} -function ze(t, e) { - (void 0 === e && (e = 0 | t[Q]), 32 & e && !(4096 & e) && rt(t, 4096 | e)); -} -function Ke(t, e, n) { - return ( - !!(2 & n) || (!(!(32 & n) || 4096 & n) && (rt(e, 2 | n), (t.h = ct), !0)) - ); -} -const Ye = Et(0), - qe = {}; -function $e(t, e, n, r, i) { - if (null !== (e = Je(t.v, e, n, i)) || (r && t.m !== ct)) return e; -} -function Je(t, e, n, r) { - if (-1 === e) return null; - const i = e + (n ? 0 : -1), - s = t.length - 1; - let o, a; - if (!(s < 1 + (n ? 0 : -1))) { - if (i >= s) - if ( - ((o = t[s]), - null != o && "object" == typeof o && o.constructor === Object) - ) - ((n = o[e]), (a = !0)); - else { - if (i !== s) return; - n = o; - } - else n = t[i]; - if (r && null != n) { - if (null == (r = r(n))) return r; - if (!Object.is(r, n)) return (a ? (o[e] = r) : (t[i] = r), r); - } - return n; - } -} -function Ze(t, e, n, r) { - (We(t), Qe((t = t.v), 0 | t[Q], e, n, r)); -} -function Qe(t, e, n, r, i) { - const s = n + (i ? 0 : -1); - var o = t.length - 1; - if (o >= 1 + (i ? 0 : -1) && s >= o) { - const i = t[o]; - if (null != i && "object" == typeof i && i.constructor === Object) - return ((i[n] = r), e); - } - return s <= o - ? ((t[s] = r), e) - : (void 0 !== r && - (n >= (o = ((e ??= 0 | t[Q]) >> 14) & 1023 || 536870912) - ? null != r && (t[o + (i ? 0 : -1)] = { [n]: r }) - : (t[s] = r)), - e); -} -function tn() { - return void 0 === lt ? 2 : 4; -} -function en(t, e, n, r, i) { - let s = t.v, - o = 0 | s[Q]; - ((r = at(t, o) ? 1 : r), - (i = !!i || 3 === r), - 2 === r && He(t) && ((s = t.v), (o = 0 | s[Q]))); - let a = (t = rn(s, e)) === tt ? 7 : 0 | t[Q], - c = sn(a, o); - var h = !(4 & c); - if (h) { - 4 & c && ((t = Vt(t)), (a = 0), (c = An(c, o)), (o = Qe(s, o, e, t))); - let r = 0, - i = 0; - for (; r < t.length; r++) { - const e = n(t[r]); - null != e && (t[i++] = e); - } - (i < r && (t.length = i), - (n = -513 & (4 | c)), - (c = n &= -1025), - (c &= -4097)); - } - return ( - c !== a && (rt(t, c), 2 & c && Object.freeze(t)), - nn(t, c, s, o, e, r, h, i) - ); -} -function nn(t, e, n, r, i, s, o, a) { - let c = e; - return ( - 1 === s || (4 === s && (2 & e || (!(16 & e) && 32 & r))) - ? on(e) || - ((e |= - !t.length || (o && !(4096 & e)) || (32 & r && !(4096 & e || 16 & e)) - ? 2 - : 256) !== c && rt(t, e), - Object.freeze(t)) - : (2 === s && - on(e) && - ((t = Vt(t)), (c = 0), (e = An(e, r)), (r = Qe(n, r, i, t))), - on(e) || (a || (e |= 16), e !== c && rt(t, e))), - 2 & e || !(4096 & e || 16 & e) || ze(n, r), - t - ); -} -function rn(t, e, n) { - return ((t = Je(t, e, n)), Array.isArray(t) ? t : tt); -} -function sn(t, e) { - return (2 & e && (t |= 2), 1 | t); -} -function on(t) { - return (!!(2 & t) && !!(4 & t)) || !!(256 & t); -} -function an(t) { - return ht(t, !0); -} -function cn(t) { - t = Vt(t); - for (let e = 0; e < t.length; e++) { - const n = (t[e] = Vt(t[e])); - Array.isArray(n[1]) && (n[1] = it(n[1])); - } - return st(t); -} -function hn(t, e, n, r) { - (We(t), - Qe( - (t = t.v), - 0 | t[Q], - e, - ("0" === r ? 0 === Number(n) : n === r) ? void 0 : n, - )); -} -function un(t, e, n) { - if (2 & e) throw Error(); - const r = pt(e); - let i = rn(t, n, r), - s = i === tt ? 7 : 0 | i[Q], - o = sn(s, e); - return ( - (2 & o || on(o) || 16 & o) && - (o === s || on(o) || rt(i, o), - (i = Vt(i)), - (s = 0), - (o = An(o, e)), - Qe(t, e, n, i, r)), - (o &= -13), - o !== s && rt(i, o), - i - ); -} -function ln(t, e) { - var n = Cs; - return pn(fn((t = t.v)), t, void 0, n) === e ? e : -1; -} -function fn(t) { - if (B) return t[X] ?? (t[X] = new Map()); - if (X in t) return t[X]; - const e = new Map(); - return (Object.defineProperty(t, X, { value: e }), e); -} -function dn(t, e, n, r, i) { - const s = fn(t), - o = pn(s, t, e, n, i); - return (o !== r && (o && (e = Qe(t, e, o, void 0, i)), s.set(n, r)), e); -} -function pn(t, e, n, r, i) { - let s = t.get(r); - if (null != s) return s; - s = 0; - for (let t = 0; t < r.length; t++) { - const o = r[t]; - null != Je(e, o, i) && (0 !== s && (n = Qe(e, n, s, void 0, i)), (s = o)); - } - return (t.set(r, s), s); -} -function gn(t, e, n) { - let r = 0 | t[Q]; - const i = pt(r), - s = Je(t, n, i); - let o; - if (null != s && s[q] === ot) { - if (!at(s)) return (He(s), s.v); - o = s.v; - } else Array.isArray(s) && (o = s); - if (o) { - const t = 0 | o[Q]; - 2 & t && (o = Ve(o, t)); - } - return ((o = Ne(o, e)), o !== s && Qe(t, r, n, o, i), o); -} -function mn(t, e, n, r, i) { - let s = !1; - if ( - null != - (r = Je(t, r, i, (t) => { - const r = fe(t, n, !1, e); - return ((s = r !== t && null != r), r); - })) - ) - return (s && !at(r) && ze(t, e), r); -} -function yn(t, e, n, r) { - let i = t.v, - s = 0 | i[Q]; - if (null == (e = mn(i, s, e, n, r))) return e; - if (((s = 0 | i[Q]), !at(t, s))) { - const o = Xe(e); - o !== e && - (He(t) && ((i = t.v), (s = 0 | i[Q])), - (s = Qe(i, s, n, (e = o), r)), - ze(i, s)); - } - return e; -} -function _n(t, e, n, r, i, s, o, a) { - var c = at(t, n); - ((s = c ? 1 : s), - (o = !!o || 3 === s), - (c = a && !c), - (2 === s || c) && He(t) && (n = 0 | (e = t.v)[Q])); - var h = (t = rn(e, i)) === tt ? 7 : 0 | t[Q], - u = sn(h, n); - if ((a = !(4 & u))) { - var l = t, - f = n; - const e = !!(2 & u); - e && (f |= 2); - let i = !e, - s = !0, - o = 0, - a = 0; - for (; o < l.length; o++) { - const t = fe(l[o], r, !1, f); - if (t instanceof r) { - if (!e) { - const e = at(t); - ((i &&= !e), (s &&= e)); - } - l[a++] = t; - } - } - (a < o && (l.length = a), - (u |= 4), - (u = s ? -4097 & u : 4096 | u), - (u = i ? 8 | u : -9 & u)); - } - if ( - (u !== h && (rt(t, u), 2 & u && Object.freeze(t)), - c && - !( - 8 & u || - (!t.length && - (1 === s || (4 === s && (2 & u || (!(16 & u) && 32 & n))))) - )) - ) { - for ( - on(u) && ((t = Vt(t)), (u = An(u, n)), (n = Qe(e, n, i, t))), - r = t, - c = u, - h = 0; - h < r.length; - h++ - ) - (l = r[h]) !== (u = Xe(l)) && (r[h] = u); - ((c |= 8), rt(t, (u = c = r.length ? 4096 | c : -4097 & c))); - } - return nn(t, u, e, n, i, s, a, o); -} -function vn(t, e, n) { - const r = t.v; - return _n(t, r, 0 | r[Q], e, n, tn(), !1, !0); -} -function En(t) { - return (null == t && (t = void 0), t); -} -function wn(t, e, n, r, i) { - return (Ze(t, n, (r = En(r)), i), r && !at(r) && ze(t.v), t); -} -function Tn(t, e, n, r) { - t: { - var i = (r = En(r)); - We(t); - const s = t.v; - let o = 0 | s[Q]; - if (null == i) { - const t = fn(s); - if (pn(t, s, o, n) !== e) break t; - t.set(n, 0); - } else o = dn(s, o, n, e); - Qe(s, o, e, i); - } - r && !at(r) && ze(t.v); -} -function An(t, e) { - return -273 & (2 & e ? 2 | t : -3 & t); -} -function bn(t, e, n, r) { - var i = r; - (We(t), - (t = _n(t, (r = t.v), 0 | r[Q], n, e, 2, !0)), - (i = null != i ? i : new n()), - t.push(i), - (e = n = t === tt ? 7 : 0 | t[Q]), - (i = at(i)) ? ((n &= -9), 1 === t.length && (n &= -4097)) : (n |= 4096), - n !== e && rt(t, n), - i || ze(r)); -} -function kn(t, e, n) { - return ee($e(t, e, void 0, n)); -} -function Sn(t, e) { - return $e(t, e, void 0, void 0, $t) ?? 0; -} -function xn(t, e, n) { - if (null != n) { - if ("number" != typeof n) throw N("int32"); - if (!zt(n)) throw N("int32"); - n |= 0; - } - Ze(t, e, n); -} -function Ln(t, e, n) { - Ze(t, e, qt(n)); -} -function Rn(t, e, n) { - hn(t, e, ue(n), ""); -} -function In(t, e, n) { - { - We(t); - const o = t.v; - let a = 0 | o[Q]; - if (null == n) Qe(o, a, e); - else { - var r = (t = n === tt ? 7 : 0 | n[Q]), - i = on(t), - s = i || Object.isFrozen(n); - for ( - i || (t = 0), - s || ((n = Vt(n)), (r = 0), (t = An(t, a)), (s = !1)), - t |= 5, - t |= (4 & t ? (512 & t ? 512 : 1024 & t ? 1024 : 0) : void 0) ?? 1024, - i = 0; - i < n.length; - i++ - ) { - const e = n[i], - o = he(e); - Object.is(e, o) || - (s && ((n = Vt(n)), (r = 0), (t = An(t, a)), (s = !1)), (n[i] = o)); - } - (t !== r && (s && ((n = Vt(n)), (t = An(t, a))), rt(n, t)), - Qe(o, a, e, n)); - } - } -} -function Fn(t, e, n) { - (We(t), en(t, e, le, 2, !0).push(he(n))); -} -var Mn = class { - constructor(t, e, n) { - if (((this.buffer = t), n && !e)) throw Error(); - this.g = e; - } -}; -function Pn(t, e) { - if ("string" == typeof t) return new Mn(S(t), e); - if (Array.isArray(t)) return new Mn(new Uint8Array(t), e); - if (t.constructor === Uint8Array) return new Mn(t, !1); - if (t.constructor === ArrayBuffer) - return ((t = new Uint8Array(t)), new Mn(t, !1)); - if (t.constructor === F) - return ((e = I(t) || new Uint8Array(0)), new Mn(e, !0, t)); - if (t instanceof Uint8Array) - return ( - (t = - t.constructor === Uint8Array - ? t - : new Uint8Array(t.buffer, t.byteOffset, t.byteLength)), - new Mn(t, !1) - ); - throw Error(); -} -function Cn(t, e) { - let n, - r = 0, - i = 0, - s = 0; - const o = t.h; - let a = t.g; - do { - ((n = o[a++]), (r |= (127 & n) << s), (s += 7)); - } while (s < 32 && 128 & n); - if (s > 32) - for (i |= (127 & n) >> 4, s = 3; s < 32 && 128 & n; s += 7) - ((n = o[a++]), (i |= (127 & n) << s)); - if ((Gn(t, a), !(128 & n))) return e(r >>> 0, i >>> 0); - throw Error(); -} -function On(t) { - let e = 0, - n = t.g; - const r = n + 10, - i = t.h; - for (; n < r; ) { - const r = i[n++]; - if (((e |= r), 0 == (128 & r))) return (Gn(t, n), !!(127 & e)); - } - throw Error(); -} -function Nn(t) { - const e = t.h; - let n = t.g, - r = e[n++], - i = 127 & r; - if ( - 128 & r && - ((r = e[n++]), - (i |= (127 & r) << 7), - 128 & r && - ((r = e[n++]), - (i |= (127 & r) << 14), - 128 & r && - ((r = e[n++]), - (i |= (127 & r) << 21), - 128 & r && - ((r = e[n++]), - (i |= r << 28), - 128 & r && - 128 & e[n++] && - 128 & e[n++] && - 128 & e[n++] && - 128 & e[n++] && - 128 & e[n++])))) - ) - throw Error(); - return (Gn(t, n), i); -} -function Un(t) { - return Nn(t) >>> 0; -} -function Dn(t) { - var e = t.h; - const n = t.g; - var r = e[n], - i = e[n + 1]; - const s = e[n + 2]; - return ( - (e = e[n + 3]), - Gn(t, t.g + 4), - (t = - 2 * ((i = ((r << 0) | (i << 8) | (s << 16) | (e << 24)) >>> 0) >> 31) + - 1), - (r = (i >>> 23) & 255), - (i &= 8388607), - 255 == r - ? i - ? NaN - : t * (1 / 0) - : 0 == r - ? 1401298464324817e-60 * t * i - : t * Math.pow(2, r - 150) * (i + 8388608) - ); -} -function Bn(t) { - return Nn(t); -} -function Gn(t, e) { - if (((t.g = e), e > t.l)) throw Error(); -} -function jn(t, e) { - if (e < 0) throw Error(); - const n = t.g; - if ((e = n + e) > t.l) throw Error(); - return ((t.g = e), n); -} -function Vn(t, e) { - if (0 == e) return R(); - var n = jn(t, e); - return ( - t.Y && t.j - ? (n = t.h.subarray(n, n + e)) - : ((t = t.h), - (n = - n === (e = n + e) - ? new Uint8Array(0) - : xt - ? t.slice(n, e) - : new Uint8Array(t.subarray(n, e)))), - 0 == n.length ? R() : new F(n, L) - ); -} -var Xn = []; -function Hn(t, e, n, r) { - if (Qn.length) { - const i = Qn.pop(); - return (i.o(r), i.g.init(t, e, n, r), i); - } - return new Zn(t, e, n, r); -} -function Wn(t) { - (t.g.clear(), (t.l = -1), (t.h = -1), Qn.length < 100 && Qn.push(t)); -} -function zn(t) { - var e = t.g; - if (e.g == e.l) return !1; - t.m = t.g.g; - var n = Un(t.g); - if (((e = n >>> 3), !((n &= 7) >= 0 && n <= 5))) throw Error(); - if (e < 1) throw Error(); - return ((t.l = e), (t.h = n), !0); -} -function Kn(t) { - switch (t.h) { - case 0: - 0 != t.h ? Kn(t) : On(t.g); - break; - case 1: - Gn((t = t.g), t.g + 8); - break; - case 2: - if (2 != t.h) Kn(t); - else { - var e = Un(t.g); - Gn((t = t.g), t.g + e); - } - break; - case 5: - Gn((t = t.g), t.g + 4); - break; - case 3: - for (e = t.l; ; ) { - if (!zn(t)) throw Error(); - if (4 == t.h) { - if (t.l != e) throw Error(); - break; - } - Kn(t); - } - break; - default: - throw Error(); - } -} -function Yn(t, e, n) { - const r = t.g.l; - var i = Un(t.g); - let s = (i = t.g.g + i) - r; - if ( - (s <= 0 && ((t.g.l = i), n(e, t, void 0, void 0, void 0), (s = i - t.g.g)), - s) - ) - throw Error(); - return ((t.g.g = i), (t.g.l = r), e); -} -function qn(t) { - var e = Un(t.g), - a = jn((t = t.g), e); - if (((t = t.h), o)) { - var c, - h = t; - ((c = s) || (c = s = new TextDecoder("utf-8", { fatal: !0 })), - (e = a + e), - (h = 0 === a && e === h.length ? h : h.subarray(a, e))); - try { - var u = c.decode(h); - } catch (t) { - if (void 0 === i) { - try { - c.decode(new Uint8Array([128])); - } catch (t) {} - try { - (c.decode(new Uint8Array([97])), (i = !0)); - } catch (t) { - i = !1; - } - } - throw (!i && (s = void 0), t); - } - } else { - ((e = (u = a) + e), (a = [])); - let i, - s = null; - for (; u < e; ) { - var l = t[u++]; - (l < 128 - ? a.push(l) - : l < 224 - ? u >= e - ? n() - : ((i = t[u++]), - l < 194 || 128 != (192 & i) - ? (u--, n()) - : a.push(((31 & l) << 6) | (63 & i))) - : l < 240 - ? u >= e - 1 - ? n() - : ((i = t[u++]), - 128 != (192 & i) || - (224 === l && i < 160) || - (237 === l && i >= 160) || - 128 != (192 & (c = t[u++])) - ? (u--, n()) - : a.push(((15 & l) << 12) | ((63 & i) << 6) | (63 & c))) - : l <= 244 - ? u >= e - 2 - ? n() - : ((i = t[u++]), - 128 != (192 & i) || - (i - 144 + (l << 28)) >> 30 != 0 || - 128 != (192 & (c = t[u++])) || - 128 != (192 & (h = t[u++])) - ? (u--, n()) - : ((l = - ((7 & l) << 18) | - ((63 & i) << 12) | - ((63 & c) << 6) | - (63 & h)), - (l -= 65536), - a.push(55296 + ((l >> 10) & 1023), 56320 + (1023 & l)))) - : n(), - a.length >= 8192 && ((s = r(s, a)), (a.length = 0))); - } - u = r(s, a); - } - return u; -} -function $n(t) { - const e = Un(t.g); - return Vn(t.g, e); -} -function Jn(t, e, n) { - var r = Un(t.g); - for (r = t.g.g + r; t.g.g < r; ) n.push(e(t.g)); -} -var Zn = class { - constructor(t, e, n, r) { - if (Xn.length) { - const i = Xn.pop(); - (i.init(t, e, n, r), (t = i)); - } else - t = new (class { - constructor(t, e, n, r) { - ((this.h = null), - (this.j = !1), - (this.g = this.l = this.m = 0), - this.init(t, e, n, r)); - } - init(t, e, n, { Y: r = !1, ea: i = !1 } = {}) { - ((this.Y = r), - (this.ea = i), - t && - ((t = Pn(t, this.ea)), - (this.h = t.buffer), - (this.j = t.g), - (this.m = e || 0), - (this.l = void 0 !== n ? this.m + n : this.h.length), - (this.g = this.m))); - } - clear() { - ((this.h = null), - (this.j = !1), - (this.g = this.l = this.m = 0), - (this.Y = !1)); - } - })(t, e, n, r); - ((this.g = t), (this.m = this.g.g), (this.h = this.l = -1), this.o(r)); - } - o({ ha: t = !1 } = {}) { - this.ha = t; - } - }, - Qn = []; -function tr(t) { - return t - ? /^\d+$/.test(t) - ? (Gt(t), new er(Rt, It)) - : null - : (nr ||= new er(0, 0)); -} -var er = class { - constructor(t, e) { - ((this.h = t >>> 0), (this.g = e >>> 0)); - } -}; -let nr; -function rr(t) { - return t - ? /^-?\d+$/.test(t) - ? (Gt(t), new ir(Rt, It)) - : null - : (sr ||= new ir(0, 0)); -} -var ir = class { - constructor(t, e) { - ((this.h = t >>> 0), (this.g = e >>> 0)); - } -}; -let sr; -function or(t, e, n) { - for (; n > 0 || e > 127; ) - (t.g.push((127 & e) | 128), - (e = ((e >>> 7) | (n << 25)) >>> 0), - (n >>>= 7)); - t.g.push(e); -} -function ar(t, e) { - for (; e > 127; ) (t.g.push((127 & e) | 128), (e >>>= 7)); - t.g.push(e); -} -function cr(t, e) { - if (e >= 0) ar(t, e); - else { - for (let n = 0; n < 9; n++) (t.g.push((127 & e) | 128), (e >>= 7)); - t.g.push(1); - } -} -function hr(t) { - var e = Rt; - (t.g.push((e >>> 0) & 255), - t.g.push((e >>> 8) & 255), - t.g.push((e >>> 16) & 255), - t.g.push((e >>> 24) & 255)); -} -function ur(t, e) { - 0 !== e.length && (t.l.push(e), (t.h += e.length)); -} -function lr(t, e, n) { - ar(t.g, 8 * e + n); -} -function fr(t, e) { - return (lr(t, e, 2), (e = t.g.end()), ur(t, e), e.push(t.h), e); -} -function dr(t, e) { - var n = e.pop(); - for (n = t.h + t.g.length() - n; n > 127; ) - (e.push((127 & n) | 128), (n >>>= 7), t.h++); - (e.push(n), t.h++); -} -function pr(t, e, n) { - (lr(t, e, 2), ar(t.g, n.length), ur(t, t.g.end()), ur(t, n)); -} -function gr(t, e, n, r) { - null != n && ((e = fr(t, e)), r(n, t), dr(t, e)); -} -function mr() { - const t = class { - constructor() { - throw Error(); - } - }; - return (Object.setPrototypeOf(t, t.prototype), t); -} -var yr = mr(), - _r = mr(), - vr = mr(), - Er = mr(), - wr = mr(), - Tr = mr(), - Ar = mr(), - br = mr(), - kr = mr(), - Sr = mr(); -function xr(t, e, n) { - var r = t.v; - (H && H in r && (r = r[H]) && delete r[e.g], - e.h ? e.j(t, e.h, e.g, n, e.l) : e.j(t, e.g, n, e.l)); -} -var Lr = class { - constructor(t, e) { - this.v = Ue(t, e, void 0, 2048); - } - toJSON() { - return Oe(this); - } - j() { - var t = xo, - e = this.v, - n = t.g, - r = H; - if ( - (B && r && null != e[r]?.[n] && U(W, 3), - (e = t.g), - $ && H && void 0 === $ && (r = (n = this.v)[H]) && (r = r.da)) - ) - try { - r(n, e, Le); - } catch (t) { - u(t); - } - return t.h ? t.m(this, t.h, t.g, t.l) : t.m(this, t.g, t.defaultValue, t.l); - } - clone() { - const t = this.v, - e = 0 | t[Q]; - return Ke(this, t, e) - ? Ge(this, t, !0) - : new this.constructor(Ve(t, e, !1)); - } -}; -((Lr.prototype[q] = ot), - (Lr.prototype.toString = function () { - return this.v.toString(); - })); -var Rr = class { - constructor(t, e, n) { - ((this.g = t), (this.h = e), (t = yr), (this.l = (!!t && n === t) || !1)); - } -}; -function Ir(t, e) { - return new Rr(t, e, yr); -} -function Fr(t, e, n, r, i) { - gr(t, n, Xr(e, r), i); -} -const Mr = Ir(function (t, e, n, r, i) { - return 2 === t.h && (Yn(t, gn(e, r, n), i), !0); - }, Fr), - Pr = Ir(function (t, e, n, r, i) { - return 2 === t.h && (Yn(t, gn(e, r, n), i), !0); - }, Fr); -var Cr = Symbol(), - Or = Symbol(), - Nr = Symbol(), - Ur = Symbol(), - Dr = Symbol(); -let Br, Gr; -function jr(t, e, n, r) { - var i = r[t]; - if (i) return i; - (((i = {}).qa = r), - (i.T = (function (t) { - switch (typeof t) { - case "boolean": - return (Pe ||= [0, void 0, !0]); - case "number": - return t > 0 ? void 0 : 0 === t ? (Ce ||= [0, void 0]) : [-t, void 0]; - case "string": - return [0, t]; - case "object": - return t; - } - })(r[0]))); - var s = r[1]; - let o = 1; - s && - s.constructor === Object && - ((i.ba = s), - "function" == typeof (s = r[++o]) && - ((i.ma = !0), (Br ??= s), (Gr ??= r[o + 1]), (s = r[(o += 2)]))); - const a = {}; - for ( - ; - s && Array.isArray(s) && s.length && "number" == typeof s[0] && s[0] > 0; - - ) { - for (var c = 0; c < s.length; c++) a[s[c]] = s; - s = r[++o]; - } - for (c = 1; void 0 !== s; ) { - let t; - "number" == typeof s && ((c += s), (s = r[++o])); - var h = void 0; - if ((s instanceof Rr ? (t = s) : ((t = Mr), o--), t?.l)) { - ((s = r[++o]), (h = r)); - var u = o; - ("function" == typeof s && ((s = s()), (h[u] = s)), (h = s)); - } - for ( - u = c + 1, - "number" == typeof (s = r[++o]) && s < 0 && ((u -= s), (s = r[++o])); - c < u; - c++ - ) { - const r = a[c]; - h ? n(i, c, t, h, r) : e(i, c, t, r); - } - } - return (r[t] = i); -} -function Vr(t) { - return Array.isArray(t) ? (t[0] instanceof Rr ? t : [Pr, t]) : [t, void 0]; -} -function Xr(t, e) { - return t instanceof Lr ? t.v : Array.isArray(t) ? Ne(t, e) : void 0; -} -function Hr(t, e, n, r) { - const i = n.g; - t[e] = r ? (t, e, n) => i(t, e, n, r) : i; -} -function Wr(t, e, n, r, i) { - const s = n.g; - let o, a; - t[e] = (t, e, n) => s(t, e, n, (a ||= jr(Or, Hr, Wr, r).T), (o ||= zr(r)), i); -} -function zr(t) { - let e = t[Nr]; - if (null != e) return e; - const n = jr(Or, Hr, Wr, t); - return ( - (e = n.ma - ? (t, e) => Br(t, e, n) - : (t, e) => { - for (; zn(e) && 4 != e.h; ) { - var r = e.l, - i = n[r]; - if (null == i) { - var s = n.ba; - s && (s = s[r]) && null != (s = Yr(s)) && (i = n[r] = s); - } - if (null == i || !i(e, t, r)) { - if (((i = (s = e).m), Kn(s), s.ha)) var o = void 0; - else ((o = s.g.g - i), (s.g.g = i), (o = Vn(s.g, o))); - ((i = void 0), - (s = t), - o && - ((i = s[H] ?? (s[H] = new xe()))[r] ?? (i[r] = [])).push(o)); - } - } - return ((t = ke(t)) && (t.da = n.qa[Dr]), !0); - }), - (t[Nr] = e), - (t[Dr] = Kr.bind(t)), - e - ); -} -function Kr(t, e, n, r) { - var i = this[Or]; - const s = this[Nr], - o = Ne(void 0, i.T), - a = ke(t); - if (a) { - var c = !1, - h = i.ba; - if (h) { - if ( - ((i = (e, n, i) => { - if (0 !== i.length) - if (h[n]) - for (const t of i) { - e = Hn(t); - try { - ((c = !0), s(o, e)); - } finally { - Wn(e); - } - } - else r?.(t, n, i); - }), - null == e) - ) - Se(a, i); - else if (null != a) { - const t = a[e]; - t && i(a, e, t); - } - if (c) { - let r = 0 | t[Q]; - if (2 & r && 2048 & r && !n?.Ka) throw Error(); - const i = pt(r), - s = (e, s) => { - if (null != Je(t, e, i)) { - if (1 === n?.Qa) return; - throw Error(); - } - (null != s && (r = Qe(t, r, e, s, i)), delete a[e]); - }; - null == e - ? ft(o, 0 | o[Q], (t, e) => { - s(t, e); - }) - : s(e, Je(o, e, i)); - } - } - } -} -function Yr(t) { - const e = (t = Vr(t))[0].g; - if ((t = t[1])) { - const n = zr(t), - r = jr(Or, Hr, Wr, t).T; - return (t, i, s) => e(t, i, s, r, n); - } - return e; -} -function qr(t, e, n) { - t[e] = n.h; -} -function $r(t, e, n, r) { - let i, s; - const o = n.h; - t[e] = (t, e, n) => o(t, e, n, (s ||= jr(Cr, qr, $r, r).T), (i ||= Jr(r))); -} -function Jr(t) { - let e = t[Ur]; - if (!e) { - const n = jr(Cr, qr, $r, t); - ((e = (t, e) => Zr(t, e, n)), (t[Ur] = e)); - } - return e; -} -function Zr(t, e, n) { - (ft(t, 0 | t[Q], (t, r) => { - if (null != r) { - var i = (function (t, e) { - var n = t[e]; - if (n) return n; - if ((n = t.ba) && (n = n[e])) { - var r = (n = Vr(n))[0].h; - if ((n = n[1])) { - const e = Jr(n), - i = jr(Cr, qr, $r, n).T; - n = t.ma ? Gr(i, e) : (t, n, s) => r(t, n, s, i, e); - } else n = r; - return (t[e] = n); - } - })(n, t); - i ? i(e, r, t) : t < 500 || U(K, 3); - } - }), - (t = ke(t)) && - Se(t, (t, n, r) => { - for (ur(e, e.g.end()), t = 0; t < r.length; t++) - ur(e, I(r[t]) || new Uint8Array(0)); - })); -} -const Qr = Et(0); -function ti(t, e) { - if (Array.isArray(e)) { - var n = 0 | e[Q]; - if (4 & n) return e; - for (var r = 0, i = 0; r < e.length; r++) { - const n = t(e[r]); - null != n && (e[i++] = n); - } - return ( - i < r && (e.length = i), - (t = -1537 & (5 | n)) !== n && rt(e, t), - 2 & t && Object.freeze(e), - e - ); - } -} -function ei(t, e, n) { - return new Rr(t, e, n); -} -function ni(t, e, n) { - return new Rr(t, e, n); -} -function ri(t, e, n) { - Qe(t, 0 | t[Q], e, n, pt(0 | t[Q])); -} -var ii = Ir( - function (t, e, n, r, i) { - if (2 !== t.h) return !1; - if ( - ((t = Vt((t = Yn(t, Ne([void 0, void 0], r), i)))), - (i = pt((r = 0 | e[Q]))), - 2 & r) - ) - throw Error(); - let s = Je(e, n, i); - if (s instanceof Ee) - 0 != (2 & s.J) ? ((s = s.V()), s.push(t), Qe(e, r, n, s, i)) : s.Ma(t); - else if (Array.isArray(s)) { - var o = 0 | s[Q]; - (8192 & o || rt(s, (o |= 8192)), - 2 & o && ((s = cn(s)), Qe(e, r, n, s, i)), - s.push(t)); - } else Qe(e, r, n, st([t]), i); - return !0; - }, - function (t, e, n, r, i) { - if (e instanceof Ee) - e.forEach((e, s) => { - gr(t, n, Ne([s, e], r), i); - }); - else if (Array.isArray(e)) { - for (let s = 0; s < e.length; s++) { - const o = e[s]; - Array.isArray(o) && gr(t, n, Ne(o, r), i); - } - st(e); - } - }, -); -function si(t, e, n) { - null != (e = $t(e)) && (lr(t, n, 5), (t = t.g), Pt(e), hr(t)); -} -function oi(t, e, n) { - if ( - ((e = (function (t) { - if (null == t) return t; - const e = typeof t; - if ("bigint" === e) return String(Xt(64, t)); - if (te(t)) { - if ("string" === e) return se(t); - if ("number" === e) return ie(t); - } - })(e)), - null != e) - ) { - if ("string" == typeof e) rr(e); - if (null != e) - switch ((lr(t, n, 0), typeof e)) { - case "number": - ((t = t.g), Mt(e), or(t, Rt, It)); - break; - case "bigint": - ((n = BigInt.asUintN(64, e)), - (n = new ir( - Number(n & BigInt(4294967295)), - Number(n >> BigInt(32)), - )), - or(t.g, n.h, n.g)); - break; - default: - ((n = rr(e)), or(t.g, n.h, n.g)); - } - } -} -function ai(t, e, n) { - null != (e = ee(e)) && null != e && (lr(t, n, 0), cr(t.g, e)); -} -function ci(t, e, n) { - null != (e = Zt(e)) && (lr(t, n, 0), t.g.g.push(e ? 1 : 0)); -} -function hi(t, e, n) { - null != (e = le(e)) && pr(t, n, h(e)); -} -function ui(t, e, n, r, i) { - gr(t, n, Xr(e, r), i); -} -function li(t, e, n) { - null != - (e = null == e || "string" == typeof e || e instanceof F ? e : void 0) && - pr(t, n, Pn(e, !0).buffer); -} -function fi(t, e, n) { - null != (e = ne(e)) && null != e && (lr(t, n, 0), ar(t.g, e)); -} -function di(t, e, n) { - return ( - (5 === t.h || 2 === t.h) && - ((e = un(e, 0 | e[Q], n)), 2 == t.h ? Jn(t, Dn, e) : e.push(Dn(t.g)), !0) - ); -} -var pi = ei( - function (t, e, n) { - return 5 === t.h && (ri(e, n, Dn(t.g)), !0); - }, - si, - br, - ), - gi = ni( - di, - function (t, e, n) { - if (null != (e = ti($t, e))) - for (let o = 0; o < e.length; o++) { - var r = t, - i = n, - s = e[o]; - null != s && (lr(r, i, 5), (r = r.g), Pt(s), hr(r)); - } - }, - br, - ), - mi = ni( - di, - function (t, e, n) { - if (null != (e = ti($t, e)) && e.length) { - (lr(t, n, 2), ar(t.g, 4 * e.length)); - for (let r = 0; r < e.length; r++) ((n = t.g), Pt(e[r]), hr(n)); - } - }, - br, - ), - yi = ei( - function (t, e, n) { - return 5 === t.h && (ri(e, n, 0 === (t = Dn(t.g)) ? void 0 : t), !0); - }, - si, - br, - ), - _i = ei( - function (t, e, n) { - return (0 !== t.h ? (t = !1) : (ri(e, n, Cn(t.g, Nt)), (t = !0)), t); - }, - oi, - Tr, - ), - vi = ei( - function (t, e, n) { - return ( - 0 !== t.h - ? (e = !1) - : (ri(e, n, (t = Cn(t.g, Nt)) === Qr ? void 0 : t), (e = !0)), - e - ); - }, - oi, - Tr, - ), - Ei = ei( - function (t, e, n) { - return (0 !== t.h ? (t = !1) : (ri(e, n, Cn(t.g, Ot)), (t = !0)), t); - }, - function (t, e, n) { - if ( - ((e = (function (t) { - if (null == t) return t; - var e = typeof t; - if ("bigint" === e) return String(Ht(64, t)); - if (te(t)) { - if ("string" === e) - return ( - (e = Kt(Number(t))), - Wt(e) && e >= 0 - ? (t = String(e)) - : (-1 !== (e = t.indexOf(".")) && (t = t.substring(0, e)), - (e = - "-" !== t[0] && - ((e = t.length) < 20 || - (20 === e && t <= "18446744073709551615"))) || - (Gt(t), (t = Ut(Rt, It)))), - t - ); - if ("number" === e) - return ( - ((t = Kt(t)) >= 0 && Wt(t)) || (Mt(t), (t = Ct(Rt, It))), - t - ); - } - })(e)), - null != e) - ) { - if ("string" == typeof e) tr(e); - if (null != e) - switch ((lr(t, n, 0), typeof e)) { - case "number": - ((t = t.g), Mt(e), or(t, Rt, It)); - break; - case "bigint": - ((n = BigInt.asUintN(64, e)), - (n = new er( - Number(n & BigInt(4294967295)), - Number(n >> BigInt(32)), - )), - or(t.g, n.h, n.g)); - break; - default: - ((n = tr(e)), or(t.g, n.h, n.g)); - } - } - }, - Ar, - ), - wi = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, Nn(t.g)), !0); - }, - ai, - Er, - ), - Ti = ni( - function (t, e, n) { - return ( - (0 === t.h || 2 === t.h) && - ((e = un(e, 0 | e[Q], n)), - 2 == t.h ? Jn(t, Nn, e) : e.push(Nn(t.g)), - !0) - ); - }, - function (t, e, n) { - if (null != (e = ti(ee, e)) && e.length) { - n = fr(t, n); - for (let n = 0; n < e.length; n++) cr(t.g, e[n]); - dr(t, n); - } - }, - Er, - ), - Ai = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, 0 === (t = Nn(t.g)) ? void 0 : t), !0); - }, - ai, - Er, - ), - bi = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, On(t.g)), !0); - }, - ci, - _r, - ), - ki = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, !1 === (t = On(t.g)) ? void 0 : t), !0); - }, - ci, - _r, - ), - Si = ni( - function (t, e, n) { - return 2 === t.h && ((t = qn(t)), un(e, 0 | e[Q], n).push(t), !0); - }, - function (t, e, n) { - if (null != (e = ti(le, e))) - for (let o = 0; o < e.length; o++) { - var r = t, - i = n, - s = e[o]; - null != s && pr(r, i, h(s)); - } - }, - vr, - ), - xi = ei( - function (t, e, n) { - return 2 === t.h && (ri(e, n, "" === (t = qn(t)) ? void 0 : t), !0); - }, - hi, - vr, - ), - Li = ei( - function (t, e, n) { - return 2 === t.h && (ri(e, n, qn(t)), !0); - }, - hi, - vr, - ), - Ri = (function (t, e, n = yr) { - return new Rr(t, e, n); - })( - function (t, e, n, r, i) { - return ( - 2 === t.h && - ((r = Ne(void 0, r)), un(e, 0 | e[Q], n).push(r), Yn(t, r, i), !0) - ); - }, - function (t, e, n, r, i) { - if (Array.isArray(e)) { - for (let s = 0; s < e.length; s++) ui(t, e[s], n, r, i); - 1 & (t = 0 | e[Q]) || rt(e, 1 | t); - } - }, - ), - Ii = Ir(function (t, e, n, r, i, s) { - if (2 !== t.h) return !1; - let o = 0 | e[Q]; - return (dn(e, o, s, n, pt(o)), Yn(t, (e = gn(e, r, n)), i), !0); - }, ui), - Fi = ei( - function (t, e, n) { - return 2 === t.h && (ri(e, n, $n(t)), !0); - }, - li, - kr, - ), - Mi = ni( - function (t, e, n) { - return ( - (0 === t.h || 2 === t.h) && - ((e = un(e, 0 | e[Q], n)), - 2 == t.h ? Jn(t, Un, e) : e.push(Un(t.g)), - !0) - ); - }, - function (t, e, n) { - if (null != (e = ti(ne, e))) - for (let o = 0; o < e.length; o++) { - var r = t, - i = n, - s = e[o]; - null != s && (lr(r, i, 0), ar(r.g, s)); - } - }, - wr, - ), - Pi = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, 0 === (t = Un(t.g)) ? void 0 : t), !0); - }, - fi, - wr, - ), - Ci = ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, Nn(t.g)), !0); - }, - function (t, e, n) { - null != (e = ee(e)) && ((e = parseInt(e, 10)), lr(t, n, 0), cr(t.g, e)); - }, - Sr, - ); -class Oi { - constructor(t, e) { - var n = Qi; - ((this.g = t), - (this.h = e), - (this.m = yn), - (this.j = wn), - (this.defaultValue = void 0), - (this.l = null != n.Oa ? dt : void 0)); - } - register() { - m(this); - } -} -function Ni(t, e) { - return new Oi(t, e); -} -function Ui(t, e) { - return (n, r) => { - { - const s = { ea: !0 }; - (r && Object.assign(s, r), (n = Hn(n, void 0, void 0, s))); - try { - const r = new t(), - s = r.v; - zr(e)(s, n); - var i = r; - } finally { - Wn(n); - } - } - return i; - }; -} -function Di(t) { - return function () { - const e = new (class { - constructor() { - ((this.l = []), - (this.h = 0), - (this.g = new (class { - constructor() { - this.g = []; - } - length() { - return this.g.length; - } - end() { - const t = this.g; - return ((this.g = []), t); - } - })())); - } - })(); - (Zr(this.v, e, jr(Cr, qr, $r, t)), ur(e, e.g.end())); - const n = new Uint8Array(e.h), - r = e.l, - i = r.length; - let s = 0; - for (let t = 0; t < i; t++) { - const e = r[t]; - (n.set(e, s), (s += e.length)); - } - return ((e.l = [n]), n); - }; -} -var Bi = class extends Lr { - constructor(t) { - super(t); - } - }, - Gi = [ - 0, - xi, - ei( - function (t, e, n) { - return 2 === t.h && (ri(e, n, (t = $n(t)) === R() ? void 0 : t), !0); - }, - function (t, e, n) { - if (null != e) { - if (e instanceof Lr) { - const r = e.Ra; - return void (r - ? ((e = r(e)), null != e && pr(t, n, Pn(e, !0).buffer)) - : U(K, 3)); - } - if (Array.isArray(e)) return void U(K, 3); - } - li(t, e, n); - }, - kr, - ), - ]; -let ji, - Vi = globalThis.trustedTypes; -function Xi(t) { - var e; - return ( - void 0 === ji && - (ji = (function () { - let t = null; - if (!Vi) return t; - try { - const e = (t) => t; - t = Vi.createPolicy("goog#html", { - createHTML: e, - createScript: e, - createScriptURL: e, - }); - } catch (t) {} - return t; - })()), - (t = (e = ji) ? e.createScriptURL(t) : t), - new (class { - constructor(t) { - this.g = t; - } - toString() { - return this.g + ""; - } - })(t) - ); -} -function Hi(t, ...e) { - if (0 === e.length) return Xi(t[0]); - let n = t[0]; - for (let r = 0; r < e.length; r++) n += encodeURIComponent(e[r]) + t[r + 1]; - return Xi(n); -} -var Wi = [0, wi, Ci, bi, -1, Ti, Ci, -1, bi], - zi = class extends Lr { - constructor(t) { - super(t); - } - }, - Ki = [ - 0, - bi, - Li, - bi, - Ci, - -1, - ni( - function (t, e, n) { - return ( - (0 === t.h || 2 === t.h) && - ((e = un(e, 0 | e[Q], n)), - 2 == t.h ? Jn(t, Bn, e) : e.push(Nn(t.g)), - !0) - ); - }, - function (t, e, n) { - if (null != (e = ti(ee, e)) && e.length) { - n = fr(t, n); - for (let n = 0; n < e.length; n++) cr(t.g, e[n]); - dr(t, n); - } - }, - Sr, - ), - Li, - -1, - [0, bi, -1], - Ci, - bi, - -1, - ], - Yi = [ - 0, - 3, - bi, - -1, - 2, - [ - 0, - [2], - wi, - Ii, - [ - 0, - ei( - function (t, e, n) { - return 0 === t.h && (ri(e, n, Un(t.g)), !0); - }, - fi, - wr, - ), - ], - ], - [0, Ci, bi, Ci, bi, Ci, bi, Li, -1], - [0, [3, 4], Li, -1, Ii, [0, wi], Ii, [0, Ci]], - [0], - ], - qi = [0, Li, -2], - $i = class extends Lr { - constructor(t) { - super(t); - } - }, - Ji = [0], - Zi = [0, wi, bi, 1, bi, -4], - Qi = class extends Lr { - constructor(t) { - super(t, 2); - } - }, - ts = {}; -ts[336783863] = [ - 0, - Li, - bi, - -1, - wi, - [ - 0, - [1, 2, 3, 4, 5, 6, 7, 8, 9], - Ii, - Ji, - Ii, - Ki, - Ii, - qi, - Ii, - Zi, - Ii, - Wi, - Ii, - [0, Li, -2], - Ii, - [0, Li, Ci], - Ii, - Yi, - Ii, - [0, Ci, -1, bi], - ], - [0, Li], - bi, - [0, [1, 3], [2, 4], Ii, [0, Ti], -1, Ii, [0, Si], -1, Ri, [0, Li, -1]], - Li, -]; -var es = [0, vi, -1, ki, -3, vi, Ti, xi, Ai, vi, -1, ki, Ai, ki, -2, xi]; -function ns(t, e) { - Fn(t, 3, e); -} -function rs(t, e) { - Fn(t, 4, e); -} -var is = class extends Lr { - constructor(t) { - super(t, 500); - } - o(t) { - return wn(this, 0, 7, t); - } - }, - ss = [-1, {}], - os = [0, Li, 1, ss], - as = [0, Li, Si, ss]; -function cs(t, e) { - bn(t, 1, is, e); -} -function hs(t, e) { - Fn(t, 10, e); -} -function us(t, e) { - Fn(t, 15, e); -} -var ls = class extends Lr { - constructor(t) { - super(t, 500); - } - o(t) { - return wn(this, 0, 1001, t); - } - }, - fs = [ - -500, - Ri, - [ - -500, - xi, - -1, - Si, - -3, - [-2, ts, bi], - Ri, - Gi, - Ai, - -1, - os, - as, - Ri, - [0, xi, ki], - xi, - es, - Ai, - Si, - 987, - Si, - ], - 4, - Ri, - [-500, Li, -1, [-1, {}], 998, Li], - Ri, - [-500, Li, Si, -1, [-2, {}, bi], 997, Si, -1], - Ai, - Ri, - [-500, Li, Si, ss, 998, Si], - Si, - Ai, - os, - as, - Ri, - [0, xi, -1, ss], - Si, - -2, - es, - xi, - -1, - ki, - [0, ki, Pi], - 978, - ss, - Ri, - Gi, - ]; -ls.prototype.g = Di(fs); -var ds = Ui(ls, fs), - ps = class extends Lr { - constructor(t) { - super(t); - } - }, - gs = class extends Lr { - constructor(t) { - super(t); - } - g() { - return vn(this, ps, 1); - } - }, - ms = [0, Ri, [0, wi, pi, Li, -1]], - ys = Ui(gs, ms), - _s = class extends Lr { - constructor(t) { - super(t); - } - }, - vs = class extends Lr { - constructor(t) { - super(t); - } - }, - Es = class extends Lr { - constructor(t) { - super(t); - } - l() { - return yn(this, _s, 2); - } - g() { - return vn(this, vs, 5); - } - }, - ws = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [ - 0, - Si, - Ti, - mi, - [ - 0, - Ci, - [0, wi, -3], - [0, pi, -3], - [0, wi, -1, [0, Ri, [0, wi, -2]]], - Ri, - [0, pi, -1, Li, pi], - ], - Li, - -1, - _i, - Ri, - [0, wi, pi], - Si, - _i, - ], - ), - Ts = class extends Lr { - constructor(t) { - super(t); - } - }, - As = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [0, Ri, [0, pi, -4]], - ), - bs = class extends Lr { - constructor(t) { - super(t); - } - }, - ks = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [0, Ri, [0, pi, -4]], - ), - Ss = class extends Lr { - constructor(t) { - super(t); - } - }, - xs = [0, wi, -1, mi, Ci], - Ls = class extends Lr { - constructor(t) { - super(t); - } - }; -Ls.prototype.g = Di([0, pi, -4, _i]); -var Rs = class extends Lr { - constructor(t) { - super(t); - } - }, - Is = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [0, Ri, [0, 1, wi, Li, ms], _i], - ), - Fs = class extends Lr { - constructor(t) { - super(t); - } - }, - Ms = class extends Lr { - constructor(t) { - super(t); - } - na() { - const t = $e(this, 1, void 0, void 0, an); - return null == t ? R() : t; - } - }, - Ps = class extends Lr { - constructor(t) { - super(t); - } - }, - Cs = [1, 2], - Os = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [0, Ri, [0, Cs, Ii, [0, mi], Ii, [0, Fi], wi, Li], _i], - ), - Ns = class extends Lr { - constructor(t) { - super(t); - } - }, - Us = [0, Li, wi, pi, Si, -1], - Ds = class extends Lr { - constructor(t) { - super(t); - } - }, - Bs = [0, bi, -1], - Gs = class extends Lr { - constructor(t) { - super(t); - } - }, - js = [1, 2, 3, 4, 5, 6], - Vs = class extends Lr { - constructor(t) { - super(t); - } - g() { - return null != $e(this, 1, void 0, void 0, an); - } - l() { - return null != le($e(this, 2)); - } - }, - Xs = class extends Lr { - constructor(t) { - super(t); - } - g() { - return Zt($e(this, 2)) ?? !1; - } - }, - Hs = [0, Fi, Li, [0, wi, _i, -1], [0, Ei, _i]], - Ws = [0, Hs, bi, [0, js, Ii, Zi, Ii, Ki, Ii, Wi, Ii, Ji, Ii, qi, Ii, Yi], Ci], - zs = class extends Lr { - constructor(t) { - super(t); - } - }, - Ks = [0, Ws, pi, -1, wi], - Ys = Ni(502141897, zs); -ts[502141897] = Ks; -var qs = Ui( - class extends Lr { - constructor(t) { - super(t); - } - }, - [0, [0, Ci, -1, gi, Mi], xs], - ), - $s = class extends Lr { - constructor(t) { - super(t); - } - }, - Js = class extends Lr { - constructor(t) { - super(t); - } - }, - Zs = [0, Ws, pi, [0, Ws], bi], - Qs = Ni(508968150, Js); -((ts[508968150] = [0, Ws, Ks, Zs, pi, [0, [0, Hs]]]), (ts[508968149] = Zs)); -var to = class extends Lr { - constructor(t) { - super(t); - } - l() { - return yn(this, Ns, 2); - } - g() { - Ze(this, 2); - } - }, - eo = [0, Ws, Us]; -ts[478825465] = eo; -var no = class extends Lr { - constructor(t) { - super(t); - } - }, - ro = class extends Lr { - constructor(t) { - super(t); - } - }, - io = class extends Lr { - constructor(t) { - super(t); - } - }, - so = class extends Lr { - constructor(t) { - super(t); - } - }, - oo = class extends Lr { - constructor(t) { - super(t); - } - }, - ao = [0, Ws, [0, Ws], eo, -1], - co = [0, Ws, pi, wi], - ho = [0, Ws, pi], - uo = [0, Ws, co, ho, pi], - lo = Ni(479097054, oo); -((ts[479097054] = [0, Ws, uo, ao]), (ts[463370452] = ao), (ts[464864288] = co)); -var fo = Ni(462713202, so); -((ts[462713202] = uo), (ts[474472470] = ho)); -var po = class extends Lr { - constructor(t) { - super(t); - } - }, - go = class extends Lr { - constructor(t) { - super(t); - } - }, - mo = class extends Lr { - constructor(t) { - super(t); - } - }, - yo = class extends Lr { - constructor(t) { - super(t); - } - }, - _o = [0, Ws, pi, -1, wi], - vo = [0, Ws, pi, bi]; -yo.prototype.g = Di([0, Ws, ho, [0, Ws], Ks, Zs, _o, vo]); -var Eo = class extends Lr { - constructor(t) { - super(t); - } - }, - wo = Ni(456383383, Eo); -ts[456383383] = [0, Ws, Us]; -var To = class extends Lr { - constructor(t) { - super(t); - } - }, - Ao = Ni(476348187, To); -ts[476348187] = [0, Ws, Bs]; -var bo = class extends Lr { - constructor(t) { - super(t); - } - }, - ko = class extends Lr { - constructor(t) { - super(t); - } - }, - So = [0, Ci, -1], - xo = Ni( - 458105876, - class extends Lr { - constructor(t) { - super(t); - } - g() { - let t; - var e = this.v; - const n = 0 | e[Q]; - return ( - (t = at(this, n)), - (e = (function (t, e, n, r) { - var i = ko; - !r && He(t) && (n = 0 | (e = t.v)[Q]); - var s = Je(e, 2); - if (((t = !1), null == s)) { - if (r) return be(); - s = []; - } else if (s.constructor === Ee) { - if (!(2 & s.J) || r) return s; - s = s.V(); - } else Array.isArray(s) ? (t = !!(2 & (0 | s[Q]))) : (s = []); - if (r) { - if (!s.length) return be(); - t || ((t = !0), it(s)); - } else t && ((t = !1), st(s), (s = cn(s))); - return ( - !t && 32 & n && nt(s, 32), - (n = Qe(e, n, 2, (r = new Ee(s, i, de, void 0)))), - t || ze(e, n), - r - ); - })(this, e, n, t)), - !t && ko && (e.ra = !0), - e - ); - } - }, - ); -ts[458105876] = [0, So, ii, [!0, _i, [0, Li, -1, Si]], [0, Ti, bi, Ci]]; -var Lo = class extends Lr { - constructor(t) { - super(t); - } - }, - Ro = Ni(458105758, Lo); -ts[458105758] = [0, Ws, Li, So]; -var Io = class extends Lr { - constructor(t) { - super(t); - } - }, - Fo = [0, yi, -1, ki], - Mo = class extends Lr { - constructor(t) { - super(t); - } - }, - Po = class extends Lr { - constructor(t) { - super(t); - } - }, - Co = [1, 2]; -Po.prototype.g = Di([0, Co, Ii, Fo, Ii, [0, Ri, Fo]]); -var Oo = class extends Lr { - constructor(t) { - super(t); - } - }, - No = Ni(443442058, Oo); -((ts[443442058] = [0, Ws, Li, wi, pi, Si, -1, bi, pi]), (ts[514774813] = _o)); -var Uo = class extends Lr { - constructor(t) { - super(t); - } - }, - Do = Ni(516587230, Uo); -function Bo(t, e) { - return ( - (e = e ? e.clone() : new Ns()), - void 0 !== t.displayNamesLocale - ? Ze(e, 1, ue(t.displayNamesLocale)) - : void 0 === t.displayNamesLocale && Ze(e, 1), - void 0 !== t.maxResults - ? xn(e, 2, t.maxResults) - : "maxResults" in t && Ze(e, 2), - void 0 !== t.scoreThreshold - ? Ln(e, 3, t.scoreThreshold) - : "scoreThreshold" in t && Ze(e, 3), - void 0 !== t.categoryAllowlist - ? In(e, 4, t.categoryAllowlist) - : "categoryAllowlist" in t && Ze(e, 4), - void 0 !== t.categoryDenylist - ? In(e, 5, t.categoryDenylist) - : "categoryDenylist" in t && Ze(e, 5), - e - ); -} -function Go(t) { - const e = Number(t); - return Number.isSafeInteger(e) ? e : String(t); -} -function jo(t, e = -1, n = "") { - return { - categories: t.map((t) => ({ - index: kn(t, 1) ?? 0 ?? -1, - score: Sn(t, 2) ?? 0, - categoryName: le($e(t, 3)) ?? "" ?? "", - displayName: le($e(t, 4)) ?? "" ?? "", - })), - headIndex: e, - headName: n, - }; -} -function Vo(t) { - const e = { - classifications: vn(t, Rs, 1).map((t) => - jo(yn(t, gs, 4)?.g() ?? [], kn(t, 2) ?? 0, le($e(t, 3)) ?? ""), - ), - }; - return ( - null != - (function (t) { - return null == t - ? t - : "bigint" == typeof t - ? (wt(t) - ? (t = Number(t)) - : ((t = Xt(64, t)), (t = wt(t) ? Number(t) : String(t))), - t) - : te(t) - ? "number" == typeof t - ? ie(t) - : se(t) - : void 0; - })($e(t, 2, void 0, void 0, ce)) && - (e.timestampMs = Go($e(t, 2, void 0, void 0, ce) ?? Ye)), - e - ); -} -function Xo(t) { - var e = en(t, 3, $t, tn()), - n = en(t, 2, ee, tn()), - r = en(t, 1, le, tn()), - i = en(t, 9, le, tn()); - const s = { categories: [], keypoints: [] }; - for (let t = 0; t < e.length; t++) - s.categories.push({ - score: e[t], - index: n[t] ?? -1, - categoryName: r[t] ?? "", - displayName: i[t] ?? "", - }); - if ( - ((e = yn(t, Es, 4)?.l()) && - (s.boundingBox = { - originX: kn(e, 1, qe) ?? 0, - originY: kn(e, 2, qe) ?? 0, - width: kn(e, 3, qe) ?? 0, - height: kn(e, 4, qe) ?? 0, - angle: 0, - }), - yn(t, Es, 4)?.g().length) - ) - for (const e of yn(t, Es, 4).g()) - s.keypoints.push({ - x: $e(e, 1, void 0, qe, $t) ?? 0, - y: $e(e, 2, void 0, qe, $t) ?? 0, - score: $e(e, 4, void 0, qe, $t) ?? 0, - label: le($e(e, 3, void 0, qe)) ?? "", - }); - return s; -} -function Ho(t) { - const e = []; - for (const n of vn(t, bs, 1)) - e.push({ - x: Sn(n, 1) ?? 0, - y: Sn(n, 2) ?? 0, - z: Sn(n, 3) ?? 0, - visibility: Sn(n, 4) ?? 0, - }); - return e; -} -function Wo(t) { - const e = []; - for (const n of vn(t, Ts, 1)) - e.push({ - x: Sn(n, 1) ?? 0, - y: Sn(n, 2) ?? 0, - z: Sn(n, 3) ?? 0, - visibility: Sn(n, 4) ?? 0, - }); - return e; -} -function zo(t) { - return Array.from(t, (t) => (t > 127 ? t - 256 : t)); -} -function Ko(t, e) { - if (t.length !== e.length) - throw Error( - `Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`, - ); - let n = 0, - r = 0, - i = 0; - for (let s = 0; s < t.length; s++) - ((n += t[s] * e[s]), (r += t[s] * t[s]), (i += e[s] * e[s])); - if (r <= 0 || i <= 0) - throw Error("Cannot compute cosine similarity on embedding with 0 norm."); - return n / Math.sqrt(r * i); -} -let Yo; -((ts[516587230] = [0, Ws, _o, vo, pi]), (ts[518928384] = vo)); -const qo = new Uint8Array([ - 0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, - 0, 65, 0, 253, 15, 253, 98, 11, -]); -async function $o(t) { - if (t) return !0; - if (void 0 === Yo) - try { - (await WebAssembly.instantiate(qo), (Yo = !0)); - } catch { - Yo = !1; - } - return Yo; -} -async function Jo(t, e, n) { - return { - wasmLoaderPath: `${e}/${t}_${(n = `wasm${n ? "_module" : ""}${(await $o(n)) ? "" : "_nosimd"}_internal`)}.js`, - wasmBinaryPath: `${e}/${t}_${n}.wasm`, - }; -} -var Zo = class {}; -function Qo() { - var t = navigator; - return ( - "undefined" != typeof OffscreenCanvas && - (!(function (t = navigator) { - return (t = t.userAgent).includes("Safari") && !t.includes("Chrome"); - })(t) || - !!( - (t = t.userAgent.match(/Version\/([\d]+).*Safari/)) && - t.length >= 1 && - Number(t[1]) >= 17 - )) - ); -} -async function ta(t) { - if ("function" != typeof importScripts) { - const e = document.createElement("script"); - return ( - (e.src = t.toString()), - (e.crossOrigin = "anonymous"), - new Promise((t, n) => { - (e.addEventListener( - "load", - () => { - t(); - }, - !1, - ), - e.addEventListener( - "error", - (t) => { - n(t); - }, - !1, - ), - document.body.appendChild(e)); - }) - ); - } - try { - importScripts(t.toString()); - } catch (e) { - if (!(e instanceof TypeError)) throw e; - { - const e = self.import; - e ? await e(t.toString()) : await import(t.toString()); - } - } -} -function ea(t) { - return void 0 !== t.videoWidth - ? [t.videoWidth, t.videoHeight] - : void 0 !== t.naturalWidth - ? [t.naturalWidth, t.naturalHeight] - : void 0 !== t.displayWidth - ? [t.displayWidth, t.displayHeight] - : [t.width, t.height]; -} -function na(t, e, n) { - (t.m || - console.error( - "No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target", - ), - n((e = t.i.stringToNewUTF8(e))), - t.i._free(e)); -} -function ra(t, e, n) { - if (!t.i.canvas) throw Error("No OpenGL canvas configured."); - if ( - (n ? t.i._bindTextureToStream(n) : t.i._bindTextureToCanvas(), - !(n = t.i.canvas.getContext("webgl2") || t.i.canvas.getContext("webgl"))) - ) - throw Error( - "Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.", - ); - (t.i.gpuOriginForWebTexturesIsBottomLeft && - n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !0), - n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, e), - t.i.gpuOriginForWebTexturesIsBottomLeft && - n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !1)); - const [r, i] = ea(e); - return ( - !t.l || - (r === t.i.canvas.width && i === t.i.canvas.height) || - ((t.i.canvas.width = r), (t.i.canvas.height = i)), - [r, i] - ); -} -function ia(t, e, n) { - t.m || - console.error( - "No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target", - ); - const r = new Uint32Array(e.length); - for (let n = 0; n < e.length; n++) r[n] = t.i.stringToNewUTF8(e[n]); - ((e = t.i._malloc(4 * r.length)), t.i.HEAPU32.set(r, e >> 2), n(e)); - for (const e of r) t.i._free(e); - t.i._free(e); -} -function sa(t, e, n) { - ((t.i.simpleListeners = t.i.simpleListeners || {}), - (t.i.simpleListeners[e] = n)); -} -function oa(t, e, n) { - let r = []; - ((t.i.simpleListeners = t.i.simpleListeners || {}), - (t.i.simpleListeners[e] = (t, e, i) => { - e ? (n(r, i), (r = [])) : r.push(t); - })); -} -((Zo.forVisionTasks = function (t, e = !1) { - return Jo("vision", t ?? Hi``, e); -}), - (Zo.forTextTasks = function (t, e = !1) { - return Jo("text", t ?? Hi``, e); - }), - (Zo.forGenAiTasks = function (t, e = !1) { - return Jo("genai", t ?? Hi``, e); - }), - (Zo.forAudioTasks = function (t, e = !1) { - return Jo("audio", t ?? Hi``, e); - }), - (Zo.isSimdSupported = function (t = !1) { - return $o(t); - })); -async function aa(t, e, n, r) { - return ( - (t = await (async (t, e, n, r, i) => { - if ((e && (await ta(e)), !self.ModuleFactory)) - throw Error("ModuleFactory not set."); - if (n && (await ta(n), !self.ModuleFactory)) - throw Error("ModuleFactory not set."); - return ( - self.Module && - i && - (((e = self.Module).locateFile = i.locateFile), - i.mainScriptUrlOrBlob && - (e.mainScriptUrlOrBlob = i.mainScriptUrlOrBlob)), - (i = await self.ModuleFactory(self.Module || i)), - (self.ModuleFactory = self.Module = void 0), - new t(i, r) - ); - })(t, n.wasmLoaderPath, n.assetLoaderPath, e, { - locateFile: (t) => - t.endsWith(".wasm") - ? n.wasmBinaryPath.toString() - : n.assetBinaryPath && t.endsWith(".data") - ? n.assetBinaryPath.toString() - : t, - })), - await t.o(r), - t - ); -} -function ca(t, e) { - const n = yn(t.baseOptions, Vs, 1) || new Vs(); - ("string" == typeof e - ? (Ze(n, 2, ue(e)), Ze(n, 1)) - : e instanceof Uint8Array && (Ze(n, 1, ht(e, !1)), Ze(n, 2)), - wn(t.baseOptions, 0, 1, n)); -} -function ha(t) { - try { - const e = t.H.length; - if (1 === e) throw Error(t.H[0].message); - if (e > 1) - throw Error( - "Encountered multiple errors: " + t.H.map((t) => t.message).join(", "), - ); - } finally { - t.H = []; - } -} -function ua(t, e) { - t.C = Math.max(t.C, e); -} -function la(t, e) { - ((t.B = new is()), - Rn(t.B, 2, "PassThroughCalculator"), - ns(t.B, "free_memory"), - rs(t.B, "free_memory_unused_out"), - hs(e, "free_memory"), - cs(e, t.B)); -} -function fa(t, e) { - (ns(t.B, e), rs(t.B, e + "_unused_out")); -} -function da(t) { - t.g.addBoolToStream(!0, "free_memory", t.C); -} -var pa = class { - constructor(t) { - ((this.g = t), - (this.H = []), - (this.C = 0), - this.g.setAutoRenderToScreen(!1)); - } - l(t, e = !0) { - if (e) { - const e = t.baseOptions || {}; - if (t.baseOptions?.modelAssetBuffer && t.baseOptions?.modelAssetPath) - throw Error( - "Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer", - ); - if ( - !( - yn(this.baseOptions, Vs, 1)?.g() || - yn(this.baseOptions, Vs, 1)?.l() || - t.baseOptions?.modelAssetBuffer || - t.baseOptions?.modelAssetPath - ) - ) - throw Error( - "Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set", - ); - if ( - ((function (t, e) { - let n = yn(t.baseOptions, Gs, 3); - if (!n) { - var r = (n = new Gs()), - i = new $i(); - Tn(r, 4, js, i); - } - ("delegate" in e && - ("GPU" === e.delegate - ? ((e = n), (r = new zi()), Tn(e, 2, js, r)) - : ((e = n), (r = new $i()), Tn(e, 4, js, r))), - wn(t.baseOptions, 0, 3, n)); - })(this, e), - e.modelAssetPath) - ) - return fetch(e.modelAssetPath.toString()) - .then((t) => { - if (t.ok) return t.arrayBuffer(); - throw Error( - `Failed to fetch model: ${e.modelAssetPath} (${t.status})`, - ); - }) - .then((t) => { - try { - this.g.i.FS_unlink("/model.dat"); - } catch {} - (this.g.i.FS_createDataFile( - "/", - "model.dat", - new Uint8Array(t), - !0, - !1, - !1, - ), - ca(this, "/model.dat"), - this.m(), - this.L()); - }); - if (e.modelAssetBuffer instanceof Uint8Array) - ca(this, e.modelAssetBuffer); - else if (e.modelAssetBuffer) - return (async function (t) { - const e = []; - for (var n = 0; ; ) { - const { done: r, value: i } = await t.read(); - if (r) break; - (e.push(i), (n += i.length)); - } - if (0 === e.length) return new Uint8Array(0); - if (1 === e.length) return e[0]; - ((t = new Uint8Array(n)), (n = 0)); - for (const r of e) (t.set(r, n), (n += r.length)); - return t; - })(e.modelAssetBuffer).then((t) => { - (ca(this, t), this.m(), this.L()); - }); - } - return (this.m(), this.L(), Promise.resolve()); - } - L() {} - ca() { - let t; - if ( - (this.g.ca((e) => { - t = ds(e); - }), - !t) - ) - throw Error("Failed to retrieve CalculatorGraphConfig"); - return t; - } - setGraph(t, e) { - (this.g.attachErrorListener((t, e) => { - this.H.push(Error(e)); - }), - this.g.Ja(), - this.g.setGraph(t, e), - (this.B = void 0), - ha(this)); - } - finishProcessing() { - (this.g.finishProcessing(), ha(this)); - } - close() { - ((this.B = void 0), this.g.closeGraph()); - } -}; -function ga(t, e) { - if (!t) throw Error(`Unable to obtain required WebGL resource: ${e}`); - return t; -} -pa.prototype.close = pa.prototype.close; -class ma { - constructor(t, e, n, r) { - ((this.g = t), (this.h = e), (this.m = n), (this.l = r)); - } - bind() { - this.g.bindVertexArray(this.h); - } - close() { - (this.g.deleteVertexArray(this.h), - this.g.deleteBuffer(this.m), - this.g.deleteBuffer(this.l)); - } -} -function ya(t, e, n) { - const r = t.g; - if ( - ((n = ga(r.createShader(n), "Failed to create WebGL shader")), - r.shaderSource(n, e), - r.compileShader(n), - !r.getShaderParameter(n, r.COMPILE_STATUS)) - ) - throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`); - return (r.attachShader(t.h, n), n); -} -function _a(t, e) { - const n = t.g, - r = ga(n.createVertexArray(), "Failed to create vertex array"); - n.bindVertexArray(r); - const i = ga(n.createBuffer(), "Failed to create buffer"); - (n.bindBuffer(n.ARRAY_BUFFER, i), - n.enableVertexAttribArray(t.O), - n.vertexAttribPointer(t.O, 2, n.FLOAT, !1, 0, 0), - n.bufferData( - n.ARRAY_BUFFER, - new Float32Array([-1, -1, -1, 1, 1, 1, 1, -1]), - n.STATIC_DRAW, - )); - const s = ga(n.createBuffer(), "Failed to create buffer"); - return ( - n.bindBuffer(n.ARRAY_BUFFER, s), - n.enableVertexAttribArray(t.L), - n.vertexAttribPointer(t.L, 2, n.FLOAT, !1, 0, 0), - n.bufferData( - n.ARRAY_BUFFER, - new Float32Array(e ? [0, 1, 0, 0, 1, 0, 1, 1] : [0, 0, 0, 1, 1, 1, 1, 0]), - n.STATIC_DRAW, - ), - n.bindBuffer(n.ARRAY_BUFFER, null), - n.bindVertexArray(null), - new ma(n, r, i, s) - ); -} -function va(t, e) { - if (t.g) { - if (e !== t.g) throw Error("Cannot change GL context once initialized"); - } else t.g = e; -} -function Ea(t, e, n, r) { - return ( - va(t, e), - t.h || (t.m(), t.D()), - n - ? (t.u || (t.u = _a(t, !0)), (n = t.u)) - : (t.A || (t.A = _a(t, !1)), (n = t.A)), - e.useProgram(t.h), - n.bind(), - t.l(), - (t = r()), - n.g.bindVertexArray(null), - t - ); -} -function wa(t, e, n) { - return ( - va(t, e), - (t = ga(e.createTexture(), "Failed to create texture")), - e.bindTexture(e.TEXTURE_2D, t), - e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), - e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), - e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, n ?? e.LINEAR), - e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, n ?? e.LINEAR), - e.bindTexture(e.TEXTURE_2D, null), - t - ); -} -function Ta(t, e, n) { - (va(t, e), - t.B || (t.B = ga(e.createFramebuffer(), "Failed to create framebuffe.")), - e.bindFramebuffer(e.FRAMEBUFFER, t.B), - e.framebufferTexture2D( - e.FRAMEBUFFER, - e.COLOR_ATTACHMENT0, - e.TEXTURE_2D, - n, - 0, - )); -} -function Aa(t) { - t.g?.bindFramebuffer(t.g.FRAMEBUFFER, null); -} -var ba = class { - H() { - return "\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n "; - } - m() { - const t = this.g; - if ( - ((this.h = ga(t.createProgram(), "Failed to create WebGL program")), - (this.X = ya( - this, - "\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }", - t.VERTEX_SHADER, - )), - (this.W = ya(this, this.H(), t.FRAGMENT_SHADER)), - t.linkProgram(this.h), - !t.getProgramParameter(this.h, t.LINK_STATUS)) - ) - throw Error( - `Error during program linking: ${t.getProgramInfoLog(this.h)}`, - ); - ((this.O = t.getAttribLocation(this.h, "aVertex")), - (this.L = t.getAttribLocation(this.h, "aTex"))); - } - D() {} - l() {} - close() { - if (this.h) { - const t = this.g; - (t.deleteProgram(this.h), t.deleteShader(this.X), t.deleteShader(this.W)); - } - (this.B && this.g.deleteFramebuffer(this.B), - this.A && this.A.close(), - this.u && this.u.close()); - } -}; -var ka = class extends ba { - H() { - return "\n precision mediump float;\n uniform sampler2D backgroundTexture;\n uniform sampler2D maskTexture;\n uniform sampler2D colorMappingTexture;\n varying vec2 vTex;\n void main() {\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\n float category = texture2D(maskTexture, vTex).r;\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\n }\n "; - } - D() { - const t = this.g; - (t.activeTexture(t.TEXTURE1), - (this.C = wa(this, t, t.LINEAR)), - t.activeTexture(t.TEXTURE2), - (this.j = wa(this, t, t.NEAREST))); - } - m() { - super.m(); - const t = this.g; - ((this.P = ga( - t.getUniformLocation(this.h, "backgroundTexture"), - "Uniform location", - )), - (this.U = ga( - t.getUniformLocation(this.h, "colorMappingTexture"), - "Uniform location", - )), - (this.M = ga( - t.getUniformLocation(this.h, "maskTexture"), - "Uniform location", - ))); - } - l() { - super.l(); - const t = this.g; - (t.uniform1i(this.M, 0), t.uniform1i(this.P, 1), t.uniform1i(this.U, 2)); - } - close() { - (this.C && this.g.deleteTexture(this.C), - this.j && this.g.deleteTexture(this.j), - super.close()); - } - }, - Sa = class extends ba { - H() { - return "\n precision mediump float;\n uniform sampler2D maskTexture;\n uniform sampler2D defaultTexture;\n uniform sampler2D overlayTexture;\n varying vec2 vTex;\n void main() {\n float confidence = texture2D(maskTexture, vTex).r;\n vec4 defaultColor = texture2D(defaultTexture, vTex);\n vec4 overlayColor = texture2D(overlayTexture, vTex);\n // Apply the alpha from the overlay and merge in the default color\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\n }\n "; - } - D() { - const t = this.g; - (t.activeTexture(t.TEXTURE1), - (this.j = wa(this, t)), - t.activeTexture(t.TEXTURE2), - (this.C = wa(this, t))); - } - m() { - super.m(); - const t = this.g; - ((this.M = ga( - t.getUniformLocation(this.h, "defaultTexture"), - "Uniform location", - )), - (this.P = ga( - t.getUniformLocation(this.h, "overlayTexture"), - "Uniform location", - )), - (this.I = ga( - t.getUniformLocation(this.h, "maskTexture"), - "Uniform location", - ))); - } - l() { - super.l(); - const t = this.g; - (t.uniform1i(this.I, 0), t.uniform1i(this.M, 1), t.uniform1i(this.P, 2)); - } - close() { - (this.j && this.g.deleteTexture(this.j), - this.C && this.g.deleteTexture(this.C), - super.close()); - } - }; -function xa(t, e) { - switch (e) { - case 0: - return t.g.find((t) => t instanceof Uint8Array); - case 1: - return t.g.find((t) => t instanceof Float32Array); - case 2: - return t.g.find( - (t) => "undefined" != typeof WebGLTexture && t instanceof WebGLTexture, - ); - default: - throw Error(`Type is not supported: ${e}`); - } -} -function La(t) { - var e = xa(t, 1); - if (!e) { - if ((e = xa(t, 0))) e = new Float32Array(e).map((t) => t / 255); - else { - e = new Float32Array(t.width * t.height); - const r = Ia(t); - var n = Ma(t); - if ( - (Ta(n, r, Ra(t)), - "iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod" - .split(";") - .includes(navigator.platform) || - (navigator.userAgent.includes("Mac") && - "document" in self && - "ontouchend" in self.document)) - ) { - ((n = new Float32Array(t.width * t.height * 4)), - r.readPixels(0, 0, t.width, t.height, r.RGBA, r.FLOAT, n)); - for (let t = 0, r = 0; t < e.length; ++t, r += 4) e[t] = n[r]; - } else r.readPixels(0, 0, t.width, t.height, r.RED, r.FLOAT, e); - } - t.g.push(e); - } - return e; -} -function Ra(t) { - let e = xa(t, 2); - if (!e) { - const n = Ia(t); - e = Pa(t); - const r = La(t), - i = Fa(t); - (n.texImage2D(n.TEXTURE_2D, 0, i, t.width, t.height, 0, n.RED, n.FLOAT, r), - Ca(t)); - } - return e; -} -function Ia(t) { - if (!t.canvas) - throw Error( - "Conversion to different image formats require that a canvas is passed when initializing the image.", - ); - return ( - t.h || - (t.h = ga( - t.canvas.getContext("webgl2"), - "You cannot use a canvas that is already bound to a different type of rendering context.", - )), - t.h - ); -} -function Fa(t) { - if (((t = Ia(t)), !Oa)) - if ( - t.getExtension("EXT_color_buffer_float") && - t.getExtension("OES_texture_float_linear") && - t.getExtension("EXT_float_blend") - ) - Oa = t.R32F; - else { - if (!t.getExtension("EXT_color_buffer_half_float")) - throw Error( - "GPU does not fully support 4-channel float32 or float16 formats", - ); - Oa = t.R16F; - } - return Oa; -} -function Ma(t) { - return (t.l || (t.l = new ba()), t.l); -} -function Pa(t) { - const e = Ia(t); - (e.viewport(0, 0, t.width, t.height), e.activeTexture(e.TEXTURE0)); - let n = xa(t, 2); - return ( - n || - ((n = wa(Ma(t), e, t.m ? e.LINEAR : e.NEAREST)), t.g.push(n), (t.j = !0)), - e.bindTexture(e.TEXTURE_2D, n), - n - ); -} -function Ca(t) { - t.h.bindTexture(t.h.TEXTURE_2D, null); -} -var Oa, - Na = class { - constructor(t, e, n, r, i, s, o) { - ((this.g = t), - (this.m = e), - (this.j = n), - (this.canvas = r), - (this.l = i), - (this.width = s), - (this.height = o), - this.j && - 0 === --Ua && - console.error( - "You seem to be creating MPMask instances without invoking .close(). This leaks resources.", - )); - } - Fa() { - return !!xa(this, 0); - } - ka() { - return !!xa(this, 1); - } - R() { - return !!xa(this, 2); - } - ja() { - return ( - (e = xa((t = this), 0)) || - ((e = La(t)), - (e = new Uint8Array(e.map((t) => Math.round(255 * t)))), - t.g.push(e)), - e - ); - var t, e; - } - ia() { - return La(this); - } - N() { - return Ra(this); - } - clone() { - const t = []; - for (const e of this.g) { - let n; - if (e instanceof Uint8Array) n = new Uint8Array(e); - else if (e instanceof Float32Array) n = new Float32Array(e); - else { - if (!(e instanceof WebGLTexture)) - throw Error(`Type is not supported: ${e}`); - { - const t = Ia(this), - e = Ma(this); - (t.activeTexture(t.TEXTURE1), - (n = wa(e, t, this.m ? t.LINEAR : t.NEAREST)), - t.bindTexture(t.TEXTURE_2D, n)); - const r = Fa(this); - (t.texImage2D( - t.TEXTURE_2D, - 0, - r, - this.width, - this.height, - 0, - t.RED, - t.FLOAT, - null, - ), - t.bindTexture(t.TEXTURE_2D, null), - Ta(e, t, n), - Ea(e, t, !1, () => { - (Pa(this), - t.clearColor(0, 0, 0, 0), - t.clear(t.COLOR_BUFFER_BIT), - t.drawArrays(t.TRIANGLE_FAN, 0, 4), - Ca(this)); - }), - Aa(e), - Ca(this)); - } - } - t.push(n); - } - return new Na( - t, - this.m, - this.R(), - this.canvas, - this.l, - this.width, - this.height, - ); - } - close() { - (this.j && Ia(this).deleteTexture(xa(this, 2)), (Ua = -1)); - } - }; -((Na.prototype.close = Na.prototype.close), - (Na.prototype.clone = Na.prototype.clone), - (Na.prototype.getAsWebGLTexture = Na.prototype.N), - (Na.prototype.getAsFloat32Array = Na.prototype.ia), - (Na.prototype.getAsUint8Array = Na.prototype.ja), - (Na.prototype.hasWebGLTexture = Na.prototype.R), - (Na.prototype.hasFloat32Array = Na.prototype.ka), - (Na.prototype.hasUint8Array = Na.prototype.Fa)); -var Ua = 250; -const Da = { color: "white", lineWidth: 4, radius: 6 }; -function Ba(t) { - return { ...Da, fillColor: (t = t || {}).color, ...t }; -} -function Ga(t, e) { - return t instanceof Function ? t(e) : t; -} -function ja(t, e, n) { - return Math.max(Math.min(e, n), Math.min(Math.max(e, n), t)); -} -function Va(t) { - if (!t.l) - throw Error( - "CPU rendering requested but CanvasRenderingContext2D not provided.", - ); - return t.l; -} -function Xa(t) { - if (!t.j) - throw Error( - "GPU rendering requested but WebGL2RenderingContext not provided.", - ); - return t.j; -} -function Ha(t, e, n) { - if (e.R()) n(e.N()); - else { - const r = e.ka() ? e.ia() : e.ja(); - t.m = t.m ?? new ba(); - const i = Xa(t); - (n((t = new Na([r], e.m, !1, i.canvas, t.m, e.width, e.height)).N()), - t.close()); - } -} -function Wa(t, e, n, r) { - const i = (function (t) { - return (t.g || (t.g = new ka()), t.g); - })(t), - s = Xa(t), - o = Array.isArray(n) ? new ImageData(new Uint8ClampedArray(n), 1, 1) : n; - Ea(i, s, !0, () => { - (!(function (t, e, n, r) { - const i = t.g; - if ( - (i.activeTexture(i.TEXTURE0), - i.bindTexture(i.TEXTURE_2D, e), - i.activeTexture(i.TEXTURE1), - i.bindTexture(i.TEXTURE_2D, t.C), - i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, n), - t.I && - (function (t, e) { - if (t !== e) return !1; - ((t = t.entries()), (e = e.entries())); - for (const [n, r] of t) { - t = n; - const i = r, - s = e.next(); - if (s.done) return !1; - const [o, a] = s.value; - if ( - t !== o || - i[0] !== a[0] || - i[1] !== a[1] || - i[2] !== a[2] || - i[3] !== a[3] - ) - return !1; - } - return !!e.next().done; - })(t.I, r)) - ) - (i.activeTexture(i.TEXTURE2), i.bindTexture(i.TEXTURE_2D, t.j)); - else { - t.I = r; - const e = Array(1024).fill(0); - (r.forEach((t, n) => { - if (4 !== t.length) - throw Error(`Color at index ${n} is not a four-channel value.`); - ((e[4 * n] = t[0]), - (e[4 * n + 1] = t[1]), - (e[4 * n + 2] = t[2]), - (e[4 * n + 3] = t[3])); - }), - i.activeTexture(i.TEXTURE2), - i.bindTexture(i.TEXTURE_2D, t.j), - i.texImage2D( - i.TEXTURE_2D, - 0, - i.RGBA, - 256, - 1, - 0, - i.RGBA, - i.UNSIGNED_BYTE, - new Uint8Array(e), - )); - } - })(i, e, o, r), - s.clearColor(0, 0, 0, 0), - s.clear(s.COLOR_BUFFER_BIT), - s.drawArrays(s.TRIANGLE_FAN, 0, 4)); - const t = i.g; - (t.activeTexture(t.TEXTURE0), - t.bindTexture(t.TEXTURE_2D, null), - t.activeTexture(t.TEXTURE1), - t.bindTexture(t.TEXTURE_2D, null), - t.activeTexture(t.TEXTURE2), - t.bindTexture(t.TEXTURE_2D, null)); - }); -} -function za(t, e, n, r) { - const i = Xa(t), - s = (function (t) { - return (t.h || (t.h = new Sa()), t.h); - })(t), - o = Array.isArray(n) ? new ImageData(new Uint8ClampedArray(n), 1, 1) : n, - a = Array.isArray(r) ? new ImageData(new Uint8ClampedArray(r), 1, 1) : r; - Ea(s, i, !0, () => { - var t = s.g; - (t.activeTexture(t.TEXTURE0), - t.bindTexture(t.TEXTURE_2D, e), - t.activeTexture(t.TEXTURE1), - t.bindTexture(t.TEXTURE_2D, s.j), - t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, o), - t.activeTexture(t.TEXTURE2), - t.bindTexture(t.TEXTURE_2D, s.C), - t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, a), - i.clearColor(0, 0, 0, 0), - i.clear(i.COLOR_BUFFER_BIT), - i.drawArrays(i.TRIANGLE_FAN, 0, 4), - i.bindTexture(i.TEXTURE_2D, null), - (t = s.g).activeTexture(t.TEXTURE0), - t.bindTexture(t.TEXTURE_2D, null), - t.activeTexture(t.TEXTURE1), - t.bindTexture(t.TEXTURE_2D, null), - t.activeTexture(t.TEXTURE2), - t.bindTexture(t.TEXTURE_2D, null)); - }); -} -var Ka = class { - constructor(t, e) { - ("undefined" != typeof CanvasRenderingContext2D && - t instanceof CanvasRenderingContext2D) || - t instanceof OffscreenCanvasRenderingContext2D - ? ((this.l = t), (this.j = e)) - : (this.j = t); - } - ya(t, e) { - if (t) { - var n = Va(this); - ((e = Ba(e)), n.save()); - var r = n.canvas, - i = 0; - for (const s of t) - ((n.fillStyle = Ga(e.fillColor, { index: i, from: s })), - (n.strokeStyle = Ga(e.color, { index: i, from: s })), - (n.lineWidth = Ga(e.lineWidth, { index: i, from: s })), - (t = new Path2D()).arc( - s.x * r.width, - s.y * r.height, - Ga(e.radius, { index: i, from: s }), - 0, - 2 * Math.PI, - ), - n.fill(t), - n.stroke(t), - ++i); - n.restore(); - } - } - xa(t, e, n) { - if (t && e) { - var r = Va(this); - ((n = Ba(n)), r.save()); - var i = r.canvas, - s = 0; - for (const o of e) { - (r.beginPath(), (e = t[o.start])); - const a = t[o.end]; - (e && - a && - ((r.strokeStyle = Ga(n.color, { index: s, from: e, to: a })), - (r.lineWidth = Ga(n.lineWidth, { index: s, from: e, to: a })), - r.moveTo(e.x * i.width, e.y * i.height), - r.lineTo(a.x * i.width, a.y * i.height)), - ++s, - r.stroke()); - } - r.restore(); - } - } - ua(t, e) { - const n = Va(this); - ((e = Ba(e)), - n.save(), - n.beginPath(), - (n.lineWidth = Ga(e.lineWidth, {})), - (n.strokeStyle = Ga(e.color, {})), - (n.fillStyle = Ga(e.fillColor, {})), - n.moveTo(t.originX, t.originY), - n.lineTo(t.originX + t.width, t.originY), - n.lineTo(t.originX + t.width, t.originY + t.height), - n.lineTo(t.originX, t.originY + t.height), - n.lineTo(t.originX, t.originY), - n.stroke(), - n.fill(), - n.restore()); - } - va(t, e, n = [0, 0, 0, 255]) { - this.l - ? (function (t, e, n, r) { - const i = Xa(t); - Ha(t, e, (e) => { - (Wa(t, e, n, r), - (e = Va(t)).drawImage( - i.canvas, - 0, - 0, - e.canvas.width, - e.canvas.height, - )); - }); - })(this, t, n, e) - : Wa(this, t.N(), n, e); - } - wa(t, e, n) { - this.l - ? (function (t, e, n, r) { - const i = Xa(t); - Ha(t, e, (e) => { - (za(t, e, n, r), - (e = Va(t)).drawImage( - i.canvas, - 0, - 0, - e.canvas.width, - e.canvas.height, - )); - }); - })(this, t, e, n) - : za(this, t.N(), e, n); - } - close() { - (this.g?.close(), - (this.g = void 0), - this.h?.close(), - (this.h = void 0), - this.m?.close(), - (this.m = void 0)); - } -}; -function Ya(t, e) { - switch (e) { - case 0: - return t.g.find((t) => t instanceof ImageData); - case 1: - return t.g.find( - (t) => "undefined" != typeof ImageBitmap && t instanceof ImageBitmap, - ); - case 2: - return t.g.find( - (t) => "undefined" != typeof WebGLTexture && t instanceof WebGLTexture, - ); - default: - throw Error(`Type is not supported: ${e}`); - } -} -function qa(t) { - var e = Ya(t, 0); - if (!e) { - e = Ja(t); - const n = Za(t), - r = new Uint8Array(t.width * t.height * 4); - (Ta(n, e, $a(t)), - e.readPixels(0, 0, t.width, t.height, e.RGBA, e.UNSIGNED_BYTE, r), - Aa(n), - (e = new ImageData(new Uint8ClampedArray(r.buffer), t.width, t.height)), - t.g.push(e)); - } - return e; -} -function $a(t) { - let e = Ya(t, 2); - if (!e) { - const n = Ja(t); - e = Qa(t); - const r = Ya(t, 1) || qa(t); - (n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, n.RGBA, n.UNSIGNED_BYTE, r), tc(t)); - } - return e; -} -function Ja(t) { - if (!t.canvas) - throw Error( - "Conversion to different image formats require that a canvas is passed when initializing the image.", - ); - return ( - t.h || - (t.h = ga( - t.canvas.getContext("webgl2"), - "You cannot use a canvas that is already bound to a different type of rendering context.", - )), - t.h - ); -} -function Za(t) { - return (t.l || (t.l = new ba()), t.l); -} -function Qa(t) { - const e = Ja(t); - (e.viewport(0, 0, t.width, t.height), e.activeTexture(e.TEXTURE0)); - let n = Ya(t, 2); - return ( - n || ((n = wa(Za(t), e)), t.g.push(n), (t.m = !0)), - e.bindTexture(e.TEXTURE_2D, n), - n - ); -} -function tc(t) { - t.h.bindTexture(t.h.TEXTURE_2D, null); -} -function ec(t) { - const e = Ja(t); - return Ea(Za(t), e, !0, () => - (function (t, e) { - const n = t.canvas; - if (n.width === t.width && n.height === t.height) return e(); - const r = n.width, - i = n.height; - return ( - (n.width = t.width), - (n.height = t.height), - (t = e()), - (n.width = r), - (n.height = i), - t - ); - })(t, () => { - if ( - (e.bindFramebuffer(e.FRAMEBUFFER, null), - e.clearColor(0, 0, 0, 0), - e.clear(e.COLOR_BUFFER_BIT), - e.drawArrays(e.TRIANGLE_FAN, 0, 4), - !(t.canvas instanceof OffscreenCanvas)) - ) - throw Error( - "Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas", - ); - return t.canvas.transferToImageBitmap(); - }), - ); -} -((Ka.prototype.close = Ka.prototype.close), - (Ka.prototype.drawConfidenceMask = Ka.prototype.wa), - (Ka.prototype.drawCategoryMask = Ka.prototype.va), - (Ka.prototype.drawBoundingBox = Ka.prototype.ua), - (Ka.prototype.drawConnectors = Ka.prototype.xa), - (Ka.prototype.drawLandmarks = Ka.prototype.ya), - (Ka.lerp = function (t, e, n, r, i) { - return ja(r * (1 - (t - e) / (n - e)) + i * (1 - (n - t) / (n - e)), r, i); - }), - (Ka.clamp = ja)); -var nc = class { - constructor(t, e, n, r, i, s, o) { - ((this.g = t), - (this.j = e), - (this.m = n), - (this.canvas = r), - (this.l = i), - (this.width = s), - (this.height = o), - (this.j || this.m) && - 0 === --rc && - console.error( - "You seem to be creating MPImage instances without invoking .close(). This leaks resources.", - )); - } - Ea() { - return !!Ya(this, 0); - } - la() { - return !!Ya(this, 1); - } - R() { - return !!Ya(this, 2); - } - Ca() { - return qa(this); - } - Ba() { - var t = Ya(this, 1); - return ( - t || - ($a(this), - Qa(this), - (t = ec(this)), - tc(this), - this.g.push(t), - (this.j = !0)), - t - ); - } - N() { - return $a(this); - } - clone() { - const t = []; - for (const e of this.g) { - let n; - if (e instanceof ImageData) - n = new ImageData(e.data, this.width, this.height); - else if (e instanceof WebGLTexture) { - const t = Ja(this), - e = Za(this); - (t.activeTexture(t.TEXTURE1), - (n = wa(e, t)), - t.bindTexture(t.TEXTURE_2D, n), - t.texImage2D( - t.TEXTURE_2D, - 0, - t.RGBA, - this.width, - this.height, - 0, - t.RGBA, - t.UNSIGNED_BYTE, - null, - ), - t.bindTexture(t.TEXTURE_2D, null), - Ta(e, t, n), - Ea(e, t, !1, () => { - (Qa(this), - t.clearColor(0, 0, 0, 0), - t.clear(t.COLOR_BUFFER_BIT), - t.drawArrays(t.TRIANGLE_FAN, 0, 4), - tc(this)); - }), - Aa(e), - tc(this)); - } else { - if (!(e instanceof ImageBitmap)) - throw Error(`Type is not supported: ${e}`); - ($a(this), Qa(this), (n = ec(this)), tc(this)); - } - t.push(n); - } - return new nc( - t, - this.la(), - this.R(), - this.canvas, - this.l, - this.width, - this.height, - ); - } - close() { - (this.j && Ya(this, 1).close(), - this.m && Ja(this).deleteTexture(Ya(this, 2)), - (rc = -1)); - } -}; -((nc.prototype.close = nc.prototype.close), - (nc.prototype.clone = nc.prototype.clone), - (nc.prototype.getAsWebGLTexture = nc.prototype.N), - (nc.prototype.getAsImageBitmap = nc.prototype.Ba), - (nc.prototype.getAsImageData = nc.prototype.Ca), - (nc.prototype.hasWebGLTexture = nc.prototype.R), - (nc.prototype.hasImageBitmap = nc.prototype.la), - (nc.prototype.hasImageData = nc.prototype.Ea)); -var rc = 250; -function ic(...t) { - return t.map(([t, e]) => ({ start: t, end: e })); -} -const sc = (function (t) { - return class extends t { - Ja() { - this.i._registerModelResourcesGraphService(); - } - }; -})( - ((oc = class { - constructor(t, e) { - ((this.l = !0), - (this.i = t), - (this.g = null), - (this.h = 0), - (this.m = "function" == typeof this.i._addIntToInputStream), - void 0 !== e - ? (this.i.canvas = e) - : Qo() - ? (this.i.canvas = new OffscreenCanvas(1, 1)) - : (console.warn( - "OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.", - ), - (this.i.canvas = document.createElement("canvas")))); - } - async initializeGraph(t) { - const e = await (await fetch(t)).arrayBuffer(); - ((t = !(t.endsWith(".pbtxt") || t.endsWith(".textproto"))), - this.setGraph(new Uint8Array(e), t)); - } - setGraphFromString(t) { - this.setGraph(new TextEncoder().encode(t), !1); - } - setGraph(t, e) { - const n = t.length, - r = this.i._malloc(n); - (this.i.HEAPU8.set(t, r), - e ? this.i._changeBinaryGraph(n, r) : this.i._changeTextGraph(n, r), - this.i._free(r)); - } - configureAudio(t, e, n, r, i) { - (this.i._configureAudio || - console.warn( - 'Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?', - ), - na(this, r || "input_audio", (r) => { - na(this, (i = i || "audio_header"), (i) => { - this.i._configureAudio(r, i, t, e ?? 0, n); - }); - })); - } - setAutoResizeCanvas(t) { - this.l = t; - } - setAutoRenderToScreen(t) { - this.i._setAutoRenderToScreen(t); - } - setGpuBufferVerticalFlip(t) { - this.i.gpuOriginForWebTexturesIsBottomLeft = t; - } - ca(t) { - (sa(this, "__graph_config__", (e) => { - t(e); - }), - na(this, "__graph_config__", (t) => { - this.i._getGraphConfig(t, void 0); - }), - delete this.i.simpleListeners.__graph_config__); - } - attachErrorListener(t) { - this.i.errorListener = t; - } - attachEmptyPacketListener(t, e) { - ((this.i.emptyPacketListeners = this.i.emptyPacketListeners || {}), - (this.i.emptyPacketListeners[t] = e)); - } - addAudioToStream(t, e, n) { - this.addAudioToStreamWithShape(t, 0, 0, e, n); - } - addAudioToStreamWithShape(t, e, n, r, i) { - const s = 4 * t.length; - (this.h !== s && - (this.g && this.i._free(this.g), - (this.g = this.i._malloc(s)), - (this.h = s)), - this.i.HEAPF32.set(t, this.g / 4), - na(this, r, (t) => { - this.i._addAudioToInputStream(this.g, e, n, t, i); - })); - } - addGpuBufferToStream(t, e, n) { - na(this, e, (e) => { - const [r, i] = ra(this, t, e); - this.i._addBoundTextureToStream(e, r, i, n); - }); - } - addBoolToStream(t, e, n) { - na(this, e, (e) => { - this.i._addBoolToInputStream(t, e, n); - }); - } - addDoubleToStream(t, e, n) { - na(this, e, (e) => { - this.i._addDoubleToInputStream(t, e, n); - }); - } - addFloatToStream(t, e, n) { - na(this, e, (e) => { - this.i._addFloatToInputStream(t, e, n); - }); - } - addIntToStream(t, e, n) { - na(this, e, (e) => { - this.i._addIntToInputStream(t, e, n); - }); - } - addUintToStream(t, e, n) { - na(this, e, (e) => { - this.i._addUintToInputStream(t, e, n); - }); - } - addStringToStream(t, e, n) { - na(this, e, (e) => { - na(this, t, (t) => { - this.i._addStringToInputStream(t, e, n); - }); - }); - } - addStringRecordToStream(t, e, n) { - na(this, e, (e) => { - ia(this, Object.keys(t), (r) => { - ia(this, Object.values(t), (i) => { - this.i._addFlatHashMapToInputStream( - r, - i, - Object.keys(t).length, - e, - n, - ); - }); - }); - }); - } - addProtoToStream(t, e, n, r) { - na(this, n, (n) => { - na(this, e, (e) => { - const i = this.i._malloc(t.length); - (this.i.HEAPU8.set(t, i), - this.i._addProtoToInputStream(i, t.length, e, n, r), - this.i._free(i)); - }); - }); - } - addEmptyPacketToStream(t, e) { - na(this, t, (t) => { - this.i._addEmptyPacketToInputStream(t, e); - }); - } - addBoolVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateBoolVector(t.length); - if (!r) throw Error("Unable to allocate new bool vector on heap."); - for (const e of t) this.i._addBoolVectorEntry(r, e); - this.i._addBoolVectorToInputStream(r, e, n); - }); - } - addDoubleVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateDoubleVector(t.length); - if (!r) throw Error("Unable to allocate new double vector on heap."); - for (const e of t) this.i._addDoubleVectorEntry(r, e); - this.i._addDoubleVectorToInputStream(r, e, n); - }); - } - addFloatVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateFloatVector(t.length); - if (!r) throw Error("Unable to allocate new float vector on heap."); - for (const e of t) this.i._addFloatVectorEntry(r, e); - this.i._addFloatVectorToInputStream(r, e, n); - }); - } - addIntVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateIntVector(t.length); - if (!r) throw Error("Unable to allocate new int vector on heap."); - for (const e of t) this.i._addIntVectorEntry(r, e); - this.i._addIntVectorToInputStream(r, e, n); - }); - } - addUintVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateUintVector(t.length); - if (!r) - throw Error("Unable to allocate new unsigned int vector on heap."); - for (const e of t) this.i._addUintVectorEntry(r, e); - this.i._addUintVectorToInputStream(r, e, n); - }); - } - addStringVectorToStream(t, e, n) { - na(this, e, (e) => { - const r = this.i._allocateStringVector(t.length); - if (!r) throw Error("Unable to allocate new string vector on heap."); - for (const e of t) - na(this, e, (t) => { - this.i._addStringVectorEntry(r, t); - }); - this.i._addStringVectorToInputStream(r, e, n); - }); - } - addBoolToInputSidePacket(t, e) { - na(this, e, (e) => { - this.i._addBoolToInputSidePacket(t, e); - }); - } - addDoubleToInputSidePacket(t, e) { - na(this, e, (e) => { - this.i._addDoubleToInputSidePacket(t, e); - }); - } - addFloatToInputSidePacket(t, e) { - na(this, e, (e) => { - this.i._addFloatToInputSidePacket(t, e); - }); - } - addIntToInputSidePacket(t, e) { - na(this, e, (e) => { - this.i._addIntToInputSidePacket(t, e); - }); - } - addUintToInputSidePacket(t, e) { - na(this, e, (e) => { - this.i._addUintToInputSidePacket(t, e); - }); - } - addStringToInputSidePacket(t, e) { - na(this, e, (e) => { - na(this, t, (t) => { - this.i._addStringToInputSidePacket(t, e); - }); - }); - } - addProtoToInputSidePacket(t, e, n) { - na(this, n, (n) => { - na(this, e, (e) => { - const r = this.i._malloc(t.length); - (this.i.HEAPU8.set(t, r), - this.i._addProtoToInputSidePacket(r, t.length, e, n), - this.i._free(r)); - }); - }); - } - addBoolVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateBoolVector(t.length); - if (!n) throw Error("Unable to allocate new bool vector on heap."); - for (const e of t) this.i._addBoolVectorEntry(n, e); - this.i._addBoolVectorToInputSidePacket(n, e); - }); - } - addDoubleVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateDoubleVector(t.length); - if (!n) throw Error("Unable to allocate new double vector on heap."); - for (const e of t) this.i._addDoubleVectorEntry(n, e); - this.i._addDoubleVectorToInputSidePacket(n, e); - }); - } - addFloatVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateFloatVector(t.length); - if (!n) throw Error("Unable to allocate new float vector on heap."); - for (const e of t) this.i._addFloatVectorEntry(n, e); - this.i._addFloatVectorToInputSidePacket(n, e); - }); - } - addIntVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateIntVector(t.length); - if (!n) throw Error("Unable to allocate new int vector on heap."); - for (const e of t) this.i._addIntVectorEntry(n, e); - this.i._addIntVectorToInputSidePacket(n, e); - }); - } - addUintVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateUintVector(t.length); - if (!n) - throw Error("Unable to allocate new unsigned int vector on heap."); - for (const e of t) this.i._addUintVectorEntry(n, e); - this.i._addUintVectorToInputSidePacket(n, e); - }); - } - addStringVectorToInputSidePacket(t, e) { - na(this, e, (e) => { - const n = this.i._allocateStringVector(t.length); - if (!n) throw Error("Unable to allocate new string vector on heap."); - for (const e of t) - na(this, e, (t) => { - this.i._addStringVectorEntry(n, t); - }); - this.i._addStringVectorToInputSidePacket(n, e); - }); - } - attachBoolListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachBoolListener(t); - })); - } - attachBoolVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachBoolVectorListener(t); - })); - } - attachIntListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachIntListener(t); - })); - } - attachIntVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachIntVectorListener(t); - })); - } - attachUintListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachUintListener(t); - })); - } - attachUintVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachUintVectorListener(t); - })); - } - attachDoubleListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachDoubleListener(t); - })); - } - attachDoubleVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachDoubleVectorListener(t); - })); - } - attachFloatListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachFloatListener(t); - })); - } - attachFloatVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachFloatVectorListener(t); - })); - } - attachStringListener(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachStringListener(t); - })); - } - attachStringVectorListener(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachStringVectorListener(t); - })); - } - attachProtoListener(t, e, n) { - (sa(this, t, e), - na(this, t, (t) => { - this.i._attachProtoListener(t, n || !1); - })); - } - attachProtoVectorListener(t, e, n) { - (oa(this, t, e), - na(this, t, (t) => { - this.i._attachProtoVectorListener(t, n || !1); - })); - } - attachAudioListener(t, e, n) { - (this.i._attachAudioListener || - console.warn( - 'Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?', - ), - sa(this, t, (t, n) => { - ((t = new Float32Array(t.buffer, t.byteOffset, t.length / 4)), - e(t, n)); - }), - na(this, t, (t) => { - this.i._attachAudioListener(t, n || !1); - })); - } - finishProcessing() { - this.i._waitUntilIdle(); - } - closeGraph() { - (this.i._closeGraph(), - (this.i.simpleListeners = void 0), - (this.i.emptyPacketListeners = void 0)); - } - }), - class extends oc { - get ga() { - return this.i; - } - pa(t, e, n) { - na(this, e, (e) => { - const [r, i] = ra(this, t, e); - this.ga._addBoundTextureAsImageToStream(e, r, i, n); - }); - } - Z(t, e) { - (sa(this, t, e), - na(this, t, (t) => { - this.ga._attachImageListener(t); - })); - } - aa(t, e) { - (oa(this, t, e), - na(this, t, (t) => { - this.ga._attachImageVectorListener(t); - })); - } - }), -); -var oc, - ac = class extends sc {}; -async function cc(t, e, n) { - return (async function (t, e, n, r) { - return aa(t, e, n, r); - })(t, n.canvas ?? (Qo() ? void 0 : document.createElement("canvas")), e, n); -} -function hc(t, e, n, r) { - if (t.U) { - const s = new Ls(); - if (n?.regionOfInterest) { - if (!t.oa) throw Error("This task doesn't support region-of-interest."); - var i = n.regionOfInterest; - if (i.left >= i.right || i.top >= i.bottom) - throw Error("Expected RectF with left < right and top < bottom."); - if (i.left < 0 || i.top < 0 || i.right > 1 || i.bottom > 1) - throw Error("Expected RectF values to be in [0,1]."); - (Ln(s, 1, (i.left + i.right) / 2), - Ln(s, 2, (i.top + i.bottom) / 2), - Ln(s, 4, i.right - i.left), - Ln(s, 3, i.bottom - i.top)); - } else (Ln(s, 1, 0.5), Ln(s, 2, 0.5), Ln(s, 4, 1), Ln(s, 3, 1)); - if (n?.rotationDegrees) { - if (n?.rotationDegrees % 90 != 0) - throw Error("Expected rotation to be a multiple of 90 degrees."); - if ( - (Ln(s, 5, (-Math.PI * n.rotationDegrees) / 180), - n?.rotationDegrees % 180 != 0) - ) { - const [t, r] = ea(e); - ((n = (Sn(s, 3) * r) / t), - (i = (Sn(s, 4) * t) / r), - Ln(s, 4, n), - Ln(s, 3, i)); - } - } - t.g.addProtoToStream(s.g(), "mediapipe.NormalizedRect", t.U, r); - } - (t.g.pa(e, t.X, r ?? performance.now()), t.finishProcessing()); -} -function uc(t, e, n) { - if (t.baseOptions?.g()) - throw Error( - "Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.", - ); - hc(t, e, n, t.C + 1); -} -function lc(t, e, n, r) { - if (!t.baseOptions?.g()) - throw Error( - "Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.", - ); - hc(t, e, n, r); -} -function fc(t, e, n, r) { - var i = e.data; - const s = e.width, - o = s * (e = e.height); - if ((i instanceof Uint8Array || i instanceof Float32Array) && i.length !== o) - throw Error("Unsupported channel count: " + i.length / o); - return ((t = new Na([i], n, !1, t.g.i.canvas, t.P, s, e)), r ? t.clone() : t); -} -var dc = class extends pa { - constructor(t, e, n, r) { - (super(t), - (this.g = t), - (this.X = e), - (this.U = n), - (this.oa = r), - (this.P = new ba())); - } - l(t, e = !0) { - if ( - ("runningMode" in t && - Ze( - this.baseOptions, - 2, - Jt(!!t.runningMode && "IMAGE" !== t.runningMode), - ), - void 0 !== t.canvas && this.g.i.canvas !== t.canvas) - ) - throw Error("You must create a new task to reset the canvas."); - return super.l(t, e); - } - close() { - (this.P.close(), super.close()); - } -}; -dc.prototype.close = dc.prototype.close; -var pc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect_in", !1), - (this.j = { detections: [] }), - wn((t = this.h = new zs()), 0, 1, (e = new Xs())), - Ln(this.h, 2, 0.5), - Ln(this.h, 3, 0.3)); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - "minDetectionConfidence" in t && - Ln(this.h, 2, t.minDetectionConfidence ?? 0.5), - "minSuppressionThreshold" in t && - Ln(this.h, 3, t.minSuppressionThreshold ?? 0.3), - this.l(t) - ); - } - F(t, e) { - return ((this.j = { detections: [] }), uc(this, t, e), this.j); - } - G(t, e, n) { - return ((this.j = { detections: [] }), lc(this, t, n, e), this.j); - } - m() { - var t = new ls(); - (hs(t, "image_in"), hs(t, "norm_rect_in"), us(t, "detections")); - const e = new Qi(); - xr(e, Ys, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect_in"), - rs(n, "DETECTIONS:detections"), - n.o(e), - cs(t, n), - this.g.attachProtoVectorListener("detections", (t, e) => { - for (const e of t) ((t = ws(e)), this.j.detections.push(Xo(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("detections", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((pc.prototype.detectForVideo = pc.prototype.G), - (pc.prototype.detect = pc.prototype.F), - (pc.prototype.setOptions = pc.prototype.o), - (pc.createFromModelPath = async function (t, e) { - return cc(pc, t, { baseOptions: { modelAssetPath: e } }); - }), - (pc.createFromModelBuffer = function (t, e) { - return cc(pc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (pc.createFromOptions = function (t, e) { - return cc(pc, t, e); - })); -var gc = ic( - [61, 146], - [146, 91], - [91, 181], - [181, 84], - [84, 17], - [17, 314], - [314, 405], - [405, 321], - [321, 375], - [375, 291], - [61, 185], - [185, 40], - [40, 39], - [39, 37], - [37, 0], - [0, 267], - [267, 269], - [269, 270], - [270, 409], - [409, 291], - [78, 95], - [95, 88], - [88, 178], - [178, 87], - [87, 14], - [14, 317], - [317, 402], - [402, 318], - [318, 324], - [324, 308], - [78, 191], - [191, 80], - [80, 81], - [81, 82], - [82, 13], - [13, 312], - [312, 311], - [311, 310], - [310, 415], - [415, 308], - ), - mc = ic( - [263, 249], - [249, 390], - [390, 373], - [373, 374], - [374, 380], - [380, 381], - [381, 382], - [382, 362], - [263, 466], - [466, 388], - [388, 387], - [387, 386], - [386, 385], - [385, 384], - [384, 398], - [398, 362], - ), - yc = ic( - [276, 283], - [283, 282], - [282, 295], - [295, 285], - [300, 293], - [293, 334], - [334, 296], - [296, 336], - ), - _c = ic([474, 475], [475, 476], [476, 477], [477, 474]), - vc = ic( - [33, 7], - [7, 163], - [163, 144], - [144, 145], - [145, 153], - [153, 154], - [154, 155], - [155, 133], - [33, 246], - [246, 161], - [161, 160], - [160, 159], - [159, 158], - [158, 157], - [157, 173], - [173, 133], - ), - Ec = ic( - [46, 53], - [53, 52], - [52, 65], - [65, 55], - [70, 63], - [63, 105], - [105, 66], - [66, 107], - ), - wc = ic([469, 470], [470, 471], [471, 472], [472, 469]), - Tc = ic( - [10, 338], - [338, 297], - [297, 332], - [332, 284], - [284, 251], - [251, 389], - [389, 356], - [356, 454], - [454, 323], - [323, 361], - [361, 288], - [288, 397], - [397, 365], - [365, 379], - [379, 378], - [378, 400], - [400, 377], - [377, 152], - [152, 148], - [148, 176], - [176, 149], - [149, 150], - [150, 136], - [136, 172], - [172, 58], - [58, 132], - [132, 93], - [93, 234], - [234, 127], - [127, 162], - [162, 21], - [21, 54], - [54, 103], - [103, 67], - [67, 109], - [109, 10], - ), - Ac = [...gc, ...mc, ...yc, ...vc, ...Ec, ...Tc], - bc = ic( - [127, 34], - [34, 139], - [139, 127], - [11, 0], - [0, 37], - [37, 11], - [232, 231], - [231, 120], - [120, 232], - [72, 37], - [37, 39], - [39, 72], - [128, 121], - [121, 47], - [47, 128], - [232, 121], - [121, 128], - [128, 232], - [104, 69], - [69, 67], - [67, 104], - [175, 171], - [171, 148], - [148, 175], - [118, 50], - [50, 101], - [101, 118], - [73, 39], - [39, 40], - [40, 73], - [9, 151], - [151, 108], - [108, 9], - [48, 115], - [115, 131], - [131, 48], - [194, 204], - [204, 211], - [211, 194], - [74, 40], - [40, 185], - [185, 74], - [80, 42], - [42, 183], - [183, 80], - [40, 92], - [92, 186], - [186, 40], - [230, 229], - [229, 118], - [118, 230], - [202, 212], - [212, 214], - [214, 202], - [83, 18], - [18, 17], - [17, 83], - [76, 61], - [61, 146], - [146, 76], - [160, 29], - [29, 30], - [30, 160], - [56, 157], - [157, 173], - [173, 56], - [106, 204], - [204, 194], - [194, 106], - [135, 214], - [214, 192], - [192, 135], - [203, 165], - [165, 98], - [98, 203], - [21, 71], - [71, 68], - [68, 21], - [51, 45], - [45, 4], - [4, 51], - [144, 24], - [24, 23], - [23, 144], - [77, 146], - [146, 91], - [91, 77], - [205, 50], - [50, 187], - [187, 205], - [201, 200], - [200, 18], - [18, 201], - [91, 106], - [106, 182], - [182, 91], - [90, 91], - [91, 181], - [181, 90], - [85, 84], - [84, 17], - [17, 85], - [206, 203], - [203, 36], - [36, 206], - [148, 171], - [171, 140], - [140, 148], - [92, 40], - [40, 39], - [39, 92], - [193, 189], - [189, 244], - [244, 193], - [159, 158], - [158, 28], - [28, 159], - [247, 246], - [246, 161], - [161, 247], - [236, 3], - [3, 196], - [196, 236], - [54, 68], - [68, 104], - [104, 54], - [193, 168], - [168, 8], - [8, 193], - [117, 228], - [228, 31], - [31, 117], - [189, 193], - [193, 55], - [55, 189], - [98, 97], - [97, 99], - [99, 98], - [126, 47], - [47, 100], - [100, 126], - [166, 79], - [79, 218], - [218, 166], - [155, 154], - [154, 26], - [26, 155], - [209, 49], - [49, 131], - [131, 209], - [135, 136], - [136, 150], - [150, 135], - [47, 126], - [126, 217], - [217, 47], - [223, 52], - [52, 53], - [53, 223], - [45, 51], - [51, 134], - [134, 45], - [211, 170], - [170, 140], - [140, 211], - [67, 69], - [69, 108], - [108, 67], - [43, 106], - [106, 91], - [91, 43], - [230, 119], - [119, 120], - [120, 230], - [226, 130], - [130, 247], - [247, 226], - [63, 53], - [53, 52], - [52, 63], - [238, 20], - [20, 242], - [242, 238], - [46, 70], - [70, 156], - [156, 46], - [78, 62], - [62, 96], - [96, 78], - [46, 53], - [53, 63], - [63, 46], - [143, 34], - [34, 227], - [227, 143], - [123, 117], - [117, 111], - [111, 123], - [44, 125], - [125, 19], - [19, 44], - [236, 134], - [134, 51], - [51, 236], - [216, 206], - [206, 205], - [205, 216], - [154, 153], - [153, 22], - [22, 154], - [39, 37], - [37, 167], - [167, 39], - [200, 201], - [201, 208], - [208, 200], - [36, 142], - [142, 100], - [100, 36], - [57, 212], - [212, 202], - [202, 57], - [20, 60], - [60, 99], - [99, 20], - [28, 158], - [158, 157], - [157, 28], - [35, 226], - [226, 113], - [113, 35], - [160, 159], - [159, 27], - [27, 160], - [204, 202], - [202, 210], - [210, 204], - [113, 225], - [225, 46], - [46, 113], - [43, 202], - [202, 204], - [204, 43], - [62, 76], - [76, 77], - [77, 62], - [137, 123], - [123, 116], - [116, 137], - [41, 38], - [38, 72], - [72, 41], - [203, 129], - [129, 142], - [142, 203], - [64, 98], - [98, 240], - [240, 64], - [49, 102], - [102, 64], - [64, 49], - [41, 73], - [73, 74], - [74, 41], - [212, 216], - [216, 207], - [207, 212], - [42, 74], - [74, 184], - [184, 42], - [169, 170], - [170, 211], - [211, 169], - [170, 149], - [149, 176], - [176, 170], - [105, 66], - [66, 69], - [69, 105], - [122, 6], - [6, 168], - [168, 122], - [123, 147], - [147, 187], - [187, 123], - [96, 77], - [77, 90], - [90, 96], - [65, 55], - [55, 107], - [107, 65], - [89, 90], - [90, 180], - [180, 89], - [101, 100], - [100, 120], - [120, 101], - [63, 105], - [105, 104], - [104, 63], - [93, 137], - [137, 227], - [227, 93], - [15, 86], - [86, 85], - [85, 15], - [129, 102], - [102, 49], - [49, 129], - [14, 87], - [87, 86], - [86, 14], - [55, 8], - [8, 9], - [9, 55], - [100, 47], - [47, 121], - [121, 100], - [145, 23], - [23, 22], - [22, 145], - [88, 89], - [89, 179], - [179, 88], - [6, 122], - [122, 196], - [196, 6], - [88, 95], - [95, 96], - [96, 88], - [138, 172], - [172, 136], - [136, 138], - [215, 58], - [58, 172], - [172, 215], - [115, 48], - [48, 219], - [219, 115], - [42, 80], - [80, 81], - [81, 42], - [195, 3], - [3, 51], - [51, 195], - [43, 146], - [146, 61], - [61, 43], - [171, 175], - [175, 199], - [199, 171], - [81, 82], - [82, 38], - [38, 81], - [53, 46], - [46, 225], - [225, 53], - [144, 163], - [163, 110], - [110, 144], - [52, 65], - [65, 66], - [66, 52], - [229, 228], - [228, 117], - [117, 229], - [34, 127], - [127, 234], - [234, 34], - [107, 108], - [108, 69], - [69, 107], - [109, 108], - [108, 151], - [151, 109], - [48, 64], - [64, 235], - [235, 48], - [62, 78], - [78, 191], - [191, 62], - [129, 209], - [209, 126], - [126, 129], - [111, 35], - [35, 143], - [143, 111], - [117, 123], - [123, 50], - [50, 117], - [222, 65], - [65, 52], - [52, 222], - [19, 125], - [125, 141], - [141, 19], - [221, 55], - [55, 65], - [65, 221], - [3, 195], - [195, 197], - [197, 3], - [25, 7], - [7, 33], - [33, 25], - [220, 237], - [237, 44], - [44, 220], - [70, 71], - [71, 139], - [139, 70], - [122, 193], - [193, 245], - [245, 122], - [247, 130], - [130, 33], - [33, 247], - [71, 21], - [21, 162], - [162, 71], - [170, 169], - [169, 150], - [150, 170], - [188, 174], - [174, 196], - [196, 188], - [216, 186], - [186, 92], - [92, 216], - [2, 97], - [97, 167], - [167, 2], - [141, 125], - [125, 241], - [241, 141], - [164, 167], - [167, 37], - [37, 164], - [72, 38], - [38, 12], - [12, 72], - [38, 82], - [82, 13], - [13, 38], - [63, 68], - [68, 71], - [71, 63], - [226, 35], - [35, 111], - [111, 226], - [101, 50], - [50, 205], - [205, 101], - [206, 92], - [92, 165], - [165, 206], - [209, 198], - [198, 217], - [217, 209], - [165, 167], - [167, 97], - [97, 165], - [220, 115], - [115, 218], - [218, 220], - [133, 112], - [112, 243], - [243, 133], - [239, 238], - [238, 241], - [241, 239], - [214, 135], - [135, 169], - [169, 214], - [190, 173], - [173, 133], - [133, 190], - [171, 208], - [208, 32], - [32, 171], - [125, 44], - [44, 237], - [237, 125], - [86, 87], - [87, 178], - [178, 86], - [85, 86], - [86, 179], - [179, 85], - [84, 85], - [85, 180], - [180, 84], - [83, 84], - [84, 181], - [181, 83], - [201, 83], - [83, 182], - [182, 201], - [137, 93], - [93, 132], - [132, 137], - [76, 62], - [62, 183], - [183, 76], - [61, 76], - [76, 184], - [184, 61], - [57, 61], - [61, 185], - [185, 57], - [212, 57], - [57, 186], - [186, 212], - [214, 207], - [207, 187], - [187, 214], - [34, 143], - [143, 156], - [156, 34], - [79, 239], - [239, 237], - [237, 79], - [123, 137], - [137, 177], - [177, 123], - [44, 1], - [1, 4], - [4, 44], - [201, 194], - [194, 32], - [32, 201], - [64, 102], - [102, 129], - [129, 64], - [213, 215], - [215, 138], - [138, 213], - [59, 166], - [166, 219], - [219, 59], - [242, 99], - [99, 97], - [97, 242], - [2, 94], - [94, 141], - [141, 2], - [75, 59], - [59, 235], - [235, 75], - [24, 110], - [110, 228], - [228, 24], - [25, 130], - [130, 226], - [226, 25], - [23, 24], - [24, 229], - [229, 23], - [22, 23], - [23, 230], - [230, 22], - [26, 22], - [22, 231], - [231, 26], - [112, 26], - [26, 232], - [232, 112], - [189, 190], - [190, 243], - [243, 189], - [221, 56], - [56, 190], - [190, 221], - [28, 56], - [56, 221], - [221, 28], - [27, 28], - [28, 222], - [222, 27], - [29, 27], - [27, 223], - [223, 29], - [30, 29], - [29, 224], - [224, 30], - [247, 30], - [30, 225], - [225, 247], - [238, 79], - [79, 20], - [20, 238], - [166, 59], - [59, 75], - [75, 166], - [60, 75], - [75, 240], - [240, 60], - [147, 177], - [177, 215], - [215, 147], - [20, 79], - [79, 166], - [166, 20], - [187, 147], - [147, 213], - [213, 187], - [112, 233], - [233, 244], - [244, 112], - [233, 128], - [128, 245], - [245, 233], - [128, 114], - [114, 188], - [188, 128], - [114, 217], - [217, 174], - [174, 114], - [131, 115], - [115, 220], - [220, 131], - [217, 198], - [198, 236], - [236, 217], - [198, 131], - [131, 134], - [134, 198], - [177, 132], - [132, 58], - [58, 177], - [143, 35], - [35, 124], - [124, 143], - [110, 163], - [163, 7], - [7, 110], - [228, 110], - [110, 25], - [25, 228], - [356, 389], - [389, 368], - [368, 356], - [11, 302], - [302, 267], - [267, 11], - [452, 350], - [350, 349], - [349, 452], - [302, 303], - [303, 269], - [269, 302], - [357, 343], - [343, 277], - [277, 357], - [452, 453], - [453, 357], - [357, 452], - [333, 332], - [332, 297], - [297, 333], - [175, 152], - [152, 377], - [377, 175], - [347, 348], - [348, 330], - [330, 347], - [303, 304], - [304, 270], - [270, 303], - [9, 336], - [336, 337], - [337, 9], - [278, 279], - [279, 360], - [360, 278], - [418, 262], - [262, 431], - [431, 418], - [304, 408], - [408, 409], - [409, 304], - [310, 415], - [415, 407], - [407, 310], - [270, 409], - [409, 410], - [410, 270], - [450, 348], - [348, 347], - [347, 450], - [422, 430], - [430, 434], - [434, 422], - [313, 314], - [314, 17], - [17, 313], - [306, 307], - [307, 375], - [375, 306], - [387, 388], - [388, 260], - [260, 387], - [286, 414], - [414, 398], - [398, 286], - [335, 406], - [406, 418], - [418, 335], - [364, 367], - [367, 416], - [416, 364], - [423, 358], - [358, 327], - [327, 423], - [251, 284], - [284, 298], - [298, 251], - [281, 5], - [5, 4], - [4, 281], - [373, 374], - [374, 253], - [253, 373], - [307, 320], - [320, 321], - [321, 307], - [425, 427], - [427, 411], - [411, 425], - [421, 313], - [313, 18], - [18, 421], - [321, 405], - [405, 406], - [406, 321], - [320, 404], - [404, 405], - [405, 320], - [315, 16], - [16, 17], - [17, 315], - [426, 425], - [425, 266], - [266, 426], - [377, 400], - [400, 369], - [369, 377], - [322, 391], - [391, 269], - [269, 322], - [417, 465], - [465, 464], - [464, 417], - [386, 257], - [257, 258], - [258, 386], - [466, 260], - [260, 388], - [388, 466], - [456, 399], - [399, 419], - [419, 456], - [284, 332], - [332, 333], - [333, 284], - [417, 285], - [285, 8], - [8, 417], - [346, 340], - [340, 261], - [261, 346], - [413, 441], - [441, 285], - [285, 413], - [327, 460], - [460, 328], - [328, 327], - [355, 371], - [371, 329], - [329, 355], - [392, 439], - [439, 438], - [438, 392], - [382, 341], - [341, 256], - [256, 382], - [429, 420], - [420, 360], - [360, 429], - [364, 394], - [394, 379], - [379, 364], - [277, 343], - [343, 437], - [437, 277], - [443, 444], - [444, 283], - [283, 443], - [275, 440], - [440, 363], - [363, 275], - [431, 262], - [262, 369], - [369, 431], - [297, 338], - [338, 337], - [337, 297], - [273, 375], - [375, 321], - [321, 273], - [450, 451], - [451, 349], - [349, 450], - [446, 342], - [342, 467], - [467, 446], - [293, 334], - [334, 282], - [282, 293], - [458, 461], - [461, 462], - [462, 458], - [276, 353], - [353, 383], - [383, 276], - [308, 324], - [324, 325], - [325, 308], - [276, 300], - [300, 293], - [293, 276], - [372, 345], - [345, 447], - [447, 372], - [352, 345], - [345, 340], - [340, 352], - [274, 1], - [1, 19], - [19, 274], - [456, 248], - [248, 281], - [281, 456], - [436, 427], - [427, 425], - [425, 436], - [381, 256], - [256, 252], - [252, 381], - [269, 391], - [391, 393], - [393, 269], - [200, 199], - [199, 428], - [428, 200], - [266, 330], - [330, 329], - [329, 266], - [287, 273], - [273, 422], - [422, 287], - [250, 462], - [462, 328], - [328, 250], - [258, 286], - [286, 384], - [384, 258], - [265, 353], - [353, 342], - [342, 265], - [387, 259], - [259, 257], - [257, 387], - [424, 431], - [431, 430], - [430, 424], - [342, 353], - [353, 276], - [276, 342], - [273, 335], - [335, 424], - [424, 273], - [292, 325], - [325, 307], - [307, 292], - [366, 447], - [447, 345], - [345, 366], - [271, 303], - [303, 302], - [302, 271], - [423, 266], - [266, 371], - [371, 423], - [294, 455], - [455, 460], - [460, 294], - [279, 278], - [278, 294], - [294, 279], - [271, 272], - [272, 304], - [304, 271], - [432, 434], - [434, 427], - [427, 432], - [272, 407], - [407, 408], - [408, 272], - [394, 430], - [430, 431], - [431, 394], - [395, 369], - [369, 400], - [400, 395], - [334, 333], - [333, 299], - [299, 334], - [351, 417], - [417, 168], - [168, 351], - [352, 280], - [280, 411], - [411, 352], - [325, 319], - [319, 320], - [320, 325], - [295, 296], - [296, 336], - [336, 295], - [319, 403], - [403, 404], - [404, 319], - [330, 348], - [348, 349], - [349, 330], - [293, 298], - [298, 333], - [333, 293], - [323, 454], - [454, 447], - [447, 323], - [15, 16], - [16, 315], - [315, 15], - [358, 429], - [429, 279], - [279, 358], - [14, 15], - [15, 316], - [316, 14], - [285, 336], - [336, 9], - [9, 285], - [329, 349], - [349, 350], - [350, 329], - [374, 380], - [380, 252], - [252, 374], - [318, 402], - [402, 403], - [403, 318], - [6, 197], - [197, 419], - [419, 6], - [318, 319], - [319, 325], - [325, 318], - [367, 364], - [364, 365], - [365, 367], - [435, 367], - [367, 397], - [397, 435], - [344, 438], - [438, 439], - [439, 344], - [272, 271], - [271, 311], - [311, 272], - [195, 5], - [5, 281], - [281, 195], - [273, 287], - [287, 291], - [291, 273], - [396, 428], - [428, 199], - [199, 396], - [311, 271], - [271, 268], - [268, 311], - [283, 444], - [444, 445], - [445, 283], - [373, 254], - [254, 339], - [339, 373], - [282, 334], - [334, 296], - [296, 282], - [449, 347], - [347, 346], - [346, 449], - [264, 447], - [447, 454], - [454, 264], - [336, 296], - [296, 299], - [299, 336], - [338, 10], - [10, 151], - [151, 338], - [278, 439], - [439, 455], - [455, 278], - [292, 407], - [407, 415], - [415, 292], - [358, 371], - [371, 355], - [355, 358], - [340, 345], - [345, 372], - [372, 340], - [346, 347], - [347, 280], - [280, 346], - [442, 443], - [443, 282], - [282, 442], - [19, 94], - [94, 370], - [370, 19], - [441, 442], - [442, 295], - [295, 441], - [248, 419], - [419, 197], - [197, 248], - [263, 255], - [255, 359], - [359, 263], - [440, 275], - [275, 274], - [274, 440], - [300, 383], - [383, 368], - [368, 300], - [351, 412], - [412, 465], - [465, 351], - [263, 467], - [467, 466], - [466, 263], - [301, 368], - [368, 389], - [389, 301], - [395, 378], - [378, 379], - [379, 395], - [412, 351], - [351, 419], - [419, 412], - [436, 426], - [426, 322], - [322, 436], - [2, 164], - [164, 393], - [393, 2], - [370, 462], - [462, 461], - [461, 370], - [164, 0], - [0, 267], - [267, 164], - [302, 11], - [11, 12], - [12, 302], - [268, 12], - [12, 13], - [13, 268], - [293, 300], - [300, 301], - [301, 293], - [446, 261], - [261, 340], - [340, 446], - [330, 266], - [266, 425], - [425, 330], - [426, 423], - [423, 391], - [391, 426], - [429, 355], - [355, 437], - [437, 429], - [391, 327], - [327, 326], - [326, 391], - [440, 457], - [457, 438], - [438, 440], - [341, 382], - [382, 362], - [362, 341], - [459, 457], - [457, 461], - [461, 459], - [434, 430], - [430, 394], - [394, 434], - [414, 463], - [463, 362], - [362, 414], - [396, 369], - [369, 262], - [262, 396], - [354, 461], - [461, 457], - [457, 354], - [316, 403], - [403, 402], - [402, 316], - [315, 404], - [404, 403], - [403, 315], - [314, 405], - [405, 404], - [404, 314], - [313, 406], - [406, 405], - [405, 313], - [421, 418], - [418, 406], - [406, 421], - [366, 401], - [401, 361], - [361, 366], - [306, 408], - [408, 407], - [407, 306], - [291, 409], - [409, 408], - [408, 291], - [287, 410], - [410, 409], - [409, 287], - [432, 436], - [436, 410], - [410, 432], - [434, 416], - [416, 411], - [411, 434], - [264, 368], - [368, 383], - [383, 264], - [309, 438], - [438, 457], - [457, 309], - [352, 376], - [376, 401], - [401, 352], - [274, 275], - [275, 4], - [4, 274], - [421, 428], - [428, 262], - [262, 421], - [294, 327], - [327, 358], - [358, 294], - [433, 416], - [416, 367], - [367, 433], - [289, 455], - [455, 439], - [439, 289], - [462, 370], - [370, 326], - [326, 462], - [2, 326], - [326, 370], - [370, 2], - [305, 460], - [460, 455], - [455, 305], - [254, 449], - [449, 448], - [448, 254], - [255, 261], - [261, 446], - [446, 255], - [253, 450], - [450, 449], - [449, 253], - [252, 451], - [451, 450], - [450, 252], - [256, 452], - [452, 451], - [451, 256], - [341, 453], - [453, 452], - [452, 341], - [413, 464], - [464, 463], - [463, 413], - [441, 413], - [413, 414], - [414, 441], - [258, 442], - [442, 441], - [441, 258], - [257, 443], - [443, 442], - [442, 257], - [259, 444], - [444, 443], - [443, 259], - [260, 445], - [445, 444], - [444, 260], - [467, 342], - [342, 445], - [445, 467], - [459, 458], - [458, 250], - [250, 459], - [289, 392], - [392, 290], - [290, 289], - [290, 328], - [328, 460], - [460, 290], - [376, 433], - [433, 435], - [435, 376], - [250, 290], - [290, 392], - [392, 250], - [411, 416], - [416, 433], - [433, 411], - [341, 463], - [463, 464], - [464, 341], - [453, 464], - [464, 465], - [465, 453], - [357, 465], - [465, 412], - [412, 357], - [343, 412], - [412, 399], - [399, 343], - [360, 363], - [363, 440], - [440, 360], - [437, 399], - [399, 456], - [456, 437], - [420, 456], - [456, 363], - [363, 420], - [401, 435], - [435, 288], - [288, 401], - [372, 383], - [383, 353], - [353, 372], - [339, 255], - [255, 249], - [249, 339], - [448, 261], - [261, 255], - [255, 448], - [133, 243], - [243, 190], - [190, 133], - [133, 155], - [155, 112], - [112, 133], - [33, 246], - [246, 247], - [247, 33], - [33, 130], - [130, 25], - [25, 33], - [398, 384], - [384, 286], - [286, 398], - [362, 398], - [398, 414], - [414, 362], - [362, 463], - [463, 341], - [341, 362], - [263, 359], - [359, 467], - [467, 263], - [263, 249], - [249, 255], - [255, 263], - [466, 467], - [467, 260], - [260, 466], - [75, 60], - [60, 166], - [166, 75], - [238, 239], - [239, 79], - [79, 238], - [162, 127], - [127, 139], - [139, 162], - [72, 11], - [11, 37], - [37, 72], - [121, 232], - [232, 120], - [120, 121], - [73, 72], - [72, 39], - [39, 73], - [114, 128], - [128, 47], - [47, 114], - [233, 232], - [232, 128], - [128, 233], - [103, 104], - [104, 67], - [67, 103], - [152, 175], - [175, 148], - [148, 152], - [119, 118], - [118, 101], - [101, 119], - [74, 73], - [73, 40], - [40, 74], - [107, 9], - [9, 108], - [108, 107], - [49, 48], - [48, 131], - [131, 49], - [32, 194], - [194, 211], - [211, 32], - [184, 74], - [74, 185], - [185, 184], - [191, 80], - [80, 183], - [183, 191], - [185, 40], - [40, 186], - [186, 185], - [119, 230], - [230, 118], - [118, 119], - [210, 202], - [202, 214], - [214, 210], - [84, 83], - [83, 17], - [17, 84], - [77, 76], - [76, 146], - [146, 77], - [161, 160], - [160, 30], - [30, 161], - [190, 56], - [56, 173], - [173, 190], - [182, 106], - [106, 194], - [194, 182], - [138, 135], - [135, 192], - [192, 138], - [129, 203], - [203, 98], - [98, 129], - [54, 21], - [21, 68], - [68, 54], - [5, 51], - [51, 4], - [4, 5], - [145, 144], - [144, 23], - [23, 145], - [90, 77], - [77, 91], - [91, 90], - [207, 205], - [205, 187], - [187, 207], - [83, 201], - [201, 18], - [18, 83], - [181, 91], - [91, 182], - [182, 181], - [180, 90], - [90, 181], - [181, 180], - [16, 85], - [85, 17], - [17, 16], - [205, 206], - [206, 36], - [36, 205], - [176, 148], - [148, 140], - [140, 176], - [165, 92], - [92, 39], - [39, 165], - [245, 193], - [193, 244], - [244, 245], - [27, 159], - [159, 28], - [28, 27], - [30, 247], - [247, 161], - [161, 30], - [174, 236], - [236, 196], - [196, 174], - [103, 54], - [54, 104], - [104, 103], - [55, 193], - [193, 8], - [8, 55], - [111, 117], - [117, 31], - [31, 111], - [221, 189], - [189, 55], - [55, 221], - [240, 98], - [98, 99], - [99, 240], - [142, 126], - [126, 100], - [100, 142], - [219, 166], - [166, 218], - [218, 219], - [112, 155], - [155, 26], - [26, 112], - [198, 209], - [209, 131], - [131, 198], - [169, 135], - [135, 150], - [150, 169], - [114, 47], - [47, 217], - [217, 114], - [224, 223], - [223, 53], - [53, 224], - [220, 45], - [45, 134], - [134, 220], - [32, 211], - [211, 140], - [140, 32], - [109, 67], - [67, 108], - [108, 109], - [146, 43], - [43, 91], - [91, 146], - [231, 230], - [230, 120], - [120, 231], - [113, 226], - [226, 247], - [247, 113], - [105, 63], - [63, 52], - [52, 105], - [241, 238], - [238, 242], - [242, 241], - [124, 46], - [46, 156], - [156, 124], - [95, 78], - [78, 96], - [96, 95], - [70, 46], - [46, 63], - [63, 70], - [116, 143], - [143, 227], - [227, 116], - [116, 123], - [123, 111], - [111, 116], - [1, 44], - [44, 19], - [19, 1], - [3, 236], - [236, 51], - [51, 3], - [207, 216], - [216, 205], - [205, 207], - [26, 154], - [154, 22], - [22, 26], - [165, 39], - [39, 167], - [167, 165], - [199, 200], - [200, 208], - [208, 199], - [101, 36], - [36, 100], - [100, 101], - [43, 57], - [57, 202], - [202, 43], - [242, 20], - [20, 99], - [99, 242], - [56, 28], - [28, 157], - [157, 56], - [124, 35], - [35, 113], - [113, 124], - [29, 160], - [160, 27], - [27, 29], - [211, 204], - [204, 210], - [210, 211], - [124, 113], - [113, 46], - [46, 124], - [106, 43], - [43, 204], - [204, 106], - [96, 62], - [62, 77], - [77, 96], - [227, 137], - [137, 116], - [116, 227], - [73, 41], - [41, 72], - [72, 73], - [36, 203], - [203, 142], - [142, 36], - [235, 64], - [64, 240], - [240, 235], - [48, 49], - [49, 64], - [64, 48], - [42, 41], - [41, 74], - [74, 42], - [214, 212], - [212, 207], - [207, 214], - [183, 42], - [42, 184], - [184, 183], - [210, 169], - [169, 211], - [211, 210], - [140, 170], - [170, 176], - [176, 140], - [104, 105], - [105, 69], - [69, 104], - [193, 122], - [122, 168], - [168, 193], - [50, 123], - [123, 187], - [187, 50], - [89, 96], - [96, 90], - [90, 89], - [66, 65], - [65, 107], - [107, 66], - [179, 89], - [89, 180], - [180, 179], - [119, 101], - [101, 120], - [120, 119], - [68, 63], - [63, 104], - [104, 68], - [234, 93], - [93, 227], - [227, 234], - [16, 15], - [15, 85], - [85, 16], - [209, 129], - [129, 49], - [49, 209], - [15, 14], - [14, 86], - [86, 15], - [107, 55], - [55, 9], - [9, 107], - [120, 100], - [100, 121], - [121, 120], - [153, 145], - [145, 22], - [22, 153], - [178, 88], - [88, 179], - [179, 178], - [197, 6], - [6, 196], - [196, 197], - [89, 88], - [88, 96], - [96, 89], - [135, 138], - [138, 136], - [136, 135], - [138, 215], - [215, 172], - [172, 138], - [218, 115], - [115, 219], - [219, 218], - [41, 42], - [42, 81], - [81, 41], - [5, 195], - [195, 51], - [51, 5], - [57, 43], - [43, 61], - [61, 57], - [208, 171], - [171, 199], - [199, 208], - [41, 81], - [81, 38], - [38, 41], - [224, 53], - [53, 225], - [225, 224], - [24, 144], - [144, 110], - [110, 24], - [105, 52], - [52, 66], - [66, 105], - [118, 229], - [229, 117], - [117, 118], - [227, 34], - [34, 234], - [234, 227], - [66, 107], - [107, 69], - [69, 66], - [10, 109], - [109, 151], - [151, 10], - [219, 48], - [48, 235], - [235, 219], - [183, 62], - [62, 191], - [191, 183], - [142, 129], - [129, 126], - [126, 142], - [116, 111], - [111, 143], - [143, 116], - [118, 117], - [117, 50], - [50, 118], - [223, 222], - [222, 52], - [52, 223], - [94, 19], - [19, 141], - [141, 94], - [222, 221], - [221, 65], - [65, 222], - [196, 3], - [3, 197], - [197, 196], - [45, 220], - [220, 44], - [44, 45], - [156, 70], - [70, 139], - [139, 156], - [188, 122], - [122, 245], - [245, 188], - [139, 71], - [71, 162], - [162, 139], - [149, 170], - [170, 150], - [150, 149], - [122, 188], - [188, 196], - [196, 122], - [206, 216], - [216, 92], - [92, 206], - [164, 2], - [2, 167], - [167, 164], - [242, 141], - [141, 241], - [241, 242], - [0, 164], - [164, 37], - [37, 0], - [11, 72], - [72, 12], - [12, 11], - [12, 38], - [38, 13], - [13, 12], - [70, 63], - [63, 71], - [71, 70], - [31, 226], - [226, 111], - [111, 31], - [36, 101], - [101, 205], - [205, 36], - [203, 206], - [206, 165], - [165, 203], - [126, 209], - [209, 217], - [217, 126], - [98, 165], - [165, 97], - [97, 98], - [237, 220], - [220, 218], - [218, 237], - [237, 239], - [239, 241], - [241, 237], - [210, 214], - [214, 169], - [169, 210], - [140, 171], - [171, 32], - [32, 140], - [241, 125], - [125, 237], - [237, 241], - [179, 86], - [86, 178], - [178, 179], - [180, 85], - [85, 179], - [179, 180], - [181, 84], - [84, 180], - [180, 181], - [182, 83], - [83, 181], - [181, 182], - [194, 201], - [201, 182], - [182, 194], - [177, 137], - [137, 132], - [132, 177], - [184, 76], - [76, 183], - [183, 184], - [185, 61], - [61, 184], - [184, 185], - [186, 57], - [57, 185], - [185, 186], - [216, 212], - [212, 186], - [186, 216], - [192, 214], - [214, 187], - [187, 192], - [139, 34], - [34, 156], - [156, 139], - [218, 79], - [79, 237], - [237, 218], - [147, 123], - [123, 177], - [177, 147], - [45, 44], - [44, 4], - [4, 45], - [208, 201], - [201, 32], - [32, 208], - [98, 64], - [64, 129], - [129, 98], - [192, 213], - [213, 138], - [138, 192], - [235, 59], - [59, 219], - [219, 235], - [141, 242], - [242, 97], - [97, 141], - [97, 2], - [2, 141], - [141, 97], - [240, 75], - [75, 235], - [235, 240], - [229, 24], - [24, 228], - [228, 229], - [31, 25], - [25, 226], - [226, 31], - [230, 23], - [23, 229], - [229, 230], - [231, 22], - [22, 230], - [230, 231], - [232, 26], - [26, 231], - [231, 232], - [233, 112], - [112, 232], - [232, 233], - [244, 189], - [189, 243], - [243, 244], - [189, 221], - [221, 190], - [190, 189], - [222, 28], - [28, 221], - [221, 222], - [223, 27], - [27, 222], - [222, 223], - [224, 29], - [29, 223], - [223, 224], - [225, 30], - [30, 224], - [224, 225], - [113, 247], - [247, 225], - [225, 113], - [99, 60], - [60, 240], - [240, 99], - [213, 147], - [147, 215], - [215, 213], - [60, 20], - [20, 166], - [166, 60], - [192, 187], - [187, 213], - [213, 192], - [243, 112], - [112, 244], - [244, 243], - [244, 233], - [233, 245], - [245, 244], - [245, 128], - [128, 188], - [188, 245], - [188, 114], - [114, 174], - [174, 188], - [134, 131], - [131, 220], - [220, 134], - [174, 217], - [217, 236], - [236, 174], - [236, 198], - [198, 134], - [134, 236], - [215, 177], - [177, 58], - [58, 215], - [156, 143], - [143, 124], - [124, 156], - [25, 110], - [110, 7], - [7, 25], - [31, 228], - [228, 25], - [25, 31], - [264, 356], - [356, 368], - [368, 264], - [0, 11], - [11, 267], - [267, 0], - [451, 452], - [452, 349], - [349, 451], - [267, 302], - [302, 269], - [269, 267], - [350, 357], - [357, 277], - [277, 350], - [350, 452], - [452, 357], - [357, 350], - [299, 333], - [333, 297], - [297, 299], - [396, 175], - [175, 377], - [377, 396], - [280, 347], - [347, 330], - [330, 280], - [269, 303], - [303, 270], - [270, 269], - [151, 9], - [9, 337], - [337, 151], - [344, 278], - [278, 360], - [360, 344], - [424, 418], - [418, 431], - [431, 424], - [270, 304], - [304, 409], - [409, 270], - [272, 310], - [310, 407], - [407, 272], - [322, 270], - [270, 410], - [410, 322], - [449, 450], - [450, 347], - [347, 449], - [432, 422], - [422, 434], - [434, 432], - [18, 313], - [313, 17], - [17, 18], - [291, 306], - [306, 375], - [375, 291], - [259, 387], - [387, 260], - [260, 259], - [424, 335], - [335, 418], - [418, 424], - [434, 364], - [364, 416], - [416, 434], - [391, 423], - [423, 327], - [327, 391], - [301, 251], - [251, 298], - [298, 301], - [275, 281], - [281, 4], - [4, 275], - [254, 373], - [373, 253], - [253, 254], - [375, 307], - [307, 321], - [321, 375], - [280, 425], - [425, 411], - [411, 280], - [200, 421], - [421, 18], - [18, 200], - [335, 321], - [321, 406], - [406, 335], - [321, 320], - [320, 405], - [405, 321], - [314, 315], - [315, 17], - [17, 314], - [423, 426], - [426, 266], - [266, 423], - [396, 377], - [377, 369], - [369, 396], - [270, 322], - [322, 269], - [269, 270], - [413, 417], - [417, 464], - [464, 413], - [385, 386], - [386, 258], - [258, 385], - [248, 456], - [456, 419], - [419, 248], - [298, 284], - [284, 333], - [333, 298], - [168, 417], - [417, 8], - [8, 168], - [448, 346], - [346, 261], - [261, 448], - [417, 413], - [413, 285], - [285, 417], - [326, 327], - [327, 328], - [328, 326], - [277, 355], - [355, 329], - [329, 277], - [309, 392], - [392, 438], - [438, 309], - [381, 382], - [382, 256], - [256, 381], - [279, 429], - [429, 360], - [360, 279], - [365, 364], - [364, 379], - [379, 365], - [355, 277], - [277, 437], - [437, 355], - [282, 443], - [443, 283], - [283, 282], - [281, 275], - [275, 363], - [363, 281], - [395, 431], - [431, 369], - [369, 395], - [299, 297], - [297, 337], - [337, 299], - [335, 273], - [273, 321], - [321, 335], - [348, 450], - [450, 349], - [349, 348], - [359, 446], - [446, 467], - [467, 359], - [283, 293], - [293, 282], - [282, 283], - [250, 458], - [458, 462], - [462, 250], - [300, 276], - [276, 383], - [383, 300], - [292, 308], - [308, 325], - [325, 292], - [283, 276], - [276, 293], - [293, 283], - [264, 372], - [372, 447], - [447, 264], - [346, 352], - [352, 340], - [340, 346], - [354, 274], - [274, 19], - [19, 354], - [363, 456], - [456, 281], - [281, 363], - [426, 436], - [436, 425], - [425, 426], - [380, 381], - [381, 252], - [252, 380], - [267, 269], - [269, 393], - [393, 267], - [421, 200], - [200, 428], - [428, 421], - [371, 266], - [266, 329], - [329, 371], - [432, 287], - [287, 422], - [422, 432], - [290, 250], - [250, 328], - [328, 290], - [385, 258], - [258, 384], - [384, 385], - [446, 265], - [265, 342], - [342, 446], - [386, 387], - [387, 257], - [257, 386], - [422, 424], - [424, 430], - [430, 422], - [445, 342], - [342, 276], - [276, 445], - [422, 273], - [273, 424], - [424, 422], - [306, 292], - [292, 307], - [307, 306], - [352, 366], - [366, 345], - [345, 352], - [268, 271], - [271, 302], - [302, 268], - [358, 423], - [423, 371], - [371, 358], - [327, 294], - [294, 460], - [460, 327], - [331, 279], - [279, 294], - [294, 331], - [303, 271], - [271, 304], - [304, 303], - [436, 432], - [432, 427], - [427, 436], - [304, 272], - [272, 408], - [408, 304], - [395, 394], - [394, 431], - [431, 395], - [378, 395], - [395, 400], - [400, 378], - [296, 334], - [334, 299], - [299, 296], - [6, 351], - [351, 168], - [168, 6], - [376, 352], - [352, 411], - [411, 376], - [307, 325], - [325, 320], - [320, 307], - [285, 295], - [295, 336], - [336, 285], - [320, 319], - [319, 404], - [404, 320], - [329, 330], - [330, 349], - [349, 329], - [334, 293], - [293, 333], - [333, 334], - [366, 323], - [323, 447], - [447, 366], - [316, 15], - [15, 315], - [315, 316], - [331, 358], - [358, 279], - [279, 331], - [317, 14], - [14, 316], - [316, 317], - [8, 285], - [285, 9], - [9, 8], - [277, 329], - [329, 350], - [350, 277], - [253, 374], - [374, 252], - [252, 253], - [319, 318], - [318, 403], - [403, 319], - [351, 6], - [6, 419], - [419, 351], - [324, 318], - [318, 325], - [325, 324], - [397, 367], - [367, 365], - [365, 397], - [288, 435], - [435, 397], - [397, 288], - [278, 344], - [344, 439], - [439, 278], - [310, 272], - [272, 311], - [311, 310], - [248, 195], - [195, 281], - [281, 248], - [375, 273], - [273, 291], - [291, 375], - [175, 396], - [396, 199], - [199, 175], - [312, 311], - [311, 268], - [268, 312], - [276, 283], - [283, 445], - [445, 276], - [390, 373], - [373, 339], - [339, 390], - [295, 282], - [282, 296], - [296, 295], - [448, 449], - [449, 346], - [346, 448], - [356, 264], - [264, 454], - [454, 356], - [337, 336], - [336, 299], - [299, 337], - [337, 338], - [338, 151], - [151, 337], - [294, 278], - [278, 455], - [455, 294], - [308, 292], - [292, 415], - [415, 308], - [429, 358], - [358, 355], - [355, 429], - [265, 340], - [340, 372], - [372, 265], - [352, 346], - [346, 280], - [280, 352], - [295, 442], - [442, 282], - [282, 295], - [354, 19], - [19, 370], - [370, 354], - [285, 441], - [441, 295], - [295, 285], - [195, 248], - [248, 197], - [197, 195], - [457, 440], - [440, 274], - [274, 457], - [301, 300], - [300, 368], - [368, 301], - [417, 351], - [351, 465], - [465, 417], - [251, 301], - [301, 389], - [389, 251], - [394, 395], - [395, 379], - [379, 394], - [399, 412], - [412, 419], - [419, 399], - [410, 436], - [436, 322], - [322, 410], - [326, 2], - [2, 393], - [393, 326], - [354, 370], - [370, 461], - [461, 354], - [393, 164], - [164, 267], - [267, 393], - [268, 302], - [302, 12], - [12, 268], - [312, 268], - [268, 13], - [13, 312], - [298, 293], - [293, 301], - [301, 298], - [265, 446], - [446, 340], - [340, 265], - [280, 330], - [330, 425], - [425, 280], - [322, 426], - [426, 391], - [391, 322], - [420, 429], - [429, 437], - [437, 420], - [393, 391], - [391, 326], - [326, 393], - [344, 440], - [440, 438], - [438, 344], - [458, 459], - [459, 461], - [461, 458], - [364, 434], - [434, 394], - [394, 364], - [428, 396], - [396, 262], - [262, 428], - [274, 354], - [354, 457], - [457, 274], - [317, 316], - [316, 402], - [402, 317], - [316, 315], - [315, 403], - [403, 316], - [315, 314], - [314, 404], - [404, 315], - [314, 313], - [313, 405], - [405, 314], - [313, 421], - [421, 406], - [406, 313], - [323, 366], - [366, 361], - [361, 323], - [292, 306], - [306, 407], - [407, 292], - [306, 291], - [291, 408], - [408, 306], - [291, 287], - [287, 409], - [409, 291], - [287, 432], - [432, 410], - [410, 287], - [427, 434], - [434, 411], - [411, 427], - [372, 264], - [264, 383], - [383, 372], - [459, 309], - [309, 457], - [457, 459], - [366, 352], - [352, 401], - [401, 366], - [1, 274], - [274, 4], - [4, 1], - [418, 421], - [421, 262], - [262, 418], - [331, 294], - [294, 358], - [358, 331], - [435, 433], - [433, 367], - [367, 435], - [392, 289], - [289, 439], - [439, 392], - [328, 462], - [462, 326], - [326, 328], - [94, 2], - [2, 370], - [370, 94], - [289, 305], - [305, 455], - [455, 289], - [339, 254], - [254, 448], - [448, 339], - [359, 255], - [255, 446], - [446, 359], - [254, 253], - [253, 449], - [449, 254], - [253, 252], - [252, 450], - [450, 253], - [252, 256], - [256, 451], - [451, 252], - [256, 341], - [341, 452], - [452, 256], - [414, 413], - [413, 463], - [463, 414], - [286, 441], - [441, 414], - [414, 286], - [286, 258], - [258, 441], - [441, 286], - [258, 257], - [257, 442], - [442, 258], - [257, 259], - [259, 443], - [443, 257], - [259, 260], - [260, 444], - [444, 259], - [260, 467], - [467, 445], - [445, 260], - [309, 459], - [459, 250], - [250, 309], - [305, 289], - [289, 290], - [290, 305], - [305, 290], - [290, 460], - [460, 305], - [401, 376], - [376, 435], - [435, 401], - [309, 250], - [250, 392], - [392, 309], - [376, 411], - [411, 433], - [433, 376], - [453, 341], - [341, 464], - [464, 453], - [357, 453], - [453, 465], - [465, 357], - [343, 357], - [357, 412], - [412, 343], - [437, 343], - [343, 399], - [399, 437], - [344, 360], - [360, 440], - [440, 344], - [420, 437], - [437, 456], - [456, 420], - [360, 420], - [420, 363], - [363, 360], - [361, 401], - [401, 288], - [288, 361], - [265, 372], - [372, 353], - [353, 265], - [390, 339], - [339, 249], - [249, 390], - [339, 448], - [448, 255], - [255, 339], - ); -function kc(t) { - t.j = { - faceLandmarks: [], - faceBlendshapes: [], - facialTransformationMatrixes: [], - }; -} -var Sc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !1), - (this.j = { - faceLandmarks: [], - faceBlendshapes: [], - facialTransformationMatrixes: [], - }), - (this.outputFacialTransformationMatrixes = this.outputFaceBlendshapes = - !1), - wn((t = this.h = new Js()), 0, 1, (e = new Xs())), - (this.A = new $s()), - wn(this.h, 0, 3, this.A), - (this.u = new zs()), - wn(this.h, 0, 2, this.u), - xn(this.u, 4, 1), - Ln(this.u, 2, 0.5), - Ln(this.A, 2, 0.5), - Ln(this.h, 4, 0.5)); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - "numFaces" in t && xn(this.u, 4, t.numFaces ?? 1), - "minFaceDetectionConfidence" in t && - Ln(this.u, 2, t.minFaceDetectionConfidence ?? 0.5), - "minTrackingConfidence" in t && - Ln(this.h, 4, t.minTrackingConfidence ?? 0.5), - "minFacePresenceConfidence" in t && - Ln(this.A, 2, t.minFacePresenceConfidence ?? 0.5), - "outputFaceBlendshapes" in t && - (this.outputFaceBlendshapes = !!t.outputFaceBlendshapes), - "outputFacialTransformationMatrixes" in t && - (this.outputFacialTransformationMatrixes = - !!t.outputFacialTransformationMatrixes), - this.l(t) - ); - } - F(t, e) { - return (kc(this), uc(this, t, e), this.j); - } - G(t, e, n) { - return (kc(this), lc(this, t, n, e), this.j); - } - m() { - var t = new ls(); - (hs(t, "image_in"), hs(t, "norm_rect"), us(t, "face_landmarks")); - const e = new Qi(); - xr(e, Qs, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "NORM_LANDMARKS:face_landmarks"), - n.o(e), - cs(t, n), - this.g.attachProtoVectorListener("face_landmarks", (t, e) => { - for (const e of t) ((t = ks(e)), this.j.faceLandmarks.push(Ho(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("face_landmarks", (t) => { - ua(this, t); - }), - this.outputFaceBlendshapes && - (us(t, "blendshapes"), - rs(n, "BLENDSHAPES:blendshapes"), - this.g.attachProtoVectorListener("blendshapes", (t, e) => { - if (this.outputFaceBlendshapes) - for (const e of t) - ((t = ys(e)), this.j.faceBlendshapes.push(jo(t.g() ?? []))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("blendshapes", (t) => { - ua(this, t); - })), - this.outputFacialTransformationMatrixes && - (us(t, "face_geometry"), - rs(n, "FACE_GEOMETRY:face_geometry"), - this.g.attachProtoVectorListener("face_geometry", (t, e) => { - if (this.outputFacialTransformationMatrixes) - for (const e of t) - (t = yn((t = qs(e)), Ss, 2)) && - this.j.facialTransformationMatrixes.push({ - rows: kn(t, 1) ?? 0 ?? 0, - columns: kn(t, 2) ?? 0 ?? 0, - data: en(t, 3, $t, tn()).slice() ?? [], - }); - ua(this, e); - }), - this.g.attachEmptyPacketListener("face_geometry", (t) => { - ua(this, t); - })), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Sc.prototype.detectForVideo = Sc.prototype.G), - (Sc.prototype.detect = Sc.prototype.F), - (Sc.prototype.setOptions = Sc.prototype.o), - (Sc.createFromModelPath = function (t, e) { - return cc(Sc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Sc.createFromModelBuffer = function (t, e) { - return cc(Sc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Sc.createFromOptions = function (t, e) { - return cc(Sc, t, e); - }), - (Sc.FACE_LANDMARKS_LIPS = gc), - (Sc.FACE_LANDMARKS_LEFT_EYE = mc), - (Sc.FACE_LANDMARKS_LEFT_EYEBROW = yc), - (Sc.FACE_LANDMARKS_LEFT_IRIS = _c), - (Sc.FACE_LANDMARKS_RIGHT_EYE = vc), - (Sc.FACE_LANDMARKS_RIGHT_EYEBROW = Ec), - (Sc.FACE_LANDMARKS_RIGHT_IRIS = wc), - (Sc.FACE_LANDMARKS_FACE_OVAL = Tc), - (Sc.FACE_LANDMARKS_CONTOURS = Ac), - (Sc.FACE_LANDMARKS_TESSELATION = bc)); -var xc = ic( - [0, 1], - [1, 2], - [2, 3], - [3, 4], - [0, 5], - [5, 6], - [6, 7], - [7, 8], - [5, 9], - [9, 10], - [10, 11], - [11, 12], - [9, 13], - [13, 14], - [14, 15], - [15, 16], - [13, 17], - [0, 17], - [17, 18], - [18, 19], - [19, 20], -); -function Lc(t) { - ((t.gestures = []), - (t.landmarks = []), - (t.worldLandmarks = []), - (t.handedness = [])); -} -function Rc(t) { - return 0 === t.gestures.length - ? { - gestures: [], - landmarks: [], - worldLandmarks: [], - handedness: [], - handednesses: [], - } - : { - gestures: t.gestures, - landmarks: t.landmarks, - worldLandmarks: t.worldLandmarks, - handedness: t.handedness, - handednesses: t.handedness, - }; -} -function Ic(t, e = !0) { - const n = []; - for (const i of t) { - var r = ys(i); - t = []; - for (const n of r.g()) - ((r = e && null != kn(n, 1) ? (kn(n, 1) ?? 0) : -1), - t.push({ - score: Sn(n, 2) ?? 0, - index: r, - categoryName: le($e(n, 3)) ?? "" ?? "", - displayName: le($e(n, 4)) ?? "" ?? "", - })); - n.push(t); - } - return n; -} -var Fc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !1), - (this.gestures = []), - (this.landmarks = []), - (this.worldLandmarks = []), - (this.handedness = []), - wn((t = this.j = new oo()), 0, 1, (e = new Xs())), - (this.u = new so()), - wn(this.j, 0, 2, this.u), - (this.D = new io()), - wn(this.u, 0, 3, this.D), - (this.A = new ro()), - wn(this.u, 0, 2, this.A), - (this.h = new no()), - wn(this.j, 0, 3, this.h), - Ln(this.A, 2, 0.5), - Ln(this.u, 4, 0.5), - Ln(this.D, 2, 0.5)); - } - get baseOptions() { - return yn(this.j, Xs, 1); - } - set baseOptions(t) { - wn(this.j, 0, 1, t); - } - o(t) { - if ( - (xn(this.A, 3, t.numHands ?? 1), - "minHandDetectionConfidence" in t && - Ln(this.A, 2, t.minHandDetectionConfidence ?? 0.5), - "minTrackingConfidence" in t && - Ln(this.u, 4, t.minTrackingConfidence ?? 0.5), - "minHandPresenceConfidence" in t && - Ln(this.D, 2, t.minHandPresenceConfidence ?? 0.5), - t.cannedGesturesClassifierOptions) - ) { - var e = new to(), - n = e, - r = Bo(t.cannedGesturesClassifierOptions, yn(this.h, to, 3)?.l()); - (wn(n, 0, 2, r), wn(this.h, 0, 3, e)); - } else - void 0 === t.cannedGesturesClassifierOptions && yn(this.h, to, 3)?.g(); - return ( - t.customGesturesClassifierOptions - ? (wn( - (n = e = new to()), - 0, - 2, - (r = Bo(t.customGesturesClassifierOptions, yn(this.h, to, 4)?.l())), - ), - wn(this.h, 0, 4, e)) - : void 0 === t.customGesturesClassifierOptions && - yn(this.h, to, 4)?.g(), - this.l(t) - ); - } - Ha(t, e) { - return (Lc(this), uc(this, t, e), Rc(this)); - } - Ia(t, e, n) { - return (Lc(this), lc(this, t, n, e), Rc(this)); - } - m() { - var t = new ls(); - (hs(t, "image_in"), - hs(t, "norm_rect"), - us(t, "hand_gestures"), - us(t, "hand_landmarks"), - us(t, "world_hand_landmarks"), - us(t, "handedness")); - const e = new Qi(); - xr(e, lo, this.j); - const n = new is(); - (Rn( - n, - 2, - "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph", - ), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "HAND_GESTURES:hand_gestures"), - rs(n, "LANDMARKS:hand_landmarks"), - rs(n, "WORLD_LANDMARKS:world_hand_landmarks"), - rs(n, "HANDEDNESS:handedness"), - n.o(e), - cs(t, n), - this.g.attachProtoVectorListener("hand_landmarks", (t, e) => { - for (const e of t) { - t = ks(e); - const n = []; - for (const e of vn(t, bs, 1)) - n.push({ - x: Sn(e, 1) ?? 0, - y: Sn(e, 2) ?? 0, - z: Sn(e, 3) ?? 0, - visibility: Sn(e, 4) ?? 0, - }); - this.landmarks.push(n); - } - ua(this, e); - }), - this.g.attachEmptyPacketListener("hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoVectorListener("world_hand_landmarks", (t, e) => { - for (const e of t) { - t = As(e); - const n = []; - for (const e of vn(t, Ts, 1)) - n.push({ - x: Sn(e, 1) ?? 0, - y: Sn(e, 2) ?? 0, - z: Sn(e, 3) ?? 0, - visibility: Sn(e, 4) ?? 0, - }); - this.worldLandmarks.push(n); - } - ua(this, e); - }), - this.g.attachEmptyPacketListener("world_hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoVectorListener("hand_gestures", (t, e) => { - (this.gestures.push(...Ic(t, !1)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("hand_gestures", (t) => { - ua(this, t); - }), - this.g.attachProtoVectorListener("handedness", (t, e) => { - (this.handedness.push(...Ic(t)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("handedness", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -function Mc(t) { - return { - landmarks: t.landmarks, - worldLandmarks: t.worldLandmarks, - handednesses: t.handedness, - handedness: t.handedness, - }; -} -((Fc.prototype.recognizeForVideo = Fc.prototype.Ia), - (Fc.prototype.recognize = Fc.prototype.Ha), - (Fc.prototype.setOptions = Fc.prototype.o), - (Fc.createFromModelPath = function (t, e) { - return cc(Fc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Fc.createFromModelBuffer = function (t, e) { - return cc(Fc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Fc.createFromOptions = function (t, e) { - return cc(Fc, t, e); - }), - (Fc.HAND_CONNECTIONS = xc)); -var Pc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !1), - (this.landmarks = []), - (this.worldLandmarks = []), - (this.handedness = []), - wn((t = this.h = new so()), 0, 1, (e = new Xs())), - (this.u = new io()), - wn(this.h, 0, 3, this.u), - (this.j = new ro()), - wn(this.h, 0, 2, this.j), - xn(this.j, 3, 1), - Ln(this.j, 2, 0.5), - Ln(this.u, 2, 0.5), - Ln(this.h, 4, 0.5)); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - "numHands" in t && xn(this.j, 3, t.numHands ?? 1), - "minHandDetectionConfidence" in t && - Ln(this.j, 2, t.minHandDetectionConfidence ?? 0.5), - "minTrackingConfidence" in t && - Ln(this.h, 4, t.minTrackingConfidence ?? 0.5), - "minHandPresenceConfidence" in t && - Ln(this.u, 2, t.minHandPresenceConfidence ?? 0.5), - this.l(t) - ); - } - F(t, e) { - return ( - (this.landmarks = []), - (this.worldLandmarks = []), - (this.handedness = []), - uc(this, t, e), - Mc(this) - ); - } - G(t, e, n) { - return ( - (this.landmarks = []), - (this.worldLandmarks = []), - (this.handedness = []), - lc(this, t, n, e), - Mc(this) - ); - } - m() { - var t = new ls(); - (hs(t, "image_in"), - hs(t, "norm_rect"), - us(t, "hand_landmarks"), - us(t, "world_hand_landmarks"), - us(t, "handedness")); - const e = new Qi(); - xr(e, fo, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "LANDMARKS:hand_landmarks"), - rs(n, "WORLD_LANDMARKS:world_hand_landmarks"), - rs(n, "HANDEDNESS:handedness"), - n.o(e), - cs(t, n), - this.g.attachProtoVectorListener("hand_landmarks", (t, e) => { - for (const e of t) ((t = ks(e)), this.landmarks.push(Ho(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoVectorListener("world_hand_landmarks", (t, e) => { - for (const e of t) ((t = As(e)), this.worldLandmarks.push(Wo(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("world_hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoVectorListener("handedness", (t, e) => { - var n = this.handedness, - r = n.push; - const i = []; - for (const e of t) { - t = ys(e); - const n = []; - for (const e of t.g()) - n.push({ - score: Sn(e, 2) ?? 0, - index: kn(e, 1) ?? 0 ?? -1, - categoryName: le($e(e, 3)) ?? "" ?? "", - displayName: le($e(e, 4)) ?? "" ?? "", - }); - i.push(n); - } - (r.call(n, ...i), ua(this, e)); - }), - this.g.attachEmptyPacketListener("handedness", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Pc.prototype.detectForVideo = Pc.prototype.G), - (Pc.prototype.detect = Pc.prototype.F), - (Pc.prototype.setOptions = Pc.prototype.o), - (Pc.createFromModelPath = function (t, e) { - return cc(Pc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Pc.createFromModelBuffer = function (t, e) { - return cc(Pc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Pc.createFromOptions = function (t, e) { - return cc(Pc, t, e); - }), - (Pc.HAND_CONNECTIONS = xc)); -var Cc = ic( - [0, 1], - [1, 2], - [2, 3], - [3, 7], - [0, 4], - [4, 5], - [5, 6], - [6, 8], - [9, 10], - [11, 12], - [11, 13], - [13, 15], - [15, 17], - [15, 19], - [15, 21], - [17, 19], - [12, 14], - [14, 16], - [16, 18], - [16, 20], - [16, 22], - [18, 20], - [11, 23], - [12, 24], - [23, 24], - [23, 25], - [24, 26], - [25, 27], - [26, 28], - [27, 29], - [28, 30], - [29, 31], - [30, 32], - [27, 31], - [28, 32], -); -function Oc(t) { - t.h = { - faceLandmarks: [], - faceBlendshapes: [], - poseLandmarks: [], - poseWorldLandmarks: [], - poseSegmentationMasks: [], - leftHandLandmarks: [], - leftHandWorldLandmarks: [], - rightHandLandmarks: [], - rightHandWorldLandmarks: [], - }; -} -function Nc(t) { - try { - if (!t.D) return t.h; - t.D(t.h); - } finally { - da(t); - } -} -function Uc(t, e) { - ((t = ks(t)), e.push(Ho(t))); -} -var Dc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "input_frames_image", null, !1), - (this.h = { - faceLandmarks: [], - faceBlendshapes: [], - poseLandmarks: [], - poseWorldLandmarks: [], - poseSegmentationMasks: [], - leftHandLandmarks: [], - leftHandWorldLandmarks: [], - rightHandLandmarks: [], - rightHandWorldLandmarks: [], - }), - (this.outputPoseSegmentationMasks = this.outputFaceBlendshapes = !1), - wn((t = this.j = new yo()), 0, 1, (e = new Xs())), - (this.I = new io()), - wn(this.j, 0, 2, this.I), - (this.W = new po()), - wn(this.j, 0, 3, this.W), - (this.u = new zs()), - wn(this.j, 0, 4, this.u), - (this.O = new $s()), - wn(this.j, 0, 5, this.O), - (this.A = new go()), - wn(this.j, 0, 6, this.A), - (this.M = new mo()), - wn(this.j, 0, 7, this.M), - Ln(this.u, 2, 0.5), - Ln(this.u, 3, 0.3), - Ln(this.O, 2, 0.5), - Ln(this.A, 2, 0.5), - Ln(this.A, 3, 0.3), - Ln(this.M, 2, 0.5), - Ln(this.I, 2, 0.5)); - } - get baseOptions() { - return yn(this.j, Xs, 1); - } - set baseOptions(t) { - wn(this.j, 0, 1, t); - } - o(t) { - return ( - "minFaceDetectionConfidence" in t && - Ln(this.u, 2, t.minFaceDetectionConfidence ?? 0.5), - "minFaceSuppressionThreshold" in t && - Ln(this.u, 3, t.minFaceSuppressionThreshold ?? 0.3), - "minFacePresenceConfidence" in t && - Ln(this.O, 2, t.minFacePresenceConfidence ?? 0.5), - "outputFaceBlendshapes" in t && - (this.outputFaceBlendshapes = !!t.outputFaceBlendshapes), - "minPoseDetectionConfidence" in t && - Ln(this.A, 2, t.minPoseDetectionConfidence ?? 0.5), - "minPoseSuppressionThreshold" in t && - Ln(this.A, 3, t.minPoseSuppressionThreshold ?? 0.3), - "minPosePresenceConfidence" in t && - Ln(this.M, 2, t.minPosePresenceConfidence ?? 0.5), - "outputPoseSegmentationMasks" in t && - (this.outputPoseSegmentationMasks = !!t.outputPoseSegmentationMasks), - "minHandLandmarksConfidence" in t && - Ln(this.I, 2, t.minHandLandmarksConfidence ?? 0.5), - this.l(t) - ); - } - F(t, e, n) { - const r = "function" != typeof e ? e : {}; - return ( - (this.D = "function" == typeof e ? e : n), - Oc(this), - uc(this, t, r), - Nc(this) - ); - } - G(t, e, n, r) { - const i = "function" != typeof n ? n : {}; - return ( - (this.D = "function" == typeof n ? n : r), - Oc(this), - lc(this, t, i, e), - Nc(this) - ); - } - m() { - var t = new ls(); - (hs(t, "input_frames_image"), - us(t, "pose_landmarks"), - us(t, "pose_world_landmarks"), - us(t, "face_landmarks"), - us(t, "left_hand_landmarks"), - us(t, "left_hand_world_landmarks"), - us(t, "right_hand_landmarks"), - us(t, "right_hand_world_landmarks")); - const e = new Qi(), - n = new Bi(); - (Rn( - n, - 1, - "type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions", - ), - (function (t, e) { - if (null != e) - if (Array.isArray(e)) Ze(t, 2, Ie(e, 0, Me)); - else { - if (!("string" == typeof e || e instanceof F || x(e))) - throw Error( - "invalid value in Any.value field: " + - e + - " expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array", - ); - hn(t, 2, ht(e, !1), R()); - } - })(n, this.j.g())); - const r = new is(); - (Rn( - r, - 2, - "mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph", - ), - bn(r, 8, Bi, n), - ns(r, "IMAGE:input_frames_image"), - rs(r, "POSE_LANDMARKS:pose_landmarks"), - rs(r, "POSE_WORLD_LANDMARKS:pose_world_landmarks"), - rs(r, "FACE_LANDMARKS:face_landmarks"), - rs(r, "LEFT_HAND_LANDMARKS:left_hand_landmarks"), - rs(r, "LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"), - rs(r, "RIGHT_HAND_LANDMARKS:right_hand_landmarks"), - rs(r, "RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"), - r.o(e), - cs(t, r), - la(this, t), - this.g.attachProtoListener("pose_landmarks", (t, e) => { - (Uc(t, this.h.poseLandmarks), ua(this, e)); - }), - this.g.attachEmptyPacketListener("pose_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoListener("pose_world_landmarks", (t, e) => { - var n = this.h.poseWorldLandmarks; - ((t = As(t)), n.push(Wo(t)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("pose_world_landmarks", (t) => { - ua(this, t); - }), - this.outputPoseSegmentationMasks && - (rs(r, "POSE_SEGMENTATION_MASK:pose_segmentation_mask"), - fa(this, "pose_segmentation_mask"), - this.g.Z("pose_segmentation_mask", (t, e) => { - ((this.h.poseSegmentationMasks = [fc(this, t, !0, !this.D)]), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("pose_segmentation_mask", (t) => { - ((this.h.poseSegmentationMasks = []), ua(this, t)); - })), - this.g.attachProtoListener("face_landmarks", (t, e) => { - (Uc(t, this.h.faceLandmarks), ua(this, e)); - }), - this.g.attachEmptyPacketListener("face_landmarks", (t) => { - ua(this, t); - }), - this.outputFaceBlendshapes && - (us(t, "extra_blendshapes"), - rs(r, "FACE_BLENDSHAPES:extra_blendshapes"), - this.g.attachProtoListener("extra_blendshapes", (t, e) => { - var n = this.h.faceBlendshapes; - (this.outputFaceBlendshapes && ((t = ys(t)), n.push(jo(t.g() ?? []))), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("extra_blendshapes", (t) => { - ua(this, t); - })), - this.g.attachProtoListener("left_hand_landmarks", (t, e) => { - (Uc(t, this.h.leftHandLandmarks), ua(this, e)); - }), - this.g.attachEmptyPacketListener("left_hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoListener("left_hand_world_landmarks", (t, e) => { - var n = this.h.leftHandWorldLandmarks; - ((t = As(t)), n.push(Wo(t)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("left_hand_world_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoListener("right_hand_landmarks", (t, e) => { - (Uc(t, this.h.rightHandLandmarks), ua(this, e)); - }), - this.g.attachEmptyPacketListener("right_hand_landmarks", (t) => { - ua(this, t); - }), - this.g.attachProtoListener("right_hand_world_landmarks", (t, e) => { - var n = this.h.rightHandWorldLandmarks; - ((t = As(t)), n.push(Wo(t)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("right_hand_world_landmarks", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Dc.prototype.detectForVideo = Dc.prototype.G), - (Dc.prototype.detect = Dc.prototype.F), - (Dc.prototype.setOptions = Dc.prototype.o), - (Dc.createFromModelPath = function (t, e) { - return cc(Dc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Dc.createFromModelBuffer = function (t, e) { - return cc(Dc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Dc.createFromOptions = function (t, e) { - return cc(Dc, t, e); - }), - (Dc.HAND_CONNECTIONS = xc), - (Dc.POSE_CONNECTIONS = Cc), - (Dc.FACE_LANDMARKS_LIPS = gc), - (Dc.FACE_LANDMARKS_LEFT_EYE = mc), - (Dc.FACE_LANDMARKS_LEFT_EYEBROW = yc), - (Dc.FACE_LANDMARKS_LEFT_IRIS = _c), - (Dc.FACE_LANDMARKS_RIGHT_EYE = vc), - (Dc.FACE_LANDMARKS_RIGHT_EYEBROW = Ec), - (Dc.FACE_LANDMARKS_RIGHT_IRIS = wc), - (Dc.FACE_LANDMARKS_FACE_OVAL = Tc), - (Dc.FACE_LANDMARKS_CONTOURS = Ac), - (Dc.FACE_LANDMARKS_TESSELATION = bc)); -var Bc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "input_image", "norm_rect", !0), - (this.j = { classifications: [] }), - wn((t = this.h = new Eo()), 0, 1, (e = new Xs()))); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return (wn(this.h, 0, 2, Bo(t, yn(this.h, Ns, 2))), this.l(t)); - } - sa(t, e) { - return ((this.j = { classifications: [] }), uc(this, t, e), this.j); - } - ta(t, e, n) { - return ((this.j = { classifications: [] }), lc(this, t, n, e), this.j); - } - m() { - var t = new ls(); - (hs(t, "input_image"), hs(t, "norm_rect"), us(t, "classifications")); - const e = new Qi(); - xr(e, wo, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"), - ns(n, "IMAGE:input_image"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "CLASSIFICATIONS:classifications"), - n.o(e), - cs(t, n), - this.g.attachProtoListener("classifications", (t, e) => { - ((this.j = Vo(Is(t))), ua(this, e)); - }), - this.g.attachEmptyPacketListener("classifications", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Bc.prototype.classifyForVideo = Bc.prototype.ta), - (Bc.prototype.classify = Bc.prototype.sa), - (Bc.prototype.setOptions = Bc.prototype.o), - (Bc.createFromModelPath = function (t, e) { - return cc(Bc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Bc.createFromModelBuffer = function (t, e) { - return cc(Bc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Bc.createFromOptions = function (t, e) { - return cc(Bc, t, e); - })); -var Gc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !0), - (this.h = new To()), - (this.embeddings = { embeddings: [] }), - wn((t = this.h), 0, 1, (e = new Xs()))); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - var e = this.h, - n = yn(this.h, Ds, 2); - return ( - (n = n ? n.clone() : new Ds()), - void 0 !== t.l2Normalize - ? Ze(n, 1, Jt(t.l2Normalize)) - : "l2Normalize" in t && Ze(n, 1), - void 0 !== t.quantize - ? Ze(n, 2, Jt(t.quantize)) - : "quantize" in t && Ze(n, 2), - wn(e, 0, 2, n), - this.l(t) - ); - } - za(t, e) { - return (uc(this, t, e), this.embeddings); - } - Aa(t, e, n) { - return (lc(this, t, n, e), this.embeddings); - } - m() { - var t = new ls(); - (hs(t, "image_in"), hs(t, "norm_rect"), us(t, "embeddings_out")); - const e = new Qi(); - xr(e, Ao, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "EMBEDDINGS:embeddings_out"), - n.o(e), - cs(t, n), - this.g.attachProtoListener("embeddings_out", (t, e) => { - ((t = Os(t)), - (this.embeddings = (function (t) { - return { - embeddings: vn(t, Ps, 1).map((t) => { - const e = { - headIndex: kn(t, 3) ?? 0 ?? -1, - headName: le($e(t, 4)) ?? "" ?? "", - }; - var n = t.v; - return ( - void 0 !== mn(n, 0 | n[Q], Fs, ln(t, 1)) - ? ((t = en((t = yn(t, Fs, ln(t, 1), void 0)), 1, $t, tn())), - (e.floatEmbedding = t.slice())) - : ((n = new Uint8Array(0)), - (e.quantizedEmbedding = - yn(t, Ms, ln(t, 2), void 0) - ?.na() - ?.h() ?? n)), - e - ); - }), - timestampMs: Go($e(t, 2, void 0, void 0, ce) ?? Ye), - }; - })(t)), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("embeddings_out", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Gc.cosineSimilarity = function (t, e) { - if (t.floatEmbedding && e.floatEmbedding) - t = Ko(t.floatEmbedding, e.floatEmbedding); - else { - if (!t.quantizedEmbedding || !e.quantizedEmbedding) - throw Error( - "Cannot compute cosine similarity between quantized and float embeddings.", - ); - t = Ko(zo(t.quantizedEmbedding), zo(e.quantizedEmbedding)); - } - return t; -}), - (Gc.prototype.embedForVideo = Gc.prototype.Aa), - (Gc.prototype.embed = Gc.prototype.za), - (Gc.prototype.setOptions = Gc.prototype.o), - (Gc.createFromModelPath = function (t, e) { - return cc(Gc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Gc.createFromModelBuffer = function (t, e) { - return cc(Gc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Gc.createFromOptions = function (t, e) { - return cc(Gc, t, e); - })); -var jc = class { - constructor(t, e, n) { - ((this.confidenceMasks = t), - (this.categoryMask = e), - (this.qualityScores = n)); - } - close() { - (this.confidenceMasks?.forEach((t) => { - t.close(); - }), - this.categoryMask?.close()); - } -}; -function Vc(t) { - const e = (function (t) { - return vn(t, is, 1); - })(t.ca()).filter((t) => - (le($e(t, 1)) ?? "").includes( - "mediapipe.tasks.TensorsToSegmentationCalculator", - ), - ); - if (((t.u = []), e.length > 1)) - throw Error( - "The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.", - ); - 1 === e.length && - (yn(e[0], Qi, 7)?.j()?.g() ?? new Map()).forEach((e, n) => { - t.u[Number(n)] = le($e(e, 1)) ?? ""; - }); -} -function Xc(t) { - ((t.categoryMask = void 0), - (t.confidenceMasks = void 0), - (t.qualityScores = void 0)); -} -function Hc(t) { - try { - const e = new jc(t.confidenceMasks, t.categoryMask, t.qualityScores); - if (!t.j) return e; - t.j(e); - } finally { - da(t); - } -} -jc.prototype.close = jc.prototype.close; -var Wc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !1), - (this.u = []), - (this.outputCategoryMask = !1), - (this.outputConfidenceMasks = !0), - (this.h = new Lo()), - (this.A = new bo()), - wn(this.h, 0, 3, this.A), - wn((t = this.h), 0, 1, (e = new Xs()))); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - void 0 !== t.displayNamesLocale - ? Ze(this.h, 2, ue(t.displayNamesLocale)) - : "displayNamesLocale" in t && Ze(this.h, 2), - "outputCategoryMask" in t && - (this.outputCategoryMask = t.outputCategoryMask ?? !1), - "outputConfidenceMasks" in t && - (this.outputConfidenceMasks = t.outputConfidenceMasks ?? !0), - super.l(t) - ); - } - L() { - Vc(this); - } - segment(t, e, n) { - const r = "function" != typeof e ? e : {}; - return ( - (this.j = "function" == typeof e ? e : n), - Xc(this), - uc(this, t, r), - Hc(this) - ); - } - La(t, e, n, r) { - const i = "function" != typeof n ? n : {}; - return ( - (this.j = "function" == typeof n ? n : r), - Xc(this), - lc(this, t, i, e), - Hc(this) - ); - } - Da() { - return this.u; - } - m() { - var t = new ls(); - (hs(t, "image_in"), hs(t, "norm_rect")); - const e = new Qi(); - xr(e, Ro, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - n.o(e), - cs(t, n), - la(this, t), - this.outputConfidenceMasks && - (us(t, "confidence_masks"), - rs(n, "CONFIDENCE_MASKS:confidence_masks"), - fa(this, "confidence_masks"), - this.g.aa("confidence_masks", (t, e) => { - ((this.confidenceMasks = t.map((t) => fc(this, t, !0, !this.j))), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("confidence_masks", (t) => { - ((this.confidenceMasks = []), ua(this, t)); - })), - this.outputCategoryMask && - (us(t, "category_mask"), - rs(n, "CATEGORY_MASK:category_mask"), - fa(this, "category_mask"), - this.g.Z("category_mask", (t, e) => { - ((this.categoryMask = fc(this, t, !1, !this.j)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("category_mask", (t) => { - ((this.categoryMask = void 0), ua(this, t)); - })), - us(t, "quality_scores"), - rs(n, "QUALITY_SCORES:quality_scores"), - this.g.attachFloatVectorListener("quality_scores", (t, e) => { - ((this.qualityScores = t), ua(this, e)); - }), - this.g.attachEmptyPacketListener("quality_scores", (t) => { - ((this.categoryMask = void 0), ua(this, t)); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Wc.prototype.getLabels = Wc.prototype.Da), - (Wc.prototype.segmentForVideo = Wc.prototype.La), - (Wc.prototype.segment = Wc.prototype.segment), - (Wc.prototype.setOptions = Wc.prototype.o), - (Wc.createFromModelPath = function (t, e) { - return cc(Wc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Wc.createFromModelBuffer = function (t, e) { - return cc(Wc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Wc.createFromOptions = function (t, e) { - return cc(Wc, t, e); - })); -var zc = class { - constructor(t, e, n) { - ((this.confidenceMasks = t), - (this.categoryMask = e), - (this.qualityScores = n)); - } - close() { - (this.confidenceMasks?.forEach((t) => { - t.close(); - }), - this.categoryMask?.close()); - } -}; -zc.prototype.close = zc.prototype.close; -var Kc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect_in", !1), - (this.outputCategoryMask = !1), - (this.outputConfidenceMasks = !0), - (this.h = new Lo()), - (this.u = new bo()), - wn(this.h, 0, 3, this.u), - wn((t = this.h), 0, 1, (e = new Xs()))); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - "outputCategoryMask" in t && - (this.outputCategoryMask = t.outputCategoryMask ?? !1), - "outputConfidenceMasks" in t && - (this.outputConfidenceMasks = t.outputConfidenceMasks ?? !0), - super.l(t) - ); - } - segment(t, e, n, r) { - const i = "function" != typeof n ? n : {}; - if ( - ((this.j = "function" == typeof n ? n : r), - (this.qualityScores = this.categoryMask = this.confidenceMasks = void 0), - (n = this.C + 1), - (r = new Po()), - e.keypoint && e.scribble) - ) - throw Error("Cannot provide both keypoint and scribble."); - if (e.keypoint) { - var s = new Io(); - (hn(s, 3, Jt(!0), !1), - hn(s, 1, qt(e.keypoint.x), 0), - hn(s, 2, qt(e.keypoint.y), 0), - Tn(r, 1, Co, s)); - } else { - if (!e.scribble) - throw Error("Must provide either a keypoint or a scribble."); - { - const t = new Mo(); - for (s of e.scribble) - (hn((e = new Io()), 3, Jt(!0), !1), - hn(e, 1, qt(s.x), 0), - hn(e, 2, qt(s.y), 0), - bn(t, 1, Io, e)); - Tn(r, 2, Co, t); - } - } - (this.g.addProtoToStream( - r.g(), - "mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest", - "roi_in", - n, - ), - uc(this, t, i)); - t: { - try { - const t = new zc( - this.confidenceMasks, - this.categoryMask, - this.qualityScores, - ); - if (!this.j) { - var o = t; - break t; - } - this.j(t); - } finally { - da(this); - } - o = void 0; - } - return o; - } - m() { - var t = new ls(); - (hs(t, "image_in"), hs(t, "roi_in"), hs(t, "norm_rect_in")); - const e = new Qi(); - xr(e, Ro, this.h); - const n = new is(); - (Rn( - n, - 2, - "mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2", - ), - ns(n, "IMAGE:image_in"), - ns(n, "ROI:roi_in"), - ns(n, "NORM_RECT:norm_rect_in"), - n.o(e), - cs(t, n), - la(this, t), - this.outputConfidenceMasks && - (us(t, "confidence_masks"), - rs(n, "CONFIDENCE_MASKS:confidence_masks"), - fa(this, "confidence_masks"), - this.g.aa("confidence_masks", (t, e) => { - ((this.confidenceMasks = t.map((t) => fc(this, t, !0, !this.j))), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("confidence_masks", (t) => { - ((this.confidenceMasks = []), ua(this, t)); - })), - this.outputCategoryMask && - (us(t, "category_mask"), - rs(n, "CATEGORY_MASK:category_mask"), - fa(this, "category_mask"), - this.g.Z("category_mask", (t, e) => { - ((this.categoryMask = fc(this, t, !1, !this.j)), ua(this, e)); - }), - this.g.attachEmptyPacketListener("category_mask", (t) => { - ((this.categoryMask = void 0), ua(this, t)); - })), - us(t, "quality_scores"), - rs(n, "QUALITY_SCORES:quality_scores"), - this.g.attachFloatVectorListener("quality_scores", (t, e) => { - ((this.qualityScores = t), ua(this, e)); - }), - this.g.attachEmptyPacketListener("quality_scores", (t) => { - ((this.categoryMask = void 0), ua(this, t)); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Kc.prototype.segment = Kc.prototype.segment), - (Kc.prototype.setOptions = Kc.prototype.o), - (Kc.createFromModelPath = function (t, e) { - return cc(Kc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Kc.createFromModelBuffer = function (t, e) { - return cc(Kc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Kc.createFromOptions = function (t, e) { - return cc(Kc, t, e); - })); -var Yc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "input_frame_gpu", "norm_rect", !1), - (this.j = { detections: [] }), - wn((t = this.h = new Oo()), 0, 1, (e = new Xs()))); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - void 0 !== t.displayNamesLocale - ? Ze(this.h, 2, ue(t.displayNamesLocale)) - : "displayNamesLocale" in t && Ze(this.h, 2), - void 0 !== t.maxResults - ? xn(this.h, 3, t.maxResults) - : "maxResults" in t && Ze(this.h, 3), - void 0 !== t.scoreThreshold - ? Ln(this.h, 4, t.scoreThreshold) - : "scoreThreshold" in t && Ze(this.h, 4), - void 0 !== t.categoryAllowlist - ? In(this.h, 5, t.categoryAllowlist) - : "categoryAllowlist" in t && Ze(this.h, 5), - void 0 !== t.categoryDenylist - ? In(this.h, 6, t.categoryDenylist) - : "categoryDenylist" in t && Ze(this.h, 6), - this.l(t) - ); - } - F(t, e) { - return ((this.j = { detections: [] }), uc(this, t, e), this.j); - } - G(t, e, n) { - return ((this.j = { detections: [] }), lc(this, t, n, e), this.j); - } - m() { - var t = new ls(); - (hs(t, "input_frame_gpu"), hs(t, "norm_rect"), us(t, "detections")); - const e = new Qi(); - xr(e, No, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.ObjectDetectorGraph"), - ns(n, "IMAGE:input_frame_gpu"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "DETECTIONS:detections"), - n.o(e), - cs(t, n), - this.g.attachProtoVectorListener("detections", (t, e) => { - for (const e of t) ((t = ws(e)), this.j.detections.push(Xo(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("detections", (t) => { - ua(this, t); - }), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Yc.prototype.detectForVideo = Yc.prototype.G), - (Yc.prototype.detect = Yc.prototype.F), - (Yc.prototype.setOptions = Yc.prototype.o), - (Yc.createFromModelPath = async function (t, e) { - return cc(Yc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Yc.createFromModelBuffer = function (t, e) { - return cc(Yc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Yc.createFromOptions = function (t, e) { - return cc(Yc, t, e); - })); -var qc = class { - constructor(t, e, n) { - ((this.landmarks = t), - (this.worldLandmarks = e), - (this.segmentationMasks = n)); - } - close() { - this.segmentationMasks?.forEach((t) => { - t.close(); - }); - } -}; -function $c(t) { - ((t.landmarks = []), (t.worldLandmarks = []), (t.segmentationMasks = void 0)); -} -function Jc(t) { - try { - const e = new qc(t.landmarks, t.worldLandmarks, t.segmentationMasks); - if (!t.u) return e; - t.u(e); - } finally { - da(t); - } -} -qc.prototype.close = qc.prototype.close; -var Zc = class extends dc { - constructor(t, e) { - (super(new ac(t, e), "image_in", "norm_rect", !1), - (this.landmarks = []), - (this.worldLandmarks = []), - (this.outputSegmentationMasks = !1), - wn((t = this.h = new Uo()), 0, 1, (e = new Xs())), - (this.A = new mo()), - wn(this.h, 0, 3, this.A), - (this.j = new go()), - wn(this.h, 0, 2, this.j), - xn(this.j, 4, 1), - Ln(this.j, 2, 0.5), - Ln(this.A, 2, 0.5), - Ln(this.h, 4, 0.5)); - } - get baseOptions() { - return yn(this.h, Xs, 1); - } - set baseOptions(t) { - wn(this.h, 0, 1, t); - } - o(t) { - return ( - "numPoses" in t && xn(this.j, 4, t.numPoses ?? 1), - "minPoseDetectionConfidence" in t && - Ln(this.j, 2, t.minPoseDetectionConfidence ?? 0.5), - "minTrackingConfidence" in t && - Ln(this.h, 4, t.minTrackingConfidence ?? 0.5), - "minPosePresenceConfidence" in t && - Ln(this.A, 2, t.minPosePresenceConfidence ?? 0.5), - "outputSegmentationMasks" in t && - (this.outputSegmentationMasks = t.outputSegmentationMasks ?? !1), - this.l(t) - ); - } - F(t, e, n) { - const r = "function" != typeof e ? e : {}; - return ( - (this.u = "function" == typeof e ? e : n), - $c(this), - uc(this, t, r), - Jc(this) - ); - } - G(t, e, n, r) { - const i = "function" != typeof n ? n : {}; - return ( - (this.u = "function" == typeof n ? n : r), - $c(this), - lc(this, t, i, e), - Jc(this) - ); - } - m() { - var t = new ls(); - (hs(t, "image_in"), - hs(t, "norm_rect"), - us(t, "normalized_landmarks"), - us(t, "world_landmarks"), - us(t, "segmentation_masks")); - const e = new Qi(); - xr(e, Do, this.h); - const n = new is(); - (Rn(n, 2, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), - ns(n, "IMAGE:image_in"), - ns(n, "NORM_RECT:norm_rect"), - rs(n, "NORM_LANDMARKS:normalized_landmarks"), - rs(n, "WORLD_LANDMARKS:world_landmarks"), - n.o(e), - cs(t, n), - la(this, t), - this.g.attachProtoVectorListener("normalized_landmarks", (t, e) => { - this.landmarks = []; - for (const e of t) ((t = ks(e)), this.landmarks.push(Ho(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("normalized_landmarks", (t) => { - ((this.landmarks = []), ua(this, t)); - }), - this.g.attachProtoVectorListener("world_landmarks", (t, e) => { - this.worldLandmarks = []; - for (const e of t) ((t = As(e)), this.worldLandmarks.push(Wo(t))); - ua(this, e); - }), - this.g.attachEmptyPacketListener("world_landmarks", (t) => { - ((this.worldLandmarks = []), ua(this, t)); - }), - this.outputSegmentationMasks && - (rs(n, "SEGMENTATION_MASK:segmentation_masks"), - fa(this, "segmentation_masks"), - this.g.aa("segmentation_masks", (t, e) => { - ((this.segmentationMasks = t.map((t) => fc(this, t, !0, !this.u))), - ua(this, e)); - }), - this.g.attachEmptyPacketListener("segmentation_masks", (t) => { - ((this.segmentationMasks = []), ua(this, t)); - })), - (t = t.g()), - this.setGraph(new Uint8Array(t), !0)); - } -}; -((Zc.prototype.detectForVideo = Zc.prototype.G), - (Zc.prototype.detect = Zc.prototype.F), - (Zc.prototype.setOptions = Zc.prototype.o), - (Zc.createFromModelPath = function (t, e) { - return cc(Zc, t, { baseOptions: { modelAssetPath: e } }); - }), - (Zc.createFromModelBuffer = function (t, e) { - return cc(Zc, t, { baseOptions: { modelAssetBuffer: e } }); - }), - (Zc.createFromOptions = function (t, e) { - return cc(Zc, t, e); - }), - (Zc.POSE_CONNECTIONS = Cc)); -export { - Ka as DrawingUtils, - pc as FaceDetector, - Sc as FaceLandmarker, - Zo as FilesetResolver, - Fc as GestureRecognizer, - Pc as HandLandmarker, - Dc as HolisticLandmarker, - Bc as ImageClassifier, - Gc as ImageEmbedder, - Wc as ImageSegmenter, - jc as ImageSegmenterResult, - Kc as InteractiveSegmenter, - zc as InteractiveSegmenterResult, - nc as MPImage, - Na as MPMask, - Yc as ObjectDetector, - Zc as PoseLandmarker, - pa as TaskRunner, - dc as VisionTaskRunner, -}; +var t="undefined"!=typeof self?self:{};function e(e,n){t:{for(var r=["CLOSURE_FLAGS"],i=t,s=0;s>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i=56320&&s<=57343){e=1024*(e-55296)+s-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}function u(e){t.setTimeout((()=>{throw e}),0)}var l,f=e(610401301,!1),d=e(748402147,!0);function p(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}const g=t.navigator;function m(t){return m[" "](t),t}l=g&&g.userAgentData||null,m[" "]=function(){};const y={};let _=null;function v(t){const e=t.length;let n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r>4),64!=i&&(e(r<<4&240|i>>2),64!=s&&e(i<<6&192|s))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function E(){if(!_){_={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));y[n]=r;for(let t=0;t0)&&(-1!=p().indexOf("Trident")||-1!=p().indexOf("MSIE")))&&"function"==typeof btoa;const A=/[-_.]/g,b={"-":"+",_:"/",".":"="};function k(t){return b[t]||""}function S(t){if(!T)return v(t);t=A.test(t)?t.replace(A,k):t,t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n=e||(n[t]=r+1,O(t=Error(),"incident"),u(t))}}function D(){return"function"==typeof BigInt}var B="function"==typeof Symbol&&"symbol"==typeof Symbol();function G(t,e,n=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?n&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var j=G("jas",void 0,!0),V=G(void 0,"0di"),X=G(void 0,"1oa"),H=G(void 0,Symbol()),W=G(void 0,"0ub"),z=G(void 0,"0ubs"),K=G(void 0,"0ubsb"),Y=G(void 0,"0actk"),q=G("m_m","Pa",!0),$=G();const J={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Z=Object.defineProperties,Q=B?j:"Ga";var tt;const et=[];function nt(t,e){B||Q in t||Z(t,J),t[Q]|=e}function rt(t,e){B||Q in t||Z(t,J),t[Q]=e}function it(t){return nt(t,34),t}function st(t){return nt(t,8192),t}rt(et,7),tt=Object.freeze(et);var ot={};function at(t,e){return void 0===e?t.h!==ct&&!!(2&(0|t.v[Q])):!!(2&e)&&t.h!==ct}const ct={};function ht(t,e){if(null!=t)if("string"==typeof t)t=t?new F(t,L):R();else if(t.constructor!==F)if(x(t))t=t.length?new F(new Uint8Array(t),L):R();else{if(!e)throw Error();t=void 0}return t}class ut{constructor(t,e,n){this.g=t,this.h=e,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var lt=Object.freeze({});function ft(t,e,n){const r=128&e?0:-1,i=t.length;var s;(s=!!i)&&(s=null!=(s=t[i-1])&&"object"==typeof s&&s.constructor===Object);const o=i+(s?-1:0);for(e=128&e?1:0;e"number"==typeof t)),yt=gt((t=>"string"==typeof t)),_t=gt((t=>"boolean"==typeof t)),vt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function Et(t){var e=t;if(yt(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(mt(e)&&!Number.isSafeInteger(e))throw Error(String(e));return vt?BigInt(t):t=_t(t)?t?"1":"0":yt(t)?t.trim()||"0":String(t)}var wt=gt((t=>vt?t>=At&&t<=kt:"-"===t[0]?St(t,Tt):St(t,bt)));const Tt=Number.MIN_SAFE_INTEGER.toString(),At=vt?BigInt(Number.MIN_SAFE_INTEGER):void 0,bt=Number.MAX_SAFE_INTEGER.toString(),kt=vt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function St(t,e){if(t.length>e.length)return!1;if(t.lengthi)return!1;if(r>>0;Rt=e,It=(t-e)/4294967296>>>0}function Mt(t){if(t<0){Ft(-t);const[e,n]=jt(Rt,It);Rt=e>>>0,It=n>>>0}else Ft(t)}function Pt(t){const e=Lt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),It=0,Rt=e.getUint32(0,!0)}function Ct(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ut(t,e)}function Ot(t,e){return Et(D()?BigInt.asUintN(64,(BigInt(e>>>0)<>>0)):Ut(t,e))}function Nt(t,e){return D()?Et(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else D()?n=""+(BigInt(e)<>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+Dt(n)+Dt(t));return n}function Dt(t){return t=String(t),"0000000".slice(t.length)+t}function Bt(t,e){if(2147483648&e)if(D())t=""+(BigInt(0|e)<>>0));else{const[n,r]=jt(t,e);t="-"+Ut(n,r)}else t=Ut(t,e);return t}function Gt(t){if(t.length<16)Mt(Number(t));else if(D())t=BigInt(t),Rt=Number(t&BigInt(4294967295))>>>0,It=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);It=Rt=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));It*=1e6,Rt=1e6*Rt+e,Rt>=4294967296&&(It+=Math.trunc(Rt/4294967296),It>>>=0,Rt>>>=0)}if(e){const[t,e]=jt(Rt,It);Rt=t,It=e}}}function jt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Vt(t){return Array.prototype.slice.call(t)}const Xt="function"==typeof BigInt?BigInt.asIntN:void 0,Ht="function"==typeof BigInt?BigInt.asUintN:void 0,Wt=Number.isSafeInteger,zt=Number.isFinite,Kt=Math.trunc,Yt=Et(0);function qt(t){if(null!=t&&"number"!=typeof t)throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);return t}function $t(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Jt(t){if(null!=t&&"boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}function Zt(t){return null==t||"boolean"==typeof t?t:"number"==typeof t?!!t:void 0}const Qt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function te(t){switch(typeof t){case"bigint":return!0;case"number":return zt(t);case"string":return Qt.test(t);default:return!1}}function ee(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return zt(t)?0|t:void 0}function ne(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return zt(t)?t>>>0:void 0}function re(t){const e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(Gt(t),Bt(Rt,It))}function ie(t){if(t=Kt(t),!Wt(t)){Mt(t);var e=Rt,n=It;(t=2147483648&n)&&(n=~n>>>0,0==(e=1+~e>>>0)&&(n=n+1>>>0)),t="number"==typeof(e=Ct(e,n))?t?-e:e:t?"-"+e:e}return t}function se(t){var e=Kt(Number(t));return Wt(e)?String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),re(t))}function oe(t){var e=Kt(Number(t));return Wt(e)?Et(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),D()?Et(Xt(64,BigInt(t))):Et(re(t)))}function ae(t){return Wt(t)?t=Et(ie(t)):(t=Kt(t),Wt(t)?t=String(t):(Mt(t),t=Bt(Rt,It)),t=Et(t)),t}function ce(t){const e=typeof t;return null==t?t:"bigint"===e?Et(Xt(64,t)):te(t)?"string"===e?oe(t):ae(t):void 0}function he(t){if("string"!=typeof t)throw Error();return t}function ue(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function le(t){return null==t||"string"==typeof t?t:void 0}function fe(t,e,n,r){return null!=t&&t[q]===ot?t:Array.isArray(t)?((r=(n=0|t[Q])|32&r|2&r)!==n&&rt(t,r),new e(t)):(n?2&r?((t=e[V])||(it((t=new e).v),t=e[V]=t),e=t):e=new e:e=void 0,e)}function de(t,e,n){if(e)t:{if(!te(e=t))throw N("int64");switch(typeof e){case"string":e=oe(e);break t;case"bigint":e=Et(Xt(64,e));break t;default:e=ae(e)}}else e=ce(t);return null==(t=e)?n?Yt:void 0:t}const pe={};let ge=function(){try{return m(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class me{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,e){return this.g.set(t,e),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}[Symbol.iterator](){return this.entries()}}const ye=ge?(Object.setPrototypeOf(me.prototype,Map.prototype),Object.defineProperties(me.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),me):class extends Map{constructor(){super()}};function _e(t){return t}function ve(t){if(2&t.J)throw Error("Cannot mutate an immutable Map")}var Ee=class extends ye{constructor(t,e,n=_e,r=_e){super(),this.J=0|t[Q],this.K=e,this.S=n,this.fa=this.K?we:r;for(let i=0;i{t.call(e,i.get(r),r,i)})):super.forEach(t,e)}set(t,e){return ve(this),null==(t=this.S(t,!0,!1))?this:null==e?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?void 0===t?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(void 0!==e){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function we(t,e,n,r,i,s){return t=fe(t,r,n,s),i&&(t=Xe(t)),t}function Te(t){return[t,this.get(t)]}let Ae;function be(){return Ae||=new Ee(it([]),void 0,void 0,void 0,pe)}function ke(t){return H?t[H]:void 0}function Se(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}Ee.prototype.toJSON=void 0;var xe=class{};const Le={Ka:!0};function Re(t,e){e<100||U(z,1)}function Ie(t,e,n,r){const i=void 0!==r;r=!!r;var s,o=H;!i&&B&&o&&(s=t[o])&&Se(s,Re),o=[];var a=t.length;let c;s=4294967295;let h=!1;const u=!!(64&e),l=u?128&e?0:-1:void 0;1&e||(c=a&&t[a-1],null!=c&&"object"==typeof c&&c.constructor===Object?s=--a:c=void 0,!u||128&e||i||(h=!0,s=s-l+l)),e=void 0;for(var f=0;f=s){const t=f-l;(e??={})[t]=i}else o[f]=i}if(c)for(let t in c){if(null==(a=c[t])||null==(a=n(a,r)))continue;let i;f=+t,u&&!Number.isNaN(f)&&(i=f+l){e[n]=Vt(r)})),e.da=t.da,e}(t)),o}function Fe(t){return t[0]=Me(t[0]),t[1]=Me(t[1]),t}function Me(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return wt(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[Q];return 0===t.length&&1&e?void 0:Ie(t,e,Me)}if(null!=t&&t[q]===ot)return Oe(t);if(t instanceof F){if(null==(e=t.g))t="";else if("string"==typeof e)t=e;else{if(T){for(var n="",r=0,i=e.length-10240;r>2];s=n[(3&s)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+s+o+a}switch(c=0,a=i,e.length-t){case 2:a=n[(15&(c=e[t+1]))<<2]||i;case 1:e=e[t],r[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+i}e=r.join("")}t=t.g=e}return t}return t instanceof Ee?t=0!==t.size?t.V(Fe):void 0:void 0}return t}let Pe,Ce;function Oe(t){return Ie(t=t.v,0|t[Q],Me)}function Ne(t,e){return Ue(t,e[0],e[1])}function Ue(t,e,n,r=0){if(null==t){var i=32;n?(t=[n],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(i=0|t[Q],d&&1&i)throw Error("rfarr");if(2048&i&&!(2&i)&&function(){if(d)throw Error("carr");U(Y,5)}(),256&i)throw Error("farr");if(64&i)return(i|r)!==i&&rt(t,i|r),t;if(n&&(i|=128,n!==t[0]))throw Error("mid");t:{i|=64;var s=(n=t).length;if(s){var o=s-1;const t=n[o];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((o-=e=128&i?0:-1)>=1024)throw Error("pvtlmt");for(var a in t)(s=+a)1024)throw Error("spvt");i=-16760833&i|(1023&a)<<14}}}return rt(t,64|i|r),t}function De(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var n=0|t[Q];return 0===t.length&&1&n?void 0:Be(t,n,e)}if(null!=t&&t[q]===ot)return je(t);if(t instanceof Ee){if(2&(e=t.J))return t;if(!t.size)return;if(n=it(t.V()),t.K)for(t=0;t=s)if(o=t[s],null!=o&&"object"==typeof o&&o.constructor===Object)n=o[e],a=!0;else{if(i!==s)return;n=o}else n=t[i];if(r&&null!=n){if(null==(r=r(n)))return r;if(!Object.is(r,n))return a?o[e]=r:t[i]=r,r}return n}}function Ze(t,e,n,r){We(t),Qe(t=t.v,0|t[Q],e,n,r)}function Qe(t,e,n,r,i){const s=n+(i?0:-1);var o=t.length-1;if(o>=1+(i?0:-1)&&s>=o){const i=t[o];if(null!=i&&"object"==typeof i&&i.constructor===Object)return i[n]=r,e}return s<=o?(t[s]=r,e):(void 0!==r&&(n>=(o=(e??=0|t[Q])>>14&1023||536870912)?null!=r&&(t[o+(i?0:-1)]={[n]:r}):t[s]=r),e)}function tn(){return void 0===lt?2:4}function en(t,e,n,r,i){let s=t.v,o=0|s[Q];r=at(t,o)?1:r,i=!!i||3===r,2===r&&He(t)&&(s=t.v,o=0|s[Q]);let a=(t=rn(s,e))===tt?7:0|t[Q],c=sn(a,o);var h=!(4&c);if(h){4&c&&(t=Vt(t),a=0,c=An(c,o),o=Qe(s,o,e,t));let r=0,i=0;for(;r{const r=fe(t,n,!1,e);return s=r!==t&&null!=r,r}))))return s&&!at(r)&&ze(t,e),r}function yn(t,e,n,r){let i=t.v,s=0|i[Q];if(null==(e=mn(i,s,e,n,r)))return e;if(s=0|i[Q],!at(t,s)){const o=Xe(e);o!==e&&(He(t)&&(i=t.v,s=0|i[Q]),s=Qe(i,s,n,e=o,r),ze(i,s))}return e}function _n(t,e,n,r,i,s,o,a){var c=at(t,n);s=c?1:s,o=!!o||3===s,c=a&&!c,(2===s||c)&&He(t)&&(n=0|(e=t.v)[Q]);var h=(t=rn(e,i))===tt?7:0|t[Q],u=sn(h,n);if(a=!(4&u)){var l=t,f=n;const e=!!(2&u);e&&(f|=2);let i=!e,s=!0,o=0,a=0;for(;o32)for(i|=(127&n)>>4,s=3;s<32&&128&n;s+=7)n=o[a++],i|=(127&n)<>>0,i>>>0);throw Error()}function On(t){let e=0,n=t.g;const r=n+10,i=t.h;for(;n>>0}function Dn(t){var e=t.h;const n=t.g;var r=e[n],i=e[n+1];const s=e[n+2];return e=e[n+3],Gn(t,t.g+4),t=2*((i=(r<<0|i<<8|s<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function Bn(t){return Nn(t)}function Gn(t,e){if(t.g=e,e>t.l)throw Error()}function jn(t,e){if(e<0)throw Error();const n=t.g;if((e=n+e)>t.l)throw Error();return t.g=e,n}function Vn(t,e){if(0==e)return R();var n=jn(t,e);return t.Y&&t.j?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):xt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?R():new F(n,L)}var Xn=[];function Hn(t,e,n,r){if(Qn.length){const i=Qn.pop();return i.o(r),i.g.init(t,e,n,r),i}return new Zn(t,e,n,r)}function Wn(t){t.g.clear(),t.l=-1,t.h=-1,Qn.length<100&&Qn.push(t)}function zn(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Un(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Error();if(e<1)throw Error();return t.l=e,t.h=n,!0}function Kn(t){switch(t.h){case 0:0!=t.h?Kn(t):On(t.g);break;case 1:Gn(t=t.g,t.g+8);break;case 2:if(2!=t.h)Kn(t);else{var e=Un(t.g);Gn(t=t.g,t.g+e)}break;case 5:Gn(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!zn(t))throw Error();if(4==t.h){if(t.l!=e)throw Error();break}Kn(t)}break;default:throw Error()}}function Yn(t,e,n){const r=t.g.l;var i=Un(t.g);let s=(i=t.g.g+i)-r;if(s<=0&&(t.g.l=i,n(e,t,void 0,void 0,void 0),s=i-t.g.g),s)throw Error();return t.g.g=i,t.g.l=r,e}function qn(t){var e=Un(t.g),a=jn(t=t.g,e);if(t=t.h,o){var c,h=t;(c=s)||(c=s=new TextDecoder("utf-8",{fatal:!0})),e=a+e,h=0===a&&e===h.length?h:h.subarray(a,e);try{var u=c.decode(h)}catch(t){if(void 0===i){try{c.decode(new Uint8Array([128]))}catch(t){}try{c.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(s=void 0),t}}else{e=(u=a)+e,a=[];let i,s=null;for(;u=e?n():(i=t[u++],l<194||128!=(192&i)?(u--,n()):a.push((31&l)<<6|63&i)):l<240?u>=e-1?n():(i=t[u++],128!=(192&i)||224===l&&i<160||237===l&&i>=160||128!=(192&(c=t[u++]))?(u--,n()):a.push((15&l)<<12|(63&i)<<6|63&c)):l<=244?u>=e-2?n():(i=t[u++],128!=(192&i)||i-144+(l<<28)>>30!=0||128!=(192&(c=t[u++]))||128!=(192&(h=t[u++]))?(u--,n()):(l=(7&l)<<18|(63&i)<<12|(63&c)<<6|63&h,l-=65536,a.push(55296+(l>>10&1023),56320+(1023&l)))):n(),a.length>=8192&&(s=r(s,a),a.length=0)}u=r(s,a)}return u}function $n(t){const e=Un(t.g);return Vn(t.g,e)}function Jn(t,e,n){var r=Un(t.g);for(r=t.g.g+r;t.g.g>>0,this.g=e>>>0}};let nr;function rr(t){return t?/^-?\d+$/.test(t)?(Gt(t),new ir(Rt,It)):null:sr||=new ir(0,0)}var ir=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let sr;function or(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function ar(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function cr(t,e){if(e>=0)ar(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function hr(t){var e=Rt;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function ur(t,e){0!==e.length&&(t.l.push(e),t.h+=e.length)}function lr(t,e,n){ar(t.g,8*e+n)}function fr(t,e){return lr(t,e,2),e=t.g.end(),ur(t,e),e.push(t.h),e}function dr(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function pr(t,e,n){lr(t,e,2),ar(t.g,n.length),ur(t,t.g.end()),ur(t,n)}function gr(t,e,n,r){null!=n&&(e=fr(t,e),r(n,t),dr(t,e))}function mr(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var yr=mr(),_r=mr(),vr=mr(),Er=mr(),wr=mr(),Tr=mr(),Ar=mr(),br=mr(),kr=mr(),Sr=mr();function xr(t,e,n){var r=t.v;H&&H in r&&(r=r[H])&&delete r[e.g],e.h?e.j(t,e.h,e.g,n,e.l):e.j(t,e.g,n,e.l)}var Lr=class{constructor(t,e){this.v=Ue(t,e,void 0,2048)}toJSON(){return Oe(this)}j(){var t=xo,e=this.v,n=t.g,r=H;if(B&&r&&null!=e[r]?.[n]&&U(W,3),e=t.g,$&&H&&void 0===$&&(r=(n=this.v)[H])&&(r=r.da))try{r(n,e,Le)}catch(t){u(t)}return t.h?t.m(this,t.h,t.g,t.l):t.m(this,t.g,t.defaultValue,t.l)}clone(){const t=this.v,e=0|t[Q];return Ke(this,t,e)?Ge(this,t,!0):new this.constructor(Ve(t,e,!1))}};Lr.prototype[q]=ot,Lr.prototype.toString=function(){return this.v.toString()};var Rr=class{constructor(t,e,n){this.g=t,this.h=e,t=yr,this.l=!!t&&n===t||!1}};function Ir(t,e){return new Rr(t,e,yr)}function Fr(t,e,n,r,i){gr(t,n,Xr(e,r),i)}const Mr=Ir((function(t,e,n,r,i){return 2===t.h&&(Yn(t,gn(e,r,n),i),!0)}),Fr),Pr=Ir((function(t,e,n,r,i){return 2===t.h&&(Yn(t,gn(e,r,n),i),!0)}),Fr);var Cr=Symbol(),Or=Symbol(),Nr=Symbol(),Ur=Symbol(),Dr=Symbol();let Br,Gr;function jr(t,e,n,r){var i=r[t];if(i)return i;(i={}).qa=r,i.T=function(t){switch(typeof t){case"boolean":return Pe||=[0,void 0,!0];case"number":return t>0?void 0:0===t?Ce||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(r[0]);var s=r[1];let o=1;s&&s.constructor===Object&&(i.ba=s,"function"==typeof(s=r[++o])&&(i.ma=!0,Br??=s,Gr??=r[o+1],s=r[o+=2]));const a={};for(;s&&Array.isArray(s)&&s.length&&"number"==typeof s[0]&&s[0]>0;){for(var c=0;ci(t,e,n,r):i}function Wr(t,e,n,r,i){const s=n.g;let o,a;t[e]=(t,e,n)=>s(t,e,n,a||=jr(Or,Hr,Wr,r).T,o||=zr(r),i)}function zr(t){let e=t[Nr];if(null!=e)return e;const n=jr(Or,Hr,Wr,t);return e=n.ma?(t,e)=>Br(t,e,n):(t,e)=>{for(;zn(e)&&4!=e.h;){var r=e.l,i=n[r];if(null==i){var s=n.ba;s&&(s=s[r])&&(null!=(s=Yr(s))&&(i=n[r]=s))}if(null==i||!i(e,t,r)){if(i=(s=e).m,Kn(s),s.ha)var o=void 0;else o=s.g.g-i,s.g.g=i,o=Vn(s.g,o);i=void 0,s=t,o&&((i=s[H]??(s[H]=new xe))[r]??(i[r]=[])).push(o)}}return(t=ke(t))&&(t.da=n.qa[Dr]),!0},t[Nr]=e,t[Dr]=Kr.bind(t),e}function Kr(t,e,n,r){var i=this[Or];const s=this[Nr],o=Ne(void 0,i.T),a=ke(t);if(a){var c=!1,h=i.ba;if(h){if(i=(e,n,i)=>{if(0!==i.length)if(h[n])for(const t of i){e=Hn(t);try{c=!0,s(o,e)}finally{Wn(e)}}else r?.(t,n,i)},null==e)Se(a,i);else if(null!=a){const t=a[e];t&&i(a,e,t)}if(c){let r=0|t[Q];if(2&r&&2048&r&&!n?.Ka)throw Error();const i=pt(r),s=(e,s)=>{if(null!=Je(t,e,i)){if(1===n?.Qa)return;throw Error()}null!=s&&(r=Qe(t,r,e,s,i)),delete a[e]};null==e?ft(o,0|o[Q],((t,e)=>{s(t,e)})):s(e,Je(o,e,i))}}}}function Yr(t){const e=(t=Vr(t))[0].g;if(t=t[1]){const n=zr(t),r=jr(Or,Hr,Wr,t).T;return(t,i,s)=>e(t,i,s,r,n)}return e}function qr(t,e,n){t[e]=n.h}function $r(t,e,n,r){let i,s;const o=n.h;t[e]=(t,e,n)=>o(t,e,n,s||=jr(Cr,qr,$r,r).T,i||=Jr(r))}function Jr(t){let e=t[Ur];if(!e){const n=jr(Cr,qr,$r,t);e=(t,e)=>Zr(t,e,n),t[Ur]=e}return e}function Zr(t,e,n){ft(t,0|t[Q],((t,r)=>{if(null!=r){var i=function(t,e){var n=t[e];if(n)return n;if((n=t.ba)&&(n=n[e])){var r=(n=Vr(n))[0].h;if(n=n[1]){const e=Jr(n),i=jr(Cr,qr,$r,n).T;n=t.ma?Gr(i,e):(t,n,s)=>r(t,n,s,i,e)}else n=r;return t[e]=n}}(n,t);i?i(e,r,t):t<500||U(K,3)}})),(t=ke(t))&&Se(t,((t,n,r)=>{for(ur(e,e.g.end()),t=0;t{gr(t,n,Ne([s,e],r),i)}));else if(Array.isArray(e)){for(let s=0;s>BigInt(32))),or(t.g,n.h,n.g);break;default:n=rr(e),or(t.g,n.h,n.g)}}}function ai(t,e,n){null!=(e=ee(e))&&null!=e&&(lr(t,n,0),cr(t.g,e))}function ci(t,e,n){null!=(e=Zt(e))&&(lr(t,n,0),t.g.g.push(e?1:0))}function hi(t,e,n){null!=(e=le(e))&&pr(t,n,h(e))}function ui(t,e,n,r,i){gr(t,n,Xr(e,r),i)}function li(t,e,n){null!=(e=null==e||"string"==typeof e||e instanceof F?e:void 0)&&pr(t,n,Pn(e,!0).buffer)}function fi(t,e,n){null!=(e=ne(e))&&null!=e&&(lr(t,n,0),ar(t.g,e))}function di(t,e,n){return(5===t.h||2===t.h)&&(e=un(e,0|e[Q],n),2==t.h?Jn(t,Dn,e):e.push(Dn(t.g)),!0)}var pi=ei((function(t,e,n){return 5===t.h&&(ri(e,n,Dn(t.g)),!0)}),si,br),gi=ni(di,(function(t,e,n){if(null!=(e=ti($t,e)))for(let o=0;o=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),(e="-"!==t[0]&&((e=t.length)<20||20===e&&t<="18446744073709551615"))||(Gt(t),t=Ut(Rt,It))),t;if("number"===e)return(t=Kt(t))>=0&&Wt(t)||(Mt(t),t=Ct(Rt,It)),t}}(e),null!=e){if("string"==typeof e)tr(e);if(null!=e)switch(lr(t,n,0),typeof e){case"number":t=t.g,Mt(e),or(t,Rt,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new er(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),or(t.g,n.h,n.g);break;default:n=tr(e),or(t.g,n.h,n.g)}}}),Ar),wi=ei((function(t,e,n){return 0===t.h&&(ri(e,n,Nn(t.g)),!0)}),ai,Er),Ti=ni((function(t,e,n){return(0===t.h||2===t.h)&&(e=un(e,0|e[Q],n),2==t.h?Jn(t,Nn,e):e.push(Nn(t.g)),!0)}),(function(t,e,n){if(null!=(e=ti(ee,e))&&e.length){n=fr(t,n);for(let n=0;n{{const s={ea:!0};r&&Object.assign(s,r),n=Hn(n,void 0,void 0,s);try{const r=new t,s=r.v;zr(e)(s,n);var i=r}finally{Wn(n)}}return i}}function Di(t){return function(){const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};Zr(this.v,e,jr(Cr,qr,$r,t)),ur(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,i=r.length;let s=0;for(let t=0;tt;t=Vi.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=ji)?e.createScriptURL(t):t,new class{constructor(t){this.g=t}toString(){return this.g+""}}(t)}function Hi(t,...e){if(0===e.length)return Xi(t[0]);let n=t[0];for(let r=0;r({index:kn(t,1)??0??-1,score:Sn(t,2)??0,categoryName:le($e(t,3))??""??"",displayName:le($e(t,4))??""??""}))),headIndex:e,headName:n}}function Vo(t){const e={classifications:vn(t,Rs,1).map((t=>jo(yn(t,gs,4)?.g()??[],kn(t,2)??0,le($e(t,3))??"")))};return null!=function(t){return null==t?t:"bigint"==typeof t?(wt(t)?t=Number(t):(t=Xt(64,t),t=wt(t)?Number(t):String(t)),t):te(t)?"number"==typeof t?ie(t):se(t):void 0}($e(t,2,void 0,void 0,ce))&&(e.timestampMs=Go($e(t,2,void 0,void 0,ce)??Ye)),e}function Xo(t){var e=en(t,3,$t,tn()),n=en(t,2,ee,tn()),r=en(t,1,le,tn()),i=en(t,9,le,tn());const s={categories:[],keypoints:[]};for(let t=0;tt>127?t-256:t))}function Ko(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,i=0;for(let s=0;s=1&&Number(t[1])>=17))}async function ta(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{const e=self.import;e?await e(t.toString()):await import(t.toString())}}}function ea(t){return void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function na(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function ra(t,e,n){if(!t.i.canvas)throw Error("No OpenGL canvas configured.");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext("webgl2")||t.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,i]=ea(e);return!t.l||r===t.i.canvas.width&&i===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=i),[r,i]}function ia(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let n=0;n>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function sa(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function oa(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}Zo.forVisionTasks=function(t,e=!1){return Jo("vision",t??Hi``,e)},Zo.forTextTasks=function(t,e=!1){return Jo("text",t??Hi``,e)},Zo.forGenAiTasks=function(t,e=!1){return Jo("genai",t??Hi``,e)},Zo.forAudioTasks=function(t,e=!1){return Jo("audio",t??Hi``,e)},Zo.isSimdSupported=function(t=!1){return $o(t)};async function aa(t,e,n,r){return t=await(async(t,e,n,r,i)=>{if(e&&await ta(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await ta(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,r)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:t=>t.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&t.endsWith(".data")?n.assetBinaryPath.toString():t}),await t.o(r),t}function ca(t,e){const n=yn(t.baseOptions,Vs,1)||new Vs;"string"==typeof e?(Ze(n,2,ue(e)),Ze(n,1)):e instanceof Uint8Array&&(Ze(n,1,ht(e,!1)),Ze(n,2)),wn(t.baseOptions,0,1,n)}function ha(t){try{const e=t.H.length;if(1===e)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map((t=>t.message)).join(", "))}finally{t.H=[]}}function ua(t,e){t.C=Math.max(t.C,e)}function la(t,e){t.B=new is,Rn(t.B,2,"PassThroughCalculator"),ns(t.B,"free_memory"),rs(t.B,"free_memory_unused_out"),hs(e,"free_memory"),cs(e,t.B)}function fa(t,e){ns(t.B,e),rs(t.B,e+"_unused_out")}function da(t){t.g.addBoolToStream(!0,"free_memory",t.C)}var pa=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){if(e){const e=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(yn(this.baseOptions,Vs,1)?.g()||yn(this.baseOptions,Vs,1)?.l()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=yn(t.baseOptions,Gs,3);if(!n){var r=n=new Gs,i=new $i;Tn(r,4,js,i)}"delegate"in e&&("GPU"===e.delegate?(e=n,r=new zi,Tn(e,2,js,r)):(e=n,r=new $i,Tn(e,4,js,r))),wn(t.baseOptions,0,3,n)}(this,e),e.modelAssetPath)return fetch(e.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${e.modelAssetPath} (${t.status})`)})).then((t=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(t),!0,!1,!1),ca(this,"/model.dat"),this.m(),this.L()}));if(e.modelAssetBuffer instanceof Uint8Array)ca(this,e.modelAssetBuffer);else if(e.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;return t}(e.modelAssetBuffer).then((t=>{ca(this,t),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca((e=>{t=ds(e)})),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.H.push(Error(e))})),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,ha(this)}finishProcessing(){this.g.finishProcessing(),ha(this)}close(){this.B=void 0,this.g.closeGraph()}};function ga(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}pa.prototype.close=pa.prototype.close;class ma{constructor(t,e,n,r){this.g=t,this.h=e,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function ya(t,e,n){const r=t.g;if(n=ga(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function _a(t,e){const n=t.g,r=ga(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const i=ga(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.O),n.vertexAttribPointer(t.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const s=ga(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.L),n.vertexAttribPointer(t.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new ma(n,r,i,s)}function va(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function Ea(t,e,n,r){return va(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=_a(t,!0)),n=t.u):(t.A||(t.A=_a(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function wa(t,e,n){return va(t,e),t=ga(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function Ta(t,e,n){va(t,e),t.B||(t.B=ga(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,t.B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function Aa(t){t.g?.bindFramebuffer(t.g.FRAMEBUFFER,null)}var ba=class{H(){return"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n "}m(){const t=this.g;if(this.h=ga(t.createProgram(),"Failed to create WebGL program"),this.X=ya(this,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",t.VERTEX_SHADER),this.W=ya(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.O=t.getAttribLocation(this.h,"aVertex"),this.L=t.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.X),t.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};var ka=class extends ba{H(){return"\n precision mediump float;\n uniform sampler2D backgroundTexture;\n uniform sampler2D maskTexture;\n uniform sampler2D colorMappingTexture;\n varying vec2 vTex;\n void main() {\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\n float category = texture2D(maskTexture, vTex).r;\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\n }\n "}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.C=wa(this,t,t.LINEAR),t.activeTexture(t.TEXTURE2),this.j=wa(this,t,t.NEAREST)}m(){super.m();const t=this.g;this.P=ga(t.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.U=ga(t.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.M=ga(t.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const t=this.g;t.uniform1i(this.M,0),t.uniform1i(this.P,1),t.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Sa=class extends ba{H(){return"\n precision mediump float;\n uniform sampler2D maskTexture;\n uniform sampler2D defaultTexture;\n uniform sampler2D overlayTexture;\n varying vec2 vTex;\n void main() {\n float confidence = texture2D(maskTexture, vTex).r;\n vec4 defaultColor = texture2D(defaultTexture, vTex);\n vec4 overlayColor = texture2D(overlayTexture, vTex);\n // Apply the alpha from the overlay and merge in the default color\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\n }\n "}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.j=wa(this,t),t.activeTexture(t.TEXTURE2),this.C=wa(this,t)}m(){super.m();const t=this.g;this.M=ga(t.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.P=ga(t.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.I=ga(t.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const t=this.g;t.uniform1i(this.I,0),t.uniform1i(this.M,1),t.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function xa(t,e){switch(e){case 0:return t.g.find((t=>t instanceof Uint8Array));case 1:return t.g.find((t=>t instanceof Float32Array));case 2:return t.g.find((t=>"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function La(t){var e=xa(t,1);if(!e){if(e=xa(t,0))e=new Float32Array(e).map((t=>t/255));else{e=new Float32Array(t.width*t.height);const r=Ia(t);var n=Ma(t);if(Ta(n,r,Ra(t)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let t=0,r=0;tMath.round(255*t)))),t.g.push(e)),e;var t,e}ia(){return La(this)}N(){return Ra(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const t=Ia(this),e=Ma(this);t.activeTexture(t.TEXTURE1),n=wa(e,t,this.m?t.LINEAR:t.NEAREST),t.bindTexture(t.TEXTURE_2D,n);const r=Fa(this);t.texImage2D(t.TEXTURE_2D,0,r,this.width,this.height,0,t.RED,t.FLOAT,null),t.bindTexture(t.TEXTURE_2D,null),Ta(e,t,n),Ea(e,t,!1,(()=>{Pa(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Ca(this)})),Aa(e),Ca(this)}}t.push(n)}return new Na(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ia(this).deleteTexture(xa(this,2)),Ua=-1}};Na.prototype.close=Na.prototype.close,Na.prototype.clone=Na.prototype.clone,Na.prototype.getAsWebGLTexture=Na.prototype.N,Na.prototype.getAsFloat32Array=Na.prototype.ia,Na.prototype.getAsUint8Array=Na.prototype.ja,Na.prototype.hasWebGLTexture=Na.prototype.R,Na.prototype.hasFloat32Array=Na.prototype.ka,Na.prototype.hasUint8Array=Na.prototype.Fa;var Ua=250;const Da={color:"white",lineWidth:4,radius:6};function Ba(t){return{...Da,fillColor:(t=t||{}).color,...t}}function Ga(t,e){return t instanceof Function?t(e):t}function ja(t,e,n){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function Va(t){if(!t.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return t.l}function Xa(t){if(!t.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return t.j}function Ha(t,e,n){if(e.R())n(e.N());else{const r=e.ka()?e.ia():e.ja();t.m=t.m??new ba;const i=Xa(t);n((t=new Na([r],e.m,!1,i.canvas,t.m,e.width,e.height)).N()),t.close()}}function Wa(t,e,n,r){const i=function(t){return t.g||(t.g=new ka),t.g}(t),s=Xa(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Ea(i,s,!0,(()=>{!function(t,e,n,r){const i=t.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,t.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),t.I&&function(t,e){if(t!==e)return!1;t=t.entries(),e=e.entries();for(const[n,r]of t){t=n;const i=r,s=e.next();if(s.done)return!1;const[o,a]=s.value;if(t!==o||i[0]!==a[0]||i[1]!==a[1]||i[2]!==a[2]||i[3]!==a[3])return!1}return!!e.next().done}(t.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j);else{t.I=r;const e=Array(1024).fill(0);r.forEach(((t,n)=>{if(4!==t.length)throw Error(`Color at index ${n} is not a four-channel value.`);e[4*n]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(e))}}(i,e,o,r),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);const t=i.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}function za(t,e,n,r){const i=Xa(t),s=function(t){return t.h||(t.h=new Sa),t.h}(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,a=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ea(s,i,!0,(()=>{var t=s.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s.j),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,s.C),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(t=s.g).activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}var Ka=class{constructor(t,e){"undefined"!=typeof CanvasRenderingContext2D&&t instanceof CanvasRenderingContext2D||t instanceof OffscreenCanvasRenderingContext2D?(this.l=t,this.j=e):this.j=t}ya(t,e){if(t){var n=Va(this);e=Ba(e),n.save();var r=n.canvas,i=0;for(const s of t)n.fillStyle=Ga(e.fillColor,{index:i,from:s}),n.strokeStyle=Ga(e.color,{index:i,from:s}),n.lineWidth=Ga(e.lineWidth,{index:i,from:s}),(t=new Path2D).arc(s.x*r.width,s.y*r.height,Ga(e.radius,{index:i,from:s}),0,2*Math.PI),n.fill(t),n.stroke(t),++i;n.restore()}}xa(t,e,n){if(t&&e){var r=Va(this);n=Ba(n),r.save();var i=r.canvas,s=0;for(const o of e){r.beginPath(),e=t[o.start];const a=t[o.end];e&&a&&(r.strokeStyle=Ga(n.color,{index:s,from:e,to:a}),r.lineWidth=Ga(n.lineWidth,{index:s,from:e,to:a}),r.moveTo(e.x*i.width,e.y*i.height),r.lineTo(a.x*i.width,a.y*i.height)),++s,r.stroke()}r.restore()}}ua(t,e){const n=Va(this);e=Ba(e),n.save(),n.beginPath(),n.lineWidth=Ga(e.lineWidth,{}),n.strokeStyle=Ga(e.color,{}),n.fillStyle=Ga(e.fillColor,{}),n.moveTo(t.originX,t.originY),n.lineTo(t.originX+t.width,t.originY),n.lineTo(t.originX+t.width,t.originY+t.height),n.lineTo(t.originX,t.originY+t.height),n.lineTo(t.originX,t.originY),n.stroke(),n.fill(),n.restore()}va(t,e,n=[0,0,0,255]){this.l?function(t,e,n,r){const i=Xa(t);Ha(t,e,(e=>{Wa(t,e,n,r),(e=Va(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,n,e):Wa(this,t.N(),n,e)}wa(t,e,n){this.l?function(t,e,n,r){const i=Xa(t);Ha(t,e,(e=>{za(t,e,n,r),(e=Va(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,e,n):za(this,t.N(),e,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Ya(t,e){switch(e){case 0:return t.g.find((t=>t instanceof ImageData));case 1:return t.g.find((t=>"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap));case 2:return t.g.find((t=>"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function qa(t){var e=Ya(t,0);if(!e){e=Ja(t);const n=Za(t),r=new Uint8Array(t.width*t.height*4);Ta(n,e,$a(t)),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,r),Aa(n),e=new ImageData(new Uint8ClampedArray(r.buffer),t.width,t.height),t.g.push(e)}return e}function $a(t){let e=Ya(t,2);if(!e){const n=Ja(t);e=Qa(t);const r=Ya(t,1)||qa(t);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),tc(t)}return e}function Ja(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return t.h||(t.h=ga(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function Za(t){return t.l||(t.l=new ba),t.l}function Qa(t){const e=Ja(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Ya(t,2);return n||(n=wa(Za(t),e),t.g.push(n),t.m=!0),e.bindTexture(e.TEXTURE_2D,n),n}function tc(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}function ec(t){const e=Ja(t);return Ea(Za(t),e,!0,(()=>function(t,e){const n=t.canvas;if(n.width===t.width&&n.height===t.height)return e();const r=n.width,i=n.height;return n.width=t.width,n.height=t.height,t=e(),n.width=r,n.height=i,t}(t,(()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(t.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return t.canvas.transferToImageBitmap()}))))}Ka.prototype.close=Ka.prototype.close,Ka.prototype.drawConfidenceMask=Ka.prototype.wa,Ka.prototype.drawCategoryMask=Ka.prototype.va,Ka.prototype.drawBoundingBox=Ka.prototype.ua,Ka.prototype.drawConnectors=Ka.prototype.xa,Ka.prototype.drawLandmarks=Ka.prototype.ya,Ka.lerp=function(t,e,n,r,i){return ja(r*(1-(t-e)/(n-e))+i*(1-(n-t)/(n-e)),r,i)},Ka.clamp=ja;var nc=class{constructor(t,e,n,r,i,s,o){this.g=t,this.j=e,this.m=n,this.canvas=r,this.l=i,this.width=s,this.height=o,(this.j||this.m)&&(0===--rc&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources."))}Ea(){return!!Ya(this,0)}la(){return!!Ya(this,1)}R(){return!!Ya(this,2)}Ca(){return qa(this)}Ba(){var t=Ya(this,1);return t||($a(this),Qa(this),t=ec(this),tc(this),this.g.push(t),this.j=!0),t}N(){return $a(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof ImageData)n=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=Ja(this),e=Za(this);t.activeTexture(t.TEXTURE1),n=wa(e,t),t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),Ta(e,t,n),Ea(e,t,!1,(()=>{Qa(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),tc(this)})),Aa(e),tc(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);$a(this),Qa(this),n=ec(this),tc(this)}t.push(n)}return new nc(t,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ya(this,1).close(),this.m&&Ja(this).deleteTexture(Ya(this,2)),rc=-1}};nc.prototype.close=nc.prototype.close,nc.prototype.clone=nc.prototype.clone,nc.prototype.getAsWebGLTexture=nc.prototype.N,nc.prototype.getAsImageBitmap=nc.prototype.Ba,nc.prototype.getAsImageData=nc.prototype.Ca,nc.prototype.hasWebGLTexture=nc.prototype.R,nc.prototype.hasImageBitmap=nc.prototype.la,nc.prototype.hasImageData=nc.prototype.Ea;var rc=250;function ic(...t){return t.map((([t,e])=>({start:t,end:e})))}const sc=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((oc=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:Qo()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),na(this,r||"input_audio",(r=>{na(this,i=i||"audio_header",(i=>{this.i._configureAudio(r,i,t,e??0,n)}))}))}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ca(t){sa(this,"__graph_config__",(e=>{t(e)})),na(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const s=4*t.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(t,this.g/4),na(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){na(this,e,(e=>{const[r,i]=ra(this,t,e);this.i._addBoundTextureToStream(e,r,i,n)}))}addBoolToStream(t,e,n){na(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){na(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){na(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){na(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){na(this,e,(e=>{this.i._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){na(this,e,(e=>{na(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){na(this,e,(e=>{ia(this,Object.keys(t),(r=>{ia(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){na(this,n,(n=>{na(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){na(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.i._addBoolVectorEntry(r,e);this.i._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.i._addDoubleVectorEntry(r,e);this.i._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.i._addFloatVectorEntry(r,e);this.i._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.i._addIntVectorEntry(r,e);this.i._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.i._addUintVectorEntry(r,e);this.i._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){na(this,e,(e=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const e of t)na(this,e,(t=>{this.i._addStringVectorEntry(r,t)}));this.i._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){na(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){na(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){na(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){na(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){na(this,e,(e=>{this.i._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){na(this,e,(e=>{na(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){na(this,n,(n=>{na(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.i._addBoolVectorEntry(n,e);this.i._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.i._addDoubleVectorEntry(n,e);this.i._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.i._addFloatVectorEntry(n,e);this.i._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.i._addIntVectorEntry(n,e);this.i._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.i._addUintVectorEntry(n,e);this.i._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){na(this,e,(e=>{const n=this.i._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const e of t)na(this,e,(t=>{this.i._addStringVectorEntry(n,t)}));this.i._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachUintListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachUintListener(t)}))}attachUintVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachUintVectorListener(t)}))}attachDoubleListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){sa(this,t,e),na(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){oa(this,t,e),na(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){sa(this,t,e),na(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){oa(this,t,e),na(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),sa(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),na(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends oc{get ga(){return this.i}pa(t,e,n){na(this,e,(e=>{const[r,i]=ra(this,t,e);this.ga._addBoundTextureAsImageToStream(e,r,i,n)}))}Z(t,e){sa(this,t,e),na(this,t,(t=>{this.ga._attachImageListener(t)}))}aa(t,e){oa(this,t,e),na(this,t,(t=>{this.ga._attachImageVectorListener(t)}))}}));var oc,ac=class extends sc{};async function cc(t,e,n){return async function(t,e,n,r){return aa(t,e,n,r)}(t,n.canvas??(Qo()?void 0:document.createElement("canvas")),e,n)}function hc(t,e,n,r){if(t.U){const s=new Ls;if(n?.regionOfInterest){if(!t.oa)throw Error("This task doesn't support region-of-interest.");var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Ln(s,1,(i.left+i.right)/2),Ln(s,2,(i.top+i.bottom)/2),Ln(s,4,i.right-i.left),Ln(s,3,i.bottom-i.top)}else Ln(s,1,.5),Ln(s,2,.5),Ln(s,4,1),Ln(s,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(Ln(s,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){const[t,r]=ea(e);n=Sn(s,3)*r/t,i=Sn(s,4)*t/r,Ln(s,4,n),Ln(s,3,i)}}t.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",t.U,r)}t.g.pa(e,t.X,r??performance.now()),t.finishProcessing()}function uc(t,e,n){if(t.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");hc(t,e,n,t.C+1)}function lc(t,e,n,r){if(!t.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");hc(t,e,n,r)}function fc(t,e,n,r){var i=e.data;const s=e.width,o=s*(e=e.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error("Unsupported channel count: "+i.length/o);return t=new Na([i],n,!1,t.g.i.canvas,t.P,s,e),r?t.clone():t}var dc=class extends pa{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new ba}l(t,e=!0){if("runningMode"in t&&Ze(this.baseOptions,2,Jt(!!t.runningMode&&"IMAGE"!==t.runningMode)),void 0!==t.canvas&&this.g.i.canvas!==t.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(t,e)}close(){this.P.close(),super.close()}};dc.prototype.close=dc.prototype.close;var pc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect_in",!1),this.j={detections:[]},wn(t=this.h=new zs,0,1,e=new Xs),Ln(this.h,2,.5),Ln(this.h,3,.3)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return"minDetectionConfidence"in t&&Ln(this.h,2,t.minDetectionConfidence??.5),"minSuppressionThreshold"in t&&Ln(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}F(t,e){return this.j={detections:[]},uc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},lc(this,t,n,e),this.j}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect_in"),us(t,"detections");const e=new Qi;xr(e,Ys,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect_in"),rs(n,"DETECTIONS:detections"),n.o(e),cs(t,n),this.g.attachProtoVectorListener("detections",((t,e)=>{for(const e of t)t=ws(e),this.j.detections.push(Xo(t));ua(this,e)})),this.g.attachEmptyPacketListener("detections",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};pc.prototype.detectForVideo=pc.prototype.G,pc.prototype.detect=pc.prototype.F,pc.prototype.setOptions=pc.prototype.o,pc.createFromModelPath=async function(t,e){return cc(pc,t,{baseOptions:{modelAssetPath:e}})},pc.createFromModelBuffer=function(t,e){return cc(pc,t,{baseOptions:{modelAssetBuffer:e}})},pc.createFromOptions=function(t,e){return cc(pc,t,e)};var gc=ic([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),mc=ic([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),yc=ic([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),_c=ic([474,475],[475,476],[476,477],[477,474]),vc=ic([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Ec=ic([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),wc=ic([469,470],[470,471],[471,472],[472,469]),Tc=ic([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Ac=[...gc,...mc,...yc,...vc,...Ec,...Tc],bc=ic([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function kc(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var Sc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,wn(t=this.h=new Js,0,1,e=new Xs),this.A=new $s,wn(this.h,0,3,this.A),this.u=new zs,wn(this.h,0,2,this.u),xn(this.u,4,1),Ln(this.u,2,.5),Ln(this.A,2,.5),Ln(this.h,4,.5)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return"numFaces"in t&&xn(this.u,4,t.numFaces??1),"minFaceDetectionConfidence"in t&&Ln(this.u,2,t.minFaceDetectionConfidence??.5),"minTrackingConfidence"in t&&Ln(this.h,4,t.minTrackingConfidence??.5),"minFacePresenceConfidence"in t&&Ln(this.A,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}F(t,e){return kc(this),uc(this,t,e),this.j}G(t,e,n){return kc(this),lc(this,t,n,e),this.j}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect"),us(t,"face_landmarks");const e=new Qi;xr(e,Qs,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),rs(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),cs(t,n),this.g.attachProtoVectorListener("face_landmarks",((t,e)=>{for(const e of t)t=ks(e),this.j.faceLandmarks.push(Ho(t));ua(this,e)})),this.g.attachEmptyPacketListener("face_landmarks",(t=>{ua(this,t)})),this.outputFaceBlendshapes&&(us(t,"blendshapes"),rs(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((t,e)=>{if(this.outputFaceBlendshapes)for(const e of t)t=ys(e),this.j.faceBlendshapes.push(jo(t.g()??[]));ua(this,e)})),this.g.attachEmptyPacketListener("blendshapes",(t=>{ua(this,t)}))),this.outputFacialTransformationMatrixes&&(us(t,"face_geometry"),rs(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((t,e)=>{if(this.outputFacialTransformationMatrixes)for(const e of t)(t=yn(t=qs(e),Ss,2))&&this.j.facialTransformationMatrixes.push({rows:kn(t,1)??0??0,columns:kn(t,2)??0??0,data:en(t,3,$t,tn()).slice()??[]});ua(this,e)})),this.g.attachEmptyPacketListener("face_geometry",(t=>{ua(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Sc.prototype.detectForVideo=Sc.prototype.G,Sc.prototype.detect=Sc.prototype.F,Sc.prototype.setOptions=Sc.prototype.o,Sc.createFromModelPath=function(t,e){return cc(Sc,t,{baseOptions:{modelAssetPath:e}})},Sc.createFromModelBuffer=function(t,e){return cc(Sc,t,{baseOptions:{modelAssetBuffer:e}})},Sc.createFromOptions=function(t,e){return cc(Sc,t,e)},Sc.FACE_LANDMARKS_LIPS=gc,Sc.FACE_LANDMARKS_LEFT_EYE=mc,Sc.FACE_LANDMARKS_LEFT_EYEBROW=yc,Sc.FACE_LANDMARKS_LEFT_IRIS=_c,Sc.FACE_LANDMARKS_RIGHT_EYE=vc,Sc.FACE_LANDMARKS_RIGHT_EYEBROW=Ec,Sc.FACE_LANDMARKS_RIGHT_IRIS=wc,Sc.FACE_LANDMARKS_FACE_OVAL=Tc,Sc.FACE_LANDMARKS_CONTOURS=Ac,Sc.FACE_LANDMARKS_TESSELATION=bc;var xc=ic([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Lc(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function Rc(t){return 0===t.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function Ic(t,e=!0){const n=[];for(const i of t){var r=ys(i);t=[];for(const n of r.g())r=e&&null!=kn(n,1)?kn(n,1)??0:-1,t.push({score:Sn(n,2)??0,index:r,categoryName:le($e(n,3))??""??"",displayName:le($e(n,4))??""??""});n.push(t)}return n}var Fc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],wn(t=this.j=new oo,0,1,e=new Xs),this.u=new so,wn(this.j,0,2,this.u),this.D=new io,wn(this.u,0,3,this.D),this.A=new ro,wn(this.u,0,2,this.A),this.h=new no,wn(this.j,0,3,this.h),Ln(this.A,2,.5),Ln(this.u,4,.5),Ln(this.D,2,.5)}get baseOptions(){return yn(this.j,Xs,1)}set baseOptions(t){wn(this.j,0,1,t)}o(t){if(xn(this.A,3,t.numHands??1),"minHandDetectionConfidence"in t&&Ln(this.A,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&Ln(this.u,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&Ln(this.D,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new to,n=e,r=Bo(t.cannedGesturesClassifierOptions,yn(this.h,to,3)?.l());wn(n,0,2,r),wn(this.h,0,3,e)}else void 0===t.cannedGesturesClassifierOptions&&yn(this.h,to,3)?.g();return t.customGesturesClassifierOptions?(wn(n=e=new to,0,2,r=Bo(t.customGesturesClassifierOptions,yn(this.h,to,4)?.l())),wn(this.h,0,4,e)):void 0===t.customGesturesClassifierOptions&&yn(this.h,to,4)?.g(),this.l(t)}Ha(t,e){return Lc(this),uc(this,t,e),Rc(this)}Ia(t,e,n){return Lc(this),lc(this,t,n,e),Rc(this)}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect"),us(t,"hand_gestures"),us(t,"hand_landmarks"),us(t,"world_hand_landmarks"),us(t,"handedness");const e=new Qi;xr(e,lo,this.j);const n=new is;Rn(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),rs(n,"HAND_GESTURES:hand_gestures"),rs(n,"LANDMARKS:hand_landmarks"),rs(n,"WORLD_LANDMARKS:world_hand_landmarks"),rs(n,"HANDEDNESS:handedness"),n.o(e),cs(t,n),this.g.attachProtoVectorListener("hand_landmarks",((t,e)=>{for(const e of t){t=ks(e);const n=[];for(const e of vn(t,bs,1))n.push({x:Sn(e,1)??0,y:Sn(e,2)??0,z:Sn(e,3)??0,visibility:Sn(e,4)??0});this.landmarks.push(n)}ua(this,e)})),this.g.attachEmptyPacketListener("hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoVectorListener("world_hand_landmarks",((t,e)=>{for(const e of t){t=As(e);const n=[];for(const e of vn(t,Ts,1))n.push({x:Sn(e,1)??0,y:Sn(e,2)??0,z:Sn(e,3)??0,visibility:Sn(e,4)??0});this.worldLandmarks.push(n)}ua(this,e)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoVectorListener("hand_gestures",((t,e)=>{this.gestures.push(...Ic(t,!1)),ua(this,e)})),this.g.attachEmptyPacketListener("hand_gestures",(t=>{ua(this,t)})),this.g.attachProtoVectorListener("handedness",((t,e)=>{this.handedness.push(...Ic(t)),ua(this,e)})),this.g.attachEmptyPacketListener("handedness",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function Mc(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Fc.prototype.recognizeForVideo=Fc.prototype.Ia,Fc.prototype.recognize=Fc.prototype.Ha,Fc.prototype.setOptions=Fc.prototype.o,Fc.createFromModelPath=function(t,e){return cc(Fc,t,{baseOptions:{modelAssetPath:e}})},Fc.createFromModelBuffer=function(t,e){return cc(Fc,t,{baseOptions:{modelAssetBuffer:e}})},Fc.createFromOptions=function(t,e){return cc(Fc,t,e)},Fc.HAND_CONNECTIONS=xc;var Pc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],wn(t=this.h=new so,0,1,e=new Xs),this.u=new io,wn(this.h,0,3,this.u),this.j=new ro,wn(this.h,0,2,this.j),xn(this.j,3,1),Ln(this.j,2,.5),Ln(this.u,2,.5),Ln(this.h,4,.5)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return"numHands"in t&&xn(this.j,3,t.numHands??1),"minHandDetectionConfidence"in t&&Ln(this.j,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&Ln(this.h,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&Ln(this.u,2,t.minHandPresenceConfidence??.5),this.l(t)}F(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],uc(this,t,e),Mc(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],lc(this,t,n,e),Mc(this)}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect"),us(t,"hand_landmarks"),us(t,"world_hand_landmarks"),us(t,"handedness");const e=new Qi;xr(e,fo,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),rs(n,"LANDMARKS:hand_landmarks"),rs(n,"WORLD_LANDMARKS:world_hand_landmarks"),rs(n,"HANDEDNESS:handedness"),n.o(e),cs(t,n),this.g.attachProtoVectorListener("hand_landmarks",((t,e)=>{for(const e of t)t=ks(e),this.landmarks.push(Ho(t));ua(this,e)})),this.g.attachEmptyPacketListener("hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoVectorListener("world_hand_landmarks",((t,e)=>{for(const e of t)t=As(e),this.worldLandmarks.push(Wo(t));ua(this,e)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoVectorListener("handedness",((t,e)=>{var n=this.handedness,r=n.push;const i=[];for(const e of t){t=ys(e);const n=[];for(const e of t.g())n.push({score:Sn(e,2)??0,index:kn(e,1)??0??-1,categoryName:le($e(e,3))??""??"",displayName:le($e(e,4))??""??""});i.push(n)}r.call(n,...i),ua(this,e)})),this.g.attachEmptyPacketListener("handedness",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Pc.prototype.detectForVideo=Pc.prototype.G,Pc.prototype.detect=Pc.prototype.F,Pc.prototype.setOptions=Pc.prototype.o,Pc.createFromModelPath=function(t,e){return cc(Pc,t,{baseOptions:{modelAssetPath:e}})},Pc.createFromModelBuffer=function(t,e){return cc(Pc,t,{baseOptions:{modelAssetBuffer:e}})},Pc.createFromOptions=function(t,e){return cc(Pc,t,e)},Pc.HAND_CONNECTIONS=xc;var Cc=ic([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function Oc(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Nc(t){try{if(!t.D)return t.h;t.D(t.h)}finally{da(t)}}function Uc(t,e){t=ks(t),e.push(Ho(t))}var Dc=class extends dc{constructor(t,e){super(new ac(t,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,wn(t=this.j=new yo,0,1,e=new Xs),this.I=new io,wn(this.j,0,2,this.I),this.W=new po,wn(this.j,0,3,this.W),this.u=new zs,wn(this.j,0,4,this.u),this.O=new $s,wn(this.j,0,5,this.O),this.A=new go,wn(this.j,0,6,this.A),this.M=new mo,wn(this.j,0,7,this.M),Ln(this.u,2,.5),Ln(this.u,3,.3),Ln(this.O,2,.5),Ln(this.A,2,.5),Ln(this.A,3,.3),Ln(this.M,2,.5),Ln(this.I,2,.5)}get baseOptions(){return yn(this.j,Xs,1)}set baseOptions(t){wn(this.j,0,1,t)}o(t){return"minFaceDetectionConfidence"in t&&Ln(this.u,2,t.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in t&&Ln(this.u,3,t.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in t&&Ln(this.O,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"minPoseDetectionConfidence"in t&&Ln(this.A,2,t.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in t&&Ln(this.A,3,t.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in t&&Ln(this.M,2,t.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in t&&Ln(this.I,2,t.minHandLandmarksConfidence??.5),this.l(t)}F(t,e,n){const r="function"!=typeof e?e:{};return this.D="function"==typeof e?e:n,Oc(this),uc(this,t,r),Nc(this)}G(t,e,n,r){const i="function"!=typeof n?n:{};return this.D="function"==typeof n?n:r,Oc(this),lc(this,t,i,e),Nc(this)}m(){var t=new ls;hs(t,"input_frames_image"),us(t,"pose_landmarks"),us(t,"pose_world_landmarks"),us(t,"face_landmarks"),us(t,"left_hand_landmarks"),us(t,"left_hand_world_landmarks"),us(t,"right_hand_landmarks"),us(t,"right_hand_world_landmarks");const e=new Qi,n=new Bi;Rn(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(t,e){if(null!=e)if(Array.isArray(e))Ze(t,2,Ie(e,0,Me));else{if(!("string"==typeof e||e instanceof F||x(e)))throw Error("invalid value in Any.value field: "+e+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");hn(t,2,ht(e,!1),R())}}(n,this.j.g());const r=new is;Rn(r,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),bn(r,8,Bi,n),ns(r,"IMAGE:input_frames_image"),rs(r,"POSE_LANDMARKS:pose_landmarks"),rs(r,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),rs(r,"FACE_LANDMARKS:face_landmarks"),rs(r,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),rs(r,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),rs(r,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),rs(r,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),r.o(e),cs(t,r),la(this,t),this.g.attachProtoListener("pose_landmarks",((t,e)=>{Uc(t,this.h.poseLandmarks),ua(this,e)})),this.g.attachEmptyPacketListener("pose_landmarks",(t=>{ua(this,t)})),this.g.attachProtoListener("pose_world_landmarks",((t,e)=>{var n=this.h.poseWorldLandmarks;t=As(t),n.push(Wo(t)),ua(this,e)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(t=>{ua(this,t)})),this.outputPoseSegmentationMasks&&(rs(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),fa(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((t,e)=>{this.h.poseSegmentationMasks=[fc(this,t,!0,!this.D)],ua(this,e)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(t=>{this.h.poseSegmentationMasks=[],ua(this,t)}))),this.g.attachProtoListener("face_landmarks",((t,e)=>{Uc(t,this.h.faceLandmarks),ua(this,e)})),this.g.attachEmptyPacketListener("face_landmarks",(t=>{ua(this,t)})),this.outputFaceBlendshapes&&(us(t,"extra_blendshapes"),rs(r,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((t,e)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(t=ys(t),n.push(jo(t.g()??[]))),ua(this,e)})),this.g.attachEmptyPacketListener("extra_blendshapes",(t=>{ua(this,t)}))),this.g.attachProtoListener("left_hand_landmarks",((t,e)=>{Uc(t,this.h.leftHandLandmarks),ua(this,e)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoListener("left_hand_world_landmarks",((t,e)=>{var n=this.h.leftHandWorldLandmarks;t=As(t),n.push(Wo(t)),ua(this,e)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(t=>{ua(this,t)})),this.g.attachProtoListener("right_hand_landmarks",((t,e)=>{Uc(t,this.h.rightHandLandmarks),ua(this,e)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(t=>{ua(this,t)})),this.g.attachProtoListener("right_hand_world_landmarks",((t,e)=>{var n=this.h.rightHandWorldLandmarks;t=As(t),n.push(Wo(t)),ua(this,e)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Dc.prototype.detectForVideo=Dc.prototype.G,Dc.prototype.detect=Dc.prototype.F,Dc.prototype.setOptions=Dc.prototype.o,Dc.createFromModelPath=function(t,e){return cc(Dc,t,{baseOptions:{modelAssetPath:e}})},Dc.createFromModelBuffer=function(t,e){return cc(Dc,t,{baseOptions:{modelAssetBuffer:e}})},Dc.createFromOptions=function(t,e){return cc(Dc,t,e)},Dc.HAND_CONNECTIONS=xc,Dc.POSE_CONNECTIONS=Cc,Dc.FACE_LANDMARKS_LIPS=gc,Dc.FACE_LANDMARKS_LEFT_EYE=mc,Dc.FACE_LANDMARKS_LEFT_EYEBROW=yc,Dc.FACE_LANDMARKS_LEFT_IRIS=_c,Dc.FACE_LANDMARKS_RIGHT_EYE=vc,Dc.FACE_LANDMARKS_RIGHT_EYEBROW=Ec,Dc.FACE_LANDMARKS_RIGHT_IRIS=wc,Dc.FACE_LANDMARKS_FACE_OVAL=Tc,Dc.FACE_LANDMARKS_CONTOURS=Ac,Dc.FACE_LANDMARKS_TESSELATION=bc;var Bc=class extends dc{constructor(t,e){super(new ac(t,e),"input_image","norm_rect",!0),this.j={classifications:[]},wn(t=this.h=new Eo,0,1,e=new Xs)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return wn(this.h,0,2,Bo(t,yn(this.h,Ns,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},uc(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},lc(this,t,n,e),this.j}m(){var t=new ls;hs(t,"input_image"),hs(t,"norm_rect"),us(t,"classifications");const e=new Qi;xr(e,wo,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),ns(n,"IMAGE:input_image"),ns(n,"NORM_RECT:norm_rect"),rs(n,"CLASSIFICATIONS:classifications"),n.o(e),cs(t,n),this.g.attachProtoListener("classifications",((t,e)=>{this.j=Vo(Is(t)),ua(this,e)})),this.g.attachEmptyPacketListener("classifications",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Bc.prototype.classifyForVideo=Bc.prototype.ta,Bc.prototype.classify=Bc.prototype.sa,Bc.prototype.setOptions=Bc.prototype.o,Bc.createFromModelPath=function(t,e){return cc(Bc,t,{baseOptions:{modelAssetPath:e}})},Bc.createFromModelBuffer=function(t,e){return cc(Bc,t,{baseOptions:{modelAssetBuffer:e}})},Bc.createFromOptions=function(t,e){return cc(Bc,t,e)};var Gc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!0),this.h=new To,this.embeddings={embeddings:[]},wn(t=this.h,0,1,e=new Xs)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){var e=this.h,n=yn(this.h,Ds,2);return n=n?n.clone():new Ds,void 0!==t.l2Normalize?Ze(n,1,Jt(t.l2Normalize)):"l2Normalize"in t&&Ze(n,1),void 0!==t.quantize?Ze(n,2,Jt(t.quantize)):"quantize"in t&&Ze(n,2),wn(e,0,2,n),this.l(t)}za(t,e){return uc(this,t,e),this.embeddings}Aa(t,e,n){return lc(this,t,n,e),this.embeddings}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect"),us(t,"embeddings_out");const e=new Qi;xr(e,Ao,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),rs(n,"EMBEDDINGS:embeddings_out"),n.o(e),cs(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Os(t),this.embeddings=function(t){return{embeddings:vn(t,Ps,1).map((t=>{const e={headIndex:kn(t,3)??0??-1,headName:le($e(t,4))??""??""};var n=t.v;return void 0!==mn(n,0|n[Q],Fs,ln(t,1))?(t=en(t=yn(t,Fs,ln(t,1),void 0),1,$t,tn()),e.floatEmbedding=t.slice()):(n=new Uint8Array(0),e.quantizedEmbedding=yn(t,Ms,ln(t,2),void 0)?.na()?.h()??n),e})),timestampMs:Go($e(t,2,void 0,void 0,ce)??Ye)}}(t),ua(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Gc.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Ko(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Ko(zo(t.quantizedEmbedding),zo(e.quantizedEmbedding))}return t},Gc.prototype.embedForVideo=Gc.prototype.Aa,Gc.prototype.embed=Gc.prototype.za,Gc.prototype.setOptions=Gc.prototype.o,Gc.createFromModelPath=function(t,e){return cc(Gc,t,{baseOptions:{modelAssetPath:e}})},Gc.createFromModelBuffer=function(t,e){return cc(Gc,t,{baseOptions:{modelAssetBuffer:e}})},Gc.createFromOptions=function(t,e){return cc(Gc,t,e)};var jc=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};function Vc(t){const e=function(t){return vn(t,is,1)}(t.ca()).filter((t=>(le($e(t,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(t.u=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");1===e.length&&(yn(e[0],Qi,7)?.j()?.g()??new Map).forEach(((e,n)=>{t.u[Number(n)]=le($e(e,1))??""}))}function Xc(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function Hc(t){try{const e=new jc(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{da(t)}}jc.prototype.close=jc.prototype.close;var Wc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lo,this.A=new bo,wn(this.h,0,3,this.A),wn(t=this.h,0,1,e=new Xs)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?Ze(this.h,2,ue(t.displayNamesLocale)):"displayNamesLocale"in t&&Ze(this.h,2),"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}L(){Vc(this)}segment(t,e,n){const r="function"!=typeof e?e:{};return this.j="function"==typeof e?e:n,Xc(this),uc(this,t,r),Hc(this)}La(t,e,n,r){const i="function"!=typeof n?n:{};return this.j="function"==typeof n?n:r,Xc(this),lc(this,t,i,e),Hc(this)}Da(){return this.u}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect");const e=new Qi;xr(e,Ro,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),n.o(e),cs(t,n),la(this,t),this.outputConfidenceMasks&&(us(t,"confidence_masks"),rs(n,"CONFIDENCE_MASKS:confidence_masks"),fa(this,"confidence_masks"),this.g.aa("confidence_masks",((t,e)=>{this.confidenceMasks=t.map((t=>fc(this,t,!0,!this.j))),ua(this,e)})),this.g.attachEmptyPacketListener("confidence_masks",(t=>{this.confidenceMasks=[],ua(this,t)}))),this.outputCategoryMask&&(us(t,"category_mask"),rs(n,"CATEGORY_MASK:category_mask"),fa(this,"category_mask"),this.g.Z("category_mask",((t,e)=>{this.categoryMask=fc(this,t,!1,!this.j),ua(this,e)})),this.g.attachEmptyPacketListener("category_mask",(t=>{this.categoryMask=void 0,ua(this,t)}))),us(t,"quality_scores"),rs(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((t,e)=>{this.qualityScores=t,ua(this,e)})),this.g.attachEmptyPacketListener("quality_scores",(t=>{this.categoryMask=void 0,ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Wc.prototype.getLabels=Wc.prototype.Da,Wc.prototype.segmentForVideo=Wc.prototype.La,Wc.prototype.segment=Wc.prototype.segment,Wc.prototype.setOptions=Wc.prototype.o,Wc.createFromModelPath=function(t,e){return cc(Wc,t,{baseOptions:{modelAssetPath:e}})},Wc.createFromModelBuffer=function(t,e){return cc(Wc,t,{baseOptions:{modelAssetBuffer:e}})},Wc.createFromOptions=function(t,e){return cc(Wc,t,e)};var zc=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};zc.prototype.close=zc.prototype.close;var Kc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lo,this.u=new bo,wn(this.h,0,3,this.u),wn(t=this.h,0,1,e=new Xs)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}segment(t,e,n,r){const i="function"!=typeof n?n:{};if(this.j="function"==typeof n?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Po,e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var s=new Io;hn(s,3,Jt(!0),!1),hn(s,1,qt(e.keypoint.x),0),hn(s,2,qt(e.keypoint.y),0),Tn(r,1,Co,s)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");{const t=new Mo;for(s of e.scribble)hn(e=new Io,3,Jt(!0),!1),hn(e,1,qt(s.x),0),hn(e,2,qt(s.y),0),bn(t,1,Io,e);Tn(r,2,Co,t)}}this.g.addProtoToStream(r.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),uc(this,t,i);t:{try{const t=new zc(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=t;break t}this.j(t)}finally{da(this)}o=void 0}return o}m(){var t=new ls;hs(t,"image_in"),hs(t,"roi_in"),hs(t,"norm_rect_in");const e=new Qi;xr(e,Ro,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),ns(n,"IMAGE:image_in"),ns(n,"ROI:roi_in"),ns(n,"NORM_RECT:norm_rect_in"),n.o(e),cs(t,n),la(this,t),this.outputConfidenceMasks&&(us(t,"confidence_masks"),rs(n,"CONFIDENCE_MASKS:confidence_masks"),fa(this,"confidence_masks"),this.g.aa("confidence_masks",((t,e)=>{this.confidenceMasks=t.map((t=>fc(this,t,!0,!this.j))),ua(this,e)})),this.g.attachEmptyPacketListener("confidence_masks",(t=>{this.confidenceMasks=[],ua(this,t)}))),this.outputCategoryMask&&(us(t,"category_mask"),rs(n,"CATEGORY_MASK:category_mask"),fa(this,"category_mask"),this.g.Z("category_mask",((t,e)=>{this.categoryMask=fc(this,t,!1,!this.j),ua(this,e)})),this.g.attachEmptyPacketListener("category_mask",(t=>{this.categoryMask=void 0,ua(this,t)}))),us(t,"quality_scores"),rs(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((t,e)=>{this.qualityScores=t,ua(this,e)})),this.g.attachEmptyPacketListener("quality_scores",(t=>{this.categoryMask=void 0,ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Kc.prototype.segment=Kc.prototype.segment,Kc.prototype.setOptions=Kc.prototype.o,Kc.createFromModelPath=function(t,e){return cc(Kc,t,{baseOptions:{modelAssetPath:e}})},Kc.createFromModelBuffer=function(t,e){return cc(Kc,t,{baseOptions:{modelAssetBuffer:e}})},Kc.createFromOptions=function(t,e){return cc(Kc,t,e)};var Yc=class extends dc{constructor(t,e){super(new ac(t,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},wn(t=this.h=new Oo,0,1,e=new Xs)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?Ze(this.h,2,ue(t.displayNamesLocale)):"displayNamesLocale"in t&&Ze(this.h,2),void 0!==t.maxResults?xn(this.h,3,t.maxResults):"maxResults"in t&&Ze(this.h,3),void 0!==t.scoreThreshold?Ln(this.h,4,t.scoreThreshold):"scoreThreshold"in t&&Ze(this.h,4),void 0!==t.categoryAllowlist?In(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&Ze(this.h,5),void 0!==t.categoryDenylist?In(this.h,6,t.categoryDenylist):"categoryDenylist"in t&&Ze(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},uc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},lc(this,t,n,e),this.j}m(){var t=new ls;hs(t,"input_frame_gpu"),hs(t,"norm_rect"),us(t,"detections");const e=new Qi;xr(e,No,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),ns(n,"IMAGE:input_frame_gpu"),ns(n,"NORM_RECT:norm_rect"),rs(n,"DETECTIONS:detections"),n.o(e),cs(t,n),this.g.attachProtoVectorListener("detections",((t,e)=>{for(const e of t)t=ws(e),this.j.detections.push(Xo(t));ua(this,e)})),this.g.attachEmptyPacketListener("detections",(t=>{ua(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Yc.prototype.detectForVideo=Yc.prototype.G,Yc.prototype.detect=Yc.prototype.F,Yc.prototype.setOptions=Yc.prototype.o,Yc.createFromModelPath=async function(t,e){return cc(Yc,t,{baseOptions:{modelAssetPath:e}})},Yc.createFromModelBuffer=function(t,e){return cc(Yc,t,{baseOptions:{modelAssetBuffer:e}})},Yc.createFromOptions=function(t,e){return cc(Yc,t,e)};var qc=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((t=>{t.close()}))}};function $c(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function Jc(t){try{const e=new qc(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{da(t)}}qc.prototype.close=qc.prototype.close;var Zc=class extends dc{constructor(t,e){super(new ac(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,wn(t=this.h=new Uo,0,1,e=new Xs),this.A=new mo,wn(this.h,0,3,this.A),this.j=new go,wn(this.h,0,2,this.j),xn(this.j,4,1),Ln(this.j,2,.5),Ln(this.A,2,.5),Ln(this.h,4,.5)}get baseOptions(){return yn(this.h,Xs,1)}set baseOptions(t){wn(this.h,0,1,t)}o(t){return"numPoses"in t&&xn(this.j,4,t.numPoses??1),"minPoseDetectionConfidence"in t&&Ln(this.j,2,t.minPoseDetectionConfidence??.5),"minTrackingConfidence"in t&&Ln(this.h,4,t.minTrackingConfidence??.5),"minPosePresenceConfidence"in t&&Ln(this.A,2,t.minPosePresenceConfidence??.5),"outputSegmentationMasks"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}F(t,e,n){const r="function"!=typeof e?e:{};return this.u="function"==typeof e?e:n,$c(this),uc(this,t,r),Jc(this)}G(t,e,n,r){const i="function"!=typeof n?n:{};return this.u="function"==typeof n?n:r,$c(this),lc(this,t,i,e),Jc(this)}m(){var t=new ls;hs(t,"image_in"),hs(t,"norm_rect"),us(t,"normalized_landmarks"),us(t,"world_landmarks"),us(t,"segmentation_masks");const e=new Qi;xr(e,Do,this.h);const n=new is;Rn(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),ns(n,"IMAGE:image_in"),ns(n,"NORM_RECT:norm_rect"),rs(n,"NORM_LANDMARKS:normalized_landmarks"),rs(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),cs(t,n),la(this,t),this.g.attachProtoVectorListener("normalized_landmarks",((t,e)=>{this.landmarks=[];for(const e of t)t=ks(e),this.landmarks.push(Ho(t));ua(this,e)})),this.g.attachEmptyPacketListener("normalized_landmarks",(t=>{this.landmarks=[],ua(this,t)})),this.g.attachProtoVectorListener("world_landmarks",((t,e)=>{this.worldLandmarks=[];for(const e of t)t=As(e),this.worldLandmarks.push(Wo(t));ua(this,e)})),this.g.attachEmptyPacketListener("world_landmarks",(t=>{this.worldLandmarks=[],ua(this,t)})),this.outputSegmentationMasks&&(rs(n,"SEGMENTATION_MASK:segmentation_masks"),fa(this,"segmentation_masks"),this.g.aa("segmentation_masks",((t,e)=>{this.segmentationMasks=t.map((t=>fc(this,t,!0,!this.u))),ua(this,e)})),this.g.attachEmptyPacketListener("segmentation_masks",(t=>{this.segmentationMasks=[],ua(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Zc.prototype.detectForVideo=Zc.prototype.G,Zc.prototype.detect=Zc.prototype.F,Zc.prototype.setOptions=Zc.prototype.o,Zc.createFromModelPath=function(t,e){return cc(Zc,t,{baseOptions:{modelAssetPath:e}})},Zc.createFromModelBuffer=function(t,e){return cc(Zc,t,{baseOptions:{modelAssetBuffer:e}})},Zc.createFromOptions=function(t,e){return cc(Zc,t,e)},Zc.POSE_CONNECTIONS=Cc;export{Ka as DrawingUtils,pc as FaceDetector,Sc as FaceLandmarker,Zo as FilesetResolver,Fc as GestureRecognizer,Pc as HandLandmarker,Dc as HolisticLandmarker,Bc as ImageClassifier,Gc as ImageEmbedder,Wc as ImageSegmenter,jc as ImageSegmenterResult,Kc as InteractiveSegmenter,zc as InteractiveSegmenterResult,nc as MPImage,Na as MPMask,Yc as ObjectDetector,Zc as PoseLandmarker,pa as TaskRunner,dc as VisionTaskRunner}; //# sourceMappingURL=vision_bundle_mjs.js.map diff --git a/lab-js/vendor/vision_bundle_mjs.js.map b/lab-js/vendor/vision_bundle_mjs.js.map new file mode 100644 index 0000000..2b45703 --- /dev/null +++ b/lab-js/vendor/vision_bundle_mjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vision_bundle_mjs.js","sources":["../../../../../../../mediapipe/tasks/web/vision/vision_js.js"],"sourcesContent":["'use strict';/*\n\n Copyright The Closure Library Authors.\n SPDX-License-Identifier: Apache-2.0\n*/\nvar aa=this||(typeof self!==\"undefined\"?self:{});function ba(a,b){a:{var c=[\"CLOSURE_FLAGS\"];for(var d=aa,e=0;e>6|192;else{if(b>=55296&&b<=57343){if(b<=56319&&e=56320&&f<=57343){b=(b-55296)*1024+f-56320+65536;d[c++]=b>>18|240;d[c++]=b>>12&63|128;d[c++]=b>>6&63|128;d[c++]=b&63|128;continue}else e--}b=65533}d[c++]=b>>12|224;d[c++]=b>>6&63|128}d[c++]=b&63|128}}a=c===d.length?\nd:d.subarray(0,c)}return a};function ma(a){aa.setTimeout(()=>{throw a;},0)};var na=ba(610401301,!1),oa=ba(748402147,!0);function pa(){var a=aa.navigator;return a&&(a=a.userAgent)?a:\"\"}var qa;const ra=aa.navigator;qa=ra?ra.userAgentData||null:null;function sa(a){sa[\" \"](a);return a}sa[\" \"]=function(){};const ta={};let ua=null;function va(a){const b=a.length;let c=b*3/4;c%3?c=Math.floor(c):\"=.\".indexOf(a[b-1])!=-1&&(c=\"=.\".indexOf(a[b-2])!=-1?c-2:c-1);const d=new Uint8Array(c);let e=0;xa(a,function(f){d[e++]=f});return e!==c?d.subarray(0,e):d}\nfunction xa(a,b){function c(e){for(;d>4);g!=64&&(b(f<<4&240|g>>2),h!=64&&b(g<<6&192|h))}}\nfunction ya(){if(!ua){ua={};var a=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".split(\"\"),b=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"];for(let c=0;c<5;c++){const d=a.concat(b[c].split(\"\"));ta[c]=d;for(let e=0;e0?0:pa().indexOf(\"Trident\")!=-1||pa().indexOf(\"MSIE\")!=-1)&&typeof btoa===\"function\";const Ba=/[-_.]/g,Ca={\"-\":\"+\",_:\"/\",\".\":\"=\"};function Da(a){return Ca[a]||\"\"}function Ea(a){if(!Aa)return va(a);a=Ba.test(a)?a.replace(Ba,Da):a;a=atob(a);const b=new Uint8Array(a.length);for(let c=0;c=b||(c[a]=d+1,a=Error(),Ma(a,\"incident\"),ma(a))}};function Qa(){return typeof BigInt===\"function\"};var Ra=typeof Symbol===\"function\"&&typeof Symbol()===\"symbol\";function Sa(a,b,c=!1){return typeof Symbol===\"function\"&&typeof Symbol()===\"symbol\"?c&&Symbol.for&&a?Symbol.for(a):a!=null?Symbol(a):Symbol():b}var Ta=Sa(\"jas\",void 0,!0),Ua=Sa(void 0,\"0di\"),Va=Sa(void 0,\"1oa\"),Wa=Sa(void 0,Symbol()),Xa=Sa(void 0,\"0ub\"),Ya=Sa(void 0,\"0ubs\"),Za=Sa(void 0,\"0ubsb\"),$a=Sa(void 0,\"0actk\"),ab=Sa(\"m_m\",\"Pa\",!0),bb=Sa();const cb={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},db=Object.defineProperties,n=Ra?Ta:\"Ga\";var eb;const fb=[];p(fb,7);eb=Object.freeze(fb);function gb(a,b){Ra||n in a||db(a,cb);a[n]|=b}function p(a,b){Ra||n in a||db(a,cb);a[n]=b}function hb(a){gb(a,34);return a}function ib(a){gb(a,8192);return a};var jb={};function kb(a,b){return b===void 0?a.h!==lb&&!!(2&(a.v[n]|0)):!!(2&b)&&a.h!==lb}const lb={};function mb(a,b){if(a!=null)if(typeof a===\"string\")a=a?new Ja(a,Ga):Ha();else if(a.constructor!==Ja)if(Fa(a))a=a.length?new Ja(new Uint8Array(a),Ga):Ha();else{if(!b)throw Error();a=void 0}return a}class nb{constructor(a,b,c){this.g=a;this.h=b;this.l=c}next(){const a=this.g.next();a.done||(a.value=this.h.call(this.l,a.value));return a}[Symbol.iterator](){return this}}var ob=Object.freeze({});\nfunction pb(a,b,c){const d=b&128?0:-1,e=a.length;var f;if(f=!!e)f=a[e-1],f=f!=null&&typeof f===\"object\"&&f.constructor===Object;const g=e+(f?-1:0);for(b=b&128?1:0;btypeof a===\"number\"),ub=sb(a=>typeof a===\"string\"),vb=sb(a=>typeof a===\"boolean\");var wb=typeof aa.BigInt===\"function\"&&typeof aa.BigInt(0)===\"bigint\";function xb(a){var b=a;if(ub(b)){if(!/^\\s*(?:-?[1-9]\\d*|0)?\\s*$/.test(b))throw Error(String(b));}else if(tb(b)&&!Number.isSafeInteger(b))throw Error(String(b));return wb?BigInt(a):a=vb(a)?a?\"1\":\"0\":ub(a)?a.trim()||\"0\":String(a)}var Db=sb(a=>wb?a>=yb&&a<=zb:a[0]===\"-\"?Ab(a,Bb):Ab(a,Cb));const Bb=Number.MIN_SAFE_INTEGER.toString(),yb=wb?BigInt(Number.MIN_SAFE_INTEGER):void 0,Cb=Number.MAX_SAFE_INTEGER.toString(),zb=wb?BigInt(Number.MAX_SAFE_INTEGER):void 0;\nfunction Ab(a,b){if(a.length>b.length)return!1;if(a.lengthe)return!1;if(d>>0;q=b;r=(a-b)/4294967296>>>0}function Hb(a){if(a<0){Gb(-a);const [b,c]=Ib(q,r);q=b>>>0;r=c>>>0}else Gb(a)}function Jb(a){const b=Fb||=new DataView(new ArrayBuffer(8));b.setFloat32(0,+a,!0);r=0;q=b.getUint32(0,!0)}function Kb(a,b){const c=b*4294967296+(a>>>0);return Number.isSafeInteger(c)?c:Lb(a,b)}function Mb(a,b){return xb(Qa()?BigInt.asUintN(64,(BigInt(b>>>0)<>>0)):Lb(a,b))}\nfunction Nb(a,b){return Qa()?xb(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(b))<>>=0;a>>>=0;if(b<=2097151)var c=\"\"+(4294967296*b+a);else Qa()?c=\"\"+(BigInt(b)<>>24|b<<8)&16777215,b=b>>16&65535,a=(a&16777215)+c*6777216+b*6710656,c+=b*8147497,b*=2,a>=1E7&&(c+=a/1E7>>>0,a%=1E7),c>=1E7&&(b+=c/1E7>>>0,c%=1E7),c=b+Pb(c)+Pb(a));return c}function Pb(a){a=String(a);return\"0000000\".slice(a.length)+a}\nfunction Ob(a,b){if(b&2147483648)if(Qa())a=\"\"+(BigInt(b|0)<>>0));else{const [c,d]=Ib(a,b);a=\"-\"+Lb(c,d)}else a=Lb(a,b);return a}\nfunction Qb(a){if(a.length<16)Hb(Number(a));else if(Qa())a=BigInt(a),q=Number(a&BigInt(4294967295))>>>0,r=Number(a>>BigInt(32)&BigInt(4294967295));else{const b=+(a[0]===\"-\");r=q=0;const c=a.length;for(let d=b,e=(c-b)%6+b;e<=c;d=e,e+=6){const f=Number(a.slice(d,e));r*=1E6;q=q*1E6+f;q>=4294967296&&(r+=Math.trunc(q/4294967296),r>>>=0,q>>>=0)}if(b){const [d,e]=Ib(q,r);q=d;r=e}}}function Ib(a,b){b=~b;a?a=~a+1:b+=1;return[a,b]};function Rb(a){return Array.prototype.slice.call(a)};const Sb=typeof BigInt===\"function\"?BigInt.asIntN:void 0,Tb=typeof BigInt===\"function\"?BigInt.asUintN:void 0,Ub=Number.isSafeInteger,Vb=Number.isFinite,Wb=Math.trunc,Xb=xb(0);function Yb(a){if(a!=null&&typeof a!==\"number\")throw Error(`Value of float/double field must be a number, found ${typeof a}: ${a}`);return a}function Zb(a){if(a==null||typeof a===\"number\")return a;if(a===\"NaN\"||a===\"Infinity\"||a===\"-Infinity\")return Number(a)}\nfunction $b(a){if(a!=null&&typeof a!==\"boolean\"){var b=typeof a;throw Error(`Expected boolean but got ${b!=\"object\"?b:a?Array.isArray(a)?\"array\":b:\"null\"}: ${a}`);}return a}function ac(a){if(a==null||typeof a===\"boolean\")return a;if(typeof a===\"number\")return!!a}const bc=/^-?([1-9][0-9]*|0)(\\.[0-9]+)?$/;function cc(a){switch(typeof a){case \"bigint\":return!0;case \"number\":return Vb(a);case \"string\":return bc.test(a);default:return!1}}\nfunction dc(a){if(a==null)return a;if(typeof a===\"string\"&&a)a=+a;else if(typeof a!==\"number\")return;return Vb(a)?a|0:void 0}function ec(a){if(a==null)return a;if(typeof a===\"string\"&&a)a=+a;else if(typeof a!==\"number\")return;return Vb(a)?a>>>0:void 0}function fc(a){const b=a.length;if(a[0]===\"-\"?b<20||b===20&&a<=\"-9223372036854775808\":b<19||b===19&&a<=\"9223372036854775807\")return a;Qb(a);return Ob(q,r)}\nfunction hc(a){a=Wb(a);if(!Ub(a)){Hb(a);var b=q,c=r;if(a=c&2147483648)b=~b+1>>>0,c=~c>>>0,b==0&&(c=c+1>>>0);b=Kb(b,c);a=typeof b===\"number\"?a?-b:b:a?\"-\"+b:b}return a}function ic(a){var b=Wb(Number(a));if(Ub(b))return String(b);b=a.indexOf(\".\");b!==-1&&(a=a.substring(0,b));return fc(a)}function jc(a){var b=Wb(Number(a));if(Ub(b))return xb(b);b=a.indexOf(\".\");b!==-1&&(a=a.substring(0,b));return Qa()?xb(Sb(64,BigInt(a))):xb(fc(a))}\nfunction kc(a){Ub(a)?a=xb(hc(a)):(a=Wb(a),Ub(a)?a=String(a):(Hb(a),a=Ob(q,r)),a=xb(a));return a}function lc(a){if(a==null)return a;if(typeof a===\"bigint\")return Db(a)?a=Number(a):(a=Sb(64,a),a=Db(a)?Number(a):String(a)),a;if(cc(a))return typeof a===\"number\"?hc(a):ic(a)}function mc(a){const b=typeof a;if(a==null)return a;if(b===\"bigint\")return xb(Sb(64,a));if(cc(a))return b===\"string\"?jc(a):kc(a)}\nfunction nc(a){if(a==null)return a;const b=typeof a;if(b===\"bigint\")return String(Sb(64,a));if(cc(a)){if(b===\"string\")return ic(a);if(b===\"number\")return hc(a)}}\nfunction oc(a){if(a==null)return a;var b=typeof a;if(b===\"bigint\")return String(Tb(64,a));if(cc(a)){if(b===\"string\")return b=Wb(Number(a)),Ub(b)&&b>=0?a=String(b):(b=a.indexOf(\".\"),b!==-1&&(a=a.substring(0,b)),a[0]===\"-\"?b=!1:(b=a.length,b=b<20?!0:b===20&&a<=\"18446744073709551615\"),b||(Qb(a),a=Lb(q,r))),a;if(b===\"number\")return a=Wb(a),a>=0&&Ub(a)||(Hb(a),a=Kb(q,r)),a}}function pc(a){if(typeof a!==\"string\")throw Error();return a}\nfunction qc(a){if(a!=null&&typeof a!==\"string\")throw Error();return a}function t(a){return a==null||typeof a===\"string\"?a:void 0}function rc(a,b,c,d){if(a!=null&&a[ab]===jb)return a;if(!Array.isArray(a))return c?d&2?((a=b[Ua])||(a=new b,hb(a.v),a=b[Ua]=a),b=a):b=new b:b=void 0,b;c=a[n]|0;d=c|d&32|d&2;d!==c&&p(a,d);return new b(a)}\nfunction sc(a,b,c){if(b)a:{b=a;if(!cc(b))throw Oa(\"int64\");switch(typeof b){case \"string\":b=jc(b);break a;case \"bigint\":b=xb(Sb(64,b));break a;default:b=kc(b)}}else b=mc(a);a=b;return a==null?c?Xb:void 0:a};function tc(a){return a};const uc={};let vc=function(){try{return sa(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();\nclass wc{constructor(){this.g=new Map}get(a){return this.g.get(a)}set(a,b){this.g.set(a,b);this.size=this.g.size;return this}delete(a){a=this.g.delete(a);this.size=this.g.size;return a}clear(){this.g.clear();this.size=this.g.size}has(a){return this.g.has(a)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(a,b){return this.g.forEach(a,b)}[Symbol.iterator](){return this.entries()}}\nconst xc=(()=>vc?(Object.setPrototypeOf(wc.prototype,Map.prototype),Object.defineProperties(wc.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),wc):class extends Map{constructor(){super()}})();function yc(a){return a}function zc(a){if(a.J&2)throw Error(\"Cannot mutate an immutable Map\");}\nvar Cc=class extends xc{constructor(a,b,c=yc,d=yc){super();this.J=a[n]|0;this.K=b;this.S=c;this.fa=this.K?Ac:d;for(let e=0;e{a.call(b,e.get(d),d,e)}):super.forEach(a,b)}set(a,b){zc(this);a=this.S(a,!0,!1);return a==null?this:b==null?(super.delete(a),this):super.set(a,this.fa(b,!0,!0,this.K,!1,this.J))}Ma(a){const b=this.S(a[0],!1,!0);a=a[1];a=this.K?a===void 0?null:a:this.fa(a,!1,!0,void 0,!1,this.J);super.set(b,a)}has(a){return super.has(this.S(a,!1,!1))}get(a){a=this.S(a,!1,!1);const b=super.get(a);\nif(b!==void 0){var c=this.K;return c?(c=this.fa(b,!1,!0,c,this.ra,this.J),c!==b&&super.set(a,c),c):b}}[Symbol.iterator](){return this.entries()}};Cc.prototype.toJSON=void 0;function Ac(a,b,c,d,e,f){a=rc(a,d,c,f);e&&(a=Dc(a));return a}function Bc(a){return[a,this.get(a)]}let Ec;function Fc(){return Ec||=new Cc(hb([]),void 0,void 0,void 0,uc)};function Gc(a){const b=ca(Wa);return b?a[b]:void 0}function Ic(a,b){for(const c in a)!isNaN(c)&&b(a,+c,a[c])}function Jc(a){const b=new Kc;Ic(a,(c,d,e)=>{b[d]=Rb(e)});b.da=a.da;return b}var Kc=class{};const Lc={Ka:!0};function Mc(a,b){b<100||Pa(Ya,1)};function Nc(a,b,c,d){const e=d!==void 0;d=!!d;var f=ca(Wa),g;!e&&Ra&&f&&(g=a[f])&&Ic(g,Mc);f=[];var h=a.length;let k;g=4294967295;let w=!1;const m=!!(b&64),D=m?b&128?0:-1:void 0;b&1||(k=h&&a[h-1],k!=null&&typeof k===\"object\"&&k.constructor===Object?(h--,g=h):k=void 0,!m||b&128||e||(w=!0,g=(Oc??tc)(g-D,D,a,k,void 0)+D));b=void 0;for(var G=0;G=g){const wa=G-D;(b??={})[wa]=N}else f[G]=N}if(k)for(let N in k){h=k[N];if(h==null||(h=c(h,d))==null)continue;\nG=+N;let wa;m&&!Number.isNaN(G)&&(wa=G+D)>2];f=c[(f&3)<<4|g>>4];g=c[(g&15)<<2|h>>6];h=c[h&63];d[m++]=k+f+g+h}k=0;h=e;switch(b.length-w){case 2:k=b[w+1],h=c[(k&15)<<2]||e;case 1:b=b[w],d[m]=c[b>>2]+c[(b&3)<<4|k>>4]+h+e}b=d.join(\"\")}a=a.g=b}return a}if(a instanceof Cc)return a=a.size!==0?a.V(Pc):void 0,a;return}return a}let Oc;function Rc(a){a=a.v;return Nc(a,a[n]|0,Qc)};let Sc,Tc;function Uc(a){switch(typeof a){case \"boolean\":return Sc||=[0,void 0,!0];case \"number\":return a>0?void 0:a===0?Tc||=[0,void 0]:[-a,void 0];case \"string\":return[0,a];case \"object\":return a}}function Vc(a,b){return Wc(a,b[0],b[1])}\nfunction Wc(a,b,c,d=0){if(a==null){var e=32;c?(a=[c],e|=128):a=[];b&&(e=e&-16760833|(b&1023)<<14)}else{if(!Array.isArray(a))throw Error(\"narr\");e=a[n]|0;if(oa&&1&e)throw Error(\"rfarr\");2048&e&&!(2&e)&&Xc();if(e&256)throw Error(\"farr\");if(e&64)return(e|d)!==e&&p(a,e|d),a;if(c&&(e|=128,c!==a[0]))throw Error(\"mid\");a:{c=a;e|=64;var f=c.length;if(f){var g=f-1;const k=c[g];if(k!=null&&typeof k===\"object\"&&k.constructor===Object){b=e&128?0:-1;g-=b;if(g>=1024)throw Error(\"pvtlmt\");for(var h in k)f=+h,f<\ng&&(c[f+b]=k[h],delete k[h]);e=e&-16760833|(g&1023)<<14;break a}}if(b){h=Math.max(b,f-(e&128?0:-1));if(h>1024)throw Error(\"spvt\");e=e&-16760833|(h&1023)<<14}}}p(a,e|64|d);return a}function Xc(){if(oa)throw Error(\"carr\");Pa($a,5)};function Yc(a,b){if(typeof a!==\"object\")return a;if(Array.isArray(a)){var c=a[n]|0;return a.length===0&&c&1?void 0:Zc(a,c,b)}if(a!=null&&a[ab]===jb)return $c(a);if(a instanceof Cc){b=a.J;if(b&2)return a;if(!a.size)return;c=hb(a.V());if(a.K)for(a=0;a=f)if(g=a[f],g!=null&&typeof g===\"object\"&&g.constructor===Object)c=g[b],h=!0;else if(e===f)c=g;else return;else c=a[e];if(d&&c!=null){d=d(c);if(d==null)return d;if(!Object.is(d,c))return h?g[b]=d:a[e]=d,d}return c}}function v(a,b,c,d){ed(a);a=a.v;x(a,a[n]|0,b,c,d)}\nfunction x(a,b,c,d,e){const f=c+(e?0:-1);var g=a.length-1;if(g>=1+(e?0:-1)&&f>=g){const h=a[g];if(h!=null&&typeof h===\"object\"&&h.constructor===Object)return h[c]=d,b}if(f<=g)return a[f]=d,b;d!==void 0&&(g=(b??=a[n]|0)>>14&1023||536870912,c>=g?d!=null&&(a[g+(e?0:-1)]={[c]:d}):a[f]=d);return b}function jd(){return void 0===ob?2:4}\nfunction kd(a,b,c,d,e){let f=a.v,g=f[n]|0;d=kb(a,g)?1:d;e=!!e||d===3;d===2&&dd(a)&&(f=a.v,g=f[n]|0);a=ld(f,b);let h=a===eb?7:a[n]|0,k=md(h,g);var w=4&k?!1:!0;if(w){4&k&&(a=Rb(a),h=0,k=nd(k,g),g=x(f,g,b,a));let m=0,D=0;for(;m{const h=rc(g,c,!1,b);f=h!==g&&h!=null;return h});if(d!=null)return f&&!kb(d)&&fd(a,b),d}\nfunction y(a,b,c,d){let e=a.v,f=e[n]|0;b=Cd(e,f,b,c,d);if(b==null)return b;f=e[n]|0;if(!kb(a,f)){const g=Dc(b);g!==b&&(dd(a)&&(e=a.v,f=e[n]|0),b=g,f=x(e,f,c,b,d),fd(e,f))}return b}\nfunction Dd(a,b,c,d,e,f,g,h){var k=kb(a,c);f=k?1:f;g=!!g||f===3;k=h&&!k;(f===2||k)&&dd(a)&&(b=a.v,c=b[n]|0);a=ld(b,e);var w=a===eb?7:a[n]|0,m=md(w,c);if(h=!(4&m)){var D=a,G=c;const N=!!(2&m);N&&(G|=2);let wa=!N,Rf=!0,Hc=0,Td=0;for(;Hc32)for(e|=(c&127)>>4,f=3;f<32&&c&128;f+=7)c=g[h++],e|=(c&127)<>>0,e>>>0);throw Error();}function Rd(a){let b=0,c=a.g;const d=c+10,e=a.h;for(;c>>0}\nfunction Wd(a){var b=a.h;const c=a.g;var d=b[c];var e=b[c+1];const f=b[c+2];b=b[c+3];Qd(a,a.g+4);e=(d<<0|e<<8|f<<16|b<<24)>>>0;a=(e>>31)*2+1;d=e>>>23&255;e&=8388607;return d==255?e?NaN:a*Infinity:d==0?a*1.401298464324817E-45*e:a*Math.pow(2,d-150)*(e+8388608)}function Xd(a){return Sd(a)}function Qd(a,b){a.g=b;if(b>a.l)throw Error();}function Yd(a,b){if(b<0)throw Error();const c=a.g;b=c+b;if(b>a.l)throw Error();a.g=b;return c}\nfunction Zd(a,b){if(b==0)return Ha();var c=Yd(a,b);a.Y&&a.j?c=a.h.subarray(c,c+b):(a=a.h,b=c+b,c=c===b?new Uint8Array(0):Eb?a.slice(c,b):new Uint8Array(a.subarray(c,b)));return c.length==0?Ha():new Ja(c,Ga)}\nvar $d=class{constructor(a,b,c,d){this.h=null;this.j=!1;this.g=this.l=this.m=0;this.init(a,b,c,d)}init(a,b,c,{Y:d=!1,ea:e=!1}={}){this.Y=d;this.ea=e;a&&(a=Od(a,this.ea),this.h=a.buffer,this.j=a.g,this.m=b||0,this.l=c!==void 0?this.m+c:this.h.length,this.g=this.m)}clear(){this.h=null;this.j=!1;this.g=this.l=this.m=0;this.Y=!1}},ae=[];function be(a,b,c,d){if(ce.length){const e=ce.pop();e.o(d);e.g.init(a,b,c,d);return e}return new de(a,b,c,d)}function ee(a){a.g.clear();a.l=-1;a.h=-1;ce.length<100&&ce.push(a)}function fe(a){var b=a.g;if(b.g==b.l)return!1;a.m=a.g.g;var c=Vd(a.g);b=c>>>3;c&=7;if(!(c>=0&&c<=5))throw Error();if(b<1)throw Error();a.l=b;a.h=c;return!0}\nfunction ge(a){switch(a.h){case 0:a.h!=0?ge(a):Rd(a.g);break;case 1:a=a.g;Qd(a,a.g+8);break;case 2:if(a.h!=2)ge(a);else{var b=Vd(a.g);a=a.g;Qd(a,a.g+b)}break;case 5:a=a.g;Qd(a,a.g+4);break;case 3:b=a.l;do{if(!fe(a))throw Error();if(a.h==4){if(a.l!=b)throw Error();break}ge(a)}while(1);break;default:throw Error();}}function he(a,b,c){const d=a.g.l;var e=Vd(a.g);e=a.g.g+e;let f=e-d;f<=0&&(a.g.l=e,c(b,a,void 0,void 0,void 0),f=e-a.g.g);if(f)throw Error();a.g.g=e;a.g.l=d;return b}\nfunction ie(a){var b=Vd(a.g);a=a.g;var c=Yd(a,b);a=a.h;if(ia){var d=a,e;(e=ha)||(e=ha=new TextDecoder(\"utf-8\",{fatal:!0}));b=c+b;d=c===0&&b===d.length?d:d.subarray(c,b);try{var f=e.decode(d)}catch(h){if(fa===void 0){try{e.decode(new Uint8Array([128]))}catch(k){}try{e.decode(new Uint8Array([97])),fa=!0}catch(k){fa=!1}}!fa&&(ha=void 0);throw h;}}else{f=c;b=f+b;c=[];let h=null;let k;for(;f=b?da():(k=a[f++],g<194||(k&192)!==128?(f--,da()):c.push((g&31)<<6|k&63)):\ng<240?f>=b-1?da():(k=a[f++],(k&192)!==128||g===224&&k<160||g===237&&k>=160||((e=a[f++])&192)!==128?(f--,da()):c.push((g&15)<<12|(k&63)<<6|e&63)):g<=244?f>=b-2?da():(k=a[f++],(k&192)!==128||(g<<28)+(k-144)>>30!==0||((e=a[f++])&192)!==128||((d=a[f++])&192)!==128?(f--,da()):(g=(g&7)<<18|(k&63)<<12|(e&63)<<6|d&63,g-=65536,c.push((g>>10&1023)+55296,(g&1023)+56320))):da();c.length>=8192&&(h=ea(h,c),c.length=0)}f=ea(h,c)}return f}function je(a){const b=Vd(a.g);return Zd(a.g,b)}\nfunction ke(a,b,c){var d=Vd(a.g);for(d=a.g.g+d;a.g.g>>0;this.g=b>>>0}};let me;function oe(a){if(!a)return pe||=new qe(0,0);if(!/^-?\\d+$/.test(a))return null;Qb(a);return new qe(q,r)}var qe=class{constructor(a,b){this.h=a>>>0;this.g=b>>>0}};let pe;function re(a,b,c){for(;c>0||b>127;)a.g.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.g.push(b)}function se(a,b){for(;b>127;)a.g.push(b&127|128),b>>>=7;a.g.push(b)}function te(a,b){if(b>=0)se(a,b);else{for(let c=0;c<9;c++)a.g.push(b&127|128),b>>=7;a.g.push(1)}}function ue(a){var b=q;a.g.push(b>>>0&255);a.g.push(b>>>8&255);a.g.push(b>>>16&255);a.g.push(b>>>24&255)}var ve=class{constructor(){this.g=[]}length(){return this.g.length}end(){const a=this.g;this.g=[];return a}};function we(a,b){b.length!==0&&(a.l.push(b),a.h+=b.length)}function xe(a,b,c){se(a.g,b*8+c)}function ye(a,b){xe(a,b,2);b=a.g.end();we(a,b);b.push(a.h);return b}function ze(a,b){var c=b.pop();for(c=a.h+a.g.length()-c;c>127;)b.push(c&127|128),c>>>=7,a.h++;b.push(c);a.h++}function Ae(a,b,c){xe(a,b,2);se(a.g,c.length);we(a,a.g.end());we(a,c)}function Be(a,b,c,d){c!=null&&(b=ye(a,b),d(c,a),ze(a,b))}var Ce=class{constructor(){this.l=[];this.h=0;this.g=new ve}};function De(){const a=class{constructor(){throw Error();}};Object.setPrototypeOf(a,a.prototype);return a}var Ee=De(),Fe=De(),Ge=De(),He=De(),Ie=De(),Je=De(),Ke=De(),Le=De(),Me=De(),Ne=De();function Oe(a,b,c){var d=a.v;const e=ca(Wa);e&&e in d&&(d=d[e])&&delete d[b.g];b.h?b.j(a,b.h,b.g,c,b.l):b.j(a,b.g,c,b.l)}\nvar C=class{constructor(a,b){this.v=Wc(a,b,void 0,2048)}toJSON(){var a=Rc(this);return a}j(){var a=Pe,b=this.v,c=a.g,d=ca(Wa);Ra&&d&&b[d]?.[c]!=null&&Pa(Xa,3);b=a.g;if(ca(bb)&&ca(Wa)&&void 0===bb&&(c=this.v,d=c[Wa])&&(d=d.da))try{d(c,b,Lc)}catch(e){ma(e)}return a.h?a.m(this,a.h,a.g,a.l):a.m(this,a.g,a.defaultValue,a.l)}clone(){const a=this.v,b=a[n]|0;return cd(this,a,b)?bd(this,a,!0):new this.constructor(ad(a,b,!1))}};C.prototype[ab]=jb;C.prototype.toString=function(){return this.v.toString()};var Qe=class{constructor(a,b,c){this.g=a;this.h=b;a=ca(Ee);this.l=!!a&&c===a||!1}};function Re(a,b){return new Qe(a,b,Ee)}function Se(a,b,c,d,e){Be(a,c,Te(b,d),e)}const Ue=Re(function(a,b,c,d,e){if(a.h!==2)return!1;he(a,Bd(b,d,c),e);return!0},Se),Ve=Re(function(a,b,c,d,e){if(a.h!==2)return!1;he(a,Bd(b,d,c),e);return!0},Se);var We=Symbol(),Xe=Symbol(),Ye=Symbol(),Ze=Symbol(),$e=Symbol();let af,bf;\nfunction cf(a,b,c,d){var e=d[a];if(e)return e;e={};e.qa=d;e.T=Uc(d[0]);var f=d[1];let g=1;f&&f.constructor===Object&&(e.ba=f,f=d[++g],typeof f===\"function\"&&(e.ma=!0,af??=f,bf??=d[g+1],f=d[g+=2]));const h={};for(;f&&Array.isArray(f)&&f.length&&typeof f[0]===\"number\"&&f[0]>0;){for(var k=0;ke(f,g,h,d):e}function ff(a,b,c,d,e){const f=c.g;let g,h;a[b]=(k,w,m)=>f(k,w,m,h||=cf(Xe,ef,ff,d).T,g||=gf(d),e)}\nfunction gf(a){let b=a[Ye];if(b!=null)return b;const c=cf(Xe,ef,ff,a);b=c.ma?(d,e)=>af(d,e,c):(d,e)=>{for(;fe(e)&&e.h!=4;){var f=e.l,g=c[f];if(g==null){var h=c.ba;h&&(h=h[f])&&(h=hf(h),h!=null&&(g=c[f]=h))}if(g==null||!g(e,d,f)){h=e;g=h.m;ge(h);if(h.ha)var k=void 0;else k=h.g.g-g,h.g.g=g,k=Zd(h.g,k);g=void 0;h=d;k&&((g=h[Wa]??(h[Wa]=new Kc))[f]??(g[f]=[])).push(k)}}if(d=Gc(d))d.da=c.qa[$e];return!0};a[Ye]=b;a[$e]=jf.bind(a);return b}\nfunction jf(a,b,c,d){var e=this[Xe];const f=this[Ye],g=Vc(void 0,e.T),h=Gc(a);if(h){var k=!1,w=e.ba;if(w){e=(m,D,G)=>{if(G.length!==0)if(w[D])for(const N of G){m=be(N);try{k=!0,f(g,m)}finally{ee(m)}}else d?.(a,D,G)};if(b==null)Ic(h,e);else if(h!=null){const m=h[b];m&&e(h,b,m)}if(k){let m=a[n]|0;if(m&2&&m&2048&&!c?.Ka)throw Error();const D=rb(m),G=(N,wa)=>{if(id(a,N,D)!=null)switch(c?.Qa){case 1:return;default:throw Error();}wa!=null&&(m=x(a,m,N,wa,D));delete h[N]};b==null?pb(g,g[n]|0,(N,wa)=>{G(N,\nwa)}):G(b,id(g,b,D))}}}}function hf(a){a=df(a);const b=a[0].g;if(a=a[1]){const c=gf(a),d=cf(Xe,ef,ff,a).T;return(e,f,g)=>b(e,f,g,d,c)}return b};function kf(a,b,c){a[b]=c.h}function lf(a,b,c,d){let e,f;const g=c.h;a[b]=(h,k,w)=>g(h,k,w,f||=cf(We,kf,lf,d).T,e||=mf(d))}function mf(a){let b=a[Ze];if(!b){const c=cf(We,kf,lf,a);b=(d,e)=>nf(d,e,c);a[Ze]=b}return b}function nf(a,b,c){pb(a,a[n]|0,(d,e)=>{if(e!=null){var f=of(c,d);f?f(b,e,d):d<500||Pa(Za,3)}});(a=Gc(a))&&Ic(a,(d,e,f)=>{we(b,b.g.end());for(d=0;dd(g,h,k,f,e)}else c=d;return a[b]=c}};const pf=xb(0);function qf(a,b){if(Array.isArray(b)){var c=b[n]|0;if(c&4)return b;for(var d=0,e=0;d{Be(a,c,Vc([g,f],d),e)});else if(Array.isArray(b)){for(let f=0;f>BigInt(32)));re(a.g,c.h,c.g);break;default:c=oe(b),re(a.g,c.h,c.g)}}}function xf(a,b,c){b=dc(b);b!=null&&b!=null&&(xe(a,c,0),te(a.g,b))}\nfunction yf(a,b,c){b=ac(b);b!=null&&(xe(a,c,0),a.g.g.push(b?1:0))}function zf(a,b,c){b=t(b);b!=null&&Ae(a,c,la(b))}function Af(a,b,c,d,e){Be(a,c,Te(b,d),e)}function Bf(a,b,c){b=b==null||typeof b==\"string\"||b instanceof Ja?b:void 0;b!=null&&Ae(a,c,Od(b,!0).buffer)}function Cf(a,b,c){b=ec(b);b!=null&&b!=null&&(xe(a,c,0),se(a.g,b))}function Df(a,b,c){if(a.h!==5&&a.h!==2)return!1;b=vd(b,b[n]|0,c);a.h==2?ke(a,Wd,b):b.push(Wd(a.g));return!0}\nvar E=rf(function(a,b,c){if(a.h!==5)return!1;tf(b,c,Wd(a.g));return!0},vf,Le),Ef=sf(Df,function(a,b,c){b=qf(Zb,b);if(b!=null)for(let g=0;g>BigInt(32)));re(a.g,c.h,c.g);break;default:c=le(b),re(a.g,c.h,c.g)}}},Ke),\nF=rf(function(a,b,c){if(a.h!==0)return!1;tf(b,c,Sd(a.g));return!0},xf,He),Kf=sf(function(a,b,c){if(a.h!==0&&a.h!==2)return!1;b=vd(b,b[n]|0,c);a.h==2?ke(a,Sd,b):b.push(Sd(a.g));return!0},function(a,b,c){b=qf(dc,b);if(b!=null&&b.length){c=ye(a,c);for(let d=0;d{{const f={ea:!0};d&&Object.assign(f,d);c=be(c,void 0,void 0,f);try{const g=new a,h=g.v;gf(b)(h,c);var e=g}finally{ee(c)}}return e}}function Zf(a){return function(){const b=new Ce;nf(this.v,b,cf(We,kf,lf,a));we(b,b.g.end());const c=new Uint8Array(b.h),d=b.l,e=d.length;let f=0;for(let g=0;gc;a=cg.createPolicy(\"goog#html\",{createHTML:b,createScript:b,createScriptURL:b})}catch(b){}return a};var fg=class{constructor(a){this.g=a}toString(){return this.g+\"\"}};function gg(a){var b;dg===void 0&&(dg=eg());a=(b=dg)?b.createScriptURL(a):a;return new fg(a)};function hg(a,...b){if(b.length===0)return gg(a[0]);let c=a[0];for(let d=0;d({index:Id(d,1)??0??-1,score:A(d,2)??0,categoryName:t(u(d,3))??\"\"??\"\",displayName:t(u(d,4))??\"\"??\"\"})),headIndex:b,headName:c}}function Yh(a){const b={classifications:Ed(a,Qg,1).map(c=>Xh(y(c,Cg,4)?.g()??[],Id(c,2)??0,t(u(c,3))??\"\"))};lc(u(a,2,void 0,void 0,mc))!=null&&(b.timestampMs=Wh(u(a,2,void 0,void 0,mc)??gd));return b};function Zh(a){var b=kd(a,3,Zb,jd());var c=kd(a,2,dc,jd());var d=kd(a,1,t,jd());var e=kd(a,9,t,jd());const f={categories:[],keypoints:[]};for(let g=0;g{const c={headIndex:Id(b,3)??0??-1,headName:t(u(b,4))??\"\"??\"\"};var d=b.v;Cd(d,d[n]|0,Sg,wd(b,1))!==void 0?(b=y(b,Sg,wd(b,1),void 0),b=kd(b,1,Zb,jd()),c.floatEmbedding=b.slice()):(d=new Uint8Array(0),c.quantizedEmbedding=y(b,Tg,wd(b,2),void 0)?.na()?.h()??d);return c}),timestampMs:Wh(u(a,2,void 0,void 0,mc)??gd)}};function ai(a){const b=[];for(const c of Ed(a,Lg,1))b.push({x:A(c,1)??0,y:A(c,2)??0,z:A(c,3)??0,visibility:A(c,4)??0});return b}function bi(a){const b=[];for(const c of Ed(a,Jg,1))b.push({x:A(c,1)??0,y:A(c,2)??0,z:A(c,3)??0,visibility:A(c,4)??0});return b};function ci(a){return Array.from(a,b=>b>127?b-256:b)}function di(a,b){if(a.length!==b.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${a.length} vs. ${b.length}).`);let c=0,d=0,e=0;for(let f=0;f=1&&Number(a[1])>=17?!0:!1:!0};async function mi(a){if(typeof importScripts===\"function\")try{importScripts(a.toString())}catch(b){if(b instanceof TypeError){const c=self[\"import\"];if(c)await c(a.toString());else await import(a.toString());}else throw b;}else{const b=document.createElement(\"script\");b.src=a.toString();b.crossOrigin=\"anonymous\";return new Promise((c,d)=>{b.addEventListener(\"load\",()=>{c()},!1);b.addEventListener(\"error\",e=>{d(e)},!1);document.body.appendChild(b)})}};function ni(a){return a.videoWidth!==void 0?[a.videoWidth,a.videoHeight]:a.naturalWidth!==void 0?[a.naturalWidth,a.naturalHeight]:a.displayWidth!==void 0?[a.displayWidth,a.displayHeight]:[a.width,a.height]}function T(a,b,c){a.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\");b=a.i.stringToNewUTF8(b);c(b);a.i._free(b)}\nfunction oi(a,b,c){if(!a.i.canvas)throw Error(\"No OpenGL canvas configured.\");c?a.i._bindTextureToStream(c):a.i._bindTextureToCanvas();c=a.i.canvas.getContext(\"webgl2\")||a.i.canvas.getContext(\"webgl\");if(!c)throw Error(\"Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.\");a.i.gpuOriginForWebTexturesIsBottomLeft&&c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,!0);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b);a.i.gpuOriginForWebTexturesIsBottomLeft&&\nc.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,!1);const [d,e]=ni(b);!a.l||d===a.i.canvas.width&&e===a.i.canvas.height||(a.i.canvas.width=d,a.i.canvas.height=e);return[d,e]}\nfunction pi(a,b,c){a.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\");const d=new Uint32Array(b.length);for(let e=0;e>2);c(b);for(const e of d)a.i._free(e);a.i._free(b)}function qi(a,b,c){a.i.simpleListeners=a.i.simpleListeners||{};a.i.simpleListeners[b]=c}\nfunction ri(a,b,c){let d=[];a.i.simpleListeners=a.i.simpleListeners||{};a.i.simpleListeners[b]=(e,f,g)=>{f?(c(d,g),d=[]):d.push(e)}}\nvar si=class{constructor(a,b){this.l=!0;this.i=a;this.g=null;this.h=0;this.m=typeof this.i._addIntToInputStream===\"function\";b!==void 0?this.i.canvas=b:li()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(\"OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.\"),this.i.canvas=document.createElement(\"canvas\"))}async initializeGraph(a){const b=await (await fetch(a)).arrayBuffer();a=!(a.endsWith(\".pbtxt\")||a.endsWith(\".textproto\"));this.setGraph(new Uint8Array(b),\na)}setGraphFromString(a){this.setGraph((new TextEncoder).encode(a),!1)}setGraph(a,b){const c=a.length,d=this.i._malloc(c);this.i.HEAPU8.set(a,d);b?this.i._changeBinaryGraph(c,d):this.i._changeTextGraph(c,d);this.i._free(d)}configureAudio(a,b,c,d,e){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep \":gl_graph_runner_audio\" missing?');T(this,d||\"input_audio\",f=>{e=e||\"audio_header\";T(this,e,g=>{this.i._configureAudio(f,g,a,b??0,c)})})}setAutoResizeCanvas(a){this.l=\na}setAutoRenderToScreen(a){this.i._setAutoRenderToScreen(a)}setGpuBufferVerticalFlip(a){this.i.gpuOriginForWebTexturesIsBottomLeft=a}ca(a){qi(this,\"__graph_config__\",b=>{a(b)});T(this,\"__graph_config__\",b=>{this.i._getGraphConfig(b,void 0)});delete this.i.simpleListeners.__graph_config__}attachErrorListener(a){this.i.errorListener=a}attachEmptyPacketListener(a,b){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{};this.i.emptyPacketListeners[a]=b}addAudioToStream(a,b,c){this.addAudioToStreamWithShape(a,\n0,0,b,c)}addAudioToStreamWithShape(a,b,c,d,e){const f=a.length*4;this.h!==f&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(f),this.h=f);this.i.HEAPF32.set(a,this.g/4);T(this,d,g=>{this.i._addAudioToInputStream(this.g,b,c,g,e)})}addGpuBufferToStream(a,b,c){T(this,b,d=>{const [e,f]=oi(this,a,d);this.i._addBoundTextureToStream(d,e,f,c)})}addBoolToStream(a,b,c){T(this,b,d=>{this.i._addBoolToInputStream(a,d,c)})}addDoubleToStream(a,b,c){T(this,b,d=>{this.i._addDoubleToInputStream(a,d,c)})}addFloatToStream(a,\nb,c){T(this,b,d=>{this.i._addFloatToInputStream(a,d,c)})}addIntToStream(a,b,c){T(this,b,d=>{this.i._addIntToInputStream(a,d,c)})}addUintToStream(a,b,c){T(this,b,d=>{this.i._addUintToInputStream(a,d,c)})}addStringToStream(a,b,c){T(this,b,d=>{T(this,a,e=>{this.i._addStringToInputStream(e,d,c)})})}addStringRecordToStream(a,b,c){T(this,b,d=>{pi(this,Object.keys(a),e=>{pi(this,Object.values(a),f=>{this.i._addFlatHashMapToInputStream(e,f,Object.keys(a).length,d,c)})})})}addProtoToStream(a,b,c,d){T(this,\nc,e=>{T(this,b,f=>{const g=this.i._malloc(a.length);this.i.HEAPU8.set(a,g);this.i._addProtoToInputStream(g,a.length,f,e,d);this.i._free(g)})})}addEmptyPacketToStream(a,b){T(this,a,c=>{this.i._addEmptyPacketToInputStream(c,b)})}addBoolVectorToStream(a,b,c){T(this,b,d=>{const e=this.i._allocateBoolVector(a.length);if(!e)throw Error(\"Unable to allocate new bool vector on heap.\");for(const f of a)this.i._addBoolVectorEntry(e,f);this.i._addBoolVectorToInputStream(e,d,c)})}addDoubleVectorToStream(a,b,c){T(this,\nb,d=>{const e=this.i._allocateDoubleVector(a.length);if(!e)throw Error(\"Unable to allocate new double vector on heap.\");for(const f of a)this.i._addDoubleVectorEntry(e,f);this.i._addDoubleVectorToInputStream(e,d,c)})}addFloatVectorToStream(a,b,c){T(this,b,d=>{const e=this.i._allocateFloatVector(a.length);if(!e)throw Error(\"Unable to allocate new float vector on heap.\");for(const f of a)this.i._addFloatVectorEntry(e,f);this.i._addFloatVectorToInputStream(e,d,c)})}addIntVectorToStream(a,b,c){T(this,\nb,d=>{const e=this.i._allocateIntVector(a.length);if(!e)throw Error(\"Unable to allocate new int vector on heap.\");for(const f of a)this.i._addIntVectorEntry(e,f);this.i._addIntVectorToInputStream(e,d,c)})}addUintVectorToStream(a,b,c){T(this,b,d=>{const e=this.i._allocateUintVector(a.length);if(!e)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const f of a)this.i._addUintVectorEntry(e,f);this.i._addUintVectorToInputStream(e,d,c)})}addStringVectorToStream(a,b,c){T(this,b,d=>\n{const e=this.i._allocateStringVector(a.length);if(!e)throw Error(\"Unable to allocate new string vector on heap.\");for(const f of a)T(this,f,g=>{this.i._addStringVectorEntry(e,g)});this.i._addStringVectorToInputStream(e,d,c)})}addBoolToInputSidePacket(a,b){T(this,b,c=>{this.i._addBoolToInputSidePacket(a,c)})}addDoubleToInputSidePacket(a,b){T(this,b,c=>{this.i._addDoubleToInputSidePacket(a,c)})}addFloatToInputSidePacket(a,b){T(this,b,c=>{this.i._addFloatToInputSidePacket(a,c)})}addIntToInputSidePacket(a,\nb){T(this,b,c=>{this.i._addIntToInputSidePacket(a,c)})}addUintToInputSidePacket(a,b){T(this,b,c=>{this.i._addUintToInputSidePacket(a,c)})}addStringToInputSidePacket(a,b){T(this,b,c=>{T(this,a,d=>{this.i._addStringToInputSidePacket(d,c)})})}addProtoToInputSidePacket(a,b,c){T(this,c,d=>{T(this,b,e=>{const f=this.i._malloc(a.length);this.i.HEAPU8.set(a,f);this.i._addProtoToInputSidePacket(f,a.length,e,d);this.i._free(f)})})}addBoolVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateBoolVector(a.length);\nif(!d)throw Error(\"Unable to allocate new bool vector on heap.\");for(const e of a)this.i._addBoolVectorEntry(d,e);this.i._addBoolVectorToInputSidePacket(d,c)})}addDoubleVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateDoubleVector(a.length);if(!d)throw Error(\"Unable to allocate new double vector on heap.\");for(const e of a)this.i._addDoubleVectorEntry(d,e);this.i._addDoubleVectorToInputSidePacket(d,c)})}addFloatVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateFloatVector(a.length);\nif(!d)throw Error(\"Unable to allocate new float vector on heap.\");for(const e of a)this.i._addFloatVectorEntry(d,e);this.i._addFloatVectorToInputSidePacket(d,c)})}addIntVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateIntVector(a.length);if(!d)throw Error(\"Unable to allocate new int vector on heap.\");for(const e of a)this.i._addIntVectorEntry(d,e);this.i._addIntVectorToInputSidePacket(d,c)})}addUintVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateUintVector(a.length);\nif(!d)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const e of a)this.i._addUintVectorEntry(d,e);this.i._addUintVectorToInputSidePacket(d,c)})}addStringVectorToInputSidePacket(a,b){T(this,b,c=>{const d=this.i._allocateStringVector(a.length);if(!d)throw Error(\"Unable to allocate new string vector on heap.\");for(const e of a)T(this,e,f=>{this.i._addStringVectorEntry(d,f)});this.i._addStringVectorToInputSidePacket(d,c)})}attachBoolListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachBoolListener(c)})}attachBoolVectorListener(a,\nb){ri(this,a,b);T(this,a,c=>{this.i._attachBoolVectorListener(c)})}attachIntListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachIntListener(c)})}attachIntVectorListener(a,b){ri(this,a,b);T(this,a,c=>{this.i._attachIntVectorListener(c)})}attachUintListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachUintListener(c)})}attachUintVectorListener(a,b){ri(this,a,b);T(this,a,c=>{this.i._attachUintVectorListener(c)})}attachDoubleListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachDoubleListener(c)})}attachDoubleVectorListener(a,\nb){ri(this,a,b);T(this,a,c=>{this.i._attachDoubleVectorListener(c)})}attachFloatListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachFloatListener(c)})}attachFloatVectorListener(a,b){ri(this,a,b);T(this,a,c=>{this.i._attachFloatVectorListener(c)})}attachStringListener(a,b){qi(this,a,b);T(this,a,c=>{this.i._attachStringListener(c)})}attachStringVectorListener(a,b){ri(this,a,b);T(this,a,c=>{this.i._attachStringVectorListener(c)})}attachProtoListener(a,b,c){qi(this,a,b);T(this,a,d=>{this.i._attachProtoListener(d,\nc||!1)})}attachProtoVectorListener(a,b,c){ri(this,a,b);T(this,a,d=>{this.i._attachProtoVectorListener(d,c||!1)})}attachAudioListener(a,b,c){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep \":gl_graph_runner_audio_out\" missing?');qi(this,a,(d,e)=>{d=new Float32Array(d.buffer,d.byteOffset,d.length/4);b(d,e)});T(this,a,d=>{this.i._attachAudioListener(d,c||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph();\nthis.i.simpleListeners=void 0;this.i.emptyPacketListeners=void 0}},ti=async(a,b,c,d,e)=>{b&&await mi(b);if(!self.ModuleFactory)throw Error(\"ModuleFactory not set.\");if(c&&(await mi(c),!self.ModuleFactory))throw Error(\"ModuleFactory not set.\");self.Module&&e&&(b=self.Module,b.locateFile=e.locateFile,e.mainScriptUrlOrBlob&&(b.mainScriptUrlOrBlob=e.mainScriptUrlOrBlob));e=await self.ModuleFactory(self.Module||e);self.ModuleFactory=self.Module=void 0;return new a(e,d)};async function ui(a,b,c,d){a=await ti(a,c.wasmLoaderPath,c.assetLoaderPath,b,{locateFile(e){return e.endsWith(\".wasm\")?c.wasmBinaryPath.toString():c.assetBinaryPath&&e.endsWith(\".data\")?c.assetBinaryPath.toString():e}});await a.o(d);return a}async function vi(a,b,c,d){return ui(a,b,c,d)}function wi(a,b){let c=y(a.baseOptions,$g,3);if(!c){var d=c=new $g,e=new ng;Gd(d,4,ah,e)}\"delegate\"in b&&(b.delegate===\"GPU\"?(b=c,d=new jg,Gd(b,2,ah,d)):(b=c,d=new ng,Gd(b,4,ah,d)));z(a.baseOptions,$g,3,c)}\nfunction xi(a,b){const c=y(a.baseOptions,bh,1)||new bh;typeof b===\"string\"?(v(c,2,qc(b)),v(c,1)):b instanceof Uint8Array&&(v(c,1,mb(b,!1)),v(c,2));z(a.baseOptions,bh,1,c)}function yi(a){try{const b=a.H.length;if(b===1)throw Error(a.H[0].message);if(b>1)throw Error(\"Encountered multiple errors: \"+a.H.map(c=>c.message).join(\", \"));}finally{a.H=[]}}function U(a,b){a.C=Math.max(a.C,b)}\nfunction zi(a,b){a.B=new sg;Kd(a.B,2,\"PassThroughCalculator\");M(a.B,\"free_memory\");O(a.B,\"free_memory_unused_out\");P(b,\"free_memory\");xg(b,a.B)}function Ai(a,b){M(a.B,b);O(a.B,b+\"_unused_out\")}function Bi(a){a.g.addBoolToStream(!0,\"free_memory\",a.C)}\nvar Ci=class{constructor(a){this.g=a;this.H=[];this.C=0;this.g.setAutoRenderToScreen(!1)}l(a,b=!0){if(b){const c=a.baseOptions||{};if(a.baseOptions?.modelAssetBuffer&&a.baseOptions?.modelAssetPath)throw Error(\"Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer\");if(!(y(this.baseOptions,bh,1)?.g()||y(this.baseOptions,bh,1)?.l()||a.baseOptions?.modelAssetBuffer||a.baseOptions?.modelAssetPath))throw Error(\"Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set\");\nwi(this,c);if(c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(d=>{if(d.ok)return d.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${d.status})`);}).then(d=>{try{this.g.i.FS_unlink(\"/model.dat\")}catch{}this.g.i.FS_createDataFile(\"/\",\"model.dat\",new Uint8Array(d),!0,!1,!1);xi(this,\"/model.dat\");this.m();this.L()});if(c.modelAssetBuffer instanceof Uint8Array)xi(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return ji(c.modelAssetBuffer).then(d=>{xi(this,d);\nthis.m();this.L()})}this.m();this.L();return Promise.resolve()}L(){}ca(){let a;this.g.ca(b=>{a=Ag(b)});if(!a)throw Error(\"Failed to retrieve CalculatorGraphConfig\");return a}setGraph(a,b){this.g.attachErrorListener((c,d)=>{this.H.push(Error(d))});this.g.Ja();this.g.setGraph(a,b);this.B=void 0;yi(this)}finishProcessing(){this.g.finishProcessing();yi(this)}close(){this.B=void 0;this.g.closeGraph()}};Ci.prototype.close=Ci.prototype.close;export {Ci as TaskRunner};function Di(a,b){if(!a)throw Error(`Unable to obtain required WebGL resource: ${b}`);return a}class Ei{constructor(a,b,c,d){this.g=a;this.h=b;this.m=c;this.l=d}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h);this.g.deleteBuffer(this.m);this.g.deleteBuffer(this.l)}}\nfunction Fi(a,b,c){const d=a.g;c=Di(d.createShader(c),\"Failed to create WebGL shader\");d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${d.getShaderInfoLog(c)}`);d.attachShader(a.h,c);return c}\nfunction Gi(a,b){const c=a.g,d=Di(c.createVertexArray(),\"Failed to create vertex array\");c.bindVertexArray(d);const e=Di(c.createBuffer(),\"Failed to create buffer\");c.bindBuffer(c.ARRAY_BUFFER,e);c.enableVertexAttribArray(a.O);c.vertexAttribPointer(a.O,2,c.FLOAT,!1,0,0);c.bufferData(c.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),c.STATIC_DRAW);const f=Di(c.createBuffer(),\"Failed to create buffer\");c.bindBuffer(c.ARRAY_BUFFER,f);c.enableVertexAttribArray(a.L);c.vertexAttribPointer(a.L,2,c.FLOAT,\n!1,0,0);c.bufferData(c.ARRAY_BUFFER,new Float32Array(b?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),c.STATIC_DRAW);c.bindBuffer(c.ARRAY_BUFFER,null);c.bindVertexArray(null);return new Ei(c,d,e,f)}function Hi(a,b){if(!a.g)a.g=b;else if(b!==a.g)throw Error(\"Cannot change GL context once initialized\");}function Ii(a,b,c,d){Hi(a,b);a.h||(a.m(),a.D());c?(a.u||(a.u=Gi(a,!0)),c=a.u):(a.A||(a.A=Gi(a,!1)),c=a.A);b.useProgram(a.h);c.bind();a.l();a=d();c.g.bindVertexArray(null);return a}\nfunction Ji(a,b,c){Hi(a,b);a=Di(b.createTexture(),\"Failed to create texture\");b.bindTexture(b.TEXTURE_2D,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,c??b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,c??b.LINEAR);b.bindTexture(b.TEXTURE_2D,null);return a}\nfunction Ki(a,b,c){Hi(a,b);a.B||(a.B=Di(b.createFramebuffer(),\"Failed to create framebuffe.\"));b.bindFramebuffer(b.FRAMEBUFFER,a.B);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,c,0)}function Li(a){a.g?.bindFramebuffer(a.g.FRAMEBUFFER,null)}\nvar Mi=class{H(){return\"\\n precision mediump float;\\n varying vec2 vTex;\\n uniform sampler2D inputTexture;\\n void main() {\\n gl_FragColor = texture2D(inputTexture, vTex);\\n }\\n \"}m(){const a=this.g;this.h=Di(a.createProgram(),\"Failed to create WebGL program\");this.X=Fi(this,\"\\n attribute vec2 aVertex;\\n attribute vec2 aTex;\\n varying vec2 vTex;\\n void main(void) {\\n gl_Position = vec4(aVertex, 0.0, 1.0);\\n vTex = aTex;\\n }\",a.VERTEX_SHADER);this.W=Fi(this,this.H(),a.FRAGMENT_SHADER);\na.linkProgram(this.h);if(!a.getProgramParameter(this.h,a.LINK_STATUS))throw Error(`Error during program linking: ${a.getProgramInfoLog(this.h)}`);this.O=a.getAttribLocation(this.h,\"aVertex\");this.L=a.getAttribLocation(this.h,\"aTex\")}D(){}l(){}close(){if(this.h){const a=this.g;a.deleteProgram(this.h);a.deleteShader(this.X);a.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B);this.A&&this.A.close();this.u&&this.u.close()}};function Ni(a,b){if(a!==b)return!1;a=a.entries();b=b.entries();for(const [c,d]of a){a=c;const e=d,f=b.next();if(f.done)return!1;const [g,h]=f.value;if(a!==g||e[0]!==h[0]||e[1]!==h[1]||e[2]!==h[2]||e[3]!==h[3])return!1}return!!b.next().done}\nfunction Oi(a,b,c,d){const e=a.g;e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,b);e.activeTexture(e.TEXTURE1);e.bindTexture(e.TEXTURE_2D,a.C);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,c);if(a.I&&Ni(a.I,d))e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.j);else{a.I=d;const f=Array(1024).fill(0);d.forEach((g,h)=>{if(g.length!==4)throw Error(`Color at index ${h} is not a four-channel value.`);f[h*4]=g[0];f[h*4+1]=g[1];f[h*4+2]=g[2];f[h*4+3]=g[3]});e.activeTexture(e.TEXTURE2);\ne.bindTexture(e.TEXTURE_2D,a.j);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,256,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(f))}}\nvar Pi=class extends Mi{H(){return\"\\n precision mediump float;\\n uniform sampler2D backgroundTexture;\\n uniform sampler2D maskTexture;\\n uniform sampler2D colorMappingTexture;\\n varying vec2 vTex;\\n void main() {\\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\\n float category = texture2D(maskTexture, vTex).r;\\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\\n }\\n \"}D(){const a=this.g;\na.activeTexture(a.TEXTURE1);this.C=Ji(this,a,a.LINEAR);a.activeTexture(a.TEXTURE2);this.j=Ji(this,a,a.NEAREST)}m(){super.m();const a=this.g;this.P=Di(a.getUniformLocation(this.h,\"backgroundTexture\"),\"Uniform location\");this.U=Di(a.getUniformLocation(this.h,\"colorMappingTexture\"),\"Uniform location\");this.M=Di(a.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const a=this.g;a.uniform1i(this.M,0);a.uniform1i(this.P,1);a.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C);\nthis.j&&this.g.deleteTexture(this.j);super.close()}};var Qi=class extends Mi{H(){return\"\\n precision mediump float;\\n uniform sampler2D maskTexture;\\n uniform sampler2D defaultTexture;\\n uniform sampler2D overlayTexture;\\n varying vec2 vTex;\\n void main() {\\n float confidence = texture2D(maskTexture, vTex).r;\\n vec4 defaultColor = texture2D(defaultTexture, vTex);\\n vec4 overlayColor = texture2D(overlayTexture, vTex);\\n // Apply the alpha from the overlay and merge in the default color\\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\\n }\\n \"}D(){const a=\nthis.g;a.activeTexture(a.TEXTURE1);this.j=Ji(this,a);a.activeTexture(a.TEXTURE2);this.C=Ji(this,a)}m(){super.m();const a=this.g;this.M=Di(a.getUniformLocation(this.h,\"defaultTexture\"),\"Uniform location\");this.P=Di(a.getUniformLocation(this.h,\"overlayTexture\"),\"Uniform location\");this.I=Di(a.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const a=this.g;a.uniform1i(this.I,0);a.uniform1i(this.M,1);a.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j);this.C&&\nthis.g.deleteTexture(this.C);super.close()}};function Ri(a,b){switch(b){case 0:return a.g.find(c=>c instanceof Uint8Array);case 1:return a.g.find(c=>c instanceof Float32Array);case 2:return a.g.find(c=>typeof WebGLTexture!==\"undefined\"&&c instanceof WebGLTexture);default:throw Error(`Type is not supported: ${b}`);}}function Si(a){var b=Ri(a,0);b||(b=Ti(a),b=new Uint8Array(b.map(c=>Math.round(255*c))),a.g.push(b));return b}\nfunction Ti(a){var b=Ri(a,1);if(!b){if(b=Ri(a,0))b=(new Float32Array(b)).map(d=>d/255);else{b=new Float32Array(a.width*a.height);const d=Ui(a);var c=Vi(a);const e=Wi(a);Ki(c,d,e);if(\"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod\".split(\";\").includes(navigator.platform)||navigator.userAgent.includes(\"Mac\")&&\"document\"in self&&\"ontouchend\"in self.document){c=new Float32Array(a.width*a.height*4);d.readPixels(0,0,a.width,a.height,d.RGBA,d.FLOAT,c);for(let f=0,g=0;f{Xi(this);d.clearColor(0,0,0,0);d.clear(d.COLOR_BUFFER_BIT);d.drawArrays(d.TRIANGLE_FAN,0,4);Zi(this)});Li(e);Zi(this)}else throw Error(`Type is not supported: ${b}`);a.push(c)}return new V(a,\nthis.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ui(this).deleteTexture(Ri(this,2));aj=-1}},$i;V.prototype.close=V.prototype.close;V.prototype.clone=V.prototype.clone;V.prototype.getAsWebGLTexture=V.prototype.N;V.prototype.getAsFloat32Array=V.prototype.ia;V.prototype.getAsUint8Array=V.prototype.ja;V.prototype.hasWebGLTexture=V.prototype.R;V.prototype.hasFloat32Array=V.prototype.ka;V.prototype.hasUint8Array=V.prototype.Fa;var aj=250;export {V as MPMask};const bj={color:\"white\",lineWidth:4,radius:6};function cj(a){a=a||{};return{...bj,fillColor:a.color,...a}}function dj(a,b){return a instanceof Function?a(b):a}function ej(a,b,c){return Math.max(Math.min(b,c),Math.min(Math.max(b,c),a))}function fj(a){if(!a.l)throw Error(\"CPU rendering requested but CanvasRenderingContext2D not provided.\");return a.l}function gj(a){if(!a.j)throw Error(\"GPU rendering requested but WebGL2RenderingContext not provided.\");return a.j}\nfunction hj(a){a.g||(a.g=new Pi);return a.g}function ij(a){a.h||(a.h=new Qi);return a.h}function jj(a,b,c){if(b.R())c(b.N());else{const d=b.ka()?b.ia():b.ja();a.m=a.m??new Mi;const e=gj(a);a=new V([d],b.m,!1,e.canvas,a.m,b.width,b.height);c(a.N());a.close()}}\nfunction kj(a,b,c,d){const e=hj(a),f=gj(a),g=Array.isArray(c)?new ImageData(new Uint8ClampedArray(c),1,1):c;Ii(e,f,!0,()=>{Oi(e,b,g,d);f.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT);f.drawArrays(f.TRIANGLE_FAN,0,4);const h=e.g;h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,null);h.activeTexture(h.TEXTURE1);h.bindTexture(h.TEXTURE_2D,null);h.activeTexture(h.TEXTURE2);h.bindTexture(h.TEXTURE_2D,null)})}\nfunction lj(a,b,c,d){const e=gj(a);jj(a,b,f=>{kj(a,f,c,d);f=fj(a);f.drawImage(e.canvas,0,0,f.canvas.width,f.canvas.height)})}\nfunction mj(a,b,c,d){const e=gj(a),f=ij(a),g=Array.isArray(c)?new ImageData(new Uint8ClampedArray(c),1,1):c,h=Array.isArray(d)?new ImageData(new Uint8ClampedArray(d),1,1):d;Ii(f,e,!0,()=>{var k=f.g;k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,b);k.activeTexture(k.TEXTURE1);k.bindTexture(k.TEXTURE_2D,f.j);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,g);k.activeTexture(k.TEXTURE2);k.bindTexture(k.TEXTURE_2D,f.C);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,h);e.clearColor(0,\n0,0,0);e.clear(e.COLOR_BUFFER_BIT);e.drawArrays(e.TRIANGLE_FAN,0,4);e.bindTexture(e.TEXTURE_2D,null);k=f.g;k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,null);k.activeTexture(k.TEXTURE1);k.bindTexture(k.TEXTURE_2D,null);k.activeTexture(k.TEXTURE2);k.bindTexture(k.TEXTURE_2D,null)})}function nj(a,b,c,d){const e=gj(a);jj(a,b,f=>{mj(a,f,c,d);f=fj(a);f.drawImage(e.canvas,0,0,f.canvas.width,f.canvas.height)})}\nvar oj=class{constructor(a,b){typeof CanvasRenderingContext2D!==\"undefined\"&&a instanceof CanvasRenderingContext2D||a instanceof OffscreenCanvasRenderingContext2D?(this.l=a,this.j=b):this.j=a}ya(a,b){if(a){var c=fj(this);b=cj(b);c.save();var d=c.canvas,e=0;for(const f of a)c.fillStyle=dj(b.fillColor,{index:e,from:f}),c.strokeStyle=dj(b.color,{index:e,from:f}),c.lineWidth=dj(b.lineWidth,{index:e,from:f}),a=new Path2D,a.arc(f.x*d.width,f.y*d.height,dj(b.radius,{index:e,from:f}),0,2*Math.PI),c.fill(a),\nc.stroke(a),++e;c.restore()}}xa(a,b,c){if(a&&b){var d=fj(this);c=cj(c);d.save();var e=d.canvas,f=0;for(const g of b){d.beginPath();b=a[g.start];const h=a[g.end];b&&h&&(d.strokeStyle=dj(c.color,{index:f,from:b,to:h}),d.lineWidth=dj(c.lineWidth,{index:f,from:b,to:h}),d.moveTo(b.x*e.width,b.y*e.height),d.lineTo(h.x*e.width,h.y*e.height));++f;d.stroke()}d.restore()}}ua(a,b){const c=fj(this);b=cj(b);c.save();c.beginPath();c.lineWidth=dj(b.lineWidth,{});c.strokeStyle=dj(b.color,{});c.fillStyle=dj(b.fillColor,\n{});c.moveTo(a.originX,a.originY);c.lineTo(a.originX+a.width,a.originY);c.lineTo(a.originX+a.width,a.originY+a.height);c.lineTo(a.originX,a.originY+a.height);c.lineTo(a.originX,a.originY);c.stroke();c.fill();c.restore()}va(a,b,c=[0,0,0,255]){this.l?lj(this,a,c,b):kj(this,a.N(),c,b)}wa(a,b,c){this.l?nj(this,a,b,c):mj(this,a.N(),b,c)}close(){this.g?.close();this.g=void 0;this.h?.close();this.h=void 0;this.m?.close();this.m=void 0}};oj.prototype.close=oj.prototype.close;\noj.prototype.drawConfidenceMask=oj.prototype.wa;oj.prototype.drawCategoryMask=oj.prototype.va;oj.prototype.drawBoundingBox=oj.prototype.ua;oj.prototype.drawConnectors=oj.prototype.xa;oj.prototype.drawLandmarks=oj.prototype.ya;oj.lerp=function(a,b,c,d,e){return ej(d*(1-(a-b)/(c-b))+e*(1-(c-a)/(c-b)),d,e)};oj.clamp=ej;export {oj as DrawingUtils};function pj(a,b){switch(b){case 0:return a.g.find(c=>c instanceof ImageData);case 1:return a.g.find(c=>typeof ImageBitmap!==\"undefined\"&&c instanceof ImageBitmap);case 2:return a.g.find(c=>typeof WebGLTexture!==\"undefined\"&&c instanceof WebGLTexture);default:throw Error(`Type is not supported: ${b}`);}}\nfunction qj(a){var b=pj(a,0);if(!b){b=rj(a);const c=sj(a),d=new Uint8Array(a.width*a.height*4),e=tj(a);Ki(c,b,e);b.readPixels(0,0,a.width,a.height,b.RGBA,b.UNSIGNED_BYTE,d);Li(c);b=new ImageData(new Uint8ClampedArray(d.buffer),a.width,a.height);a.g.push(b)}return b}function tj(a){let b=pj(a,2);if(!b){const c=rj(a);b=uj(a);const d=pj(a,1)||qj(a);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,d);vj(a)}return b}\nfunction rj(a){if(!a.canvas)throw Error(\"Conversion to different image formats require that a canvas is passed when initializing the image.\");a.h||(a.h=Di(a.canvas.getContext(\"webgl2\"),\"You cannot use a canvas that is already bound to a different type of rendering context.\"));return a.h}function sj(a){a.l||(a.l=new Mi);return a.l}\nfunction uj(a){const b=rj(a);b.viewport(0,0,a.width,a.height);b.activeTexture(b.TEXTURE0);let c=pj(a,2);c||(c=Ji(sj(a),b),a.g.push(c),a.m=!0);b.bindTexture(b.TEXTURE_2D,c);return c}function vj(a){a.h.bindTexture(a.h.TEXTURE_2D,null)}\nfunction wj(a){const b=rj(a);return Ii(sj(a),b,!0,()=>xj(a,()=>{b.bindFramebuffer(b.FRAMEBUFFER,null);b.clearColor(0,0,0,0);b.clear(b.COLOR_BUFFER_BIT);b.drawArrays(b.TRIANGLE_FAN,0,4);if(!(a.canvas instanceof OffscreenCanvas))throw Error(\"Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas\");return a.canvas.transferToImageBitmap()}))}\nfunction xj(a,b){const c=a.canvas;if(c.width===a.width&&c.height===a.height)return b();const d=c.width,e=c.height;c.width=a.width;c.height=a.height;a=b();c.width=d;c.height=e;return a}\nvar W=class{constructor(a,b,c,d,e,f,g){this.g=a;this.j=b;this.m=c;this.canvas=d;this.l=e;this.width=f;this.height=g;if(this.j||this.m)--yj,yj===0&&console.error(\"You seem to be creating MPImage instances without invoking .close(). This leaks resources.\")}Ea(){return!!pj(this,0)}la(){return!!pj(this,1)}R(){return!!pj(this,2)}Ca(){return qj(this)}Ba(){var a=pj(this,1);a||(tj(this),uj(this),a=wj(this),vj(this),this.g.push(a),this.j=!0);return a}N(){return tj(this)}clone(){const a=[];for(const b of this.g){let c;\nif(b instanceof ImageData)c=new ImageData(b.data,this.width,this.height);else if(b instanceof WebGLTexture){const d=rj(this),e=sj(this);d.activeTexture(d.TEXTURE1);c=Ji(e,d);d.bindTexture(d.TEXTURE_2D,c);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null);d.bindTexture(d.TEXTURE_2D,null);Ki(e,d,c);Ii(e,d,!1,()=>{uj(this);d.clearColor(0,0,0,0);d.clear(d.COLOR_BUFFER_BIT);d.drawArrays(d.TRIANGLE_FAN,0,4);vj(this)});Li(e);vj(this)}else if(b instanceof ImageBitmap)tj(this),\nuj(this),c=wj(this),vj(this);else throw Error(`Type is not supported: ${b}`);a.push(c)}return new W(a,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&pj(this,1).close();this.m&&rj(this).deleteTexture(pj(this,2));yj=-1}};W.prototype.close=W.prototype.close;W.prototype.clone=W.prototype.clone;W.prototype.getAsWebGLTexture=W.prototype.N;W.prototype.getAsImageBitmap=W.prototype.Ba;W.prototype.getAsImageData=W.prototype.Ca;W.prototype.hasWebGLTexture=W.prototype.R;\nW.prototype.hasImageBitmap=W.prototype.la;W.prototype.hasImageData=W.prototype.Ea;var yj=250;export {W as MPImage};function zj(...a){return a.map(([b,c])=>({start:b,end:c}))};const Aj=function(a){return class extends a{Ja(){this.i._registerModelResourcesGraphService()}}}(function(a){return class extends a{get ga(){return this.i}pa(b,c,d){T(this,c,e=>{const [f,g]=oi(this,b,e);this.ga._addBoundTextureAsImageToStream(e,f,g,d)})}Z(b,c){qi(this,b,c);T(this,b,d=>{this.ga._attachImageListener(d)})}aa(b,c){ri(this,b,c);T(this,b,d=>{this.ga._attachImageVectorListener(d)})}}}(si));var Bj=class extends Aj{};\nasync function X(a,b,c){const d=c.canvas??(li()?void 0:document.createElement(\"canvas\"));return vi(a,d,b,c)}\nfunction Cj(a,b,c,d){if(a.U){const f=new Pg;if(c?.regionOfInterest){if(!a.oa)throw Error(\"This task doesn't support region-of-interest.\");var e=c.regionOfInterest;if(e.left>=e.right||e.top>=e.bottom)throw Error(\"Expected RectF with left < right and top < bottom.\");if(e.left<0||e.top<0||e.right>1||e.bottom>1)throw Error(\"Expected RectF values to be in [0,1].\");B(f,1,(e.left+e.right)/2);B(f,2,(e.top+e.bottom)/2);B(f,4,e.right-e.left);B(f,3,e.bottom-e.top)}else B(f,1,.5),B(f,2,.5),B(f,4,1),B(f,3,1);\nif(c?.rotationDegrees){if(c?.rotationDegrees%90!==0)throw Error(\"Expected rotation to be a multiple of 90\\u00b0.\");B(f,5,-Math.PI*c.rotationDegrees/180);if(c?.rotationDegrees%180!==0){const [g,h]=ni(b);c=A(f,3)*h/g;e=A(f,4)*g/h;B(f,4,c);B(f,3,e)}}a.g.addProtoToStream(f.g(),\"mediapipe.NormalizedRect\",a.U,d)}a.g.pa(b,a.X,d??performance.now());a.finishProcessing()}\nfunction Dj(a,b,c){if(a.baseOptions?.g())throw Error(\"Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.\");Cj(a,b,c,a.C+1)}function Ej(a,b,c,d){if(!a.baseOptions?.g())throw Error(\"Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.\");Cj(a,b,c,d)}\nfunction Fj(a,b,c,d){var e=b.data;const f=b.width;b=b.height;const g=f*b;if((e instanceof Uint8Array||e instanceof Float32Array)&&e.length!==g)throw Error(`Unsupported channel count: ${e.length/g}`);a=new V([e],c,!1,a.g.i.canvas,a.P,f,b);return d?a.clone():a}\nvar Gj=class extends Ci{constructor(a,b,c,d){super(a);this.g=a;this.X=b;this.U=c;this.oa=d;this.P=new Mi}l(a,b=!0){\"runningMode\"in a&&v(this.baseOptions,2,$b(!!a.runningMode&&a.runningMode!==\"IMAGE\"));if(a.canvas!==void 0&&this.g.i.canvas!==a.canvas)throw Error(\"You must create a new task to reset the canvas.\");return super.l(a,b)}close(){this.P.close();super.close()}};Gj.prototype.close=Gj.prototype.close;export {Gj as VisionTaskRunner};var Hj=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect_in\",!1);this.j={detections:[]};a=this.h=new dh;b=new R;z(a,R,1,b);B(this.h,2,.5);B(this.h,3,.3)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){\"minDetectionConfidence\"in a&&B(this.h,2,a.minDetectionConfidence??.5);\"minSuppressionThreshold\"in a&&B(this.h,3,a.minSuppressionThreshold??.3);return this.l(a)}F(a,b){this.j={detections:[]};Dj(this,a,b);return this.j}G(a,b,c){this.j={detections:[]};\nEj(this,a,c,b);return this.j}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect_in\");Q(a,\"detections\");const b=new Wf;Oe(b,fh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.face_detector.FaceDetectorGraph\");M(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect_in\");O(c,\"DETECTIONS:detections\");c.o(b);xg(a,c);this.g.attachProtoVectorListener(\"detections\",(d,e)=>{for(const f of d)d=Ig(f),this.j.detections.push(Zh(d));U(this,e)});this.g.attachEmptyPacketListener(\"detections\",d=>{U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),\n!0)}};Hj.prototype.detectForVideo=Hj.prototype.G;Hj.prototype.detect=Hj.prototype.F;Hj.prototype.setOptions=Hj.prototype.o;Hj.createFromModelPath=async function(a,b){return X(Hj,a,{baseOptions:{modelAssetPath:b}})};Hj.createFromModelBuffer=function(a,b){return X(Hj,a,{baseOptions:{modelAssetBuffer:b}})};Hj.createFromOptions=function(a,b){return X(Hj,a,b)};export {Hj as FaceDetector};var Ij=zj([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Jj=zj([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],\n[386,385],[385,384],[384,398],[398,362]),Kj=zj([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Lj=zj([474,475],[475,476],[476,477],[477,474]),Mj=zj([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Nj=zj([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Oj=zj([469,470],[470,471],[471,472],[472,469]),Pj=zj([10,338],[338,297],[297,332],[332,284],\n[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Qj=[...Ij,...Jj,...Kj,...Mj,...Nj,...Pj],Rj=zj([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,\n128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,\n135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,\n8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,\n238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,\n225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,\n89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,\n171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],\n[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],\n[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],\n[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,\n56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,\n131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,\n431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],\n[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,\n355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],\n[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],\n[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,\n404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],\n[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],\n[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],\n[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,\n401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,\n449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],\n[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],\n[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],\n[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,\n77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,\n100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],\n[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,\n227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,\n15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],\n[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],\n[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,\n125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],\n[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,\n113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,\n349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,\n375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,\n464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],\n[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,\n266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],\n[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],\n[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,\n336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],\n[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],\n[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],\n[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],\n[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,\n390],[339,448],[448,255],[255,339]);function Sj(a){a.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}\nvar Y=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!1);this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]};this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1;a=this.h=new ih;b=new R;z(a,R,1,b);this.A=new hh;z(this.h,hh,3,this.A);this.u=new dh;z(this.h,dh,2,this.u);Jd(this.u,4,1);B(this.u,2,.5);B(this.A,2,.5);B(this.h,4,.5)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){\"numFaces\"in a&&Jd(this.u,\n4,a.numFaces??1);\"minFaceDetectionConfidence\"in a&&B(this.u,2,a.minFaceDetectionConfidence??.5);\"minTrackingConfidence\"in a&&B(this.h,4,a.minTrackingConfidence??.5);\"minFacePresenceConfidence\"in a&&B(this.A,2,a.minFacePresenceConfidence??.5);\"outputFaceBlendshapes\"in a&&(this.outputFaceBlendshapes=!!a.outputFaceBlendshapes);\"outputFacialTransformationMatrixes\"in a&&(this.outputFacialTransformationMatrixes=!!a.outputFacialTransformationMatrixes);return this.l(a)}F(a,b){Sj(this);Dj(this,a,b);return this.j}G(a,\nb,c){Sj(this);Ej(this,a,c,b);return this.j}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect\");Q(a,\"face_landmarks\");const b=new Wf;Oe(b,kh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph\");M(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect\");O(c,\"NORM_LANDMARKS:face_landmarks\");c.o(b);xg(a,c);this.g.attachProtoVectorListener(\"face_landmarks\",(d,e)=>{for(const f of d)d=Mg(f),this.j.faceLandmarks.push(ai(d));U(this,e)});this.g.attachEmptyPacketListener(\"face_landmarks\",\nd=>{U(this,d)});this.outputFaceBlendshapes&&(Q(a,\"blendshapes\"),O(c,\"BLENDSHAPES:blendshapes\"),this.g.attachProtoVectorListener(\"blendshapes\",(d,e)=>{if(this.outputFaceBlendshapes)for(const f of d)d=Eg(f),this.j.faceBlendshapes.push(Xh(d.g()??[]));U(this,e)}),this.g.attachEmptyPacketListener(\"blendshapes\",d=>{U(this,d)}));this.outputFacialTransformationMatrixes&&(Q(a,\"face_geometry\"),O(c,\"FACE_GEOMETRY:face_geometry\"),this.g.attachProtoVectorListener(\"face_geometry\",(d,e)=>{if(this.outputFacialTransformationMatrixes)for(const f of d)d=\ngh(f),(d=y(d,Ng,2))&&this.j.facialTransformationMatrixes.push({rows:Id(d,1)??0??0,columns:Id(d,2)??0??0,data:kd(d,3,Zb,jd()).slice()??[]});U(this,e)}),this.g.attachEmptyPacketListener(\"face_geometry\",d=>{U(this,d)}));a=a.g();this.setGraph(new Uint8Array(a),!0)}};Y.prototype.detectForVideo=Y.prototype.G;Y.prototype.detect=Y.prototype.F;Y.prototype.setOptions=Y.prototype.o;Y.createFromModelPath=function(a,b){return X(Y,a,{baseOptions:{modelAssetPath:b}})};\nY.createFromModelBuffer=function(a,b){return X(Y,a,{baseOptions:{modelAssetBuffer:b}})};Y.createFromOptions=function(a,b){return X(Y,a,b)};Y.FACE_LANDMARKS_LIPS=Ij;Y.FACE_LANDMARKS_LEFT_EYE=Jj;\nY.FACE_LANDMARKS_LEFT_EYEBROW=Kj;Y.FACE_LANDMARKS_LEFT_IRIS=Lj;Y.FACE_LANDMARKS_RIGHT_EYE=Mj;\nY.FACE_LANDMARKS_RIGHT_EYEBROW=Nj;Y.FACE_LANDMARKS_RIGHT_IRIS=Oj;\nY.FACE_LANDMARKS_FACE_OVAL=Pj;Y.FACE_LANDMARKS_CONTOURS=Qj;\nY.FACE_LANDMARKS_TESSELATION=Rj;export {Y as FaceLandmarker};var Tj=zj([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Uj(a){a.gestures=[];a.landmarks=[];a.worldLandmarks=[];a.handedness=[]}function Vj(a){return a.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:a.gestures,landmarks:a.landmarks,worldLandmarks:a.worldLandmarks,handedness:a.handedness,handednesses:a.handedness}}\nfunction Wj(a,b=!0){const c=[];for(const e of a){var d=Eg(e);a=[];for(const f of d.g())d=b&&Id(f,1)!=null?Id(f,1)??0:-1,a.push({score:A(f,2)??0,index:d,categoryName:t(u(f,3))??\"\"??\"\",displayName:t(u(f,4))??\"\"??\"\"});c.push(a)}return c}\nvar Xj=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!1);this.gestures=[];this.landmarks=[];this.worldLandmarks=[];this.handedness=[];a=this.j=new rh;b=new R;z(a,R,1,b);this.u=new qh;z(this.j,qh,2,this.u);this.D=new ph;z(this.u,ph,3,this.D);this.A=new oh;z(this.u,oh,2,this.A);this.h=new nh;z(this.j,nh,3,this.h);B(this.A,2,.5);B(this.u,4,.5);B(this.D,2,.5)}get baseOptions(){return y(this.j,R,1)}set baseOptions(a){z(this.j,R,1,a)}o(a){Jd(this.A,3,a.numHands??1);\"minHandDetectionConfidence\"in\na&&B(this.A,2,a.minHandDetectionConfidence??.5);\"minTrackingConfidence\"in a&&B(this.u,4,a.minTrackingConfidence??.5);\"minHandPresenceConfidence\"in a&&B(this.D,2,a.minHandPresenceConfidence??.5);if(a.cannedGesturesClassifierOptions){var b=new lh,c=b,d=Vh(a.cannedGesturesClassifierOptions,y(this.h,lh,3)?.l());z(c,Wg,2,d);z(this.h,lh,3,b)}else a.cannedGesturesClassifierOptions===void 0&&y(this.h,lh,3)?.g();a.customGesturesClassifierOptions?(c=b=new lh,d=Vh(a.customGesturesClassifierOptions,y(this.h,\nlh,4)?.l()),z(c,Wg,2,d),z(this.h,lh,4,b)):a.customGesturesClassifierOptions===void 0&&y(this.h,lh,4)?.g();return this.l(a)}Ha(a,b){Uj(this);Dj(this,a,b);return Vj(this)}Ia(a,b,c){Uj(this);Ej(this,a,c,b);return Vj(this)}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect\");Q(a,\"hand_gestures\");Q(a,\"hand_landmarks\");Q(a,\"world_hand_landmarks\");Q(a,\"handedness\");const b=new Wf;Oe(b,wh,this.j);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph\");M(c,\"IMAGE:image_in\");\nM(c,\"NORM_RECT:norm_rect\");O(c,\"HAND_GESTURES:hand_gestures\");O(c,\"LANDMARKS:hand_landmarks\");O(c,\"WORLD_LANDMARKS:world_hand_landmarks\");O(c,\"HANDEDNESS:handedness\");c.o(b);xg(a,c);this.g.attachProtoVectorListener(\"hand_landmarks\",(d,e)=>{for(const f of d){d=Mg(f);const g=[];for(const h of Ed(d,Lg,1))g.push({x:A(h,1)??0,y:A(h,2)??0,z:A(h,3)??0,visibility:A(h,4)??0});this.landmarks.push(g)}U(this,e)});this.g.attachEmptyPacketListener(\"hand_landmarks\",d=>{U(this,d)});this.g.attachProtoVectorListener(\"world_hand_landmarks\",\n(d,e)=>{for(const f of d){d=Kg(f);const g=[];for(const h of Ed(d,Jg,1))g.push({x:A(h,1)??0,y:A(h,2)??0,z:A(h,3)??0,visibility:A(h,4)??0});this.worldLandmarks.push(g)}U(this,e)});this.g.attachEmptyPacketListener(\"world_hand_landmarks\",d=>{U(this,d)});this.g.attachProtoVectorListener(\"hand_gestures\",(d,e)=>{this.gestures.push(...Wj(d,!1));U(this,e)});this.g.attachEmptyPacketListener(\"hand_gestures\",d=>{U(this,d)});this.g.attachProtoVectorListener(\"handedness\",(d,e)=>{this.handedness.push(...Wj(d));\nU(this,e)});this.g.attachEmptyPacketListener(\"handedness\",d=>{U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};Xj.prototype.recognizeForVideo=Xj.prototype.Ia;Xj.prototype.recognize=Xj.prototype.Ha;Xj.prototype.setOptions=Xj.prototype.o;Xj.createFromModelPath=function(a,b){return X(Xj,a,{baseOptions:{modelAssetPath:b}})};Xj.createFromModelBuffer=function(a,b){return X(Xj,a,{baseOptions:{modelAssetBuffer:b}})};Xj.createFromOptions=function(a,b){return X(Xj,a,b)};Xj.HAND_CONNECTIONS=Tj;\nexport {Xj as GestureRecognizer};function Yj(a){return{landmarks:a.landmarks,worldLandmarks:a.worldLandmarks,handednesses:a.handedness,handedness:a.handedness}}\nvar Zj=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!1);this.landmarks=[];this.worldLandmarks=[];this.handedness=[];a=this.h=new qh;b=new R;z(a,R,1,b);this.u=new ph;z(this.h,ph,3,this.u);this.j=new oh;z(this.h,oh,2,this.j);Jd(this.j,3,1);B(this.j,2,.5);B(this.u,2,.5);B(this.h,4,.5)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){\"numHands\"in a&&Jd(this.j,3,a.numHands??1);\"minHandDetectionConfidence\"in a&&B(this.j,2,a.minHandDetectionConfidence??\n.5);\"minTrackingConfidence\"in a&&B(this.h,4,a.minTrackingConfidence??.5);\"minHandPresenceConfidence\"in a&&B(this.u,2,a.minHandPresenceConfidence??.5);return this.l(a)}F(a,b){this.landmarks=[];this.worldLandmarks=[];this.handedness=[];Dj(this,a,b);return Yj(this)}G(a,b,c){this.landmarks=[];this.worldLandmarks=[];this.handedness=[];Ej(this,a,c,b);return Yj(this)}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect\");Q(a,\"hand_landmarks\");Q(a,\"world_hand_landmarks\");Q(a,\"handedness\");const b=new Wf;Oe(b,\nxh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph\");M(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect\");O(c,\"LANDMARKS:hand_landmarks\");O(c,\"WORLD_LANDMARKS:world_hand_landmarks\");O(c,\"HANDEDNESS:handedness\");c.o(b);xg(a,c);this.g.attachProtoVectorListener(\"hand_landmarks\",(d,e)=>{for(const f of d)d=Mg(f),this.landmarks.push(ai(d));U(this,e)});this.g.attachEmptyPacketListener(\"hand_landmarks\",d=>{U(this,d)});this.g.attachProtoVectorListener(\"world_hand_landmarks\",\n(d,e)=>{for(const f of d)d=Kg(f),this.worldLandmarks.push(bi(d));U(this,e)});this.g.attachEmptyPacketListener(\"world_hand_landmarks\",d=>{U(this,d)});this.g.attachProtoVectorListener(\"handedness\",(d,e)=>{var f=this.handedness,g=f.push;const h=[];for(const k of d){d=Eg(k);const w=[];for(const m of d.g())w.push({score:A(m,2)??0,index:Id(m,1)??0??-1,categoryName:t(u(m,3))??\"\"??\"\",displayName:t(u(m,4))??\"\"??\"\"});h.push(w)}g.call(f,...h);U(this,e)});this.g.attachEmptyPacketListener(\"handedness\",d=>{U(this,\nd)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};Zj.prototype.detectForVideo=Zj.prototype.G;Zj.prototype.detect=Zj.prototype.F;Zj.prototype.setOptions=Zj.prototype.o;Zj.createFromModelPath=function(a,b){return X(Zj,a,{baseOptions:{modelAssetPath:b}})};Zj.createFromModelBuffer=function(a,b){return X(Zj,a,{baseOptions:{modelAssetBuffer:b}})};Zj.createFromOptions=function(a,b){return X(Zj,a,b)};Zj.HAND_CONNECTIONS=Tj;\nexport {Zj as HandLandmarker};var ak=zj([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function bk(a){a.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function ck(a){try{if(a.D)a.D(a.h);else return a.h}finally{Bi(a)}}function dk(a,b){a=Mg(a);b.push(ai(a))}\nvar Z=class extends Gj{constructor(a,b){super(new Bj(a,b),\"input_frames_image\",null,!1);this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]};this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1;a=this.j=new Bh;b=new R;z(a,R,1,b);this.I=new ph;z(this.j,ph,2,this.I);this.W=new yh;z(this.j,yh,3,this.W);this.u=new dh;z(this.j,dh,4,this.u);this.O=\nnew hh;z(this.j,hh,5,this.O);this.A=new zh;z(this.j,zh,6,this.A);this.M=new Ah;z(this.j,Ah,7,this.M);B(this.u,2,.5);B(this.u,3,.3);B(this.O,2,.5);B(this.A,2,.5);B(this.A,3,.3);B(this.M,2,.5);B(this.I,2,.5)}get baseOptions(){return y(this.j,R,1)}set baseOptions(a){z(this.j,R,1,a)}o(a){\"minFaceDetectionConfidence\"in a&&B(this.u,2,a.minFaceDetectionConfidence??.5);\"minFaceSuppressionThreshold\"in a&&B(this.u,3,a.minFaceSuppressionThreshold??.3);\"minFacePresenceConfidence\"in a&&B(this.O,2,a.minFacePresenceConfidence??\n.5);\"outputFaceBlendshapes\"in a&&(this.outputFaceBlendshapes=!!a.outputFaceBlendshapes);\"minPoseDetectionConfidence\"in a&&B(this.A,2,a.minPoseDetectionConfidence??.5);\"minPoseSuppressionThreshold\"in a&&B(this.A,3,a.minPoseSuppressionThreshold??.3);\"minPosePresenceConfidence\"in a&&B(this.M,2,a.minPosePresenceConfidence??.5);\"outputPoseSegmentationMasks\"in a&&(this.outputPoseSegmentationMasks=!!a.outputPoseSegmentationMasks);\"minHandLandmarksConfidence\"in a&&B(this.I,2,a.minHandLandmarksConfidence??\n.5);return this.l(a)}F(a,b,c){const d=typeof b!==\"function\"?b:{};this.D=typeof b===\"function\"?b:c;bk(this);Dj(this,a,d);return ck(this)}G(a,b,c,d){const e=typeof c!==\"function\"?c:{};this.D=typeof c===\"function\"?c:d;bk(this);Ej(this,a,e,b);return ck(this)}m(){var a=new yg;P(a,\"input_frames_image\");Q(a,\"pose_landmarks\");Q(a,\"pose_world_landmarks\");Q(a,\"face_landmarks\");Q(a,\"left_hand_landmarks\");Q(a,\"left_hand_world_landmarks\");Q(a,\"right_hand_landmarks\");Q(a,\"right_hand_world_landmarks\");const b=new Wf,\nc=new ag;Kd(c,1,\"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions\");$f(c,this.j.g());const d=new sg;Kd(d,2,\"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph\");Hd(d,8,ag,c);M(d,\"IMAGE:input_frames_image\");O(d,\"POSE_LANDMARKS:pose_landmarks\");O(d,\"POSE_WORLD_LANDMARKS:pose_world_landmarks\");O(d,\"FACE_LANDMARKS:face_landmarks\");O(d,\"LEFT_HAND_LANDMARKS:left_hand_landmarks\");O(d,\"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks\");\nO(d,\"RIGHT_HAND_LANDMARKS:right_hand_landmarks\");O(d,\"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks\");d.o(b);xg(a,d);zi(this,a);this.g.attachProtoListener(\"pose_landmarks\",(e,f)=>{dk(e,this.h.poseLandmarks);U(this,f)});this.g.attachEmptyPacketListener(\"pose_landmarks\",e=>{U(this,e)});this.g.attachProtoListener(\"pose_world_landmarks\",(e,f)=>{var g=this.h.poseWorldLandmarks;e=Kg(e);g.push(bi(e));U(this,f)});this.g.attachEmptyPacketListener(\"pose_world_landmarks\",e=>{U(this,e)});this.outputPoseSegmentationMasks&&\n(O(d,\"POSE_SEGMENTATION_MASK:pose_segmentation_mask\"),Ai(this,\"pose_segmentation_mask\"),this.g.Z(\"pose_segmentation_mask\",(e,f)=>{this.h.poseSegmentationMasks=[Fj(this,e,!0,!this.D)];U(this,f)}),this.g.attachEmptyPacketListener(\"pose_segmentation_mask\",e=>{this.h.poseSegmentationMasks=[];U(this,e)}));this.g.attachProtoListener(\"face_landmarks\",(e,f)=>{dk(e,this.h.faceLandmarks);U(this,f)});this.g.attachEmptyPacketListener(\"face_landmarks\",e=>{U(this,e)});this.outputFaceBlendshapes&&(Q(a,\"extra_blendshapes\"),\nO(d,\"FACE_BLENDSHAPES:extra_blendshapes\"),this.g.attachProtoListener(\"extra_blendshapes\",(e,f)=>{var g=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=Eg(e),g.push(Xh(e.g()??[])));U(this,f)}),this.g.attachEmptyPacketListener(\"extra_blendshapes\",e=>{U(this,e)}));this.g.attachProtoListener(\"left_hand_landmarks\",(e,f)=>{dk(e,this.h.leftHandLandmarks);U(this,f)});this.g.attachEmptyPacketListener(\"left_hand_landmarks\",e=>{U(this,e)});this.g.attachProtoListener(\"left_hand_world_landmarks\",(e,f)=>\n{var g=this.h.leftHandWorldLandmarks;e=Kg(e);g.push(bi(e));U(this,f)});this.g.attachEmptyPacketListener(\"left_hand_world_landmarks\",e=>{U(this,e)});this.g.attachProtoListener(\"right_hand_landmarks\",(e,f)=>{dk(e,this.h.rightHandLandmarks);U(this,f)});this.g.attachEmptyPacketListener(\"right_hand_landmarks\",e=>{U(this,e)});this.g.attachProtoListener(\"right_hand_world_landmarks\",(e,f)=>{var g=this.h.rightHandWorldLandmarks;e=Kg(e);g.push(bi(e));U(this,f)});this.g.attachEmptyPacketListener(\"right_hand_world_landmarks\",\ne=>{U(this,e)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};Z.prototype.detectForVideo=Z.prototype.G;Z.prototype.detect=Z.prototype.F;Z.prototype.setOptions=Z.prototype.o;Z.createFromModelPath=function(a,b){return X(Z,a,{baseOptions:{modelAssetPath:b}})};Z.createFromModelBuffer=function(a,b){return X(Z,a,{baseOptions:{modelAssetBuffer:b}})};Z.createFromOptions=function(a,b){return X(Z,a,b)};Z.HAND_CONNECTIONS=Tj;\nZ.POSE_CONNECTIONS=ak;Z.FACE_LANDMARKS_LIPS=Ij;\nZ.FACE_LANDMARKS_LEFT_EYE=Jj;Z.FACE_LANDMARKS_LEFT_EYEBROW=Kj;\nZ.FACE_LANDMARKS_LEFT_IRIS=Lj;Z.FACE_LANDMARKS_RIGHT_EYE=Mj;\nZ.FACE_LANDMARKS_RIGHT_EYEBROW=Nj;Z.FACE_LANDMARKS_RIGHT_IRIS=Oj;\nZ.FACE_LANDMARKS_FACE_OVAL=Pj;Z.FACE_LANDMARKS_CONTOURS=Qj;\nZ.FACE_LANDMARKS_TESSELATION=Rj;export {Z as HolisticLandmarker};var ek=class extends Gj{constructor(a,b){super(new Bj(a,b),\"input_image\",\"norm_rect\",!0);this.j={classifications:[]};a=this.h=new Eh;b=new R;z(a,R,1,b)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){var b=this.h,c=Vh(a,y(this.h,Wg,2));z(b,Wg,2,c);return this.l(a)}sa(a,b){this.j={classifications:[]};Dj(this,a,b);return this.j}ta(a,b,c){this.j={classifications:[]};Ej(this,a,c,b);return this.j}m(){var a=new yg;P(a,\"input_image\");P(a,\"norm_rect\");Q(a,\"classifications\");\nconst b=new Wf;Oe(b,Fh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph\");M(c,\"IMAGE:input_image\");M(c,\"NORM_RECT:norm_rect\");O(c,\"CLASSIFICATIONS:classifications\");c.o(b);xg(a,c);this.g.attachProtoListener(\"classifications\",(d,e)=>{this.j=Yh(Rg(d));U(this,e)});this.g.attachEmptyPacketListener(\"classifications\",d=>{U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};ek.prototype.classifyForVideo=ek.prototype.ta;ek.prototype.classify=ek.prototype.sa;\nek.prototype.setOptions=ek.prototype.o;ek.createFromModelPath=function(a,b){return X(ek,a,{baseOptions:{modelAssetPath:b}})};ek.createFromModelBuffer=function(a,b){return X(ek,a,{baseOptions:{modelAssetBuffer:b}})};ek.createFromOptions=function(a,b){return X(ek,a,b)};export {ek as ImageClassifier};var fk=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!0);this.h=new Gh;this.embeddings={embeddings:[]};a=this.h;b=new R;z(a,R,1,b)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){var b=this.h,c=y(this.h,Yg,2);c=c?c.clone():new Yg;a.l2Normalize!==void 0?v(c,1,$b(a.l2Normalize)):\"l2Normalize\"in a&&v(c,1);a.quantize!==void 0?v(c,2,$b(a.quantize)):\"quantize\"in a&&v(c,2);z(b,Yg,2,c);return this.l(a)}za(a,b){Dj(this,a,b);return this.embeddings}Aa(a,\nb,c){Ej(this,a,c,b);return this.embeddings}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect\");Q(a,\"embeddings_out\");const b=new Wf;Oe(b,Hh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph\");M(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect\");O(c,\"EMBEDDINGS:embeddings_out\");c.o(b);xg(a,c);this.g.attachProtoListener(\"embeddings_out\",(d,e)=>{d=Vg(d);this.embeddings=$h(d);U(this,e)});this.g.attachEmptyPacketListener(\"embeddings_out\",d=>{U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),\n!0)}};fk.cosineSimilarity=function(a,b){if(a.floatEmbedding&&b.floatEmbedding)a=di(a.floatEmbedding,b.floatEmbedding);else if(a.quantizedEmbedding&&b.quantizedEmbedding)a=di(ci(a.quantizedEmbedding),ci(b.quantizedEmbedding));else throw Error(\"Cannot compute cosine similarity between quantized and float embeddings.\");return a};fk.prototype.embedForVideo=fk.prototype.Aa;fk.prototype.embed=fk.prototype.za;fk.prototype.setOptions=fk.prototype.o;fk.createFromModelPath=function(a,b){return X(fk,a,{baseOptions:{modelAssetPath:b}})};\nfk.createFromModelBuffer=function(a,b){return X(fk,a,{baseOptions:{modelAssetBuffer:b}})};fk.createFromOptions=function(a,b){return X(fk,a,b)};export {fk as ImageEmbedder};var gk=class{constructor(a,b,c){this.confidenceMasks=a;this.categoryMask=b;this.qualityScores=c}close(){this.confidenceMasks?.forEach(a=>{a.close()});this.categoryMask?.close()}};gk.prototype.close=gk.prototype.close;export {gk as ImageSegmenterResult};function hk(a){const b=wg(a.ca()).filter(c=>(t(u(c,1))??\"\").includes(\"mediapipe.tasks.TensorsToSegmentationCalculator\"));a.u=[];if(b.length>1)throw Error(\"The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.\");b.length===1&&(y(b[0],Wf,7)?.j()?.g()??new Map).forEach((c,d)=>{a.u[Number(d)]=t(u(c,1))??\"\"})}function ik(a){a.categoryMask=void 0;a.confidenceMasks=void 0;a.qualityScores=void 0}\nfunction jk(a){try{const b=new gk(a.confidenceMasks,a.categoryMask,a.qualityScores);if(a.j)a.j(b);else return b}finally{Bi(a)}}\nvar kk=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!1);this.u=[];this.outputCategoryMask=!1;this.outputConfidenceMasks=!0;this.h=new Kh;this.A=new Ih;z(this.h,Ih,3,this.A);a=this.h;b=new R;z(a,R,1,b)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){a.displayNamesLocale!==void 0?v(this.h,2,qc(a.displayNamesLocale)):\"displayNamesLocale\"in a&&v(this.h,2);\"outputCategoryMask\"in a&&(this.outputCategoryMask=a.outputCategoryMask??!1);\"outputConfidenceMasks\"in\na&&(this.outputConfidenceMasks=a.outputConfidenceMasks??!0);return super.l(a)}L(){hk(this)}segment(a,b,c){const d=typeof b!==\"function\"?b:{};this.j=typeof b===\"function\"?b:c;ik(this);Dj(this,a,d);return jk(this)}La(a,b,c,d){const e=typeof c!==\"function\"?c:{};this.j=typeof c===\"function\"?c:d;ik(this);Ej(this,a,e,b);return jk(this)}Da(){return this.u}m(){var a=new yg;P(a,\"image_in\");P(a,\"norm_rect\");const b=new Wf;Oe(b,Lh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph\");\nM(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect\");c.o(b);xg(a,c);zi(this,a);this.outputConfidenceMasks&&(Q(a,\"confidence_masks\"),O(c,\"CONFIDENCE_MASKS:confidence_masks\"),Ai(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",(d,e)=>{this.confidenceMasks=d.map(f=>Fj(this,f,!0,!this.j));U(this,e)}),this.g.attachEmptyPacketListener(\"confidence_masks\",d=>{this.confidenceMasks=[];U(this,d)}));this.outputCategoryMask&&(Q(a,\"category_mask\"),O(c,\"CATEGORY_MASK:category_mask\"),Ai(this,\"category_mask\"),this.g.Z(\"category_mask\",\n(d,e)=>{this.categoryMask=Fj(this,d,!1,!this.j);U(this,e)}),this.g.attachEmptyPacketListener(\"category_mask\",d=>{this.categoryMask=void 0;U(this,d)}));Q(a,\"quality_scores\");O(c,\"QUALITY_SCORES:quality_scores\");this.g.attachFloatVectorListener(\"quality_scores\",(d,e)=>{this.qualityScores=d;U(this,e)});this.g.attachEmptyPacketListener(\"quality_scores\",d=>{this.categoryMask=void 0;U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};kk.prototype.getLabels=kk.prototype.Da;\nkk.prototype.segmentForVideo=kk.prototype.La;kk.prototype.segment=kk.prototype.segment;kk.prototype.setOptions=kk.prototype.o;kk.createFromModelPath=function(a,b){return X(kk,a,{baseOptions:{modelAssetPath:b}})};kk.createFromModelBuffer=function(a,b){return X(kk,a,{baseOptions:{modelAssetBuffer:b}})};kk.createFromOptions=function(a,b){return X(kk,a,b)};export {kk as ImageSegmenter};var lk=class{constructor(a,b,c){this.confidenceMasks=a;this.categoryMask=b;this.qualityScores=c}close(){this.confidenceMasks?.forEach(a=>{a.close()});this.categoryMask?.close()}};lk.prototype.close=lk.prototype.close;export {lk as InteractiveSegmenterResult};var mk=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect_in\",!1);this.outputCategoryMask=!1;this.outputConfidenceMasks=!0;this.h=new Kh;this.u=new Ih;z(this.h,Ih,3,this.u);a=this.h;b=new R;z(a,R,1,b)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){\"outputCategoryMask\"in a&&(this.outputCategoryMask=a.outputCategoryMask??!1);\"outputConfidenceMasks\"in a&&(this.outputConfidenceMasks=a.outputConfidenceMasks??!0);return super.l(a)}segment(a,b,c,d){const e=\ntypeof c!==\"function\"?c:{};this.j=typeof c===\"function\"?c:d;this.qualityScores=this.categoryMask=this.confidenceMasks=void 0;c=this.C+1;d=new Ph;if(b.keypoint&&b.scribble)throw Error(\"Cannot provide both keypoint and scribble.\");if(b.keypoint){var f=new Mh;ud(f,3,$b(!0),!1);ud(f,1,Yb(b.keypoint.x),0);ud(f,2,Yb(b.keypoint.y),0);Gd(d,1,Qh,f)}else if(b.scribble){const h=new Oh;for(f of b.scribble)b=new Mh,ud(b,3,$b(!0),!1),ud(b,1,Yb(f.x),0),ud(b,2,Yb(f.y),0),Hd(h,1,Mh,b);Gd(d,2,Qh,h)}else throw Error(\"Must provide either a keypoint or a scribble.\");\nthis.g.addProtoToStream(d.g(),\"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest\",\"roi_in\",c);Dj(this,a,e);a:{try{const h=new lk(this.confidenceMasks,this.categoryMask,this.qualityScores);if(this.j)this.j(h);else{var g=h;break a}}finally{Bi(this)}g=void 0}return g}m(){var a=new yg;P(a,\"image_in\");P(a,\"roi_in\");P(a,\"norm_rect_in\");const b=new Wf;Oe(b,Lh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2\");M(c,\"IMAGE:image_in\");\nM(c,\"ROI:roi_in\");M(c,\"NORM_RECT:norm_rect_in\");c.o(b);xg(a,c);zi(this,a);this.outputConfidenceMasks&&(Q(a,\"confidence_masks\"),O(c,\"CONFIDENCE_MASKS:confidence_masks\"),Ai(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",(d,e)=>{this.confidenceMasks=d.map(f=>Fj(this,f,!0,!this.j));U(this,e)}),this.g.attachEmptyPacketListener(\"confidence_masks\",d=>{this.confidenceMasks=[];U(this,d)}));this.outputCategoryMask&&(Q(a,\"category_mask\"),O(c,\"CATEGORY_MASK:category_mask\"),Ai(this,\"category_mask\"),this.g.Z(\"category_mask\",\n(d,e)=>{this.categoryMask=Fj(this,d,!1,!this.j);U(this,e)}),this.g.attachEmptyPacketListener(\"category_mask\",d=>{this.categoryMask=void 0;U(this,d)}));Q(a,\"quality_scores\");O(c,\"QUALITY_SCORES:quality_scores\");this.g.attachFloatVectorListener(\"quality_scores\",(d,e)=>{this.qualityScores=d;U(this,e)});this.g.attachEmptyPacketListener(\"quality_scores\",d=>{this.categoryMask=void 0;U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};mk.prototype.segment=mk.prototype.segment;\nmk.prototype.setOptions=mk.prototype.o;mk.createFromModelPath=function(a,b){return X(mk,a,{baseOptions:{modelAssetPath:b}})};mk.createFromModelBuffer=function(a,b){return X(mk,a,{baseOptions:{modelAssetBuffer:b}})};mk.createFromOptions=function(a,b){return X(mk,a,b)};export {mk as InteractiveSegmenter};var nk=class extends Gj{constructor(a,b){super(new Bj(a,b),\"input_frame_gpu\",\"norm_rect\",!1);this.j={detections:[]};a=this.h=new Rh;b=new R;z(a,R,1,b)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){a.displayNamesLocale!==void 0?v(this.h,2,qc(a.displayNamesLocale)):\"displayNamesLocale\"in a&&v(this.h,2);a.maxResults!==void 0?Jd(this.h,3,a.maxResults):\"maxResults\"in a&&v(this.h,3);a.scoreThreshold!==void 0?B(this.h,4,a.scoreThreshold):\"scoreThreshold\"in a&&v(this.h,4);\na.categoryAllowlist!==void 0?Ld(this.h,5,a.categoryAllowlist):\"categoryAllowlist\"in a&&v(this.h,5);a.categoryDenylist!==void 0?Ld(this.h,6,a.categoryDenylist):\"categoryDenylist\"in a&&v(this.h,6);return this.l(a)}F(a,b){this.j={detections:[]};Dj(this,a,b);return this.j}G(a,b,c){this.j={detections:[]};Ej(this,a,c,b);return this.j}m(){var a=new yg;P(a,\"input_frame_gpu\");P(a,\"norm_rect\");Q(a,\"detections\");const b=new Wf;Oe(b,Sh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.ObjectDetectorGraph\");\nM(c,\"IMAGE:input_frame_gpu\");M(c,\"NORM_RECT:norm_rect\");O(c,\"DETECTIONS:detections\");c.o(b);xg(a,c);this.g.attachProtoVectorListener(\"detections\",(d,e)=>{for(const f of d)d=Ig(f),this.j.detections.push(Zh(d));U(this,e)});this.g.attachEmptyPacketListener(\"detections\",d=>{U(this,d)});a=a.g();this.setGraph(new Uint8Array(a),!0)}};nk.prototype.detectForVideo=nk.prototype.G;nk.prototype.detect=nk.prototype.F;nk.prototype.setOptions=nk.prototype.o;\nnk.createFromModelPath=async function(a,b){return X(nk,a,{baseOptions:{modelAssetPath:b}})};nk.createFromModelBuffer=function(a,b){return X(nk,a,{baseOptions:{modelAssetBuffer:b}})};nk.createFromOptions=function(a,b){return X(nk,a,b)};export {nk as ObjectDetector};var ok=class{constructor(a,b,c){this.landmarks=a;this.worldLandmarks=b;this.segmentationMasks=c}close(){this.segmentationMasks?.forEach(a=>{a.close()})}};ok.prototype.close=ok.prototype.close;function pk(a){a.landmarks=[];a.worldLandmarks=[];a.segmentationMasks=void 0}function qk(a){try{const b=new ok(a.landmarks,a.worldLandmarks,a.segmentationMasks);if(a.u)a.u(b);else return b}finally{Bi(a)}}\nvar rk=class extends Gj{constructor(a,b){super(new Bj(a,b),\"image_in\",\"norm_rect\",!1);this.landmarks=[];this.worldLandmarks=[];this.outputSegmentationMasks=!1;a=this.h=new Th;b=new R;z(a,R,1,b);this.A=new Ah;z(this.h,Ah,3,this.A);this.j=new zh;z(this.h,zh,2,this.j);Jd(this.j,4,1);B(this.j,2,.5);B(this.A,2,.5);B(this.h,4,.5)}get baseOptions(){return y(this.h,R,1)}set baseOptions(a){z(this.h,R,1,a)}o(a){\"numPoses\"in a&&Jd(this.j,4,a.numPoses??1);\"minPoseDetectionConfidence\"in a&&B(this.j,2,a.minPoseDetectionConfidence??\n.5);\"minTrackingConfidence\"in a&&B(this.h,4,a.minTrackingConfidence??.5);\"minPosePresenceConfidence\"in a&&B(this.A,2,a.minPosePresenceConfidence??.5);\"outputSegmentationMasks\"in a&&(this.outputSegmentationMasks=a.outputSegmentationMasks??!1);return this.l(a)}F(a,b,c){const d=typeof b!==\"function\"?b:{};this.u=typeof b===\"function\"?b:c;pk(this);Dj(this,a,d);return qk(this)}G(a,b,c,d){const e=typeof c!==\"function\"?c:{};this.u=typeof c===\"function\"?c:d;pk(this);Ej(this,a,e,b);return qk(this)}m(){var a=\nnew yg;P(a,\"image_in\");P(a,\"norm_rect\");Q(a,\"normalized_landmarks\");Q(a,\"world_landmarks\");Q(a,\"segmentation_masks\");const b=new Wf;Oe(b,Uh,this.h);const c=new sg;Kd(c,2,\"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph\");M(c,\"IMAGE:image_in\");M(c,\"NORM_RECT:norm_rect\");O(c,\"NORM_LANDMARKS:normalized_landmarks\");O(c,\"WORLD_LANDMARKS:world_landmarks\");c.o(b);xg(a,c);zi(this,a);this.g.attachProtoVectorListener(\"normalized_landmarks\",(d,e)=>{this.landmarks=[];for(const f of d)d=Mg(f),this.landmarks.push(ai(d));\nU(this,e)});this.g.attachEmptyPacketListener(\"normalized_landmarks\",d=>{this.landmarks=[];U(this,d)});this.g.attachProtoVectorListener(\"world_landmarks\",(d,e)=>{this.worldLandmarks=[];for(const f of d)d=Kg(f),this.worldLandmarks.push(bi(d));U(this,e)});this.g.attachEmptyPacketListener(\"world_landmarks\",d=>{this.worldLandmarks=[];U(this,d)});this.outputSegmentationMasks&&(O(c,\"SEGMENTATION_MASK:segmentation_masks\"),Ai(this,\"segmentation_masks\"),this.g.aa(\"segmentation_masks\",(d,e)=>{this.segmentationMasks=\nd.map(f=>Fj(this,f,!0,!this.u));U(this,e)}),this.g.attachEmptyPacketListener(\"segmentation_masks\",d=>{this.segmentationMasks=[];U(this,d)}));a=a.g();this.setGraph(new Uint8Array(a),!0)}};rk.prototype.detectForVideo=rk.prototype.G;rk.prototype.detect=rk.prototype.F;rk.prototype.setOptions=rk.prototype.o;rk.createFromModelPath=function(a,b){return X(rk,a,{baseOptions:{modelAssetPath:b}})};rk.createFromModelBuffer=function(a,b){return X(rk,a,{baseOptions:{modelAssetBuffer:b}})};\nrk.createFromOptions=function(a,b){return X(rk,a,b)};rk.POSE_CONNECTIONS=ak;export {rk as PoseLandmarker};\n"],"names":["aa","self","ba","a","b","c","d","e","length","da","Error","ea","String","fromCharCode","apply","fa","ha","ia","TextDecoder","ja","ka","TextEncoder","la","encode","Uint8Array","charCodeAt","f","subarray","ma","setTimeout","qa","na","oa","pa","navigator","userAgent","ra","sa","userAgentData","ta","ua","va","Math","floor","indexOf","charAt","g","test","ya","h","xa","split","concat","za","Aa","brands","btoa","Ba","Ca","_","Da","Ea","replace","atob","Fa","Ga","Ha","Ia","Ja","Ka","La","this","constructor","Na","Ma","__closure__error__context__984382","severity","Oa","Pa","Qa","BigInt","Ra","Symbol","Sa","for","Ta","Ua","Va","Wa","Xa","Ya","Za","$a","ab","bb","cb","value","configurable","writable","enumerable","db","Object","defineProperties","n","eb","fb","gb","p","hb","ib","freeze","jb","kb","lb","v","mb","nb","l","next","done","call","iterator","ob","pb","isNaN","qb","rb","sb","tb","ub","vb","wb","xb","Number","isSafeInteger","trim","Db","yb","zb","Ab","Bb","Cb","MIN_SAFE_INTEGER","toString","MAX_SAFE_INTEGER","Eb","prototype","slice","Fb","q","r","Gb","Hb","Ib","Jb","DataView","ArrayBuffer","setFloat32","getUint32","Kb","Lb","Mb","asUintN","Nb","asIntN","Ob","Pb","Qb","trunc","Rb","Array","Sb","Tb","Ub","Vb","isFinite","Wb","Xb","Yb","Zb","$b","isArray","ac","bc","cc","dc","ec","fc","hc","ic","substring","jc","kc","mc","pc","qc","t","rc","sc","uc","vc","Map","super","wc","get","set","size","delete","clear","has","entries","keys","values","forEach","xc","setPrototypeOf","yc","zc","J","Cc","K","S","Ac","V","from","Bc","Dc","Ec","Fc","Gc","Ic","toJSON","Kc","Lc","Mc","Nc","k","w","m","D","G","N","wa","push","Jc","Pc","Qc","Rc","join","Sc","Tc","Vc","Wc","Xc","max","Yc","Zc","$c","ad","bd","cd","dd","ed","fd","gd","hd","u","id","is","x","jd","kd","ld","md","nd","od","pd","qd","rd","ud","vd","wd","xd","yd","zd","defineProperty","Ad","Bd","Cd","y","Dd","Rf","Hc","Td","Ud","Sf","Ed","Fd","z","Gd","Hd","Id","A","Jd","B","Kd","Ld","isFrozen","Md","Nd","buffer","Od","byteOffset","byteLength","Pd","Qd","Rd","Sd","Vd","Wd","NaN","Infinity","pow","Xd","Yd","Zd","Y","j","ae","be","ce","pop","o","init","de","ee","fe","ge","he","ie","fatal","decode","je","ke","le","ne","me","oe","qe","pe","re","se","te","ue","we","xe","ye","end","ze","Ae","Be","De","Ee","Fe","Ge","He","Ie","Je","Ke","Le","Me","Ne","Oe","C","Pe","defaultValue","clone","Qe","Re","Se","Te","Ue","Ve","We","Xe","Ye","Ze","$e","af","bf","cf","T","Uc","df","ef","ff","gf","hf","jf","bind","kf","lf","mf","nf","of","pf","qf","rf","sf","tf","uf","vf","wf","nc","xf","yf","zf","Af","Bf","Cf","Df","E","Ef","Ff","Gf","Hf","If","Jf","oc","F","Kf","Lf","H","Mf","Nf","Of","I","Pf","Qf","Tf","Uf","parseInt","Vf","Wf","register","Xf","Yf","assign","Zf","ag","bg","dg","cg","globalThis","trustedTypes","gg","createPolicy","createHTML","createScript","createScriptURL","eg","hg","encodeURIComponent","ig","jg","kg","lg","mg","ng","og","pg","L","qg","M","O","sg","tg","ug","vg","xg","P","Q","yg","rg","zg","Ag","Bg","Cg","Dg","Eg","Fg","Gg","Hg","Ig","Jg","Kg","Lg","Mg","Ng","Og","Pg","Qg","Rg","Sg","Tg","Ug","Vg","Wg","Xg","Yg","Zg","$g","ah","bh","R","ch","dh","eh","fh","gh","hh","ih","jh","kh","lh","mh","nh","oh","ph","qh","rh","sh","th","uh","vh","wh","xh","yh","zh","Ah","Bh","Ch","Dh","Eh","Fh","Gh","Hh","Ih","td","Jh","sd","Kh","Lh","Mh","Nh","Oh","Ph","Qh","Rh","Sh","Th","Uh","Vh","displayNamesLocale","maxResults","scoreThreshold","categoryAllowlist","categoryDenylist","Wh","Xh","categories","map","index","score","categoryName","displayName","headIndex","headName","Yh","classifications","lc","timestampMs","Zh","keypoints","boundingBox","originX","originY","width","height","angle","label","ai","visibility","bi","ci","di","sqrt","ei","fi","async","gi","WebAssembly","instantiate","hi","wasmLoaderPath","wasmBinaryPath","ii","li","OffscreenCanvas","includes","ki","match","mi","importScripts","document","createElement","src","crossOrigin","Promise","addEventListener","body","appendChild","TypeError","import","ni","videoWidth","videoHeight","naturalWidth","naturalHeight","displayWidth","displayHeight","console","error","i","stringToNewUTF8","_free","oi","canvas","_bindTextureToStream","_bindTextureToCanvas","getContext","gpuOriginForWebTexturesIsBottomLeft","pixelStorei","UNPACK_FLIP_Y_WEBGL","texImage2D","TEXTURE_2D","RGBA","UNSIGNED_BYTE","pi","Uint32Array","_malloc","HEAPU32","qi","simpleListeners","ri","forVisionTasks","forTextTasks","forGenAiTasks","forAudioTasks","isSimdSupported","ui","ModuleFactory","Module","locateFile","mainScriptUrlOrBlob","ti","assetLoaderPath","endsWith","assetBinaryPath","xi","baseOptions","yi","message","U","zi","Ai","Bi","addBoolToStream","Ci","setAutoRenderToScreen","modelAssetBuffer","modelAssetPath","delegate","wi","fetch","then","ok","arrayBuffer","status","FS_unlink","FS_createDataFile","read","ji","resolve","ca","setGraph","attachErrorListener","finishProcessing","close","closeGraph","Di","Ei","bindVertexArray","deleteVertexArray","deleteBuffer","Fi","createShader","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","attachShader","Gi","createVertexArray","createBuffer","bindBuffer","ARRAY_BUFFER","enableVertexAttribArray","vertexAttribPointer","FLOAT","bufferData","Float32Array","STATIC_DRAW","Hi","Ii","useProgram","Ji","createTexture","bindTexture","texParameteri","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","TEXTURE_MIN_FILTER","LINEAR","TEXTURE_MAG_FILTER","Ki","createFramebuffer","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","Li","Mi","createProgram","X","VERTEX_SHADER","W","FRAGMENT_SHADER","linkProgram","getProgramParameter","LINK_STATUS","getProgramInfoLog","getAttribLocation","deleteProgram","deleteShader","deleteFramebuffer","Pi","activeTexture","TEXTURE1","TEXTURE2","NEAREST","getUniformLocation","uniform1i","deleteTexture","Qi","Ri","find","WebGLTexture","Ti","Ui","Vi","Wi","platform","readPixels","RED","Xi","Yi","Zi","$i","getExtension","R32F","R16F","viewport","TEXTURE0","aj","round","clearColor","COLOR_BUFFER_BIT","drawArrays","TRIANGLE_FAN","getAsWebGLTexture","getAsFloat32Array","getAsUint8Array","hasWebGLTexture","hasFloat32Array","hasUint8Array","bj","color","lineWidth","radius","cj","fillColor","dj","Function","ej","min","fj","gj","jj","kj","hj","ImageData","Uint8ClampedArray","Ni","fill","Oi","mj","ij","oj","CanvasRenderingContext2D","OffscreenCanvasRenderingContext2D","save","fillStyle","strokeStyle","Path2D","arc","PI","stroke","restore","beginPath","start","to","moveTo","lineTo","drawImage","lj","nj","pj","ImageBitmap","qj","rj","sj","tj","uj","vj","wj","xj","transferToImageBitmap","drawConfidenceMask","drawCategoryMask","drawBoundingBox","drawConnectors","drawLandmarks","lerp","clamp","yj","data","getAsImageBitmap","getAsImageData","hasImageBitmap","hasImageData","zj","Aj","_registerModelResourcesGraphService","_addIntToInputStream","warn","setGraphFromString","HEAPU8","_changeBinaryGraph","_changeTextGraph","configureAudio","_configureAudio","setAutoResizeCanvas","_setAutoRenderToScreen","setGpuBufferVerticalFlip","_getGraphConfig","__graph_config__","errorListener","attachEmptyPacketListener","emptyPacketListeners","addAudioToStream","addAudioToStreamWithShape","HEAPF32","_addAudioToInputStream","addGpuBufferToStream","_addBoundTextureToStream","_addBoolToInputStream","addDoubleToStream","_addDoubleToInputStream","addFloatToStream","_addFloatToInputStream","addIntToStream","addUintToStream","_addUintToInputStream","addStringToStream","_addStringToInputStream","addStringRecordToStream","_addFlatHashMapToInputStream","addProtoToStream","_addProtoToInputStream","addEmptyPacketToStream","_addEmptyPacketToInputStream","addBoolVectorToStream","_allocateBoolVector","_addBoolVectorEntry","_addBoolVectorToInputStream","addDoubleVectorToStream","_allocateDoubleVector","_addDoubleVectorEntry","_addDoubleVectorToInputStream","addFloatVectorToStream","_allocateFloatVector","_addFloatVectorEntry","_addFloatVectorToInputStream","addIntVectorToStream","_allocateIntVector","_addIntVectorEntry","_addIntVectorToInputStream","addUintVectorToStream","_allocateUintVector","_addUintVectorEntry","_addUintVectorToInputStream","addStringVectorToStream","_allocateStringVector","_addStringVectorEntry","_addStringVectorToInputStream","addBoolToInputSidePacket","_addBoolToInputSidePacket","addDoubleToInputSidePacket","_addDoubleToInputSidePacket","addFloatToInputSidePacket","_addFloatToInputSidePacket","addIntToInputSidePacket","_addIntToInputSidePacket","addUintToInputSidePacket","_addUintToInputSidePacket","addStringToInputSidePacket","_addStringToInputSidePacket","addProtoToInputSidePacket","_addProtoToInputSidePacket","addBoolVectorToInputSidePacket","_addBoolVectorToInputSidePacket","addDoubleVectorToInputSidePacket","_addDoubleVectorToInputSidePacket","addFloatVectorToInputSidePacket","_addFloatVectorToInputSidePacket","addIntVectorToInputSidePacket","_addIntVectorToInputSidePacket","addUintVectorToInputSidePacket","_addUintVectorToInputSidePacket","addStringVectorToInputSidePacket","_addStringVectorToInputSidePacket","attachBoolListener","_attachBoolListener","attachBoolVectorListener","_attachBoolVectorListener","attachIntListener","_attachIntListener","attachIntVectorListener","_attachIntVectorListener","attachUintListener","_attachUintListener","attachUintVectorListener","_attachUintVectorListener","attachDoubleListener","_attachDoubleListener","attachDoubleVectorListener","_attachDoubleVectorListener","attachFloatListener","_attachFloatListener","attachFloatVectorListener","_attachFloatVectorListener","attachStringListener","_attachStringListener","attachStringVectorListener","_attachStringVectorListener","attachProtoListener","_attachProtoListener","attachProtoVectorListener","_attachProtoVectorListener","attachAudioListener","_attachAudioListener","_waitUntilIdle","_closeGraph","ga","_addBoundTextureAsImageToStream","Z","_attachImageListener","_attachImageVectorListener","Bj","vi","Cj","regionOfInterest","left","right","top","bottom","rotationDegrees","performance","now","Dj","Ej","Fj","Gj","runningMode","Hj","detections","minDetectionConfidence","minSuppressionThreshold","detectForVideo","detect","setOptions","createFromModelPath","createFromModelBuffer","createFromOptions","Ij","Jj","Kj","Lj","Mj","Nj","Oj","Pj","Qj","Rj","Sj","faceLandmarks","faceBlendshapes","facialTransformationMatrixes","outputFacialTransformationMatrixes","outputFaceBlendshapes","numFaces","minFaceDetectionConfidence","minTrackingConfidence","minFacePresenceConfidence","rows","columns","FACE_LANDMARKS_LIPS","FACE_LANDMARKS_LEFT_EYE","FACE_LANDMARKS_LEFT_EYEBROW","FACE_LANDMARKS_LEFT_IRIS","FACE_LANDMARKS_RIGHT_EYE","FACE_LANDMARKS_RIGHT_EYEBROW","FACE_LANDMARKS_RIGHT_IRIS","FACE_LANDMARKS_FACE_OVAL","FACE_LANDMARKS_CONTOURS","FACE_LANDMARKS_TESSELATION","Tj","Uj","gestures","landmarks","worldLandmarks","handedness","Vj","handednesses","Wj","Xj","numHands","minHandDetectionConfidence","minHandPresenceConfidence","cannedGesturesClassifierOptions","customGesturesClassifierOptions","Yj","recognizeForVideo","recognize","HAND_CONNECTIONS","Zj","ak","bk","poseLandmarks","poseWorldLandmarks","poseSegmentationMasks","leftHandLandmarks","leftHandWorldLandmarks","rightHandLandmarks","rightHandWorldLandmarks","ck","dk","outputPoseSegmentationMasks","minFaceSuppressionThreshold","minPoseDetectionConfidence","minPoseSuppressionThreshold","minPosePresenceConfidence","minHandLandmarksConfidence","$f","POSE_CONNECTIONS","ek","classifyForVideo","classify","fk","embeddings","l2Normalize","quantize","floatEmbedding","quantizedEmbedding","$h","cosineSimilarity","embedForVideo","embed","gk","confidenceMasks","categoryMask","qualityScores","hk","wg","filter","ik","jk","kk","outputCategoryMask","outputConfidenceMasks","segment","getLabels","segmentForVideo","lk","mk","keypoint","scribble","nk","segmentationMasks","pk","qk","rk","outputSegmentationMasks","numPoses"],"mappings":"AAKA,IAAIA,EAAwB,oBAAPC,KAAmBA,KAAK,CAAA,EAAI,SAASC,EAAGC,EAAEC,GAAGD,EAAE,CAAyB,IAAxB,IAAIE,EAAE,CAAC,iBAAyBC,EAAEN,EAAGO,EAAE,EAAEA,EAAEF,EAAEG,OAAOD,IAAI,GAAgB,OAAbD,EAAEA,EAAED,EAAEE,KAAY,CAACF,EAAE,KAAK,MAAMF,CAAC,CAACE,EAAEC,CAAC,CAAW,OAAU,OAApBH,EAAEE,GAAGA,EAAEF,IAAkBA,EAAEC,CAAC,CAA+K,SAASK,IAAK,MAAMC,MAAM,eAAgB,CAAC,SAASC,EAAGR,EAAEC,GAAuC,OAApCA,EAAEQ,OAAOC,aAAaC,MAAM,KAAKV,GAAa,MAAHD,EAAQC,EAAED,EAAEC,CAAC,CAAC,IAAIW,EAAUC,EAAG,MAAMC,EAAwB,oBAAdC,YAA0B,IAAIC,EAAG,MAAMC,EAAwB,oBAAdC,YACxjB,SAASC,EAAGnB,GAAG,GAAGiB,EAAGjB,GAAGgB,IAAK,IAAIE,aAAaE,OAAOpB,OAAO,CAAC,IAAIE,EAAE,EAAE,MAAMC,EAAE,IAAIkB,WAAW,EAAErB,EAAEK,QAAQ,IAAI,IAAID,EAAE,EAAEA,EAAEJ,EAAEK,OAAOD,IAAI,CAAC,IAAIH,EAAED,EAAEsB,WAAWlB,GAAG,GAAGH,EAAE,IAAIE,EAAED,KAAKD,MAAM,CAAC,GAAGA,EAAE,KAAKE,EAAED,KAAKD,GAAG,EAAE,QAAQ,CAAC,GAAGA,GAAG,OAAOA,GAAG,MAAM,CAAC,GAAGA,GAAG,OAAOG,EAAEJ,EAAEK,OAAO,CAAC,MAAMkB,EAAEvB,EAAEsB,aAAalB,GAAG,GAAGmB,GAAG,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AAEC,GAAG,OAAOsuB,GAAE0X,GAAGjmC,EAAE,CAAC2pB,YAAY,CAACW,eAAerqB,IAAI,EAAEgmC,GAAG7G,sBAAsB,SAASp/B,EAAEC,GAAG,OAAOsuB,GAAE0X,GAAGjmC,EAAE,CAAC2pB,YAAY,CAACU,iBAAiBpqB,IAAI,EAC9dgmC,GAAG5G,kBAAkB,SAASr/B,EAAEC,GAAG,OAAOsuB,GAAE0X,GAAGjmC,EAAEC,EAAE,EAAEgmC,GAAGrC,iBAAiBlB"} \ No newline at end of file diff --git a/lab-js/video-loader/FOLDER-DESCRIPTION.md b/lab-js/video-loader/FOLDER-DESCRIPTION.md new file mode 100644 index 0000000..e4e482f --- /dev/null +++ b/lab-js/video-loader/FOLDER-DESCRIPTION.md @@ -0,0 +1,25 @@ +# lab-js/video-loader + +This folder contains the seekable-video analysis core used by `loader.html`. +It is intentionally independent from the live-camera state owned by +`realtime.html` and the main lab. + +`controller.js` owns local video loading, deterministic seeking, MediaPipe +FaceLandmarker and ImageEmbedder sampling, sparse face-api verification, +baseline acquisition, and native-resolution evidence capture. It retains no +pixel queue: only selected evidence frames survive, while neighbouring frames +can be recovered later by seeking the original source. A person can also ask +for an immediate comparison at the current source position after the baseline +exists; that manual check is stored separately from automatically confirmed +events. + +`analysis.js` contains pure numeric helpers and the trigger state machine. Its +default face-api identity distance is `0.6`; ImageEmbedder drift is maintained +as a separate generic visual signal and never presented as identity distance. + +`session.js` owns the versioned analysis session, append-only observations, +review classifications, report projection, separately downloadable NDJSON +technical log, and reversible editorial actions. + +The detailed product boundary, signal semantics, calibration decisions, CLI +contract, and test policy live in `../../tutorials/video-loader.md`. diff --git a/lab-js/video-loader/analysis.js b/lab-js/video-loader/analysis.js new file mode 100644 index 0000000..0901627 --- /dev/null +++ b/lab-js/video-loader/analysis.js @@ -0,0 +1,321 @@ +/** + * @module video-loader/analysis + * @description + * Pure numerical helpers and trigger policy for the seekable-video analyser. + * The module deliberately has no DOM or model dependencies so thresholds, + * baseline selection, and event decisions can be tested without loading the + * large vendored runtimes. + */ + +/** Default face-api descriptor distance used by the vendored FaceMatcher. */ +export const DEFAULT_FACE_DISTANCE_THRESHOLD = 0.6; + +/** + * Computes Euclidean distance between equal-length vectors. The Video Loader + * uses this metric for face-api descriptors: `buildFaceBaseline()` uses it to + * choose the representative descriptor and measure baseline spread, while the + * controller uses it to compare later face-api checks with that baseline and + * the configured `0.6` identity-distance threshold. + * + * @param {ArrayLike} left First vector. + * @param {ArrayLike} right Second vector. + * @returns {number} L2 distance. + * @throws {Error} When vector lengths differ. + */ +export function euclideanDistance(left, right) { + if (left.length !== right.length) throw new Error('Vectors must have the same length.'); + let sum = 0; + for (let index = 0; index < left.length; index += 1) { + const delta = left[index] - right[index]; + sum += delta * delta; + } + return Math.sqrt(sum); +} + +/** + * Computes cosine similarity between equal-length vectors. It is used only + * for MediaPipe ImageEmbedder vectors from aligned face crops. The baseline + * medoid and every later visual-drift sample use `1 - cosineSimilarity(...)`; + * this value is a generic appearance-change signal, not an identity score. + * + * @param {ArrayLike} left First vector. + * @param {ArrayLike} right Second vector. + * @returns {number} Similarity in the range -1..1, or zero for a zero vector. + * @throws {Error} When vector lengths differ. + */ +export function cosineSimilarity(left, right) { + if (left.length !== right.length) throw new Error('Vectors must have the same length.'); + let dot = 0; + let leftNorm = 0; + let rightNorm = 0; + for (let index = 0; index < left.length; index += 1) { + dot += left[index] * right[index]; + leftNorm += left[index] * left[index]; + rightNorm += right[index] * right[index]; + } + const denominator = Math.sqrt(leftNorm) * Math.sqrt(rightNorm); + return denominator === 0 ? 0 : dot / denominator; +} + +/** + * Returns the median without mutating the caller's collection. Baseline + * construction uses it to summarise face-api descriptor spread and the centre + * of ImageEmbedder drift; `medianAbsoluteDeviation()` calls it again to derive + * the adaptive visual-change threshold from baseline noise. + * + * @param {number[]} values Numeric values. + * @returns {number} Median, or zero for an empty collection. + */ +export function median(values) { + if (!values.length) return 0; + const sorted = [...values].sort((left, right) => left - right); + const middle = Math.floor(sorted.length / 2); + return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2; +} + +/** + * Computes median absolute deviation, a robust estimate of baseline noise. + * + * @param {number[]} values Numeric values. + * @returns {number} Median absolute deviation. + */ +export function medianAbsoluteDeviation(values) { + const centre = median(values); + return median(values.map((value) => Math.abs(value - centre))); +} + +/** + * Picks the real vector with the smallest total distance to its peers. Both + * baseline builders use this helper: cosine distance selects a representative + * ImageEmbedder vector, and Euclidean distance selects a representative + * face-api descriptor. Keeping an observed vector, instead of an arithmetic + * mean, also lets the controller associate the visual baseline with a real + * sampled timestamp. + * + * @param {Array>} vectors Candidate vectors. + * @param {function(ArrayLike, ArrayLike): number} metric Distance metric. + * @returns {{vector: number[], index: number, distances: number[]}} Medoid and distances to it. + * @throws {Error} When no vector is provided. + */ +export function vectorMedoid(vectors, metric) { + if (!vectors.length) throw new Error('vectorMedoid() requires at least one vector.'); + let bestIndex = 0; + let bestTotal = Infinity; + for (let left = 0; left < vectors.length; left += 1) { + let total = 0; + for (let right = 0; right < vectors.length; right += 1) { + if (left !== right) total += metric(vectors[left], vectors[right]); + } + if (total < bestTotal) { + bestTotal = total; + bestIndex = left; + } + } + const vector = Array.from(vectors[bestIndex]); + return { + vector, + index: bestIndex, + distances: vectors.map((candidate) => metric(candidate, vector)), + }; +} + +/** + * Builds a robust ImageEmbedder baseline and its adaptive drift threshold. + * + * ImageEmbedder is a generic visual model, not a biometric matcher. The + * threshold therefore comes from the current video's stable baseline rather + * than a universal identity claim. + * + * @param {Array>} embeddings Stable aligned-face embeddings. + * @param {object} [options] Threshold tuning. + * @param {number} [options.minimumDelta] Minimum drift above baseline noise. + * @param {number} [options.madMultiplier] Robust-noise multiplier. + * @returns {{embedding: number[], medoidIndex: number, medianDrift: number, mad: number, triggerThreshold: number, drifts: number[]}} Baseline model. + */ +export function buildEmbeddingBaseline(embeddings, options = {}) { + const minimumDelta = options.minimumDelta ?? 0.025; + const madMultiplier = options.madMultiplier ?? 6; + const result = vectorMedoid(embeddings, (left, right) => 1 - cosineSimilarity(left, right)); + const medianDrift = median(result.distances); + const mad = medianAbsoluteDeviation(result.distances); + return { + embedding: result.vector, + medoidIndex: result.index, + medianDrift, + mad, + triggerThreshold: medianDrift + Math.max(minimumDelta, mad * madMultiplier), + drifts: result.distances, + }; +} + +/** + * Builds the face-api descriptor baseline as a medoid and reports its spread. + * + * @param {Array>} descriptors Stable face-api descriptors. + * @returns {{descriptor: number[], medoidIndex: number, spread: number}} Baseline descriptor. + */ +export function buildFaceBaseline(descriptors) { + const result = vectorMedoid(descriptors, euclideanDistance); + return { + descriptor: result.vector, + medoidIndex: result.index, + spread: median(result.distances), + }; +} + +/** + * Uses the human-selected ImageEmbedder vector as the actual baseline while + * nearby vectors estimate normal visual noise. The Video Loader uses this + * variant only for an explicitly anchored baseline, ensuring that later + * visual drift is computed from the frame the person selected rather than a + * medoid several seconds later. + * + * @param {Array>} embeddings Nearby stable embeddings. + * @param {number} referenceIndex Index of the explicitly selected frame. + * @param {object} [options] Adaptive-trigger tuning. + * @param {number} [options.minimumDelta] Minimum drift above baseline noise. + * @param {number} [options.madMultiplier] Robust-noise multiplier. + * @returns {{embedding: number[], referenceIndex: number, medianDrift: number, mad: number, triggerThreshold: number, drifts: number[]}} Anchored baseline model. + */ +export function buildAnchoredEmbeddingBaseline(embeddings, referenceIndex, options = {}) { + if (!embeddings[referenceIndex]) throw new Error('Anchored embedding baseline requires a valid reference index.'); + const minimumDelta = options.minimumDelta ?? 0.025; + const madMultiplier = options.madMultiplier ?? 6; + const embedding = Array.from(embeddings[referenceIndex]); + const drifts = embeddings.map((candidate) => visualDrift(candidate, embedding)); + const medianDrift = median(drifts); + const mad = medianAbsoluteDeviation(drifts); + return { + embedding, + referenceIndex, + medianDrift, + mad, + triggerThreshold: medianDrift + Math.max(minimumDelta, mad * madMultiplier), + drifts, + }; +} + +/** + * Uses the face-api descriptor from the human-selected frame as the identity + * baseline and measures nearby descriptor spread around it. The Video Loader + * uses this for explicit baseline selection so every later L2 distance truly + * originates from the visible baseline card. + * + * @param {Array>} descriptors Nearby stable descriptors. + * @param {number} referenceIndex Index of the selected frame descriptor. + * @returns {{descriptor: number[], referenceIndex: number, spread: number}} Anchored face-api baseline. + */ +export function buildAnchoredFaceBaseline(descriptors, referenceIndex) { + if (!descriptors[referenceIndex]) throw new Error('Anchored face baseline requires a valid reference index.'); + const descriptor = Array.from(descriptors[referenceIndex]); + const distances = descriptors.map((candidate) => euclideanDistance(candidate, descriptor)); + return { + descriptor, + referenceIndex, + spread: median(distances), + }; +} + +/** + * Computes ImageEmbedder visual drift from a baseline embedding. + * + * @param {ArrayLike} embedding Current aligned-face embedding. + * @param {ArrayLike} baseline Baseline aligned-face embedding. + * @returns {number} Cosine distance where zero means identical direction. + */ +export function visualDrift(embedding, baseline) { + return 1 - cosineSimilarity(embedding, baseline); +} + +/** + * Creates the stateful policy that decides when expensive face-api work is + * justified. The policy retains numeric samples only; it never retains frames. + * + * @param {object} [options] Trigger policy overrides. + * @param {number} [options.heartbeatSeconds=4] Maximum gap between identity checks. + * @param {number} [options.minimumFaceApiGapSeconds=0.75] Cooldown between expensive checks. + * @param {number} [options.jumpDelta=0.035] Single-sample visual-drift jump. + * @param {number} [options.requiredVotes=2] Above-threshold samples required. + * @param {number} [options.voteWindow=3] Recent samples considered for votes. + * @returns {{evaluate: Function, markFaceApi: Function, reset: Function}} Trigger detector. + */ +export function createTriggerDetector(options = {}) { + const heartbeatSeconds = options.heartbeatSeconds ?? 4; + const minimumFaceApiGapSeconds = options.minimumFaceApiGapSeconds ?? 0.75; + const jumpDelta = options.jumpDelta ?? 0.035; + const requiredVotes = options.requiredVotes ?? 2; + const voteWindow = options.voteWindow ?? 3; + + let previousPresence = null; + let previousDrift = null; + let lastFaceApiAt = -Infinity; + /** @type {boolean[]} */ + let recentVotes = []; + + return { + /** + * Evaluates one lightweight sample. + * + * @param {{mediaTime: number, facePresent: boolean, comparable: boolean, visualDrift: number|null, visualThreshold: number|null}} sample Current sample. + * @returns {{shouldVerify: boolean, reasons: string[], observations: string[]}} Trigger decision. + */ + evaluate(sample) { + const reasons = []; + const observations = []; + + if (previousPresence !== null && sample.facePresent !== previousPresence) { + observations.push(sample.facePresent ? 'mediapipe-face-returned' : 'mediapipe-face-lost'); + if (sample.facePresent) reasons.push('mediapipe-face-returned'); + } + + if (sample.comparable && sample.visualDrift !== null && sample.visualThreshold !== null) { + const aboveThreshold = sample.visualDrift > sample.visualThreshold; + recentVotes.push(aboveThreshold); + recentVotes = recentVotes.slice(-voteWindow); + const votes = recentVotes.filter(Boolean).length; + if (recentVotes.length >= requiredVotes && votes >= requiredVotes) reasons.push('visual-drift-sustained'); + + if (previousDrift !== null && sample.visualDrift - previousDrift > jumpDelta) { + reasons.push('visual-drift-jump'); + } + previousDrift = sample.visualDrift; + } else { + recentVotes = []; + } + + if (sample.comparable && sample.mediaTime - lastFaceApiAt >= heartbeatSeconds) { + reasons.push('identity-heartbeat'); + } + + previousPresence = sample.facePresent; + const outsideCooldown = sample.mediaTime - lastFaceApiAt >= minimumFaceApiGapSeconds; + return { + shouldVerify: sample.facePresent && sample.comparable && reasons.length > 0 && outsideCooldown, + reasons: [...new Set(reasons)], + observations, + }; + }, + + /** + * Records completion of a face-api pass. + * + * @param {number} mediaTime Video timestamp in seconds. + * @returns {void} + */ + markFaceApi(mediaTime) { + lastFaceApiAt = mediaTime; + }, + + /** + * Clears temporal state before analysing another source. + * + * @returns {void} + */ + reset() { + previousPresence = null; + previousDrift = null; + lastFaceApiAt = -Infinity; + recentVotes = []; + }, + }; +} diff --git a/lab-js/video-loader/controller.js b/lab-js/video-loader/controller.js new file mode 100644 index 0000000..4192f22 --- /dev/null +++ b/lab-js/video-loader/controller.js @@ -0,0 +1,1177 @@ +/** + * @module video-loader/controller + * @description + * Seekable local-video analysis controller. MediaPipe FaceLandmarker supplies + * frequent presence and geometry, MediaPipe ImageEmbedder supplies an aligned + * visual-change signal, and the heavier face-api recognition path runs only + * for baseline capture, trigger verification, and a bounded heartbeat. + */ + +import { + MEDIAPIPE_FACE_LANDMARKER_URL, + MEDIAPIPE_IMAGE_EMBEDDER_URL, + MEDIAPIPE_TASKS_VISION_URL, + MEDIAPIPE_WASM_URL, + MODEL_URLS, +} from '../config.js'; +import { + DEFAULT_FACE_DISTANCE_THRESHOLD, + buildAnchoredEmbeddingBaseline, + buildAnchoredFaceBaseline, + buildEmbeddingBaseline, + buildFaceBaseline, + createTriggerDetector, + euclideanDistance, + visualDrift, +} from './analysis.js'; +import { + appendJournal, + appendSample, + buildReport, + createAnalysisSession, + recordEvidenceObservation, + recordManualFrameCheck, + selectEventFrame, + serializeTechnicalLog, +} from './session.js'; + +/** + * @typedef {object} VideoLoaderConfig + * @property {number} sampleIntervalSeconds Media-time interval between lightweight samples. + * @property {number} baselineEmbeddingSamples Stable ImageEmbedder samples required. + * @property {number} baselineFaceSamples Stable face-api descriptors required. + * @property {number} anchoredBaselineEmbeddingSamples Comparable neighbours used around a selected frame. + * @property {number} anchoredBaselineFaceSamples Face descriptors used around a selected frame. + * @property {number} faceDistanceThreshold Face-api L2 distance threshold. + * @property {number} heartbeatSeconds Maximum media-time gap between face-api checks. + * @property {number} minimumFaceApiGapSeconds Minimum media-time gap between face-api checks. + * @property {number} minimumVisualDelta Minimum ImageEmbedder drift above baseline noise. + * @property {number} visualMadMultiplier Baseline MAD multiplier for adaptive visual drift. + * @property {number} visualJumpDelta One-sample visual drift jump threshold. + * @property {number} maximumBaselineAppearanceStep Largest accepted low-resolution crop change. + * @property {number} maximumBaselineRollStep Largest accepted roll change in degrees. + * @property {number} maximumBaselineYawStep Largest accepted approximate yaw change. + * @property {number} maximumBaselineScaleStep Largest accepted face-width ratio change. + * @property {number} maximumBaselineFaceSpread Largest accepted face-api baseline spread. + * @property {number} maximumAnchoredBaselineFaceSpread Largest spread accepted around a human-selected frame. + * @property {number} anchoredBaselineWindowSeconds Maximum local calibration span after a selected frame. + * @property {number} alignedCropSize ImageEmbedder crop edge in pixels. + * @property {number} evidenceRefinementRadiusSeconds Neighbourhood around a confirmed event. + * @property {number} evidenceRefinementStepSeconds MediaPipe-only refinement cadence. + * @property {number} evidenceRefinementFaceApiCandidates Maximum refined candidates verified by face-api. + */ + +/** @type {VideoLoaderConfig} */ +export const DEFAULT_VIDEO_LOADER_CONFIG = Object.freeze({ + sampleIntervalSeconds: 0.5, + baselineEmbeddingSamples: 8, + baselineFaceSamples: 3, + anchoredBaselineEmbeddingSamples: 4, + anchoredBaselineFaceSamples: 3, + faceDistanceThreshold: DEFAULT_FACE_DISTANCE_THRESHOLD, + heartbeatSeconds: 4, + minimumFaceApiGapSeconds: 0.75, + minimumVisualDelta: 0.025, + visualMadMultiplier: 6, + visualJumpDelta: 0.035, + maximumBaselineAppearanceStep: 0.14, + maximumBaselineRollStep: 10, + maximumBaselineYawStep: 0.15, + maximumBaselineScaleStep: 0.15, + maximumBaselineFaceSpread: 0.3, + maximumAnchoredBaselineFaceSpread: 0.5, + anchoredBaselineWindowSeconds: 3, + alignedCropSize: 224, + evidenceRefinementRadiusSeconds: 1, + evidenceRefinementStepSeconds: 0.2, + evidenceRefinementFaceApiCandidates: 3, +}); + +/** MediaPipe landmark indices used only to normalise the face crop. */ +const FACE_MESH = Object.freeze({ + rightEyeOuter: 33, + leftEyeOuter: 263, + noseTip: 1, +}); + +/** + * Waits for a one-shot media event with a timeout that prevents a corrupt + * source from hanging the analysis forever. + * + * @param {HTMLMediaElement} media Media element. + * @param {string} eventName Event name. + * @param {number} [timeoutMs=15000] Timeout in milliseconds. + * @returns {Promise} Resolves when the event fires. + */ +function waitForMediaEvent(media, eventName, timeoutMs = 15000) { + return new Promise((resolve, reject) => { + const timer = window.setTimeout(() => { + cleanup(); + reject(new Error(`Timed out waiting for media event: ${eventName}`)); + }, timeoutMs); + const onEvent = () => { + cleanup(); + resolve(); + }; + const onError = () => { + cleanup(); + reject(media.error || new Error(`Media error while waiting for ${eventName}.`)); + }; + const cleanup = () => { + window.clearTimeout(timer); + media.removeEventListener(eventName, onEvent); + media.removeEventListener('error', onError); + }; + media.addEventListener(eventName, onEvent, { once: true }); + media.addEventListener('error', onError, { once: true }); + }); +} + +/** + * Seeks to a decoded video frame. + * + * @param {HTMLVideoElement} video Seekable video element. + * @param {number} mediaTime Target media timestamp in seconds. + * @returns {Promise} Resolves after Chromium reports the seek complete. + */ +async function seekVideo(video, mediaTime) { + const target = Math.max(0, Math.min(mediaTime, Number.isFinite(video.duration) ? video.duration : mediaTime)); + if (video.readyState >= 2 && Math.abs(video.currentTime - target) < 0.001) return; + const pending = waitForMediaEvent(video, 'seeked'); + video.currentTime = target; + await pending; +} + +/** + * Extracts a numeric float embedding from a MediaPipe ImageEmbedder result. + * + * @param {object} result MediaPipe result. + * @returns {number[]|null} Serializable embedding. + */ +function unpackEmbedding(result) { + const vector = result?.embeddings?.[0]?.floatEmbedding; + return vector ? Array.from(vector) : null; +} + +/** + * Draws an eye-levelled face crop using MediaPipe's normalised landmarks. + * The crop removes most background and normalises roll and scale before the + * generic ImageEmbedder sees any pixels. + * + * @param {HTMLVideoElement} video Source video. + * @param {Array<{x: number, y: number}>} landmarks FaceLandmarker mesh. + * @param {HTMLCanvasElement} canvas Reusable square crop surface. + * @returns {{comparable: boolean, rollDegrees: number, yawOffset: number, faceWidthRatio: number}} Geometry metrics. + */ +function drawAlignedFaceCrop(video, landmarks, canvas) { + const width = video.videoWidth || 1; + const height = video.videoHeight || 1; + const points = landmarks.map((point) => ({ x: point.x * width, y: point.y * height })); + const xs = points.map((point) => point.x); + const ys = points.map((point) => point.y); + const minX = Math.min(...xs); + const maxX = Math.max(...xs); + const minY = Math.min(...ys); + const maxY = Math.max(...ys); + const faceWidth = Math.max(1, maxX - minX); + const faceHeight = Math.max(1, maxY - minY); + + const eyeA = points[FACE_MESH.rightEyeOuter]; + const eyeB = points[FACE_MESH.leftEyeOuter]; + const nose = points[FACE_MESH.noseTip]; + if (!eyeA || !eyeB || !nose) { + return { comparable: false, rollDegrees: 0, yawOffset: Infinity, faceWidthRatio: 0 }; + } + const leftEye = eyeA.x <= eyeB.x ? eyeA : eyeB; + const rightEye = eyeA.x <= eyeB.x ? eyeB : eyeA; + const eyeMid = { + x: (leftEye.x + rightEye.x) / 2, + y: (leftEye.y + rightEye.y) / 2, + }; + const interocular = Math.max(1, Math.hypot(rightEye.x - leftEye.x, rightEye.y - leftEye.y)); + const roll = Math.atan2(rightEye.y - leftEye.y, rightEye.x - leftEye.x); + const rollDegrees = Math.abs((roll * 180) / Math.PI); + const yawOffset = Math.abs(nose.x - eyeMid.x) / interocular; + const faceWidthRatio = faceWidth / width; + + const centreX = (minX + maxX) / 2; + const centreY = (minY + maxY) / 2; + const sourceEdge = Math.max(faceWidth, faceHeight) * 1.35; + const scale = canvas.width / sourceEdge; + const context = canvas.getContext('2d', { willReadFrequently: true }); + context.save(); + context.setTransform(1, 0, 0, 1, 0, 0); + context.fillStyle = '#000'; + context.fillRect(0, 0, canvas.width, canvas.height); + context.translate(canvas.width / 2, canvas.height / 2); + context.rotate(-roll); + context.scale(scale, scale); + context.translate(-centreX, -centreY); + context.drawImage(video, 0, 0); + context.restore(); + + return { + comparable: faceWidthRatio >= 0.12 && rollDegrees <= 25 && yawOffset <= 0.42, + rollDegrees, + yawOffset, + faceWidthRatio, + }; +} + +/** + * Measures crop exposure and gradient energy. Sharpness is a ranking signal, + * not a universal accept/reject threshold. + * + * @param {HTMLCanvasElement} canvas Aligned crop. + * @returns {{sharpness: number, luma: number, clippedRatio: number, exposed: boolean, signature: number[]}} Quality metrics and a low-resolution RGB signature. + */ +function measureCropQuality(canvas) { + const context = canvas.getContext('2d', { willReadFrequently: true }); + const { data, width, height } = context.getImageData(0, 0, canvas.width, canvas.height); + const gray = new Float32Array(width * height); + let lumaTotal = 0; + let clipped = 0; + const signatureGrid = 8; + const signatureChannels = new Float64Array(signatureGrid * signatureGrid * 3); + const signatureCounts = new Uint16Array(signatureGrid * signatureGrid); + for (let offset = 0, pixel = 0; offset < data.length; offset += 4, pixel += 1) { + const value = (data[offset] * 0.299 + data[offset + 1] * 0.587 + data[offset + 2] * 0.114) / 255; + gray[pixel] = value; + lumaTotal += value; + if (value < 0.02 || value > 0.98) clipped += 1; + const pixelX = pixel % width; + const pixelY = Math.floor(pixel / width); + const cellX = Math.min(signatureGrid - 1, Math.floor((pixelX / width) * signatureGrid)); + const cellY = Math.min(signatureGrid - 1, Math.floor((pixelY / height) * signatureGrid)); + const cell = cellY * signatureGrid + cellX; + const channel = cell * 3; + signatureChannels[channel] += data[offset] / 255; + signatureChannels[channel + 1] += data[offset + 1] / 255; + signatureChannels[channel + 2] += data[offset + 2] / 255; + signatureCounts[cell] += 1; + } + let gradientEnergy = 0; + for (let y = 1; y < height - 1; y += 1) { + for (let x = 1; x < width - 1; x += 1) { + const index = y * width + x; + const horizontal = gray[index + 1] - gray[index - 1]; + const vertical = gray[index + width] - gray[index - width]; + gradientEnergy += horizontal * horizontal + vertical * vertical; + } + } + const pixels = width * height; + const luma = lumaTotal / pixels; + const clippedRatio = clipped / pixels; + const signature = Array.from(signatureChannels, (value, index) => { + const count = signatureCounts[Math.floor(index / 3)] || 1; + return value / count; + }); + return { + sharpness: gradientEnergy / pixels, + luma, + clippedRatio, + exposed: luma >= 0.12 && luma <= 0.92 && clippedRatio <= 0.18, + signature, + }; +} + +/** + * Computes mean absolute difference between equal-length appearance signatures. + * + * @param {number[]} left First RGB grid. + * @param {number[]} right Second RGB grid. + * @returns {number} Mean absolute channel difference in the range 0..1. + */ +function appearanceDistance(left, right) { + if (!left || !right || left.length !== right.length) return Infinity; + let total = 0; + for (let index = 0; index < left.length; index += 1) total += Math.abs(left[index] - right[index]); + return total / left.length; +} + +/** + * Captures the decoded source frame at native video resolution. + * + * @param {HTMLVideoElement} video Source video. + * @param {number} mediaTime Current video timestamp. + * @param {number} sharpness Crop sharpness associated with the frame. + * @param {string} reason Selection reason. + * @returns {{mediaTime: number, dataUrl: string, width: number, height: number, sharpness: number, reason: string}} Frame artifact. + */ +function captureSourceFrame(video, mediaTime, sharpness, reason) { + const canvas = document.createElement('canvas'); + canvas.width = video.videoWidth; + canvas.height = video.videoHeight; + canvas.getContext('2d').drawImage(video, 0, 0); + return { + mediaTime, + dataUrl: canvas.toDataURL('image/jpeg', 0.92), + width: canvas.width, + height: canvas.height, + sharpness, + reason, + }; +} + +/** + * Creates the seekable-video analysis controller. + * + * @param {HTMLVideoElement} video Local video element. + * @param {Partial} [overrides] Configuration overrides. + * @returns {object} Controller API. + */ +export function createVideoAnalysisController(video, overrides = {}) { + /** @type {VideoLoaderConfig} */ + const config = { ...DEFAULT_VIDEO_LOADER_CONFIG, ...overrides }; + const cropCanvas = document.createElement('canvas'); + cropCanvas.width = config.alignedCropSize; + cropCanvas.height = config.alignedCropSize; + const triggerDetector = createTriggerDetector({ + heartbeatSeconds: config.heartbeatSeconds, + minimumFaceApiGapSeconds: config.minimumFaceApiGapSeconds, + jumpDelta: config.visualJumpDelta, + }); + + let faceLandmarker = null; + let imageEmbedder = null; + let modelsReady = false; + let session = null; + let sourceFile = null; + let objectUrl = null; + let cancelRequested = false; + /** @type {Array} */ + const listeners = []; + + /** + * Notifies the UI and Playwright bridge after state changes. + * + * @param {string} type Update type. + * @param {object} [detail={}] Update detail. + * @returns {void} + */ + function notify(type, detail = {}) { + const update = { type, session, ...detail }; + for (const listener of listeners) listener(update); + } + + /** + * Loads vendored face-api and MediaPipe models. + * + * @returns {Promise} Resolves after every model is ready. + */ + async function loadModels() { + if (modelsReady) return; + await Promise.all([ + faceapi.nets.tinyFaceDetector.loadFromUri(MODEL_URLS.tiny), + faceapi.nets.faceLandmark68Net.loadFromUri(MODEL_URLS.landmarks), + faceapi.nets.faceRecognitionNet.loadFromUri(MODEL_URLS.recognition), + ]); + const { FilesetResolver, FaceLandmarker, ImageEmbedder } = await import(MEDIAPIPE_TASKS_VISION_URL); + const vision = await FilesetResolver.forVisionTasks(MEDIAPIPE_WASM_URL); + [faceLandmarker, imageEmbedder] = await Promise.all([ + FaceLandmarker.createFromOptions(vision, { + baseOptions: { modelAssetPath: MEDIAPIPE_FACE_LANDMARKER_URL, delegate: 'CPU' }, + runningMode: 'IMAGE', + numFaces: 1, + outputFaceBlendshapes: false, + }), + ImageEmbedder.createFromOptions(vision, { + baseOptions: { modelAssetPath: MEDIAPIPE_IMAGE_EMBEDDER_URL, delegate: 'CPU' }, + runningMode: 'IMAGE', + l2Normalize: true, + }), + ]); + modelsReady = true; + notify('models-ready'); + } + + /** + * Loads a local file into the video element and creates a fresh session. + * + * @param {File} file User-selected local video. + * @param {object} [metadata] Optional Node-computed provenance. + * @param {string|null} [metadata.fingerprint] Bounded source fingerprint. + * @returns {Promise} Fresh analysis session. + */ + async function loadFile(file, metadata = {}) { + cancelRequested = true; + if (objectUrl) URL.revokeObjectURL(objectUrl); + sourceFile = file; + objectUrl = URL.createObjectURL(file); + video.pause(); + video.srcObject = null; + const metadataReady = waitForMediaEvent(video, 'loadedmetadata'); + video.src = objectUrl; + video.load(); + await metadataReady; + session = createAnalysisSession({ + name: file.name, + size: file.size, + type: file.type || 'application/octet-stream', + lastModified: file.lastModified || null, + duration: video.duration, + width: video.videoWidth, + height: video.videoHeight, + fingerprint: metadata.fingerprint || null, + }, config); + session.models = { + faceApi: '@vladmandic/face-api vendored bundle', + faceMatcherDefaultThreshold: DEFAULT_FACE_DISTANCE_THRESHOLD, + mediaPipeTasksVision: '0.10.35', + mediaPipeDelegate: 'CPU', + faceLandmarker: 'float16/1', + imageEmbedder: 'mobilenet_v3_small float32/1', + }; + appendJournal(session, 'source-loaded', { source: session.source }); + triggerDetector.reset(); + cancelRequested = false; + notify('source-loaded'); + return session; + } + + /** + * Creates an empty analysis state for the already loaded source. This is + * used when a failed or completed run is intentionally started again; a + * resume operation keeps the existing session instead. + * + * @returns {object} Fresh session for the current source. + */ + function resetLoadedSourceSession() { + const source = structuredClone(session.source); + const models = structuredClone(session.models); + session = createAnalysisSession(source, config); + session.models = models; + appendJournal(session, 'source-reused', { source: session.source }); + triggerDetector.reset(); + return session; + } + + /** + * Runs face-api recognition against the current decoded frame. + * + * @returns {Promise} Detection with landmarks and descriptor. + */ + async function runFaceApi() { + session.summary.faceApiRuns += 1; + const options = new faceapi.TinyFaceDetectorOptions({ inputSize: 416, scoreThreshold: 0.5 }); + return faceapi.detectSingleFace(video, options).withFaceLandmarks().withFaceDescriptor(); + } + + /** + * Compares one person-selected source timestamp with the established + * baseline. The explicit request runs both detector families immediately, + * stores one lightweight sample, captures the native frame, and creates a + * manual story entry without pretending that it passed automatic voting. + * + * @param {number} mediaTime Source timestamp requested by the person. + * @returns {Promise} Created manual evidence event. + */ + async function analyzeFrame(mediaTime) { + if (!sourceFile || !session) throw new Error('Load a local video before analysing a frame.'); + if (!modelsReady) await loadModels(); + if (!session.baseline) throw new Error('Complete baseline acquisition before analysing an individual frame.'); + if (session.status === 'analysing') throw new Error('Pause the running analysis before inspecting an individual frame.'); + + const target = Math.max(0, Math.min(video.duration, Number(mediaTime))); + if (!Number.isFinite(target)) throw new Error('The requested frame timestamp is invalid.'); + await seekVideo(video, target); + const mediaPipeResult = faceLandmarker.detect(video); + const landmarks = mediaPipeResult?.faceLandmarks?.[0] || null; + let geometry = null; + let quality = null; + let embedding = null; + let comparable = false; + if (landmarks) { + geometry = drawAlignedFaceCrop(video, landmarks, cropCanvas); + const measured = measureCropQuality(cropCanvas); + quality = { + sharpness: measured.sharpness, + luma: measured.luma, + clippedRatio: measured.clippedRatio, + exposed: measured.exposed, + }; + comparable = geometry.comparable && quality.exposed; + if (comparable) embedding = unpackEmbedding(imageEmbedder.embed(cropCanvas)); + } + const drift = comparable && embedding + ? visualDrift(embedding, session.baseline.embedding) + : null; + const detection = await runFaceApi(); + const faceDistance = detection?.descriptor + ? euclideanDistance(detection.descriptor, session.baseline.descriptor) + : null; + const interpretation = !comparable + ? 'not-comparable' + : !detection + ? 'no-2d-face' + : faceDistance >= config.faceDistanceThreshold + ? 'above-threshold' + : 'below-threshold'; + const sample = appendSample(session, { + phase: 'manual', + mediaTime: target, + facePresent: !!landmarks, + comparable, + visualDrift: drift, + visualThreshold: session.baseline.visualTriggerThreshold, + geometry, + quality, + }); + const observation = { + mediaTime: target, + outcome: interpretation === 'above-threshold' || interpretation === 'no-2d-face' + ? 'divergent' + : interpretation === 'below-threshold' ? 'matched' : 'not-comparable', + mediaPipeComparable: comparable, + faceApiDetected: !!detection, + faceDistance, + faceThreshold: config.faceDistanceThreshold, + visualDrift: drift, + reasons: ['manual-frame-check'], + quality, + }; + appendJournal(session, 'face-api-result', { ...observation, origin: 'manual' }); + const frame = captureSourceFrame( + video, + target, + quality?.sharpness || 0, + 'manual-frame-check', + ); + const event = recordManualFrameCheck(session, { + mediaTime: target, + interpretation, + observation, + frame, + }); + notify('manual-frame-checked', { event, sample }); + return event; + } + + /** + * Finds a clear frame near a confirmed event without retaining a frame + * queue. MediaPipe ranks timestamps first; face-api then verifies only the + * sharpest bounded subset before the native source frame is captured. + * + * @param {object} event Confirmed evidence event. + * @param {number} analysisStart First allowed media timestamp. + * @param {number} analysisEnd Last allowed media timestamp. + * @returns {Promise} Selected frame payload. + */ + async function refineEvidenceFrame(event, analysisStart, analysisEnd) { + const radius = config.evidenceRefinementRadiusSeconds; + const rangeStart = Math.max(analysisStart, event.startMediaTime - radius); + const rangeEnd = Math.min(analysisEnd, event.endMediaTime + radius); + const candidates = []; + + for (let candidateTime = rangeStart; candidateTime <= rangeEnd + 0.0001; candidateTime += config.evidenceRefinementStepSeconds) { + const mediaTime = Math.min(candidateTime, rangeEnd); + await seekVideo(video, mediaTime); + const result = faceLandmarker.detect(video); + const landmarks = result?.faceLandmarks?.[0]; + if (!landmarks) continue; + const geometry = drawAlignedFaceCrop(video, landmarks, cropCanvas); + const measured = measureCropQuality(cropCanvas); + const quality = { + sharpness: measured.sharpness, + luma: measured.luma, + clippedRatio: measured.clippedRatio, + exposed: measured.exposed, + }; + if (!geometry.comparable || !quality.exposed) continue; + candidates.push({ mediaTime, quality, geometry }); + } + + const ranked = candidates + .sort((left, right) => right.quality.sharpness - left.quality.sharpness) + .slice(0, config.evidenceRefinementFaceApiCandidates); + let selected = null; + let selectionSource = 'refined'; + for (const candidate of ranked) { + await seekVideo(video, candidate.mediaTime); + const detection = await runFaceApi(); + const faceDistance = detection?.descriptor + ? euclideanDistance(detection.descriptor, session.baseline.descriptor) + : null; + const detectorMissing = !detection; + const identityDistance = Number.isFinite(faceDistance) + && faceDistance >= config.faceDistanceThreshold; + const retainsEvidence = event.classification === 'identity-distance' + ? identityDistance + : event.classification === 'detector-divergence' + ? detectorMissing + : detectorMissing || identityDistance; + appendJournal(session, 'evidence-refinement-check', { + eventId: event.id, + mediaTime: candidate.mediaTime, + sharpness: candidate.quality.sharpness, + faceApiDetected: !!detection, + faceDistance, + retainsEvidence, + }); + if (retainsEvidence) { + selected = { + ...candidate, + faceApiDetected: !!detection, + faceDistance, + }; + break; + } + } + + if (!selected) { + const fallback = event.observations.reduce((best, item) => ( + (item.quality?.sharpness || 0) > (best.quality?.sharpness || 0) ? item : best + )); + selected = { + mediaTime: fallback.mediaTime, + quality: fallback.quality || { sharpness: 0 }, + faceApiDetected: fallback.faceApiDetected, + faceDistance: fallback.faceDistance, + }; + selectionSource = 'original-observation'; + } + + await seekVideo(video, selected.mediaTime); + const reason = selected.faceApiDetected + ? `${selectionSource}-face-distance-above-threshold` + : `${selectionSource}-mediapipe-present-face-api-missing`; + const frame = captureSourceFrame( + video, + selected.mediaTime, + selected.quality?.sharpness || 0, + reason, + ); + selectEventFrame(event, frame); + appendJournal(session, 'evidence-frame-selected', { + eventId: event.id, + mediaTime: frame.mediaTime, + sharpness: frame.sharpness, + reason, + refinementCandidates: candidates.length, + faceApiCandidates: ranked.length, + }); + return frame; + } + + /** + * Finalises the baseline after enough stable samples have been accepted. + * + * @param {Array} embeddingSamples Accepted embedding samples. + * @param {Array} faceSamples Accepted face-api samples. + * @param {object} representativeFrame Visible baseline frame. + * @param {number|null} anchoredMediaTime Human-selected timestamp, or null for automatic search. + * @returns {object} Stored session baseline. + */ + function finaliseBaseline(embeddingSamples, faceSamples, representativeFrame, anchoredMediaTime = null) { + const embeddingVectors = embeddingSamples.map((sample) => sample.embedding); + const faceDescriptors = faceSamples.map((sample) => sample.descriptor); + const embeddingReferenceIndex = anchoredMediaTime === null + ? null + : embeddingSamples.findIndex((sample) => Math.abs(sample.mediaTime - anchoredMediaTime) < 0.001); + const faceReferenceIndex = anchoredMediaTime === null + ? null + : faceSamples.findIndex((sample) => Math.abs(sample.mediaTime - anchoredMediaTime) < 0.001); + const embeddingBaseline = anchoredMediaTime === null + ? buildEmbeddingBaseline(embeddingVectors, { + minimumDelta: config.minimumVisualDelta, + madMultiplier: config.visualMadMultiplier, + }) + : buildAnchoredEmbeddingBaseline(embeddingVectors, embeddingReferenceIndex, { + minimumDelta: config.minimumVisualDelta, + madMultiplier: config.visualMadMultiplier, + }); + const faceBaseline = anchoredMediaTime === null + ? buildFaceBaseline(faceDescriptors) + : buildAnchoredFaceBaseline(faceDescriptors, faceReferenceIndex); + session.baseline = { + mediaTime: representativeFrame.mediaTime, + selectionMode: anchoredMediaTime === null ? 'automatic-search' : 'selected-frame', + selectedMediaTime: anchoredMediaTime, + embedding: embeddingBaseline.embedding, + descriptor: faceBaseline.descriptor, + faceSpread: faceBaseline.spread, + embeddingMedianDrift: embeddingBaseline.medianDrift, + embeddingMad: embeddingBaseline.mad, + visualTriggerThreshold: embeddingBaseline.triggerThreshold, + frame: representativeFrame, + }; + appendJournal(session, 'baseline-ready', { + mediaTime: session.baseline.mediaTime, + selectionMode: session.baseline.selectionMode, + selectedMediaTime: session.baseline.selectedMediaTime, + faceSpread: session.baseline.faceSpread, + embeddingMedianDrift: session.baseline.embeddingMedianDrift, + embeddingMad: session.baseline.embeddingMad, + visualTriggerThreshold: session.baseline.visualTriggerThreshold, + }); + return session.baseline; + } + + /** + * Runs the complete coarse scan over a selected media-time interval. + * + * @param {object} [options] Scan range and baseline search start. + * @param {number} [options.start] First source timestamp. + * @param {number} [options.end] Last source timestamp. + * @param {number} [options.baselineTime] Baseline timestamp or automatic-search start. + * @param {'anchored'|'search'} [options.baselineSelectionMode] Whether baselineTime is exact or a search start. + * @param {number} [options.sampleIntervalSeconds] Coarse scan cadence. + * @param {boolean} [options.resume] Continue a previously cancelled scan. + * @returns {Promise} Completed or cancelled session. + */ + async function analyze(options = {}) { + if (!sourceFile || !session) throw new Error('Load a local video before starting analysis.'); + if (!modelsReady) await loadModels(); + const resumeRequested = options.resume === true; + if (resumeRequested && session.status !== 'cancelled') { + throw new Error('Only a cancelled analysis can be resumed.'); + } + if (!resumeRequested && session.status !== 'idle') resetLoadedSourceSession(); + const previousRange = session.config.analysisRange; + const start = Math.max(0, Number(resumeRequested ? previousRange?.start ?? 0 : options.start ?? 0)); + const end = Math.min( + video.duration, + Number(resumeRequested ? previousRange?.end ?? video.duration : options.end ?? video.duration), + ); + const baselineTime = Math.max(start, Math.min( + end, + Number(resumeRequested ? session.config.baselineSearchStart ?? start : options.baselineTime ?? start), + )); + const baselineSelectionMode = resumeRequested + ? session.config.baselineSelectionMode ?? 'search' + : options.baselineSelectionMode === 'anchored' ? 'anchored' : 'search'; + const anchoredBaseline = baselineSelectionMode === 'anchored'; + const baselineSearchEnd = anchoredBaseline + ? Math.min(end, baselineTime + config.anchoredBaselineWindowSeconds) + : end; + const step = Math.max(0.1, Number( + resumeRequested ? session.config.sampleIntervalSeconds : options.sampleIntervalSeconds ?? config.sampleIntervalSeconds, + )); + if (!(end > start)) throw new Error('Analysis end time must be greater than start time.'); + + const previousScanSamples = session.samples.filter((sample) => sample.phase === 'scan'); + const lastScanSample = previousScanSamples.at(-1) || null; + const resumeWithBaseline = resumeRequested && !!session.baseline; + const resumeMediaTime = resumeWithBaseline && lastScanSample + ? Math.min(end, lastScanSample.mediaTime + step) + : start; + const scanSampleTotal = Math.ceil((end - start) / step) + 1; + let scanSampleIndex = previousScanSamples.length; + const baselineEmbeddingSamplesRequired = anchoredBaseline + ? config.anchoredBaselineEmbeddingSamples + : config.baselineEmbeddingSamples; + const baselineFaceSamplesRequired = anchoredBaseline + ? config.anchoredBaselineFaceSamples + : config.baselineFaceSamples; + + cancelRequested = false; + video.pause(); + session.status = 'analysing'; + session.config.sampleIntervalSeconds = step; + session.config.analysisRange = { start, end }; + session.config.baselineSearchStart = baselineTime; + session.config.baselineSelectionMode = baselineSelectionMode; + session.config.baselineSearchEnd = baselineSearchEnd; + session.config.baselineSampleIntervalSeconds = Math.min(step, 0.25); + appendJournal(session, resumeRequested ? 'analysis-resumed' : 'analysis-started', { + start, + end, + baselineTime, + baselineSelectionMode, + baselineSearchEnd, + sampleIntervalSeconds: step, + resumeMediaTime: resumeRequested ? resumeMediaTime : null, + }); + notify(resumeRequested ? 'analysis-resumed' : 'analysis-started', { + start, + end, + resumeMediaTime: resumeRequested ? resumeMediaTime : null, + scanSampleIndex, + scanSampleTotal, + }); + + /** @type {Array<{mediaTime: number, embedding: number[], quality: object, signature: number[], geometry: object}>} */ + const embeddingSamples = []; + /** @type {Array<{mediaTime: number, descriptor: number[]}>} */ + const faceSamples = []; + let anchoredBaselineFailure = null; + + /** + * Drops an unstable baseline run while retaining the reason in the + * technical journal. No frame pixels are retained by the candidate. + * + * @param {string} reason Stable reset reason. + * @param {number} atMediaTime Timestamp that broke continuity. + * @param {object} [detail={}] Numeric diagnostics. + * @returns {void} + */ + function resetBaselineCandidate(reason, atMediaTime, detail = {}) { + if (embeddingSamples.length || faceSamples.length) { + appendJournal(session, 'baseline-candidate-reset', { + reason, + mediaTime: atMediaTime, + acceptedEmbeddings: embeddingSamples.length, + acceptedDescriptors: faceSamples.length, + ...detail, + }); + } + embeddingSamples.length = 0; + faceSamples.length = 0; + } + + let phase = resumeWithBaseline ? 'scan' : 'baseline'; + let mediaTime = resumeWithBaseline ? resumeMediaTime : baselineTime; + while (mediaTime <= end + 0.0001) { + if (cancelRequested) break; + if (phase === 'baseline' && mediaTime > baselineSearchEnd + 0.0001) break; + const currentTime = Math.min(mediaTime, end); + await seekVideo(video, currentTime); + const mediaPipeResult = faceLandmarker.detect(video); + const landmarks = mediaPipeResult?.faceLandmarks?.[0] || null; + let geometry = null; + let quality = null; + let appearanceSignature = null; + let embedding = null; + let comparable = false; + + if (landmarks) { + geometry = drawAlignedFaceCrop(video, landmarks, cropCanvas); + const measuredQuality = measureCropQuality(cropCanvas); + const { signature, ...serialisableQuality } = measuredQuality; + quality = serialisableQuality; + appearanceSignature = signature; + comparable = geometry.comparable && quality.exposed; + if (comparable) embedding = unpackEmbedding(imageEmbedder.embed(cropCanvas)); + } + + if (!session.baseline && comparable && embedding) { + const previous = embeddingSamples.at(-1); + const continuityDrift = previous ? visualDrift(embedding, previous.embedding) : 0; + const appearanceStep = previous ? appearanceDistance(appearanceSignature, previous.signature) : 0; + const rollStep = previous ? Math.abs(geometry.rollDegrees - previous.geometry.rollDegrees) : 0; + const yawStep = previous ? Math.abs(geometry.yawOffset - previous.geometry.yawOffset) : 0; + const scaleStep = previous ? Math.abs(geometry.faceWidthRatio - previous.geometry.faceWidthRatio) : 0; + const unstable = appearanceStep > config.maximumBaselineAppearanceStep + || rollStep > config.maximumBaselineRollStep + || yawStep > config.maximumBaselineYawStep + || scaleStep > config.maximumBaselineScaleStep; + if (unstable) { + const detail = { appearanceStep, continuityDrift, rollStep, yawStep, scaleStep }; + if (anchoredBaseline) { + appendJournal(session, 'anchored-baseline-neighbour-skipped', { + reason: 'appearance-or-pose-discontinuity', + mediaTime: currentTime, + ...detail, + }); + } else { + resetBaselineCandidate('appearance-or-pose-discontinuity', currentTime, detail); + } + } + if (!unstable || !anchoredBaseline) { + embeddingSamples.push({ + mediaTime: currentTime, + embedding, + quality, + signature: appearanceSignature, + geometry, + }); + } + if (embeddingSamples.length >= baselineEmbeddingSamplesRequired) { + const rankedVerificationSamples = [...embeddingSamples] + .sort((left, right) => right.quality.sharpness - left.quality.sharpness) + .filter((sample) => !anchoredBaseline + || Math.abs(sample.mediaTime - baselineTime) >= 0.001); + const selectedSample = anchoredBaseline + ? embeddingSamples.find((sample) => Math.abs(sample.mediaTime - baselineTime) < 0.001) + : null; + const verificationSamples = [ + ...(selectedSample ? [selectedSample] : []), + ...rankedVerificationSamples, + ] + .slice(0, baselineFaceSamplesRequired) + .sort((left, right) => left.mediaTime - right.mediaTime); + faceSamples.length = 0; + for (const candidate of verificationSamples) { + await seekVideo(video, candidate.mediaTime); + const detection = await runFaceApi(); + if (detection?.descriptor) { + faceSamples.push({ + mediaTime: candidate.mediaTime, + descriptor: Array.from(detection.descriptor), + }); + } + } + + if (faceSamples.length >= baselineFaceSamplesRequired) { + const selectedFaceIndex = anchoredBaseline + ? faceSamples.findIndex((sample) => Math.abs(sample.mediaTime - baselineTime) < 0.001) + : -1; + if (anchoredBaseline && selectedFaceIndex < 0) { + resetBaselineCandidate('selected-frame-face-api-missing', currentTime); + anchoredBaselineFailure = 'face-api-could-not-describe-the-selected-frame'; + } else { + const provisionalFaceBaseline = anchoredBaseline + ? buildAnchoredFaceBaseline( + faceSamples.map((sample) => sample.descriptor), + selectedFaceIndex, + ) + : buildFaceBaseline(faceSamples.map((sample) => sample.descriptor)); + const maximumFaceSpread = anchoredBaseline + ? config.maximumAnchoredBaselineFaceSpread + : config.maximumBaselineFaceSpread; + if (provisionalFaceBaseline.spread <= maximumFaceSpread) { + const provisionalEmbeddingBaseline = buildEmbeddingBaseline( + embeddingSamples.map((sample) => sample.embedding), + { + minimumDelta: config.minimumVisualDelta, + madMultiplier: config.visualMadMultiplier, + }, + ); + const representative = anchoredBaseline + ? selectedSample + : embeddingSamples[provisionalEmbeddingBaseline.medoidIndex]; + await seekVideo(video, representative.mediaTime); + const representativeFrame = captureSourceFrame( + video, + representative.mediaTime, + representative.quality.sharpness, + anchoredBaseline ? 'baseline-selected-frame' : 'baseline-embedding-medoid', + ); + finaliseBaseline( + embeddingSamples, + faceSamples, + representativeFrame, + anchoredBaseline ? baselineTime : null, + ); + triggerDetector.markFaceApi(currentTime); + notify('baseline-ready'); + } else { + resetBaselineCandidate('face-descriptor-spread', currentTime, { + faceSpread: provisionalFaceBaseline.spread, + }); + if (anchoredBaseline) anchoredBaselineFailure = 'selected-frame-descriptors-are-not-stable'; + } + } + } else { + const selectedFaceAvailable = faceSamples.some( + (sample) => Math.abs(sample.mediaTime - baselineTime) < 0.001, + ); + if (anchoredBaseline && selectedFaceAvailable) { + appendJournal(session, 'anchored-baseline-face-sample-incomplete', { + mediaTime: currentTime, + acceptedDescriptors: faceSamples.length, + requiredDescriptors: baselineFaceSamplesRequired, + }); + } else { + resetBaselineCandidate('face-api-baseline-incomplete', currentTime); + if (anchoredBaseline) { + anchoredBaselineFailure = 'face-api-could-not-describe-the-selected-frame'; + } + } + } + } + } else if (!session.baseline && embeddingSamples.length) { + if (anchoredBaseline) { + appendJournal(session, 'anchored-baseline-neighbour-skipped', { + reason: 'non-comparable-frame', + mediaTime: currentTime, + }); + } else { + resetBaselineCandidate('non-comparable-frame', currentTime); + } + } else if (!session.baseline && anchoredBaseline && currentTime === baselineTime) { + anchoredBaselineFailure = 'selected-frame-is-not-comparable'; + } + + const drift = session.baseline && embedding + ? visualDrift(embedding, session.baseline.embedding) + : null; + const sample = appendSample(session, { + phase, + mediaTime: currentTime, + facePresent: !!landmarks, + comparable, + visualDrift: drift, + visualThreshold: session.baseline?.visualTriggerThreshold ?? null, + geometry, + quality, + }); + if (phase === 'scan') { + scanSampleIndex += 1; + session.config.lastScanMediaTime = currentTime; + } + + if (session.baseline && phase === 'scan') { + const decision = triggerDetector.evaluate(sample); + for (const observation of decision.observations) { + appendJournal(session, observation, { mediaTime: currentTime }); + } + if (decision.shouldVerify) { + const detection = await runFaceApi(); + triggerDetector.markFaceApi(currentTime); + const faceDistance = detection?.descriptor + ? euclideanDistance(detection.descriptor, session.baseline.descriptor) + : null; + const divergent = !detection || faceDistance >= config.faceDistanceThreshold; + const observation = { + mediaTime: currentTime, + outcome: divergent ? 'divergent' : 'matched', + mediaPipeComparable: comparable, + faceApiDetected: !!detection, + faceDistance, + faceThreshold: config.faceDistanceThreshold, + visualDrift: drift, + reasons: decision.reasons, + quality, + }; + appendJournal(session, 'face-api-result', observation); + + if (divergent) { + const confirmedBeforeObservation = session.summary.confirmedEvents; + const event = recordEvidenceObservation(session, observation); + const newlyConfirmed = session.summary.confirmedEvents > confirmedBeforeObservation; + if (newlyConfirmed) { + await refineEvidenceFrame(event, start, end); + notify('event-confirmed', { event }); + } + } + } + } + + notify('sample', { + sample, + phase, + progress: phase === 'baseline' ? 0 : (currentTime - start) / (end - start), + baselineAcceptedSamples: phase === 'baseline' ? embeddingSamples.length : null, + baselineRequiredSamples: baselineEmbeddingSamplesRequired, + baselineAcceptedDescriptors: phase === 'baseline' ? faceSamples.length : null, + baselineRequiredDescriptors: baselineFaceSamplesRequired, + scanSampleIndex, + scanSampleTotal, + }); + if (anchoredBaselineFailure && phase === 'baseline') break; + if (session.baseline && phase === 'baseline') { + phase = 'scan'; + mediaTime = start; + triggerDetector.reset(); + appendJournal(session, 'analysis-scan-started', { start, end }); + notify('analysis-scan-started', { start, end }); + await new Promise((resolve) => window.setTimeout(resolve, 0)); + continue; + } + if (currentTime >= end) break; + const nextTime = currentTime + (phase === 'scan' ? step : session.config.baselineSampleIntervalSeconds); + mediaTime = nextTime > end ? end : nextTime; + await new Promise((resolve) => window.setTimeout(resolve, 0)); + } + + if (!session.baseline && !cancelRequested) { + session.status = 'failed'; + const selectedEmbeddingAvailable = embeddingSamples.some( + (sample) => Math.abs(sample.mediaTime - baselineTime) < 0.001, + ); + const selectedDescriptorAvailable = faceSamples.some( + (sample) => Math.abs(sample.mediaTime - baselineTime) < 0.001, + ); + const reason = anchoredBaselineFailure || (anchoredBaseline + ? selectedEmbeddingAvailable && embeddingSamples.length < baselineEmbeddingSamplesRequired + ? 'selected-frame-neighbours-insufficient' + : selectedDescriptorAvailable && faceSamples.length < baselineFaceSamplesRequired + ? 'selected-frame-descriptors-insufficient' + : 'selected-frame-window-incomplete' + : 'baseline-not-found'); + const failureDetail = { + reason, + baselineTime, + baselineSearchEnd, + acceptedEmbeddings: embeddingSamples.length, + requiredEmbeddings: baselineEmbeddingSamplesRequired, + acceptedDescriptors: faceSamples.length, + requiredDescriptors: baselineFaceSamplesRequired, + }; + appendJournal(session, 'analysis-failed', failureDetail); + notify('analysis-failed', failureDetail); + if (anchoredBaseline) { + if (reason === 'selected-frame-neighbours-insufficient') { + throw new Error(`The selected baseline at ${baselineTime.toFixed(3)} s had only ${embeddingSamples.length} of ${baselineEmbeddingSamplesRequired} comparable nearby frames. Choose a steadier moment and try again.`); + } + if (reason === 'selected-frame-descriptors-insufficient') { + throw new Error(`The selected baseline at ${baselineTime.toFixed(3)} s had only ${faceSamples.length} of ${baselineFaceSamplesRequired} nearby face-api descriptors. Choose a clearer interval and try again.`); + } + throw new Error(`The selected baseline at ${baselineTime.toFixed(3)} s could not produce a stable local reference (${reason}). Choose a clearer frame and try again.`); + } + throw new Error('No stable face baseline was found in the selected interval.'); + } + + session.status = cancelRequested ? 'cancelled' : 'complete'; + session.updatedAt = new Date().toISOString(); + if (cancelRequested && Number.isFinite(session.config.lastScanMediaTime)) { + await seekVideo(video, session.config.lastScanMediaTime); + } + appendJournal(session, cancelRequested ? 'analysis-cancelled' : 'analysis-complete', { + summary: session.summary, + lastScanMediaTime: session.config.lastScanMediaTime ?? null, + scanSampleIndex, + scanSampleTotal, + }); + const cancelledProgress = Number.isFinite(session.config.lastScanMediaTime) + ? Math.max(0, Math.min(1, (session.config.lastScanMediaTime - start) / (end - start))) + : 0; + notify(session.status === 'complete' ? 'analysis-complete' : 'analysis-cancelled', { + progress: session.status === 'complete' ? 1 : cancelledProgress, + mediaTime: session.config.lastScanMediaTime ?? null, + scanSampleIndex, + scanSampleTotal, + }); + return session; + } + + /** + * Requests cancellation at the next sample boundary. + * + * @returns {void} + */ + function cancel() { + cancelRequested = true; + } + + /** + * Returns report, technical log, and separately addressable image artifacts. + * + * @returns {{report: object, technicalLog: string, frames: Array}} Export bundle. + */ + function exportBundle() { + if (!session) throw new Error('No analysis session is available.'); + const frames = []; + if (session.baseline?.frame) frames.push({ id: 'baseline', ...session.baseline.frame }); + for (const event of session.events) { + if (event.status === 'confirmed' && event.selectedFrame) { + frames.push({ id: event.id, ...event.selectedFrame }); + } + } + return { + report: buildReport(session), + technicalLog: serializeTechnicalLog(session), + frames, + }; + } + + return { + config, + loadModels, + loadFile, + analyze, + analyzeFrame, + cancel, + exportBundle, + getSession: () => session, + isModelsReady: () => modelsReady, + subscribe(listener) { + listeners.push(listener); + return () => { + const index = listeners.indexOf(listener); + if (index >= 0) listeners.splice(index, 1); + }; + }, + }; +} diff --git a/lab-js/video-loader/session.js b/lab-js/video-loader/session.js new file mode 100644 index 0000000..c8a25f4 --- /dev/null +++ b/lab-js/video-loader/session.js @@ -0,0 +1,487 @@ +/** + * @module video-loader/session + * @description + * Versioned analysis session, technical journal, and reversible editorial + * commands for the Video Loader. The technical journal is intentionally + * independent from the report so it can later drive clip extraction or other + * post-processing without rendering the editorial output again. + */ + +/** Current machine-readable session and log schema version. */ +export const VIDEO_ANALYSIS_SCHEMA_VERSION = 4; + +/** + * Creates a stable random identifier with a deterministic fallback for older + * browsers and constrained test environments. + * + * @param {string} prefix Identifier prefix. + * @returns {string} Unique identifier. + */ +function createId(prefix) { + const random = globalThis.crypto?.randomUUID?.() || `${Date.now()}-${Math.random().toString(16).slice(2)}`; + return `${prefix}-${random}`; +} + +/** + * Creates an empty video-analysis session. + * + * @param {object} source Source metadata. + * @param {string} source.name Source filename. + * @param {number} source.size Source byte size. + * @param {string} source.type Source media type. + * @param {number} [source.lastModified] Source modification time. + * @param {number} [source.duration] Decoded duration. + * @param {number} [source.width] Decoded width. + * @param {number} [source.height] Decoded height. + * @param {string|null} [source.fingerprint] Bounded source fingerprint. + * @param {object} config Effective analyser configuration. + * @returns {object} Mutable session owned by one analyser controller. + */ +export function createAnalysisSession(source, config) { + const createdAt = new Date().toISOString(); + return { + schemaVersion: VIDEO_ANALYSIS_SCHEMA_VERSION, + sessionId: createId('session'), + createdAt, + updatedAt: createdAt, + source: { ...source }, + config: structuredClone(config), + models: {}, + baseline: null, + samples: [], + events: [], + journal: [], + editorial: { + storyOrder: ['baseline'], + undo: [], + redo: [], + }, + status: 'idle', + summary: { + sampledFrames: 0, + mediaPipeFaces: 0, + faceApiRuns: 0, + confirmedEvents: 0, + manualChecks: 0, + }, + }; +} + +/** + * Appends one structured technical-journal entry. + * + * @param {object} session Analysis session. + * @param {string} type Stable entry type. + * @param {object} [payload={}] Serializable entry payload. + * @returns {object} Appended journal entry. + */ +export function appendJournal(session, type, payload = {}) { + const entry = { + sequence: session.journal.length + 1, + recordedAt: new Date().toISOString(), + type, + ...structuredClone(payload), + }; + session.journal.push(entry); + session.updatedAt = entry.recordedAt; + return entry; +} + +/** + * Adds one lightweight sample without image pixels or model vectors. + * + * @param {object} session Analysis session. + * @param {object} sample Serializable sample metrics. + * @returns {object} Stored sample. + */ +export function appendSample(session, sample) { + const stored = { + sequence: session.samples.length + 1, + ...structuredClone(sample), + }; + session.samples.push(stored); + session.summary.sampledFrames += 1; + if (stored.facePresent) session.summary.mediaPipeFaces += 1; + return stored; +} + +/** + * Adds an evidence event or merges a nearby verification into the latest open + * event. Images may be attached to the session for report rendering, but they + * are excluded from the separately downloadable technical log. + * + * @param {object} session Analysis session. + * @param {object} observation Face-api observation and trigger context. + * @param {number} [mergeWindowSeconds=3] Maximum distance from the previous observation. + * @returns {object} Created or updated event. + */ +export function recordEvidenceObservation(session, observation, mergeWindowSeconds = 3) { + const latest = session.events.at(-1); + const mayMerge = latest + && latest.origin !== 'manual' + && latest.status !== 'rejected' + && observation.mediaTime - latest.endMediaTime <= mergeWindowSeconds; + const event = mayMerge ? latest : { + id: createId('event'), + origin: 'automatic', + startMediaTime: observation.mediaTime, + endMediaTime: observation.mediaTime, + anchorMediaTime: observation.mediaTime, + status: 'candidate', + classification: 'unclassified', + reviewRequired: true, + promoted: false, + caption: '', + observations: [], + selectedFrame: null, + recommendedClip: { + start: Math.max(0, observation.mediaTime - 2), + end: observation.mediaTime + 3, + }, + }; + + if (!mayMerge) { + session.events.push(event); + } + event.observations.push(structuredClone(observation)); + event.endMediaTime = observation.mediaTime; + event.recommendedClip.end = observation.mediaTime + 3; + + const divergent = event.observations.filter((item) => ( + item.outcome === 'divergent' + && (Number.isFinite(item.faceDistance) || item.mediaPipeComparable === true) + )); + if (divergent.length >= 2 && event.status !== 'confirmed') { + event.status = 'confirmed'; + event.anchorMediaTime = divergent.reduce((best, item) => ( + (item.quality?.sharpness || 0) > (best.quality?.sharpness || 0) ? item : best + )).mediaTime; + session.editorial.storyOrder.push(event.id); + const chronologicalEvents = session.editorial.storyOrder + .filter((itemId) => itemId !== 'baseline') + .sort((leftId, rightId) => { + const leftTime = session.events.find((candidate) => candidate.id === leftId)?.anchorMediaTime + ?? Number.POSITIVE_INFINITY; + const rightTime = session.events.find((candidate) => candidate.id === rightId)?.anchorMediaTime + ?? Number.POSITIVE_INFINITY; + return leftTime - rightTime; + }); + session.editorial.storyOrder = ['baseline', ...chronologicalEvents]; + session.summary.confirmedEvents += 1; + } + const distanceDivergences = divergent.filter((item) => ( + Number.isFinite(item.faceDistance) + && item.faceDistance >= (item.faceThreshold ?? session.config.faceDistanceThreshold) + )); + const missingDetections = divergent.filter((item) => ( + item.mediaPipeComparable === true && item.faceApiDetected === false + )); + if (distanceDivergences.length >= 2) { + event.classification = 'identity-distance'; + event.reviewRequired = false; + } else if (missingDetections.length >= 2) { + event.classification = 'detector-divergence'; + event.reviewRequired = true; + } else if (divergent.length >= 2) { + event.classification = 'mixed-divergence'; + event.reviewRequired = true; + } + return event; +} + +/** + * Adds one person-requested source-frame comparison to the evidence story. + * Unlike automatic events, a manual check needs no repeated divergence vote: + * its meaning is that a person explicitly asked to inspect this timestamp. + * Image bytes remain on the session event and are omitted from the log. + * + * @param {object} session Analysis session with an acquired baseline. + * @param {object} check Manual comparison result. + * @param {number} check.mediaTime Exact source timestamp. + * @param {'below-threshold'|'above-threshold'|'no-2d-face'|'not-comparable'} check.interpretation Human-facing result category. + * @param {object} check.observation Model result stored with the event. + * @param {{mediaTime: number, dataUrl: string, width: number, height: number, sharpness: number, reason: string}} check.frame Native source frame. + * @returns {object} Created manual evidence event. + */ +export function recordManualFrameCheck(session, check) { + if (!session.baseline) throw new Error('A baseline is required before a frame can be compared.'); + const event = { + id: createId('event'), + origin: 'manual', + startMediaTime: check.mediaTime, + endMediaTime: check.mediaTime, + anchorMediaTime: check.mediaTime, + status: 'confirmed', + classification: 'manual-frame-check', + interpretation: check.interpretation, + reviewRequired: true, + promoted: false, + caption: '', + observations: [structuredClone(check.observation)], + selectedFrame: { ...check.frame }, + recommendedClip: { + start: Math.max(0, check.mediaTime - 2), + end: check.mediaTime + 3, + }, + }; + session.events.push(event); + session.editorial.storyOrder.push(event.id); + session.summary.manualChecks = (session.summary.manualChecks || 0) + 1; + appendJournal(session, 'manual-frame-checked', { + eventId: event.id, + mediaTime: check.mediaTime, + interpretation: check.interpretation, + mediaPipeComparable: check.observation.mediaPipeComparable, + faceApiDetected: check.observation.faceApiDetected, + faceDistance: check.observation.faceDistance, + faceThreshold: check.observation.faceThreshold, + visualDrift: check.observation.visualDrift, + frame: { + mediaTime: check.frame.mediaTime, + width: check.frame.width, + height: check.frame.height, + sharpness: check.frame.sharpness, + reason: check.frame.reason, + }, + }); + return event; +} + +/** + * Attaches or replaces the selected high-resolution frame for an event. + * + * @param {object} event Evidence event. + * @param {{mediaTime: number, dataUrl: string, width: number, height: number, sharpness: number, reason: string}} frame Frame payload. + * @returns {boolean} Whether the frame replaced the prior selection. + */ +export function selectEventFrame(event, frame) { + if (event.selectedFrame && event.selectedFrame.sharpness > frame.sharpness) return false; + event.selectedFrame = { ...frame }; + return true; +} + +/** + * Applies one reversible editorial command. + * + * @param {object} session Analysis session. + * @param {object} command Editorial command. + * @param {'promote'|'reject'|'caption'|'move-earlier'|'move-later'} command.type Command type. + * @param {string} command.eventId Event identifier. The baseline is pinned and cannot receive editorial commands. + * @param {string} [command.value] Caption value. + * @returns {boolean} Whether the command changed an event. + */ +export function applyEditorialCommand(session, command) { + const event = session.events.find((candidate) => candidate.id === command.eventId); + const isMovement = command.type === 'move-earlier' || command.type === 'move-later'; + if (!event) return false; + const before = { + event: event ? { + status: event.status, + promoted: event.promoted, + caption: event.caption, + } : null, + storyOrder: [...session.editorial.storyOrder], + }; + if (command.type === 'promote') event.promoted = true; + if (command.type === 'reject') { + event.status = 'rejected'; + session.editorial.storyOrder = session.editorial.storyOrder.filter((id) => id !== event.id); + } + if (command.type === 'caption') event.caption = command.value || ''; + if (isMovement) { + const index = session.editorial.storyOrder.indexOf(command.eventId); + const offset = command.type === 'move-earlier' ? -1 : 1; + const target = index + offset; + if (index < 0 || target < 0 || target >= session.editorial.storyOrder.length) return false; + if (session.editorial.storyOrder[target] === 'baseline') return false; + [session.editorial.storyOrder[index], session.editorial.storyOrder[target]] = [ + session.editorial.storyOrder[target], + session.editorial.storyOrder[index], + ]; + } + const after = { + event: event ? { + status: event.status, + promoted: event.promoted, + caption: event.caption, + } : null, + storyOrder: [...session.editorial.storyOrder], + }; + session.editorial.undo.push({ command: structuredClone(command), before, after }); + session.editorial.redo = []; + appendJournal(session, 'editorial-command', { command, before, after }); + return true; +} + +/** + * Restores the state before the latest editorial command. + * + * @param {object} session Analysis session. + * @returns {boolean} Whether a command was undone. + */ +export function undoEditorialCommand(session) { + const change = session.editorial.undo.pop(); + if (!change) return false; + const event = session.events.find((candidate) => candidate.id === change.command.eventId); + if (change.before.event && !event) return false; + if (event && change.before.event) Object.assign(event, change.before.event); + session.editorial.storyOrder = [...change.before.storyOrder]; + session.editorial.redo.push(change); + appendJournal(session, 'editorial-undo', { command: change.command }); + return true; +} + +/** + * Reapplies the latest undone editorial command. + * + * @param {object} session Analysis session. + * @returns {boolean} Whether a command was redone. + */ +export function redoEditorialCommand(session) { + const change = session.editorial.redo.pop(); + if (!change) return false; + const event = session.events.find((candidate) => candidate.id === change.command.eventId); + if (change.after.event && !event) return false; + if (event && change.after.event) Object.assign(event, change.after.event); + session.editorial.storyOrder = [...change.after.storyOrder]; + session.editorial.undo.push(change); + appendJournal(session, 'editorial-redo', { command: change.command }); + return true; +} + +/** + * Produces the user-facing report without technical journal internals or image + * byte duplication. Selected frame data URLs remain available to the caller as + * separate frame artifacts. + * + * @param {object} session Analysis session. + * @returns {object} Serializable report model. + */ +export function buildReport(session) { + const storyIndex = new Map(session.editorial.storyOrder.map((id, index) => [id, index])); + const events = session.events + .filter((event) => event.status === 'confirmed' && event.status !== 'rejected') + .map((event) => ({ + id: event.id, + startMediaTime: event.startMediaTime, + endMediaTime: event.endMediaTime, + anchorMediaTime: event.anchorMediaTime, + classification: event.classification, + origin: event.origin || 'automatic', + interpretation: event.interpretation || null, + reviewRequired: event.reviewRequired, + promoted: event.promoted, + caption: event.caption, + recommendedClip: event.recommendedClip, + selectedFrame: event.selectedFrame ? { + mediaTime: event.selectedFrame.mediaTime, + width: event.selectedFrame.width, + height: event.selectedFrame.height, + sharpness: event.selectedFrame.sharpness, + reason: event.selectedFrame.reason, + } : null, + evidence: event.observations.map((observation) => ({ + mediaTime: observation.mediaTime, + outcome: observation.outcome, + faceDistance: observation.faceDistance, + visualDrift: observation.visualDrift, + reasons: observation.reasons, + })), + })) + .sort((left, right) => ( + (storyIndex.get(left.id) ?? Number.POSITIVE_INFINITY) + - (storyIndex.get(right.id) ?? Number.POSITIVE_INFINITY) + )); + const includedIds = new Set(events.map((event) => event.id)); + const storyOrder = session.editorial.storyOrder.filter((id) => id === 'baseline' || includedIds.has(id)); + + return { + schemaVersion: session.schemaVersion, + sessionId: session.sessionId, + createdAt: session.createdAt, + updatedAt: session.updatedAt, + source: structuredClone(session.source), + config: structuredClone(session.config), + models: structuredClone(session.models), + storyOrder, + baseline: session.baseline ? { + mediaTime: session.baseline.mediaTime, + selectionMode: session.baseline.selectionMode, + selectedMediaTime: session.baseline.selectedMediaTime, + faceSpread: session.baseline.faceSpread, + embeddingMedianDrift: session.baseline.embeddingMedianDrift, + embeddingMad: session.baseline.embeddingMad, + visualTriggerThreshold: session.baseline.visualTriggerThreshold, + frame: session.baseline.frame ? { + mediaTime: session.baseline.frame.mediaTime, + width: session.baseline.frame.width, + height: session.baseline.frame.height, + } : null, + } : null, + summary: structuredClone(session.summary), + events, + }; +} + +/** + * Serialises the technical log as newline-delimited JSON. The first record is + * a self-contained header; later records can be streamed or processed without + * loading report images into memory. + * + * @param {object} session Analysis session. + * @returns {string} NDJSON document ending with a newline. + */ +export function serializeTechnicalLog(session) { + const header = { + type: 'analysis-header', + schemaVersion: session.schemaVersion, + sessionId: session.sessionId, + createdAt: session.createdAt, + source: session.source, + config: session.config, + models: session.models, + baseline: session.baseline ? { + mediaTime: session.baseline.mediaTime, + selectionMode: session.baseline.selectionMode, + selectedMediaTime: session.baseline.selectedMediaTime, + faceSpread: session.baseline.faceSpread, + embeddingMedianDrift: session.baseline.embeddingMedianDrift, + embeddingMad: session.baseline.embeddingMad, + visualTriggerThreshold: session.baseline.visualTriggerThreshold, + } : null, + }; + const samples = session.samples.map((sample) => ({ type: 'sample', ...sample })); + const events = session.events.map((event) => ({ + type: 'evidence-event', + id: event.id, + startMediaTime: event.startMediaTime, + endMediaTime: event.endMediaTime, + anchorMediaTime: event.anchorMediaTime, + status: event.status, + classification: event.classification, + origin: event.origin || 'automatic', + interpretation: event.interpretation || null, + reviewRequired: event.reviewRequired, + promoted: event.promoted, + caption: event.caption, + recommendedClip: event.recommendedClip, + selectedFrame: event.selectedFrame ? { + mediaTime: event.selectedFrame.mediaTime, + width: event.selectedFrame.width, + height: event.selectedFrame.height, + sharpness: event.selectedFrame.sharpness, + reason: event.selectedFrame.reason, + } : null, + observations: event.observations, + })); + const footer = { + type: 'analysis-footer', + status: session.status, + updatedAt: session.updatedAt, + summary: session.summary, + storyOrder: session.editorial.storyOrder, + }; + return [header, ...samples, ...session.journal, ...events, footer] + .map((entry) => JSON.stringify(entry)) + .join('\n') + '\n'; +} diff --git a/loader.html b/loader.html index a54f171..f05f9b6 100644 --- a/loader.html +++ b/loader.html @@ -4,53 +4,17 @@ - Makeup Video Loader & Face Engine Debugger — Ghostmaxxing - - - + Video Loader — Ghostmaxxing + + + - - - - - - - - - - - @@ -64,89 +28,146 @@ Ghostmaxxing - Internal video loader + Seekable video analysis
- + +
- loading models + loading models
-

Makeup Video Test Loader

+
+
+

Existing video → evidence

+

Makeup video analyser

+
+

+ Select a local video. It stays on this device while MediaPipe maps frequent visual changes and face-api verifies selected moments. +

+
-
-
-
Select a local MP4 video to begin.
+
+
+
Select a local MP4, WebM, or compatible video to begin.
- diagnostic preview - - - +
-
- -
+ +
+
+ Source + +
+ No video selected + Local files remain on this device. +
+
+
+ Viewing 00:00.000 00:00.000
+
-
-
- - -
- Faces in memory - 0 - Next ID - 0 - 2D threshold - 0.58 - +
+
+ Analysis plan +
+ +
+ + No base selected. Scrub the video, then select the displayed frame. +
+
+
+
+ Run +
+ + +
+
+ Analysis samples + + 0 / — +
+
+
-
-
-

Activity log

-

Each entry is captured at the exact video timestamp where the button was pressed.

+
+
+
+

Analysis report

+

Evidence and story order

+

No video analysed yet.

+
+
+
+ History + + +
+
+ Export + + +
+
+
+ +
+ Distance reference + Distance reference not acquired yet.
-
- + +

+ The baseline stays first because every distance starts there. Source timestamps remain factual; use “Move earlier” and “Move later” to arrange the later evidence independently of source chronology. +

+ +
+ +
+ MediaPipe coverage is diagnostic context, not evidence by itself. ImageEmbedder drift is frequent generic-image change measured as 1 − cosine similarity. face-api L2 distance is sampled only on comparable frames; × means no 2D face was returned. Each dashed line prints the active numeric trigger or decision threshold beside it. +
+
+ +
+ Confirmed transitions will appear here with a high-resolution source frame and editable story text. +
+
-

- Test the synthetic before-and-after faces in tests/fixtures/ - with the Playwright script. -

+ - - - - - - - - - - - - - diff --git a/package.json b/package.json index 6a7bd46..548aa8a 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,16 @@ "test:unit:watch": "vitest", "test:coverage": "vitest run --coverage", "test:e2e": "playwright test", + "test:e2e:realtime": "playwright test tests/e2e/realtime.spec.js", "test:e2e:ui": "playwright test --ui", "docs": "jsdoc -c jsdoc.clean.json && node scripts-dev/enrich-jsdoc-seo.cjs", "docs:functional": "node scripts-dev/build-functional-docs.cjs", "docs:clean": "node -e \"require('node:fs').rmSync('docs/jsdoc', { recursive: true, force: true })\"", "docs:rebuild": "npm run docs:clean && npm run docs", "htmls": "npm run docs:functional && npm run docs:rebuild && npm run test:coverage && npm run update:coverage-badge && npm run update:projects && npm run update:references && npm run update:genealogy && npm run codemap", - "htmls:install": "npm run docs:functional && npm run docs:rebuild && npm run test:coverage && npm run update:coverage-badge && npm run update:projects && npm run update:references && npm run update:genealogy && npm run codemap && npm run check:seo && npm run web-client-setup", + "htmls:install": "npm run docs:functional && npm run docs:rebuild && npm run test:coverage && npm run update:coverage-badge && npm run update:projects && npm run update:references && npm run update:genealogy && npm run codemap && npm run web-client-setup", "docs:screenshots": "node scripts-dev/capture-doc-screenshots.cjs", + "analyze:video": "node scripts-dev/video-loader.cjs analyze", "capture:render": "node scripts-dev/lab-capture.cjs render", "capture:measure": "node scripts-dev/lab-capture.cjs measure", "capture:shots": "node scripts-dev/lab-capture.cjs shots", @@ -52,7 +54,6 @@ "update:projects": "node projects/build-projects-page.js", "update:references": "node references/build-references-page.js", "update:genealogy": "python3 scripts-dev/build-genealogy.py", - "check:seo": "node scripts-dev/check-seo.cjs", "i18n:extract": "node scripts-dev/extract-i18n-pot.cjs", "build:client-interface": "node scripts-dev/install-client-interface.cjs", "web-client-setup": "npm run build:client-interface", diff --git a/realtime.html b/realtime.html new file mode 100644 index 0000000..6e3d021 --- /dev/null +++ b/realtime.html @@ -0,0 +1,234 @@ + + + + + + + Ghostmaxxing | Latent Space Visualizer for Face Descriptor Drift + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ VALID DISTANCE + +
+

0.000

+
+ +
+
+
+ +
+
+ +
+ + +
+
+ + Noise floor — +
+
+ + + +
+
+ + Match threshold 0.60 + +
+ +
+
+ +
+ + +
+
+ + Loading models… +
+ +
+
+ + + 0/5 +
+

Capture a reference of your bare face before you start.

+ + +
+ + + + + +
+
+
+ Source +
+ Using camera +
+ + +
+ + + + + The file stays on this device. +
+
+
+ +
+ Equalizer + +
+ +
+ +
+ + 0 + + +
+
+
+ +
+
+

Descriptor Delta

+

NO BASELINE

+
+
+
+ WAITING FOR VALID FRAME + +
+ live + measured step +
+

16 ranked RMS bands from 128 latent deltas; distribution, not facial regions.

+
+
+
+
+
+
+ +
+ + + + + + diff --git a/references/index.html b/references/index.html index 0993e97..036f4c3 100644 --- a/references/index.html +++ b/references/index.html @@ -1299,6 +1299,7 @@

Jump to

Technical documentation Code Video Loader + Latent Space Visualizer
diff --git a/references/templates/references.template.html b/references/templates/references.template.html index f0c736e..b6a3e8d 100644 --- a/references/templates/references.template.html +++ b/references/templates/references.template.html @@ -235,6 +235,7 @@

Jump to

Technical documentation Code Video Loader + Latent Space Visualizer diff --git a/report.html b/report.html index 137468e..43479fd 100644 --- a/report.html +++ b/report.html @@ -616,6 +616,7 @@

Jump to

Technical documentation Code Video Loader + Latent Space Visualizer diff --git a/scripts-dev/FOLDER-DESCRIPTION.md b/scripts-dev/FOLDER-DESCRIPTION.md index 447be75..47a69b1 100644 --- a/scripts-dev/FOLDER-DESCRIPTION.md +++ b/scripts-dev/FOLDER-DESCRIPTION.md @@ -8,7 +8,7 @@ Related-project generation lives beside its data in `projects/`, mirroring the e ## Script roles -- `build-face-fixtures.cjs` — uses ffmpeg to turn synthetic clean/painted JPEG pairs into large, git-ignored Y4M fake-camera clips under `tests/fixtures/synthetic-faces/y4m/`. +- `video-loader.cjs` — drives the seekable local-video analyser through Playwright, writes report HTML/JSON, selected JPEG evidence, and a separate versioned NDJSON technical log. Its `extract-clips` command can later reprocess that log with the original source and ffmpeg. It does not create fake-camera or Y4M inputs. - `lab-capture.cjs` — drives the Lab in a headless browser with a picture or video in place of the webcam (converted to Y4M with ffmpeg). `render` draws the Lab's layers and a Ghostyle on one picture, `measure` reports the recognition distance between a baseline and a dazzled picture, `shots` captures the workshop screenshots; `--debug` dumps page state. Results do not establish protection against external systems. diff --git a/scripts-dev/README.md b/scripts-dev/README.md index 85decef..6c7c41f 100644 --- a/scripts-dev/README.md +++ b/scripts-dev/README.md @@ -22,6 +22,7 @@ Run the commands below from the `ghostmaxxing` repository root. Most scripts res | Draw the lab's layers on a picture | `node scripts-dev/lab-capture.cjs render --baseline --layers landmarks --output ` | One picture with the lab's overlays (needs `ffmpeg`) | | Measure the distance between two pictures | `node scripts-dev/lab-capture.cjs measure --baseline --dazzled ` | Readings and verdict on stdout; `--output-visual-log ` for a composite picture | | Capture the workshop screenshots | `node scripts-dev/lab-capture.cjs shots --baseline --dazzled ` | Three JPEGs in `images/workshops/` | +| Analyse a seekable makeup video | `npm run analyze:video --