social-embeds 0.9.0 → 0.9.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 +5 -5
- package/dist/components/iframe-embed.js +15 -31
- package/dist/core/drivers.js +6 -6
- package/dist/core/layout.js +1 -45
- package/dist/core/message-height.js +24 -0
- package/dist/core/plans/bluesky.js +3 -1
- package/dist/core/plans/flickr.js +16 -6
- package/dist/core/plans/imgur.js +3 -1
- package/dist/core/plans/reddit.js +3 -1
- package/dist/core/plans/strava.js +3 -1
- package/dist/core/plans/telegram.js +3 -1
- package/dist/core/plans/truthsocial.js +5 -2
- package/dist/core/plans/tumblr.js +3 -1
- package/dist/core/plans/twitch.js +5 -2
- package/dist/core/resolve.js +15 -37
- package/dist/core/size-in-src.js +47 -0
- package/dist/element.js +1 -1
- package/dist/loader/platform-scripts.js +23 -22
- package/dist/parser/html.d.ts +1 -6
- package/dist/parser/html.js +6 -1
- package/dist/parser/lookup.js +11 -5
- package/dist/parser/platform.d.ts +9 -3
- package/dist/parser/platforms/applemusic.js +2 -0
- package/dist/parser/platforms/applepodcasts.js +2 -0
- package/dist/parser/platforms/bluesky.js +6 -2
- package/dist/parser/platforms/dailymotion.js +2 -0
- package/dist/parser/platforms/facebook.js +8 -2
- package/dist/parser/platforms/flickr.js +4 -2
- package/dist/parser/platforms/giphy.js +2 -0
- package/dist/parser/platforms/imgur.js +4 -2
- package/dist/parser/platforms/instagram.js +4 -2
- package/dist/parser/platforms/kick.js +2 -0
- package/dist/parser/platforms/linkedin.js +2 -0
- package/dist/parser/platforms/pinterest.js +2 -0
- package/dist/parser/platforms/reddit.js +2 -0
- package/dist/parser/platforms/rumble.js +4 -0
- package/dist/parser/platforms/snapchat.js +2 -0
- package/dist/parser/platforms/soundcloud.js +2 -0
- package/dist/parser/platforms/spotify.js +2 -0
- package/dist/parser/platforms/strava.js +2 -0
- package/dist/parser/platforms/streamable.js +2 -0
- package/dist/parser/platforms/telegram.js +2 -0
- package/dist/parser/platforms/tenor.js +4 -2
- package/dist/parser/platforms/threads.js +4 -2
- package/dist/parser/platforms/tiktok.js +2 -0
- package/dist/parser/platforms/truthsocial.js +2 -0
- package/dist/parser/platforms/tumblr.js +2 -0
- package/dist/parser/platforms/twitch.js +2 -0
- package/dist/parser/platforms/vimeo.js +2 -0
- package/dist/parser/platforms/x.js +8 -2
- package/dist/parser/platforms/youtube.js +2 -0
- package/dist/parser/verify.js +2 -46
- package/package.json +1 -1
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}const s={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0}};function c(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:s,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const l=/^x[a-z0-9]{3,12}$/;function u(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...u}=e.options,d=n??c;if(d===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof d!=`string`||!l.test(d))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(d)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${d}.html${a([[`video`,e.id]],i(u,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const d=15e3,f=3e3,p=/* @__PURE__ */ new Map;function m(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=p.get(e.key);return t||(t=h(e).catch(t=>{throw p.delete(e.key),t}),p.set(e.key,t)),t}async function h(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await g(e,t)||await v(e)}await e.whenPresent?.()}function g(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?f:d),i,a=()=>{r=Date.now()+f},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 _=class extends Error{};async function v(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await y(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof _)||t>=3)throw e;await x(1e3*2**(t-1))}await(t?b(t,`${e.url} did not report ready`):ee(e))}async function y(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 _(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await b(r,`${e.url} did not load`)}finally{t?.()}return n}function ee(e){return new Promise((t,n)=>{let r=Date.now()+d,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function b(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},d);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function x(e){return new Promise(t=>setTimeout(t,e))}const S=()=>window,C=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function w(e){return()=>{let t=S().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const ne={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=S().twttr?.ready;t?t(()=>{e()}):e()})};function re(){let e=S().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ie(e){let t=w(e);return()=>{let e=S().FB;return!t()&&e!==void 0&&!e.__buffer}}const ae={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:w(`instagram`),prepare:re,skipped:ie(`instagram`)},oe={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:w(`threads`),prepare:re,skipped:ie(`threads`)};function se(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${C}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=S().fbAsyncInit;S().fbAsyncInit=()=>{t?.(),e()}})}}const ce={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 S().PinUtils?.build==`function`};function T(e,{locale:t=`en_US`}={}){switch(e){case`x`:return m(ne);case`instagram`:return m(ae);case`threads`:return m(oe);case`pinterest`:return m(ce);case`facebook`:return te.test(t)?m(se(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const E=()=>window;var le=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 ue(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function de(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const fe={load:()=>T(`x`),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,de,t);return ue(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function pe(e,t){if(e.getRootNode()!==document)throw new le(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function me(){let e=E().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const he={load:()=>T(`instagram`),render(e,t){pe(e,`Instagram`);let n=D(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ue(e,`instagram-media`),me(),n}},ge={load:()=>T(`threads`),render(e,t){pe(e,`Threads`);let n=D(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ue(e,`text-post-media`),me(),n}},_e=/* @__PURE__ */ new Map;function ve(e){let t=_e.get(e);return t||(t={load:()=>T(`facebook`,{locale: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:C}),i()}return()=>{}}},_e.set(e,t)),t}const ye={load:()=>T(`pinterest`),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}},be=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),xe=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Se=/<([a-zA-Z][a-zA-Z0-9-]*)/y,Ce=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,we=/\s*(\/?)>/y,Te=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Ee=/* @__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}Te.lastIndex=a;let s=Te.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=Te.lastIndex;continue}let c=De(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:xe.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&&!be.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function De(e,t){Se.lastIndex=t;let n=Se.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Se.lastIndex;for(;;){we.lastIndex=i;let t=we.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:we.lastIndex};Ce.lastIndex=i;let a=Ce.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Oe(s??c??l??``)),i=Ce.lastIndex}}function Oe(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 Ee.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 ke(e,t),t}function ke(e,t){for(let n of e)n.type===`element`&&(t.push(n),ke(n.children,t))}const Ae=/* @__PURE__ */ new Set([`href`,`cite`]),je=/^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)||Ae.has(e)&&!je.test(i)||(n+=` ${e}="${M(i)}"`)}n+=`>`,be.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 Me(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 Ne(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Me(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const Pe={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Fe={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Ie={post:300,video:200};function Le(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 Re(e,t){if(e.variant===`iframe`)return Le(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Fe)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Le({...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)}"${Ne(Pe,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:ve(i),minHeight:Ie[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}const ze=[`header`,`footer`,`context`],Be=/\/albums\/\d+$/;function Ve(e,t){let n=Be.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;return{kind:`iframe`,src:`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:{width:4,height:3},...o?{size:o,maxWidth:o.width}:{},sizeInSrc:!0,...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 He(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 Ue={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}};function We(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:Ue,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function Ge(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${Me({"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:he,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const Ke=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function qe(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])=>Ke.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Je(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 Ye={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},Xe={small:236,medium:345,large:600};function Ze(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${M(e.url)}"${Ne(Ye,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:ye,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:Xe[String(n.width)]??236}}const Qe={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},$e={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}};function et(e,t){let n=[];for(let[e,r]of Object.entries(Qe)){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:$e,startHeight:e.size?.height??316,maxWidth:640}}function tt(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 nt={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 rt(e,t){let n=[];for(let[e,r]of Object.entries(nt)){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 it(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 at=/* @__PURE__ */ new Set([`track`,`episode`]);function ot(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??(at.has(n)?152:352)}}const st={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}};function ct(e){return e===`minimal`?`minimal`:`standard`}function lt(e,t){let n=e.id.startsWith(`route/`),r=ct(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:st,startHeight:650,...i?{}:{maxWidth:554}}}const ut=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),dt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function ft(e,t){let n=Object.entries(e.options).filter(([e])=>ut.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,dt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const pt=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function mt(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 ht={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}};function gt(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 pt){let n=mt(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:ht,startHeight:300,maxWidth:500}}function _t(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 vt(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${Me({"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:ge,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const yt={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 bt(e,t){let n=o(t,yt);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 xt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const St={origin:`https://truthsocial.com`,read:xt},Ct={origin:`https://truthsocial.com`,read(e){let t=xt(e);return t===void 0||t<=0?void 0:t+165}},wt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Tt(e){let t=wt.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?Ct:St,startHeight:150,maxWidth:e.size?.width??600}}const Et={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}};function Dt(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:Et,startHeight:400,maxWidth:540}}const Ot=[`channel`,`video`,`collection`,`clip`,`parent`];function kt(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 At(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]=kt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Ot),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const jt={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 Mt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,jt),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 Nt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Pt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${M(e.url)}"></a>`,i=`<blockquote${Ne(Nt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:fe,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const Ft={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 It(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 Lt(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}=It(e),f=o(r,Ft).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 Rt(e){switch(e.platform){case`x`:return Pt(e,{});case`instagram`:return Ge(e,{});case`threads`:return vt(e,{});case`facebook`:return Re(e,{});case`tiktok`:return bt(e,{});case`youtube`:return Lt(e,{});case`telegram`:return gt(e,{});case`snapchat`:return tt(e);case`linkedin`:return Je(e,{});case`reddit`:return et(e,{});case`pinterest`:return Ze(e,{});case`spotify`:return ot(e,{});case`vimeo`:return Mt(e,{});case`twitch`:return At(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return rt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Dt(e);case`kick`:return qe(e,{});case`giphy`:return He(e);case`tenor`:return _t(e);case`streamable`:return ft(e,{});case`rumble`:return it(e);case`truthsocial`:return Tt(e);case`imgur`:return We(e,{});case`strava`:return lt(e,{});case`flickr`:return Ve(e,{});default:return e.platform}}const zt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=zt.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=Bt(t===-1?e:e.slice(0,t)),r=Bt(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 Bt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t){return e===t||e.startsWith(`${t}/`)}function z(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 B(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function V(e,t){return t?{...e,size:t}:e}function H(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=Vt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Vt(e,t){return t===0?e:Vt(t,e%t)}const Ht=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),Ut=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),Wt=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),U=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),Gt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),W=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),Kt=/* @__PURE__ */ new Set([`player.kick.com`]),qt=`embed.music.apple.com`,Jt=`embed.podcasts.apple.com`,Yt=e=>Ut.has(e.host)||Ht.has(e.host)&&R(e.path,`/embed`),Xt=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||Wt.has(e.host)&&(R(e.path,`/embed`)||R(e.path,`/video`)),Zt=e=>U.has(e.host)&&R(e.path,`/player`),Qt=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&R(e.path,`/embed`),$t=e=>e.host===`player.vimeo.com`,en=e=>Gt.has(e.host)&&R(e.path,`/plugins`),tn=e=>W.has(e.host)&&R(e.path,`/embed`),nn=e=>Kt.has(e.host),rn=e=>e.host===`www.linkedin.com`&&R(e.path,`/embed`),an=e=>e.host===`assets.pinterest.com`,on=e=>e.host===qt,sn=e=>e.host===Jt,cn=e=>e.host===`w.soundcloud.com`,ln=e=>e.host===`open.spotify.com`&&R(e.path,`/embed`),un=e=>e.host===`rumble.com`&&R(e.path,`/embed`),dn=e=>e.host===`streamable.com`&&(R(e.path,`/e`)||R(e.path,`/o`)),fn=e=>e.host===`tenor.com`&&R(e.path,`/embed`),pn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function mn(e){return[Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn].some(t=>t(e))}const hn=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],gn=/* @__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`]),_n=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),vn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,yn=RegExp(`^(?:https:)?//${vn}(?:[/?#]|$)`,`i`),bn=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${vn})$`,`i`),xn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Sn=/[\t\n\f\r ]+/,Cn=/^\s*(width|height)\s*:(.*)$/is,wn=/^(\d+)px$/i,Tn=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function En(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=B(r)??Fn(r);return On({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&&H(a,Tn)?.size})}function Dn(e){return On(e)}function On(e){if(typeof e!=`object`||!e)return null;let t=e,n=kn(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=hn.find(e=>e===i),o=Mn(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?An(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:jn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Pn(t.size),...o?{ratio:o}:{}}}function kn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=yn.test(t)&&!t.includes(`\\`)?F(t):null;return!n||xn.test(n.path)||mn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function An(e){return e.split(`;`).map(e=>e.split(Sn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&_n.has(e)&&t.every(e=>bn.test(e))).map(e=>e.join(` `)).join(`; `)}function jn(e){let t=e.split(Sn).map(e=>e.toLowerCase()).filter(e=>gn.has(e));return[...new Set(t)].join(` `)}function Mn(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Nn(t)&&Nn(n)?{width:t,height:n}:void 0}function Nn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Pn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?L(String(t)):void 0,i=typeof n==`number`?L(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Fn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Cn.exec(r)??[],a=L(wn.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 In={width:16,height:9};function Ln(e){let t=Dn(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}:{},...Rn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Rn({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??In,...n===void 0?{}:{maxWidth:n}}:{ratio:In,height:r}}const zn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Bn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Vn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,Hn=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),Un=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function Wn(e){let t=typeof e==`string`?F(e):null;if(!t)return null;if(Hn.has(t.host))return Un.test(t.path)?`rumble`:null;if(!zn.has(t.host))return null;let[,n]=Bn.exec(t.path)??[];return n!==void 0&&Vn.test(n)?`bluesky`:null}const Gn=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,Kn=/^\d{1,15}$/;function qn(e,t){if(e?.host!==t)return null;let[,n,r,i]=Gn.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!Kn.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!Kn.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Jn={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=qn(F(e.attrs.get(`src`)??``),qt);if(!t)return null;let{height:n}=B(e)??{};return V({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=qn(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:on},Yn=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,Xn=/^\d{1,15}$/;function Zn(e,t){if(e?.host!==t)return null;let[,n,r]=Yn.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!Xn.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 Qn={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Zn(F(e.attrs.get(`src`)??``),Jt);return t&&V({...t,options:{}},B(e))},isOwnScript:()=>!1,match(e){let t=Zn(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:sn},$n=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,er=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,tr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),nr=RegExp(`^/profile/${$n}/post/${er}/?$`),rr=RegExp(`^at://${$n}/app\\.bsky\\.feed\\.post/${er}$`),ir=/^[a-z2-7]{20,100}$/,ar=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),or=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,sr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function cr(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 lr(e){if(!e||!tr.has(e.host))return null;let[,t,n]=nr.exec(e.path)??[];return t===void 0||n===void 0?null:cr(t,n)}const ur={platform:`bluesky`,fallback:sr,parse(e){if(e.tag!==`blockquote`||!k(e,`bluesky-embed`))return null;let[,t,n]=rr.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=cr(t,n);if(A(e.children).reverse().map(e=>e.tag===`a`?lr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&ir.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&ar.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:j(e.children,sr)}},isOwnScript:e=>or.test(e),match(e){let t=lr(e);return t&&{...t,options:{}}}},dr=/^x[a-z0-9]{4,12}$/,fr=/^x[a-z0-9]{3,12}$/,pr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/;function mr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function hr(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&&!fr.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),mr(r,i)}function gr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return dr.test(t)?mr(t,{}):null}if(!Wt.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&dr.test(t)?mr(t,{}):null}const _r={platform:`dailymotion`,parse(e){let t=H(e,pr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=hr(r)??gr(r);return i&&V(i,t?.size??B(n))},isOwnScript:()=>!1,match(e){return hr(e)??gr(e)},ownsFrame:Xt},vr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),G=`https://www.facebook.com`,yr=`[A-Za-z0-9.\\-]{1,80}`,br=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,xr=RegExp(`^/(${yr})/posts/(${br})/?$`),Sr=RegExp(`^/(${yr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Cr=RegExp(`^/(${yr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),wr=/^\/reel\/(\d{1,25})\/?$/,Tr=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Er=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Dr=RegExp(`^${br}$`),Or=/^\d{1,25}$/,kr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Ar=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],jr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Mr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Nr=/* @__PURE__ */ new Map([[`div`,[Mr]],[`blockquote`,[`cite`,Mr]],[`a`,[`href`]],[`p`,[]]]);function Pr(e){if(!e||!vr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=xr.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${G}/${r}/posts/${i}`};if(Tr.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Dr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Or.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${G}${t}?story_fbid=${e}${i}`}}if(Er.has(t)){let e=n.get(`fbid`);return e===void 0||!Or.test(e)?null:{kind:`post`,id:e,url:`${G}${t}?fbid=${e}`}}let[,a,o,s]=Sr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${G}/${a}/photos/${o}/${s}/`};let[,c,l]=Cr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${G}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Or.test(e)?null:{kind:`video`,id:e,url:`${G}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=wr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${G}/reel/${u}`}}function K(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Fr={platform:`facebook`,fallback:Nr,parse(e){if(e.tag===`div`){let t=k(e,`fb-post`)?`post`:k(e,`fb-video`)?`video`:null,n=Pr(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...K(n,t,`sdk`,z(e,Ar,I)),fallbackHtml:j(e.children,Nr)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!Gt.has(t.host))return null;let n=Pr(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),K(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of jr){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return V(K(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return V(K(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),B(e))}return null},isOwnScript:e=>kr.test(e),scriptOptions(e){let[,t]=kr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=Pr(e);return t&&K(t,t.kind,`sdk`,{})},ownsFrame:en},Ir=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),Lr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Rr=`(\\d{1,20})`,zr=RegExp(`^/photos/${Lr}/${Rr}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),Br=RegExp(`^/photos/${Lr}/(?:albums|sets)/${Rr}/?$`),Vr=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,Hr=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,Ur=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,Wr=[`header`,`footer`,`context`],Gr=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,Kr=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:Gr},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function qr(e){if(e===``)return null;let t=0n;for(let n of e){let e=Ur.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function Jr(e){let t=BigInt(e),n=``;for(;t>0n;)n=Ur.charAt(Number(t%58n))+n,t/=58n;return n}function Yr(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function Xr(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function Zr(e){if(!e||!Ir.has(e.host))return null;let[,t,n]=Br.exec(e.path)??[];if(t!==void 0&&n!==void 0)return Xr(t,n);let[,r,i]=zr.exec(e.path)??[];return r===void 0||i===void 0?null:Yr(r,i)}function Qr(e){if(e.host!==`flic.kr`)return null;let[,t]=Vr.exec(e.path)??[],n=t===void 0?null:qr(t);return t===void 0||n===null||Jr(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function $r(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 ei={platform:`flickr`,fallback:Kr,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=Zr(F(e.attrs.get(`href`)??``)),n=$r(e);if(!t||!n)return null;let r={};for(let t of Wr)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=B(n),a=Gr.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return V({...t,options:r,fallbackHtml:j([a],Kr)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>Hr.test(e),match(e){let t=Zr(e)??Qr(e);return t&&{...t,options:{}}}},q=`([A-Za-z0-9]{6,40})`,ti=RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${q}/?$`),ni=RegExp(`^/embed/${q}/?$`),ri=/^(?:media\d?|i)\.giphy\.com$/,ii=`\\.(?:gif|webp|mp4)`,ai=RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${q}/[A-Za-z0-9_-]{1,40}${ii}$`),oi=RegExp(`^/${q}${ii}$`),si=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function ci(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function li(e){if(e){if(W.has(e.host))return(ti.exec(e.path)??ni.exec(e.path))?.[1];if(ri.test(e.host))return(ai.exec(e.path)??(e.host===`i.giphy.com`?oi.exec(e.path):null))?.[1]}}function ui(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=ni.exec(t.path)??[];return n===void 0?null:ci(n)}function di(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||ti.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 fi={platform:`giphy`,parse(e){let t=H(e,si),n=t?.iframe??e,r=ui(n);return r?V({...r,options:{}},t?.size??B(n)):null},isOwnScript:()=>!1,isOwnExtra:di,match(e){let t=li(e);return t===void 0?null:{...ci(t),options:{}}},ownsFrame:tn},pi=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),J=`([A-Za-z0-9]{5,7})`,mi=RegExp(`^(a/)?${J}$`),hi=RegExp(`^/a/${J}/?$`),gi=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${J}/?$`),_i=RegExp(`^/${J}/?$`),vi=RegExp(`^/${J}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),yi=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,bi=/* @__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`]),xi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Si(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Ci(e){return e===void 0||bi.has(e.toLowerCase())?void 0:e}function wi(e){if(!e)return;if(e.host===`i.imgur.com`)return Ci(vi.exec(e.path)?.[1]);if(!pi.has(e.host))return;let t=(hi.exec(e.path)??gi.exec(e.path))?.[1];return t===void 0?Ci(_i.exec(e.path)?.[1]):`a/${t}`}function Ti(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:Ti(e.children)}})}function Ei(e,t){return e.attrs.get(t)===`false`}const Di={platform:`imgur`,fallback:xi,parse(e){if(e.tag!==`blockquote`||!k(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=mi.exec(t)??[];if(r===void 0||n===void 0&&!Ci(r))return null;let i={};return Ei(e,`data-context`)&&(i.context=!1),Ei(e,`data-analytics`)&&(i.analytics=!1),{...Si(t),options:i,fallbackHtml:j(Ti(e.children),xi)}},isOwnScript:e=>yi.test(e),match(e){let t=wi(e);return t===void 0?null:{...Si(t),options:{}}}},Oi=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),ki=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Ai=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),ji=/* @__PURE__ */ new Set([`p`,`reel`]),Mi=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Ni=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Pi(e){if(!e||!Oi.has(e.host))return null;let[,t,n,r]=ki.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Ai.has(t)||!ji.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Fi={platform:`instagram`,fallback:Ni,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`?Pi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Pi(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:j(e.children,Ni)}},isOwnScript:e=>Mi.test(e),match(e){let t=Pi(e);return t&&{...t,options:{}}}},Ii=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),Li=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Ri=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),zi=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Bi(e,t){if(!e||!t.has(e.host))return null;let[,n]=Li.exec(e.path)??[];if(n===void 0||Ri.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Vi={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=Bi(t,Kt);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>zi.has(e)).map(([e,t])=>[e,I(t)]));return V({...n,options:r},B(e))},isOwnScript:()=>!1,match(e){let t=Bi(e,Ii)??Bi(e,Kt);return t&&{...t,options:{}}},ownsFrame:nn},Hi=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,Ui=`(activity|share|ugcPost):(\\d{19})`,Wi=RegExp(`^(?:/embed)?/feed/update/urn:li:${Ui}/?$`),Gi=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),Ki=RegExp(`^/embed/feed/update/urn:li:${Ui}$`);function qi(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 Ji=e=>e.replace(/%3A/gi,`:`),Yi={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=Ki.exec(t.path)??[];return n===void 0||r===void 0?null:V(qi(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:()=>!1,match(e){if(!Hi.test(e.host))return null;let t=Ji(e.path),[,n,r]=Wi.exec(t)??Gi.exec(t)??[];return n===void 0||r===void 0?null:qi(n,r)},ownsFrame:rn},Xi=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,Zi=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,Qi=/^\d{1,25}$/,$i=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,ea=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function ta(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function na(e){if(!e||!Xi.test(e.host))return null;let[,t]=Zi.exec(e.path)??[];return t===void 0?null:ta(t)}const ra={platform:`pinterest`,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=na(F(e.attrs.get(`href`)??``));return t&&{...t,options:z(e,ea,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Qi.test(n)?{...ta(n),options:{}}:null},isOwnScript:e=>$i.test(e),match(e){let t=na(e);return t&&{...t,options:{}}},ownsFrame:an},ia=/* @__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}))?\/?$/,oa=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,sa=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,ca=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function la(e){if(!e||!ia.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 ua={platform:`reddit`,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`?la(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return V({...t,options:z(e,ca,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>oa.test(e)||sa.test(e),match(e){let t=la(e);return t&&{...t,options:{}}}},da=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),fa=`([A-Za-z][A-Za-z0-9._-]{1,29})`,pa=RegExp(`^(?:/@${fa})?/spotlight/([A-Za-z0-9_-]{20,120})$`),ma=RegExp(`^/(?:@|add/)${fa}$`),ha=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,ga=RegExp(`^/@${fa}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),_a=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function va(e){if(!e||!da.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=pa.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]=ma.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=ha.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=ga.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const ya={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!k(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=va({...t,path:t.path.slice(0,-6)});if(!n||!A(e.children).filter(e=>e.tag===`a`).every(e=>{let t=va(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return V({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>_a.test(e),match(e){let t=va(e);return t&&{...t,options:{}}}},ba=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),xa=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Sa=`[a-z0-9_-]{1,64}`,Ca=`s-[A-Za-z0-9]{1,32}`,wa=RegExp(`^/(${Sa})(?:/(sets/${Sa}|${Sa})(?:/(${Ca}))?)?/?$`,`i`),Ta=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Ea=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Da=RegExp(`^${Ca}$`);function Oa(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function ka(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=xa.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Da.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Oa(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Aa(e){if(!ba.has(e.host))return null;let[,t,n,r]=wa.exec(e.path)??[];if(t===void 0||Ta.has(t.toLowerCase())||n!==void 0&&Ea.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Oa(`https://soundcloud.com/${i}`,i)}const ja=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Ma(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ja.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&ba.has(F(e.attrs.get(`href`)??``)?.host??``)}function Na(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&&Ma(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Ma(r)}const Pa={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=ka(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Da.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=B(e)??{};return V({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Na,match(e){let t=ka(e)??Aa(e);return t&&{...t,options:{}}},ownsFrame:cn},Fa=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Ia=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function La(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Ra(e,t){return e&&t.has(e.host)?Fa.exec(e.path)?.[1]:void 0}const za={platform:`rumble`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=Ra(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=I(i)),V({...La(n),options:r},B(e))},isOwnScript:()=>!1,match(e){let t=Ra(e,Ia);return t===void 0?null:{...La(t),options:{}}},ownsFrame:un},Ba=/* @__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)?/?$`),Va=/* @__PURE__ */ new Set([`utm_source`,`si`]);function Ha(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=Ba.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 Ua(e){return Object.fromEntries([...e].filter(([e])=>!Va.has(e)).map(([e,t])=>[e,I(t)]))}const Wa={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Ha(t);if(!n)return null;let{query:r,...i}=n;return V({...i,options:Ua(r)},B(e))},isOwnScript:()=>!1,match(e){let t=Ha(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:ln},Ga=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),Ka=/^\d{1,20}$/,qa=/^\/(activities|routes)\/(\d{1,20})\/?$/,Ja=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,Ya=/* @__PURE__ */ new Set([`standard`,`minimal`]),Xa=/^[A-Za-z0-9_-]{1,100}$/,Za={activity:`activities`,route:`routes`};function Qa(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${Za[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function $a(e){return e===`activity`||e===`route`}const eo={platform:`strava`,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(!$a(t)||!Ka.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&Ya.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&&Xa.test(a)&&(r.mapHash=a),{...Qa(t,n),options:r}},isOwnScript:e=>Ja.test(e),match(e){if(!Ga.has(e.host))return null;let[,t,n]=qa.exec(e.path)??[];return t===void 0||n===void 0?null:{...Qa(t===`routes`?`route`:`activity`,n),options:{}}}},to=`([a-z0-9]{4,8})`,no=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),ro=RegExp(`^/[eo]/${to}$`),io=RegExp(`^/${to}/?$`),ao=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),oo=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,so=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),co=/<\/div\s*>$/i;function lo(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function uo(e){return e!==void 0&&!ao.has(e)}function fo(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=ro.exec(t.path)??[];if(!uo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>so.has(e)).map(([e,t])=>[e,I(t)]));return{...lo(n),options:r}}function po(e){if(!e||!no.has(e.host))return;let t=(ro.exec(e.path)??io.exec(e.path))?.[1];return uo(t)?t:void 0}const mo={platform:`streamable`,parse(e){let t=H(e,oo),n=t?.iframe??e,r=fo(n);return r?V(r,t?.size??B(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=co.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null},match(e){let t=po(e);return t===void 0?null:{...lo(t),options:{}}},ownsFrame:dn},ho=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),go=`[A-Za-z][A-Za-z0-9_]{2,31}`,_o=RegExp(`^(${go})/(\\d{1,10})$`),vo=RegExp(`^/(?:s/)?(${go})/(\\d{1,10})/?$`),yo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,bo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],xo=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function So(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Co={platform:`telegram`,parse:()=>null,parseScript(e){if(!yo.test(e.attrs.get(`src`)??``)||bo.some(t=>e.attrs.has(t)))return null;let[,t,n]=_o.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=z(e,xo,I);return e.attrs.has(`data-single`)&&(r.single=!0),So(t,n,r)},isOwnScript:e=>yo.test(e),match(e){if(!ho.has(e.host))return null;let[,t,n]=vo.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)),So(t,n,r)}},wo=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),To=`(\\d{1,20})`,Eo=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${To}/?$`),Do=RegExp(`^/embed/${To}$`),Oo=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,ko=/^\d{1,3}(?:\.\d{1,20})?$/,Ao=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function jo(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Mo(e){return e&&wo.has(e.host)?Eo.exec(e.path)?.[1]:void 0}function No(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=Po(t,1e4);return{width:t/n,height:1e4/n}}function Po(e,t){return t===0?e:Po(t,e%t)}function Fo(e){if(!k(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${To}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!ko.test(n))return null;let r=No(n===void 0?1.33:Number(n));return r?V({...jo(t),options:{},fallbackHtml:j(e.children,Ao)},r):null}function Io(e){let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=Do.exec(t.path)??[];return n===void 0?null:V({...jo(n),options:{}},B(e))}const Lo={platform:`tenor`,fallback:Ao,parse(e){return e.tag===`div`?Fo(e):e.tag===`iframe`?Io(e):null},isOwnScript:e=>Oo.test(e),match(e){let t=Mo(e);return t===void 0?null:{...jo(t),options:{}}},ownsFrame:fn},Ro=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),zo=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Bo=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Vo=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Ho=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Uo(e){if(!e||!Ro.has(e.host))return null;let[,t]=zo.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Wo={platform:`threads`,fallback:Ho,parse(e){if(e.tag!==`blockquote`||!k(e,`text-post-media`))return null;let t=Uo(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:z(e,Vo,I),fallbackHtml:j(e.children,Ho)}},isOwnScript:e=>Bo.test(e),match(e){let t=Uo(e);return t&&{...t,options:{}}}},Go=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Ko=/^\/player\/v1\/(\d{1,25})\/?$/,qo=/^\d{1,25}$/,Jo=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function Yo(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const Xo={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&k(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&U.has(t.host)?Go.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!qo.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Yo(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!U.has(t.host))return null;let[,n]=Ko.exec(t.path)??[];return n===void 0?null:V(Yo(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:e=>Jo.test(e),match(e){if(!U.has(e.host))return null;let[,t,n]=Go.exec(e.path)??[];return t===void 0||n===void 0?null:Yo(n,t)},ownsFrame:Zt},Zo=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),Qo=`(@[A-Za-z0-9_.-]{1,64})`,$o=`(\\d{1,25})`,es=RegExp(`^/${Qo}/(?:posts/)?${$o}/?$`),ts=RegExp(`^/${Qo}/${$o}/embed$`),ns=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function rs(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function is(e){if(!e||!Zo.has(e.host))return null;let[,t,n]=es.exec(e.path)??[];return t===void 0||n===void 0?null:rs(t,n)}const as={platform:`truthsocial`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=ts.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=k(e,`truthsocial-video`)?{video:!0}:{};return V({...rs(n,r),options:i},B(e))},isOwnScript:e=>ns.test(e),match(e){let t=is(e);return t&&{...t,options:{}}},ownsFrame:pn},os=`([a-z0-9-]{1,32})`,Y=`(\\d{1,20})`,ss=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),cs=RegExp(`^/${os}/${Y}(?:/[^/]{1,200})?/?$`),ls=RegExp(`^${os}\\.tumblr\\.com$`),us=RegExp(`^/post/${Y}(?:/[^/]{1,200})?/?$`),ds=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${os})/${Y}/v2$`),fs=RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${Y}$`),ps=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),ms=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function hs(e){if(!e)return null;let t,n;return ss.has(e.host)?[,t,n]=cs.exec(e.path)??[]:([,t]=ls.exec(e.host)??[],[,n]=us.exec(e.path)??[]),t===void 0||n===void 0||ps.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const gs={platform:`tumblr`,parse(e){if(e.tag!==`div`||!k(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ds.exec(t.path)??[],i=r??fs.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=hs(F(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>ms.test(e),match(e){let t=hs(e);return t&&{...t,options:{}}}},_s=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),vs=/^[A-Za-z0-9_]{3,25}$/,ys=/^v?(\d{1,12})$/,bs=/^[A-Za-z0-9_-]{6,30}$/,xs=/^[A-Za-z0-9_-]{6,100}$/,Ss=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Cs=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),ws=[`autoplay`,`muted`,`time`];function Ts(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Es=e=>Ts(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),Ds=e=>Ts(`https://www.twitch.tv/videos/${e}`,e),Os=e=>Ts(`https://www.twitch.tv/collections/${e}`,e),ks=e=>Ts(`https://clips.twitch.tv/${e}`,e);function As(e){let t={};for(let n of ws){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function js(e){let t=e.query.get(`channel`);if(t!==void 0)return vs.test(t)?Es(t):null;let[,n]=ys.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return Ds(n);let r=e.query.get(`collection`);return r!==void 0&&bs.test(r)?Os(r):null}function Ms(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return xs.test(t)?{found:ks(t),options:{}}:null}if(!_s.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=ys.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:Ds(t),options:n!==void 0&&Ss.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?bs.test(r??``)?{found:Os(r??``),options:{}}:null:t.length===3&&r===`clip`?vs.test(n)&&xs.test(i??``)?{found:ks(i??``),options:{}}:null:t.length===1&&vs.test(n)&&!Cs.has(n.toLowerCase())?{found:Es(n),options:{}}:null}const Ns={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=js(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=xs.test(e)?ks(e):null}return n&&V({...n,options:As(t.query)},B(e))},isOwnScript:()=>!1,match(e){let t=Ms(e);return t&&{...t.found,options:t.options}},ownsFrame:Qt},Ps=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),X=`(\\d{1,12})`,Fs=`([0-9a-f]{6,20})`,Is=[RegExp(`^/${X}(?:/${Fs})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${X}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${X}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${X}/?$`)],Ls=RegExp(`^/video/${X}/?$`),Rs=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,zs=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Bs=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Vs=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Hs(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Us(e){let[,t]=Vs.exec(e.fragment??``)??[];return t?{t}:{}}function Ws(e){if(!e||!Ps.has(e.host))return null;for(let t of Is){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return Hs(n,r)}return null}function Gs(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=F(e.attrs.get(`href`)??``);return n!==null&&Ps.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function Ks(e,t){return e?.type===`text`&&e.raw.trim()===t}function qs(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&&Gs(n,e=>Ws(e)?.id===t.id)&&Ks(r,`from`)&&Gs(i,()=>!0)&&Ks(a,`on`)&&Gs(o,e=>e.path===``||e.path===`/`)&&Ks(s,`.`)}function Js(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=Ls.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${Fs}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Bs.has(e)).map(([e,t])=>[e,I(t)]));return{...Hs(t,n),options:{...r,...Us(e)}}}const Ys={platform:`vimeo`,parse(e){let t=H(e,Rs),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Js(F(n.attrs.get(`src`)??``));return r&&V(r,t?.size??B(n))},isOwnScript:e=>zs.test(e),isOwnExtra:qs,match(e){let t=Js(e);if(t)return t;let n=Ws(e);return n&&{...n,options:Us(e)}},ownsFrame:$t},Xs=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Zs=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Qs=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,$s=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,ec=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],tc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function nc(e,t=Zs){if(!e||!Xs.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`}}const rc={platform:`x`,fallback:tc,parse(e){if(e.tag!==`blockquote`||!(k(e,`twitter-tweet`)||k(e,`twitter-video`)))return null;let t=A(e.children).reverse().map(e=>e.tag===`a`?nc(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:z(e,ec,I),fallbackHtml:j(e.children,tc)}:null},isOwnScript:e=>$s.test(e),match(e){let t=nc(e,Qs);return t&&{...t,options:{}}}},ic=`https://www.youtube.com`,ac=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,oc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,sc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,cc=/^\/([A-Za-z0-9_-]{11})\/?$/,lc=/^[A-Za-z0-9_-]{10,64}$/,uc=/^UC[A-Za-z0-9_-]{22}$/,dc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,fc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,pc=/^t=(.+)$/;function mc(e){if(e===void 0||e===``)return;let t=fc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function hc(e){return mc(e.get(`start`))??mc(e.get(`t`))}function gc(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function _c(e,t=!1){return gc(e,t?`${ic}/shorts/${e}`:`${ic}/watch?v=${e}`)}function vc(e){return e!==void 0&&lc.test(e)?gc(e,`${ic}/playlist?list=${e}`):null}function yc(e){return e!==void 0&&uc.test(e)?gc(e,`${ic}/channel/${e}/live`):null}function bc(e){let[,t,n]=oc.exec(e.path)??[];if(n!==void 0)return{found:_c(n)};if(t===`videoseries`){let t=vc(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=yc(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function xc(e,t){let n=hc(e.query)??mc(pc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const Sc=[rc,Fi,Fr,Wo,Xo,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&Ut.has(t.host);if(!t||!(n||Ht.has(t.host)))return null;let r=bc(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=hc(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),V({...r.found,options:a},B(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=cc.exec(e.path)??[];return t===void 0?null:{..._c(t),options:xc(e,!1)}}let t=Ut.has(e.host);if(!t&&!Ht.has(e.host))return null;let n=xc(e,t);if(R(e.path,`/embed`)){let t=bc(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&&ac.test(t)?{..._c(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=vc(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=dc.exec(e.path)??[],i=yc(r);if(i)return{...i,options:n};let[,a,o]=sc.exec(e.path)??[];return a===void 0||o===void 0?null:{..._c(o,a===`shorts`),options:n}},ownsFrame:Yt},Co,ya,Yi,ua,ra,Wa,Ys,Ns,_r,Pa,Jn,Qn,Vi,fi,Lo,mo,za,as,Di,eo,ei,ur,gs];function Cc(e){return Sc.find(t=>t.platform===e)}function wc(e){return Tc(Sc,e)}function Tc(e,t){let n=Dc(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function Ec(e,t){let n=Dc(t);return n&&e.match(n)}function Dc(e){return typeof e==`string`?F(e):null}const Oc={x:[`post sdk`],instagram:[`post sdk`],threads:[`post sdk`],facebook:[`post sdk`,`video sdk`,`video iframe`],tiktok:[`video iframe`],youtube:[`video iframe`],telegram:[`post iframe`],snapchat:[`post iframe`,`video iframe`],linkedin:[`post iframe`],reddit:[`post iframe`],pinterest:[`post sdk`],spotify:[`post iframe`,`video iframe`],vimeo:[`video iframe`],twitch:[`video iframe`],dailymotion:[`video iframe`],bluesky:[`post iframe`],soundcloud:[`post iframe`],applemusic:[`post iframe`],applepodcasts:[`post iframe`],tumblr:[`post iframe`],kick:[`video iframe`],giphy:[`video iframe`],truthsocial:[`post iframe`],imgur:[`post iframe`],tenor:[`video iframe`],streamable:[`video iframe`],strava:[`post iframe`],flickr:[`post iframe`],rumble:[`video iframe`]};function kc(e,t){if(t.platform!==e.platform)return null;let n=Ec(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!Oc[t.platform].includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||Ac(e,t,t.fallbackHtml))return t;let r={...t};return delete r.fallbackHtml,r}function Ac(e,t,n){let r=e.fallback,i=O(n);if(!r||!i||j(i,r)!==n)return!1;if(t.platform!==`x`)return!0;let[a]=O(`<blockquote class="twitter-tweet">${n}</blockquote>`)??[];return a?.type===`element`&&e.parse(a)?.id===t.id}const Z={x:`X`,instagram:`Instagram`,facebook:`Facebook`,threads:`Threads`,tiktok:`TikTok`,youtube:`YouTube`,telegram:`Telegram`,snapchat:`Snapchat`,linkedin:`LinkedIn`,reddit:`Reddit`,pinterest:`Pinterest`,spotify:`Spotify`,vimeo:`Vimeo`,twitch:`Twitch`,dailymotion:`Dailymotion`,bluesky:`Bluesky`,soundcloud:`SoundCloud`,applemusic:`Apple Music`,applepodcasts:`Apple Podcasts`,tumblr:`Tumblr`,kick:`Kick`,giphy:`Giphy`,truthsocial:`Truth Social`,imgur:`Imgur`,tenor:`Tenor`,streamable:`Streamable`,strava:`Strava`,flickr:`Flickr`,rumble:`Rumble`};function jc(e){return`social-embeds: a ${Z[e]} URL needs a lookup: use the embed code`}function Mc(e,t,n){let{platform:r}=n,i=t??(e===void 0?null:Ec(n,e));if(!i&&e!==void 0&&Wn(e)===r)return{error:jc(r)};if(!i)return{error:`social-embeds: not a ${Z[r]} post URL: ${String(e)}`};if(i.platform!==r)return{error:`social-embeds: expected a ${Z[r]} embed, got ${Z[i.platform]}`};let a=kc(n,i);return a?{embed:a}:{error:`social-embeds: the ${Z[r]} embed's url and id do not match`}}function Nc(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=Wn(e.url);return t?jc(t):`social-embeds: not a supported post URL: ${e.url}`}function Pc(e){return Fc(Sc,e)}function Fc(e,t){if(typeof t!=`string`)return null;let n=O(t);return n?Lc(e,n):Ic(e,t)}function Ic(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:O(r),a=i&&Lc(e,i);if(a?.platform===n.platform)return a}return null}function Lc(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Oe(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(Rc(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 Rc(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function zc(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Bc(e){return e===null?void 0:zc(e.trim().replace(/px$/i,``))}function Vc(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function Hc(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Uc(e,t){let n=t??e.getAttribute(`html`)??Vc(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:zc(i)??(i?.trim()?i:void 0),maxWidth:Bc(e.getAttribute(`max-width`)),height:Bc(e.getAttribute(`height`)),maxHeight:Bc(e.getAttribute(`max-height`))},eager:Hc(e)}}function Wc(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Gc(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Wc(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 Kc(e,t){let n=Wc(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 qc(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 Jc=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function Yc(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`&&Jc.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Xc(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 Zc(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 Qc(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function $c(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function el(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{Yc(c,Gc(t,e,l))};u(n);let d=$c(document.createElement(`div`)),f=$c(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?Xc():tl(t.fallbackHtml,t.fallbackImage===!0)];f.append(...p),d.append(f),c.append(d),e.append(c);let m,h=!1,g,_=[],v=()=>{f.remove(),h||(h=!0,a())},y=e=>{if(!s||e.origin!==s.origin||!m||e.source!==m.contentWindow)return;let t;try{t=s.read(e.data)}catch{return}typeof t==`number`&&t>0&&t<=5e4&&(l=Math.ceil(t),Q(c,{height:l}),v())},ee=s?`did not report its height`:`did not load`,b=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${ee}`)))},15e3)},x=e=>{let n=document.createElement(`iframe`);n.src=t.hostParam?Qc(e,t.hostParam):e,n.title=t.title,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),Q(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{s||v()}),m?m.replaceWith(n):d.prepend(n),m=n,s&&window.addEventListener(`message`,y)},S=!1,C=()=>{S||(S=!0,t.sizeInSrc?_.push(qc(d,e=>{x(Kc(t,e))})):x(t.src))};return r&&C(),_.push(Zc(d,!1,()=>{C(),b()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),window.removeEventListener(`message`,y),c.remove()},update(e,t){u(e),t&&C()}}}function tl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const nl=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function rl(e){let t=e.querySelector(nl.map(e=>`[${e}]`).join());for(let e of nl){let n=t?.getAttribute(e);if(n)return n}}function il(e){return`View this post on ${e}`}function al(e){return e instanceof Error?e:Error(String(e))}function ol(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{Yc(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=rl(f),m=t.hasFallback?[]:o.length>0?o:[Xc(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=e=>{for(let e of m)e.parentNode?.removeChild(e);m=e,d.append(...e)},g=!1,_=!1,v,y=()=>{},ee=()=>{g||_||(_=!0,clearTimeout(v),y(),h([]),s())},b=e=>{if(t.hasFallback||p===void 0)h([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,p),e.textContent=il(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof le?b(t):v=setTimeout(()=>{S(e+1)},1e3*2**(e-1)))},S=e=>{if(!(g||_)){try{y=r.render(f,ee)}catch(t){x(e,al(t));return}v=setTimeout(()=>{x(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},C=!1,te=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(al(e))}))},w=Zc(f,a,te);return{wrapper:l,cleanup:()=>{g=!0,w(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&te()}}}const sl=typeof HTMLElement>`u`?class{}:HTMLElement,$=`embed`;function cl(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 ll(e){let t=``;for(let n of e.children)n.slot!==$&&(t+=n.outerHTML);return t&&(Pc(t)??En(t))?t:void 0}function ul(e){let t=`html`in e?Pc(e.html):wc(e.url);if(!t){let t=`html`in e?En(e.html):null;return t?Ln(t):{kind:`error`,message:Nc(e)}}let n=Cc(t.platform);if(!n)return{kind:`error`,message:Nc(e)};let r=Mc(void 0,t,n);return r.error===void 0?Rt(r.embed):{kind:`error`,message:r.error}}const dl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var fl=class extends sl{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i;#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${$}"></slot>`;for(let e of dl){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get eager(){return Hc(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=Uc(this,this.#e);this.#i=n.source?void 0:t&&this.#i||ll(this),n.source??=this.#i===void 0?null:{html:this.#i};let r=JSON.stringify(n.source);r===this.#r&&t?this.#n?.update(n.layout,n.eager):(this.#u(),this.#r=r,this.#d(n))}#u(){this.#a+=1;let e=this.#n;this.#n=void 0,e?.cleanup()}#d(e){let{source:t,layout:n,eager:r}=e;if(!t)return;let i=this.#a,a=e=>{queueMicrotask(()=>{i===this.#a&&this.isConnected&&this.dispatchEvent(e)})},o=e=>{a(new ErrorEvent(`error`,{error:e,message:e.message}))},s=ul(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?cl(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?el(this,s,c):ol(this,s,c),this.#n.wrapper.slot=$}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,fl);export{fl 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)}}const c={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0},listen:s};function l(e,t){let n=t.colorMode??e.options.colorMode;return{kind:`iframe`,src:`https://embed.bsky.app/embed/${e.id}${a(typeof n==`string`?[[`colorMode`,n]]:void 0)}`,title:`Bluesky post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:c,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const u=/^x[a-z0-9]{3,12}$/;function d(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...l}=e.options,d=n??c;if(d===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof d!=`string`||!u.test(d))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(d)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${d}.html${a([[`video`,e.id]],i(l,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const f=15e3,p=3e3,m=/* @__PURE__ */ new Map;function h(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=m.get(e.key);return t||(t=g(e).catch(t=>{throw m.delete(e.key),t}),m.set(e.key,t)),t}async function g(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await _(e,t)||await y(e)}await e.whenPresent?.()}function _(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?p:f),i,a=()=>{r=Date.now()+p},o=()=>{clearTimeout(i),window.removeEventListener(`load`,a);for(let e of t)e.removeEventListener(`error`,o);n(e.isPresent())},s=()=>{e.isPresent()||Date.now()>=r?o():i=setTimeout(s,50)};window.addEventListener(`load`,a);for(let e of t)e.addEventListener(`error`,o);s()})}var v=class extends Error{};async function y(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await ee(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof v)||t>=3)throw e;await S(1e3*2**(t-1))}await(t?x(t,`${e.url} did not report ready`):b(e))}async function ee(e){let t=e.prepare?.(),n=document.createElement(`script`),r=new Promise((t,r)=>{n.src=e.url,n.async=!0,e.crossOrigin&&(n.crossOrigin=e.crossOrigin);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new v(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await x(r,`${e.url} did not load`)}finally{t?.()}return n}function b(e){return new Promise((t,n)=>{let r=Date.now()+f,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function x(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},f);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function S(e){return new Promise(t=>setTimeout(t,e))}const C=()=>window,w=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){let t=C().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}const re={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=C().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=C().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=C().FB;return!ne(e)&&t!==void 0&&!t.__buffer}const oe={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`instagram`),prepare:ie,skipped:()=>ae(`instagram`)},se={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:()=>ne(`threads`),prepare:ie,skipped:()=>ae(`threads`)};function ce(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${w}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=C().fbAsyncInit;C().fbAsyncInit=()=>{t?.(),e()}})}}const le={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().PinUtils?.build==`function`};function ue(){return h(re)}function de(){return h(oe)}function fe(){return h(se)}function pe(){return h(le)}function me(e){return te.test(e)?h(ce(e)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${e}"`))}const T=()=>window;var he=class extends Error{};function E(e,t,n){if(t(e))return n(),()=>{};let r=new MutationObserver(()=>{t(e)&&(r.disconnect(),n())});return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`class`,`style`,`height`]}),()=>{r.disconnect()}}function ge(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function _e(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ve={load:()=>ue(),render(e,t){let n=T().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=E(e,_e,t);return ge(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function ye(e,t){if(e.getRootNode()!==document)throw new he(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function be(){let e=T().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const xe={load:()=>de(),render(e,t){ye(e,`Instagram`);let n=E(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ge(e,`instagram-media`),be(),n}},Se={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=E(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ge(e,`text-post-media`),be(),n}},Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);return t||(t={load:()=>me(e),render(e,t){let n=T().FB,r=n?.XFBML?.parse;if(!n||!r)throw Error(`social-embeds: FB.XFBML.parse is missing`);let i=()=>{r(e,t)};try{i()}catch(e){if(!(e instanceof Error)||!/init not called/.test(e.message))throw e;n.init?.({xfbml:!1,version:w}),i()}return()=>{}}},Ce.set(e,t)),t}const Te={load:()=>pe(),render(e,t){let n=T().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=E(e,e=>e.querySelector(`span[data-pin-id]`)!==null,t),i=e.querySelector(`a`);return i&&!i.hasAttribute(`data-pin-do`)&&i.setAttribute(`data-pin-do`,`embedPin`),n(e),r}},Ee=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),De=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Oe=/<([a-zA-Z][a-zA-Z0-9-]*)/y,ke=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ae=/\s*(\/?)>/y,je=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Me=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}je.lastIndex=a;let s=je.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=je.lastIndex;continue}let c=Ne(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:De.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!Ee.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ne(e,t){Oe.lastIndex=t;let n=Oe.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Oe.lastIndex;for(;;){Ae.lastIndex=i;let t=Ae.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ae.lastIndex};ke.lastIndex=i;let a=ke.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Pe(s??c??l??``)),i=ke.lastIndex}}function Pe(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return Me.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Fe(e,t),t}function Fe(e,t){for(let n of e)n.type===`element`&&(t.push(n),Fe(n.children,t))}const Ie=/* @__PURE__ */ new Set([`href`,`cite`]),Le=/^https?:\/\//i;function A(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Ie.has(e)&&!Le.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,Ee.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function M(e,t){let n=D(e);return n!==null&&A(n,t)===e}function Re(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function ze(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Re(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const Be={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ve={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},He={post:300,video:200};function Ue(e){let t=Object.entries(e.options).filter(([e])=>e!==`href`);return{kind:`iframe`,src:`https://www.facebook.com/plugins/video.php${a([[`href`,e.url]],t)}`,title:`Facebook video player`,allow:`autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function We(e,t){if(e.variant===`iframe`)return Ue(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ve)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ue({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${j(e.url)}"${ze(Be,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:we(i),minHeight:He[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Ge(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Ke(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Ge(e),l=i===void 0||a!==void 0?void 0:Math.floor(i*s/c);return{position:`relative`,width:r,maxWidth:l===void 0||o!==void 0&&o<l?o:l,...e.messageHeight?{height:n??e.startHeight}:a===void 0?{aspectRatio:`${String(s)} / ${String(c)}`}:{height:a,maxHeight:i},...e.borderRadius===void 0?{}:{borderRadius:e.borderRadius,overflow:`hidden`}}}function qe(e,t){let n=Ge(e),r=Math.round(t*n.height/n.width),i=e.src.indexOf(`?`),a=i===-1?e.src:e.src.slice(0,i),o=i===-1?``:`&${e.src.slice(i+1)}`;return`${a}?width=${String(t)}&height=${String(r)}${o}`}function Je(e,t){let n,r,i=e=>{let i=Math.round(e);i<=0||(clearTimeout(r),i!==n&&(n===void 0?(n=i,t(i)):r=setTimeout(()=>{n=i,t(i)},200)))};if(typeof ResizeObserver>`u`)return i(e.getBoundingClientRect().width),()=>{};let a=new ResizeObserver(e=>{for(let t of e)i(t.contentRect.width)});return a.observe(e),()=>{a.disconnect(),clearTimeout(r)}}const Ye=[`header`,`footer`,`context`],Xe=/\/albums\/\d+$/;function Ze(e,t){let n=Xe.test(e.url),r=Ye.filter(n=>t[n]??e.options[n]===!0),{width:i,height:a}=e.size??{},o=i!==void 0&&a!==void 0?{width:i,height:a}:void 0,s=`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,c={width:4,height:3};return{kind:`iframe`,src:s,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:c,...o?{size:o,maxWidth:o.width}:{},sizeInSrc:{watch:Je,src:e=>qe({src:s,ratio:c,size:o},e)},...e.fallbackHtml===void 0?{}:{fallbackHtml:e.fallbackHtml.replace(/<img(?=[\s>])/g,`<img style="display:block;width:100%;height:100%;object-fit:cover"`)},fallbackImage:!0}}function Qe(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}const $e={origin:`https://imgur.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.message===`resize_imgur`&&typeof t.height==`number`?t.height:void 0},listen:s};function et(e,t){let n=[`pub=true`,...t.context??e.options.context!==!1?[]:[`context=false`],...e.options.analytics===!1?[`analytics=false`]:[]];return{kind:`iframe`,src:`https://imgur.com/${e.id}/embed?${n.join(`&`)}`,title:`Imgur post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:$e,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function tt(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${Re({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:xe,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const nt=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function rt(e,t){let n=[];return t.autoplay!==void 0&&n.push([`autoplay`,t.autoplay]),t.muted!==void 0&&n.push([`muted`,t.muted]),{kind:`iframe`,src:`https://player.kick.com/${e.id}${a(Object.entries(e.options).filter(([e])=>nt.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function it(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const at={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ot={small:236,medium:345,large:600};function st(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${ze(at,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:Te,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:ot[String(n.width)]??236}}const ct={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},lt={origin:`https://embed.reddit.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.type===`resize.embed`&&typeof t.data==`number`?t.data:void 0},listen:s};function ut(e,t){let n=[];for(let[e,r]of Object.entries(ct)){let i=t[e];i!==void 0&&n.push([r,i])}return{kind:`iframe`,src:`https://embed.reddit.com${e.url.slice(22)}${a([[`embed`,!0]],Object.entries(e.options),n)}`,title:`Reddit post`,allow:`clipboard-read; clipboard-write`,sandbox:`allow-scripts allow-same-origin allow-popups`,scrolling:`no`,ratio:{width:1,height:1},messageHeight:lt,startHeight:e.size?.height??316,maxWidth:640}}function dt(e){let t=e.options.title;return{kind:`iframe`,src:`${e.url}/embed`,title:typeof t==`string`&&t!==``?t:`Snapchat`,allow:`autoplay; camera; microphone; clipboard-write;`,scrolling:`no`,ratio:{width:416,height:692},size:e.size,maxWidth:416}}const ft={visual:`visual`,color:`color`,autoPlay:`auto_play`,hideRelated:`hide_related`,showComments:`show_comments`,showUser:`show_user`,showReposts:`show_reposts`,showTeaser:`show_teaser`,showArtwork:`show_artwork`};function pt(e,t){let n=[];for(let[e,r]of Object.entries(ft)){let i=t[e];i!==void 0&&n.push([r,i])}let r=e.size===void 0;return{kind:`iframe`,src:`https://w.soundcloud.com/player/${a([[`url`,e.url]],r?[[`visual`,!0]]:void 0,i(e.options,[`url`,`secret_token`]),n)}`,title:`SoundCloud player`,allow:`autoplay; encrypted-media`,scrolling:`no`,ratio:{width:16,height:9},height:e.size?.height??400}}function mt(e){let t=i(e.options,[]).filter(([e])=>e===`pub`);return{kind:`iframe`,src:`https://rumble.com/embed/${e.id}/${a(t)}`,title:`Rumble video`,allow:`fullscreen`,ratio:{width:16,height:9},size:e.size}}const ht=/* @__PURE__ */ new Set([`track`,`episode`]);function gt(e,t){let n=new URL(e.url).pathname.split(`/`)[1]??``,r=e.kind===`video`,i=a(Object.entries(e.options),t.theme===void 0?void 0:[[`theme`,t.theme]]);return{kind:`iframe`,src:`https://open.spotify.com/embed/${n}/${e.id}${r?`/video`:``}${i}`,title:`Spotify Embed`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,ratio:{width:16,height:9},size:r?e.size:void 0,borderRadius:12,height:r?void 0:e.size?.height??(ht.has(n)?152:352)}}const _t={origin:`https://strava-embeds.com`,read(e){if(!Array.isArray(e))return;let[,t,n]=e;return t===`BROADCAST_IFRAME_HEIGHT`&&typeof n==`number`?n:void 0},listen:s};function vt(e){return e===`minimal`?`minimal`:`standard`}function yt(e,t){let n=e.id.startsWith(`route/`),r=vt(t.embedStyle??e.options.style),i=n&&(t.fullWidth??e.options.fullWidth===!0),a=t.mapHash??e.options.mapHash,o=`?style=${r}${i?`&fullWidth=true`:``}`,s=`#ns=social-embeds${typeof a==`string`&&a!==``?`&mapHash=${encodeURIComponent(a)}`:``}`;return{kind:`iframe`,src:`https://strava-embeds.com/${e.id}${o}${s}`,title:n?`Strava route`:`Strava activity`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:_t,startHeight:650,...i?{}:{maxWidth:554}}}const bt=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),xt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function St(e,t){let n=Object.entries(e.options).filter(([e])=>bt.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,xt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Ct=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function wt(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0},listen:s};function Et(e,t){let{userpic:n,color:r,dark:i,darkColor:o}=t,s={...e.options,...n===void 0?{}:{userpic:n},...r===void 0?{}:{color:r},...i===void 0?{}:{dark:i},...o===void 0?{}:{darkColor:o}},c=[[`embed`,1]];for(let[e,t]of Ct){let n=wt(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Tt,startHeight:300,maxWidth:500}}function Dt(e){return{kind:`iframe`,src:`https://tenor.com/embed/${e.id}`,title:`Tenor GIF`,allow:`fullscreen`,ratio:{width:133,height:100},size:e.size}}function Ot(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${Re({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:Se,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const kt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function At(e,t){let n=o(t,kt);return{kind:`iframe`,src:`https://www.tiktok.com/player/v1/${e.id}${a(Object.entries(e.options),n)}`,title:`TikTok video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share`,ratio:{width:9,height:16},size:e.size,maxWidth:325}}function jt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Mt={origin:`https://truthsocial.com`,read:jt,listen:s},Nt={origin:`https://truthsocial.com`,read(e){let t=jt(e);return t===void 0||t<=0?void 0:t+165},listen:s},Pt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Ft(e){let t=Pt.exec(e.url)?.[1];return t===void 0?{kind:`error`,message:`social-embeds: not a Truth Social post URL: ${e.url}`}:{kind:`iframe`,src:`https://truthsocial.com/${t}/${e.id}/embed`,title:`Truth Social post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:e.options.video===!0?Nt:Mt,startHeight:150,maxWidth:e.size?.width??600}}const It={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0},listen:s};function Lt(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:It,startHeight:400,maxWidth:540}}const Rt=[`channel`,`video`,`collection`,`clip`,`parent`];function zt(e,t){let{hostname:n,pathname:r}=new URL(e);if(n===`clips.twitch.tv`)return[`https://clips.twitch.tv/embed`,[`clip`,t]];let i=r.split(`/`)[1];return[`https://player.twitch.tv/`,i===`videos`?[`video`,`v${t}`]:i===`collections`?[`collection`,t]:[`channel`,t]]}function Bt(e,t){let{autoplay:n,muted:r,time:o}=t,s=[];n!==void 0&&s.push([`autoplay`,String(n)]),r!==void 0&&s.push([`muted`,String(r)]),o!==void 0&&s.push([`time`,o]);let[c,l]=zt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Rt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Vt}}function Vt(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Ht={autopause:`autopause`,autoplay:`autoplay`,background:`background`,byline:`byline`,color:`color`,controls:`controls`,dnt:`dnt`,keyboard:`keyboard`,loop:`loop`,muted:`muted`,pip:`pip`,playsinline:`playsinline`,portrait:`portrait`,quality:`quality`,speed:`speed`,title:`title`,transparent:`transparent`};function Ut(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ht),d=n??s;return{kind:`iframe`,src:`https://player.vimeo.com/video/${e.id}${a(l?[[`h`,l]]:void 0,i(c,[`h`]),u)}${d===void 0?``:`#t=${encodeURIComponent(String(d))}`}`,title:`Vimeo video player`,allow:`autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:{width:16,height:9},size:e.size}}const Wt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Gt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${ze(Wt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ve,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const Kt={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function qt(e){return e.url.startsWith(`https://www.youtube.com/playlist?`)?{path:`videoseries`,key:`list`}:e.url.startsWith(`https://www.youtube.com/channel/`)?{path:`live_stream`,key:`channel`}:{path:e.id}}function Jt(e,t){let{nocookie:n,...r}=t,{nocookie:s,...c}=e.options,l=n??s===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,{path:u,key:d}=qt(e),f=o(r,Kt).filter(([e])=>e!==d);return{kind:`iframe`,src:`${l}/embed/${u}${a(d===void 0?void 0:[[d,e.id]],i(c,d===void 0?[]:[d]),f)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function Yt(e){switch(e.platform){case`x`:return Gt(e,{});case`instagram`:return tt(e,{});case`threads`:return Ot(e,{});case`facebook`:return We(e,{});case`tiktok`:return At(e,{});case`youtube`:return Jt(e,{});case`telegram`:return Et(e,{});case`snapchat`:return dt(e);case`linkedin`:return it(e,{});case`reddit`:return ut(e,{});case`pinterest`:return st(e,{});case`spotify`:return gt(e,{});case`vimeo`:return Ut(e,{});case`twitch`:return Bt(e,{});case`dailymotion`:return d(e,{});case`bluesky`:return l(e,{});case`soundcloud`:return pt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Lt(e);case`kick`:return rt(e,{});case`giphy`:return Qe(e);case`tenor`:return Dt(e);case`streamable`:return St(e,{});case`rumble`:return mt(e);case`truthsocial`:return Ft(e);case`imgur`:return et(e,{});case`strava`:return yt(e,{});case`flickr`:return Ze(e,{});default:return e.platform}}const Xt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=Xt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&`,`&`).split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=Zt(t===-1?e:e.slice(0,t)),r=Zt(t===-1?``:e.slice(t+1));if(n===null||r===null)return null;o.has(n)||o.set(n,r)}return{host:n.toLowerCase(),path:r,query:o,...a?{fragment:a}:{}}}function Zt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t){return e===t||e.startsWith(`${t}/`)}function z(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 B(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function V(e,t){return t?{...e,size:t}:e}function H(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`]),U=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),nn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),W=/* @__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)&&R(e.path,`/embed`),cn=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||tn.has(e.host)&&(R(e.path,`/embed`)||R(e.path,`/video`)),ln=e=>U.has(e.host)&&R(e.path,`/player`),un=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&R(e.path,`/embed`),dn=e=>e.host===`player.vimeo.com`,fn=e=>nn.has(e.host)&&R(e.path,`/plugins`),pn=e=>W.has(e.host)&&R(e.path,`/embed`),mn=e=>rn.has(e.host),hn=e=>e.host===`www.linkedin.com`&&R(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`&&R(e.path,`/embed`),xn=e=>e.host===`rumble.com`&&R(e.path,`/embed`),Sn=e=>e.host===`streamable.com`&&(R(e.path,`/e`)||R(e.path,`/o`)),Cn=e=>e.host===`tenor.com`&&R(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=RegExp(`^(?:https:)?//${kn}(?:[/?#]|$)`,`i`),jn=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${kn})$`,`i`),Mn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Nn=/[\t\n\f\r ]+/,Pn=/^\s*(width|height)\s*:(.*)$/is,Fn=/^(\d+)px$/i,In=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function Ln(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=B(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&&H(a,In)?.size})}function Rn(e){return zn(e)}function zn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Bn(t.src);if(n===null)return null;let r=typeof t.title==`string`?t.title.trim():``,i=typeof t.referrerPolicy==`string`?t.referrerPolicy.toLowerCase():void 0,a=En.find(e=>e===i),o=Un(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Vn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Hn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Gn(t.size),...o?{ratio:o}:{}}}function Bn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=An.test(t)&&!t.includes(`\\`)?F(t):null;return!n||Mn.test(n.path)||Tn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Vn(e){return e.split(`;`).map(e=>e.split(Nn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&On.has(e)&&t.every(e=>jn.test(e))).map(e=>e.join(` `)).join(`; `)}function Hn(e){let t=e.split(Nn).map(e=>e.toLowerCase()).filter(e=>Dn.has(e));return[...new Set(t)].join(` `)}function Un(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Wn(t)&&Wn(n)?{width:t,height:n}:void 0}function Wn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Gn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?L(String(t)):void 0,i=typeof n==`number`?L(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Kn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Pn.exec(r)??[],a=L(Fn.exec(i.trim())?.[1]);e.toLowerCase()===`width`&&(t=a),e.toLowerCase()===`height`&&(n=a)}return t===void 0&&n===void 0?void 0:{width:t,height:n}}const qn={width:16,height:9};function Jn(e){let t=Rn(e);return t?{kind:`iframe`,src:t.src,title:t.title??`Embedded content`,allow:t.allow,allowFullscreen:t.allowFullscreen,...t.referrerPolicy?{referrerPolicy:t.referrerPolicy}:{},...t.sandbox===void 0?{}:{sandbox:t.sandbox},...t.scrolling?{scrolling:t.scrolling}:{},...Yn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Yn({size:e,ratio:t}){let{width:n,height:r}=e;return n!==void 0&&r!==void 0?{ratio:{width:n,height:r},maxWidth:n}:r===void 0?{ratio:t??qn,...n===void 0?{}:{maxWidth:n}}:{ratio:qn,height:r}}const Xn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Qn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,$n=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),er=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function tr(e){let t=typeof e==`string`?F(e):null;return t?nr(t)?`rumble`:rr(t)?`bluesky`:null:null}function nr(e){return $n.has(e.host)&&er.test(e.path)}function rr(e){if(!Xn.has(e.host))return!1;let[,t]=Zn.exec(e.path)??[];return t!==void 0&&Qn.test(t)}const ir=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,ar=/^\d{1,15}$/;function or(e,t){if(e?.host!==t)return null;let[,n,r,i]=ir.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!ar.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!ar.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const sr={platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=or(F(e.attrs.get(`src`)??``),an);if(!t)return null;let{height:n}=B(e)??{};return V({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=or(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:_n},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={platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=ur(F(e.attrs.get(`src`)??``),on);return t&&V({...t,options:{}},B(e))},isOwnScript:()=>!1,match(e){let t=ur(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:vn},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=RegExp(`^/profile/${fr}/post/${pr}/?$`),gr=RegExp(`^at://${fr}/app\\.bsky\\.feed\\.post/${pr}$`),_r=/^[a-z2-7]{20,100}$/,vr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),yr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,br=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function xr(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 Sr(e){if(!e||!mr.has(e.host))return null;let[,t,n]=hr.exec(e.path)??[];return t===void 0||n===void 0?null:xr(t,n)}const Cr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:rr,trustsFallback:e=>M(e,br),parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=gr.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=xr(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?Sr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&_r.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&vr.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:A(e.children,br)}},isOwnScript:e=>yr.test(e),match(e){let t=Sr(e);return t&&{...t,options:{}}}},wr=/^x[a-z0-9]{4,12}$/,Tr=/^x[a-z0-9]{3,12}$/,Er=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/;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(!wr.test(r)||n!==void 0&&!Tr.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),Dr(r,i)}function kr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return wr.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&&wr.test(t)?Dr(t,{}):null}const Ar={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],parse(e){let t=H(e,Er),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=Or(r)??kr(r);return i&&V(i,t?.size??B(n))},isOwnScript:()=>!1,match(e){return Or(e)??kr(e)},ownsFrame:cn},jr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),G=`https://www.facebook.com`,Mr=`[A-Za-z0-9.\\-]{1,80}`,Nr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Pr=RegExp(`^/(${Mr})/posts/(${Nr})/?$`),Fr=RegExp(`^/(${Mr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Ir=RegExp(`^/(${Mr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),Lr=/^\/reel\/(\d{1,25})\/?$/,Rr=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),zr=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Br=RegExp(`^${Nr}$`),Vr=/^\d{1,25}$/,Hr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Ur=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Wr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Gr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Kr=/* @__PURE__ */ new Map([[`div`,[Gr]],[`blockquote`,[`cite`,Gr]],[`a`,[`href`]],[`p`,[]]]);function qr(e){if(!e||!jr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Pr.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${G}/${r}/posts/${i}`};if(Rr.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Br.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Vr.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${G}${t}?story_fbid=${e}${i}`}}if(zr.has(t)){let e=n.get(`fbid`);return e===void 0||!Vr.test(e)?null:{kind:`post`,id:e,url:`${G}${t}?fbid=${e}`}}let[,a,o,s]=Fr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${G}/${a}/photos/${o}/${s}/`};let[,c,l]=Ir.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${G}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Vr.test(e)?null:{kind:`video`,id:e,url:`${G}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=Lr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${G}/reel/${u}`}}function K(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Jr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>M(e,Kr),parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=qr(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...K(n,t,`sdk`,z(e,Ur,I)),fallbackHtml:A(e.children,Kr)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!nn.has(t.host))return null;let n=qr(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),K(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Wr){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return V(K(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return V(K(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),B(e))}return null},isOwnScript:e=>Hr.test(e),scriptOptions(e){let[,t]=Hr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=qr(e);return t&&K(t,t.kind,`sdk`,{})},ownsFrame:fn},Yr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),Xr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Zr=`(\\d{1,20})`,Qr=RegExp(`^/photos/${Xr}/${Zr}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),$r=RegExp(`^/photos/${Xr}/(?:albums|sets)/${Zr}/?$`),ei=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,ti=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,ni=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,ri=[`header`,`footer`,`context`],ii=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,ai=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:ii},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function oi(e){if(e===``)return null;let t=0n;for(let n of e){let e=ni.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function si(e){let t=BigInt(e),n=``;for(;t>0n;)n=ni.charAt(Number(t%58n))+n,t/=58n;return n}function ci(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function li(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function ui(e){if(!e||!Yr.has(e.host))return null;let[,t,n]=$r.exec(e.path)??[];if(t!==void 0&&n!==void 0)return li(t,n);let[,r,i]=Qr.exec(e.path)??[];return r===void 0||i===void 0?null:ci(r,i)}function di(e){if(e.host!==`flic.kr`)return null;let[,t]=ei.exec(e.path)??[],n=t===void 0?null:oi(t);return t===void 0||n===null||si(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function fi(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 pi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>M(e,ai),parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=ui(F(e.attrs.get(`href`)??``)),n=fi(e);if(!t||!n)return null;let r={};for(let t of ri)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=B(n),a=ii.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return V({...t,options:r,fallbackHtml:A([a],ai)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>ti.test(e),match(e){let t=ui(e)??di(e);return t&&{...t,options:{}}}},q=`([A-Za-z0-9]{6,40})`,mi=RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${q}/?$`),hi=RegExp(`^/embed/${q}/?$`),gi=/^(?:media\d?|i)\.giphy\.com$/,_i=`\\.(?:gif|webp|mp4)`,vi=RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${q}/[A-Za-z0-9_-]{1,40}${_i}$`),yi=RegExp(`^/${q}${_i}$`),bi=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function xi(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Si(e){if(e){if(W.has(e.host))return(mi.exec(e.path)??hi.exec(e.path))?.[1];if(gi.test(e.host))return(vi.exec(e.path)??(e.host===`i.giphy.com`?yi.exec(e.path):null))?.[1]}}function Ci(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=hi.exec(t.path)??[];return n===void 0?null:xi(n)}function wi(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||mi.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 Ti={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],parse(e){let t=H(e,bi),n=t?.iframe??e,r=Ci(n);return r?V({...r,options:{}},t?.size??B(n)):null},isOwnScript:()=>!1,isOwnExtra:wi,match(e){let t=Si(e);return t===void 0?null:{...xi(t),options:{}}},ownsFrame:pn},Ei=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),J=`([A-Za-z0-9]{5,7})`,Di=RegExp(`^(a/)?${J}$`),Oi=RegExp(`^/a/${J}/?$`),ki=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${J}/?$`),Ai=RegExp(`^/${J}/?$`),ji=RegExp(`^/${J}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Mi=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,Ni=/* @__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`]),Pi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Fi(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Ii(e){return e===void 0||Ni.has(e.toLowerCase())?void 0:e}function Li(e){if(!e)return;if(e.host===`i.imgur.com`)return Ii(ji.exec(e.path)?.[1]);if(!Ei.has(e.host))return;let t=(Oi.exec(e.path)??ki.exec(e.path))?.[1];return t===void 0?Ii(Ai.exec(e.path)?.[1]):`a/${t}`}function Ri(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:Ri(e.children)}})}function zi(e,t){return e.attrs.get(t)===`false`}const Bi={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>M(e,Pi),parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Di.exec(t)??[];if(r===void 0||n===void 0&&!Ii(r))return null;let i={};return zi(e,`data-context`)&&(i.context=!1),zi(e,`data-analytics`)&&(i.analytics=!1),{...Fi(t),options:i,fallbackHtml:A(Ri(e.children),Pi)}},isOwnScript:e=>Mi.test(e),match(e){let t=Li(e);return t===void 0?null:{...Fi(t),options:{}}}},Vi=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Hi=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Ui=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Wi=/* @__PURE__ */ new Set([`p`,`reel`]),Gi=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Ki=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function qi(e){if(!e||!Vi.has(e.host))return null;let[,t,n,r]=Hi.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Ui.has(t)||!Wi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Ji={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>M(e,Ki),parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?qi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):qi(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:A(e.children,Ki)}},isOwnScript:e=>Gi.test(e),match(e){let t=qi(e);return t&&{...t,options:{}}}},Yi=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),Xi=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Zi=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Qi=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function $i(e,t){if(!e||!t.has(e.host))return null;let[,n]=Xi.exec(e.path)??[];if(n===void 0||Zi.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const ea={platform:`kick`,name:`Kick`,shapes:[`video iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=$i(t,rn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Qi.has(e)).map(([e,t])=>[e,I(t)]));return V({...n,options:r},B(e))},isOwnScript:()=>!1,match(e){let t=$i(e,Yi)??$i(e,rn);return t&&{...t,options:{}}},ownsFrame:mn},ta=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,na=`(activity|share|ugcPost):(\\d{19})`,ra=RegExp(`^(?:/embed)?/feed/update/urn:li:${na}/?$`),ia=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),aa=RegExp(`^/embed/feed/update/urn:li:${na}$`);function oa(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 sa=e=>e.replace(/%3A/gi,`:`),ca={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=aa.exec(t.path)??[];return n===void 0||r===void 0?null:V(oa(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:()=>!1,match(e){if(!ta.test(e.host))return null;let t=sa(e.path),[,n,r]=ra.exec(t)??ia.exec(t)??[];return n===void 0||r===void 0?null:oa(n,r)},ownsFrame:hn},la=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ua=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,da=/^\d{1,25}$/,fa=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,pa=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function ma(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function ha(e){if(!e||!la.test(e.host))return null;let[,t]=ua.exec(e.path)??[];return t===void 0?null:ma(t)}const ga={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],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=ha(F(e.attrs.get(`href`)??``));return t&&{...t,options:z(e,pa,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&da.test(n)?{...ma(n),options:{}}:null},isOwnScript:e=>fa.test(e),match(e){let t=ha(e);return t&&{...t,options:{}}},ownsFrame:gn},_a=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),va=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,ya=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,ba=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,xa=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function Sa(e){if(!e||!_a.has(e.host))return null;let[,t,n,r,i]=va.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 Ca={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],parse(e){if(e.tag!==`blockquote`||!(O(e,`reddit-embed-bq`)||O(e,`reddit-card`)))return null;let t=k(e.children).map(e=>e.tag===`a`?Sa(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return V({...t,options:z(e,xa,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>ya.test(e)||ba.test(e),match(e){let t=Sa(e);return t&&{...t,options:{}}}},wa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ta=`([A-Za-z][A-Za-z0-9._-]{1,29})`,Ea=RegExp(`^(?:/@${Ta})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Da=RegExp(`^/(?:@|add/)${Ta}$`),Oa=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,ka=RegExp(`^/@${Ta}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),Aa=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function ja(e){if(!e||!wa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=Ea.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]=Da.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=Oa.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=ka.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Ma={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=ja({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=ja(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return V({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Aa.test(e),match(e){let t=ja(e);return t&&{...t,options:{}}}},Na=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Pa=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Fa=`[a-z0-9_-]{1,64}`,Ia=`s-[A-Za-z0-9]{1,32}`,La=RegExp(`^/(${Fa})(?:/(sets/${Fa}|${Fa})(?:/(${Ia}))?)?/?$`,`i`),Ra=/* @__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`]),Ba=RegExp(`^${Ia}$`);function Va(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function Ha(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Pa.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Ba.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Va(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Ua(e){if(!Na.has(e.host))return null;let[,t,n,r]=La.exec(e.path)??[];if(t===void 0||Ra.has(t.toLowerCase())||n!==void 0&&za.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Va(`https://soundcloud.com/${i}`,i)}const Wa=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Ga(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Wa.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Na.has(F(e.attrs.get(`href`)??``)?.host??``)}function Ka(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&&Ga(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Ga(r)}const qa={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=Ha(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Ba.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=B(e)??{};return V({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Ka,match(e){let t=Ha(e)??Ua(e);return t&&{...t,options:{}}},ownsFrame:yn},Ja=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Ya=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function Xa(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Za(e,t){return e&&t.has(e.host)?Ja.exec(e.path)?.[1]:void 0}const Qa={platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:nr,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=Za(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=I(i)),V({...Xa(n),options:r},B(e))},isOwnScript:()=>!1,match(e){let t=Za(e,Ya);return t===void 0?null:{...Xa(t),options:{}}},ownsFrame:xn},$a=/* @__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)?/?$`),eo=/* @__PURE__ */ new Set([`utm_source`,`si`]);function to(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=$a.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 no(e){return Object.fromEntries([...e].filter(([e])=>!eo.has(e)).map(([e,t])=>[e,I(t)]))}const ro={platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=to(t);if(!n)return null;let{query:r,...i}=n;return V({...i,options:no(r)},B(e))},isOwnScript:()=>!1,match(e){let t=to(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:bn},io=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),ao=/^\d{1,20}$/,oo=/^\/(activities|routes)\/(\d{1,20})\/?$/,so=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,co=/* @__PURE__ */ new Set([`standard`,`minimal`]),lo=/^[A-Za-z0-9_-]{1,100}$/,uo={activity:`activities`,route:`routes`};function fo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${uo[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function po(e){return e===`activity`||e===`route`}const mo={platform:`strava`,name:`Strava`,shapes:[`post iframe`],parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!po(t)||!ao.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&co.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&&lo.test(a)&&(r.mapHash=a),{...fo(t,n),options:r}},isOwnScript:e=>so.test(e),match(e){if(!io.has(e.host))return null;let[,t,n]=oo.exec(e.path)??[];return t===void 0||n===void 0?null:{...fo(t===`routes`?`route`:`activity`,n),options:{}}}},ho=`([a-z0-9]{4,8})`,go=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),_o=RegExp(`^/[eo]/${ho}$`),vo=RegExp(`^/${ho}/?$`),yo=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),bo=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,xo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),So=/<\/div\s*>$/i;function Co(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function wo(e){return e!==void 0&&!yo.has(e)}function To(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=_o.exec(t.path)??[];if(!wo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>xo.has(e)).map(([e,t])=>[e,I(t)]));return{...Co(n),options:r}}function Eo(e){if(!e||!go.has(e.host))return;let t=(_o.exec(e.path)??vo.exec(e.path))?.[1];return wo(t)?t:void 0}const Do={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],parse(e){let t=H(e,bo),n=t?.iframe??e,r=To(n);return r?V(r,t?.size??B(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=So.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null},match(e){let t=Eo(e);return t===void 0?null:{...Co(t),options:{}}},ownsFrame:Sn},Oo=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),ko=`[A-Za-z][A-Za-z0-9_]{2,31}`,Ao=RegExp(`^(${ko})/(\\d{1,10})$`),jo=RegExp(`^/(?:s/)?(${ko})/(\\d{1,10})/?$`),Mo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,No=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Po=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function Fo(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Io={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],parse:()=>null,parseScript(e){if(!Mo.test(e.attrs.get(`src`)??``)||No.some(t=>e.attrs.has(t)))return null;let[,t,n]=Ao.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=z(e,Po,I);return e.attrs.has(`data-single`)&&(r.single=!0),Fo(t,n,r)},isOwnScript:e=>Mo.test(e),match(e){if(!Oo.has(e.host))return null;let[,t,n]=jo.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)),Fo(t,n,r)}},Lo=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),Ro=`(\\d{1,20})`,zo=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${Ro}/?$`),Bo=RegExp(`^/embed/${Ro}$`),Vo=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,Ho=/^\d{1,3}(?:\.\d{1,20})?$/,Uo=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function Wo(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Go(e){return e&&Lo.has(e.host)?zo.exec(e.path)?.[1]:void 0}function Ko(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=qo(t,1e4);return{width:t/n,height:1e4/n}}function qo(e,t){return t===0?e:qo(t,e%t)}function Jo(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${Ro}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!Ho.test(n))return null;let r=Ko(n===void 0?1.33:Number(n));return r?V({...Wo(t),options:{},fallbackHtml:A(e.children,Uo)},r):null}function Yo(e){let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=Bo.exec(t.path)??[];return n===void 0?null:V({...Wo(n),options:{}},B(e))}const Xo={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>M(e,Uo),parse(e){return e.tag===`div`?Jo(e):e.tag===`iframe`?Yo(e):null},isOwnScript:e=>Vo.test(e),match(e){let t=Go(e);return t===void 0?null:{...Wo(t),options:{}}},ownsFrame:Cn},Zo=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Qo=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,$o=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,es=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],ts=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function ns(e){if(!e||!Zo.has(e.host))return null;let[,t]=Qo.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const rs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>M(e,ts),parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=ns(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:z(e,es,I),fallbackHtml:A(e.children,ts)}},isOwnScript:e=>$o.test(e),match(e){let t=ns(e);return t&&{...t,options:{}}}},is=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,as=/^\/player\/v1\/(\d{1,25})\/?$/,os=/^\d{1,25}$/,ss=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;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 ls={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&U.has(t.host)?is.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:cs(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!U.has(t.host))return null;let[,n]=as.exec(t.path)??[];return n===void 0?null:V(cs(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:e=>ss.test(e),match(e){if(!U.has(e.host))return null;let[,t,n]=is.exec(e.path)??[];return t===void 0||n===void 0?null:cs(n,t)},ownsFrame:ln},us=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),ds=`(@[A-Za-z0-9_.-]{1,64})`,fs=`(\\d{1,25})`,ps=RegExp(`^/${ds}/(?:posts/)?${fs}/?$`),ms=RegExp(`^/${ds}/${fs}/embed$`),hs=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function gs(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function _s(e){if(!e||!us.has(e.host))return null;let[,t,n]=ps.exec(e.path)??[];return t===void 0||n===void 0?null:gs(t,n)}const vs={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=ms.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return V({...gs(n,r),options:i},B(e))},isOwnScript:e=>hs.test(e),match(e){let t=_s(e);return t&&{...t,options:{}}},ownsFrame:wn},ys=`([a-z0-9-]{1,32})`,Y=`(\\d{1,20})`,bs=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),xs=RegExp(`^/${ys}/${Y}(?:/[^/]{1,200})?/?$`),Ss=RegExp(`^${ys}\\.tumblr\\.com$`),Cs=RegExp(`^/post/${Y}(?:/[^/]{1,200})?/?$`),ws=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${ys})/${Y}/v2$`),Ts=RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${Y}$`),Es=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),Ds=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function Os(e){if(!e)return null;let t,n;return bs.has(e.host)?[,t,n]=xs.exec(e.path)??[]:([,t]=Ss.exec(e.host)??[],[,n]=Cs.exec(e.path)??[]),t===void 0||n===void 0||Es.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`],parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ws.exec(t.path)??[],i=r??Ts.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=Os(F(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>Ds.test(e),match(e){let t=Os(e);return t&&{...t,options:{}}}},As=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),js=/^[A-Za-z0-9_]{3,25}$/,Ms=/^v?(\d{1,12})$/,Ns=/^[A-Za-z0-9_-]{6,30}$/,Ps=/^[A-Za-z0-9_-]{6,100}$/,Fs=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Is=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),Ls=[`autoplay`,`muted`,`time`];function X(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Rs=e=>X(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),zs=e=>X(`https://www.twitch.tv/videos/${e}`,e),Bs=e=>X(`https://www.twitch.tv/collections/${e}`,e),Vs=e=>X(`https://clips.twitch.tv/${e}`,e);function Hs(e){let t={};for(let n of Ls){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function Us(e){let t=e.query.get(`channel`);if(t!==void 0)return js.test(t)?Rs(t):null;let[,n]=Ms.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return zs(n);let r=e.query.get(`collection`);return r!==void 0&&Ns.test(r)?Bs(r):null}function Ws(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return Ps.test(t)?{found:Vs(t),options:{}}:null}if(!As.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=Ms.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:zs(t),options:n!==void 0&&Fs.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?Ns.test(r??``)?{found:Bs(r??``),options:{}}:null:t.length===3&&r===`clip`?js.test(n)&&Ps.test(i??``)?{found:Vs(i??``),options:{}}:null:t.length===1&&js.test(n)&&!Is.has(n.toLowerCase())?{found:Rs(n),options:{}}:null}const Gs={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=Us(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=Ps.test(e)?Vs(e):null}return n&&V({...n,options:Hs(t.query)},B(e))},isOwnScript:()=>!1,match(e){let t=Ws(e);return t&&{...t.found,options:t.options}},ownsFrame:un},Ks=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Z=`(\\d{1,12})`,qs=`([0-9a-f]{6,20})`,Js=[RegExp(`^/${Z}(?:/${qs})?/?$`),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}/?$`)],Ys=RegExp(`^/video/${Z}/?$`),Xs=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Zs=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Qs=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),$s=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function ec(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function tc(e){let[,t]=$s.exec(e.fragment??``)??[];return t?{t}:{}}function nc(e){if(!e||!Ks.has(e.host))return null;for(let t of Js){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return ec(n,r)}return null}function rc(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=F(e.attrs.get(`href`)??``);return n!==null&&Ks.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function ic(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&&rc(n,e=>nc(e)?.id===t.id)&&ic(r,`from`)&&rc(i,()=>!0)&&ic(a,`on`)&&rc(o,e=>e.path===``||e.path===`/`)&&ic(s,`.`)}function oc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=Ys.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${qs}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Qs.has(e)).map(([e,t])=>[e,I(t)]));return{...ec(t,n),options:{...r,...tc(e)}}}const sc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],parse(e){let t=H(e,Xs),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=oc(F(n.attrs.get(`src`)??``));return r&&V(r,t?.size??B(n))},isOwnScript:e=>Zs.test(e),isOwnExtra:ac,match(e){let t=oc(e);if(t)return t;let n=nc(e);return n&&{...n,options:tc(e)}},ownsFrame:dn},cc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),lc=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,uc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,dc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,fc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],pc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function mc(e,t=lc){if(!e||!cc.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 hc(e,t){let[n]=D(`<blockquote class="twitter-tweet">${e}</blockquote>`)??[];return n?.type===`element`&&gc.parse(n)?.id===t}const gc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>M(e,pc)&&hc(e,t.id),parse(e){if(e.tag!==`blockquote`||!(O(e,`twitter-tweet`)||O(e,`twitter-video`)))return null;let t=k(e.children).reverse().map(e=>e.tag===`a`?mc(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:z(e,fc,I),fallbackHtml:A(e.children,pc)}:null},isOwnScript:e=>dc.test(e),match(e){let t=mc(e,uc);return t&&{...t,options:{}}}},_c=`https://www.youtube.com`,vc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,yc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,bc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,xc=/^\/([A-Za-z0-9_-]{11})\/?$/,Sc=/^[A-Za-z0-9_-]{10,64}$/,Cc=/^UC[A-Za-z0-9_-]{22}$/,wc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,Tc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,Ec=/^t=(.+)$/;function Dc(e){if(e===void 0||e===``)return;let t=Tc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function Oc(e){return Dc(e.get(`start`))??Dc(e.get(`t`))}function kc(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function Ac(e,t=!1){return kc(e,t?`${_c}/shorts/${e}`:`${_c}/watch?v=${e}`)}function jc(e){return e!==void 0&&Sc.test(e)?kc(e,`${_c}/playlist?list=${e}`):null}function Mc(e){return e!==void 0&&Cc.test(e)?kc(e,`${_c}/channel/${e}/live`):null}function Nc(e){let[,t,n]=yc.exec(e.path)??[];if(n!==void 0)return{found:Ac(n)};if(t===`videoseries`){let t=jc(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=Mc(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function Pc(e,t){let n=Oc(e.query)??Dc(Ec.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const Fc=[gc,Ji,Jr,rs,ls,{platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&en.has(t.host);if(!t||!(n||$t.has(t.host)))return null;let r=Nc(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=Oc(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),V({...r.found,options:a},B(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=xc.exec(e.path)??[];return t===void 0?null:{...Ac(t),options:Pc(e,!1)}}let t=en.has(e.host);if(!t&&!$t.has(e.host))return null;let n=Pc(e,t);if(R(e.path,`/embed`)){let t=Nc(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&&vc.test(t)?{...Ac(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=jc(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=wc.exec(e.path)??[],i=Mc(r);if(i)return{...i,options:n};let[,a,o]=bc.exec(e.path)??[];return a===void 0||o===void 0?null:{...Ac(o,a===`shorts`),options:n}},ownsFrame:sn},Io,Ma,ca,Ca,ga,ro,sc,Gs,Ar,qa,sr,dr,ea,Ti,Xo,Do,Qa,vs,Bi,mo,pi,Cr,ks];function Ic(e){return Fc.find(t=>t.platform===e)}function Lc(e){return Rc(Fc,e)}function Rc(e,t){let n=Bc(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function zc(e,t){let n=Bc(t);return n&&e.match(n)}function Bc(e){return typeof e==`string`?F(e):null}function Vc(e,t){if(t.platform!==e.platform)return null;let n=zc(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 Hc={bluesky:`Bluesky`,rumble:`Rumble`};function Uc(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function Wc(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:zc(n,e));if(!a&&e!==void 0&&Kc(n,e))return{error:Uc(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=Vc(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function Gc(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=tr(e.url);return t?Uc(Hc[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function Kc(e,t){let n=typeof t==`string`?F(t):null;return n!==null&&e.needsLookup?.(n)===!0}function qc(e){return Jc(Fc,e)}function Jc(e,t){if(typeof t!=`string`)return null;let n=D(t);return n?Xc(e,n):Yc(e,t)}function Yc(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:D(r),a=i&&Xc(e,i);if(a?.platform===n.platform)return a}return null}function Xc(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(Zc(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 Zc(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Qc(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function $c(e){return e===null?void 0:Qc(e.trim().replace(/px$/i,``))}function el(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function tl(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function nl(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:Qc(i)??(i?.trim()?i:void 0),maxWidth:$c(e.getAttribute(`max-width`)),height:$c(e.getAttribute(`height`)),maxHeight:$c(e.getAttribute(`max-height`))},eager:tl(e)}}const rl=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function il(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`&&rl.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function al(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),Q(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function ol(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 sl(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function cl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{il(c,Ke(t,e,l))};u(n);let d=sl(document.createElement(`div`)),f=sl(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?al():ll(t.fallbackHtml,t.fallbackImage===!0)];f.append(...p),d.append(f),c.append(d),e.append(c);let m,h=!1,g,_=[],v=()=>{f.remove(),h||(h=!0,a())},y=s?`did not report its height`:`did not load`,ee=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${y}`)))},15e3)},b=e=>{let n=document.createElement(`iframe`);n.src=t.clientSrc?t.clientSrc(e):e,n.title=t.title,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),Q(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{s||v()}),m?m.replaceWith(n):d.prepend(n),m=n},x=!1,S=()=>{if(x)return;x=!0,s&&_.push(s.listen(()=>m,e=>{l=e,Q(c,{height:l}),v()}));let{sizeInSrc:e}=t;e?_.push(e.watch(d,t=>{b(e.src(t))})):b(t.src)};return r&&S(),_.push(ol(d,!1,()=>{S(),ee()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),c.remove()},update(e,t){u(e),t&&S()}}}function ll(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 dl(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 fl(e){return`View this post on ${e}`}function pl(e){return e instanceof Error?e:Error(String(e))}function ml(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{il(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=dl(f),m=t.hasFallback?[]:o.length>0?o:[al(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=e=>{for(let e of m)e.parentNode?.removeChild(e);m=e,d.append(...e)},g=!1,_=!1,v,y=()=>{},ee=()=>{g||_||(_=!0,clearTimeout(v),y(),h([]),s())},b=e=>{if(t.hasFallback||p===void 0)h([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,p),e.textContent=fl(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof he?b(t):v=setTimeout(()=>{S(e+1)},1e3*2**(e-1)))},S=e=>{if(!(g||_)){try{y=r.render(f,ee)}catch(t){x(e,pl(t));return}v=setTimeout(()=>{x(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},C=!1,w=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(pl(e))}))},te=ol(f,a,w);return{wrapper:l,cleanup:()=>{g=!0,te(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&w()}}}const hl=typeof HTMLElement>`u`?class{}:HTMLElement,$=`embed`;function gl(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 _l(e){let t=``;for(let n of e.children)n.slot!==$&&(t+=n.outerHTML);return t&&(qc(t)??Ln(t))?t:void 0}function vl(e){let t=`html`in e?qc(e.html):Lc(e.url);if(!t){let t=`html`in e?Ln(e.html):null;return t?Jn(t):{kind:`error`,message:Gc(e)}}let n=Ic(t.platform);if(!n)return{kind:`error`,message:Gc(e)};let r=Wc(void 0,t,n);return r.error===void 0?Yt(r.embed):{kind:`error`,message:r.error}}const yl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var bl=class extends hl{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i;#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${$}"></slot>`;for(let e of yl){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get eager(){return tl(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=nl(this,this.#e);this.#i=n.source?void 0:t&&this.#i||_l(this),n.source??=this.#i===void 0?null:{html:this.#i};let r=JSON.stringify(n.source);r===this.#r&&t?this.#n?.update(n.layout,n.eager):(this.#u(),this.#r=r,this.#d(n))}#u(){this.#a+=1;let e=this.#n;this.#n=void 0,e?.cleanup()}#d(e){let{source:t,layout:n,eager:r}=e;if(!t)return;let i=this.#a,a=e=>{queueMicrotask(()=>{i===this.#a&&this.isConnected&&this.dispatchEvent(e)})},o=e=>{a(new ErrorEvent(`error`,{error:e,message:e.message}))},s=vl(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?gl(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?cl(this,s,c):ml(this,s,c),this.#n.wrapper.slot=$}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,bl);export{bl as SocialEmbedElement};
|
|
@@ -6,10 +6,8 @@ const FACEBOOK_SDK_VERSION = "v26.0";
|
|
|
6
6
|
const LOCALE = /^[a-z]{2,3}_[A-Z]{2}$/;
|
|
7
7
|
/** Instagram and Threads share `instgrm.Embeds`; each registers its name when loaded. */
|
|
8
8
|
function embedSdkRegistered(name) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return embeds?.registeredEmbedSDKs?.[name] === true && typeof embeds.process === "function";
|
|
12
|
-
};
|
|
9
|
+
const embeds = globals().instgrm?.Embeds;
|
|
10
|
+
return embeds?.registeredEmbedSDKs?.[name] === true && typeof embeds.process === "function";
|
|
13
11
|
}
|
|
14
12
|
const x = {
|
|
15
13
|
key: "x",
|
|
@@ -33,27 +31,24 @@ function besideFacebookSdk() {
|
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
33
|
function skippedBesideFacebookSdk(name) {
|
|
36
|
-
const
|
|
37
|
-
return ()
|
|
38
|
-
const fb = globals().FB;
|
|
39
|
-
return !registered() && fb !== void 0 && !fb.__buffer;
|
|
40
|
-
};
|
|
34
|
+
const fb = globals().FB;
|
|
35
|
+
return !embedSdkRegistered(name) && fb !== void 0 && !fb.__buffer;
|
|
41
36
|
}
|
|
42
37
|
const instagram = {
|
|
43
38
|
key: "instagram",
|
|
44
39
|
url: "https://www.instagram.com/embed.js",
|
|
45
40
|
isOwn: (src) => /^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(src),
|
|
46
|
-
isPresent: embedSdkRegistered("instagram"),
|
|
41
|
+
isPresent: () => embedSdkRegistered("instagram"),
|
|
47
42
|
prepare: besideFacebookSdk,
|
|
48
|
-
skipped: skippedBesideFacebookSdk("instagram")
|
|
43
|
+
skipped: () => skippedBesideFacebookSdk("instagram")
|
|
49
44
|
};
|
|
50
45
|
const threads = {
|
|
51
46
|
key: "threads",
|
|
52
47
|
url: "https://www.threads.com/embed.js",
|
|
53
48
|
isOwn: (src) => /^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(src),
|
|
54
|
-
isPresent: embedSdkRegistered("threads"),
|
|
49
|
+
isPresent: () => embedSdkRegistered("threads"),
|
|
55
50
|
prepare: besideFacebookSdk,
|
|
56
|
-
skipped: skippedBesideFacebookSdk("threads")
|
|
51
|
+
skipped: () => skippedBesideFacebookSdk("threads")
|
|
57
52
|
};
|
|
58
53
|
function facebook(locale) {
|
|
59
54
|
return {
|
|
@@ -77,13 +72,19 @@ const pinterest = {
|
|
|
77
72
|
isOwn: (src) => /^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(src),
|
|
78
73
|
isPresent: () => typeof globals().PinUtils?.build === "function"
|
|
79
74
|
};
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
function loadX() {
|
|
76
|
+
return loadScript(x);
|
|
77
|
+
}
|
|
78
|
+
function loadInstagram() {
|
|
79
|
+
return loadScript(instagram);
|
|
80
|
+
}
|
|
81
|
+
function loadThreads() {
|
|
82
|
+
return loadScript(threads);
|
|
83
|
+
}
|
|
84
|
+
function loadPinterest() {
|
|
85
|
+
return loadScript(pinterest);
|
|
86
|
+
}
|
|
87
|
+
function loadFacebook(locale) {
|
|
88
|
+
return LOCALE.test(locale) ? loadScript(facebook(locale)) : Promise.reject(/* @__PURE__ */ new Error(`social-embeds: invalid Facebook locale "${locale}"`));
|
|
88
89
|
}
|
|
89
|
-
export { FACEBOOK_SDK_VERSION,
|
|
90
|
+
export { FACEBOOK_SDK_VERSION, loadFacebook, loadInstagram, loadPinterest, loadThreads, loadX };
|
package/dist/parser/html.d.ts
CHANGED
|
@@ -11,9 +11,4 @@ export type HtmlText = {
|
|
|
11
11
|
export type HtmlComment = {
|
|
12
12
|
type: 'comment';
|
|
13
13
|
};
|
|
14
|
-
export type HtmlNode = HtmlElement | HtmlText | HtmlComment;
|
|
15
|
-
export type AttributeRule = string | {
|
|
16
|
-
name: string;
|
|
17
|
-
value: RegExp;
|
|
18
|
-
};
|
|
19
|
-
export type Whitelist = ReadonlyMap<string, readonly AttributeRule[]>;
|
|
14
|
+
export type HtmlNode = HtmlElement | HtmlText | HtmlComment;
|
package/dist/parser/html.js
CHANGED
|
@@ -169,4 +169,9 @@ function rebuild(nodes, whitelist) {
|
|
|
169
169
|
function escapeAttribute(value) {
|
|
170
170
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
/** True when `html` parses and rebuilds through the whitelist unchanged. */
|
|
173
|
+
function rebuildsAs(html, whitelist) {
|
|
174
|
+
const nodes = parseHtml(html);
|
|
175
|
+
return nodes !== null && rebuild(nodes, whitelist) === html;
|
|
176
|
+
}
|
|
177
|
+
export { decodeEntities, descendants, escapeAttribute, hasClass, parseHtml, rebuild, rebuildsAs };
|
package/dist/parser/lookup.js
CHANGED
|
@@ -12,9 +12,15 @@ const RUMBLE_PAGE = /^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;
|
|
|
12
12
|
function needsLookup(url) {
|
|
13
13
|
const parsed = typeof url === "string" ? parseUrl(url) : null;
|
|
14
14
|
if (!parsed) return null;
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
const [, profile] = HANDLE_POST.exec(parsed.path) ?? [];
|
|
18
|
-
return profile !== void 0 && HANDLE.test(profile) ? "bluesky" : null;
|
|
15
|
+
if (rumbleNeedsLookup(parsed)) return "rumble";
|
|
16
|
+
return blueskyNeedsLookup(parsed) ? "bluesky" : null;
|
|
19
17
|
}
|
|
20
|
-
|
|
18
|
+
function rumbleNeedsLookup(url) {
|
|
19
|
+
return RUMBLE_HOSTS.has(url.host) && RUMBLE_PAGE.test(url.path);
|
|
20
|
+
}
|
|
21
|
+
function blueskyNeedsLookup(url) {
|
|
22
|
+
if (!BLUESKY_HOSTS.has(url.host)) return false;
|
|
23
|
+
const [, profile] = HANDLE_POST.exec(url.path) ?? [];
|
|
24
|
+
return profile !== void 0 && HANDLE.test(profile);
|
|
25
|
+
}
|
|
26
|
+
export { blueskyNeedsLookup, needsLookup, rumbleNeedsLookup };
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { HtmlElement
|
|
1
|
+
import { HtmlElement } from "./html.js";
|
|
2
2
|
import { ParsedEmbed, Platform } from "./types.js";
|
|
3
3
|
import { ParsedUrl } from "./url.js";
|
|
4
4
|
export type Options = ParsedEmbed['options'];
|
|
5
5
|
export type PlatformParser = {
|
|
6
6
|
platform: Platform;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/** For messages: `YouTube`, `Apple Music`. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** The `kind variant` pairs this platform's embeds may have, such as `post sdk`. */
|
|
10
|
+
shapes: readonly string[];
|
|
11
|
+
/** True when `fallbackHtml` is exactly what this parser writes for the embed (docs/decisions.md D35). */
|
|
12
|
+
trustsFallback?: (html: string, embed: ParsedEmbed) => boolean;
|
|
13
|
+
/** A post URL that only a network lookup could turn into an embed (docs/decisions.md D70). */
|
|
14
|
+
needsLookup?: (url: ParsedUrl) => boolean;
|
|
9
15
|
/** The embed element (blockquote, div or iframe) of the platform's own embed code. */
|
|
10
16
|
parse: (root: HtmlElement) => ParsedEmbed | null;
|
|
11
17
|
/** Embed code that is a single `<script>` tag, as Telegram's is. */
|
|
@@ -20,6 +20,8 @@ function appleContent(url, host) {
|
|
|
20
20
|
}
|
|
21
21
|
const applemusic = {
|
|
22
22
|
platform: "applemusic",
|
|
23
|
+
name: "Apple Music",
|
|
24
|
+
shapes: ["post iframe"],
|
|
23
25
|
parse(root) {
|
|
24
26
|
if (root.tag !== "iframe") return null;
|
|
25
27
|
const found = appleContent(parseUrl(root.attrs.get("src") ?? ""), APPLE_MUSIC_FRAME_HOST);
|