mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-25 04:32:31 +01:00
1 line
73 KiB
JavaScript
1 line
73 KiB
JavaScript
(()=>{var e={110:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cloneNode=function e(t,n){return i(this,void 0,void 0,(function*(){const{root:c,filter:u}=n;if(!c&&u&&!u(t))return null;let d=yield function(e,t){try{if(e instanceof HTMLCanvasElement&&(null==t?void 0:t.images))return(0,r.createImage)(e.toDataURL(),null==t?void 0:t.fetchOptions);if(!(null==t?void 0:t.images)&&e instanceof HTMLImageElement)return null;if(!(null==t?void 0:t.styles)&&(e instanceof HTMLButtonElement||e instanceof HTMLFormElement||e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return null;if(e.nodeType===Node.COMMENT_NODE)return null;if((n=e)&&n.tagName&&a.includes(n.tagName.toLowerCase()))return null;if(e.nodeType!==Node.TEXT_NODE&&!l(e)){const{display:t,width:n,height:i}=window.getComputedStyle(e);if("none"===t||"0px"===n&&"0px"===i)return null;if(function(e){return!(!e||!e.tagName)&&!s.includes(e.tagName.toLowerCase())&&e.tagName.includes("-")}(e)){const n=t.includes("inline"),i=document.createElement(n?"span":"div");for(const t of e.attributes)i.setAttribute(t.name,t.value);return i}}return e.cloneNode(!1)}catch(e){return console.error("Failed to clone element",e),null}var n}(t,n);if(!d)return null;d=yield function(t,n,r){return i(this,void 0,void 0,(function*(){const o=t.childNodes;return 0===o.length||(yield function(t,n,r){return i(this,void 0,void 0,(function*(){for(const i of n){const n=yield e(i,Object.assign(Object.assign({},r),{root:!1}));n&&t.appendChild(n)}}))}(n,o,r)),n}))}(t,d,n);const h=function(e,t,n){return t instanceof Element?(n.styles&&(function(e,t,n){const{getElementStyles:i}=n,r=i&&i(e);if(!r)return;var o,s;t.style.cssText=r.cssText,"body"===e.tagName.toLowerCase()&&(o=getComputedStyle(e),(s=t.style).font=o.font,s.fontFamily=o.fontFamily,s.fontFeatureSettings=o.fontFeatureSettings,s.fontKerning=o.fontKerning,s.fontSize=o.fontSize,s.fontStretch=o.fontStretch,s.fontStyle=o.fontStyle,s.fontVariant=o.fontVariant,s.fontVariantCaps=o.fontVariantCaps,s.fontVariantEastAsian=o.fontVariantEastAsian,s.fontVariantLigatures=o.fontVariantLigatures,s.fontVariantNumeric=o.fontVariantNumeric,s.fontVariationSettings=o.fontVariationSettings,s.fontWeight=o.fontWeight);const a=t.getAttribute("style");a&&t.setAttribute("style",a.replace(/(:?[:;])(:? +)/gm,((e,t)=>t)))}(e,t,n),function(e,t,n){const{getPseudoElementStyles:i}=n;let r=!1;const s=document.createElement("style"),a=`pseudo--${(0,o.uid)()}`;for(const t of[":before",":after"]){const n=i&&i(e,t)||getComputedStyle(e,t);if(!n.cssText)continue;const o=`.${a}:${t} {\n ${n.cssText}\n }`;s.appendChild(document.createTextNode(o)),r=!0}r&&(t.className=a,t.appendChild(s))}(e,t,n)),function(e){const t=["href","src"],n=window.location.href;for(const i of t){const t=e.getAttribute(i),r=(null==t?void 0:t.startsWith("http"))?void 0:t;if(r){const t=new URL(r,n).href;e.setAttribute(i,t)}}}(t),function(e,t){(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&t.setAttribute("value",e.value)}(e,t),function(e){e instanceof SVGElement&&(e.setAttribute("xmlns","http://www.w3.org/2000/svg"),["width","height"].forEach((function(t){const n=e.getAttribute(t);n&&!e.style.getPropertyValue(t)&&e.style.setProperty(t,n)})))}(t),t):t}(t,d,n);return h}))},t.isSVGElement=l;const r=n(32),o=n(787),s=["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"].map((e=>e.toLowerCase())),a=["script"].map((e=>e.toLowerCase()));function l(e){return!(!e||!e.tagName)&&s.includes(e.tagName.toLowerCase())}},136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenize=function(e){return function(e){return u="",e}(function(e){for(;d();)switch(f(c)){case 0:r(m(l-1),e);break;case 2:r(h(l-1,g(91===(t=c)?t+2:40===t?t+1:t)).trim(),e);break;default:r(n(c),e)}var t;return e}(function(e){return o=s=1,a=function(e){return e.length}(u=e),l=0,[]}(e)))};const n=String.fromCharCode;function i(e,t){return 0|e.charCodeAt(t)}function r(e,t){return t.push(e),e}let o=1,s=1,a=0,l=0,c=0,u="";function d(){return c=l<a?i(u,l++):0,s++,10===c&&(s=1,o++),c}function h(e,t){return function(e,t,n){return e.slice(t,n)}(u,e,t)}function f(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 42:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function g(e){for(;d();)switch(c){case e:return l;case 34:case 39:34!==e&&39!==e&&g(c);break;case 40:41===e&&g(e);break;case 92:d()}return l}function m(e){for(;!f(i(u,l));)d();return h(e,l)}},917:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.toJpeg=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL("image/jpeg",t.quality||1)}))},t.toBlob=function(e,t){return t.raster=!0,f(e,t).then((e=>e&&(0,l.canvasToBlob)(e)))},t.toCanvas=function(e,t){return t.raster=!0,f(e,t)},t.toPixelData=function(e,t){return(t=t||{}).raster=!0,f(e,t).then((function(t){var n;return null===(n=null==t?void 0:t.getContext("2d"))||void 0===n?void 0:n.getImageData(0,0,(0,l.width)(e),(0,l.height)(e)).data}))},t.toPng=function(e,t){return t.raster=!0,f(e,t).then((function(e){return null==e?void 0:e.toDataURL()}))},t.toSvg=h,t.getInlinedNode=d;const r=n(110),o=n(32),s=n(663),a=n(261),l=n(787),c=n(69),u={inlineOptions:{}};function d(e,t){return i(this,void 0,void 0,(function*(){const{fonts:n,images:i,stylesheets:o,inlineImages:l}=t.inlineOptions||{};o&&(yield(0,c.inlineStylesheets)(t.fetchOptions));const u=getComputedStyle(document.documentElement),d=o?yield(0,c.cacheStylesheets)(u):void 0;let h=yield(0,r.cloneNode)(e,{styles:t.styles,filter:t.filter,root:!0,vector:!t.raster,fetchOptions:t.fetchOptions,getElementStyles:null==d?void 0:d.get,getPseudoElementStyles:null==d?void 0:d.getPseudo,images:i});if(h&&!(h instanceof Text))return n&&(h=yield function(e,t){return(0,s.resolveAll)(t).then((function(t){const n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}(h,t.fetchOptions)),l&&(yield(0,a.inlineAllImages)(h,t.fetchOptions)),function(e){for(const t of e.querySelectorAll("*"))if(t instanceof HTMLElement&&!(0,r.isSVGElement)(t)){for(const e of Array.from(t.attributes))"class"===e.name&&t.className.includes("pseudo--")||g.includes(e.name)||t.removeAttribute(e.name);t instanceof HTMLAnchorElement&&(t.href=t.href.startsWith("http")?t.href:document.location.origin+t.href)}}(h),h}))}function h(e,t){return i(this,void 0,void 0,(function*(){t.inlineOptions=Object.assign({fonts:!0,images:!0,stylesheets:!0},t.inlineOptions);let n=yield d(e,t);if(n)return n=function(e,t){return t.backgroundColor&&(e.style.backgroundColor=t.backgroundColor),t.width&&(e.style.width=t.width+"px"),t.height&&(e.style.height=t.height+"px"),e}(n,t),function(e,t,n){e.setAttribute("xmlns","http://www.w3.org/1999/xhtml");return'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'"><foreignObject x="0" y="0" width="100%" height="100%">'+(0,l.escapeXhtml)((new XMLSerializer).serializeToString(e))+"</foreignObject></svg>"}(n,t.width||(0,l.width)(e),t.height||(0,l.height)(e))}))}function f(e,t){return t=Object.assign(Object.assign({},u),t),h(e,t).then((e=>e?(0,o.createImage)(e,t.fetchOptions):null)).then((0,l.delay)(0)).then((function(n){const i="number"!=typeof t.scale?1:t.scale,r=function(e,t,n){const i=document.createElement("canvas");if(i.width=(n.width||(0,l.width)(e))*t,i.height=(n.height||(0,l.height)(e))*t,n.backgroundColor){const e=i.getContext("2d");if(!e)return null;e.fillStyle=n.backgroundColor,e.fillRect(0,0,i.width,i.height)}return i}(e,i,t),o=null==r?void 0:r.getContext("2d");return o?(o.imageSmoothingEnabled=!1,n&&(o.scale(i,i),o.drawImage(n,0,0)),r):null}))}const g=["src","href","title","style","srcset","sizes","width","height","target","rel"]},32:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};function i(e,t){if(!e.startsWith("http"))return e;if((null==t?void 0:t.noCache)&&(e+=(/\?/.test(e)?"&":"?")+Date.now()),(null==t?void 0:t.bypassCors)&&(null==t?void 0:t.corsHost)){if(e.startsWith(t.corsHost))return e;e=`${t.corsHost}/${e}`}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.fetchResource=function(e,t){return n(this,void 0,void 0,(function*(){if(!e)return null;const n=yield fetch(i(e,t));if(!n.ok)return"";const r=yield n.blob(),o=new FileReader;return o.readAsDataURL(r),new Promise((e=>{o.addEventListener("loadend",(()=>{"string"==typeof o.result&&e(o.result)}))}))}))},t.createImage=function(e,t){return"data:,"===e?Promise.resolve(null):new Promise((function(n,r){const o=new Image;o.crossOrigin=(null==t?void 0:t.crossOrigin)||null,o.onload=function(){n(o)},o.onerror=r,o.src=i(e,t)}))},t.reloadImage=function(e,t){return t.corsHost&&e.currentSrc.startsWith(t.corsHost)?Promise.resolve(null):(t.noCache=!0,new Promise((function(n,r){e.crossOrigin=t.crossOrigin||null,e.onload=function(){n(e)},e.onerror=t=>{console.error("Failed to load image",e.currentSrc),r(t)},e.src=i(e.currentSrc,t)})))},t.constructUrl=i},663:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAll=function(e){return i(this,void 0,void 0,(function*(){const t=s(function(e){const t=[];for(const n of e)try{const e=s(Array.from(n.cssRules));e.length>3&&t.push(e[0])}catch(e){e instanceof Error&&console.log("Error while reading CSS rules from "+n.href,e.toString())}return t}(document.styleSheets)).map(o),n=[];for(const i of t)n.push(yield i.resolve(e));return n.join("\n")}))};const r=n(783);function o(e){return{resolve:function(t){const n=(e.parentStyleSheet||{}).href||void 0;return(0,r.inlineAll)(e.cssText,t,n)},src:function(){return e.style.getPropertyValue("src")}}}function s(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return(0,r.shouldProcess)(e.style.getPropertyValue("src"))}))}},261:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineAllImages=function(e,t){return i(this,void 0,void 0,(function*(){const n=e.querySelectorAll("img"),i=[];for(let e=0;e<n.length;++e){const r=n[e];i.push(a(r,t))}const r=e.querySelectorAll('[style*="background-image:"],[style*="background:"]');for(let e=0;e<r.length;++e){const n=r[e];i.push(l(n,t))}yield Promise.all(i).catch((e=>console.error(e)))}))};const r=n(32),o=n(783),s=n(787);function a(e,t){return i(this,void 0,void 0,(function*(){if((0,s.isDataUrl)(e.currentSrc))return Promise.resolve(null);const n=yield(0,r.fetchResource)(e.currentSrc||e.src,t);return n?"data:,"===n?(e.removeAttribute("src"),e):new Promise((function(t,i){var r,o;"PICTURE"===(null===(r=e.parentElement)||void 0===r?void 0:r.tagName)&&(null===(o=e.parentElement)||void 0===o||o.replaceWith(e)),e.onload=()=>t(e),e.onerror=e=>i(e),e.src=n,e.removeAttribute("srcset")})):null}))}function l(e,t){return i(this,void 0,void 0,(function*(){const n=e.style.getPropertyValue("background-image");if(!n)return e;const i=yield(0,o.inlineAll)(n,t);return e.style.setProperty("background-image",i),e}))}},590:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.clipPage=function(e,t,n){return i(this,void 0,void 0,(function*(){const{body:i,head:r}=yield v(e,n,t);return i&&r?`<!doctype html>\n${p(r,i).documentElement.outerHTML}`:null}))},t.clipArticle=function(e,t){return i(this,void 0,void 0,(function*(){const{body:n,head:i}=yield v(e,t);if(!n||!i)return null;const o=p(i,n),s=new r.Readability(o);s.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];const a=s.parse();return`<!DOCTYPE html><html>${(null==i?void 0:i.outerHTML)||""}<body>${(null==a?void 0:a.content)||""}</body></html>`}))},t.cleanup=y,t.clipScreenshot=function(e){return i(this,arguments,void 0,(function*(e,t="jpeg",n){const i=e||document.body,r="jpeg"===t?a.toJpeg:"png"===t?a.toPng:a.toBlob,o=yield r(i,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:b(n),inlineOptions:{fonts:!0,images:!0,stylesheets:!0},styles:!0});return"jpeg"===t||"png"===t?`<img width="${document.body.scrollWidth}px" height="${document.body.scrollHeight}px" src="${o}" />`:o}))},t.enterNodeSelectionMode=function(e,t){return setTimeout((()=>{!function(e){e.body.addEventListener("click",g)}(e),function(e){e.body.addEventListener("mouseout",f),e.body.addEventListener("mouseover",h)}(e)}),0),function(){const e=`.${l.nodeHover} {\n border: 1px solid green;\n background-color: rgb(0,0,0,0.05);\n cursor: pointer;\n }\n\n .${l.nodeSelected} {\n border: 2px solid green;\n cursor: pointer;\n }\n\n .${l.nodeSelectionContainer} {\n position: fixed;\n bottom: 0px;\n right: 0px;\n z-index: ${Number.MAX_VALUE};\n }`;(0,o.injectCss)(e,"nn-clipper-styles")}(),new Promise(((e,n)=>{!function(e,t){const n=document.createElement("div");n.classList.add(l.nodeSelectionContainer),setTimeout((()=>{document.body.appendChild(n)}),0),(0,s.app)({init:{isClipping:!1},view:({isClipping:n})=>(0,s.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,s.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,s.text)("Notesnook Web Clipper")]),(0,s.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[n?(0,s.text)("Clipping selected elements. Please wait..."):(0,s.text)("Click on any element to select it.")]),(0,s.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,s.h)("button",{onclick:t=>[Object.assign(Object.assign({},t),{isClipping:!0}),t=>{null==e||e(),t({isClipping:!1})}],style:{marginRight:"5px"},disabled:n},[n?(0,s.text)("Clipping..."):(0,s.text)("Clip")]),(0,s.h)("button",{onclick:e=>(y(),null==t||t(),e),disabled:n},[(0,s.text)("Cancel")])])]),node:n})}((()=>i(this,void 0,void 0,(function*(){y();const n=document.querySelectorAll(`.${l.nodeSelected}`),i=document.createElement("div");for(const e of n){e.classList.remove(l.nodeSelected);const n=yield(0,a.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:u});n&&i.appendChild(n)}e(null==i?void 0:i.outerHTML)}))),(()=>n("Cancelled.")))}))};const r=n(107),o=n(787),s=n(482),a=n(917),l={nodeHover:"nn-node-selection--hover",nodeSelected:"nn-node-selection--selected",nodeSelectionContainer:"nn-node-selection-container"},c=[l.nodeSelected,l.nodeSelectionContainer],u={fonts:!1,images:!0,stylesheets:!0};function d(e){for(const t of c)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}const h=e=>{const t=e.target;!t.classList.contains(l.nodeHover)&&d(t)&&t.classList.add(l.nodeHover)},f=e=>{const t=e.target;t.classList.contains(l.nodeHover)&&t.classList.remove(l.nodeHover)},g=e=>{e.preventDefault();const t=e.target;t.classList.contains(l.nodeSelected)?t.classList.remove(l.nodeSelected):d(t)&&t.classList.add(l.nodeSelected)};function m(e){e.nodeType!==Node.TEXT_NODE&&e.getBoundingClientRect||!e.parentElement||(e=e.parentElement);const t=function(e){const t={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},n=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth,o=n.left>=0&&n.left+n.width<=r,s=n.top>=0&&n.top+n.height<=i;t.isInsideViewport=o&&s;const a=n.left<0&&n.left+n.width>r,l=n.top<0&&n.top+n.height>i;t.isAroundViewport=a&&l;const c=n.top<0&&n.top+n.height>0,u=n.left<r&&n.left+n.width>r,d=n.left<0&&n.left+n.width>0,h=n.top<i&&n.top+n.height>i,f=s||l||c||h,g=o||a||d||u;t.isOnTopEdge=c&&g,t.isOnRightEdge=u&&f,t.isOnBottomEdge=h&&g,t.isOnLeftEdge=d&&f,t.isOnEdge=t.isOnLeftEdge||t.isOnRightEdge||t.isOnTopEdge||t.isOnBottomEdge;const m=o||a||t.isOnLeftEdge||t.isOnRightEdge,p=s||l||t.isOnTopEdge||t.isOnBottomEdge;return t.isInViewport=m&&p,t.isPartiallyInViewport=t.isInViewport&&t.isOnEdge,t}(e);return t.isInViewport}function p(e,t){const n=document.implementation.createHTMLDocument();return n.documentElement.replaceChildren(e,t),n}function y(){setTimeout((()=>{var e;document.querySelectorAll(`.${l.nodeSelected}`).forEach((e=>{e instanceof HTMLElement&&e.classList.remove(l.nodeSelected)})),document.querySelectorAll(`.${l.nodeSelectionContainer}`).forEach((e=>e.remove())),(e=document).body.removeEventListener("mouseout",f),e.body.removeEventListener("mouseover",h),document.body.removeEventListener("click",g)}),0)}function v(e,t){return i(this,arguments,void 0,(function*(e,t,n=!1){const i=yield(0,a.getInlinedNode)(e.body,{raster:!0,fetchOptions:b(t),inlineOptions:{fonts:!1,inlineImages:null==t?void 0:t.inlineImages,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},styles:null==t?void 0:t.styles,filter:e=>!n||m(e)});if(!i)return{};const r=e.createElement("head"),o=e.createElement("title");return o.innerText=e.title,r.appendChild(o),{body:i,head:r}}))}function b(e){return(null==e?void 0:e.corsProxy)?{bypassCors:!0,corsHost:e.corsProxy,crossOrigin:"anonymous",noCache:!0}:void 0}},783:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldProcess=a,t.inlineAll=function(e,t,n){return i(this,void 0,void 0,(function*(){if(!a(e))return e;const i=l(e);let r=e;for(const e of i)r=yield c(r,e,t,n);return r}))},t.readUrls=l;const r=n(32),o=n(787),s=/url\(['"]?([^'"]+?)['"]?\)/g;function a(e){return-1!==e.search(s)}function l(e){const t=[];let n;for(;null!==(n=s.exec(e));)t.push(n[1]);return t.filter((function(e){return!(0,o.isDataUrl)(e)}))}function c(e,t,n,s){return i(this,void 0,void 0,(function*(){t=s?(0,o.resolveUrl)(t,s):t;const i=yield(0,r.fetchResource)(t,n);return e.replace((a=t,new RegExp("(url\\(['\"]?)("+(0,o.escape)(a)+")(['\"]?\\))","g")),"$1"+i+"$3");var a}))}},69:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineStylesheets=function(e){return i(this,void 0,void 0,(function*(){for(const t of document.styleSheets)yield f(t,e);yield function(e){return i(this,void 0,void 0,(function*(){for(const t of document.styleSheets){const n=[];if(!(yield f(t,e))){for(let i=0;i<t.cssRules.length;++i){const r=t.cssRules.item(i);if(r&&r.type===CSSRule.IMPORT_RULE){const o=r.href,s=yield c(o,e);s&&(t.ownerNode?t.ownerNode.before(s):document.head.appendChild(s),n.push(i))}}for(const e of n)t.deleteRule(e)}}}))}(e)}))},t.cacheStylesheets=function(e){return i(this,void 0,void 0,(function*(){const t=new Map,n=new Map;for(const i of document.styleSheets){if(yield f(i))continue;let r=i.href||void 0;!r&&i.ownerNode instanceof HTMLElement&&(r=i.ownerNode.getAttribute("href")||void 0),u(i.cssRules,e,t,n,r)}return{getPseudo(t,i){var r;const o=null===(r=n.get(t))||void 0===r?void 0:r.filter((e=>e.pseudoElement.includes(i)));if(o&&o.length)return d(t,o,e)},get(n){const i=t.get(n);if(!i)return;const r=i.sort(((e,t)=>(0,o.compare)(e.specificity,t.specificity)));return r.push({rule:n.style,specificity:[0,0,0,0],href:null}),d(n,r,e)}}}))};const r=n(32),o=n(302),s=n(136),a=n(763),l=["animation","background","border","border-block-end","border-block-start","border-bottom","border-color","border-image","border-inline-end","border-inline-start","border-left","border-radius","border-right","border-style","border-top","border-width","column-rule","columns","contain-intrinsic-size","flex","flex-flow","font","gap","grid","grid-area","grid-column","grid-row","grid-template","grid-gap","list-style","margin","mask","offset","outline","overflow","padding","place-content","place-items","place-self","scroll-margin","scroll-padding","text-decoration","text-emphasis","transition"];function c(e,t){return i(this,void 0,void 0,(function*(){try{const n=document.createElement("style"),i=yield fetch((0,r.constructUrl)(e,t));return!!i.ok&&(n.innerText=yield i.text(),n.setAttribute("href",e),n)}catch(t){console.error("Failed to inline stylesheet",e,t)}}))}function u(e,t,n,i,r){for(const a of e)if(a instanceof CSSStyleRule){if((s=a.selectorText).includes(":before")||s.includes(":after")||s.includes("::after")||s.includes("::before")){const e=p(a.selectorText);for(const t of e){if(!t||!t.selector.trim())continue;const e=document.querySelectorAll(t.selector);for(const n of e){if(!(n instanceof HTMLElement||n instanceof SVGElement))continue;const e=i.get(n)||[];i.set(n,e),e.push({rule:a.style,href:m(r),pseudoElement:t.pseudoElement})}}}const e=document.querySelectorAll(a.selectorText);for(const t of e){if(!(t instanceof HTMLElement||t instanceof SVGElement))continue;const e=a.selectorText.split(","),i=n.get(t)||[];n.set(t,i);for(const t of e)try{const e=(0,o.calculate)(t)[0];i.push({specificity:e.specificityArray,rule:a.style,href:m(r)});break}catch(e){console.error(e,r&&m(r))}}}else(a instanceof CSSMediaRule&&window.matchMedia(a.conditionText).matches||a instanceof CSSSupportsRule&&CSS.supports(a.conditionText))&&u(a.cssRules,t,n,i,r);var s}function d(e,t,n){const i=function(){const e=new CSSStyleSheet;return e.insertRule(".dummy{}"),e.cssRules[0].style}(),r=function(e){let t;return Object.defineProperty({},"style",{get:()=>(t||(t=getComputedStyle(e)),t)})}(e),o=["display"];for(const e of t)for(const t of[...e.rule,...l]){let s=e.rule.getPropertyValue(t);o.includes(t)&&(s=r.style.getPropertyValue(t)),s.trim()&&h(i,t,s,(e=>r.style.getPropertyValue(e)||n.getPropertyValue(e)),(t=>(console.log("resolving url",t,e.href),t.startsWith("data:")||!e.href?t:(console.log("resolving url",t,e.href.href),t.startsWith("/")?new URL(`${e.href.origin}${t}`).href:new URL(`${e.href.href}${t}`).href))),e.rule.getPropertyPriority(t))}return i}function h(e,t,n,i,r,o){n=function(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;e<n.length;++e){const r=n[e];if("url"!==r||n[e+1].startsWith("(data"))i.push(r);else{const o=t(n[++e].slice(2,-2));o&&(i.push(r),i.push('("'),i.push(o),i.push('")'))}}return i.join("")}(n=g(n,i),r),e.setProperty(t,n,o)}function f(e,t){return i(this,void 0,void 0,(function*(){try{e.cssRules.length}catch(n){const i=e.ownerNode;if(e.href&&i instanceof HTMLLinkElement){const e=yield c(i.href,t);e&&i.replaceWith(e)}return!0}return e.media.mediaText.split(",").map((e=>e.trim())).includes("print")}))}function g(e,t){const n=(0,s.tokenize)(e),i=[];for(let e=0;e<n.length;++e){const r=n[e];if("var"===r){const r=(0,s.tokenize)(n[++e].slice(1,-1)),[o,a,l,...c]=r,u=t(o);u?i.push(u):a&&c.length<=1?i.push(c[0]||l):a&&2===c.length&&i.push(g(c.join(""),t))}else r.startsWith("(")&&r.endsWith(")")?i.push("(",g(r.slice(1,-1),t),")"):i.push(r)}return i.join("")}function m(e){if(!e)return null;e.startsWith("/")&&(e=`${document.location.origin}${e}`);const t=new URL(e),n=t.pathname.split("/").slice(0,-1).join("/");return new URL(`${t.origin}${n}/`)}function p(e){const t=[],n=(0,a.parse)(e);for(const e of n){const n=e.findIndex((e=>!(e.type!==a.SelectorType.Pseudo&&e.type!==a.SelectorType.PseudoElement||"after"!==e.name&&"before"!==e.name)));n<=-1||t.push({selector:(0,a.stringify)([e.slice(0,n)]),pseudoElement:(0,a.stringify)([e.slice(n)])})}return t}},787:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.injectCss=function(e,t){const n=document.getElementById(t),i=document.getElementsByTagName("head")[0];n&&i.removeChild(n);const r=document.createElement("style");r.type="text/css",r.id=t,r.appendChild(document.createTextNode(e)),i.insertBefore(r,function(){for(const e of document.querySelectorAll("style"))if(e.innerHTML.includes("#root"))return e;return null}())},t.escape=function(e){return e.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")},t.parseExtension=o,t.mimeType=function(e){const t=o(e).toLowerCase();return r[t]||""},t.dataAsUrl=function(e,t){return"data:"+t+";base64,"+e},t.isDataUrl=function(e){return-1!==e.search(/^(data:)/)},t.canvasToBlob=function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):Promise.resolve(function(e){const t=atob(e.toDataURL().split(",")[1]),n=t.length,i=new Uint8Array(n);for(let e=0;e<n;e++)i[e]=t.charCodeAt(e);return new Blob([i],{type:"image/png"})}(e))},t.resolveUrl=function(e,t){const n=document.implementation.createHTMLDocument(),i=n.createElement("base");n.head.appendChild(i);const r=n.createElement("a");return n.body.appendChild(r),i.href=t,r.href=e,r.href},t.uid=function(){return"u"+("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)+s++},t.delay=function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},t.asArray=function(e){const t=[],n=e.length;for(let i=0;i<n;i++)t.push(e[i]);return t},t.escapeXhtml=function(e){return e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/\n/g,"%0A")},t.width=function(e){const t=a(e,"border-left-width"),n=a(e,"border-right-width");return e.scrollWidth+t+n},t.height=function(e){const t=a(e,"border-top-width"),n=a(e,"border-bottom-width");return e.scrollHeight+t+n};const n="application/font-woff",i="image/jpeg",r={woff:n,woff2:n,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:i,jpeg:i,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function o(e){const t=/\.([^./]*?)(\?|$)/g.exec(e);return t?t[1]:""}let s=0;function a(e,t){const n=getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}},893:e=>{var t={unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i};function n(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))}e.exports=function(e,i={}){"function"==typeof i&&(i={visibilityChecker:i});var r={minScore:20,minContentLength:140,visibilityChecker:n};i=Object.assign(r,i);var o=e.querySelectorAll("p, pre, article"),s=e.querySelectorAll("div > br");if(s.length){var a=new Set(o);[].forEach.call(s,(function(e){a.add(e.parentNode)})),o=Array.from(a)}var l=0;return[].some.call(o,(function(e){if(!i.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.unlikelyCandidates.test(n)&&!t.okMaybeItsACandidate.test(n))return!1;if(e.matches("li p"))return!1;var r=e.textContent.trim().length;return!(r<i.minContentLength)&&(l+=Math.sqrt(r-i.minContentLength))>i.minScore}))}},174:e=>{function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(e){if(e.nodeType==e.TEXT_NODE)return`${e.nodeName} ("${e.textContent}")`;let t=Array.from(e.attributes||[],(function(e){return`${e.name}="${e.value}"`})).join(" ");return`<${e.localName} ${t}>`};this.log=function(){if("undefined"!=typeof dump){var t=Array.prototype.map.call(arguments,(function(t){return t&&t.nodeName?e(t):t})).join(" ");dump("Reader: (Readability) "+t+"\n")}else if("undefined"!=typeof console){let t=Array.from(arguments,(t=>t&&t.nodeType==this.ELEMENT_NODE?e(t):t));t.unshift("Reader: (Readability)"),console.log.apply(console,t)}}}else this.log=function(){}}t.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var n=e.length-1;n>=0;n--){var i=e[n],r=i.parentNode;r&&(t&&!t.call(this,i,n,e)||r.removeChild(i))}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(const n of e)this._setNodeTag(n,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_findNode:function(e,t){return Array.prototype.find.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map((function(t){return e.call(t)}));return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map((function(t){var n=e.getElementsByTagName(t);return Array.isArray(n)?n:Array.from(n)})))},_cleanClasses:function(e){var t=this._classesToPreserve,n=(e.getAttribute("class")||"").split(/\s+/).filter((function(e){return-1!=t.indexOf(e)})).join(" ");for(n?e.setAttribute("class",n):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,n=this._doc.documentURI;function i(e){if(t==n&&"#"==e.charAt(0))return e;try{return new URL(e,t).href}catch(e){}return e}var r=this._getAllNodesWithTag(e,["a"]);this._forEachNode(r,(function(e){var t=e.getAttribute("href");if(t)if(0===t.indexOf("javascript:"))if(1===e.childNodes.length&&e.childNodes[0].nodeType===this.TEXT_NODE){var n=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(n,e)}else{for(var r=this._doc.createElement("span");e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",i(t))}));var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,(function(e){var t=e.getAttribute("src"),n=e.getAttribute("poster"),r=e.getAttribute("srcset");if(t&&e.setAttribute("src",i(t)),n&&e.setAttribute("poster",i(n)),r){var o=r.replace(this.REGEXPS.srcsetUrl,(function(e,t,n,r){return i(t)+(n||"")+r}));e.setAttribute("srcset",o)}}))},_simplifyNestedElements:function(e){for(var t=e;t;){if(t.parentNode&&["DIV","SECTION"].includes(t.tagName)&&(!t.id||!t.id.startsWith("readability"))){if(this._isElementWithoutContent(t)){t=this._removeAndGetNext(t);continue}if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var n=t.children[0],i=0;i<t.attributes.length;i++)n.setAttribute(t.attributes[i].name,t.attributes[i].value);t.parentNode.replaceChild(n,t),t=n;continue}}t=this._getNextNode(t)}},_getArticleTitle:function(){var e=this._doc,t="",n="";try{"string"!=typeof(t=n=e.title.trim())&&(t=n=this._getInnerText(e.getElementsByTagName("title")[0]))}catch(e){}var i=!1;function r(e){return e.split(/\s+/).length}if(/ [\|\-\\\/>»] /.test(t))i=/ [\\\/>»] /.test(t),r(t=n.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))<3&&(t=n.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),s=t.trim();this._someNode(o,(function(e){return e.textContent.trim()===s}))||(r(t=n.substring(n.lastIndexOf(":")+1))<3?t=n.substring(n.indexOf(":")+1):r(n.substr(0,n.indexOf(":")))>5&&(t=n))}else if(t.length>150||t.length<15){var a=e.getElementsByTagName("h1");1===a.length&&(t=this._getInnerText(a[0]))}var l=r(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!i||l!=r(n.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=n),t},_prepDocument:function(){var e=this._doc;this._removeNodes(this._getAllNodesWithTag(e,["style"])),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(this._getAllNodesWithTag(e,["font"]),"SPAN")},_nextNode:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),(function(e){for(var t=e.nextSibling,n=!1;(t=this._nextNode(t))&&"BR"==t.tagName;){n=!0;var i=t.nextSibling;t.parentNode.removeChild(t),t=i}if(n){var r=this._doc.createElement("p");for(e.parentNode.replaceChild(r,e),t=r.nextSibling;t;){if("BR"==t.tagName){var o=this._nextNode(t.nextSibling);if(o&&"BR"==o.tagName)break}if(!this._isPhrasingContent(t))break;var s=t.nextSibling;r.appendChild(t),t=s}for(;r.lastChild&&this._isWhitespace(r.lastChild);)r.removeChild(r.lastChild);"P"===r.parentNode.tagName&&this._setNodeTag(r.parentNode,"DIV")}}))},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),this._docJSDOMParser)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var n=e.ownerDocument.createElement(t);e.firstChild;)n.appendChild(e.firstChild);e.parentNode.replaceChild(n,e),e.readability&&(n.readability=e.readability);for(var i=0;i<e.attributes.length;i++)try{n.setAttribute(e.attributes[i].name,e.attributes[i].value)}catch(e){}return n},_prepArticle:function(e){this._cleanStyles(e),this._markDataTables(e),this._fixLazyImages(e),this._cleanConditionally(e,"form"),this._cleanConditionally(e,"fieldset"),this._clean(e,"object"),this._clean(e,"embed"),this._clean(e,"footer"),this._clean(e,"link"),this._clean(e,"aside");var t=this.DEFAULT_CHAR_THRESHOLD;this._forEachNode(e.children,(function(e){this._cleanMatchedNodes(e,(function(e,n){return this.REGEXPS.shareElements.test(n)&&e.textContent.length<t}))})),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._replaceNodeTags(this._getAllNodesWithTag(e,["h1"]),"h2"),this._removeNodes(this._getAllNodesWithTag(e,["p"]),(function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)})),this._forEachNode(this._getAllNodesWithTag(e,["br"]),(function(e){var t=this._nextNode(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)})),this._forEachNode(this._getAllNodesWithTag(e,["table"]),(function(e){var t=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;if(this._hasSingleTagInsideElement(t,"TR")){var n=t.firstElementChild;if(this._hasSingleTagInsideElement(n,"TD")){var i=n.firstElementChild;i=this._setNodeTag(i,this._everyNode(i.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(i,e)}}}))},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_textSimilarity:function(e,t){var n=e.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean),i=t.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean);return n.length&&i.length?1-i.filter((e=>!n.includes(e))).join(" ").length/i.join(" ").length:0},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var n=e.getAttribute("rel"),i=e.getAttribute("itemprop");return!(!("author"===n||i&&-1!==i.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent)||(this._articleByline=e.textContent.trim(),0))},_getNodeAncestors:function(e,t){t=t||0;for(var n=0,i=[];e.parentNode&&(i.push(e.parentNode),!t||++n!==t);)e=e.parentNode;return i},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,n=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var i=e.innerHTML;;){this.log("Starting grabArticle loop");var r=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),o=[],s=this._doc.documentElement;let F=!0;for(;s;){"HTML"===s.tagName&&(this._articleLang=s.getAttribute("lang"));var a=s.className+" "+s.id;if(this._isProbablyVisible(s))if(this._checkByline(s,a))s=this._removeAndGetNext(s);else if(F&&this._headerDuplicatesTitle(s))this.log("Removing header: ",s.textContent.trim(),this._articleTitle.trim()),F=!1,s=this._removeAndGetNext(s);else{if(r){if(this.REGEXPS.unlikelyCandidates.test(a)&&!this.REGEXPS.okMaybeItsACandidate.test(a)&&!this._hasAncestorTag(s,"table")&&!this._hasAncestorTag(s,"code")&&"BODY"!==s.tagName&&"A"!==s.tagName){this.log("Removing unlikely candidate - "+a),s=this._removeAndGetNext(s);continue}if(this.UNLIKELY_ROLES.includes(s.getAttribute("role"))){this.log("Removing content with role "+s.getAttribute("role")+" - "+a),s=this._removeAndGetNext(s);continue}}if("DIV"!==s.tagName&&"SECTION"!==s.tagName&&"HEADER"!==s.tagName&&"H1"!==s.tagName&&"H2"!==s.tagName&&"H3"!==s.tagName&&"H4"!==s.tagName&&"H5"!==s.tagName&&"H6"!==s.tagName||!this._isElementWithoutContent(s)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(s.tagName)&&o.push(s),"DIV"===s.tagName){for(var l=null,c=s.firstChild;c;){var u=c.nextSibling;if(this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),s.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}if(this._hasSingleTagInsideElement(s,"P")&&this._getLinkDensity(s)<.25){var d=s.children[0];s.parentNode.replaceChild(d,s),s=d,o.push(s)}else this._hasChildBlockElement(s)||(s=this._setNodeTag(s,"P"),o.push(s))}s=this._getNextNode(s)}else s=this._removeAndGetNext(s)}else this.log("Removing hidden node - "+a),s=this._removeAndGetNext(s)}var h=[];this._forEachNode(o,(function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t=this._getInnerText(e);if(!(t.length<25)){var n=this._getNodeAncestors(e,5);if(0!==n.length){var i=0;i+=1,i+=t.split(",").length,i+=Math.min(Math.floor(t.length/100),3),this._forEachNode(n,(function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var n=1;else n=1===t?2:3*t;e.readability.contentScore+=i/n}}))}}}}));for(var f=[],g=0,m=h.length;g<m;g+=1){var p=h[g],y=p.readability.contentScore*(1-this._getLinkDensity(p));p.readability.contentScore=y,this.log("Candidate:",p,"with score "+y);for(var v=0;v<this._nbTopCandidates;v++){var b=f[v];if(!b||y>b.readability.contentScore){f.splice(v,0,p),f.length>this._nbTopCandidates&&f.pop();break}}}var _,E=f[0]||null,N=!1;if(null===E||"BODY"===E.tagName){for(E=t.createElement("DIV"),N=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),E.appendChild(e.firstChild);e.appendChild(E),this._initializeNode(E)}else if(E){for(var A=[],T=1;T<f.length;T++)f[T].readability.contentScore/E.readability.contentScore>=.75&&A.push(this._getNodeAncestors(f[T]));if(A.length>=3)for(_=E.parentNode;"BODY"!==_.tagName;){for(var C=0,S=0;S<A.length&&C<3;S++)C+=Number(A[S].includes(_));if(C>=3){E=_;break}_=_.parentNode}E.readability||this._initializeNode(E),_=E.parentNode;for(var w=E.readability.contentScore,x=w/3;"BODY"!==_.tagName;)if(_.readability){var L=_.readability.contentScore;if(L<x)break;if(L>w){E=_;break}w=_.readability.contentScore,_=_.parentNode}else _=_.parentNode;for(_=E.parentNode;"BODY"!=_.tagName&&1==_.children.length;)_=(E=_).parentNode;E.readability||this._initializeNode(E)}var P=t.createElement("DIV");n&&(P.id="readability-content");for(var O=Math.max(10,.2*E.readability.contentScore),I=(_=E.parentNode).children,R=0,D=I.length;R<D;R++){var M=I[R],k=!1;if(this.log("Looking at sibling node:",M,M.readability?"with score "+M.readability.contentScore:""),this.log("Sibling has score",M.readability?M.readability.contentScore:"Unknown"),M===E)k=!0;else{var B=0;if(M.className===E.className&&""!==E.className&&(B+=.2*E.readability.contentScore),M.readability&&M.readability.contentScore+B>=O)k=!0;else if("P"===M.nodeName){var H=this._getLinkDensity(M),j=this._getInnerText(M),U=j.length;(U>80&&H<.25||U<80&&U>0&&0===H&&-1!==j.search(/\.( |$)/))&&(k=!0)}}k&&(this.log("Appending node:",M),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(M.nodeName)&&(this.log("Altering sibling:",M,"to div."),M=this._setNodeTag(M,"DIV")),P.appendChild(M),I=_.children,R-=1,D-=1)}if(this._debug&&this.log("Article content pre-prep: "+P.innerHTML),this._prepArticle(P),this._debug&&this.log("Article content post-prep: "+P.innerHTML),N)E.id="readability-page-1",E.className="page";else{var $=t.createElement("DIV");for($.id="readability-page-1",$.className="page";P.firstChild;)$.appendChild(P.firstChild);P.appendChild($)}this._debug&&this.log("Article content after paging: "+P.innerHTML);var G=!0,V=this._getInnerText(P,!0).length;if(V<this._charThreshold)if(G=!1,e.innerHTML=i,this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))this._removeFlag(this.FLAG_STRIP_UNLIKELYS),this._attempts.push({articleContent:P,textLength:V});else if(this._flagIsActive(this.FLAG_WEIGHT_CLASSES))this._removeFlag(this.FLAG_WEIGHT_CLASSES),this._attempts.push({articleContent:P,textLength:V});else if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY),this._attempts.push({articleContent:P,textLength:V});else{if(this._attempts.push({articleContent:P,textLength:V}),this._attempts.sort((function(e,t){return t.textLength-e.textLength})),!this._attempts[0].textLength)return null;P=this._attempts[0].articleContent,G=!0}if(G){var W=[_,E].concat(this._getNodeAncestors(_));return this._someNode(W,(function(e){if(!e.tagName)return!1;var t=e.getAttribute("dir");return!!t&&(this._articleDir=t,!0)})),P}}},_isValidByline:function(e){return("string"==typeof e||e instanceof String)&&(e=e.trim()).length>0&&e.length<100},_unescapeHtmlEntities:function(e){if(!e)return e;var t=this.HTML_ESCAPE_MAP;return e.replace(/&(quot|amp|apos|lt|gt);/g,(function(e,n){return t[n]})).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,(function(e,t,n){var i=parseInt(t||n,t?16:10);return String.fromCharCode(i)}))},_getJSONLD:function(e){var t,n=this._getAllNodesWithTag(e,["script"]);return this._forEachNode(n,(function(e){if(!t&&"application/ld+json"===e.getAttribute("type"))try{var n=e.textContent.replace(/^\s*<!\[CDATA\[|\]\]>\s*$/g,""),i=JSON.parse(n);if(!i["@context"]||!i["@context"].match(/^https?\:\/\/schema\.org$/))return;if(!i["@type"]&&Array.isArray(i["@graph"])&&(i=i["@graph"].find((function(e){return(e["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)}))),!i||!i["@type"]||!i["@type"].match(this.REGEXPS.jsonLdArticleTypes))return;if(t={},"string"==typeof i.name&&"string"==typeof i.headline&&i.name!==i.headline){var r=this._getArticleTitle(),o=this._textSimilarity(i.name,r)>.75,s=this._textSimilarity(i.headline,r)>.75;t.title=s&&!o?i.headline:i.name}else"string"==typeof i.name?t.title=i.name.trim():"string"==typeof i.headline&&(t.title=i.headline.trim());return i.author&&("string"==typeof i.author.name?t.byline=i.author.name.trim():Array.isArray(i.author)&&i.author[0]&&"string"==typeof i.author[0].name&&(t.byline=i.author.filter((function(e){return e&&"string"==typeof e.name})).map((function(e){return e.name.trim()})).join(", "))),"string"==typeof i.description&&(t.excerpt=i.description.trim()),void(i.publisher&&"string"==typeof i.publisher.name&&(t.siteName=i.publisher.name.trim()))}catch(e){this.log(e.message)}})),t||{}},_getArticleMetadata:function(e){var t={},n={},i=this._doc.getElementsByTagName("meta"),r=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,o=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(i,(function(e){var t=e.getAttribute("name"),i=e.getAttribute("property"),s=e.getAttribute("content");if(s){var a=null,l=null;i&&(a=i.match(r))&&(l=a[0].toLowerCase().replace(/\s/g,""),n[l]=s.trim()),!a&&t&&o.test(t)&&(l=t,s&&(l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),n[l]=s.trim()))}})),t.title=e.title||n["dc:title"]||n["dcterm:title"]||n["og:title"]||n["weibo:article:title"]||n["weibo:webpage:title"]||n.title||n["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||n["dc:creator"]||n["dcterm:creator"]||n.author,t.excerpt=e.excerpt||n["dc:description"]||n["dcterm:description"]||n["og:description"]||n["weibo:article:description"]||n["weibo:webpage:description"]||n.description||n["twitter:description"],t.siteName=e.siteName||n["og:site_name"],t.title=this._unescapeHtmlEntities(t.title),t.byline=this._unescapeHtmlEntities(t.byline),t.excerpt=this._unescapeHtmlEntities(t.excerpt),t.siteName=this._unescapeHtmlEntities(t.siteName),t},_isSingleImage:function(e){return"IMG"===e.tagName||1===e.children.length&&""===e.textContent.trim()&&this._isSingleImage(e.children[0])},_unwrapNoscriptImages:function(e){var t=Array.from(e.getElementsByTagName("img"));this._forEachNode(t,(function(e){for(var t=0;t<e.attributes.length;t++){var n=e.attributes[t];switch(n.name){case"src":case"srcset":case"data-src":case"data-srcset":return}if(/\.(jpg|jpeg|png|webp)/i.test(n.value))return}e.parentNode.removeChild(e)}));var n=Array.from(e.getElementsByTagName("noscript"));this._forEachNode(n,(function(t){var n=e.createElement("div");if(n.innerHTML=t.innerHTML,this._isSingleImage(n)){var i=t.previousElementSibling;if(i&&this._isSingleImage(i)){var r=i;"IMG"!==r.tagName&&(r=i.getElementsByTagName("img")[0]);for(var o=n.getElementsByTagName("img")[0],s=0;s<r.attributes.length;s++){var a=r.attributes[s];if(""!==a.value&&("src"===a.name||"srcset"===a.name||/\.(jpg|jpeg|png|webp)/i.test(a.value))){if(o.getAttribute(a.name)===a.value)continue;var l=a.name;o.hasAttribute(l)&&(l="data-old-"+l),o.setAttribute(l,a.value)}}t.parentNode.replaceChild(n.firstElementChild,i)}}}))},_removeScripts:function(e){this._removeNodes(this._getAllNodesWithTag(e,["script"]),(function(e){return e.nodeValue="",e.removeAttribute("src"),!0})),this._removeNodes(this._getAllNodesWithTag(e,["noscript"]))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,(function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)}))},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,(function(e){return this.DIV_TO_P_ELEMS.has(e.tagName)||this._hasChildBlockElement(e)}))},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var n=e.textContent.trim();return t?n.replace(this.REGEXPS.normalize," "):n},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){if(e&&"svg"!==e.tagName.toLowerCase()){for(var t=0;t<this.PRESENTATIONAL_ATTRIBUTES.length;t++)e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);-1!==this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName)&&(e.removeAttribute("width"),e.removeAttribute("height"));for(var n=e.firstElementChild;null!==n;)this._cleanStyles(n),n=n.nextElementSibling}},_getLinkDensity:function(e){var t=this._getInnerText(e).length;if(0===t)return 0;var n=0;return this._forEachNode(e.getElementsByTagName("a"),(function(e){var t=e.getAttribute("href"),i=t&&this.REGEXPS.hashUrl.test(t)?.3:1;n+=this._getInnerText(e).length*i})),n/t},_getClassWeight:function(e){if(!this._flagIsActive(this.FLAG_WEIGHT_CLASSES))return 0;var t=0;return"string"==typeof e.className&&""!==e.className&&(this.REGEXPS.negative.test(e.className)&&(t-=25),this.REGEXPS.positive.test(e.className)&&(t+=25)),"string"==typeof e.id&&""!==e.id&&(this.REGEXPS.negative.test(e.id)&&(t-=25),this.REGEXPS.positive.test(e.id)&&(t+=25)),t},_clean:function(e,t){var n=-1!==["object","embed","iframe"].indexOf(t);this._removeNodes(this._getAllNodesWithTag(e,[t]),(function(e){if(n){for(var t=0;t<e.attributes.length;t++)if(this.REGEXPS.videos.test(e.attributes[t].value))return!1;if("object"===e.tagName&&this.REGEXPS.videos.test(e.innerHTML))return!1}return!0}))},_hasAncestorTag:function(e,t,n,i){n=n||3,t=t.toUpperCase();for(var r=0;e.parentNode;){if(n>0&&r>n)return!1;if(e.parentNode.tagName===t&&(!i||i(e.parentNode)))return!0;e=e.parentNode,r++}return!1},_getRowAndColumnCount:function(e){for(var t=0,n=0,i=e.getElementsByTagName("tr"),r=0;r<i.length;r++){var o=i[r].getAttribute("rowspan")||0;o&&(o=parseInt(o,10)),t+=o||1;for(var s=0,a=i[r].getElementsByTagName("td"),l=0;l<a.length;l++){var c=a[l].getAttribute("colspan")||0;c&&(c=parseInt(c,10)),s+=c||1}n=Math.max(n,s)}return{rows:t,columns:n}},_markDataTables:function(e){for(var t=e.getElementsByTagName("table"),n=0;n<t.length;n++){var i=t[n];if("presentation"!=i.getAttribute("role"))if("0"!=i.getAttribute("datatable"))if(i.getAttribute("summary"))i._readabilityDataTable=!0;else{var r=i.getElementsByTagName("caption")[0];if(r&&r.childNodes.length>0)i._readabilityDataTable=!0;else if(["col","colgroup","tfoot","thead","th"].some((function(e){return!!i.getElementsByTagName(e)[0]})))this.log("Data table because found data-y descendant"),i._readabilityDataTable=!0;else if(i.getElementsByTagName("table")[0])i._readabilityDataTable=!1;else{var o=this._getRowAndColumnCount(i);o.rows>=10||o.columns>4?i._readabilityDataTable=!0:i._readabilityDataTable=o.rows*o.columns>10}}else i._readabilityDataTable=!1;else i._readabilityDataTable=!1}},_fixLazyImages:function(e){this._forEachNode(this._getAllNodesWithTag(e,["img","picture","figure"]),(function(e){if(e.src&&this.REGEXPS.b64DataUrl.test(e.src)){if("image/svg+xml"===this.REGEXPS.b64DataUrl.exec(e.src)[1])return;for(var t=!1,n=0;n<e.attributes.length;n++){var i=e.attributes[n];if("src"!==i.name&&/\.(jpg|jpeg|png|webp)/i.test(i.value)){t=!0;break}}if(t){var r=e.src.search(/base64\s*/i)+7;e.src.length-r<133&&e.removeAttribute("src")}}if(!(e.src||e.srcset&&"null"!=e.srcset)||-1!==e.className.toLowerCase().indexOf("lazy"))for(var o=0;o<e.attributes.length;o++)if("src"!==(i=e.attributes[o]).name&&"srcset"!==i.name&&"alt"!==i.name){var s=null;if(/\.(jpg|jpeg|png|webp)\s+\d/.test(i.value)?s="srcset":/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(i.value)&&(s="src"),s)if("IMG"===e.tagName||"PICTURE"===e.tagName)e.setAttribute(s,i.value);else if("FIGURE"===e.tagName&&!this._getAllNodesWithTag(e,["img","picture"]).length){var a=this._doc.createElement("img");a.setAttribute(s,i.value),e.appendChild(a)}}}))},_getTextDensity:function(e,t){var n=this._getInnerText(e,!0).length;if(0===n)return 0;var i=0,r=this._getAllNodesWithTag(e,t);return this._forEachNode(r,(e=>i+=this._getInnerText(e,!0).length)),i/n},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),(function(e){var n=function(e){return e._readabilityDataTable},i="ul"===t||"ol"===t;if(!i){var r=0,o=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(o,(e=>r+=this._getInnerText(e).length)),i=r/this._getInnerText(e).length>.9}if("table"===t&&n(e))return!1;if(this._hasAncestorTag(e,"table",-1,n))return!1;if(this._hasAncestorTag(e,"code"))return!1;var s=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),s+0<0)return!0;if(this._getCharCount(e,",")<10){for(var a=e.getElementsByTagName("p").length,l=e.getElementsByTagName("img").length,c=e.getElementsByTagName("li").length-100,u=e.getElementsByTagName("input").length,d=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),h=0,f=this._getAllNodesWithTag(e,["object","embed","iframe"]),g=0;g<f.length;g++){for(var m=0;m<f[g].attributes.length;m++)if(this.REGEXPS.videos.test(f[g].attributes[m].value))return!1;if("object"===f[g].tagName&&this.REGEXPS.videos.test(f[g].innerHTML))return!1;h++}var p=this._getLinkDensity(e),y=this._getInnerText(e).length;return l>1&&a/l<.5&&!this._hasAncestorTag(e,"figure")||!i&&c>a||u>Math.floor(a/3)||!i&&d<.9&&y<25&&(0===l||l>2)&&!this._hasAncestorTag(e,"figure")||!i&&s<25&&p>.2||s>=25&&p>.5||1===h&&y<75||h>1}return!1}))},_cleanMatchedNodes:function(e,t){for(var n=this._getNextNode(e,!0),i=this._getNextNode(e);i&&i!=n;)i=t.call(this,i,i.className+" "+i.id)?this._removeAndGetNext(i):this._getNextNode(i)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,(function(e){let t=this._getClassWeight(e)<0;return t&&this.log("Removing header with low class weight:",e),t}))},_headerDuplicatesTitle:function(e){if("H1"!=e.tagName&&"H2"!=e.tagName)return!1;var t=this._getInnerText(e,!1);return this.log("Evaluating similarity of header:",t,this._articleTitle),this._textSimilarity(this._articleTitle,t)>.75},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._unwrapNoscriptImages(this._doc);var t=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var n=this._getArticleMetadata(t);this._articleTitle=n.title;var i=this._grabArticle();if(!i)return null;if(this.log("Grabbed: "+i.innerHTML),this._postProcessContent(i),!n.excerpt){var r=i.getElementsByTagName("p");r.length>0&&(n.excerpt=r[0].textContent.trim())}var o=i.textContent;return{title:this._articleTitle,byline:n.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(i),textContent:o,length:o.length,excerpt:n.excerpt,siteName:n.siteName||this._articleSiteName}}},e.exports=t},107:(e,t,n)=>{var i=n(174),r=n(893);e.exports={Readability:i,isProbablyReaderable:r}},763:(e,t,n)=>{"use strict";var i;n.r(t),n.d(t,{AttributeAction:()=>o,IgnoreCaseMode:()=>r,SelectorType:()=>i,isTraversal:()=>u,parse:()=>p,stringify:()=>A}),function(e){e.Attribute="attribute",e.Pseudo="pseudo",e.PseudoElement="pseudo-element",e.Tag="tag",e.Universal="universal",e.Adjacent="adjacent",e.Child="child",e.Descendant="descendant",e.Parent="parent",e.Sibling="sibling",e.ColumnCombinator="column-combinator"}(i||(i={}));const r={Unknown:null,QuirksMode:"quirks",IgnoreCase:!0,CaseSensitive:!1};var o;!function(e){e.Any="any",e.Element="element",e.End="end",e.Equals="equals",e.Exists="exists",e.Hyphen="hyphen",e.Not="not",e.Start="start"}(o||(o={}));const s=/^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,a=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,l=new Map([[126,o.Element],[94,o.Start],[36,o.End],[42,o.Any],[33,o.Not],[124,o.Hyphen]]),c=new Set(["has","not","matches","is","where","host","host-context"]);function u(e){switch(e.type){case i.Adjacent:case i.Child:case i.Descendant:case i.Parent:case i.Sibling:case i.ColumnCombinator:return!0;default:return!1}}const d=new Set(["contains","icontains"]);function h(e,t,n){const i=parseInt(t,16)-65536;return i!=i||n?t:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)}function f(e){return e.replace(a,h)}function g(e){return 39===e||34===e}function m(e){return 32===e||9===e||10===e||12===e||13===e}function p(e){const t=[],n=y(t,`${e}`,0);if(n<e.length)throw new Error(`Unmatched selector: ${e.slice(n)}`);return t}function y(e,t,n){let r=[];function a(e){const i=t.slice(n+e).match(s);if(!i)throw new Error(`Expected name, found ${t.slice(n)}`);const[r]=i;return n+=e+r.length,f(r)}function h(e){for(n+=e;n<t.length&&m(t.charCodeAt(n));)n++}function p(){const e=n+=1;let i=1;for(;i>0&&n<t.length;n++)40!==t.charCodeAt(n)||v(n)?41!==t.charCodeAt(n)||v(n)||i--:i++;if(i)throw new Error("Parenthesis not matched");return f(t.slice(e,n-1))}function v(e){let n=0;for(;92===t.charCodeAt(--e);)n++;return 1==(1&n)}function b(){if(r.length>0&&u(r[r.length-1]))throw new Error("Did not expect successive traversals.")}function _(e){r.length>0&&r[r.length-1].type===i.Descendant?r[r.length-1].type=e:(b(),r.push({type:e}))}function E(e,t){r.push({type:i.Attribute,name:e,action:t,value:a(1),namespace:null,ignoreCase:"quirks"})}function N(){if(r.length&&r[r.length-1].type===i.Descendant&&r.pop(),0===r.length)throw new Error("Empty sub-selector");e.push(r)}if(h(0),t.length===n)return n;e:for(;n<t.length;){const e=t.charCodeAt(n);switch(e){case 32:case 9:case 10:case 12:case 13:0!==r.length&&r[0].type===i.Descendant||(b(),r.push({type:i.Descendant})),h(1);break;case 62:_(i.Child),h(1);break;case 60:_(i.Parent),h(1);break;case 126:_(i.Sibling),h(1);break;case 43:_(i.Adjacent),h(1);break;case 46:E("class",o.Element);break;case 35:E("id",o.Equals);break;case 91:{let e;h(1);let s=null;124===t.charCodeAt(n)?e=a(1):t.startsWith("*|",n)?(s="*",e=a(2)):(e=a(0),124===t.charCodeAt(n)&&61!==t.charCodeAt(n+1)&&(s=e,e=a(1))),h(0);let c=o.Exists;const u=l.get(t.charCodeAt(n));if(u){if(c=u,61!==t.charCodeAt(n+1))throw new Error("Expected `=`");h(2)}else 61===t.charCodeAt(n)&&(c=o.Equals,h(1));let d="",p=null;if("exists"!==c){if(g(t.charCodeAt(n))){const e=t.charCodeAt(n);let i=n+1;for(;i<t.length&&(t.charCodeAt(i)!==e||v(i));)i+=1;if(t.charCodeAt(i)!==e)throw new Error("Attribute value didn't end");d=f(t.slice(n+1,i)),n=i+1}else{const e=n;for(;n<t.length&&(!m(t.charCodeAt(n))&&93!==t.charCodeAt(n)||v(n));)n+=1;d=f(t.slice(e,n))}h(0);const e=32|t.charCodeAt(n);115===e?(p=!1,h(1)):105===e&&(p=!0,h(1))}if(93!==t.charCodeAt(n))throw new Error("Attribute selector didn't terminate");n+=1;const y={type:i.Attribute,name:e,action:c,value:d,namespace:s,ignoreCase:p};r.push(y);break}case 58:{if(58===t.charCodeAt(n+1)){r.push({type:i.PseudoElement,name:a(2).toLowerCase(),data:40===t.charCodeAt(n)?p():null});continue}const e=a(1).toLowerCase();let o=null;if(40===t.charCodeAt(n))if(c.has(e)){if(g(t.charCodeAt(n+1)))throw new Error(`Pseudo-selector ${e} cannot be quoted`);if(o=[],n=y(o,t,n+1),41!==t.charCodeAt(n))throw new Error(`Missing closing parenthesis in :${e} (${t})`);n+=1}else{if(o=p(),d.has(e)){const e=o.charCodeAt(0);e===o.charCodeAt(o.length-1)&&g(e)&&(o=o.slice(1,-1))}o=f(o)}r.push({type:i.Pseudo,name:e,data:o});break}case 44:N(),r=[],h(1);break;default:{if(t.startsWith("/*",n)){const e=t.indexOf("*/",n+2);if(e<0)throw new Error("Comment was not terminated");n=e+2,0===r.length&&h(0);break}let o,l=null;if(42===e)n+=1,o="*";else if(124===e){if(o="",124===t.charCodeAt(n+1)){_(i.ColumnCombinator),h(2);break}}else{if(!s.test(t.slice(n)))break e;o=a(0)}124===t.charCodeAt(n)&&124!==t.charCodeAt(n+1)&&(l=o,42===t.charCodeAt(n+1)?(o="*",n+=2):o=a(1)),r.push("*"===o?{type:i.Universal,namespace:l}:{type:i.Tag,name:o,namespace:l})}}}return N(),n}const v=["\\",'"',"%","'"],b=[...v,"(",")"],_=new Set(v.map((e=>e.charCodeAt(0)))),E=new Set(b.map((e=>e.charCodeAt(0)))),N=new Set([...b,"~","^","$","*","+","!","|",":","[","]"," ","."].map((e=>e.charCodeAt(0))));function A(e){return e.map((e=>e.map(T).join(""))).join(", ")}function T(e,t,n){switch(e.type){case i.Child:return 0===t?"> ":" > ";case i.Parent:return 0===t?"< ":" < ";case i.Sibling:return 0===t?"~ ":" ~ ";case i.Adjacent:return 0===t?"+ ":" + ";case i.Descendant:return" ";case i.ColumnCombinator:return 0===t?"|| ":" || ";case i.Universal:return"*"===e.namespace&&t+1<n.length&&"name"in n[t+1]?"":`${S(e.namespace)}*`;case i.Tag:return C(e);case i.PseudoElement:return`::${w(e.name,N)}${null===e.data?"":`(${w(e.data,E)})`}`;case i.Pseudo:return`:${w(e.name,N)}${null===e.data?"":`(${"string"==typeof e.data?w(e.data,E):A(e.data)})`}`;case i.Attribute:{if("id"===e.name&&e.action===o.Equals&&"quirks"===e.ignoreCase&&!e.namespace)return`#${w(e.value,N)}`;if("class"===e.name&&e.action===o.Element&&"quirks"===e.ignoreCase&&!e.namespace)return`.${w(e.value,N)}`;const t=C(e);return e.action===o.Exists?`[${t}]`:`[${t}${function(e){switch(e){case o.Equals:return"";case o.Element:return"~";case o.Start:return"^";case o.End:return"$";case o.Any:return"*";case o.Not:return"!";case o.Hyphen:return"|";case o.Exists:throw new Error("Shouldn't be here")}}(e.action)}="${w(e.value,_)}"${null===e.ignoreCase?"":e.ignoreCase?" i":" s"}]`}}}function C(e){return`${S(e.namespace)}${w(e.name,N)}`}function S(e){return null!==e?`${"*"===e?"*":w(e,N)}|`:""}function w(e,t){let n=0,i="";for(let r=0;r<e.length;r++)t.has(e.charCodeAt(r))&&(i+=`${e.slice(n,r)}\\${e.charAt(r)}`,n=r+1);return i.length>0?i+e.slice(n):e}},482:(e,t,n)=>{"use strict";n.r(t),n.d(t,{app:()=>E,h:()=>_,memo:()=>v,text:()=>b});var i={},r=[],o=e=>e,s=r.map,a=Array.isArray,l="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout,c=e=>{var t="";if("string"==typeof e)return e;if(a(e))for(var n,i=0;i<e.length;i++)(n=c(e[i]))&&(t+=(t&&" ")+n);else for(var i in e)e[i]&&(t+=(t&&" ")+i);return t},u=(e,t)=>{for(var n in{...e,...t})if("function"==typeof(a(e[n])?e[n][0]:e[n]))t[n]=e[n];else if(e[n]!==t[n])return!0},d=e=>null==e?e:e.key,h=(e,t,n,i,r,o)=>{if("style"===t)for(var s in{...n,...i})n=null==i||null==i[s]?"":i[s],"-"===s[0]?e[t].setProperty(s,n):e[t][s]=n;else"o"===t[0]&&"n"===t[1]?((e.events||(e.events={}))[t=t.slice(2)]=i)?n||e.addEventListener(t,r):e.removeEventListener(t,r):!o&&"list"!==t&&"form"!==t&&t in e?e[t]=null==i?"":i:null==i||!1===i?e.removeAttribute(t):e.setAttribute(t,i)},f=(e,t,n)=>{var i=e.props,r=3===e.type?document.createTextNode(e.tag):(n=n||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag,i.is&&i):document.createElement(e.tag,i.is&&i);for(var o in i)h(r,o,null,i[o],t,n);for(var s=0;s<e.children.length;s++)r.appendChild(f(e.children[s]=m(e.children[s]),t,n));return e.node=r},g=(e,t,n,i,r,o)=>{if(n===i);else if(null!=n&&3===n.type&&3===i.type)n.tag!==i.tag&&(t.nodeValue=i.tag);else if(null==n||n.tag!==i.tag)t=e.insertBefore(f(i=m(i),r,o),t),null!=n&&e.removeChild(n.node);else{var s,a,l,c,u=n.props,p=i.props,y=n.children,v=i.children,b=0,_=0,E=y.length-1,N=v.length-1;for(var A in o=o||"svg"===i.tag,{...u,...p})("value"===A||"selected"===A||"checked"===A?t[A]:u[A])!==p[A]&&h(t,A,u[A],p[A],r,o);for(;_<=N&&b<=E&&null!=(l=d(y[b]))&&l===d(v[_]);)g(t,y[b].node,y[b],v[_]=m(v[_++],y[b++]),r,o);for(;_<=N&&b<=E&&null!=(l=d(y[E]))&&l===d(v[N]);)g(t,y[E].node,y[E],v[N]=m(v[N--],y[E--]),r,o);if(b>E)for(;_<=N;)t.insertBefore(f(v[_]=m(v[_++]),r,o),(a=y[b])&&a.node);else if(_>N)for(;b<=E;)t.removeChild(y[b++].node);else{var T={},C={};for(A=b;A<=E;A++)null!=(l=y[A].key)&&(T[l]=y[A]);for(;_<=N;)l=d(a=y[b]),c=d(v[_]=m(v[_],a)),C[l]||null!=c&&c===d(y[b+1])?(null==l&&t.removeChild(a.node),b++):null==c||1===n.type?(null==l&&(g(t,a&&a.node,a,v[_],r,o),_++),b++):(l===c?(g(t,a.node,a,v[_],r,o),C[c]=!0,b++):null!=(s=T[c])?(g(t,t.insertBefore(s.node,a&&a.node),s,v[_],r,o),C[c]=!0):g(t,a&&a.node,null,v[_],r,o),_++);for(;b<=E;)null==d(a=y[b++])&&t.removeChild(a.node);for(var A in T)null==C[A]&&t.removeChild(T[A].node)}}return i.node=t},m=(e,t)=>!0!==e&&!1!==e&&e?"function"==typeof e.tag?((!t||null==t.memo||((e,t)=>{for(var n in e)if(e[n]!==t[n])return!0;for(var n in t)if(e[n]!==t[n])return!0})(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:b(""),p=e=>3===e.nodeType?b(e.nodeValue,e):y(e.nodeName.toLowerCase(),i,s.call(e.childNodes,p),1,e),y=(e,{key:t,...n},i,r,o)=>({tag:e,props:n,key:t,children:i,type:r,node:o}),v=(e,t)=>({tag:e,memo:t}),b=(e,t)=>y(e,i,r,3,t),_=(e,{class:t,...n},o=r)=>y(e,{...n,...t?{class:c(t)}:i},a(o)?o:[o]),E=({node:e,view:t,subscriptions:n,dispatch:s=o,init:c=i})=>{var d,h,f=e&&p(e),m=[],y=e=>{d!==e&&(null==(d=e)&&(s=n=v=o),n&&(m=((e,t=r,n)=>{for(var i,o,s=[],a=0;a<e.length||a<t.length;a++)i=e[a],o=t[a],s.push(o&&!0!==o?!i||o[0]!==i[0]||u(o[1],i[1])?[o[0],o[1],(i&&i[2](),o[0](n,o[1]))]:i:i&&i[2]());return s})(m,n(d),s)),t&&!h&&l(v,h=!0))},v=()=>e=g(e.parentNode,e,f,f=t(d),b,h=!1),b=function(e){s(this.events[e.type],e)};return(s=s(((e,t)=>"function"==typeof e?s(e(d,t)):a(e)?"function"==typeof e[0]?s(e[0],e[1]):e.slice(1).map((e=>e&&!0!==e&&(e[0]||e)(s,e[1])),y(e[0])):y(e))))(c),s}},302:(e,t,n)=>{"use strict";n.r(t),n.d(t,{calculate:()=>i,compare:()=>o});var i=function(e){var t,n,i,o,s=[];for(i=0,o=(t=e.split(",")).length;i<o;i+=1)(n=t[i]).length>0&&s.push(r(n));return s},r=function(e){var t,n,i=e,r={a:0,b:0,c:0},o=[];return t=function(t,n){var s,a,l,c,u,d;if(t.test(i))for(a=0,l=(s=i.match(t)).length;a<l;a+=1)r[n]+=1,c=s[a],u=i.indexOf(c),d=c.length,o.push({selector:e.substr(u,d),type:n,index:u,length:d}),i=i.replace(c,Array(d+1).join(" "))},(n=function(e){var t,n,r,o;if(e.test(i))for(n=0,r=(t=i.match(e)).length;n<r;n+=1)o=t[n],i=i.replace(o,Array(o.length+1).join("A"))})(/\\[0-9A-Fa-f]{6}\s?/g),n(/\\[0-9A-Fa-f]{1,5}\s/g),n(/\\./g),function(){var e,t,n,r,o=/{[^]*/gm;if(o.test(i))for(t=0,n=(e=i.match(o)).length;t<n;t+=1)r=e[t],i=i.replace(r,Array(r.length+1).join(" "))}(),t(/(\[[^\]]+\])/g,"b"),t(/(#[^\#\s\+>~\.\[:\)]+)/g,"a"),t(/(\.[^\s\+>~\.\[:\)]+)/g,"b"),t(/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,"c"),t(/(:(?!not|global|local)[\w-]+\([^\)]*\))/gi,"b"),t(/(:(?!not|global|local)[^\s\+>~\.\[:]+)/g,"b"),i=(i=(i=(i=(i=(i=i.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," ")).replace(/:not/g," ")).replace(/:local/g," ")).replace(/:global/g," ")).replace(/[\(\)]/g," "),t(/([^\s\+>~\.\[:]+)/g,"c"),o.sort((function(e,t){return e.index-t.index})),{selector:e,specificity:"0,"+r.a.toString()+","+r.b.toString()+","+r.c.toString(),specificityArray:[0,r.a,r.b,r.c],parts:o}},o=function(e,t){var n,i,o;if("string"==typeof e){if(-1!==e.indexOf(","))throw"Invalid CSS selector";n=r(e).specificityArray}else{if(!Array.isArray(e))throw"Invalid CSS selector or specificity array";if(4!==e.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";n=e}if("string"==typeof t){if(-1!==t.indexOf(","))throw"Invalid CSS selector";i=r(t).specificityArray}else{if(!Array.isArray(t))throw"Invalid CSS selector or specificity array";if(4!==t.filter((function(e){return"number"==typeof e})).length)throw"Invalid specificity array";i=t}for(o=0;o<4;o+=1){if(n[o]<i[o])return-1;if(n[o]>i[o])return 1}return 0}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";const e=n(590);n.g.Clipper={clipArticle:e.clipArticle,clipPage:e.clipPage}})()})(); |