You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
121 KiB

3 years ago
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
3 months ago
var yn=Object.create;var mt=Object.defineProperty;var Tn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_n=(e,t)=>{for(var i in t)mt(e,i,{get:t[i],enumerable:!0})},Ki=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Nn(t))!En.call(e,o)&&o!==i&&mt(e,o,{get:()=>t[o],enumerable:!(r=Tn(t,o))||r.enumerable});return e};var He=(e,t,i)=>(i=e!=null?yn(An(e)):{},Ki(t||!e||!e.__esModule?mt(i,"default",{value:e,enumerable:!0}):i,e)),wn=e=>Ki(mt({},"__esModule",{value:!0}),e);var ir=we((er,tr)=>{(function(e){if(typeof er=="object")tr.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch(i){t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(p,g){return p+g&4294967295},i=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(p,g,l,s,h,c){return g=t(t(g,p),t(s,c)),t(g<<h|g>>>32-h,l)}function o(p,g){var l=p[0],s=p[1],h=p[2],c=p[3];l+=(s&h|~s&c)+g[0]-680876936|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[1]-389564586|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[2]+606105819|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[3]-1044525330|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[4]-176418897|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[5]+1200080426|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[6]-1473231341|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[7]-45705983|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[8]+1770035416|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[9]-1958414417|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[10]-42063|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[11]-1990404162|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[12]+1804603682|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[13]-40341101|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[14]-1502002290|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[15]+1236535329|0,s=(s<<22|s>>>10)+h|0,l+=(s&c|h&~c)+g[1]-165796510|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[6]-1069501632|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[11]+643717713|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[0]-373897302|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[5]-701558691|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[10]+38016083|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[15]-660478335|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[4]-405537848|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[9]+568446438|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[14]-1019803690|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[3]-187363961|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[8]+1163531501|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[13]-1444681467|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[2]-51403784|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[7]+1735328473|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[12]-1926607734|0,s=(s<<20|s>>>12)+h|0,l+=(s^h^c)+g[5]-378558|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[8]-2022574463|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[11]+1839030562|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[14]-35309556|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[1]-1530992060|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[4]+1272893353|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[7]-155497632|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[10]-1094730640|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[13]+681279174|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[0]-358537222|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[3]-722521979|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[6]+76029189|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[9]-640364487|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[12]-421815835|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[15]+530742520|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[2]-995338651|0,s=(s<<23|s>>>9)+h|0,l+=(h^(s|~c))+g[0]-198630844|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[7]+1126891415|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[14]-1416354905|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[5]-57434055|0,s=(s<<21|s>>>11)+h|0,l+=(h^(s|~c))+g[12]+1700485571|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[3]-1894986606|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[10]-1051523|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[1]-2054922799|0,s=(s<<21|s>>>11)+h|0,l+=(h^(s|~c))+g[8]+1873313359|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[15]-30611744|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[6]-1560198380|0,h=(h<<15|h>>
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b=Object.hasOwnProperty,S=Object.setPrototypeOf,I=Object.isFrozen,x=Object.getPrototypeOf,O=Object.getOwnPropertyDescriptor,L=Object.freeze,N=Object.seal,p=Object.create,g=typeof Reflect!="undefined"&&Reflect,l=g.apply,s=g.construct;l||(l=function(A,D,C){return A.apply(D,C)}),L||(L=function(A){return A}),N||(N=function(A){return A}),s||(s=function(A,D){return r(A,o(D))});var h=ee(Array.prototype.forEach),c=ee(Array.prototype.pop),P=ee(Array.prototype.push),W=ee(String.prototype.toLowerCase),K=ee(String.prototype.toString),pe=ee(String.prototype.match),Q=ee(String.prototype.replace),$e=ee(String.prototype.indexOf),xt=ee(String.prototype.trim),B=ee(RegExp.prototype.test),H=ze(TypeError);function ee(T){return function(A){for(var D=arguments.length,C=new Array(D>1?D-1:0),G=1;G<D;G++)C[G-1]=arguments[G];return l(T,A,C)}}function ze(T){return function(){for(var A=arguments.length,D=new Array(A),C=0;C<A;C++)D[C]=arguments[C];return s(T,D)}}function R(T,A,D){var C;D=(C=D)!==null&&C!==void 0?C:W,S&&S(T,null);for(var G=A.length;G--;){var ne=A[G];if(typeof ne=="string"){var re=D(ne);re!==ne&&(I(A)||(A[G]=re),ne=re)}T[ne]=!0}return T}function le(T){var A=p(null),D;for(D in T)l(b,T,[D])===!0&&(A[D]=T[D]);return A}function k(T,A){for(;T!==null;){var D=O(T,A);if(D){if(D.get)return ee(D.get);if(typeof D.value=="function")return ee(D.value)}T=x(T)}function C(G){return console.warn("fallback value for",G),null}return C}var be=L(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xe=L(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Le=L(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rt=L(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Te=L(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Ie=L(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ce=L(["#text"]),ye=L(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","
`+$),Me&&($=Q($,Mt," "),$=Q($,Ot," "),$=Q($,kt," ")),se&&ct?se.createHTML($):$},A.setConfig=function(E){jt(E),Gt=!0},A.clearConfig=function(){Be=null,Gt=!1},A.isValidAttribute=function(E,u,v){Be||jt({});var y=j(E),M=j(u);return qi(y,M,v)},A.addHook=function(E,u){typeof u=="function"&&(he[E]=he[E]||[],P(he[E],u))},A.removeHook=function(E){if(he[E])return c(he[E])},A.removeHooks=function(E){he[E]&&(he[E]=[])},A.removeAllHooks=function(){he={}},A}var Xr=wi();return Xr})});var fi=we((Ns,xr)=>{xr.exports=window.DOMPurify||(window.DOMPurify=mi().default||mi())});var Cr=we((Rs,bi)=>{function Ir(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(i){return i.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 i=function(r){if(r.nodeType==r.TEXT_NODE)return`${r.nodeName} ("${r.textContent}")`;let o=Array.from(r.attributes||[],function(n){return`${n.name}="${n.value}"`}).join(" ");return`<${r.localName} ${o}>`};this.log=function(){if(typeof console!="undefined"){let o=Array.from(arguments,n=>n&&n.nodeType==this.ELEMENT_NODE?i(n):n);o.unshift("Reader: (Readability)"),console.log.apply(console,o)}else if(typeof dump!="undefined"){var r=Array.prototype.map.call(arguments,function(o){return o&&o.nodeName?i(o):o}).join(" ");dump("Reader: (Readability) "+r+`
`)}}}else this.log=function(){}}Ir.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,commas:/\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,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 i=e.length-1;i>=0;i--){var r=e[i],o=r.parentNode;o&&(!t||t.call(this,r,i,e))&&o.removeChild(r)}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new 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(r){return e.call(r)});return Array.prototype.concat.apply([],i)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(i){var r=e.getElementsByTagName(i);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){v
# [%videoTitle%](%videoURL%)
2 years ago
1 year ago
%videoPlayer%`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoNoteTitle:"Vimeo - %title%",vimeoNote:`[[ReadItLater]] [[Vimeo]]
2 years ago
# [%videoTitle%](%videoURL%)
2 years ago
2 years ago
%videoPlayer%`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliNoteTitle:"Bilibili - %title%",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
2 years ago
# [%videoTitle%](%videoURL%)
2 years ago
2 years ago
%videoPlayer%`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterNoteTitle:"Tweet from %tweetAuthorName% (%date%)",twitterNote:`[[ReadItLater]] [[Tweet]]
2 years ago
# [%tweetAuthorName%](%tweetURL%)
2 years ago
%tweetContent%`,parseableArticleNoteTitle:"%title%",parsableArticleNote:`[[ReadItLater]] [[Article]]
2 years ago
# [%articleTitle%](%articleURL%)
2 years ago
%articleContent%`,notParseableArticleNoteTitle:"Article %date%",notParsableArticleNote:`[[ReadItLater]] [[Article]]
2 years ago
[%articleURL%](%articleURL%)`,textSnippetNoteTitle:"Note %date%",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
2 years ago
%content%`,mastodonNoteTitle:"Toot from %tootAuthorName% (%date%)",mastodonNote:`[[ReadItLater]] [[Toot]]
2 years ago
# [%tootAuthorName%](%tootURL%)
2 years ago
> %tootContent%`,downloadImages:!0,downloadImagesInArticleDir:!1,dateTitleFmt:"YYYY-MM-DD HH-mm-ss",dateContentFmt:"YYYY-MM-DD",downloadMastodonMediaAttachments:!0,downloadMastodonMediaAttachmentsInDir:!1,saveMastodonReplies:!1,mastodonReply:`[%tootAuthorName%](%tootURL%)
2 years ago
> %tootContent%`,stackExchangeNoteTitle:"%title%",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
2 years ago
# [%questionTitle%](%questionURL%)
2 years ago
Author: [%authorName%](%authorProfileURL%)
2 years ago
%questionContent%
2 years ago
***
2 years ago
%topAnswer%
2 years ago
%answers%`,stackExchangeAnswer:`Answered by: [%authorName%](%authorProfileURL%)
2 years ago
2 years ago
%answerContent%`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokNoteTitle:"TikTok from %authorName% (%date%)",tikTokNote:`[[ReadItLater]] [[TikTok]]
%videoDescription%
[%videoURL%](%videoURL%)
3 months ago
%videoPlayer%`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0};var w=require("obsidian");var Nt=class extends w.PluginSettingTab{constructor(t,i){super(t,i),this.plugin=i}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"General"}),new w.Setting(t).setName("Inbox dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.inboxDir||_.inboxDir).onChange(async a=>{this.plugin.settings.inboxDir=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Assets dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.assetsDir||_.inboxDir+"/assets").onChange(async a=>{this.plugin.settings.assetsDir=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Open new note").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||_.openNewNote).onChange(async a=>{this.plugin.settings.openNewNote=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Date format string").setDesc("Format of the %date% variable. NOTE: do not use symbols forbidden in file names.").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD HH-mm-ss").setValue(this.plugin.settings.dateTitleFmt||_.dateTitleFmt).onChange(async a=>{this.plugin.settings.dateTitleFmt=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Date format string in contents").setDesc("Format of the %date% variable for contents").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD").setValue(this.plugin.settings.dateContentFmt||_.dateContentFmt).onChange(async a=>{this.plugin.settings.dateContentFmt=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Extend share menu").setDesc("If enabled, share menu will be extended with shortcut to create note directly from it. Requires plugin reload or Obsidian restart to apply change.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"extendShareMenu")?this.plugin.settings.extendShareMenu:_.extendShareMenu).onChange(async a=>{this.plugin.settings.extendShareMenu=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"YouTube"}),new w.Setting(t).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||_.youtubeNoteTitle).onChange(async a=>{this.plugin.settings.youtubeNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %videoThumbnail%, %channelId%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||_.youtubeNote).onChange(async a=>{this.plugin.settings.youtubeNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Youtube Data API v3 key").setDesc("If entered, additional template variables are available").addText(n=>n.setPlaceholder("").setValue(this.plugin.settings.youtubeApiKey||_.youtubeApiKey).onChange(async a=>{this.plugin.settings.youtubeApiKey=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube embed player width").addText(n=>n.setPlaceholder(_.youtubeEmbedWidth).setValue(this.plugin.settings.youtubeEmbedWidth||_.youtubeEmbedWidth).onChange(async a=>{this.plugin.settings.youtubeEmbedWidth=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube embed player height").addText(n=>n.setPlaceholder(_.youtubeEmbedHeight).setValue(this.plugin.settings.youtubeEmbedHeight||_.youtubeEmbedHeight).onChange(async a=>{this.plugin.settings.youtubeEmbedHeight=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Embed in privacy enh
`;)t--;return e.substring(0,t)}var Wn=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function li(e){return ci(e,Wn)}var fr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function dr(e){return ci(e,fr)}function $n(e){return br(e,fr)}var vr=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function zn(e){return ci(e,vr)}function qn(e){return br(e,vr)}function ci(e,t){return t.indexOf(e.nodeName)>=0}function br(e,t){return e.getElementsByTagName&&t.some(function(i){return e.getElementsByTagName(i).length})}var Z={};Z.paragraph={filter:"p",replacement:function(e){return`
2 years ago
`+e+`
2 years ago
3 months ago
`}};Z.lineBreak={filter:"br",replacement:function(e,t,i){return i.br+`
`}};Z.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,i){var r=Number(t.nodeName.charAt(1));if(i.headingStyle==="setext"&&r<3){var o=oi(r===1?"=":"-",e.length);return`
2 years ago
`+e+`
3 months ago
`+o+`
2 years ago
`}else return`
2 years ago
3 months ago
`+oi("#",r)+" "+e+`
2 years ago
2 years ago
`}};Z.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
2 years ago
`+e+`
2 years ago
3 months ago
`}};Z.list={filter:["ul","ol"],replacement:function(e,t){var i=t.parentNode;return i.nodeName==="LI"&&i.lastElementChild===t?`
`+e:`
2 years ago
`+e+`
2 years ago
3 months ago
`}};Z.listItem={filter:"li",replacement:function(e,t,i){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
3 months ago
`);var r=i.bulletListMarker+" ",o=t.parentNode;if(o.nodeName==="OL"){var n=o.getAttribute("start"),a=Array.prototype.indexOf.call(o.children,t);r=(n?Number(n)+a:a+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
`:"")}};Z.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,i){return`
2 years ago
3 months ago
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
2 years ago
3 months ago
`}};Z.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,i){for(var r=t.firstChild.getAttribute("class")||"",o=(r.match(/language-(\S+)/)||[null,""])[1],n=t.firstChild.textContent,a=i.fence.charAt(0),m=3,d=new RegExp("^"+a+"{3,}","gm"),f;f=d.exec(n);)f[0].length>=m&&(m=f[0].length+1);var b=oi(a,m);return`
2 years ago
3 months ago
`+b+o+`
`+n.replace(/\n$/,"")+`
2 years ago
`+b+`
2 years ago
3 months ago
`}};Z.horizontalRule={filter:"hr",replacement:function(e,t,i){return`
2 years ago
3 months ago
`+i.hr+`
2 years ago
3 months ago
`}};Z.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var i=t.getAttribute("href");i&&(i=i.replace(/([()])/g,"\\$1"));var r=Et(t.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+e+"]("+i+r+")"}};Z.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,i){var r=t.getAttribute("href"),o=Et(t.getAttribute("title"));o&&(o=' "'+o+'"');var n,a;switch(i.linkReferenceStyle){case"collapsed":n="["+e+"][]",a="["+e+"]: "+r+o;break;case"shortcut":n="["+e+"]",a="["+e+"]: "+r+o;break;default:var m=this.references.length+1;n="["+e+"]["+m+"]",a="["+m+"]: "+r+o}return this.references.push(a),n},references:[],append:function(e){var t="";return this.references.length&&(t=`
2 years ago
`+this.references.join(`
`)+`
2 years ago
3 months ago
`,this.references=[]),t}};Z.emphasis={filter:["em","i"],replacement:function(e,t,i){return e.trim()?i.emDelimiter+e+i.emDelimiter:""}};Z.strong={filter:["strong","b"],replacement:function(e,t,i){return e.trim()?i.strongDelimiter+e+i.strongDelimiter:""}};Z.code={filter:function(e){var t=e.previousSibling||e.nextSibling,i=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!i},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",i="`",r=e.match(/`+/gm)||[];r.indexOf(i)!==-1;)i=i+"`";return i+t+e+t+i}};Z.image={filter:"img",replacement:function(e,t){var i=Et(t.getAttribute("alt")),r=t.getAttribute("src")||"",o=Et(t.getAttribute("title")),n=o?' "'+o+'"':"";return r?"!["+i+"]("+r+n+")":""}};function Et(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function yr(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}yr.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ni(this.array,e,this.options))||(t=ni(this._keep,e,this.options))||(t=ni(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ni(e,t,i){for(var r=0;r<e.length;r++){var o=e[r];if(jn(o,t,i))return o}}function jn(e,t,i){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,i))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Yn(e){var t=e.element,i=e.isBlock,r=e.isVoid,o=e.isPre||function(S){return S.nodeName==="PRE"};if(!(!t.firstChild||o(t))){for(var n=null,a=!1,m=null,d=pr(m,t,o);d!==t;){if(d.nodeType===3||d.nodeType===4){var f=d.data.replace(/[ \r\n\t]+/g," ");if((!n||/ $/.test(n.data))&&!a&&f[0]===" "&&(f=f.substr(1)),!f){d=ai(d);continue}d.data=f,n=d}else if(d.nodeType===1)i(d)||d.nodeName==="BR"?(n&&(n.data=n.data.replace(/ $/,"")),n=null,a=!1):r(d)||o(d)?(n=null,a=!0):n&&(a=!1);else{d=ai(d);continue}var b=pr(m,d,o);m=d,d=b}n&&(n.data=n.data.replace(/ $/,""),n.data||ai(n))}}function ai(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function pr(e,t,i){return e&&e.parentNode===t||i(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ui=typeof window!="undefined"?window:{};function Xn(){var e=ui.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(i){}return t}function Kn(){var e=function(){};return Jn()?e.prototype.parseFromString=function(t){var i=new window.ActiveXObject("htmlfile");return i.designMode="on",i.open(),i.write(t),i.close(),i}:e.prototype.parseFromString=function(t){var i=document.implementation.createHTMLDocument("");return i.open(),i.write(t),i.close(),i},e}function Jn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){ui.ActiveXObject&&(e=!0)}return e}var Zn=Xn()?ui.DOMParser:Kn();function Qn(e,t){var i;if(typeof e=="string"){var r=ea().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");i=r.getElementById("turndown-root")}else i=e.cloneNode(!0);return Yn({element:i,isBlock:li,isVoid:dr,isPre:t.preformattedCode?ta:null}),i}var si;function ea(){return si=si||new Zn,si}function ta(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function ia(e,t){return e.isBlock=li(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=ra(e),e.flankingWhitespace=na(e,t),e}function ra(e){return!dr(e)&&!zn(e)&&/^\s*$/i.test(e.textContent)&&!$n(e)&&!qn(e)}function na(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var i=aa(e.textContent);return i.leadingAscii&&mr("left",e,t)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&mr("right",e,t)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}function aa(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function mr(e,t,i){var r,o,n;return e==="left"?(r=t.previousSibling,o=/ $/):(r=t.nextSibling,o=/^ /),r&&(r.nodeType===3?n=o.test(r.nodeValue):i.preformattedCode&&r.nodeName==="CODE"?n=!1:r.nodeType===1&&!li(r)&&(n=o.test(r.textContent))),n}var sa=Array.prototype.reduce,oa=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\
2 years ago
3 months ago
`:""},keepReplacement:function(i,r){return r.isBlock?`
2 years ago
2 years ago
`+r.outerHTML+`
2 years ago
3 months ago
`:r.outerHTML},defaultReplacement:function(i,r){return r.isBlock?`
2 years ago
3 months ago
`+i+`
2 years ago
3 months ago
`:i}};this.options=Hn({},t,e),this.rules=new yr(this.options)}_t.prototype={turndown:function(e){if(!ua(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Tr.call(this,new Qn(e,this.options));return la.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return oa.reduce(function(t,i){return t.replace(i[0],i[1])},e)}};function Tr(e){var t=this;return sa.call(e.childNodes,function(i,r){r=new ia(r,t.options);var o="";return r.nodeType===3?o=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(o=ca.call(t,r)),Nr(i,o)},"")}function la(e){var t=this;return this.rules.forEach(function(i){typeof i.append=="function"&&(e=Nr(e,i.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function ca(e){var t=this.rules.forNode(e),i=Tr.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(i=i.trim()),r.leading+t.replacement(i,e,this.options)+r.trailing}function Nr(e,t){var i=Vn(e),r=Gn(t),o=Math.max(e.length-i.length,t.length-r.length),n=`
2 years ago
3 months ago
`.substring(0,o);return i+n+r}function ua(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var Ar=_t;var Er=/highlight-(?:text|source)-([a-z0-9]+)/;function ha(e){e.addRule("highlightedCodeBlock",{filter:function(t){var i=t.firstChild;return t.nodeName==="DIV"&&Er.test(t.className)&&i&&i.nodeName==="PRE"},replacement:function(t,i,r){var o=i.className||"",n=(o.match(Er)||[null,""])[1];return`
2 years ago
3 months ago
`+r.fence+n+`
`+i.firstChild.textContent+`
2 years ago
`+r.fence+`
2 years ago
3 months ago
`}})}function ga(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var pa=Array.prototype.indexOf,De={};De.tableCell={filter:["th","td"],replacement:function(e,t){return _r(e,t)+wr(t,"")}};De.tableRow={filter:"tr",replacement:function(e,t){var i="",r={left:":--",right:"--:",center:":-:"};if(ma(t))for(var o=0;o<t.childNodes.length;o++){var n="---",a=(t.childNodes[o].getAttribute("align")||"").toLowerCase();a&&(n=r[a]||n),i+=_r(n,t.childNodes[o])+wr(t.childNodes[o],n)}return`
`+e+(i?`
`+i:"")}};De.table={filter:function(e){return e.nodeName==="TABLE"&&!Sr(e)},replacement:function(e){return e=e.replace(`
2 years ago
`,`
`),`
2 years ago
`+e+`
2 years ago
3 months ago
`}};De.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};De.captionSection={filter:"caption",replacement:function(e,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?e:""}};function ma(e){var t=e.parentNode,i=t;return(t.nodeName==="THEAD"||t.nodeName==="TFOOT"||t.nodeName==="TBODY")&&(i=t.parentNode),i.nodeName==="TABLE"&&i.rows[0]===e}function _r(e,t){var i=pa.call(t.parentNode.childNodes,t),r=" ";return i===0&&(r="| "),e=e.replace(/\r\n/g,`
`).replace(/\n/g," "),e=e.replace(/\|/g,"\\|"),r+e+" |"}function wr(e,t){var i=e.getAttribute("colspan")||1;return i<=1?"":(" "+t+" |").repeat(i-1)}function Sr(e){for(var t=e.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function fa(e){e.keep(function(i){return i.nodeName==="TABLE"&&Sr(i)});for(var t in De)e.addRule(t,De[t])}function da(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,i){return(i.checked?"[x]":"[ ]")+" "}})}function Dr(e){e.use([ha,ga,fa,da])}async function ve(e){let t=Dr,i=new Ar({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return i.use(t),i.turndown(e)}var hi=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(https:\/\/(twitter|x).com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=new URL(i);r.hostname==="x.com"&&(r.hostname="twitter.com");let o=JSON.parse(await(0,wt.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${r.href}`})),n=o.author_name,a=await ve(o.html),m=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,n).replace(/%tweetURL%/g,o.url).replace(/%tweetContent%/g,a).replace(/%tweetPublishDate%/g,this.getPublishedDateFromDOM(o.html)),f=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,n).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(f,m)}getPublishedDateFromDOM(i){let o=new DOMParser().parseFromString(i,"text/html").querySelector("blockquote > a"),n=(0,wt.moment)(o.textContent);return n.isValid()?n.format(this.settings.dateContentFmt):""}},Rr=hi;var St=require("obsidian"),di=He(fi());var vi=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await(0,St.request)({method:"GET",url:i}),o=new DOMParser().parseFromString(r,"text/html"),n=await this.parseDocument(o),a=this.settings.stackExchangeNoteTitle.replace(/%title%/g,n.title).replace(/%date%/g,this.getFormattedDateForFilename()),m=n.topAnswer?this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,n.topAnswer.content).replace(/%authorName%/g,n.topAnswer.author.name).replace(/%authorProfileURL%/g,n.topAnswer.author.profile):"",d="";for(let I=0;I<n.answers.length;I++){let x=this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,n.answers[I].content).replace(/%authorName%/g,n.answers[I].author.name).replace(/%authorProfileURL%/g,n.answers[I].author.profile);d=d.concat(`
2 years ago
***
3 years ago
3 months ago
`,x)}let f=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,n.title).replace(/%questionURL%/g,n.url).replace(/%questionContent%/g,n.content).replace(/%authorName%/g,n.author.name).replace(/%authorProfileURL%/g,n.author.profile).replace(/%topAnswer%/g,m).replace(/%answers%/g,d.trim()),b=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${oe(a)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&St.Platform.isDesktop&&(f=await Se(app,f,b));let S=`${a}.md`;return new U(S,f)}async parseDocument(i){var a,m,d,f,b,S,I,x,O,L,N,p,g,l,s,h;let r;try{r=new URL((d=(a=i.querySelector('link[rel="canonical"]'))==null?void 0:a.getAttribute("href"))!=null?d:(m=i.querySelector('meta[property="og:url"]'))==null?void 0:m.getAttribute("content"))}catch(c){r=null}let o=i.querySelector('#question [itemprop="author"]'),n=[];for(let c of i.querySelectorAll(".answer")){let P=c.querySelector('[itemprop="author"]');n.push({content:await ve(di.sanitize((f=c.querySelector('[itemprop="text"]'))!=null?f:"")),author:{name:(S=(b=P==null?void 0:P.querySelector('[itemprop="name"]'))==null?void 0:b.textContent)!=null?S:"",profile:P instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(x=(I=P.querySelector("a"))==null?void 0:I.getAttribute("href"))!=null?x:""):""}})}return{title:(L=(O=i.querySelector('#question-header [itemprop="name"]'))==null?void 0:O.textContent)!=null?L:"",content:await ve(di.sanitize((N=i.querySelector('#question [itemprop="text"]'))!=null?N:"")),url:(p=r==null?void 0:r.href)!=null?p:"",topAnswer:n.slice(0,1).shift(),answers:n.slice(1),author:{name:(l=(g=o==null?void 0:o.querySelector('[itemprop="name"]'))==null?void 0:g.textContent)!=null?l:"",profile:o instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(h=(s=o.querySelector("a"))==null?void 0:s.getAttribute("href"))!=null?h:""):""}}}},Lr=vi;var Re=require("obsidian"),Dt=He(kr()),Fr=He(fi());var Ti=class extends V{constructor(t,i){super(t,i)}test(t){return this.isValidUrl(t)}async prepareNote(t){var S,I;let i=new URL(t),r=await(0,Re.request)({method:"GET",url:i.href}),o=new DOMParser().parseFromString(r,"text/html"),n=o.getElementsByTagName("base"),a=null;n.length>0&&(a=n.item(0).getAttribute("href"),Array.from(n).forEach(x=>{x.remove()}));let m=o.createElement("base");m.setAttribute("href",Jt(a!=null?a:i.href,i.origin)),o.head.append(m);let d=Fr.sanitize(o.body.innerHTML);o.body.innerHTML=d,(S=o.body.querySelectorAll("pre br"))==null||S.forEach(x=>{x.outerHTML="<br-keep></br-keep>"}),(I=o.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||I.forEach(x=>{x.className=""}),(0,Dt.isProbablyReaderable)(o)||new Re.Notice("@mozilla/readability considers this document to unlikely be readerable.");let f=this.extractPreviewUrl(o),b=new Dt.Readability(o).parse();return Object.prototype.hasOwnProperty.call(b,"content")||this.notParsableArticle(i.href,f),this.parsableArticle({url:i.href,previewImageUrl:f,...b})}async parsableArticle(t){let i=t.title||"No title",r=await ve(t.content),o=t.publishedTime!==null?Tt(t.publishedTime,this.settings.dateContentFmt):"",n=this.settings.parseableArticleNoteTitle.replace(/%title%/g,i).replace(/%date%/g,this.getFormattedDateForFilename()),a=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,i).replace(/%articleURL%/g,t.url).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(t)}`).replace(/%articleContent%/g,r).replace(/%siteName%/g,t.siteName||"").replace(/%author%/g,t.byline||"").replace(/%previewURL%/g,t.previewImageUrl||"").replace(/%publishedTime%/g,o);return this.settings.downloadImages&&Re.Platform.isDesktop&&(a=await this.replaceImages(n,a)),new U(`${n}.md`,a)}async notParsableArticle(t,i){console.error("Website not parseable");let r=this.settings.notParsableArticleNote.replace(/%articleURL%/g,t).replace(/%previewURL%/g,i||""),o=this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename());return this.se
***
3 months ago
`,x)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,o.account.display_name).replace(/%tootURL%/g,o.url).replace(/%tootContent%/g,m),f=`${n}.md`;return new U(f,d)}async loadStatus(t,i){return JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:`https://${t}${Ai.STATUS}/${i}`}))}async loadReplies(t,i){let r=String.prototype.concat.call("https://",t,String.prototype.replace.call(Ai.CONTEXT,"%id%",i));return JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:r})).descendants}async parseStatus(t,i){let r=await ve(t.content),o=this.settings.downloadMastodonMediaAttachments&&We.Platform.isDesktop?await Se(app,this.prepareMedia(t.media_attachments),i):this.prepareMedia(t.media_attachments);return r.concat(o)}prepareMedia(t){return t.reduce((i,{url:r,description:o})=>{let n=o?`
> *${o}*`:"";return`${i}
3 months ago
![](${r})${n}`},"")}async testIsMastodon(t){if(!t)return!1;let i=new URL(t).hostname;try{let r=JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:`https://${i}${Ai.INSTANCE}`}));return(r==null?void 0:r.domain)===i}catch(r){return!1}}},Hr=Ei;var Gr=require("obsidian");var _i=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(tiktok.com)\/(\S+)\/(video)\/(\d+)/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await this.parseHtml(i),o=this.settings.tikTokNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoDescription%/g,r.description).replace(/%videoId%/g,r.id).replace(/%videoURL%/g,r.url).replace(/%authorName%/g,r.author.name).replace(/%authorURL%/g,r.author.url).replace(/%videoPlayer%/g,r.player),a=`${this.settings.tikTokNoteTitle.replace(/%authorName%/g,r.author.name).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(a,o)}async parseHtml(i){var a,m,d,f;let r=await(0,Gr.request)({method:"GET",url:i,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"}}),o=new DOMParser().parseFromString(r,"text/html"),n=this.PATTERN.exec(i);return{id:n[4],url:(m=(a=o.querySelector('meta[property="og:url"]'))==null?void 0:a.getAttribute("content"))!=null?m:i,description:(f=(d=o.querySelector('meta[property="og:description"]'))==null?void 0:d.getAttribute("content"))!=null?f:"",player:`<iframe width="${this.settings.tikTokEmbedWidth}" height="${this.settings.tikTokEmbedHeight}" src="https://www.tiktok.com/embed/v2/${n[4]}"></iframe>`,author:{name:n[2],url:`https://www.tiktok.com/${n[2]}`}}}},Vr=_i;var it=class{constructor(t){this.parsers=t}async createParser(t){for(let i of this.parsers)if(await i.test(t))return i}};var Rt=class extends ge.Plugin{async onload(){await this.loadSettings(),this.parserCreator=new it([new lr(this.app,this.settings),new ur(this.app,this.settings),new gr(this.app,this.settings),new Rr(this.app,this.settings),new Lr(this.app,this.settings),new Hr(this.app,this.settings),new Vr(this.app,this.settings),new Ur(this.app,this.settings),new Br(this.app,this.settings)]),(0,ge.addIcon)("read-it-later",Aa),this.addRibbonIcon("read-it-later","ReadItLater: Save clipboard",async()=>{await this.processClipboard()}),this.addCommand({id:"save-clipboard-to-notice",name:"Save clipboard",callback:async()=>{await this.processClipboard()}}),this.addSettingTab(new Nt(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(t,i)=>{t.addItem(r=>{r.setTitle("ReadItLater"),r.setIcon("read-it-later"),r.onClick(()=>this.processContent(i))})}))}async loadSettings(){this.settings=Object.assign({},_,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let t=await navigator.clipboard.readText(),r=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(r.fileName,r.content)}async processContent(t){let r=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(r.fileName,r.content)}async writeFile(t,i){let r;if(t=oe(t),await et(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?r=(0,ge.normalizePath)(`${this.settings.inboxDir}/${t}`):r=(0,ge.normalizePath)(`/${t}`),await this.app.vault.adapter.exists(r))new ge.Notice(`${t} already exists!`);else{let o=await this.app.vault.create(r,i);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(o),new ge.Notice(`${t} created successful`)}}},Aa=`
<svg fill="currentColor" stroke="currentColor" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<g>
<path d="m365.9,144.9c-12.3,0-24.2,1.8-35.4,5.2v-114.7h-96.9l7.3-35.4h-150.2l6.8,35.4h-97.5v454.6h330.5v-102.1c11.2,3.4 23.1,5.2 35.4,5.2 68.8-0.1 124.1-56.4 124.1-124.1 0-67.8-55.3-124.1-124.1-124.1zm-150.1-124l-10.4,50h-79.2l-9.4-50h99zm93.8,448.2h-288.7v-412.8h80.7l6.8,35.4h113.6l7.3-35.4h80.3v102.2c-27.3,14-48.8,37.9-59.7,66.7h-200.9v20.8h195c-1.4,7.4-2.2,15.1-2.2,22.9 0,13.4 2.2,26.4 6.2,38.6h-199v20.9h208.1c12,21.8 30.3,39.7 52.5,51.1v89.6zm56.3-98c-57.3,0-103.2-46.9-103.2-103.2s46.9-103.2 103.2-103.2c57.3,0 103.2,46.9 103.2,103.2s-45.8,103.2-103.2,103.2z"/>
<polygon points="426.4,223.1 346.1,303.4 313.8,271.1 299.2,285.7 346.1,332.6 441,237.7 "/>
<rect width="233.5" x="49" y="143.9" height="20.9"/>
<rect width="233.5" x="49" y="388.9" height="20.9"/>
</g>
</svg>`;
/*! Bundled license information:
dompurify/dist/purify.js:
3 months ago
(*! @license DOMPurify 2.5.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.6/LICENSE *)
*/