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
117 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
*/
2 years ago
var pn=Object.create;var gt=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var dn=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty;var Ee=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),bn=(e,i)=>{for(var t in i)gt(e,t,{get:i[t],enumerable:!0})},$i=(e,i,t,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of fn(i))!vn.call(e,s)&&s!==t&&gt(e,s,{get:()=>i[s],enumerable:!(r=mn(i,s))||r.enumerable});return e};var Fe=(e,i,t)=>(t=e!=null?pn(dn(e)):{},$i(i||!e||!e.__esModule?gt(t,"default",{value:e,enumerable:!0}):t,e)),yn=e=>$i(gt({},"__esModule",{value:!0}),e);var Ki=Ee((Yi,Xi)=>{(function(e){if(typeof Yi=="object")Xi.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,l,a,g,u){return p=i(i(p,m),i(a,u)),i(p<<g|p>>>32-g,l)}function s(m,p){var l=m[0],a=m[1],g=m[2],u=m[3];l+=(a&g|~a&u)+p[0]-680876936|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&g)+p[1]-389564586|0,u=(u<<12|u>>>20)+l|0,g+=(u&l|~u&a)+p[2]+606105819|0,g=(g<<17|g>>>15)+u|0,a+=(g&u|~g&l)+p[3]-1044525330|0,a=(a<<22|a>>>10)+g|0,l+=(a&g|~a&u)+p[4]-176418897|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&g)+p[5]+1200080426|0,u=(u<<12|u>>>20)+l|0,g+=(u&l|~u&a)+p[6]-1473231341|0,g=(g<<17|g>>>15)+u|0,a+=(g&u|~g&l)+p[7]-45705983|0,a=(a<<22|a>>>10)+g|0,l+=(a&g|~a&u)+p[8]+1770035416|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&g)+p[9]-1958414417|0,u=(u<<12|u>>>20)+l|0,g+=(u&l|~u&a)+p[10]-42063|0,g=(g<<17|g>>>15)+u|0,a+=(g&u|~g&l)+p[11]-1990404162|0,a=(a<<22|a>>>10)+g|0,l+=(a&g|~a&u)+p[12]+1804603682|0,l=(l<<7|l>>>25)+a|0,u+=(l&a|~l&g)+p[13]-40341101|0,u=(u<<12|u>>>20)+l|0,g+=(u&l|~u&a)+p[14]-1502002290|0,g=(g<<17|g>>>15)+u|0,a+=(g&u|~g&l)+p[15]+1236535329|0,a=(a<<22|a>>>10)+g|0,l+=(a&u|g&~u)+p[1]-165796510|0,l=(l<<5|l>>>27)+a|0,u+=(l&g|a&~g)+p[6]-1069501632|0,u=(u<<9|u>>>23)+l|0,g+=(u&a|l&~a)+p[11]+643717713|0,g=(g<<14|g>>>18)+u|0,a+=(g&l|u&~l)+p[0]-373897302|0,a=(a<<20|a>>>12)+g|0,l+=(a&u|g&~u)+p[5]-701558691|0,l=(l<<5|l>>>27)+a|0,u+=(l&g|a&~g)+p[10]+38016083|0,u=(u<<9|u>>>23)+l|0,g+=(u&a|l&~a)+p[15]-660478335|0,g=(g<<14|g>>>18)+u|0,a+=(g&l|u&~l)+p[4]-405537848|0,a=(a<<20|a>>>12)+g|0,l+=(a&u|g&~u)+p[9]+568446438|0,l=(l<<5|l>>>27)+a|0,u+=(l&g|a&~g)+p[14]-1019803690|0,u=(u<<9|u>>>23)+l|0,g+=(u&a|l&~a)+p[3]-187363961|0,g=(g<<14|g>>>18)+u|0,a+=(g&l|u&~l)+p[8]+1163531501|0,a=(a<<20|a>>>12)+g|0,l+=(a&u|g&~u)+p[13]-1444681467|0,l=(l<<5|l>>>27)+a|0,u+=(l&g|a&~g)+p[2]-51403784|0,u=(u<<9|u>>>23)+l|0,g+=(u&a|l&~a)+p[7]+1735328473|0,g=(g<<14|g>>>18)+u|0,a+=(g&l|u&~l)+p[12]-1926607734|0,a=(a<<20|a>>>12)+g|0,l+=(a^g^u)+p[5]-378558|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^g)+p[8]-2022574463|0,u=(u<<11|u>>>21)+l|0,g+=(u^l^a)+p[11]+1839030562|0,g=(g<<16|g>>>16)+u|0,a+=(g^u^l)+p[14]-35309556|0,a=(a<<23|a>>>9)+g|0,l+=(a^g^u)+p[1]-1530992060|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^g)+p[4]+1272893353|0,u=(u<<11|u>>>21)+l|0,g+=(u^l^a)+p[7]-155497632|0,g=(g<<16|g>>>16)+u|0,a+=(g^u^l)+p[10]-1094730640|0,a=(a<<23|a>>>9)+g|0,l+=(a^g^u)+p[13]+681279174|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^g)+p[0]-358537222|0,u=(u<<11|u>>>21)+l|0,g+=(u^l^a)+p[3]-722521979|0,g=(g<<16|g>>>16)+u|0,a+=(g^u^l)+p[6]+76029189|0,a=(a<<23|a>>>9)+g|0,l+=(a^g^u)+p[9]-640364487|0,l=(l<<4|l>>>28)+a|0,u+=(l^a^g)+p[12]-421815835|0,u=(u<<11|u>>>21)+l|0,g+=(u^l^a)+p[15]+530742520|0,g=(g<<16|g>>>16)+u|0,a+=(g^u^l)+p[2]-995338651|0,a=(a<<23|a>>>9)+g|0,l+=(g^(a|~u))+p[0]-198630844|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~g))+p[7]+1126891415|0,u=(u<<10|u>>>22)+l|0,g+=(l^(u|~a))+p[14]-1416354905|0,g=(g<<15|g>>>17)+u|0,a+=(u^(g|~l))+p[5]-57434055|0,a=(a<<21|a>>>11)+g|0,l+=(g^(a|~u))+p[12]+1700485571|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~g))+p[3]-1894986606|0,u=(u<<10|u>>>22)+l|0,g+=(l^(u|~a))+p[10]-1051523|0,g=(g<<15|g>>>17)+u|0,a+=(u^(g|~l))+p[1]-2054922799|0,a=(a<<21|a>>>11)+g|0,l+=(g^(a|~u))+p[8]+1873313359|0,l=(l<<6|l>>>26)+a|0,u+=(a^(l|~g))+p[15]-30611744|0,u=(u<<10|u>>>22)+l|0,g+=(l^(u|~a))+p[6]-1560198380|0,g=(g<<15|g>>
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b=Object.hasOwnProperty,R=Object.setPrototypeOf,I=Object.isFrozen,C=Object.getPrototypeOf,U=Object.getOwnPropertyDescriptor,x=Object.freeze,A=Object.seal,m=Object.create,p=typeof Reflect!="undefined"&&Reflect,l=p.apply,a=p.construct;l||(l=function(T,w,L){return T.apply(w,L)}),x||(x=function(T){return T}),A||(A=function(T){return T}),a||(a=function(T,w){return r(T,s(w))});var g=ee(Array.prototype.forEach),u=ee(Array.prototype.pop),P=ee(Array.prototype.push),W=ee(String.prototype.toLowerCase),K=ee(String.prototype.toString),ve=ee(String.prototype.match),Q=ee(String.prototype.replace),Ge=ee(String.prototype.indexOf),wt=ee(String.prototype.trim),V=ee(RegExp.prototype.test),B=We(TypeError);function ee(y){return function(T){for(var w=arguments.length,L=new Array(w>1?w-1:0),O=1;O<w;O++)L[O-1]=arguments[O];return l(y,T,L)}}function We(y){return function(){for(var T=arguments.length,w=new Array(T),L=0;L<T;L++)w[L]=arguments[L];return a(y,w)}}function D(y,T,w){w=w||W,R&&R(y,null);for(var L=T.length;L--;){var O=T[L];if(typeof O=="string"){var oe=w(O);oe!==O&&(I(T)||(T[L]=oe),O=oe)}y[O]=!0}return y}function ae(y){var T=m(null),w;for(w in y)l(b,y,[w])===!0&&(T[w]=y[w]);return T}function k(y,T){for(;y!==null;){var w=U(y,T);if(w){if(w.get)return ee(w.get);if(typeof w.value=="function")return ee(w.value)}y=C(y)}function L(O){return console.warn("fallback value for",O),null}return L}var be=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"]),Se=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"]),Re=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"]),tt=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"]),De=x(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xe=x(["#text"]),ye=x(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","con
`+j),Ie&&(j=Q(j,Lt," "),j=Q(j,It," "),j=Q(j,Ct," ")),re&&ot?re.createHTML(j):j},T.setConfig=function(E){Wt(E),Ot=!0},T.clearConfig=function(){Oe=null,Ot=!1},T.isValidAttribute=function(E,h,v){Oe||Wt({});var N=z(E),M=z(h);return Hi(N,M,v)},T.addHook=function(E,h){typeof h=="function"&&(ce[E]=ce[E]||[],P(ce[E],h))},T.removeHook=function(E){if(ce[E])return u(ce[E])},T.removeHooks=function(E){ce[E]&&(ce[E]=[])},T.removeAllHooks=function(){ce={}},T}var Vr=Ti();return Vr})});var hi=Ee((ps,_r)=>{_r.exports=window.DOMPurify||(window.DOMPurify=ui().default||ui())});var Rr=Ee((Ns,mi)=>{function Sr(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._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 s=Array.from(r.attributes||[],function(o){return`${o.name}="${o.value}"`}).join(" ");return`<${r.localName} ${s}>`};this.log=function(){if(typeof dump!="undefined"){var r=Array.prototype.map.call(arguments,function(s){return s&&s.nodeName?t(s):s}).join(" ");dump("Reader: (Readability) "+r+`
`)}else if(typeof console!="undefined"){let s=Array.from(arguments,o=>o&&o.nodeType==this.ELEMENT_NODE?t(o):o);s.unshift("Reader: (Readability)"),console.log.apply(console,s)}}}else this.log=function(){}}Sr.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,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],s=r.parentNode;s&&(!i||i.call(this,r,t,e))&&s.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
# [%videoTitle%](%videoURL%)
2 years ago
2 years ago
%videoPlayer%`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",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 vt=class extends S.PluginSettingTab{constructor(t,r){super(t,r);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||_.inboxDir).onChange(async c=>{this.plugin.settings.inboxDir=c,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||_.inboxDir+"/assets").onChange(async c=>{this.plugin.settings.assetsDir=c,await this.plugin.saveSettings()})),new S.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 c=>{this.plugin.settings.openNewNote=c,await this.plugin.saveSettings()})),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||_.dateTitleFmt).onChange(async c=>{this.plugin.settings.dateTitleFmt=c,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||_.dateContentFmt).onChange(async c=>{this.plugin.settings.dateContentFmt=c,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:_.extendShareMenu).onChange(async c=>{this.plugin.settings.extendShareMenu=c,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||_.youtubeNoteTitle).onChange(async c=>{this.plugin.settings.youtubeNoteTitle=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelId%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||_.youtubeNote).onChange(async c=>{this.plugin.settings.youtubeNote=c,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||_.youtubeApiKey).onChange(async c=>{this.plugin.settings.youtubeApiKey=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube embed player width").addText(n=>n.setPlaceholder(_.youtubeEmbedWidth).setValue(this.plugin.settings.youtubeEmbedWidth||_.youtubeEmbedWidth).onChange(async c=>{this.plugin.settings.youtubeEmbedWidth=c,await this.plugin.saveSettings()})),new S.Setting(t).setName("Youtube embed player height").addText(n=>n.setPlaceholder(_.youtubeEmbedHeight).setValue(this.plugin.settings.youtubeEmbedHeight||_.youtubeEmbedHeight).onChange(async c=>{this.plugin.settings.youtubeEmbedHeight=c,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Vimeo"}),new S.Setting(t).setName("Vimeo
`;)i--;return e.substring(0,i)}var Fn=["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 ai(e){return si(e,Fn)}var lr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function cr(e){return si(e,lr)}function Un(e){return hr(e,lr)}var ur=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Bn(e){return si(e,ur)}function Hn(e){return hr(e,ur)}function si(e,i){return i.indexOf(e.nodeName)>=0}function hr(e,i){return e.getElementsByTagName&&i.some(function(t){return e.getElementsByTagName(t).length})}var Z={};Z.paragraph={filter:"p",replacement:function(e){return`
2 years ago
`+e+`
2 years ago
2 years ago
`}};Z.lineBreak={filter:"br",replacement:function(e,i,t){return t.br+`
`}};Z.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 s=ni(r===1?"=":"-",e.length);return`
2 years ago
`+e+`
2 years ago
`+s+`
2 years ago
`}else return`
2 years ago
2 years ago
`+ni("#",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
2 years ago
`}};Z.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
2 years ago
`}};Z.listItem={filter:"li",replacement:function(e,i,t){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
2 years ago
`);var r=t.bulletListMarker+" ",s=i.parentNode;if(s.nodeName==="OL"){var o=s.getAttribute("start"),n=Array.prototype.indexOf.call(s.children,i);r=(o?Number(o)+n:n+1)+". "}return r+e+(i.nextSibling&&!/\n$/.test(e)?`
`:"")}};Z.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
2 years ago
`+i.firstChild.textContent.replace(/\n/g,`
`)+`
2 years ago
2 years ago
`}};Z.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")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],o=i.firstChild.textContent,n=t.fence.charAt(0),c=3,d=new RegExp("^"+n+"{3,}","gm"),f;f=d.exec(o);)f[0].length>=c&&(c=f[0].length+1);var b=ni(n,c);return`
2 years ago
2 years ago
`+b+s+`
`+o.replace(/\n$/,"")+`
`+b+`
2 years ago
2 years ago
`}};Z.horizontalRule={filter:"hr",replacement:function(e,i,t){return`
2 years ago
2 years ago
`+t.hr+`
2 years ago
2 years ago
`}};Z.inlineLink={filter:function(e,i){return i.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,i){var t=i.getAttribute("href"),r=Nt(i.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+t+r+")"}};Z.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"),s=Nt(i.getAttribute("title"));s&&(s=' "'+s+'"');var o,n;switch(t.linkReferenceStyle){case"collapsed":o="["+e+"][]",n="["+e+"]: "+r+s;break;case"shortcut":o="["+e+"]",n="["+e+"]: "+r+s;break;default:var c=this.references.length+1;o="["+e+"]["+c+"]",n="["+c+"]: "+r+s}return this.references.push(n),o},references:[],append:function(e){var i="";return this.references.length&&(i=`
2 years ago
`+this.references.join(`
`)+`
2 years ago
2 years ago
`,this.references=[]),i}};Z.emphasis={filter:["em","i"],replacement:function(e,i,t){return e.trim()?t.emDelimiter+e+t.emDelimiter:""}};Z.strong={filter:["strong","b"],replacement:function(e,i,t){return e.trim()?t.strongDelimiter+e+t.strongDelimiter:""}};Z.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}};Z.image={filter:"img",replacement:function(e,i){var t=Nt(i.getAttribute("alt")),r=i.getAttribute("src")||"",s=Nt(i.getAttribute("title")),o=s?' "'+s+'"':"";return r?"!["+t+"]("+r+o+")":""}};function Nt(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function gr(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])}gr.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=ti(this.array,e,this.options))||(i=ti(this._keep,e,this.options))||(i=ti(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 ti(e,i,t){for(var r=0;r<e.length;r++){var s=e[r];if(Gn(s,i,t))return s}}function Gn(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 Wn(e){var i=e.element,t=e.isBlock,r=e.isVoid,s=e.isPre||function(R){return R.nodeName==="PRE"};if(!(!i.firstChild||s(i))){for(var o=null,n=!1,c=null,d=sr(c,i,s);d!==i;){if(d.nodeType===3||d.nodeType===4){var f=d.data.replace(/[ \r\n\t]+/g," ");if((!o||/ $/.test(o.data))&&!n&&f[0]===" "&&(f=f.substr(1)),!f){d=ii(d);continue}d.data=f,o=d}else if(d.nodeType===1)t(d)||d.nodeName==="BR"?(o&&(o.data=o.data.replace(/ $/,"")),o=null,n=!1):r(d)||s(d)?(o=null,n=!0):o&&(n=!1);else{d=ii(d);continue}var b=sr(c,d,s);c=d,d=b}o&&(o.data=o.data.replace(/ $/,""),o.data||ii(o))}}function ii(e){var i=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),i}function sr(e,i,t){return e&&e.parentNode===i||t(i)?i.nextSibling||i.parentNode:i.firstChild||i.nextSibling||i.parentNode}var pr=typeof window!="undefined"?window:{};function Vn(){var e=pr.DOMParser,i=!1;try{new e().parseFromString("","text/html")&&(i=!0)}catch(t){}return i}function $n(){var e=function(){};return zn()?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 zn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(i){window.ActiveXObject&&(e=!0)}return e}var jn=Vn()?pr.DOMParser:$n();function qn(e,i){var t;if(typeof e=="string"){var r=Yn().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");t=r.getElementById("turndown-root")}else t=e.cloneNode(!0);return Wn({element:t,isBlock:ai,isVoid:cr,isPre:i.preformattedCode?Xn:null}),t}var ri;function Yn(){return ri=ri||new jn,ri}function Xn(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Kn(e,i){return e.isBlock=ai(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Jn(e),e.flankingWhitespace=Zn(e,i),e}function Jn(e){return!cr(e)&&!Bn(e)&&/^\s*$/i.test(e.textContent)&&!Un(e)&&!Hn(e)}function Zn(e,i){if(e.isBlock||i.preformattedCode&&e.isCode)return{leading:"",trailing:""};var t=Qn(e.textContent);return t.leadingAscii&&or("left",e,i)&&(t.leading=t.leadingNonAscii),t.trailingAscii&&or("right",e,i)&&(t.trailing=t.trailingNonAscii),{leading:t.leading,trailing:t.trailing}}function Qn(e){var i=e.match(/^(([ \t\r\n]*)(\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 or(e,i,t){var r,s,o;return e==="left"?(r=i.previousSibling,s=/ $/):(r=i.nextSibling,s=/^ /),r&&(r.nodeType===3?o=s.test(r.nodeValue):t.preformattedCode&&r.nodeName==="CODE"?o=!1:r.nodeType===1&&!ai(r)&&(o=s.test(r.textContent))),o}var ea=Array.prototype.reduce,ta=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>
2 years ago
2 years ago
`:""},keepReplacement:function(t,r){return r.isBlock?`
2 years ago
2 years ago
`+r.outerHTML+`
2 years ago
2 years ago
`:r.outerHTML},defaultReplacement:function(t,r){return r.isBlock?`
2 years ago
2 years ago
`+t+`
2 years ago
2 years ago
`:t}};this.options=Mn({},i,e),this.rules=new gr(this.options)}Tt.prototype={turndown:function(e){if(!na(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var i=mr.call(this,new qn(e,this.options));return ia.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 ta.reduce(function(i,t){return i.replace(t[0],t[1])},e)}};function mr(e){var i=this;return ea.call(e.childNodes,function(t,r){r=new Kn(r,i.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:i.escape(r.nodeValue):r.nodeType===1&&(s=ra.call(i,r)),fr(t,s)},"")}function ia(e){var i=this;return this.rules.forEach(function(t){typeof t.append=="function"&&(e=fr(e,t.append(i.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function ra(e){var i=this.rules.forNode(e),t=mr.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 fr(e,i){var t=On(e),r=kn(i),s=Math.max(e.length-t.length,i.length-r.length),o=`
2 years ago
2 years ago
`.substring(0,s);return t+o+r}function na(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var dr=Tt;var vr=/highlight-(?:text|source)-([a-z0-9]+)/;function aa(e){e.addRule("highlightedCodeBlock",{filter:function(i){var t=i.firstChild;return i.nodeName==="DIV"&&vr.test(i.className)&&t&&t.nodeName==="PRE"},replacement:function(i,t,r){var s=t.className||"",o=(s.match(vr)||[null,""])[1];return`
2 years ago
2 years ago
`+r.fence+o+`
`+t.firstChild.textContent+`
`+r.fence+`
2 years ago
2 years ago
`}})}function sa(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(i){return"~"+i+"~"}})}var oa=Array.prototype.indexOf,we={};we.tableCell={filter:["th","td"],replacement:function(e,i){return br(e,i)+yr(i,"")}};we.tableRow={filter:"tr",replacement:function(e,i){var t="",r={left:":--",right:"--:",center:":-:"};if(la(i))for(var s=0;s<i.childNodes.length;s++){var o="---",n=(i.childNodes[s].getAttribute("align")||"").toLowerCase();n&&(o=r[n]||o),t+=br(o,i.childNodes[s])+yr(i.childNodes[s],o)}return`
`+e+(t?`
`+t:"")}};we.table={filter:function(e){return e.nodeName==="TABLE"&&!Nr(e)},replacement:function(e){return e=e.replace(`
2 years ago
`,`
`),`
2 years ago
`+e+`
2 years ago
2 years ago
`}};we.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};we.captionSection={filter:"caption",replacement:function(e,i){return i.parentNode.nodeName==="TABLE"&&i.parentNode.childNodes[0]===i?e:""}};function la(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 br(e,i){var t=oa.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 yr(e,i){var t=e.getAttribute("colspan")||1;return t<=1?"":(" "+i+" |").repeat(t-1)}function Nr(e){for(var i=e.parentNode;i;){if(i.nodeName==="TABLE")return!0;i=i.parentNode}return!1}function ca(e){e.keep(function(t){return t.nodeName==="TABLE"&&Nr(t)});for(var i in we)e.addRule(i,we[i])}function ua(e){e.addRule("taskListItems",{filter:function(i){return i.type==="checkbox"&&i.parentNode.nodeName==="LI"},replacement:function(i,t){return(t.checked?"[x]":"[ ]")+" "}})}function Tr(e){e.use([aa,sa,ca,ua])}async function de(e){let i=Tr,t=new dr({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return t.use(i),t.turndown(e)}var oi=class extends G{constructor(t,r){super(t,r);this.PATTERN=/(https:\/\/twitter.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=JSON.parse(await(0,Ar.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${t}`})),s=r.author_name,o=await de(r.html),n=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,s).replace(/%tweetURL%/g,r.url).replace(/%tweetContent%/g,o),d=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,s).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(d,n)}},Er=oi;var At=require("obsidian"),gi=Fe(hi());var pi=class extends G{constructor(t,r){super(t,r);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,At.request)({method:"GET",url:t}),s=new DOMParser().parseFromString(r,"text/html"),o=await this.parseDocument(s),n=this.settings.stackExchangeNoteTitle.replace(/%title%/g,o.title).replace(/%date%/g,this.getFormattedDateForFilename()),c=o.topAnswer?this.settings.stackExchangeAnswer.replace(/%answerContent%/g,o.topAnswer.content).replace(/%authorName%/g,o.topAnswer.author.name).replace(/%authorProfileURL%/g,o.topAnswer.author.profile):"",d="";for(let I=0;I<o.answers.length;I++){let C=this.settings.stackExchangeAnswer.replace(/%answerContent%/g,o.answers[I].content).replace(/%authorName%/g,o.answers[I].author.name).replace(/%authorProfileURL%/g,o.answers[I].author.profile);d=d.concat(`
2 years ago
***
3 years ago
2 years ago
`,C)}let f=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,o.title).replace(/%questionURL%/g,o.url).replace(/%questionContent%/g,o.content).replace(/%authorName%/g,o.author.name).replace(/%authorProfileURL%/g,o.author.profile).replace(/%topAnswer%/g,c).replace(/%answers%/g,d.trim()),b=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${ne(n)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&At.Platform.isDesktop&&(f=await _e(app,f,b));let R=`${n}.md`;return new F(R,f)}async parseDocument(t){var n,c,d,f,b,R,I,C,U,x,A,m,p,l,a,g;let r;try{r=new URL((d=(n=t.querySelector('link[rel="canonical"]'))==null?void 0:n.getAttribute("href"))!=null?d:(c=t.querySelector('meta[property="og:url"]'))==null?void 0:c.getAttribute("content"))}catch(u){r=null}let s=t.querySelector('#question [itemprop="author"]'),o=[];for(let u of t.querySelectorAll(".answer")){let P=u.querySelector('[itemprop="author"]');o.push({content:await de(gi.sanitize((f=u.querySelector('[itemprop="text"]'))!=null?f:"")),author:{name:(R=(b=P==null?void 0:P.querySelector('[itemprop="name"]'))==null?void 0:b.textContent)!=null?R:"",profile:P instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(C=(I=P.querySelector("a"))==null?void 0:I.getAttribute("href"))!=null?C:""):""}})}return{title:(x=(U=t.querySelector('#question-header [itemprop="name"]'))==null?void 0:U.textContent)!=null?x:"",content:await de(gi.sanitize((A=t.querySelector('#question [itemprop="text"]'))!=null?A:"")),url:(m=r==null?void 0:r.href)!=null?m:"",topAnswer:o.slice(0,1).shift(),answers:o.slice(1),author:{name:(l=(p=s==null?void 0:s.querySelector('[itemprop="name"]'))==null?void 0:p.textContent)!=null?l:"",profile:s instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(g=(a=s.querySelector("a"))==null?void 0:a.getAttribute("href"))!=null?g:""):""}}}},wr=pi;var Be=require("obsidian"),Et=Fe(Ir()),Cr=Fe(hi());var di=class extends G{constructor(i,t){super(i,t)}test(i){return this.isValidUrl(i)}async prepareNote(i){let t=new URL(i),r=await(0,Be.request)({method:"GET",url:t.href}),s=new DOMParser().parseFromString(r,"text/html"),o=s.getElementsByTagName("base"),n=null;o.length>0&&(n=o.item(0).getAttribute("href"),Array.from(o).forEach(b=>{b.remove()}));let c=s.createElement("base");c.setAttribute("href",qt(n!=null?n:t.href,t.origin)),s.head.append(c);let d=Cr.sanitize(s.body.innerHTML);s.body.innerHTML=d,(0,Et.isProbablyReaderable)(s)||new Be.Notice("@mozilla/readability considers this document to unlikely be readerable.");let f=new Et.Readability(s).parse();return f!=null&&f.content?await this.parsableArticle(this.app,f,t.href):this.notParsableArticle(t.href)}async parsableArticle(i,t,r){let s=t.title||"No title",o=t.siteName||"",n=t.byline||"",c=await de(t.content),d=this.settings.parseableArticleNoteTitle.replace(/%title%/g,s).replace(/%date%/g,this.getFormattedDateForFilename()),f=this.settings.downloadImagesInArticleDir?`${this.settings.assetsDir}/${ne(d)}/`:this.settings.assetsDir;this.settings.downloadImages&&Be.Platform.isDesktop&&(c=await _e(i,c,f));let b=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,s).replace(/%articleURL%/g,r).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(t)}`).replace(/%articleContent%/g,c).replace(/%siteName%/g,o).replace(/%author%/g,n),R=`${d}.md`;return new F(R,b)}notParsableArticle(i){console.error("Website not parseable");let t=this.settings.notParsableArticleNote.replace("%articleURL%",i),s=`${this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new F(s,t)}getEstimatedReadingTime(i){let t=i.lang||"en",r=this.getReadingSpeed(t),s=i.textContent.trim().split(/\s+/).length;return Math.ceil(s/r)}getReadingSpeed(i){let t=new Map([["en",228],["ar",138],["de",179],["es",218],["fi",161],["fr",195],["he",187],["it",188],["ja",193],["nl",202],["pl",166],["pt",181],["ru",184],["sk",190],["sl",180],["sv",1
***
2 years ago
`,C)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,s.account.display_name).replace(/%tootURL%/g,s.url).replace(/%tootContent%/g,c),f=`${o}.md`;return new F(f,d)}async loadStatus(i,t){return JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:`https://${i}${bi.STATUS}/${t}`}))}async loadReplies(i,t){let r=String.prototype.concat.call("https://",i,String.prototype.replace.call(bi.CONTEXT,"%id%",t));return JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:r})).descendants}async parseStatus(i,t){let r=await de(i.content),s=this.settings.downloadMastodonMediaAttachments&&He.Platform.isDesktop?await _e(app,this.prepareMedia(i.media_attachments),t):this.prepareMedia(i.media_attachments);return r.concat(s)}prepareMedia(i){return i.reduce((t,{url:r,description:s})=>{let o=s?`
> *${s}*`:"";return`${t}
2 years ago
![](${r})${o}`},"")}async testIsMastodon(i){if(!i)return!1;let t=new URL(i).hostname;try{let r=JSON.parse(await(0,He.request)({method:"GET",contentType:"application/json",url:`https://${t}${bi.INSTANCE}`}));return(r==null?void 0:r.domain)===t}catch(r){return!1}}},kr=yi;var Or=require("obsidian");var Ni=class extends G{constructor(t,r){super(t,r);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),s=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 F(n,s)}async parseHtml(t){var n,c,d,f;let r=await(0,Or.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"}}),s=new DOMParser().parseFromString(r,"text/html"),o=this.PATTERN.exec(t);return{id:o[4],url:(c=(n=s.querySelector('meta[property="og:url"]'))==null?void 0:n.getAttribute("content"))!=null?c:t,description:(f=(d=s.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/${o[4]}"></iframe>`,author:{name:o[2],url:`https://www.tiktok.com/${o[2]}`}}}},Fr=Ni;var et=class{constructor(i){this.parsers=i}async createParser(i){for(let t of this.parsers)if(await t.test(i))return t}};var _t=class extends ue.Plugin{async onload(){await this.loadSettings(),this.parserCreator=new et([new tr(this.app,this.settings),new rr(this.app,this.settings),new ar(this.app,this.settings),new Er(this.app,this.settings),new wr(this.app,this.settings),new kr(this.app,this.settings),new Fr(this.app,this.settings),new Pr(this.app,this.settings),new Mr(this.app,this.settings)]),(0,ue.addIcon)("read-it-later",da),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 vt(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(t,r)=>{t.addItem(s=>{s.setTitle("ReadItLater"),s.setIcon("read-it-later"),s.onClick(()=>this.processContent(r))})}))}async loadSettings(){this.settings=Object.assign({},_,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let t=await navigator.clipboard.readText(),s=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(s.fileName,s.content)}async processContent(t){let s=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(s.fileName,s.content)}async writeFile(t,r){let s;if(t=ne(t),await Ze(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?s=(0,ue.normalizePath)(`${this.settings.inboxDir}/${t}`):s=(0,ue.normalizePath)(`/${t}`),await this.app.vault.adapter.exists(s))new ue.Notice(`${t} already exists!`);else{let o=await this.app.vault.create(s,r);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(o),new ue.Notice(`${t} created successful`)}}},da=`
<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:
(*! @license DOMPurify 2.4.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.3/LICENSE *)
*/