social-embeds 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -20
- package/dist/components/hooks.js +11 -1
- package/dist/components/iframe-embed.js +9 -6
- package/dist/components/script-embed.js +9 -2
- package/dist/components/shared.d.ts +2 -0
- package/dist/components/social-embed.d.ts +10 -3
- package/dist/components/social-embed.js +9 -6
- package/dist/core/frame-title.js +35 -0
- package/dist/core/message-height.js +31 -1
- package/dist/core/plans/bluesky.js +3 -2
- package/dist/core/plans/facebook.js +1 -0
- package/dist/core/plans/imgur.js +3 -2
- package/dist/core/plans/instagram.js +1 -0
- package/dist/core/plans/pinterest.js +1 -0
- package/dist/core/plans/reddit.js +3 -2
- package/dist/core/plans/strava.js +3 -2
- package/dist/core/plans/telegram.js +3 -2
- package/dist/core/plans/threads.js +1 -0
- package/dist/core/plans/truthsocial.js +5 -3
- package/dist/core/plans/tumblr.js +3 -2
- package/dist/core/plans/x.js +1 -0
- package/dist/element.d.ts +2 -0
- package/dist/element.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -105,14 +105,19 @@ export const SocialEmbed = createSocialEmbed([
|
|
|
105
105
|
]);
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
| ------------------------------------------------- | ------- |
|
|
110
|
-
| `youtube` | 6 KB |
|
|
111
|
-
| `youtube`, `x` | 9 KB |
|
|
112
|
-
| `youtube`, `x`, `instagram`, `facebook`, `tiktok` | 12 KB |
|
|
113
|
-
| the same five and `genericIframe` | 14 KB |
|
|
114
|
-
| every platform (`<SocialEmbed>`) | 27 KB |
|
|
108
|
+
JavaScript added to a page in a Next.js 16 production build, gzipped:
|
|
115
109
|
|
|
110
|
+
| Platforms | Turbopack | webpack |
|
|
111
|
+
| ------------------------------------------------- | --------- | ------- |
|
|
112
|
+
| `youtube` | 6 KB | 7 KB |
|
|
113
|
+
| `youtube`, `x` | 9 KB | 10 KB |
|
|
114
|
+
| `youtube`, `x`, `instagram`, `facebook`, `tiktok` | 12 KB | 13 KB |
|
|
115
|
+
| the same five and `genericIframe` | 14 KB | 15 KB |
|
|
116
|
+
| every platform (`<SocialEmbed>`) | 27 KB | 27 KB |
|
|
117
|
+
|
|
118
|
+
Before 0.9.4, Next.js kept every platform in a `createSocialEmbed` component as well: about 17 KB for `youtube` alone.
|
|
119
|
+
|
|
120
|
+
- **A fixed list:** the list is set when the app is built, not per page, and a platform that is not in it is never recognised. If embed code comes from a CMS where editors can paste any platform, list every platform they use, add `genericIframe` and handle the rest with `fallback`, or use `<SocialEmbed>`.
|
|
116
121
|
- **Names:** each platform is exported under its id, as in `embed.platform`: `x`, `instagram`, `threads`, `facebook`, `tiktok`, `youtube`, `telegram`, `snapchat`, `linkedin`, `reddit`, `pinterest`, `spotify`, `vimeo`, `twitch`, `dailymotion`, `bluesky`, `soundcloud`, `applemusic`, `applepodcasts`, `tumblr`, `kick`, `giphy`, `truthsocial`, `imgur`, `tenor`, `streamable`, `strava`, `flickr` and `rumble`. `genericIframe` adds [generic iframe embeds](#generic-iframe-embeds). The order of the list does not matter.
|
|
117
122
|
- **The same component:** it takes the same props and renders exactly what `<SocialEmbed>` renders for the platforms it knows. Embed code of another platform goes to `fallback`, or to `onError` as `social-embeds: unrecognised embed code`; a URL of another platform is reported as `social-embeds: not a supported post URL: …`. A frame that a named platform serves never renders as a generic iframe, even when that platform is not in the list.
|
|
118
123
|
- **A client module:** call `createSocialEmbed` once, at the top of a module with `'use client'`, and import the component from there. In the Next.js App Router a Server Component cannot call it, because it comes from a client module; it can render the component it returns.
|
|
@@ -121,7 +126,7 @@ export const SocialEmbed = createSocialEmbed([
|
|
|
121
126
|
|
|
122
127
|
Each platform component takes a `url`, or an `embed` already parsed by [`social-embeds/parser`](#parser), plus the shared props and its own option props. Option props override options from the embed code.
|
|
123
128
|
|
|
124
|
-
A platform component bundles only its own platform's parser: one component adds about 3 to 5 KB gzipped to
|
|
129
|
+
A platform component bundles only its own platform's parser: in a Next.js 16 production build, under Turbopack or webpack, one component adds about 3 to 5.5 KB gzipped to a page (`FacebookEmbed` about 7 KB), against about 27 KB for `<SocialEmbed>`, which recognises every platform. Before 0.9.4, under Turbopack each component added at least 15 KB. A URL of another platform is reported as `social-embeds: not a {Platform} post URL: …`, and an `embed` of another platform as `social-embeds: expected a {Platform} embed, got {id}`.
|
|
125
130
|
|
|
126
131
|
```tsx
|
|
127
132
|
import {
|
|
@@ -341,11 +346,12 @@ A component checks an `embed` before using it: its `url` must be the exact URL `
|
|
|
341
346
|
| `maxHeight` | `number` | | Fixed-size iframe embeds only: the embed is at most this tall, in pixels. It narrows to keep its aspect ratio, so a vertical video does not fill the column. |
|
|
342
347
|
| `placeholder` | `ReactNode` | a skeleton | Shown until the post has loaded. The default skeleton has a per-platform minimum height to limit layout shift. |
|
|
343
348
|
| `lazy` | `boolean` | `true` | Load the embed only when it comes within 200 px of the viewport. |
|
|
349
|
+
| `iframeTitle` | `string` | per platform | The embed's iframe `title`, which screen readers announce. See [Iframe titles](#iframe-titles). |
|
|
344
350
|
| `onLoad` | `() => void` | | Called once the platform has rendered the post (iframe embeds: when the iframe has loaded; Telegram, Reddit, Bluesky, Tumblr, Truth Social, Imgur and Strava: when the frame first reports its height). |
|
|
345
351
|
| `onError` | `(error: Error) => void` | | Called on invalid input, a script that fails to load, or a post that does not render. Components never throw. |
|
|
346
352
|
| `...rest` | `ComponentProps<'div'>` | | Passed to the wrapper `div` (`className`, `style`, `data-*`, …). |
|
|
347
353
|
|
|
348
|
-
Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Iframe embeds get 15 s, counted from when the embed comes near the viewport, also with `lazy={false}`. Telegram, Reddit, Bluesky, Tumblr, Truth Social, Imgur and Strava frames that report no height by then show at their starting height; other frames that have not loaded by then show as they are, such as a frame the browser blocked. `onError` reports both, and a frame that loads or reports its height later still calls `onLoad`.
|
|
354
|
+
Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Iframe embeds get 15 s, counted from when the embed comes near the viewport, also with `lazy={false}`. Telegram, Reddit, Bluesky, Tumblr, Truth Social, Imgur and Strava frames count their 15 s only while they are on screen in a visible tab, and start again when they leave it first: browsers paint a frame only there, and Bluesky's and Tumblr's report their height only once painted. Those that report no height by then show at their starting height; other frames that have not loaded by then show as they are, such as a frame the browser blocked. `onError` reports both, and a frame that loads or reports its height later still calls `onLoad`.
|
|
349
355
|
|
|
350
356
|
Instagram's and Threads' script scans only the document, so their embeds cannot render inside another component's shadow root (Lit, Stencil): `onError` reports that at once. X, Facebook and Pinterest embeds work there.
|
|
351
357
|
|
|
@@ -353,6 +359,32 @@ The scripts the package adds carry the nonce of the page's first `<script nonce>
|
|
|
353
359
|
|
|
354
360
|
When a script-based embed fails for good, its placeholder goes, as an iframe's does: a URL leaves a "View this post on {Platform}" link to the post, and embed code keeps its fallback content. A platform `<script>` tag already in the page whose platform never appears, such as one written through `innerHTML` or `dangerouslySetInnerHTML` (those never run), holds an embed back for at most 3 s after the page's `load` event; the package then adds its own tag.
|
|
355
361
|
|
|
362
|
+
### Iframe titles
|
|
363
|
+
|
|
364
|
+
Every embed's iframe gets a `title`, so screen readers can name it and Lighthouse's `frame-title` audit passes. The package's own iframes have always had one, such as `YouTube video player`. Instagram's and Threads' scripts add their iframe without a title, so the package gives it `Instagram post` or `Threads post`, also when the script adds or replaces the iframe later. X's and Facebook's scripts title their own iframes (`X Post`, `fb:post Facebook Social Plugin`); a title a script sets is never replaced. Any other iframe a platform script adds without a title gets `X post`, `Facebook post`, `Facebook video` or `Pinterest pin`.
|
|
365
|
+
|
|
366
|
+
`iframeTitle` replaces the default, for example to localise it, but not a title the platform's script set:
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
<InstagramEmbed url={url} iframeTitle="Публикация в Instagram" />
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
`<SocialEmbed>` and `createSocialEmbed` components also take a function of the platform id (`'iframe'` for a generic iframe). Return `undefined` to keep the default:
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
import type { Platform } from 'social-embeds/parser';
|
|
376
|
+
|
|
377
|
+
const TITLES: Partial<Record<Platform | 'iframe', string>> = {
|
|
378
|
+
instagram: 'Публикация в Instagram',
|
|
379
|
+
x: 'Публикация в X',
|
|
380
|
+
tiktok: 'Видео в TikTok',
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
<SocialEmbed html={code} iframeTitle={(platform) => TITLES[platform]} />;
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
A blank `iframeTitle` keeps the default. A generic iframe keeps the title from its embed code, or `Embedded content`, unless `iframeTitle` gives one. Error messages keep the default title.
|
|
387
|
+
|
|
356
388
|
## Platforms
|
|
357
389
|
|
|
358
390
|
| Platform | Mechanism | URL formats | Options read from embed code | Default `maxWidth` |
|
|
@@ -624,21 +656,22 @@ Embed code goes in a `<template>`, which keeps the platform's own `<script>` fro
|
|
|
624
656
|
</social-embed>
|
|
625
657
|
```
|
|
626
658
|
|
|
627
|
-
| Attribute / property
|
|
628
|
-
|
|
|
629
|
-
| `html`
|
|
630
|
-
| `url`
|
|
631
|
-
| `width`
|
|
632
|
-
| `max-width` / `maxWidth`
|
|
633
|
-
| `height`
|
|
634
|
-
| `max-height` / `maxHeight`
|
|
635
|
-
| `eager`
|
|
659
|
+
| Attribute / property | Meaning |
|
|
660
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
661
|
+
| `html` | Embed code. Usually set as a property (below). |
|
|
662
|
+
| `url` | A post URL. |
|
|
663
|
+
| `width` | A number means pixels; otherwise any CSS length. |
|
|
664
|
+
| `max-width` / `maxWidth` | Pixels: `400` or `400px`. |
|
|
665
|
+
| `height` | Pixels: `400` or `400px`. Reaches only iframe-based platforms, as in React. |
|
|
666
|
+
| `max-height` / `maxHeight` | Pixels: `400` or `400px`. Reaches only iframe-based platforms, as in React. |
|
|
667
|
+
| `eager` | Load at once instead of when near the viewport (the inverse of React's `lazy`); `eager="false"` is off. |
|
|
668
|
+
| `iframe-title` / `iframeTitle` | The iframe's `title`, as React's `iframeTitle` (a string only). |
|
|
636
669
|
|
|
637
|
-
Each property reflects its attribute, so framework property bindings such as Angular's `[url]` work. `url` and the size properties take a string, and `null` removes the attribute; `eager` takes a boolean.
|
|
670
|
+
Each property reflects its attribute, so framework property bindings such as Angular's `[url]` work. `url`, `iframeTitle` and the size properties take a string, and `null` removes the attribute; `eager` takes a boolean.
|
|
638
671
|
|
|
639
672
|
The `html` property takes embed code from script. From a framework, pass embed code this way: a `<template>` the framework renders keeps its children in `childNodes`, not in `content`, where the element reads them. Before the tag is defined, React 19, Vue and Svelte write `html` as an attribute, and server HTML can carry it that way too; the element reads that attribute. When several inputs are set, the `html` property wins over the `html` attribute, which wins over the `<template>`, which wins over `url`. Options come only from the embed code, as with `<SocialEmbed>`, and the element renders into the light DOM. The element has no `playerId`, so Dailymotion needs embed code that names a Player ID; a Dailymotion URL alone fires `error`.
|
|
640
673
|
|
|
641
|
-
The element's own children other than `<template>` are never rendered and never moved, so a framework that renders children into it keeps owning them. Copies of them, taken each time the embed starts and without their `id`s, are the placeholder until it loads; without any, a neutral skeleton shows. Embed code written straight inside the element, without a `<template>` (as a CMS that strips `<template>` leaves it), is used as `html` when there is no other input. Changing `width`, `max-width`, `height` or `
|
|
674
|
+
The element's own children other than `<template>` are never rendered and never moved, so a framework that renders children into it keeps owning them. Copies of them, taken each time the embed starts and without their `id`s, are the placeholder until it loads; without any, a neutral skeleton shows. Embed code written straight inside the element, without a `<template>` (as a CMS that strips `<template>` leaves it), is used as `html` when there is no other input. Changing `width`, `max-width`, `height`, `max-height` or `iframe-title` restyles or retitles the embed in place; only a new `url` or `html` starts it again. The embed renders into a `<div slot="embed">` in the light DOM, which a shadow root holding only that slot shows; the `embed` slot name is the element's own. If other code removes that `<div>`, for example a framework setting a text child or a DOM morph, the embed starts again. If the element connects while the document is still loading, it waits for `DOMContentLoaded` before reading its children.
|
|
642
675
|
|
|
643
676
|
It dispatches `load` (an `Event`) when the platform has rendered, and `error` (an `ErrorEvent`) when it cannot. `error.error` is an `Error` with the same message as React's `onError`. Neither event bubbles, both fire in a microtask, and only while the element is connected.
|
|
644
677
|
|
|
@@ -701,6 +734,8 @@ export function Embed({ html }: { html: string }) {
|
|
|
701
734
|
|
|
702
735
|
Client navigation needs nothing extra: each platform script loads once per page, and an embed that mounts after navigation renders without loading it again. With `lazy` (the default), a page with five embeds loads no platform script until the first embed comes near the viewport, and each embed then renders only when it comes near.
|
|
703
736
|
|
|
737
|
+
In a Next.js 16 production build, with Turbopack (the default) or webpack, a platform component adds about 3 to 5.5 KB gzipped to a page (`FacebookEmbed` about 7 KB), a [`createSocialEmbed`](#only-the-platforms-you-use) component with five platforms about 12 to 13 KB, and `<SocialEmbed>` about 27 KB. Before 0.9.4, any one component added at least 15 KB under Turbopack. When a page's embed code comes from a CMS and can be any platform, `<SocialEmbed>` is the component that recognises all of them.
|
|
738
|
+
|
|
704
739
|
## Server-side fallback content
|
|
705
740
|
|
|
706
741
|
- **Embed code with fallback content** (X, Instagram, Threads, Facebook SDK code with a blockquote): the server HTML contains the platform's blockquote with its whitelisted content, such as the post text, author and link. No placeholder is shown. On the client, the platform script turns it into the post.
|
package/dist/components/hooks.js
CHANGED
|
@@ -23,6 +23,16 @@ function useNearViewport(ref, lazy) {
|
|
|
23
23
|
}, [ref, lazy]);
|
|
24
24
|
return near;
|
|
25
25
|
}
|
|
26
|
+
/** Whether `watch` reports the element on screen; false while `watch` is undefined. */
|
|
27
|
+
function useOnScreen(ref, watch) {
|
|
28
|
+
const [onScreen, setOnScreen] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const element = ref.current;
|
|
31
|
+
if (!watch || !element) return;
|
|
32
|
+
return watch(element, setOnScreen);
|
|
33
|
+
}, [ref, watch]);
|
|
34
|
+
return watch !== void 0 && onScreen;
|
|
35
|
+
}
|
|
26
36
|
/** Calls `onError` from an effect, once per distinct message. */
|
|
27
37
|
function useReportError(message, onError) {
|
|
28
38
|
const latest = useRef(onError);
|
|
@@ -35,4 +45,4 @@ function useReportError(message, onError) {
|
|
|
35
45
|
reported.current = message;
|
|
36
46
|
}, [message]);
|
|
37
47
|
}
|
|
38
|
-
export { useNearViewport, useReportError };
|
|
48
|
+
export { useNearViewport, useOnScreen, useReportError };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { titleOr } from "../core/frame-title.js";
|
|
1
2
|
import { FRAME_TIMEOUT_MS } from "../core/timing.js";
|
|
2
3
|
import { frameStyle } from "../core/layout.js";
|
|
3
|
-
import { useNearViewport } from "./hooks.js";
|
|
4
|
+
import { useNearViewport, useOnScreen } from "./hooks.js";
|
|
4
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
// src/components/iframe-embed.tsx
|
|
@@ -39,12 +40,13 @@ const FILL = {
|
|
|
39
40
|
function IframeEmbed(props) {
|
|
40
41
|
return /* @__PURE__ */ jsx(Frame, { ...props }, props.src);
|
|
41
42
|
}
|
|
42
|
-
function Frame({ src, title, allow, allowFullscreen = true, referrerPolicy, scrolling, sandbox, ratio, size, messageHeight, startHeight, clientSrc, borderRadius, sizeInSrc, width, maxWidth, height, maxHeight, placeholder, lazy = true, onLoad, onError, style, ...rest }) {
|
|
43
|
+
function Frame({ src, title, allow, allowFullscreen = true, referrerPolicy, scrolling, sandbox, ratio, size, messageHeight, startHeight, clientSrc, borderRadius, sizeInSrc, iframeTitle, width, maxWidth, height, maxHeight, placeholder, lazy = true, onLoad, onError, style, ...rest }) {
|
|
43
44
|
const frame = useRef(null);
|
|
44
45
|
const iframe = useRef(null);
|
|
45
46
|
const near = useNearViewport(frame, lazy);
|
|
46
|
-
const inView = useNearViewport(frame, !lazy);
|
|
47
47
|
const [loaded, setLoaded] = useState(false);
|
|
48
|
+
const inView = useNearViewport(frame, !lazy && !messageHeight);
|
|
49
|
+
const onScreen = useOnScreen(frame, near && !loaded ? messageHeight?.onScreen : void 0);
|
|
48
50
|
const [reportedHeight, setReportedHeight] = useState();
|
|
49
51
|
const [boxWidth, setBoxWidth] = useState();
|
|
50
52
|
const reported = useRef(false);
|
|
@@ -85,8 +87,9 @@ function Frame({ src, title, allow, allowFullscreen = true, referrerPolicy, scro
|
|
|
85
87
|
if (!near || !sized || !element) return;
|
|
86
88
|
return sizing.current?.watch(element, setBoxWidth);
|
|
87
89
|
}, [near, sized]);
|
|
90
|
+
const counting = messageHeight ? onScreen : inView;
|
|
88
91
|
useEffect(() => {
|
|
89
|
-
if (!near || !
|
|
92
|
+
if (!near || !counting) return;
|
|
90
93
|
const failure = messageHeight ? "did not report its height" : "did not load";
|
|
91
94
|
const timer = setTimeout(() => {
|
|
92
95
|
if (reported.current) return;
|
|
@@ -98,7 +101,7 @@ function Frame({ src, title, allow, allowFullscreen = true, referrerPolicy, scro
|
|
|
98
101
|
};
|
|
99
102
|
}, [
|
|
100
103
|
near,
|
|
101
|
-
|
|
104
|
+
counting,
|
|
102
105
|
messageHeight,
|
|
103
106
|
title
|
|
104
107
|
]);
|
|
@@ -131,7 +134,7 @@ function Frame({ src, title, allow, allowFullscreen = true, referrerPolicy, scro
|
|
|
131
134
|
children: [near && frameSrc !== void 0 && /* @__PURE__ */ jsx("iframe", {
|
|
132
135
|
ref: iframe,
|
|
133
136
|
src: clientSrc ? clientSrc(frameSrc) : frameSrc,
|
|
134
|
-
title,
|
|
137
|
+
title: titleOr(iframeTitle, title),
|
|
135
138
|
allow,
|
|
136
139
|
allowFullScreen: allowFullscreen,
|
|
137
140
|
referrerPolicy,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FinalError } from "../core/drivers.js";
|
|
2
|
+
import { titleFrames, titleOr } from "../core/frame-title.js";
|
|
2
3
|
import { postLinkText, postUrl } from "../core/post-link.js";
|
|
3
4
|
import { RENDER_TIMEOUT_MS, RETRY_DELAY_MS } from "../core/timing.js";
|
|
4
5
|
import { useNearViewport } from "./hooks.js";
|
|
@@ -9,9 +10,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
10
|
const LAYER = { width: "100%" };
|
|
10
11
|
/** A platform component's script embed: it sizes itself, so `height` and `maxHeight` are dropped. */
|
|
11
12
|
function scriptOf(plan, props) {
|
|
12
|
-
const { maxWidth, height, maxHeight, ...rest } = props;
|
|
13
|
+
const { maxWidth, height, maxHeight, iframeTitle, ...rest } = props;
|
|
13
14
|
return /* @__PURE__ */ jsx(ScriptEmbed, {
|
|
14
15
|
...rest,
|
|
16
|
+
iframeTitle: titleOr(iframeTitle, plan.title),
|
|
15
17
|
maxWidth: maxWidth ?? plan.maxWidth,
|
|
16
18
|
driver: plan.driver,
|
|
17
19
|
markup: plan.markup,
|
|
@@ -23,7 +25,7 @@ function scriptOf(plan, props) {
|
|
|
23
25
|
function toError(error) {
|
|
24
26
|
return error instanceof Error ? error : new Error(String(error));
|
|
25
27
|
}
|
|
26
|
-
function ScriptEmbed({ driver, markup, hasFallback, minHeight, label, width = "100%", maxWidth, placeholder, lazy = true, onLoad, onError, style, ...rest }) {
|
|
28
|
+
function ScriptEmbed({ driver, markup, hasFallback, minHeight, label, iframeTitle, width = "100%", maxWidth, placeholder, lazy = true, onLoad, onError, style, ...rest }) {
|
|
27
29
|
const container = useRef(null);
|
|
28
30
|
const near = useNearViewport(container, lazy);
|
|
29
31
|
const [rendered, setRendered] = useState(false);
|
|
@@ -39,6 +41,11 @@ function ScriptEmbed({ driver, markup, hasFallback, minHeight, label, width = "1
|
|
|
39
41
|
onError
|
|
40
42
|
};
|
|
41
43
|
});
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const element = container.current;
|
|
46
|
+
if (!element) return;
|
|
47
|
+
return titleFrames(element, iframeTitle);
|
|
48
|
+
}, [iframeTitle]);
|
|
42
49
|
useEffect(() => {
|
|
43
50
|
const element = container.current;
|
|
44
51
|
if (!near || !element || done.current) return;
|
|
@@ -16,6 +16,8 @@ export type SharedProps = Omit<ComponentProps<'div'>, 'children' | 'onLoad' | 'o
|
|
|
16
16
|
placeholder?: ReactNode;
|
|
17
17
|
/** Load the embed only when it comes near the viewport. Default `true`. */
|
|
18
18
|
lazy?: boolean;
|
|
19
|
+
/** The iframe's `title`. Default: per platform. A title the platform's script sets is kept. */
|
|
20
|
+
iframeTitle?: string;
|
|
19
21
|
/** Fires once the platform has rendered the post. */
|
|
20
22
|
onLoad?: () => void;
|
|
21
23
|
/** Fires on invalid input, script load failure or init timeout. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlatformParser } from "../parser/platform.js";
|
|
2
|
-
import { ParsedEmbed } from "../parser/types.js";
|
|
2
|
+
import { ParsedEmbed, Platform } from "../parser/types.js";
|
|
3
3
|
import "./bluesky-embed.js";
|
|
4
4
|
import "./dailymotion-embed.js";
|
|
5
5
|
import { BlueskyOptions } from "../core/plans/bluesky.js";
|
|
@@ -51,16 +51,23 @@ export type SocialEmbedSource = {
|
|
|
51
51
|
html?: never;
|
|
52
52
|
};
|
|
53
53
|
type PlatformOption = keyof XOptions | keyof InstagramOptions | keyof ThreadsOptions | keyof FacebookOptions | keyof TikTokOptions | keyof YouTubeOptions | keyof TelegramOptions | keyof RedditOptions | keyof LinkedInOptions | keyof PinterestOptions | keyof VimeoOptions | keyof TwitchOptions | keyof DailymotionOptions | keyof BlueskyOptions | keyof SoundCloudOptions | keyof KickOptions | keyof StreamableOptions | keyof ImgurOptions | keyof StravaOptions | keyof FlickrOptions;
|
|
54
|
-
export type SocialEmbedProps = SocialEmbedSource & Omit<FrameProps, PlatformOption> & {
|
|
54
|
+
export type SocialEmbedProps = SocialEmbedSource & Omit<FrameProps, PlatformOption | 'iframeTitle'> & {
|
|
55
55
|
/**
|
|
56
56
|
* Called with the original string when `html` is neither a platform's embed code nor a
|
|
57
57
|
* safe iframe. Without it, nothing is rendered and `onError` is called.
|
|
58
58
|
*/
|
|
59
59
|
fallback?: (html: string) => ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* The iframe's `title`, or a function of the platform (`'iframe'` for a generic iframe) that
|
|
62
|
+
* returns it; `undefined` keeps the default. A title the platform's script sets is kept.
|
|
63
|
+
*/
|
|
64
|
+
iframeTitle?: string | ((platform: Platform | 'iframe') => string | undefined);
|
|
60
65
|
};
|
|
61
66
|
/** What `<SocialEmbed>` passes on to the platform it renders. */
|
|
62
67
|
export type RouteProps = {
|
|
63
|
-
shared: Omit<SocialEmbedProps, 'html' | 'url' | 'fallback' | 'height' | 'maxHeight' | 'onError'
|
|
68
|
+
shared: Omit<SocialEmbedProps, 'html' | 'url' | 'fallback' | 'height' | 'maxHeight' | 'onError' | 'iframeTitle'> & {
|
|
69
|
+
iframeTitle?: string;
|
|
70
|
+
};
|
|
64
71
|
frame: Pick<FrameProps, 'height' | 'maxHeight'>;
|
|
65
72
|
onError: FrameProps['onError'];
|
|
66
73
|
};
|
|
@@ -14,15 +14,18 @@ function tableOf(list) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
function useSocialEmbed(props, table) {
|
|
17
|
-
const { html, url, fallback, height, maxHeight, onError, ...shared } = props;
|
|
18
|
-
const route = {
|
|
19
|
-
shared
|
|
17
|
+
const { html, url, fallback, height, maxHeight, onError, iframeTitle, ...shared } = props;
|
|
18
|
+
const route = (platform) => ({
|
|
19
|
+
shared: {
|
|
20
|
+
...shared,
|
|
21
|
+
iframeTitle: typeof iframeTitle === "function" ? iframeTitle(platform) : iframeTitle
|
|
22
|
+
},
|
|
20
23
|
frame: {
|
|
21
24
|
height,
|
|
22
25
|
maxHeight
|
|
23
26
|
},
|
|
24
27
|
onError
|
|
25
|
-
};
|
|
28
|
+
});
|
|
26
29
|
const embed = useMemo(() => html !== void 0 ? parseEmbedWith(table.parsers, html) : matchUrlWith(table.parsers, url), [
|
|
27
30
|
html,
|
|
28
31
|
url,
|
|
@@ -34,9 +37,9 @@ function useSocialEmbed(props, table) {
|
|
|
34
37
|
table
|
|
35
38
|
]);
|
|
36
39
|
useReportError(embed === null && iframe === null && !(html !== void 0 && fallback) ? sourceError(html !== void 0 ? { html } : { url }) : void 0, onError);
|
|
37
|
-
if (iframe && table.iframe) return table.iframe.render(iframe, route);
|
|
40
|
+
if (iframe && table.iframe) return table.iframe.render(iframe, route("iframe"));
|
|
38
41
|
if (!embed) return html !== void 0 && fallback ? fallback(html) : null;
|
|
39
|
-
return table.renders.get(embed.platform)?.(embed, route) ?? null;
|
|
42
|
+
return table.renders.get(embed.platform)?.(embed, route(embed.platform)) ?? null;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
45
|
* A `<SocialEmbed>` that recognises only the listed platforms, so a bundler leaves the others
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/core/frame-title.ts
|
|
2
|
+
const ours = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function retitle(container, title) {
|
|
4
|
+
for (const iframe of container.querySelectorAll("iframe")) {
|
|
5
|
+
const current = iframe.getAttribute("title");
|
|
6
|
+
if (current === title) continue;
|
|
7
|
+
if (current?.trim() && current !== ours.get(iframe)) continue;
|
|
8
|
+
iframe.setAttribute("title", title);
|
|
9
|
+
ours.set(iframe, title);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** `title`, unless it is missing or blank. */
|
|
13
|
+
function titleOr(title, fallback) {
|
|
14
|
+
return title?.trim() ? title : fallback;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Titles each iframe under `container` that has none, including ones a platform script adds or
|
|
18
|
+
* replaces later (docs/decisions.md D119). Returns the cleanup.
|
|
19
|
+
*/
|
|
20
|
+
function titleFrames(container, title) {
|
|
21
|
+
retitle(container, title);
|
|
22
|
+
const observer = new MutationObserver(() => {
|
|
23
|
+
retitle(container, title);
|
|
24
|
+
});
|
|
25
|
+
observer.observe(container, {
|
|
26
|
+
subtree: true,
|
|
27
|
+
childList: true,
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: ["title"]
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
observer.disconnect();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export { titleFrames, titleOr };
|
|
@@ -21,4 +21,34 @@ function listenForHeight(frame, onHeight) {
|
|
|
21
21
|
window.removeEventListener("message", listen);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* `MessageHeight.onScreen`: whether the element is in the viewport of a visible page, once at the
|
|
26
|
+
* first observation, then on each change. Without IntersectionObserver it is always on screen.
|
|
27
|
+
*/
|
|
28
|
+
function watchOnScreen(element, onChange) {
|
|
29
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
30
|
+
onChange(true);
|
|
31
|
+
return () => {};
|
|
32
|
+
}
|
|
33
|
+
let intersecting = false;
|
|
34
|
+
let last;
|
|
35
|
+
const update = () => {
|
|
36
|
+
const onScreen = intersecting && document.visibilityState !== "hidden";
|
|
37
|
+
if (onScreen === last) return;
|
|
38
|
+
last = onScreen;
|
|
39
|
+
onChange(onScreen);
|
|
40
|
+
};
|
|
41
|
+
const observer = new IntersectionObserver((entries) => {
|
|
42
|
+
const entry = entries[entries.length - 1];
|
|
43
|
+
if (!entry) return;
|
|
44
|
+
intersecting = entry.isIntersecting;
|
|
45
|
+
update();
|
|
46
|
+
});
|
|
47
|
+
observer.observe(element);
|
|
48
|
+
document.addEventListener("visibilitychange", update);
|
|
49
|
+
return () => {
|
|
50
|
+
observer.disconnect();
|
|
51
|
+
document.removeEventListener("visibilitychange", update);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export { listenForHeight, watchOnScreen };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { query } from "../params.js";
|
|
2
|
-
import { listenForHeight } from "../message-height.js";
|
|
2
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
3
3
|
// src/core/plans/bluesky.ts
|
|
4
4
|
/** The frame posts `{ height }` once it has painted (docs/decisions.md D70). */
|
|
5
5
|
const BLUESKY_HEIGHT = {
|
|
@@ -8,7 +8,8 @@ const BLUESKY_HEIGHT = {
|
|
|
8
8
|
const height = data?.height;
|
|
9
9
|
return typeof height === "number" ? height : void 0;
|
|
10
10
|
},
|
|
11
|
-
listen: listenForHeight
|
|
11
|
+
listen: listenForHeight,
|
|
12
|
+
onScreen: watchOnScreen
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* At most 600px wide by default, Bluesky's oEmbed width. Renders the frame `embed.js` would
|
|
@@ -72,6 +72,7 @@ function facebookPlan(embed, options) {
|
|
|
72
72
|
driver: facebookDriver(sdkLocale),
|
|
73
73
|
minHeight: MIN_HEIGHT[embed.kind],
|
|
74
74
|
label: "Facebook",
|
|
75
|
+
title: embed.kind === "video" ? "Facebook video" : "Facebook post",
|
|
75
76
|
hasFallback: hasFallback(embed.fallbackHtml),
|
|
76
77
|
maxWidth: embed.kind === "post" ? POST_MAX_WIDTH : void 0
|
|
77
78
|
};
|
package/dist/core/plans/imgur.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listenForHeight } from "../message-height.js";
|
|
1
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
2
2
|
// src/core/plans/imgur.ts
|
|
3
3
|
/** The frame posts one JSON string at `load`, unasked (docs/decisions.md D94). */
|
|
4
4
|
const IMGUR_HEIGHT = {
|
|
@@ -8,7 +8,8 @@ const IMGUR_HEIGHT = {
|
|
|
8
8
|
const message = JSON.parse(data);
|
|
9
9
|
return message.message === "resize_imgur" && typeof message.height === "number" ? message.height : void 0;
|
|
10
10
|
},
|
|
11
|
-
listen: listenForHeight
|
|
11
|
+
listen: listenForHeight,
|
|
12
|
+
onScreen: watchOnScreen
|
|
12
13
|
};
|
|
13
14
|
/** At most 540px wide by default, the widest `embed.js` makes the frame (docs/decisions.md D94). */
|
|
14
15
|
function imgurPlan(embed, options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { query } from "../params.js";
|
|
2
|
-
import { listenForHeight } from "../message-height.js";
|
|
2
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
3
3
|
// src/core/plans/reddit.ts
|
|
4
4
|
const PARAMS = {
|
|
5
5
|
theme: "theme",
|
|
@@ -20,7 +20,8 @@ const REDDIT_HEIGHT = {
|
|
|
20
20
|
const message = JSON.parse(data);
|
|
21
21
|
return message.type === "resize.embed" && typeof message.data === "number" ? message.data : void 0;
|
|
22
22
|
},
|
|
23
|
-
listen: listenForHeight
|
|
23
|
+
listen: listenForHeight,
|
|
24
|
+
onScreen: watchOnScreen
|
|
24
25
|
};
|
|
25
26
|
/** At most 640px wide by default, the width widgets.js gives the frame (docs/decisions.md D52). */
|
|
26
27
|
function redditPlan(embed, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listenForHeight } from "../message-height.js";
|
|
1
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
2
2
|
// src/core/plans/strava.ts
|
|
3
3
|
const NS = "social-embeds";
|
|
4
4
|
/** The frame posts `[ns, 'BROADCAST_IFRAME_HEIGHT', height]` once, unasked (docs/decisions.md D97). */
|
|
@@ -9,7 +9,8 @@ const STRAVA_HEIGHT = {
|
|
|
9
9
|
const [, type, height] = data;
|
|
10
10
|
return type === "BROADCAST_IFRAME_HEIGHT" && typeof height === "number" ? height : void 0;
|
|
11
11
|
},
|
|
12
|
-
listen: listenForHeight
|
|
12
|
+
listen: listenForHeight,
|
|
13
|
+
onScreen: watchOnScreen
|
|
13
14
|
};
|
|
14
15
|
function styleOf(value) {
|
|
15
16
|
return value === "minimal" ? "minimal" : "standard";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { query } from "../params.js";
|
|
2
|
-
import { listenForHeight } from "../message-height.js";
|
|
2
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
3
3
|
// src/core/plans/telegram.ts
|
|
4
4
|
const PARAMS = [
|
|
5
5
|
["comment", "comment"],
|
|
@@ -26,7 +26,8 @@ const TELEGRAM_HEIGHT = {
|
|
|
26
26
|
const message = JSON.parse(data);
|
|
27
27
|
return message.event === "resize" && typeof message.height === "number" ? message.height : void 0;
|
|
28
28
|
},
|
|
29
|
-
listen: listenForHeight
|
|
29
|
+
listen: listenForHeight,
|
|
30
|
+
onScreen: watchOnScreen
|
|
30
31
|
};
|
|
31
32
|
/** At most 500px wide by default, the widest the post renders (docs/decisions.md D49). */
|
|
32
33
|
function telegramPlan(embed, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listenForHeight } from "../message-height.js";
|
|
1
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
2
2
|
// src/core/plans/truthsocial.ts
|
|
3
3
|
const VIDEO_EXTRA = 165;
|
|
4
4
|
function setHeight(data) {
|
|
@@ -9,7 +9,8 @@ function setHeight(data) {
|
|
|
9
9
|
const TRUTH_SOCIAL_HEIGHT = {
|
|
10
10
|
origin: "https://truthsocial.com",
|
|
11
11
|
read: setHeight,
|
|
12
|
-
listen: listenForHeight
|
|
12
|
+
listen: listenForHeight,
|
|
13
|
+
onScreen: watchOnScreen
|
|
13
14
|
};
|
|
14
15
|
/** A video post reports its height before the video is sized (docs/decisions.md D100). */
|
|
15
16
|
const TRUTH_SOCIAL_VIDEO_HEIGHT = {
|
|
@@ -18,7 +19,8 @@ const TRUTH_SOCIAL_VIDEO_HEIGHT = {
|
|
|
18
19
|
const height = setHeight(data);
|
|
19
20
|
return height === void 0 || height <= 0 ? void 0 : height + VIDEO_EXTRA;
|
|
20
21
|
},
|
|
21
|
-
listen: listenForHeight
|
|
22
|
+
listen: listenForHeight,
|
|
23
|
+
onScreen: watchOnScreen
|
|
22
24
|
};
|
|
23
25
|
const CANONICAL = /^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;
|
|
24
26
|
/** At most 600px wide by default, the width of Truth Social's embed code (docs/decisions.md D93). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listenForHeight } from "../message-height.js";
|
|
1
|
+
import { listenForHeight, watchOnScreen } from "../message-height.js";
|
|
2
2
|
// src/core/plans/tumblr.ts
|
|
3
3
|
/** The frame posts a JSON string once it has painted (docs/decisions.md D74). */
|
|
4
4
|
const TUMBLR_HEIGHT = {
|
|
@@ -9,7 +9,8 @@ const TUMBLR_HEIGHT = {
|
|
|
9
9
|
const [height] = Array.isArray(message.args) ? message.args : [];
|
|
10
10
|
return message.method === "tumblr-post:sizeChange" && typeof height === "number" ? height : void 0;
|
|
11
11
|
},
|
|
12
|
-
listen: listenForHeight
|
|
12
|
+
listen: listenForHeight,
|
|
13
|
+
onScreen: watchOnScreen
|
|
13
14
|
};
|
|
14
15
|
/** At most 540px wide by default, Tumblr's oEmbed width. Renders the frame `post.js` would create (docs/decisions.md D77). */
|
|
15
16
|
function tumblrPlan(embed) {
|
package/dist/core/plans/x.js
CHANGED
package/dist/element.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare class SocialEmbedElement extends Base {
|
|
|
18
18
|
set height(value: string | null);
|
|
19
19
|
get maxHeight(): string | null;
|
|
20
20
|
set maxHeight(value: string | null);
|
|
21
|
+
get iframeTitle(): string | null;
|
|
22
|
+
set iframeTitle(value: string | null);
|
|
21
23
|
get eager(): boolean;
|
|
22
24
|
set eager(value: boolean | string | null | undefined);
|
|
23
25
|
connectedCallback(): void;
|
package/dist/element.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`autoplay *; encrypted-media *; fullscreen *; clipboard-write`,t=`allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation`;function n(n){let r=n.url.slice(23),i=r.includes(`/song/`)||r.includes(`?i=`);return{kind:`iframe`,src:`https://embed.music.apple.com${r}`,title:`Apple Music player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(i?175:450),maxWidth:660,borderRadius:10}}function r(n){let r=n.url.slice(26);return{kind:`iframe`,src:`https://embed.podcasts.apple.com${r}`,title:`Apple Podcasts player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(r.includes(`?i=`)?160:450),maxWidth:640,borderRadius:12}}function i(e,t){return Object.entries(e).filter(([e])=>!t.includes(e.toLowerCase()))}function a(...e){let t=/* @__PURE__ */ new Map;for(let n of e)for(let[e,r]of n??[])t.set(e,String(r));let n=[...t].map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);return n.length>0?`?${n.join(`&`)}`:``}function o(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=e[r];typeof t==`boolean`?n.push([i,+!!t]):(typeof t==`string`||typeof t==`number`)&&n.push([i,t])}return n}function s(e,t){let{origin:n,read:r}=this,i=i=>{if(i.origin!==n)return;let a=e();if(!a||i.source!==a.contentWindow)return;let o;try{o=r(i.data)}catch{return}typeof o==`number`&&o>0&&o<=5e4&&t(Math.ceil(o))};return window.addEventListener(`message`,i),()=>{window.removeEventListener(`message`,i)}}const c={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0},listen:s};function l(e,t){let n=t.colorMode??e.options.colorMode;return{kind:`iframe`,src:`https://embed.bsky.app/embed/${e.id}${a(typeof n==`string`?[[`colorMode`,n]]:void 0)}`,title:`Bluesky post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:c,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const u=/^x[a-z0-9]{3,12}$/;function d(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...l}=e.options,d=n??c;if(d===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof d!=`string`||!u.test(d))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(d)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${d}.html${a([[`video`,e.id]],i(l,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const f=15e3,p=3e3,m=/* @__PURE__ */ new Map;function h(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=m.get(e.key);return t||(t=g(e).catch(t=>{throw m.delete(e.key),t}),m.set(e.key,t)),t}async function g(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await _(e,t)||await y(e)}await e.whenPresent?.()}function _(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?p:f),i,a=()=>{r=Date.now()+p},o=()=>{clearTimeout(i),window.removeEventListener(`load`,a);for(let e of t)e.removeEventListener(`error`,o);n(e.isPresent())},s=()=>{e.isPresent()||Date.now()>=r?o():i=setTimeout(s,50)};window.addEventListener(`load`,a);for(let e of t)e.addEventListener(`error`,o);s()})}var v=class extends Error{};async function y(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await ee(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof v)||t>=3)throw e;await S(1e3*2**(t-1))}await(t?x(t,`${e.url} did not report ready`):b(e))}async function ee(e){let t=e.prepare?.(),n=document.createElement(`script`),r=new Promise((t,r)=>{n.src=e.url,n.async=!0,e.crossOrigin&&(n.crossOrigin=e.crossOrigin);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new v(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await x(r,`${e.url} did not load`)}finally{t?.()}return n}function b(e){return new Promise((t,n)=>{let r=Date.now()+f,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function x(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},f);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function S(e){return new Promise(t=>setTimeout(t,e))}const C=()=>window,w=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){let t=C().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}const re={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=C().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=C().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=C().FB;return!ne(e)&&t!==void 0&&!t.__buffer}const oe={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`instagram`),prepare:ie,skipped:()=>ae(`instagram`)},se={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`threads`),prepare:ie,skipped:()=>ae(`threads`)};function ce(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${w}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=C().fbAsyncInit;C().fbAsyncInit=()=>{t?.(),e()}})}}const le={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().PinUtils?.build==`function`};function ue(){return h(re)}function de(){return h(oe)}function fe(){return h(se)}function pe(){return h(le)}function me(e){return te.test(e)?h(ce(e)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${e}"`))}const T=()=>window;var he=class extends Error{};function E(e,t,n){if(t(e))return n(),()=>{};let r=new MutationObserver(()=>{t(e)&&(r.disconnect(),n())});return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`class`,`style`,`height`]}),()=>{r.disconnect()}}function ge(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function _e(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ve={load:()=>ue(),render(e,t){let n=T().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=E(e,_e,t);return ge(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function ye(e,t){if(e.getRootNode()!==document)throw new he(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function be(){let e=T().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const xe={load:()=>de(),render(e,t){ye(e,`Instagram`);let n=E(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ge(e,`instagram-media`),be(),n}},Se={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=E(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ge(e,`text-post-media`),be(),n}},Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);return t||(t={load:()=>me(e),render(e,t){let n=T().FB,r=n?.XFBML?.parse;if(!n||!r)throw Error(`social-embeds: FB.XFBML.parse is missing`);let i=()=>{r(e,t)};try{i()}catch(e){if(!(e instanceof Error)||!/init not called/.test(e.message))throw e;n.init?.({xfbml:!1,version:w}),i()}return()=>{}}},Ce.set(e,t)),t}const Te={load:()=>pe(),render(e,t){let n=T().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=E(e,e=>e.querySelector(`span[data-pin-id]`)!==null,t),i=e.querySelector(`a`);return i&&!i.hasAttribute(`data-pin-do`)&&i.setAttribute(`data-pin-do`,`embedPin`),n(e),r}},Ee=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),De=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Oe=/<([a-zA-Z][a-zA-Z0-9-]*)/y,ke=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ae=/\s*(\/?)>/y,je=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Me=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}je.lastIndex=a;let s=je.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=je.lastIndex;continue}let c=Ne(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:De.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!Ee.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ne(e,t){Oe.lastIndex=t;let n=Oe.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Oe.lastIndex;for(;;){Ae.lastIndex=i;let t=Ae.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ae.lastIndex};ke.lastIndex=i;let a=ke.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Pe(s??c??l??``)),i=ke.lastIndex}}function Pe(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return Me.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Fe(e,t),t}function Fe(e,t){for(let n of e)n.type===`element`&&(t.push(n),Fe(n.children,t))}const Ie=/* @__PURE__ */ new Set([`href`,`cite`]),Le=/^https?:\/\//i;function A(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Ie.has(e)&&!Le.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,Ee.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function M(e,t){let n=D(e);return n!==null&&A(n,t)===e}function Re(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function ze(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Re(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const Be={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ve={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},He={post:300,video:200};function Ue(e){let t=Object.entries(e.options).filter(([e])=>e!==`href`);return{kind:`iframe`,src:`https://www.facebook.com/plugins/video.php${a([[`href`,e.url]],t)}`,title:`Facebook video player`,allow:`autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function We(e,t){if(e.variant===`iframe`)return Ue(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ve)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ue({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${j(e.url)}"${ze(Be,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:we(i),minHeight:He[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Ge(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Ke(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Ge(e),l=i===void 0||a!==void 0?void 0:Math.floor(i*s/c);return{position:`relative`,width:r,maxWidth:l===void 0||o!==void 0&&o<l?o:l,...e.messageHeight?{height:n??e.startHeight}:a===void 0?{aspectRatio:`${String(s)} / ${String(c)}`}:{height:a,maxHeight:i},...e.borderRadius===void 0?{}:{borderRadius:e.borderRadius,overflow:`hidden`}}}function qe(e,t){let n=Ge(e),r=Math.round(t*n.height/n.width),i=e.src.indexOf(`?`),a=i===-1?e.src:e.src.slice(0,i),o=i===-1?``:`&${e.src.slice(i+1)}`;return`${a}?width=${String(t)}&height=${String(r)}${o}`}function Je(e,t){let n,r,i=e=>{let i=Math.round(e);i<=0||(clearTimeout(r),i!==n&&(n===void 0?(n=i,t(i)):r=setTimeout(()=>{n=i,t(i)},200)))};if(typeof ResizeObserver>`u`)return i(e.getBoundingClientRect().width),()=>{};let a=new ResizeObserver(e=>{for(let t of e)i(t.contentRect.width)});return a.observe(e),()=>{a.disconnect(),clearTimeout(r)}}const Ye=[`header`,`footer`,`context`],Xe=/\/albums\/\d+$/;function Ze(e,t){let n=Xe.test(e.url),r=Ye.filter(n=>t[n]??e.options[n]===!0),{width:i,height:a}=e.size??{},o=i!==void 0&&a!==void 0?{width:i,height:a}:void 0,s=`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,c={width:4,height:3};return{kind:`iframe`,src:s,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:c,...o?{size:o,maxWidth:o.width}:{},sizeInSrc:{watch:Je,src:e=>qe({src:s,ratio:c,size:o},e)},...e.fallbackHtml===void 0?{}:{fallbackHtml:e.fallbackHtml.replace(/<img(?=[\s>])/g,`<img style="display:block;width:100%;height:100%;object-fit:cover"`)},fallbackImage:!0}}function Qe(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}const $e={origin:`https://imgur.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.message===`resize_imgur`&&typeof t.height==`number`?t.height:void 0},listen:s};function et(e,t){let n=[`pub=true`,...t.context??e.options.context!==!1?[]:[`context=false`],...e.options.analytics===!1?[`analytics=false`]:[]];return{kind:`iframe`,src:`https://imgur.com/${e.id}/embed?${n.join(`&`)}`,title:`Imgur post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:$e,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function tt(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${Re({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:xe,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const nt=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function rt(e,t){let n=[];return t.autoplay!==void 0&&n.push([`autoplay`,t.autoplay]),t.muted!==void 0&&n.push([`muted`,t.muted]),{kind:`iframe`,src:`https://player.kick.com/${e.id}${a(Object.entries(e.options).filter(([e])=>nt.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function it(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const at={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ot={small:236,medium:345,large:600};function st(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${ze(at,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:Te,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:ot[String(n.width)]??236}}const ct={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},lt={origin:`https://embed.reddit.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.type===`resize.embed`&&typeof t.data==`number`?t.data:void 0},listen:s};function ut(e,t){let n=[];for(let[e,r]of Object.entries(ct)){let i=t[e];i!==void 0&&n.push([r,i])}return{kind:`iframe`,src:`https://embed.reddit.com${e.url.slice(22)}${a([[`embed`,!0]],Object.entries(e.options),n)}`,title:`Reddit post`,allow:`clipboard-read; clipboard-write`,sandbox:`allow-scripts allow-same-origin allow-popups`,scrolling:`no`,ratio:{width:1,height:1},messageHeight:lt,startHeight:e.size?.height??316,maxWidth:640}}function dt(e){let t=e.options.title;return{kind:`iframe`,src:`${e.url}/embed`,title:typeof t==`string`&&t!==``?t:`Snapchat`,allow:`autoplay; camera; microphone; clipboard-write;`,scrolling:`no`,ratio:{width:416,height:692},size:e.size,maxWidth:416}}const ft={visual:`visual`,color:`color`,autoPlay:`auto_play`,hideRelated:`hide_related`,showComments:`show_comments`,showUser:`show_user`,showReposts:`show_reposts`,showTeaser:`show_teaser`,showArtwork:`show_artwork`};function pt(e,t){let n=[];for(let[e,r]of Object.entries(ft)){let i=t[e];i!==void 0&&n.push([r,i])}let r=e.size===void 0;return{kind:`iframe`,src:`https://w.soundcloud.com/player/${a([[`url`,e.url]],r?[[`visual`,!0]]:void 0,i(e.options,[`url`,`secret_token`]),n)}`,title:`SoundCloud player`,allow:`autoplay; encrypted-media`,scrolling:`no`,ratio:{width:16,height:9},height:e.size?.height??400}}function mt(e){let t=i(e.options,[]).filter(([e])=>e===`pub`);return{kind:`iframe`,src:`https://rumble.com/embed/${e.id}/${a(t)}`,title:`Rumble video`,allow:`fullscreen`,ratio:{width:16,height:9},size:e.size}}const ht=/* @__PURE__ */ new Set([`track`,`episode`]);function gt(e,t){let n=new URL(e.url).pathname.split(`/`)[1]??``,r=e.kind===`video`,i=a(Object.entries(e.options),t.theme===void 0?void 0:[[`theme`,t.theme]]);return{kind:`iframe`,src:`https://open.spotify.com/embed/${n}/${e.id}${r?`/video`:``}${i}`,title:`Spotify Embed`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,ratio:{width:16,height:9},size:r?e.size:void 0,borderRadius:12,height:r?void 0:e.size?.height??(ht.has(n)?152:352)}}const _t={origin:`https://strava-embeds.com`,read(e){if(!Array.isArray(e))return;let[,t,n]=e;return t===`BROADCAST_IFRAME_HEIGHT`&&typeof n==`number`?n:void 0},listen:s};function vt(e){return e===`minimal`?`minimal`:`standard`}function yt(e,t){let n=e.id.startsWith(`route/`),r=vt(t.embedStyle??e.options.style),i=n&&(t.fullWidth??e.options.fullWidth===!0),a=t.mapHash??e.options.mapHash,o=`?style=${r}${i?`&fullWidth=true`:``}`,s=`#ns=social-embeds${typeof a==`string`&&a!==``?`&mapHash=${encodeURIComponent(a)}`:``}`;return{kind:`iframe`,src:`https://strava-embeds.com/${e.id}${o}${s}`,title:n?`Strava route`:`Strava activity`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:_t,startHeight:650,...i?{}:{maxWidth:554}}}const bt=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),xt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function St(e,t){let n=Object.entries(e.options).filter(([e])=>bt.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,xt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Ct=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function wt(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0},listen:s};function Et(e,t){let{userpic:n,color:r,dark:i,darkColor:o}=t,s={...e.options,...n===void 0?{}:{userpic:n},...r===void 0?{}:{color:r},...i===void 0?{}:{dark:i},...o===void 0?{}:{darkColor:o}},c=[[`embed`,1]];for(let[e,t]of Ct){let n=wt(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Tt,startHeight:300,maxWidth:500}}function Dt(e){return{kind:`iframe`,src:`https://tenor.com/embed/${e.id}`,title:`Tenor GIF`,allow:`fullscreen`,ratio:{width:133,height:100},size:e.size}}function Ot(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${Re({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:Se,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const kt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function At(e,t){let n=o(t,kt);return{kind:`iframe`,src:`https://www.tiktok.com/player/v1/${e.id}${a(Object.entries(e.options),n)}`,title:`TikTok video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share`,ratio:{width:9,height:16},size:e.size,maxWidth:325}}function jt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Mt={origin:`https://truthsocial.com`,read:jt,listen:s},Nt={origin:`https://truthsocial.com`,read(e){let t=jt(e);return t===void 0||t<=0?void 0:t+165},listen:s},Pt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Ft(e){let t=Pt.exec(e.url)?.[1];return t===void 0?{kind:`error`,message:`social-embeds: not a Truth Social post URL: ${e.url}`}:{kind:`iframe`,src:`https://truthsocial.com/${t}/${e.id}/embed`,title:`Truth Social post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:e.options.video===!0?Nt:Mt,startHeight:150,maxWidth:e.size?.width??600}}const It={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0},listen:s};function Lt(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:It,startHeight:400,maxWidth:540}}const Rt=[`channel`,`video`,`collection`,`clip`,`parent`];function zt(e,t){let{hostname:n,pathname:r}=new URL(e);if(n===`clips.twitch.tv`)return[`https://clips.twitch.tv/embed`,[`clip`,t]];let i=r.split(`/`)[1];return[`https://player.twitch.tv/`,i===`videos`?[`video`,`v${t}`]:i===`collections`?[`collection`,t]:[`channel`,t]]}function Bt(e,t){let{autoplay:n,muted:r,time:o}=t,s=[];n!==void 0&&s.push([`autoplay`,String(n)]),r!==void 0&&s.push([`muted`,String(r)]),o!==void 0&&s.push([`time`,o]);let[c,l]=zt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Rt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Vt}}function Vt(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Ht={autopause:`autopause`,autoplay:`autoplay`,background:`background`,byline:`byline`,color:`color`,controls:`controls`,dnt:`dnt`,keyboard:`keyboard`,loop:`loop`,muted:`muted`,pip:`pip`,playsinline:`playsinline`,portrait:`portrait`,quality:`quality`,speed:`speed`,title:`title`,transparent:`transparent`};function Ut(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ht),d=n??s;return{kind:`iframe`,src:`https://player.vimeo.com/video/${e.id}${a(l?[[`h`,l]]:void 0,i(c,[`h`]),u)}${d===void 0?``:`#t=${encodeURIComponent(String(d))}`}`,title:`Vimeo video player`,allow:`autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:{width:16,height:9},size:e.size}}const Wt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Gt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${ze(Wt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ve,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const Kt={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function qt(e){return e.url.startsWith(`https://www.youtube.com/playlist?`)?{path:`videoseries`,key:`list`}:e.url.startsWith(`https://www.youtube.com/channel/`)?{path:`live_stream`,key:`channel`}:{path:e.id}}function Jt(e,t){let{nocookie:n,...r}=t,{nocookie:s,...c}=e.options,l=n??s===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,{path:u,key:d}=qt(e),f=o(r,Kt).filter(([e])=>e!==d);return{kind:`iframe`,src:`${l}/embed/${u}${a(d===void 0?void 0:[[d,e.id]],i(c,d===void 0?[]:[d]),f)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function Yt(e){switch(e.platform){case`x`:return Gt(e,{});case`instagram`:return tt(e,{});case`threads`:return Ot(e,{});case`facebook`:return We(e,{});case`tiktok`:return At(e,{});case`youtube`:return Jt(e,{});case`telegram`:return Et(e,{});case`snapchat`:return dt(e);case`linkedin`:return it(e,{});case`reddit`:return ut(e,{});case`pinterest`:return st(e,{});case`spotify`:return gt(e,{});case`vimeo`:return Ut(e,{});case`twitch`:return Bt(e,{});case`dailymotion`:return d(e,{});case`bluesky`:return l(e,{});case`soundcloud`:return pt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Lt(e);case`kick`:return rt(e,{});case`giphy`:return Qe(e);case`tenor`:return Dt(e);case`streamable`:return St(e,{});case`rumble`:return mt(e);case`truthsocial`:return Ft(e);case`imgur`:return et(e,{});case`strava`:return yt(e,{});case`flickr`:return Ze(e,{});default:return e.platform}}const Xt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=Xt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&`,`&`).split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=Zt(t===-1?e:e.slice(0,t)),r=Zt(t===-1?``:e.slice(t+1));if(n===null||r===null)return null;o.has(n)||o.set(n,r)}return{host:n.toLowerCase(),path:r,query:o,...a?{fragment:a}:{}}}function Zt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t){return{...e,...t}}function z(e,t){return e===t||e.startsWith(`${t}/`)}function B(e,t,n){let r={};for(let[i,a]of t){let t=e.attrs.get(i);t!==void 0&&!(a in r)&&(r[a]=n(t))}return r}function V(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function H(e,t){return t?{...e,size:t}:e}function U(e,t){if(e.tag!==`div`||e.attrs.size!==1)return null;let[,n]=t.exec(e.attrs.get(`style`)??``)??[];if(n===void 0)return null;let r;for(let t of e.children)if(!(t.type===`text`&&/^\s*$/.test(t.raw))){if(t.type!==`element`||t.tag!==`iframe`||r)return null;r=t}let i=Math.round(Number(n)*100);if(!r||!(i>0&&i<=1e5))return null;let a=Qt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Qt(e,t){return t===0?e:Qt(t,e%t)}const $t=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),en=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),tn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),W=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),nn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),G=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),rn=/* @__PURE__ */ new Set([`player.kick.com`]),an=`embed.music.apple.com`,on=`embed.podcasts.apple.com`,sn=e=>en.has(e.host)||$t.has(e.host)&&z(e.path,`/embed`),cn=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||tn.has(e.host)&&(z(e.path,`/embed`)||z(e.path,`/video`)),ln=e=>W.has(e.host)&&z(e.path,`/player`),un=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&z(e.path,`/embed`),dn=e=>e.host===`player.vimeo.com`,fn=e=>nn.has(e.host)&&z(e.path,`/plugins`),pn=e=>G.has(e.host)&&z(e.path,`/embed`),mn=e=>rn.has(e.host),hn=e=>e.host===`www.linkedin.com`&&z(e.path,`/embed`),gn=e=>e.host===`assets.pinterest.com`,_n=e=>e.host===an,vn=e=>e.host===on,yn=e=>e.host===`w.soundcloud.com`,bn=e=>e.host===`open.spotify.com`&&z(e.path,`/embed`),xn=e=>e.host===`rumble.com`&&z(e.path,`/embed`),Sn=e=>e.host===`streamable.com`&&(z(e.path,`/e`)||z(e.path,`/o`)),Cn=e=>e.host===`tenor.com`&&z(e.path,`/embed`),wn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function Tn(e){return[sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn].some(t=>t(e))}const En=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],Dn=/* @__PURE__ */ new Set([`allow-downloads`,`allow-forms`,`allow-modals`,`allow-orientation-lock`,`allow-pointer-lock`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-presentation`,`allow-same-origin`,`allow-scripts`,`allow-top-navigation`,`allow-top-navigation-by-user-activation`,`allow-top-navigation-to-custom-protocols`]),On=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),kn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,An=/* @__PURE__ */ RegExp(`^(?:https:)?//${kn}(?:[/?#]|$)`,`i`),jn=/* @__PURE__ */ RegExp(`^(?:\\*|'self'|'src'|'none'|https://${kn})$`,`i`),Mn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Nn=/[\t\n\f\r ]+/,Pn=/^\s*(width|height)\s*:(.*)$/is,Fn=/^(\d+)px$/i,In=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function Ln(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=V(r)??Kn(r);return zn({src:o.get(`src`),title:o.get(`title`),allow:o.get(`allow`),allowFullscreen:o.has(`allowfullscreen`),referrerPolicy:o.get(`referrerpolicy`),sandbox:o.get(`sandbox`),scrolling:o.get(`scrolling`),size:s??{},ratio:s?void 0:a&&U(a,In)?.size})}function Rn(e){return zn(e)}function zn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Bn(t.src);if(n===null)return null;let r=typeof t.title==`string`?t.title.trim():``,i=typeof t.referrerPolicy==`string`?t.referrerPolicy.toLowerCase():void 0,a=En.find(e=>e===i),o=Un(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Vn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Hn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Gn(t.size),...o?{ratio:o}:{}}}function Bn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=An.test(t)&&!t.includes(`\\`)?F(t):null;return!n||Mn.test(n.path)||Tn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Vn(e){return e.split(`;`).map(e=>e.split(Nn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&On.has(e)&&t.every(e=>jn.test(e))).map(e=>e.join(` `)).join(`; `)}function Hn(e){let t=e.split(Nn).map(e=>e.toLowerCase()).filter(e=>Dn.has(e));return[...new Set(t)].join(` `)}function Un(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Wn(t)&&Wn(n)?{width:t,height:n}:void 0}function Wn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Gn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?L(String(t)):void 0,i=typeof n==`number`?L(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Kn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Pn.exec(r)??[],a=L(Fn.exec(i.trim())?.[1]);e.toLowerCase()===`width`&&(t=a),e.toLowerCase()===`height`&&(n=a)}return t===void 0&&n===void 0?void 0:{width:t,height:n}}const qn={width:16,height:9};function Jn(e){let t=Rn(e);return t?{kind:`iframe`,src:t.src,title:t.title??`Embedded content`,allow:t.allow,allowFullscreen:t.allowFullscreen,...t.referrerPolicy?{referrerPolicy:t.referrerPolicy}:{},...t.sandbox===void 0?{}:{sandbox:t.sandbox},...t.scrolling?{scrolling:t.scrolling}:{},...Yn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Yn({size:e,ratio:t}){let{width:n,height:r}=e;return n!==void 0&&r!==void 0?{ratio:{width:n,height:r},maxWidth:n}:r===void 0?{ratio:t??qn,...n===void 0?{}:{maxWidth:n}}:{ratio:qn,height:r}}const Xn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Qn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,$n=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),er=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function tr(e){let t=typeof e==`string`?F(e):null;return t?nr(t)?`rumble`:rr(t)?`bluesky`:null:null}function nr(e){return $n.has(e.host)&&er.test(e.path)}function rr(e){if(!Xn.has(e.host))return!1;let[,t]=Zn.exec(e.path)??[];return t!==void 0&&Qn.test(t)}const ir=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,ar=/^\d{1,15}$/;function or(e,t){if(e?.host!==t)return null;let[,n,r,i]=ir.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!ar.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!ar.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const sr=/* @__PURE__ */ R({platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],match(e){let t=or(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:_n},{parse(e){if(e.tag!==`iframe`)return null;let t=or(F(e.attrs.get(`src`)??``),an);if(!t)return null;let{height:n}=V(e)??{};return H({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1}),cr=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,lr=/^\d{1,15}$/;function ur(e,t){if(e?.host!==t)return null;let[,n,r]=cr.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!lr.test(i)?null:{platform:`applepodcasts`,kind:`post`,url:`https://podcasts.apple.com/${n}/podcast/id${r}${i?`?i=${i}`:``}`,id:i??r,variant:`iframe`}}const dr=/* @__PURE__ */ R({platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],match(e){let t=ur(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:vn},{parse(e){if(e.tag!==`iframe`)return null;let t=ur(F(e.attrs.get(`src`)??``),on);return t&&H({...t,options:{}},V(e))},isOwnScript:()=>!1}),fr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,pr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,mr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),hr=/* @__PURE__ */ RegExp(`^/profile/${fr}/post/${pr}/?$`),gr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function _r(e,t){return{platform:`bluesky`,kind:`post`,url:`https://bsky.app/profile/${e}/post/${t}`,id:`${e}/app.bsky.feed.post/${t}`,variant:`iframe`}}function vr(e){if(!e||!mr.has(e.host))return null;let[,t,n]=hr.exec(e.path)??[];return t===void 0||n===void 0?null:_r(t,n)}const yr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:rr,trustsFallback:e=>M(e,gr),match(e){let t=vr(e);return t&&{...t,options:{}}}},br=/* @__PURE__ */ RegExp(`^at://${fr}/app\\.bsky\\.feed\\.post/${pr}$`),xr=/^[a-z2-7]{20,100}$/,Sr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Cr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,wr=/* @__PURE__ */ R(yr,{parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=br.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=_r(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?vr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&xr.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&Sr.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:A(e.children,gr)}},isOwnScript:e=>Cr.test(e)}),Tr=/^x[a-z0-9]{4,12}$/,Er=/^x[a-z0-9]{3,12}$/;function Dr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Or(e){if(e.host!==`geo.dailymotion.com`||e.query.has(`playlist`))return null;let t=/^\/player(?:\/([a-z0-9]+))?\.html$/.exec(e.path);if(!t)return null;let[,n]=t,r=e.query.get(`video`)??``;if(!Tr.test(r)||n!==void 0&&!Er.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),Dr(r,i)}function kr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Tr.test(t)?Dr(t,{}):null}if(!tn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Tr.test(t)?Dr(t,{}):null}const Ar={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],match(e){return Or(e)??kr(e)},ownsFrame:cn},jr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Mr=/* @__PURE__ */ R(Ar,{parse(e){let t=U(e,jr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=Or(r)??kr(r);return i&&H(i,t?.size??V(n))},isOwnScript:()=>!1}),Nr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),K=`https://www.facebook.com`,Pr=`[A-Za-z0-9.\\-]{1,80}`,Fr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Ir=/* @__PURE__ */ RegExp(`^/(${Pr})/posts/(${Fr})/?$`),Lr=/* @__PURE__ */ RegExp(`^/(${Pr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Rr=/* @__PURE__ */ RegExp(`^/(${Pr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),zr=/^\/reel\/(\d{1,25})\/?$/,Br=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Vr=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Hr=/* @__PURE__ */ RegExp(`^${Fr}$`),Ur=/^\d{1,25}$/,Wr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Gr=/* @__PURE__ */ new Map([[`div`,[Wr]],[`blockquote`,[`cite`,Wr]],[`a`,[`href`]],[`p`,[]]]);function Kr(e){if(!e||!Nr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Ir.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${K}/${r}/posts/${i}`};if(Br.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Hr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Ur.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${K}${t}?story_fbid=${e}${i}`}}if(Vr.has(t)){let e=n.get(`fbid`);return e===void 0||!Ur.test(e)?null:{kind:`post`,id:e,url:`${K}${t}?fbid=${e}`}}let[,a,o,s]=Lr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${K}/${a}/photos/${o}/${s}/`};let[,c,l]=Rr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${K}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Ur.test(e)?null:{kind:`video`,id:e,url:`${K}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=zr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${K}/reel/${u}`}}function q(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const qr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>M(e,Gr),match(e){let t=Kr(e);return t&&q(t,t.kind,`sdk`,{})},ownsFrame:fn},Jr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Yr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Xr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Zr=/* @__PURE__ */ R(qr,{parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=Kr(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...q(n,t,`sdk`,B(e,Yr,I)),fallbackHtml:A(e.children,Gr)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!nn.has(t.host))return null;let n=Kr(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),q(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Xr){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return H(q(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return H(q(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),V(e))}return null},isOwnScript:e=>Jr.test(e),scriptOptions(e){let[,t]=Jr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0}),Qr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),$r=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,ei=`(\\d{1,20})`,ti=/* @__PURE__ */ RegExp(`^/photos/${$r}/${ei}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),ni=/* @__PURE__ */ RegExp(`^/photos/${$r}/(?:albums|sets)/${ei}/?$`),ri=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,ii=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,ai=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,oi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:ai},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function si(e){if(e===``)return null;let t=0n;for(let n of e){let e=ii.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function ci(e){let t=BigInt(e),n=``;for(;t>0n;)n=ii.charAt(Number(t%58n))+n,t/=58n;return n}function li(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function ui(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function di(e){if(!e||!Qr.has(e.host))return null;let[,t,n]=ni.exec(e.path)??[];if(t!==void 0&&n!==void 0)return ui(t,n);let[,r,i]=ti.exec(e.path)??[];return r===void 0||i===void 0?null:li(r,i)}function fi(e){if(e.host!==`flic.kr`)return null;let[,t]=ri.exec(e.path)??[],n=t===void 0?null:si(t);return t===void 0||n===null||ci(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}const pi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>M(e,oi),match(e){let t=di(e)??fi(e);return t&&{...t,options:{}}}},mi=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,hi=[`header`,`footer`,`context`];function gi(e){let t=null;for(let n of e.children)if(!(n.type===`text`&&/^\s*$/.test(n.raw))){if(n.type!==`element`||n.tag!==`img`||t)return null;t=n}return t}const _i=/* @__PURE__ */ R(pi,{parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=di(F(e.attrs.get(`href`)??``)),n=gi(e);if(!t||!n)return null;let r={};for(let t of hi)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=V(n),a=ai.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return H({...t,options:r,fallbackHtml:A([a],oi)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>mi.test(e)}),J=`([A-Za-z0-9]{6,40})`,vi=/* @__PURE__ */ RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${J}/?$`),yi=/* @__PURE__ */ RegExp(`^/embed/${J}/?$`),bi=/^(?:media\d?|i)\.giphy\.com$/,xi=`\\.(?:gif|webp|mp4)`,Si=/* @__PURE__ */ RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${J}/[A-Za-z0-9_-]{1,40}${xi}$`),Ci=/* @__PURE__ */ RegExp(`^/${J}${xi}$`);function wi(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Ti(e){if(e){if(G.has(e.host))return(vi.exec(e.path)??yi.exec(e.path))?.[1];if(bi.test(e.host))return(Si.exec(e.path)??(e.host===`i.giphy.com`?Ci.exec(e.path):null))?.[1]}}const Ei={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],match(e){let t=Ti(e);return t===void 0?null:{...wi(t),options:{}}},ownsFrame:pn},Di=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function Oi(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!G.has(t.host))return null;let[,n]=yi.exec(t.path)??[];return n===void 0?null:wi(n)}function ki(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!G.has(i.host)||vi.exec(i.path)?.[1]!==t.id)return!1;let[a,...o]=n.children;return o.length===0&&a?.type===`text`&&a.raw.trim()===`via GIPHY`}const Ai=/* @__PURE__ */ R(Ei,{parse(e){let t=U(e,Di),n=t?.iframe??e,r=Oi(n);return r?H({...r,options:{}},t?.size??V(n)):null},isOwnScript:()=>!1,isOwnExtra:ki}),ji=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),Y=`([A-Za-z0-9]{5,7})`,Mi=/* @__PURE__ */ RegExp(`^/a/${Y}/?$`),Ni=/* @__PURE__ */ RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${Y}/?$`),Pi=/* @__PURE__ */ RegExp(`^/${Y}/?$`),Fi=/* @__PURE__ */ RegExp(`^/${Y}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Ii=/* @__PURE__ */ new Set([`about`,`apps`,`blog`,`help`,`jobs`,`login`,`press`,`privacy`,`random`,`search`,`signin`,`signup`,`terms`,`tools`,`upload`,`account`,`contact`,`emerald`,`explore`,`gallery`,`hot`,`new`,`rules`,`user`]),Li=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Ri(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function zi(e){return e===void 0||Ii.has(e.toLowerCase())?void 0:e}function Bi(e){if(!e)return;if(e.host===`i.imgur.com`)return zi(Fi.exec(e.path)?.[1]);if(!ji.has(e.host))return;let t=(Mi.exec(e.path)??Ni.exec(e.path))?.[1];return t===void 0?zi(Pi.exec(e.path)?.[1]):`a/${t}`}const Vi={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>M(e,Li),match(e){let t=Bi(e);return t===void 0?null:{...Ri(t),options:{}}}},Hi=/* @__PURE__ */ RegExp(`^(a/)?${Y}$`),Ui=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/;function Wi(e){return e.map(e=>{if(e.type!==`element`)return e;let t=e.attrs.get(`href`),n=new Map(e.attrs);return e.tag===`a`&&t?.startsWith(`//`)&&n.set(`href`,`https:${t}`),{...e,attrs:n,children:Wi(e.children)}})}function Gi(e,t){return e.attrs.get(t)===`false`}const Ki=/* @__PURE__ */ R(Vi,{parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Hi.exec(t)??[];if(r===void 0||n===void 0&&!zi(r))return null;let i={};return Gi(e,`data-context`)&&(i.context=!1),Gi(e,`data-analytics`)&&(i.analytics=!1),{...Ri(t),options:i,fallbackHtml:A(Wi(e.children),Li)}},isOwnScript:e=>Ui.test(e)}),qi=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Ji=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Yi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Xi=/* @__PURE__ */ new Set([`p`,`reel`]),Zi=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Qi(e){if(!e||!qi.has(e.host))return null;let[,t,n,r]=Ji.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Yi.has(t)||!Xi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const $i={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>M(e,Zi),match(e){let t=Qi(e);return t&&{...t,options:{}}}},ea=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,ta=/* @__PURE__ */ R($i,{parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?Qi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Qi(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:A(e.children,Zi)}},isOwnScript:e=>ea.test(e)}),na=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),ra=/^\/([A-Za-z0-9_-]{1,32})\/?$/,ia=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]);function aa(e,t){if(!e||!t.has(e.host))return null;let[,n]=ra.exec(e.path)??[];if(n===void 0||ia.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const oa={platform:`kick`,name:`Kick`,shapes:[`video iframe`],match(e){let t=aa(e,na)??aa(e,rn);return t&&{...t,options:{}}},ownsFrame:mn},sa=/* @__PURE__ */ new Set([`autoplay`,`muted`]),ca=/* @__PURE__ */ R(oa,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=aa(t,rn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>sa.has(e)).map(([e,t])=>[e,I(t)]));return H({...n,options:r},V(e))},isOwnScript:()=>!1}),la=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,ua=`(activity|share|ugcPost):(\\d{19})`,da=/* @__PURE__ */ RegExp(`^(?:/embed)?/feed/update/urn:li:${ua}/?$`),fa=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`);function pa(e,t,n={}){let r=`urn:li:${e}:${t}`;return{platform:`linkedin`,kind:`post`,url:`https://www.linkedin.com/feed/update/${r}/`,id:r,variant:`iframe`,options:n}}const ma=e=>e.replace(/%3A/gi,`:`),ha={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],match(e){if(!la.test(e.host))return null;let t=ma(e.path),[,n,r]=da.exec(t)??fa.exec(t)??[];return n===void 0||r===void 0?null:pa(n,r)},ownsFrame:hn},ga=/* @__PURE__ */ RegExp(`^/embed/feed/update/urn:li:${ua}$`),_a=/* @__PURE__ */ R(ha,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=ga.exec(t.path)??[];return n===void 0||r===void 0?null:H(pa(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),V(e))},isOwnScript:()=>!1}),va=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ya=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/;function ba(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function xa(e){if(!e||!va.test(e.host))return null;let[,t]=ya.exec(e.path)??[];return t===void 0?null:ba(t)}const Sa={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],match(e){let t=xa(e);return t&&{...t,options:{}}},ownsFrame:gn},Ca=/^\d{1,25}$/,wa=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Ta=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]],Ea=/* @__PURE__ */ R(Sa,{parse(e){if(e.tag===`a`){if(e.attrs.get(`data-pin-do`)!==`embedPin`||e.children.some(e=>e.type===`element`))return null;let t=xa(F(e.attrs.get(`href`)??``));return t&&{...t,options:B(e,Ta,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Ca.test(n)?{...ba(n),options:{}}:null},isOwnScript:e=>wa.test(e)}),Da=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Oa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/;function ka(e){if(!e||!Da.has(e.host))return null;let[,t,n,r,i]=Oa.exec(e.path)??[];if(t===void 0||n===void 0)return null;let a={platform:`reddit`,kind:`post`,variant:`iframe`},o=`https://www.reddit.com/r/${t}/comments/${n}/`;return i===void 0?{...a,url:o,id:n}:r===void 0?null:{...a,url:`${o}comment/${i}/`,id:i}}const Aa={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],match(e){let t=ka(e);return t&&{...t,options:{}}}},ja=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,Ma=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,Na=/* @__PURE__ */ [`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]),Pa=/* @__PURE__ */ R(Aa,{parse(e){if(e.tag!==`blockquote`||!(O(e,`reddit-embed-bq`)||O(e,`reddit-card`)))return null;let t=k(e.children).map(e=>e.tag===`a`?ka(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return H({...t,options:B(e,Na,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>ja.test(e)||Ma.test(e)}),Fa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ia=`([A-Za-z][A-Za-z0-9._-]{1,29})`,La=/* @__PURE__ */ RegExp(`^(?:/@${Ia})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Ra=/* @__PURE__ */ RegExp(`^/(?:@|add/)${Ia}$`),za=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,Ba=/* @__PURE__ */ RegExp(`^/@${Ia}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`);function Va(e){if(!e||!Fa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=La.exec(t)??[];if(i!==void 0){let e=r===void 0?``:`/@${r}`;return{...n,kind:`video`,url:`https://www.snapchat.com${e}/spotlight/${i}`,id:i}}let[,a]=Ra.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=za.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=Ba.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Ha={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],match(e){let t=Va(e);return t&&{...t,options:{}}}},Ua=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/,Wa=/* @__PURE__ */ R(Ha,{parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=Va({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Va(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return H({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Ua.test(e)}),Ga=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ka=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,qa=`[a-z0-9_-]{1,64}`,Ja=`s-[A-Za-z0-9]{1,32}`,Ya=/* @__PURE__ */ RegExp(`^/(${qa})(?:/(sets/${qa}|${qa})(?:/(${Ja}))?)?/?$`,`i`),Xa=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Za=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Qa=/* @__PURE__ */ RegExp(`^${Ja}$`);function $a(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function eo(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ka.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Qa.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return $a(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function to(e){if(!Ga.has(e.host))return null;let[,t,n,r]=Ya.exec(e.path)??[];if(t===void 0||Xa.has(t.toLowerCase())||n!==void 0&&Za.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return $a(`https://soundcloud.com/${i}`,i)}const no={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],match(e){let t=eo(e)??to(e);return t&&{...t,options:{}}},ownsFrame:yn},ro=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function io(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ro.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Ga.has(F(e.attrs.get(`href`)??``)?.host??``)}function ao(e){if(e.tag!==`div`||e.attrs.size!==1||!e.attrs.has(`style`))return!1;let[t,n,r,...i]=e.children;return i.length===0&&io(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&io(r)}const oo=/* @__PURE__ */ R(no,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=eo(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Qa.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=V(e)??{};return H({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:ao}),so=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,co=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function lo(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function uo(e,t){return e&&t.has(e.host)?so.exec(e.path)?.[1]:void 0}const fo=/* @__PURE__ */ R({platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:nr,match(e){let t=uo(e,co);return t===void 0?null:{...lo(t),options:{}}},ownsFrame:xn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=uo(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=I(i)),H({...lo(n),options:r},V(e))},isOwnScript:()=>!1}),po=/* @__PURE__ */ RegExp(`^(?:/intl-[a-z]{2}(?:-[A-Za-z]{2})?)?(?:/embed)?/(track|album|playlist|artist|episode|show|audiobook|chapter)/([A-Za-z0-9]{22})(/video)?/?$`),mo=/* @__PURE__ */ new Set([`utm_source`,`si`]);function ho(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=po.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`spotify`,kind:r?`video`:`post`,url:`https://open.spotify.com/${t}/${n}`,id:n,variant:`iframe`,query:e.query}}function go(e){return Object.fromEntries([...e].filter(([e])=>!mo.has(e)).map(([e,t])=>[e,I(t)]))}const _o=/* @__PURE__ */ R({platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],match(e){let t=ho(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:bn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=ho(t);if(!n)return null;let{query:r,...i}=n;return H({...i,options:go(r)},V(e))},isOwnScript:()=>!1}),vo=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),yo=/^\/(activities|routes)\/(\d{1,20})\/?$/,bo={activity:`activities`,route:`routes`};function xo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${bo[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}const So={platform:`strava`,name:`Strava`,shapes:[`post iframe`],match(e){if(!vo.has(e.host))return null;let[,t,n]=yo.exec(e.path)??[];return t===void 0||n===void 0?null:{...xo(t===`routes`?`route`:`activity`,n),options:{}}}},Co=/^\d{1,20}$/,wo=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,To=/* @__PURE__ */ new Set([`standard`,`minimal`]),Eo=/^[A-Za-z0-9_-]{1,100}$/;function Do(e){return e===`activity`||e===`route`}const Oo=/* @__PURE__ */ R(So,{parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!Do(t)||!Co.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&To.has(i)&&(r.style=i),t===`route`&&e.attrs.get(`data-full-width`)===`true`&&(r.fullWidth=!0);let a=e.attrs.get(`data-map-hash`);return a!==void 0&&Eo.test(a)&&(r.mapHash=a),{...xo(t,n),options:r}},isOwnScript:e=>wo.test(e)}),ko=`([a-z0-9]{4,8})`,Ao=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),jo=/* @__PURE__ */ RegExp(`^/[eo]/${ko}$`),Mo=/* @__PURE__ */ RegExp(`^/${ko}/?$`),No=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]);function Po(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function Fo(e){return e!==void 0&&!No.has(e)}function Io(e){if(!e||!Ao.has(e.host))return;let t=(jo.exec(e.path)??Mo.exec(e.path))?.[1];return Fo(t)?t:void 0}const Lo={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],match(e){let t=Io(e);return t===void 0?null:{...Po(t),options:{}}},ownsFrame:Sn},Ro=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,zo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),Bo=/<\/div\s*>$/i;function Vo(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=jo.exec(t.path)??[];if(!Fo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>zo.has(e)).map(([e,t])=>[e,I(t)]));return{...Po(n),options:r}}const Ho=/* @__PURE__ */ R(Lo,{parse(e){let t=U(e,Ro),n=t?.iframe??e,r=Vo(n);return r?H(r,t?.size??V(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=Bo.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null}}),Uo=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Wo=`[A-Za-z][A-Za-z0-9_]{2,31}`,Go=/* @__PURE__ */ RegExp(`^/(?:s/)?(${Wo})/(\\d{1,10})/?$`);function Ko(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const qo={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],match(e){if(!Uo.has(e.host))return null;let[,t,n]=Go.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r={};e.query.has(`single`)&&(r.single=!0);let i=e.query.get(`comment`);return i!==void 0&&/^\d{1,10}$/.test(i)&&(r.comment=Number(i)),Ko(t,n,r)}},Jo=/* @__PURE__ */ RegExp(`^(${Wo})/(\\d{1,10})$`),Yo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Xo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Zo=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]],Qo=/* @__PURE__ */ R(qo,{parse:()=>null,parseScript(e){if(!Yo.test(e.attrs.get(`src`)??``)||Xo.some(t=>e.attrs.has(t)))return null;let[,t,n]=Jo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=B(e,Zo,I);return e.attrs.has(`data-single`)&&(r.single=!0),Ko(t,n,r)},isOwnScript:e=>Yo.test(e)}),$o=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),es=`(\\d{1,20})`,ts=/* @__PURE__ */ RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${es}/?$`),ns=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function rs(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function is(e){return e&&$o.has(e.host)?ts.exec(e.path)?.[1]:void 0}const as={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>M(e,ns),match(e){let t=is(e);return t===void 0?null:{...rs(t),options:{}}},ownsFrame:Cn},os=/* @__PURE__ */ RegExp(`^/embed/${es}$`),ss=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,cs=/^\d{1,3}(?:\.\d{1,20})?$/;function ls(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=us(t,1e4);return{width:t/n,height:1e4/n}}function us(e,t){return t===0?e:us(t,e%t)}function ds(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!(/* @__PURE__ */ RegExp(`^(\\d{1,20})$`)).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!cs.test(n))return null;let r=ls(n===void 0?1.33:Number(n));return r?H({...rs(t),options:{},fallbackHtml:A(e.children,ns)},r):null}function fs(e){let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=os.exec(t.path)??[];return n===void 0?null:H({...rs(n),options:{}},V(e))}const ps=/* @__PURE__ */ R(as,{parse(e){return e.tag===`div`?ds(e):e.tag===`iframe`?fs(e):null},isOwnScript:e=>ss.test(e)}),ms=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),hs=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,gs=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function _s(e){if(!e||!ms.has(e.host))return null;let[,t]=hs.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const vs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>M(e,gs),match(e){let t=_s(e);return t&&{...t,options:{}}}},ys=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,bs=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],xs=/* @__PURE__ */ R(vs,{parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=_s(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:B(e,bs,I),fallbackHtml:A(e.children,gs)}},isOwnScript:e=>ys.test(e)}),Ss=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/;function Cs(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ws={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],match(e){if(!W.has(e.host))return null;let[,t,n]=Ss.exec(e.path)??[];return t===void 0||n===void 0?null:Cs(n,t)},ownsFrame:ln},Ts=/^\/player\/v1\/(\d{1,25})\/?$/,Es=/^\d{1,25}$/,Ds=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/,Os=/* @__PURE__ */ R(ws,{parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&W.has(t.host)?Ss.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Es.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Cs(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=Ts.exec(t.path)??[];return n===void 0?null:H(Cs(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),V(e))},isOwnScript:e=>Ds.test(e)}),ks=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),As=`(@[A-Za-z0-9_.-]{1,64})`,js=`(\\d{1,25})`,Ms=/* @__PURE__ */ RegExp(`^/${As}/(?:posts/)?${js}/?$`);function Ns(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function Ps(e){if(!e||!ks.has(e.host))return null;let[,t,n]=Ms.exec(e.path)??[];return t===void 0||n===void 0?null:Ns(t,n)}const Fs={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],match(e){let t=Ps(e);return t&&{...t,options:{}}},ownsFrame:wn},Is=/* @__PURE__ */ RegExp(`^/${As}/${js}/embed$`),Ls=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/,Rs=/* @__PURE__ */ R(Fs,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=Is.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return H({...Ns(n,r),options:i},V(e))},isOwnScript:e=>Ls.test(e)}),zs=`([a-z0-9-]{1,32})`,X=`(\\d{1,20})`,Bs=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),Vs=/* @__PURE__ */ RegExp(`^/${zs}/${X}(?:/[^/]{1,200})?/?$`),Hs=/* @__PURE__ */ RegExp(`^${zs}\\.tumblr\\.com$`),Us=/* @__PURE__ */ RegExp(`^/post/${X}(?:/[^/]{1,200})?/?$`),Ws=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]);function Gs(e){if(!e)return null;let t,n;return Bs.has(e.host)?[,t,n]=Vs.exec(e.path)??[]:([,t]=Hs.exec(e.host)??[],[,n]=Us.exec(e.path)??[]),t===void 0||n===void 0||Ws.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Ks={platform:`tumblr`,name:`Tumblr`,shapes:[`post iframe`],match(e){let t=Gs(e);return t&&{...t,options:{}}}},qs=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${zs})/${X}/v2$`),Js=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${X}$`),Ys=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/,Xs=/* @__PURE__ */ R(Ks,{parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=qs.exec(t.path)??[],i=r??Js.exec(t.path)?.[1];if(i===void 0)return null;let[a,...o]=e.children.filter(e=>e.type!==`text`||e.raw.trim()!==``);if(o.length>0||a?.type!==`element`||a.tag!==`a`)return null;let s=Gs(F(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>Ys.test(e)}),Zs=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),Qs=/^[A-Za-z0-9_]{3,25}$/,$s=/^v?(\d{1,12})$/,ec=/^[A-Za-z0-9_-]{6,30}$/,tc=/^[A-Za-z0-9_-]{6,100}$/,nc=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,rc=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]);function Z(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const ic=e=>Z(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),ac=e=>Z(`https://www.twitch.tv/videos/${e}`,e),oc=e=>Z(`https://www.twitch.tv/collections/${e}`,e),sc=e=>Z(`https://clips.twitch.tv/${e}`,e);function cc(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return tc.test(t)?{found:sc(t),options:{}}:null}if(!Zs.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=$s.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:ac(t),options:n!==void 0&&nc.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?ec.test(r??``)?{found:oc(r??``),options:{}}:null:t.length===3&&r===`clip`?Qs.test(n)&&tc.test(i??``)?{found:sc(i??``),options:{}}:null:t.length===1&&Qs.test(n)&&!rc.has(n.toLowerCase())?{found:ic(n),options:{}}:null}const lc={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],match(e){let t=cc(e);return t&&{...t.found,options:t.options}},ownsFrame:un},uc=[`autoplay`,`muted`,`time`];function dc(e){let t={};for(let n of uc){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function fc(e){let t=e.query.get(`channel`);if(t!==void 0)return Qs.test(t)?ic(t):null;let[,n]=$s.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return ac(n);let r=e.query.get(`collection`);return r!==void 0&&ec.test(r)?oc(r):null}const pc=/* @__PURE__ */ R(lc,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=fc(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=tc.test(e)?sc(e):null}return n&&H({...n,options:dc(t.query)},V(e))},isOwnScript:()=>!1}),mc=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Q=`(\\d{1,12})`,hc=`([0-9a-f]{6,20})`,gc=[RegExp(`^/${Q}(?:/${hc})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Q}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Q}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Q}/?$`)],_c=/* @__PURE__ */ RegExp(`^/video/${Q}/?$`),vc=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),yc=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function bc(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function xc(e){let[,t]=yc.exec(e.fragment??``)??[];return t?{t}:{}}function Sc(e){if(!e||!mc.has(e.host))return null;for(let t of gc){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return bc(n,r)}return null}function Cc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=_c.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${hc}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!vc.has(e)).map(([e,t])=>[e,I(t)]));return{...bc(t,n),options:{...r,...xc(e)}}}const wc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],match(e){let t=Cc(e);if(t)return t;let n=Sc(e);return n&&{...n,options:xc(e)}},ownsFrame:dn},Tc=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Ec=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/;function Dc(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=F(e.attrs.get(`href`)??``);return n!==null&&mc.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function Oc(e,t){return e?.type===`text`&&e.raw.trim()===t}function kc(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,r,i,a,o,s,...c]=e.children;return c.length===0&&Dc(n,e=>Sc(e)?.id===t.id)&&Oc(r,`from`)&&Dc(i,()=>!0)&&Oc(a,`on`)&&Dc(o,e=>e.path===``||e.path===`/`)&&Oc(s,`.`)}const Ac=/* @__PURE__ */ R(wc,{parse(e){let t=U(e,Tc),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Cc(F(n.attrs.get(`src`)??``));return r&&H(r,t?.size??V(n))},isOwnScript:e=>Ec.test(e),isOwnExtra:kc}),jc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Mc=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Nc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,Pc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Fc(e,t=Mc){if(!e||!jc.has(e.host))return null;let[,n=`i`,r]=t.exec(e.path)??[];return r===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${n}/status/${r}`,id:r,variant:`sdk`}}function Ic(e){return k(e).reverse().map(e=>e.tag===`a`?Fc(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)??null}function Lc(e,t){return Ic(D(e)??[])?.id===t}const Rc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>M(e,Pc)&&Lc(e,t.id),match(e){let t=Fc(e,Nc);return t&&{...t,options:{}}}},zc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Bc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Vc=/* @__PURE__ */ R(Rc,{parse(e){if(e.tag!==`blockquote`||!(O(e,`twitter-tweet`)||O(e,`twitter-video`)))return null;let t=Ic(e.children);return t?{...t,options:B(e,Bc,I),fallbackHtml:A(e.children,Pc)}:null},isOwnScript:e=>zc.test(e)}),Hc=`https://www.youtube.com`,Uc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,Wc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,Gc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,Kc=/^\/([A-Za-z0-9_-]{11})\/?$/,qc=/^[A-Za-z0-9_-]{10,64}$/,Jc=/^UC[A-Za-z0-9_-]{22}$/,Yc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,Xc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,Zc=/^t=(.+)$/;function Qc(e){if(e===void 0||e===``)return;let t=Xc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function $c(e){return Qc(e.get(`start`))??Qc(e.get(`t`))}function el(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function tl(e,t=!1){return el(e,t?`${Hc}/shorts/${e}`:`${Hc}/watch?v=${e}`)}function nl(e){return e!==void 0&&qc.test(e)?el(e,`${Hc}/playlist?list=${e}`):null}function rl(e){return e!==void 0&&Jc.test(e)?el(e,`${Hc}/channel/${e}/live`):null}function il(e){let[,t,n]=Wc.exec(e.path)??[];if(n!==void 0)return{found:tl(n)};if(t===`videoseries`){let t=nl(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=rl(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function al(e,t){let n=$c(e.query)??Qc(Zc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const ol=[Vc,ta,Zr,xs,Os,/* @__PURE__ */ R({platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],match(e){if(e.host===`youtu.be`){let[,t]=Kc.exec(e.path)??[];return t===void 0?null:{...tl(t),options:al(e,!1)}}let t=en.has(e.host);if(!t&&!$t.has(e.host))return null;let n=al(e,t);if(z(e.path,`/embed`)){let t=il(e);return t&&{...t.found,options:n}}if(t)return null;if(/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&Uc.test(t)?{...tl(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=nl(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=Yc.exec(e.path)??[],i=rl(r);if(i)return{...i,options:n};let[,a,o]=Gc.exec(e.path)??[];return a===void 0||o===void 0?null:{...tl(o,a===`shorts`),options:n}},ownsFrame:sn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&en.has(t.host);if(!t||!(n||$t.has(t.host)))return null;let r=il(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=$c(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),H({...r.found,options:a},V(e))},isOwnScript:()=>!1}),Qo,Wa,_a,Pa,Ea,_o,Ac,pc,Mr,oo,sr,dr,ca,Ai,ps,Ho,fo,Rs,Ki,Oo,_i,wr,Xs];function sl(e){return ol.find(t=>t.platform===e)}function cl(e){return ll(ol,e)}function ll(e,t){let n=dl(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function ul(e,t){let n=dl(t);return n&&e.match(n)}function dl(e){return typeof e==`string`?F(e):null}function fl(e,t){if(t.platform!==e.platform)return null;let n=ul(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!e.shapes.includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||e.trustsFallback?.(t.fallbackHtml,t))return t;let r={...t};return delete r.fallbackHtml,r}const pl={bluesky:`Bluesky`,rumble:`Rumble`};function ml(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function hl(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:ul(n,e));if(!a&&e!==void 0&&_l(n,e))return{error:ml(i)};if(!a)return{error:`social-embeds: not a ${i} post URL: ${String(e)}`};if(a.platform!==r)return{error:`social-embeds: expected a ${i} embed, got ${a.platform}`};let o=fl(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function gl(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=tr(e.url);return t?ml(pl[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function _l(e,t){let n=typeof t==`string`?F(t):null;return n!==null&&e.needsLookup?.(n)===!0}function vl(e){return yl(ol,e)}function yl(e,t){if(typeof t!=`string`)return null;let n=D(t);return n?xl(e,n):bl(e,t)}function bl(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:D(r),a=i&&xl(e,i);if(a?.platform===n.platform)return a}return null}function xl(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Pe(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(Sl(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[t]=i;if(a||i.length!==1||!t||t.children.length!==0)return null;for(let n of e){let e=n.parseScript?.(t);if(e)return e}return null}for(let t of e){let e=t.parse(n);if(!e)continue;if(a&&!t.allowsFbRoot||r&&!t.isOwnExtra?.(r,e))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(e=>e!==void 0&&t.isOwnScript(e)))return null;let s=o.map(e=>e===void 0?{}:t.scriptOptions?.(e)??{});return{...e,options:Object.assign({},...s,e.options)}}return null}function Sl(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Cl(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function wl(e){return e===null?void 0:Cl(e.trim().replace(/px$/i,``))}function Tl(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function El(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Dl(e,t){let n=t??e.getAttribute(`html`)??Tl(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:Cl(i)??(i?.trim()?i:void 0),maxWidth:wl(e.getAttribute(`max-width`)),height:wl(e.getAttribute(`height`)),maxHeight:wl(e.getAttribute(`max-height`))},eager:El(e)}}const Ol=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function kl(e,t){e.removeAttribute(`style`),$(e,t)}function $(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&Ol.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Al(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),$(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function jl(e,t,n){if(t||typeof IntersectionObserver>`u`)return n(),()=>{};let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r.disconnect(),n())},{rootMargin:`200px 0px`});return r.observe(e),()=>{r.disconnect()}}function Ml(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Nl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{kl(c,Ke(t,e,l))};u(n);let d=Ml(document.createElement(`div`)),f=Ml(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?Al():Pl(t.fallbackHtml,t.fallbackImage===!0)];f.append(...p),d.append(f),c.append(d),e.append(c);let m,h=!1,g,_=[],v=()=>{f.remove(),h||(h=!0,a())},y=s?`did not report its height`:`did not load`,ee=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${y}`)))},15e3)},b=e=>{let n=document.createElement(`iframe`);n.src=t.clientSrc?t.clientSrc(e):e,n.title=t.title,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),$(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{s||v()}),m?m.replaceWith(n):d.prepend(n),m=n},x=!1,S=()=>{if(x)return;x=!0,s&&_.push(s.listen(()=>m,e=>{l=e,$(c,{height:l}),v()}));let{sizeInSrc:e}=t;e?_.push(e.watch(d,t=>{b(e.src(t))})):b(t.src)};return r&&S(),_.push(jl(d,!1,()=>{S(),ee()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),c.remove()},update(e,t){u(e),t&&S()}}}function Pl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Fl=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function Il(e){let t=e.querySelector(Fl.map(e=>`[${e}]`).join());for(let e of Fl){let n=t?.getAttribute(e);if(n)return n}}function Ll(e){return`View this post on ${e}`}function Rl(e){return e instanceof Error?e:Error(String(e))}function zl(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{kl(l,{width:e.width??`100%`,maxWidth:e.maxWidth??t.maxWidth})};u(n);let d=document.createElement(`div`);$(d,{width:`100%`});let f=document.createElement(`div`);f.innerHTML=t.markup,d.append(f);let p=Il(f),m=t.hasFallback?[]:o.length>0?o:[Al(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=e=>{for(let e of m)e.parentNode?.removeChild(e);m=e,d.append(...e)},g=!1,_=!1,v,y=()=>{},ee=()=>{g||_||(_=!0,clearTimeout(v),y(),h([]),s())},b=e=>{if(t.hasFallback||p===void 0)h([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,p),e.textContent=Ll(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof he?b(t):v=setTimeout(()=>{S(e+1)},1e3*2**(e-1)))},S=e=>{if(!(g||_)){try{y=r.render(f,ee)}catch(t){x(e,Rl(t));return}v=setTimeout(()=>{x(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},C=!1,w=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(Rl(e))}))},te=jl(f,a,w);return{wrapper:l,cleanup:()=>{g=!0,te(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&w()}}}const Bl=typeof HTMLElement>`u`?class{}:HTMLElement,Vl=`embed`;function Hl(e){let t=[];for(let n of e.childNodes)if(n.nodeType===Node.ELEMENT_NODE&&!(n instanceof HTMLTemplateElement)||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim()){let e=n.cloneNode(!0);if(e instanceof Element)for(let t of[e,...e.querySelectorAll(`[id]`)])t.removeAttribute(`id`);t.push(e)}return t}function Ul(e){let t=``;for(let n of e.children)n.slot!==Vl&&(t+=n.outerHTML);return t&&(vl(t)??Ln(t))?t:void 0}function Wl(e){let t=`html`in e?vl(e.html):cl(e.url);if(!t){let t=`html`in e?Ln(e.html):null;return t?Jn(t):{kind:`error`,message:gl(e)}}let n=sl(t.platform);if(!n)return{kind:`error`,message:gl(e)};let r=hl(void 0,t,n);return r.error===void 0?Yt(r.embed):{kind:`error`,message:r.error}}const Gl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Kl=class extends Bl{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i;#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${Vl}"></slot>`;for(let e of Gl){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get eager(){return El(this)}set eager(e){this.#c(`eager`,e===``||e&&e!==`false`?``:null)}connectedCallback(){!this.#t&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#t?.disconnect(),this.#u(),this.#r=void 0,this.#i=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#t;if(e){e.disconnect(),e.observe(this,{childList:!0});for(let t of this.children)t instanceof HTMLTemplateElement&&e.observe(t.content,{childList:!0,subtree:!0,characterData:!0})}}#c(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}#l(){if(!this.isConnected||!this.#t)return;let e=this.#n?.wrapper;for(let t of[...this.children])t!==e&&t.slot===Vl&&t.remove();let t=!e||e.parentNode===this,n=Dl(this,this.#e);this.#i=n.source?void 0:t&&this.#i||Ul(this),n.source??=this.#i===void 0?null:{html:this.#i};let r=JSON.stringify(n.source);r===this.#r&&t?this.#n?.update(n.layout,n.eager):(this.#u(),this.#r=r,this.#d(n))}#u(){this.#a+=1;let e=this.#n;this.#n=void 0,e?.cleanup()}#d(e){let{source:t,layout:n,eager:r}=e;if(!t)return;let i=this.#a,a=e=>{queueMicrotask(()=>{i===this.#a&&this.isConnected&&this.dispatchEvent(e)})},o=e=>{a(new ErrorEvent(`error`,{error:e,message:e.message}))},s=Wl(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?Hl(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?Nl(this,s,c):zl(this,s,c),this.#n.wrapper.slot=Vl}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Kl);export{Kl as SocialEmbedElement};
|
|
1
|
+
const e=`autoplay *; encrypted-media *; fullscreen *; clipboard-write`,t=`allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation`;function n(n){let r=n.url.slice(23),i=r.includes(`/song/`)||r.includes(`?i=`);return{kind:`iframe`,src:`https://embed.music.apple.com${r}`,title:`Apple Music player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(i?175:450),maxWidth:660,borderRadius:10}}function r(n){let r=n.url.slice(26);return{kind:`iframe`,src:`https://embed.podcasts.apple.com${r}`,title:`Apple Podcasts player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(r.includes(`?i=`)?160:450),maxWidth:640,borderRadius:12}}function i(e,t){return Object.entries(e).filter(([e])=>!t.includes(e.toLowerCase()))}function a(...e){let t=/* @__PURE__ */ new Map;for(let n of e)for(let[e,r]of n??[])t.set(e,String(r));let n=[...t].map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);return n.length>0?`?${n.join(`&`)}`:``}function o(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=e[r];typeof t==`boolean`?n.push([i,+!!t]):(typeof t==`string`||typeof t==`number`)&&n.push([i,t])}return n}function s(e,t){let{origin:n,read:r}=this,i=i=>{if(i.origin!==n)return;let a=e();if(!a||i.source!==a.contentWindow)return;let o;try{o=r(i.data)}catch{return}typeof o==`number`&&o>0&&o<=5e4&&t(Math.ceil(o))};return window.addEventListener(`message`,i),()=>{window.removeEventListener(`message`,i)}}function c(e,t){if(typeof IntersectionObserver>`u`)return t(!0),()=>{};let n=!1,r,i=()=>{let e=n&&document.visibilityState!==`hidden`;e!==r&&(r=e,t(e))},a=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(n=t.isIntersecting,i())});return a.observe(e),document.addEventListener(`visibilitychange`,i),()=>{a.disconnect(),document.removeEventListener(`visibilitychange`,i)}}const l={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0},listen:s,onScreen:c};function u(e,t){let n=t.colorMode??e.options.colorMode;return{kind:`iframe`,src:`https://embed.bsky.app/embed/${e.id}${a(typeof n==`string`?[[`colorMode`,n]]:void 0)}`,title:`Bluesky post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:l,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const d=/^x[a-z0-9]{3,12}$/;function f(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...l}=e.options,u=n??c;if(u===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof u!=`string`||!d.test(u))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(u)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${u}.html${a([[`video`,e.id]],i(l,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const p=15e3,m=3e3,h=/* @__PURE__ */ new Map;function g(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=h.get(e.key);return t||(t=_(e).catch(t=>{throw h.delete(e.key),t}),h.set(e.key,t)),t}async function _(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await v(e,t)||await b(e)}await e.whenPresent?.()}function v(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?m:p),i,a=()=>{r=Date.now()+m},o=()=>{clearTimeout(i),window.removeEventListener(`load`,a);for(let e of t)e.removeEventListener(`error`,o);n(e.isPresent())},s=()=>{e.isPresent()||Date.now()>=r?o():i=setTimeout(s,50)};window.addEventListener(`load`,a);for(let e of t)e.addEventListener(`error`,o);s()})}var y=class extends Error{};async function b(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await ee(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof y)||t>=3)throw e;await C(1e3*2**(t-1))}await(t?S(t,`${e.url} did not report ready`):x(e))}async function ee(e){let t=e.prepare?.(),n=document.createElement(`script`),r=new Promise((t,r)=>{n.src=e.url,n.async=!0,e.crossOrigin&&(n.crossOrigin=e.crossOrigin);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new y(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await S(r,`${e.url} did not load`)}finally{t?.()}return n}function x(e){return new Promise((t,n)=>{let r=Date.now()+p,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function S(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},p);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function C(e){return new Promise(t=>setTimeout(t,e))}const w=()=>window,T=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){let t=w().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}const re={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof w().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=w().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=w().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=w().FB;return!ne(e)&&t!==void 0&&!t.__buffer}const oe={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`instagram`),prepare:ie,skipped:()=>ae(`instagram`)},se={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`threads`),prepare:ie,skipped:()=>ae(`threads`)};function ce(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${T}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof w().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=w().fbAsyncInit;w().fbAsyncInit=()=>{t?.(),e()}})}}const le={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof w().PinUtils?.build==`function`};function ue(){return g(re)}function de(){return g(oe)}function fe(){return g(se)}function pe(){return g(le)}function me(e){return te.test(e)?g(ce(e)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${e}"`))}const E=()=>window;var he=class extends Error{};function D(e,t,n){if(t(e))return n(),()=>{};let r=new MutationObserver(()=>{t(e)&&(r.disconnect(),n())});return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`class`,`style`,`height`]}),()=>{r.disconnect()}}function ge(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function _e(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ve={load:()=>ue(),render(e,t){let n=E().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=D(e,_e,t);return ge(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function ye(e,t){if(e.getRootNode()!==document)throw new he(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function be(){let e=E().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const xe={load:()=>de(),render(e,t){ye(e,`Instagram`);let n=D(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ge(e,`instagram-media`),be(),n}},Se={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=D(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ge(e,`text-post-media`),be(),n}},Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);return t||(t={load:()=>me(e),render(e,t){let n=E().FB,r=n?.XFBML?.parse;if(!n||!r)throw Error(`social-embeds: FB.XFBML.parse is missing`);let i=()=>{r(e,t)};try{i()}catch(e){if(!(e instanceof Error)||!/init not called/.test(e.message))throw e;n.init?.({xfbml:!1,version:T}),i()}return()=>{}}},Ce.set(e,t)),t}const Te={load:()=>pe(),render(e,t){let n=E().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=D(e,e=>e.querySelector(`span[data-pin-id]`)!==null,t),i=e.querySelector(`a`);return i&&!i.hasAttribute(`data-pin-do`)&&i.setAttribute(`data-pin-do`,`embedPin`),n(e),r}},Ee=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),De=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Oe=/<([a-zA-Z][a-zA-Z0-9-]*)/y,ke=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ae=/\s*(\/?)>/y,je=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Me=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function O(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}je.lastIndex=a;let s=je.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=je.lastIndex;continue}let c=Ne(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:De.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!Ee.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ne(e,t){Oe.lastIndex=t;let n=Oe.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Oe.lastIndex;for(;;){Ae.lastIndex=i;let t=Ae.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ae.lastIndex};ke.lastIndex=i;let a=ke.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Pe(s??c??l??``)),i=ke.lastIndex}}function Pe(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return Me.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function k(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function A(e){let t=[];return Fe(e,t),t}function Fe(e,t){for(let n of e)n.type===`element`&&(t.push(n),Fe(n.children,t))}const Ie=/* @__PURE__ */ new Set([`href`,`cite`]),Le=/^https?:\/\//i;function j(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Ie.has(e)&&!Le.test(i)||(n+=` ${e}="${M(i)}"`)}n+=`>`,Ee.has(r.tag)||(n+=`${j(r.children,t)}</${r.tag}>`)}}return n}function M(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function N(e,t){let n=O(e);return n!==null&&j(n,t)===e}function Re(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${M(String(r))}"`);return t}function ze(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Re(n)}function P(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function F(e){return e!==void 0&&e.trim()!==``}const Be={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ve={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},He={post:300,video:200};function Ue(e){let t=Object.entries(e.options).filter(([e])=>e!==`href`);return{kind:`iframe`,src:`https://www.facebook.com/plugins/video.php${a([[`href`,e.url]],t)}`,title:`Facebook video player`,allow:`autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function We(e,t){if(e.variant===`iframe`)return Ue(e);let n=P(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ve)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ue({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${M(e.url)}"${ze(Be,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:we(i),minHeight:He[e.kind],label:`Facebook`,title:e.kind===`video`?`Facebook video`:`Facebook post`,hasFallback:F(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Ge(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Ke(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Ge(e),l=i===void 0||a!==void 0?void 0:Math.floor(i*s/c);return{position:`relative`,width:r,maxWidth:l===void 0||o!==void 0&&o<l?o:l,...e.messageHeight?{height:n??e.startHeight}:a===void 0?{aspectRatio:`${String(s)} / ${String(c)}`}:{height:a,maxHeight:i},...e.borderRadius===void 0?{}:{borderRadius:e.borderRadius,overflow:`hidden`}}}function qe(e,t){let n=Ge(e),r=Math.round(t*n.height/n.width),i=e.src.indexOf(`?`),a=i===-1?e.src:e.src.slice(0,i),o=i===-1?``:`&${e.src.slice(i+1)}`;return`${a}?width=${String(t)}&height=${String(r)}${o}`}function Je(e,t){let n,r,i=e=>{let i=Math.round(e);i<=0||(clearTimeout(r),i!==n&&(n===void 0?(n=i,t(i)):r=setTimeout(()=>{n=i,t(i)},200)))};if(typeof ResizeObserver>`u`)return i(e.getBoundingClientRect().width),()=>{};let a=new ResizeObserver(e=>{for(let t of e)i(t.contentRect.width)});return a.observe(e),()=>{a.disconnect(),clearTimeout(r)}}const Ye=[`header`,`footer`,`context`],Xe=/\/albums\/\d+$/;function Ze(e,t){let n=Xe.test(e.url),r=Ye.filter(n=>t[n]??e.options[n]===!0),{width:i,height:a}=e.size??{},o=i!==void 0&&a!==void 0?{width:i,height:a}:void 0,s=`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,c={width:4,height:3};return{kind:`iframe`,src:s,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:c,...o?{size:o,maxWidth:o.width}:{},sizeInSrc:{watch:Je,src:e=>qe({src:s,ratio:c,size:o},e)},...e.fallbackHtml===void 0?{}:{fallbackHtml:e.fallbackHtml.replace(/<img(?=[\s>])/g,`<img style="display:block;width:100%;height:100%;object-fit:cover"`)},fallbackImage:!0}}function Qe(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}const $e={origin:`https://imgur.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.message===`resize_imgur`&&typeof t.height==`number`?t.height:void 0},listen:s,onScreen:c};function et(e,t){let n=[`pub=true`,...t.context??e.options.context!==!1?[]:[`context=false`],...e.options.analytics===!1?[`analytics=false`]:[]];return{kind:`iframe`,src:`https://imgur.com/${e.id}/embed?${n.join(`&`)}`,title:`Imgur post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:$e,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function tt(e,t){let n=P(e.options,{captioned:t.captioned}),r=`<blockquote${Re({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:xe,minHeight:680,label:`Instagram`,title:`Instagram post`,hasFallback:F(e.fallbackHtml),maxWidth:540}}const nt=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function rt(e,t){let n=[];return t.autoplay!==void 0&&n.push([`autoplay`,t.autoplay]),t.muted!==void 0&&n.push([`muted`,t.muted]),{kind:`iframe`,src:`https://player.kick.com/${e.id}${a(Object.entries(e.options).filter(([e])=>nt.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function it(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const at={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ot={small:236,medium:345,large:600};function st(e,t){let n=P(e.options,{width:t.pinWidth}),r=`<a href="${M(e.url)}"${ze(at,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:Te,minHeight:270,label:`Pinterest`,title:`Pinterest pin`,hasFallback:!1,maxWidth:ot[String(n.width)]??236}}const ct={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},lt={origin:`https://embed.reddit.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.type===`resize.embed`&&typeof t.data==`number`?t.data:void 0},listen:s,onScreen:c};function ut(e,t){let n=[];for(let[e,r]of Object.entries(ct)){let i=t[e];i!==void 0&&n.push([r,i])}return{kind:`iframe`,src:`https://embed.reddit.com${e.url.slice(22)}${a([[`embed`,!0]],Object.entries(e.options),n)}`,title:`Reddit post`,allow:`clipboard-read; clipboard-write`,sandbox:`allow-scripts allow-same-origin allow-popups`,scrolling:`no`,ratio:{width:1,height:1},messageHeight:lt,startHeight:e.size?.height??316,maxWidth:640}}function dt(e){let t=e.options.title;return{kind:`iframe`,src:`${e.url}/embed`,title:typeof t==`string`&&t!==``?t:`Snapchat`,allow:`autoplay; camera; microphone; clipboard-write;`,scrolling:`no`,ratio:{width:416,height:692},size:e.size,maxWidth:416}}const ft={visual:`visual`,color:`color`,autoPlay:`auto_play`,hideRelated:`hide_related`,showComments:`show_comments`,showUser:`show_user`,showReposts:`show_reposts`,showTeaser:`show_teaser`,showArtwork:`show_artwork`};function pt(e,t){let n=[];for(let[e,r]of Object.entries(ft)){let i=t[e];i!==void 0&&n.push([r,i])}let r=e.size===void 0;return{kind:`iframe`,src:`https://w.soundcloud.com/player/${a([[`url`,e.url]],r?[[`visual`,!0]]:void 0,i(e.options,[`url`,`secret_token`]),n)}`,title:`SoundCloud player`,allow:`autoplay; encrypted-media`,scrolling:`no`,ratio:{width:16,height:9},height:e.size?.height??400}}function mt(e){let t=i(e.options,[]).filter(([e])=>e===`pub`);return{kind:`iframe`,src:`https://rumble.com/embed/${e.id}/${a(t)}`,title:`Rumble video`,allow:`fullscreen`,ratio:{width:16,height:9},size:e.size}}const ht=/* @__PURE__ */ new Set([`track`,`episode`]);function gt(e,t){let n=new URL(e.url).pathname.split(`/`)[1]??``,r=e.kind===`video`,i=a(Object.entries(e.options),t.theme===void 0?void 0:[[`theme`,t.theme]]);return{kind:`iframe`,src:`https://open.spotify.com/embed/${n}/${e.id}${r?`/video`:``}${i}`,title:`Spotify Embed`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,ratio:{width:16,height:9},size:r?e.size:void 0,borderRadius:12,height:r?void 0:e.size?.height??(ht.has(n)?152:352)}}const _t={origin:`https://strava-embeds.com`,read(e){if(!Array.isArray(e))return;let[,t,n]=e;return t===`BROADCAST_IFRAME_HEIGHT`&&typeof n==`number`?n:void 0},listen:s,onScreen:c};function vt(e){return e===`minimal`?`minimal`:`standard`}function yt(e,t){let n=e.id.startsWith(`route/`),r=vt(t.embedStyle??e.options.style),i=n&&(t.fullWidth??e.options.fullWidth===!0),a=t.mapHash??e.options.mapHash,o=`?style=${r}${i?`&fullWidth=true`:``}`,s=`#ns=social-embeds${typeof a==`string`&&a!==``?`&mapHash=${encodeURIComponent(a)}`:``}`;return{kind:`iframe`,src:`https://strava-embeds.com/${e.id}${o}${s}`,title:n?`Strava route`:`Strava activity`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:_t,startHeight:650,...i?{}:{maxWidth:554}}}const bt=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),xt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function St(e,t){let n=Object.entries(e.options).filter(([e])=>bt.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,xt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Ct=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function wt(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0},listen:s,onScreen:c};function Et(e,t){let{userpic:n,color:r,dark:i,darkColor:o}=t,s={...e.options,...n===void 0?{}:{userpic:n},...r===void 0?{}:{color:r},...i===void 0?{}:{dark:i},...o===void 0?{}:{darkColor:o}},c=[[`embed`,1]];for(let[e,t]of Ct){let n=wt(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Tt,startHeight:300,maxWidth:500}}function Dt(e){return{kind:`iframe`,src:`https://tenor.com/embed/${e.id}`,title:`Tenor GIF`,allow:`fullscreen`,ratio:{width:133,height:100},size:e.size}}function Ot(e,t){let n=P(e.options,{theme:t.theme}),r=`<blockquote${Re({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:Se,minHeight:240,label:`Threads`,title:`Threads post`,hasFallback:F(e.fallbackHtml),maxWidth:658}}const kt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function At(e,t){let n=o(t,kt);return{kind:`iframe`,src:`https://www.tiktok.com/player/v1/${e.id}${a(Object.entries(e.options),n)}`,title:`TikTok video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share`,ratio:{width:9,height:16},size:e.size,maxWidth:325}}function jt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Mt={origin:`https://truthsocial.com`,read:jt,listen:s,onScreen:c},Nt={origin:`https://truthsocial.com`,read(e){let t=jt(e);return t===void 0||t<=0?void 0:t+165},listen:s,onScreen:c},Pt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Ft(e){let t=Pt.exec(e.url)?.[1];return t===void 0?{kind:`error`,message:`social-embeds: not a Truth Social post URL: ${e.url}`}:{kind:`iframe`,src:`https://truthsocial.com/${t}/${e.id}/embed`,title:`Truth Social post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:e.options.video===!0?Nt:Mt,startHeight:150,maxWidth:e.size?.width??600}}const It={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0},listen:s,onScreen:c};function Lt(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:It,startHeight:400,maxWidth:540}}const Rt=[`channel`,`video`,`collection`,`clip`,`parent`];function zt(e,t){let{hostname:n,pathname:r}=new URL(e);if(n===`clips.twitch.tv`)return[`https://clips.twitch.tv/embed`,[`clip`,t]];let i=r.split(`/`)[1];return[`https://player.twitch.tv/`,i===`videos`?[`video`,`v${t}`]:i===`collections`?[`collection`,t]:[`channel`,t]]}function Bt(e,t){let{autoplay:n,muted:r,time:o}=t,s=[];n!==void 0&&s.push([`autoplay`,String(n)]),r!==void 0&&s.push([`muted`,String(r)]),o!==void 0&&s.push([`time`,o]);let[c,l]=zt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Rt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Vt}}function Vt(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Ht={autopause:`autopause`,autoplay:`autoplay`,background:`background`,byline:`byline`,color:`color`,controls:`controls`,dnt:`dnt`,keyboard:`keyboard`,loop:`loop`,muted:`muted`,pip:`pip`,playsinline:`playsinline`,portrait:`portrait`,quality:`quality`,speed:`speed`,title:`title`,transparent:`transparent`};function Ut(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ht),d=n??s;return{kind:`iframe`,src:`https://player.vimeo.com/video/${e.id}${a(l?[[`h`,l]]:void 0,i(c,[`h`]),u)}${d===void 0?``:`#t=${encodeURIComponent(String(d))}`}`,title:`Vimeo video player`,allow:`autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:{width:16,height:9},size:e.size}}const Wt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Gt(e,t){let n=P(e.options,{...t}),r=e.fallbackHtml??`<a href="${M(e.url)}"></a>`,i=`<blockquote${ze(Wt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ve,minHeight:250,label:`X`,title:`X post`,hasFallback:F(e.fallbackHtml),maxWidth:550}}const Kt={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function qt(e){return e.url.startsWith(`https://www.youtube.com/playlist?`)?{path:`videoseries`,key:`list`}:e.url.startsWith(`https://www.youtube.com/channel/`)?{path:`live_stream`,key:`channel`}:{path:e.id}}function Jt(e,t){let{nocookie:n,...r}=t,{nocookie:s,...c}=e.options,l=n??s===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,{path:u,key:d}=qt(e),f=o(r,Kt).filter(([e])=>e!==d);return{kind:`iframe`,src:`${l}/embed/${u}${a(d===void 0?void 0:[[d,e.id]],i(c,d===void 0?[]:[d]),f)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function Yt(e){switch(e.platform){case`x`:return Gt(e,{});case`instagram`:return tt(e,{});case`threads`:return Ot(e,{});case`facebook`:return We(e,{});case`tiktok`:return At(e,{});case`youtube`:return Jt(e,{});case`telegram`:return Et(e,{});case`snapchat`:return dt(e);case`linkedin`:return it(e,{});case`reddit`:return ut(e,{});case`pinterest`:return st(e,{});case`spotify`:return gt(e,{});case`vimeo`:return Ut(e,{});case`twitch`:return Bt(e,{});case`dailymotion`:return f(e,{});case`bluesky`:return u(e,{});case`soundcloud`:return pt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Lt(e);case`kick`:return rt(e,{});case`giphy`:return Qe(e);case`tenor`:return Dt(e);case`streamable`:return St(e,{});case`rumble`:return mt(e);case`truthsocial`:return Ft(e);case`imgur`:return et(e,{});case`strava`:return yt(e,{});case`flickr`:return Ze(e,{});default:return e.platform}}const Xt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function I(e){let t=Xt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&`,`&`).split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=Zt(t===-1?e:e.slice(0,t)),r=Zt(t===-1?``:e.slice(t+1));if(n===null||r===null)return null;o.has(n)||o.set(n,r)}return{host:n.toLowerCase(),path:r,query:o,...a?{fragment:a}:{}}}function Zt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function L(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function R(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function z(e,t){return{...e,...t}}function B(e,t){return e===t||e.startsWith(`${t}/`)}function V(e,t,n){let r={};for(let[i,a]of t){let t=e.attrs.get(i);t!==void 0&&!(a in r)&&(r[a]=n(t))}return r}function H(e){let t=R(e.attrs.get(`width`)),n=R(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function U(e,t){return t?{...e,size:t}:e}function W(e,t){if(e.tag!==`div`||e.attrs.size!==1)return null;let[,n]=t.exec(e.attrs.get(`style`)??``)??[];if(n===void 0)return null;let r;for(let t of e.children)if(!(t.type===`text`&&/^\s*$/.test(t.raw))){if(t.type!==`element`||t.tag!==`iframe`||r)return null;r=t}let i=Math.round(Number(n)*100);if(!r||!(i>0&&i<=1e5))return null;let a=Qt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Qt(e,t){return t===0?e:Qt(t,e%t)}const $t=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),en=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),tn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),G=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),nn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),K=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),rn=/* @__PURE__ */ new Set([`player.kick.com`]),an=`embed.music.apple.com`,on=`embed.podcasts.apple.com`,sn=e=>en.has(e.host)||$t.has(e.host)&&B(e.path,`/embed`),cn=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||tn.has(e.host)&&(B(e.path,`/embed`)||B(e.path,`/video`)),ln=e=>G.has(e.host)&&B(e.path,`/player`),un=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&B(e.path,`/embed`),dn=e=>e.host===`player.vimeo.com`,fn=e=>nn.has(e.host)&&B(e.path,`/plugins`),pn=e=>K.has(e.host)&&B(e.path,`/embed`),mn=e=>rn.has(e.host),hn=e=>e.host===`www.linkedin.com`&&B(e.path,`/embed`),gn=e=>e.host===`assets.pinterest.com`,_n=e=>e.host===an,vn=e=>e.host===on,yn=e=>e.host===`w.soundcloud.com`,bn=e=>e.host===`open.spotify.com`&&B(e.path,`/embed`),xn=e=>e.host===`rumble.com`&&B(e.path,`/embed`),Sn=e=>e.host===`streamable.com`&&(B(e.path,`/e`)||B(e.path,`/o`)),Cn=e=>e.host===`tenor.com`&&B(e.path,`/embed`),wn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function Tn(e){return[sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn].some(t=>t(e))}const En=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],Dn=/* @__PURE__ */ new Set([`allow-downloads`,`allow-forms`,`allow-modals`,`allow-orientation-lock`,`allow-pointer-lock`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-presentation`,`allow-same-origin`,`allow-scripts`,`allow-top-navigation`,`allow-top-navigation-by-user-activation`,`allow-top-navigation-to-custom-protocols`]),On=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),kn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,An=/* @__PURE__ */ RegExp(`^(?:https:)?//${kn}(?:[/?#]|$)`,`i`),jn=/* @__PURE__ */ RegExp(`^(?:\\*|'self'|'src'|'none'|https://${kn})$`,`i`),Mn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Nn=/[\t\n\f\r ]+/,Pn=/^\s*(width|height)\s*:(.*)$/is,Fn=/^(\d+)px$/i,In=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function Ln(e){if(typeof e!=`string`)return null;let t=O(e);if(!t)return null;let n=A(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=H(r)??Kn(r);return zn({src:o.get(`src`),title:o.get(`title`),allow:o.get(`allow`),allowFullscreen:o.has(`allowfullscreen`),referrerPolicy:o.get(`referrerpolicy`),sandbox:o.get(`sandbox`),scrolling:o.get(`scrolling`),size:s??{},ratio:s?void 0:a&&W(a,In)?.size})}function Rn(e){return zn(e)}function zn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Bn(t.src);if(n===null)return null;let r=typeof t.title==`string`?t.title.trim():``,i=typeof t.referrerPolicy==`string`?t.referrerPolicy.toLowerCase():void 0,a=En.find(e=>e===i),o=Un(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Vn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Hn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Gn(t.size),...o?{ratio:o}:{}}}function Bn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=An.test(t)&&!t.includes(`\\`)?I(t):null;return!n||Mn.test(n.path)||Tn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Vn(e){return e.split(`;`).map(e=>e.split(Nn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&On.has(e)&&t.every(e=>jn.test(e))).map(e=>e.join(` `)).join(`; `)}function Hn(e){let t=e.split(Nn).map(e=>e.toLowerCase()).filter(e=>Dn.has(e));return[...new Set(t)].join(` `)}function Un(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Wn(t)&&Wn(n)?{width:t,height:n}:void 0}function Wn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Gn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?R(String(t)):void 0,i=typeof n==`number`?R(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Kn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Pn.exec(r)??[],a=R(Fn.exec(i.trim())?.[1]);e.toLowerCase()===`width`&&(t=a),e.toLowerCase()===`height`&&(n=a)}return t===void 0&&n===void 0?void 0:{width:t,height:n}}const qn={width:16,height:9};function Jn(e){let t=Rn(e);return t?{kind:`iframe`,src:t.src,title:t.title??`Embedded content`,allow:t.allow,allowFullscreen:t.allowFullscreen,...t.referrerPolicy?{referrerPolicy:t.referrerPolicy}:{},...t.sandbox===void 0?{}:{sandbox:t.sandbox},...t.scrolling?{scrolling:t.scrolling}:{},...Yn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Yn({size:e,ratio:t}){let{width:n,height:r}=e;return n!==void 0&&r!==void 0?{ratio:{width:n,height:r},maxWidth:n}:r===void 0?{ratio:t??qn,...n===void 0?{}:{maxWidth:n}}:{ratio:qn,height:r}}const Xn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Qn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,$n=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),er=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function tr(e){let t=typeof e==`string`?I(e):null;return t?nr(t)?`rumble`:rr(t)?`bluesky`:null:null}function nr(e){return $n.has(e.host)&&er.test(e.path)}function rr(e){if(!Xn.has(e.host))return!1;let[,t]=Zn.exec(e.path)??[];return t!==void 0&&Qn.test(t)}const ir=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,ar=/^\d{1,15}$/;function or(e,t){if(e?.host!==t)return null;let[,n,r,i]=ir.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!ar.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!ar.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const sr=/* @__PURE__ */ z({platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],match(e){let t=or(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:_n},{parse(e){if(e.tag!==`iframe`)return null;let t=or(I(e.attrs.get(`src`)??``),an);if(!t)return null;let{height:n}=H(e)??{};return U({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1}),cr=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,lr=/^\d{1,15}$/;function ur(e,t){if(e?.host!==t)return null;let[,n,r]=cr.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!lr.test(i)?null:{platform:`applepodcasts`,kind:`post`,url:`https://podcasts.apple.com/${n}/podcast/id${r}${i?`?i=${i}`:``}`,id:i??r,variant:`iframe`}}const dr=/* @__PURE__ */ z({platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],match(e){let t=ur(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:vn},{parse(e){if(e.tag!==`iframe`)return null;let t=ur(I(e.attrs.get(`src`)??``),on);return t&&U({...t,options:{}},H(e))},isOwnScript:()=>!1}),fr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,pr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,mr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),hr=/* @__PURE__ */ RegExp(`^/profile/${fr}/post/${pr}/?$`),gr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function _r(e,t){return{platform:`bluesky`,kind:`post`,url:`https://bsky.app/profile/${e}/post/${t}`,id:`${e}/app.bsky.feed.post/${t}`,variant:`iframe`}}function vr(e){if(!e||!mr.has(e.host))return null;let[,t,n]=hr.exec(e.path)??[];return t===void 0||n===void 0?null:_r(t,n)}const yr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:rr,trustsFallback:e=>N(e,gr),match(e){let t=vr(e);return t&&{...t,options:{}}}},br=/* @__PURE__ */ RegExp(`^at://${fr}/app\\.bsky\\.feed\\.post/${pr}$`),xr=/^[a-z2-7]{20,100}$/,Sr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Cr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,wr=/* @__PURE__ */ z(yr,{parse(e){if(e.tag!==`blockquote`||!k(e,`bluesky-embed`))return null;let[,t,n]=br.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=_r(t,n);if(A(e.children).reverse().map(e=>e.tag===`a`?vr(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&xr.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&Sr.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:j(e.children,gr)}},isOwnScript:e=>Cr.test(e)}),Tr=/^x[a-z0-9]{4,12}$/,Er=/^x[a-z0-9]{3,12}$/;function Dr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Or(e){if(e.host!==`geo.dailymotion.com`||e.query.has(`playlist`))return null;let t=/^\/player(?:\/([a-z0-9]+))?\.html$/.exec(e.path);if(!t)return null;let[,n]=t,r=e.query.get(`video`)??``;if(!Tr.test(r)||n!==void 0&&!Er.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,L(t)]));return n!==void 0&&(i.playerId=n),Dr(r,i)}function kr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Tr.test(t)?Dr(t,{}):null}if(!tn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Tr.test(t)?Dr(t,{}):null}const Ar={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],match(e){return Or(e)??kr(e)},ownsFrame:cn},jr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Mr=/* @__PURE__ */ z(Ar,{parse(e){let t=W(e,jr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=I(n.attrs.get(`src`)??``);if(!r)return null;let i=Or(r)??kr(r);return i&&U(i,t?.size??H(n))},isOwnScript:()=>!1}),Nr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),q=`https://www.facebook.com`,Pr=`[A-Za-z0-9.\\-]{1,80}`,Fr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Ir=/* @__PURE__ */ RegExp(`^/(${Pr})/posts/(${Fr})/?$`),Lr=/* @__PURE__ */ RegExp(`^/(${Pr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Rr=/* @__PURE__ */ RegExp(`^/(${Pr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),zr=/^\/reel\/(\d{1,25})\/?$/,Br=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Vr=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Hr=/* @__PURE__ */ RegExp(`^${Fr}$`),Ur=/^\d{1,25}$/,Wr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Gr=/* @__PURE__ */ new Map([[`div`,[Wr]],[`blockquote`,[`cite`,Wr]],[`a`,[`href`]],[`p`,[]]]);function Kr(e){if(!e||!Nr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Ir.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${q}/${r}/posts/${i}`};if(Br.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Hr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Ur.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${q}${t}?story_fbid=${e}${i}`}}if(Vr.has(t)){let e=n.get(`fbid`);return e===void 0||!Ur.test(e)?null:{kind:`post`,id:e,url:`${q}${t}?fbid=${e}`}}let[,a,o,s]=Lr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${q}/${a}/photos/${o}/${s}/`};let[,c,l]=Rr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${q}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Ur.test(e)?null:{kind:`video`,id:e,url:`${q}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=zr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${q}/reel/${u}`}}function J(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const qr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>N(e,Gr),match(e){let t=Kr(e);return t&&J(t,t.kind,`sdk`,{})},ownsFrame:fn},Jr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Yr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Xr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Zr=/* @__PURE__ */ z(qr,{parse(e){if(e.tag===`div`){let t=k(e,`fb-post`)?`post`:k(e,`fb-video`)?`video`:null,n=Kr(I(e.attrs.get(`data-href`)??``));return!t||!n?null:{...J(n,t,`sdk`,V(e,Yr,L)),fallbackHtml:j(e.children,Gr)}}if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||!nn.has(t.host))return null;let n=Kr(I(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=L(r)),i!==void 0&&(e.width=L(i)),J(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=L(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Xr){let i=t.query.get(n);i!==void 0&&(e[r]=L(i))}let r=R(t.query.get(`width`)),i=R(t.query.get(`height`));return U(J(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return U(J(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,L(t)]))),H(e))}return null},isOwnScript:e=>Jr.test(e),scriptOptions(e){let[,t]=Jr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0}),Qr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),$r=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,ei=`(\\d{1,20})`,ti=/* @__PURE__ */ RegExp(`^/photos/${$r}/${ei}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),ni=/* @__PURE__ */ RegExp(`^/photos/${$r}/(?:albums|sets)/${ei}/?$`),ri=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,ii=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,ai=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,oi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:ai},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function si(e){if(e===``)return null;let t=0n;for(let n of e){let e=ii.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function ci(e){let t=BigInt(e),n=``;for(;t>0n;)n=ii.charAt(Number(t%58n))+n,t/=58n;return n}function li(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function ui(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function di(e){if(!e||!Qr.has(e.host))return null;let[,t,n]=ni.exec(e.path)??[];if(t!==void 0&&n!==void 0)return ui(t,n);let[,r,i]=ti.exec(e.path)??[];return r===void 0||i===void 0?null:li(r,i)}function fi(e){if(e.host!==`flic.kr`)return null;let[,t]=ri.exec(e.path)??[],n=t===void 0?null:si(t);return t===void 0||n===null||ci(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}const pi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>N(e,oi),match(e){let t=di(e)??fi(e);return t&&{...t,options:{}}}},mi=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,hi=[`header`,`footer`,`context`];function gi(e){let t=null;for(let n of e.children)if(!(n.type===`text`&&/^\s*$/.test(n.raw))){if(n.type!==`element`||n.tag!==`img`||t)return null;t=n}return t}const _i=/* @__PURE__ */ z(pi,{parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=di(I(e.attrs.get(`href`)??``)),n=gi(e);if(!t||!n)return null;let r={};for(let t of hi)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=H(n),a=ai.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return U({...t,options:r,fallbackHtml:j([a],oi)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>mi.test(e)}),Y=`([A-Za-z0-9]{6,40})`,vi=/* @__PURE__ */ RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${Y}/?$`),yi=/* @__PURE__ */ RegExp(`^/embed/${Y}/?$`),bi=/^(?:media\d?|i)\.giphy\.com$/,xi=`\\.(?:gif|webp|mp4)`,Si=/* @__PURE__ */ RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${Y}/[A-Za-z0-9_-]{1,40}${xi}$`),Ci=/* @__PURE__ */ RegExp(`^/${Y}${xi}$`);function wi(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Ti(e){if(e){if(K.has(e.host))return(vi.exec(e.path)??yi.exec(e.path))?.[1];if(bi.test(e.host))return(Si.exec(e.path)??(e.host===`i.giphy.com`?Ci.exec(e.path):null))?.[1]}}const Ei={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],match(e){let t=Ti(e);return t===void 0?null:{...wi(t),options:{}}},ownsFrame:pn},Di=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function Oi(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||!K.has(t.host))return null;let[,n]=yi.exec(t.path)??[];return n===void 0?null:wi(n)}function ki(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=I(n.attrs.get(`href`)??``);if(!i||!K.has(i.host)||vi.exec(i.path)?.[1]!==t.id)return!1;let[a,...o]=n.children;return o.length===0&&a?.type===`text`&&a.raw.trim()===`via GIPHY`}const Ai=/* @__PURE__ */ z(Ei,{parse(e){let t=W(e,Di),n=t?.iframe??e,r=Oi(n);return r?U({...r,options:{}},t?.size??H(n)):null},isOwnScript:()=>!1,isOwnExtra:ki}),ji=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),X=`([A-Za-z0-9]{5,7})`,Mi=/* @__PURE__ */ RegExp(`^/a/${X}/?$`),Ni=/* @__PURE__ */ RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${X}/?$`),Pi=/* @__PURE__ */ RegExp(`^/${X}/?$`),Fi=/* @__PURE__ */ RegExp(`^/${X}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Ii=/* @__PURE__ */ new Set([`about`,`apps`,`blog`,`help`,`jobs`,`login`,`press`,`privacy`,`random`,`search`,`signin`,`signup`,`terms`,`tools`,`upload`,`account`,`contact`,`emerald`,`explore`,`gallery`,`hot`,`new`,`rules`,`user`]),Li=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Ri(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function zi(e){return e===void 0||Ii.has(e.toLowerCase())?void 0:e}function Bi(e){if(!e)return;if(e.host===`i.imgur.com`)return zi(Fi.exec(e.path)?.[1]);if(!ji.has(e.host))return;let t=(Mi.exec(e.path)??Ni.exec(e.path))?.[1];return t===void 0?zi(Pi.exec(e.path)?.[1]):`a/${t}`}const Vi={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>N(e,Li),match(e){let t=Bi(e);return t===void 0?null:{...Ri(t),options:{}}}},Hi=/* @__PURE__ */ RegExp(`^(a/)?${X}$`),Ui=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/;function Wi(e){return e.map(e=>{if(e.type!==`element`)return e;let t=e.attrs.get(`href`),n=new Map(e.attrs);return e.tag===`a`&&t?.startsWith(`//`)&&n.set(`href`,`https:${t}`),{...e,attrs:n,children:Wi(e.children)}})}function Gi(e,t){return e.attrs.get(t)===`false`}const Ki=/* @__PURE__ */ z(Vi,{parse(e){if(e.tag!==`blockquote`||!k(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Hi.exec(t)??[];if(r===void 0||n===void 0&&!zi(r))return null;let i={};return Gi(e,`data-context`)&&(i.context=!1),Gi(e,`data-analytics`)&&(i.analytics=!1),{...Ri(t),options:i,fallbackHtml:j(Wi(e.children),Li)}},isOwnScript:e=>Ui.test(e)}),qi=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Ji=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Yi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Xi=/* @__PURE__ */ new Set([`p`,`reel`]),Zi=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Qi(e){if(!e||!qi.has(e.host))return null;let[,t,n,r]=Ji.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Yi.has(t)||!Xi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const $i={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>N(e,Zi),match(e){let t=Qi(e);return t&&{...t,options:{}}}},ea=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,ta=/* @__PURE__ */ z($i,{parse(e){if(e.tag!==`blockquote`||!k(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?A(e.children).reverse().map(e=>e.tag===`a`?Qi(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Qi(I(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=L(i)),{...n,options:r,fallbackHtml:j(e.children,Zi)}},isOwnScript:e=>ea.test(e)}),na=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),ra=/^\/([A-Za-z0-9_-]{1,32})\/?$/,ia=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]);function aa(e,t){if(!e||!t.has(e.host))return null;let[,n]=ra.exec(e.path)??[];if(n===void 0||ia.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const oa={platform:`kick`,name:`Kick`,shapes:[`video iframe`],match(e){let t=aa(e,na)??aa(e,rn);return t&&{...t,options:{}}},ownsFrame:mn},sa=/* @__PURE__ */ new Set([`autoplay`,`muted`]),ca=/* @__PURE__ */ z(oa,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=aa(t,rn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>sa.has(e)).map(([e,t])=>[e,L(t)]));return U({...n,options:r},H(e))},isOwnScript:()=>!1}),la=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,ua=`(activity|share|ugcPost):(\\d{19})`,da=/* @__PURE__ */ RegExp(`^(?:/embed)?/feed/update/urn:li:${ua}/?$`),fa=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`);function pa(e,t,n={}){let r=`urn:li:${e}:${t}`;return{platform:`linkedin`,kind:`post`,url:`https://www.linkedin.com/feed/update/${r}/`,id:r,variant:`iframe`,options:n}}const ma=e=>e.replace(/%3A/gi,`:`),ha={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],match(e){if(!la.test(e.host))return null;let t=ma(e.path),[,n,r]=da.exec(t)??fa.exec(t)??[];return n===void 0||r===void 0?null:pa(n,r)},ownsFrame:hn},ga=/* @__PURE__ */ RegExp(`^/embed/feed/update/urn:li:${ua}$`),_a=/* @__PURE__ */ z(ha,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=ga.exec(t.path)??[];return n===void 0||r===void 0?null:U(pa(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,L(t)]))),H(e))},isOwnScript:()=>!1}),va=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ya=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/;function ba(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function xa(e){if(!e||!va.test(e.host))return null;let[,t]=ya.exec(e.path)??[];return t===void 0?null:ba(t)}const Sa={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],match(e){let t=xa(e);return t&&{...t,options:{}}},ownsFrame:gn},Ca=/^\d{1,25}$/,wa=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Ta=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]],Ea=/* @__PURE__ */ z(Sa,{parse(e){if(e.tag===`a`){if(e.attrs.get(`data-pin-do`)!==`embedPin`||e.children.some(e=>e.type===`element`))return null;let t=xa(I(e.attrs.get(`href`)??``));return t&&{...t,options:V(e,Ta,L)}}if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Ca.test(n)?{...ba(n),options:{}}:null},isOwnScript:e=>wa.test(e)}),Da=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Oa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/;function ka(e){if(!e||!Da.has(e.host))return null;let[,t,n,r,i]=Oa.exec(e.path)??[];if(t===void 0||n===void 0)return null;let a={platform:`reddit`,kind:`post`,variant:`iframe`},o=`https://www.reddit.com/r/${t}/comments/${n}/`;return i===void 0?{...a,url:o,id:n}:r===void 0?null:{...a,url:`${o}comment/${i}/`,id:i}}const Aa={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],match(e){let t=ka(e);return t&&{...t,options:{}}}},ja=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,Ma=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,Na=/* @__PURE__ */ [`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]),Pa=/* @__PURE__ */ z(Aa,{parse(e){if(e.tag!==`blockquote`||!(k(e,`reddit-embed-bq`)||k(e,`reddit-card`)))return null;let t=A(e.children).map(e=>e.tag===`a`?ka(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=R(e.attrs.get(`data-embed-height`));return U({...t,options:V(e,Na,L)},n===void 0?void 0:{height:n})},isOwnScript:e=>ja.test(e)||Ma.test(e)}),Fa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ia=`([A-Za-z][A-Za-z0-9._-]{1,29})`,La=/* @__PURE__ */ RegExp(`^(?:/@${Ia})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Ra=/* @__PURE__ */ RegExp(`^/(?:@|add/)${Ia}$`),za=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,Ba=/* @__PURE__ */ RegExp(`^/@${Ia}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`);function Va(e){if(!e||!Fa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=La.exec(t)??[];if(i!==void 0){let e=r===void 0?``:`/@${r}`;return{...n,kind:`video`,url:`https://www.snapchat.com${e}/spotlight/${i}`,id:i}}let[,a]=Ra.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=za.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=Ba.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Ha={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],match(e){let t=Va(e);return t&&{...t,options:{}}}},Ua=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/,Wa=/* @__PURE__ */ z(Ha,{parse(e){if(e.tag!==`blockquote`||!k(e,`snapchat-embed`))return null;let t=I(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=Va({...t,path:t.path.slice(0,-6)});if(!n||!A(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Va(I(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=R(e.attrs.get(`data-snapchat-embed-width`)),a=R(e.attrs.get(`data-snapchat-embed-height`));return U({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Ua.test(e)}),Ga=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ka=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,qa=`[a-z0-9_-]{1,64}`,Ja=`s-[A-Za-z0-9]{1,32}`,Ya=/* @__PURE__ */ RegExp(`^/(${qa})(?:/(sets/${qa}|${qa})(?:/(${Ja}))?)?/?$`,`i`),Xa=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Za=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Qa=/* @__PURE__ */ RegExp(`^${Ja}$`);function $a(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function eo(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ka.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Qa.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return $a(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function to(e){if(!Ga.has(e.host))return null;let[,t,n,r]=Ya.exec(e.path)??[];if(t===void 0||Xa.has(t.toLowerCase())||n!==void 0&&Za.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return $a(`https://soundcloud.com/${i}`,i)}const no={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],match(e){let t=eo(e)??to(e);return t&&{...t,options:{}}},ownsFrame:yn},ro=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function io(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ro.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Ga.has(I(e.attrs.get(`href`)??``)?.host??``)}function ao(e){if(e.tag!==`div`||e.attrs.size!==1||!e.attrs.has(`style`))return!1;let[t,n,r,...i]=e.children;return i.length===0&&io(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&io(r)}const oo=/* @__PURE__ */ z(no,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=eo(I(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Qa.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,L(t)])),{height:a}=H(e)??{};return U({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:ao}),so=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,co=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function lo(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function uo(e,t){return e&&t.has(e.host)?so.exec(e.path)?.[1]:void 0}const fo=/* @__PURE__ */ z({platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:nr,match(e){let t=uo(e,co);return t===void 0?null:{...lo(t),options:{}}},ownsFrame:xn},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=uo(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=L(i)),U({...lo(n),options:r},H(e))},isOwnScript:()=>!1}),po=/* @__PURE__ */ RegExp(`^(?:/intl-[a-z]{2}(?:-[A-Za-z]{2})?)?(?:/embed)?/(track|album|playlist|artist|episode|show|audiobook|chapter)/([A-Za-z0-9]{22})(/video)?/?$`),mo=/* @__PURE__ */ new Set([`utm_source`,`si`]);function ho(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=po.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`spotify`,kind:r?`video`:`post`,url:`https://open.spotify.com/${t}/${n}`,id:n,variant:`iframe`,query:e.query}}function go(e){return Object.fromEntries([...e].filter(([e])=>!mo.has(e)).map(([e,t])=>[e,L(t)]))}const _o=/* @__PURE__ */ z({platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],match(e){let t=ho(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:bn},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=ho(t);if(!n)return null;let{query:r,...i}=n;return U({...i,options:go(r)},H(e))},isOwnScript:()=>!1}),vo=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),yo=/^\/(activities|routes)\/(\d{1,20})\/?$/,bo={activity:`activities`,route:`routes`};function xo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${bo[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}const So={platform:`strava`,name:`Strava`,shapes:[`post iframe`],match(e){if(!vo.has(e.host))return null;let[,t,n]=yo.exec(e.path)??[];return t===void 0||n===void 0?null:{...xo(t===`routes`?`route`:`activity`,n),options:{}}}},Co=/^\d{1,20}$/,wo=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,To=/* @__PURE__ */ new Set([`standard`,`minimal`]),Eo=/^[A-Za-z0-9_-]{1,100}$/;function Do(e){return e===`activity`||e===`route`}const Oo=/* @__PURE__ */ z(So,{parse(e){if(e.tag!==`div`||!k(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!Do(t)||!Co.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&To.has(i)&&(r.style=i),t===`route`&&e.attrs.get(`data-full-width`)===`true`&&(r.fullWidth=!0);let a=e.attrs.get(`data-map-hash`);return a!==void 0&&Eo.test(a)&&(r.mapHash=a),{...xo(t,n),options:r}},isOwnScript:e=>wo.test(e)}),ko=`([a-z0-9]{4,8})`,Ao=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),jo=/* @__PURE__ */ RegExp(`^/[eo]/${ko}$`),Mo=/* @__PURE__ */ RegExp(`^/${ko}/?$`),No=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]);function Po(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function Fo(e){return e!==void 0&&!No.has(e)}function Io(e){if(!e||!Ao.has(e.host))return;let t=(jo.exec(e.path)??Mo.exec(e.path))?.[1];return Fo(t)?t:void 0}const Lo={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],match(e){let t=Io(e);return t===void 0?null:{...Po(t),options:{}}},ownsFrame:Sn},Ro=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,zo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),Bo=/<\/div\s*>$/i;function Vo(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=jo.exec(t.path)??[];if(!Fo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>zo.has(e)).map(([e,t])=>[e,L(t)]));return{...Po(n),options:r}}const Ho=/* @__PURE__ */ z(Lo,{parse(e){let t=W(e,Ro),n=t?.iframe??e,r=Vo(n);return r?U(r,t?.size??H(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=Bo.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null}}),Uo=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Wo=`[A-Za-z][A-Za-z0-9_]{2,31}`,Go=/* @__PURE__ */ RegExp(`^/(?:s/)?(${Wo})/(\\d{1,10})/?$`);function Ko(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const qo={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],match(e){if(!Uo.has(e.host))return null;let[,t,n]=Go.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r={};e.query.has(`single`)&&(r.single=!0);let i=e.query.get(`comment`);return i!==void 0&&/^\d{1,10}$/.test(i)&&(r.comment=Number(i)),Ko(t,n,r)}},Jo=/* @__PURE__ */ RegExp(`^(${Wo})/(\\d{1,10})$`),Yo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Xo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Zo=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]],Qo=/* @__PURE__ */ z(qo,{parse:()=>null,parseScript(e){if(!Yo.test(e.attrs.get(`src`)??``)||Xo.some(t=>e.attrs.has(t)))return null;let[,t,n]=Jo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=V(e,Zo,L);return e.attrs.has(`data-single`)&&(r.single=!0),Ko(t,n,r)},isOwnScript:e=>Yo.test(e)}),$o=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),es=`(\\d{1,20})`,ts=/* @__PURE__ */ RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${es}/?$`),ns=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function rs(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function is(e){return e&&$o.has(e.host)?ts.exec(e.path)?.[1]:void 0}const as={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>N(e,ns),match(e){let t=is(e);return t===void 0?null:{...rs(t),options:{}}},ownsFrame:Cn},os=/* @__PURE__ */ RegExp(`^/embed/${es}$`),ss=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,cs=/^\d{1,3}(?:\.\d{1,20})?$/;function ls(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=us(t,1e4);return{width:t/n,height:1e4/n}}function us(e,t){return t===0?e:us(t,e%t)}function ds(e){if(!k(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!(/* @__PURE__ */ RegExp(`^(\\d{1,20})$`)).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!cs.test(n))return null;let r=ls(n===void 0?1.33:Number(n));return r?U({...rs(t),options:{},fallbackHtml:j(e.children,ns)},r):null}function fs(e){let t=I(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=os.exec(t.path)??[];return n===void 0?null:U({...rs(n),options:{}},H(e))}const ps=/* @__PURE__ */ z(as,{parse(e){return e.tag===`div`?ds(e):e.tag===`iframe`?fs(e):null},isOwnScript:e=>ss.test(e)}),ms=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),hs=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,gs=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function _s(e){if(!e||!ms.has(e.host))return null;let[,t]=hs.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const vs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>N(e,gs),match(e){let t=_s(e);return t&&{...t,options:{}}}},ys=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,bs=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],xs=/* @__PURE__ */ z(vs,{parse(e){if(e.tag!==`blockquote`||!k(e,`text-post-media`))return null;let t=_s(I(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:V(e,bs,L),fallbackHtml:j(e.children,gs)}},isOwnScript:e=>ys.test(e)}),Ss=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/;function Cs(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ws={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],match(e){if(!G.has(e.host))return null;let[,t,n]=Ss.exec(e.path)??[];return t===void 0||n===void 0?null:Cs(n,t)},ownsFrame:ln},Ts=/^\/player\/v1\/(\d{1,25})\/?$/,Es=/^\d{1,25}$/,Ds=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/,Os=/* @__PURE__ */ z(ws,{parse(e){if(e.tag===`blockquote`&&k(e,`tiktok-embed`)){let t=I(e.attrs.get(`cite`)??``),[,n,r]=t&&G.has(t.host)?Ss.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Es.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Cs(a,n)}if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||!G.has(t.host))return null;let[,n]=Ts.exec(t.path)??[];return n===void 0?null:U(Cs(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,L(t)]))),H(e))},isOwnScript:e=>Ds.test(e)}),ks=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),As=`(@[A-Za-z0-9_.-]{1,64})`,js=`(\\d{1,25})`,Ms=/* @__PURE__ */ RegExp(`^/${As}/(?:posts/)?${js}/?$`);function Ns(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function Ps(e){if(!e||!ks.has(e.host))return null;let[,t,n]=Ms.exec(e.path)??[];return t===void 0||n===void 0?null:Ns(t,n)}const Fs={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],match(e){let t=Ps(e);return t&&{...t,options:{}}},ownsFrame:wn},Is=/* @__PURE__ */ RegExp(`^/${As}/${js}/embed$`),Ls=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/,Rs=/* @__PURE__ */ z(Fs,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=Is.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=k(e,`truthsocial-video`)?{video:!0}:{};return U({...Ns(n,r),options:i},H(e))},isOwnScript:e=>Ls.test(e)}),zs=`([a-z0-9-]{1,32})`,Z=`(\\d{1,20})`,Bs=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),Vs=/* @__PURE__ */ RegExp(`^/${zs}/${Z}(?:/[^/]{1,200})?/?$`),Hs=/* @__PURE__ */ RegExp(`^${zs}\\.tumblr\\.com$`),Us=/* @__PURE__ */ RegExp(`^/post/${Z}(?:/[^/]{1,200})?/?$`),Ws=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]);function Gs(e){if(!e)return null;let t,n;return Bs.has(e.host)?[,t,n]=Vs.exec(e.path)??[]:([,t]=Hs.exec(e.host)??[],[,n]=Us.exec(e.path)??[]),t===void 0||n===void 0||Ws.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Ks={platform:`tumblr`,name:`Tumblr`,shapes:[`post iframe`],match(e){let t=Gs(e);return t&&{...t,options:{}}}},qs=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${zs})/${Z}/v2$`),Js=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${Z}$`),Ys=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/,Xs=/* @__PURE__ */ z(Ks,{parse(e){if(e.tag!==`div`||!k(e,`tumblr-post`))return null;let t=I(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=qs.exec(t.path)??[],i=r??Js.exec(t.path)?.[1];if(i===void 0)return null;let[a,...o]=e.children.filter(e=>e.type!==`text`||e.raw.trim()!==``);if(o.length>0||a?.type!==`element`||a.tag!==`a`)return null;let s=Gs(I(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>Ys.test(e)}),Zs=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),Qs=/^[A-Za-z0-9_]{3,25}$/,$s=/^v?(\d{1,12})$/,ec=/^[A-Za-z0-9_-]{6,30}$/,tc=/^[A-Za-z0-9_-]{6,100}$/,nc=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,rc=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]);function ic(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const ac=e=>ic(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),oc=e=>ic(`https://www.twitch.tv/videos/${e}`,e),sc=e=>ic(`https://www.twitch.tv/collections/${e}`,e),cc=e=>ic(`https://clips.twitch.tv/${e}`,e);function lc(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return tc.test(t)?{found:cc(t),options:{}}:null}if(!Zs.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=$s.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:oc(t),options:n!==void 0&&nc.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?ec.test(r??``)?{found:sc(r??``),options:{}}:null:t.length===3&&r===`clip`?Qs.test(n)&&tc.test(i??``)?{found:cc(i??``),options:{}}:null:t.length===1&&Qs.test(n)&&!rc.has(n.toLowerCase())?{found:ac(n),options:{}}:null}const uc={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],match(e){let t=lc(e);return t&&{...t.found,options:t.options}},ownsFrame:un},dc=[`autoplay`,`muted`,`time`];function fc(e){let t={};for(let n of dc){let r=e.get(n);r!==void 0&&(t[n]=L(r))}return t}function pc(e){let t=e.query.get(`channel`);if(t!==void 0)return Qs.test(t)?ac(t):null;let[,n]=$s.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return oc(n);let r=e.query.get(`collection`);return r!==void 0&&ec.test(r)?sc(r):null}const mc=/* @__PURE__ */ z(uc,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=pc(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=tc.test(e)?cc(e):null}return n&&U({...n,options:fc(t.query)},H(e))},isOwnScript:()=>!1}),hc=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Q=`(\\d{1,12})`,gc=`([0-9a-f]{6,20})`,_c=[RegExp(`^/${Q}(?:/${gc})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Q}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Q}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Q}/?$`)],vc=/* @__PURE__ */ RegExp(`^/video/${Q}/?$`),yc=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),bc=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function xc(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Sc(e){let[,t]=bc.exec(e.fragment??``)??[];return t?{t}:{}}function Cc(e){if(!e||!hc.has(e.host))return null;for(let t of _c){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return xc(n,r)}return null}function wc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=vc.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${gc}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!yc.has(e)).map(([e,t])=>[e,L(t)]));return{...xc(t,n),options:{...r,...Sc(e)}}}const Tc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],match(e){let t=wc(e);if(t)return t;let n=Cc(e);return n&&{...n,options:Sc(e)}},ownsFrame:dn},Ec=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Dc=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/;function Oc(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=I(e.attrs.get(`href`)??``);return n!==null&&hc.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function kc(e,t){return e?.type===`text`&&e.raw.trim()===t}function Ac(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,r,i,a,o,s,...c]=e.children;return c.length===0&&Oc(n,e=>Cc(e)?.id===t.id)&&kc(r,`from`)&&Oc(i,()=>!0)&&kc(a,`on`)&&Oc(o,e=>e.path===``||e.path===`/`)&&kc(s,`.`)}const jc=/* @__PURE__ */ z(Tc,{parse(e){let t=W(e,Ec),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=wc(I(n.attrs.get(`src`)??``));return r&&U(r,t?.size??H(n))},isOwnScript:e=>Dc.test(e),isOwnExtra:Ac}),Mc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Nc=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Pc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,Fc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Ic(e,t=Nc){if(!e||!Mc.has(e.host))return null;let[,n=`i`,r]=t.exec(e.path)??[];return r===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${n}/status/${r}`,id:r,variant:`sdk`}}function Lc(e){return A(e).reverse().map(e=>e.tag===`a`?Ic(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null)??null}function Rc(e,t){return Lc(O(e)??[])?.id===t}const zc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>N(e,Fc)&&Rc(e,t.id),match(e){let t=Ic(e,Pc);return t&&{...t,options:{}}}},Bc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Vc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Hc=/* @__PURE__ */ z(zc,{parse(e){if(e.tag!==`blockquote`||!(k(e,`twitter-tweet`)||k(e,`twitter-video`)))return null;let t=Lc(e.children);return t?{...t,options:V(e,Vc,L),fallbackHtml:j(e.children,Fc)}:null},isOwnScript:e=>Bc.test(e)}),Uc=`https://www.youtube.com`,Wc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,Gc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,Kc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,qc=/^\/([A-Za-z0-9_-]{11})\/?$/,Jc=/^[A-Za-z0-9_-]{10,64}$/,Yc=/^UC[A-Za-z0-9_-]{22}$/,Xc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,Zc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,Qc=/^t=(.+)$/;function $c(e){if(e===void 0||e===``)return;let t=Zc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function el(e){return $c(e.get(`start`))??$c(e.get(`t`))}function tl(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function nl(e,t=!1){return tl(e,t?`${Uc}/shorts/${e}`:`${Uc}/watch?v=${e}`)}function rl(e){return e!==void 0&&Jc.test(e)?tl(e,`${Uc}/playlist?list=${e}`):null}function il(e){return e!==void 0&&Yc.test(e)?tl(e,`${Uc}/channel/${e}/live`):null}function al(e){let[,t,n]=Gc.exec(e.path)??[];if(n!==void 0)return{found:nl(n)};if(t===`videoseries`){let t=rl(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=il(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function ol(e,t){let n=el(e.query)??$c(Qc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const sl=[Hc,ta,Zr,xs,Os,/* @__PURE__ */ z({platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],match(e){if(e.host===`youtu.be`){let[,t]=qc.exec(e.path)??[];return t===void 0?null:{...nl(t),options:ol(e,!1)}}let t=en.has(e.host);if(!t&&!$t.has(e.host))return null;let n=ol(e,t);if(B(e.path,`/embed`)){let t=al(e);return t&&{...t.found,options:n}}if(t)return null;if(/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&Wc.test(t)?{...nl(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=rl(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=Xc.exec(e.path)??[],i=il(r);if(i)return{...i,options:n};let[,a,o]=Kc.exec(e.path)??[];return a===void 0||o===void 0?null:{...nl(o,a===`shorts`),options:n}},ownsFrame:sn},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=t!==null&&en.has(t.host);if(!t||!(n||$t.has(t.host)))return null;let r=al(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,L(t)]),a=Object.fromEntries(i),o=el(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),U({...r.found,options:a},H(e))},isOwnScript:()=>!1}),Qo,Wa,_a,Pa,Ea,_o,jc,mc,Mr,oo,sr,dr,ca,Ai,ps,Ho,fo,Rs,Ki,Oo,_i,wr,Xs];function cl(e){return sl.find(t=>t.platform===e)}function ll(e){return ul(sl,e)}function ul(e,t){let n=fl(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function dl(e,t){let n=fl(t);return n&&e.match(n)}function fl(e){return typeof e==`string`?I(e):null}function pl(e,t){if(t.platform!==e.platform)return null;let n=dl(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!e.shapes.includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||e.trustsFallback?.(t.fallbackHtml,t))return t;let r={...t};return delete r.fallbackHtml,r}const ml={bluesky:`Bluesky`,rumble:`Rumble`};function hl(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function gl(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:dl(n,e));if(!a&&e!==void 0&&vl(n,e))return{error:hl(i)};if(!a)return{error:`social-embeds: not a ${i} post URL: ${String(e)}`};if(a.platform!==r)return{error:`social-embeds: expected a ${i} embed, got ${a.platform}`};let o=pl(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function _l(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=tr(e.url);return t?hl(ml[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function vl(e,t){let n=typeof t==`string`?I(t):null;return n!==null&&e.needsLookup?.(n)===!0}function yl(e){return bl(sl,e)}function bl(e,t){if(typeof t!=`string`)return null;let n=O(t);return n?Sl(e,n):xl(e,t)}function xl(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:O(r),a=i&&Sl(e,i);if(a?.platform===n.platform)return a}return null}function Sl(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Pe(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(Cl(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[t]=i;if(a||i.length!==1||!t||t.children.length!==0)return null;for(let n of e){let e=n.parseScript?.(t);if(e)return e}return null}for(let t of e){let e=t.parse(n);if(!e)continue;if(a&&!t.allowsFbRoot||r&&!t.isOwnExtra?.(r,e))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(e=>e!==void 0&&t.isOwnScript(e)))return null;let s=o.map(e=>e===void 0?{}:t.scriptOptions?.(e)??{});return{...e,options:Object.assign({},...s,e.options)}}return null}function Cl(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function wl(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Tl(e){return e===null?void 0:wl(e.trim().replace(/px$/i,``))}function El(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function Dl(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Ol(e,t){let n=t??e.getAttribute(`html`)??El(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:wl(i)??(i?.trim()?i:void 0),maxWidth:Tl(e.getAttribute(`max-width`)),height:Tl(e.getAttribute(`height`)),maxHeight:Tl(e.getAttribute(`max-height`))},eager:Dl(e),iframeTitle:e.getAttribute(`iframe-title`)??void 0}}const kl=/* @__PURE__ */ new WeakMap;function Al(e,t){for(let n of e.querySelectorAll(`iframe`)){let e=n.getAttribute(`title`);e!==t&&(e?.trim()&&e!==kl.get(n)||(n.setAttribute(`title`,t),kl.set(n,t)))}}function jl(e,t){return e?.trim()?e:t}function Ml(e,t){Al(e,t);let n=new MutationObserver(()=>{Al(e,t)});return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`title`]}),()=>{n.disconnect()}}const Nl=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function Pl(e,t){e.removeAttribute(`style`),$(e,t)}function $(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&Nl.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Fl(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),$(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function Il(e,t,n){if(t||typeof IntersectionObserver>`u`)return n(),()=>{};let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r.disconnect(),n())},{rootMargin:`200px 0px`});return r.observe(e),()=>{r.disconnect()}}function Ll(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Rl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=jl(n.iframeTitle,t.title),l=document.createElement(`div`),u,d=e=>{Pl(l,Ke(t,e,u))};d(n);let f=Ll(document.createElement(`div`)),p=Ll(document.createElement(`div`)),m=i.length>0?i:[t.fallbackHtml===void 0?Fl():zl(t.fallbackHtml,t.fallbackImage===!0)];p.append(...m),f.append(p),l.append(f),e.append(l);let h,g=!1,_,v=()=>{},y=[],b=()=>{p.remove(),v(),g||(g=!0,a())},ee=s?`did not report its height`:`did not load`,x=()=>{clearTimeout(_),_=setTimeout(()=>{g||(v(),p.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${ee}`)))},15e3)},S=e=>{let n=document.createElement(`iframe`);n.src=t.clientSrc?t.clientSrc(e):e,n.title=c,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),$(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{s||b()}),h?h.replaceWith(n):f.prepend(n),h=n},C=!1,w=()=>{if(C)return;C=!0,s&&y.push(s.listen(()=>h,e=>{u=e,$(l,{height:u}),b()}));let{sizeInSrc:e}=t;e?y.push(e.watch(f,t=>{S(e.src(t))})):S(t.src)};return r&&w(),y.push(Il(f,!1,()=>{w(),s?g||(v=s.onScreen(f,e=>{e?x():clearTimeout(_)})):x()})),{wrapper:l,cleanup:()=>{for(let e of y)e();v(),clearTimeout(_),l.remove()},update(e,n,r){d(e),c=jl(r,t.title),h&&(h.title=c),n&&w()}}}function zl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Bl=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function Vl(e){let t=e.querySelector(Bl.map(e=>`[${e}]`).join());for(let e of Bl){let n=t?.getAttribute(e);if(n)return n}}function Hl(e){return`View this post on ${e}`}function Ul(e){return e instanceof Error?e:Error(String(e))}function Wl(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{Pl(l,{width:e.width??`100%`,maxWidth:e.maxWidth??t.maxWidth})};u(n);let d=document.createElement(`div`);$(d,{width:`100%`});let f=document.createElement(`div`);f.innerHTML=t.markup,d.append(f);let p=Vl(f),m=t.hasFallback?[]:o.length>0?o:[Fl(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=Ml(f,jl(n.iframeTitle,t.title)),g=e=>{for(let e of m)e.parentNode?.removeChild(e);m=e,d.append(...e)},_=!1,v=!1,y,b=()=>{},ee=()=>{_||v||(v=!0,clearTimeout(y),b(),g([]),s())},x=e=>{if(t.hasFallback||p===void 0)g([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,p),e.textContent=Hl(i),g([e])}c(e)},S=(e,t)=>{_||v||(b(),b=()=>{},e>=3||t instanceof he?x(t):y=setTimeout(()=>{C(e+1)},1e3*2**(e-1)))},C=e=>{if(!(_||v)){try{b=r.render(f,ee)}catch(t){S(e,Ul(t));return}y=setTimeout(()=>{S(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},w=!1,T=()=>{w||(w=!0,r.load().then(()=>{C(1)},e=>{_||x(Ul(e))}))},te=Il(f,a,T);return{wrapper:l,cleanup:()=>{_=!0,te(),clearTimeout(y),b(),h(),l.remove()},update(e,n,r){u(e),h(),h=Ml(f,jl(r,t.title)),n&&T()}}}const Gl=typeof HTMLElement>`u`?class{}:HTMLElement,Kl=`embed`;function ql(e){let t=[];for(let n of e.childNodes)if(n.nodeType===Node.ELEMENT_NODE&&!(n instanceof HTMLTemplateElement)||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim()){let e=n.cloneNode(!0);if(e instanceof Element)for(let t of[e,...e.querySelectorAll(`[id]`)])t.removeAttribute(`id`);t.push(e)}return t}function Jl(e){let t=``;for(let n of e.children)n.slot!==Kl&&(t+=n.outerHTML);return t&&(yl(t)??Ln(t))?t:void 0}function Yl(e){let t=`html`in e?yl(e.html):ll(e.url);if(!t){let t=`html`in e?Ln(e.html):null;return t?Jn(t):{kind:`error`,message:_l(e)}}let n=cl(t.platform);if(!n)return{kind:`error`,message:_l(e)};let r=gl(void 0,t,n);return r.error===void 0?Yt(r.embed):{kind:`error`,message:r.error}}const Xl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`,`iframeTitle`];var Zl=class extends Gl{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`,`iframe-title`];#e=null;#t;#n;#r;#i;#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${Kl}"></slot>`;for(let e of Xl){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get iframeTitle(){return this.getAttribute(`iframe-title`)}set iframeTitle(e){this.#c(`iframe-title`,e)}get eager(){return Dl(this)}set eager(e){this.#c(`eager`,e===``||e&&e!==`false`?``:null)}connectedCallback(){!this.#t&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#t?.disconnect(),this.#u(),this.#r=void 0,this.#i=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#t;if(e){e.disconnect(),e.observe(this,{childList:!0});for(let t of this.children)t instanceof HTMLTemplateElement&&e.observe(t.content,{childList:!0,subtree:!0,characterData:!0})}}#c(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}#l(){if(!this.isConnected||!this.#t)return;let e=this.#n?.wrapper;for(let t of[...this.children])t!==e&&t.slot===Kl&&t.remove();let t=!e||e.parentNode===this,n=Ol(this,this.#e);this.#i=n.source?void 0:t&&this.#i||Jl(this),n.source??=this.#i===void 0?null:{html:this.#i};let r=JSON.stringify(n.source);r===this.#r&&t?this.#n?.update(n.layout,n.eager,n.iframeTitle):(this.#u(),this.#r=r,this.#d(n))}#u(){this.#a+=1;let e=this.#n;this.#n=void 0,e?.cleanup()}#d(e){let{source:t,layout:n,eager:r,iframeTitle:i}=e;if(!t)return;let a=this.#a,o=e=>{queueMicrotask(()=>{a===this.#a&&this.isConnected&&this.dispatchEvent(e)})},s=e=>{o(new ErrorEvent(`error`,{error:e,message:e.message}))},c=Yl(t);if(c.kind===`error`){s(Error(c.message));return}let l={...n,eager:r,iframeTitle:i,placeholder:this.#i===void 0?ql(this):[],onLoad:()=>{o(new Event(`load`))},onError:s};this.#n=c.kind===`iframe`?Rl(this,c,l):Wl(this,c,l),this.#n.wrapper.slot=Kl}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Zl);export{Zl as SocialEmbedElement};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "social-embeds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Turn social media embed code or post URLs into working React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@testing-library/react": "16.3.3",
|
|
86
86
|
"@types/react": "19.3.0",
|
|
87
87
|
"@types/react-dom": "19.3.0",
|
|
88
|
-
"es-module-lexer": "
|
|
88
|
+
"es-module-lexer": "3.0.5",
|
|
89
89
|
"eslint": "10.15.0",
|
|
90
90
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
91
91
|
"happy-dom": "21.0.4",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
"react-dom": "19.3.1",
|
|
96
96
|
"tsdown": "0.23.7",
|
|
97
97
|
"typescript": "6.0.3",
|
|
98
|
-
"typescript-eslint": "8.
|
|
98
|
+
"typescript-eslint": "8.73.0",
|
|
99
99
|
"vite": "8.3.8",
|
|
100
|
-
"vitest": "5.1.
|
|
100
|
+
"vitest": "5.1.1"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "tsdown",
|