social-embeds 0.10.0 → 0.10.1
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 +66 -2
- package/dist/core/drivers.js +8 -0
- package/dist/element.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ JavaScript added to a page in a Next.js 16 production build, gzipped:
|
|
|
117
117
|
|
|
118
118
|
Before 0.9.4, Next.js kept every platform in a `createSocialEmbed` component as well: about 17 KB for `youtube` alone.
|
|
119
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>`.
|
|
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>`. No list is chosen per page at runtime; in Next.js, see [Embed code from a CMS](#embed-code-from-a-cms) for two ways to load less.
|
|
121
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.
|
|
122
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.
|
|
123
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.
|
|
@@ -734,7 +734,71 @@ export function Embed({ html }: { html: string }) {
|
|
|
734
734
|
|
|
735
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.
|
|
736
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.
|
|
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; see [Embed code from a CMS](#embed-code-from-a-cms) for loading less of it.
|
|
738
|
+
|
|
739
|
+
### Embed code from a CMS
|
|
740
|
+
|
|
741
|
+
Nothing chooses platforms per page. In a Next.js 16 build, Turbopack and webpack put every component a route can render into one chunk, so a page with one X post loads the same code as a page with every platform. Two things load less.
|
|
742
|
+
|
|
743
|
+
**Pages without an embed, under Turbopack.** Turbopack loads the package on every page of a route that renders embeds, also on a page that has none: about 27 KB with `<SocialEmbed>`. Load it through `next/dynamic` instead:
|
|
744
|
+
|
|
745
|
+
```tsx
|
|
746
|
+
// app/lazy-social-embed.tsx
|
|
747
|
+
'use client';
|
|
748
|
+
|
|
749
|
+
import dynamic from 'next/dynamic';
|
|
750
|
+
import type { SocialEmbedProps } from 'social-embeds';
|
|
751
|
+
|
|
752
|
+
const SocialEmbed = dynamic(() =>
|
|
753
|
+
import('social-embeds').then((module) => module.SocialEmbed),
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
export function LazySocialEmbed(props: SocialEmbedProps) {
|
|
757
|
+
return <SocialEmbed {...props} />;
|
|
758
|
+
}
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
Render `<LazySocialEmbed>` where you rendered `<SocialEmbed>`. A page without an embed then adds 1.8 KB, and a page with one about 29 KB. webpack already loads nothing on a page without an embed.
|
|
762
|
+
|
|
763
|
+
**Recognition on the server.** `parseEmbed` in a Server Component keeps the code that reads embed code out of the browser. Render the component of each platform your editors use:
|
|
764
|
+
|
|
765
|
+
```tsx
|
|
766
|
+
// app/server-embed.tsx: a Server Component
|
|
767
|
+
import {
|
|
768
|
+
FacebookEmbed,
|
|
769
|
+
GenericIframeEmbed,
|
|
770
|
+
InstagramEmbed,
|
|
771
|
+
TikTokEmbed,
|
|
772
|
+
XEmbed,
|
|
773
|
+
YouTubeEmbed,
|
|
774
|
+
} from 'social-embeds';
|
|
775
|
+
import { parseEmbed, parseIframe } from 'social-embeds/parser';
|
|
776
|
+
|
|
777
|
+
export function ServerEmbed({ html }: { html: string }) {
|
|
778
|
+
const embed = parseEmbed(html);
|
|
779
|
+
if (!embed) {
|
|
780
|
+
const iframe = parseIframe(html);
|
|
781
|
+
return iframe ? <GenericIframeEmbed embed={iframe} /> : null;
|
|
782
|
+
}
|
|
783
|
+
switch (embed.platform) {
|
|
784
|
+
case 'x':
|
|
785
|
+
return <XEmbed embed={embed} />;
|
|
786
|
+
case 'instagram':
|
|
787
|
+
return <InstagramEmbed embed={embed} />;
|
|
788
|
+
case 'facebook':
|
|
789
|
+
return <FacebookEmbed embed={embed} locale="bg_BG" />;
|
|
790
|
+
case 'tiktok':
|
|
791
|
+
return <TikTokEmbed embed={embed} />;
|
|
792
|
+
case 'youtube':
|
|
793
|
+
return <YouTubeEmbed embed={embed} />;
|
|
794
|
+
// … one case for each platform your editors use
|
|
795
|
+
default:
|
|
796
|
+
return null;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
With every platform in the switch it adds about 21 KB under Turbopack or webpack, against 27 KB for `<SocialEmbed>`; with the five above and generic iframes, about 12 KB under Turbopack. As with `<SocialEmbed>`, Turbopack loads it on every page of the route, and webpack only on a page with an embed. Each case can pass the platform's own props, such as Facebook's `locale`, which `<SocialEmbed>` has no prop for. Return your own fallback where the switch returns `null`. `onLoad` and `onError` cannot be passed from a Server Component, so a platform component that needs them goes in a Client Component of your own, as above.
|
|
738
802
|
|
|
739
803
|
## Server-side fallback content
|
|
740
804
|
|
package/dist/core/drivers.js
CHANGED
|
@@ -70,11 +70,19 @@ const instagramDriver = {
|
|
|
70
70
|
return stop;
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
let threadsIds = 0;
|
|
74
|
+
function ownId(container) {
|
|
75
|
+
const blockquote = container.querySelector("blockquote");
|
|
76
|
+
if (!blockquote?.id || blockquote.hasAttribute("class")) return;
|
|
77
|
+
threadsIds += 1;
|
|
78
|
+
blockquote.id = `${blockquote.id}-${String(threadsIds)}`;
|
|
79
|
+
}
|
|
73
80
|
const threadsDriver = {
|
|
74
81
|
load: () => loadThreads(),
|
|
75
82
|
render(container, done) {
|
|
76
83
|
inDocument(container, "Threads");
|
|
77
84
|
const stop = watch(container, (element) => element.querySelector("iframe") !== null && element.querySelector("blockquote") === null, done);
|
|
85
|
+
ownId(container);
|
|
78
86
|
reveal(container, "text-post-media");
|
|
79
87
|
processEmbeds();
|
|
80
88
|
return stop;
|
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)}}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};
|
|
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}};let Se=0;function Ce(e){let t=e.querySelector(`blockquote`);t?.id&&!t.hasAttribute(`class`)&&(Se+=1,t.id=`${t.id}-${String(Se)}`)}const we={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=D(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return Ce(e),ge(e,`text-post-media`),be(),n}},Te=/* @__PURE__ */ new Map;function Ee(e){let t=Te.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()=>{}}},Te.set(e,t)),t}const De={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}},Oe=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),ke=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Ae=/<([a-zA-Z][a-zA-Z0-9-]*)/y,je=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Me=/\s*(\/?)>/y,Ne=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Pe=/* @__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}Ne.lastIndex=a;let s=Ne.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=Ne.lastIndex;continue}let c=Fe(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:ke.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&&!Oe.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Fe(e,t){Ae.lastIndex=t;let n=Ae.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Ae.lastIndex;for(;;){Me.lastIndex=i;let t=Me.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Me.lastIndex};je.lastIndex=i;let a=je.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Ie(s??c??l??``)),i=je.lastIndex}}function Ie(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 Pe.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 Le(e,t),t}function Le(e,t){for(let n of e)n.type===`element`&&(t.push(n),Le(n.children,t))}const Re=/* @__PURE__ */ new Set([`href`,`cite`]),ze=/^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)||Re.has(e)&&!ze.test(i)||(n+=` ${e}="${M(i)}"`)}n+=`>`,Oe.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 Be(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 Ve(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Be(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 He={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ue={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},We={post:300,video:200};function Ge(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 Ke(e,t){if(e.variant===`iframe`)return Ge(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(Ue)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ge({...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)}"${Ve(He,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:Ee(i),minHeight:We[e.kind],label:`Facebook`,title:e.kind===`video`?`Facebook video`:`Facebook post`,hasFallback:F(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function qe(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Je(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=qe(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 Ye(e,t){let n=qe(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 Xe(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 Ze=[`header`,`footer`,`context`],Qe=/\/albums\/\d+$/;function $e(e,t){let n=Qe.test(e.url),r=Ze.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:Xe,src:e=>Ye({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 et(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 tt={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 nt(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:tt,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function rt(e,t){let n=P(e.options,{captioned:t.captioned}),r=`<blockquote${Be({"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 it=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function at(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])=>it.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function ot(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 st={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ct={small:236,medium:345,large:600};function lt(e,t){let n=P(e.options,{width:t.pinWidth}),r=`<a href="${M(e.url)}"${Ve(st,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:De,minHeight:270,label:`Pinterest`,title:`Pinterest pin`,hasFallback:!1,maxWidth:ct[String(n.width)]??236}}const ut={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},dt={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 ft(e,t){let n=[];for(let[e,r]of Object.entries(ut)){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:dt,startHeight:e.size?.height??316,maxWidth:640}}function pt(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 mt={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 ht(e,t){let n=[];for(let[e,r]of Object.entries(mt)){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 gt(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 _t=/* @__PURE__ */ new Set([`track`,`episode`]);function vt(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??(_t.has(n)?152:352)}}const yt={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 bt(e){return e===`minimal`?`minimal`:`standard`}function xt(e,t){let n=e.id.startsWith(`route/`),r=bt(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:yt,startHeight:650,...i?{}:{maxWidth:554}}}const St=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),Ct={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function wt(e,t){let n=Object.entries(e.options).filter(([e])=>St.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,Ct))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Tt=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function Et(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 Dt={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 Ot(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 Tt){let n=Et(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:Dt,startHeight:300,maxWidth:500}}function kt(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 At(e,t){let n=P(e.options,{theme:t.theme}),r=`<blockquote${Be({"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:we,minHeight:240,label:`Threads`,title:`Threads post`,hasFallback:F(e.fallbackHtml),maxWidth:658}}const jt={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 Mt(e,t){let n=o(t,jt);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 Nt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Pt={origin:`https://truthsocial.com`,read:Nt,listen:s,onScreen:c},Ft={origin:`https://truthsocial.com`,read(e){let t=Nt(e);return t===void 0||t<=0?void 0:t+165},listen:s,onScreen:c},It=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Lt(e){let t=It.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?Ft:Pt,startHeight:150,maxWidth:e.size?.width??600}}const Rt={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 zt(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:Rt,startHeight:400,maxWidth:540}}const Bt=[`channel`,`video`,`collection`,`clip`,`parent`];function Vt(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 Ht(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]=Vt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Bt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Ut}}function Ut(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Wt={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 Gt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Wt),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 Kt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function qt(e,t){let n=P(e.options,{...t}),r=e.fallbackHtml??`<a href="${M(e.url)}"></a>`,i=`<blockquote${Ve(Kt,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 Jt={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 Yt(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 Xt(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}=Yt(e),f=o(r,Jt).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 Zt(e){switch(e.platform){case`x`:return qt(e,{});case`instagram`:return rt(e,{});case`threads`:return At(e,{});case`facebook`:return Ke(e,{});case`tiktok`:return Mt(e,{});case`youtube`:return Xt(e,{});case`telegram`:return Ot(e,{});case`snapchat`:return pt(e);case`linkedin`:return ot(e,{});case`reddit`:return ft(e,{});case`pinterest`:return lt(e,{});case`spotify`:return vt(e,{});case`vimeo`:return Gt(e,{});case`twitch`:return Ht(e,{});case`dailymotion`:return f(e,{});case`bluesky`:return u(e,{});case`soundcloud`:return ht(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return zt(e);case`kick`:return at(e,{});case`giphy`:return et(e);case`tenor`:return kt(e);case`streamable`:return wt(e,{});case`rumble`:return gt(e);case`truthsocial`:return Lt(e);case`imgur`:return nt(e,{});case`strava`:return xt(e,{});case`flickr`:return $e(e,{});default:return e.platform}}const Qt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function I(e){let t=Qt.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=$t(t===-1?e:e.slice(0,t)),r=$t(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 $t(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=en(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function en(e,t){return t===0?e:en(t,e%t)}const tn=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),nn=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),rn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),G=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),an=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),K=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),on=/* @__PURE__ */ new Set([`player.kick.com`]),sn=`embed.music.apple.com`,cn=`embed.podcasts.apple.com`,ln=e=>nn.has(e.host)||tn.has(e.host)&&B(e.path,`/embed`),un=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||rn.has(e.host)&&(B(e.path,`/embed`)||B(e.path,`/video`)),dn=e=>G.has(e.host)&&B(e.path,`/player`),fn=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&B(e.path,`/embed`),pn=e=>e.host===`player.vimeo.com`,mn=e=>an.has(e.host)&&B(e.path,`/plugins`),hn=e=>K.has(e.host)&&B(e.path,`/embed`),gn=e=>on.has(e.host),_n=e=>e.host===`www.linkedin.com`&&B(e.path,`/embed`),vn=e=>e.host===`assets.pinterest.com`,yn=e=>e.host===sn,bn=e=>e.host===cn,xn=e=>e.host===`w.soundcloud.com`,Sn=e=>e.host===`open.spotify.com`&&B(e.path,`/embed`),Cn=e=>e.host===`rumble.com`&&B(e.path,`/embed`),wn=e=>e.host===`streamable.com`&&(B(e.path,`/e`)||B(e.path,`/o`)),Tn=e=>e.host===`tenor.com`&&B(e.path,`/embed`),En=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function Dn(e){return[ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En].some(t=>t(e))}const On=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],kn=/* @__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`]),An=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),jn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,Mn=/* @__PURE__ */ RegExp(`^(?:https:)?//${jn}(?:[/?#]|$)`,`i`),Nn=/* @__PURE__ */ RegExp(`^(?:\\*|'self'|'src'|'none'|https://${jn})$`,`i`),Pn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Fn=/[\t\n\f\r ]+/,In=/^\s*(width|height)\s*:(.*)$/is,Ln=/^(\d+)px$/i,Rn=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function zn(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)??Jn(r);return Vn({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,Rn)?.size})}function Bn(e){return Vn(e)}function Vn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Hn(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=On.find(e=>e===i),o=Gn(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Un(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Wn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:qn(t.size),...o?{ratio:o}:{}}}function Hn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=Mn.test(t)&&!t.includes(`\\`)?I(t):null;return!n||Pn.test(n.path)||Dn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Un(e){return e.split(`;`).map(e=>e.split(Fn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&An.has(e)&&t.every(e=>Nn.test(e))).map(e=>e.join(` `)).join(`; `)}function Wn(e){let t=e.split(Fn).map(e=>e.toLowerCase()).filter(e=>kn.has(e));return[...new Set(t)].join(` `)}function Gn(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Kn(t)&&Kn(n)?{width:t,height:n}:void 0}function Kn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function qn(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 Jn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=In.exec(r)??[],a=R(Ln.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 Yn={width:16,height:9};function Xn(e){let t=Bn(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}:{},...Zn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Zn({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??Yn,...n===void 0?{}:{maxWidth:n}}:{ratio:Yn,height:r}}const Qn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),$n=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,er=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,tr=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),nr=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function rr(e){let t=typeof e==`string`?I(e):null;return t?ir(t)?`rumble`:ar(t)?`bluesky`:null:null}function ir(e){return tr.has(e.host)&&nr.test(e.path)}function ar(e){if(!Qn.has(e.host))return!1;let[,t]=$n.exec(e.path)??[];return t!==void 0&&er.test(t)}const or=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,sr=/^\d{1,15}$/;function cr(e,t){if(e?.host!==t)return null;let[,n,r,i]=or.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!sr.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!sr.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const lr=/* @__PURE__ */ z({platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],match(e){let t=cr(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:yn},{parse(e){if(e.tag!==`iframe`)return null;let t=cr(I(e.attrs.get(`src`)??``),sn);if(!t)return null;let{height:n}=H(e)??{};return U({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1}),ur=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,dr=/^\d{1,15}$/;function fr(e,t){if(e?.host!==t)return null;let[,n,r]=ur.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!dr.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 pr=/* @__PURE__ */ z({platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],match(e){let t=fr(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:bn},{parse(e){if(e.tag!==`iframe`)return null;let t=fr(I(e.attrs.get(`src`)??``),cn);return t&&U({...t,options:{}},H(e))},isOwnScript:()=>!1}),mr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,hr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,gr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),_r=/* @__PURE__ */ RegExp(`^/profile/${mr}/post/${hr}/?$`),vr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function yr(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 br(e){if(!e||!gr.has(e.host))return null;let[,t,n]=_r.exec(e.path)??[];return t===void 0||n===void 0?null:yr(t,n)}const xr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:ar,trustsFallback:e=>N(e,vr),match(e){let t=br(e);return t&&{...t,options:{}}}},Sr=/* @__PURE__ */ RegExp(`^at://${mr}/app\\.bsky\\.feed\\.post/${hr}$`),Cr=/^[a-z2-7]{20,100}$/,wr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Tr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,Er=/* @__PURE__ */ z(xr,{parse(e){if(e.tag!==`blockquote`||!k(e,`bluesky-embed`))return null;let[,t,n]=Sr.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=yr(t,n);if(A(e.children).reverse().map(e=>e.tag===`a`?br(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&&Cr.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&wr.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:j(e.children,vr)}},isOwnScript:e=>Tr.test(e)}),Dr=/^x[a-z0-9]{4,12}$/,Or=/^x[a-z0-9]{3,12}$/;function kr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Ar(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(!Dr.test(r)||n!==void 0&&!Or.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),kr(r,i)}function jr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Dr.test(t)?kr(t,{}):null}if(!rn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Dr.test(t)?kr(t,{}):null}const Mr={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],match(e){return Ar(e)??jr(e)},ownsFrame:un},Nr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Pr=/* @__PURE__ */ z(Mr,{parse(e){let t=W(e,Nr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=I(n.attrs.get(`src`)??``);if(!r)return null;let i=Ar(r)??jr(r);return i&&U(i,t?.size??H(n))},isOwnScript:()=>!1}),Fr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),q=`https://www.facebook.com`,Ir=`[A-Za-z0-9.\\-]{1,80}`,Lr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Rr=/* @__PURE__ */ RegExp(`^/(${Ir})/posts/(${Lr})/?$`),zr=/* @__PURE__ */ RegExp(`^/(${Ir})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Br=/* @__PURE__ */ RegExp(`^/(${Ir})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),Vr=/^\/reel\/(\d{1,25})\/?$/,Hr=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Ur=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Wr=/* @__PURE__ */ RegExp(`^${Lr}$`),Gr=/^\d{1,25}$/,Kr={name:`class`,value:/^fb-xfbml-parse-ignore$/},qr=/* @__PURE__ */ new Map([[`div`,[Kr]],[`blockquote`,[`cite`,Kr]],[`a`,[`href`]],[`p`,[]]]);function Jr(e){if(!e||!Fr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Rr.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${q}/${r}/posts/${i}`};if(Hr.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Wr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Gr.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${q}${t}?story_fbid=${e}${i}`}}if(Ur.has(t)){let e=n.get(`fbid`);return e===void 0||!Gr.test(e)?null:{kind:`post`,id:e,url:`${q}${t}?fbid=${e}`}}let[,a,o,s]=zr.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]=Br.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||!Gr.test(e)?null:{kind:`video`,id:e,url:`${q}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=Vr.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 Yr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>N(e,qr),match(e){let t=Jr(e);return t&&J(t,t.kind,`sdk`,{})},ownsFrame:mn},Xr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Zr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Qr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],$r=/* @__PURE__ */ z(Yr,{parse(e){if(e.tag===`div`){let t=k(e,`fb-post`)?`post`:k(e,`fb-video`)?`video`:null,n=Jr(I(e.attrs.get(`data-href`)??``));return!t||!n?null:{...J(n,t,`sdk`,V(e,Zr,L)),fallbackHtml:j(e.children,qr)}}if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||!an.has(t.host))return null;let n=Jr(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 Qr){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=>Xr.test(e),scriptOptions(e){let[,t]=Xr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0}),ei=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),ti=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,ni=`(\\d{1,20})`,ri=/* @__PURE__ */ RegExp(`^/photos/${ti}/${ni}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),ii=/* @__PURE__ */ RegExp(`^/photos/${ti}/(?:albums|sets)/${ni}/?$`),ai=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,oi=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,si=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,ci=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:si},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function li(e){if(e===``)return null;let t=0n;for(let n of e){let e=oi.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function ui(e){let t=BigInt(e),n=``;for(;t>0n;)n=oi.charAt(Number(t%58n))+n,t/=58n;return n}function di(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function fi(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function pi(e){if(!e||!ei.has(e.host))return null;let[,t,n]=ii.exec(e.path)??[];if(t!==void 0&&n!==void 0)return fi(t,n);let[,r,i]=ri.exec(e.path)??[];return r===void 0||i===void 0?null:di(r,i)}function mi(e){if(e.host!==`flic.kr`)return null;let[,t]=ai.exec(e.path)??[],n=t===void 0?null:li(t);return t===void 0||n===null||ui(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}const hi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>N(e,ci),match(e){let t=pi(e)??mi(e);return t&&{...t,options:{}}}},gi=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,_i=[`header`,`footer`,`context`];function vi(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 yi=/* @__PURE__ */ z(hi,{parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=pi(I(e.attrs.get(`href`)??``)),n=vi(e);if(!t||!n)return null;let r={};for(let t of _i)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=H(n),a=si.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return U({...t,options:r,fallbackHtml:j([a],ci)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>gi.test(e)}),Y=`([A-Za-z0-9]{6,40})`,bi=/* @__PURE__ */ RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${Y}/?$`),xi=/* @__PURE__ */ RegExp(`^/embed/${Y}/?$`),Si=/^(?:media\d?|i)\.giphy\.com$/,Ci=`\\.(?:gif|webp|mp4)`,wi=/* @__PURE__ */ RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${Y}/[A-Za-z0-9_-]{1,40}${Ci}$`),Ti=/* @__PURE__ */ RegExp(`^/${Y}${Ci}$`);function Ei(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Di(e){if(e){if(K.has(e.host))return(bi.exec(e.path)??xi.exec(e.path))?.[1];if(Si.test(e.host))return(wi.exec(e.path)??(e.host===`i.giphy.com`?Ti.exec(e.path):null))?.[1]}}const Oi={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],match(e){let t=Di(e);return t===void 0?null:{...Ei(t),options:{}}},ownsFrame:hn},ki=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function Ai(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||!K.has(t.host))return null;let[,n]=xi.exec(t.path)??[];return n===void 0?null:Ei(n)}function ji(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)||bi.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 Mi=/* @__PURE__ */ z(Oi,{parse(e){let t=W(e,ki),n=t?.iframe??e,r=Ai(n);return r?U({...r,options:{}},t?.size??H(n)):null},isOwnScript:()=>!1,isOwnExtra:ji}),Ni=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),X=`([A-Za-z0-9]{5,7})`,Pi=/* @__PURE__ */ RegExp(`^/a/${X}/?$`),Fi=/* @__PURE__ */ RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${X}/?$`),Ii=/* @__PURE__ */ RegExp(`^/${X}/?$`),Li=/* @__PURE__ */ RegExp(`^/${X}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Ri=/* @__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`]),zi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Bi(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Vi(e){return e===void 0||Ri.has(e.toLowerCase())?void 0:e}function Hi(e){if(!e)return;if(e.host===`i.imgur.com`)return Vi(Li.exec(e.path)?.[1]);if(!Ni.has(e.host))return;let t=(Pi.exec(e.path)??Fi.exec(e.path))?.[1];return t===void 0?Vi(Ii.exec(e.path)?.[1]):`a/${t}`}const Ui={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>N(e,zi),match(e){let t=Hi(e);return t===void 0?null:{...Bi(t),options:{}}}},Wi=/* @__PURE__ */ RegExp(`^(a/)?${X}$`),Gi=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/;function Ki(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:Ki(e.children)}})}function qi(e,t){return e.attrs.get(t)===`false`}const Ji=/* @__PURE__ */ z(Ui,{parse(e){if(e.tag!==`blockquote`||!k(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Wi.exec(t)??[];if(r===void 0||n===void 0&&!Vi(r))return null;let i={};return qi(e,`data-context`)&&(i.context=!1),qi(e,`data-analytics`)&&(i.analytics=!1),{...Bi(t),options:i,fallbackHtml:j(Ki(e.children),zi)}},isOwnScript:e=>Gi.test(e)}),Yi=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Xi=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Zi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Qi=/* @__PURE__ */ new Set([`p`,`reel`]),$i=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function ea(e){if(!e||!Yi.has(e.host))return null;let[,t,n,r]=Xi.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Zi.has(t)||!Qi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const ta={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>N(e,$i),match(e){let t=ea(e);return t&&{...t,options:{}}}},na=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,ra=/* @__PURE__ */ z(ta,{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`?ea(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null):ea(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,$i)}},isOwnScript:e=>na.test(e)}),ia=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),aa=/^\/([A-Za-z0-9_-]{1,32})\/?$/,oa=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]);function sa(e,t){if(!e||!t.has(e.host))return null;let[,n]=aa.exec(e.path)??[];if(n===void 0||oa.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const ca={platform:`kick`,name:`Kick`,shapes:[`video iframe`],match(e){let t=sa(e,ia)??sa(e,on);return t&&{...t,options:{}}},ownsFrame:gn},la=/* @__PURE__ */ new Set([`autoplay`,`muted`]),ua=/* @__PURE__ */ z(ca,{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=sa(t,on);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>la.has(e)).map(([e,t])=>[e,L(t)]));return U({...n,options:r},H(e))},isOwnScript:()=>!1}),da=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,fa=`(activity|share|ugcPost):(\\d{19})`,pa=/* @__PURE__ */ RegExp(`^(?:/embed)?/feed/update/urn:li:${fa}/?$`),ma=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`);function ha(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 ga=e=>e.replace(/%3A/gi,`:`),_a={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],match(e){if(!da.test(e.host))return null;let t=ga(e.path),[,n,r]=pa.exec(t)??ma.exec(t)??[];return n===void 0||r===void 0?null:ha(n,r)},ownsFrame:_n},va=/* @__PURE__ */ RegExp(`^/embed/feed/update/urn:li:${fa}$`),ya=/* @__PURE__ */ z(_a,{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]=va.exec(t.path)??[];return n===void 0||r===void 0?null:U(ha(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,L(t)]))),H(e))},isOwnScript:()=>!1}),ba=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,xa=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/;function Sa(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function Ca(e){if(!e||!ba.test(e.host))return null;let[,t]=xa.exec(e.path)??[];return t===void 0?null:Sa(t)}const wa={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],match(e){let t=Ca(e);return t&&{...t,options:{}}},ownsFrame:vn},Ta=/^\d{1,25}$/,Ea=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Da=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]],Oa=/* @__PURE__ */ z(wa,{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=Ca(I(e.attrs.get(`href`)??``));return t&&{...t,options:V(e,Da,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&&Ta.test(n)?{...Sa(n),options:{}}:null},isOwnScript:e=>Ea.test(e)}),ka=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Aa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/;function ja(e){if(!e||!ka.has(e.host))return null;let[,t,n,r,i]=Aa.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 Ma={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],match(e){let t=ja(e);return t&&{...t,options:{}}}},Na=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,Pa=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,Fa=/* @__PURE__ */ [`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]),Ia=/* @__PURE__ */ z(Ma,{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`?ja(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,Fa,L)},n===void 0?void 0:{height:n})},isOwnScript:e=>Na.test(e)||Pa.test(e)}),La=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ra=`([A-Za-z][A-Za-z0-9._-]{1,29})`,za=/* @__PURE__ */ RegExp(`^(?:/@${Ra})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Ba=/* @__PURE__ */ RegExp(`^/(?:@|add/)${Ra}$`),Va=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,Ha=/* @__PURE__ */ RegExp(`^/@${Ra}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`);function Ua(e){if(!e||!La.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=za.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]=Ba.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=Va.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=Ha.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Wa={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],match(e){let t=Ua(e);return t&&{...t,options:{}}}},Ga=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/,Ka=/* @__PURE__ */ z(Wa,{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=Ua({...t,path:t.path.slice(0,-6)});if(!n||!A(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Ua(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=>Ga.test(e)}),qa=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ja=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Ya=`[a-z0-9_-]{1,64}`,Xa=`s-[A-Za-z0-9]{1,32}`,Za=/* @__PURE__ */ RegExp(`^/(${Ya})(?:/(sets/${Ya}|${Ya})(?:/(${Xa}))?)?/?$`,`i`),Qa=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),$a=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),eo=/* @__PURE__ */ RegExp(`^${Xa}$`);function to(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function no(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ja.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!eo.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return to(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function ro(e){if(!qa.has(e.host))return null;let[,t,n,r]=Za.exec(e.path)??[];if(t===void 0||Qa.has(t.toLowerCase())||n!==void 0&&$a.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return to(`https://soundcloud.com/${i}`,i)}const io={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],match(e){let t=no(e)??ro(e);return t&&{...t,options:{}}},ownsFrame:xn},ao=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function oo(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ao.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&qa.has(I(e.attrs.get(`href`)??``)?.host??``)}function so(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&&oo(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&oo(r)}const co=/* @__PURE__ */ z(io,{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=no(I(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!eo.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:so}),lo=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,uo=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function fo(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function po(e,t){return e&&t.has(e.host)?lo.exec(e.path)?.[1]:void 0}const mo=/* @__PURE__ */ z({platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:ir,match(e){let t=po(e,uo);return t===void 0?null:{...fo(t),options:{}}},ownsFrame:Cn},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=po(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({...fo(n),options:r},H(e))},isOwnScript:()=>!1}),ho=/* @__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)?/?$`),go=/* @__PURE__ */ new Set([`utm_source`,`si`]);function _o(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=ho.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 vo(e){return Object.fromEntries([...e].filter(([e])=>!go.has(e)).map(([e,t])=>[e,L(t)]))}const yo=/* @__PURE__ */ z({platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],match(e){let t=_o(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:Sn},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=_o(t);if(!n)return null;let{query:r,...i}=n;return U({...i,options:vo(r)},H(e))},isOwnScript:()=>!1}),bo=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),xo=/^\/(activities|routes)\/(\d{1,20})\/?$/,So={activity:`activities`,route:`routes`};function Co(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${So[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}const wo={platform:`strava`,name:`Strava`,shapes:[`post iframe`],match(e){if(!bo.has(e.host))return null;let[,t,n]=xo.exec(e.path)??[];return t===void 0||n===void 0?null:{...Co(t===`routes`?`route`:`activity`,n),options:{}}}},To=/^\d{1,20}$/,Eo=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,Do=/* @__PURE__ */ new Set([`standard`,`minimal`]),Oo=/^[A-Za-z0-9_-]{1,100}$/;function ko(e){return e===`activity`||e===`route`}const Ao=/* @__PURE__ */ z(wo,{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(!ko(t)||!To.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&Do.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&&Oo.test(a)&&(r.mapHash=a),{...Co(t,n),options:r}},isOwnScript:e=>Eo.test(e)}),jo=`([a-z0-9]{4,8})`,Mo=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),No=/* @__PURE__ */ RegExp(`^/[eo]/${jo}$`),Po=/* @__PURE__ */ RegExp(`^/${jo}/?$`),Fo=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]);function Io(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function Lo(e){return e!==void 0&&!Fo.has(e)}function Ro(e){if(!e||!Mo.has(e.host))return;let t=(No.exec(e.path)??Po.exec(e.path))?.[1];return Lo(t)?t:void 0}const zo={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],match(e){let t=Ro(e);return t===void 0?null:{...Io(t),options:{}}},ownsFrame:wn},Bo=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,Vo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),Ho=/<\/div\s*>$/i;function Uo(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=No.exec(t.path)??[];if(!Lo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>Vo.has(e)).map(([e,t])=>[e,L(t)]));return{...Io(n),options:r}}const Wo=/* @__PURE__ */ z(zo,{parse(e){let t=W(e,Bo),n=t?.iframe??e,r=Uo(n);return r?U(r,t?.size??H(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=Ho.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null}}),Go=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Ko=`[A-Za-z][A-Za-z0-9_]{2,31}`,qo=/* @__PURE__ */ RegExp(`^/(?:s/)?(${Ko})/(\\d{1,10})/?$`);function Jo(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Yo={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],match(e){if(!Go.has(e.host))return null;let[,t,n]=qo.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)),Jo(t,n,r)}},Xo=/* @__PURE__ */ RegExp(`^(${Ko})/(\\d{1,10})$`),Zo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Qo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],$o=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]],es=/* @__PURE__ */ z(Yo,{parse:()=>null,parseScript(e){if(!Zo.test(e.attrs.get(`src`)??``)||Qo.some(t=>e.attrs.has(t)))return null;let[,t,n]=Xo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=V(e,$o,L);return e.attrs.has(`data-single`)&&(r.single=!0),Jo(t,n,r)},isOwnScript:e=>Zo.test(e)}),ts=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),ns=`(\\d{1,20})`,rs=/* @__PURE__ */ RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${ns}/?$`),is=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function as(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function os(e){return e&&ts.has(e.host)?rs.exec(e.path)?.[1]:void 0}const ss={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>N(e,is),match(e){let t=os(e);return t===void 0?null:{...as(t),options:{}}},ownsFrame:Tn},cs=/* @__PURE__ */ RegExp(`^/embed/${ns}$`),ls=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,us=/^\d{1,3}(?:\.\d{1,20})?$/;function ds(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=fs(t,1e4);return{width:t/n,height:1e4/n}}function fs(e,t){return t===0?e:fs(t,e%t)}function ps(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&&!us.test(n))return null;let r=ds(n===void 0?1.33:Number(n));return r?U({...as(t),options:{},fallbackHtml:j(e.children,is)},r):null}function ms(e){let t=I(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=cs.exec(t.path)??[];return n===void 0?null:U({...as(n),options:{}},H(e))}const hs=/* @__PURE__ */ z(ss,{parse(e){return e.tag===`div`?ps(e):e.tag===`iframe`?ms(e):null},isOwnScript:e=>ls.test(e)}),gs=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),_s=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,vs=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function ys(e){if(!e||!gs.has(e.host))return null;let[,t]=_s.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const bs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>N(e,vs),match(e){let t=ys(e);return t&&{...t,options:{}}}},xs=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Ss=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Cs=/* @__PURE__ */ z(bs,{parse(e){if(e.tag!==`blockquote`||!k(e,`text-post-media`))return null;let t=ys(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,Ss,L),fallbackHtml:j(e.children,vs)}},isOwnScript:e=>xs.test(e)}),ws=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/;function Ts(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const Es={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],match(e){if(!G.has(e.host))return null;let[,t,n]=ws.exec(e.path)??[];return t===void 0||n===void 0?null:Ts(n,t)},ownsFrame:dn},Ds=/^\/player\/v1\/(\d{1,25})\/?$/,Os=/^\d{1,25}$/,ks=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/,As=/* @__PURE__ */ z(Es,{parse(e){if(e.tag===`blockquote`&&k(e,`tiktok-embed`)){let t=I(e.attrs.get(`cite`)??``),[,n,r]=t&&G.has(t.host)?ws.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Os.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Ts(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]=Ds.exec(t.path)??[];return n===void 0?null:U(Ts(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,L(t)]))),H(e))},isOwnScript:e=>ks.test(e)}),js=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),Ms=`(@[A-Za-z0-9_.-]{1,64})`,Ns=`(\\d{1,25})`,Ps=/* @__PURE__ */ RegExp(`^/${Ms}/(?:posts/)?${Ns}/?$`);function Fs(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function Is(e){if(!e||!js.has(e.host))return null;let[,t,n]=Ps.exec(e.path)??[];return t===void 0||n===void 0?null:Fs(t,n)}const Ls={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],match(e){let t=Is(e);return t&&{...t,options:{}}},ownsFrame:En},Rs=/* @__PURE__ */ RegExp(`^/${Ms}/${Ns}/embed$`),zs=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/,Bs=/* @__PURE__ */ z(Ls,{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]=Rs.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=k(e,`truthsocial-video`)?{video:!0}:{};return U({...Fs(n,r),options:i},H(e))},isOwnScript:e=>zs.test(e)}),Vs=`([a-z0-9-]{1,32})`,Hs=`(\\d{1,20})`,Us=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),Ws=/* @__PURE__ */ RegExp(`^/${Vs}/${Hs}(?:/[^/]{1,200})?/?$`),Gs=/* @__PURE__ */ RegExp(`^${Vs}\\.tumblr\\.com$`),Ks=/* @__PURE__ */ RegExp(`^/post/${Hs}(?:/[^/]{1,200})?/?$`),qs=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]);function Js(e){if(!e)return null;let t,n;return Us.has(e.host)?[,t,n]=Ws.exec(e.path)??[]:([,t]=Gs.exec(e.host)??[],[,n]=Ks.exec(e.path)??[]),t===void 0||n===void 0||qs.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Ys={platform:`tumblr`,name:`Tumblr`,shapes:[`post iframe`],match(e){let t=Js(e);return t&&{...t,options:{}}}},Xs=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${Vs})/${Hs}/v2$`),Zs=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${Hs}$`),Qs=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/,$s=/* @__PURE__ */ z(Ys,{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]=Xs.exec(t.path)??[],i=r??Zs.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=Js(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=>Qs.test(e)}),ec=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),tc=/^[A-Za-z0-9_]{3,25}$/,nc=/^v?(\d{1,12})$/,rc=/^[A-Za-z0-9_-]{6,30}$/,ic=/^[A-Za-z0-9_-]{6,100}$/,ac=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,oc=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]);function sc(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const cc=e=>sc(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),lc=e=>sc(`https://www.twitch.tv/videos/${e}`,e),uc=e=>sc(`https://www.twitch.tv/collections/${e}`,e),dc=e=>sc(`https://clips.twitch.tv/${e}`,e);function fc(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return ic.test(t)?{found:dc(t),options:{}}:null}if(!ec.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=nc.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:lc(t),options:n!==void 0&&ac.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?rc.test(r??``)?{found:uc(r??``),options:{}}:null:t.length===3&&r===`clip`?tc.test(n)&&ic.test(i??``)?{found:dc(i??``),options:{}}:null:t.length===1&&tc.test(n)&&!oc.has(n.toLowerCase())?{found:cc(n),options:{}}:null}const pc={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],match(e){let t=fc(e);return t&&{...t.found,options:t.options}},ownsFrame:fn},mc=[`autoplay`,`muted`,`time`];function hc(e){let t={};for(let n of mc){let r=e.get(n);r!==void 0&&(t[n]=L(r))}return t}function gc(e){let t=e.query.get(`channel`);if(t!==void 0)return tc.test(t)?cc(t):null;let[,n]=nc.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return lc(n);let r=e.query.get(`collection`);return r!==void 0&&rc.test(r)?uc(r):null}const _c=/* @__PURE__ */ z(pc,{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=gc(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=ic.test(e)?dc(e):null}return n&&U({...n,options:hc(t.query)},H(e))},isOwnScript:()=>!1}),vc=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Z=`(\\d{1,12})`,yc=`([0-9a-f]{6,20})`,bc=[RegExp(`^/${Z}(?:/${yc})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Z}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Z}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Z}/?$`)],xc=/* @__PURE__ */ RegExp(`^/video/${Z}/?$`),Sc=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Cc=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function wc(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Tc(e){let[,t]=Cc.exec(e.fragment??``)??[];return t?{t}:{}}function Ec(e){if(!e||!vc.has(e.host))return null;for(let t of bc){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return wc(n,r)}return null}function Dc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=xc.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${yc}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Sc.has(e)).map(([e,t])=>[e,L(t)]));return{...wc(t,n),options:{...r,...Tc(e)}}}const Oc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],match(e){let t=Dc(e);if(t)return t;let n=Ec(e);return n&&{...n,options:Tc(e)}},ownsFrame:pn},kc=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Ac=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/;function jc(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&&vc.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function Mc(e,t){return e?.type===`text`&&e.raw.trim()===t}function Nc(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&&jc(n,e=>Ec(e)?.id===t.id)&&Mc(r,`from`)&&jc(i,()=>!0)&&Mc(a,`on`)&&jc(o,e=>e.path===``||e.path===`/`)&&Mc(s,`.`)}const Pc=/* @__PURE__ */ z(Oc,{parse(e){let t=W(e,kc),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Dc(I(n.attrs.get(`src`)??``));return r&&U(r,t?.size??H(n))},isOwnScript:e=>Ac.test(e),isOwnExtra:Nc}),Fc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Ic=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Lc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,Rc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function zc(e,t=Ic){if(!e||!Fc.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 Bc(e){return A(e).reverse().map(e=>e.tag===`a`?zc(I(e.attrs.get(`href`)??``)):null).find(e=>e!==null)??null}function Vc(e,t){return Bc(O(e)??[])?.id===t}const Hc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>N(e,Rc)&&Vc(e,t.id),match(e){let t=zc(e,Lc);return t&&{...t,options:{}}}},Uc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Wc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Gc=/* @__PURE__ */ z(Hc,{parse(e){if(e.tag!==`blockquote`||!(k(e,`twitter-tweet`)||k(e,`twitter-video`)))return null;let t=Bc(e.children);return t?{...t,options:V(e,Wc,L),fallbackHtml:j(e.children,Rc)}:null},isOwnScript:e=>Uc.test(e)}),Kc=`https://www.youtube.com`,qc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,Jc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,Yc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,Xc=/^\/([A-Za-z0-9_-]{11})\/?$/,Zc=/^[A-Za-z0-9_-]{10,64}$/,Qc=/^UC[A-Za-z0-9_-]{22}$/,$c=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,el=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,tl=/^t=(.+)$/;function nl(e){if(e===void 0||e===``)return;let t=el.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function rl(e){return nl(e.get(`start`))??nl(e.get(`t`))}function il(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function al(e,t=!1){return il(e,t?`${Kc}/shorts/${e}`:`${Kc}/watch?v=${e}`)}function ol(e){return e!==void 0&&Zc.test(e)?il(e,`${Kc}/playlist?list=${e}`):null}function sl(e){return e!==void 0&&Qc.test(e)?il(e,`${Kc}/channel/${e}/live`):null}function cl(e){let[,t,n]=Jc.exec(e.path)??[];if(n!==void 0)return{found:al(n)};if(t===`videoseries`){let t=ol(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=sl(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function ll(e,t){let n=rl(e.query)??nl(tl.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const ul=[Gc,ra,$r,Cs,As,/* @__PURE__ */ z({platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],match(e){if(e.host===`youtu.be`){let[,t]=Xc.exec(e.path)??[];return t===void 0?null:{...al(t),options:ll(e,!1)}}let t=nn.has(e.host);if(!t&&!tn.has(e.host))return null;let n=ll(e,t);if(B(e.path,`/embed`)){let t=cl(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&&qc.test(t)?{...al(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=ol(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=$c.exec(e.path)??[],i=sl(r);if(i)return{...i,options:n};let[,a,o]=Yc.exec(e.path)??[];return a===void 0||o===void 0?null:{...al(o,a===`shorts`),options:n}},ownsFrame:ln},{parse(e){if(e.tag!==`iframe`)return null;let t=I(e.attrs.get(`src`)??``),n=t!==null&&nn.has(t.host);if(!t||!(n||tn.has(t.host)))return null;let r=cl(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=rl(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),U({...r.found,options:a},H(e))},isOwnScript:()=>!1}),es,Ka,ya,Ia,Oa,yo,Pc,_c,Pr,co,lr,pr,ua,Mi,hs,Wo,mo,Bs,Ji,Ao,yi,Er,$s];function dl(e){return ul.find(t=>t.platform===e)}function fl(e){return pl(ul,e)}function pl(e,t){let n=hl(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function ml(e,t){let n=hl(t);return n&&e.match(n)}function hl(e){return typeof e==`string`?I(e):null}function gl(e,t){if(t.platform!==e.platform)return null;let n=ml(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 _l={bluesky:`Bluesky`,rumble:`Rumble`};function vl(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function yl(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:ml(n,e));if(!a&&e!==void 0&&xl(n,e))return{error:vl(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=gl(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function bl(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=rr(e.url);return t?vl(_l[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function xl(e,t){let n=typeof t==`string`?I(t):null;return n!==null&&e.needsLookup?.(n)===!0}function Sl(e){return Cl(ul,e)}function Cl(e,t){if(typeof t!=`string`)return null;let n=O(t);return n?Tl(e,n):wl(e,t)}function wl(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:O(r),a=i&&Tl(e,i);if(a?.platform===n.platform)return a}return null}function Tl(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Ie(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(El(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 El(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Dl(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Ol(e){return e===null?void 0:Dl(e.trim().replace(/px$/i,``))}function kl(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function Al(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function jl(e,t){let n=t??e.getAttribute(`html`)??kl(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:Dl(i)??(i?.trim()?i:void 0),maxWidth:Ol(e.getAttribute(`max-width`)),height:Ol(e.getAttribute(`height`)),maxHeight:Ol(e.getAttribute(`max-height`))},eager:Al(e),iframeTitle:e.getAttribute(`iframe-title`)??void 0}}const Ml=/* @__PURE__ */ new WeakMap;function Nl(e,t){for(let n of e.querySelectorAll(`iframe`)){let e=n.getAttribute(`title`);e!==t&&(e?.trim()&&e!==Ml.get(n)||(n.setAttribute(`title`,t),Ml.set(n,t)))}}function Pl(e,t){return e?.trim()?e:t}function Fl(e,t){Nl(e,t);let n=new MutationObserver(()=>{Nl(e,t)});return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`title`]}),()=>{n.disconnect()}}const Il=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function Ll(e,t){e.removeAttribute(`style`),Q(e,t)}function Q(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&Il.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Rl(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),Q(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function zl(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 Bl(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Vl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=Pl(n.iframeTitle,t.title),l=document.createElement(`div`),u,d=e=>{Ll(l,Je(t,e,u))};d(n);let f=Bl(document.createElement(`div`)),p=Bl(document.createElement(`div`)),m=i.length>0?i:[t.fallbackHtml===void 0?Rl():Hl(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),Q(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,Q(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(zl(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=Pl(r,t.title),h&&(h.title=c),n&&w()}}}function Hl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Ul=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function Wl(e){let t=e.querySelector(Ul.map(e=>`[${e}]`).join());for(let e of Ul){let n=t?.getAttribute(e);if(n)return n}}function Gl(e){return`View this post on ${e}`}function Kl(e){return e instanceof Error?e:Error(String(e))}function ql(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{Ll(l,{width:e.width??`100%`,maxWidth:e.maxWidth??t.maxWidth})};u(n);let d=document.createElement(`div`);Q(d,{width:`100%`});let f=document.createElement(`div`);f.innerHTML=t.markup,d.append(f);let p=Wl(f),m=t.hasFallback?[]:o.length>0?o:[Rl(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=Fl(f,Pl(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=Gl(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,Kl(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(Kl(e))}))},te=zl(f,a,T);return{wrapper:l,cleanup:()=>{_=!0,te(),clearTimeout(y),b(),h(),l.remove()},update(e,n,r){u(e),h(),h=Fl(f,Pl(r,t.title)),n&&T()}}}const Jl=typeof HTMLElement>`u`?class{}:HTMLElement,$=`embed`;function Yl(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 Xl(e){let t=``;for(let n of e.children)n.slot!==$&&(t+=n.outerHTML);return t&&(Sl(t)??zn(t))?t:void 0}function Zl(e){let t=`html`in e?Sl(e.html):fl(e.url);if(!t){let t=`html`in e?zn(e.html):null;return t?Xn(t):{kind:`error`,message:bl(e)}}let n=dl(t.platform);if(!n)return{kind:`error`,message:bl(e)};let r=yl(void 0,t,n);return r.error===void 0?Zt(r.embed):{kind:`error`,message:r.error}}const Ql=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`,`iframeTitle`];var $l=class extends Jl{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="${$}"></slot>`;for(let e of Ql){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 Al(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===$&&t.remove();let t=!e||e.parentNode===this,n=jl(this,this.#e);this.#i=n.source?void 0:t&&this.#i||Xl(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=Zl(t);if(c.kind===`error`){s(Error(c.message));return}let l={...n,eager:r,iframeTitle:i,placeholder:this.#i===void 0?Yl(this):[],onLoad:()=>{o(new Event(`load`))},onError:s};this.#n=c.kind===`iframe`?Vl(this,c,l):ql(this,c,l),this.#n.wrapper.slot=$}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,$l);export{$l as SocialEmbedElement};
|