import"./chunk-Z35E3KWV.js";import"./chunk-F6QDPILS.js";import"./chunk-CXWBUGW7.js";import{a as Nt}from"./chunk-BKGCVLI3.js";import{a as le}from"./chunk-7XGTX76V.js";import{a as we}from"./chunk-UQFDLVII.js";import"./chunk-TYN6FJD3.js";import{a as v}from"./chunk-SSSSNVF5.js";import"./chunk-FD2XQWPC.js";import"./chunk-3UDU62CH.js";import"./chunk-FKJPRJ46.js";import"./chunk-5PO6RROQ.js";import{D as Rt,t as Bt}from"./chunk-43GP4A7N.js";import"./chunk-MBHSJ34F.js";import"./chunk-DMUXVFIA.js";import"./chunk-Z3E43XMU.js";import"./chunk-BN5XPDNR.js";import"./chunk-YYPSUSZQ.js";import"./chunk-56NWWOIX.js";import"./chunk-EF43U47C.js";import"./chunk-GWCIFOLA.js";import"./chunk-NK4CKTAC.js";import{c as Tt,d as xt,k as bt,m as U}from"./chunk-KO4WPNRU.js";import"./chunk-F5622KQ7.js";import"./chunk-WC6QURV6.js";import"./chunk-TIGAXALM.js";import"./chunk-ZQRXZJGY.js";import"./chunk-6S4AP2UG.js";import"./chunk-O3LC63CS.js";import"./chunk-AG3QEKLJ.js";import"./chunk-C4ZBMBCR.js";import{Cd as Re,Dd as Ot,Ea as O,Ec as It,Fa as I,Fc as Mt,Ha as St,Hc as Ht,Ia as Et,Na as re,Oa as G,Oc as $e,Qa as se,Qb as vt,Ra as _,Ta as xe,ca as z,cd as qt,dd as ie,ea as gt,ed as ve,fa as oe,gb as be,gd as M,hd as Be,i as dt,m as x,n as B,nc as wt,o as ft,p as pe,pc as kt,q as pt,s as P,sa as yt,sc as Lt,t as T,ta as L,ua as Y,va as Ct,vc as At,wb as A,xc as Ft}from"./chunk-RISKGE32.js";import{P as Te,V as _e,ba as Cn,ea as Ue,ja as ge}from"./chunk-6O6MLDWR.js";import{b as q,c as ht,g as Pt,i as b,k as ye}from"./chunk-F4AZU7R4.js";import{g as ne}from"./chunk-GQY3J744.js";import{d as w,g as c,i as m,j as g,k as Pe,m as yn,n as u}from"./chunk-CLPINNGF.js";u();c();yn();u();c();var Dt=w(ne());function Ke({children:e,root:t}){let o=(0,Dt.useMemo)(()=>ht({key:"post-player-emotion-cache",container:t}),[t]);return m(Pt,{value:o},e)}u();c();var ae=w(ne());function Ye({notificationAnchor:e,queueableContent:t}){let{usePlayingState:o,useCurrentContent:n}=G,[r,s]=(0,ae.useState)(null),i=(0,ae.useRef)(null),{play:l,pause:a}=re,d=o(),p=n(),f=!!p&&p?.id===r?.id,C=!!f&&d==="playing",h=!!f&&d==="buffering",S=!!f&&d==="errored",E=(0,ae.useCallback)(async k=>{if(k.stopPropagation(),_e()||ge("browser-action",{animate:!1},"pill-player"),h)return;if(C)return a();if(f)return l();let K=se(t,!0);s(K)},[h,C,f,l,a,t]);return m("div",null,m(bt,{isLoading:h,isLoadingFailed:S,isPlaying:C,onClick:E,ref:i,...e?{[M]:!0}:{}}))}u();c();u();c();u();c();u();c();var ce=w(ne());var Sn="[data-speechifyplaybackhighlighter-highlight]",En="div[data-speechify-shadow-container]";function $({queueableContent:e,wrapper:t,remoteConfig:o,isActiveElement:n}){let[r,s]=(0,ce.useState)(null),{play:i,pause:l}=re,{usePlayingState:a,useCurrentContent:d}=G,p=a(),f=d(),{activeElement:C}=le(),h=C instanceof Element?C:null;(0,ce.useEffect)(()=>{s(e)},[t]);let S=h?.nodeType===Node.TEXT_NODE?h?.parentElement:h,E=p==="playing",k=S?.isConnected||!1,K=E&&o&&e.options?.autoplay!==void 0?S?.closest(o.selectors.postSelector)?.querySelector(En)?.isSameNode(t):!1,V=o&&p==="playing"&&!k&&t.closest(o.selectors.postSelector)?.querySelector(Sn),te=!!(f&&f?.id===r?.id||K||n||V),We=te&&p==="playing",Ge=te&&p==="buffering",pn=te&&p==="errored";return{playInbox:(0,ce.useCallback)(()=>{if((window.getSelection()??"").toString().length>0)return i();if(Ge)return;if(We)return l();if(te&&f)return i();let gn=se(e,!0);s(gn)},[e,t,Ge,We,te,i,l]),isActive:te,isPlaying:We,isLoading:Ge,isLoadingFailed:pn}}u();c();var Q=ye(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&&b(e)};
`,hn=b`
  flex-direction: column;
  gap: 0px;
  margin-right: 0px;
  margin-top: 6px;
`,Pn=ye.div`
  align-items: center;
  display: flex;
  flex-direction: inherit;
  gap: 5px;
  margin-top: inherit;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out, max-width 0.3s ease-in-out;

  ${({expanded:e})=>e?`
        max-height: 600px;
        max-width: 600px;
      `:`
        max-height: 0;
        max-width: 0;
      `}

  > button {
    height: 20px;
    min-height: 20px;
    min-width: 20px;
    padding: 0;
    width: 20px;

    ${({isDarkMode:e})=>e?`
          color: ${q.icnTxtTert};
          border: 1px solid ${q.brdrTert4050}; 
        `:`
          color: ${q.icnTxtPrimInv}; 
          border: 1px solid ${q.icnTxtPrimInv};
        `}
  }
`;function R({backgroundElement:e=document.body,isActiveElement:t,isDarkMode:o,notificationAnchor:n,onClick:r,overrideStyles:s={},queueableContent:i,remoteConfig:l,styleSets:a,wrapper:d}){let p=a?.lightTheme||{buttonColor:q.sfPrimWB,iconBackground:"white",hoverBackgroundColor:"none",activeBackgroundColor:"none"},f=a?.darkTheme||{buttonColor:q.brdrTert4050,iconBackground:"#212121",hoverBackgroundColor:"none",activeBackgroundColor:"none"},{playInbox:C,isPlaying:h,isLoading:S,isLoadingFailed:E}=$({queueableContent:i,remoteConfig:l,wrapper:d,isActiveElement:t}),{isDarkBackground:k}=ie(e||document.body),K=l?d.getAttribute(l.selectors.toolBarAttribute)===l.selectors.toolBar:void 0;return m(Q,{styleThemes:o||k?f:p,customStyles:s,...n&&!K?{[M]:!0}:{}},m(U,{isLoading:S,isLoadingFailed:E,isPlaying:h,onClick:V=>{V.stopPropagation(),C(),Re("individual-post-button-hint"),r&&r()}}))}var xn={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},bn=b`
  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;
  }
`,_t=e=>m(R,{overrideStyles:bn,styleSets:xn,...e});u();c();var Ut=w(Cn()),$t=w(z());var Qe=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Kt=function({selectors:e}){return new Promise(t=>{let o=!!document.querySelector(e.profileButton),n=o?e.main:e.mainWrapper,r=[],s=(0,Ut.default)(()=>{let a=r.some(C=>Array.from(C.addedNodes).find(S=>S instanceof HTMLElement&&S.getAttribute(e.nodeAttributeSelector)?.startsWith(e.stringToMatchAttribute))!==void 0),d=!o&&r.some(({target:C})=>C===l),p=r.some(C=>C.target.parentElement===document.querySelector(e.main)),f=r.some(C=>C.type==="childList"&&!C.target.isConnected);r.length=0,(a||p||f||d)&&(i.disconnect(),t(x(void 0))),d&&we()},16),i=new MutationObserver(a=>{r.push(...a),s()}),l=document.querySelector(n);if(!l)return B("Element not found");i.observe(l,{childList:!0,subtree:!0})})};function vn(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 Ce=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector),r=e.querySelectorAll(t.selectors.postContentSelector).length>1?o?.parentElement:o;return r?A({startingNode:r,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}).filter(i=>i.nodeType===Node.TEXT_NODE||vn(r,r)):[]},Se=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 t instanceof HTMLElement?o(t,"overflowY","auto",5):null},Bn=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null};var Ve=e=>$t.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),ze=(e,t)=>{let o=Qe(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1},Rn=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,j=(e,t)=>ze(e,t)?Rn(t)?!0:!Bn(e,t):!1,Yt=(e,t)=>{let o=e.getAttribute(t.selectors.nodeAttributeSelector);if(!o)return;let n=o.split(t.selectors.stringToMatchAttributeWithHyphen).pop();return Number(n)};u();c();var F=()=>[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],ke=T(function(e){return Array.from(document.querySelectorAll(e))}),wn=function(e,t){return e instanceof HTMLElement?e.matches(t):!1},N=function(e,t){return new Promise(o=>{let n=new MutationObserver(s=>{s.some(l=>Array.from(l.addedNodes).find(a=>wn(a,t)))&&(n.disconnect(),o(x(void 0)))}),r=document.querySelector(e);if(!r)return B("Element not found");n.observe(r,{childList:!0,subtree:!0})})},ue=function(e){let{cursor:t}=G.getState();if(!t)return!1;let o=(t?.ref).ref;return gt(o)?!1:o&&e&&e.contains(o)},Qt=async function(e){let t=G.getState().currentContent;if(t&&e){let o=await Et(t),n=o[0]?v(o[0]):"",r=v(e);return n===r}return!1},Le=async(e,t)=>{let o=e.filter(n=>!!n);return{getContent:await _(async()=>({content:o,chunksAfter:0,chunksBefore:0})),options:{sideEffects:!1,autoplay:!0},converter:n=>({text:v(n),ref:{ref:n}}),metadata:{source:t}}};var kn=Bt()?7500:15e3,Ln={key:"chatgpt",configuration:{options:{autoplayNewest:async(e,t)=>{let o=ze(e,t),n=(Yt(e,t)??0)%2===0;if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!j(e,t);)if(await O(300),performance.now()-r>kn){s();break}s()})}return o&&n&&j(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"},prependElement:!0},component:_t,elementUpdateProvider:async function*(e){await Y(e.selectors.promptArea);do yield Qe(e);while(await Kt(e))},getElementToEmbed:(e,t)=>{let o=e.querySelector(t.selectors.playerContainerWithUserSelector)||e.querySelector(t.selectors.playerContainerWithoutUserSelector)||e;return o?.querySelector(t.selectors.isMessageFromUser)?null:o},queueableContentFn:async(e,t)=>{let o=!1;return{getContent:async n=>{if(await I(async()=>Ce(e,t).length<1&&!j(e,t)),j(e,t)&&(o=!0),!o)return{content:Ce(e,t).map(i=>({elem:i,text:i.textContent||"",type:"paragraph",vertices:F()})),chunksBefore:0,chunksAfter:0};await I(async()=>{let i=Ve(Ce(e,t).map(d=>d.textContent).join(`
`)),l=[".","!","?",":",";"];return i.filter(d=>{let p=d.slice(-1);return l.includes(p)}).length<n.index+2&&j(e,t)},500);let r=Ce(e,t).flatMap(i=>Ve(i.textContent??"").map(a=>({elem:i,sentence:a,type:"paragraph",text:a,vertices:F()}))),s=r.length-1<=n.index&&!j(e,t);return{content:r.slice(n.index,n.index+1),chunksBefore:n.index,chunksAfter:s?0:Math.max(1,r.length-n.index-1)}},converter:n=>{if("sentence"in n&&"elem"in n){let s=n.elem instanceof HTMLElement?n.elem.textContent?.indexOf(n.sentence)??0:0,i=Se(t)||void 0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:s,scrollElement:i}}}}let r="elem"in n?n.elem:n;return{text:v(r),ref:{ref:r,highlightInfo:{startOffset:0,scrollElement:Se(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Chatgpt"}}}}},Vt=Ln;u();c();u();c();var An={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},Fn=b`
  flex-direction: column;
  gap: 0px;
  top: 16px;
  margin-left: -42px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;

  button {
    opacity: 1;
  }
`,zt=e=>m(R,{overrideStyles:Fn,styleSets:An,...e});u();c();var jt=w(oe()),Xt=w(z());var Jt=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null},Fe=(e,t)=>{let o;if(e.isConnected)o=e;else{let a=function(d,p){let f=d.toLowerCase().split(/\s+/),C=p.toLowerCase().split(/\s+/),h=new Set(f),S=new Set(C),E=new Set([...h].filter(V=>S.has(V))),k=new Set([...h,...S]).size;return E.size/k>=.7};var s=a;let i=e.textContent?.trim();if(!i)return[];o=Array.from(document.querySelectorAll(t.selectors.postSelector)).find(d=>{let p=d.textContent?.trim();return p&&a(p,i)})||null}if(!o)return[];let n=o.querySelector(t.selectors.postContentSelector);return n?A({startingNode:n,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},je=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Xe=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)},Je=e=>Xt.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),Ze=(e,t)=>{let o=je(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1},Zt=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,In=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,me=(e,t)=>In(t)&&Ze(e,t),eo=function(e,t){return new Promise(o=>{let n=[],r=(0,jt.default)(()=>{let l=n.some(d=>Array.from(d.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(d=>d.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(x(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return B("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var Mn={key:"claude",configuration:{options:{autoplayNewest:async(e,t)=>{let o=Ze(e,t),n=Zt(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!me(e,t);)if(await O(300),performance.now()-r>5e3){s(!1);break}s(!0)})}return o&&n&&me(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:zt,elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield je(e);while(await eo(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async o=>{let n=!e.isConnected;if(me(e,t)||o.index!==0||n){await I(async()=>{let l=Je(Fe(e,t).map(a=>a.textContent).join(`
`));return!!Jt(e,t)&&l.length<o.index+2&&me(e,t)});let s=Fe(e,t).flatMap(l=>Je(l.textContent??"").map(d=>({type:"paragraph",text:d,vertices:F(),elem:l,sentence:d}))),i=s.length-1===o.index&&!me(e,t)||s.slice(o.index,o.index+1).length===0||!e.isConnected;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:Fe(e,t).map(s=>({type:"paragraph",text:s.textContent||"",vertices:F(),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=Xe(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:v(n),ref:{ref:n,highlightInfo:{startOffset:0,scrollElement:Xe(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Claude"}})}},to=Mn;u();c();u();c();var Hn={darkTheme:{buttonColor:"#CBD4E0",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#909090",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},qn=e=>b`
  flex-direction: column;
  gap: 0px;
  margin-left: -42px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  ${e?"":"margin-top: 42px;"}

  button {
    opacity: 1;
  }
`,On=(e,t)=>{if(!e)return!1;let o=t.selectors.reasoningToggleSelector;return!!e.querySelector(o)},Nn=(e,t)=>{for(;e&&!e.matches(t);)e=e.parentElement;return e},oo=e=>{let t=e.remoteConfig.selectors.postSelector,o=e.wrapper,n=Nn(o,t),r=On(n,e.remoteConfig),s=qn(r);return m(R,{overrideStyles:s,styleSets:Hn,...e})};u();c();var no=w(oe()),ro=w(z());var Ee=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?A({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}):[]},X=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector)).filter(o=>o.querySelector(e.selectors.postContentSelector)!==null)}),so=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},et=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)},tt=e=>ro.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),Ie=(e,t)=>{let o=X(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1};var Dn=e=>{let t=X(e);if(P(t))return!1;let o=t.value.pop();return o?o.querySelectorAll(e.selectors.iconSelector).length===0:!1},Wn=e=>{let t=X(e);if(P(t))return!1;let o=t.value.pop();if(!o)return!1;let n=o.querySelector(e.selectors.reasoningSelector),r=o.querySelector(e.selectors.isStillGeneratingSelector);return n!==null&&r!==null},io=(e,t)=>Wn(t)&&Ie(e,t),J=(e,t)=>Dn(t)&&Ie(e,t),lo=function(e,t){return new Promise(o=>{let n=X(t);if(P(n))return o(B("Error getting current post elements"));let r=n.value.length,s=[],i=(0,no.default)(()=>{let d=X(t);if(P(d))return o(B("Error getting current post elements"));let f=d.value.length>r,C=s.some(S=>{let E=S.type==="characterData",k=S.target.parentElement?.closest(t.selectors.postContentSelector);return E&&k}),h=s.some(S=>S.target.parentElement===document.querySelector(e));s.length=0,(f||C||h)&&(l.disconnect(),o(x(void 0)))},200),l=new MutationObserver(d=>{s.push(...d),i()}),a=document.querySelector(e);if(!a)return o(B("Element not found"));l.observe(a,{childList:!0,subtree:!0,attributes:!0,characterData:!0})})};var Gn={key:"deepseek",configuration:{options:{autoplayNewest:async(e,t)=>{let o=Ie(e,t);if(o){let n=performance.now();await new Promise(async r=>{for(;!J(e,t);)if(await O(300),performance.now()-n>5e3){r(!1);break}r(!0)})}return o&&J(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"},prependElement:!0},component:oo,elementUpdateProvider:async function*(e){await Y(e.selectors.main);let t=0,o=1;for(;;){let n=X(e);if(P(n)){yield n;continue}let r=n.value,s=so(e);(r.length>t||s>o)&&(o=s,t=r.length,yield x(r));let i=await lo(e.selectors.main,e);if(P(i)){console.error("Error waiting for more elements:",i.error),yield B(new Error(i.error));break}}},getElementToEmbed:(e,t)=>e.querySelector(t.selectors.postContentSelector)??e,queueableContentFn:async(e,t)=>{let o=!1;return{getContent:async n=>{if(await I(async()=>Ee(e,t).length<1&&!J(e,t)&&!io(e,t)),J(e,t)&&(o=!0),!o)return{content:Ee(e,t).map(l=>({elem:l,text:l.textContent||"",type:"paragraph",vertices:F()})),chunksBefore:0,chunksAfter:0};await I(async()=>{let i=tt(Ee(e,t).map(d=>d.textContent).join(`
`)),l=[".","!","?",":",";"];return i.filter(d=>{let p=d.slice(-1);return l.includes(p)}).length<n.index+2&&J(e,t)},500);let r=Ee(e,t).flatMap(i=>tt(i.textContent??"").map(a=>({type:"paragraph",text:a,vertices:F(),elem:i,sentence:a}))),s=r.length-1===n.index&&!J(e,t);return{content:r.slice(n.index,n.index+1),chunksBefore:n.index,chunksAfter:s?0:Math.max(1,r.length-n.index-1)}},converter:n=>{if("sentence"in n&&"elem"in n){let s=n.elem instanceof HTMLElement?n.elem.textContent?.indexOf(n.sentence)??0:0,i=et(t)||void 0;return{text:n.sentence,ref:{ref:n.elem,highlightInfo:{startOffset:s,scrollElement:i}}}}let r="elem"in n?n.elem:n;return{text:v(r),ref:{ref:r,highlightInfo:{startOffset:0,scrollElement:et(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"DeepSeek"}}}}},ao=Gn;u();c();u();c();var uo=w(ne());u();c();var co=T(function(e){let t=e.selectors,o=!!document.querySelector(`${t.feedContainer}`),n=!!document.querySelector(`${t.complementary}`),r=!!document.querySelector(t.isComposePageSelector);return o||n||r?[...r?Array.from(document.querySelectorAll(t.isComposePageSelector)).map(i=>{let l=i.parentElement?.parentElement?.parentElement?.parentElement;return l?.childElementCount&&l?.childElementCount>=3?l:null}):[],...o?Array.from(document.querySelectorAll(t.feedContainer)):[],...n?Array.from(document.querySelectorAll(t.singlePopupSelector)).map(i=>i.parentElement?.parentElement?.parentElement?.nextElementSibling?.querySelector(t.div)):[],...o||n?Array.from(document.querySelectorAll(t.commentsSelector)).map(i=>i):[]].filter(Boolean):[]});function Me(e,t){return e.closest(t.ul)?.closest(t?.commentParent)?.querySelector(t.commentContent)??e.closest(t.feedContainer)?.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)}u();c();var de=e=>{let{text:t,color:o,showText:n}=e;return n?m(be,{fixedWidthNumbers:!0,color:o,style:{display:"flex",alignItems:"center",fontWeight:"600",cursor:"pointer",fontFamily:"system-ui"}},m("span",{style:{lineHeight:"7px",fontSize:"14px"}},t)):m(g,null)};var Un=b`
  width: 90px;
  height: 32px;
  border-radius: 4px;
  margin-right: 0px;
`,$n=b`
  margin-right: 0px;
  gap: 0px;
`,Kn={buttonColor:"rgba(101, 103, 107, 1)",iconBackground:"#FFFFFF",hoverBackgroundColor:"rgba(242, 242, 242, 1)",activeBackgroundColor:"#CED1FF"},Yn={buttonColor:"rgba(176, 179, 184, 1)",iconBackground:"#242526",hoverBackgroundColor:"rgba(58, 59, 60, 1)",activeBackgroundColor:"#556478"};function mo({backgroundElement:e=document.body,notificationAnchor:t,queueableContent:o,remoteConfig:n,wrapper:r}){let s=n.selectors,{activeElement:i}=le(),l=(0,uo.useMemo)(()=>{let E=Me(r,s);return E?ue(E):!1},[i]),{playInbox:a,isPlaying:d,isLoading:p,isLoadingFailed:f}=$({queueableContent:o,wrapper:r,isActiveElement:l}),C=!!(r.closest(s.dialog)?.querySelector(s.editor)&&!r.closest(s.parentPlayerContainerInPopup)),h=r.closest(s.ul)?.closest(s?.commentParent)?.querySelector(s.commentContent),{isDarkBackground:S}=ie(e);return h||C?m(R,{backgroundElement:e,isDarkMode:S,notificationAnchor:t,overrideStyles:h?$n:{},queueableContent:o,wrapper:r}):m(Q,{styleThemes:S?Yn:Kn,customStyles:Un,onClick:a,...t?{[M]:!0}:{}},m(U,{isLoading:p,isLoadingFailed:f,isPlaying:d,onClick:E=>{E.stopPropagation(),a()}}),m(de,{text:"Listen",color:S?"rgba(176, 179, 184, 1)":"rgba(101, 103, 107, 1)",showText:!p&&!d}))}var Qn={key:"facebook",configuration:{elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield co(e);while(await N(e.selectors.waitForSelector,e.selectors.mutationSelector))},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:mo,queueableContentFn:async(e,t)=>{let o=t.selectors,n=[Me(e,o)];return n[0]&&ue(n[0])?G.getState().currentContent:Le(n,"Facebook")},options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToPost"],getFeatureForElement:()=>"listenToPost"}}}},fo=Qn;u();c();u();c();var Vn={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},zn=b`
  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;
  }
`,po=e=>m(R,{onClick:()=>{document.body.querySelectorAll(`[${he}]`).forEach(n=>{n.removeAttribute(he)})},overrideStyles:zn,styleSets:Vn,...e});u();c();var go=w(oe()),yo=w(z());var Co=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null},He=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?A({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},ot=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),nt=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)},rt=e=>yo.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),st=(e,t)=>{let o=ot(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1},So=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,jn=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},fe=(e,t)=>jn(t)&&st(e,t),Eo=function(e,t){return new Promise(o=>{let n=[],r=(0,go.default)(()=>{let l=n.some(d=>Array.from(d.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(d=>d.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(x(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return B("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var he="data-speechify-streamed",Xn={key:"gemini",configuration:{options:{autoplayNewest:async(e,t)=>{let o=st(e,t),n=So(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!fe(e,t);)if(await O(300),performance.now()-r>5e3){s(!1);break}s(!0)})}return o&&n&&fe(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:po,elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield ot(e);while(await Eo(e.selectors.main,e))},getElementToEmbed:(e,t)=>e.querySelector(t.selectors.playerContainerSelector)||e,queueableContentFn:async(e,t)=>({getContent:async o=>{let n=e.getAttribute(he)==="true";if(fe(e,t)||o.index!==0||n){e.setAttribute(he,"true"),await I(async()=>{let l=rt(He(e,t).map(a=>a.textContent).join(`
`));return!!Co(e,t)&&l.length<o.index+2&&fe(e,t)});let s=He(e,t).flatMap(l=>rt(l.textContent??"").map(d=>({type:"paragraph",text:d,vertices:F(),elem:l,sentence:d}))),i=s.length-1===o.index&&!fe(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:He(e,t).map(s=>({type:"paragraph",text:s.textContent||"",vertices:F(),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=nt(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:v(n),ref:{ref:n,highlightInfo:{startOffset:0,scrollElement:nt(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Gemini"}})}},ho=Xn;u();c();u();c();var Jn={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},Zn=b`
  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;
  }
`,Po=e=>m(R,{overrideStyles:Zn,styleSets:Jn,...e});u();c();var To=w(oe()),xo=w(z());var bo=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o||null},qe=(e,t)=>{let o;if(e.isConnected)o=e;else{let a=function(d,p){let f=d.toLowerCase().split(/\s+/),C=p.toLowerCase().split(/\s+/),h=new Set(f),S=new Set(C),E=new Set([...h].filter(V=>S.has(V))),k=new Set([...h,...S]).size;return E.size/k>=.7};var s=a;let i=e.textContent?.trim();if(!i)return[];o=Array.from(document.querySelectorAll(t.selectors.postSelector)).find(d=>{let p=d.textContent?.trim();return p&&a(p,i)})||null}if(!o)return[];let n=o.querySelector(t.selectors.postContentSelector);return n?A({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}):[]},it=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),vo=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)},lt=e=>xo.default.sentences(e,{preserve_whitespace:!0,newline_boundaries:!0}),at=(e,t)=>{let o=it(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1},Bo=(e,t)=>e.querySelector(t.selectors.postContentSelector)!==null,er=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,Z=(e,t)=>er(t)&&at(e,t),Ro=function(e,t){return new Promise(o=>{let n=[],r=(0,To.default)(()=>{let l=n.some(d=>Array.from(d.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(d=>d.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(x(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return B("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var tr={key:"grok",configuration:{options:{autoplayNewest:async(e,t)=>{let o=at(e,t),n=Bo(e,t);if(o&&n){let r=performance.now();await new Promise(async s=>{for(;!Z(e,t);)if(await O(300),performance.now()-r>5e3){s(!1);break}s(!0)})}return o&&n&&Z(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:Po,elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield it(e);while(await Ro(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async o=>{let n=!e.isConnected;if(Z(e,t)||o.index!==0||n){await I(async()=>{let l=lt(qe(e,t).map(a=>a.textContent).join(`
`));return!!bo(e,t)&&l.length<o.index+2&&Z(e,t)});let s=qe(e,t).flatMap(l=>lt(l.textContent??"").map(d=>({type:"paragraph",text:d,vertices:F(),elem:l,sentence:d}))),i=s.length-1===o.index&&!Z(e,t)||s.slice(o.index,o.index+1).length===0||!e.isConnected;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:qe(e,t).map(s=>({type:"paragraph",text:s.textContent||"",vertices:F(),elem:s})),chunksBefore:0,chunksAfter:0}},converter:o=>{let r=Z(e,t)?void 0:vo(t)||void 0;if("sentence"in o&&"elem"in o){let i=o.elem instanceof HTMLElement?o.elem.textContent?.indexOf(o.sentence)??0:0;return{text:o.sentence,ref:{ref:o.elem,highlightInfo:{startOffset:i,scrollElement:r}}}}let s="elem"in o?o.elem:o;return{text:v(s),ref:{ref:s,highlightInfo:{startOffset:0,scrollElement:r}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Grok"}})}},wo=tr;u();c();u();c();var or={darkTheme:{buttonColor:"#B4B4B4",iconBackground:"#212121",hoverBackgroundColor:"#2f2f2f",activeBackgroundColor:"#2f2f2f"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"#f9f9f9",activeBackgroundColor:"#f9f9f9"}},nr=b`
  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;
  }
`,ko=e=>m(R,{overrideStyles:nr,styleSets:or,...e});u();c();var Lo=w(oe()),rr=w(z());var Ao=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?A({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!1}):[]},Fo=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Io=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 Mo=function(e,t){return new Promise(o=>{let n=[],r=(0,Lo.default)(()=>{let l=n.some(d=>Array.from(d.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(d=>d.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(x(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return B("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var sr={key:"grokx",configuration:{options:{autoplayNewest:async()=>!1,granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:ko,elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield Fo(e);while(await Mo(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async()=>({content:Ao(e,t),chunksBefore:0,chunksAfter:0}),converter:o=>{let n=o instanceof Node?o.parentElement?.parentElement?.parentElement?.parentElement??o:o;return{text:v(o),ref:{ref:n,highlightInfo:{startOffset:0,scrollElement:Io(t)||void 0}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"GrokX"}})}},Ho=sr;u();c();u();c();var Do=w(ne());u();c();var qo=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}},Oo=T(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=qo(e);return[...Array.from(document.querySelectorAll(l.articleContainer)).map(a=>a?.querySelector(l.socialIcons)),...Array.from(document.querySelectorAll(e.commentPlayerContainer))]}return[]})().filter(Boolean)}),Oe=(e,t)=>{let o=qo(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 ir=b`
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -8px;
  width: 53px;

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

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

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

    > svg {
      height: 18.5px;
      width: 18.5px;
    }
  }
`,ar={buttonColor:"rgba(0, 0, 0, 0.75)",iconBackground:"#FFFFFF",hoverBackgroundColor:"rgba(235, 235, 235, 1)",activeBackgroundColor:"#CED1FF"},cr={buttonColor:"rgba(255, 255, 255, 0.9)",iconBackground:"#1B1F23",hoverBackgroundColor:"rgba(71, 74, 77, 1)",activeBackgroundColor:"#556478"};function Wo({notificationAnchor:e,queueableContent:t,wrapper:o,backgroundElement:n=document.body,remoteConfig:r}){let{isDarkBackground:s}=ie(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:d}=le(),p=(0,Do.useMemo)(()=>{let E=Oe(o,r.selectors);return E?!!ue(E):!1},[d,o]),{playInbox:f,isPlaying:C,isLoading:h,isLoadingFailed:S}=$({queueableContent:t,wrapper:o,isActiveElement:p});return i||l?m(R,{backgroundElement:n,isActiveElement:p,isDarkMode:s,notificationAnchor:e,overrideStyles:l?lr:null,queueableContent:t,wrapper:o}):m(Q,{styleThemes:s?cr:ar,customStyles:a?[No,ir]:No,onClick:f,...e?{[M]:!0}:{}},m(U,{isLoading:h,isLoadingFailed:S,isPlaying:C,onClick:E=>{E.stopPropagation(),f()}}),m(de,{text:"Listen",color:s?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.75)",showText:!h&&!C}))}var ur={key:"linkedin",configuration:{elementUpdateProvider:async function*(e){await L(e.selectors.main);do await new Promise(t=>setTimeout(t,100)),yield Oo(e);while(await N(e.selectors.main,e.selectors.mutationSelector))},getElementToEmbed(e){return e},component:Wo,queueableContentFn:async(e,t)=>({getContent:await _(async()=>{let o=t.selectors;return{content:[Oe(e,o)].filter(r=>!!r),chunksAfter:0,chunksBefore:0}}),options:{sideEffects:!1,autoplay:!0},converter:o=>({text:v(o),ref:{ref:o}}),metadata:{source:"Linkedin"}}),options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToPost","listenWhenTyping"],getFeatureForElement:(e,t)=>e.closest(t.selectors.composePage)?"listenWhenTyping":"listenToPost"}}}},Go=ur;u();c();u();c();var ee=w(ne());var _o={buttonColor:"#454746",iconBackground:q.bgPrimInvBW,hoverBackgroundColor:"#F2F2F2",activeBackgroundColor:"#E4E4E4"},Uo={buttonColor:q.icnTxtPrim,iconBackground:"#1B1F23",hoverBackgroundColor:"rgba(71, 74, 77, 1)",activeBackgroundColor:"#606367"},$o=ye(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};
  }
`;$o.defaultProps={xAlign:!0,yAlign:!0};function Ko({notificationAnchor:e,queueableContent:t,wrapper:o}){let[n,r]=(0,ee.useState)(null),{state:s,pause:i,play:l,isActive:a,queueAndPlayContent:d}=St(n),p=ve(document.querySelector("#mainApp")),f=a&&s==="playing",C=a&&s==="buffering",h=s==="errored";(0,ee.useEffect)(()=>yt(()=>{re.pause()}),[]),(0,ee.useEffect)(()=>{r(t)},[o]);let S=(0,ee.useCallback)(async E=>{if(E&&E.stopPropagation(),!a)return d();if(!C){if(f)return i();if((window.getSelection()??"").toString().length>0||!f)return l();Array.from(document.querySelectorAll(".speechify-inbox-player")).forEach(k=>k.classList.remove("speechify-inbox-player")),Array.from(document.querySelectorAll(`.${Te}`)).forEach(k=>k.classList.remove(Te)),o.classList.add(Te)}},[o,f,C,n,a]);return m($o,{onClick:S,styleThemes:p?Uo:_o,...e?{[M]:!0}:{}},m(U,{isLoading:C,isLoadingFailed:h,isPlaying:f,iconSize:"20px",onClick:S}),m(be,{color:p?Uo.buttonColor:_o.buttonColor,fontSize:"14px",letterSpacing:"0.2px",medium:!0},f?"Pause":"Listen"))}u();c();function Yo(e){return document.querySelectorAll(e.conversationContentHost).length>1}function Qo(e){return document.querySelectorAll(e.conversationContentDocument)}function ct(e){return document.querySelectorAll(e).length>0}var mr={key:"outlook",configuration:{component:Ko,elementUpdateProvider:async function*(e){let t=e.selectors;await L(t.componentContainerSelector);do{let o=ke(t.componentContainerSelector);if(P(o)){yield o;continue}let n=o.value,r=ct(t.composeButtonSelector)?n.slice(0,1):n;yield x(r)}while(await N(t.main,t.toWatchElements))},getElementToEmbed:(e,t)=>ct(t.selectors.composeButtonSelector)?e.parentElement:e,queueableContentFn:async(e,t)=>({getContent:await _(async()=>{let o=t.selectors;return{content:(Yo(o)?Array.from(Qo(o)):Array.from(e.closest(o.contentParent)?.querySelectorAll(o.messageSelector)??[])).flatMap(s=>A({startingNode:s,shouldFindHeadings:!1,getAllTextBlocksInitialThreshold:1,ignoreCache:!0})),chunksAfter:0,chunksBefore:0}}),converter:o=>({text:v(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"}}}},Vo=mr;u();c();u();c();var dr={darkTheme:{buttonColor:"#A2A096",iconBackground:"#212121",hoverBackgroundColor:"transparent",activeBackgroundColor:"#393937"},lightTheme:{buttonColor:"#7D7D7D",iconBackground:"#FFFFFF",hoverBackgroundColor:"transparent",activeBackgroundColor:"#f8f8f7"}},fr=b`
  border-radius: 50%;
  flex-direction: column;
  gap: 0px;
  height: 24px;
  left: 0;
  margin-left: -42px;
  position: absolute;
  top: 16px;
  width: 24px;

  button {
    opacity: 1;
  }
`,zo=e=>m(R,{overrideStyles:fr,styleSets:dr,...e});u();c();var jo=w(oe()),pr=w(z());var Xo=(e,t)=>{let o=e.querySelector(t.selectors.postContentSelector);return o?A({startingNode:o,ignoreCache:!0,getAllTextBlocksInitialThreshold:15,minimumTotalCharThresholdForGaussianHeuristic:4,shouldFindHeadings:!0}):[]},ut=T(function(e){return Array.from(document.querySelectorAll(e.selectors.postSelector))}),Jo=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 mt=(e,t)=>{let o=ut(t);return P(o)?!1:o.value.pop()?.isSameNode(e)??!1};var gr=e=>document.querySelectorAll(e.selectors.isStillGeneratingSelector).length>0,Ne=(e,t)=>gr(t)&&mt(e,t),Zo=function(e,t){return new Promise(o=>{let n=[],r=(0,jo.default)(()=>{let l=n.some(d=>Array.from(d.addedNodes).find(f=>f instanceof HTMLElement&&f.querySelector(t.selectors.postSelector))!==void 0),a=n.some(d=>d.target.parentElement===document.querySelector(e));n.length=0,(l||a)&&(s.disconnect(),o(x(void 0)))},200),s=new MutationObserver(l=>{n.push(...l),r()}),i=document.querySelector(e);if(!i)return B("Element not found");s.observe(i,{childList:!0,subtree:!0})})};var yr={key:"perplexity",configuration:{options:{autoplayNewest:async(e,t)=>{let o=mt(e,t);if(o){let n=performance.now();await new Promise(async r=>{for(;!Ne(e,t);)if(await O(300),performance.now()-n>5e3){r(!1);break}r(!0)})}return o&&Ne(e,t)},granularSettings:{supportedFeatures:["listenToAnswer"],getFeatureForElement:()=>"listenToAnswer"}},component:zo,elementUpdateProvider:async function*(e){await Y(e.selectors.main);do yield ut(e);while(await Zo(e.selectors.main,e))},getElementToEmbed:e=>e,queueableContentFn:async(e,t)=>({getContent:async()=>(await I(async()=>Ne(e,t)),{content:Xo(e,t),chunksBefore:0,chunksAfter:0}),converter:o=>{let n=Jo(t)||void 0;return{text:v(o),ref:{ref:o,highlightInfo:{startOffset:0,scrollElement:n}}}},options:{autoplay:!0,sideEffects:!0},metadata:{source:"Perplexity"}})}},en=yr;u();c();u();c();var tn={buttonColor:"#000000",iconBackground:"#FFFFFF",hoverBackgroundColor:"none",activeBackgroundColor:"none"},on={buttonColor:"#FFFFFF",iconBackground:"#000000",hoverBackgroundColor:"none",activeBackgroundColor:"none"},De=b`
  &:hover {
    opacity: 0.75;
  }

  &:active {
    opacity: 0.7;
  }
`,Cr=b`
  ${De}
  margin-top: 4px;
  margin-left: 10px;
`,Sr=b`
  ${De}
`,Er=b`
  ${De}
  margin-left: 10px;
`,hr=b`
  ${De}
  margin-top: 4px;
  margin-left: 8px;
`;function nn({backgroundElement:e=document.body,notificationAnchor:t,queueableContent:o,remoteConfig:n,wrapper:r}){let{playInbox:s,isPlaying:i,isLoading:l,isLoadingFailed:a}=$({queueableContent:o,wrapper:r}),d=n.selectors.isTextAddedToComposeCommentBox,p=r?.closest(n.selectors.commentSelector),f=!!r?.closest(n.selectors.composePostSelector),C=r.closest(n.selectors.composeCommentSelector),h=!!C;C&&(C.querySelector(d)?r.style.display="flex":r.style.display="none");let S=ve(e),E=document.documentElement.classList.contains("theme-dark")||S;return p?m(R,{queueableContent:o,wrapper:r,backgroundElement:e,isDarkMode:E,notificationAnchor:t,styleSets:{lightTheme:{...tn,hoverBackgroundColor:"none",activeBackgroundColor:"none"},darkTheme:{...on,hoverBackgroundColor:"none",activeBackgroundColor:"none"}},overrideStyles:hr}):m(Q,{onClick:s,styleThemes:E?on:tn,customStyles:f?Sr:h?Er:Cr,"data-notification-trigger":"ai-button",...t?{[M]:!0}:{}},m(U,{isLoading:l,isPlaying:i,isLoadingFailed:a}),f||h&&m(de,{text:i?"Pause":"Listen",color:E?"#FFF":"#000",showText:!l}))}u();c();var rn=T(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 Pr={key:"reddit",configuration:{elementUpdateProvider:async function*(e){await L(e.selectors.main);do yield rn(e.selectors);while(await N(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 _(async()=>({content: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)]).filter(n=>!!n),chunksAfter:0,chunksBefore:0})),converter:o=>({text:v(o),ref:{ref:o}}),options:{sideEffects:!1,autoplay:!0},metadata:{source:"Reddit"}}),options:{prependElement:!1,styles:()=>({marginRight:"auto"}),granularSettings:{supportedFeatures:["listenToPost"],getFeatureForElement:()=>"listenToPost"}},component:nn}},sn=Pr;u();c();u();c();var Tr={buttonColor:"rgb(83, 100, 113)",iconBackground:"white",hoverButtonColor:"#4759F7",hoverBackgroundColor:"#f1f4f9",activeBackgroundColor:"#f1f4f9"},xr={buttonColor:"rgb(113, 118, 123)",iconBackground:"white",hoverButtonColor:"#4759F7",hoverBackgroundColor:"rgba(0, 0, 0, 0.1)",activeBackgroundColor:"rgba(0, 0, 0, 0.1)"},br={padding:"10px",borderRadius:"50%",marginTop:"-1px"},ln=e=>m(R,{...e,overrideStyles:br,styleSets:{darkTheme:xr,lightTheme:Tr}});u();c();var an=T(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 cn(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(x(void 0)))}),n=document.querySelector(e.selectors.contentParent);if(!n)return B("Element not found");o.observe(n,{childList:!0,subtree:!0})})}var vr={key:"x",configuration:{elementUpdateProvider:async function*(e){let t=window.location.pathname,o=new MutationObserver(()=>{let r=window.location.pathname;t!==r&&(t=r,we())}),n=document.querySelector("title");n&&o.observe(n,{subtree:!0,characterData:!0,childList:!0});try{await Y(e.selectors.mainArea);do await Ct(e.selectors.loadingTimeline),yield an(e);while(await Promise.race([N(e.selectors.mountArea,e.selectors.mainArea),cn(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:ln,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 Qt(n[0])?G.getState().currentContent:Le(n,"Twitter")},options:{prependElement:!0,granularSettings:{supportedFeatures:["listenToTweet"],getFeatureForElement:()=>"listenToTweet"}}}},un=vr;u();c();u();c();var Br={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)"},Rr={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)"},wr={padding:"8px",borderRadius:"50%",marginRight:0,circle:{strokeWidth:"1px"}},mn=e=>m(R,{...e,backgroundElement:document.querySelector("ytd-app")??document.body,overrideStyles:wr,styleSets:{darkTheme:Rr,lightTheme:Br}});var kr={key:"youtube",configuration:{elementUpdateProvider:async function*(e){await L(e.selectors.mainArea);do yield ke(e.selectors.posts);while(await N(e.selectors.mainArea,e.selectors.posts))},getElementToEmbed:(e,t)=>e.querySelector(t.selectors.mountArea),component:mn,queueableContentFn:async(e,t)=>({getContent:await _(async()=>({content:Array.from(e.querySelectorAll(t.selectors.postBodies)),chunksAfter:0,chunksBefore:0})),converter:o=>{let n=Se(t),r=n?.querySelector(t.selectors.mainArea)?n:null;return{text:v(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"}}}},dn=kr;var Lr=[Vt,to,ao,fo,ho,wo,Ho,Go,Vo,en,sn,un,dn];async function Ar(e){let t=Lr.find(r=>r.key===e.configurationKey);if(!t)return;let o=new AbortController;return Fr(t,e,o.signal).then(r=>{if(P(r)){let s=r.error,l={context:{errorMessage:s instanceof Error?s.message:JSON.stringify(s,null,2)}};Ue(new Error(`Failed to mount configuration:${JSON.stringify(s,null,2)} `),l)}}),await Gr(),()=>{o.abort(),Or()}}var Fr=async(e,t,o)=>{let{elementUpdateProvider:n,options:r}=e.configuration,s=!0,i=0,l=2,a=p=>(i<l?(console.warn("Error getting elements:",p),Ue(new Error(`Error getting elements from provider ${p.message}`),{context:{error:String(p),occurrence:`${i+1} of batch`,operation:"get_elements"}})):i===l&&console.warn(`Suppressing additional error logs (${i+1} and counting)`),i++,[]),d=n(t);for await(let p of d){if(o.aborted)break;let f=pt(p,a);if(f.length===0)continue;let h=(await Promise.all(f.map(S=>Mr(S,t,e,r,s)))).filter(P);if(h.length>0){let S=new Error(`Failed to process ${h.length} elements: ${h[0].error.message}`);return B(S)}}return x(!0)},Ir=async(e,t,o,n)=>{if(n?.granularSettings){let r=T(()=>n.granularSettings?.getFeatureForElement(e,t))();if(P(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},Mr=async(e,t,o,n,r)=>{let{component:s,queueableContentFn:i,getElementToEmbed:l}=o.configuration,a=pe(T(()=>l(e,t))(),E=>new Error(`[Error getting element to embed] ${E.message}`));if(P(a))return a;if(!a.value)return x(!0);if(await Ir(e,t,o,n))return x(!0);let p=n?.styles?n.styles(e,t):null,f=Hr(a.value,!!n?.prependElement,p,r);if(P(f))return pe(f,E=>new Error(`[Error creating mountable component] ${E.message}`));let C=await i(e,t),h=s??Ye,S=_r(f.value.container,()=>m(h,{notificationAnchor:r,queueableContent:C,remoteConfig:t,wrapper:f.value.shadowContainer}));return P(S)?pe(S,E=>new Error(`[Error mounting component] ${E.message}`)):(n?.autoplayNewest&&Nr(o.key,C,()=>n.autoplayNewest?.(e,t)).then(E=>{if(P(E))return pe(E,k=>new Error(`[Error triggering autoplay] ${k.message}`))}),r=!1,x(!0))},fn=(e,t,o=null,n)=>{let r=e.querySelector(`div[${Be}]`)??document.createElement("div");return r.setAttribute(Be,"true"),r.style.alignSelf="center",n&&r.setAttribute(M,"true"),o&&Object.assign(r.style,o),t?e.prepend(r):e.appendChild(r),{shadowRoot:r.shadowRoot??r.attachShadow({mode:"open"}),shadowContainer:r}},Hr=T((e,t,o=null,n)=>{qr(e);let{shadowRoot:r,shadowContainer:s}=fn(e,t??!1,o??null,n),i=document.createElement("div");return i.role="speechify-post-player",r.appendChild(i),{container:i,shadowContainer:s}}),qr=(e,t)=>{let{shadowRoot:o}=fn(e,t??!1);if(!o)return;let n=o.querySelector('div[role="speechify-post-player"]');n&&(Pe(null,n),o.removeChild(n))},Or=()=>{document.querySelectorAll(`div[${Be}]`).forEach(t=>{Pe(null,t),t.remove()})},Nr=async(e,t,o)=>{if(!(o?await o():!1))return x(void 0);let r=await dt();if(!qt(r))return x(void 0);let i=T(()=>vt.playButtons.get(Rt(e),e,"autoplayResponses"))();if(P(i))return B(new Error(`Failed to get autoplay setting: ${i.error.message}`));let l=i.value;if(t.options??={autoplay:!1,sideEffects:!1},l===!0)t.options.autoplay=!0;else if(l===void 0)await ge("introduce-ai-autoplay",{animate:!1},"pill-player"),t.options.autoplay=!1;else return x(void 0);let a=T(()=>se(t,!0))();return ft(a,()=>{})},Dr={aichat:"AICHAT",facebook:"FACEBOOK",gmail:"GMAIL",linkedin:"LINKEDIN",outlook:"OUTLOOK",reddit:"REDDIT",youtube:"YOUTUBE",x:"X"},Wr=()=>{let e=null;return kt()?e="facebook":Lt()?e="gmail":wt()?e="linkedin":Ht()?e="outlook":At()?e="reddit":Ft()?e="youtube":It()?e="x":Mt()&&(e="aichat"),e},Gr=async()=>{let e=Wr();if(!e)return;let t=Dr[e],o=await Tt("SHOULD_SHOW_PLAY_BUTTON_HINT");if(o.includes(t)===!0){Re("individual-post-button-hint");return}await Ot({allowPointerActions:!0,component:!0,duration:0,id:"individual-post-button-hint",priority:101,showOnMobile:!1,timeSensitive:!0,render:()=>m(Nt,null)}),await xt("SHOULD_SHOW_PLAY_BUTTON_HINT",[...o,t]),$e("extension_play_button_hint_shown",{platform:e})},_r=T((e,t)=>{Pe(m(Ke,{root:e},m(t,null)),e)});export{Ar as default};
//# sourceMappingURL=init-BGYXL5MP.js.map
