dsh-thoughtdag 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/cordis.patch.yml +11 -0
- package/dist-app/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist-app/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist-app/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist-app/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist-app/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist-app/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist-app/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist-app/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist-app/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist-app/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist-app/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist-app/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist-app/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist-app/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist-app/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist-app/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist-app/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist-app/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist-app/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist-app/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist-app/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist-app/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist-app/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist-app/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist-app/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist-app/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist-app/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist-app/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist-app/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist-app/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist-app/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist-app/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist-app/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist-app/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist-app/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist-app/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist-app/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist-app/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist-app/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist-app/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist-app/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist-app/assets/canonical-DbPqsMYz.js +2 -0
- package/dist-app/assets/canvas-record-C1A8ExlM.js +1 -0
- package/dist-app/assets/claude-code-session-DQRgWy00.js +7 -0
- package/dist-app/assets/codex-session--KVj3_vb.js +12 -0
- package/dist-app/assets/dsh-session-6OCSm4h5.js +6 -0
- package/dist-app/assets/experiment-loop-BfxITu2e.js +2 -0
- package/dist-app/assets/index-6m02Pb4Q.js +761 -0
- package/dist-app/assets/index-BH-U0zVI.js +105 -0
- package/dist-app/assets/index-BL39OXsY.js +221 -0
- package/dist-app/assets/index-BeoRn2gJ.js +2 -0
- package/dist-app/assets/index-D-BTv0n0.js +3 -0
- package/dist-app/assets/index-DEHbIrRr.css +1 -0
- package/dist-app/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist-app/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist-app/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist-app/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist-app/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist-app/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist-app/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist-app/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist-app/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist-app/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist-app/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist-app/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist-app/assets/live-mirror-BElcCk_a.js +2 -0
- package/dist-app/assets/pdf-gh-BrLFn.js +12 -0
- package/dist-app/assets/pdf.worker.min-C_APr3k7.js +1 -0
- package/dist-app/assets/pdf.worker.min-yatZIOMy.mjs +21 -0
- package/dist-app/assets/purify.es-Cz4mVeUR.js +3 -0
- package/dist-app/assets/sensitive-scan-L0rFzufE.js +7 -0
- package/dist-app/assets/session-handoff-CGrowwZp.js +2 -0
- package/dist-app/assets/shared-CURSZnXt.js +10 -0
- package/dist-app/assets/turndown-plugin-gfm.cjs-p3SpZgsj.js +22 -0
- package/dist-app/assets/turndown.browser.es-kLzRgxYD.js +61 -0
- package/dist-app/assets/update-check-D5daO3Cz.js +1 -0
- package/dist-app/favicon.svg +10 -0
- package/dist-app/index.html +31 -0
- package/dist-app/logo-social.png +0 -0
- package/dist-app/logo-social.svg +52 -0
- package/dist-app/og-twitter.jpg +0 -0
- package/dist-app/og.jpg +0 -0
- package/dist-app/robots.txt +4 -0
- package/dist-app/sitemap.xml +6 -0
- package/dist-app/tutorial/map-en.gif +0 -0
- package/dist-app/tutorial/map-zh.gif +0 -0
- package/dist-app/tutorial/prune-en.gif +0 -0
- package/dist-app/tutorial/prune-zh.gif +0 -0
- package/dist-app/tutorial/reading-en.gif +0 -0
- package/dist-app/tutorial/reading-zh.gif +0 -0
- package/dist-app/tutorial/ref-en.gif +0 -0
- package/dist-app/tutorial/ref-zh.gif +0 -0
- package/lib/client.js +84 -0
- package/lib/index.js +845 -0
- package/package.json +107 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import{A as me}from"./index-6m02Pb4Q.js";function fe(Ot,Bt){for(var $t=0;$t<Bt.length;$t++){const xt=Bt[$t];if(typeof xt!="string"&&!Array.isArray(xt)){for(const Tt in xt)if(Tt!=="default"&&!(Tt in Ot)){const qt=Object.getOwnPropertyDescriptor(xt,Tt);qt&&Object.defineProperty(Ot,Tt,qt.get?qt:{enumerable:!0,get:()=>xt[Tt]})}}}return Object.freeze(Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"}))}var Dt={exports:{}},pe=Dt.exports,ne;function ge(){return ne||(ne=1,(function(Ot,Bt){(function($t,xt){Ot.exports=xt()})(Object(typeof self<"u"?self:pe),(()=>(()=>{var $t={2640(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.TW_ARBITRARY_RE=w.TW_SPECIAL_CLASS_RE=w.TW_COLOR_CLASS_RE=w.TAILWIND_SPECIAL=w.TAILWIND_COLORS=w.ALLOWED_ATTRIBUTES_DEBUG=w.ALLOWED_ATTRIBUTES=w.ALLOWED_EMPTY_ELEMENTS=w.FOOTNOTE_LIST_SELECTORS=w.FOOTNOTE_INLINE_REFERENCES=w.TEST_ATTRIBUTES_SELECTOR=w.PARTIAL_SELECTORS_ANCHORED_REGEX=w.PARTIAL_SELECTORS_REGEX=w.PARTIAL_SELECTORS=w.TEST_ATTRIBUTES=w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS=w.HIDDEN_EXACT_SKIP_SELECTOR=w.HIDDEN_EXACT_SELECTOR=w.CONTENT_ELEMENT_SELECTOR=w.INLINE_ELEMENTS=w.PRESERVE_ELEMENTS=w.BLOCK_LEVEL_ELEMENTS=w.BLOCK_ELEMENTS_SET=w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS=w.MOBILE_WIDTH=w.ENTRY_POINT_ELEMENTS=void 0,w.ENTRY_POINT_ELEMENTS=["#post",".post-content",".post-body",".article-content","#article-content",".js-article-content",".article_post",".article-wrapper",".entry-content",".content-article",".instapaper_body",".post",".markdown-body","article",'[role="article"]',"main",'[role="main"]',".article-body","#content","body"],w.MOBILE_WIDTH=600,w.BLOCK_ELEMENTS=["div","section","article","main","aside","header","footer","nav","content"],w.BLOCK_ELEMENTS_SELECTOR=w.BLOCK_ELEMENTS.join(","),w.BLOCK_ELEMENTS_SET=new Set(w.BLOCK_ELEMENTS),w.BLOCK_LEVEL_ELEMENTS=new Set([...w.BLOCK_ELEMENTS,"p","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","pre","blockquote","figure","figcaption","table","thead","tbody","tfoot","tr","td","th","details","summary","address","hr","form","fieldset"]),w.PRESERVE_ELEMENTS=new Set(["pre","code","table","thead","tbody","tr","td","th","ul","ol","li","dl","dt","dd","figure","figcaption","picture","details","summary","blockquote","form","fieldset"]),w.INLINE_ELEMENTS=new Set(["a","span","strong","em","i","b","u","code","br","small","sub","sup","mark","date","del","ins","q","abbr","cite","relative-time","time","font"]),w.CONTENT_ELEMENT_SELECTOR=["math","[data-mathml]",".katex",".katex-mathml",".katex-display",".MathJax",".MathJax_Display",".MathJax_SVG","mjx-container","pre","code","table","img","picture","video","blockquote","figure"].join(", ");const I=["[hidden]",'[aria-hidden="true"]',".hidden",".invisible"],P=I.map((L=>L==='[aria-hidden="true"]'?'[aria-hidden="true"]:not([class*="math"]):not(svg):not([class*="paywall"])':L));w.HIDDEN_EXACT_SELECTOR=P.join(","),w.HIDDEN_EXACT_SKIP_SELECTOR=I.join(","),w.EXACT_SELECTORS=["noscript",'script:not([type^="math/"])',"style","meta","link","audio:not([src]):not(:has(source))","video:not([src]):not(:has(source))",".jwplayer",'.ad:not([class*="gradient"])','[class^="ad-" i]','[class$="-ad" i]',"[data-ad-wrapper]",'[id^="ad-" i]','[id$="-ad" i]','[role="banner" i]','[alt*="advert" i]',".promo",".Promo","#barrier-page",".alert",'[rel="sponsored" i]','[href*="source=promotion" i]','[id="comments" i]','[id="comment" i]','div[class*="cover-"]','div[id*="cover-"]',"ads-breadcrumbs","header:not(:has(p + p)):not(:has(img))",'header[class~="fixed"]','header[class~="sticky"]',".header:not(.banner)","#header","#Header","#banner","#Banner","nav",".navigation","#navigation",'[role="navigation" i]','[role="dialog" i]','[role="alertdialog" i]','[role*="complementary" i]','[class*="pagination" i]',".menu","#siteSub",".previous",".author",".Author",'[class$="_bio"]',"#categories",".contributor",".date","#date","[data-date]",".entry-meta",".meta",".tags","#tags",'[rel="tag"]',".headline","#headline","#title","#Title","#articleTag",'[href*="/author/"]','[href*="/author?"]','[href$="/author"]','a[href*="copyright.com"]','a[href*="google.com/preferences"]','[href="#top"]','[href="#Top"]','[href="#page-header"]','[href="#content"]','[href="#site-content"]','[href="#main-content"]','[href^="#main"]','[src*="author"]',".toc",".Toc","#toc",'[href*="#toc"]',"footer",".aside",'aside:not([class*="callout"])',"button","canvas","date","dialog","fieldset","form",'input:not([type="checkbox"])','input[type="checkbox"][class*="sidebar" i]','input[type="checkbox"][id*="sidebar" i]','input[type="checkbox"][class*="drawer" i]','input[type="checkbox"][id*="drawer" i]','input[type="checkbox"][class*="hamburger" i]','input[type="checkbox"][id*="hamburger" i]','input[type="checkbox"][class*="toggle" i]','input[type="checkbox"][id*="toggle" i]','input[type="checkbox"][class*="trigger" i]','input[type="checkbox"][id*="trigger" i]',"label","option","select",'[role="listbox"]','[role="option"]',"textarea",...P,"instaread-player","iframe:not([src])",'iframe[src*="blink.net"]','iframe[src*="giscus.app"]','iframe[src*="tinypass.com"]','iframe[src*="trinitymedia.ai"]','[class="logo" i]',"#logo","#Logo","#newsletter","#Newsletter",".subscribe",'[data-component-name="ButtonCreateButton"]','[data-component-name="DigestPostEmbed"]','[data-component-name="SubscribeWidgetToDOM"]','[class*="digestPostEmbed"]',".noprint",'[data-print-layout="hide" i]','[data-block="donotprint" i]','[class*="clickable-icon" i]','li span[class*="ltx_tag" i][class*="ltx_tag_item" i]','a[href^="#"][class*="anchor" i]','a[href^="#"][class*="ref" i]:not(.ltx_ref):not(.footnote-backref)','[data-container*="most-viewed" i]',".sidebar",".Sidebar","#sidebar","#Sidebar","#side-bar","#secondary","#sitesub",'[href*="/sitemap/sitemap.xml"]','[data-link-name*="skip" i]','[aria-label*="skip" i]','[title^="Share on" i]','[aria-label="Dismiss" i]','[aria-label="Close" i]',"svg[data-icon]",'[data-testid="load-more-posts"] + div',".copyright","#copyright",".licensebox","#page-info","#rss","#feed",".gutter","#primaryaudio","#NYT_ABOVE_MAIN_CONTENT_REGION",'[data-testid="photoviewer-children-figure"] > span',"table.infobox",'[data-optimizely="related-articles-section" i]','[data-orientation="vertical"]',".gh-header-sticky",'[data-testid="issue-metadata-sticky"]'],w.EXACT_SELECTORS_JOINED=w.EXACT_SELECTORS.join(","),w.TEST_ATTRIBUTES=["class","id","data-component","data-test","data-testid","data-test-id","data-qa","data-cy"],w.PARTIAL_SELECTORS=["a-statement","(?<!main-)access-wall","activitypub","actioncall","addcomment","addtoany","advert","adlayout","ad-tldr","ad-placement","adplacehold","ads-container","_ad_","AdBlock_","AdUnit","after_content","after_main_article","afterpost","allterms","-alert-","alert-box","_archive","around-the-web","aroundpages","article-author","article-badges","article-banner","article-bottom-section","article-bottom","article-category","article-card","article-citation","article-continues","article__copy","article_date","article-date","article-end ","article_header","article-header","article__header","article__hero","article__info","article-info","article-meta","article_meta","article__meta","articlename","article-subject","article_subject","article-snippet","article-separator","article--share","article-share","article--topics","article-tools","articletags","article-tags","article_tags","articletitle","article-title","article_title","articletopics","article-topics","article-actions","article--lede","articlewell","associated-people","ambient-video__button","audio-card","beyondwords","about-author","author-bio","author-box","author-info","author_info","authorm","author-mini-bio","author-name","author-publish-info","authored-by","avatar","back-to-top","backlink_container","backlinks-section","bio-block","biobox","blog-pager","bookmark-","-bookmark","bottominfo","bottomnav","bottom-of-article","bottom-wrapper","brand-bar","bcrumb","breadcrumb","brdcrumb","crumbs","bubblewrapper","button-wrapper","buttons-container","btn-","-btn","byline","captcha","card-text","card-media","card-post","carouselcontainer","carousel-container","cat_header","cat-overlay","catlinks","_categories","card-author","card-content","chapter-list","collections","comments","-comment\\b","commentbox","comment-button","commentcomp","comment-content","comment-count","comment-form","comment-number","comment-respond","comment-thread","comment-wrap","complementary","consent","contact-","contactus","cookie.law","content-card","copycontent","copy-tooltip","content-topics","contentpromo","context-bar","context-widget","core-collateral","cover-image","cover-photo","cover-wrap","created-date","creative-commons_","c-subscribe","_cta","-cta","cta-","cta_","current-issue","custom-list-number","dateline","dateheader","date-header","date-pub","disclaimer","disclosure","discussion","discuss_","-dismiss","disqus","donate","donation","dropdown","editorial_contact","editorial-contact","element-invisible","elementor-shortcode","eletters","emailsignup","emoji-bar","engagement-widget","enhancement-","entry-author-info","entry-categories","entry-date","entry-title","entry-utility","-error","error-","eyebrow","expand-reduce","external-anchor","externallinkembedwrapper","extra-services","extra-title","facebook","fancy-box","favorite","featured-content","feature_feed","feedback","feed-links","field-site-sections","filed","fixheader","floating-vid","follower","footer","footnote-back","footnoteback","form-group","for-you","frontmatter","further-reading","fullbleedheader","gallery-count","gated-popup","gh-feed","gist-meta","goog-","graph-view","hamburger","hawk-","header-pattern","hero[_\\-a-z]","hide-for-print","hide-print","hide-when-no-script","hidden-print","hidden-sidenote","hidden-accessibility","home-link","icon-sidebar","inarticle-ad","infoline","inline-topic","instacartIntegration","interlude","interaction","itemendrow","intro-date","invisible","jp-no-solution","jp-relatedposts","jswarning","js-warning","jumplink","jumpto","jump-to-","js-skip-to-content","keepreading","keep-reading","keep_reading","keyword_wrap","kicker","labstab","-labels","language-name","lastupdated","latest-content","-ledes-","-license","license-","lightbox-popup","like-button","link-box","links-grid","links-title","listing-dynamic-terms","list-tags","live-blog-header-live-label","listinks","loading","loa-info","logo","ltx_role_refnum","ltx_tag_bibitem","ltx_error","masthead","marketing","media-inquiry","-menu","menu-","metadata","meta-bottom","meta-date","meta-row","might-like","minibio","more-about","mod-paywall","_modal","-modal","more-","morenews","morestories","more_wrapper","most-read","move-helper","mw-editsection","mw-cite-backlink","mw-indicators","mw-jump-link","nav-","nav_","navigation-post","next-","next_prev","no-script","newsgallery","news-story-title","newsletter_","newsletterbanner","newslettercontainer","newsletter-form","newsletter-signup","newslettersignup","newsletterwidget","newsletterwrapper","not-found","notessection","nomobile","noprint","onward-journey","open-slideshow","originally-published","osano-cm","other-blogs","outline-view","pagefoot","pagehead","page-header","page-title","paywall_message","-partners","permission-","plea","popular","popup_links","pop_stories","pop-up","post__author","post-author","post-bottom","post__category","postcomment","postdate","post-date","post_date","post-details","post-feeds","postinfo","post-info","post_info","post-inline-date","post-links","postlist","post_list","post_meta","post-meta","postmeta","post_more","postnavi","post-navigation","postpath","post-preview","postsnippet","post_snippet","post-snippet","post-subject","posttax","post-tax","post_tax","posttag","post-tag","post_time","posttitle","post-title","post_title","post__title","post-ufi-button","prev-post","prevnext","prev_next","prev-next","previousnext","press-inquiries","print-none","print-header","print:hidden","privacy-notice","privacy-settings","profile","promo_article","promo-bar","promo-box","pubdate","pub_date","pub-date","publish_date","publish-date","publication-date","publicationName","qr-code","qr_code","quick_up","_rail","ratingssection","read_also","readmore","read-next","read_next","read_time","read-time","reading_time","reading-time","reading-list","recent-","recent-articles","recentpost","recent_post","recent-post","recommend","redirectedfrom","recirc","register","(?<!h[1-6]-)related","relevant","relposts","reversefootnote","rightcol","\\bnocontent\\b","_rss","rss-link","rubricwrapper","screen-reader-text","scroll_to","scroll-to","_search","-search","section-nav","series-banner","share-box","sharedaddy","share-icons","sharelinks","share-links","share-post","share-print","share-section","share-text","sharing_","shariff-","shortcode-id","show-for-print","sidebartitle","sidebar-content","sidebar-wrapper","sideitems","sidebar-author","sidebar-item","side-box","sign-in-gate","similar-","similar_","similars-","site-index","site-header","siteheader","site-name","site-wordpress","skip-content","skip-to-content","skip-link","c-skip-link","_skip-link","-slider","slug-wrap","social-author","social-button","social-shar","social-date","speechify-ignore","speedbump","sponsor","springercitation","sr-only","_stats","sticky-social","story-date","story-navigation","storyreadtime","storysmall","storypublishdate","subject-label","submenu","-subscribe-","subscriber-drive","subscription-","_tags","tags__item","tag_list","tag-list","tag-module","takeaways","taxonomy","table-of-contents","tblc","tabs-","terminaltout","time-rubric","timestamp","time-read","time-to-read","tip_off","-ticker","tiptout","-tout-","toc-container","toggle-caption","tooltip-content","topbar","subnavbar","topic-authors","topic-footer","topic-list","topic-subnav","top-wrapper","tree-item","trending","trust-feat","trust-badge","trust-project","chakra-badge","twiblock","u-hide","upsell","vid_carousel","viewbottom","view-language","yarpp-related","visually-hidden","welcomebox","widget_pages","window__widget","w-form-done","w-form-fail"],w.PARTIAL_SELECTORS_REGEX=new RegExp(w.PARTIAL_SELECTORS.join("|"),"i"),w.PARTIAL_SELECTORS_ANCHORED_REGEX=new RegExp("^(?:"+w.PARTIAL_SELECTORS.join("|")+")$","i"),w.TEST_ATTRIBUTES_SELECTOR=w.TEST_ATTRIBUTES.map((L=>`[${L}]`)).join(","),w.FOOTNOTE_INLINE_REFERENCES=["sup.reference","cite.ltx_cite",'sup[id^="fnr"]','span[id^="fnr"]','span[class*="footnote_ref"]','span[class*="footnote-ref"]',"span.footnote-link","a.citation",'a[id^="ref-link"]','a[href^="#fn"]','a[href^="#cite"]','a[href^="#reference"]','a[href^="#footnote"]','a[href^="#r"]','a[href^="#b"]','a[href*="cite_note"]','a[href*="cite_ref"]',"a.footnote-anchor","span.footnote-hovercard-target a",'a[role="doc-biblioref"]','a[id^="fnref"]','a[id^="ref-link"]',"sup.footnoteref","sup.footnote-reference",'sup[data-fn] > a[href^="#"]','sup[id^="ftnt_ref"] a[href^="#ftnt"]','span.easy-footnote > a[href^="#easy-footnote-bottom-"]','a.footnote[href^="#"]','a[data-type="noteref"]'].join(","),w.FOOTNOTE_LIST_SELECTORS=["div.footnote ol","div.footnotes ol",'div[role="doc-endnotes"]','div[role="doc-footnotes"]',"ol.footnotes-list","ol.footnotes","ol.references",'ol[class*="article-references"]',"section.footnotes ol",'section[role="doc-endnotes"]','section[role="doc-footnotes"]','section[role="doc-bibliography"]',"ul.footnotes-list","ul.ltx_biblist",'div.footnote[data-component-name="FootnoteToDOM"]',"div.footnotes-footer","div.footnote-definitions","div.footnote-definition","ol.wp-block-footnotes","ol.easy-footnotes-wrapper","div.footnotes-segment","#footnotes"].join(","),w.ALLOWED_EMPTY_ELEMENTS=new Set(["area","audio","base","br","circle","col","defs","ellipse","embed","figure","g","hr","iframe","img","input","line","link","mask","meta","object","param","path","pattern","picture","polygon","polyline","rect","source","stop","svg","td","th","track","use","video","wbr"]),w.ALLOWED_ATTRIBUTES=new Set(["alt","allow","allowfullscreen","aria-label","checked","colspan","controls","data-latex","data-src","data-srcset","data-callout","data-callout-fold","data-callout-title","data-lang","dir","display","frameborder","headers","height","href","kind","label","lang","role","rowspan","sandbox","src","srclang","srcset","start","title","type","width","accent","accentunder","align","columnalign","columnlines","columnspacing","columnspan","data-mjx-texclass","depth","displaystyle","fence","frame","framespacing","linethickness","lspace","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","rowalign","rowlines","rowspacing","rowspan","rspace","scriptlevel","separator","stretchy","symmetric","voffset","xmlns"]),w.ALLOWED_ATTRIBUTES_DEBUG=new Set(["class","id"]),w.TAILWIND_COLORS={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},w.TAILWIND_SPECIAL={black:"#000",white:"#fff",transparent:"transparent",current:"currentColor"},w.TW_COLOR_CLASS_RE=/^(fill|stroke)-([a-z]+)-(\d{2,3})(?:\/(\d+))?$/,w.TW_SPECIAL_CLASS_RE=/^(fill|stroke)-(black|white|transparent|current)$/,w.TW_ARBITRARY_RE=/^text-\[(.+)\]$/},4467(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.findContentStart=function s(i,c){const f=(function(y,a){const d=(0,P.normalizeText)(a);if(!d)return null;const p=y.querySelectorAll("h1, h2");for(const x of p)if((0,P.normalizeText)(x.textContent||"")===d)return x;return null})(i,c)||null,u=i.ownerDocument.createTreeWalker(i,1);f&&(u.currentNode=f);let h=null,b=null,g=u.nextNode();for(;g;){const y=g;if(o(y)){if(t.has(y.tagName)){h=y;break}b||(b=y)}g=u.nextNode()}if(h)return h;if(b){let y=b;for(;;){let a=null,d=!1;for(const p of y.children)if(o(p)){if(a){d=!0;break}a=p}if(!a||d)break;y=a}return y}return f?s(i,""):null},w.isAboveContentStart=function(s,i){if(!i||s===i)return!1;const c=s.compareDocumentPosition(i);return!(1&c)&&!!(4&c)};const P=I(2552),L=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,_=/^by\s+\S/i,A=/[.!?]/,S=/\b(?:isHidden(?:-[A-Za-z0-9_]+)?|is-hidden)\b/,n=new Set(["P","DIV","SECTION","ARTICLE","BLOCKQUOTE","FONT"]),t=new Set(["P","BLOCKQUOTE","FONT"]),r='[role="dialog"], [role="alertdialog"]',e=`aside, nav, header, footer, form, ${r}`;function o(s){if(!s.tagName||!n.has(s.tagName)||s.closest(e))return!1;const i=typeof s.className=="string"?s.className:"";if(S.test(i)||s.querySelector(r)||s.querySelector("script, style"))return!1;const c=(s.textContent||"").trim();if(!c)return!1;const f=(0,P.countWords)(c);return!(f<7)&&!!A.test(c)&&!(_.test(c)&&f<15)&&!(L.test(c)&&f<20)&&!((function(u){let h=0;for(const b of u.querySelectorAll("a"))h+=(b.textContent||"").length;return h})(s)>.7*c.length)&&!(s.tagName==="DIV"&&!s.querySelector("p"))}},5628(at,w,I){var P=this&&this.__awaiter||function(y,a,d,p){return new(d||(d=Promise))((function(x,l){function m(q){try{E(p.next(q))}catch(C){l(C)}}function v(q){try{E(p.throw(q))}catch(C){l(C)}}function E(q){var C;q.done?x(q.value):(C=q.value,C instanceof d?C:new d((function(N){N(C)}))).then(m,v)}E((p=p.apply(y,a||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.Defuddle=void 0;const L=I(1608),_=I(1917),A=I(2640),S=I(4840),n=I(3610),t=I(7726),r=I(3550),e=I(2408),o=I(8983),s=I(7393),i=I(3172),c=I(662),f=I(2552),u=I(639),h=new Set(["title","author","published","site","description","image","language"]),b=/[:\[\]()#>~+,]/;class g{constructor(a,d={}){this._schemaOrgData=void 0,this._schemaOrgExtracted=!1,this._inExtractorPipelineRun=!1,this.doc=a,this.options=d,this.debug=d.debug||!1}getSchemaOrgData(){return this._schemaOrgExtracted||(this._schemaOrgData=this._extractSchemaOrgData(this.doc),this._schemaOrgExtracted=!0),this._schemaOrgData}parse(){this.doc.body&&(this._normalizeAttributes(this.doc.body),this._resolveNoscriptImages(this.doc.body));let a=this.parseInternal();if(a.wordCount<200){this._log("Initial parse returned very little content, trying again");const p=this.parseInternal({removePartialSelectors:!1});p.wordCount>2*a.wordCount&&(this._log("Retry produced more content"),a=p)}if(a.wordCount<50){this._log("Still very little content, retrying without hidden-element removal");const p=this.parseInternal({removeHiddenElements:!1});p.wordCount>2*a.wordCount&&(this._log("Hidden-element retry produced more content"),a=p);const x=this.findLargestHiddenContentSelector();if(x){this._log("Retrying with hidden content selector:",x);const l=this.parseInternal({removeHiddenElements:!1,removePartialSelectors:!1,contentSelector:x});(l.wordCount>a.wordCount||l.wordCount>Math.max(20,.7*a.wordCount)&&l.content.length<a.content.length)&&(this._log("Hidden-selector retry produced better focused content"),a=l)}}if(a.wordCount<50){this._log("Still very little content, retrying without scoring/partial selectors (possible index page)");const p=this.parseInternal({removeLowScoring:!1,removePartialSelectors:!1,removeContentPatterns:!1});p.wordCount>a.wordCount&&(this._log("Index page retry produced more content"),a=p)}const d=this._getSchemaText(a.schemaOrgData);if(d&&this.countHtmlWords(d)>1.5*a.wordCount){const p=this.doc,x=p.cloneNode(!0);this._stripUnsafeElements(x.body),this.doc=x;try{const l=this._findElementBySchemaText(this.doc.body,d);if(l){const m=this.getElementSelector(l);this._log("Schema.org suggests a better content element, retrying with selector:",m),a=this.parseInternal({contentSelector:m})}else this._log("Using schema.org text as content (DOM element not found)"),a.content=d,a.wordCount=this.countHtmlWords(d)}finally{this.doc=p}}return a}_getSchemaText(a,d=0){if(!a||d>10)return"";const p=Array.isArray(a)?a:[a];for(const x of p)if(Array.isArray(x)){const l=this._getSchemaText(x,d+1);if(l)return l}else{if(x?.text&&typeof x.text=="string")return x.text;if(x?.articleBody&&typeof x.articleBody=="string")return x.articleBody;if(x?.["@graph"]&&Array.isArray(x["@graph"])){const l=this._getSchemaText(x["@graph"],d+1);if(l)return l}}return""}_serializeFallbackBody(){if(!this.doc.body)return"";const a=this.doc.body.cloneNode(!0);return this._stripUnsafeElements(a),this.resolveContentUrls((0,u.serializeHTML)(a))}_stripUnsafeElements(a){if(!a)return;const d=a.querySelectorAll('script:not([type^="math/"]), style, noscript, frame, frameset, object, embed, applet, base');for(const x of d)x.remove();const p=[a,...Array.from(a.querySelectorAll("*"))];for(const x of p)for(const l of Array.from(x.attributes)){const m=l.name.toLowerCase();if(m.startsWith("on"))x.removeAttribute(l.name);else if(m==="srcdoc")x.removeAttribute(l.name);else if(["href","src","action","formaction","xlink:href"].includes(m)){const v=!(m==="src"&&x.tagName==="IFRAME");(0,u.isDangerousUrl)(l.value,v)&&x.removeAttribute(l.name)}}}_deduplicateImages(a){for(const p of a.querySelectorAll("figure")){const x=Array.from(p.querySelectorAll("img")).filter((m=>!m.closest("noscript")&&m.parentElement));if(x.length<2)continue;const l=new Map;for(const m of x){const v=m.getAttribute("src")||"";if(!v||v.startsWith("data:"))continue;const E=(m.getAttribute("alt")||"").trim()||null,q=l.get(E)||[];q.push(m),l.set(E,q)}for(const[m,v]of l)v.length<2||m!==null&&v.every((E=>E.getAttribute("src")===v[0].getAttribute("src")))||this._keepBestImage(v)}const d=Array.from(a.querySelectorAll("img"));for(let p=0;p<d.length-1;p++){const x=d[p];if(!x.parentElement||x.closest("noscript")||x.closest("figure"))continue;const l=(x.getAttribute("alt")||"").trim();if(!l)continue;const m=x.getAttribute("src")||"";if(!m||m.startsWith("data:"))continue;const v=d[p+1];if(!v.parentElement||v.closest("noscript")||v.closest("figure")||(v.getAttribute("alt")||"").trim()!==l)continue;const E=v.getAttribute("src")||"";E&&!E.startsWith("data:")&&E!==m&&this._noVisibleContentBetween(x,v)&&this._keepBestImage([x,v])}for(const p of Array.from(a.querySelectorAll("img"))){if(!p.parentElement||p.closest("a, figure, noscript"))continue;const x=p.getAttribute("src")||"";if(!x||x.startsWith("data:"))continue;const l=p.parentElement,m=this._normalizeSrc(x);for(const v of l.querySelectorAll(":scope > a[href]")){if(!v.querySelector("img"))continue;const E=v.getAttribute("href")||"";if(m===this._normalizeSrc(E)){p.remove();break}}}}_keepBestImage(a){let d=a[0];for(let p=1;p<a.length;p++){const x=this._pickBestImage(d,a[p]);(x===d?a[p]:d).remove(),d=x}}_noVisibleContentBetween(a,d){const p=x=>{if(!x)return null;if(x.firstChild)return x.firstChild;let l=x;for(;l;){if(l.nextSibling)return l.nextSibling;l=l.parentNode}return null};for(let x=p(a);x&&x!==d;x=p(x))if(x.nodeType===3&&(x.textContent||"").trim())return!1;return!0}_normalizeSrc(a){return a.replace(/^https?:\/\//,"").split("?")[0]}_removeCoverImage(a,d){if(!d)return;const p=this._normalizeSrc(d);for(const x of a.querySelectorAll("img")){const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:")||this._normalizeSrc(l)!==p)continue;const m=this._getLargestImageSrc(x),v=x.closest("figure");return v&&v.querySelector("figcaption")||x.remove(),m}}_pickBestImage(a,d){const p=a.getAttribute("srcset")?2:a.closest("picture")?1:0,x=d.getAttribute("srcset")?2:d.closest("picture")?1:0;if(p!==x)return p>x?a:d;const l=g._urlWidth(a),m=g._urlWidth(d);return l!==m?l>m?a:d:a}static _urlWidth(a){const d=(a.getAttribute("src")||"").match(g._urlWidthPattern);return d?parseInt(d[1],10):0}_normalizeAttributes(a){const d=[["srcSet","srcset"]],p=a.querySelectorAll("img, source");for(const x of p)for(const[l,m]of d){const v=x.getAttribute(l);v!==null&&(x.removeAttribute(l),x.setAttribute(m,v))}}_resolveNoscriptImages(a){const d=a.querySelectorAll("noscript");for(const p of d){let x=p.querySelector("img");if(!x){let C=p.innerHTML||"";if(C.includes("<img")||(C=p.textContent||""),!C.includes("<img"))continue;x=(0,u.parseHTML)(this.doc,C).querySelector("img")}if(!x)continue;const l=x.getAttribute("src")||"";if(!l||l.startsWith("data:"))continue;const m=x.getAttribute("alt"),v=p.parentElement;if(!v)continue;let E=!1;const q=v.querySelectorAll(":scope > img");for(const C of q){if(!(C.getAttribute("src")||"").startsWith("data:")||!m||C.getAttribute("alt")!==m)continue;C.setAttribute("src",l);const N=x.getAttribute("srcset")||"";N&&C.setAttribute("srcset",N),E=!0;break}if(!E&&this._isLazyImageContext(p)){const C=(p.closest("figure")||v).querySelectorAll("img");let N=!1;for(const O of C){if(O.closest("noscript"))continue;const T=O.getAttribute("src")||"";if(T&&!T.startsWith("data:")){N=!0;break}}if(!N){const O=x.cloneNode(!0);v.insertBefore(O,p)}}}}_isLazyImageContext(a){if(a.closest("figure"))return!0;const d=a.parentElement;if(d){for(const x of d.children)if(x!==a&&(0,u.getClassName)(x).toLowerCase().includes("lazy"))return!0;const p=(0,u.getClassName)(d).toLowerCase();if(p.includes("image")||p.includes("img")||p.includes("picture")||p.includes("photo")||p.includes("media"))return!0}return!1}_findElementBySchemaText(a,d){var p;const x=(((p=d.split(/\n\s*\n/)[0])===null||p===void 0?void 0:p.trim())||"").substring(0,100).trim();if(!x)return null;const l=(0,f.countWords)(d);let m=null,v=1/0;const E=a.querySelectorAll("*");for(const q of E){if(q===a)continue;const C=q.textContent||"";if(!C.includes(x))continue;const N=(0,f.countWords)(C);N>=.8*l&&N<v&&(v=N,m=q)}return m}findLargestHiddenContentSelector(){const a=this.doc.body;if(!a)return;const d=Array.from(a.querySelectorAll(A.HIDDEN_EXACT_SKIP_SELECTOR)).filter((l=>!(l.getAttribute("class")||"").includes("math")));let p=null,x=0;for(const l of d){const m=(0,f.countWords)(l.textContent||"");m>x&&(p=l,x=m)}return!p||x<30?void 0:this.getElementSelector(p)}_getLargestImageSrc(a){const d=a.getAttribute("srcset")||"";if(!d)return a.getAttribute("src")||"";const p=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let x,l="",m=0,v=0;for(;(x=p.exec(d))!==null;){let q=x[1].trim();v>0&&(q=q.replace(/^,\s*/,"")),v=p.lastIndex;const C=parseFloat(x[2]);q&&C>m&&(m=C,l=q)}let E=l||a.getAttribute("src")||"";return E=E.replace(/,w_\d+/g,"").replace(/,c_\w+/g,""),E}parseAsync(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync!==!1){const p=yield this.tryAsyncExtractor(_.ExtractorRegistry.findPreferredAsyncExtractor.bind(_.ExtractorRegistry));if(p)return p}const d=this.parse();return d.wordCount>0||this.options.useAsync===!1?d:(a=yield this.tryAsyncExtractor(_.ExtractorRegistry.findAsyncExtractor.bind(_.ExtractorRegistry)))!==null&&a!==void 0?a:d}))}fetchAsyncVariables(){return P(this,void 0,void 0,(function*(){var a;if(this.options.useAsync===!1)return null;try{const d=this.options.url||this.doc.URL,p=this.getSchemaOrgData(),x={includeReplies:(a=this.options.includeReplies)!==null&&a!==void 0?a:"extractors",language:this.options.language,fetch:this.options.fetch},l=_.ExtractorRegistry.findPreferredAsyncExtractor(this.doc,d,p,x);if(l){const m=yield l.extractAsync();return this.getExtractorVariables(m.variables)||null}}catch(d){console.error("Defuddle","Error fetching async variables:",d)}return null}))}tryAsyncExtractor(a){return P(this,void 0,void 0,(function*(){var d;try{const p=this.options.url||this.doc.URL,x=this.getSchemaOrgData(),l={includeReplies:(d=this.options.includeReplies)!==null&&d!==void 0?d:"extractors",language:this.options.language,fetch:this.options.fetch},m=a(this.doc,p,x,l);if(m){const v=Date.now(),E=yield m.extractAsync(),q=this._collectMetaTags(),C=L.MetadataExtractor.extract(this.doc,x,q);return this.buildExtractorResponse(E,C,v,m,q)}}catch(p){console.error("Defuddle","Error in async extraction:",p)}return null}))}parseInternal(a={}){var d,p,x,l,m,v,E;const q=Date.now(),C={},N=(d=this.options.profile)!==null&&d!==void 0&&d,O=(W,B)=>{if(!N)return B();const H=performance.now(),k=B();return C[W]=Math.round(performance.now()-H),k};if(!this.doc.documentElement){const W=this.options.url||"";return{content:"",title:"",description:"",domain:W?new URL(W).hostname:"",favicon:"",image:"",language:"",parseTime:Date.now()-q,published:"",author:"",site:"",schemaOrgData:null,wordCount:0}}const T=Object.assign(Object.assign({removeExactSelectors:!0,removePartialSelectors:!0,removeHiddenElements:!0,removeLowScoring:!0,removeSmallImages:!0,removeContentPatterns:!0,standardize:!0,includeReplies:"extractors"},this.options),a),R=[],D=this.getSchemaOrgData();this._metaTags||(this._metaTags=this._collectMetaTags());const $=this._metaTags;this._metadata||(this._metadata=L.MetadataExtractor.extract(this.doc,D,$));const M=this._metadata;T.removeImages&&this.removeImages(this.doc);try{const W=T.url||this.doc.URL,B={includeReplies:T.includeReplies,language:T.language,fetch:T.fetch};if(!this._inExtractorPipelineRun){const K=_.ExtractorRegistry.findExtractor(this.doc,W,D,B);if(K&&K.canExtract()){const V=K.extract();if(V.contentSelector){this._inExtractorPipelineRun=!0;try{const X=this.parseInternal({contentSelector:V.contentSelector,removeLowScoring:!1,removeHiddenElements:!1}),Z=this.getExtractorVariables(V.variables);return Object.assign(Object.assign(Object.assign({},X),{title:((p=V.variables)===null||p===void 0?void 0:p.title)||X.title,description:((x=V.variables)===null||x===void 0?void 0:x.description)||X.description,author:((l=V.variables)===null||l===void 0?void 0:l.author)||X.author,published:((m=V.variables)===null||m===void 0?void 0:m.published)||X.published,site:((v=V.variables)===null||v===void 0?void 0:v.site)||X.site,language:((E=V.variables)===null||E===void 0?void 0:E.language)||X.language,extractorType:K.constructor.name.replace("Extractor","").toLowerCase()}),Z?{variables:Z}:{})}finally{this._inExtractorPipelineRun=!1}}return this.buildExtractorResponse(V,M,q,K,$)}}this._mobileStyles||(this._mobileStyles=this._evaluateMediaQueries(this.doc));const H=this._mobileStyles;this._smallImages||(this._smallImages=(0,e.findSmallImages)(this.doc,this.debug));const k=this._smallImages;let F;O("cloneDocument",(()=>{var K;F=this.doc.cloneNode(!0),(K=F.body)===null||K===void 0||K.normalize()})),O("flattenShadowRoots",(()=>this.flattenShadowRoots(this.doc,F))),O("resolveStreamedContent",(()=>this.resolveStreamedContent(F))),O("applyMobileStyles",(()=>this.applyMobileStyles(F,H)));const z=O("findMainContent",(()=>{let K=null;if(T.contentSelector&&(K=F.querySelector(T.contentSelector),this._log("Using contentSelector:",T.contentSelector,K?"found":"not found")),K||(K=this.findMainContent(F)),K){const V=K.closest("[data-defuddle]");V&&(K=V)}if(K&&K.tagName.toLowerCase()==="body"){const V=this._getSchemaText(D);if(V){const X=this._findElementBySchemaText(F.body,V);X&&(this._log("Found content element via schema.org text"),K=X)}}return K}));if(!z){const K=this._serializeFallbackBody(),V=Date.now();return Object.assign(Object.assign({content:K},M),{wordCount:this.countHtmlWords(K),parseTime:Math.round(V-q),metaTags:$})}O("removeMetadataBlock",(()=>{(M.published||M.author)&&(0,c.removeMetadataBlock)(z),z.querySelectorAll("wbr").forEach((K=>K.remove()))})),O("adoptExternalFootnotes",(()=>{T.standardize&&this.adoptExternalFootnotes(z,F)})),O("standardizeFootnotesCallouts",(()=>{T.standardize&&((0,n.standardizeFootnotes)(z),(0,t.standardizeCallouts)(z))})),O("removeSmallImages",(()=>{T.removeSmallImages&&(0,e.removeSmallImages)(F,k,this.debug)})),O("removeHiddenElements",(()=>{T.removeHiddenElements&&(0,o.removeHiddenElements)(F,this.debug,R)})),O("removeEyebrowLabel",(()=>{T.removeContentPatterns&&z&&(0,i.removeEyebrowLabel)(z,this.debug,R)})),O("removeBySelector",(()=>{(T.removeExactSelectors||T.removePartialSelectors)&&(0,s.removeBySelector)(F,this.debug,T.removeExactSelectors,T.removePartialSelectors,z,R,T.removeHiddenElements===!1)})),O("removeLowScoring",(()=>{T.removeLowScoring&&r.ContentScorer.scoreAndRemove(F,this.debug,R,z)})),O("removeByContentPattern",(()=>{if(T.removeContentPatterns&&z){const K=this.options.url||this.doc.URL||"";(0,i.removeByContentPattern)(z,this.debug,K,M.title||"",M.description||"",R)}})),O("standardizeContent",(()=>{T.standardize&&(0,S.standardizeContent)(z,M,this.doc,this.debug,N?C:void 0)})),O("resolveRelativeUrls",(()=>this.resolveRelativeUrls(z))),this._deduplicateImages(z);const Y=this._removeCoverImage(z,M.image||"");Y&&(M.image=Y),this._stripUnsafeElements(z);const ot=z.outerHTML,U=Date.now(),Q=Object.assign(Object.assign({content:ot},M),{wordCount:this.countHtmlWords(ot),parseTime:Math.round(U-q),metaTags:$});return this.debug&&(Q.debug={contentSelector:this.getElementSelector(z),removals:R}),this.options.profile&&(Q.profile=C),Q}catch(W){console.error("Defuddle","Error processing document:",W);const B=this._serializeFallbackBody(),H=Date.now();return Object.assign(Object.assign({content:B},M),{wordCount:this.countHtmlWords(B),parseTime:Math.round(H-q),metaTags:$})}}countHtmlWords(a){const d=a.replace(/<[^>]*>/g," ").replace(/ /gi," ").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/&#\d+;/g," ").replace(/&\w+;/g," ");return(0,f.countWords)(d)}_log(...a){this.debug&&console.log("Defuddle:",...a)}_evaluateMediaQueries(a){const d=[],p=/max-width[^:]*:\s*(\d+)/;try{if(!a.styleSheets)return d;Array.from(a.styleSheets).filter((l=>{try{return l.cssRules,!0}catch(m){return m instanceof DOMException&&m.name,!1}})).flatMap((l=>{try{return typeof CSSMediaRule>"u"?[]:Array.from(l.cssRules).filter((m=>m instanceof CSSMediaRule&&m.conditionText.includes("max-width")))}catch(m){return this.debug&&console.warn("Defuddle: Failed to process stylesheet:",m),[]}})).forEach((l=>{const m=l.conditionText.match(p);if(m){const v=parseInt(m[1]);A.MOBILE_WIDTH<=v&&Array.from(l.cssRules).filter((E=>E instanceof CSSStyleRule)).forEach((E=>{try{d.push({selector:E.selectorText,styles:E.style.cssText})}catch(q){this.debug&&console.warn("Defuddle: Failed to process CSS rule:",q)}}))}}))}catch(x){console.error("Defuddle: Error evaluating media queries:",x)}return d}applyMobileStyles(a,d){d.forEach((({selector:p,styles:x})=>{try{a.querySelectorAll(p).forEach((l=>{l.setAttribute("style",(l.getAttribute("style")||"")+x)}))}catch(l){console.error("Defuddle","Error applying styles for selector:",p,l)}}))}removeImages(a){const d=a.getElementsByTagName("img");Array.from(d).forEach((p=>{p.remove()}))}findMainContent(a){const d=[];if(A.ENTRY_POINT_ELEMENTS.forEach(((l,m)=>{a.querySelectorAll(l).forEach((v=>{let E=40*(A.ENTRY_POINT_ELEMENTS.length-m);E+=r.ContentScorer.scoreElement(v),d.push({element:v,score:E,selectorIndex:m})}))})),d.length===0)return this.findContentByScoring(a);if(d.sort(((l,m)=>m.score-l.score)),this.debug&&this._log("Content candidates:",d.map((l=>({element:l.element.tagName,selector:this.getElementSelector(l.element),score:l.score})))),d.length===1&&d[0].element.tagName.toLowerCase()==="body"){const l=this.findTableBasedContent(a);if(l)return l}const p=d[0];let x=p;for(let l=1;l<d.length;l++){const m=d[l],v=(0,f.countWords)(m.element.textContent||"");if(m.selectorIndex<x.selectorIndex&&x.element.contains(m.element)&&v>50){let E=0;for(const q of d)if(q.selectorIndex===m.selectorIndex&&p.element.contains(q.element)&&++E>1)break;if(E>1)continue;x=m}}return x!==p?x.element:p.element}findTableBasedContent(a){if(!Array.from(a.getElementsByTagName("table")).some((l=>{var m;const v=parseInt(l.getAttribute("width")||"0"),E=this.getComputedStyle(l),q=(0,u.getClassName)(l).toLowerCase();return v>400||((m=E?.width)===null||m===void 0?void 0:m.includes("px"))&&parseInt(E.width)>400||l.getAttribute("align")==="center"||q.includes("content")||q.includes("article")||Array.from(l.getElementsByTagName("tr")).some((C=>{const N=Array.from(C.children).filter((O=>O.tagName==="TD"));return N.length>=2&&N.some((O=>O.getAttribute("width")))}))})))return null;const p=Array.from(a.getElementsByTagName("td")),x=r.ContentScorer.findBestElement(p);return x?2*(0,f.countWords)(x.textContent||"")<(0,f.countWords)((a.body||a.documentElement).textContent||"")?null:x:null}findContentByScoring(a){const d=[];return a.querySelectorAll(A.BLOCK_ELEMENTS_SELECTOR).forEach((p=>{const x=r.ContentScorer.scoreElement(p);x>0&&d.push({score:x,element:p})})),d.length>0?d.sort(((p,x)=>x.score-p.score))[0].element:null}getElementSelector(a){const d=[];let p=a;for(;p&&p!==this.doc.documentElement;){let x=p.tagName.toLowerCase();if(p.id)x+="#"+p.id;else if((0,u.getClassName)(p)){const l=(0,u.getClassName)(p).trim().split(/\s+/).filter((m=>!b.test(m)));l.length&&(x+="."+l.join("."))}d.unshift(x),p=p.parentElement}return d.join(" > ")}getComputedStyle(a){return(0,f.getComputedStyle)(a)}adoptExternalFootnotes(a,d){const p=d.body||d;p&&a!==p&&p.querySelectorAll("div, section, aside").forEach((x=>{var l;const m=(0,u.getClassName)(x),v=x.id||"";if(!/footnote/i.test(m)&&!/footnote/i.test(v)||a.contains(x)||x.contains(a))return;const E=x.querySelector("h1, h2, h3, h4, h5, h6");E&&n.FOOTNOTE_SECTION_RE.test(((l=E.textContent)===null||l===void 0?void 0:l.trim())||"")&&a.appendChild(x)}))}resolveRelativeUrls(a){const d=this.options.url||this.doc.URL;if(!d)return;let p=d;const x=this.doc.querySelector("base[href]");if(x){const m=x.getAttribute("href");if(m)try{p=new URL(m,d).href}catch{}}const l=m=>{const v=m.trim().replace(/^\\?["']+/,"").replace(/\\?["']+$/,"");if(v.startsWith("#"))return v;try{return new URL(v,p).href}catch{return v||m}};a.querySelectorAll("[href]").forEach((m=>{const v=m.getAttribute("href");v&&m.setAttribute("href",l(v))})),a.querySelectorAll("[src]").forEach((m=>{const v=m.getAttribute("src");v&&m.setAttribute("src",l(v))})),a.querySelectorAll("[srcset]").forEach((m=>{const v=m.getAttribute("srcset");if(v){const E=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g,q=[];let C,N=0;for(;(C=E.exec(v))!==null;){let O=C[1].trim();N>0&&(O=O.replace(/^,\s*/,"")),N=E.lastIndex,q.push(`${l(O)} ${C[2]}`)}if(q.length>0)m.setAttribute("srcset",q.join(", "));else{const O=v.split(",").map((T=>{const R=T.trim().split(/\s+/);return R[0]&&(R[0]=l(R[0])),R.join(" ")})).join(", ");m.setAttribute("srcset",O)}}})),a.querySelectorAll("[poster]").forEach((m=>{const v=m.getAttribute("poster");v&&m.setAttribute("poster",l(v))}))}flattenShadowRoots(a,d){var p,x,l;if(!a.body||!d.body)return;const m=Array.from(a.body.querySelectorAll("*")),v=m.find((q=>q.shadowRoot));if(!v)return;const E=Array.from(d.body.querySelectorAll("*"));if(((l=(x=(p=v.shadowRoot)===null||p===void 0?void 0:p.childNodes)===null||x===void 0?void 0:x.length)!==null&&l!==void 0?l:0)>0)for(let q=m.length-1;q>=0;q--){const C=m[q];if(!C.shadowRoot)continue;const N=E[q];if(!N)continue;const O=C.shadowRoot.innerHTML;O.length>0&&this.replaceShadowHost(N,O,d)}else{const q=[];for(let C=0;C<m.length;C++){const N=m[C],O=N.getAttribute("data-defuddle-shadow");if(!O)continue;const T=E[C];T&&(q.push({cloneEl:T,html:O}),N.removeAttribute("data-defuddle-shadow"),T.removeAttribute("data-defuddle-shadow"))}for(const{cloneEl:C,html:N}of q)this.replaceShadowHost(C,N,d)}}resolveStreamedContent(a){const d=a.querySelectorAll("script"),p=[],x=/\$RC\("(B:\d+)","(S:\d+)"\)/g;for(const m of d){const v=m.textContent||"";if(!v.includes("$RC("))continue;let E;for(x.lastIndex=0;(E=x.exec(v))!==null;)p.push({templateId:E[1],contentId:E[2]})}if(p.length===0)return;let l=0;for(const{templateId:m,contentId:v}of p){const E=a.getElementById(m),q=a.getElementById(v);if(!E||!q)continue;const C=E.parentNode;if(!C)continue;let N=E.nextSibling,O=!1;for(;N;){const T=N.nextSibling;if(N.nodeType===8&&N.data==="/$"){N.remove(),O=!0;break}N.remove(),N=T}if(O){for(;q.firstChild;)C.insertBefore(q.firstChild,E);E.remove(),q.remove(),l++}}l>0&&this._log("Resolved streamed content:",l,"suspense boundaries")}replaceShadowHost(a,d,p){var x;const l=(0,u.parseHTML)(p,d);if(a.tagName.includes("-")){const m=p.createElement("div");m.appendChild(l),(x=a.parentNode)===null||x===void 0||x.replaceChild(m,a)}else a.textContent="",a.appendChild(l)}resolveContentUrls(a){if(!(this.options.url||this.doc.URL))return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}_extractSchemaOrgData(a){const d=a.querySelectorAll('script[type="application/ld+json"]'),p=[];d.forEach((l=>{let m=l.textContent||"";try{m=m.replace(/\/\*[\s\S]*?\*\/|^\s*\/\/.*$/gm,"").replace(/^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/,"$1").replace(/^\s*(\*\/|\/\*)\s*|\s*(\*\/|\/\*)\s*$/g,"").trim();const v=JSON.parse(m);v["@graph"]&&Array.isArray(v["@graph"])?p.push(...v["@graph"]):p.push(v)}catch(v){console.error("Defuddle: Error parsing schema.org data:",v),this.debug&&console.error("Defuddle: Problematic JSON content:",m)}}));const x=l=>{if(typeof l=="string")return this._decodeHTMLEntities(l);if(Array.isArray(l))return l.map(x);if(typeof l=="object"&&l!==null){const m={};for(const v in l)Object.prototype.hasOwnProperty.call(l,v)&&(m[v]=x(l[v]));return m}return l};return p.map(x)}_collectMetaTags(){const a=[];return this.doc.querySelectorAll("meta").forEach((d=>{const p=d.getAttribute("name"),x=d.getAttribute("property");let l=d.getAttribute("content");l&&a.push({name:p,property:x,content:this._decodeHTMLEntities(l)})})),a}_decodeHTMLEntities(a){return(0,u.decodeHTMLEntities)(this.doc,a)}buildExtractorResponse(a,d,p,x,l){var m,v,E,q,C,N;const O=this._sanitizeExtractorHtml(a.contentHtml),T=this.getExtractorVariables(a.variables);return Object.assign({content:O,title:((m=a.variables)===null||m===void 0?void 0:m.title)||d.title,description:((v=a.variables)===null||v===void 0?void 0:v.description)||d.description,domain:d.domain,favicon:d.favicon,image:d.image,language:((E=a.variables)===null||E===void 0?void 0:E.language)||d.language,published:((q=a.variables)===null||q===void 0?void 0:q.published)||d.published,author:((C=a.variables)===null||C===void 0?void 0:C.author)||d.author,site:((N=a.variables)===null||N===void 0?void 0:N.site)||d.site,schemaOrgData:d.schemaOrgData,wordCount:this.countHtmlWords(O),parseTime:Math.round(Date.now()-p),extractorType:x.constructor.name.replace("Extractor","").toLowerCase(),metaTags:l},T?{variables:T}:{})}_sanitizeExtractorHtml(a){if(!a)return a;const d=this.doc.createElement("div");return d.appendChild((0,u.parseHTML)(this.doc,a)),this._stripUnsafeElements(d),this.resolveRelativeUrls(d),(0,u.serializeHTML)(d)}getExtractorVariables(a){if(!a)return;const d={};let p=!1;for(const[x,l]of Object.entries(a))h.has(x)||(d[x]=l,p=!0);return p?d:void 0}}w.Defuddle=g,g._urlWidthPattern=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/},7726(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.standardizeCallouts=function(_){var A,S;const n=_.ownerDocument;if(!n)return;const t=Array.from(_.querySelectorAll(".callout.is-collapsed, .callout.is-collapsible"));for(const c of t){const f=c.classList.contains("is-collapsed");c.classList.remove("is-collapsed","is-collapsible"),c.hasAttribute("data-callout-fold")||c.setAttribute("data-callout-fold",f?"-":"+");const u=c.querySelector(".callout-fold");u&&u.remove();const h=c.querySelector(".callout-content");if(h){const b=h.getAttribute("style");if(b){const g=b.replace(/display\s*:\s*none\s*;?/gi,"").trim();g?h.setAttribute("style",g):h.removeAttribute("style")}}}const r=Array.from(_.querySelectorAll(".markdown-alert"));for(const c of r){const f=Array.from(c.classList).find((g=>g.startsWith("markdown-alert-")&&g!=="markdown-alert")),u=f?f.replace("markdown-alert-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".markdown-alert-title");b&&b.remove(),c.replaceWith(L(n,u,h,c))}const e=Array.from(_.querySelectorAll('aside[class*="callout"]'));for(const c of e){const f=Array.from(c.classList).find((g=>g.startsWith("callout-"))),u=f?f.replace("callout-",""):"note",h=u.charAt(0).toUpperCase()+u.slice(1),b=c.querySelector(".callout-content");c.replaceWith(L(n,u,h,b||c))}const o=new Set(["info","warning","note","tip","danger","caution","important","abstract","success","question","failure","bug","example","quote"]),s=Array.from(_.querySelectorAll(".admonition"));for(const c of s){if(c.getAttribute("data-callout"))continue;const f=Array.from(c.classList).find((g=>o.has(g)))||"note",u=c.querySelector(".admonition-title"),h=((A=u?.textContent)===null||A===void 0?void 0:A.trim())||f.charAt(0).toUpperCase()+f.slice(1);u&&u.remove();const b=c.querySelector(".admonition-content")||c.querySelector(".details-content")||c;c.replaceWith(L(n,f,h,b))}const i=Array.from(_.querySelectorAll('.alert[class*="alert-"]'));for(const c of i){const f=Array.from(c.classList).find((g=>g.startsWith("alert-")&&g!=="alert-dismissible")),u=f?f.replace("alert-",""):"note",h=c.querySelector(".alert-heading, .alert-title"),b=((S=h?.textContent)===null||S===void 0?void 0:S.trim())||u.charAt(0).toUpperCase()+u.slice(1);h&&h.remove(),c.replaceWith(L(n,u,b,c))}};const P=I(639);function L(_,A,S,n){const t=_.createElement("div");t.setAttribute("data-callout",A),t.className="callout";const r=_.createElement("div");r.className="callout-title";const e=_.createElement("div");e.className="callout-title-inner",e.textContent=S,r.appendChild(e),t.appendChild(r);const o=_.createElement("div");return o.className="callout-content",(0,P.transferContent)(n,o),t.appendChild(o),t}},754(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.codeBlockRules=void 0;const P=I(2552),L=[/^language-(\w+)$/,/^lang-(\w+)$/,/^(\w+)-code$/,/^code-(\w+)$/,/^syntax-(\w+)$/,/^code-snippet__(\w+)$/,/^highlight-(\w+)$/,/^(\w+)-snippet$/,/(?:^|\s)(?:language|lang|brush|syntax)-(\w+)(?:\s|$)/i],_=new Set(["abap","actionscript","ada","adoc","agda","antlr4","applescript","arduino","armasm","asciidoc","aspnet","atom","bash","batch","c","clojure","cmake","cobol","coffeescript","cpp","c++","crystal","csharp","cs","dart","django","dockerfile","dotnet","elixir","elm","erlang","fortran","fsharp","gdscript","gitignore","glsl","golang","gradle","graphql","groovy","haskell","hs","haxe","hlsl","html","idris","java","javascript","js","jsx","jsdoc","json","jsonp","julia","kotlin","latex","lean","lean4","lisp","elisp","livescript","lua","makefile","markdown","md","markup","masm","mathml","matlab","mongodb","mysql","nasm","nginx","nim","nix","objc","ocaml","pascal","perl","php","postgresql","powershell","prolog","puppet","python","regex","rss","ruby","rb","rust","scala","scheme","shell","sh","solidity","sparql","sql","ssml","svg","swift","tcl","terraform","tex","toml","typescript","ts","tsx","unrealscript","verilog","vhdl","webassembly","wasm","xml","yaml","yml","zig"]);w.codeBlockRules=[{selector:["pre",'div[class*="prismjs"]',".syntaxhighlighter",".highlight",".highlight-source",".wp-block-syntaxhighlighter-code",".wp-block-code",'div[class*="language-"]',".code-block[data-lang]","code.hl.block"].join(", "),element:"pre",transform:(A,S)=>{var n;if(!(h=>"classList"in h&&"getAttribute"in h&&"querySelector"in h)(A))return A;A.querySelectorAll('button, [class*="codeblock-button"]').forEach((h=>h.remove())),A.querySelectorAll('[class*="header"], [class*="toolbar"], [class*="titlebar"], [class*="title-bar"]').forEach((h=>{var b;const g=h.tagName;if(g!=="DIV"&&g!=="SPAN")return;const y=(b=h.closest)===null||b===void 0?void 0:b.call(h,"[data-line], .line");if(y&&A.contains(y)||h.querySelector("[data-line], .line, pre"))return;const a=(h.textContent||"").trim();(0,P.countWords)(a)<=5&&h.remove()}));const t=h=>{var b;const g=h.getAttribute("data-lang")||h.getAttribute("data-language")||h.getAttribute("language");if(g)return g.toLowerCase();const y=Array.from(h.classList||[]);if(!((b=h.classList)===null||b===void 0)&&b.contains("syntaxhighlighter")){const a=y.find((d=>!["syntaxhighlighter","nogutter"].includes(d)));if(a&&_.has(a.toLowerCase()))return a.toLowerCase()}for(const a of y)for(const d of L){const p=a.toLowerCase().match(d);if(p&&p[1]&&_.has(p[1].toLowerCase()))return p[1].toLowerCase()}for(const a of y)if(_.has(a.toLowerCase()))return a.toLowerCase();return""};let r="",e=A;for(;e&&!r;){if(r=t(e),!r&&e===A){const h=e.querySelector('code[data-lang], code[class*="language-"]')||e.querySelector("code");h&&(r=t(h))}e=e.parentElement}const o=A.querySelector(".cm-content");if(o&&!r){const h=Array.from(A.querySelectorAll("div"));for(const b of h){if(b.contains(o))continue;const g=(b.textContent||"").trim().toLowerCase();if(g&&_.has(g)){r=g;break}}}const s=h=>{var b;if((0,P.isTextNode)(h))return!((b=h.parentElement)===null||b===void 0)&&b.querySelector("[data-line], .line")&&!(h.textContent||"").trim()?"":h.textContent||"";let g="";if((0,P.isElement)(h)){if(h.matches(".hover-info, .hover-container")||h.tagName==="BUTTON"||h.tagName==="STYLE")return"";if(h.tagName==="BR"){const y=h.previousElementSibling;return y&&y.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')?"":`
|
|
2
|
+
`}if(h.matches("span.lnt")||h.matches("span.lineno")||h.matches(".react-syntax-highlighter-line-number")||h.matches(".rouge-gutter"))return"";if((h.tagName==="DIV"||h.tagName==="SPAN")&&h.children.length===2){const y=(h.children[0].textContent||"").trim();if(/^\d+$/.test(y))return s(h.children[1]).replace(/\n$/,"")+`
|
|
3
|
+
`}if(h.matches('div[class*="line"], span[class*="line"], .ec-line, [data-line-number], [data-line]')){const y=h.querySelector('.code:not(.token), .content:not(.token), [class*="code-"], [class*="content-"]');if(y)return(y.textContent||"").replace(/\n$/,"")+`
|
|
4
|
+
`;const a=h.querySelector('.line-number, .gutter, [class*="line-number"], [class*="gutter"]');return a?Array.from(h.childNodes).filter((d=>!a.contains(d))).map((d=>s(d))).join("").replace(/\n$/,"")+`
|
|
5
|
+
`:(h.textContent||"").replace(/\n$/,"")+`
|
|
6
|
+
`}h.childNodes.forEach((y=>{g+=s(y)}))}return g};let i="";if(A.matches(".syntaxhighlighter, .wp-block-syntaxhighlighter-code")&&(i=(h=>{const b=h.querySelector(".syntaxhighlighter table .code .container");if(b)return Array.from(b.children).map((y=>Array.from(y.querySelectorAll("code")).map((d=>{var p;let x=d.textContent||"";return!((p=d.classList)===null||p===void 0)&&p.contains("spaces")&&(x=" ".repeat(x.length)),x})).join("")||y.textContent||"")).join(`
|
|
7
|
+
`);const g=h.querySelectorAll(".code .line");return g.length>0?Array.from(g).map((y=>Array.from(y.querySelectorAll("code")).map((d=>d.textContent||"")).join("")||y.textContent||"")).join(`
|
|
8
|
+
`):""})(A)),!i&&o)i=s(o);else if(!i){let h=A;if(A.tagName!=="PRE"&&A.tagName!=="CODE"){const b=Array.from(A.querySelectorAll("pre")),g=b.find((y=>y.querySelector('code[data-lang], code[class*="language-"], .line, [data-line]')))||b.find((y=>y.querySelector("span[class]")&&!y.classList.contains("lineno")));g&&(h=g)}i=s(h)}if(A.matches("code.hl.block"))i=i.replace(/^[ \t]+|[ \t]+$/g,"").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/^\n+/,"");else{i=i.replace(/\t/g," ").replace(/\u00a0/g," ");const h=i.split(`
|
|
9
|
+
`);let b=1/0;for(const g of h){const y=g.search(/\S/);y>-1&&(b=Math.min(b,y))}b===1/0&&(b=0),b>0&&(i=h.map((g=>g.slice(b))).join(`
|
|
10
|
+
`)),i=i.replace(/^\s+|\s+$/g,"").replace(/\n{3,}/g,`
|
|
11
|
+
|
|
12
|
+
`).replace(/^\n+/,"").replace(/\n+$/,"")}let c=A;for(let h=0;h<3&&c;h++){const b=c.parentElement;if(!b||b.tagName==="BODY"||b.children.length>5||!((n=b.closest)===null||n===void 0)&&n.call(b,"[data-callout]"))break;const g=Array.from(b.children);for(const y of g){if(y.contains(A))continue;const a=y.tagName;if(a!=="DIV"&&a!=="SPAN")continue;const d=(y.textContent||"").trim();(0,P.countWords)(d)<=5&&!y.querySelector("pre, code, img, svg, table, h1, h2, h3, h4, h5, h6, p, blockquote, ul, ol, hr")&&y.remove()}c=b}const f=S.createElement("pre");A.matches("code.hl.block, pre.hl.lean.lean-output")&&f.setAttribute("data-verso-code","true");const u=S.createElement("code");return r&&(u.setAttribute("data-lang",r),u.setAttribute("class",`language-${r}`)),u.textContent=i,f.appendChild(u),f}}]},3610(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.FOOTNOTE_SECTION_RE=void 0,w.standardizeFootnotes=function(s){const i=s.ownerDocument;i&&new o(i).standardizeFootnotes(s)};const P=I(2640),L=I(639),_=I(2552),A=I(4840);w.FOOTNOTE_SECTION_RE=/^(foot\s*notes?|end\s*notes?|notes?|references?)$/i;const S=/^[\^\u21A9\u21A5\u2191\u21B5\u2934\u2935\u23CE]+$/,n=/^#cite_ref-/,t=/^\[?\(?(\d{1,4})\)?\]?$/;function r(s){var i;return((i=(s?.getAttribute("href")||"").split("#").pop())===null||i===void 0?void 0:i.toLowerCase())||""}const e=[{selector:"sup.footnoteref",extract:s=>{var i;const c=s.querySelector('a[id^="footnoteref-"]');return((i=c?.id.match(/^footnoteref-(\d+)$/))===null||i===void 0?void 0:i[1])||""}},{selector:'a[id^="ref-link"]',extract:s=>{var i;return((i=s.textContent)===null||i===void 0?void 0:i.trim())||""}},{selector:'a[role="doc-biblioref"]',extract:s=>{const i=s.getAttribute("data-xml-rid");if(i)return i;const c=s.getAttribute("href")||"";return c.startsWith("#core-R")?c.replace("#core-",""):""}},{selector:"a.footnote-anchor, span.footnote-hovercard-target a",extract:s=>{var i;return(((i=s.id)===null||i===void 0?void 0:i.replace("footnote-anchor-",""))||"").toLowerCase()}},{selector:"sup.reference",extract:s=>{let i="";return s.querySelectorAll("a").forEach((c=>{var f;const u=(f=(c.getAttribute("href")||"").split("/").pop())===null||f===void 0?void 0:f.match(/(?:cite_note|cite_ref)-(.+)/);u&&(i=u[1].toLowerCase())})),i}},{selector:'sup[id^="fnref:"], span[id^="fnref:"]',extract:s=>s.id.replace("fnref:","").toLowerCase()},{selector:'sup[id^="fnr"]',extract:s=>s.id.replace("fnr","").toLowerCase()},{selector:"sup.footnote-reference",extract:s=>r(s.querySelector('a[href^="#"]'))},{selector:"span.footnote-reference",extract:s=>{var i;return s.getAttribute("data-footnote-id")||""||(!((i=s.id)===null||i===void 0)&&i.startsWith("fnref")?s.id.replace("fnref","").toLowerCase():"")}},{selector:"span.footnote-link",extract:s=>s.getAttribute("data-footnote-id")||""},{selector:"a.citation",extract:s=>{var i;return((i=s.textContent)===null||i===void 0?void 0:i.trim())||""}},{selector:'a[id^="fnref"]',extract:s=>s.id.replace("fnref","").toLowerCase()},{selector:'a[data-type="noteref"]',extract:s=>r(s)}];class o{constructor(i){this.pendingRemovals=[],this.doc=i}makeRefId(i,c){return c>0?`fnref:${i}-${c+1}`:`fnref:${i}`}mergeFootnotes(i,c){for(const[f,u]of Object.entries(c)){const h=parseInt(f);i[h]||(i[h]=u)}}addFootnote(i,c,f,u){if(!c||i.processedIds.has(c))return!1;const h=u??i.count;return i.footnotes[h]={content:f,originalId:c,refs:[]},i.processedIds.add(c),u===void 0?i.count++:u>=i.count&&(i.count=u+1),!0}createFootnoteItem(i,c,f){const u=typeof c=="string"?this.doc:c.ownerDocument,h=u.createElement("li");if(h.className="footnote",h.id=`fn:${i}`,typeof c=="string"){const g=u.createElement("p");g.appendChild((0,L.parseHTML)(u,c)),h.appendChild(g)}else{const g=Array.from(c.children),y=g.some((d=>d.tagName.toLowerCase()==="p")),a=g.some((d=>P.BLOCK_LEVEL_ELEMENTS.has(d.tagName.toLowerCase())));if(y||a)!y&&a?g.forEach((d=>{if(this.isBackrefLink(d))return;const p=d.cloneNode(!0);this.removeBackrefs(p),h.appendChild(p)})):g.forEach((d=>{var p;if(!this.isBackrefLink(d))if(d.tagName.toLowerCase()==="p"){if(!(!((p=d.textContent)===null||p===void 0)&&p.trim())&&!d.querySelector("img, br"))return;const x=u.createElement("p");(0,L.transferContent)(d,x),this.removeBackrefs(x),h.appendChild(x)}else{const x=d.cloneNode(!0);this.removeBackrefs(x),h.appendChild(x)}}));else{const d=u.createElement("p");(0,L.transferContent)(c,d),this.removeBackrefs(d),h.appendChild(d)}}const b=h.querySelector("p:last-of-type")||h;return f.forEach(((g,y)=>{const a=u.createElement("a");a.href=`#${g}`,a.title="return to article",a.className="footnote-backref",a.textContent="↩",y<f.length-1&&(a.textContent+=" "),b.appendChild(a)})),h}collectFootnotes(i){const c={footnotes:{},processedIds:new Set,count:1};i.querySelectorAll(P.FOOTNOTE_LIST_SELECTORS).forEach((u=>{var h,b;if(u.matches("div.footnotes-footer"))return void u.querySelectorAll("div.footnote-footer").forEach((g=>{const y=(g.id||"").match(/^footnote-(\d+)$/);if(!y)return;const a=y[1];if(c.processedIds.has(a))return;const d=g.cloneNode(!0),p=d.querySelector("a");p&&p.remove();const x=(0,L.serializeHTML)(d).replace(/^\s*\.\s*/,""),l=i.ownerDocument.createElement("div");l.appendChild((0,L.parseHTML)(i.ownerDocument,x.trim())),this.addFootnote(c,a,l)}));if(u.matches("div.footnote-definition")&&!(!((h=u.parentElement)===null||h===void 0)&&h.matches("div.footnote-definitions"))){const g=(u.id||"").toLowerCase(),y=u.cloneNode(!0),a=y.querySelector("sup.footnote-definition-label");return a&&a.remove(),void this.addFootnote(c,g,y)}if(u.matches("div.footnote-definitions")){u.querySelectorAll("div.footnote-definition").forEach((y=>{const a=y.querySelector("sup[id]"),d=y.querySelector(".footnote-body");a&&d&&this.addFootnote(c,(a.id||"").toLowerCase(),d.cloneNode(!0))}));const g=u.parentElement;return void(g&&g!==i&&((b=g.classList)===null||b===void 0?void 0:b.contains("footnotes"))&&this.pendingRemovals.push(g))}if(u.matches("ol.easy-footnotes-wrapper"))return u.querySelectorAll("li.easy-footnote-single").forEach((g=>{var y,a;const d=g.querySelector('span[id^="easy-footnote-bottom-"]');if(!d)return;const p=g.cloneNode(!0);(y=p.querySelector('span[id^="easy-footnote-bottom-"]'))===null||y===void 0||y.remove(),(a=p.querySelector("a.easy-footnote-to-top"))===null||a===void 0||a.remove(),this.addFootnote(c,d.id.toLowerCase(),p)})),void i.querySelectorAll("span.easy-footnote-margin-adjust").forEach((g=>{this.pendingRemovals.push(g)}));if(u.matches("div.footnotes-segment"))return u.querySelectorAll("h5.footnote-body-heading").forEach((g=>{var y,a,d,p;const x=(((y=g.querySelector("a[id]"))===null||y===void 0?void 0:y.id)||"").toLowerCase();if(!x)return;const l=i.ownerDocument.createElement("div");let m=g.nextElementSibling;for(;m&&(m.tagName.toLowerCase()!=="h5"||!(!((a=m.classList)===null||a===void 0)&&a.contains("footnote-body-heading")));)(!((d=m.textContent)===null||d===void 0)&&d.trim()||!((p=m.querySelector)===null||p===void 0)&&p.call(m,"img, br"))&&l.appendChild(m.cloneNode(!0)),m=m.nextElementSibling;this.addFootnote(c,x,l)})),void this.pendingRemovals.push(u);if(u.matches('div.footnote[data-component-name="FootnoteToDOM"]')){const g=u.querySelector("a.footnote-number"),y=u.querySelector(".footnote-content");return void(g&&y&&this.addFootnote(c,g.id.replace("footnote-","").toLowerCase(),y))}u.querySelectorAll('li, div[role="listitem"]').forEach((g=>{const{id:y,content:a}=this.extractListItemIdAndContent(g);this.addFootnote(c,y,a||g)}))}));const f=[this.tryDataTypeFootnotes,this.tryGenericIdDetection,this.tryWordExport,this.tryGoogleDocs,this.tryLabeledSection,this.tryLooseFootnotes,this.tryClassFootnote];for(const u of f){if(c.count>1)break;u.call(this,i,c)}return c.footnotes}tryDataTypeFootnotes(i,c){i.querySelectorAll('p[data-type="footnote"][id]').forEach((f=>{const u=(f.id||"").toLowerCase();if(!u)return;const h=i.ownerDocument.createElement("div"),b=f.cloneNode(!0),g=b.firstElementChild;g&&g.tagName.toLowerCase()==="sup"&&g.querySelector('a[href*="#"]')&&(g.remove(),this.trimLeadingWhitespace(b)),h.appendChild(b),this.addFootnote(c,u,h),this.pendingRemovals.push(f)}))}tryGenericIdDetection(i,c){const f=new Map;if(i.querySelectorAll('a[href*="#"]').forEach((x=>{var l;const m=r(x);if(!m)return;const v=((l=x.textContent)===null||l===void 0?void 0:l.trim())||"";t.test(v)&&(f.has(m)||f.set(m,[]),f.get(m).push(x))})),f.size<2)return;const u=new Set(f.keys()),h=i.querySelectorAll("div, section, aside, footer, ol, ul");let b=null,g=0;if(h.forEach((x=>{if(x===i)return;const l=this.findMatchingFootnoteElements(x,u).length;l>=2&&l>=g&&(g=l,b=x)})),!b)return;const y=this.findMatchingFootnoteElements(b,u),a=new Set(y.map((({id:x})=>x)));let d=0,p=0;f.forEach(((x,l)=>{x.some((m=>b.contains(m)))||(d++,a.has(l)&&p++)})),p<Math.max(2,Math.ceil(.75*d))&&(b=null),y.forEach((({el:x,id:l})=>{var m,v;if(c.processedIds.has(l))return;const E=i.ownerDocument.createElement("div"),q=x.cloneNode(!0),C=q.querySelector(`a[id="${l}"]`);!C||!((m=C.textContent)===null||m===void 0)&&m.trim()&&!/^\d+[.)]*\s*$/.test(C.textContent.trim())||C.remove();const N=q.querySelector("a[name]");N&&((v=N.getAttribute("name"))===null||v===void 0?void 0:v.toLowerCase())===l&&N.remove();const O=q.childNodes[0];O&&O.nodeType===3&&(O.textContent=O.textContent.replace(/^\d+\.\s*/,"").replace(/^\s+/,"")),q.matches("li")?(0,L.transferContent)(q,E):E.appendChild(q);let T=x.nextElementSibling;for(;T&&!T.id;){const R=this.getChildAnchorId(T);if(R&&u.has(R))break;E.appendChild(T.cloneNode(!0)),T=T.nextElementSibling}this.addFootnote(c,l,E)})),b&&this.pendingRemovals.push(b)}tryWordExport(i,c){const f=Array.from(i.querySelectorAll('a[href*="#_ftnref"]'));if(f.length<2)return;const u=[];f.forEach((h=>{const b=r(h).match(/^_ftnref(\d+)$/);b&&u.push({num:parseInt(b[1]),anchor:h})})),u.sort(((h,b)=>h.num-b.num)),u.forEach((({num:h,anchor:b})=>{const g=`_ftn${h}`;if(c.processedIds.has(g))return;let y=b.parentElement;for(;y&&y!==i;){const x=y.tagName.toLowerCase();if(x==="p"||x==="div"||x==="li")break;y=y.parentElement}if(!y||y===i)return;const a=y.cloneNode(!0),d=a.querySelector('a[href*="_ftnref"]');if(d){const x=d.closest("sup");x?x.remove():d.remove()}const p=i.ownerDocument.createElement("div");p.appendChild(a),this.addFootnote(c,g,p,h),this.pendingRemovals.push(y)}))}tryGoogleDocs(i,c){var f;const u=[];if(i.querySelectorAll('p[id^="ftnt"]').forEach((y=>{const a=(y.id||"").match(/^ftnt(\d+)$/);a&&u.push({num:parseInt(a[1]),el:y})})),u.length<2)return;u.sort(((y,a)=>y.num-a.num)),u.forEach((({num:y,el:a})=>{var d;const p=`ftnt${y}`;if(c.processedIds.has(p))return;const x=a.cloneNode(!0);(d=x.querySelector('a[href*="#ftnt_ref"]'))===null||d===void 0||d.remove();const l=i.ownerDocument.createElement("div");l.appendChild(x),this.addFootnote(c,p,l,y),this.pendingRemovals.push(a);const m=a.parentElement;m&&m!==i&&m.tagName.toLowerCase()==="div"&&m.children.length===1&&this.pendingRemovals.push(m)}));const h=u[0].el,b=h.parentElement,g=(b&&b!==i&&b.tagName.toLowerCase()==="div"?b:h).previousElementSibling;g&&/^h[1-6]$/.test(g.tagName.toLowerCase())&&w.FOOTNOTE_SECTION_RE.test(((f=g.textContent)===null||f===void 0?void 0:f.trim())||"")&&this.pendingRemovals.push(g)}tryLooseFootnotes(i,c){var f,u;const h=this.findLooseFootnoteParagraphs(i);if(!h)return;const{paragraphs:b,toRemove:g}=h,y=new Set(g);for(let a=0;a<b.length;a++){const{num:d,el:p}=b[a],x=(u=(f=b[a+1])===null||f===void 0?void 0:f.el)!==null&&u!==void 0?u:null,l=this.stripMarkerAndWrap(p);let m=p.nextElementSibling;for(;m&&m!==x&&y.has(m);)l.appendChild(m.cloneNode(!0)),m=m.nextElementSibling;this.addFootnote(c,String(d),l)}this.pendingRemovals.push(...g)}tryClassFootnote(i,c){const f=[];i.querySelectorAll("p.footnote").forEach((u=>{const h=this.parseFootnoteNum(u);h!==null&&f.push({num:h,el:u})}));for(const{num:u,el:h}of f)this.addFootnote(c,String(u),this.stripMarkerAndWrap(h));this.pendingRemovals.push(...f.map((u=>u.el)))}tryLabeledSection(i,c){var f,u;const h=i.querySelectorAll("div, section, aside");for(const b of Array.from(h)){const g=(0,L.getClassName)(b),y=b.id||"";if(!/footnote/i.test(g)&&!/footnote/i.test(y))continue;const a=b.querySelector("h1, h2, h3, h4, h5, h6");if(!a||!w.FOOTNOTE_SECTION_RE.test(((f=a.textContent)===null||f===void 0?void 0:f.trim())||""))continue;const d=[];if(b.querySelectorAll("p").forEach((x=>{const l=this.parseFootnoteNum(x);l!==null&&d.push({num:l,el:x})})),d.length===0)continue;const p=new Set(d.map((x=>x.el)));for(let x=0;x<d.length;x++){const{num:l,el:m}=d[x],v=this.stripMarkerAndWrap(m);let E=m.nextElementSibling;for(;E&&!p.has(E);)!((u=E.textContent)===null||u===void 0)&&u.trim()&&v.appendChild(E.cloneNode(!0)),this.pendingRemovals.push(E),E=E.nextElementSibling;this.addFootnote(c,String(l),v),this.pendingRemovals.push(m)}this.pendingRemovals.push(b);break}}trimLeadingWhitespace(i){const c=i.firstChild;c?.nodeType===3&&(c.textContent=c.textContent.replace(/^\s+/,""))}isBoldWrappedSup(i){var c,f,u;const h=(c=i.tagName)===null||c===void 0?void 0:c.toLowerCase();return(h==="b"||h==="strong")&&i.firstChild===i.firstElementChild&&((u=(f=i.firstElementChild)===null||f===void 0?void 0:f.tagName)===null||u===void 0?void 0:u.toLowerCase())==="sup"}stripMarkerAndWrap(i){const c=i.ownerDocument.createElement("div"),f=i.cloneNode(!0),u=f.firstElementChild;return u&&(this.isBoldWrappedSup(u)?(u.firstElementChild.remove(),this.trimLeadingWhitespace(u)):(u.remove(),this.trimLeadingWhitespace(f))),c.appendChild(f),c}parseFootnoteNum(i){var c;if(!i.firstChild)return null;let f=i.firstElementChild;if(!f||f!==i.firstChild)return null;let u=f.tagName.toLowerCase();if(this.isBoldWrappedSup(f)&&(f=f.firstElementChild,u="sup"),u!=="sup"&&u!=="strong")return null;const h=((c=f.textContent)===null||c===void 0?void 0:c.trim())||"",b=parseInt(h,10);return!isNaN(b)&&b>=1&&String(b)===h?b:null}crossValidate(i,c){const f=new Set(c.map((h=>h.num))),u=new Set;return i.querySelectorAll("sup").forEach((h=>{var b;if(c.some((a=>a.el.contains(h)))||h.querySelector("a"))return;const g=((b=h.textContent)===null||b===void 0?void 0:b.trim())||"",y=parseInt(g,10);!isNaN(y)&&y>=1&&String(y)===g&&f.has(y)&&u.add(y)})),u.size>=2}findLooseFootnoteParagraphs(i){var c,f;const u=Array.from(i.querySelectorAll("p")),h=u.length>0&&(c=u[u.length-1].parentElement)!==null&&c!==void 0?c:i,b=Array.from(h.children);for(let d=b.length-1;d>=0;d--){if(b[d].tagName.toLowerCase()!=="hr")continue;const p=[];for(let x=d+1;x<b.length;x++){const l=this.parseFootnoteNum(b[x]);l!==null&&p.push({num:l,el:b[x]})}if(p.length>=2&&this.crossValidate(i,p))return{paragraphs:p,toRemove:b.slice(d)};break}const g=[];let y=-1;for(let d=b.length-1;d>=0;d--){const p=b[d],x=p.tagName.toLowerCase();if(x==="p"){const l=this.parseFootnoteNum(p);if(l!==null){g.unshift({num:l,el:p}),y=d;continue}break}if(x!=="ul"&&x!=="ol"&&x!=="blockquote")break}if(g.length>=2&&this.crossValidate(i,g)){const d=b.slice(y),p=g[0].el.previousElementSibling;if(p){const x=p.tagName.toLowerCase();/^h[1-6]$/.test(x)&&w.FOOTNOTE_SECTION_RE.test(((f=p.textContent)===null||f===void 0?void 0:f.trim())||"")&&d.unshift(p)}return{paragraphs:g,toRemove:d}}const a=[];for(let d=Math.floor(u.length/2);d<u.length;d++){const p=this.parseFootnoteNum(u[d]);p!==null&&a.push({num:p,el:u[d]})}return a.length>=2&&this.crossValidate(i,a)?{paragraphs:a,toRemove:a.map((d=>d.el))}:null}isBackrefLink(i){var c,f,u;if(((c=i.tagName)===null||c===void 0?void 0:c.toLowerCase())!=="a")return!1;const h=((f=i.textContent)===null||f===void 0?void 0:f.trim().replace(/\uFE0E|\uFE0F/g,""))||"";if(S.test(h)||!((u=i.classList)===null||u===void 0)&&u.contains("footnote-backref"))return!0;const b=i.getAttribute("href")||"";return n.test(b)}removeBackrefs(i){for(i.querySelectorAll("a").forEach((c=>{var f;if(this.isBackrefLink(c)){const u=c.parentElement;((f=u?.tagName)===null||f===void 0?void 0:f.toLowerCase())==="sup"&&u.children.length===1?u.remove():c.remove()}}));i.firstChild&&i.firstChild.nodeType===3;){const c=i.firstChild.textContent;if(!(c&&/^[\s\^,.;]*$/.test(c)&&c.includes("^")))break;i.firstChild.remove()}for(;i.lastChild&&i.lastChild.nodeType===3;){const c=i.lastChild.textContent;if(!/^[\s,.;]*$/.test(c))break;i.lastChild.remove()}}getChildAnchorId(i){const c=i.querySelector("a[id], a[name]");return c?(c.id||c.getAttribute("name")||"").toLowerCase():""}extractListItemIdAndContent(i){var c,f;const u=i.querySelector(".citations");if(!((c=u?.id)===null||c===void 0)&&c.toLowerCase().startsWith("r"))return{id:u.id.toLowerCase(),content:u.querySelector(".citation-content")||null};const h=(i.id||"").toLowerCase();for(const g of["bib.bib","fn:","fn"])if(h.startsWith(g))return{id:h.slice(g.length),content:i};if(i.hasAttribute("data-counter"))return{id:(i.getAttribute("data-counter")||"").replace(/\.$/,"").toLowerCase(),content:i};const b=(f=h.split("/").pop())===null||f===void 0?void 0:f.match(/cite_note-(.+)/);return{id:b?b[1]:h,content:i}}findMatchingFootnoteElements(i,c){const f=[],u=new Set;return i.querySelectorAll("li, p, div").forEach((h=>{let b="";if(h.id&&c.has(h.id.toLowerCase()))b=h.id.toLowerCase();else if(!h.id){const g=this.getChildAnchorId(h);g&&c.has(g)&&(b=g)}b&&!u.has(b)&&(f.push({el:h,id:b}),u.add(b))})),f}replaceContainerPreservingText(i,c){let f="",u=!1;for(const h of i.childNodes)(0,_.isTextNode)(h)?f+=h.textContent||"":(0,_.isElement)(h)&&(u=!0);if(f=f.trim(),f&&u){const h=i.ownerDocument.createDocumentFragment();h.appendChild(i.ownerDocument.createTextNode(f)),h.appendChild(c),i.replaceWith(h)}else i.replaceWith(c)}findOuterFootnoteContainer(i){var c;let f=i,u=i.parentElement;for(;u;){const h=u.tagName.toLowerCase();if(h!=="span"&&h!=="sup")break;if(h==="span"){let b=!1;for(const g of u.childNodes)if(g!==f){if((0,_.isTextNode)(g)&&(!((c=g.textContent)===null||c===void 0)&&c.trim())){b=!0;break}if((0,_.isElement)(g)&&g.tagName.toLowerCase()!=="sup"){b=!0;break}}if(b)break}f=u,u=u.parentElement}return f}createFootnoteReference(i,c){const f=this.doc.createElement("sup");f.id=c;const u=this.doc.createElement("a");return u.href=`#fn:${i}`,u.textContent=i,f.appendChild(u),f}collectInlineSidenotes(i){const c={},f=i.querySelectorAll("span.footnote-container, span.sidenote-container, span.inline-footnote");if(f.length===0){const h=i.querySelectorAll("label.footref");if(h.length>0){let b=1;return h.forEach((g=>{var y,a,d;let p=g.nextElementSibling;if(p?.tagName==="INPUT"&&(!((y=p.classList)===null||y===void 0)&&y.contains("footref-toggle"))&&(p=p.nextElementSibling),!p||p.tagName!=="SPAN"||!(!((a=p.classList)===null||a===void 0)&&a.contains("sidenote")))return;const x=p.cloneNode(!0),l=x.querySelector("sup");l&&x.firstChild===l&&l.remove(),c[b]={content:x,originalId:String(b),refs:[`fnref:${b}`]};const m=this.createFootnoteReference(String(b),`fnref:${b}`),v=g.nextElementSibling;v?.tagName==="INPUT"&&(!((d=v.classList)===null||d===void 0)&&d.contains("footref-toggle"))&&v.remove(),p.remove(),g.replaceWith(m),b++})),i.querySelectorAll("footer").forEach((g=>{g.querySelector(".footdef")&&g.remove()})),c}return i.querySelectorAll("span.sidenote").forEach((b=>{b.remove()})),c}let u=1;return f.forEach((h=>{const b=h.querySelector("span.footnote, span.sidenote, span.footnoteContent");if(!b)return;c[u]={content:b.cloneNode(!0),originalId:String(u),refs:[`fnref:${u}`]};const g=this.createFootnoteReference(String(u),`fnref:${u}`);h.replaceWith(g),u++})),c}collectSidenotesColumn(i){const c={};let f=Array.from(i.querySelectorAll(".sidenotes-column"));if(f.length===0){let h=i.parentElement;for(let b=0;b<3&&h&&f.length===0;b++)f=Array.from(h.querySelectorAll(":scope > .sidenotes-column")),h=h.parentElement}if(f.length===0)return c;let u=1;return f.forEach((h=>{h.querySelectorAll(".sidenote[id]").forEach((b=>{var g;const y=b.id;if(!y)return;const a=b.querySelector(".sidenote__id"),d=(g=a?.textContent)===null||g===void 0?void 0:g.replace(/\D/g,""),p=d?parseInt(d,10):u,x=this.doc.createElement("div");Array.from(b.childNodes).forEach((l=>{var m,v,E;(0,_.isElement)(l)&&(!((m=l.classList)===null||m===void 0)&&m.contains("sidenote__id")||!((v=l.classList)===null||v===void 0)&&v.contains("sidenote__label")||!((E=l.classList)===null||E===void 0)&&E.contains("sn-backref"))||x.appendChild(l.cloneNode(!0))})),this.removeBackrefs(x),c[p]={content:x,originalId:y.toLowerCase(),refs:[]},u++})),h.remove()})),c}collectAsideFootnotes(i){const c={},f=Array.from(i.querySelectorAll("aside > ol[start]"));return f.length===0||f.forEach((u=>{const h=u.parentElement,b=parseInt(u.getAttribute("start")||"",10);if(isNaN(b)||b<1)return;const g=Array.from(u.querySelectorAll("li"));if(g.length===0)return;const y=this.doc.createElement("div");g.length===1?(0,L.transferContent)(g[0].cloneNode(!0),y):g.forEach((a=>{const d=this.doc.createElement("p");(0,L.transferContent)(a.cloneNode(!0),d),y.appendChild(d)})),c[b]={content:y,originalId:String(b),refs:[]},h.remove()})),c}collectHiddenAsideFootnotes(i){const c={},f=Array.from(i.querySelectorAll("span[data-definition]"));if(f.length===0)return c;const u=new Map;i.querySelectorAll("aside[id]").forEach((b=>{u.set(b.id,b)}));let h=1;return f.forEach((b=>{const g=b.getAttribute("data-definition");if(!g)return;const y=u.get(g);if(!y)return;const a=this.doc.createElement("div");(0,L.transferContent)(y,a),y.remove();const d=String(h),p=`fnref:${d}`;c[h]={content:a,originalId:g.toLowerCase(),refs:[p]},b.replaceWith(this.createFootnoteReference(d,p)),h++})),c}standardizeFootnotes(i){const c=this.collectInlineSidenotes(i),f=this.collectHiddenAsideFootnotes(i);this.mergeFootnotes(f,this.collectFootnotes(i)),this.mergeFootnotes(f,this.collectSidenotesColumn(i)),this.mergeFootnotes(f,this.collectAsideFootnotes(i));const u=i.querySelectorAll(P.FOOTNOTE_INLINE_REFERENCES),h=new Map,b=new Map;Object.entries(f).forEach((([p,x])=>{b.set(x.originalId.toLowerCase(),[p,x])})),u.forEach((p=>{var x,l;if(!p||!p.parentNode||!(!((x=p.textContent)===null||x===void 0)&&x.trim()))return;if(p.matches("cite.ltx_cite")){const v=[];if(p.querySelectorAll("a").forEach((E=>{var q;const C=E.getAttribute("href");if(!C)return;const N=(q=C.split("/").pop())===null||q===void 0?void 0:q.match(/bib\.bib(\d+)/);if(!N)return;const O=b.get(N[1].toLowerCase());if(!O)return;const[T,R]=O,D=this.makeRefId(T,R.refs.length);R.refs.push(D),v.push(this.createFootnoteReference(T,D))})),v.length>0){const E=this.findOuterFootnoteContainer(p),q=p.ownerDocument.createDocumentFragment();v.forEach(((C,N)=>{N>0&&q.appendChild(p.ownerDocument.createTextNode(" ")),q.appendChild(C)})),E.replaceWith(q)}return}let m="";for(const{selector:v,extract:E}of e)if(p.matches(v)){m=E(p);break}if(!m){const v=p.getAttribute("href");v&&(m=v.replace(/^[#]/,"").toLowerCase())}if(m){const v=b.get(m.toLowerCase());if(v){const[E,q]=v,C=this.findOuterFootnoteContainer(p),N=C.tagName.toLowerCase()==="sup";if(N&&(!((l=h.get(C))===null||l===void 0)&&l.some((T=>T.footnoteNumber===E))))return;const O=this.makeRefId(E,q.refs.length);q.refs.push(O),N?(h.has(C)||h.set(C,[]),h.get(C).push({footnoteNumber:E,refId:O})):this.replaceContainerPreservingText(C,this.createFootnoteReference(E,O))}}}));const g=Object.entries(f).filter((([p,x])=>x.refs.length===0));if(g.length>0){const p=new Map,x=new Map;g.forEach((([v,E])=>{p.set(E.originalId,[v,E]),x.set(v,[v,E])}));const l=v=>v.closest('[id^="fnref:"]')||v.closest("#footnotes")||this.pendingRemovals.some((E=>E.contains(v))),m=(v,E)=>{const[q,C]=E,N=this.makeRefId(q,C.refs.length);C.refs.push(N);const O=this.findOuterFootnoteContainer(v);this.replaceContainerPreservingText(O,this.createFootnoteReference(q,N))};i.querySelectorAll('a[href*="#"]').forEach((v=>{var E;if(!v.parentNode||l(v))return;const q=r(v);if(!q)return;const C=p.get(q);if(!C)return;const N=((E=v.textContent)===null||E===void 0?void 0:E.trim())||"";t.test(N)&&m(v,C)})),Object.values(f).some((v=>v.refs.length===0))&&i.querySelectorAll("sup, span.footnote-ref").forEach((v=>{var E,q;if(!v.parentNode||!((E=v.id)===null||E===void 0)&&E.startsWith("fnref:")||v.closest("#footnotes"))return;const C=(((q=v.textContent)===null||q===void 0?void 0:q.trim())||"").match(t);if(!C)return;const N=x.get(C[1])||p.get(C[1]);!N||N[1].refs.length>0||m(v,N)}))}h.forEach(((p,x)=>{const l=this.doc.createDocumentFragment();p.forEach((({footnoteNumber:m,refId:v})=>{l.appendChild(this.createFootnoteReference(m,v))})),x.replaceWith(l)}));const y=this.doc.createElement("div");y.id="footnotes";const a=this.doc.createElement("ol"),d=Object.assign(Object.assign({},c),f);Object.entries(d).forEach((([p,x])=>{a.appendChild(this.createFootnoteItem(parseInt(p),x.content,x.refs))})),i.querySelectorAll(P.FOOTNOTE_LIST_SELECTORS).forEach((p=>p.remove())),this.pendingRemovals.forEach((p=>{p.parentNode&&p.remove()})),(0,A.removeOrphanedDividers)(i),a.children.length>0&&(y.appendChild(a),i.appendChild(y))}}},7864(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.headingRules=void 0,w.removePermalinkAnchors=function(_){Array.from(_.querySelectorAll("h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, a.permalink, a.anchor-link, a.heading-anchor")).forEach((A=>{L(A)&&A.remove()}))},w.isPermalinkAnchor=L;const P=I(2640);function L(_){if(_.tagName.toLowerCase()!=="a")return!1;const A=_.getAttribute("href")||"",S=(_.getAttribute("title")||"").toLowerCase(),n=(_.getAttribute("class")||"").toLowerCase(),t=(_.textContent||"").trim();return A.startsWith("#")||S.includes("permalink")?!0:!!(n.includes("permalink")||n.includes("heading-anchor")||n.includes("anchor-link"))||!!/^[#\xb6\xa7\ud83d\udd17\uFEFF]$/.test(t)}w.headingRules=[{selector:"h1, h2, h3, h4, h5, h6",element:"keep",transform:_=>{var A,S;const n=_.ownerDocument;if(!n)return _;const t=n.createElement(_.tagName);if(Array.from(_.attributes).forEach((i=>{P.ALLOWED_ATTRIBUTES.has(i.name)&&t.setAttribute(i.name,i.value)})),!_.children.length)return t.textContent=((A=_.textContent)===null||A===void 0?void 0:A.trim())||"",t;const r=_.cloneNode(!0),e=new Map,o=[];Array.from(r.querySelectorAll("*")).forEach((i=>{var c,f,u,h;if(!(function(g){const y=g.tagName.toLowerCase();return y==="button"||!(y!=="a"||!L(g))||!(!g.classList.contains("anchor")&&!g.classList.contains("permalink-widget"))||!(y!=="span"&&y!=="div"||!Array.from(g.querySelectorAll("a")).some((a=>L(a))))})(i))return;e.set(i,((c=i.textContent)===null||c===void 0?void 0:c.trim())||"");const b=i.parentElement;b&&b!==r&&((f=b.textContent)===null||f===void 0?void 0:f.trim())===((u=i.textContent)===null||u===void 0?void 0:u.trim())&&e.set(b,((h=i.textContent)===null||h===void 0?void 0:h.trim())||""),o.push(i)})),o.forEach((i=>i.remove()));let s=((S=r.textContent)===null||S===void 0?void 0:S.trim())||"";return!s&&e.size>0&&(s=Array.from(e.values())[0]),t.textContent=s,t}}]},2649(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.imageRules=void 0,w.isBase64Placeholder=b;const P=I(2552),L=I(639),_=I(2640),A=/^data:image\/([^;]+);base64,/,S=/\.(jpg|jpeg|png|webp)\s+\d/,n=/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/,t=/\.(jpg|jpeg|png|webp|gif|avif)(\?.*)?$/i,r=/\s(\d+)w/,e=/dpr=(\d+(?:\.\d+)?)/,o=/^([^\s]+)/,s=/^https?:\/\//,i=/^[\w\-\.\/\\]+\.(jpg|jpeg|png|gif|webp|svg)$/i,c=/^\d{4}-\d{2}-\d{2}$/;function f(C,N,O){const T=O.createElement("figure");T.appendChild(C.cloneNode(!0));const R=O.createElement("figcaption"),D=(function($){const M=[],W=new Set,B=k=>{var F;if((0,P.isTextNode)(k)){const z=((F=k.textContent)===null||F===void 0?void 0:F.trim())||"";z&&!W.has(z)&&(M.push(z),W.add(z))}else if((0,P.isElement)(k)){const z=k.childNodes;for(let Y=0;Y<z.length;Y++)B(z[Y])}},H=$.childNodes;for(let k=0;k<H.length;k++)B(H[k]);return M.length>0?M.join(" "):(0,L.serializeHTML)($)})(N);return R.appendChild((0,L.parseHTML)(O,D)),T.appendChild(R),T}function u(C,N){N.setAttribute("srcset",C);const O=E(C);O&&y(O)&&N.setAttribute("src",O)}function h(C,N,O){for(let T=0;T<C.attributes.length;T++){const R=C.attributes[T];O.includes(R.name)||N.setAttribute(R.name,R.value)}}function b(C){const N=C.match(A);if(!N||N[1]==="svg+xml")return!1;const O=N[0].length;return C.length-O<133}function g(C){return C.startsWith("data:image/svg+xml")}function y(C){return!C.startsWith("data:")&&!(!C||C.trim()==="")&&(t.test(C)||C.includes("image")||C.includes("img")||C.includes("photo"))}function a(C){return d(C)?!0:C.querySelectorAll("img, video, picture, source").length>0}function d(C){const N=C.tagName.toLowerCase();return N==="img"||N==="video"||N==="picture"||N==="source"}function p(C){if(d(C))return C;const N=C.querySelectorAll("picture");if(N.length>0)return N[0];const O=C.querySelectorAll("img"),T=[];for(let M=0;M<O.length;M++){const W=O[M],B=W.getAttribute("src")||"",H=W.getAttribute("alt")||"";g(B)||b(B)||!H.trim()&&O.length>1||T.push(W)}if(T.length>0)return T[0];const R=C.querySelectorAll("video");if(R.length>0)return R[0];const D=C.querySelectorAll("source");if(D.length>0)return D[0];const $=C.querySelectorAll("img, picture, source, video");return $.length>0?$[0]:null}function x(C){var N,O,T,R;const D=C.querySelector("figcaption");if(D)return D;const $=new Set,M=['[class*="caption"]','[class*="description"]','[class*="alt"]','[class*="title"]','[class*="credit"]','[class*="text"]','[class*="post-thumbnail-text"]','[class*="image-caption"]','[class*="photo-caption"]',"[aria-label]","[title]"].join(", "),W=C.querySelectorAll(M);for(let k=0;k<W.length;k++){const F=W[k];if(d(F))continue;const z=(N=F.textContent)===null||N===void 0?void 0:N.trim();if(z&&z.length>0&&!$.has(z))return $.add(z),F}const B=C.querySelector("img");if(B&&B.hasAttribute("alt")){const k=B.getAttribute("alt");if(k&&k.trim().length>0){const F=C.ownerDocument.createElement("div");return F.textContent=k,F}}if(C.parentElement){const k=C.parentElement.children;for(let F=0;F<k.length;F++){const z=k[F];if(z!==C&&Array.from(z.classList).some((Y=>Y.includes("caption")||Y.includes("credit")||Y.includes("text")||Y.includes("description")))){const Y=(O=z.textContent)===null||O===void 0?void 0:O.trim();if(Y&&Y.length>0)return z}}}const H=C.querySelectorAll("img");for(let k=0;k<H.length;k++){const F=H[k];if(!F.parentElement)continue;let z=F.nextElementSibling;for(;z;){if(["EM","STRONG","SPAN","I","B","SMALL","CITE"].includes(z.tagName)){const Y=(T=z.textContent)===null||T===void 0?void 0:T.trim();if(Y&&Y.length>0)return z}z=z.nextElementSibling}}for(let k=0;k<H.length;k++){const F=H[k],z=F.parentElement;if(!z)continue;const Y=z.querySelectorAll("em, strong, span, i, b, small, cite");for(let ot=0;ot<Y.length;ot++){const U=Y[ot];if(U===F)continue;const Q=(R=U.textContent)===null||R===void 0?void 0:R.trim();if(Q&&Q.length>0)return U}}return null}function l(C){var N;const O=((N=C.textContent)===null||N===void 0?void 0:N.trim())||"";return!(O.length<10||O.startsWith("http://")||O.startsWith("https://"))&&!i.test(O)&&!O.match(/^\d+$/)&&!c.test(O)}function m(C,N){const O=C.tagName.toLowerCase();if(O==="img")return v(C,N);if(O==="picture"){const T=C.querySelector("img");return T?v(T,N):C.cloneNode(!0)}return O==="source"?(function(T,R){const D=R.createElement("img"),$=T.getAttribute("srcset");$&&u($,D);const M=T.parentElement;if(M){const W=M.querySelectorAll("img"),B=[];for(let H=0;H<W.length;H++){const k=W[H],F=k.getAttribute("src")||"";b(F)||g(F)||F===""||B.push(k)}if(B.length>0){if(h(B[0],D,["src","srcset"]),!D.hasAttribute("src")||!y(D.getAttribute("src")||"")){const H=B[0].getAttribute("src");H&&y(H)&&D.setAttribute("src",H)}}else{const H=M.querySelector("img[data-src]");if(H&&(h(H,D,["src","srcset"]),!D.hasAttribute("src")||!y(D.getAttribute("src")||""))){const k=H.getAttribute("data-src");k&&y(k)&&D.setAttribute("src",k)}}}return D})(C,N):C.cloneNode(!0)}function v(C,N){const O=C.getAttribute("src")||"";if(b(O)||g(O)){const T=C.parentElement;if(T){const R=T.querySelectorAll("source"),D=[];for(let $=0;$<R.length;$++){const M=R[$];M.hasAttribute("data-srcset")&&M.getAttribute("data-srcset")!==""&&D.push(M)}if(D.length>0){const $=N.createElement("img"),M=C.getAttribute("data-src");return M&&!g(M)&&$.setAttribute("src",M),h(C,$,["src"]),$}}}return C.cloneNode(!0)}function E(C){if(!C||!C.trim())return null;const N=C.trim(),O=/(.+?)\s+(\d+(?:\.\d+)?[wx])/g;let T,R=0;for(;(T=O.exec(N))!==null;){let $=T[1].trim();if(R>0&&($=$.replace(/^,\s*/,"")),R=O.lastIndex,$&&!g($))return $}const D=N.match(o);return D&&D[1]&&!g(D[1])?D[1]:null}function q(C){if(C.length===0)return null;if(C.length===1)return C[0];for(let T=0;T<C.length;T++)if(!C[T].hasAttribute("media"))return C[T];let N=null,O=0;for(let T=0;T<C.length;T++){const R=C[T],D=R.getAttribute("srcset");if(!D)continue;const $=D.match(r),M=D.match(e);if($&&$[1]){const W=parseInt($[1],10)*(M?parseFloat(M[1]):1);W>O&&(O=W,N=R)}}return N||C[0]}w.imageRules=[{selector:"picture",element:"picture",transform:(C,N)=>{const O=C.querySelectorAll("source"),T=C.querySelector("img");if(!T){const $=q(O);if($){const M=$.getAttribute("srcset");if(M){const W=N.createElement("img");return u(M,W),C.replaceChildren(W),C}}return C}let R=null,D=null;if(O.length>0){const $=q(O);$&&(R=$.getAttribute("srcset"),R&&(D=E(R)))}if(R&&T.setAttribute("srcset",R),D&&y(D))T.setAttribute("src",D);else if(!T.hasAttribute("src")||!y(T.getAttribute("src")||"")){const $=E(T.getAttribute("srcset")||R||"");$&&y($)&&T.setAttribute("src",$)}return O.forEach(($=>$.remove())),C}},{selector:"uni-image-full-width",element:"figure",transform:(C,N)=>{var O;const T=N.createElement("figure"),R=N.createElement("img"),D=C.querySelector("img");if(!D)return T;let $=D.getAttribute("src");const M=D.getAttribute("data-loading");if(M)try{const H=JSON.parse(M);H.desktop&&y(H.desktop)&&($=H.desktop)}catch{}if(!$||!y($))return T;R.setAttribute("src",$);let W=D.getAttribute("alt");W||(W=C.getAttribute("alt-text")),W&&R.setAttribute("alt",W),T.appendChild(R);const B=C.querySelector("figcaption");if(B){const H=(O=B.textContent)===null||O===void 0?void 0:O.trim();if(H&&H.length>5){const k=N.createElement("figcaption"),F=B.querySelector(".rich-text p");F?(0,L.transferContent)(F,k):k.textContent=H,T.appendChild(k)}}return T}},{selector:'img[data-src], img[data-srcset], img[loading="lazy"], img.lazy, img.lazyload, img[src^="data:image/svg+xml"]',element:"img",transform:(C,N)=>{const O=C.getAttribute("src")||"",T=(function($){if($.hasAttribute("data-src")||$.hasAttribute("data-srcset"))return!0;for(let M=0;M<$.attributes.length;M++){const W=$.attributes[M];if(W.name!=="src"&&(W.name.startsWith("data-")&&/\.(jpg|jpeg|png|webp|gif)(\?.*)?$/i.test(W.value)||/\.(jpg|jpeg|png|webp|gif)(\?.*)?$/i.test(W.value)))return!0}return!1})(C);(b(O)||g(O))&&T&&C.removeAttribute("src");const R=C.getAttribute("data-src");R&&!C.getAttribute("src")&&C.setAttribute("src",R);const D=C.getAttribute("data-srcset");D&&!C.getAttribute("srcset")&&C.setAttribute("srcset",D);for(let $=0;$<C.attributes.length;$++){const M=C.attributes[$];if(M.name==="src"||M.name==="srcset"||M.name==="alt")continue;const W=M.value.charAt(0);if(W!=="{"&&W!=="["){if(S.test(M.value))C.setAttribute("srcset",M.value);else if(n.test(M.value)){const B=C.getAttribute("src")||"",H=s.test(B),k=s.test(M.value);H&&!k||C.setAttribute("src",M.value)}}}return C.classList.remove("lazy","lazyload"),C.removeAttribute("data-ll-status"),C.removeAttribute("data-src"),C.removeAttribute("data-srcset"),C.removeAttribute("loading"),C}},{selector:"span:has(img)",element:"span",transform:(C,N)=>{try{if(!a(C))return C;for(const D of C.children)if(_.BLOCK_LEVEL_ELEMENTS.has(D.tagName.toLowerCase()))return C;const O=p(C);if(!O)return C;const T=x(C),R=m(O,N);if(T&&l(T)){const D=f(R,T,N);return T.parentNode&&T.parentNode.removeChild(T),D}return R}catch{return C}}},{selector:'figure, p:has([class*="caption"])',element:"figure",transform:(C,N)=>{try{if(!a(C))return C;const O=p(C);if(!O)return C;const T=x(C);if(T&&l(T)){const R=p(C);let D;return D=R||m(O,N),f(D,T,N)}return C}catch{return C}}}]},7282(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.LOOKS_LIKE_LATEX_RE=w.mathSelectors=w.mathFastCheck=w.isBlockDisplay=w.getBasicLatexFromElement=w.getMathMLFromElement=w.reconstructMathMLFromMjx=void 0,w.extractLatexFromImageSrc=function(a){for(const x of f){const l=a.match(x);if(l){const m=u(l[1]);if(m)return m}}const d=a.match(/\?([^#]+)/);if(d){const x=u(d[1]);if(x)return x}const p=a.split("?")[0].split("/");for(let x=p.length-1;x>=0;x--)if(/%5[Cc]/.test(p[x])){const l=u(p[x]);if(l)return l}return null},w.wrapRawLatexDelimiters=function(a,d){var p,x;if(!(function(v){const E=Array.from(v.querySelectorAll("script[src]"));for(const C of E){const N=(C.getAttribute("src")||"").toLowerCase();if(N.includes("mathjax")||N.includes("katex"))return!0}const q=Array.from(v.querySelectorAll("script:not([src])"));for(const C of q){const N=C.textContent||"";if(/MathJax\s*[.=]/.test(N)||/katex/i.test(N))return!0}return!1})(d)||a.querySelector(w.mathFastCheck))return;const l=[];(function v(E){if(!(0,L.isElement)(E)||!y.has(E.tagName))if((0,L.isTextNode)(E))l.push(E);else for(let q=E.firstChild;q;q=q.nextSibling)v(q)})(a);for(const v of l){const E=v.textContent||"";if(!E.includes("$")&&!E.includes("\\(")&&!E.includes("\\["))continue;const q=[];let C,N=0,O=!1;for(h.lastIndex=0;(C=h.exec(E))!==null;){const R=(p=C[1])!==null&&p!==void 0?p:C[2],D=(x=C[3])!==null&&x!==void 0?x:C[4],$=R!==void 0,M=(R??D).trim();(C[2]!==void 0||C[4]!==void 0||(m=M,b.test(m)||g.test(m)))&&(N<C.index&&q.push(E.slice(N,C.index)),$&&(O=!0),q.push({latex:M,isBlock:$}),N=C.index+C[0].length)}if(q.length===0)continue;if(N<E.length&&q.push(E.slice(N)),O){const R=q.some((M=>typeof M=="string"&&M.trim().length>0)),D=v.parentElement,$=!!D&&Array.from(D.childNodes).some((M=>M!==v&&((0,L.isTextNode)(M)&&(M.textContent||"").trim().length>0||(0,L.isElement)(M))));if(R||$)for(const M of q)typeof M!="string"&&(M.isBlock=!1)}const T=d.createDocumentFragment();for(const R of q)if(typeof R=="string")T.appendChild(d.createTextNode(R));else{const D=d.createElement("math");D.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),D.setAttribute("display",R.isBlock?"block":"inline"),D.setAttribute("data-latex",R.latex),D.textContent=R.latex,T.appendChild(D)}v.replaceWith(T)}var m};const P=I(639),L=I(2552),_=/[\u2061\u2062\u2063\u2064]/g,A=a=>a.normalize("NFKC").replace(_,""),S=new Set(["mi","mo","mn","mtext","ms","mspace","mglyph"]),n=new Set(["mrow","mstyle","mpadded","mphantom","menclose","merror","mtable","mtr","mtd","mlabeledtr"]),t=new Set(["mjx-nstrut","mjx-dstrut","mjx-strut","mjx-line","mjx-spacer","mjx-break","mjx-mark"]),r=(a,d)=>{for(const p of Array.from(a.children))if(p.tagName.toLowerCase()===d)return p;return null},e=(a,d,p)=>{if(!a)return[];const x=[];for(const l of Array.from(a.children))l!==p&&x.push(...i(l,d));return x},o=(a,d)=>{if(a.length===1)return a[0];const p=d.createElement("mrow");return a.forEach((x=>p.appendChild(x))),p},s=(a,d,p)=>{const x=p.createElement(a);return d.forEach((l=>x.appendChild(l))),x},i=(a,d)=>{const p=a.tagName.toLowerCase();if(p==="mjx-c"){const l=A(a.textContent||"");return l?[d.createTextNode(l)]:[]}if(t.has(p))return[];if(!p.startsWith("mjx-"))return[];const x=p.slice(4);if(S.has(x)){const l=A(a.textContent||"");if(!l&&x!=="mspace")return[];const m=d.createElement(x);return l&&(m.textContent=l),[m]}if(n.has(x))return[s(x,e(a,d),d)];switch(x){case"mfrac":{const l=o(e(a.querySelector("mjx-num"),d),d),m=o(e(a.querySelector("mjx-den"),d),d);return[s("mfrac",[l,m],d)]}case"msqrt":{const l=a.querySelector("mjx-box");return[s("msqrt",e(l||a,d),d)]}case"msub":case"msup":{const l=r(a,"mjx-script"),m=o(e(a,d,l),d),v=o(e(l,d),d);return[s(x,[m,v],d)]}case"msubsup":{const l=r(a,"mjx-script"),m=o(e(a,d,l),d),v=e(l,d),E=v.length>1?v[v.length-1]:v[0]||d.createElement("mrow"),q=v.length>1?v[0]:d.createElement("mrow");return[s("msubsup",[m,E,q],d)]}case"munder":case"mover":case"munderover":{const l=o(e(a.querySelector("mjx-base"),d),d),m=a.querySelector("mjx-under"),v=a.querySelector("mjx-over");return x==="munder"?[s("munder",[l,o(e(m,d),d)],d)]:x==="mover"?[s("mover",[l,o(e(v,d),d)],d)]:[s("munderover",[l,o(e(m,d),d),o(e(v,d),d)],d)]}default:return e(a,d)}};w.reconstructMathMLFromMjx=(a,d)=>{const p=d.createElement("math");p.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML");for(const l of Array.from(a.children))for(const m of i(l,d))p.appendChild(m);if(p.childNodes.length===0)return null;const x=a.getAttribute("display")==="true";return x&&p.setAttribute("display","block"),{mathml:p.outerHTML,latex:null,isBlock:x}};const c=a=>{const d=a.cloneNode(!0);return(p=>{const x=p.ownerDocument;if(!x)return;const l=Array.from(p.querySelectorAll("mtable"));for(const m of l){const v=Array.from(m.children).filter((T=>{const R=T.tagName.toLowerCase();return R==="mtr"||R==="mlabeledtr"}));if(v.length!==1)continue;const E=v[0];if(E.tagName.toLowerCase()!=="mlabeledtr")continue;const q=Array.from(E.children).filter((T=>T.tagName.toLowerCase()==="mtd"));if(q.length<2)continue;const[C,...N]=q,O=x.createElement("mrow");for(const T of N)for(;T.firstChild;)O.appendChild(T.firstChild);if(C.childNodes.length>0){const T=x.createElement("mspace");for(T.setAttribute("width","2em"),O.appendChild(T);C.firstChild;)O.appendChild(C.firstChild)}m.replaceWith(O)}})(d),d.outerHTML};w.getMathMLFromElement=a=>{if(a.tagName.toLowerCase()==="math"){const m=a.getAttribute("display")==="block";return{mathml:c(a),latex:a.getAttribute("alttext")||null,isBlock:m}}const d=a.getAttribute("data-mathml");if(d){const m=a.ownerDocument||document,v=(0,P.parseHTML)(m,d).querySelector("math");if(v){const E=v.getAttribute("display")==="block";return{mathml:c(v),latex:v.getAttribute("alttext")||null,isBlock:E}}}const p=a.querySelector(".MJX_Assistive_MathML, mjx-assistive-mml");if(p){const m=p.querySelector("math");if(m){const v=m.getAttribute("display"),E=p.getAttribute("display"),q=v==="block"||E==="block";return{mathml:c(m),latex:m.getAttribute("alttext")||null,isBlock:q}}}const x=a.querySelector(".katex-mathml math");if(x)return{mathml:c(x),latex:null,isBlock:!1};const l=a.tagName.toLowerCase()==="mjx-math"?a:a.querySelector("mjx-math");if(l){const m=a.ownerDocument||document,v=(0,w.reconstructMathMLFromMjx)(l,m);if(v)return v}return null},w.getBasicLatexFromElement=a=>{var d,p,x,l;const m=a.getAttribute("data-latex");if(m)return m;const v=a.getAttribute("data-math");if(v)return v;const E=!((d=a.parentElement)===null||d===void 0)&&d.classList.contains("hurmet-tex")?a.parentElement.getAttribute("data-entry"):null;if(E)return E;if(a.tagName.toLowerCase()==="img"&&a.classList.contains("latex")){const C=a.getAttribute("alt");if(C)return C;const N=a.getAttribute("src");if(N){const O=N.match(/latex\.php\?latex=([^&]+)/);if(O)return decodeURIComponent(O[1]).replace(/\+/g," ").replace(/%5C/g,"\\")}}const q=a.querySelector('annotation[encoding="application/x-tex"]');if(q?.textContent)return q.textContent.trim();if(a.matches(".katex")){const C=a.querySelector('.katex-mathml annotation[encoding="application/x-tex"]');if(C?.textContent)return C.textContent.trim()}if(a.matches('script[type="math/tex"]')||a.matches('script[type="math/tex; mode=display"]'))return((p=a.textContent)===null||p===void 0?void 0:p.trim())||null;if(a.parentElement){const C=a.parentElement.querySelector('script[type="math/tex"], script[type="math/tex; mode=display"]');if(C)return((x=C.textContent)===null||x===void 0?void 0:x.trim())||null}return a.tagName.toLowerCase()==="math"&&(!((l=a.textContent)===null||l===void 0)&&l.trim())?a.textContent.trim():a.getAttribute("alt")||null},w.isBlockDisplay=a=>{if(a.getAttribute("display")==="block")return!0;const d=(0,P.getClassName)(a).toLowerCase();if(d.includes("display")||d.includes("block")||a.closest('.katex-display, .MathJax_Display, [data-display="block"]'))return!0;const p=a.previousElementSibling;if(p?.tagName.toLowerCase()==="p"||a.matches(".mwe-math-fallback-image-display"))return!0;if(a.matches(".katex"))return a.closest(".katex-display")!==null;if(a.hasAttribute("display"))return a.getAttribute("display")==="true";if(a.matches('script[type="math/tex; mode=display"]'))return!0;const x=a.closest("[display]");return!!x&&x.getAttribute("display")==="true"},w.mathFastCheck='math, mjx-container, .MathJax, .katex, img.latex, [data-math], [data-latex], script[type^="math/"]',w.mathSelectors=['img.latex[src*="latex.php"]',"span.MathJax","mjx-container",'script[type="math/tex"]','script[type="math/tex; mode=display"]','.MathJax_Preview + script[type="math/tex"]',".MathJax_Display",".MathJax_SVG",".MathJax_MathML",".mwe-math-element",".mwe-math-fallback-image-inline",".mwe-math-fallback-image-display",".mwe-math-mathml-inline",".mwe-math-mathml-display",".katex",".katex-display",".katex-mathml",".katex-html","[data-katex]",'script[type="math/katex"]',"math","[data-math]","[data-latex]","[data-tex]",'script[type^="math/"]','annotation[encoding="application/x-tex"]'].join(",");const f=["latex","chl","tex","eq","math"].map((a=>new RegExp(`[?&]${a}=([^&#]+)`,"i")));function u(a){try{const d=decodeURIComponent(a.replace(/\+/g," "));return w.LOOKS_LIKE_LATEX_RE.test(d)?d:null}catch{return null}}w.LOOKS_LIKE_LATEX_RE=/\\[a-zA-Z]{2,}/;const h=/\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\]|\$([^\s$][^$]*[^\s$]|[^\s$])\$|\\\(([\s\S]+?)\\\)/g,b=/\\[a-zA-Z]/,g=/[_^{}]/,y=new Set(["PRE","CODE","SCRIPT","STYLE","MATH","SVG","TEXTAREA"])},6e3(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.mathRules=w.createCleanMathEl=void 0;const P=I(7282),L=I(639);w.createCleanMathEl=(_,A,S,n)=>{const t=n.createElement("math");if(t.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),t.setAttribute("display",S?"block":"inline"),t.setAttribute("data-latex",A||""),_?.mathml){const r=(0,L.parseHTML)(n,_.mathml).querySelector("math");r&&(0,L.transferContent)(r,t)}else A&&(t.textContent=A);return t},w.mathRules=[{selector:P.mathSelectors,element:"math",fastCheck:P.mathFastCheck,transform:(_,A)=>{if(!(function(e){return"classList"in e&&"getAttribute"in e&&"querySelector"in e})(_))return _;const S=(0,P.getMathMLFromElement)(_),n=(0,P.getBasicLatexFromElement)(_),t=(0,P.isBlockDisplay)(_),r=(0,w.createCleanMathEl)(S,n,t,A);return _.parentElement&&!_.matches('script[type^="math/"]')&&_.parentElement.querySelectorAll('script[type^="math/"], .MathJax_Preview, script[type="text/javascript"][src*="mathjax"], script[type="text/javascript"][src*="katex"]').forEach((e=>e.remove())),r}}]},1917(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ExtractorRegistry=void 0;const P=I(5959),L=I(2248),_=I(1064),A=I(3258),S=I(9759),n=I(2458),t=I(8632),r=I(8397),e=I(3020),o=I(4732),s=I(3588),i=I(5666),c=I(3055),f=I(27),u=I(6581),h=I(8090),b=I(2144),g=I(8477),y=I(9970),a=I(5654),d=I(4454),p=I(1756),x=I(7228),l=I(7278),m=I(9964);class v{static initialize(){this.register({patterns:["x.com","twitter.com"],extractor:_.XArticleExtractor}),this.register({patterns:["twitter.com",/\/x\.com\/.*/],extractor:L.TwitterExtractor}),this.register({patterns:["x.com","twitter.com"],extractor:i.XOembedExtractor}),this.register({patterns:["reddit.com","old.reddit.com","new.reddit.com",/^https:\/\/[^\/]+\.reddit\.com/],extractor:P.RedditExtractor}),this.register({patterns:["youtube.com","youtu.be",/youtube\.com\/watch\?v=.*/,/youtu\.be\/.*/],extractor:A.YoutubeExtractor}),this.register({patterns:["bilibili.com",/www\.bilibili\.com\/video\/BV[0-9A-Za-z]+/],extractor:S.BilibiliExtractor}),this.register({patterns:["news.ycombinator.com"],extractor:n.HackerNewsExtractor}),this.register({patterns:[/^https?:\/\/chatgpt\.com\/(c|share)\/.*/],extractor:t.ChatGPTExtractor}),this.register({patterns:["claude.ai",/^https?:\/\/claude\.ai\/(chat|share)\/.*/],extractor:r.ClaudeExtractor}),this.register({patterns:[/^https?:\/\/grok\.com\/(chat|share)(\/.*)?$/],extractor:e.GrokExtractor}),this.register({patterns:[/^https?:\/\/gemini\.google\.com\/app\/.*/],extractor:o.GeminiExtractor}),this.register({patterns:["github.com",/^https?:\/\/github\.com\/.*/],extractor:s.GitHubExtractor}),this.register({patterns:["linkedin.com"],extractor:g.LinkedInExtractor}),this.register({patterns:["threads.net","www.threads.com","threads.com"],extractor:y.ThreadsExtractor}),this.register({patterns:["bsky.app"],extractor:a.BlueskyExtractor}),this.register({patterns:["medium.com",/\.medium\.com/],extractor:p.MediumExtractor}),this.register({patterns:["wiki.c2.com"],extractor:f.C2WikiExtractor}),this.register({patterns:[/^https?:\/\/substack\.com\/@[^/]+\/note\/.+/,/^https?:\/\/substack\.com\/home\/post\/p-\d+/,"substack.com"],extractor:u.SubstackExtractor}),this.register({patterns:["nytimes.com"],extractor:h.NytimesExtractor}),this.register({patterns:["wikipedia.org"],extractor:b.WikipediaExtractor}),this.register({patterns:[/\/@[^/]+\/\d+/],extractor:m.MastodonExtractor}),this.register({patterns:[/\/t\/[^/]+\/\d+/],extractor:d.DiscourseExtractor}),this.register({patterns:["leetcode.com"],extractor:x.LeetCodeExtractor}),this.register({patterns:["lwn.net"],extractor:l.LwnExtractor}),this.register({patterns:[/.*/],extractor:c.BbcodeDataExtractor})}static register(q){this.mappings.push(q)}static findExtractor(q,C,N,O){return this.findByPredicate(q,C,N,(T=>T.canExtract()),O)}static findAsyncExtractor(q,C,N,O){return this.findByPredicate(q,C,N,(T=>T.canExtractAsync()),O)}static findPreferredAsyncExtractor(q,C,N,O){return this.findByPredicate(q,C,N,(T=>T.canExtractAsync()&&T.prefersAsync()),O)}static findByPredicate(q,C,N,O,T){try{const R=new URL(C).hostname;for(const{patterns:D,extractor:$}of this.mappings)if(D.some((M=>M instanceof RegExp?M.test(C):R.includes(M)))){const M=new $(q,C,N,T);if(O(M))return M}return null}catch(R){return console.error("Error finding extractor:",R),null}}}w.ExtractorRegistry=v,v.mappings=[],v.initialize()},2279(at,w){var I=this&&this.__awaiter||function(P,L,_,A){return new(_||(_=Promise))((function(S,n){function t(o){try{e(A.next(o))}catch(s){n(s)}}function r(o){try{e(A.throw(o))}catch(s){n(s)}}function e(o){var s;o.done?S(o.value):(s=o.value,s instanceof _?s:new _((function(i){i(s)}))).then(t,r)}e((A=A.apply(P,L||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.BaseExtractor=void 0,w.BaseExtractor=class{constructor(P,L,_,A){this.document=P,this.url=L,this.schemaOrgData=_,this.options=A||{}}get fetch(){return(this.options.fetch||globalThis.fetch).bind(globalThis)}postTitle(P,L){return`Post by ${P} on ${L}`}canExtractAsync(){return!1}prefersAsync(){return!1}extractAsync(){return I(this,void 0,void 0,(function*(){return this.extract()}))}}},5181(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ConversationExtractor=void 0;const P=I(2279),L=I(5628),_=I(639);class A extends P.BaseExtractor{getFootnotes(){return[]}extract(){var n;const t=this.extractMessages(),r=this.getMetadata(),e=this.getFootnotes(),o=this.createContentHtml(t,e),s=this.createTemporaryDocument(),i=s.createElement("article");i.appendChild((0,_.parseHTML)(s,o)),s.body.appendChild(i);const c=new L.Defuddle(s,{url:"about:blank"}).parse(),f=c.content;return{content:f,contentHtml:f,extractedContent:{messageCount:t.length.toString()},variables:{title:r.title||"Conversation",site:r.site,description:r.description||`${r.site} conversation with ${t.length} messages`,wordCount:((n=c.wordCount)===null||n===void 0?void 0:n.toString())||""}}}createTemporaryDocument(){var n;const t=this.document.implementation;if(t?.createHTMLDocument)return t.createHTMLDocument();const r=((n=this.document.defaultView)===null||n===void 0?void 0:n.DOMParser)||globalThis.DOMParser;if(r)return new r().parseFromString("<!doctype html><html><body></body></html>","text/html");throw new Error("Unable to create a temporary document for conversation extraction")}createContentHtml(n,t){return`${n.map(((r,e)=>{const o=r.timestamp?`<div class="message-timestamp">${r.timestamp}</div>`:"",s=/<p[^>]*>[\s\S]*?<\/p>/i.test(r.content)?r.content:`<p>${r.content}</p>`,i=r.metadata?Object.entries(r.metadata).map((([c,f])=>`data-${c}="${f}"`)).join(" "):"";return`
|
|
13
|
+
<div class="message message-${r.author.toLowerCase()}" ${i}>
|
|
14
|
+
<div class="message-header">
|
|
15
|
+
<p class="message-author"><strong>${r.author}</strong></p>
|
|
16
|
+
${o}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="message-content">
|
|
19
|
+
${s}
|
|
20
|
+
</div>
|
|
21
|
+
</div>${e<n.length-1?`
|
|
22
|
+
<hr>`:""}`})).join(`
|
|
23
|
+
`).trim()}
|
|
24
|
+
${t.length>0?`
|
|
25
|
+
<div id="footnotes">
|
|
26
|
+
<ol>
|
|
27
|
+
${t.map(((r,e)=>`
|
|
28
|
+
<li class="footnote" id="fn:${e+1}">
|
|
29
|
+
<p>
|
|
30
|
+
<a href="${r.url}" target="_blank">${r.text}</a> <a href="#fnref:${e+1}" class="footnote-backref">↩</a>
|
|
31
|
+
</p>
|
|
32
|
+
</li>
|
|
33
|
+
`)).join("")}
|
|
34
|
+
</ol>
|
|
35
|
+
</div>`:""}`.trim()}}w.ConversationExtractor=A},3055(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.BbcodeDataExtractor=void 0;const P=I(2279),L=I(6618);class _ extends P.BaseExtractor{constructor(){super(...arguments),this.eventData=void 0}canExtract(){var S,n;return!!(!((n=(S=this.getEventData())===null||S===void 0?void 0:S.announcement_body)===null||n===void 0)&&n.body)}extract(){const S=this.getEventData(),n=S.announcement_body,t=(0,L.bbcodeToHtml)(n.body||""),r=n.headline||S.event_name||"",e=n.posttime?new Date(1e3*n.posttime).toISOString():"";return{content:t,contentHtml:t,extractedContent:{},variables:{title:r,author:this.getGroupName(),published:e}}}getEventData(){var S;return this.eventData===void 0&&(this.eventData=(S=this.parseConfigAttr("data-partnereventstore"))!==null&&S!==void 0?S:null),this.eventData}getGroupName(){const S=this.parseConfigAttr("data-groupvanityinfo");return S?.group_name||""}parseConfigAttr(S){const n=this.document.querySelector("#application_config"),t=n?.getAttribute(S);if(!t)return null;try{const r=JSON.parse(t);return Array.isArray(r)?r[0]:r}catch{return null}}}w.BbcodeDataExtractor=_},9759(at,w,I){var P=this&&this.__awaiter||function(r,e,o,s){return new(o||(o=Promise))((function(i,c){function f(b){try{h(s.next(b))}catch(g){c(g)}}function u(b){try{h(s.throw(b))}catch(g){c(g)}}function h(b){var g;b.done?i(b.value):(g=b.value,g instanceof o?g:new o((function(y){y(g)}))).then(f,u)}h((s=s.apply(r,e||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.BilibiliExtractor=void 0;const L=I(2279),_=I(639),A=I(1497),S=4e3,n=/[\u4E00-\u9FFF]/;class t extends L.BaseExtractor{constructor(e,o,s,i){super(e,o,s,i)}canExtract(){return!!this.getBvid()}canExtractAsync(){return this.canExtract()}prefersAsync(){return!0}extract(){return this.buildResult()}extractAsync(){return P(this,void 0,void 0,(function*(){var e;const o=this.getBvid();if(!o)return this.buildResult();const s=yield this.fetchViewData(o);if(!s)return this.buildResult();const{aid:i,pages:c=[]}=s,f=this.getPageNumber(),u=c.length>0?(e=c[f-1])!==null&&e!==void 0?e:c[0]:void 0,h=u?.cid,b=this.normalizeLanguageCode(this.options.language),g=i&&h?`${o}:${h}:${b}`:"";let y;if(i&&h){if(g&&t.transcriptCache.has(g)){const a=t.transcriptCache.get(g);y=a??void 0}else if(y=yield this.fetchTranscript(i,h,o),g&&(t.transcriptCache.set(g,y??null),t.transcriptCache.size>300)){const a=t.transcriptCache.keys().next().value;a&&t.transcriptCache.delete(a)}}return this.buildResult(y,s,u,f)}))}getBvid(){var e;if(this._bvid!==void 0)return this._bvid;try{const o=new URL(this.url).pathname.match(/\/video\/(BV[0-9A-Za-z]+)\/?/);this._bvid=(e=o?.[1])!==null&&e!==void 0?e:""}catch{this._bvid=""}return this._bvid}getPageNumber(){try{const e=new URL(this.url),o=parseInt(new URLSearchParams(e.search).get("p")||"1",10);return Number.isFinite(o)&&o>0?o:1}catch{return 1}}formatDescription(e){const o=(0,_.escapeHtml)(e).replace(/\n/g,"<br>");return o?`<p>${o}</p>`:""}buildEmbedHtml(e,o){return`<iframe width="560" height="315" src="${`https://player.bilibili.com/player.html?bvid=${encodeURIComponent(e)}&page=${o}&high_quality=1&danmaku=0`}" title="Bilibili video player" frameborder="0" allowfullscreen></iframe>`}buildResult(e,o,s,i){var c;const f=this.getBvid(),u=o?.title||this.document.title||"",h=((c=o?.owner)===null||c===void 0?void 0:c.name)||"",b=o?.desc||"",g=b.slice(0,200).trim(),y=o?.pic||"",a=o?.pubdate?new Date(1e3*o.pubdate).toISOString():"";let d="";f&&(d+=this.buildEmbedHtml(f,i||this.getPageNumber())),b&&(d+=this.formatDescription(b)),e?.html&&(d+=e.html);const p={title:u,author:h,site:"Bilibili",image:y,published:a,description:g};return s?.part&&(p.part=s.part),e?.text&&(p.transcript=e.text),e?.languageCode&&(p.language=e.languageCode),{content:d,contentHtml:d,extractedContent:Object.assign({videoId:f},s?.cid?{cid:String(s.cid)}:{}),variables:p}}normalizeLanguageCode(e){return(e||"").trim().replace(/_/g,"-").toLocaleLowerCase()}pickSubtitleTrack(e,o){var s;if(e.length===0)return;const i=this.normalizeLanguageCode(o),c=i?i.split("-")[0]:"",f=u=>(u||"").trim().toLocaleLowerCase();return(s=e.map(((u,h)=>{const b=this.normalizeLanguageCode(u.lan);let g=3;i&&(b===i?g=0:c&&b===c?g=1:c&&b.split("-")[0]===c&&(g=2));const y=u.is_ai_subtitle||(d=>{const p=f(d);return p.includes("ai")||p.includes("auto")||p.includes("自动")})(u.lan_doc)?1:0,a=(d=>d==="zh-cn"||d==="zh-hans"?0:d==="zh"?1:d.startsWith("zh-")?2:d==="en"||d.startsWith("en-")?3:4)(b);return{t:u,prefScore:g,aiScore:y,lp:a,id:typeof u.id=="number"?u.id:Number.MAX_SAFE_INTEGER,doc:f(u.lan_doc),urlKey:(d=>{const p=(d||"").trim();if(!p)return"";try{const x=p.startsWith("//")?`https:${p}`:p,l=new URL(x);return`${l.hostname.toLocaleLowerCase()}${l.pathname}`}catch{return p.split("?")[0].split("#")[0]}})(u.subtitle_url),index:h}})).sort(((u,h)=>u.prefScore!==h.prefScore?u.prefScore-h.prefScore:u.aiScore!==h.aiScore?u.aiScore-h.aiScore:u.lp!==h.lp?u.lp-h.lp:u.id!==h.id?u.id-h.id:u.doc!==h.doc?u.doc.localeCompare(h.doc):u.urlKey!==h.urlKey?u.urlKey.localeCompare(h.urlKey):u.index-h.index))[0])===null||s===void 0?void 0:s.t}fetchViewData(e){return P(this,void 0,void 0,(function*(){try{const o=`https://api.bilibili.com/x/web-interface/view?bvid=${encodeURIComponent(e)}`,s=yield this.fetch(o,{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},credentials:"include",signal:AbortSignal.timeout(S)});if(!s.ok)return;const i=yield s.json();return i?.code!==0?void 0:i.data}catch{return}}))}parseSubtitleTracks(e){var o,s,i,c,f,u;const h=[(s=(o=e?.data)===null||o===void 0?void 0:o.subtitle)===null||s===void 0?void 0:s.subtitles,(c=(i=e?.data)===null||i===void 0?void 0:i.subtitle)===null||c===void 0?void 0:c.list,(u=(f=e?.data)===null||f===void 0?void 0:f.subtitle)===null||u===void 0?void 0:u.tracks];for(const b of h)if(Array.isArray(b))return b.map((g=>{var y,a,d,p,x,l;return{lan:String((d=(a=(y=g?.lan)!==null&&y!==void 0?y:g?.lang)!==null&&a!==void 0?a:g?.language)!==null&&d!==void 0?d:""),lan_doc:g?.lan_doc?String(g.lan_doc):void 0,subtitle_url:String((l=(x=(p=g?.subtitle_url)!==null&&p!==void 0?p:g?.subtitleUrl)!==null&&x!==void 0?x:g?.url)!==null&&l!==void 0?l:""),id:typeof g?.id=="number"?g.id:typeof g?.subtitle_id=="number"?g.subtitle_id:void 0,is_ai_subtitle:typeof g?.is_ai_subtitle=="boolean"?g.is_ai_subtitle:typeof g?.ai_type=="number"?g.ai_type>0:void 0}})).filter((g=>!!g.lan&&!!g.subtitle_url));return[]}fetchPlayerV2(e){return P(this,void 0,void 0,(function*(){const o=yield this.fetch(e,{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},credentials:"include",signal:AbortSignal.timeout(S)});if(!o.ok)return{tracks:[],code:o.status,message:`http_${o.status}`};const s=yield o.json(),i=typeof s?.code=="number"?s.code:void 0,c=typeof s?.message=="string"?s.message:void 0;return i!==0?{tracks:[],code:i,message:c}:{tracks:this.parseSubtitleTracks(s),code:i,message:c}}))}fetchTranscript(e,o,s){return P(this,void 0,void 0,(function*(){try{const i=`https://api.bilibili.com/x/player/wbi/v2?bvid=${encodeURIComponent(String(s))}&aid=${encodeURIComponent(String(e))}&cid=${encodeURIComponent(String(o))}`,c=`https://api.bilibili.com/x/player/v2?bvid=${encodeURIComponent(String(s))}&cid=${encodeURIComponent(String(o))}`,f=`https://api.bilibili.com/x/player/v2?aid=${encodeURIComponent(String(e))}&cid=${encodeURIComponent(String(o))}`;let u=[];if(u=(yield this.fetchPlayerV2(i)).tracks,u.length===0&&(u=(yield this.fetchPlayerV2(c)).tracks,u.length===0&&(u=(yield this.fetchPlayerV2(f)).tracks)),!Array.isArray(u)||u.length===0)return;const h=this.pickSubtitleTrack(u,this.options.language);if(!h?.subtitle_url)return;const b=this.normalizeSubtitleUrl(h.subtitle_url);if(!b||!this.isAllowedSubtitleHost(b))return;const g=yield this.fetch(b.toString(),{headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"},signal:AbortSignal.timeout(S)});if(!g.ok)return;const y=yield g.json(),a=this.parseSubtitleJson(y);return a?Object.assign(Object.assign({},a),{languageCode:h.lan}):void 0}catch{return}}))}normalizeSubtitleUrl(e){try{const o=(e||"").trim();if(!o)return null;const s=o.startsWith("//")?`https:${o}`:o,i=new URL(s);return i.protocol!=="https:"?null:i}catch{return null}}isAllowedSubtitleHost(e){const o=e.hostname.toLocaleLowerCase();return o.endsWith(".hdslb.com")||o.endsWith(".bilibili.com")}parseSubtitleJson(e){const o=(Array.isArray(e?.body)?e.body:[]).map((f=>({start:typeof f.from=="number"?f.from:NaN,end:typeof f.to=="number"?f.to:typeof f.from=="number"?f.from:NaN,text:(f.content||"").trim()}))).filter((f=>Number.isFinite(f.start)&&f.text.length>0)).sort(((f,u)=>f.start-u.start));if(o.length===0)return;const s=this.groupSubtitleLines(o),{html:i,text:c}=(0,A.buildTranscript)("bilibili",s);return{html:i,text:c}}groupSubtitleLines(e){const o=[];let s=e[0].start,i=e[0].end,c=e[0].text;const f=()=>{const u=c.replace(/\s+/g," ").trim();u&&o.push({start:Math.max(0,Math.floor(s)),text:u,speakerChange:o.length>0})};for(let u=1;u<e.length;u++){const h=e[u],b=h.start-i,g=Math.max(h.end,h.start)-s;b>20||g>30?(f(),s=h.start,i=h.end,c=h.text):(c=this.concatTranscriptText(c,h.text),i=Math.max(i,h.end))}return f(),o}concatTranscriptText(e,o){const s=(e||"").trimEnd(),i=(o||"").trimStart();if(!s)return i;if(!i)return s;const c=s[s.length-1],f=i[0],u=n.test(c),h=n.test(f);return u&&h?s+i:`${s} ${i}`}}w.BilibiliExtractor=t,t.transcriptCache=new Map},5654(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.BlueskyExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t,r,e){super(n,t,r,e),this.postItems=[],this.threadScreen=n.querySelector('[data-testid="postThreadScreen"]'),this.threadScreen&&(this.postItems=Array.from(this.threadScreen.querySelectorAll('[data-testid^="postThreadItem-by-"]')))}canExtract(){return this.postItems.length>0}extract(){const n=this.getHandle(this.postItems[0]),t=[],r=[];let e=!1;for(const g of this.postItems){const y=this.getHandle(g);e||y!==n?(e=!0,r.push(g)):t.push(g)}const o=t.map((g=>this.extractPostContent(g))).join(`
|
|
36
|
+
<hr>
|
|
37
|
+
`),s=this.options.includeReplies!==!1?this.extractComments(r):"",i=(0,_.buildContentHtml)("bluesky",o,s),c=`@${n}`,f=this.getDisplayName(this.postItems[0]),u=this.createDescription(this.postItems[0]),h=this.getPublishedDate(),b=this.postTitle(f||c,"Bluesky");return{content:i,contentHtml:i,extractedContent:{postAuthor:n},variables:Object.assign({title:b,author:f||c,site:"Bluesky",description:u},h&&{published:h})}}extractComments(n){if(n.length===0)return"";let t=0;const r=n.map((e=>{const o=this.getHandle(e),s=this.getDisplayName(e),i=this.extractPostContent(e),c=this.getReplyDate(e),f=this.getPermalink(e);return this.hasTopConnector(e)?t++:t=0,{author:s?`${s} @${o}`:`@${o}`,date:c,content:i,depth:t,url:f||void 0}}));return(0,_.buildCommentTree)(r)}hasTopConnector(n){const t=n.children[0];if(!t)return!1;const r=t.querySelectorAll("div");for(const e of Array.from(r)){const o=e.getAttribute("style")||"";if(o.includes("width: 2px")&&o.includes("background-color"))return!0}return!1}getHandle(n){const t=(n.getAttribute("data-testid")||"").match(/^postThreadItem-by-(.+)$/);return t?t[1]:""}getDisplayName(n){var t;const r=n.querySelector('a[aria-label*="avatar"]');if(r){const o=(r.getAttribute("aria-label")||"").match(/^(.+)'s avatar$/);if(o)return o[1]}const e=n.querySelectorAll('a[href^="/profile/"]');for(const o of Array.from(e)){const s=((t=o.textContent)===null||t===void 0?void 0:t.trim())||"";if(s&&!s.startsWith("@")&&!s.includes("avatar")&&!s.includes("·"))return s}return""}getPublishedDate(){const n=this.document.querySelector('meta[name="twitter:value1"]');if(n){const t=n.getAttribute("content")||"";try{return new Date(t).toISOString().split("T")[0]}catch{}}return""}getReplyDate(n){const t=n.querySelector('a[href*="/post/"]');if(!t)return"";const r=t.getAttribute("aria-label")||"";if(!r)return"";try{const e=new Date(r.replace(" at "," "));if(!isNaN(e.getTime()))return e.toISOString().split("T")[0]}catch{}return""}getPermalink(n){const t=n.querySelector('a[href*="/post/"]');if(!t)return"";const r=t.getAttribute("href")||"";return r.startsWith("http")?r:`https://bsky.app${r}`}extractPostContent(n){const t=[],r=n.querySelector('div[data-word-wrap="1"]');if(r){const i=this.cleanText(r);i&&t.push(i)}const e=this.extractImages(n);e&&t.push(e);const o=this.extractLinkCard(n);o&&t.push(o);const s=this.extractQuotedPost(n);return s&&t.push(s),t.join(`
|
|
38
|
+
`)}cleanText(n){const t=n.cloneNode(!0);t.querySelectorAll('a[href*="/profile/"]').forEach((e=>{var o;const s=((o=e.textContent)===null||o===void 0?void 0:o.trim())||"",i=e.getAttribute("href")||"";if(s.startsWith("@")){const c=s.slice(1),f=t.ownerDocument.createElement("a");f.setAttribute("href",`https://bsky.app/profile/${c}`),f.textContent=s,e.replaceWith(f)}else i.startsWith("/profile/")&&e.setAttribute("href",`https://bsky.app${i}`)})),t.querySelectorAll('a[href^="http"]').forEach((e=>{var o;const s=e.getAttribute("href")||"",i=((o=e.textContent)===null||o===void 0?void 0:o.trim())||"",c=t.ownerDocument.createElement("a");c.setAttribute("href",s),c.textContent=i,e.replaceWith(c)})),t.querySelectorAll("span, div").forEach((e=>{e.replaceWith(...Array.from(e.childNodes))}));let r=(t.innerHTML||t.textContent||"").trim();return r=r.replace(/[\u200E\u200F\u200B]/g,""),r=r.replace(/[^\S\n]+/g," ").trim(),r?r.split(/\n+/).map((e=>e.trim())).filter((e=>e)).map((e=>`<p>${e}</p>`)).join(`
|
|
39
|
+
`):""}extractImages(n){const t=[];return n.querySelectorAll('img[src*="/feed_thumbnail/"], img[src*="/feed_fullsize/"]').forEach((r=>{const e=r.getAttribute("src")||"";if(!e)return;const o=e.replace("/feed_thumbnail/","/feed_fullsize/");t.push(`<img src="${(0,L.escapeHtml)(o)}" alt="" />`)})),t.join(`
|
|
40
|
+
`)}extractLinkCard(n){const t=n.querySelectorAll('a[aria-label][href^="http"]');for(const r of Array.from(t)){if(!r.querySelector('div[style*="border"]'))continue;const e=r.getAttribute("href")||"",o=r.getAttribute("aria-label")||"",s=r.querySelector("img");if(o){let i="";if(s){const c=s.getAttribute("src")||"";i+=`<a href="${(0,L.escapeHtml)(e)}"><img src="${(0,L.escapeHtml)(c)}" alt="${(0,L.escapeHtml)(o)}" /></a>
|
|
41
|
+
`}return i+=`<p><a href="${(0,L.escapeHtml)(e)}">${(0,L.escapeHtml)(o)}</a></p>`,i}}return""}extractQuotedPost(n){const t=n.querySelectorAll('[data-testid^="postThreadItem-by-"]');for(const r of Array.from(t)){if(r===n)continue;const e=this.getHandle(r),o=this.getDisplayName(r),s=r.querySelector('div[data-word-wrap="1"]'),i=s?this.cleanText(s):"";return(0,_.buildQuotedPost)({author:o?`${o} @${e}`:`@${e}`,content:i})}return""}createDescription(n){const t=n.querySelector('div[data-word-wrap="1"]');return t?(t.textContent||"").replace(/[\u200E\u200F\u200B]/g,"").trim().slice(0,140).replace(/\s+/g," "):""}}w.BlueskyExtractor=A},27(at,w,I){var P=this&&this.__awaiter||function(n,t,r,e){return new(r||(r=Promise))((function(o,s){function i(u){try{f(e.next(u))}catch(h){s(h)}}function c(u){try{f(e.throw(u))}catch(h){s(h)}}function f(u){var h;u.done?o(u.value):(h=u.value,h instanceof r?h:new r((function(b){b(h)}))).then(i,c)}f((e=e.apply(n,t||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.C2WikiExtractor=void 0;const L=I(2279),_=I(639);class A extends L.BaseExtractor{canExtract(){return!1}canExtractAsync(){return this.getPageTitle()!==null}prefersAsync(){return!0}extract(){return{content:"",contentHtml:""}}extractAsync(){return P(this,void 0,void 0,(function*(){const t=this.getPageTitle();if(!t)return{content:"",contentHtml:""};const r=yield this.fetch("https://c2.com/wiki/remodel/pages/"+t).then((s=>s.json()));if(!r||!r.text)return{content:"",contentHtml:""};const e=t.replace(/([a-z])([A-Z])/g,"$1 $2"),o=this.renderPage(r);return{content:o,contentHtml:o,variables:Object.assign({title:e,site:"C2 Wiki"},r.date?{published:r.date}:{})}}))}getPageTitle(){if(this.pageTitle!==void 0)return this.pageTitle;try{const t=new URL(this.url).search.match(/[?&]([A-Za-z]\w*)/);this.pageTitle=t?t[1]:"WelcomeVisitors"}catch{this.pageTitle=null}return this.pageTitle}renderPage(t){return`${this.markup(t.text)}${t.date?`<hr><p>Last edit ${(0,_.escapeHtml)(t.date)}</p>`:""}`}markup(t){const r=t.replace(/\\\n/g," ").split(/\r?\n/),e=[];let o=[];for(const s of r){const{html:i,openTags:c}=this.applyBullets(s,o);e.push(this.applyInline(i)),o=c}for(;o.length>0;)e.push(`</${o.pop()}>`);return e.join(`
|
|
42
|
+
`)}applyBullets(t,r){const e=[...r];let o="";const s=(h,b)=>{for(;e.length>h;)o+=`</${e.pop()}>`;b&&e.length<h?(o+=`<${b}>`,e.push(b)):b&&e.length===h&&e[h-1]!==b&&(o+=`</${e.pop()}><${b}>`,e.push(b))};if(/^\s*$/.test(t))return e.some((h=>h==="ul"||h==="ol"||h==="dl"))?{html:"",openTags:e}:(s(0),{html:o+"<p></p>",openTags:e});if(/^-----*/.test(t))return s(0),{html:o+"<hr>",openTags:e};const i=t.match(/^(\t+)(.+):\t/);if(i)return s(i[1].length,"dl"),{html:o+`<dt>${i[2]}<dd>`+t.slice(i[0].length),openTags:e};const c=t.match(/^(\t+)\*/);if(c)return s(c[1].length,"ul"),{html:o+"<li>"+t.slice(c[0].length),openTags:e};const f=t.match(/^(\*+)/);if(f)return s(f[1].length,"ul"),{html:o+"<li>"+t.slice(f[0].length),openTags:e};const u=t.match(/^(\t+)\d+\.?/);return u?(s(u[1].length,"ol"),{html:o+"<li>"+t.slice(u[0].length),openTags:e}):/^\s/.test(t)?(s(1,"pre"),{html:o+t,openTags:e}):(s(0),{html:o+t,openTags:e})}applyInline(t){return t.replace(/'''(.*?)'''/g,"<strong>$1</strong>").replace(/''(.*?)''/g,"<em>$1</em>").replace(/\b(https?|ftp|mailto|file|telnet|news):[^\s<>[\]"'()]*[^\s<>[\]"'(),.?]/g,(r=>(0,_.isDangerousUrl)(r)?(0,_.escapeHtml)(r):/\.(gif|jpg|jpeg|png)$/i.test(r)?`<img src="${S(r)}">`:`<a href="${S(r)}" rel="nofollow" target="_blank">${(0,_.escapeHtml)(r)}</a>`))}}function S(n){return n.replace(/"/g,""").replace(/'/g,"'")}w.C2WikiExtractor=A},8632(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ChatGPTExtractor=void 0;const P=I(5181),L=I(639);class _ extends P.ConversationExtractor{constructor(S,n){super(S,n),this.cachedMessages=null,this.turns=S.querySelectorAll('[data-testid^="conversation-turn-"]'),this.footnotes=[],this.footnoteCounter=0}canExtract(){return!!this.turns&&this.turns.length>0}extractMessages(){if(this.cachedMessages)return this.cachedMessages;const S=[];return this.footnotes=[],this.footnoteCounter=0,this.turns&&(this.turns.forEach((n=>{var t,r;const e=n.querySelector("h4.sr-only, h5.sr-only, h6.sr-only"),o=((r=(t=e?.textContent)===null||t===void 0?void 0:t.trim())===null||r===void 0?void 0:r.replace(/:\s*$/,""))||"",s=Array.from(n.querySelectorAll("[data-message-author-role]")).filter((g=>g.closest('[data-testid^="conversation-turn-"]')===n)),i=s[0],c=i?.getAttribute("data-message-author-role")||"",f=s.flatMap((g=>{const y=this.getMessageContentElements(g);return y.length>0?y.map((a=>(0,L.serializeHTML)(a))):[(0,L.serializeHTML)(g)]}));let u=(f.length>0?f:[(0,L.serializeHTML)(n)]).join(`
|
|
43
|
+
`);u=u.replace(/\u200B/g,"");const h=this.document.createElement("div");h.appendChild((0,L.parseHTML)(this.document,u)),h.querySelectorAll("h4.sr-only, h5.sr-only, h6.sr-only").forEach((g=>g.remove())),u=(0,L.serializeHTML)(h),u=u.replace(/(​)?(<span[^>]*?>\s*(?:<span[^>]*?>\s*)*<a(?=[^>]*?href="([^"]+)")(?=[^>]*?target="_blank")(?=[^>]*?rel="noopener")[^>]*?>[\s\S]*?<\/a>\s*(?:<\/span>\s*)+)/gi,((g,y,a,d)=>{let p="",x="";try{p=new URL(d).hostname.replace(/^www\./,"");const v=d.split("#:~:text=");if(v.length>1){x=decodeURIComponent(v[1]),x=x.replace(/%2C/g,",");const E=x.split(",");x=E.length>1&&E[0].trim()?` — ${E[0].trim()}...`:E[0].trim()?` — ${x.trim()}`:""}}catch(v){console.error(`Failed to parse URL: ${d}`,v),p=d}let l,m=this.footnotes.findIndex((v=>v.url===d));return m===-1?(this.footnoteCounter++,l=this.footnoteCounter,this.footnotes.push({url:d,text:`<a href="${d}">${p}</a>${x}`})):l=m+1,`<sup id="fnref:${l}"><a href="#fn:${l}">${l}</a></sup>`}));const b=this.document.createElement("div");b.appendChild((0,L.parseHTML)(this.document,u)),b.querySelectorAll('span[data-state="closed"]').forEach((g=>g.remove())),u=(0,L.serializeHTML)(b),u=u.replace(/<p[^>]*>\s*<\/p>/g,""),S.push({author:o,content:u.trim(),metadata:{role:c||"unknown"}})})),this.cachedMessages=S),S}getMessageContentElements(S){const n=".markdown, .whitespace-pre-wrap",t=[...S.matches(n)?[S]:[],...Array.from(S.querySelectorAll(n))];return t.filter((r=>!t.some((e=>e!==r&&e.contains(r)))))}getFootnotes(){return this.footnotes}getMetadata(){const S=this.getTitle(),n=this.extractMessages();return{title:S,site:"ChatGPT",url:this.url,messageCount:n.length,description:`ChatGPT conversation with ${n.length} messages`}}getTitle(){var S,n,t;const r=(S=this.document.title)===null||S===void 0?void 0:S.trim();if(r&&r!=="ChatGPT")return r;const e=(t=(n=this.turns)===null||n===void 0?void 0:n.item(0))===null||t===void 0?void 0:t.querySelector(".text-message");if(e){const o=e.textContent||"";return o.length>50?o.slice(0,50)+"...":o}return"ChatGPT Conversation"}}w.ChatGPTExtractor=_},8397(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ClaudeExtractor=void 0;const P=I(5181),L=I(639);class _ extends P.ConversationExtractor{constructor(S,n){super(S,n),this.articles=S.querySelectorAll('div[data-testid="user-message"], div[data-testid="assistant-message"], div.font-claude-response')}canExtract(){return!!this.articles&&this.articles.length>0}extractMessages(){const S=[];return this.articles&&this.articles.forEach((n=>{let t,r;if(n.hasAttribute("data-testid")){if(n.getAttribute("data-testid")!=="user-message")return;t="you",r=(0,L.serializeHTML)(n)}else{if(!n.classList.contains("font-claude-response"))return;{t="assistant";const e=n.querySelector(".standard-markdown")||n;r=(0,L.serializeHTML)(e)}}r&&(r=r.replace(/\u200B/g,"").replace(/<p[^>]*>\s*<\/p>/g,""),S.push({author:t==="you"?"You":"Claude",content:r.trim(),metadata:{role:t}}))})),S}getMetadata(){const S=this.getTitle(),n=this.extractMessages();return{title:S,site:"Claude",url:this.url,messageCount:n.length,description:`Claude conversation with ${n.length} messages`}}getTitle(){var S,n,t,r,e;const o=(S=this.document.title)===null||S===void 0?void 0:S.trim();if(o&&o!=="Claude")return o.replace(/ - Claude$/,"");const s=(t=(n=this.document.querySelector("header .font-tiempos"))===null||n===void 0?void 0:n.textContent)===null||t===void 0?void 0:t.trim();if(s)return s;const i=(e=(r=this.articles)===null||r===void 0?void 0:r.item(0))===null||e===void 0?void 0:e.querySelector('[data-testid="user-message"]');if(i){const c=i.textContent||"";return c.length>50?c.slice(0,50)+"...":c}return"Claude Conversation"}}w.ClaudeExtractor=_},4454(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.DiscourseExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t,r,e){var o;super(n,t,r,e);const s=((o=n.querySelector('meta[name="generator"]'))===null||o===void 0?void 0:o.getAttribute("content"))||"";this.isDiscourse=s.startsWith("Discourse")}canExtract(){return this.isDiscourse&&!!this.document.querySelector(".topic-post")}extract(){var n,t,r,e;const o=this.getTopicTitle(),s=((n=this.document.querySelector('meta[property="og:site_name"]'))===null||n===void 0?void 0:n.getAttribute("content"))||"",i=((r=(t=this.document.querySelector(".badge-category__name"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"",c=this.getTags(),f=this.getPublishedDate(),u=Array.from(this.document.querySelectorAll(".topic-post")),h=u.find((l=>l.classList.contains("topic-owner"))),b=h?this.extractPostContent(h):"",g=h?this.getAuthor(h):"",y=u.filter((l=>l!==h)),a=this.options.includeReplies!==!1?this.extractComments(y):"",d=(0,_.buildContentHtml)("discourse",b,a),p=g||this.getAuthor(u[0]),x=h?this.getPostText(h).slice(0,140).replace(/\s+/g," "):"";return{content:d,contentHtml:d,extractedContent:{topicId:((e=this.document.querySelector("h1[data-topic-id]"))===null||e===void 0?void 0:e.getAttribute("data-topic-id"))||"",category:i,tags:c.join(", ")},variables:Object.assign({title:o,author:p,site:s||"Discourse",description:x},f&&{published:f})}}getTopicTitle(){var n,t;const r=this.document.querySelector(".fancy-title");if(r)return((n=r.textContent)===null||n===void 0?void 0:n.trim())||"";const e=this.document.querySelector("h1[data-topic-id]");if(e){const o=e.cloneNode(!0);return o.querySelectorAll("svg, .topic-statuses").forEach((s=>s.remove())),((t=o.textContent)===null||t===void 0?void 0:t.trim())||""}return""}getTags(){return Array.from(this.document.querySelectorAll("a.discourse-tag")).map((n=>{var t;return n.getAttribute("data-tag-name")||((t=n.textContent)===null||t===void 0?void 0:t.trim())||""})).filter((n=>n))}getPublishedDate(){const n=this.document.querySelector('meta[property="article:published_time"]');if(n){const t=n.getAttribute("content")||"";try{return new Date(t).toISOString().split("T")[0]}catch{}}return""}getAuthor(n){var t;const r=n.querySelector(".names a[data-user-card]");return r?.getAttribute("data-user-card")||((t=r?.textContent)===null||t===void 0?void 0:t.trim())||""}getPostDate(n){const t=n.querySelector(".relative-date[data-time]");if(!t)return"";const r=parseInt(t.getAttribute("data-time")||"0");if(!r)return"";try{return new Date(r).toISOString().split("T")[0]}catch{return""}}getPostPermalink(n){const t=n.querySelector("a.post-date[href]");if(!t)return"";const r=t.getAttribute("href")||"";if(!r)return"";try{return`${new URL(this.url).origin}${r}`}catch{return r}}getLikeCount(n){var t;const r=n.querySelector("button.like-count"),e=((t=r?.textContent)===null||t===void 0?void 0:t.trim())||"";return e?`${e} likes`:""}getPostText(n){var t;const r=n.querySelector(".cooked");return r&&((t=r.textContent)===null||t===void 0?void 0:t.trim())||""}extractPostContent(n){const t=n.querySelector(".cooked");if(!t)return"";const r=t.cloneNode(!0);return r.querySelectorAll(".cooked-selection-barrier").forEach((e=>e.remove())),r.querySelectorAll("a.anchor").forEach((e=>e.remove())),(0,L.serializeHTML)(r)}extractComments(n){if(n.length===0)return"";const t=n.map((r=>{const e=this.getAuthor(r),o=this.extractPostContent(r),s=this.getPostDate(r),i=this.getPostPermalink(r);return{author:e,date:s,content:o,depth:0,score:this.getLikeCount(r)||void 0,url:i||void 0}}));return(0,_.buildCommentTree)(t)}}w.DiscourseExtractor=A},4732(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.GeminiExtractor=void 0;const P=I(5181),L=I(639);class _ extends P.ConversationExtractor{constructor(S,n){super(S,n),this.messageCount=null,this.conversationContainers=S.querySelectorAll("div.conversation-container"),this.footnotes=[]}canExtract(){return!!this.conversationContainers&&this.conversationContainers.length>0}extractMessages(){this.messageCount=0;const S=[];return this.conversationContainers&&(this.extractSources(),this.conversationContainers.forEach((n=>{const t=n.querySelector("user-query");if(t){const e=t.querySelector(".query-text");if(e){const o=(0,L.serializeHTML)(e);S.push({author:"You",content:o.trim(),metadata:{role:"user"}})}}const r=n.querySelector("model-response");if(r){const e=r.querySelector(".model-response-text .markdown"),o=r.querySelector("#extended-response-markdown-content")||e;if(o){let s=(0,L.serializeHTML)(o);const i=this.document.createElement("div");i.appendChild((0,L.parseHTML)(this.document,s)),i.querySelectorAll(".table-content").forEach((c=>{c.classList.remove("table-content")})),s=(0,L.serializeHTML)(i),S.push({author:"Gemini",content:s.trim(),metadata:{role:"assistant"}})}}})),this.messageCount=S.length),S}extractSources(){const S=this.document.querySelectorAll("browse-item");S&&S.length>0&&S.forEach((n=>{var t,r,e,o;const s=n.querySelector("a");if(s instanceof HTMLAnchorElement){const i=s.href,c=((r=(t=s.querySelector(".domain"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"",f=((o=(e=s.querySelector(".title"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"";i&&(c||f)&&this.footnotes.push({url:i,text:f?`${c}: ${f}`:c})}}))}getFootnotes(){return this.footnotes}getMetadata(){var S;const n=this.getTitle(),t=(S=this.messageCount)!==null&&S!==void 0?S:this.extractMessages().length;return{title:n,site:"Gemini",url:this.url,messageCount:t,description:`Gemini conversation with ${t} messages`}}getTitle(){var S,n,t,r,e;const o=(S=this.document.title)===null||S===void 0?void 0:S.trim();if(o&&o!=="Gemini"&&!o.includes("Gemini"))return o;const s=(t=(n=this.document.querySelector(".title-text"))===null||n===void 0?void 0:n.textContent)===null||t===void 0?void 0:t.trim();if(s)return s;const i=(e=(r=this.conversationContainers)===null||r===void 0?void 0:r.item(0))===null||e===void 0?void 0:e.querySelector(".query-text");if(i){const c=i.textContent||"";return c.length>50?c.slice(0,50)+"...":c}return"Gemini Conversation"}}w.GeminiExtractor=_},3588(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.GitHubExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t){super(n,t),this.isIssue=/\/issues\/\d+/.test(t),this.isPR=/\/pull\/\d+/.test(t)}canExtract(){return!!['meta[name="expected-hostname"][content="github.com"]','meta[name="octolytics-url"]','meta[name="github-keyboard-shortcuts"]',".js-header-wrapper","#js-repo-pjax-container"].some((n=>this.document.querySelector(n)!==null))&&(this.isIssue?['[data-testid="issue-metadata-sticky"]','[data-testid="issue-title"]'].some((n=>this.document.querySelector(n)!==null)):!!this.isPR&&[".pull-discussion-timeline",".discussion-timeline",".gh-header-title",".js-issue-title"].some((n=>this.document.querySelector(n)!==null)))}extract(){const n=this.extractRepoInfo(),t=this.extractNumber(),r=this.isPR?"pull":"issue",e=this.isPR?this.getPRBody():null,{content:o,author:s,published:i}=this.isPR?this.getPRContent(e):this.getIssueContent(),c=this.options.includeReplies!==!1?this.isPR?this.extractPRComments(e):this.extractComments():"",f=this.createContentHtml(o,c);return{content:f,contentHtml:f,extractedContent:{type:r,number:t,repository:n.repo,owner:n.owner},variables:{title:this.document.title,author:s,published:i,site:`GitHub - ${n.owner}/${n.repo}`,description:this.createDescription(f)}}}createContentHtml(n,t){return(0,_.buildContentHtml)("github",n,t)}getIssueContent(){const n=this.document.querySelector('[data-testid="issue-viewer-issue-container"]');if(!n)return{content:"",author:"",published:""};const t=this.extractAuthor(n,['a[data-testid="issue-body-header-author"]',".IssueBodyHeaderAuthor-module__authorLoginLink--_S7aT",".ActivityHeader-module__AuthorLink--iofTU",'a[href*="/users/"][data-hovercard-url*="/users/"]','a[aria-label*="profile"]']),r=n.querySelector("relative-time"),e=r?.getAttribute("datetime")||"",o=n.querySelector('[data-testid="issue-body-viewer"] .markdown-body');return o?{content:this.cleanBodyContent(o),author:t,published:e}:{content:"",author:t,published:e}}extractComments(){const n=Array.from(this.document.querySelectorAll("[data-wrapper-timeline-id]")),t=new Set,r=[];for(const e of n){const o=e.querySelector(".react-issue-comment");if(!o)continue;const s=e.getAttribute("data-wrapper-timeline-id");if(!s||t.has(s))continue;t.add(s);const i=this.extractAuthor(o,[".ActivityHeader-module__AuthorLink--iofTU",'a[data-testid="avatar-link"]','a[href^="/"][data-hovercard-url*="/users/"]']),c=o.querySelector("relative-time"),f=c?.getAttribute("datetime")||"",u=f?new Date(f).toISOString().split("T")[0]:"",h=o.querySelector(".markdown-body");if(!h)continue;const b=this.cleanBodyContent(h);b&&r.push({author:i,date:u,content:b})}return(0,_.buildCommentTree)(r)}getPRBody(){return this.document.querySelector('[id^="pullrequest-"]')||this.document.querySelector(".timeline-comment")}getPRContent(n){var t;const r=n?.querySelector(".comment-body.markdown-body")||this.document.querySelector(".comment-body.markdown-body"),e=r?this.cleanBodyContent(r):"",o=n?.querySelector(".author")||this.document.querySelector(".gh-header-meta .author"),s=((t=o?.textContent)===null||t===void 0?void 0:t.trim())||"",i=n?.querySelector("relative-time");return{content:e,author:s,published:i?.getAttribute("datetime")||""}}extractPRComments(n){var t;const r=Array.from(this.document.querySelectorAll(".timeline-comment, .review-comment")),e=[];for(const o of r){if(n&&(o===n||n.contains(o)))continue;const s=o.querySelector(".author"),i=((t=s?.textContent)===null||t===void 0?void 0:t.trim())||"",c=o.querySelector("relative-time"),f=c?.getAttribute("datetime")||"",u=f?new Date(f).toISOString().split("T")[0]:"",h=o.querySelector(".comment-body.markdown-body");if(!h)continue;const b=this.cleanBodyContent(h);b&&e.push({author:i,date:u,content:b})}return(0,_.buildCommentTree)(e)}extractAuthor(n,t){for(const r of t){const e=n.querySelector(r);if(e){const o=e.getAttribute("href");if(o){if(o.startsWith("/"))return o.substring(1);if(o.includes("github.com/")){const s=o.match(/github\.com\/([^\/\?#]+)/);if(s&&s[1])return s[1]}}}}return"Unknown"}cleanBodyContent(n){const t=n.cloneNode(!0);return t.querySelectorAll('button, [data-testid*="button"], [data-testid*="menu"]').forEach((r=>r.remove())),t.querySelectorAll(".js-clipboard-copy, .zeroclipboard-container").forEach((r=>r.remove())),t.querySelectorAll('div.highlight[class*="highlight-source-"] pre, div.highlight pre').forEach((r=>{const e=r.parentElement;if(!e)return;const o=e.className.match(/highlight-source-(\w+)/),s=o?.[1]||"",i=e.getAttribute("data-snippet-clipboard-copy-content")||r.textContent||"",c=this.document.createElement("code");s&&(c.setAttribute("class",`language-${s}`),c.setAttribute("data-lang",s)),c.textContent=i;const f=this.document.createElement("pre");f.appendChild(c),e.replaceWith(f)})),(0,L.serializeHTML)(t).trim()}extractNumber(){var n;const t=this.url.match(/\/(issues|pull)\/(\d+)/);if(t)return t[2];const r=this.document.querySelector("h1"),e=(n=r?.textContent)===null||n===void 0?void 0:n.match(/#(\d+)/);return e?e[1]:""}extractRepoInfo(){const n=this.url.match(/github\.com\/([^\/]+)\/([^\/]+)/);if(n)return{owner:n[1],repo:n[2]};const t=this.document.title.match(/([^\/\s]+)\/([^\/\s]+)/);return t?{owner:t[1],repo:t[2]}:{owner:"",repo:""}}createDescription(n){var t;if(!n)return"";const r=this.document.createElement("div");return r.appendChild((0,L.parseHTML)(this.document,n)),((t=r.textContent)===null||t===void 0?void 0:t.trim().slice(0,140).replace(/\s+/g," "))||""}}w.GitHubExtractor=A},3020(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.GrokExtractor=void 0;const P=I(5181),L=I(639);class _ extends P.ConversationExtractor{constructor(S,n){super(S,n),this.messageContainerSelector=".relative.group.flex.flex-col.justify-center.w-full",this.messageBubbles=S.querySelectorAll(this.messageContainerSelector),this.footnotes=[],this.footnoteCounter=0}canExtract(){return!!this.messageBubbles&&this.messageBubbles.length>0}extractMessages(){const S=[];return this.footnotes=[],this.footnoteCounter=0,this.messageBubbles&&this.messageBubbles.length!==0&&this.messageBubbles.forEach((n=>{var t;const r=n.classList.contains("items-end"),e=n.classList.contains("items-start");if(!r&&!e)return;const o=n.querySelector(".message-bubble");if(!o)return;let s="",i="",c="";if(r)s=o.textContent||"",i="user",c="You";else if(e){i="assistant",c="Grok";const f=o.cloneNode(!0);(t=f.querySelector(".relative.border.border-border-l1.bg-surface-base"))===null||t===void 0||t.remove(),s=(0,L.serializeHTML)(f),s=this.processFootnotes(s)}s.trim()&&S.push({author:c,content:s.trim(),metadata:{role:i}})})),S}getFootnotes(){return this.footnotes}getMetadata(){var S;const n=this.getTitle(),t=((S=this.messageBubbles)===null||S===void 0?void 0:S.length)||0;return{title:n,site:"Grok",url:this.url,messageCount:t,description:`Grok conversation with ${t} messages`}}getTitle(){var S,n;const t=(S=this.document.title)===null||S===void 0?void 0:S.trim();if(t&&t!=="Grok"&&!t.startsWith("Grok by "))return t.replace(/\s-\s*Grok$/,"").trim();const r=this.document.querySelector(`${this.messageContainerSelector}.items-end`);if(r){const e=r.querySelector(".message-bubble");if(e){const o=((n=e.textContent)===null||n===void 0?void 0:n.trim())||"";return o.length>50?o.slice(0,50)+"...":o}}return"Grok Conversation"}processFootnotes(S){return S.replace(/<a\s+(?:[^>]*?\s+)?href="([^"]*)"[^>]*>(.*?)<\/a>/gi,((n,t,r)=>{if(!t||t.startsWith("#")||!t.match(/^https?:\/\//i))return n;let e;if(this.footnotes.find((o=>o.url===t)))e=this.footnotes.findIndex((o=>o.url===t))+1;else{this.footnoteCounter++,e=this.footnoteCounter;let o=t;try{const s=new URL(t).hostname.replace(/^www\./,"");o=`<a href="${t}" target="_blank" rel="noopener noreferrer">${s}</a>`}catch{o=`<a href="${t}" target="_blank" rel="noopener noreferrer">${t}</a>`,console.warn(`GrokExtractor: Could not parse URL for footnote: ${t}`)}this.footnotes.push({url:t,text:o})}return`${r}<sup id="fnref:${e}" class="footnote-ref"><a href="#fn:${e}" class="footnote-link">${e}</a></sup>`}))}}w.GrokExtractor=_},2458(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.HackerNewsExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t){super(n,t),this.mainPost=n.querySelector(".fatitem"),this.isListingPage=this.detectListingPage(),this.isCommentPage=this.detectCommentPage(),this.mainComment=this.isCommentPage?this.findMainComment():null}detectListingPage(){return this.mainPost?!1:this.document.querySelectorAll("tr.athing").length>1}detectCommentPage(){var n,t;return!!(!((n=this.mainPost)===null||n===void 0)&&n.querySelector(".onstory"))&&!(!((t=this.mainPost)===null||t===void 0)&&t.querySelector(".titleline"))}findMainComment(){var n;return((n=this.mainPost)===null||n===void 0?void 0:n.querySelector("tr.athing"))||null}canExtract(){return!!this.mainPost||this.isListingPage}extract(){if(this.isListingPage)return this.extractListing();const n=this.getPostContent(),t=this.options.includeReplies!==!1?this.extractComments():"",r=this.createContentHtml(n,t),e=this.getPostTitle(),o=this.getPostAuthor(),s=this.createDescription(),i=this.getPostDate();return{content:r,contentHtml:r,extractedContent:{postId:this.getPostId(),postAuthor:o},variables:{title:e,author:o,site:"Hacker News",description:s,published:i}}}getMoreLink(){var n;const t=this.document.querySelector(".morelink");return t?{url:t.getAttribute("href")||"",text:((n=t.textContent)===null||n===void 0?void 0:n.trim())||"More"}:null}extractListing(){var n;const t=this.extractStories(),r=this.getMoreLink(),e=this.buildListingHtml(t,r);return{content:e,contentHtml:e,extractedContent:{},variables:{title:((n=this.document.title)===null||n===void 0?void 0:n.replace(/\s*\|\s*Hacker News$/,"").trim())||"Hacker News",site:"Hacker News"}}}extractStories(){var n,t,r,e,o,s,i,c;const f=Array.from(this.document.querySelectorAll("tr.athing")),u=[];for(const h of f){const b=h.getAttribute("id")||"",g=h.querySelector(".titleline a");if(!g)continue;const y=((n=g.textContent)===null||n===void 0?void 0:n.trim())||"",a=g.getAttribute("href")||"",d=((r=(t=h.querySelector(".sitestr"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"",p=h.nextElementSibling,x=((o=(e=p?.querySelector(".score"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"",l=((i=(s=p?.querySelector(".hnuser"))===null||s===void 0?void 0:s.textContent)===null||i===void 0?void 0:i.trim())||"",m=p?.querySelector(".age"),v=(m?.getAttribute("title")||"").split("T")[0]||"",E=p?Array.from(p.querySelectorAll("td.subtext a")):[],q=E[E.length-1],C=((c=q?.textContent)===null||c===void 0?void 0:c.replace(/\u00a0/g," ").trim())||"",N=/\d+\s*comment/.test(C)?C:"",O=b?`https://news.ycombinator.com/item?id=${b}`:"";u.push({id:b,title:y,url:a,site:d,score:x,author:l,date:v,comments:N,commentsUrl:O})}return u}buildListingHtml(n,t){if(n.length===0)return"";let e=`<ol>${n.map((o=>{let s="<li>";s+=`<a href="${(0,L.escapeHtml)(o.url)}">${(0,L.escapeHtml)(o.title)}</a>`,o.site&&(s+=` <small>(${(0,L.escapeHtml)(o.site)})</small>`);const i=[];return o.score&&i.push((0,L.escapeHtml)(o.score)),o.author&&i.push(`by ${(0,L.escapeHtml)(o.author)}`),o.comments&&i.push(`<a href="${(0,L.escapeHtml)(o.commentsUrl)}">${(0,L.escapeHtml)(o.comments)}</a>`),i.length>0&&(s+=`<br><small>${i.join(" · ")}</small>`),s+="</li>",s})).join("")}</ol>`;return t&&(e+=`<p><a href="${(0,L.escapeHtml)(t.url)}">${(0,L.escapeHtml)(t.text)}</a></p>`),e}createContentHtml(n,t){return(0,_.buildContentHtml)("hackernews",n,t)}getPostContent(){var n,t,r,e;if(!this.mainPost)return"";if(this.isCommentPage&&this.mainComment){const f=((n=this.mainComment.querySelector(".hnuser"))===null||n===void 0?void 0:n.textContent)||"[deleted]",u=this.mainComment.querySelector(".commtext"),h=u?(0,L.serializeHTML)(u):"",b=this.mainComment.querySelector(".age"),g=(b?.getAttribute("title")||"").split("T")[0]||"",y=((r=(t=this.mainComment.querySelector(".score"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"";return(0,_.buildComment)({author:f,date:g,content:h,score:y||void 0})}const o=this.mainPost.querySelector("tr.athing"),s=(o?.nextElementSibling,((e=o?.querySelector(".titleline a"))===null||e===void 0?void 0:e.getAttribute("href"))||"");let i="";s&&(i+=`<p><a href="${s}" target="_blank">${s}</a></p>`);const c=this.mainPost.querySelector(".toptext");return c&&(i+=`<div class="post-text">${(0,L.serializeHTML)(c)}</div>`),i}extractComments(){const n=Array.from(this.document.querySelectorAll("tr.comtr"));return this.processComments(n)}processComments(n){var t,r,e,o;const s=[],i=new Set;for(const c of n){const f=c.getAttribute("id");if(!f||i.has(f))continue;i.add(f);const u=((t=c.querySelector(".ind img"))===null||t===void 0?void 0:t.getAttribute("width"))||"0",h=parseInt(u)/40,b=c.querySelector(".commtext"),g=((r=c.querySelector(".hnuser"))===null||r===void 0?void 0:r.textContent)||"[deleted]",y=c.querySelector(".age"),a=((o=(e=c.querySelector(".score"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"";if(!b)continue;const d=`https://news.ycombinator.com/item?id=${f}`,p=(y?.getAttribute("title")||"").split("T")[0]||"";s.push({author:g,date:p,content:(0,L.serializeHTML)(b),depth:h,score:a||void 0,url:d})}return(0,_.buildCommentTree)(s)}getPostId(){const n=this.url.match(/id=(\d+)/);return n?.[1]||""}getPostTitle(){var n,t,r,e,o;if(this.isCommentPage&&this.mainComment){const s=((n=this.mainComment.querySelector(".hnuser"))===null||n===void 0?void 0:n.textContent)||"[deleted]",i=((t=this.mainComment.querySelector(".commtext"))===null||t===void 0?void 0:t.textContent)||"";return`Comment by ${s}: ${i.trim().slice(0,50)+(i.length>50?"...":"")}`}return((o=(e=(r=this.mainPost)===null||r===void 0?void 0:r.querySelector(".titleline"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||""}getPostAuthor(){var n,t,r;return((r=(t=(n=this.mainPost)===null||n===void 0?void 0:n.querySelector(".hnuser"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||""}createDescription(){const n=this.getPostTitle(),t=this.getPostAuthor();return this.isCommentPage?`Comment by ${t} on Hacker News`:`${n} - by ${t} on Hacker News`}getPostDate(){if(!this.mainPost)return"";const n=this.mainPost.querySelector(".age");return(n?.getAttribute("title")||"").split("T")[0]||""}}w.HackerNewsExtractor=A},7228(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.LeetCodeExtractor=void 0;const P=I(2279);class L extends P.BaseExtractor{canExtract(){return this.document.querySelector('[data-track-load="description_content"]')!==null}extract(){var A;const S=((A=this.document.querySelector('meta[property="og:title"]'))===null||A===void 0?void 0:A.getAttribute("content"))||"";return{content:"",contentHtml:"",contentSelector:'[data-track-load="description_content"]',variables:{title:S.replace(/\s*[-\u2013\u2014]\s*LeetCode\s*$/,"")||S,site:"LeetCode"}}}}w.LeetCodeExtractor=L},8477(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.LinkedInExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t,r,e){super(n,t,r,e),this.postArticle=n.querySelector('[role="article"].feed-shared-update-v2')}canExtract(){return!!this.postArticle}extract(){var n;const t=this.getPostContent(),r=this.options.includeReplies!==!1?this.extractComments():"",e=(0,_.buildContentHtml)("linkedin",t,r),o=this.getAuthorName(),s=this.createDescription();return{content:e,contentHtml:e,extractedContent:{postUrn:((n=this.postArticle)===null||n===void 0?void 0:n.getAttribute("data-urn"))||""},variables:{title:this.postTitle(o,"LinkedIn"),author:o,site:"LinkedIn",description:s}}}getPostContent(){if(!this.postArticle)return"";const n=this.postArticle.querySelector(".feed-shared-update-v2__update-content-wrapper"),t=this.postArticle.querySelector(".update-components-text.update-components-update-v2__commentary"),r=!t||n&&n.contains(t)?"":this.cleanTextContent(t),e=this.extractImages(),o=this.extractVideo(),s=this.extractQuotedPost(n);let i="";return r&&(i+=r),e&&(i+=`
|
|
44
|
+
${e}`),o&&(i+=`
|
|
45
|
+
${o}`),s&&(i+=`
|
|
46
|
+
${s}`),i}getVisibleText(n,t){var r;const e=n.cloneNode(!0),o=t?`.visually-hidden, ${t}`:".visually-hidden";return e.querySelectorAll(o).forEach((s=>s.remove())),((r=e.textContent)===null||r===void 0?void 0:r.trim())||""}cleanTextContent(n){const t=n.cloneNode(!0);t.querySelectorAll(".visually-hidden, .feed-shared-inline-show-more-text__see-more-less-toggle").forEach((e=>e.remove())),t.querySelectorAll("a").forEach((e=>{var o;const s=e.getAttribute("href")||"",i=((o=e.textContent)===null||o===void 0?void 0:o.trim())||"";if(s&&i){const c=this.document.createElement("a");c.setAttribute("href",s),c.textContent=i,e.replaceWith(c)}else e.replaceWith(e.textContent||"")})),t.querySelectorAll("span, div").forEach((e=>{e.replaceWith(...Array.from(e.childNodes))}));let r=(0,L.serializeHTML)(t).trim();return r=r.replace(/<!--.*?-->/g,""),r.split(/(?:<br\s*\/?>\s*){2,}|\n{2,}/).map((e=>e.replace(/<br\s*\/?>/g," ").replace(/\s+/g," ").trim())).filter((e=>e)).map((e=>`<p>${e}</p>`)).join(`
|
|
47
|
+
`)}extractQuotedPost(n){var t;if(!n)return"";const r=n.querySelector(".update-components-actor__title"),e=r?this.getVisibleText(r,".update-components-actor__supplementary-actor-info, .text-view-model__verified-icon"):"",o=n.querySelector(".update-components-actor__sub-description");let s="";if(o){const b=(((t=(o.querySelector('[aria-hidden="true"]')||o).textContent)===null||t===void 0?void 0:t.trim())||"").match(/^(\d+\w+)/);s=b?b[1]:""}const i=n.querySelector(".update-components-text.update-components-update-v2__commentary"),c=i?this.cleanTextContent(i):"",f=n.querySelector("a.update-components-mini-update-v2__link-to-details-page"),u=f?.getAttribute("href")||"",h=u?(u.startsWith("http")?u:`https://www.linkedin.com${u}`).split("?")[0]:"";return(0,_.buildQuotedPost)({author:e||void 0,date:s||void 0,content:c,url:h||void 0})}extractImages(){if(!this.postArticle)return"";const n=[];return this.postArticle.querySelectorAll(".update-components-image img, .feed-shared-image img").forEach((t=>{const r=t.getAttribute("src")||"",e=t.getAttribute("alt")||"";!r||r.includes("profile-displayphoto")||r.includes("avm-avatar")||n.push(`<img src="${(0,L.escapeHtml)(r)}" alt="${(0,L.escapeHtml)(e)}" />`)})),n.join(`
|
|
48
|
+
`)}extractVideo(){if(!this.postArticle)return"";const n=this.postArticle.querySelector(".update-components-linkedin-video video[poster]");if(!n)return"";const t=n.getAttribute("poster")||"";return`<img src="${(0,L.escapeHtml)(t)}" alt="Video thumbnail" />`}extractComments(){if(!this.postArticle)return"";const n=[],t=this.postArticle.querySelectorAll("article.comments-comment-entity:not(.comments-comment-entity--reply)");for(const r of Array.from(t)){const e=this.extractCommentData(r,0);e&&n.push(e);const o=r.querySelectorAll(".comments-replies-list article.comments-comment-entity--reply");for(const s of Array.from(o)){const i=this.extractCommentData(s,1);i&&n.push(i)}}return n.length>0?(0,_.buildCommentTree)(n):""}extractCommentData(n,t){var r,e,o,s,i;const c=((e=(r=n.querySelector(".comments-comment-meta__description-title"))===null||r===void 0?void 0:r.textContent)===null||e===void 0?void 0:e.trim())||"";if(!c)return null;const f=n.querySelector(".comments-comment-entity__content .update-components-text"),u=f?this.cleanTextContent(f):"",h=n.querySelector("time.comments-comment-meta__data"),b=((o=h?.textContent)===null||o===void 0?void 0:o.trim())||"",g=n.querySelector("a.comments-comment-meta__description-container"),y=((s=g?.getAttribute("href"))===null||s===void 0?void 0:s.split("?")[0])||"";let a="";y&&(a=y.startsWith("http")?y:`https://www.linkedin.com${y}`);const d=n.querySelector(".comments-comment-social-bar__reactions-count--cr span.v-align-middle"),p=((i=d?.textContent)===null||i===void 0?void 0:i.trim())||"";return{author:c,date:b,content:u,depth:t,score:p?`${p} reactions`:void 0,url:a||void 0}}getAuthorName(){if(!this.postArticle)return"";const n=this.postArticle.querySelector(".update-components-actor__title");return n?this.getVisibleText(n,".text-view-model__verified-icon, .update-components-actor__supplementary-actor-info"):""}createDescription(){if(!this.postArticle)return"";const n=this.postArticle.querySelector(".feed-shared-update-v2__update-content-wrapper"),t=this.postArticle.querySelector(".update-components-text.update-components-update-v2__commentary");return!t||n&&n.contains(t)?"":this.getVisibleText(t).slice(0,140).replace(/\s+/g," ")}}w.LinkedInExtractor=A},7278(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.LwnExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{canExtract(){return!!this.document.querySelector(".PageHeadline")&&!!this.document.querySelector(".ArticleText")}extract(){var n,t,r,e,o,s;const i=this.document.querySelector(".ArticleText main"),c=i?this.getArticleContent(i):"",f=this.options.includeReplies!==!1&&i?this.extractComments(i):"",u=(0,_.buildContentHtml)("lwn",c,f),h=((t=(n=this.document.querySelector(".Byline"))===null||n===void 0?void 0:n.textContent)===null||t===void 0?void 0:t.trim())||"";return{content:u,contentHtml:u,extractedContent:{},variables:{title:((e=(r=this.document.querySelector(".PageHeadline h1"))===null||r===void 0?void 0:r.textContent)===null||e===void 0?void 0:e.trim())||"",author:((o=h.match(/by\s+(\w+)/i))===null||o===void 0?void 0:o[1])||"",site:"LWN.net",published:this.parseDate(h),description:((s=this.document.querySelector('meta[property="og:description"]'))===null||s===void 0?void 0:s.getAttribute("content"))||""}}}parseDate(n){const t=n.match(/Posted\s+(\w+\s+\d+,\s+\d{4})/);if(!t)return"";const r=new Date(t[1]);return isNaN(r.getTime())?"":r.toISOString().split("T")[0]}getArticleContent(n){const t=n.cloneNode(!0);for(const e of Array.from(t.querySelectorAll('details.CommentBox, form, a[name^="Comm"]')))e.remove();let r=t.lastElementChild;for(;r&&(r.tagName==="HR"||r.tagName==="BR"&&r.getAttribute("clear"));){const e=r.previousElementSibling;r.remove(),r=e}return(0,L.serializeHTML)(t)}extractComments(n){const t=Array.from(n.querySelectorAll("details.CommentBox")),r=[];for(const e of t){const o=this.getCommentDepth(e,n),s=this.extractCommentData(e,o);s&&r.push(s)}return r.length>0?(0,_.buildCommentTree)(r):""}getCommentDepth(n,t){let r=0,e=n.parentElement;for(;e&&e!==t;)e.tagName==="DETAILS"&&e.classList.contains("CommentBox")&&r++,e=e.parentElement;return r}extractCommentData(n,t){var r,e,o,s,i,c,f;const u=n.querySelector(":scope > summary .CommentPoster");if(!u)return null;const h=((e=(r=u.querySelector("b"))===null||r===void 0?void 0:r.textContent)===null||e===void 0?void 0:e.trim())||"",b=u.querySelector('a[href^="/Articles/"]'),g=b?.getAttribute("href")||"",y=g?`https://lwn.net${g}`:"",a=this.parseDate(u.textContent||""),d=((s=(o=n.querySelector(":scope > summary h3.CommentTitle"))===null||o===void 0?void 0:o.textContent)===null||s===void 0?void 0:s.trim())||"",p=(i=n.parentElement)===null||i===void 0?void 0:i.closest("details.CommentBox"),x=((f=(c=p?.querySelector(":scope > summary h3.CommentTitle"))===null||c===void 0?void 0:c.textContent)===null||f===void 0?void 0:f.trim())||"",l=d&&d!==x?d:"";return{author:h,date:a,content:this.getCommentContent(n,l),depth:t,url:y}}getCommentContent(n,t){var r,e;let o="";t&&(o+=`<p><strong>${(0,L.escapeHtml)(t)}</strong></p>`);const s=n.querySelector(":scope > .FormattedComment");if(s)o+=(0,L.serializeHTML)(s);else{const i=this.document.createElement("div");for(const f of Array.from(n.childNodes)){if(f.nodeType===1){const u=f,h=u.tagName;if(h==="SUMMARY"||h==="DETAILS"||u.classList.contains("CommentReplyButton")||h==="FORM"||h==="A"&&(!((r=u.getAttribute("name"))===null||r===void 0)&&r.startsWith("CommAnchor"))||h==="P"&&!(!((e=u.textContent)===null||e===void 0)&&e.trim()))continue}i.appendChild(f.cloneNode(!0))}const c=(0,L.serializeHTML)(i).trim();c&&(o+=c)}return o}}w.LwnExtractor=A},9964(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.MastodonExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t,r,e){super(n,t,r,e),this.mainPost=null,this.replyStatuses=[],this.mainPost=n.querySelector(".detailed-status__wrapper");const o=Array.from(n.querySelectorAll(".status__wrapper"));this.replyStatuses=o.filter((s=>!!s.querySelector(".status[data-id]")))}canExtract(){if(!this.mainPost)return!1;if(this.document.getElementById("mastodon"))return!0;const n=this.document.querySelector("script#initial-state");if(n){const t=n.textContent||"";if(t.includes("mastodon/mastodon")||t.includes('"mastodon"'))return!0}return Array.from(this.document.querySelectorAll('link[rel="stylesheet"]')).some((t=>(t.getAttribute("href")||"").includes("mastodon")))}extract(){var n;const t=this.getFullHandle(this.mainPost),r=t.split("@")[0],e=this.getDisplayName(this.mainPost),o=[],s=[];let i=!1;for(const d of this.replyStatuses){const p=this.getFullHandle(d).split("@")[0];i||p!==r?(i=!0,s.push(d)):o.push(d)}const c=[this.extractPostContent(this.mainPost),...o.map((d=>this.extractPostContent(d)))].filter(Boolean).join(`
|
|
49
|
+
<hr>
|
|
50
|
+
`),f=this.options.includeReplies!==!1?this.extractComments(s):"",u=(0,_.buildContentHtml)("mastodon",c,f),h=e||`@${t}`,b=this.getDescription(),g=this.getPublishedDate(),y=((n=this.document.querySelector('meta[property="og:site_name"]'))===null||n===void 0?void 0:n.getAttribute("content"))||"",a=this.postTitle(h,y||"Mastodon");return{content:u,contentHtml:u,extractedContent:{postAuthor:t},variables:Object.assign({title:a,author:h,site:y||"Mastodon",description:b},g&&{published:g})}}getFullHandle(n){var t;const r=n.querySelector(".display-name__account");return(((t=r?.textContent)===null||t===void 0?void 0:t.trim())||"").replace(/^@/,"")}getDisplayName(n){var t;const r=n.querySelector(".display-name__html");if(!r)return"";const e=r.cloneNode(!0);return this.replaceEmojiImages(e),((t=e.textContent)===null||t===void 0?void 0:t.trim())||""}getReplyDate(n){const t=n.querySelector("time[datetime]");if(!t)return"";const r=t.getAttribute("datetime")||"";try{return new Date(r).toISOString().split("T")[0]}catch{return""}}getReplyPermalink(n){const t=n.querySelector("a.status__relative-time[href]");if(!t)return"";const r=t.getAttribute("href")||"";if(!r)return"";try{const e=new URL(this.url);return r.startsWith("http")?r:`${e.origin}${r}`}catch{return r}}getPublishedDate(){const n=this.document.querySelector('meta[property="og:published_time"]');if(n){const t=n.getAttribute("content")||"";try{return new Date(t).toISOString().split("T")[0]}catch{}}if(this.mainPost){const t=this.mainPost.querySelector("time[datetime]");if(t)try{return new Date(t.getAttribute("datetime")||"").toISOString().split("T")[0]}catch{}}return""}getDescription(){if(!this.mainPost)return"";const n=this.mainPost.querySelector(".status__content__text");return n?(n.textContent||"").trim().slice(0,140).replace(/\s+/g," "):""}extractPostContent(n){const t=[],r=this.extractTextContent(n.querySelector(".status__content"));r&&t.push(r);const e=this.extractImages(n);e&&t.push(e);const o=this.extractLinkCard(n);return o&&t.push(o),t.join(`
|
|
51
|
+
`)}extractTextContent(n){if(!n)return"";const t=n.querySelector(".status__content__text");if(!t)return"";const r=t.cloneNode(!0);return this.replaceEmojiImages(r),r.querySelectorAll("span.invisible").forEach((e=>e.remove())),r.querySelectorAll("span").forEach((e=>{e.replaceWith(...Array.from(e.childNodes))})),(r.innerHTML||r.textContent||"").trim()}replaceEmojiImages(n){n.querySelectorAll("img.emojione").forEach((t=>{const r=t.getAttribute("alt")||"";r?t.replaceWith(t.ownerDocument.createTextNode(r)):t.remove()}))}extractImages(n){const t=n.querySelector(".media-gallery");if(!t)return"";const r=[];return t.querySelectorAll(".media-gallery__item-thumbnail").forEach((e=>{const o=e.getAttribute("href")||"",s=e.querySelector("img"),i=s?.getAttribute("alt")||"";o&&r.push(`<img src="${(0,L.escapeHtml)(o)}" alt="${(0,L.escapeHtml)(i)}" />`)})),r.join(`
|
|
52
|
+
`)}extractLinkCard(n){var t,r,e,o;const s=n.querySelector("a.status-card[href]");if(!s)return"";const i=s.getAttribute("href")||"",c=((r=(t=s.querySelector(".status-card__title"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"",f=((o=(e=s.querySelector(".status-card__description"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"",u=s.querySelector(".status-card__image-image");if(!c&&!i)return"";let h="";if(u){const b=u.getAttribute("src")||"";b&&(h+=`<a href="${(0,L.escapeHtml)(i)}"><img src="${(0,L.escapeHtml)(b)}" alt="${(0,L.escapeHtml)(c)}" /></a>
|
|
53
|
+
`)}return h+=`<p><a href="${(0,L.escapeHtml)(i)}">${(0,L.escapeHtml)(c||i)}</a></p>`,f&&(h+=`
|
|
54
|
+
<p>${(0,L.escapeHtml)(f)}</p>`),h}extractComments(n){if(n.length===0)return"";let t=0;const r=n.map(((e,o)=>{const s=this.getFullHandle(e),i=this.getDisplayName(e),c=this.extractPostContent(e),f=this.getReplyDate(e),u=this.getReplyPermalink(e);return e.querySelector(".status--first-in-thread")||o===0?t=0:t++,{author:i?`${i} @${s}`:`@${s}`,date:f,content:c,depth:t,url:u||void 0}}));return(0,_.buildCommentTree)(r)}}w.MastodonExtractor=A},1756(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.MediumExtractor=void 0;const P=I(2279);class L extends P.BaseExtractor{constructor(A,S,n,t){super(A,S,n,t),this.article=A.querySelector("article.meteredContent")||A.querySelector("article")}canExtract(){var A,S,n;if(!this.article)return!1;if(!((A=this.article.classList)===null||A===void 0)&&A.contains("meteredContent"))return!0;const t=((S=this.document.querySelector('meta[property="og:site_name"]'))===null||S===void 0?void 0:S.getAttribute("content"))||"",r=((n=this.document.querySelector('meta[property="al:android:app_name"]'))===null||n===void 0?void 0:n.getAttribute("content"))||"";return t==="Medium"||r==="Medium"}extract(){const A=this.getTitle(),S=this.getSubtitle(),n=this.getAuthor(),t=this.getPublication();return this.cleanArticle(),{content:"",contentHtml:"",contentSelector:"article",extractedContent:{publication:t},variables:{title:A,author:n,site:t||"Medium",description:S||this.getDescription()}}}cleanArticle(){if(!this.article)return;this.article.querySelectorAll('figure [role="button"]').forEach((S=>{S.replaceWith(...Array.from(S.childNodes))})),this.article.querySelectorAll('[role="tooltip"]').forEach((S=>{S.removeAttribute("role")})),this.article.querySelectorAll('a[href*="medium.com/plans"]').forEach((S=>{const n=S.closest("div");n&&n!==this.article?n.remove():S.remove()})),this.article.querySelectorAll('[data-testid="post-preview"]').forEach((S=>S.remove())),this.article.querySelectorAll('[data-testid*="Clap"], [data-testid*="Bookmark"], [data-testid*="Share"], [data-testid*="Response"]').forEach((S=>S.remove())),this.article.querySelectorAll('[data-testid="authorPhoto"], [data-testid="authorName"], [data-testid="storyReadTime"]').forEach((S=>S.remove()));const A=new Set(["Member-only story","Listen","Share","Top highlight","·","Press enter or click to view image in full size"]);this.article.querySelectorAll("p, span, div").forEach((S=>{var n;const t=((n=S.textContent)===null||n===void 0?void 0:n.trim())||"";t&&(A.has(t)||/^\w{3}\s+\d{1,2},\s+\d{4}/.test(t)&&t.length<30||/^\xb7\s*\d+\s*\w+\s*ago$/.test(t)||/^\xb7?\s*\d+\s*min\s*read$/.test(t))&&S.remove()}))}getTitle(){var A,S,n,t;const r=this.document.querySelector('[data-testid="storyTitle"]');return r?((A=r.textContent)===null||A===void 0?void 0:A.trim())||"":((t=(n=(S=this.article)===null||S===void 0?void 0:S.querySelector("h1"))===null||n===void 0?void 0:n.textContent)===null||t===void 0?void 0:t.trim())||""}getSubtitle(){var A,S;return((S=(A=this.document.querySelector(".pw-subtitle-paragraph"))===null||A===void 0?void 0:A.textContent)===null||S===void 0?void 0:S.trim())||""}getAuthor(){var A,S;return((S=(A=this.document.querySelector('[data-testid="authorName"]'))===null||A===void 0?void 0:A.textContent)===null||S===void 0?void 0:S.trim())||""}getPublication(){var A;const S=this.document.querySelector('meta[property="og:site_name"]'),n=S?.getAttribute("content")||"";if(n&&n!=="Medium")return n;const t=Array.isArray(this.schemaOrgData)?this.schemaOrgData:[this.schemaOrgData];for(const r of t)if(!((A=r?.publisher)===null||A===void 0)&&A.name)return r.publisher.name;return""}getDescription(){var A;if(!this.article)return"";const S=this.article.querySelectorAll("p");for(const n of Array.from(S)){const t=((A=n.textContent)===null||A===void 0?void 0:A.trim())||"";if(!(t.length<3||/^[\d\W]+$/.test(t)))return t.slice(0,140).replace(/\s+/g," ")}return""}}w.MediumExtractor=L},8090(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.NytimesExtractor=void 0;const P=I(2279),L=I(639),_="data-defuddle-nyt";class A extends P.BaseExtractor{constructor(n,t,r,e){var o;if(super(n,t,r,e),this.preloadedData=null,this.contentSelector=null,this.preloadedData=this.extractPreloadData(),this.preloadedData){const s=this.preloadedData.sprinkledBody||this.preloadedData.body;if(!((o=s?.content)===null||o===void 0)&&o.length){if(!n.querySelector(`[${_}]`)){const i=n.createElement("div");i.setAttribute(_,""),i.appendChild((0,L.parseHTML)(n,this.renderBlocks(s.content))),n.body.appendChild(i)}this.contentSelector=`[${_}]`}}}canExtract(){return this.contentSelector!==null}extract(){var n,t,r;const e=this.preloadedData,o=((n=e.headline)===null||n===void 0?void 0:n.default)||"",s=(((r=(t=e.bylines)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.creators)||[]).map((f=>f.displayName)).filter(Boolean).join(", "),i=e.firstPublished||"",c=e.summary||"";return{content:"",contentHtml:"",contentSelector:this.contentSelector,variables:{title:o,author:s,published:i,description:c}}}extractPreloadData(){var n,t;const r=this.document.querySelectorAll("script:not([src])");for(const e of r){const o=e.textContent||"";if(!o.includes("window.__preloadedData"))continue;const s=o.match(/window\.__preloadedData\s*=\s*({[\s\S]+})\s*;?\s*$/);if(s)try{const i=s[1].replace(new RegExp("(?<=:)undefined(?=[,}\\]])","g"),"null");return((t=(n=JSON.parse(i).initialData)===null||n===void 0?void 0:n.data)===null||t===void 0?void 0:t.article)||null}catch{return null}}return null}renderBlocks(n){var t,r,e;const o=[];for(const s of n)switch(s.__typename){case"ParagraphBlock":o.push(`<p>${this.renderInlines(s.content)}</p>`);break;case"Heading2Block":o.push(`<h2>${this.renderInlines(s.content)}</h2>`);break;case"Heading3Block":o.push(`<h3>${this.renderInlines(s.content)}</h3>`);break;case"Heading4Block":o.push(`<h4>${this.renderInlines(s.content)}</h4>`);break;case"ImageBlock":{const i=s.media;if(!i)break;const c=this.getBestImageUrl(i);if(!c)break;const f=this.escapeAttr(i.altText||((t=i.caption)===null||t===void 0?void 0:t.text)||""),u=[((r=i.caption)===null||r===void 0?void 0:r.text)||"",i.credit||""].filter(Boolean);u.length?o.push(`<figure><img src="${this.escapeAttr(c)}" alt="${f}"><figcaption>${this.escapeHtml(u.join(" "))}</figcaption></figure>`):o.push(`<img src="${this.escapeAttr(c)}" alt="${f}">`);break}case"HeaderBasicBlock":case"Dropzone":break;default:{const i=s;!((e=i.content)===null||e===void 0)&&e.length&&o.push(`<p>${this.renderInlines(i.content)}</p>`);break}}return o.join(`
|
|
55
|
+
`)}renderInlines(n){return n?n.map((t=>{var r;let e=this.escapeHtml(t.text||"");if(!(!((r=t.formats)===null||r===void 0)&&r.length))return e;for(const o of t.formats)switch(o.__typename){case"BoldFormat":e=`<strong>${e}</strong>`;break;case"ItalicFormat":e=`<em>${e}</em>`;break;case"LinkFormat":o.url&&(e=`<a href="${this.escapeAttr(o.url)}">${e}</a>`)}return e})).join(""):""}getBestImageUrl(n){var t,r;const e=n?.crops;if(!e?.length)return null;const o=["superJumbo","jumbo","articleLarge"];for(const s of o)for(const i of e){const c=(t=i.renditions)===null||t===void 0?void 0:t.find((f=>f.name===s));if(c?.url)return c.url}for(const s of e)if(!((r=s.renditions)===null||r===void 0)&&r.length&&s.renditions[0].url)return s.renditions[0].url;return null}escapeHtml(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}escapeAttr(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}}w.NytimesExtractor=A},5959(at,w,I){var P=this&&this.__awaiter||function(n,t,r,e){return new(r||(r=Promise))((function(o,s){function i(u){try{f(e.next(u))}catch(h){s(h)}}function c(u){try{f(e.throw(u))}catch(h){s(h)}}function f(u){var h;u.done?o(u.value):(h=u.value,h instanceof r?h:new r((function(b){b(h)}))).then(i,c)}f((e=e.apply(n,t||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.RedditExtractor=void 0;const L=I(2279),_=I(639),A=I(6077);class S extends L.BaseExtractor{constructor(t,r){super(t,r),this.shredditPost=t.querySelector("shreddit-post"),this.isOldReddit=!!t.querySelector(".thing.link")}canExtract(){return!!this.shredditPost||this.isOldReddit}canExtractAsync(){return this.isCommentsPage()&&!this.isOldReddit}prefersAsync(){const t=typeof window<"u"&&this.document.defaultView===window;return this.isCommentsPage()&&!this.isOldReddit&&!t}isCommentsPage(){return/\/r\/.+\/comments\//.test(this.url)}extractAsync(){return P(this,void 0,void 0,(function*(){var t,r;const e=new URL(this.url);e.hostname="old.reddit.com";const o=yield this.fetch(e.toString(),{headers:{"User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0)"}});if(!o.ok)throw new Error(`Failed to fetch old.reddit.com: ${o.status}`);const s=yield o.text(),i=(r=(t=this.document.defaultView)===null||t===void 0?void 0:t.DOMParser)!==null&&r!==void 0?r:typeof DOMParser<"u"?DOMParser:null;if(!i)throw new Error("DOMParser is not available in this environment");const c=new i().parseFromString(s,"text/html");return this.extractOldReddit(c)}))}extract(){var t,r;if(this.isOldReddit)return this.extractOldReddit(this.document);const e=((r=(t=this.document.querySelector("h1"))===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"",o=this.getSubreddit(),s=this.getPostAuthor(),i=this.getPostContent(),c=this.createDescription(i),f=this.options.includeReplies!==!1?this.extractComments():"",u=this.createContentHtml(i,f);return{content:u,contentHtml:u,extractedContent:{postId:this.getPostId(),subreddit:o,postAuthor:s},variables:{title:e,author:s,site:`r/${o}`,description:c}}}extractOldReddit(t){var r,e;const o=t.querySelector(".thing.link"),s=((e=(r=o?.querySelector("a.title"))===null||r===void 0?void 0:r.textContent)===null||e===void 0?void 0:e.trim())||"",i=o?.getAttribute("data-author")||"",c=o?.getAttribute("data-subreddit")||"",f=o?.querySelector(".usertext-body .md"),u=f?(0,_.serializeHTML)(f):"";let h="";if(this.options.includeReplies!==!1){const y=t.querySelector(".commentarea .sitetable"),a=y?this.collectOldRedditComments(y):[];h=a.length>0?(0,A.buildCommentTree)(a):""}const b=this.createContentHtml(u,h),g=this.createDescription(u);return{content:b,contentHtml:b,extractedContent:{postId:this.getPostId(),subreddit:c,postAuthor:i},variables:{title:s,author:i,site:`r/${c}`,description:g}}}getPostContent(){var t,r,e;const o=(t=this.shredditPost)===null||t===void 0?void 0:t.querySelector('[slot="text-body"]');return(o?(0,_.serializeHTML)(o):"")+(((e=(r=this.shredditPost)===null||r===void 0?void 0:r.querySelector("#post-image"))===null||e===void 0?void 0:e.outerHTML)||"")}createContentHtml(t,r){return(0,A.buildContentHtml)("reddit",t,r)}extractComments(){const t=Array.from(this.document.querySelectorAll("shreddit-comment"));return this.processComments(t)}getPostId(){const t=this.url.match(/comments\/([a-zA-Z0-9]+)/);return t?.[1]||""}getSubreddit(){const t=this.url.match(/\/r\/([^/]+)/);return t?.[1]||""}getPostAuthor(){var t;return((t=this.shredditPost)===null||t===void 0?void 0:t.getAttribute("author"))||""}createDescription(t){var r;if(!t)return"";const e=this.document.createElement("div");return e.appendChild((0,_.parseHTML)(this.document,t)),((r=e.textContent)===null||r===void 0?void 0:r.trim().slice(0,140).replace(/\s+/g," "))||""}collectOldRedditComments(t,r=0){var e,o;const s=[],i=Array.from(t.querySelectorAll(":scope > .thing.comment"));for(const c of i){const f=c.getAttribute("data-author")||"",u=c.getAttribute("data-permalink")||"",h=((o=(e=c.querySelector(".entry .tagline .score.unvoted"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"",b=c.querySelector(".entry .tagline time[datetime]"),g=b?.getAttribute("datetime")||"",y=g?new Date(g).toISOString().split("T")[0]:"",a=c.querySelector(".entry .usertext-body .md"),d=a?(0,_.serializeHTML)(a):"";s.push({author:f,date:y,content:d,depth:r,score:h||void 0,url:u?`https://reddit.com${u}`:void 0});const p=c.querySelector(".child > .sitetable");p&&s.push(...this.collectOldRedditComments(p,r+1))}return s}processComments(t){var r;const e=[];for(const o of t){const s=parseInt(o.getAttribute("depth")||"0"),i=o.getAttribute("author")||"",c=o.getAttribute("score")||"0",f=o.getAttribute("permalink")||"",u=o.querySelector('[slot="comment"]'),h=u?(0,_.serializeHTML)(u):"",b=o.getAttribute("created")||((r=o.querySelector("time"))===null||r===void 0?void 0:r.getAttribute("datetime"))||"",g=b?new Date(b).toISOString().split("T")[0]:"";e.push({author:i,date:g,content:h,depth:s,score:`${c} points`,url:f?`https://reddit.com${f}`:void 0})}return(0,A.buildCommentTree)(e)}}w.RedditExtractor=S},6581(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.SubstackExtractor=void 0;const P=I(2279),L=I(639),_="data-defuddle-substack-post";class A extends P.BaseExtractor{constructor(n,t,r,e){var o,s;if(super(n,t,r,e),this.noteText=null,this.noteImage=null,this.postData=null,this.postContentSelector=null,n.querySelector("div.body.markup"))return this.postData=this.extractPreloadData(),void(this.postContentSelector="div.body.markup");if(this.postData=this.extractPreloadData(),(o=this.postData)===null||o===void 0?void 0:o.body_html){if(!n.querySelector(`[${_}]`)){const c=n.createElement("div");c.setAttribute(_,""),c.appendChild((0,L.parseHTML)(n,this.postData.body_html)),n.body.appendChild(c)}return void(this.postContentSelector=`[${_}]`)}const i=n.querySelector('[class*="feedPermalinkUnit"]');if(this.noteText=(i||n).querySelector("div.ProseMirror.FeedProseMirror"),this.noteText){const c=this.noteText.closest('[class*="feedCommentBody"]:not([class*="feedCommentBodyInner"])');if(c){const f=[c.nextElementSibling,(s=c.parentElement)===null||s===void 0?void 0:s.nextElementSibling];for(const u of f)if(u&&(u.getAttribute("class")||"").includes("imageGrid")){this.noteImage=u;break}}}}canExtract(){return this.postContentSelector!==null||this.noteText!==null}extract(){return this.postContentSelector?this.extractPost():this.extractNote()}extractPost(){var n,t,r,e,o,s,i,c,f,u;const h=((n=this.postData)===null||n===void 0?void 0:n.title)||((t=this.document.querySelector('meta[property="og:title"]'))===null||t===void 0?void 0:t.getAttribute("content"))||"",b=((r=this.postData)===null||r===void 0?void 0:r.subtitle)||((e=this.document.querySelector('meta[property="og:description"]'))===null||e===void 0?void 0:e.getAttribute("content"))||"",g=((i=(s=(o=this.postData)===null||o===void 0?void 0:o.publishedBylines)===null||s===void 0?void 0:s[0])===null||i===void 0?void 0:i.name)||((f=(c=this.document.querySelector('a[href*="substack.com/@"]'))===null||c===void 0?void 0:c.textContent)===null||f===void 0?void 0:f.trim())||"",y=((u=this.postData)===null||u===void 0?void 0:u.post_date)||this.parseDateFromByline()||"";return{content:"",contentHtml:"",contentSelector:this.postContentSelector,variables:{title:h,author:g,site:"Substack",description:b,published:y}}}extractNote(){var n,t;const r=this.noteText.outerHTML,e=this.buildImageHtml(),o=e?`${r}
|
|
56
|
+
${e}`:r,s=((n=this.document.querySelector('meta[property="og:title"]'))===null||n===void 0?void 0:n.getAttribute("content"))||"",i=((t=this.document.querySelector('meta[property="og:description"]'))===null||t===void 0?void 0:t.getAttribute("content"))||"",c=s.replace(/\s*\(@[^)]+\)\s*$/,"").trim();return{content:o,contentHtml:o,variables:{title:s,author:c,site:"Substack",description:i}}}parseDateFromByline(){const n=this.document.querySelector('[class*="byline-wrapper"]');if(!n)return"";const t={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"},r=(n.textContent||"").trim().replace(/([a-z])([A-Z])/g,"$1 $2").match(new RegExp("\\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s+(\\d{1,2}),?\\s+(\\d{4})\\b"));if(r){const e=t[r[1]],o=r[2].padStart(2,"0");return`${r[3]}-${e}-${o}T00:00:00+00:00`}return""}extractPreloadData(){var n,t;const r=Array.from(this.document.querySelectorAll("script"));for(const e of r){const o=e.textContent||"";if(!o.includes("window._preloads")||!o.includes("body_html"))continue;const s=o.indexOf('JSON.parse("');if(s===-1)continue;const i=s+12;let c=i;for(;c<o.length;)if(o[c]==="\\")c+=2;else{if(o[c]==='"')break;c++}try{const f=o.slice(i,c),u=JSON.parse('"'+f+'"'),h=JSON.parse(u),b=(t=(n=h?.feedData)===null||n===void 0?void 0:n.initialPost)===null||t===void 0?void 0:t.post;if(b?.body_html)return b}catch{}}return null}buildImageHtml(){var n;if(!this.noteImage)return"";const t=(n=this.document.querySelector('meta[property="og:image"]'))===null||n===void 0?void 0:n.getAttribute("content");if(t)return`<img src="${(0,L.escapeHtml)(t)}" alt="" />`;const r=this.noteImage.querySelector("img");if(!r)return"";const e=this.getLargestSrc(r);return e?`<img src="${(0,L.escapeHtml)(e)}" alt="" />`:""}getLargestSrc(n){const t=n.getAttribute("srcset")||"";if(t){const r=/(.+?)\s+(\d+(?:\.\d+)?)w/g;let e,o="",s=0,i=0;for(;(e=r.exec(t))!==null;){let c=e[1].trim();i>0&&(c=c.replace(/^,\s*/,"")),i=r.lastIndex;const f=parseFloat(e[2]);c&&f>s&&(s=f,o=c)}if(o)return o.replace(/,w_\d+/g,"").replace(/,c_\w+/g,"")}return n.getAttribute("src")||""}}w.SubstackExtractor=A},9970(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ThreadsExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t,r,e){super(n,t,r,e),this.pagelets=[],this.regionContainer=null;const o=Array.from(n.querySelectorAll('[data-pagelet^="threads_post_page_"]'));if(this.pagelets=o.filter((s=>s.querySelector('a[href^="/@"], time[datetime]'))),this.pagelets.length===0){const s=n.querySelector('div[role="region"]');s?.querySelector('a[href^="/@"]')&&(this.regionContainer=s)}}canExtract(){return this.pagelets.length>0||!!this.regionContainer}extract(){var n,t;if(this.pagelets.length===0&&this.regionContainer)return this.extractFromRegion(this.regionContainer);const r=this.getUsername(this.pagelets[0]),e=[],o=[];let s=!1;for(const y of this.pagelets){const a=this.getPostsFromPagelet(y);a.length!==0&&(s||a[0].username!==r||a.length!==1?(s=!0,o.push(a)):e.push(a[0]))}const i=e.map((y=>y.content)).join(`
|
|
57
|
+
<hr>
|
|
58
|
+
`),c=this.options.includeReplies!==!1?this.extractComments(o):"",f=(0,_.buildContentHtml)("threads",i,c),u=`@${r}`,h=this.createDescription((n=e[0])===null||n===void 0?void 0:n.element),b=this.postTitle(u,"Threads"),g=((t=e[0])===null||t===void 0?void 0:t.date)||"";return{content:f,contentHtml:f,extractedContent:{postAuthor:r},variables:Object.assign({title:b,author:u,site:"Threads",description:h},g&&{published:g})}}extractFromRegion(n){const t=this.getUsername(n);if(!t)return{content:"",contentHtml:""};const r=`@${t}`,e=this.extractPostContent(n),o=this.options.includeReplies!==!1?this.extractCommentsFromJson(t):"",s=(0,_.buildContentHtml)("threads",e,o),i=this.createDescription(n),c=this.getDate(n);return{content:s,contentHtml:s,extractedContent:{postAuthor:t},variables:Object.assign({title:this.postTitle(r,"Threads"),author:r,site:"Threads",description:i},c&&{published:c})}}extractCommentsFromJson(n){const t=this.document.querySelectorAll('script[type="application/json"]'),r=[],e=new Set;for(const i of Array.from(t)){const c=i.textContent||"";if(!((c.match(/"text_fragments"/g)||[]).length<2)&&c.includes('"username"'))try{const f=JSON.parse(c);for(const u of this.findPostsInJson(f,0)){const h=u.username+":"+u.text.slice(0,80);e.has(h)||(e.add(h),r.push(u))}}catch{}}if(r.length<2)return"";const o=[];let s=!0;for(const i of r)s&&i.username===n?s=!1:o.push({author:`@${i.username}`,date:"",content:`<p>${(0,L.escapeHtml)(i.text)}</p>`,depth:0});return o.length>0?(0,_.buildCommentTree)(o):""}findPostsInJson(n,t,r=[]){var e;if(t>35||n==null||typeof n!="object")return r;if(!((e=n.user)===null||e===void 0)&&e.username&&typeof n.user.username=="string"){const o=this.extractTextFromJson(n,0);o&&r.push({username:n.user.username,text:o})}for(const o of Object.keys(n))o!=="quoted_post"&&this.findPostsInJson(n[o],t+1,r);return r}extractTextFromJson(n,t){var r;if(t>10||n==null||typeof n!="object")return null;if(!((r=n.text_fragments)===null||r===void 0)&&r.fragments)return n.text_fragments.fragments.map((e=>{var o;return e.plaintext?e.plaintext:!((o=e.mention_fragment)===null||o===void 0)&&o.username?`@${e.mention_fragment.username}`:e.linkified_web_url?e.linkified_web_url:""})).join("");for(const e of Object.keys(n)){if(e==="quoted_post")continue;const o=this.extractTextFromJson(n[e],t+1);if(o)return o}return null}getPostsFromPagelet(n){var t;const r=n.querySelectorAll("[data-pressable-container]"),e=[];for(const o of Array.from(r)){if(!((t=o.parentElement)===null||t===void 0)&&t.closest("[data-pressable-container]"))continue;const s=this.getUsername(o);s&&e.push({username:s,date:this.getDate(o),permalink:this.getPermalink(o),content:this.extractPostContent(o),element:o})}return e}extractComments(n){const t=[];for(const r of n)for(let e=0;e<r.length;e++)t.push(this.toCommentData(r[e],r.length===1?0:e));return t.length>0?(0,_.buildCommentTree)(t):""}toCommentData(n,t){return{author:`@${n.username}`,date:n.date,content:n.content,depth:t,url:n.permalink||void 0}}getUsername(n){var t,r;const e=n.querySelectorAll('a[href^="/@"][role="link"]');for(const s of Array.from(e)){const i=(t=s.textContent)===null||t===void 0?void 0:t.trim();if(i&&!i.includes("profile picture"))return i}const o=n.querySelector('a[href^="/@"]');if(o){const s=(r=o.getAttribute("href"))===null||r===void 0?void 0:r.match(/\/@([^/]+)/);return s?s[1]:""}return""}getDate(n){const t=n.querySelector("time[datetime]");if(!t)return"";const r=t.getAttribute("datetime")||"";try{return new Date(r).toISOString().split("T")[0]}catch{return""}}getPermalink(n){const t=n.querySelector('a[href*="/post/"]');if(!t)return"";const r=t.getAttribute("href")||"";return r.startsWith("http")?r:`https://www.threads.com${r}`}extractPostContent(n){var t;const r=[],e=Array.from(n.querySelectorAll('span[dir="auto"]'));for(const c of e){if(c.closest('a[href^="/@"], a[href*="/post/"], a[href*="l.threads.com"], time')||c.closest('[role="button"]'))continue;const f=((t=c.textContent)===null||t===void 0?void 0:t.trim())||"";if(!f||f==="Author"||f==="·"||f==="Top"||f==="View activity"||/^\d{2}\/\d{2}\/\d{2}$/.test(f)||/^@?\w+\/post\/\w+$/.test(f)||!this.stripThreadNumber(f))continue;const u=this.cleanText(c);u&&r.push(`<p>${u}</p>`)}const o=this.extractImages(n);o&&r.push(o);const s=this.extractLinkCard(n);s&&r.push(s);const i=this.extractQuotedPost(n);return i&&r.push(i),r.join(`
|
|
59
|
+
`)}cleanText(n){const t=n.cloneNode(!0);this.removeThreadNumbers(t),t.querySelectorAll("a").forEach((e=>{var o;const s=e.getAttribute("href")||"",i=((o=e.textContent)===null||o===void 0?void 0:o.trim())||"";if(s.match(/\/@[\w.]+\/post\//))return void e.remove();const c=t.ownerDocument.createElement("a");if(s.includes("l.threads.com"))c.setAttribute("href",this.unwrapRedirectUrl(s));else{if(s.startsWith("/@")){const f=s.replace(/^\/@/,"");return c.setAttribute("href",`https://www.threads.com/@${f}`),c.textContent=`@${f}`,void e.replaceWith(c)}c.setAttribute("href",s.startsWith("http")?s:`https://www.threads.com${s}`)}c.textContent=i,e.replaceWith(c)})),t.querySelectorAll("span, div").forEach((e=>{e.replaceWith(...Array.from(e.childNodes))}));let r=(t.innerHTML||t.textContent||"").trim();return r=r.replace(/<!--.*?-->/g,""),r=r.replace(/\s+/g," ").trim(),r||""}stripThreadNumber(n){return n.replace(/\s*\d+\s*\/\s*\d+\s*$/,"").trim()}removeThreadNumbers(n){var t;const r=Array.from(n.querySelectorAll("div"));for(const e of r){const o=((t=e.textContent)===null||t===void 0?void 0:t.trim())||"";/^\d+\/\d+$/.test(o)&&e.querySelectorAll("span").length>=2&&e.remove()}}unwrapRedirectUrl(n){try{const t=new URL(n).searchParams.get("u");return t?decodeURIComponent(t):n}catch{return n}}extractImages(n){const t=[];return n.querySelectorAll("img").forEach((r=>{const e=r.getAttribute("alt")||"",o=r.getAttribute("src")||"";if(e.includes("profile picture")||!o||r.closest('a[href*="l.threads.com"]'))return;const s=parseInt(r.getAttribute("width")||"0");s>0&&s<=48||t.push(`<img src="${(0,L.escapeHtml)(o)}" alt="${(0,L.escapeHtml)(e)}" />`)})),t.join(`
|
|
60
|
+
`)}extractLinkCard(n){const t=n.querySelectorAll('a[href*="l.threads.com"]');for(const r of Array.from(t)){const e=r.querySelector("img");if(!e)continue;const o=r.getAttribute("href")||"",s=this.unwrapRedirectUrl(o),i=e.getAttribute("src")||"",c=e.getAttribute("alt")||"";if(i)return`<a href="${(0,L.escapeHtml)(s)}"><img src="${(0,L.escapeHtml)(i)}" alt="${(0,L.escapeHtml)(c)}" /></a>`}return""}extractQuotedPost(n){var t;const r=n.querySelector("[data-pressable-container]");if(r)return this.extractQuotedPostFrom(r);const e=n.querySelectorAll('a[href*="/post/"]');for(const o of Array.from(e)){const s=((t=o.textContent)===null||t===void 0?void 0:t.trim())||"";if(/^\d{2}\/\d{2}\/\d{2}$/.test(s))continue;const i=o.getAttribute("href")||"",c=i.match(/\/@([^/]+)\/post\//);if(!c)continue;const f=c[1],u=`<p>${(0,L.escapeHtml)(s)}</p>`,h=i.startsWith("http")?i:`https://www.threads.com${i}`;return(0,_.buildQuotedPost)({author:`@${f}`,content:u,url:h})}return""}extractQuotedPostFrom(n){var t,r;const e=this.getUsername(n),o=this.getDate(n),s=Array.from(n.querySelectorAll('span[dir="auto"]'));let i="";for(const c of s){if(c.closest('[role="button"], time'))continue;const f=c.closest('a[href^="/@"]');if(f&&!(!((t=f.getAttribute("href"))===null||t===void 0)&&t.includes("/post/")))continue;const u=(r=c.textContent)===null||r===void 0?void 0:r.trim();if(!u||u==="·"||u==="Author"||/^\d{2}\/\d{2}\/\d{2}$/.test(u))continue;const h=this.stripThreadNumber(u);h&&(i+=`<p>${(0,L.escapeHtml)(h)}</p>
|
|
61
|
+
`)}return(0,_.buildQuotedPost)({author:e?`@${e}`:void 0,date:o||void 0,content:i.trim()})}createDescription(n){var t;if(!n)return"";const r=n.querySelectorAll('span[dir="auto"]');for(const e of Array.from(r)){if(e.closest('a[href^="/@"], [role="button"], a[href*="/post/"], time'))continue;const o=((t=e.textContent)===null||t===void 0?void 0:t.trim())||"";if(!o||o==="Author"||o==="·"||o==="Top"||o==="View activity"||/^\d{2}\/\d{2}\/\d{2}$/.test(o))continue;const s=this.stripThreadNumber(o);if(s)return s.slice(0,140).replace(/\s+/g," ")}return""}}w.ThreadsExtractor=A},2248(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.TwitterExtractor=void 0;const P=I(2279),L=I(639),_=I(6077);class A extends P.BaseExtractor{constructor(n,t){super(n,t),this.mainTweet=null,this.threadTweets=[],this.replyTweets=[],this.replyDepths=[],this.classifyCells(this.conversationCells()),this.mainTweet||(this.mainTweet=n.querySelector('article[data-testid="tweet"]'))}conversationCells(){const n=[];for(const t of Array.from(this.document.querySelectorAll('[data-testid="cellInnerDiv"], section, h2')))if(t.getAttribute("data-testid")==="cellInnerDiv")n.push(t);else if(n.length&&!t.closest('article[data-testid="tweet"]'))break;return n}classifyCells(n){let t="",r=!1,e=!1,o=0;for(const s of n){const i=s.querySelector('article[data-testid="tweet"]');if(!i){e=!1;continue}if(!this.mainTweet){this.mainTweet=i,t=this.getHandle(i),e=!0;continue}const c=this.getHandle(i);r||!c||c!==t?(r=!0,o=e?o+1:0,this.replyTweets.push(i),this.replyDepths.push(o),e=!0):(this.threadTweets.push(i),e=!0)}}canExtract(){return!!this.mainTweet}extract(){const n=[this.extractTweetContent(this.mainTweet)];for(const c of this.threadTweets)n.push(this.extractTweetContent(c));const t=n.join(`
|
|
62
|
+
<hr>
|
|
63
|
+
`),r=this.options.includeReplies!==!1?this.extractComments():"",e=(0,_.buildContentHtml)("twitter",t,r),o=this.getTweetId(),s=this.getTweetAuthor(),i=this.createDescription(this.mainTweet);return{content:e,contentHtml:e,extractedContent:{tweetId:o,tweetAuthor:s},variables:{title:this.postTitle(s,"X"),author:s,site:"X (Twitter)",description:i}}}extractComments(){if(this.replyTweets.length===0)return"";const n=this.replyTweets.map(((t,r)=>{const e=this.extractUserInfo(t),o=this.extractTweetContent(t);return{author:e.fullName?`${e.fullName} ${e.handle}`:e.handle,date:e.date,content:o,depth:this.replyDepths[r],url:e.permalink}}));return(0,_.buildCommentTree)(n)}getHandle(n){var t;const r=n.querySelector('[data-testid="User-Name"]');if(!r)return"";const e=Array.from(r.querySelectorAll("a"));for(const s of e){const i=((t=s.textContent)===null||t===void 0?void 0:t.trim())||"";if(/^@\w{1,15}$/.test(i))return i}for(const s of e){const i=(s.getAttribute("href")||"").match(/^(?:https?:\/\/[^/]+)?\/(\w{1,15})(?:\/|$)/);if(i&&!A.RESERVED_PATHS.has(i[1].toLowerCase()))return`@${i[1]}`}const o=(r.textContent||"").match(/@(\w{1,15})/);return o?`@${o[1]}`:""}formatTweetText(n){if(!n)return"";const t=this.document.createElement("div");return t.appendChild((0,L.parseHTML)(this.document,n)),t.querySelectorAll("a").forEach((r=>{var e;const o=((e=r.textContent)===null||e===void 0?void 0:e.trim())||"";r.replaceWith(o)})),t.querySelectorAll("span, div").forEach((r=>{r.replaceWith(...Array.from(r.childNodes))})),(0,L.serializeHTML)(t).split(`
|
|
64
|
+
`).map((r=>r.trim())).filter((r=>r)).map((r=>`<p>${r}</p>`)).join(`
|
|
65
|
+
`)}replaceEmojiImages(n){n.querySelectorAll('img[src*="/emoji/"]').forEach((t=>{const r=t.getAttribute("alt");r&&t.replaceWith(r)}))}findQuotedTweet(n){var t,r;return((r=(t=n.querySelector('[aria-labelledby*="id__"]'))===null||t===void 0?void 0:t.querySelector('[data-testid="User-Name"]'))===null||r===void 0?void 0:r.closest('[aria-labelledby*="id__"]'))||null}extractTweetContent(n){if(!n)return"";const t=n.cloneNode(!0);this.replaceEmojiImages(t);const r=t.querySelector('[data-testid="tweetText"]'),e=r?(0,L.serializeHTML)(r):"",o=this.formatTweetText(e),s=this.findQuotedTweet(n),i=this.extractImages(n,s),c=s?this.extractQuotedTweet(s):"",f=this.extractCard(n);let u="";return o&&(u+=o),i.length&&(u+=`
|
|
66
|
+
${i.join(`
|
|
67
|
+
`)}`),f&&(u+=`
|
|
68
|
+
${f}`),c&&(u+=`
|
|
69
|
+
${c}`),u}extractQuotedTweet(n){const t=n.cloneNode(!0);this.replaceEmojiImages(t);const r=t.querySelector('[data-testid="tweetText"]'),e=r?(0,L.serializeHTML)(r):"",o=this.formatTweetText(e),s=this.extractUserInfo(n),i=this.extractImages(n,null);let c="";o&&(c+=o),i.length&&(c+=`
|
|
70
|
+
${i.join(`
|
|
71
|
+
`)}`);const f=s.fullName?`${s.fullName} ${s.handle}`:s.handle;return(0,_.buildQuotedPost)({author:f||void 0,date:s.date||void 0,content:c})}extractUserInfo(n){var t,r,e;const o=n.querySelector('[data-testid="User-Name"]');if(!o)return{fullName:"",handle:"",date:"",permalink:""};const s=this.getHandle(n);let i=Array.from(o.querySelectorAll("a")).map((b=>{var g;return b.querySelector("time")?"":((g=b.textContent)===null||g===void 0?void 0:g.trim())||""})).find((b=>b&&b!==s&&!b.startsWith("@")))||"";if(!i){const b=((r=(t=o.children[0])===null||t===void 0?void 0:t.textContent)===null||r===void 0?void 0:r.trim())||"";b&&!b.startsWith("@")&&(i=b)}const c=n.querySelector("time"),f=c?.getAttribute("datetime")||"",u=f?new Date(f).toISOString().split("T")[0]:"",h=((e=c?.closest("a"))===null||e===void 0?void 0:e.href)||"";return{fullName:i,handle:s,date:u,permalink:h}}extractImages(n,t){const r=['[data-testid="tweetPhoto"]','[data-testid="tweet-image"]','img[src*="media"]'],e=[];for(const o of r)n.querySelectorAll(o).forEach((s=>{var i,c;if(!t?.contains(s)&&s.tagName.toLowerCase()==="img"&&s.getAttribute("alt")){const f=((i=s.getAttribute("src"))===null||i===void 0?void 0:i.replace(/&name=\w+$/,"&name=large"))||"",u=((c=s.getAttribute("alt"))===null||c===void 0?void 0:c.replace(/\s+/g," ").trim())||"";e.push(`<img src="${(0,L.escapeHtml)(f)}" alt="${(0,L.escapeHtml)(u)}" />`)}}));return e}extractCard(n){var t;const r=n.querySelector('[data-testid="card.wrapper"]');if(!r)return"";const e=r.querySelector("a[href]");if(!e)return"";const o=e.getAttribute("href")||"",s=((t=(e.getAttribute("aria-label")||"").split(/\n/)[0])===null||t===void 0?void 0:t.trim())||o;return`<p><a href="${(0,L.escapeHtml)(o)}">${(0,L.escapeHtml)(s)}</a></p>`}getTweetId(){const n=this.url.match(/status\/(\d+)/);return n?.[1]||""}getTweetAuthor(){const n=this.getHandle(this.mainTweet);return n.startsWith("@")?n:`@${n}`}createDescription(n){var t;return n?(((t=n.querySelector('[data-testid="tweetText"]'))===null||t===void 0?void 0:t.textContent)||"").trim().slice(0,140).replace(/\s+/g," "):""}}w.TwitterExtractor=A,A.RESERVED_PATHS=new Set(["i","home","explore","search","notifications","messages","settings","compose","hashtag","intent"])},2144(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.WikipediaExtractor=void 0;const P=I(2279);class L extends P.BaseExtractor{canExtract(){return this.document.querySelector("#mw-content-text")!==null}extract(){var A;const S=((A=this.document.querySelector('meta[property="og:title"]'))===null||A===void 0?void 0:A.getAttribute("content"))||"";return{content:"",contentHtml:"",contentSelector:"#mw-content-text",variables:{title:S.replace(/\s*[-\u2013\u2014]\s*Wikipedia\s*$/,"")||S,author:"Wikipedia",site:"Wikipedia"}}}}w.WikipediaExtractor=L},1064(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.XArticleExtractor=void 0;const P=I(2279),L=I(639),_='[data-testid="twitterArticleReadView"]',A='[data-testid="twitterArticleRichTextView"]',S='[data-testid="twitter-article-title"]',n='[itemprop="author"]',t='meta[itemprop="name"]',r='meta[itemprop="additionalName"]',e='[data-testid="tweetPhoto"] img',o=".longform-unstyled, .public-DraftStyleDefault-block",s='span[style*="font-weight: bold"]',i="[data-offset-key]",c='[data-testid="simpleTweet"]',f='[data-testid="tweetText"]',u='[data-testid="User-Name"]',h='[data-testid="markdown-code-block"]';class b extends P.BaseExtractor{constructor(y,a,d){super(y,a,d),this.articleContainer=y.querySelector(A)}canExtract(){return!!this.articleContainer}extract(){const y=this.extractTitle(),a=this.extractAuthor(),d=this.extractContent(),p=this.createDescription();return{content:d,contentHtml:d,extractedContent:{articleId:this.getArticleId()},variables:{title:y,author:a,site:"X (Twitter)",description:p}}}extractTitle(){var y;const a=this.document.querySelector(S);return((y=a?.textContent)===null||y===void 0?void 0:y.trim())||"Untitled X Article"}extractAuthor(){var y,a;const d=this.document.querySelector(n);if(!d)return this.getAuthorFromUrl();const p=(y=d.querySelector(t))===null||y===void 0?void 0:y.getAttribute("content"),x=(a=d.querySelector(r))===null||a===void 0?void 0:a.getAttribute("content");return p&&x?`${p} (@${x})`:p||x||this.getAuthorFromUrl()}getAuthorFromUrl(){const y=this.url.match(/\/([a-zA-Z0-9_][a-zA-Z0-9_]{0,14})\/(article|status)\/\d+/);return y?`@${y[1]}`:this.getAuthorFromOgTitle()}getAuthorFromOgTitle(){var y;const a=(((y=this.document.querySelector('meta[property="og:title"]'))===null||y===void 0?void 0:y.getAttribute("content"))||"").match(/^(?:\(\d+\)\s+)?(.+?)\s+on\s+X\s*:/);return a?a[1].trim():"Unknown"}getArticleId(){const y=this.url.match(/article\/(\d+)/);return y?y[1]:""}extractContent(){if(!this.articleContainer)return"";const y=this.articleContainer.cloneNode(!0);return this.cleanContent(y),`<article class="x-article">${this.extractHeaderImage()}${(0,L.serializeHTML)(y)}</article>`}extractHeaderImage(){var y;const a=this.document.querySelector(_);if(!a)return"";const d=a.querySelector(e);if(!d||this.articleContainer.contains(d))return"";const p=d.getAttribute("src");if(!p)return"";const x=((y=d.getAttribute("alt"))===null||y===void 0?void 0:y.replace(/\s+/g," ").trim())||"Image";return`<img src="${(0,L.escapeHtml)(this.upgradeImageSrc(p))}" alt="${(0,L.escapeHtml)(x)}">`}cleanContent(y){const a=y.ownerDocument||this.document;this.convertEmbeddedTweets(y,a),this.convertCodeBlocks(y,a),this.convertHeaders(y,a),this.unwrapLinkedImages(y,a),this.upgradeImageQuality(y),this.convertBoldSpans(y,a),this.convertDraftParagraphs(y,a),this.removeDraftAttributes(y),this.repairSurrogatePairs(y)}convertEmbeddedTweets(y,a){y.querySelectorAll(c).forEach((d=>{var p,x,l,m,v;const E=a.createElement("blockquote");E.className="embedded-tweet";const q=d.querySelector(u),C=q?.querySelectorAll("a"),N=((x=(p=C?.[0])===null||p===void 0?void 0:p.textContent)===null||x===void 0?void 0:x.trim())||"",O=((m=(l=C?.[1])===null||l===void 0?void 0:l.textContent)===null||m===void 0?void 0:m.trim())||"",T=d.querySelector(f),R=((v=T?.textContent)===null||v===void 0?void 0:v.trim())||"";if(N||O){const D=a.createElement("cite");D.textContent=O?`${N} ${O}`:N,E.appendChild(D)}if(R){const D=a.createElement("p");D.textContent=R,E.appendChild(D)}d.replaceWith(E)}))}convertCodeBlocks(y,a){y.querySelectorAll(h).forEach((d=>{var p;const x=d.querySelector("pre"),l=d.querySelector("code");if(!x||!l)return;let m="";const v=l.className.match(/language-(\w+)/);if(v)m=v[1];else{const C=d.querySelector("span");m=((p=C?.textContent)===null||p===void 0?void 0:p.trim())||""}const E=a.createElement("pre"),q=a.createElement("code");m&&(q.setAttribute("data-lang",m),q.className=`language-${m}`),q.textContent=l.textContent||"",E.appendChild(q),d.replaceWith(E)}))}convertHeaders(y,a){y.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((d=>{var p;const x=d.tagName.toLowerCase(),l=((p=d.textContent)===null||p===void 0?void 0:p.trim())||"";if(!l)return;const m=a.createElement(x);m.textContent=l,d.replaceWith(m)}))}unwrapLinkedImages(y,a){y.querySelectorAll(e).forEach((d=>{var p;const x=d.closest("a");if(!x||!y.contains(x))return;const l=d.getAttribute("src")||"",m=((p=d.getAttribute("alt"))===null||p===void 0?void 0:p.replace(/\s+/g," ").trim())||"Image",v=a.createElement("img");v.setAttribute("src",this.upgradeImageSrc(l)),v.setAttribute("alt",m),x.replaceWith(v)}))}upgradeImageQuality(y){y.querySelectorAll(e).forEach((a=>{const d=a.getAttribute("src");d&&a.setAttribute("src",this.upgradeImageSrc(d))}))}upgradeImageSrc(y){return y.includes("&name=")?y.replace(/&name=\w+/,"&name=large"):y.includes("?")?`${y}&name=large`:`${y}?name=large`}convertDraftParagraphs(y,a){y.querySelectorAll(o).forEach((d=>{const p=a.createElement("p"),x=l=>{if(l.nodeType===3)p.appendChild(a.createTextNode(l.textContent||""));else if(l.nodeType===1){const m=l,v=m.tagName.toLowerCase();if(v==="strong"){const E=a.createElement("strong");E.textContent=m.textContent||"",p.appendChild(E)}else if(v==="a"){const E=a.createElement("a");E.setAttribute("href",m.getAttribute("href")||""),E.textContent=m.textContent||"",p.appendChild(E)}else if(v==="code"){const E=a.createElement("code");E.textContent=m.textContent||"",p.appendChild(E)}else m.childNodes.forEach((E=>x(E)))}};d.childNodes.forEach((l=>x(l))),d.replaceWith(p)}))}convertBoldSpans(y,a){y.querySelectorAll(s).forEach((d=>{const p=a.createElement("strong");p.textContent=d.textContent||"",d.replaceWith(p)}))}removeDraftAttributes(y){y.querySelectorAll(i).forEach((a=>{a.removeAttribute("data-offset-key")}))}repairSurrogatePairs(y){const a=(y.ownerDocument||this.document).createTreeWalker(y,4);let d,p=null;for(;d=a.nextNode();){const x=d;if(p){const l=p.textContent||"",m=x.textContent||"";if(l&&m){const v=l.charCodeAt(l.length-1),E=m.charCodeAt(0);v>=55296&&v<=56319&&E>=56320&&E<=57343&&(p.textContent=l.slice(0,-1),x.textContent=l.slice(-1)+m)}}p=x}}createDescription(){var y,a;const d=((a=(y=this.articleContainer)===null||y===void 0?void 0:y.textContent)===null||a===void 0?void 0:a.trim())||"";return d.slice(0,140)+(d.length>140?"...":"")}}w.XArticleExtractor=b},5666(at,w,I){var P=this&&this.__awaiter||function(n,t,r,e){return new(r||(r=Promise))((function(o,s){function i(u){try{f(e.next(u))}catch(h){s(h)}}function c(u){try{f(e.throw(u))}catch(h){s(h)}}function f(u){var h;u.done?o(u.value):(h=u.value,h instanceof r?h:new r((function(b){b(h)}))).then(i,c)}f((e=e.apply(n,t||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.XOembedExtractor=void 0;const L=I(2279),_=I(639),A=I(6077);class S extends L.BaseExtractor{canExtract(){return!1}extract(){return{content:"",contentHtml:""}}canExtractAsync(){return/\/(status|article)\/\d+/.test(this.url)}prefersAsync(){return!(typeof window<"u"&&this.document.defaultView==window)}extractAsync(){return P(this,void 0,void 0,(function*(){return(yield this.tryExtractFxTwitter())||this.extractOembed()}))}extractOembed(){return P(this,void 0,void 0,(function*(){const t=`https://publish.twitter.com/oembed?url=${encodeURIComponent(this.url)}&omit_script=true`,r=yield this.fetch(t);if(!r.ok)throw new Error(`oEmbed request failed: ${r.status}`);const e=yield r.json(),o=this.document.createElement("div");o.appendChild((0,_.parseHTML)(this.document,e.html));const s=o.querySelector("blockquote"),i=s?.querySelectorAll("p")||[],c=Array.from(i).map((g=>`<p>${(0,_.serializeHTML)(g)}</p>`)).join(`
|
|
72
|
+
`),f=e.author_url?`@${e.author_url.split("/").pop()}`:"",u=(0,A.buildContentHtml)("twitter",c,""),h=f||e.author_name,b=c.replace(/<[^>]*>/g,"").trim().slice(0,140).replace(/\s+/g," ");return{content:u,contentHtml:u,variables:{title:this.postTitle(h,"X"),author:h,site:"X (Twitter)",description:b}}}))}tryExtractFxTwitter(){return P(this,void 0,void 0,(function*(){var t,r;const e=this.url.match(/\/([a-zA-Z0-9_][a-zA-Z0-9_]{0,14})\/(status|article)\/(\d+)/);if(!e)return null;try{const o=yield this.fetchFxTwitter(e[1],e[3]);return!((t=o.tweet)===null||t===void 0)&&t.article?this.buildArticleResult(o):!((r=o.tweet)===null||r===void 0)&&r.text?this.buildTweetResult(o):null}catch{return null}}))}fetchFxTwitter(t,r){return P(this,void 0,void 0,(function*(){const e=`https://api.fxtwitter.com/${t}/status/${r}`,o=yield this.fetch(e,{headers:{"User-Agent":"Mozilla/5.0 (compatible; Defuddle/1.0; +https://defuddle.md)"}});if(!o.ok)throw new Error(`FxTwitter API request failed: ${o.status}`);return o.json()}))}toDateString(t){if(t)try{return new Date(t).toISOString().split("T")[0]}catch{return}}buildArticleResult(t){var r;const e=t.tweet.article,{blocks:o,entityMap:s}=e.content,i=e.media_entities||[],c=this.renderArticle(o,s,e.cover_media,i),f=`@${t.tweet.author.screen_name}`,u=(r=this.toDateString(e.created_at))!==null&&r!==void 0?r:this.toDateString(t.tweet.created_at);return{content:c,contentHtml:c,variables:Object.assign({title:e.title,author:f,site:"X (Twitter)",description:e.preview_text},u&&{published:u})}}buildTweetResult(t){const r=t.tweet,e=`@${r.author.screen_name}`,o=this.renderTweet(r),s=(0,A.buildContentHtml)("twitter",o,""),i=this.toDateString(r.created_at),c=(r.text||"").trim().slice(0,140).replace(/\s+/g," ");return{content:s,contentHtml:s,variables:Object.assign({title:this.postTitle(e,"X"),author:e,site:"X (Twitter)",description:c},i&&{published:i})}}codePointToUtf16Index(t,r){let e=0,o=0;for(const s of t){if(o>=r)break;e+=s.length,o+=1}return e}adjustFacetIndicesToUtf16(t,r){return r.length===0?r:/[\uD800-\uDBFF]/.test(t)?r.map((e=>{const[o,s]=e.indices;return Object.assign(Object.assign({},e),{indices:[this.codePointToUtf16Index(t,o),this.codePointToUtf16Index(t,s)]})})):r}renderTweet(t){var r,e,o;const s=((r=t.raw_text)===null||r===void 0?void 0:r.text)||t.text,i=(((e=t.raw_text)===null||e===void 0?void 0:e.facets)||[]).filter((b=>b.type!=="media")),c=this.adjustFacetIndicesToUtf16(s,i),f=s.split(/\n\n+/);let u=0;const h=[];for(const b of f){const g=s.indexOf(b,u),y=g+b.length;u=y;const a=b.trimStart().startsWith(">");let d=a?b.trimStart().slice(1).trimStart():b;const p=a?g+(b.length-b.trimStart().length)+1+(b.trimStart().slice(1).length-b.trimStart().slice(1).trimStart().length):g,x=this.applyFacets(d,p,y,c).replace(/\n/g,"<br>");a?h.push(`<blockquote><p>${x}</p></blockquote>`):x.trim()&&h.push(`<p>${x}</p>`)}if(!((o=t.media)===null||o===void 0)&&o.photos)for(const b of t.media.photos)h.push(`<img src="${(0,_.escapeHtml)(b.url)}" alt="">`);return h.join(`
|
|
73
|
+
`)}applyMarkers(t,r){if(r.length===0)return(0,_.escapeHtml)(t);r.sort(((s,i)=>s.offset!==i.offset?s.offset-i.offset:s.type==="close"&&i.type==="open"?-1:s.type==="open"&&i.type==="close"?1:0));let e="",o=0;for(const s of r)s.offset>o&&(e+=(0,_.escapeHtml)(t.slice(o,s.offset))),e+=s.tag,o=s.offset;return o<t.length&&(e+=(0,_.escapeHtml)(t.slice(o))),e}applyFacets(t,r,e,o){const s=[];for(const i of o){const[c,f]=i.indices;if(f<=r||c>=e)continue;const u=Math.max(0,c-r),h=Math.min(t.length,f-r);if(i.type==="italic")s.push({offset:u,type:"open",tag:"<em>"}),s.push({offset:h,type:"close",tag:"</em>"});else if(i.type==="mention"&&i.text){const b=`https://x.com/${(0,_.escapeHtml)(i.text)}`;s.push({offset:u,type:"open",tag:`<a href="${b}">`}),s.push({offset:h,type:"close",tag:"</a>"})}else if(i.type==="url"&&i.original){const b=(0,_.escapeHtml)(i.original);s.push({offset:u,type:"open",tag:`<a href="${b}">`}),s.push({offset:h,type:"close",tag:"</a>"})}}return this.applyMarkers(t,s)}renderArticle(t,r,e,o){var s;const i=[];!((s=e?.media_info)===null||s===void 0)&&s.original_img_url&&i.push(`<img src="${(0,_.escapeHtml)(e.media_info.original_img_url)}" alt="Cover image">`);let c=0;for(;c<t.length;){const f=t[c];if(f.type==="unordered-list-item"){const h=[];for(;c<t.length&&t[c].type==="unordered-list-item";)h.push(`<li>${this.renderInlineContent(t[c],r)}</li>`),c++;i.push(`<ul>${h.join("")}</ul>`);continue}const u=this.renderBlock(f,r,o);u&&i.push(u),c++}return`<article class="x-article">${i.join(`
|
|
74
|
+
`)}</article>`}renderBlock(t,r,e){switch(t.type){case"unstyled":default:return t.text.trim()?`<p>${this.renderInlineContent(t,r)}</p>`:"";case"header-two":return`<h2>${this.renderInlineContent(t,r)}</h2>`;case"header-three":return`<h3>${this.renderInlineContent(t,r)}</h3>`;case"atomic":return this.renderAtomicBlock(t,r,e)}}renderAtomicBlock(t,r,e){var o,s;if(t.entityRanges.length===0)return"";const i=r.find((f=>f.key===String(t.entityRanges[0].key)));if(!i)return"";const c=i.value;switch(c.type){case"MEDIA":{const f=c.data.mediaItems||[],u=c.data.caption,h=[];for(const b of f){const g=e?.find((a=>String(a.media_id)===String(b.mediaId)));if(!g)continue;const y=g.media_info;if(y.__typename==="ApiImage"&&y.original_img_url)h.push(`<img src="${(0,_.escapeHtml)(y.original_img_url)}" alt="${u?(0,_.escapeHtml)(u):""}">`);else if(y.__typename==="ApiVideo"&&(!((o=y.preview_image)===null||o===void 0)&&o.original_img_url)){const a=(s=(y.variants||[]).filter((p=>p.content_type==="video/mp4"&&p.bit_rate)).sort(((p,x)=>(x.bit_rate||0)-(p.bit_rate||0)))[0])===null||s===void 0?void 0:s.url,d=y.preview_image.original_img_url;a?h.push(`<video src="${(0,_.escapeHtml)(a)}" poster="${(0,_.escapeHtml)(d)}" controls></video>`):h.push(`<img src="${(0,_.escapeHtml)(d)}" alt="${u?(0,_.escapeHtml)(u):""}">`)}}return h.length>0&&u?`<figure>${h.join(`
|
|
75
|
+
`)}<figcaption>${(0,_.escapeHtml)(u)}</figcaption></figure>`:h.length>0?h.map((b=>`<figure>${b}</figure>`)).join(`
|
|
76
|
+
`):u?`<figure><figcaption>${(0,_.escapeHtml)(u)}</figcaption></figure>`:""}case"MARKDOWN":{const f=c.data.markdown||"",u=f.match(/^```(\w*)\n([\s\S]*?)\n?```$/);if(u){const h=u[1],b=u[2];return`<pre><code${h?` class="language-${(0,_.escapeHtml)(h)}" data-lang="${(0,_.escapeHtml)(h)}"`:""}>${(0,_.escapeHtml)(b)}</code></pre>`}return`<pre><code>${(0,_.escapeHtml)(f)}</code></pre>`}default:return""}}renderInlineContent(t,r){var e,o;const s=t.text;if(!s)return"";const i=[];for(const c of t.inlineStyleRanges)c.style==="Bold"&&(i.push({offset:c.offset,type:"open",tag:"<strong>"}),i.push({offset:c.offset+c.length,type:"close",tag:"</strong>"}));for(const c of t.entityRanges){const f=r.find((u=>u.key===String(c.key)));if(f?.value.type==="LINK"&&f.value.data.url){const u=(0,_.escapeHtml)(f.value.data.url);i.push({offset:c.offset,type:"open",tag:`<a href="${u}">`}),i.push({offset:c.offset+c.length,type:"close",tag:"</a>"})}}if(!((e=t.data)===null||e===void 0)&&e.mentions)for(const c of t.data.mentions){const f=`https://x.com/${(0,_.escapeHtml)(c.text)}`;i.push({offset:c.fromIndex,type:"open",tag:`<a href="${f}">`}),i.push({offset:c.toIndex,type:"close",tag:"</a>"})}if(!((o=t.data)===null||o===void 0)&&o.urls)for(const c of t.data.urls){const f=(0,_.escapeHtml)(c.text);i.push({offset:c.fromIndex,type:"open",tag:`<a href="${f}">`}),i.push({offset:c.toIndex,type:"close",tag:"</a>"})}return this.applyMarkers(s,i)}}w.XOembedExtractor=S},3258(at,w,I){var P=this&&this.__awaiter||function(x,l,m,v){return new(m||(m=Promise))((function(E,q){function C(T){try{O(v.next(T))}catch(R){q(R)}}function N(T){try{O(v.throw(T))}catch(R){q(R)}}function O(T){var R;T.done?E(T.value):(R=T.value,R instanceof m?R:new m((function(D){D(R)}))).then(C,N)}O((v=v.apply(x,l||[])).next())}))};Object.defineProperty(w,"__esModule",{value:!0}),w.YoutubeExtractor=void 0;const L=I(2279),_=I(639),A=I(2552),S=I(1497),n="」』)",t=new RegExp(`[.!?。!?]["'\\u2019\\u201D)${n}]*\\s*$`),r=new RegExp(`[?\\uFF1F]["'\\u2019\\u201D)${n}]*\\s*$`),e=/^(>>|-\s)/,o=/^(>>\s*|-\s+)/,s=/,\s*$/,i=new RegExp(`^(.*[.!?]["'\\u2019\\u201D)]*)\\s+([A-Z].*)$|^(.*[。!?][${n}]*)([${A.CJK_CHAR_RANGES}].*)$`),c=4e3,f="https://www.youtube.com/youtubei/v1/player?prettyPrint=false",u="20.10.38",h={client:{clientName:"ANDROID",clientVersion:u}},b=`com.google.android.youtube/${u} (Linux; U; Android 14)`,g={client:{clientName:"IOS",clientVersion:"20.10.3"}},y={client:{clientName:"WEB",clientVersion:"2.20240101.00.00"}},a={segments:"ytd-transcript-segment-renderer",timestamp:".segment-timestamp",text:".segment-text"},d={segments:"transcript-segment-view-model",timestamp:".ytwTranscriptSegmentViewModelTimestamp",text:"span.yt-core-attributed-string",chapters:"timeline-chapter-view-model h3"};class p extends L.BaseExtractor{constructor(l,m,v,E){super(l,m,v,E),this.inlineJsonCache=new Map,this.videoElement=l.querySelector("video"),this.schemaOrgData=v}canExtract(){return!0}canExtractAsync(){return!0}prefersAsync(){return!0}extract(){return this.buildResult(this.extractTranscriptFromExistingDom())}extractAsync(){return P(this,void 0,void 0,(function*(){const l=this.extractTranscriptFromExistingDom();if(this.shouldUseExistingDomTranscript(l))return this.buildResult(l);const m=(yield this.fetchTranscript())||l||(yield this.extractTranscriptFromOpenedDom());return this.buildResult(m)}))}normalizeLanguageCode(l){return(l||"").trim().replace(/_/g,"-").toLocaleLowerCase()}languageCodeMatchesPreference(l,m){const v=this.normalizeLanguageCode(l),E=this.normalizeLanguageCode(m);if(!v||!E)return!1;if(v===E)return!0;const q=v.split("-")[0],C=E.split("-")[0];return q===C&&(v===q||E===C)}shouldUseExistingDomTranscript(l){return!!l&&(!this.options.language||this.languageCodeMatchesPreference(l.languageCode,this.options.language))}getCaptionTracks(l){var m,v;const E=(v=(m=l?.captions)===null||m===void 0?void 0:m.playerCaptionsTracklistRenderer)===null||v===void 0?void 0:v.captionTracks;return Array.isArray(E)?E:[]}findPreferredCaptionTrack(l,m){var v,E;const q=this.normalizeLanguageCode(m);if(!q)return;const C=q.split("-")[0],N=l.map((T=>({t:T,code:this.normalizeLanguageCode(T.languageCode)}))),O=T=>{var R,D;const $=N.filter(T);return(D=(R=$.find((({t:M})=>M.kind!=="asr")))!==null&&R!==void 0?R:$[0])===null||D===void 0?void 0:D.t};return(E=(v=O((({code:T})=>T===q)))!==null&&v!==void 0?v:O((({code:T})=>T===C)))!==null&&E!==void 0?E:O((({code:T})=>T.split("-")[0]===C))}pickCaptionTrack(l){const m=this.options.language;if(m){const q=this.findPreferredCaptionTrack(l,m);if(q)return q}const v=l.filter((q=>q.kind!=="asr")),E=v.length>0?v:l;return E.find((q=>q.languageCode==="en"))||E[0]}getTrackDisplayName(l){var m,v,E;return((m=l?.name)===null||m===void 0?void 0:m.simpleText)||((E=(v=l?.name)===null||v===void 0?void 0:v.runs)===null||E===void 0?void 0:E.map((q=>q?.text||"")).join("").trim())||""}normalizeLanguageLabel(l){return l.replace(/\s*\([^)]*\)\s*/g," ").replace(/\s+/g," ").trim().toLocaleLowerCase()}getTranscriptLanguageCodeFromDom(){var l;const m=this.document.querySelector('ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #footer yt-sort-filter-sub-menu-renderer yt-dropdown-menu button'),v=(l=m?.textContent)===null||l===void 0?void 0:l.trim(),E=this.getCaptionTracks(this.getValidatedPlayerResponse()),q=E.length===1?E[0]:void 0;if(!v)return q?.languageCode;const C=this.normalizeLanguageLabel(v),N=E.find((O=>this.normalizeLanguageLabel(this.getTrackDisplayName(O))===C));return N?.languageCode||q?.languageCode}getInlineChapters(){var l,m,v,E;const q=this.getVideoId(),C=this.parseInlineJson("ytInitialData");if(!C)return[];if(q){const O=(m=(l=C?.currentVideoEndpoint)===null||l===void 0?void 0:l.watchEndpoint)===null||m===void 0?void 0:m.videoId,T=(E=(v=C?.endpoint)===null||v===void 0?void 0:v.watchEndpoint)===null||E===void 0?void 0:E.videoId;if(O!==q&&T!==q)return[]}const N=this.extractChaptersFromPlayerBar(C);return N.length>0?N:this.extractChaptersFromEngagementPanels(C)}getTranscriptContainer(){return this.document.querySelector('ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #segments-container')||this.document.querySelector("ytm-macro-markers-list-renderer .ytm-macro-markers-list-container")}getTranscriptSelectors(l){return l.querySelectorAll("ytd-transcript-segment-renderer").length>0?a:l.querySelectorAll("transcript-segment-view-model").length>0?d:void 0}buildTranscriptFromContainer(l,m){var v;if(l.children.length===0)return;const E=this.getTranscriptSelectors(l);if(!E)return;const q=[],C=[];if(E.chapters){const $=l.querySelectorAll(E.chapters);for(const M of $){const W=(M.textContent||"").trim();if(!W)continue;const B=M.closest("macro-markers-panel-item-view-model"),H=(v=B?.nextElementSibling)===null||v===void 0?void 0:v.querySelector(E.timestamp),k=(H?.textContent||"").trim(),F=this.parseTimestamp(k);F!==null&&C.push({title:W,start:F})}}const N=l.querySelectorAll(E.segments);for(const $ of N){const M=$.querySelector(E.timestamp),W=$.querySelector(E.text);if(!M||!W)continue;const B=(M.textContent||"").trim(),H=(W.textContent||"").trim();if(!H)continue;const k=this.parseTimestamp(B);k!==null&&q.push({start:k,text:H})}if(q.length===0)return;const O=m.length>0?m:C,T=this.groupTranscriptSegments(q),{html:R,text:D}=(0,S.buildTranscript)("youtube",T,O);return{html:R,text:D,languageCode:this.getTranscriptLanguageCodeFromDom()}}extractTranscriptFromExistingDom(){try{const l=this.getTranscriptContainer();return l?this.buildTranscriptFromContainer(l,this.getInlineChapters()):void 0}catch(l){return void console.error("YoutubeExtractor: failed to extract transcript from existing DOM",l)}}canOpenTranscriptPanel(){var l;return typeof((l=this.document.defaultView)===null||l===void 0?void 0:l.MutationObserver)=="function"}buildResult(l){const m=this.getVideoData(),v=this.getChannelName(m),E=m.description||"",q=this.formatDescription(E);let C=`<iframe width="560" height="315" src="https://www.youtube.com/embed/${this.getVideoId()}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>${q}`;l?.html&&(C+=l.html);const N={title:m.name||"",author:v,site:"YouTube",image:Array.isArray(m.thumbnailUrl)&&m.thumbnailUrl[0]||"",published:m.uploadDate,description:E.slice(0,200).trim()};return l?.text&&(N.transcript=l.text),l?.languageCode&&(N.language=l.languageCode),{content:C,contentHtml:C,extractedContent:{videoId:this.getVideoId(),author:v},variables:N}}formatDescription(l){return`<p>${(0,_.escapeHtml)(l).replace(/\n/g,"<br>")}</p>`}getVideoData(){var l,m,v,E;const q=this.getVideoId(),C=Array.from(this.document.querySelectorAll('script[type="application/ld+json"]'));let N;for(const O of C)try{const T=JSON.parse(O.textContent||""),R=(Array.isArray(T)?T:[T]).find((D=>D["@type"]!=="VideoObject"?!1:q?(D["@id"]||D.url||D.embedUrl||"").includes(q):!0));if(R&&R.description)return R;!R||!R.comment&&N||(N=R)}catch{}return N||(q&&(((l=this.document.querySelector('meta[property="og:url"]'))===null||l===void 0?void 0:l.getAttribute("content"))||"").includes(q)?{name:((m=this.document.querySelector('meta[property="og:title"]'))===null||m===void 0?void 0:m.getAttribute("content"))||"",description:((v=this.document.querySelector('meta[property="og:description"]'))===null||v===void 0?void 0:v.getAttribute("content"))||"",thumbnailUrl:((E=this.document.querySelector('meta[property="og:image"]'))===null||E===void 0?void 0:E.getAttribute("content"))||""}:{})}getChannelName(l){const m=this.getChannelNameFromDom();return m||this.getChannelNameFromPlayerResponse()||l?.author||""}getChannelNameFromDom(){var l;const m=['ytd-video-owner-renderer #channel-name a[href^="/@"]','#owner-name a[href^="/@"]'];for(const v of m){const E=this.document.querySelector(v),q=(l=E?.textContent)===null||l===void 0?void 0:l.trim();if(q)return q}return this.getChannelNameFromMicrodata()}getChannelNameFromMicrodata(){var l;const m=this.document.querySelector('[itemprop="author"]');if(!m)return"";const v=m.querySelector('meta[itemprop="name"]');if(v?.getAttribute("content"))return v.getAttribute("content").trim();const E=m.querySelector('link[itemprop="name"]');if(E?.getAttribute("content"))return E.getAttribute("content").trim();const q=m.querySelector('[itemprop="name"], a, span');return((l=q?.textContent)===null||l===void 0?void 0:l.trim())||""}getChannelNameFromPlayerResponse(){var l,m,v,E;const q=this.getValidatedPlayerResponse();return q&&(((l=q.videoDetails)===null||l===void 0?void 0:l.author)||((m=q.videoDetails)===null||m===void 0?void 0:m.ownerChannelName)||((E=(v=q.microformat)===null||v===void 0?void 0:v.playerMicroformatRenderer)===null||E===void 0?void 0:E.ownerChannelName))||""}getValidatedPlayerResponse(){var l,m,v;const E=this.getVideoId();if(!E)return null;const q=this.parseInlineJson("ytInitialPlayerResponse");if(!q)return null;const C=(l=q.videoDetails)===null||l===void 0?void 0:l.videoId,N=(v=(m=q.microformat)===null||m===void 0?void 0:m.playerMicroformatRenderer)===null||v===void 0?void 0:v.externalVideoId;return C===E||N===E?q:null}parseInlineJson(l){if(this.inlineJsonCache.has(l))return this.inlineJsonCache.get(l);const m=Array.from(this.document.querySelectorAll("script"));for(const v of m){const E=v.textContent||"";if(!E.includes(l))continue;const q=E.indexOf("{",E.indexOf(l));if(q===-1)continue;let C=0;for(let N=q;N<E.length;N++){const O=E[N];if(O==="{")C+=1;else if(O==="}"&&(C-=1,C===0)){const T=E.slice(q,N+1);try{const R=JSON.parse(T);return this.inlineJsonCache.set(l,R),R}catch(R){console.error("YoutubeExtractor: failed to parse inline JSON",R);break}}}}return null}fetchTranscript(){return P(this,void 0,void 0,(function*(){try{const l=this.getVideoId();if(!l)return;const m=this.fetchChapters(l),v=this.getInlineCaptionTrack(),E=v?this.fetchCaptionXml(v,m):void 0,q=yield this.fetchPlayerData(l),C=q?this.pickCaptionTrack(this.getCaptionTracks(q)):void 0,N=C?.baseUrl&&C.baseUrl!==v?.baseUrl?this.fetchCaptionXml(C,m):void 0;return(N?yield N:void 0)||(E?yield E:void 0)}catch(l){return void console.error("YoutubeExtractor: failed to fetch transcript",l)}}))}getInlineCaptionTrack(){const l=this.getValidatedPlayerResponse(),m=this.getCaptionTracks(l);if(m.length===0)return;const v=this.pickCaptionTrack(m);return v?.baseUrl?v:void 0}fetchCaptionXml(l,m){return P(this,void 0,void 0,(function*(){try{if(!new URL(l.baseUrl).hostname.endsWith(".youtube.com"))return;const v={"User-Agent":"Mozilla/5.0"};this.options.language&&(v["Accept-Language"]=this.options.language);const E=yield this.fetch(l.baseUrl,{headers:v,signal:AbortSignal.timeout(c)});if(!E.ok)return;let q;try{q=yield E.text()}catch{return}if(!q)return;const C=yield m;return this.parseTranscriptXml(q,l.languageCode||"en",C)}catch{return}}))}pollFor(l,m=20){return new Promise((v=>{let E=0;const q=()=>{const C=l();C?v(C):E++<m?setTimeout(q,250):v(null)};q()}))}waitForTranscriptSegments(){return this.pollFor((()=>{const l=this.getTranscriptContainer();return l&&l.children.length!==0&&l.querySelectorAll(d.segments).length>0?l:null}))}waitForTranscriptContainer(){return this.pollFor((()=>{const l=this.getTranscriptContainer();return l&&l.children.length>0?l:null}))}waitForElement(l){return this.pollFor((()=>this.document.querySelector(l)))}isMobileYoutube(){return!!this.document.querySelector("ytm-slim-video-metadata-section-renderer")}extractTranscriptFromOpenedDom(){return P(this,void 0,void 0,(function*(){try{if(!this.canOpenTranscriptPanel())return;if(this.isMobileYoutube())return this.openMobileTranscriptPanel();const l=this.document.querySelector("ytd-video-description-transcript-section-renderer button");if(!l)return;l.click();const m=yield this.waitForTranscriptContainer();if(!m)return;const v=this.getVideoId(),E=v?yield this.fetchChapters(v):this.getInlineChapters();return this.buildTranscriptFromContainer(m,E)}catch(l){return void console.error("YoutubeExtractor: failed to extract transcript from opened DOM",l)}}))}openMobileTranscriptPanel(){return P(this,void 0,void 0,(function*(){try{const l=this.document.querySelector('button[aria-label="Show more"]');l&&l.click();const m=yield this.waitForElement('button[aria-label="View all"]');if(!m)return;m.click();const v=yield this.waitForElement('button[aria-label="Timeline"]');if(!v)return;v.click();const E=yield this.waitForTranscriptSegments();return E?this.buildTranscriptFromContainer(E,[]):void 0}catch(l){return void console.error("YoutubeExtractor: failed to open mobile transcript panel",l)}}))}fetchPlayerData(l){return P(this,void 0,void 0,(function*(){try{const v={"Content-Type":"application/json"};this.options.language&&(v["Accept-Language"]=this.options.language);const E=yield this.fetch(f,{method:"POST",headers:v,signal:AbortSignal.timeout(c),body:JSON.stringify({context:g,videoId:l})});if(E.ok){const q=yield E.json();if(this.getCaptionTracks(q).length>0)return q}}catch{}try{const v={"Content-Type":"application/json","User-Agent":b};this.options.language&&(v["Accept-Language"]=this.options.language);const E=yield this.fetch(f,{method:"POST",headers:v,signal:AbortSignal.timeout(c),body:JSON.stringify({context:h,videoId:l})});if(E.ok){const q=yield E.json();if(this.getCaptionTracks(q).length>0)return q}}catch{}try{const v={"Content-Type":"application/json"};this.options.language&&(v["Accept-Language"]=this.options.language);const E=yield this.fetch(f,{method:"POST",headers:v,signal:AbortSignal.timeout(c),body:JSON.stringify({context:y,videoId:l})});if(E.ok){const q=yield E.json();if(this.getCaptionTracks(q).length>0)return q}}catch{}const m=this.parseInlineJson("ytInitialPlayerResponse");if(this.getCaptionTracks(m).length>0)return m}))}fetchChapters(l){return P(this,void 0,void 0,(function*(){const m=this.getInlineChapters();if(m.length>0)return m;try{const v={"Content-Type":"application/json"};this.options.language&&(v["Accept-Language"]=this.options.language);const E=yield this.fetch("https://www.youtube.com/youtubei/v1/next?prettyPrint=false",{method:"POST",headers:v,signal:AbortSignal.timeout(c),body:JSON.stringify({context:y,videoId:l})});if(!E.ok)return[];const q=yield E.json(),C=this.extractChaptersFromPlayerBar(q);return C.length>0?C:this.extractChaptersFromEngagementPanels(q)}catch{return[]}}))}extractChaptersFromPlayerBar(l){var m,v,E,q,C,N,O,T;const R=[],D=(N=(C=(q=(E=(v=(m=l?.playerOverlays)===null||m===void 0?void 0:m.playerOverlayRenderer)===null||v===void 0?void 0:v.decoratedPlayerBarRenderer)===null||E===void 0?void 0:E.decoratedPlayerBarRenderer)===null||q===void 0?void 0:q.playerBar)===null||C===void 0?void 0:C.multiMarkersPlayerBarRenderer)===null||N===void 0?void 0:N.markersMap;if(!Array.isArray(D))return R;for(const $ of D){const M=(O=$?.value)===null||O===void 0?void 0:O.chapters;if(Array.isArray(M))for(const W of M){const B=W?.chapterRenderer;if(!B)continue;const H=((T=B.title)===null||T===void 0?void 0:T.simpleText)||"",k=B.timeRangeStartMillis;H&&typeof k=="number"&&R.push({title:H,start:k/1e3})}}return R}extractChaptersFromEngagementPanels(l){var m,v,E,q;const C=[],N=l?.engagementPanels;if(!Array.isArray(N))return C;for(const O of N){const T=(m=O?.engagementPanelSectionListRenderer)===null||m===void 0?void 0:m.content,R=(v=T?.macroMarkersListRenderer)===null||v===void 0?void 0:v.contents;if(Array.isArray(R))for(const D of R){const $=D?.macroMarkersListItemRenderer;if(!$)continue;const M=((E=$.title)===null||E===void 0?void 0:E.simpleText)||"",W=((q=$.timeDescription)===null||q===void 0?void 0:q.simpleText)||"";if(!M||!W)continue;const B=this.parseTimestamp(W);B!==null&&C.push({title:M,start:B})}}return C}parseTimestamp(l){const m=l.split(":").map(Number);return m.some(isNaN)?null:m.length===3?3600*m[0]+60*m[1]+m[2]:m.length===2?60*m[0]+m[1]:null}parseTranscriptXml(l,m,v=[]){const E=[],q=/<p\s+t="(\d+)"[^>]*>([\s\S]*?)<\/p>/g;let C;for(;(C=q.exec(l))!==null;){const R=parseInt(C[1],10),D=C[2];let $="";const M=/<s[^>]*>([^<]*)<\/s>/g;let W;for(;(W=M.exec(D))!==null;)$+=W[1];$||($=D.replace(/<[^>]+>/g,"")),$=$.replace(/\n/g," ").replace(/\s{2,}/g," "),$=this.decodeEntities($),$.trim()&&E.push({start:R/1e3,text:$.trim()})}if(E.length===0){const R=/<text\s+start="([^"]*)"[^>]*>([\s\S]*?)<\/text>/g;for(;(C=R.exec(l))!==null;){const D=parseFloat(C[1]);let $=this.decodeEntities(C[2].replace(/<[^>]+>/g,"").replace(/\n/g," ").replace(/\s{2,}/g," "));$.trim()&&E.push({start:D,text:$.trim()})}}if(E.length===0)return;const N=this.groupTranscriptSegments(E),{html:O,text:T}=(0,S.buildTranscript)("youtube",N,v);return{html:O,text:T,languageCode:m}}decodeEntities(l){return l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&#x([0-9a-fA-F]+);/g,((m,v)=>String.fromCodePoint(parseInt(v,16)))).replace(/&#(\d+);/g,((m,v)=>String.fromCodePoint(parseInt(v,10))))}getVideoId(){if(this._videoId===void 0){const l=new URL(this.url);this._videoId=l.hostname==="youtu.be"?l.pathname.slice(1):l.pathname.includes("/shorts/")?l.pathname.split("/shorts/")[1].split("/")[0]:new URLSearchParams(l.search).get("v")||""}return this._videoId}groupTranscriptSegments(l){return l.length===0?[]:l.some((m=>e.test(m.text)))?this.groupBySpeaker(l):this.groupBySentence(l)}groupBySpeaker(l){const m=[];let v=null,E=-1,q="";for(const N of l){const O=e.test(N.text),T=N.text.replace(o,""),R=s.test(q),D=(t.test(q)||!q)&&!R;O&&D?(v&&m.push(v),E=(E+1)%2,v={start:N.start,segments:[{start:N.start,text:T}],speakerChange:!0,speaker:E}):(v||(v={start:N.start,segments:[],speakerChange:!1}),v.segments.push({start:N.start,text:T})),q=T}v&&m.push(v),this.splitAffirmativeTurns(m);const C=[];for(const N of m){const O=N.speaker===void 0?this.groupBySentence(N.segments):this.mergeSentenceGroupsWithinTurn(this.groupBySentence(N.segments));for(let T=0;T<O.length;T++)C.push(Object.assign(Object.assign({},O[T]),{speakerChange:T===0&&N.speakerChange,speaker:N.speaker}))}return C}splitAffirmativeTurns(l){const m=/^(mhm|yeah|yes|yep|right|okay|ok|absolutely|sure|exactly|uh-huh|mm-hmm)[.!,]?\s+/i;for(let v=0;v<l.length;v++){const E=l[v];if(E.speaker===void 0||E.segments.length===0)continue;const q=E.segments[0],C=m.exec(q.text);if(!C||/,\s*$/.test(C[0]))continue;const N=q.text.slice(C[0].length).trim(),O=E.segments.slice(1);if((0,A.countWords)(N)+O.reduce(((M,W)=>M+(0,A.countWords)(W.text)),0)<30)continue;const T=C[0].trimEnd(),R=N?[{start:q.start,text:N},...O]:O,D={start:E.start,segments:[{start:q.start,text:T}],speakerChange:E.speakerChange,speaker:E.speaker},$={start:R[0].start,segments:R,speakerChange:!0,speaker:E.speaker===0?1:0};l.splice(v,1,D,$),v++}}mergeSentenceGroupsWithinTurn(l){if(l.length<=1)return l;const m=[];let v=Object.assign({},l[0]),E=!0;for(let q=1;q<l.length;q++){const C=l[q];this.shouldMergeSentenceGroups(v,C,E)?v.text=`${v.text} ${C.text}`:(m.push(v),v=Object.assign({},C),E=!1)}return m.push(v),m}shouldMergeSentenceGroups(l,m,v){const E=(0,A.countWords)(l.text),q=(0,A.countWords)(m.text);return!this.isShortStandaloneUtterance(l.text,E)&&!this.isShortStandaloneUtterance(m.text,q)&&!(v&&E<8)&&!r.test(l.text)&&!r.test(m.text)&&!(E+q>80)&&!(m.start-l.start>45)}isShortStandaloneUtterance(l,m){const v=m??(0,A.countWords)(l);return v>0&&v<=3&&t.test(l)}groupBySentence(l){const m=[],v=[],E=N=>{const O=N.map((T=>T.text)).join(" ").trim();O&&m.push({start:N[0].start,text:O,speakerChange:!1})},q=()=>{v.length!==0&&(E(v),v.length=0)};for(const N of l)if(v.length>0&&N.start-v[v.length-1].start>20&&q(),v.push(N),t.test(N.text))q();else if(N.start-v[0].start>=30){const O=this.findNaturalBreak(v);O>0&&O<v.length?(C=O)<=0||E(v.splice(0,C)):q()}var C;return q(),m}findNaturalBreak(l){var m,v;if(l.length<=1)return-1;const E=l[0].start+15;for(let N=l.length-1;N>=0&&!(l[N].start<E);N--){const O=l[N].text.match(i);if(O){const T=(m=O[1])!==null&&m!==void 0?m:O[3],R=(v=O[2])!==null&&v!==void 0?v:O[4],D=l[N].start;return l.splice(N,1,{start:D,text:T},{start:D,text:R}),N+1}}let q=-1,C=0;for(let N=1;N<l.length;N++){if(l[N].start<E)continue;const O=l[N].start-l[N-1].start;O>=C&&(C=O,q=N)}return q}}w.YoutubeExtractor=p},1608(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.MetadataExtractor=void 0;const P=I(2552);class L{static extract(A,S,n){var t,r;let e="",o="";try{if(o=((t=A.location)===null||t===void 0?void 0:t.href)||"",o||(o=this.getMetaContent(n,"property","og:url")||this.getMetaContent(n,"property","twitter:url")||this.getSchemaProperty(S,"url")||this.getSchemaProperty(S,"mainEntityOfPage.url")||this.getSchemaProperty(S,"mainEntity.url")||this.getSchemaProperty(S,"WebSite.url")||((r=A.querySelector('link[rel="canonical"]'))===null||r===void 0?void 0:r.getAttribute("href"))||""),o)try{e=new URL(o).hostname.replace(/^www\./,"")}catch(b){console.warn("Failed to parse URL:",b)}}catch{const g=A.querySelector("base[href]");if(g)try{o=g.getAttribute("href")||"",e=new URL(o).hostname.replace(/^www\./,"")}catch(y){console.warn("Failed to parse base URL:",y)}}const s=this.getSiteName(S,n),{title:i,detectedSiteName:c}=this.cleanTitle(this.getBestTitle(A,S,n,e,s),s),f=this.getAuthor(A,S,n),u=f&&!f.includes(",")?f:"",h=s||c||u||e||"";return{title:i,description:this.getDescription(A,S,n),domain:e,favicon:this.getFavicon(A,o,n),image:this.getImage(A,S,n),language:this.getLanguage(A,S,n),published:this.getPublished(A,S,n,o),author:f,site:h,schemaOrgData:S,wordCount:0,parseTime:0}}static isPlaceholderValue(A){return!(!/[{}]/.test(A)&&!/^#[a-zA-Z]/.test(A))||!/[\p{L}\p{N}]/u.test(A)}static firstValid(A){for(const S of A){const n=S();if(n&&!this.isPlaceholderValue(n))return n}return""}static getAuthor(A,S,n){var t,r,e;let o;if(o=this.firstValid([()=>this.getMetaContent(n,"name","sailthru.author"),()=>this.getMetaContent(n,"property","article:author"),()=>this.getMetaContent(n,"property","author"),()=>this.getMetaContent(n,"name","author"),()=>this.getMetaContent(n,"name","byl"),()=>this.getMetaContent(n,"name","authorList")]),o){const g=this.cleanAuthorString(o);if(g)return g}let s=this.getMetaContents(n,"name","citation_author").filter((g=>!this.isPlaceholderValue(g)));if(s.length===0&&(s=this.getMetaContents(n,"property","dc.creator").filter((g=>!this.isPlaceholderValue(g)))),s.length>0)return o=s.map((g=>{if(!g.includes(","))return g.trim();const y=/(.*),\s(.*)/.exec(g);return y&&y.length===3?`${y[2]} ${y[1]}`:g.trim()})).join(", "),o;let i=this.getSchemaProperty(S,"author.name")||this.getSchemaProperty(S,"author.[].name");if(i){const g=i.split(",").map((y=>y.trim().replace(/,$/,"").trim())).filter((y=>y&&!this.isPlaceholderValue(y)));if(g.length>0){let y=[...new Set(g)];return y.length>10&&(y=y.slice(0,10)),y.join(", ")}}const c=A.querySelectorAll('a[rel~="author"], address[rel~="author"]');if(c.length>0&&c.length<=3){const g=[];c.forEach((a=>{const d=this.getVisibleText(a),p=d.toLowerCase();d&&d.length<100&&p!=="author"&&p!=="authors"&&!this.isPlaceholderValue(d)&&g.push(d)}));const y=[...new Set(g)];if(y.length>0)return y.join(", ")}const f=[],u=g=>{g&&g.split(",").forEach((y=>{const a=y.replace(/\s+/g," ").trim().replace(/,$/,"").trim(),d=a.toLowerCase();a&&d!=="author"&&d!=="authors"&&!this.isPlaceholderValue(a)&&f.push(a)}))},h=[{selector:'[itemprop="author"]'},{selector:".author",maxMatches:3},{selector:'[href*="/author/"]',maxMatches:3},{selector:".authors a",maxMatches:3}];for(const{selector:g,maxMatches:y}of h){const a=A.querySelectorAll(g);y&&a.length>y||a.forEach((d=>u(this.getAuthorName(d))))}if(f.length>0){let g=[...new Set(f.map((y=>y.trim())).filter(Boolean))];if(g.length>1&&(g=g.filter((y=>!g.some((a=>a!==y&&y.includes(a)))))),g.length>0)return g.length>10&&(g=g.slice(0,10)),g.join(", ")}const b=A.querySelector("h1");if(b){let g=b.nextElementSibling;for(let a=0;a<3&&g;a++){const d=((t=g.textContent)===null||t===void 0?void 0:t.trim())||"",p=Array.from(g.querySelectorAll("p, time")),x=p.some((l=>{var m;return!!this.parseDateText(((m=l.textContent)===null||m===void 0?void 0:m.trim())||"")}));if(this.parseDateText(d)||x){const l=g.querySelectorAll("a");if(l.length===1){const m=(((r=l[0].textContent)===null||r===void 0?void 0:r.trim())||"").replace(/\u00a0/g," ");if(m.length>0&&m.length<100&&!this.parseDateText(m))return m}if(x&&d.length<300)for(const m of p){if(m.tagName!=="P")continue;const v=(((e=m.textContent)===null||e===void 0?void 0:e.trim())||"").replace(/\u00a0/g," ");if(v.length>0&&v.length<150&&!this.parseDateText(v))return v}}g=g.nextElementSibling}let y=b;for(let a=0;a<3&&y;a++){let d=y.previousElementSibling;for(let p=0;p<3&&d;p++){const x=this.extractByline(d);if(x)return x;d=d.previousElementSibling}d=y.nextElementSibling;for(let p=0;p<3&&d;p++){const x=this.extractByline(d);if(x)return x;d=d.nextElementSibling}y=y.parentElement}}return""}static extractByline(A){var S;const n=[A,...A.querySelectorAll("p, span, address")];for(const t of n){const r=(((S=t.textContent)===null||S===void 0?void 0:S.trim())||"").replace(/\u00a0/g," ");if(r.length>0&&r.length<50){const e=r.match(/^By\s+([A-Z].+)$/i);if(e)return e[1].trim()}}return null}static cleanAuthorString(A){return(A=(A=(A=(A=A.replace(/^by\s+/i,"")).replace(/\(?\s*https?:\/\/\S+\s*\)?/gi,"")).replace(/,?\s+and\s+/gi,", ")).replace(/\s*[-\u2013\u2014|]\s*$/g,"")).trim()}static getSiteName(A,S){const n=this.firstValid([()=>this.getSchemaProperty(A,"publisher.name"),()=>this.getMetaContent(S,"property","og:site_name"),()=>this.getMetaContent(S,"name","og:site_name"),()=>this.getSchemaProperty(A,"WebSite.name"),()=>this.getSchemaProperty(A,"sourceOrganization.name"),()=>this.getMetaContent(S,"name","copyright"),()=>this.getSchemaProperty(A,"copyrightHolder.name"),()=>this.getSchemaProperty(A,"isPartOf.name"),()=>this.getMetaContent(S,"name","application-name")]);return n&&(0,P.countWords)(n)>6?"":n}static getBestTitle(A,S,n,t,r){var e,o,s,i,c;const f=[this.getMetaContent(n,"property","og:title"),this.getMetaContent(n,"name","twitter:title"),this.getSchemaProperty(S,"headline"),this.getMetaContent(n,"name","title"),this.getMetaContent(n,"name","sailthru.title"),((o=(e=A.querySelector("title"))===null||e===void 0?void 0:e.textContent)===null||o===void 0?void 0:o.trim())||"",((i=(s=A.querySelector("h1"))===null||s===void 0?void 0:s.textContent)===null||i===void 0?void 0:i.trim())||""].filter((g=>g&&!this.isPlaceholderValue(g)));if(f.length===0)return"";const u=(this.getMetaContent(n,"property","author")||this.getMetaContent(n,"name","author")).trim().toLowerCase(),h=r.trim().toLowerCase(),b=t?t.replace(/\.[^.]+$/,"").toLowerCase().replace(/[^a-z0-9]/g,""):"";return(c=f.find((g=>!this.isSiteIdentifier(g,u,h,b))))!==null&&c!==void 0?c:f[0]}static isSiteIdentifier(A,S,n,t){const r=A.trim().toLowerCase();return!!(S&&r===S||n&&r===n||t&&r.replace(/[^a-z0-9]/g,"")===t)}static cleanTitle(A,S){if(!A)return{title:A,detectedSiteName:""};const n="[|\\-–—/·]";if(S&&S.toLowerCase()!==A.toLowerCase()&&(0,P.countWords)(S)<=6){const e=S.toLowerCase(),o=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=[`\\s*${n}\\s*${o}\\s*$`,`^\\s*${o}\\s*${n}\\s*`];for(const u of s){const h=new RegExp(u,"i");if(h.test(A))return{title:A.replace(h,"").trim(),detectedSiteName:S}}const i=new RegExp(`\\s+${n}\\s+`,"g");let c;const f=[];for(;(c=i.exec(A))!==null;)f.push({index:c.index,length:c[0].length});if(f.length>0){const u=f[f.length-1],h=A.substring(u.index+u.length).trim().toLowerCase();if(h&&e.includes(h)){let y=u.index;for(let a=f.length-2;a>=0;a--){const d=f[a],p=A.substring(d.index+d.length,y).trim();if((0,P.countWords)(p)>3)break;y=d.index}return{title:A.substring(0,y).trim(),detectedSiteName:S}}const b=f[0],g=A.substring(0,b.index).trim().toLowerCase();if(g&&e.includes(g)){let y=b.index+b.length;for(let a=1;a<f.length;a++){const d=f[a],p=A.substring(y,d.index).trim();if((0,P.countWords)(p)>3)break;y=d.index+d.length}return{title:A.substring(y).trim(),detectedSiteName:S}}}}const t=this.trySeparatorSplit(A,/\s+([|/\xb7])\s+/g,{guard:(e,o)=>o<=3&&e>=2&&e>=2*o});return t||this.trySeparatorSplit(A,/\s+[-\u2013\u2014]\s+/g,{suffixOnly:!0,guard:(e,o)=>o<=2&&e>=2&&e>o})||{title:A.trim(),detectedSiteName:""}}static trySeparatorSplit(A,S,n){let t;const r=[];for(;(t=S.exec(A))!==null;)r.push({index:t.index,length:t[0].length});if(r.length===0)return null;const e=r[r.length-1],o=A.substring(0,e.index).trim(),s=A.substring(e.index+e.length).trim();if(n.guard((0,P.countWords)(o),(0,P.countWords)(s)))return{title:o,detectedSiteName:s};if(!n.suffixOnly){const i=r[0],c=A.substring(0,i.index).trim(),f=A.substring(i.index+i.length).trim();if(n.guard((0,P.countWords)(f),(0,P.countWords)(c)))return{title:f,detectedSiteName:c}}return null}static getDescription(A,S,n){return this.firstValid([()=>this.getMetaContent(n,"name","description"),()=>this.getMetaContent(n,"property","description"),()=>this.getMetaContent(n,"property","og:description"),()=>this.getSchemaProperty(S,"description"),()=>this.getMetaContent(n,"name","twitter:description"),()=>this.getMetaContent(n,"name","sailthru.description")])}static getImage(A,S,n){return this.getMetaContent(n,"property","og:image")||this.getMetaContent(n,"name","twitter:image")||this.getSchemaProperty(S,"image.url")||this.getMetaContent(n,"name","sailthru.image.full")||""}static getLanguage(A,S,n){var t,r,e,o;const s=(r=(t=A.documentElement)===null||t===void 0?void 0:t.getAttribute("lang"))===null||r===void 0?void 0:r.trim();if(s)return this.normalizeLangCode(s);const i=this.getMetaContent(n,"name","content-language")||this.getMetaContent(n,"property","og:locale");if(i)return this.normalizeLangCode(i);const c=(o=(e=A.querySelector('meta[http-equiv="Content-Language" i]'))===null||e===void 0?void 0:e.getAttribute("content"))===null||o===void 0?void 0:o.trim();if(c)return this.normalizeLangCode(c);const f=this.getSchemaProperty(S,"inLanguage");return f?this.normalizeLangCode(f):""}static normalizeLangCode(A){return A.replace(/_/g,"-")}static getFavicon(A,S,n){var t,r;const e=this.getMetaContent(n,"property","og:image:favicon");if(e)return e;const o=(t=A.querySelector("link[rel='icon']"))===null||t===void 0?void 0:t.getAttribute("href");if(o)return o;const s=(r=A.querySelector("link[rel='shortcut icon']"))===null||r===void 0?void 0:r.getAttribute("href");if(s)return s;if(S&&/^https?:\/\//.test(S))try{return new URL("/favicon.ico",S).href}catch{}return""}static getPublished(A,S,n,t){const r=this.firstValid([()=>this.getSchemaProperty(S,"datePublished"),()=>this.getMetaContent(n,"name","publishDate"),()=>this.getMetaContent(n,"property","article:published_time"),()=>{var o,s;return((s=(o=A.querySelector('abbr[itemprop="datePublished"]'))===null||o===void 0?void 0:o.title)===null||s===void 0?void 0:s.trim())||""},()=>this.getTimeElement(A,t),()=>this.getMetaContent(n,"name","sailthru.date")]);if(r)return r;const e=A.querySelector("h1");if(e){const o=(i,c,f)=>{var u,h;let b=i;for(let g=0;g<3&&b;g++){for(const y of Array.from(b.querySelectorAll("p, time"))){const a=this.parseDateText(((u=y.textContent)===null||u===void 0?void 0:u.trim())||"");if(a)return a}if(!f){const y=this.parseDateText(((h=b.textContent)===null||h===void 0?void 0:h.trim())||"");if(y)return y}b=c(b)}return""},s=this.firstValid([()=>o(e.nextElementSibling,(i=>i.nextElementSibling),!1),()=>o(e.previousElementSibling,(i=>i.previousElementSibling),!0)]);if(s)return s}return""}static getMetaContent(A,S,n){var t;return(t=this.getMetaContents(A,S,n)[0])!==null&&t!==void 0?t:""}static getMetaContents(A,S,n){return A.filter((t=>{const r=S==="name"?t.name:t.property;return r?.toLowerCase()===n.toLowerCase()})).map((t=>{var r,e;return(e=(r=t.content)===null||r===void 0?void 0:r.trim())!==null&&e!==void 0?e:""}))}static getTimeElement(A,S){var n,t;for(const r of Array.from(A.querySelectorAll("time"))){if(this.isLinkedToOtherPage(r,S))continue;const e=((n=r.getAttribute("datetime"))===null||n===void 0?void 0:n.trim())||((t=r.textContent)===null||t===void 0?void 0:t.trim())||"";if(e)return e}return""}static isLinkedToOtherPage(A,S){var n;if(!S)return!1;const t=A.closest("a[href]");if(!t)return!1;const r=((n=t.getAttribute("href"))===null||n===void 0?void 0:n.trim())||"";if(!r||r.startsWith("#"))return!1;try{const e=new URL(r,S),o=new URL(S);if(e.origin!==o.origin)return!1;const s=i=>i.replace(/\/+$/,"");return s(e.pathname)!==s(o.pathname)}catch{return!1}}static parseDateText(A){let S=A.match(/\b(\d{1,2})\s+(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{4})\b/i);if(S){const n=S[1].padStart(2,"0"),t=this.MONTH_MAP[S[2].toLowerCase()];return`${S[3]}-${t}-${n}T00:00:00+00:00`}if(S=A.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i),S){const n=this.MONTH_MAP[S[1].toLowerCase()],t=S[2].padStart(2,"0");return`${S[3]}-${n}-${t}T00:00:00+00:00`}return""}static getVisibleText(A){const S=A.cloneNode(!0);return S.querySelectorAll("script, style, noscript").forEach((n=>n.remove())),(S.textContent||"").replace(/\s+/g," ").trim()}static getAuthorName(A){const S=A.cloneNode(!0);S.querySelectorAll("script, style, noscript").forEach((t=>t.remove()));const n=(S.textContent||"").replace(/\s+/g," ").trim();if(!n)return"";for(const t of S.querySelectorAll("span, a, p")){const r=(t.textContent||"").replace(/\s+/g," ").trim();if(r.length>=2&&r.length<=50&&r!==n)return r}return n.length<=100?n:""}static getSchemaProperty(A,S,n=""){if(!A)return n;const t=(r,e,o,s=!0)=>{if(typeof r=="string")return e.length===0?[r]:[];if(!r||typeof r!="object")return[];if(Array.isArray(r)){const f=e[0];if(/^\[\d+\]$/.test(f)){const u=parseInt(f.slice(1,-1));return r[u]?t(r[u],e.slice(1),o,s):[]}return e.length===0&&r.every((u=>typeof u=="string"||typeof u=="number"))?r.map(String):r.flatMap((u=>t(u,e,o,s)))}const[i,...c]=e;if(!i)return typeof r=="string"?[r]:typeof r=="object"&&r.name?[r.name]:[];if(r.hasOwnProperty(i))return t(r[i],c,o?`${o}.${i}`:i,!0);if(!s){const f=[];for(const u in r)if(typeof r[u]=="object"){const h=t(r[u],e,o?`${o}.${u}`:u,!1);f.push(...h)}if(f.length>0)return f}return[]};try{let r=t(A,S.split("."),"",!0);r.length===0&&(r=t(A,S.split("."),"",!1));const e=[...new Set(r.filter(Boolean))];return e.length>0?e.join(", "):n}catch(r){return console.error(`Error in getSchemaProperty for ${S}:`,r),n}}}w.MetadataExtractor=L,L.MONTH_MAP={january:"01",february:"02",march:"03",april:"04",may:"05",june:"06",july:"07",august:"08",september:"09",october:"10",november:"11",december:"12"}},3172(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.removeEyebrowLabel=function($,M,W){var B;const H=$.querySelector("h1")||$.querySelector("h2");if(!H)return;let k=H;for(;k.parentElement&&k.parentElement!==$&&!k.previousElementSibling;)k=k.parentElement;const F=k.previousElementSibling;if(!F)return;const z=((B=F.textContent)===null||B===void 0?void 0:B.trim())||"",Y=(0,L.countWords)(z);Y<1||Y>6||z.length>40||/[.!?]/.test(z)||A.test(z)||F.querySelector("img, picture, video, iframe, figure, table, pre, code, time, [datetime], h1, h2, h3, h4, h5, h6, ul, ol, blockquote")||(M&&W&&W.push({step:"removeEyebrowLabel",reason:"eyebrow label",text:(0,L.textPreview)(F)}),F.remove())},w.removeByContentPattern=function($,M,W,B,H,k){var F,z,Y,ot,U,Q,K,V,X,Z,et,rt,ut,ht,dt,pt,ft,Ct,St,Et,Pt,At,Mt,gt,Nt,kt,Ht,jt,Wt,Ft,zt,Ut,Vt;const Kt=(0,_.findContentStart)($,B),_t=j=>(0,_.isAboveContentStart)(j,Kt),ie=(0,L.normalizeText)(B),se=(0,L.normalizeText)(H),Jt=$.querySelector("ul, ol");if(Jt&&(function(j){const J=j.querySelectorAll("li");if(J.length<2||J.length>8)return!1;const G=Array.from(j.querySelectorAll("a"));if(G.length<1||G.length>=J.length||j.querySelector("img, p, figure, blockquote"))return!1;for(const lt of J)if((0,L.countWords)(lt.textContent||"")>8)return!1;let st=!0,it=!1,nt=!0;for(const lt of G){const tt=lt.getAttribute("href")||"";if(tt.startsWith("http")||tt.startsWith("//")){st=!1;break}(tt==="/"||/^\/[a-zA-Z0-9_-]+\/?$/.test(tt))&&(it=!0),(lt.textContent||"").trim().split(/\s+/).filter(Boolean).length>5&&(nt=!1)}return st&&it&&nt})(Jt)){let j=Jt;for(;j.parentElement&&j.parentElement!==$&&j.parentElement.children.length===1;)j=j.parentElement;M&&k&&k.push({step:"removeByContentPattern",reason:"breadcrumb navigation list",text:(0,L.textPreview)(j)}),j.remove()}const Xt=$.querySelector("h1");if(Xt)for(const j of $.querySelectorAll("a[href]")){if(!j.parentNode||!(4&j.compareDocumentPosition(Xt))||!j.querySelector("div")||j.querySelector("img, picture, video"))continue;const J=((F=j.textContent)===null||F===void 0?void 0:F.trim())||"";(0,L.countWords)(J)>25||/[.!?]\s/.test(J)||(M&&k&&k.push({step:"removeByContentPattern",reason:"promotional banner link",text:(0,L.textPreview)(j)}),j.remove())}(function(j,J,G,st){var it;const nt=j.querySelectorAll("time");if(nt.length!==0)for(const lt of nt){if(!(0,_.isAboveContentStart)(lt,J))continue;let tt=null,ct=lt.parentElement;for(;ct&&ct!==j;){if(ct.querySelector("h1, h2")&&ct.querySelector("time")){const mt=((it=ct.textContent)===null||it===void 0?void 0:it.trim())||"",vt=(0,L.countWords)(mt),yt=new Set;for(const Rt of ct.querySelectorAll("h1, h2, h3, time, [aria-label]")){let re=!1;for(const he of yt)if(he.contains(Rt)){re=!0;break}re||yt.add(Rt)}let Gt=0;for(const Rt of yt)Gt+=(0,L.countWords)(Rt.textContent||"");if(!(vt-Gt<30))break;tt=ct}ct=ct.parentElement}if(tt)return G&&st&&st.push({step:"removeByContentPattern",reason:"hero header block",text:(0,L.textPreview)(tt)}),void tt.remove()}})($,Kt,M,k);for(const j of $.querySelectorAll("audio, video")){if(!j.parentNode||!j.getAttribute("src")&&!j.querySelector("source"))continue;let J=j;for(;J.parentElement&&J.parentElement!==$&&!((0,L.countWords)(((z=J.parentElement.textContent)===null||z===void 0?void 0:z.trim())||"")>25);)J=J.parentElement;const G=((Y=J.textContent)===null||Y===void 0?void 0:Y.trim())||"",st=/\blisten\s+to\s+(?:this\s+)?(?:article|story|post|episode|podcast)\b/i.test(G),it=!st&&_t(J)&&(0,L.countWords)(G)<=25;(st||it)&&(M&&k&&k.push({step:"removeByContentPattern",reason:"audio player widget",text:(0,L.textPreview)(J)}),J.remove())}const bt=$.textContent||"";let Lt=null;try{Lt=new URL(W)}catch{}for(const j of $.querySelectorAll("ul, ol")){if(!j.parentNode||j.closest("#footnotes"))continue;const J=((ot=j.textContent)===null||ot===void 0?void 0:ot.trim())||"",G=bt.indexOf(J.substring(0,60));if(G<0||G>.3*bt.length)continue;const st=Array.from(j.querySelectorAll("a[href]"));if(st.length<3||j.querySelector(P.CONTENT_ELEMENT_SELECTOR))continue;let it=0;for(const mt of st){const vt=mt.getAttribute("href")||"";if(vt.startsWith("#"))it++;else if(Lt&&vt.includes("#"))try{const yt=new URL(vt,W);yt.pathname===Lt.pathname&&yt.hostname===Lt.hostname&&it++}catch{}}if(it<3||it/st.length<.8)continue;let nt=j;for(;nt.parentElement&&nt.parentElement!==$&&nt.parentElement.children.length===1;)nt=nt.parentElement;const lt=nt.previousElementSibling;if(lt&&a.test(lt.tagName)){const mt=((U=lt.textContent)===null||U===void 0?void 0:U.trim())||"";/^(?:table of )?contents$|^on this page$|^in this (?:article|guide|post)$/i.test(mt)&&(M&&k&&k.push({step:"removeByContentPattern",reason:"table of contents heading",text:(0,L.textPreview)(lt)}),lt.remove())}const tt=nt.previousElementSibling,ct=nt.nextElementSibling;M&&k&&k.push({step:"removeByContentPattern",reason:"table of contents",text:(0,L.textPreview)(nt)}),nt.remove(),tt?.tagName==="HR"&&tt.remove(),ct?.tagName==="HR"&&ct.remove();break}const ae=Array.from($.querySelectorAll("p, span, div, time"));let Yt=!1,Qt=!1;for(const j of ae){if(!j.parentNode)continue;const J=((Q=j.textContent)===null||Q===void 0?void 0:Q.trim())||"",G=(0,L.countWords)(J);if(G>15||G===0||j.closest("pre, code"))continue;const st=j.tagName,it=A.test(J);let nt=-2;const lt=()=>(nt===-2&&(nt=bt.indexOf(J)),nt);if(c.test(J)&<()<=300){let tt=j;tt.parentElement&&tt.parentElement!==$&&(tt=tt.parentElement),M&&k&&k.push({step:"removeByContentPattern",reason:"timezone widget",text:(0,L.textPreview)(tt)}),tt.remove()}else if(G===1&&f.test(J))M&&k&&k.push({step:"removeByContentPattern",reason:"pinned label",text:(0,L.textPreview)(j)}),j.remove();else{for(const[tt,ct]of[[ie,"duplicate title"],[se,"duplicate description"]])if(tt&&G>=3&&_t(j)&&(0,L.normalizeText)(J)===tt){M&&k&&k.push({step:"removeByContentPattern",reason:ct,text:(0,L.textPreview)(j)}),j.remove();break}if(j.parentNode)if((st==="DIV"||st==="P")&&G>=1&&G<=10&&(it||S.test(J))&&!e.test(J)&&!/[.!?]/.test(J)&&_t(j)&&!Array.from(j.querySelectorAll("p, h1, h2, h3, h4, h5, h6")).some((tt=>(0,L.countWords)(tt.textContent||"")>8)))M&&k&&k.push({step:"removeByContentPattern",reason:"article metadata header block",text:(0,L.textPreview)(j)}),j.remove();else{if(st==="DIV"&&G>=1&&G<=5&&!/[.!?]/.test(J)&&_t(j)&&j.querySelector("img")){const tt=j.querySelectorAll("a[href]");if(tt.length>0){let ct=0;for(const mt of tt)ct+=(((K=mt.textContent)===null||K===void 0?void 0:K.trim())||"").length;if(ct/(J.length||1)>=.8){M&&k&&k.push({step:"removeByContentPattern",reason:"category badge",text:(0,L.textPreview)(j)}),j.remove();continue}}}if(!Yt&&r.test(J)&&G>=2&&!/[.!?]$/.test(J)&&_t(j)){const tt=N(j,J,$);M&&k&&k.push({step:"removeByContentPattern",reason:"author byline",text:(0,L.textPreview)(tt)}),tt.remove(),Yt=!0}else{if(n.test(J)&&(it?j.querySelectorAll("p, div, section, article").length===0:G<=5&&_t(j))){let tt=J;for(const ct of E)tt=tt.replace(ct,"");if(tt.trim().length===0){const ct=it?j:N(j,J,$);M&&k&&k.push({step:"removeByContentPattern",reason:"read time metadata",text:(0,L.textPreview)(ct)}),ct.remove();continue}}if(!Qt&&G>=2&&G<=10&&it&&!e.test(J)&&_t(j)){let tt=J;for(const ct of q)tt=tt.replace(ct,"");if(tt=tt.trim(),tt){const ct=tt.split(/\s+/).filter((mt=>mt.length>0));if(ct.length>=1&&ct.length<=4&&ct.every((mt=>t.test(mt)))){const mt=N(j,J,$);M&&k&&k.push({step:"removeByContentPattern",reason:"author date metadata",text:(0,L.textPreview)(mt)}),mt.remove(),Qt=!0;continue}}}if(it&&G<=5&&_t(j)){let tt=J;for(const ct of v)tt=tt.replace(ct,"");if(tt=tt.replace(/[,\s/\-]+/g,"").trim(),tt.length===0){const ct=N(j,J,$);M&&k&&k.push({step:"removeByContentPattern",reason:"standalone date metadata",text:(0,L.textPreview)(ct)}),ct.remove();continue}}}}}}const le=Array.from($.querySelectorAll("time"));for(const j of le){if(!j.parentNode)continue;let J=j,G=((V=J.textContent)===null||V===void 0?void 0:V.trim())||"";for(;J.parentElement&&J.parentElement!==$;){const lt=J.parentElement.tagName.toLowerCase(),tt=((X=J.parentElement.textContent)===null||X===void 0?void 0:X.trim())||"";if(lt==="p"&&tt===G){J=J.parentElement;break}if(!["i","em","span","b","strong","small"].includes(lt)||tt!==G)break;J=J.parentElement,G=tt}const st=((Z=J.textContent)===null||Z===void 0?void 0:Z.trim())||"";if((0,L.countWords)(st)>10)continue;const it=bt.indexOf(st),nt=bt.length-(it+st.length);it>200&&nt>200||(M&&k&&k.push({step:"removeByContentPattern",reason:"boundary date element",text:(0,L.textPreview)(J)}),J.remove())}const ce=$.querySelectorAll("ul, ol, dl");for(const j of ce){if(!j.parentNode||j.closest("#footnotes"))continue;const J=j.tagName==="DL",G=Array.from(j.children).filter((vt=>J?vt.tagName==="DD":vt.tagName==="LI")),st=J?1:2;if(G.length<st||G.length>8)continue;const it=((et=j.textContent)===null||et===void 0?void 0:et.trim())||"",nt=bt.indexOf(it),lt=bt.length-(nt+it.length);if(nt>500&<>500)continue;const tt=j.previousElementSibling;if(tt&&(d(tt)||(((rt=tt.textContent)===null||rt===void 0?void 0:rt.trim())||"").endsWith(":")))continue;let ct=!0;for(const vt of G){const yt=((ut=vt.textContent)===null||ut===void 0?void 0:ut.trim())||"";if((0,L.countWords)(yt)>8){ct=!1;break}if(/[.!?]$/.test(yt)){ct=!1;break}}if(!ct||(0,L.countWords)(it)>30)continue;const mt=N(j,it,$);M&&k&&k.push({step:"removeByContentPattern",reason:"blog metadata list",text:(0,L.textPreview)(mt)}),mt.remove()}const It=Lt?.pathname||"",Zt=Lt?.hostname.replace(/^www\./,"")||"";if(It){const j=$.querySelectorAll("div, span, p, a[href]"),J=$.querySelector("h1, h2, h3");for(const G of j){if(!G.parentNode)continue;const st=((ht=G.textContent)===null||ht===void 0?void 0:ht.trim())||"";if((0,L.countWords)(st)>10||G.querySelectorAll("p, div, section, article").length>0||G.matches("a[href]")&&G.parentElement&&G.parentElement!==$&&(((dt=G.parentElement.textContent)===null||dt===void 0?void 0:dt.trim())||"")!==st&&(G.closest("p")||!J||!(4&G.compareDocumentPosition(J))))continue;const it=G.matches("a[href]")?G:G.querySelector("a[href]");if(it)try{const nt=new URL(it.getAttribute("href")||"",W).pathname,lt=nt.replace(/\/[^/]*$/,"/"),tt=/^index\.(html?|php)$/i.test(nt.split("/").pop()||"")&&It.startsWith(lt);nt!=="/"&&nt!==It&&(It.startsWith(nt)||tt)&&(M&&k&&k.push({step:"removeByContentPattern",reason:"section breadcrumb",text:(0,L.textPreview)(G)}),G.remove())}catch{}}}if(Zt){const j=$.querySelectorAll("h2, h3, h4, h5, h6");for(const J of j){if(!J.parentNode)continue;const G=J.nextElementSibling;if(!G||G.tagName!=="UL"&&G.tagName!=="OL")continue;const st=Array.from(G.children).filter((tt=>tt.tagName==="LI"));if(st.length<2)continue;let it=!1,nt=G;for(;nt&&nt!==$;){let tt=nt.nextElementSibling;for(;tt;){if((((pt=tt.textContent)===null||pt===void 0?void 0:pt.trim())||"").length>0){it=!0;break}tt=tt.nextElementSibling}if(it)break;nt=nt.parentElement}if(it)continue;let lt=!0;for(const tt of st){const ct=tt.querySelectorAll("a[href]");if(ct.length===0){lt=!1;break}const mt=((ft=tt.textContent)===null||ft===void 0?void 0:ft.trim())||"";let vt=0;for(const yt of ct){vt+=(((Ct=yt.textContent)===null||Ct===void 0?void 0:Ct.trim())||"").length;try{if(new URL(yt.getAttribute("href")||"",W).hostname.replace(/^www\./,"")===Zt){lt=!1;break}}catch{}}if(!lt)break;if(vt<.6*mt.length){lt=!1;break}}lt&&(M&&k&&(k.push({step:"removeByContentPattern",reason:"trailing external link list",text:(0,L.textPreview)(J)}),k.push({step:"removeByContentPattern",reason:"trailing external link list",text:(0,L.textPreview)(G)})),G.remove(),J.remove())}}let wt=$.lastElementChild;for(;wt&&["HR","BR"].includes(wt.tagName);)wt=wt.previousElementSibling;if(wt&&["SECTION","DIV","ASIDE"].includes(wt.tagName)){const j=[];let J=!1;for(const G of wt.children)if(!((St=G.textContent)===null||St===void 0)&&St.trim()){if(G.tagName==="P")j.push(G);else if(G.tagName!=="BR"){J=!0;break}}j.length>=2&&!J&&j.every((st=>{var it,nt,lt;const tt=(((it=st.textContent)===null||it===void 0?void 0:it.trim())||"").replace(/\s+/g," "),ct=st.querySelectorAll("a[href]");if(ct.length===0)return!1;let mt=0;for(const yt of ct)mt+=(((nt=yt.textContent)===null||nt===void 0?void 0:nt.trim())||"").length;if(mt/(tt.length||1)<=.6)return!1;let vt=tt;for(const yt of ct)vt=vt.split(((lt=yt.textContent)===null||lt===void 0?void 0:lt.trim())||"").join("");return!/[.!?]/.test(vt)}))&&(M&&k&&k.push({step:"removeByContentPattern",reason:"trailing related posts block",text:(0,L.textPreview)(wt)}),wt.remove())}const te=(0,L.countWords)($.textContent||"");if(te>300){const j=[];let J=0,G=$.lastElementChild;for(;G;){if(G.id==="footnotes"){G=G.previousElementSibling;continue}if(G.tagName==="HR"){j.push(G);break}let st=0;for(const nt of G.querySelectorAll("svg"))st+=(0,L.countWords)(nt.textContent||"");const it=(0,L.countWords)(((Et=G.textContent)===null||Et===void 0?void 0:Et.trim())||"")-st;if(it>25)break;J+=it,j.push(G),G=G.previousElementSibling}if(j.length>=1&&J<.15*te){const st=j.some((lt=>d(lt))),it=j.some((lt=>lt.querySelector(P.CONTENT_ELEMENT_SELECTOR)));let nt=0;for(const lt of j)lt.tagName==="P"&&(0,L.countWords)(lt.textContent||"")>5&&nt++;if(st&&!it&&nt<2)for(const lt of j)M&&k&&k.push({step:"removeByContentPattern",reason:"trailing thin section",text:(0,L.textPreview)(lt)}),lt.remove()}}const ue=$.textContent||"",de=$.querySelectorAll("p, div, span, section");for(const j of de){if(!j.parentNode||j.closest("pre, code"))continue;const J=((Pt=j.textContent)===null||Pt===void 0?void 0:Pt.trim())||"",G=(0,L.countWords)(J);if(!(G>50||G<1)){for(const st of o)if(st.test(J)){let it=j;for(;it.parentElement&&it.parentElement!==$&&!it.nextElementSibling;)it=it.parentElement;const nt=it.textContent||"";if(ue.indexOf(nt)<200){it===j||j.nextElementSibling||(M&&k&&k.push({step:"removeByContentPattern",reason:"boilerplate text",text:(0,L.textPreview)(j)}),j.remove());continue}T(it,$,M,k);break}}}for(const j of $.querySelectorAll("h2, h3, h4, h5, h6")){if(!j.parentNode)continue;const J=((At=j.textContent)===null||At===void 0?void 0:At.trim())||"",G=l.test(J);if(!G&&!x.test(J)||bt.indexOf(J)<500)continue;const st=R(j,$);if(st===j){if(!G)continue;O(j,!0,M,k)}else D(st,M,k),M&&k&&k.push({step:"removeByContentPattern",reason:"related content section",text:(0,L.textPreview)(st)}),T(st,$,M,k);break}for(const j of $.querySelectorAll("p")){if(!j.parentNode)continue;const J=((Mt=j.textContent)===null||Mt===void 0?void 0:Mt.trim())||"";m.test(J)&&((0,L.countWords)(J)>20||j.querySelector(P.CONTENT_ELEMENT_SELECTOR)||(M&&k&&k.push({step:"removeByContentPattern",reason:"related content intro",text:(0,L.textPreview)(j)}),j.remove()))}const ee=(0,L.countWords)(bt);for(const j of $.querySelectorAll("div")){if(!j.parentNode||j.children.length<2)continue;const J=Array.from(j.children),G=J.filter((lt=>lt.querySelector("img, picture")&&(lt.querySelector("h2, h3, h4")||lt.querySelector("a[href]")))).length;if(G<2||G<.7*J.length)continue;const st=((gt=J[0].textContent)===null||gt===void 0?void 0:gt.trim().substring(0,30))||"";if(st.length<5||bt.indexOf(st)<500)continue;const it=(0,L.countWords)(j.textContent||"");if(ee>0&&it/ee>.3)continue;const nt=R(j,$);if(nt!==j&&!((0,L.countWords)(nt.textContent||"")>2*it+15)&&!C(nt)){D(nt,M,k),M&&k&&k.push({step:"removeByContentPattern",reason:"related post cards",text:(0,L.textPreview)(nt)}),O(nt,!0,M,k);break}}for(const j of $.querySelectorAll("div, section, aside")){if(!j.parentNode||j.closest("pre, code")||!p(j,60))continue;const J=(0,L.countWords)(((Nt=j.textContent)===null||Nt===void 0?void 0:Nt.trim())||"");let G=j;for(;G.parentElement&&G.parentElement!==$&&!((0,L.countWords)(((kt=G.parentElement.textContent)===null||kt===void 0?void 0:kt.trim())||"")>2*J+15);)G=G.parentElement;M&&k&&k.push({step:"removeByContentPattern",reason:"newsletter signup",text:(0,L.textPreview)(G)}),G.remove();break}for(const j of $.querySelectorAll("ul"))if(j.parentNode&&p(j,30)){M&&k&&k.push({step:"removeByContentPattern",reason:"newsletter signup list",text:(0,L.textPreview)(j)}),j.remove();break}for(const j of $.querySelectorAll("div, section")){if(!j.parentNode)continue;const J=((Ht=j.textContent)===null||Ht===void 0?void 0:Ht.trim())||"",G=(0,L.countWords)(J);if(G<2||G>40)continue;const st=bt.indexOf(J.substring(0,60));if(st<0||bt.length-(st+J.length)>300)continue;const it=j.querySelectorAll("div, span, p, dt, dd, li");let nt=!1;for(const tt of it){const ct=((jt=tt.textContent)===null||jt===void 0?void 0:jt.trim())||"";if(u.test(ct)){nt=!0;break}}if(!nt||!(g.test(J)||y.test(J)||j.querySelector('a[href^="mailto:"]')))continue;const lt=R(j,$);M&&k&&k.push({step:"removeByContentPattern",reason:"author contact block",text:(0,L.textPreview)(lt)}),lt.remove();break}for(const j of $.querySelectorAll("p, span, div")){if(!j.parentNode)continue;const J=((Wt=j.textContent)===null||Wt===void 0?void 0:Wt.trim())||"";if(!h.test(J))continue;let G=j;for(;G.parentElement&&G.parentElement!==$;){const st=G.parentElement;if((0,L.countWords)(((Ft=st.textContent)===null||Ft===void 0?void 0:Ft.trim())||"")>15)break;G=st}G.querySelector(b)||(M&&k&&k.push({step:"removeByContentPattern",reason:"author/share widget",text:(0,L.textPreview)(G)}),G.remove())}for(const j of $.querySelectorAll("a, p, div, span")){if(!j.parentNode)continue;const J=((zt=j.textContent)===null||zt===void 0?void 0:zt.trim())||"";if(!i.test(J)||j.tagName==="A"&&j.getAttribute("href"))continue;if(j.tagName!=="A"){const st=bt.indexOf(J);if(bt.length-(st+J.length)>200)continue}const G=N(j,J,$);M&&k&&k.push({step:"removeByContentPattern",reason:"social engagement counter",text:(0,L.textPreview)(G)}),G.remove()}for(const j of $.querySelectorAll("div")){if(!j.parentNode)continue;const J=((Ut=j.textContent)===null||Ut===void 0?void 0:Ut.trim())||"",G=(0,L.countWords)(J);if(G<1||G>10||/[.!?]/.test(J)||j.querySelector(P.CONTENT_ELEMENT_SELECTOR))continue;const st=bt.indexOf(J);if(st<0||bt.length-(st+J.length)>300)continue;const it=j.querySelectorAll("a[href]");if(it.length===0)continue;let nt=0;for(const lt of it)nt+=(((Vt=lt.textContent)===null||Vt===void 0?void 0:Vt.trim())||"").length;nt/(J.length||1)<.8||(M&&k&&k.push({step:"removeByContentPattern",reason:"trailing tag link block",text:(0,L.textPreview)(j)}),j.remove())}};const P=I(2640),L=I(2552),_=I(4467),A=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*|\d{4}[-/]\d{1,2}[-/]\d{1,2})/i,S=/\b\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago\b/i,n=/\d+\s*min(?:ute)?s?\s+read\b|(?:read(?:ing)?\s+time)\s*:?\s*\d+\s*min(?:ute)?s?\b/i,t=new RegExp("^\\p{Lu}","u"),r=/^(?:posted\s+)?by\s+\S/i,e=/^(?:date|published|updated|posted|from|to|subject)\s*:/i,o=[/^This (?:article|story|piece) (?:appeared|was published|originally appeared) in\b/i,/^A version of this (?:article|story) (?:appeared|was published) in\b/i,/^Originally (?:published|appeared) (?:in|on|at)\b/i,/^Any re-?use permitted\b/i,/^\xa9\s*(?:Copyright\s+)?\d{4}/i,/^Comments?$/i,/^Leave a (?:comment|reply)$/i,/^Loading\.{3}$/,/^Affiliate links\b.*\b(?:earn|commission)/i,/\bRead our Comment Policy\b/i,/^Thank you for (?:being part of|joining) our community\b/i],s=/\bsubscribe\b[\s\S]{0,40}\bnewsletter\b|\bnewsletter\b[\s\S]{0,40}\bsubscribe\b|\bsign[- ]up\b[\s\S]{0,80}\b(?:newsletter|email alert)|\b(?:don[\u2019']?t (?:want to )?miss|never miss)\b[\s\S]{0,80}\b(?:latest|best|exclusive|reports?|updates?|source)/i,i=/^\d+\s+(?:Likes?|Comments?|Shares?|Retweets?|Reposts?|Restacks?)$/i,c=/^current time in$/i,f=/^pinned$/i,u=/^(?:written by|(?:author|contact|reporter|correspondent)s?)$/i,h=/^(?:share|follow|authors?|written\s+by)$/i,b=P.CONTENT_ELEMENT_SELECTOR.replace(/img, picture, /,""),g=/[\w.-]+@[\w.-]+\.\w+/,y=/\(?\d{3}\)?[\s.\u2011\u2013-]?\d{3}[\s.\u2011\u2013-]?\d{4}/,a=/^H[1-6]$/;function d($){return a.test($.tagName)||!!$.querySelector("h1, h2, h3, h4, h5, h6")}function p($,M){var W;const B=((W=$.textContent)===null||W===void 0?void 0:W.trim())||"",H=(0,L.countWords)(B);if(H<2||H>M||$.querySelector(P.CONTENT_ELEMENT_SELECTOR))return!1;const k=B.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[\u2018\u2019]/g,"'");return s.test(k)}const x=/^(?:related (?:posts?|articles?|content|stories|reads?|reading)|you (?:might|may|could) (?:also )?(?:like|enjoy|be interested in)|read (?:next|more|also)|further reading|see also|more (?:from .*|from|articles?|posts?|like this)|more to (?:read|explore)|explore more|about (?:the )?author|latest (?:news|events?|posts?|articles?|stories)(?:\s*[&+]\s*(?:news|events?|posts?|articles?|stories))?)$/i,l=/^(?:subscribe|sign up|follow us|share this|stay (?:updated|connected)|join (?:us|our)|search (?:the |our )?(?:site|blog|archives?|newsroom|website|catalog|store|shop|database))$/i,m=/^for more (?:on|about)\b/i,v=[/\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\b/gi,/\b(?:Mon(?:day)?|Tue(?:s(?:day)?)?|Wed(?:nesday)?|Thu(?:rs(?:day)?)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)\b/gi,/\b\d+(?:st|nd|rd|th)?\b/g,/\d{4}[-/]\d{1,2}[-/]\d{1,2}/g],E=[...v,/\bmin(?:ute)?s?\b/gi,/\bread(?:ing)?\b/gi,/\btime\b/gi,/\bestimated\b/gi,/[/|\xb7\u2022\u2014\u2013\-,:.\s]+/g],q=[...v,/\bby\b/gi,/[/|\xb7\u2022\u2014\u2013\-,]+/g];function C($,M=25){let W=$.nextElementSibling;for(;W;){if(W.tagName==="P"&&(0,L.countWords)(W.textContent||"")>=M)return!0;for(const B of W.querySelectorAll("p"))if((0,L.countWords)(B.textContent||"")>=M)return!0;W=W.nextElementSibling}return!1}function N($,M,W){var B;let H=$;for(;H.parentElement&&H.parentElement!==W&&(((B=H.parentElement.textContent)===null||B===void 0?void 0:B.trim())||"")===M;)H=H.parentElement;return H}function O($,M,W,B){let H=$.nextElementSibling;for(;H;){const k=H.nextElementSibling;H.id!=="footnotes"&&(W&&B&&B.push({step:"removeByContentPattern",reason:"trailing non-content",text:(0,L.textPreview)(H)}),H.remove()),H=k}M&&(W&&B&&B.push({step:"removeByContentPattern",reason:"boilerplate text",text:(0,L.textPreview)($)}),$.remove())}function T($,M,W,B){const H=[];let k=$.parentElement;for(;k&&k!==M;)H.push(k),k=k.parentElement;O($,!0,W,B);for(const F of H)O(F,!1,W,B)}function R($,M){let W=$;for(;W.parentElement&&W.parentElement!==M;){let B=0,H=W.previousElementSibling;for(;H&&(B+=(0,L.countWords)(H.textContent||""),!(B>10));)H=H.previousElementSibling;if(B>10)break;W=W.parentElement}return W}function D($,M,W){const B=$.previousElementSibling;if(!B||(0,L.countWords)(B.textContent||"")>=50||B.querySelector(P.CONTENT_ELEMENT_SELECTOR))return;const H=B.previousElementSibling;H&&d(H)||(M&&W&&W.push({step:"removeByContentPattern",reason:"thin CTA section",text:(0,L.textPreview)(B)}),B.remove())}},8983(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.removeHiddenElements=function(_,A,S){let n=0;const t=new Map,r=/(?:^|;\s*)(?:display\s*:\s*none|visibility\s*:\s*hidden|opacity\s*:\s*0)(?:\s*;|\s*$)/i,e=_.defaultView,o=typeof window<"u"&&e===window,s=_.querySelectorAll("*");for(const i of s){if(i.querySelector("math, [data-mathml], .katex-mathml")||i.tagName.toLowerCase()==="math")continue;const c=i.getAttribute("style");if(c&&r.test(c)){const u=c.includes("display")?"display:none":c.includes("visibility")?"visibility:hidden":"opacity:0";t.set(i,u),n++;continue}if(o)try{const u=e.getComputedStyle(i);let h="";if(u.display==="none"?h="display:none":u.visibility==="hidden"?h="visibility:hidden":u.opacity==="0"&&(h="opacity:0"),h){t.set(i,h),n++;continue}}catch{}const f=i.getAttribute("class")||"";if(f){const u=f.split(/\s+/);if((0,L.hasResponsiveShowClass)(f))continue;for(const h of u){const b=h==="hidden"||h==="invisible",g=!h.includes("[")&&(h.endsWith(":hidden")||h.endsWith(":invisible"));if(b||g){t.set(i,`class:${h}`),n++;break}}}}t.forEach(((i,c)=>{A&&S&&S.push({step:"removeHiddenElements",reason:i,text:(0,P.textPreview)(c)}),c.remove()})),(0,P.logDebug)(A,"Removed hidden elements:",n)};const P=I(2552),L=I(639)},662(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.removeMetadataBlock=function(P){var L,_;const A=P.querySelector("h1");if(!A)return;let S=A.nextElementSibling;for(let n=0;n<3&&S;n++){const t=S.nextElementSibling,r=((L=S.textContent)===null||L===void 0?void 0:L.trim())||"";if(r.length>0&&r.length<300){let e=I.test(r);if(!e){for(const o of S.querySelectorAll("p, time"))if(I.test(((_=o.textContent)===null||_===void 0?void 0:_.trim())||"")){e=!0;break}}if(e){S.remove();break}}S=t}};const I=/\b(?:(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2}[\s,]+\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{4}|\d{4}[-/]\d{1,2}[-/]\d{1,2})\b/i},3550(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.ContentScorer=void 0;const P=I(2640),L=I(2552),_=I(639),A=["admonition","article","content","entry","image","img","font","figure","figcaption","pre","main","post","story","table"],S=["advertisement","all rights reserved","banner","cookie","comments","copyright","follow me","follow us","footer","header","homepage","login","menu","more articles","more like this","most read","nav","navigation","newsletter","popular","privacy","recommended","register","related","responses","share","sidebar","sign in","sign up","signup","social","sponsored","subscribe","terms","trending"],n=/\b(linkedin\.com\/(in|company)\/|twitter\.com\/(?!intent\b)\w|x\.com\/(?!intent\b)\w|facebook\.com\/(?!share\b)\w|instagram\.com\/\w|threads\.net\/\w|mastodon\.\w)/i,t=/(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*)/i,r=/\bBy\s+[A-Z]/,e=S.map((h=>new RegExp(`\\b${h.replace(/\s+/g,"\\s+")}\\b`))),o=new RegExp(S.map((h=>h.replace(/\s+/g,"\\s+"))).join("|"),"i"),s=/^(?:table of )?contents$|^on this page$|^in this (?:article|guide|post)$/i,i=/\b(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2},?\s+\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*,?\s+\d{4})\b/i,c=/\b(?:by|written by|author:)\s+[A-Za-z\s]+\b/i,f=["advert","ad-","ads","banner","cookie","copyright","footer","header","homepage","menu","nav","newsletter","popular","privacy","recommended","related","rights","share","sidebar","social","sponsored","subscribe","terms","trending","widget"];class u{constructor(b,g=!1){this.doc=b,this.debug=g}static scoreElement(b){let g=0;const y=b.textContent||"",a=(0,L.countWords)(y);g+=a,g+=10*b.getElementsByTagName("p").length,g+=y.split(/,/).length-1,g-=3*(b.getElementsByTagName("img").length/(a||1));try{const m=b.getAttribute("style")||"",v=b.getAttribute("align")||"";(m.includes("float: right")||m.includes("text-align: right")||v==="right")&&(g+=5)}catch{}i.test(y)&&(g+=10),c.test(y)&&(g+=10);const d=(0,_.getClassName)(b).toLowerCase();if((d.includes("content")||d.includes("article")||d.includes("post"))&&(g+=15),b.querySelector(P.FOOTNOTE_INLINE_REFERENCES)&&(g+=10),b.querySelector(P.FOOTNOTE_LIST_SELECTORS)&&(g+=10),g-=5*b.getElementsByTagName("table").length,b.tagName.toLowerCase()==="td"){const m=b.closest("table");if(m){const v=parseInt(m.getAttribute("width")||"0"),E=m.getAttribute("align")||"",q=(0,_.getClassName)(m).toLowerCase();if(v>400||E==="center"||q.includes("content")||q.includes("article")){const C=Array.from(m.getElementsByTagName("td")),N=C.indexOf(b);N>0&&N<C.length-1&&(g+=10)}}}const p=b.getElementsByTagName("a");let x=0;for(let m=0;m<p.length;m++)x+=(p[m].textContent||"").length;const l=y.length||1;return g*=1-Math.min(x/l,.5),g}static findBestElement(b,g=50){let y=null,a=0;return b.forEach((d=>{const p=this.scoreElement(d);p>a&&(a=p,y=d)})),a>g?y:null}static scoreAndRemove(b,g=!1,y,a){const d=Date.now(),p=new Map;Array.from(b.querySelectorAll(P.BLOCK_ELEMENTS_SELECTOR)).forEach((l=>{if(p.has(l)||a&&l.contains(a)||l.closest("pre")||l.closest("[data-defuddle]")||l.closest("td, th")||u.isLikelyContent(l))return;const m=u.scoreNonContentBlock(l);m<0&&p.set(l,m)})),p.forEach(((l,m)=>{g&&y&&y.push({step:"scoreAndRemove",reason:`score: ${l}`,text:(0,L.textPreview)(m)}),m.remove()}));const x=Date.now();(0,L.logDebug)(g,"Removed non-content blocks:",{count:p.size,processingTime:`${(x-d).toFixed(2)}ms`})}static isLikelyContent(b){const g=b.getAttribute("role");if(g&&["article","main","contentinfo"].includes(g))return!0;const y=(0,_.getClassName)(b).toLowerCase(),a=b.id.toLowerCase();for(const m of A)if(y.includes(m)||a.includes(m))return!0;if(b.querySelector("pre, table, figure, picture"))return!0;const d=b.textContent||"",p=(0,L.countWords)(d),x=b.querySelector("h1, h2, h3, h4, h5, h6");if(x){const m=(x.textContent||"").trim();if(m&&m===d.trim()){const v=m.toLowerCase();if(!o.test(v)&&!s.test(v))return!0}}if(p<1e3){const m=b.querySelectorAll("h1, h2, h3, h4, h5, h6");let v=!1;for(let E=0;E<m.length;E++){const q=(m[E].textContent||"").toLowerCase().trim();if(o.test(q)){v=!0;break}}if(v&&(p<200||b.getElementsByTagName("a").length/(p||1)>.2))return!1}if(u.isCardGrid(b,p))return!1;if(p<80){const m=b.getElementsByTagName("a");for(let v=0;v<m.length;v++){const E=(m[v].getAttribute("href")||"").toLowerCase();if(n.test(E))return!1}}const l=b.getElementsByTagName("p").length+b.getElementsByTagName("li").length;return!!(p>50&&l>1||p>100||p>30&&l>0||p>=10&&/[.?!]/.test(d)&&b.getElementsByTagName("a").length/p<.1)}static scoreNonContentBlock(b){try{if(b.matches(P.FOOTNOTE_LIST_SELECTORS)||b.querySelector(P.FOOTNOTE_LIST_SELECTORS)||b.closest(P.FOOTNOTE_LIST_SELECTORS))return 0}catch{}let g=0;const y=b.textContent||"",a=(0,L.countWords)(y);if(a<3)return 0;g+=y.split(/,/).length-1;const d=y.toLowerCase();let p=0;for(const q of e)q.test(d)&&p++;g-=10*p;const x=b.getElementsByTagName("a"),l=x.length;if(l/(a||1)>.5&&(g-=15),l>1&&a<80){let q=0;for(let N=0;N<x.length;N++)q+=(x[N].textContent||"").length;const C=y.length;C>0&&q/C>.8&&(g-=15)}const m=b.getElementsByTagName("ul").length+b.getElementsByTagName("ol").length;if(m>0&&l>3*m&&(g-=10),a<80){const q=b.getElementsByTagName("a");for(let C=0;C<q.length;C++){const N=(q[C].getAttribute("href")||"").toLowerCase();if(n.test(N)){g-=15;break}}}a<15&&r.test(y)&&t.test(y)&&(g-=10),u.isCardGrid(b,a)&&(g-=15);const v=(0,_.getClassName)(b).toLowerCase(),E=b.id.toLowerCase();for(const q of f)(v.includes(q)||E.includes(q))&&(g-=8);return g}static isCardGrid(b,g){if(g<3||g>=500)return!1;const y=b.querySelectorAll("h2, h3, h4");if(y.length<3||b.querySelectorAll("img").length<2)return!1;let a=0;for(let d=0;d<y.length;d++)a+=(0,L.countWords)(y[d].textContent||"");return(g-a)/y.length<20}}w.ContentScorer=u},7393(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.removeBySelector=function(A,S,n=!0,t=!0,r,e,o=!1){const s=Date.now();let i=0,c=0;const f=new Map;if(n&&A.querySelectorAll(P.EXACT_SELECTORS_JOINED).forEach((h=>{if(h?.parentNode){if(o){const b=h.closest(P.HIDDEN_EXACT_SKIP_SELECTOR),g=(h.getAttribute("role")||"").toLowerCase();if(h.matches(P.HIDDEN_EXACT_SELECTOR)||b&&g==="dialog")return}if(h.closest("pre, code")||h.matches(P.HIDDEN_EXACT_SELECTOR)&&(0,_.hasResponsiveShowClass)((0,_.getClassName)(h)))return;f.set(h,{type:"exact"}),i++}})),t){const h=S?P.PARTIAL_SELECTORS.map((y=>({pattern:y,regex:new RegExp(y,"i"),anchored:new RegExp("^(?:"+y+")$","i")}))):null,b=A.querySelectorAll(P.TEST_ATTRIBUTES_SELECTOR),g=r?r.querySelectorAll(P.TEST_ATTRIBUTES_SELECTOR):[];new Set([...b,...g]).forEach((y=>{var a;if(f.has(y)||y.closest("[data-defuddle]"))return;const d=y.tagName;if(d==="CODE"||d==="PRE"||y.querySelector("pre")||y.closest("code, pre"))return;const p=/^H[1-6]$/.test(d),x=(p?(0,_.getClassName)(y):(0,_.getClassName)(y)+" "+(y.getAttribute("data-component")||"")+" "+(y.getAttribute("data-test")||"")+" "+(y.getAttribute("data-testid")||"")+" "+(y.getAttribute("data-test-id")||"")+" "+(y.getAttribute("data-qa")||"")+" "+(y.getAttribute("data-cy")||"")).toLowerCase(),l=p?"":(y.id||"").toLowerCase(),m=x.trim()!=="";if(!m&&!l)return;const v=m&&P.PARTIAL_SELECTORS_REGEX.test(x),E=!!l&&/[\s_\-:.]/.test(l),q=!!l&&(E?P.PARTIAL_SELECTORS_REGEX.test(l):P.PARTIAL_SELECTORS_ANCHORED_REGEX.test(l));if(v||q){const C=v||E,N=v?x:l,O=h?(a=h.find((T=>(C?T.regex:T.anchored).test(N))))===null||a===void 0?void 0:a.pattern:void 0;f.set(y,{type:"partial",selector:O}),c++}}))}f.forEach((({type:h,selector:b},g)=>{var y;if(!(r&&g.contains(r)||g.tagName==="A"&&g.closest("h1, h2, h3, h4, h5, h6"))){try{if(g.matches(P.FOOTNOTE_LIST_SELECTORS)||g.querySelector(P.FOOTNOTE_LIST_SELECTORS))return;const a=g.parentElement;if(a&&a.matches(P.FOOTNOTE_LIST_SELECTORS)||!((y=g.classList)===null||y===void 0)&&y.contains("footnote-backref")&&g.closest("#footnotes"))return}catch{}if(g.tagName==="BUTTON"&&g.querySelector("img, picture, video")){const a=g.parentElement;if(a){for(const d of Array.from(g.querySelectorAll("img, picture, video")))a.insertBefore(d,g);g.remove()}}else g.tagName==="BUTTON"&&g.closest("p, li, td, th, span, h1, h2, h3, h4, h5, h6")?g.replaceWith(...Array.from(g.childNodes)):(S&&e&&e.push({step:"removeBySelector",selector:h==="exact"?"exact":b,reason:h==="exact"?"exact selector match":`partial match: ${b}`,text:(0,L.textPreview)(g)}),g.remove())}}));const u=Date.now();(0,L.logDebug)(S,"Removed clutter elements:",{exactSelectors:i,partialSelectors:c,total:f.size,processingTime:`${(u-s).toFixed(2)}ms`})};const P=I(2640),L=I(2552),_=I(639)},2408(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.getElementIdentifier=r,w.findSmallImages=function(e,o){var s,i,c;const f=new Set;let u=0;const h=e.querySelectorAll("img, svg"),b=e.defaultView,g=typeof window<"u"&&b===window;for(const y of h){const a=parseInt(y.getAttribute("width")||"0"),d=parseInt(y.getAttribute("height")||"0");let p=0,x=0;if(y.tagName.toLowerCase()==="svg"){const O=y.getAttribute("viewBox");if(O){const T=O.split(/[\s,]+/);T.length===4&&(p=parseFloat(T[2])||0,x=parseFloat(T[3])||0)}}const l=y.getAttribute("style")||"",m=parseInt(((s=l.match(S))===null||s===void 0?void 0:s[1])||"0"),v=parseInt(((i=l.match(n))===null||i===void 0?void 0:i[1])||"0");let E=0,q=0;if(g){try{const O=b.getComputedStyle(y);E=parseInt(O.width)||0,q=parseInt(O.height)||0}catch{}try{const O=y.getBoundingClientRect();O.width>0&&(E=E||O.width),O.height>0&&(q=q||O.height)}catch{}}const C=[a,m,E,p].filter((O=>O>0)),N=[d,v,q,x].filter((O=>O>0));if(C.length===0&&N.length===0&&y.tagName.toLowerCase()==="img"){const O=(y.getAttribute("srcset")||"").match(/(\S+)\s+1x/);if(O){const T=parseInt(((c=O[1].match(t))===null||c===void 0?void 0:c[1])||"0");T>0&&C.push(T)}}if(C.length>0||N.length>0){const O=C.length>0?Math.min(...C):1/0,T=N.length>0?Math.min(...N):1/0;if(O<33||T<33){if(y.tagName.toLowerCase()==="img"){const D=y.getAttribute("alt")||"";if(A.LOOKS_LIKE_LATEX_RE.test(D)||y.classList.contains("latex")||y.classList.contains("tex")||y.getAttribute("data-latex")||y.getAttribute("data-math"))continue}const R=r(y);R&&(f.add(R),u++)}}}return(0,P.logDebug)(o,"Found small elements:",u),f},w.removeSmallImages=function(e,o,s){let i=0;["img","svg"].forEach((c=>{const f=e.getElementsByTagName(c);Array.from(f).forEach((u=>{if(c==="img"){const b=u.getAttribute("src")||"",g=u.getAttribute("srcset")||u.getAttribute("data-src")||u.getAttribute("data-srcset")||u.getAttribute("data-lazy-src")||u.getAttribute("data-original");if(!b&&!g||!g&&!u.closest("picture")&&(0,_.isBase64Placeholder)(b))return u.remove(),void i++}const h=r(u);h&&o.has(h)&&(u.remove(),i++)}))})),(0,P.logDebug)(s,"Removed small elements:",i)};const P=I(2552),L=I(639),_=I(2649),A=I(7282),S=/width\s*:\s*(\d+)/,n=/height\s*:\s*(\d+)/,t=/(?:width[=:/]|[/,?&]w[_:=])(\d+)/;function r(e){if(e.tagName.toLowerCase()==="img"){const c=e.getAttribute("data-src");if(c)return`src:${c}`;const f=e.getAttribute("src")||"",u=e.getAttribute("srcset")||"",h=e.getAttribute("data-srcset");if(f)return`src:${f}`;if(u)return`srcset:${u}`;if(h)return`srcset:${h}`}const o=e.id||"",s=(0,L.getClassName)(e),i=e.tagName.toLowerCase()==="svg"&&e.getAttribute("viewBox")||"";return o?`id:${o}`:i?`viewBox:${i}`:s?`class:${s}`:null}},4840(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.standardizeContent=function(T,R,D,$=!1,M){e=$;const W=M?(B,H)=>{var k;const F=performance.now(),z=H();return M[B]=((k=M[B])!==null&&k!==void 0?k:0)+Math.round(performance.now()-F),z}:(B,H)=>H();W("standardizeDropCaps",(()=>(function(B){const H=Array.from(B.querySelectorAll('span[data-caps="initial"]'));let k=0;for(const F of H){if(!F.parentNode)continue;const z=F.nextElementSibling;if(z&&z.tagName==="SMALL"){const Y=F.textContent||"",ot=z.textContent||"",U=F.ownerDocument.createTextNode(Y+ot);F.parentNode.insertBefore(U,F),z.remove(),F.remove()}else f(F);k++}k>0&&B.normalize(),(0,t.logDebug)(e,"Standardized drop caps:",k)})(T))),W("standardizeSpaces",(()=>(function(B){const H=k=>{if((0,t.isElement)(k)){const F=k.tagName.toLowerCase();if(F==="pre"||F==="code"||(0,t.isSVGElement)(k))return}if((0,t.isTextNode)(k)){const F=k.textContent||"",z=F.replace(/\xA0/g," ");z!==F&&(k.textContent=z)}k.hasChildNodes()&&Array.from(k.childNodes).forEach(H)};H(B)})(T))),W("removeHtmlComments",(()=>(function(B){var H;let k=0;const F=B.ownerDocument,z=F.createTreeWalker(B,128),Y=[];for(;z.nextNode();)Y.push(z.currentNode);for(const ot of Y)(H=ot.parentNode)===null||H===void 0||H.removeChild(ot),k++;(0,t.logDebug)(e,"Removed HTML comments:",k)})(T))),W("standardizeHeadings",(()=>(function(B,H,k){const F=B.getElementsByTagName("h1");Array.from(F).forEach((Y=>{var ot;const U=k.createElement("h2");(0,r.transferContent)(Y,U),Array.from(Y.attributes).forEach((Q=>{P.ALLOWED_ATTRIBUTES.has(Q.name)&&U.setAttribute(Q.name,Q.value)})),(ot=Y.parentNode)===null||ot===void 0||ot.replaceChild(U,Y)}));const z=B.getElementsByTagName("h2");if(z.length>0){const Y=z[0];let ot="";for(const K of Y.querySelectorAll("a"))(0,S.isPermalinkAnchor)(K)&&(ot+=K.textContent||"");const U=(0,t.normalizeText)((Y.textContent||"").replace(ot,"")),Q=(0,t.normalizeText)(H);Q&&Q===U&&Y.remove()}})(T,R.title,D))),W("wrapPreformattedCode",(()=>(function(B,H){var k;const F=Array.from(B.querySelectorAll("code"));for(const z of F){if(z.closest("pre"))continue;const Y=z.getAttribute("style")||"";if(!/white-space\s*:\s*pre/.test(Y))continue;const ot=H.createElement("pre");(k=z.parentNode)===null||k===void 0||k.insertBefore(ot,z),ot.appendChild(z)}})(T,D))),W("standardizeElements",(()=>(function(B,H,k){let F=0;const z=k?(V,X)=>{var Z;const et=performance.now(),rt=X();return k["se:"+V]=((Z=k["se:"+V])!==null&&Z!==void 0?Z:0)+Math.round(performance.now()-et),rt}:(V,X)=>X();z("wrapRawLatexDelimiters",(()=>(0,_.wrapRawLatexDelimiters)(B,H))),z("convertLatexImages",(()=>{var V;for(const X of Array.from(B.querySelectorAll("img[src]"))){const Z=X.getAttribute("src");if(!Z)continue;let et=(0,_.extractLatexFromImageSrc)(Z);if(!et){const ht=X.getAttribute("alt")||"";_.LOOKS_LIKE_LATEX_RE.test(ht)&&(et=ht)}if(!et)continue;const rt=/\\begin\{/.test(et)||((V=X.parentElement)===null||V===void 0?void 0:V.tagName.toLowerCase())==="p"&&X.parentElement.childNodes.length===1,ut=(0,L.createCleanMathEl)(null,et,rt,H);X.replaceWith(ut),F++}})),o.forEach((V=>{const X=V.selector.substring(0,30);z(X,(()=>{if(V.fastCheck&&!B.querySelector(V.fastCheck))return;let Z;try{Z=B.querySelectorAll(V.selector)}catch{return}Z.forEach((et=>{if(V.transform){const rt=V.transform(et,H);et.replaceWith(rt),F++}}))}))})),Array.from(B.querySelectorAll("code > pre")).forEach((V=>{const X=V.parentElement;X&&X.tagName==="CODE"&&X.replaceWith(V)})),Array.from(B.querySelectorAll("table.ltx_equation, table.ltx_eqn_table, table.ltx_equationgroup")).forEach((V=>{const X=V.querySelectorAll("math");if(X.length===0)return;const Z=H.createDocumentFragment();X.forEach((et=>{var rt;const ut=et.getAttribute("alttext"),ht=et.querySelector('annotation[encoding="application/x-tex"]'),dt=ut||((rt=ht?.textContent)===null||rt===void 0?void 0:rt.trim())||"";if(!dt)return;const pt=et.getAttribute("display")==="block"||V.classList.contains("ltx_equation")||V.classList.contains("ltx_equationgroup"),ft=H.createElement("math");ft.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),ft.setAttribute("display",pt?"block":"inline"),ft.setAttribute("data-latex",dt),ft.textContent=dt,Z.appendChild(ft)})),Z.childNodes.length>0&&(V.replaceWith(Z),F++)})),Array.from(B.querySelectorAll("span.ltx_note_outer")).forEach((V=>{V.remove(),F++})),Array.from(B.querySelectorAll("a.ltx_ref")).forEach((V=>{if(V.querySelector("span.ltx_ref_tag, span.ltx_text.ltx_ref_tag")){const X=H.createTextNode(V.textContent||"");V.replaceWith(X),F++}}));for(const V of Array.from(B.querySelectorAll("table"))){if(!V.parentNode)continue;const X=V.querySelectorAll("td, th");X.length>0&&Array.from(X).every((Z=>!(Z.textContent||"").trim()))&&!V.querySelector("img, picture, video, audio, iframe, svg, math")&&(V.remove(),F++)}Array.from(B.querySelectorAll("table")).forEach((V=>{if(!V.parentNode)return;const X=Array.from(V.querySelectorAll("td, th")).filter((rt=>(0,r.isDirectTableChild)(rt,V)));if(X.some((rt=>rt.tagName==="TH")))return;const Z=Array.from(V.querySelectorAll("tr")).filter((rt=>(0,r.isDirectTableChild)(rt,V)));if(Z.length===0||!Z.every((rt=>X.filter((ut=>ut.parentNode===rt)).length<=1)))return;const et=H.createDocumentFragment();X.forEach((rt=>{for(;rt.firstChild;)et.appendChild(rt.firstChild)})),V.replaceWith(et),F++})),B.querySelectorAll("video:not([controls])").forEach((V=>{V.setAttribute("controls","")})),B.querySelectorAll("lite-youtube").forEach((V=>{const X=V.getAttribute("videoid");if(!X)return;const Z=H.createElement("iframe");Z.width="560",Z.height="315",Z.src=`https://www.youtube.com/embed/${X}`,Z.title=V.getAttribute("videotitle")||"YouTube video player",Z.frameBorder="0",Z.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",Z.setAttribute("allowfullscreen",""),V.replaceWith(Z),F++})),(0,t.logDebug)(e,"Converted embedded elements:",F),(function(V){var X;const Z=ht=>{let dt=null;for(const pt of ht.children){if(pt.tagName.toLowerCase()!=="code"||dt)return null;dt=pt}return dt},et=ht=>{var dt;const pt=(ht.getAttribute("data-lang")||"").toLowerCase();if(pt)return pt;const ft=(ht.getAttribute("class")||"").match(/(?:^|\s)language-([a-z0-9_+-]+)(?:\s|$)/i);return((dt=ft?.[1])===null||dt===void 0?void 0:dt.toLowerCase())||""},rt=V.querySelectorAll('pre[data-verso-code="true"]'),ut=new Set;for(const ht of rt){const dt=ht.parentElement;dt&&ut.add(dt)}for(const ht of ut){const dt=Array.from(ht.childNodes);for(let pt=0;pt<dt.length;pt++){const ft=dt[pt];if(!(0,t.isElement)(ft)||ft.tagName.toLowerCase()!=="pre"||ft.getAttribute("data-verso-code")!=="true")continue;const Ct=Z(ft);if(!Ct)continue;const St=et(Ct);if(St!=="lean"&&St!=="lean4")continue;const Et=[{pre:ft,code:Ct}],Pt=[];let At=pt+1;for(;At<dt.length;){const gt=dt[At];if((0,t.isTextNode)(gt)&&!(gt.textContent||"").trim()){Pt.push(gt),At++;continue}if(!(0,t.isElement)(gt)||gt.tagName.toLowerCase()!=="pre")break;const Nt=gt;if(Nt.getAttribute("data-verso-code")!=="true")break;const kt=Z(Nt);if(!kt||et(kt)!==St)break;Et.push({pre:Nt,code:kt}),At++}if(Et.length<=1)continue;const Mt=Et.map((({code:gt})=>(gt.textContent||"").replace(/\r?\n$/,""))).join(`
|
|
77
|
+
`).replace(/\n{3,}/g,`
|
|
78
|
+
|
|
79
|
+
`).replace(/^\n+|\n+$/g,"");Ct.textContent=Mt;for(let gt=1;gt<Et.length;gt++)Et[gt].pre.remove();for(const gt of Pt)(X=gt.parentNode)===null||X===void 0||X.removeChild(gt);pt=At-1}}})(B)})(T,D,M))),W("resolveSvgColors",(()=>(function(B,H){const k=B.querySelectorAll("svg");if(k.length===0)return;const F=H.defaultView,z=typeof window<"u"&&F===window,Y=new Map,ot=(U,Q)=>{var K,V;if(!(U=U.replace(g,((Z,et)=>et.trim()))).includes("var("))return U;if(z){const Z=Y.get(U);if(Z)return Z;const et=Q||H.documentElement;try{const rt=H.createElement("div");rt.style.color=U,et.appendChild(rt);const ut=F.getComputedStyle(rt).color;if(rt.remove(),ut&&!ut.includes("var("))return Y.set(U,ut),ut}catch{}}const X=U.match(y);if(X){const Z=(K=X[2])===null||K===void 0?void 0:K.trim();if(Z&&!Z.includes("var("))return Z;const et=X[1].toLowerCase(),rt=et.match(/(?:^|-)([a-z]+)-(\d{2,3})$/);if(rt){const ut=(V=P.TAILWIND_COLORS[rt[1]])===null||V===void 0?void 0:V[rt[2]];if(ut)return ut}if(et.endsWith("-black"))return"#000";if(et.endsWith("-white"))return"#fff";if(et.includes("background")||et.includes("card")||et.includes("surface")||et.includes("bg"))return"Canvas";if(et.includes("border")||et.includes("divider")||et.includes("separator"))return"#ccc";if(et.includes("muted")||et.includes("subtle")||et.includes("secondary")||et.includes("placeholder"))return"#888"}return"currentColor"};for(const U of Array.from(k)){const Q=U.parentElement,K=[U,...Array.from(U.querySelectorAll("*"))];for(const V of K){for(const Z of a){const et=V.getAttribute(Z);et&&(et.includes("var(")||et.includes("light-dark("))&&V.setAttribute(Z,ot(et,Q))}const X=V.getAttribute("style");if(X&&(X.includes("var(")||X.includes("light-dark("))){let Z=X.replace(g,((et,rt)=>rt.trim()));Z=Z.replace(/var\(--[^,)]+(?:,\s*[^)]+)?\)/g,(et=>ot(et,Q))),V.setAttribute("style",Z)}E(V)}v(U)}})(T,D))),$?(W("stripUnwantedAttributes",(()=>c(T,$))),W("removeTrailingHeadings",(()=>s(T))),W("stripExtraBrElements",(()=>q(T))),(0,t.logDebug)(e,"Debug mode: Skipping div flattening to preserve structure")):(W("replaceCustomElements",(()=>(function(B,H){const k=Array.from(B.querySelectorAll("*")).filter((z=>z.tagName.includes("-")&&!P.INLINE_ELEMENTS.has(z.tagName.toLowerCase())&&!(0,t.isSVGElement)(z))).reverse();let F=0;for(const z of k){if(!z.parentNode)continue;const Y=H.createElement("div");for(;z.firstChild;)Y.appendChild(z.firstChild);z.replaceWith(Y),F++}(0,t.logDebug)(e,"Replaced custom elements with divs:",F)})(T,D))),W("convertDataAsSpans",(()=>(function(B,H){let k=0;const F=Array.from(B.querySelectorAll("span[data-as]"));for(const z of F){if(!z.parentNode)continue;const Y=z.getAttribute("data-as").toLowerCase();if(!b.has(Y))continue;const ot=H.createElement(Y);(0,r.transferContent)(z,ot),z.replaceWith(ot),k++}(0,t.logDebug)(e,"Converted data-as spans:",k)})(T,D))),W("convertBlockSpans",(()=>(function(B,H){var k;let F=0;const z=Array.from(B.querySelectorAll('span[class*="block"], span[style*="block"]'));for(const Y of z){if(!Y.parentNode||!(u.test((0,r.getClassName)(Y))||h.test(Y.getAttribute("style")||""))||!(!((k=Y.textContent)===null||k===void 0)&&k.trim()))continue;const ot=H.createElement("p");(0,r.transferContent)(Y,ot),Y.replaceWith(ot),F++}(0,t.logDebug)(e,"Converted block spans to paragraphs:",F)})(T,D))),W("unwrapLayoutTables",(()=>(function(B){const H=Array.from(B.querySelectorAll("table"));let k=0;for(const F of H){if(!F.parentNode||F.querySelector("thead, tfoot, th, caption"))continue;const z=Array.from(F.querySelectorAll(":scope > tbody > tr > td, :scope > tr > td")).filter((U=>{var Q;return(Q=U.textContent)===null||Q===void 0?void 0:Q.trim()}));if(z.length!==1)continue;const Y=z[0],ot=Array.from(Y.children).filter((U=>{var Q;return(Q=U.textContent)===null||Q===void 0?void 0:Q.trim()}));ot.length===1&&P.BLOCK_LEVEL_ELEMENTS.has(ot[0].tagName.toLowerCase())&&(F.replaceWith(ot[0]),k++)}(0,t.logDebug)(e,"Unwrapped layout tables:",k)})(T))),W("flattenWrapperElements[1]",(()=>O(T,D))),W("removePermalinkAnchors",(()=>(0,S.removePermalinkAnchors)(T))),W("stripUnwantedAttributes",(()=>c(T,$))),W("unwrapBareSpans",(()=>(function(B){const H=Array.from(B.querySelectorAll("span")).reverse();let k=0;for(const F of H){if(!F.parentNode||F.attributes.length>0)continue;const z=F.parentNode;if(z){for(;F.firstChild;)z.insertBefore(F.firstChild,F);F.remove(),k++}}k>0&&B.normalize(),(0,t.logDebug)(e,"Unwrapped bare spans:",k)})(T))),W("unwrapSpecialLinks",(()=>{Array.from(T.querySelectorAll("code a")).forEach(f),Array.from(T.querySelectorAll('a[href^="javascript:"]')).forEach(f),Array.from(T.querySelectorAll("a")).forEach((B=>{const H=B.getAttribute("href");if(!H||H.startsWith("#"))return;const k=Array.from(B.children).find((z=>/^H[1-6]$/.test(z.nodeName)));if(!k)return;const F=D.createElement("a");for(F.setAttribute("href",H);k.firstChild;)F.appendChild(k.firstChild);k.appendChild(F),f(B)})),Array.from(T.querySelectorAll('a[href^="#"]')).forEach((B=>{B.querySelector("h1, h2, h3, h4, h5, h6")&&f(B)}))})),W("removeObsoleteElements",(()=>T.querySelectorAll("object, embed, applet").forEach((B=>B.remove())))),W("removeEmptyElements",(()=>(function(B){let H=0;const k=z=>{var Y;if(P.ALLOWED_EMPTY_ELEMENTS.has(z.tagName.toLowerCase()))return!1;if(z.tagName==="DIV"){const Q=z.children;if(Q.length>0){let K=!0;for(let V=0;V<Q.length;V++){const X=Q[V];if(X.tagName!=="SPAN"){K=!1;break}const Z=((Y=X.textContent)===null||Y===void 0?void 0:Y.trim())||"";if(Z!==","&&Z!==""&&Z!==" "){K=!1;break}}if(K)return!0}}const ot=z.textContent||"";if(ot.trim().length>0||ot.includes(" "))return!1;if(!z.hasChildNodes())return!0;const U=z.childNodes;for(let Q=0;Q<U.length;Q++){const K=U[Q];if((0,t.isElement)(K)&&K.tagName.toLowerCase()==="br")continue;if(!(0,t.isTextNode)(K))return!1;const V=K.textContent||"";if(V.trim().length>0||V.includes(" "))return!1}return!0},F=Array.from(B.querySelectorAll("*")).reverse();for(const z of F)z.parentNode&&k(z)&&(z.remove(),H++);(0,t.logDebug)(e,"Removed empty elements:",H)})(T))),W("removeTrailingHeadings",(()=>s(T))),W("removeOrphanedDividers[1]",(()=>i(T))),W("flattenWrapperElements[2]",(()=>O(T,D))),W("removeOrphanedDividers[2]",(()=>i(T))),W("stripExtraBrElements",(()=>q(T))),W("removeEmptyLines",(()=>(function(B,H){let k=0;const F=Date.now(),z=U=>{var Q;if((0,t.isElement)(U)){const K=U.tagName.toLowerCase();if(K==="pre"||K==="code")return}if(Array.from(U.childNodes).forEach(z),(0,t.isTextNode)(U)){const K=U.textContent||"";if(!K||/^[\u200C\u200B\u200D\u200E\u200F\uFEFF]*$/.test(K))(Q=U.parentNode)===null||Q===void 0||Q.removeChild(U),k++;else{const V=K.replace(/[\n\r]+/g," ").replace(/\t+/g," ").replace(/ {2,}/g," ").replace(/^[ ]+$/," ").replace(/\s+([,.!?:;])/g,"$1").replace(/[\u200B\u200D\u200E\u200F\uFEFF]+/g,"").replace(/(?:\xA0){2,}/g," ");V!==K&&(U.textContent=V,k+=K.length-V.length)}}},Y=U=>{var Q;if(!(0,t.isElement)(U))return;const K=U.tagName.toLowerCase();if(K==="pre"||K==="code")return;Array.from(U.childNodes).filter(t.isElement).forEach(Y),U.normalize();const V=((Q=(0,t.getComputedStyle)(U))===null||Q===void 0?void 0:Q.display)==="block",X=V?/^[\n\r\t \u200C\u200B\u200D\u200E\u200F\uFEFF\xA0]*$/:/^[\n\r\t\u200C\u200B\u200D\u200E\u200F\uFEFF]*$/;for(;U.firstChild&&(0,t.isTextNode)(U.firstChild)&&(U.firstChild.textContent||"").match(X);)U.removeChild(U.firstChild),k++;for(;U.lastChild&&(0,t.isTextNode)(U.lastChild)&&(U.lastChild.textContent||"").match(X);)U.removeChild(U.lastChild),k++;if(!V&&P.INLINE_ELEMENTS.has(K)&&U.parentNode&&(k+=N(U,H,"leading"),k+=N(U,H,"trailing")),!V){const Z=Array.from(U.childNodes);for(let et=0;et<Z.length-1;et++){const rt=Z[et],ut=Z[et+1];if((0,t.isElement)(rt)||(0,t.isElement)(ut)){const ht=ut.textContent||"",dt=rt.textContent||"",pt=ht.match(/^[,.!?:;)\]]/),ft=dt.match(/[,.!?:;(\[]\s*$/),Ct=(0,t.isTextNode)(rt)&&(rt.textContent||"").endsWith(" ")||(0,t.isTextNode)(ut)&&(ut.textContent||"").startsWith(" ");if(!pt&&!ft&&!Ct){const St=H.createTextNode(" ");U.insertBefore(St,ut)}}}}};z(B),Y(B);const ot=Date.now();(0,t.logDebug)(e,"Removed empty lines:",{charactersRemoved:k,processingTime:`${(ot-F).toFixed(2)}ms`})})(T,D))))},w.removeOrphanedDividers=i;const P=I(2640),L=I(6e3),_=I(7282),A=I(754),S=I(7864),n=I(2649),t=I(2552),r=I(639);let e=!1;const o=[...L.mathRules,...A.codeBlockRules,...S.headingRules,...n.imageRules,{selector:'div[data-testid^="paragraph"], div[role="paragraph"]',element:"p",transform:(T,R)=>{const D=R.createElement("p");return(0,r.transferContent)(T,D),Array.from(T.attributes).forEach(($=>{P.ALLOWED_ATTRIBUTES.has($.name)&&D.setAttribute($.name,$.value)})),D}},{selector:'div[role="list"]',element:"ul",transform:(T,R)=>{var D;const $=T.querySelector('div[role="listitem"] .label'),M=(((D=$?.textContent)===null||D===void 0?void 0:D.trim())||"").match(/^\d+\)/),W=R.createElement(M?"ol":"ul");return T.querySelectorAll('div[role="listitem"]').forEach((B=>{const H=R.createElement("li"),k=B.querySelector(".content");k&&(k.querySelectorAll('div[role="paragraph"]').forEach((F=>{const z=R.createElement("p");(0,r.transferContent)(F,z),F.replaceWith(z)})),k.querySelectorAll('div[role="list"]').forEach((F=>{var z;const Y=F.querySelector('div[role="listitem"] .label'),ot=(((z=Y?.textContent)===null||z===void 0?void 0:z.trim())||"").match(/^\d+\)/),U=R.createElement(ot?"ol":"ul");F.querySelectorAll('div[role="listitem"]').forEach((Q=>{const K=R.createElement("li"),V=Q.querySelector(".content");V&&(V.querySelectorAll('div[role="paragraph"]').forEach((X=>{const Z=R.createElement("p");(0,r.transferContent)(X,Z),X.replaceWith(Z)})),(0,r.transferContent)(V,K)),U.appendChild(K)})),F.replaceWith(U)})),(0,r.transferContent)(k,H)),W.appendChild(H)})),W}},{selector:'div[role="listitem"]',element:"li",transform:(T,R)=>{const D=T.querySelector(".content");return D?(D.querySelectorAll('div[role="paragraph"]').forEach(($=>{const M=R.createElement("p");(0,r.transferContent)($,M),$.replaceWith(M)})),D):T}}];function s(T){let R=0;const D=M=>{let W="",B=M.nextSibling;for(;B;)((0,t.isTextNode)(B)||(0,t.isElement)(B))&&(W+=B.textContent||""),B=B.nextSibling;if(W.trim())return!0;const H=M.parentElement;return!(!H||H===T)&&D(H)},$=Array.from(T.querySelectorAll("h1, h2, h3, h4, h5, h6")).reverse();for(const M of $){if(D(M))break;M.remove(),R++}R>0&&(0,t.logDebug)(e,"Removed trailing headings:",R)}function i(T){for(;;){let R=T.firstChild;for(;R&&(0,t.isTextNode)(R)&&!(R.textContent||"").trim();)R=R.nextSibling;if(!R||!(0,t.isElement)(R)||R.tagName.toLowerCase()!=="hr")break;R.remove()}for(;;){let R=T.lastChild;for(;R&&(0,t.isTextNode)(R)&&!(R.textContent||"").trim();)R=R.previousSibling;if(!R||!(0,t.isElement)(R)||R.tagName.toLowerCase()!=="hr")break;R.remove()}for(const R of T.querySelectorAll("hr")){if(!R.parentNode)continue;let D=R.nextSibling;for(;D;)if(!(0,t.isTextNode)(D)||(D.textContent||"").trim()){if(!(0,t.isElement)(D)||D.tagName!=="HR")break;{const $=D.nextSibling;D.remove(),D=$}}else D=D.nextSibling}}function c(T,R){let D=0;const $=M=>{if((0,t.isSVGElement)(M))return void(!R&&M.hasAttribute("class")&&(M.removeAttribute("class"),D++));const W=Array.from(M.attributes),B=M.tagName.toLowerCase();W.forEach((H=>{const k=H.name.toLowerCase(),F=H.value;k==="id"&&(F.startsWith("fnref:")||F.startsWith("fn:")||F==="footnotes")||k==="class"&&(B==="code"&&F.startsWith("language-")||F==="footnote-backref"||/^callout(?:-|$)/.test(F))||(R?P.ALLOWED_ATTRIBUTES.has(k)||P.ALLOWED_ATTRIBUTES_DEBUG.has(k)||k.startsWith("data-")||(M.removeAttribute(H.name),D++):P.ALLOWED_ATTRIBUTES.has(k)||(M.removeAttribute(H.name),D++))}))};$(T),T.querySelectorAll("*").forEach($),(0,t.logDebug)(e,"Stripped attributes:",D)}function f(T){for(var R;T.firstChild;)(R=T.parentNode)===null||R===void 0||R.insertBefore(T.firstChild,T);T.remove()}const u=/(?:^|\s)block(?:\s|$)/,h=/display\s*:\s*block/i,b=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote"]),g=/light-dark\(\s*([^,]+?)\s*,\s*[^)]+?\)/g,y=/var\(--([^,)]+)(?:,\s*([^)]+))?\)/,a=["fill","stroke","color","stop-color","flood-color","lighting-color"],d=new Set(["path","rect","circle","ellipse","polygon"]),p=new Set(["line","polyline"]),x=new Set(["text","tspan"]),l="defs, clipPath, mask, pattern, marker";function m(T,R){const D=T.getAttribute("style");return!!D&&new RegExp(`(?:^|;)\\s*${R}\\s*:`).test(D)}function v(T){if(T.querySelector("style"))return;const R=Array.from(T.querySelectorAll("*"));let D=!1;for(const $ of R){const M=$.tagName.toLowerCase();if(d.has(M)&&$.getAttribute("class")&&!$.closest(l)&&!$.hasAttribute("fill")&&!m($,"fill")){D=!0;break}}if(D)for(const $ of R){const M=$.tagName.toLowerCase(),W=d.has(M),B=p.has(M),H=x.has(M);if(!W&&!B&&!H||!$.getAttribute("class")||$.closest(l))continue;if(H){$.hasAttribute("fill")||m($,"fill")||$.setAttribute("fill","currentColor");continue}const k=$.hasAttribute("fill")&&$.getAttribute("fill")!=="none",F=$.hasAttribute("stroke")||m($,"stroke");if(!W||$.hasAttribute("fill")||m($,"fill")||$.setAttribute("fill","none"),!F){if(B)$.setAttribute("stroke","currentColor"),$.hasAttribute("stroke-opacity")||$.setAttribute("stroke-opacity","0.2");else if(W&&!k){const z=$.getAttribute("d")||"";/Z\s*$/i.test(z.trim())||$.setAttribute("stroke","currentColor")}}}}function E(T){var R;const D=T.getAttribute("class");if(!D)return;const $=D.split(/\s+/),M=[],W=[];for(const B of $){let H=B.match(P.TW_COLOR_CLASS_RE);if(H){const[,k,F,z,Y]=H,ot=(R=P.TAILWIND_COLORS[F])===null||R===void 0?void 0:R[z];if(ot){if(Y){const U=parseInt(Y)/100,Q=parseInt(ot.slice(1,3),16),K=parseInt(ot.slice(3,5),16),V=parseInt(ot.slice(5,7),16);T.setAttribute(k,`rgba(${Q},${K},${V},${U})`)}else T.setAttribute(k,ot);continue}}H=B.match(P.TW_SPECIAL_CLASS_RE),H?T.setAttribute(H[1],P.TAILWIND_SPECIAL[H[2]]):(H=B.match(P.TW_ARBITRARY_RE),!H||H[1].startsWith("#")||H[1].startsWith("rgb")||H[1].startsWith("hsl")?B!=="font-semibold"?B!=="font-bold"?B!=="font-medium"?B!=="font-mono"?M.push(B):W.push("font-family:monospace"):W.push("font-weight:500"):W.push("font-weight:700"):W.push("font-weight:600"):W.push(`font-size:${H[1]}`))}if(M.length!==$.length&&(M.length>0?T.setAttribute("class",M.join(" ")):T.removeAttribute("class"),W.length>0)){const B=T.getAttribute("style")||"",H=B&&!B.endsWith(";")?";":"";T.setAttribute("style",B+H+W.join(";"))}}function q(T){let R=0;const D=Date.now(),$=Array.from(T.getElementsByTagName("br"));let M=[];const W=()=>{if(M.length>2)for(let k=2;k<M.length;k++)M[k].remove(),R++;M=[]};$.forEach((k=>{let F=!1;if(M.length>0){const z=M[M.length-1];C(k,"previous")===z&&(F=!0)}F?M.push(k):(W(),M=[k])})),W();const B=Array.from(T.getElementsByTagName("br"));for(const k of B){const F=k.parentElement;if(!F||k.closest("pre, code"))continue;const z=F.tagName.toLowerCase();if(P.BLOCK_LEVEL_ELEMENTS.has(z)||z==="body"){const Y=[k];let ot=C(k,"next");for(;ot&&(0,t.isElement)(ot)&&ot.tagName.toLowerCase()==="br";)Y.push(ot),ot=C(ot,"next");const U=C(Y[0],"previous"),Q=C(Y[Y.length-1],"next"),K=U&&(0,t.isElement)(U)&&P.BLOCK_LEVEL_ELEMENTS.has(U.tagName.toLowerCase()),V=Q&&(0,t.isElement)(Q)&&P.BLOCK_LEVEL_ELEMENTS.has(Q.tagName.toLowerCase());if(K&&V||K&&!Q||!U){for(const X of Y)X.remove(),R++;continue}}P.BLOCK_LEVEL_ELEMENTS.has(z)&&(C(k,"next")||(k.remove(),R++))}const H=Date.now();(0,t.logDebug)(e,"Standardized br elements:",{removed:R,processingTime:`${(H-D).toFixed(2)}ms`})}function C(T,R){var D;const $=R==="previous"?"previousSibling":"nextSibling";let M=T[$];for(;M&&(0,t.isTextNode)(M)&&!(!((D=M.textContent)===null||D===void 0)&&D.trim());)M=M[$];return M}function N(T,R,D){const $=D==="leading"?T.firstChild:T.lastChild;if(!$||!(0,t.isTextNode)($))return 0;const M=$.textContent||"",W=D==="leading"?M.replace(/^\s+/,""):M.replace(/\s+$/,"");if(W===M||!T.parentNode)return 0;$.textContent=W;const B=D==="leading"?T.previousSibling:T.nextSibling;if(!(B&&(0,t.isTextNode)(B)&&(D==="leading"?(B.textContent||"").endsWith(" "):(B.textContent||"").startsWith(" ")))){const H=D==="leading"?T:T.nextSibling;T.parentNode.insertBefore(R.createTextNode(" "),H)}return 1}function O(T,R){let D=0;const $=Date.now();let M=!0;function W(U){var Q;for(const K of U.childNodes)if((0,t.isTextNode)(K)&&(!((Q=K.textContent)===null||Q===void 0)&&Q.trim())||(0,t.isElement)(K)&&P.INLINE_ELEMENTS.has(K.nodeName.toLowerCase()))return!0;return!1}const B=U=>{var Q;const K=U.tagName.toLowerCase();if((0,t.isSVGElement)(U)||P.PRESERVE_ELEMENTS.has(K)||U.getAttribute("data-callout")||!((Q=U.closest)===null||Q===void 0)&&Q.call(U,"[data-callout]"))return!0;const V=U.getAttribute("role");if(V&&["article","main","navigation","banner","contentinfo"].includes(V))return!0;const X=(0,r.getClassName)(U);return X&&X.toLowerCase().match(/(?:article|main|content|footnote|reference|bibliography)/)?!0:!!Array.from(U.children).some((Z=>P.PRESERVE_ELEMENTS.has(Z.tagName.toLowerCase())||Z.getAttribute("role")==="article"||!!(0,r.getClassName)(Z)&&(0,r.getClassName)(Z).toLowerCase().match(/(?:article|main|content|footnote|reference|bibliography)/)))},H=U=>{var Q;if(W(U))return!1;if(!(!((Q=U.textContent)===null||Q===void 0)&&Q.trim()))return!0;const K=Array.from(U.children);if(K.length===0||K.every((Z=>P.BLOCK_LEVEL_ELEMENTS.has(Z.tagName.toLowerCase()))))return!0;const V=(0,r.getClassName)(U).toLowerCase();return/(?:wrapper|container|layout|row|col|grid|flex|outer|inner|content-area)/i.test(V)||Array.from(U.childNodes).filter((Z=>{var et;return(0,t.isTextNode)(Z)&&((et=Z.textContent)===null||et===void 0?void 0:et.trim())})).length===0?!0:!(!(K.length>0)||K.some((Z=>{const et=Z.tagName.toLowerCase();return P.INLINE_ELEMENTS.has(et)})))},k=U=>{var Q,K;if(!U.parentNode||B(U))return!1;const V=U.tagName.toLowerCase();if(!P.ALLOWED_EMPTY_ELEMENTS.has(V)&&!U.children.length&&!(!((Q=U.textContent)===null||Q===void 0)&&Q.trim()))return U.remove(),D++,!0;if(U.parentElement===T){const rt=Array.from(U.children);if(rt.length>0&&!rt.some((ut=>{const ht=ut.tagName.toLowerCase();return P.INLINE_ELEMENTS.has(ht)}))){const ut=R.createDocumentFragment();for(;U.firstChild;)ut.appendChild(U.firstChild);return U.replaceWith(ut),D++,!0}}if(H(U)){const rt=R.createDocumentFragment();for(;U.firstChild;)rt.appendChild(U.firstChild);return U.replaceWith(rt),D++,!0}const X=Array.from(U.childNodes);if(X.length>0&&X.every((rt=>(0,t.isTextNode)(rt)||(0,t.isElement)(rt)&&P.INLINE_ELEMENTS.has(rt.nodeName.toLowerCase())))&&(!((K=U.textContent)===null||K===void 0)&&K.trim())){const rt=R.createElement("p");for(;U.firstChild;)rt.appendChild(U.firstChild);return U.replaceWith(rt),D++,!0}if(U.children.length===1){const rt=U.firstElementChild,ut=rt.tagName.toLowerCase();if(P.BLOCK_ELEMENTS_SET.has(ut)&&!B(rt))return U.replaceWith(rt),D++,!0}let Z=0,et=U.parentElement;for(;et;){const rt=et.tagName.toLowerCase();P.BLOCK_ELEMENTS_SET.has(rt)&&Z++,et=et.parentElement}if(Z>0&&!W(U)){const rt=R.createDocumentFragment();for(;U.firstChild;)rt.appendChild(U.firstChild);return U.replaceWith(rt),D++,!0}return!1},F=()=>{const U=Array.from(T.children).filter((K=>P.BLOCK_ELEMENTS_SET.has(K.tagName.toLowerCase())));let Q=!1;return U.forEach((K=>{k(K)&&(Q=!0)})),Q},z=()=>{const U=Array.from(T.querySelectorAll(P.BLOCK_ELEMENTS_SELECTOR)).sort(((K,V)=>{const X=Z=>{let et=0,rt=Z.parentElement;for(;rt;){const ut=rt.tagName.toLowerCase();P.BLOCK_ELEMENTS_SET.has(ut)&&et++,rt=rt.parentElement}return et};return X(V)-X(K)}));let Q=!1;return U.forEach((K=>{k(K)&&(Q=!0)})),Q},Y=()=>{const U=Array.from(T.querySelectorAll(P.BLOCK_ELEMENTS_SELECTOR));let Q=!1;return U.forEach((K=>{const V=Array.from(K.children);if(V.length>0&&V.every((X=>X.tagName.toLowerCase()==="p"))||!B(K)&&H(K)){const X=R.createDocumentFragment();for(;K.firstChild;)X.appendChild(K.firstChild);K.replaceWith(X),D++,Q=!0}})),Q};do M=!1,F()&&(M=!0),z()&&(M=!0),Y()&&(M=!0);while(M);const ot=Date.now();(0,t.logDebug)(e,"Flattened wrapper elements:",{count:D,processingTime:`${(ot-$).toFixed(2)}ms`})}},2552(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.CJK_CHAR_RANGES=void 0,w.isElement=function(A){return A.nodeType===I},w.isTextNode=function(A){return A.nodeType===P},w.isCommentNode=function(A){return A.nodeType===L},w.isSVGElement=function(A){var S;return((S=A.closest)===null||S===void 0?void 0:S.call(A,"svg"))!==null||A.namespaceURI==="http://www.w3.org/2000/svg"},w.getComputedStyle=function(A){const S=_(A.ownerDocument);return S&&typeof S.getComputedStyle=="function"?S.getComputedStyle(A):null},w.getWindow=_,w.textPreview=function(A){return(A.textContent||"").trim().substring(0,200)},w.logDebug=function(A,S,...n){A&&console.log("Defuddle:",S,...n)},w.normalizeText=function(A){return A.replace(/\u00A0/g," ").replace(/[\u2018\u2019\u201A\u201B]/g,"'").replace(/[\u2012\u2013\u2014\u2015]/g,"-").replace(/[\u201C\u201D\u201E\u201F]/g,'"').replace(/\u2026/g,"...").replace(/\s+/g," ").trim().toLowerCase()},w.countWords=function(A){if(!A)return 0;let S=0,n=0,t=!1;for(let r=0;r<A.length;r++){const e=A.charCodeAt(r);e>=12352&&e<=12447||e>=12448&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=63744&&e<=64255||e>=44032&&e<=55215?(S++,t=!1):e<=32?t=!1:t||(n++,t=!0)}return S+n};const I=1,P=3,L=8;function _(A){return A.defaultView?A.defaultView:A.ownerWindow?A.ownerWindow:A.window?A.window:null}w.CJK_CHAR_RANGES="\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\uac00-\\ud7af"},6618(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.bbcodeToHtml=function(L){let _=L;return _=_.replace(/\[h1\]([\s\S]*?)\[\/h1\]/gi,"<h1>$1</h1>"),_=_.replace(/\[h2\]([\s\S]*?)\[\/h2\]/gi,"<h2>$1</h2>"),_=_.replace(/\[h3\]([\s\S]*?)\[\/h3\]/gi,"<h3>$1</h3>"),_=_.replace(/\[b\]([\s\S]*?)\[\/b\]/gi,"<strong>$1</strong>"),_=_.replace(/\[i\]([\s\S]*?)\[\/i\]/gi,"<em>$1</em>"),_=_.replace(/\[u\]([\s\S]*?)\[\/u\]/gi,"<u>$1</u>"),_=_.replace(/\[s\]([\s\S]*?)\[\/s\]/gi,"<s>$1</s>"),_=_.replace(/\[url=["']?([^"'\]]+)["']?\]([\s\S]*?)\[\/url\]/gi,((A,S,n)=>(0,P.isDangerousUrl)(S)?n:`<a href="${S}">${n}</a>`)),_=_.replace(/\[img\]([\s\S]*?)\[\/img\]/gi,'<img src="$1">'),_=_.replace(/\[previewyoutube=["']?([^;'"]+)[^"'\]]*["']?\]\[\/previewyoutube\]/gi,'<img src="https://www.youtube.com/watch?v=$1">'),_=_.replace(/\[list\]([\s\S]*?)\[\/list\]/gi,((A,S)=>`<ul>${S.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\]|$)/gi,"<li>$1</li>")}</ul>`)),_=_.replace(/\[olist\]([\s\S]*?)\[\/olist\]/gi,((A,S)=>`<ol>${S.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/olist\]|$)/gi,"<li>$1</li>")}</ol>`)),_=_.replace(/\[quote(?:=[^\]]+)?\]([\s\S]*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>"),_=_.replace(/\[code\]([\s\S]*?)\[\/code\]/gi,"<pre><code>$1</code></pre>"),_=_.replace(/\[spoiler\]([\s\S]*?)\[\/spoiler\]/gi,"<details><summary>Spoiler</summary>$1</details>"),_=_.replace(/\[p\]([\s\S]*?)\[\/p\]/gi,((A,S)=>`<p>${S.replace(/\n/g,"<br>")}</p>`)),_=_.replace(/\n/g,"<br>"),_=_.replace(/\[[^\]]+\]/g,""),_};const P=I(639)},6077(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.buildContentHtml=function(_,A,S){return`
|
|
80
|
+
<article data-defuddle>
|
|
81
|
+
<div class="${_} post">
|
|
82
|
+
<div class="post-content">
|
|
83
|
+
${A}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
${S?`
|
|
87
|
+
<hr>
|
|
88
|
+
<div class="${_} comments">
|
|
89
|
+
<h2>Comments</h2>
|
|
90
|
+
${S}
|
|
91
|
+
</div>
|
|
92
|
+
`:""}
|
|
93
|
+
</article>
|
|
94
|
+
`.trim()},w.buildCommentTree=function(_){var A,S,n;const t=[],r=[];for(const e of _){const o=(A=e.depth)!==null&&A!==void 0?A:0;if(o===0){for(;r.length>0;)t.push("</blockquote>"),r.pop();t.push("<blockquote>"),r.push(0)}else{if(o<((S=r[r.length-1])!==null&&S!==void 0?S:-1))for(;r.length>0&&r[r.length-1]>=o;)t.push("</blockquote>"),r.pop();o>((n=r[r.length-1])!==null&&n!==void 0?n:-1)&&(t.push("<blockquote>"),r.push(o))}t.push(L(e))}for(;r.length>0;)t.push("</blockquote>"),r.pop();return t.join("")},w.buildComment=L,w.buildQuotedPost=function(_){let A="";_.author&&(A+=`<p><strong>${(0,P.escapeHtml)(_.author)}</strong>`,_.date&&(A+=` · ${(0,P.escapeHtml)(_.date)}`),A+="</p>");let S="";if(_.url){const n=(0,P.isDangerousUrl)(_.url)?"":_.url;n&&(S=`
|
|
95
|
+
<p><a href="${(0,P.escapeHtml)(n)}">${(0,P.escapeHtml)(n)}</a></p>`)}return`<blockquote class="quoted-post">${A}${_.content}${S}</blockquote>`};const P=I(639);function L(_){const A=`<span class="comment-author"><strong>${(0,P.escapeHtml)(_.author)}</strong></span>`,S=_.url&&!(0,P.isDangerousUrl)(_.url)?_.url:"";return`<div class="comment">
|
|
96
|
+
<div class="comment-metadata">
|
|
97
|
+
${A} · ${S?`<a href="${(0,P.escapeHtml)(S)}" class="comment-link">${(0,P.escapeHtml)(_.date)}</a>`:`<span class="comment-date">${(0,P.escapeHtml)(_.date)}</span>`}${_.score?` · <span class="comment-points">${(0,P.escapeHtml)(_.score)}</span>`:""}
|
|
98
|
+
</div>
|
|
99
|
+
<div class="comment-content">${_.content}</div>
|
|
100
|
+
</div>`}},639(at,w){Object.defineProperty(w,"__esModule",{value:!0}),w.transferContent=function(P,L){if("replaceChildren"in L)L.replaceChildren();else for(;L.firstChild;)L.removeChild(L.firstChild);for(;P.firstChild;)L.appendChild(P.firstChild)},w.serializeHTML=function(P){return P.innerHTML},w.decodeHTMLEntities=function(P,L){const _=P.createElement("textarea");return _.innerHTML=L,_.value},w.escapeHtml=function(P){return P.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},w.getClassName=function(P){return typeof P.className=="string"?P.className:P.getAttribute("class")||""},w.hasResponsiveShowClass=function(P){return P.split(/\s+/).some((L=>I.test(L)))},w.isDangerousUrl=function(P,L=!0){const _=P.replace(/[\s\u0000-\u001F]+/g,"").toLowerCase();return _.startsWith("javascript:")||_.startsWith("blob:")?!0:_.startsWith("data:")?!(L&&_.startsWith("data:image/")):!1},w.isDirectTableChild=function(P,L){let _=P.parentNode;for(;_&&_!==L;){if(_.nodeName==="TABLE")return!1;_=_.parentNode}return _===L},w.parseHTML=function(P,L){if(!L)return P.createDocumentFragment();const _=P.createElement("template");if(_.innerHTML=L,_.content)return _.content;const A=P.createElement("div");A.innerHTML=L;const S=P.createDocumentFragment();for(;A.firstChild;)S.appendChild(A.firstChild);return S};const I=/^(sm|md|lg|xl|2xl|min-\[|max-\[):(?:block|flex|grid|inline|table|contents)/},1497(at,w,I){Object.defineProperty(w,"__esModule",{value:!0}),w.formatTimestamp=L,w.buildTranscript=function(_,A,S=[]){const n=[...S].sort(((o,s)=>o.start-s.start));let t=0;const r=[],e=[];for(const o of A){for(;t<n.length&&n[t].start<=o.start;){const f=n[t].title;r.push(`<h3>${(0,P.escapeHtml)(f)}</h3>`),e.length>0&&e.push(""),e.push(`### ${f}`),e.push(""),t++}const s=L(o.start),i=o.speaker!==void 0?` speaker-${o.speaker}`:"",c=`<strong><span class="timestamp" data-timestamp="${o.start}">${s}</span></strong>`;r.push(`<p class="transcript-segment${i}">${c} · ${(0,P.escapeHtml)(o.text)}</p>`),o.speakerChange&&e.length>0&&e.push(""),e.push(`**${s}** · ${o.text}`)}return{html:`<div class="${_} transcript">
|
|
101
|
+
<h2>Transcript</h2>
|
|
102
|
+
${r.join(`
|
|
103
|
+
`)}
|
|
104
|
+
</div>`,text:e.join(`
|
|
105
|
+
`)}};const P=I(639);function L(_){const A=Math.floor(_/3600),S=Math.floor(_%3600/60),n=Math.floor(_%60);return A>0?`${A}:${String(S).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${S}:${String(n).padStart(2,"0")}`}}},xt={};function Tt(at){var w=xt[at];if(w!==void 0)return w.exports;var I=xt[at]={exports:{}};return $t[at].call(I.exports,I,I.exports,Tt),I.exports}var qt={};return(()=>{var at=qt;const w=Tt(5628);at.default=w.Defuddle})(),qt=qt.default})()))})(Dt)),Dt.exports}var oe=ge();const ve=me(oe),be=fe({__proto__:null,default:ve},[oe]);export{be as i};
|