diff --git a/apps/mobile/ios/extension.bundle/clipper.bundle.js b/apps/mobile/ios/extension.bundle/clipper.bundle.js index bb54bffec..4636eef74 100644 --- a/apps/mobile/ios/extension.bundle/clipper.bundle.js +++ b/apps/mobile/ios/extension.bundle/clipper.bundle.js @@ -1,18 +1,18 @@ -(()=>{var e={804:function(e){var t=/-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,i=/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,r={}){"function"==typeof r&&(r={visibilityChecker:r}),r=Object.assign({minScore:20,minContentLength:140,visibilityChecker:n},r);var o=e.querySelectorAll("p, pre, article"),a=e.querySelectorAll("div > br");if(a.length){var s=new Set(o);[].forEach.call(a,function(e){s.add(e.parentNode)}),o=Array.from(s)}var l=0;return[].some.call(o,function(e){if(!r.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.test(n)&&!i.test(n)||e.matches("li p"))return!1;var o=e.textContent.trim().length;return!(or.minScore})}},238:function(e){function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw 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".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 Error("Do not pass live node lists to _removeNodes");for(var i=e.length-1;i>=0;i--){var n=e[i],r=n.parentNode;r&&(!t||t.call(this,n,i,e))&&r.removeChild(n)}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw Error("Do not pass live node lists to _replaceNodeTags");for(let i of e)this._setNodeTag(i,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),i=t.map(function(t){return e.call(t)});return Array.prototype.concat.apply([],i)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var i=e.getElementsByTagName(t);return Array.isArray(i)?i:Array.from(i)}))},_cleanClasses:function(e){var t=this._classesToPreserve,i=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return -1!=t.indexOf(e)}).join(" ");for(i?e.setAttribute("class",i):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,i=this._doc.documentURI;function n(e){if(t==i&&"#"==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 i=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(i,e)}else{for(var r=this._doc.createElement("span");e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",n(t))});var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,function(e){var t=e.getAttribute("src"),i=e.getAttribute("poster"),r=e.getAttribute("srcset");if(t&&e.setAttribute("src",n(t)),i&&e.setAttribute("poster",n(i)),r){var o=r.replace(this.REGEXPS.srcsetUrl,function(e,t,i,r){return n(t)+(i||"")+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}else if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var i=t.children[0],n=0;n»] /.test(t))n=/ [\\\/>»] /.test(t),3>r(t=i.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))&&(t=i.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),a=t.trim();!this._someNode(o,function(e){return e.textContent.trim()===a})&&(3>r(t=i.substring(i.lastIndexOf(":")+1))?t=i.substring(i.indexOf(":")+1):r(i.substr(0,i.indexOf(":")))>5&&(t=i))}else if(t.length>150||t.length<15){var s=e.getElementsByTagName("h1");1===s.length&&(t=this._getInnerText(s[0]))}var l=r(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!n||l!=r(i.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=i),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,i=!1;(t=this._nextNode(t))&&"BR"==t.tagName;){i=!0;var n=t.nextSibling;t.parentNode.removeChild(t),t=n}if(i){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 a=t.nextSibling;r.appendChild(t),t=a}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 i=e.ownerDocument.createElement(t);e.firstChild;)i.appendChild(e.firstChild);e.parentNode.replaceChild(i,e),e.readability&&(i.readability=e.readability);for(var n=0;n!i.includes(e)).join(" ").length/n.join(" ").length:0},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var i=e.getAttribute("rel"),n=e.getAttribute("itemprop");return!!(("author"===i||n&&-1!==n.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 i=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++i!==t);)e=e.parentNode;return n},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,i=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var n=e.innerHTML;;){this.log("Starting grabArticle loop");var r,o=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),a=[],s=this._doc.documentElement;let X=!0;for(;s;){"HTML"===s.tagName&&(this._articleLang=s.getAttribute("lang"));var l=s.className+" "+s.id;if(!this._isProbablyVisible(s)){this.log("Removing hidden node - "+l),s=this._removeAndGetNext(s);continue}if(this._checkByline(s,l)){s=this._removeAndGetNext(s);continue}if(X&&this._headerDuplicatesTitle(s)){this.log("Removing header: ",s.textContent.trim(),this._articleTitle.trim()),X=!1,s=this._removeAndGetNext(s);continue}if(o){if(this.REGEXPS.unlikelyCandidates.test(l)&&!this.REGEXPS.okMaybeItsACandidate.test(l)&&!this._hasAncestorTag(s,"table")&&!this._hasAncestorTag(s,"code")&&"BODY"!==s.tagName&&"A"!==s.tagName){this.log("Removing unlikely candidate - "+l),s=this._removeAndGetNext(s);continue}if(this.UNLIKELY_ROLES.includes(s.getAttribute("role"))){this.log("Removing content with role "+s.getAttribute("role")+" - "+l),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)){s=this._removeAndGetNext(s);continue}if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(s.tagName)&&a.push(s),"DIV"===s.tagName){for(var c=null,h=s.firstChild;h;){var d=h.nextSibling;if(this._isPhrasingContent(h))null!==c?c.appendChild(h):this._isWhitespace(h)||(c=t.createElement("p"),s.replaceChild(c,h),c.appendChild(h));else if(null!==c){for(;c.lastChild&&this._isWhitespace(c.lastChild);)c.removeChild(c.lastChild);c=null}h=d}if(this._hasSingleTagInsideElement(s,"P")&&.25>this._getLinkDensity(s)){var u=s.children[0];s.parentNode.replaceChild(u,s),s=u,a.push(s)}else this._hasChildBlockElement(s)||(s=this._setNodeTag(s,"P"),a.push(s))}s=this._getNextNode(s)}var f=[];this._forEachNode(a,function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t,i=this._getInnerText(e);if(!(i.length<25)){var n=this._getNodeAncestors(e,5);0!==n.length&&(t=1+i.split(",").length+Math.min(Math.floor(i.length/100),3),this._forEachNode(n,function(e,i){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),f.push(e)),0===i)var n=1;else n=1===i?2:3*i;e.readability.contentScore+=t/n}}))}}});for(var g=[],m=0,p=f.length;mE.readability.contentScore){g.splice(y,0,_),g.length>this._nbTopCandidates&&g.pop();break}}}var b=g[0]||null,N=!1;if(null===b||"BODY"===b.tagName){for(b=t.createElement("DIV"),N=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),b.appendChild(e.firstChild);e.appendChild(b),this._initializeNode(b)}else if(b){for(var T=[],A=1;A=.75&&T.push(this._getNodeAncestors(g[A]));if(T.length>=3)for(r=b.parentNode;"BODY"!==r.tagName;){for(var S=0,C=0;C=3){b=r;break}r=r.parentNode}b.readability||this._initializeNode(b),r=b.parentNode;for(var L=b.readability.contentScore,x=L/3;"BODY"!==r.tagName;){if(!r.readability){r=r.parentNode;continue}var w=r.readability.contentScore;if(wL){b=r;break}L=r.readability.contentScore,r=r.parentNode}for(r=b.parentNode;"BODY"!=r.tagName&&1==r.children.length;)r=(b=r).parentNode;b.readability||this._initializeNode(b)}var O=t.createElement("DIV");i&&(O.id="readability-content");for(var R=Math.max(10,.2*b.readability.contentScore),I=(r=b.parentNode).children,P=0,D=I.length;P=R)B=!0;else if("P"===M.nodeName){var k=this._getLinkDensity(M),U=this._getInnerText(M),G=U.length;G>80&&k<.25?B=!0:G<80&&G>0&&0===k&&-1!==U.search(/\.( |$)/)&&(B=!0)}}B&&(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")),O.appendChild(M),I=r.children,P-=1,D-=1)}if(this._debug&&this.log("Article content pre-prep: "+O.innerHTML),this._prepArticle(O),this._debug&&this.log("Article content post-prep: "+O.innerHTML),N)b.id="readability-page-1",b.className="page";else{var j=t.createElement("DIV");for(j.id="readability-page-1",j.className="page";O.firstChild;)j.appendChild(O.firstChild);O.appendChild(j)}this._debug&&this.log("Article content after paging: "+O.innerHTML);var W=!0,F=this._getInnerText(O,!0).length;if(F0&&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,i){return t[i]}).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,function(e,t,i){return String.fromCharCode(parseInt(t||i,t?16:10))})},_getJSONLD:function(e){var t,i=this._getAllNodesWithTag(e,["script"]);return this._forEachNode(i,function(e){if(!t&&"application/ld+json"===e.getAttribute("type"))try{var i=e.textContent.replace(/^\s*\s*$/g,""),n=JSON.parse(i);if(!n["@context"]||!n["@context"].match(/^https?\:\/\/schema\.org$/)||(!n["@type"]&&Array.isArray(n["@graph"])&&(n=n["@graph"].find(function(e){return(e["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)})),!n||!n["@type"]||!n["@type"].match(this.REGEXPS.jsonLdArticleTypes)))return;if(t={},"string"==typeof n.name&&"string"==typeof n.headline&&n.name!==n.headline){var r=this._getArticleTitle(),o=this._textSimilarity(n.name,r)>.75;this._textSimilarity(n.headline,r)>.75&&!o?t.title=n.headline:t.title=n.name}else"string"==typeof n.name?t.title=n.name.trim():"string"==typeof n.headline&&(t.title=n.headline.trim());n.author&&("string"==typeof n.author.name?t.byline=n.author.name.trim():Array.isArray(n.author)&&n.author[0]&&"string"==typeof n.author[0].name&&(t.byline=n.author.filter(function(e){return e&&"string"==typeof e.name}).map(function(e){return e.name.trim()}).join(", "))),"string"==typeof n.description&&(t.excerpt=n.description.trim()),n.publisher&&"string"==typeof n.publisher.name&&(t.siteName=n.publisher.name.trim());return}catch(e){this.log(e.message)}}),t||{}},_getArticleMetadata:function(e){var t={},i={},n=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(n,function(e){var t=e.getAttribute("name"),n=e.getAttribute("property"),a=e.getAttribute("content");if(a){var s=null,l=null;n&&(s=n.match(r))&&(i[l=s[0].toLowerCase().replace(/\s/g,"")]=a.trim()),!s&&t&&o.test(t)&&(l=t,a&&(i[l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":")]=a.trim()))}}),t.title=e.title||i["dc:title"]||i["dcterm:title"]||i["og:title"]||i["weibo:article:title"]||i["weibo:webpage:title"]||i.title||i["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||i["dc:creator"]||i["dcterm:creator"]||i.author,t.excerpt=e.excerpt||i["dc:description"]||i["dcterm:description"]||i["og:description"]||i["weibo:article:description"]||i["weibo:webpage:description"]||i.description||i["twitter:description"],t.siteName=e.siteName||i["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;t0)||!(r>i));){if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,r++}return!1},_getRowAndColumnCount:function(e){for(var t=0,i=0,n=e.getElementsByTagName("tr"),r=0;r0){n._readabilityDataTable=!0;continue}if(["col","colgroup","tfoot","thead","th"].some(function(e){return!!n.getElementsByTagName(e)[0]})){this.log("Data table because found data-y descendant"),n._readabilityDataTable=!0;continue}if(n.getElementsByTagName("table")[0]){n._readabilityDataTable=!1;continue}var o=this._getRowAndColumnCount(n);if(o.rows>=10||o.columns>4){n._readabilityDataTable=!0;continue}n._readabilityDataTable=o.rows*o.columns>10}},_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,i=0;in+=this._getInnerText(e,!0).length),n/i},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),function(e){var i=function(e){return e._readabilityDataTable},n="ul"===t||"ol"===t;if(!n){var r=0,o=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(o,e=>r+=this._getInnerText(e).length),n=r/this._getInnerText(e).length>.9}if("table"===t&&i(e)||this._hasAncestorTag(e,"table",-1,i)||this._hasAncestorTag(e,"code"))return!1;var a=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),a+0<0)return!0;if(10>this._getCharCount(e,",")){for(var s=e.getElementsByTagName("p").length,l=e.getElementsByTagName("img").length,c=e.getElementsByTagName("li").length-100,h=e.getElementsByTagName("input").length,d=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),u=0,f=this._getAllNodesWithTag(e,["object","embed","iframe"]),g=0;g1&&s/l<.5&&!this._hasAncestorTag(e,"figure")||!n&&c>s||h>Math.floor(s/3)||!n&&d<.9&&_<25&&(0===l||l>2)&&!this._hasAncestorTag(e,"figure")||!n&&a<25&&p>.2||a>=25&&p>.5||1===u&&_<75||u>1}return!1})},_cleanMatchedNodes:function(e,t){for(var i=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=i;)n=t.call(this,n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,function(e){let t=0>this._getClassWeight(e);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 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 i=this._getArticleMetadata(t);this._articleTitle=i.title;var n=this._grabArticle();if(!n)return null;if(this.log("Grabbed: "+n.innerHTML),this._postProcessContent(n),!i.excerpt){var r=n.getElementsByTagName("p");r.length>0&&(i.excerpt=r[0].textContent.trim())}var o=n.textContent;return{title:this._articleTitle,byline:i.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(n),textContent:o,length:o.length,excerpt:i.excerpt,siteName:i.siteName||this._articleSiteName}}},e.exports=t},396:function(e,t,i){e.exports={Readability:i(238),isProbablyReaderable:i(804)}},900:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cloneNode=function(e,t){if(e=e.cloneNode(!0),!t.images)for(let t of e.getElementsByTagName("img"))t.remove();if(!t.styles)for(let t of e.querySelectorAll("button, form, select, input, textarea"))t.remove();for(let t of e.querySelectorAll(i.join(",")))t.remove();return e};let i=["script","noscript"]},399:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.toJpeg=function(e,t,i){return n(this,void 0,void 0,function*(){return i.raster=!0,h(e,t,i).then(e=>null==e?void 0:e.toDataURL("image/jpeg",i.quality||1))})},t.toBlob=function(e,t,i){return i.raster=!0,h(e,t,i).then(e=>e&&(0,s.canvasToBlob)(e))},t.toPng=function(e,t,i){return i.raster=!0,h(e,t,i).then(function(e){return null==e?void 0:e.toDataURL()})},t.toSvg=function(e,t,i){return d(e,t,i.width||(0,s.width)(e),i.height||(0,s.height)(e))},t.getInlinedNode=function(e,t){return n(this,void 0,void 0,function*(){let{fonts:i,images:n,stylesheets:r,inlineImages:c}=t.inlineOptions||{},h=(0,l.cloneNode)(e,{images:n,styles:r});if(!(!h||h instanceof Text)){var d,u;return i&&(h=yield(d=h,u=t.fetchOptions,(0,o.resolveAll)(u).then(function(e){let t=document.createElement("style");return d.appendChild(t),t.appendChild(document.createTextNode(e)),d}))),c&&(yield(0,a.inlineAllImages)(h,t.fetchOptions)),function(e){for(let t of e.querySelectorAll("*"))!(!(t instanceof HTMLElement)||(0,s.isSVGElement)(t))&&t instanceof HTMLAnchorElement&&(t.href=t.href.startsWith("http")?t.href:document.location.origin+t.href)}(h),h}})};let r=i(113),o=i(536),a=i(307),s=i(132),l=i(900),c={inlineOptions:{}};function h(e,t,i){return n(this,void 0,void 0,function*(){let n="data:image/svg+xml; charset=utf8, "+encodeURIComponent(d(e,t,(i=Object.assign(Object.assign({},c),i)).width||(0,s.width)(e),i.height||(0,s.height)(e)));return(0,r.createImage)(n,i.fetchOptions).then((0,s.delay)(0)).then(function(t){if(!t)return null;t.setAttribute("crossorigin","anonymous");let n="number"!=typeof i.scale?1:i.scale,r=function(e,t,i){let n=document.createElement("canvas");if(n.width=(i.width||(0,s.width)(e))*t,n.height=(i.height||(0,s.height)(e))*t,i.backgroundColor){let e=n.getContext("2d");if(!e)return null;e.fillStyle=i.backgroundColor,e.fillRect(0,0,n.width,n.height)}return n}(e,n,i),o=null==r?void 0:r.getContext("2d");return o?(o.imageSmoothingEnabled=!1,o.scale(n,n),o.drawImage(t,0,0),r):null})})}function d(e,t,i,n){for(let t of(e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),e.querySelectorAll("img, svg, video, iframe")))for(let e of t.getAttributeNames())e.match(/\W/)&&t.removeAttribute(e);let r=new XMLSerializer().serializeToString(e);return''+Array.from(t.getElementsByTagName("style")).map(e=>new XMLSerializer().serializeToString(e)).join("\n")+''+r+""}},113:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};function n(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 i(this,void 0,void 0,function*(){if(!e)return null;let i=yield fetch(n(e,t));if(!i.ok)return"";let r=yield i.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(i,r){let o=new Image;o.crossOrigin=(null==t?void 0:t.crossOrigin)||null,o.onload=function(){i(o)},o.onerror=()=>r(Error("Failed to render image.")),o.src=n(e,t)})},t.reloadImage=function(e,t){return t.corsHost&&e.currentSrc.startsWith(t.corsHost)?Promise.resolve(null):(t.noCache=!0,new Promise(function(i,r){e.crossOrigin=t.crossOrigin||null,e.onload=function(){i(e)},e.onerror=t=>{console.error("Failed to load image",e.currentSrc),r(t)},e.src=n(e.currentSrc,t)}))},t.constructUrl=n},536:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAll=function(e){return n(this,void 0,void 0,function*(){let t=a(function(e){let t=[];for(let i of e)try{let e=a(Array.from(i.cssRules));e.length>3&&t.push(e[0])}catch(e){e instanceof Error&&console.log("Error while reading CSS rules from "+i.href,e.toString())}return t}(document.styleSheets)).map(o),i=[];for(let n of t)i.push((yield n.resolve(e)));return i.join("\n")})};let r=i(812);function o(e){return{resolve:function(t){let i=(e.parentStyleSheet||{}).href||void 0;return(0,r.inlineAll)(e.cssText,t,i)},src:function(){return e.style.getPropertyValue("src")}}}function a(e){return e.filter(function(e){return e.type===CSSRule.FONT_FACE_RULE}).filter(function(e){return(0,r.shouldProcess)(e.style.getPropertyValue("src"))})}},307:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineAllImages=function(e,t){return n(this,void 0,void 0,function*(){let i=e.querySelectorAll("img"),a=[];for(let e=0;econsole.error(e))})};let r=i(113),o=i(132)},769:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.clipPage=function(e,t,i){return n(this,void 0,void 0,function*(){let{body:n,head:r}=yield E(e,i,t);if(!n||!r)return null;let o=v(r,n).documentElement.outerHTML;return` -${o}`})},t.clipArticle=function(e,t){return n(this,void 0,void 0,function*(){let{body:i,head:n}=yield E(e,t);if(!i||!n)return null;let o=v(n,i),a=new r.Readability(o);a.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];let s=a.parse();return`${(null==n?void 0:n.outerHTML)||""}${(null==s?void 0:s.content)||""}`})},t.cleanup=y,t.clipScreenshot=function(e){return n(this,arguments,void 0,function*(e,t="jpeg",i){let n=b(i),{body:r,head:o}=yield E(document,i,!1);if(!r||!o)return null;let a="jpeg"===t?s.toJpeg:"png"===t?s.toPng:"svg"===t?s.toSvg:s.toBlob,l=yield a(r,o,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:n,inlineOptions:{inlineImages:!0,fonts:!0,images:!0,stylesheets:!0}});return"jpeg"===t||"png"===t?``:l})},t.enterNodeSelectionMode=function(e,t){let i;return setTimeout(()=>{e.body.addEventListener("click",_),e.body.addEventListener("mouseout",p),e.body.addEventListener("mouseover",m)},0),i=`.${c} { +(()=>{var e={804:function(e){var t=/-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,i=/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,r={}){"function"==typeof r&&(r={visibilityChecker:r}),r=Object.assign({minScore:20,minContentLength:140,visibilityChecker:n},r);var o=e.querySelectorAll("p, pre, article"),a=e.querySelectorAll("div > br");if(a.length){var l=new Set(o);[].forEach.call(a,function(e){l.add(e.parentNode)}),o=Array.from(l)}var s=0;return[].some.call(o,function(e){if(!r.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.test(n)&&!i.test(n)||e.matches("li p"))return!1;var o=e.textContent.trim().length;return!(or.minScore})}},238:function(e){function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw 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._allowedVideoRegex=t.allowedVideoRegex||this.REGEXPS.videos,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 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 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 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".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 Error("Do not pass live node lists to _removeNodes");for(var i=e.length-1;i>=0;i--){var n=e[i],r=n.parentNode;r&&(!t||t.call(this,n,i,e))&&r.removeChild(n)}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw Error("Do not pass live node lists to _replaceNodeTags");for(let i of e)this._setNodeTag(i,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),i=t.map(function(t){return e.call(t)});return Array.prototype.concat.apply([],i)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var i=e.getElementsByTagName(t);return Array.isArray(i)?i:Array.from(i)}))},_cleanClasses:function(e){var t=this._classesToPreserve,i=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return -1!=t.indexOf(e)}).join(" ");for(i?e.setAttribute("class",i):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,i=this._doc.documentURI;function n(e){if(t==i&&"#"==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 i=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(i,e)}else{for(var r=this._doc.createElement("span");e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",n(t))});var o=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(o,function(e){var t=e.getAttribute("src"),i=e.getAttribute("poster"),r=e.getAttribute("srcset");if(t&&e.setAttribute("src",n(t)),i&&e.setAttribute("poster",n(i)),r){var o=r.replace(this.REGEXPS.srcsetUrl,function(e,t,i,r){return n(t)+(i||"")+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}else if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var i=t.children[0],n=0;n»] /.test(t))n=/ [\\\/>»] /.test(t),3>r(t=i.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))&&(t=i.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var o=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),a=t.trim();!this._someNode(o,function(e){return e.textContent.trim()===a})&&(3>r(t=i.substring(i.lastIndexOf(":")+1))?t=i.substring(i.indexOf(":")+1):r(i.substr(0,i.indexOf(":")))>5&&(t=i))}else if(t.length>150||t.length<15){var l=e.getElementsByTagName("h1");1===l.length&&(t=this._getInnerText(l[0]))}var s=r(t=t.trim().replace(this.REGEXPS.normalize," "));return s<=4&&(!n||s!=r(i.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=i),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,i=!1;(t=this._nextNode(t))&&"BR"==t.tagName;){i=!0;var n=t.nextSibling;t.parentNode.removeChild(t),t=n}if(i){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 a=t.nextSibling;r.appendChild(t),t=a}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 i=e.ownerDocument.createElement(t);e.firstChild;)i.appendChild(e.firstChild);e.parentNode.replaceChild(i,e),e.readability&&(i.readability=e.readability);for(var n=0;n!i.includes(e)).join(" ").length/n.join(" ").length:0},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var i=e.getAttribute("rel"),n=e.getAttribute("itemprop");return!!(("author"===i||n&&-1!==n.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 i=0,n=[];e.parentNode&&(n.push(e.parentNode),!t||++i!==t);)e=e.parentNode;return n},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,i=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var n=e.innerHTML;;){this.log("Starting grabArticle loop");var r,o=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),a=[],l=this._doc.documentElement;let $=!0;for(;l;){"HTML"===l.tagName&&(this._articleLang=l.getAttribute("lang"));var s=l.className+" "+l.id;if(!this._isProbablyVisible(l)){this.log("Removing hidden node - "+s),l=this._removeAndGetNext(l);continue}if("true"==l.getAttribute("aria-modal")&&"dialog"==l.getAttribute("role")||this._checkByline(l,s)){l=this._removeAndGetNext(l);continue}if($&&this._headerDuplicatesTitle(l)){this.log("Removing header: ",l.textContent.trim(),this._articleTitle.trim()),$=!1,l=this._removeAndGetNext(l);continue}if(o){if(this.REGEXPS.unlikelyCandidates.test(s)&&!this.REGEXPS.okMaybeItsACandidate.test(s)&&!this._hasAncestorTag(l,"table")&&!this._hasAncestorTag(l,"code")&&"BODY"!==l.tagName&&"A"!==l.tagName){this.log("Removing unlikely candidate - "+s),l=this._removeAndGetNext(l);continue}if(this.UNLIKELY_ROLES.includes(l.getAttribute("role"))){this.log("Removing content with role "+l.getAttribute("role")+" - "+s),l=this._removeAndGetNext(l);continue}}if(("DIV"===l.tagName||"SECTION"===l.tagName||"HEADER"===l.tagName||"H1"===l.tagName||"H2"===l.tagName||"H3"===l.tagName||"H4"===l.tagName||"H5"===l.tagName||"H6"===l.tagName)&&this._isElementWithoutContent(l)){l=this._removeAndGetNext(l);continue}if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(l.tagName)&&a.push(l),"DIV"===l.tagName){for(var c=null,d=l.firstChild;d;){var h=d.nextSibling;if(this._isPhrasingContent(d))null!==c?c.appendChild(d):this._isWhitespace(d)||(c=t.createElement("p"),l.replaceChild(c,d),c.appendChild(d));else if(null!==c){for(;c.lastChild&&this._isWhitespace(c.lastChild);)c.removeChild(c.lastChild);c=null}d=h}if(this._hasSingleTagInsideElement(l,"P")&&.25>this._getLinkDensity(l)){var u=l.children[0];l.parentNode.replaceChild(u,l),l=u,a.push(l)}else this._hasChildBlockElement(l)||(l=this._setNodeTag(l,"P"),a.push(l))}l=this._getNextNode(l)}var f=[];this._forEachNode(a,function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t,i=this._getInnerText(e);if(!(i.length<25)){var n=this._getNodeAncestors(e,5);0!==n.length&&(t=1+i.split(",").length+Math.min(Math.floor(i.length/100),3),this._forEachNode(n,function(e,i){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),f.push(e)),0===i)var n=1;else n=1===i?2:3*i;e.readability.contentScore+=t/n}}))}}});for(var g=[],m=0,p=f.length;mE.readability.contentScore){g.splice(v,0,_),g.length>this._nbTopCandidates&&g.pop();break}}}var b=g[0]||null,N=!1;if(null===b||"BODY"===b.tagName){for(b=t.createElement("DIV"),N=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),b.appendChild(e.firstChild);e.appendChild(b),this._initializeNode(b)}else if(b){for(var T=[],A=1;A=.75&&T.push(this._getNodeAncestors(g[A]));if(T.length>=3)for(r=b.parentNode;"BODY"!==r.tagName;){for(var S=0,C=0;C=3){b=r;break}r=r.parentNode}b.readability||this._initializeNode(b),r=b.parentNode;for(var L=b.readability.contentScore,x=L/3;"BODY"!==r.tagName;){if(!r.readability){r=r.parentNode;continue}var w=r.readability.contentScore;if(wL){b=r;break}L=r.readability.contentScore,r=r.parentNode}for(r=b.parentNode;"BODY"!=r.tagName&&1==r.children.length;)r=(b=r).parentNode;b.readability||this._initializeNode(b)}var O=t.createElement("DIV");i&&(O.id="readability-content");for(var R=Math.max(10,.2*b.readability.contentScore),I=(r=b.parentNode).children,P=0,D=I.length;P=R)B=!0;else if("P"===M.nodeName){var k=this._getLinkDensity(M),U=this._getInnerText(M),G=U.length;G>80&&k<.25?B=!0:G<80&&G>0&&0===k&&-1!==U.search(/\.( |$)/)&&(B=!0)}}B&&(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")),O.appendChild(M),I=r.children,P-=1,D-=1)}if(this._debug&&this.log("Article content pre-prep: "+O.innerHTML),this._prepArticle(O),this._debug&&this.log("Article content post-prep: "+O.innerHTML),N)b.id="readability-page-1",b.className="page";else{var j=t.createElement("DIV");for(j.id="readability-page-1",j.className="page";O.firstChild;)j.appendChild(O.firstChild);O.appendChild(j)}this._debug&&this.log("Article content after paging: "+O.innerHTML);var W=!0,V=this._getInnerText(O,!0).length;if(V0&&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,i){return t[i]}).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,function(e,t,i){return String.fromCharCode(parseInt(t||i,t?16:10))})},_getJSONLD:function(e){var t,i=this._getAllNodesWithTag(e,["script"]);return this._forEachNode(i,function(e){if(!t&&"application/ld+json"===e.getAttribute("type"))try{var i=e.textContent.replace(/^\s*\s*$/g,""),n=JSON.parse(i);if(!n["@context"]||!n["@context"].match(/^https?\:\/\/schema\.org$/)||(!n["@type"]&&Array.isArray(n["@graph"])&&(n=n["@graph"].find(function(e){return(e["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)})),!n||!n["@type"]||!n["@type"].match(this.REGEXPS.jsonLdArticleTypes)))return;if(t={},"string"==typeof n.name&&"string"==typeof n.headline&&n.name!==n.headline){var r=this._getArticleTitle(),o=this._textSimilarity(n.name,r)>.75;this._textSimilarity(n.headline,r)>.75&&!o?t.title=n.headline:t.title=n.name}else"string"==typeof n.name?t.title=n.name.trim():"string"==typeof n.headline&&(t.title=n.headline.trim());n.author&&("string"==typeof n.author.name?t.byline=n.author.name.trim():Array.isArray(n.author)&&n.author[0]&&"string"==typeof n.author[0].name&&(t.byline=n.author.filter(function(e){return e&&"string"==typeof e.name}).map(function(e){return e.name.trim()}).join(", "))),"string"==typeof n.description&&(t.excerpt=n.description.trim()),n.publisher&&"string"==typeof n.publisher.name&&(t.siteName=n.publisher.name.trim());return}catch(e){this.log(e.message)}}),t||{}},_getArticleMetadata:function(e){var t={},i={},n=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(n,function(e){var t=e.getAttribute("name"),n=e.getAttribute("property"),a=e.getAttribute("content");if(a){var l=null,s=null;n&&(l=n.match(r))&&(i[s=l[0].toLowerCase().replace(/\s/g,"")]=a.trim()),!l&&t&&o.test(t)&&(s=t,a&&(i[s=s.toLowerCase().replace(/\s/g,"").replace(/\./g,":")]=a.trim()))}}),t.title=e.title||i["dc:title"]||i["dcterm:title"]||i["og:title"]||i["weibo:article:title"]||i["weibo:webpage:title"]||i.title||i["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||i["dc:creator"]||i["dcterm:creator"]||i.author,t.excerpt=e.excerpt||i["dc:description"]||i["dcterm:description"]||i["og:description"]||i["weibo:article:description"]||i["weibo:webpage:description"]||i.description||i["twitter:description"],t.siteName=e.siteName||i["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;t0)||!(r>i));){if(e.parentNode.tagName===t&&(!n||n(e.parentNode)))return!0;e=e.parentNode,r++}return!1},_getRowAndColumnCount:function(e){for(var t=0,i=0,n=e.getElementsByTagName("tr"),r=0;r0){n._readabilityDataTable=!0;continue}if(["col","colgroup","tfoot","thead","th"].some(function(e){return!!n.getElementsByTagName(e)[0]})){this.log("Data table because found data-y descendant"),n._readabilityDataTable=!0;continue}if(n.getElementsByTagName("table")[0]){n._readabilityDataTable=!1;continue}var o=this._getRowAndColumnCount(n);if(o.rows>=10||o.columns>4){n._readabilityDataTable=!0;continue}n._readabilityDataTable=o.rows*o.columns>10}},_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,i=0;in+=this._getInnerText(e,!0).length),n/i},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),function(e){var i=function(e){return e._readabilityDataTable},n="ul"===t||"ol"===t;if(!n){var r=0,o=this._getAllNodesWithTag(e,["ul","ol"]);this._forEachNode(o,e=>r+=this._getInnerText(e).length),n=r/this._getInnerText(e).length>.9}if("table"===t&&i(e)||this._hasAncestorTag(e,"table",-1,i)||this._hasAncestorTag(e,"code"))return!1;var a=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),a+0<0)return!0;if(10>this._getCharCount(e,",")){for(var l=e.getElementsByTagName("p").length,s=e.getElementsByTagName("img").length,c=e.getElementsByTagName("li").length-100,d=e.getElementsByTagName("input").length,h=this._getTextDensity(e,["h1","h2","h3","h4","h5","h6"]),u=0,f=this._getAllNodesWithTag(e,["object","embed","iframe"]),g=0;g1&&l/s<.5&&!this._hasAncestorTag(e,"figure")||!n&&c>l||d>Math.floor(l/3)||!n&&h<.9&&_<25&&(0===s||s>2)&&!this._hasAncestorTag(e,"figure")||!n&&a<25&&p>.2||a>=25&&p>.5||1===u&&_<75||u>1;if(n&&y){for(var v=0;v1)return y;if(s==e.getElementsByTagName("li").length)return!1}return y}return!1})},_cleanMatchedNodes:function(e,t){for(var i=this._getNextNode(e,!0),n=this._getNextNode(e);n&&n!=i;)n=t.call(this,n,n.className+" "+n.id)?this._removeAndGetNext(n):this._getNextNode(n)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,function(e){let t=0>this._getClassWeight(e);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 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 i=this._getArticleMetadata(t);this._articleTitle=i.title;var n=this._grabArticle();if(!n)return null;if(this.log("Grabbed: "+n.innerHTML),this._postProcessContent(n),!i.excerpt){var r=n.getElementsByTagName("p");r.length>0&&(i.excerpt=r[0].textContent.trim())}var o=n.textContent;return{title:this._articleTitle,byline:i.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(n),textContent:o,length:o.length,excerpt:i.excerpt,siteName:i.siteName||this._articleSiteName}}},e.exports=t},396:function(e,t,i){e.exports={Readability:i(238),isProbablyReaderable:i(804)}},900:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cloneNode=function(e,t){let n=(e=e.cloneNode(!0)).querySelectorAll("img");if(t.images)for(let e of n)e.src=e.currentSrc;else for(let e of n)e.remove();if(!t.styles)for(let t of e.querySelectorAll("button, form, select, input, textarea"))t.remove();for(let t of e.querySelectorAll(i.join(",")))t.remove();return e};let i=["script","noscript"]},399:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.toJpeg=function(e,t,i){return n(this,void 0,void 0,function*(){return i.raster=!0,d(e,t,i).then(e=>null==e?void 0:e.toDataURL("image/jpeg",i.quality||1))})},t.toBlob=function(e,t,i){return i.raster=!0,d(e,t,i).then(e=>e&&(0,l.canvasToBlob)(e))},t.toPng=function(e,t,i){return i.raster=!0,d(e,t,i).then(function(e){return null==e?void 0:e.toDataURL()})},t.toSvg=function(e,t,i){return h(e,t,i.width||(0,l.width)(e),i.height||(0,l.height)(e))},t.getInlinedNode=function(e,t){return n(this,void 0,void 0,function*(){let{fonts:i,images:n,stylesheets:r,inlineImages:c}=t.inlineOptions||{},d=(0,s.cloneNode)(e,{images:n,styles:r});if(!(!d||d instanceof Text)){var h,u;return i&&(d=yield(h=d,u=t.fetchOptions,(0,o.resolveAll)(u).then(function(e){let t=document.createElement("style");return h.appendChild(t),t.appendChild(document.createTextNode(e)),h}))),c&&(yield(0,a.inlineAllImages)(d,t.fetchOptions)),function(e){for(let t of e.querySelectorAll("*"))!(!(t instanceof HTMLElement)||(0,l.isSVGElement)(t))&&t instanceof HTMLAnchorElement&&(t.href=t.href.startsWith("http")?t.href:document.location.origin+t.href)}(d),d}})};let r=i(113),o=i(536),a=i(307),l=i(132),s=i(900),c={inlineOptions:{}};function d(e,t,i){return n(this,void 0,void 0,function*(){let n="data:image/svg+xml; charset=utf8, "+encodeURIComponent(h(e,t,(i=Object.assign(Object.assign({},c),i)).width||(0,l.width)(e),i.height||(0,l.height)(e)));return(0,r.createImage)(n,i.fetchOptions).then((0,l.delay)(0)).then(function(t){if(!t)return null;t.setAttribute("crossorigin","anonymous");let n="number"!=typeof i.scale?1:i.scale,r=function(e,t,i){let n=document.createElement("canvas");if(n.width=(i.width||(0,l.width)(e))*t,n.height=(i.height||(0,l.height)(e))*t,i.backgroundColor){let e=n.getContext("2d");if(!e)return null;e.fillStyle=i.backgroundColor,e.fillRect(0,0,n.width,n.height)}return n}(e,n,i),o=null==r?void 0:r.getContext("2d");return o?(o.imageSmoothingEnabled=!1,o.scale(n,n),o.drawImage(t,0,0),r):null})})}function h(e,t,i,n){for(let t of(e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),e.querySelectorAll("img, svg, video, iframe")))for(let e of t.getAttributeNames())e.match(/\W/)&&t.removeAttribute(e);let r=new XMLSerializer().serializeToString(e);return''+Array.from(t.getElementsByTagName("style")).map(e=>new XMLSerializer().serializeToString(e)).join("\n")+''+r+""}},113:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};function n(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 i(this,void 0,void 0,function*(){if(!e)return null;let i=yield fetch(n(e,t));if(!i.ok)return"";let r=yield i.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(i,r){let o=new Image;o.crossOrigin=(null==t?void 0:t.crossOrigin)||null,o.onload=function(){i(o)},o.onerror=()=>r(Error("Failed to render image.")),o.src=n(e,t)})},t.reloadImage=function(e,t){return t.corsHost&&e.currentSrc.startsWith(t.corsHost)?Promise.resolve(null):(t.noCache=!0,new Promise(function(i,r){e.crossOrigin=t.crossOrigin||null,e.onload=function(){i(e)},e.onerror=t=>{console.error("Failed to load image",e.currentSrc),r(t)},e.src=n(e.currentSrc,t)}))},t.constructUrl=n},536:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAll=function(e){return n(this,void 0,void 0,function*(){let t=a(function(e){let t=[];for(let i of e)try{let e=a(Array.from(i.cssRules));e.length>3&&t.push(e[0])}catch(e){e instanceof Error&&console.log("Error while reading CSS rules from "+i.href,e.toString())}return t}(document.styleSheets)).map(o),i=[];for(let n of t)i.push((yield n.resolve(e)));return i.join("\n")})};let r=i(812);function o(e){return{resolve:function(t){let i=(e.parentStyleSheet||{}).href||void 0;return(0,r.inlineAll)(e.cssText,t,i)},src:function(){return e.style.getPropertyValue("src")}}}function a(e){return e.filter(function(e){return e.type===CSSRule.FONT_FACE_RULE}).filter(function(e){return(0,r.shouldProcess)(e.style.getPropertyValue("src"))})}},307:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.inlineAllImages=function(e,t){return n(this,void 0,void 0,function*(){let i=e.querySelectorAll("img"),a=[];for(let e=0;econsole.error(e))})};let r=i(113),o=i(132)},769:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.clipPage=function(e,t,i){return n(this,void 0,void 0,function*(){let{body:n,head:r}=yield E(e,i,t);if(!n||!r)return null;let o=y(r,n).documentElement.outerHTML;return` +${o}`})},t.clipArticle=function(e,t){return n(this,void 0,void 0,function*(){let{body:i,head:n}=yield E(e,t);if(!i||!n)return null;let o=y(n,i),a=new r.Readability(o);a.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];let l=a.parse();return`${(null==n?void 0:n.outerHTML)||""}${(null==l?void 0:l.content)||""}`})},t.cleanup=v,t.clipScreenshot=function(e){return n(this,arguments,void 0,function*(e,t="jpeg",i){let n=b(i),{body:r,head:o}=yield E(document,i,!1);if(!r||!o)return null;let a="jpeg"===t?l.toJpeg:"png"===t?l.toPng:"svg"===t?l.toSvg:l.toBlob,s=yield a(r,o,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:n,inlineOptions:{inlineImages:!0,fonts:!0,images:!0,stylesheets:!0}});return"jpeg"===t||"png"===t?``:s})},t.enterNodeSelectionMode=function(e,t){let i;return setTimeout(()=>{e.body.addEventListener("click",_),e.body.addEventListener("mouseout",p),e.body.addEventListener("mouseover",m)},0),i=`.${c} { border: 1px solid green; background-color: rgb(0,0,0,0.05); cursor: pointer; } - .${h} { + .${d} { border: 2px solid green; cursor: pointer; } - .${d} { + .${h} { position: fixed; bottom: 0px; right: 0px; z-index: ${Number.MAX_VALUE}; - }`,(0,o.injectCss)(i,"nn-clipper-styles"),new Promise((e,i)=>{var r,o;let l;r=()=>n(this,void 0,void 0,function*(){y();let i=document.querySelectorAll(`.${h}`),{head:n}=yield E(document,t,!1),r=document.createElement("html");r.append(n);let o=document.createElement("body");for(let e of(r.append(o),i)){e.classList.remove(h);let i=yield(0,s.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:Object.assign(Object.assign({},f),{images:null==t?void 0:t.images,inlineImages:null==t?void 0:t.inlineImages})});i&&o.appendChild(i)}e(null==r?void 0:r.outerHTML)}),o=()=>i("Cancelled."),(l=document.createElement("div")).classList.add(d),setTimeout(()=>{document.body.appendChild(l)},0),(0,a.app)({init:{isClipping:!1},view:({isClipping:e})=>(0,a.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,a.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,a.text)("Notesnook Web Clipper")]),(0,a.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[e?(0,a.text)("Clipping selected elements. Please wait..."):(0,a.text)("Click on any element to select it.")]),(0,a.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,a.h)("button",{onclick:e=>[Object.assign(Object.assign({},e),{isClipping:!0}),e=>{null==r||r(),e({isClipping:!1})}],style:{marginRight:"5px"},disabled:e},[e?(0,a.text)("Clipping..."):(0,a.text)("Clip")]),(0,a.h)("button",{onclick:e=>(y(),null==o||o(),e),disabled:e},[(0,a.text)("Cancel")])])]),node:l})})};let r=i(396),o=i(132),a=i(673),s=i(399),l=i(707),c="nn-node-selection--hover",h="nn-node-selection--selected",d="nn-node-selection-container",u=[h,d],f={fonts:!1,images:!1,stylesheets:!0};function g(e){for(let t of u)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}let m=e=>{let t=e.target;!t.classList.contains(c)&&g(t)&&t.classList.add(c)},p=e=>{let t=e.target;t.classList.contains(c)&&t.classList.remove(c)},_=e=>{e.preventDefault();let t=e.target;t.classList.contains(h)?t.classList.remove(h):g(t)&&t.classList.add(h)};function v(e,t){let i=document.implementation.createHTMLDocument();return i.documentElement.replaceChildren(e,t),i}function y(){setTimeout(()=>{var e;document.querySelectorAll(`.${h}`).forEach(e=>{e instanceof HTMLElement&&e.classList.remove(h)}),document.querySelectorAll(`.${d}`).forEach(e=>e.remove()),(e=document).body.removeEventListener("mouseout",p),e.body.removeEventListener("mouseover",m),document.body.removeEventListener("click",_)},0)}function E(e,t){return n(this,arguments,void 0,function*(e,t,i=!1){let n=b(t),r=yield(0,s.getInlinedNode)(e.body,{raster:!0,fetchOptions:n,inlineOptions:{fonts:!1,inlineImages:null==t?void 0:t.inlineImages,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},filter:e=>{var t;let n,r,o,a,s,l,c,h,d,u,f,g,m,p,_,v;return!i||(((t=e).nodeType===Node.TEXT_NODE||!t.getBoundingClientRect)&&t.parentElement&&(t=t.parentElement),(n={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth,s=r.left>=0&&r.left+r.width<=a,l=r.top>=0&&r.top+r.height<=o,n.isInsideViewport=s&&l,c=r.left<0&&r.left+r.width>a,h=r.top<0&&r.top+r.height>o,n.isAroundViewport=c&&h,d=r.top<0&&r.top+r.height>0,u=r.lefta,f=r.left<0&&r.left+r.width>0,g=r.topo,m=l||h||d||g,p=s||c||f||u,n.isOnTopEdge=d&&p,n.isOnRightEdge=u&&m,n.isOnBottomEdge=g&&p,n.isOnLeftEdge=f&&m,n.isOnEdge=n.isOnLeftEdge||n.isOnRightEdge||n.isOnTopEdge||n.isOnBottomEdge,_=s||c||n.isOnLeftEdge||n.isOnRightEdge,v=l||h||n.isOnTopEdge||n.isOnBottomEdge,n.isInViewport=_&&v,n.isPartiallyInViewport=n.isInViewport&&n.isOnEdge,n).isInViewport)}});if(!r)return{};let o=e.createElement("head"),a=e.createElement("title");for(let[i,s]of(a.innerText=e.title,o.appendChild(a),(null==t?void 0:t.styles)&&(yield(0,l.addStylesToHead)(o,n)),Object.entries(function(e){let t={};for(let{name:i}of e.attributes){let n=e.getAttribute(i);n&&(t[i]=n)}return t}(e.documentElement))))r.setAttribute(i,s);return{body:r,head:o}})}function b(e){return(null==e?void 0:e.corsProxy)?{bypassCors:!0,corsHost:e.corsProxy,crossOrigin:"anonymous",noCache:!0}:void 0}},812:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldProcess=s,t.inlineAll=function(e,t,i,a){return n(this,void 0,void 0,function*(){if(!s(e))return e;for(let s of l(e))e=yield(function(e,t,i,a,s){return n(this,void 0,void 0,function*(){let n=a?(0,o.resolveUrl)(t,a):t,l=s?(0,r.constructUrl)(n,i):yield(0,r.fetchResource)(n,i).catch(()=>(0,r.constructUrl)(n,i));return e.replace(t,l||n)})})(e,s,t,i,a).catch(t=>(console.error(t),e));return e})},t.readUrls=l;let r=i(113),o=i(132),a=/url\(['"]?([^'"]+?)['"]?\)/g;function s(e){return -1!==e.search(a)}function l(e){let t,i=[];for(;null!==(t=a.exec(e));)i.push(t[1]);return i.filter(function(e){return!(0,o.isDataUrl)(e)})}},707:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.addStylesToHead=function(e,t){return n(this,void 0,void 0,function*(){for(let i of(yield function(e){return n(this,void 0,void 0,function*(){for(let t of document.styleSheets){let i=[];if(!(yield function(e,t){return n(this,void 0,void 0,function*(){try{e.cssRules.length}catch(n){let i=e.ownerNode;if(e.href&&i instanceof HTMLLinkElement){if(s(i))return!0;let e=yield a(i.href,t);e&&i.replaceWith(e)}return!0}return s(e)})}(t,e))){for(let n=0;n0){yield c(i,t);let n=l(i.cssRules);e.appendChild(n);continue}if(i.ownerNode instanceof HTMLStyleElement){e.appendChild(i.ownerNode.cloneNode(!0));continue}}})};let r=i(113),o=i(812);function a(e,t){return n(this,void 0,void 0,function*(){try{let i=document.createElement("style"),n=yield fetch((0,r.constructUrl)(e,t));if(!n.ok)return!1;return i.innerHTML=yield n.text(),i.setAttribute("href",e),i}catch(t){console.error("Failed to inline stylesheet",e,t)}})}function s(e){return("string"==typeof e.media?e.media:e.media.mediaText).split(",").map(e=>e.trim()).includes("print")}function l(e){let t=Array.from(e).map(e=>e.cssText).reduce((e,t)=>e+t,""),i=document.createElement("style");return i.innerHTML=t,i}function c(e,t){return n(this,void 0,void 0,function*(){let i=[];for(let n of e.cssRules)if(n.type===CSSRule.STYLE_RULE)i.push(h(e,n,t));else if(n.type===CSSRule.MEDIA_RULE){let r=window.matchMedia(n.media.mediaText).matches;for(let o of n.cssRules)o&&o.type===CSSRule.STYLE_RULE&&i.push(h(e,o,t,r))}else if(n.type===CSSRule.SUPPORTS_RULE)for(let r of n.cssRules)r&&r.type===CSSRule.STYLE_RULE&&i.push(h(e,r,t,!1));yield Promise.allSettled(i)})}function h(e,t,i){return n(this,arguments,void 0,function*(e,t,i,n=!0){let r=e.href||document.location.href;for(let e of t.style){let a=t.style.getPropertyValue(e);if(!a)continue;let s=yield(0,o.inlineAll)(a,i,r,!n);t.style.setProperty(e,s)}})}},132:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.injectCss=function(e,t){let i=document.getElementById(t),n=document.getElementsByTagName("head")[0];i&&n.removeChild(i);let r=document.createElement("style");r.type="text/css",r.id=t,r.appendChild(document.createTextNode(e)),n.insertBefore(r,function(){for(let 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=a,t.mimeType=function(e){return o[a(e).toLowerCase()]||""},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){let t=atob(e.toDataURL().split(",")[1]),i=t.length,n=new Uint8Array(i);for(let e=0;ee.toLowerCase()),o={woff:i,woff2:i,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:n,jpeg:n,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function a(e){let t=/\.([^./]*?)(\?|$)/g.exec(e);return t?t[1]:""}let s=0;function l(e,t){return parseFloat(getComputedStyle(e).getPropertyValue(t).replace("px",""))}},673:function(e,t,i){"use strict";i.r(t),i.d(t,{app:()=>b,h:()=>E,memo:()=>v,text:()=>y});var n={},r=[],o=e=>e,a=r.map,s=Array.isArray,l="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout,c=e=>{var t="";if("string"==typeof e)return e;if(s(e))for(var i,n=0;n{for(var i in{...e,...t})if("function"==typeof(s(e[i])?e[i][0]:e[i]))t[i]=e[i];else if(e[i]!==t[i])return!0},d=e=>null==e?e:e.key,u=(e,t,i,n,r,o)=>{if("style"===t)for(var a in{...i,...n})i=null==n||null==n[a]?"":n[a],"-"===a[0]?e[t].setProperty(a,i):e[t][a]=i;else"o"===t[0]&&"n"===t[1]?((e.events||(e.events={}))[t=t.slice(2)]=n)?i||e.addEventListener(t,r):e.removeEventListener(t,r):!o&&"list"!==t&&"form"!==t&&t in e?e[t]=null==n?"":n:null==n||!1===n?e.removeAttribute(t):e.setAttribute(t,n)},f=(e,t,i)=>{var n=e.props,r=3===e.type?document.createTextNode(e.tag):(i=i||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag,n.is&&n):document.createElement(e.tag,n.is&&n);for(var o in n)u(r,o,null,n[o],t,i);for(var a=0;a{if(i===n);else if(null!=i&&3===i.type&&3===n.type)i.tag!==n.tag&&(t.nodeValue=n.tag);else if(null==i||i.tag!==n.tag)t=e.insertBefore(f(n=m(n),r,o),t),null!=i&&e.removeChild(i.node);else{var a,s,l,c,h=i.props,p=n.props,_=i.children,v=n.children,y=0,E=0,b=_.length-1,N=v.length-1;for(var T in o=o||"svg"===n.tag,{...h,...p})("value"===T||"selected"===T||"checked"===T?t[T]:h[T])!==p[T]&&u(t,T,h[T],p[T],r,o);for(;E<=N&&y<=b&&null!=(l=d(_[y]))&&l===d(v[E]);)g(t,_[y].node,_[y],v[E]=m(v[E++],_[y++]),r,o);for(;E<=N&&y<=b&&null!=(l=d(_[b]))&&l===d(v[N]);)g(t,_[b].node,_[b],v[N]=m(v[N--],_[b--]),r,o);if(y>b)for(;E<=N;)t.insertBefore(f(v[E]=m(v[E++]),r,o),(s=_[y])&&s.node);else if(E>N)for(;y<=b;)t.removeChild(_[y++].node);else{for(var A={},S={},T=y;T<=b;T++)null!=(l=_[T].key)&&(A[l]=_[T]);for(;E<=N;){if(l=d(s=_[y]),c=d(v[E]=m(v[E],s)),S[l]||null!=c&&c===d(_[y+1])){null==l&&t.removeChild(s.node),y++;continue}null==c||1===i.type?(null==l&&(g(t,s&&s.node,s,v[E],r,o),E++),y++):(l===c?(g(t,s.node,s,v[E],r,o),S[c]=!0,y++):null!=(a=A[c])?(g(t,t.insertBefore(a.node,s&&s.node),a,v[E],r,o),S[c]=!0):g(t,s&&s.node,null,v[E],r,o),E++)}for(;y<=b;)null==d(s=_[y++])&&t.removeChild(s.node);for(var T in A)null==S[T]&&t.removeChild(A[T].node)}}return n.node=t},m=(e,t)=>!0!==e&&!1!==e&&e?"function"==typeof e.tag?((!t||null==t.memo||((e,t)=>{for(var i in e)if(e[i]!==t[i])return!0;for(var i in t)if(e[i]!==t[i])return!0})(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:y(""),p=e=>3===e.nodeType?y(e.nodeValue,e):_(e.nodeName.toLowerCase(),n,a.call(e.childNodes,p),1,e),_=(e,{key:t,...i},n,r,o)=>({tag:e,props:i,key:t,children:n,type:r,node:o}),v=(e,t)=>({tag:e,memo:t}),y=(e,t)=>_(e,n,r,3,t),E=(e,{class:t,...i},o=r)=>_(e,{...i,...t?{class:c(t)}:n},s(o)?o:[o]),b=({node:e,view:t,subscriptions:i,dispatch:a=o,init:c=n})=>{var d,u,f=e&&p(e),m=[],_=e=>{d!==e&&(null==(d=e)&&(a=i=v=o),i&&(m=((e,t=r,i)=>{for(var n,o,a=[],s=0;se=g(e.parentNode,e,f,f=t(d),y,u=!1),y=function(e){a(this.events[e.type],e)};return(a=a((e,t)=>"function"==typeof e?a(e(d,t)):s(e)?"function"==typeof e[0]?a(e[0],e[1]):e.slice(1).map(e=>e&&!0!==e&&(e[0]||e)(a,e[1]),_(e[0])):_(e)))(c),a}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});let e=i(769);globalThis.Clipper={clipArticle:e.clipArticle,clipPage:e.clipPage}})(),module.exports=n})(); \ No newline at end of file + }`,(0,o.injectCss)(i,"nn-clipper-styles"),new Promise((e,i)=>{var r,o;let s;r=()=>n(this,void 0,void 0,function*(){v();let i=document.querySelectorAll(`.${d}`),{head:n}=yield E(document,t,!1),r=document.createElement("html");r.append(n);let o=document.createElement("body");for(let e of(r.append(o),i)){e.classList.remove(d);let i=yield(0,l.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:Object.assign(Object.assign({},f),{images:null==t?void 0:t.images,inlineImages:null==t?void 0:t.inlineImages})});i&&o.appendChild(i)}e(null==r?void 0:r.outerHTML)}),o=()=>i("Cancelled."),(s=document.createElement("div")).classList.add(h),setTimeout(()=>{document.body.appendChild(s)},0),(0,a.app)({init:{isClipping:!1},view:({isClipping:e})=>(0,a.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,a.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,a.text)("Notesnook Web Clipper")]),(0,a.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[e?(0,a.text)("Clipping selected elements. Please wait..."):(0,a.text)("Click on any element to select it.")]),(0,a.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,a.h)("button",{onclick:e=>[Object.assign(Object.assign({},e),{isClipping:!0}),e=>{null==r||r(),e({isClipping:!1})}],style:{marginRight:"5px"},disabled:e},[e?(0,a.text)("Clipping..."):(0,a.text)("Clip")]),(0,a.h)("button",{onclick:e=>(v(),null==o||o(),e),disabled:e},[(0,a.text)("Cancel")])])]),node:s})})};let r=i(396),o=i(132),a=i(673),l=i(399),s=i(707),c="nn-node-selection--hover",d="nn-node-selection--selected",h="nn-node-selection-container",u=[d,h],f={fonts:!1,images:!1,stylesheets:!0};function g(e){for(let t of u)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}let m=e=>{let t=e.target;!t.classList.contains(c)&&g(t)&&t.classList.add(c)},p=e=>{let t=e.target;t.classList.contains(c)&&t.classList.remove(c)},_=e=>{e.preventDefault();let t=e.target;t.classList.contains(d)?t.classList.remove(d):g(t)&&t.classList.add(d)};function y(e,t){let i=document.implementation.createHTMLDocument();return i.documentElement.replaceChildren(e,t),i}function v(){setTimeout(()=>{var e;document.querySelectorAll(`.${d}`).forEach(e=>{e instanceof HTMLElement&&e.classList.remove(d)}),document.querySelectorAll(`.${h}`).forEach(e=>e.remove()),(e=document).body.removeEventListener("mouseout",p),e.body.removeEventListener("mouseover",m),document.body.removeEventListener("click",_)},0)}function E(e,t){return n(this,arguments,void 0,function*(e,t,i=!1){let n=b(t),r=yield(0,l.getInlinedNode)(e.body,{raster:!0,fetchOptions:n,inlineOptions:{fonts:!1,inlineImages:null==t?void 0:t.inlineImages,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},filter:e=>{var t;let n,r,o,a,l,s,c,d,h,u,f,g,m,p,_,y;return!i||(((t=e).nodeType===Node.TEXT_NODE||!t.getBoundingClientRect)&&t.parentElement&&(t=t.parentElement),(n={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth,l=r.left>=0&&r.left+r.width<=a,s=r.top>=0&&r.top+r.height<=o,n.isInsideViewport=l&&s,c=r.left<0&&r.left+r.width>a,d=r.top<0&&r.top+r.height>o,n.isAroundViewport=c&&d,h=r.top<0&&r.top+r.height>0,u=r.lefta,f=r.left<0&&r.left+r.width>0,g=r.topo,m=s||d||h||g,p=l||c||f||u,n.isOnTopEdge=h&&p,n.isOnRightEdge=u&&m,n.isOnBottomEdge=g&&p,n.isOnLeftEdge=f&&m,n.isOnEdge=n.isOnLeftEdge||n.isOnRightEdge||n.isOnTopEdge||n.isOnBottomEdge,_=l||c||n.isOnLeftEdge||n.isOnRightEdge,y=s||d||n.isOnTopEdge||n.isOnBottomEdge,n.isInViewport=_&&y,n.isPartiallyInViewport=n.isInViewport&&n.isOnEdge,n).isInViewport)}});if(!r)return{};let o=e.createElement("head"),a=e.createElement("title");for(let[i,l]of(a.innerText=e.title,o.appendChild(a),(null==t?void 0:t.styles)&&(yield(0,s.addStylesToHead)(o,n)),Object.entries(function(e){let t={};for(let{name:i}of e.attributes){let n=e.getAttribute(i);n&&(t[i]=n)}return t}(e.documentElement))))r.setAttribute(i,l);return{body:r,head:o}})}function b(e){return(null==e?void 0:e.corsProxy)?{bypassCors:!0,corsHost:e.corsProxy,crossOrigin:"anonymous",noCache:!0}:void 0}},812:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.shouldProcess=l,t.inlineAll=function(e,t,i,a){return n(this,void 0,void 0,function*(){if(!l(e))return e;for(let l of s(e))e=yield(function(e,t,i,a,l){return n(this,void 0,void 0,function*(){let n=a?(0,o.resolveUrl)(t,a):t,s=l?(0,r.constructUrl)(n,i):yield(0,r.fetchResource)(n,i).catch(()=>(0,r.constructUrl)(n,i));return e.replace(t,s||n)})})(e,l,t,i,a).catch(t=>(console.error(t),e));return e})},t.readUrls=s;let r=i(113),o=i(132),a=/url\(['"]?([^'"]+?)['"]?\)/g;function l(e){return -1!==e.search(a)}function s(e){let t,i=[];for(;null!==(t=a.exec(e));)i.push(t[1]);return i.filter(function(e){return!(0,o.isDataUrl)(e)})}},707:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.addStylesToHead=function(e,t){return n(this,void 0,void 0,function*(){for(let i of(yield function(e){return n(this,void 0,void 0,function*(){for(let t of document.styleSheets){let i=[];if(!(yield function(e,t){return n(this,void 0,void 0,function*(){try{e.cssRules.length}catch(n){let i=e.ownerNode;if(e.href&&i instanceof HTMLLinkElement){if(l(i))return!0;let e=yield a(i.href,t);e&&i.replaceWith(e)}return!0}return l(e)})}(t,e))){for(let n=0;n0){yield c(i,t);let n=s(i.cssRules);e.appendChild(n);continue}if(i.ownerNode instanceof HTMLStyleElement){e.appendChild(i.ownerNode.cloneNode(!0));continue}}})};let r=i(113),o=i(812);function a(e,t){return n(this,void 0,void 0,function*(){try{let i=document.createElement("style"),n=yield fetch((0,r.constructUrl)(e,t));if(!n.ok)return!1;return i.innerHTML=yield n.text(),i.setAttribute("href",e),i}catch(t){console.error("Failed to inline stylesheet",e,t)}})}function l(e){return("string"==typeof e.media?e.media:e.media.mediaText).split(",").map(e=>e.trim()).includes("print")}function s(e){let t=Array.from(e).map(e=>e.cssText).reduce((e,t)=>e+t,""),i=document.createElement("style");return i.innerHTML=t,i}function c(e,t){return n(this,void 0,void 0,function*(){let i=[];for(let n of e.cssRules)if(n.type===CSSRule.STYLE_RULE)i.push(d(e,n,t));else if(n.type===CSSRule.MEDIA_RULE){let r=window.matchMedia(n.media.mediaText).matches;for(let o of n.cssRules)o&&o.type===CSSRule.STYLE_RULE&&i.push(d(e,o,t,r))}else if(n.type===CSSRule.SUPPORTS_RULE)for(let r of n.cssRules)r&&r.type===CSSRule.STYLE_RULE&&i.push(d(e,r,t,!1));yield Promise.allSettled(i)})}function d(e,t,i){return n(this,arguments,void 0,function*(e,t,i,n=!0){let r=e.href||document.location.href;for(let e of t.style){let a=t.style.getPropertyValue(e);if(!a)continue;let l=yield(0,o.inlineAll)(a,i,r,!n);t.style.setProperty(e,l)}})}},132:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.injectCss=function(e,t){let i=document.getElementById(t),n=document.getElementsByTagName("head")[0];i&&n.removeChild(i);let r=document.createElement("style");r.type="text/css",r.id=t,r.appendChild(document.createTextNode(e)),n.insertBefore(r,function(){for(let 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=a,t.mimeType=function(e){return o[a(e).toLowerCase()]||""},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){let t=atob(e.toDataURL().split(",")[1]),i=t.length,n=new Uint8Array(i);for(let e=0;ee.toLowerCase()),o={woff:i,woff2:i,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:n,jpeg:n,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function a(e){let t=/\.([^./]*?)(\?|$)/g.exec(e);return t?t[1]:""}let l=0;function s(e,t){return parseFloat(getComputedStyle(e).getPropertyValue(t).replace("px",""))}},673:function(e,t,i){"use strict";i.r(t),i.d(t,{app:()=>b,h:()=>E,memo:()=>y,text:()=>v});var n={},r=[],o=e=>e,a=r.map,l=Array.isArray,s="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout,c=e=>{var t="";if("string"==typeof e)return e;if(l(e))for(var i,n=0;n{for(var i in{...e,...t})if("function"==typeof(l(e[i])?e[i][0]:e[i]))t[i]=e[i];else if(e[i]!==t[i])return!0},h=e=>null==e?e:e.key,u=(e,t,i,n,r,o)=>{if("style"===t)for(var a in{...i,...n})i=null==n||null==n[a]?"":n[a],"-"===a[0]?e[t].setProperty(a,i):e[t][a]=i;else"o"===t[0]&&"n"===t[1]?((e.events||(e.events={}))[t=t.slice(2)]=n)?i||e.addEventListener(t,r):e.removeEventListener(t,r):!o&&"list"!==t&&"form"!==t&&t in e?e[t]=null==n?"":n:null==n||!1===n?e.removeAttribute(t):e.setAttribute(t,n)},f=(e,t,i)=>{var n=e.props,r=3===e.type?document.createTextNode(e.tag):(i=i||"svg"===e.tag)?document.createElementNS("http://www.w3.org/2000/svg",e.tag,n.is&&n):document.createElement(e.tag,n.is&&n);for(var o in n)u(r,o,null,n[o],t,i);for(var a=0;a{if(i===n);else if(null!=i&&3===i.type&&3===n.type)i.tag!==n.tag&&(t.nodeValue=n.tag);else if(null==i||i.tag!==n.tag)t=e.insertBefore(f(n=m(n),r,o),t),null!=i&&e.removeChild(i.node);else{var a,l,s,c,d=i.props,p=n.props,_=i.children,y=n.children,v=0,E=0,b=_.length-1,N=y.length-1;for(var T in o=o||"svg"===n.tag,{...d,...p})("value"===T||"selected"===T||"checked"===T?t[T]:d[T])!==p[T]&&u(t,T,d[T],p[T],r,o);for(;E<=N&&v<=b&&null!=(s=h(_[v]))&&s===h(y[E]);)g(t,_[v].node,_[v],y[E]=m(y[E++],_[v++]),r,o);for(;E<=N&&v<=b&&null!=(s=h(_[b]))&&s===h(y[N]);)g(t,_[b].node,_[b],y[N]=m(y[N--],_[b--]),r,o);if(v>b)for(;E<=N;)t.insertBefore(f(y[E]=m(y[E++]),r,o),(l=_[v])&&l.node);else if(E>N)for(;v<=b;)t.removeChild(_[v++].node);else{for(var A={},S={},T=v;T<=b;T++)null!=(s=_[T].key)&&(A[s]=_[T]);for(;E<=N;){if(s=h(l=_[v]),c=h(y[E]=m(y[E],l)),S[s]||null!=c&&c===h(_[v+1])){null==s&&t.removeChild(l.node),v++;continue}null==c||1===i.type?(null==s&&(g(t,l&&l.node,l,y[E],r,o),E++),v++):(s===c?(g(t,l.node,l,y[E],r,o),S[c]=!0,v++):null!=(a=A[c])?(g(t,t.insertBefore(a.node,l&&l.node),a,y[E],r,o),S[c]=!0):g(t,l&&l.node,null,y[E],r,o),E++)}for(;v<=b;)null==h(l=_[v++])&&t.removeChild(l.node);for(var T in A)null==S[T]&&t.removeChild(A[T].node)}}return n.node=t},m=(e,t)=>!0!==e&&!1!==e&&e?"function"==typeof e.tag?((!t||null==t.memo||((e,t)=>{for(var i in e)if(e[i]!==t[i])return!0;for(var i in t)if(e[i]!==t[i])return!0})(t.memo,e.memo))&&((t=e.tag(e.memo)).memo=e.memo),t):e:v(""),p=e=>3===e.nodeType?v(e.nodeValue,e):_(e.nodeName.toLowerCase(),n,a.call(e.childNodes,p),1,e),_=(e,{key:t,...i},n,r,o)=>({tag:e,props:i,key:t,children:n,type:r,node:o}),y=(e,t)=>({tag:e,memo:t}),v=(e,t)=>_(e,n,r,3,t),E=(e,{class:t,...i},o=r)=>_(e,{...i,...t?{class:c(t)}:n},l(o)?o:[o]),b=({node:e,view:t,subscriptions:i,dispatch:a=o,init:c=n})=>{var h,u,f=e&&p(e),m=[],_=e=>{h!==e&&(null==(h=e)&&(a=i=y=o),i&&(m=((e,t=r,i)=>{for(var n,o,a=[],l=0;le=g(e.parentNode,e,f,f=t(h),v,u=!1),v=function(e){a(this.events[e.type],e)};return(a=a((e,t)=>"function"==typeof e?a(e(h,t)):l(e)?"function"==typeof e[0]?a(e[0],e[1]):e.slice(1).map(e=>e&&!0!==e&&(e[0]||e)(a,e[1]),_(e[0])):_(e)))(c),a}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});let e=i(769);globalThis.Clipper={clipArticle:e.clipArticle,clipPage:e.clipPage}})(),module.exports=n})(); \ No newline at end of file diff --git a/packages/clipper/rsbuild.config.ts b/packages/clipper/rsbuild.config.ts index 5019bb2f3..d3949a4fd 100644 --- a/packages/clipper/rsbuild.config.ts +++ b/packages/clipper/rsbuild.config.ts @@ -34,10 +34,7 @@ export default defineConfig({ js: "clipper.bundle.js" }, distPath: { - root: path.resolve( - __dirname, - "../../apps/mobile/native/ios/extension.bundle" - ) + root: path.resolve(__dirname, "../../apps/mobile/ios/extension.bundle") } } }); diff --git a/packages/clipper/src/clone.ts b/packages/clipper/src/clone.ts index 8df1629af..ab87becdb 100644 --- a/packages/clipper/src/clone.ts +++ b/packages/clipper/src/clone.ts @@ -26,9 +26,13 @@ type CloneNodeOptions = { export function cloneNode(node: HTMLElement, options: CloneNodeOptions) { node = node.cloneNode(true) as HTMLElement; + const images = node.querySelectorAll("img"); if (!options.images) { - const images = node.getElementsByTagName("img"); for (const image of images) image.remove(); + } else { + for (const image of images) { + image.src = image.currentSrc; + } } if (!options.styles) {