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.

166 lines
124 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
*/
var An=Object.create;var it=Object.defineProperty;var En=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var wn=Object.getPrototypeOf,Sn=Object.prototype.hasOwnProperty;var Rn=(e,i,t)=>i in e?it(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var Se=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),Dn=(e,i)=>{for(var t in i)it(e,t,{get:i[t],enumerable:!0})},Qi=(e,i,t,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of _n(i))!Sn.call(e,a)&&a!==t&&it(e,a,{get:()=>i[a],enumerable:!(r=En(i,a))||r.enumerable});return e};var Ve=(e,i,t)=>(t=e!=null?An(wn(e)):{},Qi(i||!e||!e.__esModule?it(t,"default",{value:e,enumerable:!0}):t,e)),xn=e=>Qi(it({},"__esModule",{value:!0}),e);var k=(e,i,t)=>Rn(e,typeof i!="symbol"?i+"":i,t);var ar=Se((rr,nr)=>{(function(e){if(typeof rr=="object")nr.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var i;try{i=window}catch(t){i=self}i.SparkMD5=e()}})(function(e){"use strict";var i=function(m,p){return m+p&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(m,p,o,s,g,c){return p=i(i(p,m),i(s,c)),i(p<<g|p>>>32-g,o)}function a(m,p){var o=m[0],s=m[1],g=m[2],c=m[3];o+=(s&g|~s&c)+p[0]-680876936|0,o=(o<<7|o>>>25)+s|0,c+=(o&s|~o&g)+p[1]-389564586|0,c=(c<<12|c>>>20)+o|0,g+=(c&o|~c&s)+p[2]+606105819|0,g=(g<<17|g>>>15)+c|0,s+=(g&c|~g&o)+p[3]-1044525330|0,s=(s<<22|s>>>10)+g|0,o+=(s&g|~s&c)+p[4]-176418897|0,o=(o<<7|o>>>25)+s|0,c+=(o&s|~o&g)+p[5]+1200080426|0,c=(c<<12|c>>>20)+o|0,g+=(c&o|~c&s)+p[6]-1473231341|0,g=(g<<17|g>>>15)+c|0,s+=(g&c|~g&o)+p[7]-45705983|0,s=(s<<22|s>>>10)+g|0,o+=(s&g|~s&c)+p[8]+1770035416|0,o=(o<<7|o>>>25)+s|0,c+=(o&s|~o&g)+p[9]-1958414417|0,c=(c<<12|c>>>20)+o|0,g+=(c&o|~c&s)+p[10]-42063|0,g=(g<<17|g>>>15)+c|0,s+=(g&c|~g&o)+p[11]-1990404162|0,s=(s<<22|s>>>10)+g|0,o+=(s&g|~s&c)+p[12]+1804603682|0,o=(o<<7|o>>>25)+s|0,c+=(o&s|~o&g)+p[13]-40341101|0,c=(c<<12|c>>>20)+o|0,g+=(c&o|~c&s)+p[14]-1502002290|0,g=(g<<17|g>>>15)+c|0,s+=(g&c|~g&o)+p[15]+1236535329|0,s=(s<<22|s>>>10)+g|0,o+=(s&c|g&~c)+p[1]-165796510|0,o=(o<<5|o>>>27)+s|0,c+=(o&g|s&~g)+p[6]-1069501632|0,c=(c<<9|c>>>23)+o|0,g+=(c&s|o&~s)+p[11]+643717713|0,g=(g<<14|g>>>18)+c|0,s+=(g&o|c&~o)+p[0]-373897302|0,s=(s<<20|s>>>12)+g|0,o+=(s&c|g&~c)+p[5]-701558691|0,o=(o<<5|o>>>27)+s|0,c+=(o&g|s&~g)+p[10]+38016083|0,c=(c<<9|c>>>23)+o|0,g+=(c&s|o&~s)+p[15]-660478335|0,g=(g<<14|g>>>18)+c|0,s+=(g&o|c&~o)+p[4]-405537848|0,s=(s<<20|s>>>12)+g|0,o+=(s&c|g&~c)+p[9]+568446438|0,o=(o<<5|o>>>27)+s|0,c+=(o&g|s&~g)+p[14]-1019803690|0,c=(c<<9|c>>>23)+o|0,g+=(c&s|o&~s)+p[3]-187363961|0,g=(g<<14|g>>>18)+c|0,s+=(g&o|c&~o)+p[8]+1163531501|0,s=(s<<20|s>>>12)+g|0,o+=(s&c|g&~c)+p[13]-1444681467|0,o=(o<<5|o>>>27)+s|0,c+=(o&g|s&~g)+p[2]-51403784|0,c=(c<<9|c>>>23)+o|0,g+=(c&s|o&~s)+p[7]+1735328473|0,g=(g<<14|g>>>18)+c|0,s+=(g&o|c&~o)+p[12]-1926607734|0,s=(s<<20|s>>>12)+g|0,o+=(s^g^c)+p[5]-378558|0,o=(o<<4|o>>>28)+s|0,c+=(o^s^g)+p[8]-2022574463|0,c=(c<<11|c>>>21)+o|0,g+=(c^o^s)+p[11]+1839030562|0,g=(g<<16|g>>>16)+c|0,s+=(g^c^o)+p[14]-35309556|0,s=(s<<23|s>>>9)+g|0,o+=(s^g^c)+p[1]-1530992060|0,o=(o<<4|o>>>28)+s|0,c+=(o^s^g)+p[4]+1272893353|0,c=(c<<11|c>>>21)+o|0,g+=(c^o^s)+p[7]-155497632|0,g=(g<<16|g>>>16)+c|0,s+=(g^c^o)+p[10]-1094730640|0,s=(s<<23|s>>>9)+g|0,o+=(s^g^c)+p[13]+681279174|0,o=(o<<4|o>>>28)+s|0,c+=(o^s^g)+p[0]-358537222|0,c=(c<<11|c>>>21)+o|0,g+=(c^o^s)+p[3]-722521979|0,g=(g<<16|g>>>16)+c|0,s+=(g^c^o)+p[6]+76029189|0,s=(s<<23|s>>>9)+g|0,o+=(s^g^c)+p[9]-640364487|0,o=(o<<4|o>>>28)+s|0,c+=(o^s^g)+p[12]-421815835|0,c=(c<<11|c>>>21)+o|0,g+=(c^o^s)+p[15]+530742520|0,g=(g<<16|g>>>16)+c|0,s+=(g^c^o)+p[2]-995338651|0,s=(s<<23|s>>>9)+g|0,o+=(g^(s|~c))+p[0]-198630844|0,o=(o<<6|o>>>26)+s|0,c+=(s^(o|~g))+p[7]+1126891415|0,c=(c<<10|c>>>22)+o|0,g+=(o^(c|~s))+p[14]-1416354905|0,g=(g<<15|g>>>17)+c|0,s+=(c^(g|~o))+p[5]-57434055|0,s=(s<<21|s>>>11)+g|0,o+=(g^(s|~c))+p[12]+1700485571|0,o=(o<<6|o>>>26)+s|0,c+=(s^(o|~g))+p[3]-1894986606|0,c=(c<<10|c>>>22)+o|0,g+=(o^(c|~s))+p[10]-1051523|0,g=(g<<15|g>>>17)+c|0,s+=(c^(g|~o))+p[1]-2054922799|0,s=(s<<21|s>>>11)+g|0,o+=(g^(s|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var y=Object.hasOwnProperty,w=Object.setPrototypeOf,C=Object.isFrozen,L=Object.getPrototypeOf,M=Object.getOwnPropertyDescriptor,x=Object.freeze,b=Object.seal,m=Object.create,p=typeof Reflect!="undefined"&&Reflect,o=p.apply,s=p.construct;o||(o=function(A,R,I){return A.apply(R,I)}),x||(x=function(A){return A}),b||(b=function(A){return A}),s||(s=function(A,R){return r(A,a(R))});var g=te(Array.prototype.forEach),c=te(Array.prototype.pop),P=te(Array.prototype.push),$=te(String.prototype.toLowerCase),J=te(String.prototype.toString),me=te(String.prototype.match),ee=te(String.prototype.replace),qe=te(String.prototype.indexOf),It=te(String.prototype.trim),H=te(RegExp.prototype.test),G=je(TypeError);function te(N){return function(A){for(var R=arguments.length,I=new Array(R>1?R-1:0),V=1;V<R;V++)I[V-1]=arguments[V];return o(N,A,I)}}function je(N){return function(){for(var A=arguments.length,R=new Array(A),I=0;I<A;I++)R[I]=arguments[I];return s(N,R)}}function D(N,A,R){var I;R=(I=R)!==null&&I!==void 0?I:$,w&&w(N,null);for(var V=A.length;V--;){var ae=A[V];if(typeof ae=="string"){var ne=R(ae);ne!==ae&&(C(A)||(A[V]=ne),ae=ne)}N[ae]=!0}return N}function ce(N){var A=m(null),R;for(R in N)o(y,N,[R])===!0&&(A[R]=N[R]);return A}function F(N,A){for(;N!==null;){var R=M(N,A);if(R){if(R.get)return te(R.get);if(typeof R.value=="function")return te(R.value)}N=L(N)}function I(V){return console.warn("fallback value for",V),null}return I}var ye=x(["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"]),Ce=x(["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"]),Ie=x(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),at=x(["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"]),Ne=x(["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"]),Pe=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Me=x(["#text"]),Te=x(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class",
`+z),ke&&(z=ee(z,Ft," "),z=ee(z,Ut," "),z=ee(z,Bt," ")),oe&&ht?oe.createHTML(z):z},A.setConfig=function(_){Kt(_),$t=!0},A.clearConfig=function(){Ge=null,$t=!1},A.isValidAttribute=function(_,h,v){Ge||Kt({});var T=Y(_),O=Y(h);return Xi(T,O,v)},A.addHook=function(_,h){typeof h=="function"&&(ge[_]=ge[_]||[],P(ge[_],h))},A.removeHook=function(_){if(ge[_])return c(ge[_])},A.removeHooks=function(_){ge[_]&&(ge[_]=[])},A.removeAllHooks=function(){ge={}},A}var Zr=Di();return Zr})});var bi=Se((Os,Ir)=>{Ir.exports=window.DOMPurify||(window.DOMPurify=vi().default||vi())});var Or=Se((Ws,Ni)=>{function Mr(e,i){if(i&&i.documentElement)e=i,i=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(i=i||{},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=!!i.debug,this._maxElemsToParse=i.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=i.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=i.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(i.classesToPreserve||[]),this._keepClasses=!!i.keepClasses,this._serializer=i.serializer||function(t){return t.innerHTML},this._disableJSONLD=!!i.disableJSONLD,this._allowedVideoRegex=i.allowedVideoRegex||this.REGEXPS.videos,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let t=function(r){if(r.nodeType==r.TEXT_NODE)return`${r.nodeName} ("${r.textContent}")`;let a=Array.from(r.attributes||[],function(l){return`${l.name}="${l.value}"`}).join(" ");return`<${r.localName} ${a}>`};this.log=function(){if(typeof console!="undefined"){let a=Array.from(arguments,l=>l&&l.nodeType==this.ELEMENT_NODE?t(l):l);a.unshift("Reader: (Readability)"),console.log.apply(console,a)}else if(typeof dump!="undefined"){var r=Array.prototype.map.call(arguments,function(a){return a&&a.nodeName?t(a):a}).join(" ");dump("Reader: (Readability) "+r+`
`)}}}else this.log=function(){}}Mr.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,i){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var t=e.length-1;t>=0;t--){var r=e[t],a=r.parentNode;a&&(!i||i.call(this,r,t,e))&&a.removeChild(r)}},_replaceNodeTags:function(e,i){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let t of e)this._setNodeTag(t,i)},_forEachNode:function(e,i){Array.prototype.forEach.call(e,i,this)},_findNode:function(e,i){return Array.prototype.find.call(e,i,this)},_someNode:function(e,i){return Array.prototype.some.call(e,i,this)},_everyNode:function(e,i){return Array.prototype.every.call(e,i,this)},_concatNodeLists:function(){var e=Array.prototype.slice,i=e.call(arguments),t=i.map(function(r){return e.call(r)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,i){return e.querySelectorAll?e.querySelectorAll(i.join(",")):[].concat.apply([],i.map(function(t){var r=e.getElementsByTagName(t);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%)
%videoPlayer%`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0};var S=require("obsidian");var _t=class extends S.PluginSettingTab{constructor(t,r){super(t,r);k(this,"plugin");this.plugin=r}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"General"}),new S.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||E.inboxDir).onChange(async u=>{this.plugin.settings.inboxDir=u,await this.plugin.saveSettings()})),new S.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||E.inboxDir+"/assets").onChange(async u=>{this.plugin.settings.assetsDir=u,await this.plugin.saveSettings()})),new S.Setting(t).setName("Open new note in current workspace").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||E.openNewNote).onChange(async u=>{this.plugin.settings.openNewNote=u,u===!0&&(this.plugin.settings.openNewNoteInNewTab=!1),await this.plugin.saveSettings(),this.display()})),new S.Setting(t).setName("Open new note in new tab").setDesc("If enabled, new note will open in new tab").addToggle(n=>n.setValue(this.plugin.settings.openNewNoteInNewTab||E.openNewNoteInNewTab).onChange(async u=>{this.plugin.settings.openNewNoteInNewTab=u,u===!0&&(this.plugin.settings.openNewNote=!1),await this.plugin.saveSettings(),this.display()})),new S.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||E.dateTitleFmt).onChange(async u=>{this.plugin.settings.dateTitleFmt=u,await this.plugin.saveSettings()})),new S.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||E.dateContentFmt).onChange(async u=>{this.plugin.settings.dateContentFmt=u,await this.plugin.saveSettings()})),new S.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:E.extendShareMenu).onChange(async u=>{this.plugin.settings.extendShareMenu=u,await this.plugin.saveSettings()})),t.createEl("h2",{text:"YouTube"}),new S.Setting(t).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||E.youtubeNoteTitle).onChange(async u=>{this.plugin.settings.youtubeNoteTitle=u,await this.plugin.saveSettings()})),new S.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||E.youtubeNote).onChange(async u=>{this.plugin.settings.youtubeNote=u,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new S.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||E.youtubeApiKey).onChange(async u=>{this.plugin.settings.youtubeApiKey=u,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube embed player width").addText(n=>n.setPlaceholder(E.youtubeEmbedWidth).setValue(this.plugin.setti
`;)i--;return e.substring(0,i)}var jn=["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 hi(e){return gi(e,jn)}var br=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function yr(e){return gi(e,br)}function Yn(e){return Nr(e,br)}var Tr=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Xn(e){return gi(e,Tr)}function Kn(e){return Nr(e,Tr)}function gi(e,i){return i.indexOf(e.nodeName)>=0}function Nr(e,i){return e.getElementsByTagName&&i.some(function(t){return e.getElementsByTagName(t).length})}var Q={};Q.paragraph={filter:"p",replacement:function(e){return`
2 years ago
`+e+`
2 years ago
`}};Q.lineBreak={filter:"br",replacement:function(e,i,t){return t.br+`
`}};Q.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,i,t){var r=Number(i.nodeName.charAt(1));if(t.headingStyle==="setext"&&r<3){var a=ui(r===1?"=":"-",e.length);return`
2 years ago
`+e+`
`+a+`
2 years ago
`}else return`
2 years ago
`+ui("#",r)+" "+e+`
2 years ago
`}};Q.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
2 years ago
`+e+`
2 years ago
`}};Q.list={filter:["ul","ol"],replacement:function(e,i){var t=i.parentNode;return t.nodeName==="LI"&&t.lastElementChild===i?`
`+e:`
2 years ago
`+e+`
2 years ago
`}};Q.listItem={filter:"li",replacement:function(e,i,t){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
`);var r=t.bulletListMarker+" ",a=i.parentNode;if(a.nodeName==="OL"){var l=a.getAttribute("start"),n=Array.prototype.indexOf.call(a.children,i);r=(l?Number(l)+n:n+1)+". "}return r+e+(i.nextSibling&&!/\n$/.test(e)?`
`:"")}};Q.indentedCodeBlock={filter:function(e,i){return i.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,i,t){return`
2 years ago
`+i.firstChild.textContent.replace(/\n/g,`
`)+`
2 years ago
`}};Q.fencedCodeBlock={filter:function(e,i){return i.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,i,t){for(var r=i.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],l=i.firstChild.textContent,n=t.fence.charAt(0),u=3,d=new RegExp("^"+n+"{3,}","gm"),f;f=d.exec(l);)f[0].length>=u&&(u=f[0].length+1);var y=ui(n,u);return`
2 years ago
`+y+a+`
`+l.replace(/\n$/,"")+`
`+y+`
2 years ago
`}};Q.horizontalRule={filter:"hr",replacement:function(e,i,t){return`
2 years ago
`+t.hr+`
2 years ago
`}};Q.inlineLink={filter:function(e,i){return i.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,i){var t=i.getAttribute("href");t&&(t=t.replace(/([()])/g,"\\$1"));var r=St(i.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+e+"]("+t+r+")"}};Q.referenceLink={filter:function(e,i){return i.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,i,t){var r=i.getAttribute("href"),a=St(i.getAttribute("title"));a&&(a=' "'+a+'"');var l,n;switch(t.linkReferenceStyle){case"collapsed":l="["+e+"][]",n="["+e+"]: "+r+a;break;case"shortcut":l="["+e+"]",n="["+e+"]: "+r+a;break;default:var u=this.references.length+1;l="["+e+"]["+u+"]",n="["+u+"]: "+r+a}return this.references.push(n),l},references:[],append:function(e){var i="";return this.references.length&&(i=`
2 years ago
`+this.references.join(`
`)+`
2 years ago
`,this.references=[]),i}};Q.emphasis={filter:["em","i"],replacement:function(e,i,t){return e.trim()?t.emDelimiter+e+t.emDelimiter:""}};Q.strong={filter:["strong","b"],replacement:function(e,i,t){return e.trim()?t.strongDelimiter+e+t.strongDelimiter:""}};Q.code={filter:function(e){var i=e.previousSibling||e.nextSibling,t=e.parentNode.nodeName==="PRE"&&!i;return e.nodeName==="CODE"&&!t},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var i=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",t="`",r=e.match(/`+/gm)||[];r.indexOf(t)!==-1;)t=t+"`";return t+i+e+i+t}};Q.image={filter:"img",replacement:function(e,i){var t=St(i.getAttribute("alt")),r=i.getAttribute("src")||"",a=St(i.getAttribute("title")),l=a?' "'+a+'"':"";return r?"!["+t+"]("+r+l+")":""}};function St(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function Ar(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 i in e.rules)this.array.push(e.rules[i])}Ar.prototype={add:function(e,i){this.array.unshift(i)},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 i;return(i=oi(this.array,e,this.options))||(i=oi(this._keep,e,this.options))||(i=oi(this._remove,e,this.options))?i:this.defaultRule},forEach:function(e){for(var i=0;i<this.array.length;i++)e(this.array[i],i)}};function oi(e,i,t){for(var r=0;r<e.length;r++){var a=e[r];if(Jn(a,i,t))return a}}function Jn(e,i,t){var r=e.filter;if(typeof r=="string"){if(r===i.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(i.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,i,t))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Zn(e){var i=e.element,t=e.isBlock,r=e.isVoid,a=e.isPre||function(w){return w.nodeName==="PRE"};if(!(!i.firstChild||a(i))){for(var l=null,n=!1,u=null,d=dr(u,i,a);d!==i;){if(d.nodeType===3||d.nodeType===4){var f=d.data.replace(/[ \r\n\t]+/g," ");if((!l||/ $/.test(l.data))&&!n&&f[0]===" "&&(f=f.substr(1)),!f){d=li(d);continue}d.data=f,l=d}else if(d.nodeType===1)t(d)||d.nodeName==="BR"?(l&&(l.data=l.data.replace(/ $/,"")),l=null,n=!1):r(d)||a(d)?(l=null,n=!0):l&&(n=!1);else{d=li(d);continue}var y=dr(u,d,a);u=d,d=y}l&&(l.data=l.data.replace(/ $/,""),l.data||li(l))}}function li(e){var i=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),i}function dr(e,i,t){return e&&e.parentNode===i||t(i)?i.nextSibling||i.parentNode:i.firstChild||i.nextSibling||i.parentNode}var pi=typeof window!="undefined"?window:{};function Qn(){var e=pi.DOMParser,i=!1;try{new e().parseFromString("","text/html")&&(i=!0)}catch(t){}return i}function ea(){var e=function(){};return ta()?e.prototype.parseFromString=function(i){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(i),t.close(),t}:e.prototype.parseFromString=function(i){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(i),t.close(),t},e}function ta(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(i){pi.ActiveXObject&&(e=!0)}return e}var ia=Qn()?pi.DOMParser:ea();function ra(e,i){var t;if(typeof e=="string"){var r=na().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");t=r.getElementById("turndown-root")}else t=e.cloneNode(!0);return Zn({element:t,isBlock:hi,isVoid:yr,isPre:i.preformattedCode?aa:null}),t}var ci;function na(){return ci=ci||new ia,ci}function aa(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function sa(e,i){return e.isBlock=hi(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=oa(e),e.flankingWhitespace=la(e,i),e}function oa(e){return!yr(e)&&!Xn(e)&&/^\s*$/i.test(e.textContent)&&!Yn(e)&&!Kn(e)}function la(e,i){if(e.isBlock||i.preformattedCode&&e.isCode)return{leading:"",trailing:""};var t=ca(e.textContent);return t.leadingAscii&&vr("left",e,i)&&(t.leading=t.leadingNonAscii),t.trailingAscii&&vr("right",e,i)&&(t.trailing=t.trailingNonAscii),{leading:t.leading,trailing:t.trailing}}function ca(e){var i=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:i[1],leadingAscii:i[2],leadingNonAscii:i[3],trailing:i[4],trailingNonAscii:i[5],trailingAscii:i[6]}}function vr(e,i,t){var r,a,l;return e==="left"?(r=i.previousSibling,a=/ $/):(r=i.nextSibling,a=/^ /),r&&(r.nodeType===3?l=a.test(r.nodeValue):t.preformattedCode&&r.nodeName==="CODE"?l=!1:r.nodeType===1&&!hi(r)&&(l=a.test(r.textContent))),l}var ua=Array.prototype.reduce,ha=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\
2 years ago
`:""},keepReplacement:function(t,r){return r.isBlock?`
2 years ago
2 years ago
`+r.outerHTML+`
2 years ago
`:r.outerHTML},defaultReplacement:function(t,r){return r.isBlock?`
2 years ago
`+t+`
2 years ago
`:t}};this.options=$n({},i,e),this.rules=new Ar(this.options)}Rt.prototype={turndown:function(e){if(!ma(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var i=Er.call(this,new ra(e,this.options));return ga.call(this,i)},use:function(e){if(Array.isArray(e))for(var i=0;i<e.length;i++)this.use(e[i]);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,i){return this.rules.add(e,i),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return ha.reduce(function(i,t){return i.replace(t[0],t[1])},e)}};function Er(e){var i=this;return ua.call(e.childNodes,function(t,r){r=new sa(r,i.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:i.escape(r.nodeValue):r.nodeType===1&&(a=pa.call(i,r)),_r(t,a)},"")}function ga(e){var i=this;return this.rules.forEach(function(t){typeof t.append=="function"&&(e=_r(e,t.append(i.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function pa(e){var i=this.rules.forNode(e),t=Er.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(t=t.trim()),r.leading+i.replacement(t,e,this.options)+r.trailing}function _r(e,i){var t=qn(e),r=zn(i),a=Math.max(e.length-t.length,i.length-r.length),l=`
2 years ago
`.substring(0,a);return t+l+r}function ma(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var wr=Rt;var Sr=/highlight-(?:text|source)-([a-z0-9]+)/;function fa(e){e.addRule("highlightedCodeBlock",{filter:function(i){var t=i.firstChild;return i.nodeName==="DIV"&&Sr.test(i.className)&&t&&t.nodeName==="PRE"},replacement:function(i,t,r){var a=t.className||"",l=(a.match(Sr)||[null,""])[1];return`
2 years ago
`+r.fence+l+`
`+t.firstChild.textContent+`
2 years ago
`+r.fence+`
2 years ago
`}})}function da(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(i){return"~"+i+"~"}})}var va=Array.prototype.indexOf,xe={};xe.tableCell={filter:["th","td"],replacement:function(e,i){return Rr(e,i)+Dr(i,"")}};xe.tableRow={filter:"tr",replacement:function(e,i){var t="",r={left:":--",right:"--:",center:":-:"};if(ba(i))for(var a=0;a<i.childNodes.length;a++){var l="---",n=(i.childNodes[a].getAttribute("align")||"").toLowerCase();n&&(l=r[n]||l),t+=Rr(l,i.childNodes[a])+Dr(i.childNodes[a],l)}return`
`+e+(t?`
`+t:"")}};xe.table={filter:function(e){return e.nodeName==="TABLE"&&!xr(e)},replacement:function(e){return e=e.replace(`
2 years ago
`,`
`),`
2 years ago
`+e+`
2 years ago
`}};xe.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};xe.captionSection={filter:"caption",replacement:function(e,i){return i.parentNode.nodeName==="TABLE"&&i.parentNode.childNodes[0]===i?e:""}};function ba(e){var i=e.parentNode,t=i;return(i.nodeName==="THEAD"||i.nodeName==="TFOOT"||i.nodeName==="TBODY")&&(t=i.parentNode),t.nodeName==="TABLE"&&t.rows[0]===e}function Rr(e,i){var t=va.call(i.parentNode.childNodes,i),r=" ";return t===0&&(r="| "),e=e.replace(/\r\n/g,`
`).replace(/\n/g," "),e=e.replace(/\|/g,"\\|"),r+e+" |"}function Dr(e,i){var t=e.getAttribute("colspan")||1;return t<=1?"":(" "+i+" |").repeat(t-1)}function xr(e){for(var i=e.parentNode;i;){if(i.nodeName==="TABLE")return!0;i=i.parentNode}return!1}function ya(e){e.keep(function(t){return t.nodeName==="TABLE"&&xr(t)});for(var i in xe)e.addRule(i,xe[i])}function Ta(e){e.addRule("taskListItems",{filter:function(i){return i.type==="checkbox"&&i.parentNode.nodeName==="LI"},replacement:function(i,t){return(t.checked?"[x]":"[ ]")+" "}})}function Lr(e){e.use([fa,da,ya,Ta])}async function be(e){let i=Lr,t=new wr({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return t.use(i),t.addRule("fencedCodeLangBlock",{filter:a=>a.nodeName=="PRE"&&(!a.firstChild||a.firstChild.nodeName!="CODE")&&!a.querySelector("img"),replacement:function(a,l,n){var x;l.innerHTML=l.innerHTML.replaceAll("<br-keep></br-keep>","<br>");let u=(x=l.id)==null?void 0:x.match(/code-lang-(.+)/),d=(u==null?void 0:u.length)>0?u[1]:"",f=l.textContent,y=n.fence.charAt(0),w=3,C=new RegExp("^"+y+"{3,}","gm"),L;for(;L=C.exec(f);)L[0].length>=w&&(w=L[0].length+1);let M=Array(w+1).join(y);return`
`+M+d+`
`+f.replace(/\n$/,"")+`
`+M+`
`}}),t.turndown(e)}var mi=class extends W{constructor(t,r){super(t,r);k(this,"PATTERN",/(https:\/\/(twitter|x).com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/)}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=new URL(t);r.hostname==="x.com"&&(r.hostname="twitter.com");let a=JSON.parse(await(0,Dt.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${r.href}`})),l=a.author_name,n=await be(a.html),u=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,()=>l).replace(/%tweetURL%/g,()=>a.url).replace(/%tweetContent%/g,()=>n).replace(/%tweetPublishDate%/g,()=>this.getPublishedDateFromDOM(a.html)),f=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,()=>l).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new B(f,u)}getPublishedDateFromDOM(t){let a=new DOMParser().parseFromString(t,"text/html").querySelector("blockquote > a"),l=(0,Dt.moment)(a.textContent);return l.isValid()?l.format(this.settings.dateContentFmt):""}},Cr=mi;var xt=require("obsidian"),yi=Ve(bi());var Ti=class extends W{constructor(t,r){super(t,r);k(this,"PATTERN",/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/)}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=await(0,xt.request)({method:"GET",url:t}),a=new DOMParser().parseFromString(r,"text/html"),l=await this.parseDocument(a),n=this.settings.stackExchangeNoteTitle.replace(/%title%/g,()=>l.title).replace(/%date%/g,this.getFormattedDateForFilename()),u=l.topAnswer?this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,()=>l.topAnswer.content).replace(/%authorName%/g,()=>l.topAnswer.author.name).replace(/%authorProfileURL%/g,()=>l.topAnswer.author.profile):"",d="";for(let C=0;C<l.answers.length;C++){let L=this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,()=>l.answers[C].content).replace(/%authorName%/g,()=>l.answers[C].author.name).replace(/%authorProfileURL%/g,()=>l.answers[C].author.profile);d=d.concat(`
2 years ago
***
3 years ago
`,L)}let f=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,()=>l.title).replace(/%questionURL%/g,()=>l.url).replace(/%questionContent%/g,()=>l.content).replace(/%authorName%/g,()=>l.author.name).replace(/%authorProfileURL%/g,()=>l.author.profile).replace(/%topAnswer%/g,()=>u).replace(/%answers%/g,()=>d.trim()),y=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${le(n)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&xt.Platform.isDesktop&&(f=await De(app,f,y));let w=`${n}.md`;return new B(w,f)}async parseDocument(t){var n,u,d,f,y,w,C,L,M,x,b,m,p,o,s,g;let r;try{r=new URL((d=(n=t.querySelector('link[rel="canonical"]'))==null?void 0:n.getAttribute("href"))!=null?d:(u=t.querySelector('meta[property="og:url"]'))==null?void 0:u.getAttribute("content"))}catch(c){r=null}let a=t.querySelector('#question [itemprop="author"]'),l=[];for(let c of t.querySelectorAll(".answer")){let P=c.querySelector('[itemprop="author"]');l.push({content:await be(yi.sanitize((f=c.querySelector('[itemprop="text"]'))!=null?f:"")),author:{name:(w=(y=P==null?void 0:P.querySelector('[itemprop="name"]'))==null?void 0:y.textContent)!=null?w:"",profile:P instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(L=(C=P.querySelector("a"))==null?void 0:C.getAttribute("href"))!=null?L:""):""}})}return{title:(x=(M=t.querySelector('#question-header [itemprop="name"]'))==null?void 0:M.textContent)!=null?x:"",content:await be(yi.sanitize((b=t.querySelector('#question [itemprop="text"]'))!=null?b:"")),url:(m=r==null?void 0:r.href)!=null?m:"",topAnswer:l.slice(0,1).shift(),answers:l.slice(1),author:{name:(o=(p=a==null?void 0:a.querySelector('[itemprop="name"]'))==null?void 0:p.textContent)!=null?o:"",profile:a instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(g=(s=a.querySelector("a"))==null?void 0:s.getAttribute("href"))!=null?g:""):""}}}},Pr=Ti;var Le=require("obsidian"),Lt=Ve(Br()),Hr=Ve(bi());var Ei=class extends W{constructor(i,t){super(i,t)}test(i){return this.isValidUrl(i)}async prepareNote(i){var w,C,L,M,x;let t=new URL(i),r=await(0,Le.request)({method:"GET",url:t.href}),a=new DOMParser().parseFromString(r,"text/html"),l=a.getElementsByTagName("base"),n=null;l.length>0&&(n=l.item(0).getAttribute("href"),Array.from(l).forEach(b=>{b.remove()}));let u=a.createElement("base");u.setAttribute("href",ei(n!=null?n:t.href,t.origin)),a.head.append(u);let d=Hr.sanitize(a.body.innerHTML);a.body.innerHTML=d,(w=a.body.querySelectorAll("pre br"))==null||w.forEach(b=>{b.outerHTML="<br-keep></br-keep>"}),(C=a.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||C.forEach(b=>{b.className=""}),(L=a.body.querySelectorAll("[class*=highlight-text],[class*=highlight-source]"))==null||L.forEach(b=>{var p;let m=(p=b.className.match(/highlight-(?:text|source)-([a-z0-9]+)/))==null?void 0:p[1];b.firstElementChild.nodeName=="PRE"&&(b.removeAttribute("data-snippet-clipboard-copy-content"),b.firstElementChild.id=`code-lang-${m}`)}),(M=a.body.querySelectorAll("[class*=language-]"))==null||M.forEach(b=>{var p;let m=(p=b.className.match(/language-([a-z0-9]+)/))==null?void 0:p[1];b.id=`code-lang-${m}`}),(x=a.body.querySelectorAll(".codehilite > pre"))==null||x.forEach(b=>{b.firstChild.nodeName!=="CODE"&&!b.className.includes("language")&&(b.id="code-lang-text")}),(0,Lt.isProbablyReaderable)(a)||new Le.Notice("@mozilla/readability considers this document to unlikely be readerable.");let f=this.extractPreviewUrl(a),y=new Lt.Readability(a).parse();return y===null||!Object.prototype.hasOwnProperty.call(y,"content")?this.notParsableArticle(t.href,f):this.parsableArticle({url:t.href,previewImageUrl:f,...y})}async parsableArticle(i){let t=i.title||"No title",r=await be(i.content),a=i.publishedTime!==null?Et(i.publishedTime,this.settings.dateContentFmt):"",l=this.settings.parseableArticleNoteTitle.replace(/%title%/g,()=>t).replace(/%date%/g,this.getFormattedDateForFilename()),n=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForCo
***
`,L)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,()=>a.account.display_name).replace(/%tootURL%/g,()=>a.url).replace(/%tootContent%/g,()=>u),f=`${l}.md`;return new B(f,d)}async loadStatus(i,t){return JSON.parse(await(0,ze.request)({method:"GET",contentType:"application/json",url:`https://${i}${wi.STATUS}/${t}`}))}async loadReplies(i,t){let r=String.prototype.concat.call("https://",i,String.prototype.replace.call(wi.CONTEXT,"%id%",t));return JSON.parse(await(0,ze.request)({method:"GET",contentType:"application/json",url:r})).descendants}async parseStatus(i,t){let r=await be(i.content),a=this.settings.downloadMastodonMediaAttachments&&ze.Platform.isDesktop?await De(app,this.prepareMedia(i.media_attachments),t):this.prepareMedia(i.media_attachments);return r.concat(a)}prepareMedia(i){return i.reduce((t,{url:r,description:a})=>{let l=a?`
> *${a}*`:"";return`${t}
![](${r})${l}`},"")}async testIsMastodon(i){if(!i)return!1;let t=new URL(i).hostname;try{let r=JSON.parse(await(0,ze.request)({method:"GET",contentType:"application/json",url:`https://${t}${wi.INSTANCE}`}));return(r==null?void 0:r.domain)===t}catch(r){return!1}}},Wr=Si;var $r=require("obsidian");var Ri=class extends W{constructor(t,r){super(t,r);k(this,"PATTERN",/(tiktok.com)\/(\S+)\/(video)\/(\d+)/)}test(t){return this.isValidUrl(t)&&this.PATTERN.test(t)}async prepareNote(t){let r=await this.parseHtml(t),a=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),n=`${this.settings.tikTokNoteTitle.replace(/%authorName%/g,()=>r.author.name).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new B(n,a)}async parseHtml(t){var n,u,d,f;let r=await(0,$r.request)({method:"GET",url:t,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"}}),a=new DOMParser().parseFromString(r,"text/html"),l=this.PATTERN.exec(t);return{id:l[4],url:(u=(n=a.querySelector('meta[property="og:url"]'))==null?void 0:n.getAttribute("content"))!=null?u:t,description:(f=(d=a.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/${l[4]}"></iframe>`,author:{name:l[2],url:`https://www.tiktok.com/${l[2]}`}}}},zr=Ri;var nt=class{constructor(i){k(this,"parsers");this.parsers=i}async createParser(i){for(let t of this.parsers)if(await t.test(i))return t}};var Ct=class extends pe.Plugin{constructor(){super(...arguments);k(this,"settings");k(this,"parserCreator")}async onload(){await this.loadSettings(),this.parserCreator=new nt([new hr(this.app,this.settings),new pr(this.app,this.settings),new fr(this.app,this.settings),new Cr(this.app,this.settings),new Pr(this.app,this.settings),new Wr(this.app,this.settings),new zr(this.app,this.settings),new Gr(this.app,this.settings),new Vr(this.app,this.settings)]),(0,pe.addIcon)("read-it-later",Sa),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 _t(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(t,r)=>{t.addItem(a=>{a.setTitle("ReadItLater"),a.setIcon("read-it-later"),a.onClick(()=>this.processContent(r))})})),this.registerEvent(this.app.workspace.on("url-menu",(t,r)=>{Re(r,[vt,bt])&&t.addItem(a=>{a.setTitle("ReadItLater"),a.setIcon("read-it-later"),a.onClick(()=>this.processContent(r))})}))}async loadSettings(){this.settings=Object.assign({},E,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let t=await navigator.clipboard.readText(),a=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(a.fileName,a.content)}async processContent(t){let a=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(a.fileName,a.content)}async writeFile(t,r){let a;if(t=le(t),await rt(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?a=(0,pe.normalizePath)(`${this.settings.inboxDir}/${t}`):a=(0,pe.normalizePath)(`/${t}`),await this.app.vault.adapter.exists(a))new pe.Notice(`${t} already exists!`);else{let l=await this.app.vault.create(a,r);(this.settings.openNewNote||this.settings.openNewNoteInNewTab)&&this.app.workspace.getLeaf(this.settings.openNewNoteInNewTab?"tab":!1).openFile(l),new pe.Notice(`${t} created successful`)}}},Sa=`
<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 *)
*/