(function(){try{var g=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};g["__faroBundleId_Speechify Chrome Extension"]="13.4.1"}catch(l){}})();
import{a as $}from"./chunk-UJD7WEL5.js";import{$a as At,Ad as Me,Cd as qt,H as Rt,Jb as k,Jf as ie,K as Bt,Lb as F,Pd as Re,Ud as Ot,Wd as U,Ya as Lt,Za as H,_a as A,ac as Ft,b as xe,bb as oe,bc as kt,f as I,g as we,gc as ne,gd as L,hc as W,hd as Ht,i as E,ic as re,j as x,jc as N,k as vt,l as Ee,m as xt,n as b,o as v,r as _,rd as w,w as wt,x as X,yg as Dt,zd as se}from"./chunk-XMRXO6YU.js";import{g as Mt,o as It}from"./chunk-ODCFEFOB.js";import{a as Pt,e as bt,f as h,i as ve,l as te}from"./chunk-24ZZP5UQ.js";import{g as z}from"./chunk-GQY3J744.js";import{H as Ne,M as Se}from"./chunk-NWEJW7RD.js";import"./chunk-ASZMUWWE.js";import"./chunk-4XRFE7WB.js";import{y as be}from"./chunk-6I7EUWRH.js";import{d as R,g as c,i as d,j as p,k as Pe,m as Rn,n as u}from"./chunk-CLPINNGF.js";u();c();Rn();u();c();var Nt=R(z());function We({children:e,root:t}){let o=(0,Nt.useMemo)(()=>Pt({key:"post-player-emotion-cache",container:t}),[t]);return d(bt,{value:o},e)}u();c();var le=R(z());function Ge({notificationAnchor:e,queueableContent:t}){let{usePlayingState:o,useCurrentContent:n}=W,[r,s]=(0,le.useState)(null),i=(0,le.useRef)(null),{play:l,pause:a}=ne,m=o(),g=n(),f=!!g&&g?.id===r?.id,C=!!f&&m==="playing",T=!!f&&m==="buffering",S=!!f&&m==="errored",P=(0,le.useCallback)(async B=>{if(B.stopPropagation(),It()||Se("browser-action",{animate:!1},"pill-player"),T)return;if(C)return a();if(f)return l();let G=re(t,!0);s(G)},[T,C,f,l,a,t]);return d("div",null,d(Ot,{isLoading:T,isLoadingFailed:S,isPlaying:C,onClick:P,ref:i,...e?{[I]:!0}:{}}))}u();c();u();c();u();c();u();c();var ae=R(z());var An="[data-speechifyplaybackhighlighter-highlight]",Fn="div[data-speechify-shadow-container]";function j({queueableContent:e,wrapper:t,remoteConfig:o,isActiveElement:n}){let[r,s]=(0,ae.useState)(null),{play:i,pause:l}=ne,{usePlayingState:a,useCurrentContent:m}=W,g=a(),f=m(),{activeElement:C}=oe(),T=C instanceof Element?C:null;(0,ae.useEffect)(()=>{s(e)},[t]);let S=T?.nodeType===Node.TEXT_NODE?T?.parentElement:T,P=g==="playing",B=S?.isConnected||!1,G=P&&o&&e.options?.autoplay!==void 0?S?.closest(o.selectors.postSelector)?.querySelector(Fn)?.isSameNode(t):!1,K=o&&g==="playing"&&!B&&t.closest(o.selectors.postSelector)?.querySelector(An),ee=!!(f&&f?.id===r?.id||G||n||K),Oe=ee&&g==="playing",De=ee&&g==="buffering",wn=ee&&g==="errored";return{playInbox:(0,ae.useCallback)(()=>{if(qt(),(window.getSelection()??"").toString().length>0)return i();if(De)return;if(Oe)return l();if(ee&&f)return i();let Mn=re(e,!0);s(Mn)},[e,t,De,Oe,ee,i,l]),isActive:ee,isPlaying:Oe,isLoading:De,isLoadingFailed:wn}}u();c();var Y=ve(xe)`
  align-items: center;
  cursor: pointer;
  flex-direction: row;
  gap: 5px;
  justify-content: center;
  margin-right: 12px;
  overflow: visible;
  position: relative;

  &:hover {
    background-color: ${({styleThemes:e})=>e.hoverBackgroundColor};

    > button {
      ${({styleThemes:e})=>e.hoverButtonColor?`border: 1.8px solid ${e.hoverButtonColor}`:""};
      color: ${({styleThemes:e})=>e.hoverButtonColor};
    }
  }

  > button {
    background: none;
    border: 1.8px solid ${({styleThemes:e})=>e.buttonColor};
    color: ${({styleThemes:e})=>e.buttonColor};
  }

  &:active {
    background-color: ${({styleThemes:e})=>e.activeBackgroundColor};
  }

  ${({customStyles:e})=>e&&h(e)};
`,kn=h`
  flex-direction: column;
  gap: 0px;
  margin-right: 0px;
  margin-top: 6px;
`;function M({backgroundElement:e=document.body,isActiveElement:t,isDarkMode:o,notificationAnchor:n,onClick:r,overrideStyles:s={},queueableContent:i,remoteConfig:l,styleSets:a,wrapper:m}){let g=a?.lightTheme||{buttonColor:te["sf-prim-w-b"],iconBackground:"white",hoverBackgroundColor:"none",activeBackgroundColor:"none"},f=a?.darkTheme||{buttonColor:te["brdr-tert-40-50"],iconBackground:"#212121",hoverBackgroundColor:"none",activeBackgroundColor:"none"},{playInbox:C,isPlaying:T,isLoading:S,isLoadingFailed:P}=j({queueableContent:i,remoteConfig:l,wrapper:m,isActiveElement:t}),{isDarkBackground:B}=se(e||document.body),G=l?m.getAttribute(l.selectors.toolBarAttribute)===l.selectors.toolBar:void 0;return d(Y,{styleThemes:o||B?f:g,customStyles:s,...n&&!G?{[I]:!0}:{}},d(U,{isLoading:S,isLoadingFailed:P,isPlaying:T,onClick:K=>{K.stopPropagation(),C(),Dt("individual-post-button-hint"),r&&r()}}))}var In={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},Hn=h`
  top: 4px;
  position: absolute;
  left: -48px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  border-radius: 0.5rem;

  button {
    border-width: 1px !important;
  }
`,Wt=e=>d(M,{overrideStyles:Hn,styleSets:In,...e});u();c();var Gt=R(Mt()),_t=R(_());var _e=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Ut=function({selectors:e}){return new Promise(t=>{let o=!!document.querySelector(e.profileButton),n=o?e.main:e.mainWrapper,r=[],s=(0,Gt.default)(()=>{let a=r.some(C=>Array.from(C.addedNodes).find(S=>S instanceof HTMLElement&&S.getAttribute(e.nodeAttributeSelector)?.startsWith(e.stringToMatchAttribute))!==void 0),m=!o&&r.some(({target:C})=>C===l),g=r.some(C=>C.target.parentElement===document.querySelector(e.main)),f=r.some(C=>C.type==="childList"&&!C.target.isConnected);r.length=0,(a||g||f||m)&&(i.disconnect(),t(E(void 0))),m&&ie()},16),i=new MutationObserver(a=>{r.push(...a),s()}),l=document.querySelector(n);if(!l)return x("Element not found");i.observe(l,{childList:!0,subtree:!0})})};function qn(e,t){let o=e.getBoundingClientRect(),n=t.getBoundingClientRect(),r=o.x<=n.x&&o.x+o.width>=n.x,s=o.y<=n.y&&o.y+o.height>=n.bottom;return r&&s}var Ue=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector),r=e.querySelectorAll(t.selectors.postContentSelector).length>1?o?.parentElement:o;return r?L({startingNode:r,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}).filter(i=>i.nodeType===Node.TEXT_NODE||qn(r,r)):[]},he=e=>{let t=document.querySelector(e.selectors.scrollElementSelector);if(t instanceof HTMLElement)return t;let o=document.querySelector(e.selectors.main),n=(r,s,i,l)=>{if(l===0)return null;if(getComputedStyle(r)[s]===i)return r;for(let a of Array.from(r.children)){let m=n(a,s,i,l-1);if(m)return m}return null};return o instanceof HTMLElement?n(o,"overflowY","auto",5):null},On=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null};var $e=e=>_t.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),Qe=(e,t)=>{let o=_e(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},Dn=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,ce=(e,t)=>Qe(e,t)?Dn(t)?!0:!On(e,t):!1,$t=(e,t)=>{let o=e.getAttribute(t.selectors.nodeAttributeSelector);if(!o)return;let n=o.split(t.selectors.stringToMatchAttributeWithHyphen).pop();return Number(n)};var Nn=7500,Wn={key:"chatgpt",configuration:{options:{styles:()=>({position:"absolute",width:"100%",top:"-3px"}),autoplayNewest:async(e,t)=>{let o=Qe(e,t),n=($t(e,t)??0)%2===0;if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!ce(e,t);)if(await k(300),performance.now()-r>Nn){s();break}s()})}return o&&n&&ce(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"},prependElement:!0},component:Wt,getElementToEmbed:(e,t)=>{let o=e.querySelector(t.selectors.playerContainerWithUserSelector)||e.querySelector(t.selectors.playerContainerWithoutUserSelector)||e;return o?.querySelector(t.selectors.isMessageFromUser)?null:o},elementUpdateProvider:async function*(e){await A(e.selectors.promptArea);do yield _e(e);while(await Ut(e))},queueableContentFn:async(e,t)=>{let o=he(t)||void 0;return{contentGenerator:async function*(n){let{waitForMutation:r}=$(e,{childList:!0,subtree:!0},n);if(ce(e,t)&&await F(async()=>{let s=$e(Ue(e,t).map(a=>a.textContent).join(`
`)),i=[".","!","?",":",";"];return s.filter(a=>{let m=a.slice(-1);return i.includes(m)}).length<1&&ce(e,t)},250,2e3),!n.aborted)do{if(n.aborted)break;let s=Ue(e,t);for(let i=0;i<s.length;i++){let a=$e(s[i].textContent??"").map(g=>({elem:s[i],sentence:g})),m=ce(e,t)&&i===s.length-1?1:s.length-i-1;yield{content:a,chunksBefore:0,chunksAfter:m,index:i}}await r()}while(!n.aborted)},converter:n=>{if("sentence"in n&&"elem"in n){let r=n.elem instanceof HTMLElement?Math.max(0,n.elem.textContent?.indexOf(n.sentence)??0):0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:r,scrollElement:o}}}}return{text:w(n),ref:{ref:e,highlightInfo:{startOffset:0,scrollElement:he(t)||void 0}}}},options:{autoplay:!0},metadata:{source:"Chatgpt"}}}}},Qt=Wn;u();c();u();c();var jt=R(X()),Yt=R(_());var je=(e,t)=>{let o;if(e.isConnected)o=e;else{let a=function(m,g){let f=m.toLowerCase().split(/\s+/),C=g.toLowerCase().split(/\s+/),T=new Set(f),S=new Set(C),P=new Set([...T].filter(K=>S.has(K))),B=new Set([...T,...S]).size;return P.size/B>=.7};var s=a;let i=e.textContent?.trim();if(!i)return[];o=Array.from(document.querySelectorAll(t.selectors.postSelector)).find(m=>{let g=m.textContent?.trim();return g&&a(g,i)})||null}if(!o)return[];let n=o.querySelector(t.selectors.postContentSelector);return n?L({startingNode:n,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},Ye=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Ke=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)},ze=e=>Yt.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),Xe=(e,t)=>{let o=Ye(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},Kt=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,Gn=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,ue=(e,t)=>Gn(t)&&Xe(e,t),zt=function(e,t){return new Promise(o=>{let n=[],r=(0,jt.default)(()=>{let l=n.some(m=>Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};u();c();var _n={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},Un=h`
  flex-direction: column;
  gap: 0px;
  top: 16px;
  margin-left: -42px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;

  button {
    opacity: 1;
  }
`,Xt=e=>d(M,{overrideStyles:Un,styleSets:_n,...e});var $n=5e3,Qn={key:"claude",configuration:{options:{autoplayNewest:async(e,t)=>{let o=Xe(e,t),n=Kt(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!ue(e,t);)if(await k(300),performance.now()-r>$n){s(!1);break}s(!0)})}return o&&n&&ue(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Xt,elementUpdateProvider:async function*(e){await A(e.selectors.main);do yield Ye(e);while(await zt(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>{let o=Ke(t)||void 0;return{contentGenerator:async function*(n){let{waitForMutation:r}=$(e,{childList:!0,subtree:!0},n);if(ue(e,t)&&await F(async()=>{let s=ze(je(e,t).map(a=>a.textContent).join(`
`)),i=[".","!","?",":",";"];return s.filter(a=>{let m=a.slice(-1);return i.includes(m)}).length<1&&ue(e,t)},500),!n.aborted)do{if(n.aborted)break;let s=je(e,t);for(let i=0;i<s.length;i++)yield{content:ze(s[i].textContent??"").map(m=>({elem:s[i],sentence:m})),chunksBefore:0,chunksAfter:ue(e,t)&&i===s.length-1?1:s.length-i-1,index:i};await r()}while(!n.aborted)},converter:n=>{if("sentence"in n&&"elem"in n){let r=n.elem instanceof HTMLElement?Math.max(0,n.elem.textContent?.indexOf(n.sentence)??0):0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:r,scrollElement:o}}}}return{text:w(n),ref:{ref:e,highlightInfo:{startOffset:0,scrollElement:Ke(t)||void 0}}}},options:{autoplay:!0},metadata:{source:"Claude"}}}}},Vt=Qn;u();c();u();c();var Jt=R(X()),Zt=R(_());var Ve=(e,t)=>{let o=Array.from(e.querySelectorAll(t.selectors.postContentSelector));return o.length?o.flatMap(r=>r.closest(t.selectors.reasoningSelector)?[]:L({startingNode:r,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0})):[]},V=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector)).filter(o=>o.querySelector(e.selectors.postContentSelector)!==null)}),eo=function(e){let t=document.querySelector(e.selectors.generationSelector||".dd7e4fda");if(!t)return 1;let o=t.textContent?.split("/")[0]?.match(/\d+/);return o?parseInt(o[0],10):1},Je=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)},Ze=e=>Zt.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),Be=(e,t)=>{let o=V(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1};var jn=e=>{let t=V(e);if(b(t))return!1;let o=t.value.pop();return o?o.querySelectorAll(".ds-icon").length===0:!1},Yn=e=>{let t=V(e);if(b(t))return!1;let o=t.value.pop();if(!o)return!1;let n=o.querySelector(e.selectors.reasoningSelector),r=o.querySelector(e.selectors.reasoningLoadingIconSelector);return n!==null&&r!==null},Te=(e,t)=>Yn(t)&&Be(e,t),me=(e,t)=>jn(t)&&Be(e,t),to=function(e,t){return new Promise(o=>{let n=V(t);if(b(n))return o(x("Error getting current post elements"));let r=n.value.length,s=[],i=(0,Jt.default)(()=>{let m=V(t);if(b(m))return o(x("Error getting current post elements"));let f=m.value.length>r,C=s.some(S=>{let P=S.type==="characterData",B=S.target.parentElement?.closest(t.selectors.postContentSelector);return P&&B}),T=s.some(S=>S.target.parentElement===document.querySelector(e));s.length=0,(f||C||T)&&(l.disconnect(),o(E(void 0)))},400),l=new MutationObserver(m=>{s.push(...m),i()}),a=document.querySelector(e);if(!a)return o(x("Element not found"));l.observe(a,{childList:!0,subtree:!0,attributes:!0,characterData:!0})})};u();c();var Kn={darkTheme:{buttonColor:"#CBD4E0",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#909090",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},zn=e=>h`
  flex-direction: column;
  gap: 0px;
  margin-left: -42px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  ${e?"":"margin-top: 42px;"}

  button {
    opacity: 1;
  }
`,Xn=(e,t)=>{if(!e)return!1;let o=t.selectors.reasoningToggleSelector;return!!e.querySelector(o)},Vn=(e,t)=>{for(;e&&!e.matches(t);)e=e.parentElement;return e},oo=e=>{let t=e.remoteConfig.selectors.postSelector,o=e.wrapper,n=Vn(o,t),r=Xn(n,e.remoteConfig),s=zn(r);return d(M,{overrideStyles:s,styleSets:Kn,...e})};var Jn=5e3,Zn={key:"deepseek",configuration:{options:{autoplayNewest:async(e,t)=>{let o=Be(e,t);if(o){let n=performance.now();await new Promise(async r=>{for(;!me(e,t);)if(await k(300),performance.now()-n>Jn){r(!1);break}r(!0)})}return o&&(me(e,t)||Te(e,t))},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"},prependElement:!0},component:oo,getElementToEmbed:(e,t)=>e.querySelector(t.selectors.postContentSelector)??e,elementUpdateProvider:async function*(e){await A(e.selectors.main);let t=0,o=1;for(;;){let n=V(e);if(b(n)){yield n;continue}let r=n.value,s=eo(e);(r.length>t||s>o)&&(o=s,t=r.length,yield E(r));let i=await to(e.selectors.main,e);b(i)&&(yield x(new Error(i.error)),await k(1e3))}},queueableContentFn:async(e,t)=>{let o=Je(t)||void 0;return{contentGenerator:async function*(n){let{waitForMutation:r}=$(e,{childList:!0,subtree:!0},n);(me(e,t)||Te(e,t))&&await F(async()=>{let s=Ze(Ve(e,t).map(a=>a.textContent).join(`
`)),i=[".","!","?",":",";"],l=s.filter(a=>{let m=a.slice(-1);return i.includes(m)});return Te(e,t)||l.length<2&&me(e,t)},500,Te(e,t)?3e4:5e3);do{if(n.aborted)break;let s=Ve(e,t);for(let i=0;i<s.length;i++){let a=Ze(s[i].textContent??"").map(g=>({elem:s[i],sentence:g})),m=me(e,t)&&i===s.length-1?1:s.length-i-1;yield{content:a,chunksBefore:0,chunksAfter:m,index:i}}await r()}while(!n.aborted)},converter:n=>{if("sentence"in n&&"elem"in n){let r=n.elem instanceof HTMLElement?Math.max(0,n.elem.textContent?.indexOf(n.sentence)??0):0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:r,scrollElement:o}}}}return{text:w(n),ref:{ref:e,highlightInfo:{startOffset:0,scrollElement:Je(t)||void 0}}}},options:{autoplay:!0},metadata:{source:"DeepSeek"}}}}},no=Zn;u();c();u();c();var pe=R(z());u();c();u();c();var et=()=>[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Le=v(function(e){return Array.from(document.querySelectorAll(e))}),tt=function(e,t){return e instanceof HTMLElement?e.matches(t):!1},Q=function(e,t){return new Promise(o=>{let n=new MutationObserver(s=>{s.some(l=>Array.from(l.addedNodes).find(a=>tt(a,t)))&&(n.disconnect(),o(E(void 0)))}),r=document.querySelector(e);if(!r)return x("Element not found");n.observe(r,{childList:!0,subtree:!0})})},de=function(e){let{cursor:t}=W.getState();if(!t)return!1;let o=(t?.ref).ref;return wt(o)?!1:o&&e&&e.contains(o)},ro=async function(e){let t=W.getState().currentContent;if(t&&e){let o=await kt(t),n=o[0]?w(o[0]):"",r=w(e);return n===r}return!1},so=async(e,t)=>{let o=e.filter(n=>!!n);return{getContent:await N(async()=>({content:o,chunksAfter:0,chunksBefore:0})),options:{sideEffects:!1,autoplay:!0},converter:n=>({text:w(n),ref:{ref:n}}),metadata:{source:t}}};var ao=v(function(e){let t=e.selectors,o=!!document.querySelector(`${t.feedContainer}`),n=!!document.querySelector(`${t.complementary}`),r=!!document.querySelector(t.isComposePageSelector),s=!!document.querySelector(t.postDialog);return o||n||r?[...s?[...document.querySelectorAll(t.composeCommentButtonsSection)]:[],...r?Array.from(document.querySelectorAll(t.composeButtonsSection)):[],...o?Array.from(document.querySelectorAll(s?t.dialogFeedContainer:t.likesButtonsSection)):[],...n?Array.from(document.querySelectorAll(t.singlePopupSelector)).map(l=>l.parentElement?.parentElement?.parentElement?.nextElementSibling?.querySelector(t.div)):[],...o||n?Array.from(document.querySelectorAll(t.commentsSelector)).map(l=>l):[]].filter(Boolean):[]});function Ae(e,t){return e.closest(t.ul)?.closest(t?.commentParent)?.querySelector(t.commentContent)??e.closest(t.feedContainer)?.parentElement?.parentElement?.parentElement?.querySelector(t.feedContent)??e.closest(t.groupFeedParent)?.parentElement?.previousElementSibling?.querySelector(t.groupFeedContent)??e.closest(t.groupFeedParent)?.parentElement?.previousElementSibling?.previousElementSibling?.querySelector(t.friendTimelineContent)??e.closest(t.complementary)?.querySelector(t.complementaryContent)??e.closest(t.dialog)?.querySelector(t.editor)}var io=!1,lo=!1,co=function(e){return new Promise(t=>{let o=new MutationObserver(i=>{i.some(a=>Array.from(a.addedNodes).find(m=>tt(m,e.mutationSelector)))&&(r(),t(E(void 0)))}),n=new MutationObserver(async()=>{let i=!!document.querySelector(e.postDialog),l=!!document.querySelector(e.composeCommentButtonsSection);(l!==lo||i!==io)&&(io=i,lo=l,r(),t(E(void 0)))}),r=()=>{n.disconnect(),o.disconnect()},s=document.querySelector(e.waitForSelector);if(!s)return x("Element not found");n.observe(document,{childList:!0,subtree:!0}),o.observe(s,{childList:!0,subtree:!0})})};u();c();var fe=e=>{let{text:t,color:o,showText:n}=e;return n?d(Re,{fixedWidthNumbers:!0,color:o,style:{display:"flex",alignItems:"center",fontWeight:"600",cursor:"pointer",fontFamily:"system-ui"}},d("span",{style:{lineHeight:"7px",fontSize:"14px",...e.styles}},t)):d(p,null)};var er=h`
  width: 90px;
  height: 32px;
  border-radius: 4px;
  margin-right: 0px;
`,tr=h`
  margin-right: 0px;
  margin-top: -2.5px;
  gap: 0px;

  button,
  button svg {
    width: 16px;
    height: 16px;
  }
`,or=h`
  margin-right: 4px;

  button,
  button svg {
    width: 18px;
    height: 18px;
  }
`,nr={buttonColor:"rgba(101, 103, 107, 1)",iconBackground:"#FFFFFF",hoverBackgroundColor:"rgba(242, 242, 242, 1)",activeBackgroundColor:"#CED1FF"},rr={buttonColor:"rgba(176, 179, 184, 1)",iconBackground:"#242526",hoverBackgroundColor:"rgba(58, 59, 60, 1)",activeBackgroundColor:"rgb(81,82,83)"};function uo({backgroundElement:e=document.body,notificationAnchor:t,queueableContent:o,remoteConfig:n,wrapper:r}){let s=n.selectors,{activeElement:i}=oe(),l=(0,pe.useMemo)(()=>Ae(r,s),[r,s]),a=(0,pe.useMemo)(()=>l?de(l):!1,[i,l]),{playInbox:m,isPlaying:g,isLoading:f,isLoadingFailed:C}=j({queueableContent:o,wrapper:r,isActiveElement:a}),T=(0,pe.useMemo)(()=>!!(r.closest(s.dialog)?.querySelector(s.editor)&&!r.closest(s.parentPlayerContainerInPopup)),[r,s]),S=(0,pe.useMemo)(()=>!!r.closest(s.ul)?.closest(s?.commentParent)?.querySelector(s.commentContent),[r,s]),P=(0,pe.useMemo)(()=>r.closest("#focused-state-actions-list"),[r]),{isDarkBackground:B}=se(e);return l?S||T?d(M,{backgroundElement:e,isDarkMode:B,notificationAnchor:t,overrideStyles:S?tr:P?or:{},queueableContent:o,wrapper:r}):d(Y,{styleThemes:B?rr:nr,customStyles:er,onClick:m,...t?{[I]:!0}:{}},d(U,{isLoading:f,isLoadingFailed:C,isPlaying:g,onClick:G=>{G.stopPropagation(),m()}}),d(fe,{text:"Listen",color:B?"rgba(176, 179, 184, 1)":"rgba(101, 103, 107, 1)",showText:!f&&!g,styles:{fontSize:"15px"}})):null}var sr={key:"facebook",configuration:{elementUpdateProvider:async function*(e){await H(e.selectors.main);do yield ao(e);while(await co(e.selectors))},getElementToEmbed(e,t){let o=t.selectors;if(!!(e.matches(`${o.feedContainer}`)||e.matches(o.groupFeedParent))){let i=e?.parentElement?.parentElement?.querySelector(o.parentPlayerContainer);return i?i.querySelector(o.playerContainer)??e.closest(o.parentPlayerContainerInPopup)?.querySelector(o.playerContainer)??e:e}return e},component:uo,queueableContentFn:async(e,t)=>{let o=t.selectors,n=[Ae(e,o)];return n[0]&&de(n[0])?W.getState().currentContent:so(n,"Facebook")},options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToPost"],getFeatureForElement:()=>"listenToPost"}}}},mo=sr;u();c();u();c();var fo=R(X()),po=R(_());var ot=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?L({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},nt=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),rt=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)},st=e=>po.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),it=(e,t)=>{let o=nt(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},go=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,ir=e=>{let t=document.querySelectorAll(e.selectors.postContentSelector),o=t[t.length-1];return document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0||o&&o?.querySelector(".animating")!==null},ge=(e,t)=>ir(t)&&it(e,t),yo=function(e,t){return new Promise(o=>{let n=[],r=(0,fo.default)(()=>{let l=n.some(m=>Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};u();c();var lr={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},ar=h`
  flex-direction: column;
  gap: 0px;
  top: 50px;
  margin-left: -22px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  pointer-events: all;
  isolation: isolate;
  z-index: 1;

  button {
    opacity: 1;
  }
`,Co=e=>d(M,{onClick:()=>{document.body.querySelectorAll(`[${J}]`).forEach(n=>{n.removeAttribute(J)})},overrideStyles:ar,styleSets:lr,...e});var J="data-speechify-streamed",cr=5e3,ur={key:"gemini",configuration:{options:{autoplayNewest:async(e,t)=>{let o=it(e,t),n=go(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!ge(e,t);)if(await k(300),performance.now()-r>cr){s(!1);break}s(!0)})}return o&&n&&ge(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Co,elementUpdateProvider:async function*(e){await A(e.selectors.main);do yield nt(e);while(await yo(e.selectors.main,e))},getElementToEmbed:(e,t)=>e.querySelector(t.selectors.playerContainerSelector)||e,queueableContentFn:async(e,t)=>{let o=rt(t)||void 0;return{contentGenerator:async function*(n){let{waitForMutation:r}=$(e,{childList:!0,subtree:!0},n);if(ge(e,t)&&(e.setAttribute(J,"true"),await F(async()=>{let s=st(ot(e,t).map(a=>a.textContent).join(`
`)),i=[".","!","?",":",";"];return s.filter(a=>{let m=a.slice(-1);return i.includes(m)}).length<1&&ge(e,t)},500)),!n.aborted)do{if(n.aborted)break;let s=ot(e,t);for(let i=0;i<s.length;i++)yield{content:st(s[i].textContent??"").map(m=>({elem:s[i],sentence:m})),chunksBefore:0,chunksAfter:ge(e,t)&&i===s.length-1?1:s.length-i-1,index:i};await r()}while(!n.aborted)},converter:n=>{if("sentence"in n&&"elem"in n){let r=n.elem instanceof HTMLElement?Math.max(0,n.elem.textContent?.indexOf(n.sentence)??0):0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:r,scrollElement:o}}}}return{text:w(n),ref:{ref:e,highlightInfo:{startOffset:0,scrollElement:rt(t)||void 0}}}},options:{autoplay:!0},metadata:{source:"Gemini"}}}}},So=ur;u();c();u();c();var Fe=R(z()),Eo={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},mr=h`
  flex-direction: column;
  gap: 0px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  left: 50px;
  top: 26px;
  pointer-events: all;
  isolation: isolate;
  z-index: 1;

  button {
    opacity: 1;
  }
`,dr=h`
  flex-direction: column;
  gap: 0px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  pointer-events: all;
  isolation: isolate;
  z-index: 1;

  button {
    opacity: 1;
  }
`,ho=e=>{let t=()=>{document.body.querySelectorAll(`[${J}]`).forEach(i=>{i.removeAttribute(J)})},o=(0,Fe.useMemo)(()=>e.wrapper.parentElement?.querySelector(e.remoteConfig.selectors.modelHeadingSelector),[e.wrapper,e.remoteConfig]),n=(0,Fe.useMemo)(()=>e.wrapper.parentElement?.querySelector(e.remoteConfig.selectors.thoughtPanelSelector),[e.wrapper,e.remoteConfig]),r=(0,Fe.useMemo)(()=>o?mr:dr,[o]);return n?null:o?d(M,{onClick:t,overrideStyles:r,styleSets:Eo,...e}):d("div",{style:{display:"flex",flexDirection:"row",gap:"2px",alignItems:"center"}},d("div",{style:{color:"#8c8c8c",fontSize:"12px"}},"Listen"),d(M,{onClick:t,overrideStyles:r,styleSets:Eo,...e}))};u();c();var To=R(X()),Po=R(_());var bo=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null},ke=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?L({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},lt=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),at=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)},ct=e=>Po.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),ut=(e,t)=>{let o=lt(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},vo=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,fr=e=>{let t=document.querySelectorAll(e.selectors.postContentSelector),o=t[t.length-1];return document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0||o?.querySelector(".animating")!==null},ye=(e,t)=>fr(t)&&ut(e,t),xo=function(e,t){return new Promise(o=>{let n=[],r=(0,To.default)(()=>{let l=n.some(m=>Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postContentSelector))!==void 0),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var wo="data-speechify-streamed",pr={key:"googleaistudio",configuration:{options:{autoplayNewest:async(e,t)=>{let o=ut(e,t),n=vo(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!ye(e,t);)if(await k(300),performance.now()-r>5e3){s(!1);break}s(!0)})}return o&&n&&ye(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"},prependElement:!0,styles:()=>({width:"100%"})},component:ho,elementUpdateProvider:async function*(e){await H(e.selectors.main);do yield lt(e);while(await xo(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async o=>{let n=e.getAttribute(wo)==="true";if(ye(e,t)||o.index!==0||n){e.setAttribute(wo,"true"),await F(async()=>{let l=ct(ke(e,t).map(a=>a.textContent).join(`
`));return!!bo(e,t)&&l.length<o.index+2&&ye(e,t)});let s=ke(e,t).flatMap(l=>ct(l.textContent??"").map(m=>({type:"paragraph",text:m,vertices:et(),elem:l,sentence:m}))),i=s.length-1===o.index&&!ye(e,t)||s.slice(o.index,o.index+1).length===0;return{content:s.slice(o.index,o.index+1),chunksBefore:o.index,chunksAfter:i?0:Math.max(1,s.length-o.index-1)}}return{content:ke(e,t).map(s=>({type:"paragraph",text:s.textContent||"",vertices:et(),elem:s})),chunksBefore:0,chunksAfter:0}},converter:o=>{if("sentence"in o&&"elem"in o){let r=o.elem instanceof HTMLElement?o.elem.textContent?.indexOf(o.sentence)??0:0,s=at(t)||void 0;return{text:o.sentence,ref:{ref:o.elem,highlightInfo:{startOffset:r,scrollElement:s}}}}let n="elem"in o?o.elem:o;return{text:w(n),ref:{ref:n,highlightInfo:{startOffset:0,scrollElement:at(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"GoogleAIStudio"}})}},Mo=pr;u();c();u();c();var gr={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},yr=h`
  top: 8px;
  position: absolute;
  left: -60px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  border-radius: 0.5rem;

  button {
    border-width: 1px !important;
  }
`,Ro=e=>d(M,{overrideStyles:yr,styleSets:gr,...e});u();c();var Bo=R(Mt()),Lo=R(_());var mt=(e,t)=>{let o;if(e.isConnected)o=e;else{let a=function(m,g){let f=m.toLowerCase().split(/\s+/),C=g.toLowerCase().split(/\s+/),T=new Set(f),S=new Set(C),P=new Set([...T].filter(K=>S.has(K))),B=new Set([...T,...S]).size;return P.size/B>=.7};var s=a;let i=e.textContent?.trim();if(!i)return[];o=Array.from(document.querySelectorAll(t.selectors.postSelector)).find(m=>{let g=m.textContent?.trim();return g&&a(g,i)})||null}if(!o)return[];let n=o.querySelector(t.selectors.postContentSelector);return n?L({startingNode:n,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}).filter(i=>{let l=i.tagName?.toLowerCase()==="div",a=i.classList?.contains("flex")&&i.classList?.contains("text-sm");return!l&&!a}):[]},dt=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),ft=e=>{let t=window.location.href.startsWith("https://grok.com/project/"),o=document.querySelector(t?e.selectors.projectMain:e.selectors.main),n=(r,s,i,l)=>{if(l===0)return null;if(getComputedStyle(r)[s]===i)return r;for(let a of Array.from(r.children)){let m=n(a,s,i,l-1);if(m)return m}return null};return n(o,"overflowY","auto",4)||n(o,"overflowY","scroll",4)},pt=e=>Lo.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),gt=(e,t)=>{let o=dt(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},Ao=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,Cr=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,Ce=(e,t)=>Cr(t)&&gt(e,t),Fo=function(e,t){return new Promise(o=>{let n=[],r=(0,Bo.default)(()=>{let l=n.some(m=>{if(m.type==="childList"){if(m.addedNodes.length>0)return Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0;if(m.target instanceof HTMLElement&&m.target.querySelector(t.selectors.postSelector))return!0}return!1}),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200,{maxWait:400}),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var Sr={key:"grok",configuration:{options:{autoplayNewest:async(e,t)=>{let o=gt(e,t),n=Ao(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!Ce(e,t);)if(await k(100),performance.now()-r>5e3){s(!1);break}s(!0)})}return o&&n&&Ce(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Ro,elementUpdateProvider:async function*(e){await A(e.selectors.main,{timeout:2e3});do yield dt(e);while(await Fo(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>{let o=ft(t)||void 0;return{contentGenerator:async function*(n){let{waitForMutation:r}=$(e,{childList:!0,subtree:!0},n);if(Ce(e,t)&&await F(async()=>{let s=pt(mt(e,t).map(a=>a.textContent).join(`
`)),i=[".","!","?",":",";"];return s.filter(a=>{let m=a.slice(-1);return i.includes(m)}).length<1&&Ce(e,t)},500),!n.aborted)do{if(n.aborted)break;let s=mt(e,t);for(let i=0;i<s.length;i++)yield{content:pt(s[i].textContent??"").map(m=>({elem:s[i],sentence:m})),chunksBefore:0,chunksAfter:Ce(e,t)&&i===s.length-1?1:s.length-i-1,index:i};await r()}while(!n.aborted)},converter:n=>{if("sentence"in n&&"elem"in n){let r=n.elem instanceof HTMLElement?Math.max(0,n.elem.textContent?.indexOf(n.sentence)??0):0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:r,scrollElement:o}}}}return{text:w(n),ref:{ref:e,highlightInfo:{startOffset:0,scrollElement:ft(t)||void 0}}}},options:{autoplay:!0},metadata:{source:"Grok"}}}}},ko=Sr;u();c();u();c();var Er={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},hr=h`
  top: 4px;
  position: absolute;
  left: -20px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  border-radius: 0.5rem;

  button {
    border-width: 1px !important;
  }
`,Io=e=>d(M,{overrideStyles:hr,styleSets:Er,...e});u();c();var Ho=R(X()),Tr=R(_());var qo=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?L({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},Oo=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Do=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)};var No=function(e,t){return new Promise(o=>{let n=[],r=(0,Ho.default)(()=>{let l=n.some(m=>Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var Pr={key:"grokx",configuration:{options:{autoplayNewest:async()=>!1,granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Io,elementUpdateProvider:async function*(e){await H(e.selectors.main);do yield Oo(e);while(await No(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async()=>({content:qo(e,t),chunksBefore:0,chunksAfter:0}),converter:o=>{let n=o instanceof Node?o.parentElement?.parentElement?.parentElement?.parentElement??o:o;return{text:w(o),ref:{ref:n,highlightInfo:{startOffset:0,scrollElement:Do(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"GrokX"}})}},Wo=Pr;u();c();u();c();var $o=R(z());u();c();var Go=e=>{let t=!!document.querySelector(e.articleContainer);return{articleContainer:t?e.articleContainer:e.articleContainerUnlogged,socialIcons:t?e.socialIcons:e.socialIconsUnlogged,articleTextSelector:t?e.articleTextSelector:e.articleTextSelectorUnlogged,articleInlineElement:t?e.articleInlineElement:e.articleInlineElementUnlogged}},_o=v(function({selectors:e}){return(()=>{if(!!(document.querySelector(e.editorContainer)&&document.querySelector(e.composePage)))return Array.from(document.querySelectorAll(e.composePage));if(!!document.querySelector(e.detailModal))return[...Array.from(document.querySelectorAll(e.detailModalContainer)).map(l=>l?.querySelector(e.socialIcons))];let r=!!document.querySelector(`${e.articleContainer} ${e.socialIcons}`),s=!!document.querySelector(`${e.articleContainerUnlogged} ${e.socialIconsUnlogged}`);if(r||s){let l=Go(e);return[...Array.from(document.querySelectorAll(l.articleContainer)).map(a=>a?.querySelector(l.socialIcons)),...Array.from(document.querySelectorAll(e.commentPlayerContainer))]}return[]})().filter(Boolean)}),Ie=(e,t)=>{let o=Go(t);return document.querySelector(t.detailModal)?e.closest(t.detailModalContainer)?.querySelector(t.detailModalText):e.closest(t.commentParent)?.querySelector(t.commentContent)??e.closest(o.articleContainer)?.querySelector(o.articleTextSelector)?.querySelector(o.articleInlineElement)??document.querySelector(t.editorContainer)};var br=h`
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -8px;
  width: 53px;

  > button {
    width: 16px;
    height: 16px;
  }
`,Uo=h`
  height: 48px;
  width: 100%;
  border-radius: 4px;

  > button {
    width: 18px;
    height: 18px;
  }
`,vr=h`
  margin-right: 4px;

  > button {
    height: 18.5px;
    width: 18.5px;

    > svg {
      height: 18.5px;
      width: 18.5px;
    }
  }
`,xr={buttonColor:"rgba(0, 0, 0, 0.75)",iconBackground:"#FFFFFF",hoverBackgroundColor:"rgba(235, 235, 235, 1)",activeBackgroundColor:"#CED1FF"},wr={buttonColor:"rgba(255, 255, 255, 0.9)",iconBackground:"#1B1F23",hoverBackgroundColor:"rgba(71, 74, 77, 1)",activeBackgroundColor:"#556478"};function Qo({notificationAnchor:e,queueableContent:t,wrapper:o,backgroundElement:n=document.body,remoteConfig:r}){let{isDarkBackground:s}=se(n),i=!!(document.querySelector(r.selectors.editorContainer)&&document.querySelector(r.selectors.composePage)),l=!!o.closest(r.selectors.commentPlayerContainer),a=!!document.querySelector(r.selectors.detailModal),{activeElement:m}=oe(),g=(0,$o.useMemo)(()=>{let P=Ie(o,r.selectors);return P?!!de(P):!1},[m,o]),{playInbox:f,isPlaying:C,isLoading:T,isLoadingFailed:S}=j({queueableContent:t,wrapper:o,isActiveElement:g});return i||l?d(M,{backgroundElement:n,isActiveElement:g,isDarkMode:s,notificationAnchor:e,overrideStyles:l?vr:null,queueableContent:t,wrapper:o}):d(Y,{styleThemes:s?wr:xr,customStyles:a?[Uo,br]:Uo,onClick:f,...e?{[I]:!0}:{}},d(U,{isLoading:T,isLoadingFailed:S,isPlaying:C,onClick:P=>{P.stopPropagation(),f()}}),d(fe,{text:"Listen",color:s?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.75)",showText:!T&&!C}))}var Mr={key:"linkedin",configuration:{elementUpdateProvider:async function*(e){await H(e.selectors.main);do await new Promise(t=>setTimeout(t,100)),yield _o(e);while(await Q(e.selectors.main,e.selectors.mutationSelector))},getElementToEmbed(e){return e},component:Qo,queueableContentFn:async(e,t)=>({getContent:await N(async()=>{let o=t.selectors;return{content:[Ie(e,o)].filter(r=>!!r),chunksAfter:0,chunksBefore:0}}),options:{sideEffects:!1,autoplay:!0},converter:o=>({text:w(o),ref:{ref:o}}),metadata:{source:"Linkedin"}}),options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToPost","listenWhenTyping"],getFeatureForElement:(e,t)=>e.closest(t.selectors.composePage)?"listenWhenTyping":"listenToPost"}}}},jo=Mr;u();c();u();c();var Rr={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},Br=h`
  border-radius: 50%;
  flex-direction: column;
  gap: 0px;
  height: 24px;
  left: 0;
  margin-left: -42px;
  position: absolute;
  top: 24px;
  width: 24px;

  button {
    opacity: 1;
  }
`,Yo=e=>d(M,{overrideStyles:Br,styleSets:Rr,...e});u();c();var Ko=R(X()),Lr=R(_());var zo=e=>e?L({startingNode:e,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}).filter(n=>{if(n.textContent?.trim()==="Finished thinking")return!1;let r=n instanceof Element?n:n.parentElement;if(!r)return!0;if(r.closest(".brandable--references")||r.closest(".brandable--follow-up-questions"))return!1;let s=r;for(;s&&s!==e;){let i=s.classList;if(i?.contains("brandable--references")||i?.contains("hide-on-print")||i?.contains("brandable--follow-up-questions")||i?.contains("MuiCollapse-root")&&i?.contains("MuiCollapse-hidden")&&s.querySelector(".MuiStepper-root")||i?.contains("ArticleReferences_references_container__68XPQ")||i?.contains("ArticleReferences_references__Mtdmr")||i?.contains("ArticleReferences_reference__M4xLS"))return!1;s=s.parentElement}return!0}):[],yt=v(function(e="article"){return Array.from(document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)});var Ar=e=>e?!!document.querySelector(e):!1,Ct=(e,t="article")=>{let o=yt(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1},St=(e,t,o="article")=>Ar(t)&&Ct(e,o),Fr=(e,t)=>e instanceof HTMLElement&&e.querySelector(t)!==null,kr=(e,t)=>Array.from(e.addedNodes).some(o=>Fr(o,t)),Xo=function(e,t="article"){return new Promise(o=>{let n=[],r=(0,Ko.default)(()=>{let l=n.some(a=>kr(a,t));n.length=0,l&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e)||document.body;if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var Ir={key:"openevidence",configuration:{options:{autoplayNewest:async e=>Ct(e)&&St(e),granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Yo,elementUpdateProvider:async function*(e){e.selectors||(e.selectors={main:".brandable--wrapper",playerContainerSelector:".avatar-gutter",postSelector:"article",postContentSelector:"article",isStillGeneratingSelector:".brandable--stop-generation-button"}),await A(e.selectors.main);do yield yt(e.selectors.postSelector);while(await Xo(e.selectors.main,e.selectors.postSelector))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async()=>(await F(async()=>St(e,t.selectors?.isStillGeneratingSelector,t.selectors?.postSelector)),{content:zo(e),chunksBefore:0,chunksAfter:0}),converter:o=>({text:w(o),ref:{ref:o,highlightInfo:{startOffset:0}}}),options:{autoplay:!0,sideEffects:!0},metadata:{source:"OpenEvidence"}})}},Vo=Ir;u();c();u();c();var Z=R(z());var Jo={buttonColor:"#454746",iconBackground:te["bg-prim-inv-b-w"],hoverBackgroundColor:"#F2F2F2",activeBackgroundColor:"#E4E4E4"},Zo={buttonColor:te["icn-txt-prim"],iconBackground:"#1B1F23",hoverBackgroundColor:"rgba(71, 74, 77, 1)",activeBackgroundColor:"#606367"},en=ve(xe)`
  position: relative;
  flex-direction: row;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 0 42px;
  padding: 4px 6px;
  border-radius: 6px;

  &:hover {
    background-color: ${({styleThemes:e})=>e.hoverBackgroundColor};

    > button {
      ${({styleThemes:e})=>e.hoverButtonColor?`border: 1.8px solid ${e.hoverButtonColor}`:""};
      color: ${({styleThemes:e})=>e.hoverButtonColor};
    }
  }

  > button {
    background: none;
    border: 1.8px solid ${({styleThemes:e})=>e.buttonColor};
    color: ${({styleThemes:e})=>e.buttonColor};
  }

  &:active {
    background-color: ${({styleThemes:e})=>e.activeBackgroundColor};
  }
`;en.defaultProps={xAlign:!0,yAlign:!0};function tn({notificationAnchor:e,queueableContent:t,wrapper:o}){let[n,r]=(0,Z.useState)(null),{state:s,pause:i,play:l,isActive:a,queueAndPlayContent:m}=Ft(n),g=Me(document.querySelector("#mainApp")),f=a&&s==="playing",C=a&&s==="buffering",T=s==="errored";(0,Z.useEffect)(()=>Lt(()=>{ne.pause()}),[]),(0,Z.useEffect)(()=>{r(t)},[o]);let S=(0,Z.useCallback)(async P=>{if(P&&P.stopPropagation(),!a)return m();if(!C){if(f)return i();if((window.getSelection()??"").toString().length>0||!f)return l();Array.from(document.querySelectorAll(".speechify-inbox-player")).forEach(B=>B.classList.remove("speechify-inbox-player")),Array.from(document.querySelectorAll(`.${be}`)).forEach(B=>B.classList.remove(be)),o.classList.add(be)}},[o,f,C,n,a]);return d(en,{onClick:S,styleThemes:g?Zo:Jo,...e?{[I]:!0}:{}},d(U,{isLoading:C,isLoadingFailed:T,isPlaying:f,iconSize:"20px",onClick:S}),d(Re,{color:g?Zo.buttonColor:Jo.buttonColor,fontSize:"14px",letterSpacing:"0.2px",medium:!0},f?"Pause":"Listen"))}u();c();function on(e){return document.querySelectorAll(e.conversationContentHost).length>1}function nn(e){return document.querySelectorAll(e.conversationContentDocument)}function Et(e){return document.querySelectorAll(e).length>0}var Hr={key:"outlook",configuration:{component:tn,elementUpdateProvider:async function*(e){let t=e.selectors;await H(t.componentContainerSelector);do{let o=Le(t.componentContainerSelector);if(b(o)){yield o;continue}let n=o.value,r=Et(t.composeButtonSelector)?n.slice(0,1):n;yield E(r)}while(await Q(t.main,t.toWatchElements))},getElementToEmbed:(e,t)=>Et(t.selectors.composeButtonSelector)?e.parentElement:e,queueableContentFn:async(e,t)=>({getContent:await N(async()=>{let o=t.selectors;return{content:(on(o)?Array.from(nn(o)):Array.from(e.closest(o.contentParent)?.querySelectorAll(o.messageSelector)??[])).flatMap(s=>L({startingNode:s,shouldFindHeadings:!1,getAllTextBlocksInitialThreshold:1,ignoreCache:!0})),chunksAfter:0,chunksBefore:0}}),converter:o=>({text:w(o),ref:{ref:o}}),options:{autoplay:!0,sideEffects:!1},metadata:{source:"Outlook"}}),options:{prependElement:!1,styles(){return{display:"inline-block"}},granularSettings:{supportedFeatures:["listenInInbox"],getFeatureForElement:()=>"listenInInbox"}}}},rn=Hr;u();c();u();c();var qr={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},Or=h`
  border-radius: 50%;
  flex-direction: column;
  gap: 0px;
  height: 24px;
  left: 0;
  margin-left: -42px;
  position: absolute;
  top: 16px;
  width: 24px;

  button {
    opacity: 1;
  }
`,sn=e=>d(M,{overrideStyles:Or,styleSets:qr,...e});u();c();var ln=R(X()),Dr=R(_());var an=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?L({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}):[]},ht=v(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),cn=e=>{let t=document.querySelector(e.selectors.main),o=(n,r,s,i)=>{if(i===0)return null;if(getComputedStyle(n)[r]===s)return n;for(let l of Array.from(n.children)){let a=o(l,r,s,i-1);if(a)return a}return null};return o(t,"overflowY","auto",4)||o(t,"overflowY","scroll",4)};var Tt=(e,t)=>{let o=ht(t);return b(o)?!1:o.value.pop()?.isSameNode(e)??!1};var Nr=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,He=(e,t)=>Nr(t)&&Tt(e,t),un=function(e,t){return new Promise(o=>{let n=[],r=(0,ln.default)(()=>{let l=n.some(m=>Array.from(m.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(m=>m.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(E(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return x("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var Wr={key:"perplexity",configuration:{options:{autoplayNewest:async(e,t)=>{let o=Tt(e,t);if(o){let n=performance.now();await new Promise(async r=>{for(;!He(e,t);)if(await k(300),performance.now()-n>5e3){r(!1);break}r(!0)})}return o&&He(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:sn,elementUpdateProvider:async function*(e){let t=window.location.pathname,o=new MutationObserver(()=>{let r=window.location.pathname;t!==r&&(t=r,ie())}),n=document.querySelector("title");n&&o.observe(n,{subtree:!0,characterData:!0,childList:!0}),await A(e.selectors.main);do yield ht(e);while(await un(e.selectors.main,e));o.disconnect()},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async()=>(await F(async()=>He(e,t)),{content:an(e,t),chunksBefore:0,chunksAfter:0}),converter:o=>{let n=cn(t)||void 0;return{text:w(o),ref:{ref:o,highlightInfo:{startOffset:0,scrollElement:n}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Perplexity"}})}},mn=Wr;u();c();u();c();var dn={buttonColor:"#000000",iconBackground:"#FFFFFF",hoverBackgroundColor:"none",activeBackgroundColor:"none"},fn={buttonColor:"#FFFFFF",iconBackground:"#000000",hoverBackgroundColor:"none",activeBackgroundColor:"none"},qe=h`
  &:hover {
    opacity: 0.75;
  }

  &:active {
    opacity: 0.7;
  }
`,Gr=h`
  ${qe}
  margin-top: 4px;
  margin-left: 10px;
`,_r=h`
  ${qe}
`,Ur=h`
  ${qe}
  margin-left: 10px;
`,$r=h`
  ${qe}
  margin-top: 4px;
  margin-left: 8px;
`;function pn({backgroundElement:e=document.body,notificationAnchor:t,queueableContent:o,remoteConfig:n,wrapper:r}){let{playInbox:s,isPlaying:i,isLoading:l,isLoadingFailed:a}=j({queueableContent:o,wrapper:r}),m=n.selectors.isTextAddedToComposeCommentBox,g=r?.closest(n.selectors.commentSelector),f=!!r?.closest(n.selectors.composePostSelector),C=r.closest(n.selectors.composeCommentSelector),T=!!C;C&&(C.querySelector(m)?r.style.display="flex":r.style.display="none");let S=Me(e),P=document.documentElement.classList.contains("theme-dark")||S;return g?d(M,{queueableContent:o,wrapper:r,backgroundElement:e,isDarkMode:P,notificationAnchor:t,styleSets:{lightTheme:{...dn,hoverBackgroundColor:"none",activeBackgroundColor:"none"},darkTheme:{...fn,hoverBackgroundColor:"none",activeBackgroundColor:"none"}},overrideStyles:$r}):d(Y,{onClick:s,styleThemes:P?fn:dn,customStyles:f?_r:T?Ur:Gr,"data-notification-trigger":"ai-button",...t?{[I]:!0}:{}},d(U,{isLoading:l,isPlaying:i,isLoadingFailed:a}),f||T&&d(fe,{text:i?"Pause":"Listen",color:P?"#FFF":"#000",showText:!l}))}u();c();var gn=v(function(e){let t=!!(e.feedPageSelector&&document.querySelector(e.feedPageSelector)),o=!!(e.postContainerSelector&&document.querySelector(e.postContainerSelector)),n=!!(e.composePostSelector&&document.querySelector(e.composePostSelector));return!o&&!t&&!n?[]:[...t&&e.feedPageSelector?Array.from(document.querySelectorAll(e.feedPageSelector)):[],...o&&e.postContainerSelector?Array.from(document.querySelectorAll(e.postContainerSelector)):[],...o&&e.commentSelector?Array.from(document.querySelectorAll(e.commentSelector)):[],...o&&e.composeCommentSelector?Array.from(document.querySelectorAll(e.composeCommentSelector)):[],...n&&e.composePostSelector?Array.from(document.querySelectorAll(e.composePostSelector)):[]].filter(Boolean)});var Qr={key:"reddit",configuration:{elementUpdateProvider:async function*(e){await H(e.selectors.main);do yield gn(e.selectors);while(await Q(e.selectors.main,e.selectors.mutationSelector))},getElementToEmbed:(e,t)=>{let o=e?.tagName===t.selectors.commentTag,n=e?.tagName===t.selectors.postTag,r=e?.tagName===t.selectors.composeCommentTag,s=e?.tagName===t.selectors.composePostTag;return o?e.querySelector(t.selectors.commentChildSelector)||e.querySelector(t.selectors.commentChildSelectorFallback):r?e.querySelector(t.selectors.composeCommentChildSelector):n?e.querySelector(t.selectors.postChildSelector)||e.querySelector(t.selectors.postChildSelectorFallback):s?e.querySelector(t.selectors.composePostChildSelector)?.parentElement??null:e},queueableContentFn:async(e,t)=>({getContent:await N(async()=>{let o=Array.from(e?.closest(t.selectors.postContainerSelector)?.querySelectorAll(t.selectors.postContentSelector)??e?.closest(t.selectors.feedPostsSelector)?.querySelectorAll(t.selectors.postContentSelector)??e?.closest(t.selectors.composeCommentSelector)?.querySelectorAll(t.selectors.composeCommentContentSelector)??e?.closest(t.selectors.composePostSelector)?.querySelectorAll(t.selectors.isTextAddedToComposePostBox)??[e?.closest(t.selectors.commentSelector)?.querySelector(t.selectors.commentContentSelector)]);return{content:o.filter(r=>!r||r.shadowRoot?!1:o.some(i=>i&&i!==r&&i.contains(r))?o.some(l=>l&&l.contains(r)&&l.shadowRoot):!0).filter(r=>!!r),chunksAfter:0,chunksBefore:0}}),converter:o=>({text:w(o),ref:{ref:o}}),options:{sideEffects:!1,autoplay:!0},metadata:{source:"Reddit"}}),options:{prependElement:!1,styles:()=>({marginRight:"auto"}),granularSettings:{supportedFeatures:["listenToPost"],getFeatureForElement:()=>"listenToPost"}},component:pn}},yn=Qr;u();c();u();c();var jr={buttonColor:"rgb(83, 100, 113)",iconBackground:"white",hoverButtonColor:"#4759F7",hoverBackgroundColor:"#f1f4f9",activeBackgroundColor:"#f1f4f9"},Yr={buttonColor:"rgb(113, 118, 123)",iconBackground:"white",hoverButtonColor:"#4759F7",hoverBackgroundColor:"rgba(0, 0, 0, 0.1)",activeBackgroundColor:"rgba(0, 0, 0, 0.1)"},Kr={padding:"10px",borderRadius:"50%",marginTop:"-1px"},Cn=e=>d(M,{...e,overrideStyles:Kr,styleSets:{darkTheme:Yr,lightTheme:jr}});u();c();var Sn=R(_());var En=e=>Sn.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),hn=v(function(e){let t=document.querySelector(e.selectors.tweetContainer),o=document.querySelector(e.selectors.tweet)?.parentElement?.querySelector(e.selectors.tweetParent),n=document.querySelector(e.selectors.editorContent),r=document.querySelector(e.selectors.article);return t||o||n||r?[...t?Array.from(document.querySelectorAll(e.selectors.tweetContainer)):[],...r?Array.from(document.querySelectorAll(e.selectors.articleContainer)):[],...n?Array.from(document.querySelectorAll(e.selectors.toolBarSelector)):[],...o?[...Array.from(document.querySelectorAll(e.selectors.tweet))].map(i=>i?.parentElement?.querySelector(e.selectors.tweetParent)):[]].filter(Boolean):[]});function Tn(e){return new Promise(t=>{let o=new MutationObserver(r=>{r.some(i=>Array.from(i.addedNodes).find(l=>l instanceof HTMLElement?l.querySelector(e.selectors.toolBarSelector):!1))&&(o.disconnect(),t(E(void 0)))}),n=document.querySelector(e.selectors.contentParent);if(!n)return x("Element not found");o.observe(n,{childList:!0,subtree:!0})})}var zr=async(e,t)=>{let o=e.filter(r=>!!r),n=[];for(let r of o){let s=r.textContent??"",i=En(s);for(let l of i)l.trim().length>0&&n.push({sentence:l,elem:r})}return{getContent:await N(async()=>({content:n,chunksAfter:0,chunksBefore:0})),options:{sideEffects:!1,autoplay:!0},converter:r=>{if(typeof r=="object"&&r!==null&&"sentence"in r&&"elem"in r){let s=r,i=Math.max(0,s.elem.textContent?.indexOf(s.sentence)??0);return{text:s.sentence,ref:{ref:s.elem,highlightInfo:{startOffset:i}}}}return{text:r.textContent??"",ref:{ref:r}}},metadata:{source:t}}},Xr={key:"x",configuration:{elementUpdateProvider:async function*(e){let t=window.location.pathname,o=new MutationObserver(()=>{let r=window.location.pathname;t!==r&&(t=r,ie())}),n=document.querySelector("title");n&&o.observe(n,{subtree:!0,characterData:!0,childList:!0});try{await A(e.selectors.mainArea);do await At(e.selectors.loadingTimeline),yield hn(e);while(await Promise.race([Q(e.selectors.mountArea,e.selectors.mainArea),Tn(e)]))}finally{o.disconnect()}},getElementToEmbed(e,t){let o=document.querySelector(t.selectors.article),n=e.getAttribute(t.selectors.toolBarAttribute)===t.selectors.toolBar;return o||n?e.childNodes[0]:e.id!==""?e:null},component:Cn,queueableContentFn:async(e,t)=>{let n=document.querySelector(t.selectors.article)?Array.from(e.closest(t.selectors.tweet)?.querySelector(t.selectors.articleContent)?.querySelectorAll(t.selectors.articleContentElements)||[]):[(e.closest(t.selectors.tweet)??e.closest(t.selectors.tweet2))?.parentElement?.querySelector(t.selectors.contentParent)??document.querySelector(t.selectors.editorContent)];return await ro(n[0])?W.getState().currentContent:zr(n,"Twitter")},options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToTweet"],getFeatureForElement:()=>"listenToTweet"}}}},Pn=Xr;u();c();u();c();var Vr={buttonColor:"rgba(15,15,15,0.7)",iconBackground:"white",hoverButtonColor:"rgba(15,15,15,0.7)",hoverBackgroundColor:"rgba(0,0,0,0.1)",activeBackgroundColor:"rgba(0,0,0,0.2)"},Jr={buttonColor:"rgba(255,255,255,0.9)",iconBackground:"rgba(15,15,15,0.7)",hoverButtonColor:"rgba(255,255,255,0.9)",hoverBackgroundColor:"rgba(255,255,255,0.1)",activeBackgroundColor:"rgba(255,255,255,0.2)"},Zr={padding:"8px",borderRadius:"50%",marginRight:0,circle:{strokeWidth:"1px"}},bn=e=>d(M,{...e,backgroundElement:document.querySelector("ytd-app")??document.body,overrideStyles:Zr,styleSets:{darkTheme:Jr,lightTheme:Vr}});var es={key:"youtube",configuration:{elementUpdateProvider:async function*(e){await H(e.selectors.mainArea);do yield Le(e.selectors.posts);while(await Q(e.selectors.mainArea,e.selectors.posts))},getElementToEmbed:(e,t)=>e.querySelector(t.selectors.mountArea),component:bn,queueableContentFn:async(e,t)=>({getContent:await N(async()=>({content:Array.from(e.querySelectorAll(t.selectors.postBodies)),chunksAfter:0,chunksBefore:0})),converter:o=>{let n=he(t),r=n?.querySelector(t.selectors.mainArea)?n:null;return{text:w(o),ref:{ref:o,highlightInfo:{startOffset:0,scrollElement:r??void 0}}}},options:{autoplay:!0,sideEffects:!1},metadata:{source:"Youtube"}}),options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToComment"],getFeatureForElement:()=>"listenToComment"}}}},vn=es;var ts=[Qt,Vt,no,mo,So,ko,Mo,Wo,jo,Vo,rn,mn,yn,Pn,vn];async function os(e){let t=ts.find(r=>r.key===e.configurationKey);if(!t)return;let o=new AbortController;return ns(t,e,o.signal).then(r=>{if(b(r)){let s=r.error,l={context:{errorMessage:s instanceof Error?s.message:JSON.stringify(s,null,2)}};Ne(new Error(`Failed to mount configuration:${JSON.stringify(s,null,2)} `),l)}}),()=>{o.abort(),as()}}var ns=async(e,t,o)=>{let{elementUpdateProvider:n,options:r}=e.configuration,s=!0,i=0,l=2,a=g=>(i<l?(console.warn("Error getting elements:",g),Ne(new Error(`Error getting elements from provider ${g.message}`),{context:{error:String(g),occurrence:`${i+1} of batch`,operation:"get_elements"}})):i===l&&console.warn(`Suppressing additional error logs (${i+1} and counting)`),i++,[]),m=n(t);for await(let g of m){if(o.aborted)break;let f=xt(g,a);if(f.length===0)continue;let T=(await Promise.all(f.map(S=>ss(S,t,e,r,s)))).filter(b);if(T.length>0){let S=new Error(`Failed to process ${T.length} elements: ${T[0].error.message}`);return x(S)}}return E(!0)},rs=async(e,t,o,n)=>{if(n?.granularSettings){let r=v(()=>n.granularSettings?.getFeatureForElement(e,t))();if(b(r))return console.warn("Error getting feature key:",r.error),!1;let s=r.value,i=t.playButtons?.[o.key];if(s&&i?.[s]===!1)return!0}return!1},ss=async(e,t,o,n,r)=>{let{component:s,queueableContentFn:i,getElementToEmbed:l}=o.configuration,a=Ee(v(()=>l(e,t))(),P=>new Error(`[Error getting element to embed] ${P.message}`));if(b(a))return a;if(!a.value)return E(!0);if(await rs(e,t,o,n))return E(!0);let g=n?.styles?n.styles(e,t):null,f=is(a.value,!!n?.prependElement,g,r);if(b(f))return Ee(f,P=>new Error(`[Error creating mountable component] ${P.message}`));let C=await i(e,t),T=s??Ge,S=us(f.value.container,()=>d(T,{notificationAnchor:r,queueableContent:C,remoteConfig:t,wrapper:f.value.shadowContainer}));return b(S)?Ee(S,P=>new Error(`[Error mounting component] ${P.message}`)):(n?.autoplayNewest&&cs(C,()=>n.autoplayNewest?.(e,t)).then(P=>{if(b(P))return Ee(P,B=>new Error(`[Error triggering autoplay] ${B.message}`))}),r=!1,E(!0))},xn=(e,t,o=null,n)=>{let r=e.querySelector(`div[${we}]`)??document.createElement("div");return r.setAttribute(we,"true"),r.style.alignSelf="center",n&&r.setAttribute(I,"true"),o&&Object.assign(r.style,o),t?e.prepend(r):e.appendChild(r),{shadowRoot:r.shadowRoot??r.attachShadow({mode:"open"}),shadowContainer:r}},is=v((e,t,o=null,n)=>{ls(e);let{shadowRoot:r,shadowContainer:s}=xn(e,t??!1,o??null,n),i=document.createElement("div");return i.role="speechify-post-player",r.appendChild(i),{container:i,shadowContainer:s}}),ls=(e,t)=>{let{shadowRoot:o}=xn(e,t??!1);if(!o)return;let n=o.querySelector('div[role="speechify-post-player"]');n&&(Pe(null,n),o.removeChild(n))},as=()=>{document.querySelectorAll(`div[${we}]`).forEach(t=>{Pe(null,t),t.remove()})},cs=async(e,t)=>{if(!(t?await t():!1))return E(void 0);let n=await Bt();if(!Rt(n))return E(void 0);e.options??={autoplay:!1,sideEffects:!1};let s=await Ht("SHOULD_SHOW_AUTOPLAY");if(s===!0)e.options.autoplay=!0;else if(s===void 0)await Se("introduce-ai-autoplay",{animate:!1},"pill-player"),await Se("introduce-ai-autoplay",{animate:!1},"side-player"),e.options.autoplay=!1;else return E(void 0);let i=v(()=>re(e,!0))();return vt(i,()=>{})},us=v((e,t)=>{Pe(d(We,{root:e},d(t,null)),e)});export{os as default};
//# sourceMappingURL=init-OFRDA7GS.js.map
