PageSourceSearch

https://nexusflow-nexus-function-calling-leaderboard.hf.space/assets/Example-25a38da7.js

js nexusflow-nexus-function-calling-leaderboard.hf.space collected 2026-10-03 10:24:32 UTC 44,353 bytes, 1,546 lines download raw bytes

1import { r as resolve_wasm_src } from './file-url-1a9970c0.js';
2
3const ERROR_RESPONSE_BODY_READER = new Error("failed to get response body reader");
4const ERROR_INCOMPLETED_DOWNLOAD = new Error("failed to complete download");
5
6const HeaderContentLength = "Content-Length";
7
8/**
9 * Download content of a URL with progress.
10 *
11 * Progress only works when Content-Length is provided by the server.
12 *
13 */
14const downloadWithProgress = async (url, cb) => {
15    const resp = await fetch(url);
16    let buf;
17    try {
18        // Set total to -1 to indicate that there is not Content-Type Header.
19        const total = parseInt(resp.headers.get(HeaderContentLength) || "-1");
20        const reader = resp.body?.getReader();
21        if (!reader)
22            throw ERROR_RESPONSE_BODY_READER;
23        const chunks = [];
24        let received = 0;
25        for (;;) {
26            const { done, value } = await reader.read();
27            const delta = value ? value.length : 0;
28            if (done) {
29                if (total != -1 && total !== received)
30                    throw ERROR_INCOMPLETED_DOWNLOAD;
31                cb && cb({ url, total, received, delta, done });
32                break;
33            }
34            chunks.push(value);
35            received += delta;
36            cb && cb({ url, total, received, delta, done });
37        }
38        const data = new Uint8Array(received);
39        let position = 0;
40        for (const chunk of chunks) {
41            data.set(chunk, position);
42            position += chunk.length;
43        }
44        buf = data.buffer;
45    }
46    catch (e) {
47        console.log(`failed to send download progress event: `, e);
48        // Fetch arrayBuffer directly when it is not possible to get progress.
49        buf = await resp.arrayBuffer();
50        cb &&
51            cb({
52                url,
53                total: buf.byteLength,
54                received: buf.byteLength,
55                delta: 0,
56                done: true,
57            });
58    }
59    return buf;
60};
61/**
62 * toBlobURL fetches data from an URL and return a blob URL.
63 *
64 * Example:
65 *
66 * ```ts
67 * await toBlobURL("http://localhost:3000/ffmpeg.js", "text/javascript");
68 * ```
69 */
70const toBlobURL = async (url, mimeType, progress = false, cb) => {
71    const buf = progress
72        ? await downloadWithProgress(url, cb)
73        : await (await fetch(url)).arrayBuffer();
74    const blob = new Blob([buf], { type: mimeType });
75    return URL.createObjectURL(blob);
76};
77
78var FFMessageType;
79(function (FFMessageType) {
80    FFMessageType["LOAD"] = "LOAD";
81    FFMessageType["EXEC"] = "EXEC";
82    FFMessageType["WRITE_FILE"] = "WRITE_FILE";
83    FFMessageType["READ_FILE"] = "READ_FILE";
84    FFMessageType["DELETE_FILE"] = "DELETE_FILE";
85    FFMessageType["RENAME"] = "RENAME";
86    FFMessageType["CREATE_DIR"] = "CREATE_DIR";
87    FFMessageType["LIST_DIR"] = "LIST_DIR";
88    FFMessageType["DELETE_DIR"] = "DELETE_DIR";
89    FFMessageType["ERROR"] = "ERROR";
90    FFMessageType["DOWNLOAD"] = "DOWNLOAD";
91    FFMessageType["PROGRESS"] = "PROGRESS";
92    FFMessageType["LOG"] = "LOG";
93    FFMessageType["MOUNT"] = "MOUNT";
94    FFMessageType["UNMOUNT"] = "UNMOUNT";
95})(FFMessageType || (FFMessageType = {}));
96
97/**
98 * Generate an unique message ID.
99 */
100const getMessageID = (() => {
101    let messageID = 0;
102    return () => messageID++;
103})();
104
105const ERROR_NOT_LOADED = new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first");
106const ERROR_TERMINATED = new Error("called FFmpeg.terminate()");
107
108/**
109 * Provides APIs to interact with ffmpeg web worker.
110 *
111 * @example
112 * ```ts
113 * const ffmpeg = new FFmpeg();
114 * ```
115 */
116class FFmpeg {
117    #worker = null;
118    /**
119     * #resolves and #rejects tracks Promise resolves and rejects to
120     * be called when we receive message from web worker.
121     */
122    #resolves = {};
123    #rejects = {};
124    #logEventCallbacks = [];
125    #progressEventCallbacks = [];
126    loaded = false;
127    /**
128     * register worker message event handlers.
129     */
130    #registerHandlers = () => {
131        if (this.#worker) {
132            this.#worker.onmessage = ({ data: { id, type, data }, }) => {
133                switch (type) {
134                    case FFMessageType.LOAD:
135                        this.loaded = true;
136                        this.#resolves[id](data);
137                        break;
138                    case FFMessageType.MOUNT:
139                    case FFMessageType.UNMOUNT:
140                    case FFMessageType.EXEC:
141                    case FFMessageType.WRITE_FILE:
142                    case FFMessageType.READ_FILE:
143                    case FFMessageType.DELETE_FILE:
144                    case FFMessageType.RENAME:
145                    case FFMessageType.CREATE_DIR:
146                    case FFMessageType.LIST_DIR:
147                    case FFMessageType.DELETE_DIR:
148                        this.#resolves[id](data);
149                        break;
150                    case FFMessageType.LOG:
151                        this.#logEventCallbacks.forEach((f) => f(data));
152                        break;
153                    case FFMessageType.PROGRESS:
154                        this.#progressEventCallbacks.forEach((f) => f(data));
155                        break;
vendor: 8,902 bytes, lines 156-442
156                    case FFMessageType.ERROR:
157                        this.#rejects[id](data);
158                        break;
159                }
160                delete this.#resolves[id];
161                delete this.#rejects[id];
162            };
163        }
164    };
165    /**
166     * Generic function to send messages to web worker.
167     */
168    #send = ({ type, data }, trans = [], signal) => {
169        if (!this.#worker) {
170            return Promise.reject(ERROR_NOT_LOADED);
171        }
172        return new Promise((resolve, reject) => {
173            const id = getMessageID();
174            this.#worker && this.#worker.postMessage({ id, type, data }, trans);
175            this.#resolves[id] = resolve;
176            this.#rejects[id] = reject;
177            signal?.addEventListener("abort", () => {
178                reject(new DOMException(`Message # ${id} was aborted`, "AbortError"));
179            }, { once: true });
180        });
181    };
182    on(event, callback) {
183        if (event === "log") {
184            this.#logEventCallbacks.push(callback);
185        }
186        else if (event === "progress") {
187            this.#progressEventCallbacks.push(callback);
188        }
189    }
190    off(event, callback) {
191        if (event === "log") {
192            this.#logEventCallbacks = this.#logEventCallbacks.filter((f) => f !== callback);
193        }
194        else if (event === "progress") {
195            this.#progressEventCallbacks = this.#progressEventCallbacks.filter((f) => f !== callback);
196        }
197    }
198    /**
199     * Loads ffmpeg-core inside web worker. It is required to call this method first
200     * as it initializes WebAssembly and other essential variables.
201     *
202     * @category FFmpeg
203     * @returns `true` if ffmpeg core is loaded for the first time.
204     */
205    load = (config = {}, { signal } = {}) => {
206        if (!this.#worker) {
207            this.#worker = new Worker(new URL(""+new URL('worker-6d6dd1a7.js', import.meta.url).href+"", self.location), {
208                type: "module",
209            });
210            this.#registerHandlers();
211        }
212        return this.#send({
213            type: FFMessageType.LOAD,
214            data: config,
215        }, undefined, signal);
216    };
217    /**
218     * Execute ffmpeg command.
219     *
220     * @remarks
221     * To avoid common I/O issues, ["-nostdin", "-y"] are prepended to the args
222     * by default.
223     *
224     * @example
225     * ```ts
226     * const ffmpeg = new FFmpeg();
227     * await ffmpeg.load();
228     * await ffmpeg.writeFile("video.avi", ...);
229     * // ffmpeg -i video.avi video.mp4
230     * await ffmpeg.exec(["-i", "video.avi", "video.mp4"]);
231     * const data = ffmpeg.readFile("video.mp4");
232     * ```
233     *
234     * @returns `0` if no error, `!= 0` if timeout (1) or error.
235     * @category FFmpeg
236     */
237    exec = (
238    /** ffmpeg command line args */
239    args, 
240    /**
241     * milliseconds to wait before stopping the command execution.
242     *
243     * @defaultValue -1
244     */
245    timeout = -1, { signal } = {}) => this.#send({
246        type: FFMessageType.EXEC,
247        data: { args, timeout },
248    }, undefined, signal);
249    /**
250     * Terminate all ongoing API calls and terminate web worker.
251     * `FFmpeg.load()` must be called again before calling any other APIs.
252     *
253     * @category FFmpeg
254     */
255    terminate = () => {
256        const ids = Object.keys(this.#rejects);
257        // rejects all incomplete Promises.
258        for (const id of ids) {
259            this.#rejects[id](ERROR_TERMINATED);
260            delete this.#rejects[id];
261            delete this.#resolves[id];
262        }
263        if (this.#worker) {
264            this.#worker.terminate();
265            this.#worker = null;
266            this.loaded = false;
267        }
268    };
269    /**
270     * Write data to ffmpeg.wasm.
271     *
272     * @example
273     * ```ts
274     * const ffmpeg = new FFmpeg();
275     * await ffmpeg.load();
276     * await ffmpeg.writeFile("video.avi", await fetchFile("../video.avi"));
277     * await ffmpeg.writeFile("text.txt", "hello world");
278     * ```
279     *
280     * @category File System
281     */
282    writeFile = (path, data, { signal } = {}) => {
283        const trans = [];
284        if (data instanceof Uint8Array) {
285            trans.push(data.buffer);
286        }
287        return this.#send({
288            type: FFMessageType.WRITE_FILE,
289            data: { path, data },
290        }, trans, signal);
291    };
292    mount = (fsType, options, mountPoint) => {
293        const trans = [];
294        return this.#send({
295            type: FFMessageType.MOUNT,
296            data: { fsType, options, mountPoint },
297        }, trans);
298    };
299    unmount = (mountPoint) => {
300        const trans = [];
301        return this.#send({
302            type: FFMessageType.UNMOUNT,
303            data: { mountPoint },
304        }, trans);
305    };
306    /**
307     * Read data from ffmpeg.wasm.
308     *
309     * @example
310     * ```ts
311     * const ffmpeg = new FFmpeg();
312     * await ffmpeg.load();
313     * const data = await ffmpeg.readFile("video.mp4");
314     * ```
315     *
316     * @category File System
317     */
318    readFile = (path, 
319    /**
320     * File content encoding, supports two encodings:
321     * - utf8: read file as text file, return data in string type.
322     * - binary: read file as binary file, return data in Uint8Array type.
323     *
324     * @defaultValue binary
325     */
326    encoding = "binary", { signal } = {}) => this.#send({
327        type: FFMessageType.READ_FILE,
328        data: { path, encoding },
329    }, undefined, signal);
330    /**
331     * Delete a file.
332     *
333     * @category File System
334     */
335    deleteFile = (path, { signal } = {}) => this.#send({
336        type: FFMessageType.DELETE_FILE,
337        data: { path },
338    }, undefined, signal);
339    /**
340     * Rename a file or directory.
341     *
342     * @category File System
343     */
344    rename = (oldPath, newPath, { signal } = {}) => this.#send({
345        type: FFMessageType.RENAME,
346        data: { oldPath, newPath },
347    }, undefined, signal);
348    /**
349     * Create a directory.
350     *
351     * @category File System
352     */
353    createDir = (path, { signal } = {}) => this.#send({
354        type: FFMessageType.CREATE_DIR,
355        data: { path },
356    }, undefined, signal);
357    /**
358     * List directory contents.
359     *
360     * @category File System
361     */
362    listDir = (path, { signal } = {}) => this.#send({
363        type: FFMessageType.LIST_DIR,
364        data: { path },
365    }, undefined, signal);
366    /**
367     * Delete an empty directory.
368     *
369     * @category File System
370     */
371    deleteDir = (path, { signal } = {}) => this.#send({
372        type: FFMessageType.DELETE_DIR,
373        data: { path },
374    }, undefined, signal);
375}
376
377const mimes = {
378  "ez": "application/andrew-inset",
379  "aw": "application/applixware",
380  "atom": "application/atom+xml",
381  "atomcat": "application/atomcat+xml",
382  "atomdeleted": "application/atomdeleted+xml",
383  "atomsvc": "application/atomsvc+xml",
384  "dwd": "application/atsc-dwd+xml",
385  "held": "application/atsc-held+xml",
386  "rsat": "application/atsc-rsat+xml",
387  "bdoc": "application/bdoc",
388  "xcs": "application/calendar+xml",
389  "ccxml": "application/ccxml+xml",
390  "cdfx": "application/cdfx+xml",
391  "cdmia": "application/cdmi-capability",
392  "cdmic": "application/cdmi-container",
393  "cdmid": "application/cdmi-domain",
394  "cdmio": "application/cdmi-object",
395  "cdmiq": "application/cdmi-queue",
396  "cu": "application/cu-seeme",
397  "mpd": "application/dash+xml",
398  "davmount": "application/davmount+xml",
399  "dbk": "application/docbook+xml",
400  "dssc": "application/dssc+der",
401  "xdssc": "application/dssc+xml",
402  "es": "application/ecmascript",
403  "ecma": "application/ecmascript",
404  "emma": "application/emma+xml",
405  "emotionml": "application/emotionml+xml",
406  "epub": "application/epub+zip",
407  "exi": "application/exi",
408  "fdt": "application/fdt+xml",
409  "pfr": "application/font-tdpfr",
410  "geojson": "application/geo+json",
411  "gml": "application/gml+xml",
412  "gpx": "application/gpx+xml",
413  "gxf": "application/gxf",
414  "gz": "application/gzip",
415  "hjson": "application/hjson",
416  "stk": "application/hyperstudio",
417  "ink": "application/inkml+xml",
418  "inkml": "application/inkml+xml",
419  "ipfix": "application/ipfix",
420  "its": "application/its+xml",
421  "jar": "application/java-archive",
422  "war": "application/java-archive",
423  "ear": "application/java-archive",
424  "ser": "application/java-serialized-object",
425  "class": "application/java-vm",
426  "js": "application/javascript",
427  "mjs": "application/javascript",
428  "json": "application/json",
429  "map": "application/json",
430  "json5": "application/json5",
431  "jsonml": "application/jsonml+json",
432  "jsonld": "application/ld+json",
433  "lgr": "application/lgr+xml",
434  "lostxml": "application/lost+xml",
435  "hqx": "application/mac-binhex40",
436  "cpt": "application/mac-compactpro",
437  "mads": "application/mads+xml",
438  "webmanifest": "application/manifest+json",
439  "mrc": "application/marc",
440  "mrcx": "application/marcxml+xml",
441  "ma": "application/mathematica",
442  "nb": "application/mathematica",
443  "mb": "application/mathematica",
444  "mathml": "application/mathml+xml",
445  "mbox": "application/mbox",
446  "mscml": "application/mediaservercontrol+xml",
447  "metalink": "application/metalink+xml",
448  "meta4": "application/metalink4+xml",
449  "mets": "application/mets+xml",
450  "maei": "application/mmt-aei+xml",
451  "musd": "application/mmt-usd+xml",
452  "mods": "application/mods+xml",
453  "m21": "application/mp21",
454  "mp21": "application/mp21",
455  "mp4s": "application/mp4",
456  "m4p": "application/mp4",
457  "doc": "application/msword",
458  "dot": "application/msword",
459  "mxf": "application/mxf",
460  "nq": "application/n-quads",
461  "nt": "application/n-triples",
462  "cjs": "application/node",
463  "bin": "application/octet-stream",
464  "dms": "application/octet-stream",
465  "lrf": "application/octet-stream",
466  "mar": "application/octet-stream",
467  "so": "application/octet-stream",
468  "dist": "application/octet-stream",
469  "distz": "application/octet-stream",
470  "pkg": "application/octet-stream",
471  "bpk": "application/octet-stream",
472  "dump": "application/octet-stream",
473  "elc": "application/octet-stream",
474  "deploy": "application/octet-stream",
475  "exe": "application/octet-stream",
476  "dll": "application/octet-stream",
477  "deb": "application/octet-stream",
478  "dmg": "application/octet-stream",
479  "iso": "application/octet-stream",
480  "img": "application/octet-stream",
481  "msi": "application/octet-stream",
482  "msp": "application/octet-stream",
483  "msm": "application/octet-stream",
484  "buffer": "application/octet-stream",
485  "oda": "application/oda",
486  "opf": "application/oebps-package+xml",
487  "ogx": "application/ogg",
488  "omdoc": "application/omdoc+xml",
489  "onetoc": "application/onenote",
490  "onetoc2": "application/onenote",
491  "onetmp": "application/onenote",
492  "onepkg": "application/onenote",
493  "oxps": "application/oxps",
494  "relo": "application/p2p-overlay+xml",
495  "xer": "application/patch-ops-error+xml",
496  "pdf": "application/pdf",
497  "pgp": "application/pgp-encrypted",
498  "asc": "application/pgp-signature",
499  "sig": "application/pgp-signature",
500  "prf": "application/pics-rules",
501  "p10": "application/pkcs10",
502  "p7m": "application/pkcs7-mime",
503  "p7c": "application/pkcs7-mime",
504  "p7s": "application/pkcs7-signature",
505  "p8": "application/pkcs8",
506  "ac": "application/pkix-attr-cert",
507  "cer": "application/pkix-cert",
508  "crl": "application/pkix-crl",
509  "pkipath": "application/pkix-pkipath",
510  "pki": "application/pkixcmp",
511  "pls": "application/pls+xml",
512  "ai": "application/postscript",
513  "eps": "application/postscript",
514  "ps": "application/postscript",
515  "provx": "application/provenance+xml",
516  "cww": "application/prs.cww",
517  "pskcxml": "application/pskc+xml",
518  "raml": "application/raml+yaml",
519  "rdf": "application/rdf+xml",
520  "owl": "application/rdf+xml",
521  "rif": "application/reginfo+xml",
522  "rnc": "application/relax-ng-compact-syntax",
523  "rl": "application/resource-lists+xml",
524  "rld": "application/resource-lists-diff+xml",
525  "rs": "application/rls-services+xml",
526  "rapd": "application/route-apd+xml",
527  "sls": "application/route-s-tsid+xml",
528  "rusd": "application/route-usd+xml",
529  "gbr": "application/rpki-ghostbusters",
530  "mft": "application/rpki-manifest",
531  "roa": "application/rpki-roa",
532  "rsd": "application/rsd+xml",
533  "rss": "application/rss+xml",
534  "rtf": "application/rtf",
535  "sbml": "application/sbml+xml",
536  "scq": "application/scvp-cv-request",
537  "scs": "application/scvp-cv-response",
538  "spq": "application/scvp-vp-request",
539  "spp": "application/scvp-vp-response",
540  "sdp": "application/sdp",
541  "senmlx": "application/senml+xml",
542  "sensmlx": "application/sensml+xml",
543  "setpay": "application/set-payment-initiation",
544  "setreg": "application/set-registration-initiation",
545  "shf": "application/shf+xml",
546  "siv": "application/sieve",
547  "sieve": "application/sieve",
548  "smi": "application/smil+xml",
549  "smil": "application/smil+xml",
550  "rq": "application/sparql-query",
551  "srx": "application/sparql-results+xml",
552  "gram": "application/srgs",
553  "grxml": "application/srgs+xml",
554  "sru": "application/sru+xml",
555  "ssdl": "application/ssdl+xml",
556  "ssml": "application/ssml+xml",
557  "swidtag": "application/swid+xml",
558  "tei": "application/tei+xml",
559  "teicorpus": "application/tei+xml",
560  "tfi": "application/thraud+xml",
561  "tsd": "application/timestamped-data",
562  "toml": "application/toml",
563  "trig": "application/trig",
564  "ttml": "application/ttml+xml",
565  "ubj": "application/ubjson",
566  "rsheet": "application/urc-ressheet+xml",
567  "td": "application/urc-targetdesc+xml",
568  "vxml": "application/voicexml+xml",
569  "wasm": "application/wasm",
570  "wgt": "application/widget",
571  "hlp": "application/winhlp",
572  "wsdl": "application/wsdl+xml",
573  "wspolicy": "application/wspolicy+xml",
574  "xaml": "application/xaml+xml",
575  "xav": "application/xcap-att+xml",
576  "xca": "application/xcap-caps+xml",
577  "xdf": "application/xcap-diff+xml",
578  "xel": "application/xcap-el+xml",
579  "xns": "application/xcap-ns+xml",
580  "xenc": "application/xenc+xml",
581  "xhtml": "application/xhtml+xml",
582  "xht": "application/xhtml+xml",
583  "xlf": "application/xliff+xml",
584  "xml": "application/xml",
585  "xsl": "application/xml",
586  "xsd": "application/xml",
587  "rng": "application/xml",
588  "dtd": "application/xml-dtd",
589  "xop": "application/xop+xml",
590  "xpl": "application/xproc+xml",
591  "xslt": "application/xml",
592  "xspf": "application/xspf+xml",
593  "mxml": "application/xv+xml",
594  "xhvml": "application/xv+xml",
595  "xvml": "application/xv+xml",
596  "xvm": "application/xv+xml",
597  "yang": "application/yang",
598  "yin": "application/yin+xml",
599  "zip": "application/zip",
600  "3gpp": "video/3gpp",
601  "adp": "audio/adpcm",
602  "amr": "audio/amr",
603  "au": "audio/basic",
604  "snd": "audio/basic",
605  "mid": "audio/midi",
606  "midi": "audio/midi",
607  "kar": "audio/midi",
608  "rmi": "audio/midi",
609  "mxmf": "audio/mobile-xmf",
610  "mp3": "audio/mpeg",
611  "m4a": "audio/mp4",
612  "mp4a": "audio/mp4",
613  "mpga": "audio/mpeg",
614  "mp2": "audio/mpeg",
615  "mp2a": "audio/mpeg",
616  "m2a": "audio/mpeg",
617  "m3a": "audio/mpeg",
618  "oga": "audio/ogg",
619  "ogg": "audio/ogg",
620  "spx": "audio/ogg",
621  "opus": "audio/ogg",
622  "s3m": "audio/s3m",
623  "sil": "audio/silk",
624  "wav": "audio/wav",
625  "weba": "audio/webm",
626  "xm": "audio/xm",
627  "ttc": "font/collection",
628  "otf": "font/otf",
629  "ttf": "font/ttf",
630  "woff": "font/woff",
631  "woff2": "font/woff2",
632  "exr": "image/aces",
633  "apng": "image/apng",
634  "avif": "image/avif",
635  "bmp": "image/bmp",
636  "cgm": "image/cgm",
637  "drle": "image/dicom-rle",
638  "emf": "image/emf",
639  "fits": "image/fits",
640  "g3": "image/g3fax",
641  "gif": "image/gif",
642  "heic": "image/heic",
643  "heics": "image/heic-sequence",
644  "heif": "image/heif",
645  "heifs": "image/heif-sequence",
646  "hej2": "image/hej2k",
647  "hsj2": "image/hsj2",
648  "ief": "image/ief",
649  "jls": "image/jls",
650  "jp2": "image/jp2",
651  "jpg2": "image/jp2",
652  "jpeg": "image/jpeg",
653  "jpg": "image/jpeg",
654  "jpe": "image/jpeg",
655  "jph": "image/jph",
656  "jhc": "image/jphc",
657  "jpm": "image/jpm",
658  "jpx": "image/jpx",
659  "jpf": "image/jpx",
660  "jxr": "image/jxr",
661  "jxra": "image/jxra",
662  "jxrs": "image/jxrs",
663  "jxs": "image/jxs",
664  "jxsc": "image/jxsc",
665  "jxsi": "image/jxsi",
666  "jxss": "image/jxss",
667  "ktx": "image/ktx",
668  "ktx2": "image/ktx2",
669  "png": "image/png",
670  "btif": "image/prs.btif",
671  "pti": "image/prs.pti",
672  "sgi": "image/sgi",
673  "svg": "image/svg+xml",
674  "svgz": "image/svg+xml",
675  "t38": "image/t38",
676  "tif": "image/tiff",
677  "tiff": "image/tiff",
678  "tfx": "image/tiff-fx",
679  "webp": "image/webp",
680  "wmf": "image/wmf",
681  "disposition-notification": "message/disposition-notification",
682  "u8msg": "message/global",
683  "u8dsn": "message/global-delivery-status",
684  "u8mdn": "message/global-disposition-notification",
685  "u8hdr": "message/global-headers",
686  "eml": "message/rfc822",
687  "mime": "message/rfc822",
688  "3mf": "model/3mf",
689  "gltf": "model/gltf+json",
690  "glb": "model/gltf-binary",
691  "igs": "model/iges",
692  "iges": "model/iges",
693  "msh": "model/mesh",
694  "mesh": "model/mesh",
695  "silo": "model/mesh",
696  "mtl": "model/mtl",
697  "obj": "model/obj",
698  "stpz": "model/step+zip",
699  "stpxz": "model/step-xml+zip",
700  "stl": "model/stl",
701  "wrl": "model/vrml",
702  "vrml": "model/vrml",
703  "x3db": "model/x3d+fastinfoset",
704  "x3dbz": "model/x3d+binary",
705  "x3dv": "model/x3d-vrml",
706  "x3dvz": "model/x3d+vrml",
707  "x3d": "model/x3d+xml",
708  "x3dz": "model/x3d+xml",
709  "appcache": "text/cache-manifest",
710  "manifest": "text/cache-manifest",
711  "ics": "text/calendar",
712  "ifb": "text/calendar",
713  "coffee": "text/coffeescript",
714  "litcoffee": "text/coffeescript",
715  "css": "text/css",
716  "csv": "text/csv",
717  "html": "text/html",
718  "htm": "text/html",
719  "shtml": "text/html",
720  "jade": "text/jade",
721  "jsx": "text/jsx",
722  "less": "text/less",
723  "markdown": "text/markdown",
724  "md": "text/markdown",
725  "mml": "text/mathml",
726  "mdx": "text/mdx",
727  "n3": "text/n3",
728  "txt": "text/plain",
729  "text": "text/plain",
730  "conf": "text/plain",
731  "def": "text/plain",
732  "list": "text/plain",
733  "log": "text/plain",
734  "in": "text/plain",
735  "ini": "text/plain",
736  "dsc": "text/prs.lines.tag",
737  "rtx": "text/richtext",
738  "sgml": "text/sgml",
739  "sgm": "text/sgml",
740  "shex": "text/shex",
741  "slim": "text/slim",
742  "slm": "text/slim",
743  "spdx": "text/spdx",
744  "stylus": "text/stylus",
745  "styl": "text/stylus",
746  "tsv": "text/tab-separated-values",
747  "t": "text/troff",
748  "tr": "text/troff",
749  "roff": "text/troff",
750  "man": "text/troff",
751  "me": "text/troff",
752  "ms": "text/troff",
753  "ttl": "text/turtle",
754  "uri": "text/uri-list",
755  "uris": "text/uri-list",
756  "urls": "text/uri-list",
757  "vcard": "text/vcard",
758  "vtt": "text/vtt",
759  "yaml": "text/yaml",
760  "yml": "text/yaml",
761  "3gp": "video/3gpp",
762  "3g2": "video/3gpp2",
763  "h261": "video/h261",
764  "h263": "video/h263",
765  "h264": "video/h264",
766  "m4s": "video/iso.segment",
767  "jpgv": "video/jpeg",
768  "jpgm": "image/jpm",
769  "mj2": "video/mj2",
770  "mjp2": "video/mj2",
771  "ts": "video/mp2t",
772  "mp4": "video/mp4",
773  "mp4v": "video/mp4",
774  "mpg4": "video/mp4",
775  "mpeg": "video/mpeg",
776  "mpg": "video/mpeg",
777  "mpe": "video/mpeg",
778  "m1v": "video/mpeg",
779  "m2v": "video/mpeg",
780  "ogv": "video/ogg",
781  "qt": "video/quicktime",
782  "mov": "video/quicktime",
783  "webm": "video/webm"
784};
785
786function lookup(extn) {
787	let tmp = ('' + extn).trim().toLowerCase();
788	let idx = tmp.lastIndexOf('.');
789	return mimes[!~idx ? tmp : tmp.substring(++idx)];
790}
791
792const prettyBytes = (bytes) => {
793  let units = ["B", "KB", "MB", "GB", "PB"];
794  let i = 0;
795  while (bytes > 1024) {
796    bytes /= 1024;
797    i++;
798  }
799  let unit = units[i];
800  return bytes.toFixed(1) + " " + unit;
801};
802const playable = () => {
803  return true;
804};
805function loaded(node, { autoplay }) {
806  async function handle_playback() {
807    if (!autoplay)
808      return;
809    await node.play();
810  }
811  node.addEventListener("loadeddata", handle_playback);
812  return {
813    destroy() {
814      node.removeEventListener("loadeddata", handle_playback);
815    }
816  };
817}
818async function loadFfmpeg() {
819  const ffmpeg = new FFmpeg();
820  const baseURL = "https://unpkg.com/@ffmpeg/[email protected]/dist/esm";
821  await ffmpeg.load({
822    coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
823    wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm")
824  });
825  return ffmpeg;
826}
827async function trimVideo(ffmpeg, startTime, endTime, videoElement) {
828  try {
829    const videoUrl = videoElement.src;
830    const mimeType = lookup(videoElement.src) || "video/mp4";
831    const blobUrl = await toBlobURL(videoUrl, mimeType);
832    const response = await fetch(blobUrl);
833    const vidBlob = await response.blob();
834    const type = getVideoExtensionFromMimeType(mimeType) || "mp4";
835    const inputName = `input.${type}`;
836    const outputName = `output.${type}`;
837    await ffmpeg.writeFile(
838      inputName,
839      new Uint8Array(await vidBlob.arrayBuffer())
840    );
841    let command = [
842      "-i",
843      inputName,
844      "-ss",
845      startTime.toString(),
846      "-to",
847      endTime.toString(),
848      "-c:a",
849      "copy",
850      outputName
851    ];
852    await ffmpeg.exec(command);
853    const outputData = await ffmpeg.readFile(outputName);
854    const outputBlob = new Blob([outputData], {
855      type: `video/${type}`
856    });
857    return outputBlob;
858  } catch (error) {
859    console.error("Error initializing FFmpeg:", error);
860  }
861}
862const getVideoExtensionFromMimeType = (mimeType) => {
863  const videoMimeToExtensionMap = {
864    "video/mp4": "mp4",
865    "video/webm": "webm",
866    "video/ogg": "ogv",
867    "video/quicktime": "mov",
868    "video/x-msvideo": "avi",
869    "video/x-matroska": "mkv",
870    "video/mpeg": "mpeg",
871    "video/3gpp": "3gp",
872    "video/3gpp2": "3g2",
873    "video/h261": "h261",
874    "video/h263": "h263",
875    "video/h264": "h264",
876    "video/jpeg": "jpgv",
877    "video/jpm": "jpm",
878    "video/mj2": "mj2",
879    "video/mpv": "mpv",
880    "video/vnd.ms-playready.media.pyv": "pyv",
881    "video/vnd.uvvu.mp4": "uvu",
882    "video/vnd.vivo": "viv",
883    "video/x-f4v": "f4v",
884    "video/x-fli": "fli",
885    "video/x-flv": "flv",
886    "video/x-m4v": "m4v",
887    "video/x-ms-asf": "asf",
888    "video/x-ms-wm": "wm",
889    "video/x-ms-wmv": "wmv",
890    "video/x-ms-wmx": "wmx",
891    "video/x-ms-wvx": "wvx",
892    "video/x-sgi-movie": "movie",
893    "video/x-smv": "smv"
894  };
895  return videoMimeToExtensionMap[mimeType] || null;
896};
897
898const Video_svelte_svelte_type_style_lang = '';
899
900/* home/runner/work/gradio/gradio/js/video/shared/Video.svelte generated by Svelte v4.2.2 */
901const {
902	SvelteComponent: SvelteComponent$1,
903	action_destroyer,
904	add_render_callback,
905	append: append$1,
906	assign,
907	attr: attr$1,
908	binding_callbacks: binding_callbacks$1,
909	create_slot,
910	detach: detach$1,
911	element: element$1,
912	empty: empty$1,
913	exclude_internal_props,
914	get_all_dirty_from_scope,
915	get_slot_changes,
916	handle_promise,
917	init,
918	insert: insert$1,
919	is_function: is_function$1,
920	listen,
921	noop: noop$1,
922	raf,
923	run_all,
924	safe_not_equal: safe_not_equal$1,
925	set_data: set_data$1,
926	set_style,
927	space,
928	src_url_equal,
929	text: text$1,
930	toggle_class: toggle_class$1,
931	transition_in: transition_in$1,
932	transition_out: transition_out$1,
933	update_await_block_branch,
934	update_slot_base
935} = window.__gradio__svelte__internal;
936const { createEventDispatcher }
936 = window.__gradio__svelte__internal;
937function create_catch_block(ctx) {
938	let p;
939	let t_value = /*error*/ ctx[20].message + "";
940	let t;
941
942	return {
943		c() {
944			p = element$1("p");
945			t = text$1(t_value);
946			set_style(p, "color", "red");
947		},
948		m(target, anchor) {
949			insert$1(target, p, anchor);
950			append$1(p, t);
951		},
952		p(ctx, dirty) {
953			if (dirty & /*src*/ 16 && t_value !== (t_value = /*error*/ ctx[20].message + "")) set_data$1(t, t_value);
954		},
955		i: noop$1,
956		o: noop$1,
957		d(detaching) {
958			if (detaching) {
959				detach$1(p);
960			}
961		}
962	};
963}
964
965// (18:48)   <!--  The spread operator with `$$props` or `$$restProps` can't be used here  to pass props from the parent component to the <video> element  because of its unexpected behavior: https://github.com/sveltejs/svelte/issues/7404  For example, if we add {...$$props}
966function create_then_block(ctx) {
967	let div;
968	let t;
969	let video;
970	let video_src_value;
971	let video_data_testid_value;
972	let video_updating = false;
973	let video_animationframe;
974	let video_is_paused = true;
975	let loaded_action;
976	let current;
977	let mounted;
978	let dispose;
979	const default_slot_template = /*#slots*/ ctx[14].default;
980	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[13], null);
981
982	function video_timeupdate_handler() {
983		cancelAnimationFrame(video_animationframe);
984
985		if (!video.paused) {
986			video_animationframe = raf(video_timeupdate_handler);
987			video_updating = true;
988		}
989
990		/*video_timeupdate_handler*/ ctx[15].call(video);
991	}
992
993	return {
994		c() {
995			div = element$1("div");
996			div.innerHTML = `<span class="load-wrap svelte-1dr94qp"><span class="loader svelte-1dr94qp"></span></span>`;
997			t = space();
998			video = element$1("video");
999			if (default_slot) default_slot.c();
1000			attr$1(div, "class", "overlay svelte-1dr94qp");
1001			toggle_class$1(div, "hidden", !/*processingVideo*/ ctx[10]);
1002			if (!src_url_equal(video.src, video_src_value = /*resolved_src*/ ctx[19])) attr$1(video, "src", video_src_value);
1003			video.muted = /*muted*/ ctx[5];
1004			video.playsInline = /*playsinline*/ ctx[6];
1005			attr$1(video, "preload", /*preload*/ ctx[7]);
1006			video.autoplay = /*autoplay*/ ctx[8];
1007			video.controls = /*controls*/ ctx[9];
1008			attr$1(video, "data-testid", video_data_testid_value = /*$$props*/ ctx[12]["data-testid"]);
1009			attr$1(video, "crossorigin", "anonymous");
1010			attr$1(video, "class", "svelte-1dr94qp");
1011			if (/*duration*/ ctx[1] === void 0) add_render_callback(() => /*video_durationchange_handler*/ ctx[16].call(video));
1012		},
1013		m(target, anchor) {
1014			insert$1(target, div, anchor);
1015			insert$1(target, t, anchor);
1016			insert$1(target, video, anchor);
1017
1018			if (default_slot) {
1019				default_slot.m(video, null);
1020			}
1021
1022			/*video_binding*/ ctx[18](video);
1023			current = true;
1024
1025			if (!mounted) {
1026				dispose = [
1027					listen(video, "loadeddata", /*dispatch*/ ctx[11].bind(null, "loadeddata")),
1028					listen(video, "click", /*dispatch*/ ctx[11].bind(null, "click")),
1029					listen(video, "play", /*dispatch*/ ctx[11].bind(null, "play")),
1030					listen(video, "pause", /*dispatch*/ ctx[11].bind(null, "pause")),
1031					listen(video, "ended", /*dispatch*/ ctx[11].bind(null, "ended")),
1032					listen(video, "mouseover", /*dispatch*/ ctx[11].bind(null, "mouseover")),
1033					listen(video, "mouseout", /*dispatch*/ ctx[11].bind(null, "mouseout")),
1034					listen(video, "focus", /*dispatch*/ ctx[11].bind(null, "focus")),
1035					listen(video, "blur", /*dispatch*/ ctx[11].bind(null, "blur")),
1036					listen(video, "timeupdate", video_timeupdate_handler),
1037					listen(video, "durationchange", /*video_durationchange_handler*/ ctx[16]),
1038					listen(video, "play", /*video_play_pause_handler*/ ctx[17]),
1039					listen(video, "pause", /*video_play_pause_handler*/ ctx[17]),
1040					action_destroyer(loaded_action = loaded.call(null, video, { autoplay: /*autoplay*/ ctx[8] ?? false }))
1041				];
1042
1043				mounted = true;
1044			}
1045		},
1046		p(ctx, dirty) {
1047			if (!current || dirty & /*processingVideo*/ 1024) {
1048				toggle_class$1(div, "hidden", !/*processingVideo*/ ctx[10]);
1049			}
1050
1051			if (default_slot) {
1052				if (default_slot.p && (!current || dirty & /*$$scope*/ 8192)) {
1053					update_slot_base(
1054						default_slot,
1055						default_slot_template,
1056						ctx,
1057						/*$$scope*/ ctx[13],
1058						!current
1059						? get_all_dirty_from_scope(/*$$scope*/ ctx[13])
1060						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[13], dirty, null),
1061						null
1062					);
1063				}
1064			}
1065
1066			if (!current || dirty & /*src*/ 16 && !src_url_equal(video.src, video_src_value = /*resolved_src*/ ctx[19])) {
1067				attr$1(video, "src", video_src_value);
1068			}
1069
1070			if (!current || dirty & /*muted*/ 32) {
1071				video.muted = /*muted*/ ctx[5];
1072			}
1073
1074			if (!current || dirty & /*playsinline*/ 64) {
1075				video.playsInline = /*playsinline*/ ctx[6];
1076			}
1077
1078			if (!current || dirty & /*preload*/ 128) {
1079				attr$1(video, "preload", /*preload*/ ctx[7]);
1080			}
1081
1082			if (!current || dirty & /*autoplay*/ 256) {
1083				video.autoplay = /*autoplay*/ ctx[8];
1084			}
1085
1086			if (!current || dirty & /*controls*/ 512) {
1087				video.controls = /*controls*/ ctx[9];
1088			}
1089
1090			if (!current || dirty & /*$$props*/ 4096 && video_data_testid_value !== (video_data_testid_value = /*$$props*/ ctx[12]["data-testid"])) {
1091				attr$1(video, "data-testid", video_data_testid_value);
1092			}
1093
1094			if (!video_updating && dirty & /*currentTime*/ 1 && !isNaN(/*currentTime*/ ctx[0])) {
1095				video.currentTime = /*currentTime*/ ctx[0];
1096			}
1097
1098			video_updating = false;
1099
1100			if (dirty & /*paused*/ 4 && video_is_paused !== (video_is_paused = /*paused*/ ctx[2])) {
1101				video[video_is_paused ? "pause" : "play"]();
1102			}
1103
1104			if (loaded_action && is_function$1(loaded_action.update) && dirty & /*autoplay*/ 256) loaded_action.update.call(null, { autoplay: /*autoplay*/ ctx[8] ?? false });
1105		},
1106		i(local) {
1107			if (current) return;
1108			transition_in$1(default_slot, local);
1109			current = true;
1110		},
1111		o(local) {
1112			transition_out$1(default_slot, local);
1113			current = false;
1114		},
1115		d(detaching) {
1116			if (detaching) {
1117				detach$1(div);
1118				detach$1(t);
1119				detach$1(video);
1120			}
1121
1122			if (default_slot) default_slot.d(detaching);
1123			/*video_binding*/ ctx[18](null);
1124			mounted = false;
1125			run_all(dispose);
1126		}
1127	};
1128}
1129
1130// (1:0) <script lang="ts">import { createEventDispatcher }
1131function create_pending_block(ctx) {
1132	return {
1133		c: noop$1,
1134		m: noop$1,
1135		p: noop$1,
1136		i: noop$1,
1137		o: noop$1,
1138		d: noop$1
1139	};
1140}
1141
1142function create_fragment$1(ctx) {
1143	let await_block_anchor;
1144	let promise;
1145	let current;
1146
1147	let info = {
1148		ctx,
1149		current: null,
1150		token: null,
1151		hasCatch: true,
1152		pending: create_pending_block,
1153		then: create_then_block,
1154		catch: create_catch_block,
1155		value: 19,
1156		error: 20,
1157		blocks: [,,,]
1158	};
1159
1160	handle_promise(promise = resolve_wasm_src(/*src*/ ctx[4]), info);
1161
1162	return {
1163		c() {
1164			await_block_anchor = empty$1();
1165			info.block.c();
1166		},
1167		m(target, anchor) {
1168			insert$1(target, await_block_anchor, anchor);
1169			info.block.m(target, info.anchor = anchor);
1170			info.mount = () => await_block_anchor.parentNode;
1171			info.anchor = await_block_anchor;
1172			current = true;
1173		},
1174		p(new_ctx, [dirty]) {
1175			ctx = new_ctx;
1176			info.ctx = ctx;
1177
1178			if (dirty & /*src*/ 16 && promise !== (promise = resolve_wasm_src(/*src*/ ctx[4])) && handle_promise(promise, info)) ; else {
1179				update_await_block_branch(info, ctx, dirty);
1180			}
1181		},
1182		i(local) {
1183			if (current) return;
1184			transition_in$1(info.block);
1185			current = true;
1186		},
1187		o(local) {
1188			for (let i = 0; i < 3; i += 1) {
1189				const block = info.blocks[i];
1190				transition_out$1(block);
1191			}
1192
1193			current = false;
1194		},
1195		d(detaching) {
1196			if (detaching) {
1197				detach$1(await_block_anchor);
1198			}
1199
1200			info.block.d(detaching);
1201			info.token = null;
1202			info = null;
1203		}
1204	};
1205}
1206
1207function instance$1($$self, $$props, $$invalidate) {
1208	let { $$slots: slots = {}, $$scope } = $$props;
1209	let { src = undefined } = $$props;
1210	let { muted = undefined } = $$props;
1211	let { playsinline = undefined } = $$props;
1212	let { preload = undefined } = $$props;
1213	let { autoplay = undefined } = $$props;
1214	let { controls = undefined } = $$props;
1215	let { currentTime = undefined } = $$props;
1216	let { duration = undefined } = $$props;
1217	let { paused = undefined } = $$props;
1218	let { node = undefined } = $$props;
1219	let { processingVideo = false } = $$props;
1220	const dispatch = createEventDispatcher();
1221
1222	function video_timeupdate_handler() {
1223		currentTime = this.currentTime;
1224		$$invalidate(0, currentTime);
1225	}
1226
1227	function video_durationchange_handler() {
1228		duration = this.duration;
1229		$$invalidate(1, duration);
1230	}
1231
1232	function video_play_pause_handler() {
1233		paused = this.paused;
1234		$$invalidate(2, paused);
1235	}
1236
1237	function video_binding($$value) {
1238		binding_callbacks$1[$$value ? 'unshift' : 'push'](() => {
1239			node = $$value;
1240			$$invalidate(3, node);
1241		});
1242	}
1243
1244	$$self.$$set = $$new_props => {
1245		$$invalidate(12, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
1246		if ('src' in $$new_props) $$invalidate(4, src = $$new_props.src);
1247		if ('muted' in $$new_props) $$invalidate(5, muted = $$new_props.muted);
1248		if ('playsinline' in $$new_props) $$invalidate(6, playsinline = $$new_props.playsinline);
1249		if ('preload' in $$new_props) $$invalidate(7, preload = $$new_props.preload);
1250		if ('autoplay' in $$new_props) $$invalidate(8, autoplay = $$new_props.autoplay);
1251		if ('controls' in $$new_props) $$invalidate(9, controls = $$new_props.controls);
1252		if ('currentTime' in $$new_props) $$invalidate(0, currentTime = $$new_props.currentTime);
1253		if ('duration' in $$new_props) $$invalidate(1, duration = $$new_props.duration);
1254		if ('paused' in $$new_props) $$invalidate(2, paused = $$new_props.paused);
1255		if ('node' in $$new_props) $$invalidate(3, node = $$new_props.node);
1256		if ('processingVideo' in $$new_props) $$invalidate(10, processingVideo = $$new_props.processingVideo);
1257		if ('$$scope' in $$new_props) $$invalidate(13, $$scope = $$new_props.$$scope);
1258	};
1259
1260	$$props = exclude_internal_props($$props);
1261
1262	return [
1263		currentTime,
1264		duration,
1265		paused,
1266		node,
1267		src,
1268		muted,
1269		playsinline,
1270		preload,
1271		autoplay,
1272		controls,
1273		processingVideo,
1274		dispatch,
1275		$$props,
1276		$$scope,
1277		slots,
1278		video_timeupdate_handler,
1279		video_durationchange_handler,
1280		video_play_pause_handler,
1281		video_binding
1282	];
1283}
1284
1285class Video extends SvelteComponent$1 {
1286	constructor(options) {
1287		super();
1288
1289		init(this, options, instance$1, create_fragment$1, safe_not_equal$1, {
1290			src: 4,
1291			muted: 5,
1292			playsinline: 6,
1293			preload: 7,
1294			autoplay: 8,
1295			controls: 9,
1296			currentTime: 0,
1297			duration: 1,
1298			paused: 2,
1299			node: 3,
1300			processingVideo: 10
1301		});
1302	}
1303}
1304
1305const Example_svelte_svelte_type_style_lang = '';
1306
1307/* home/runner/work/gradio/gradio/js/video/Example.svelte generated by Svelte v4.2.2 */
1308const {
1309	SvelteComponent,
1310	add_flush_callback,
1311	append,
1312	attr,
1313	bind,
1314	binding_callbacks,
1315	create_component,
1316	destroy_component,
1317	detach,
1318	element,
1319	empty,
1320	init: init_1,
1321	insert,
1322	is_function,
1323	mount_component,
1324	noop,
1325	safe_not_equal,
1326	set_data,
1327	text,
1328	toggle_class,
1329	transition_in,
1330	transition_out
1331} = window.__gradio__svelte__internal;
1332function create_else_block(ctx) {
1333	let div;
1334	let t;
1335
1336	return {
1337		c() {
1338			div = element("div");
1339			t = text(/*value*/ ctx[2]);
1340		},
1341		m(target, anchor) {
1342			insert(target, div, anchor);
1343			append(div, t);
1344		},
1345		p(ctx, dirty) {
1346			if (dirty & /*value*/ 4) set_data(t, /*value*/ ctx[2]);
1347		},
1348		i: noop,
1349		o: noop,
1350		d(detaching) {
1351			if (detaching) {
1352				detach(div);
1353			}
1354		}
1355	};
1356}
1357
1358// (18:0) {#if playable()}
1359function create_if_block(ctx) {
1360	let div;
1361	let video_1;
1362	let updating_node;
1363	let current;
1364
1365	function video_1_node_binding(value) {
1366		/*video_1_node_binding*/ ctx[6](value);
1367	}
1368
1369	let video_1_props = {
1370		muted: true,
1371		playsinline: true,
1372		src: /*samples_dir*/ ctx[3] + /*value*/ ctx[2]
1373	};
1374
1375	if (/*video*/ ctx[4] !== void 0) {
1376		video_1_props.node = /*video*/ ctx[4];
1377	}
1378
1379	video_1 = new Video({ props: video_1_props });
1380	binding_callbacks.push(() => bind(video_1, 'node', video_1_node_binding));
1381	video_1.$on("loadeddata", /*init*/ ctx[5]);
1382
1383	video_1.$on("mouseover", function () {
1384		if (is_function(/*video*/ ctx[4].play.bind(/*video*/ ctx[4]))) /*video*/ ctx[4].play.bind(/*video*/ ctx[4]).apply(this, arguments);
1385	});
1386
1387	video_1.$on("mouseout", function () {
1388		if (is_function(/*video*/ ctx[4].pause.bind(/*video*/ ctx[4]))) /*video*/ ctx[4].pause.bind(/*video*/ ctx[4]).apply(this, arguments);
1389	});
1390
1391	return {
1392		c() {
1393			div = element("div");
1394			create_component(video_1.$$.fragment);
1395			attr(div, "class", "container svelte-1jmx6y1");
1396			toggle_class(div, "table", /*type*/ ctx[0] === "table");
1397			toggle_class(div, "gallery", /*type*/ ctx[0] === "gallery");
1398			toggle_class(div, "selected", /*selected*/ ctx[1]);
1399		},
1400		m(target, anchor) {
1401			insert(target, div, anchor);
1402			mount_component(video_1, div, null);
1403			current = true;
1404		},
1405		p(new_ctx, dirty) {
1406			ctx = new_ctx;
1407			const video_1_changes = {};
1408			if (dirty & /*samples_dir, value*/ 12) video_1_changes.src = /*samples_dir*/ ctx[3] + /*value*/ ctx[2];
1409
1410			if (!updating_node && dirty & /*video*/ 16) {
1411				updating_node = true;
1412				video_1_changes.node = /*video*/ ctx[4];
1413				add_flush_callback(() => updating_node = false);
1414			}
1415
1416			video_1.$set(video_1_changes);
1417
1418			if (!current || dirty & /*type*/ 1) {
1419				toggle_class(div, "table", /*type*/ ctx[0] === "table");
1420			}
1421
1422			if (!current || dirty & /*type*/ 1) {
1423				toggle_class(div, "gallery", /*type*/ ctx[0] === "gallery");
1424			}
1425
1426			if (!current || dirty & /*selected*/ 2) {
1427				toggle_class(div, "selected", /*selected*/ ctx[1]);
1428			}
1429		},
1430		i(local) {
1431			if (current) return;
1432			transition_in(video_1.$$.fragment, local);
1433			current = true;
1434		},
1435		o(local) {
1436			transition_out(video_1.$$.fragment, local);
1437			current = false;
1438		},
1439		d(detaching) {
1440			if (detaching) {
1441				detach(div);
1442			}
1443
1444			destroy_component(video_1);
1445		}
1446	};
1447}
1448
1449function create_fragment(ctx) {
1450	let current_block_type_index;
1451	let if_block;
1452	let if_block_anchor;
1453	let current;
1454	const if_block_creators = [create_if_block, create_else_block];
1455	const if_blocks = [];
1456
1457	function select_block_type(ctx, dirty) {
1458		return 0;
1459	}
1460
1461	current_block_type_index = select_block_type();
1462	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1463
1464	return {
1465		c() {
1466			if_block.c();
1467			if_block_anchor = empty();
1468		},
1469		m(target, anchor) {
1470			if_blocks[current_block_type_index].m(target, anchor);
1471			insert(target, if_block_anchor, anchor);
1472			current = true;
1473		},
1474		p(ctx, [dirty]) {
1475			if_block.p(ctx, dirty);
1476		},
1477		i(local) {
1478			if (current) return;
1479			transition_in(if_block);
1480			current = true;
1481		},
1482		o(local) {
1483			transition_out(if_block);
1484			current = false;
1485		},
1486		d(detaching) {
1487			if (detaching) {
1488				detach(if_block_anchor);
1489			}
1490
1491			if_blocks[current_block_type_index].d(detaching);
1492		}
1493	};
1494}
1495
1496function instance($$self, $$props, $$invalidate) {
1497	let { type } = $$props;
1498	let { selected = false } = $$props;
1499	let { value } = $$props;
1500	let { samples_dir } = $$props;
1501	let video;
1502
1503	async function init() {
1504		$$invalidate(4, video.muted = true, video);
1505		$$invalidate(4, video.playsInline = true, video);
1506		$$invalidate(4, video.controls = false, video);
1507		video.setAttribute("muted", "");
1508		await video.play();
1509		video.pause();
1510	}
1511
1512	function video_1_node_binding(value) {
1513		video = value;
1514		$$invalidate(4, video);
1515	}
1516
1517	$$self.$$set = $$props => {
1518		if ('type' in $$props) $$invalidate(0, type = $$props.type);
1519		if ('selected' in $$props) $$invalidate(1, selected = $$props.selected);
1520		if ('value' in $$props) $$invalidate(2, value = $$props.value);
1521		if ('samples_dir' in $$props) $$invalidate(3, samples_dir = $$props.samples_dir);
1522	};
1523
1524	return [type, selected, value, samples_dir, video, init, video_1_node_binding];
1525}
1526
1527class Example extends SvelteComponent {
1528	constructor(options) {
1529		super();
1530
1531		init_1(this, options, instance, create_fragment, safe_not_equal, {
1532			type: 0,
1533			selected: 1,
1534			value: 2,
1535			samples_dir: 3
1536		});
1537	}
1538}
1539
1540const Example$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1541    __proto__: null,
1542    default: Example
1543}, Symbol.toStringTag, { value: 'Module' }));
1544
1545export { Example as E, Video as V, playable as a, loaded as b, Example$1 as c, loadFfmpeg as l, prettyBytes as p, trimVideo as t };
1546//# sourceMappingURL=Example-25a38da7.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.