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.

212 lines
199 KiB

3 years ago
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
3 days ago
var tr=Object.create;var Et=Object.defineProperty;var ir=Object.getOwnPropertyDescriptor;var ar=Object.getOwnPropertyNames;var nr=Object.getPrototypeOf,rr=Object.prototype.hasOwnProperty;var sr=(i,t,e)=>t in i?Et(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var lt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),or=(i,t)=>{for(var e in t)Et(i,e,{get:t[e],enumerable:!0})},Da=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ar(t))!rr.call(i,s)&&s!==e&&Et(i,s,{get:()=>t[s],enumerable:!(a=ir(t,s))||a.enumerable});return i};var Yt=(i,t,e)=>(e=i!=null?tr(nr(i)):{},Da(t||!i||!i.__esModule?Et(e,"default",{value:i,enumerable:!0}):e,i)),lr=i=>Da(Et({},"__esModule",{value:!0}),i);var k=(i,t,e)=>sr(i,typeof t!="symbol"?t+"":t,e);var qa=lt(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.toSeconds=re.end=re.parse=re.pattern=void 0;var ct="\\d+",Li="".concat(ct,"(?:[\\.,]").concat(ct,")?"),cr="(".concat(ct,"Y)?(").concat(ct,"M)?(").concat(ct,"W)?(").concat(ct,"D)?"),mr="T(".concat(Li,"H)?(").concat(Li,"M)?(").concat(Li,"S)?"),dr="P(?:".concat(cr,"(?:").concat(mr,")?)"),ur=["years","months","weeks","days","hours","minutes","seconds"],$a=Object.freeze({years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0});re.pattern=new RegExp(dr);var gr=function(i){var t=i.replace(/,/g,".").match(re.pattern);if(!t)throw new RangeError("invalid duration: ".concat(i));var e=t.slice(1);if(e.filter(function(a){return a!=null}).length===0)throw new RangeError("invalid duration: ".concat(i));if(e.filter(function(a){return/\./.test(a||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");return e.reduce(function(a,s,n){return a[ur[n]]=parseFloat(s||"0")||0,a},{})};re.parse=gr;var hr=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},$a,i),a=t.getTime(),s=new Date(a);s.setFullYear(s.getFullYear()+e.years),s.setMonth(s.getMonth()+e.months),s.setDate(s.getDate()+e.days);var n=e.hours*3600*1e3,r=e.minutes*60*1e3;return s.setMilliseconds(s.getMilliseconds()+e.seconds*1e3+n+r),s.setDate(s.getDate()+e.weeks*7),s};re.end=hr;var fr=function(i,t){t===void 0&&(t=new Date);var e=Object.assign({},$a,i),a=t.getTime(),s=new Date(a),n=(0,re.end)(e,s),r=t.getTimezoneOffset(),o=n.getTimezoneOffset(),p=(r-o)*60,c=(n.getTime()-s.getTime())/1e3;return c+p};re.toSeconds=fr;re.default={end:re.end,toSeconds:re.toSeconds,pattern:re.pattern,parse:re.parse}});var Gi=lt((qi,Wi)=>{(function(i,t){typeof qi=="object"&&typeof Wi!="undefined"?Wi.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.DOMPurify=t())})(qi,function(){"use strict";function i(v){"@babel/helpers - typeof";return i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},i(v)}function t(v,b){return t=Object.setPrototypeOf||function(D,$){return D.__proto__=$,D},t(v,b)}function e(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(v){return!1}}function a(v,b,S){return e()?a=Reflect.construct:a=function($,ve,me){var Fe=[null];Fe.push.apply(Fe,ve);var Xe=Function.bind.apply($,Fe),xt=new Xe;return me&&t(xt,me.prototype),xt},a.apply(null,arguments)}function s(v){return n(v)||r(v)||o(v)||c()}function n(v){if(Array.isArray(v))return p(v)}function r(v){if(typeof Symbol!="undefined"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)return Array.from(v)}function o(v,b){if(v){if(typeof v=="string")return p(v,b);var S=Object.prototype.toString.call(v).slice(8,-1);if(S==="Object"&&v.constructor&&(S=v.constructor.name),S==="Map"||S==="Set")return Array.from(v);if(S==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S))return p(v,b)}}function p(v,b){(b==null||b>v.length)&&(b=v.length);for(var S=0,D=new Array(b);S<b;S++)D[S]=v[S];return D}func
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var d=Object.hasOwnProperty,h=Object.setPrototypeOf,_=Object.isFrozen,N=Object.getPrototypeOf,C=Object.getOwnPropertyDescriptor,A=Object.freeze,f=Object.seal,P=Object.create,L=typeof Reflect!="undefined"&&Reflect,z=L.apply,x=L.construct;z||(z=function(b,S,D){return b.apply(S,D)}),A||(A=function(b){return b}),f||(f=function(b){return b}),x||(x=function(b,S){return a(b,s(S))});var W=j(Array.prototype.forEach),E=j(Array.prototype.pop),I=j(Array.prototype.push),Y=j(String.prototype.toLowerCase),J=j(String.prototype.toString),Q=j(String.prototype.match),B=j(String.prototype.replace),ue=j(String.prototype.indexOf),Te=j(String.prototype.trim),O=j(RegExp.prototype.test),U=ge(TypeError);function j(v){return function(b){for(var S=arguments.length,D=new Array(S>1?S-1:0),$=1;$<S;$++)D[$-1]=arguments[$];return z(v,b,D)}}function ge(v){return function(){for(var b=arguments.length,S=new Array(b),D=0;D<b;D++)S[D]=arguments[D];return x(v,S)}}function w(v,b,S){var D;S=(D=S)!==null&&D!==void 0?D:Y,h&&h(v,null);for(var $=b.length;$--;){var ve=b[$];if(typeof ve=="string"){var me=S(ve);me!==ve&&(_(b)||(b[$]=me),ve=me)}v[ve]=!0}return v}function G(v){var b=P(null),S;for(S in v)z(d,v,[S])===!0&&(b[S]=v[S]);return b}function R(v,b){for(;v!==null;){var S=C(v,b);if(S){if(S.get)return j(S.get);if(typeof S.value=="function")return j(S.value)}v=N(v)}function D($){return console.warn("fallback value for",$),null}return D}var ae=A(["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"]),we=A(["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"]),Ne=A(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ie=A(["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"]),ye=A(["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"]),Ee=A(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ae=A(["#text"]),he=A(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color",
`+Z),it&&(Z=B(Z,ui," "),Z=B(Z,gi," "),Z=B(Z,hi," ")),Pe&&jt?Pe.createHTML(Z):Z},b.setConfig=function(T){Si(T),xi=!0},b.clearConfig=function(){ot=null,xi=!1},b.isValidAttribute=function(T,l,u){ot||Si({});var y=ie(T),F=ie(l);return Sa(y,F,u)},b.addHook=function(T,l){typeof l=="function"&&(Me[T]=Me[T]||[],I(Me[T],l))},b.removeHook=function(T){if(Me[T])return E(Me[T])},b.removeHooks=function(T){Me[T]&&(Me[T]=[])},b.removeAllHooks=function(){Me={}},b}var oe=ce();return oe})});var Yi=lt((So,fn)=>{fn.exports=window.DOMPurify||(window.DOMPurify=Gi().default||Gi())});var xn=lt((Go,Zi)=>{function yn(i,t){if(t&&t.documentElement)i=t,t=arguments[2];else if(!i||!i.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=i,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._allowedVideoRegex=t.allowedVideoRegex||this.REGEXPS.videos,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(a){if(a.nodeType==a.TEXT_NODE)return`${a.nodeName} ("${a.textContent}")`;let s=Array.from(a.attributes||[],function(n){return`${n.name}="${n.value}"`}).join(" ");return`<${a.localName} ${s}>`};this.log=function(){if(typeof console!="undefined"){let s=Array.from(arguments,n=>n&&n.nodeType==this.ELEMENT_NODE?e(n):n);s.unshift("Reader: (Readability)"),console.log.apply(console,s)}else if(typeof dump!="undefined"){var a=Array.prototype.map.call(arguments,function(s){return s&&s.nodeName?e(s):s}).join(" ");dump("Reader: (Readability) "+a+`
`)}}}else this.log=function(){}}yn.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(i){this._fixRelativeUris(i),this._simplifyNestedElements(i),this._keepClasses||this._cleanClasses(i)},_removeNodes:function(i,t){if(this._docJSDOMParser&&i._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var e=i.length-1;e>=0;e--){var a=i[e],s=a.parentNode;s&&(!t||t.call(this,a,e,i))&&s.removeChild(a)}},_replaceNodeTags:function(i,t){if(this._docJSDOMParser&&i._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let e of i)this._setNodeTag(e,t)},_forEachNode:function(i,t){Array.prototype.forEach.call(i,t,this)},_findNode:function(i,t){return Array.prototype.find.call(i,t,this)},_someNode:function(i,t){return Array.prototype.some.call(i,t,this)},_everyNode:function(i,t){return Array.prototype.every.call(i,t,this)},_concatNodeLists:function(){var i=Array.prototype.slice,t=i.call(arguments),e=t.map(function(a){return i.call(a)});return Array.prototype.concat.apply([],e)},_getAllNodesWithTag:function(i,t){return i.querySelectorAll?i.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(e){var a=i.getElementsByTagName(e);return Array.isArray(a)?a:Array.from(a)}))},_cleanClasses:function(i){v
`;case"comma":return",";case"period":return".";case"semicolon":return";"}}function La(){return[{label:"Ask",option:"ask"},{label:"Nothing",option:"nothing"},{label:"Append to the existing note",option:"appendToExisting"}]}var m={inboxDir:"ReadItLater Inbox",assetsDir:"ReadItLater Inbox/assets",openNewNote:!1,batchProcess:!1,batchProcessDelimiter:"newLine",openNewNoteInNewTab:!1,youtubeContentTypeSlug:"youtube",youtubeNoteTitle:"Youtube - {{ title }}",youtubeNote:`[[ReadItLater]] [[Youtube]]
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoContentTypeSlug:"vimeo",vimeoNoteTitle:"Vimeo - {{ title }}",vimeoNote:`[[ReadItLater]] [[Vimeo]]
3 years ago
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}
{{ videoChapters }}`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliContentTypeSlug:"bilibili",bilibiliNoteTitle:"Bilibili - {{ title }}",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
3 years ago
2 months ago
# [{{ videoTitle }}]({{ videoURL }})
3 years ago
2 months ago
{{ videoPlayer }}`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterContentTypeSlug:"xcom",twitterNoteTitle:"Tweet from {{ tweetAuthorName }} ({{ date }})",twitterNote:`[[ReadItLater]] [[Tweet]]
3 years ago
2 months ago
# [{{ tweetAuthorName }}]({{ tweetURL }})
3 years ago
2 months ago
{{ tweetContent }}`,parseableArticleContentType:"article",parseableArticleNoteTitle:"{{ title }}",parsableArticleNote:`[[ReadItLater]] [[Article]]
3 years ago
2 months ago
# [{{ articleTitle }}]({{ articleURL }})
3 years ago
2 months ago
{{ articleContent }}`,notParseableArticleContentType:"article",notParseableArticleNoteTitle:"Article {{ date }}",notParsableArticleNote:`[[ReadItLater]] [[Article]]
3 years ago
2 months ago
[{{ articleURL }}]({{ articleURL }})`,textSnippetContentType:"textsnippet",textSnippetNoteTitle:"Note {{ date }}",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
3 years ago
2 months ago
{{ content }}`,mastodonContentTypeSlug:"mastodon",mastodonNoteTitle:"Toot from {{ tootAuthorName }} ({{ date }})",mastodonNote:`[[ReadItLater]] [[Toot]]
3 years ago
2 months ago
# [{{ tootAuthorName }}]({{ tootURL }})
3 years ago
2 months 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 }})
3 years ago
2 months ago
> {{ tootContent }}`,stackExchangeContentType:"stackexchange",stackExchangeNoteTitle:"{{ title }}",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
3 years ago
2 months ago
# [{{ questionTitle }}]({{ questionURL }})
3 years ago
2 months ago
Author: [{{ authorName }}]({{ authorProfileURL }})
3 years ago
2 months ago
{{ questionContent }}
3 years ago
***
3 years ago
2 months ago
{{ topAnswer }}
3 years ago
2 months ago
{{ answers }}`,stackExchangeAnswer:`Answered by: [{{ authorName }}]({{ authorProfileURL }})
3 years ago
2 months ago
{{ answerContent }}`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokContentTypeSlug:"tiktok",tikTokNoteTitle:"TikTok from {{ authorName }} ({{ date }})",tikTokNote:`[[ReadItLater]] [[TikTok]]
2 years ago
2 months ago
{{ videoDescription }}
2 years ago
2 months ago
[{{ videoURL }}]({{ videoURL }})
2 years ago
2 months ago
{{ videoPlayer }}`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0,filesystemLimitPath:null,filesystemLimitFileName:null,youtubeChannelContentTypeSlug:"youtube-channel",youtubeChannelNoteTitle:"{{ title }}",youtubeChannelNote:`[[ReadItLater]] [[YoutubeChannel]]
# [{{ channelTitle }}]({{ channelURL }})
![{{ channelTitle }}|300]({{ channelAvatar }})
[Videos]({{ channelVideosURL }})
3 days ago
{{ channelSubscribersCount|numberLexify }} subscribers`,fileExistsStrategy:"ask",blueskyContentTypeSlug:"bluesky",blueskyNoteTitle:"Status from {{ authorName }} ({{ date }})",blueskyNote:`[[ReadItLater]] [[Bluesky]]
# [{{ authorName }}]({{ postURL }})
{{ content|blockquote }}`,downloadBlueskyEmbeds:!0,downloadBlueskyEmbedsInDir:!1,saveBlueskyPostReplies:!1,blueskyPostReply:`[{{ authorName }}]({{ postURL }})
{{ content|blockquote }}`,pinterestContentTypeSlug:"pinterest",pinterestNoteTitle:"Pin from {{ authorName }} ({{ date }})",pinterestNote:`[[ReadItLater]] [[Pinterest]]
# [{{ authorName }}]({{ pinURL }})
![]({{ image }})
{{ description }}`,downloadPinterestImage:!0};var g=require("obsidian");var Ba=require("obsidian");var Fa={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.cli
`)}getVideoChapters(e){let a=/^((?:\d{1,2}:)?(?:\d{1,2}):(?:\d{1,2}))\s+(.+)$/gm,s=[],n;for(;(n=a.exec(e))!==null;){let r=n[1].trim(),o=n[2].trim(),p=r.split(":"),c=0,d,h;p.length===3?[c,d,h]=p.map(Number):[d,h]=p.map(Number);let _=c*3600+d*60+h;s.push({timestamp:r,title:o,seconds:_})}return s}getEmbedPlayer(e){let a=this.plugin.settings.youtubeUsePrivacyEnhancedEmbed?"youtube-nocookie.com":"youtube.com";return`<iframe width="${this.plugin.settings.youtubeEmbedWidth}" height="${this.plugin.settings.youtubeEmbedHeight}" src="https://www.${a}/embed/${e}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`}},Ya=Ii;var Xa=require("obsidian");var Fi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(vimeo.com)\/(\d+)?/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.parseSchema(e,a),n=this.templateEngine.render(this.plugin.settings.vimeoNote,s),r=this.templateEngine.render(this.plugin.settings.vimeoNoteTitle,{title:s.videoTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.vimeoContentTypeSlug,a)}async parseSchema(e,a){var d,h,_,N,C,A;let s=await(0,Xa.request)({method:"GET",url:e,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"}}),r=new DOMParser().parseFromString(s,"text/html").querySelector('script[type="application/ld+json"]'),p=JSON.parse(r.textContent)[0],c=this.PATTERN.exec(e);return{date:this.getFormattedDateForContent(a),videoId:c.length===3?c[2]:"",videoURL:(d=p==null?void 0:p.url)!=null?d:"",videoTitle:(h=p==null?void 0:p.name)!=null?h:"",videoPlayer:`<iframe width="${this.plugin.settings.vimeoEmbedWidth}" height="${this.plugin.settings.vimeoEmbedHeight}" src="${p==null?void 0:p.embedUrl}" title="Vimeo video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,channelName:(N=(_=p==null?void 0:p.author)==null?void 0:_.name)!=null?N:"",channelURL:(A=(C=p==null?void 0:p.author)==null?void 0:C.url)!=null?A:""}}},Ka=Fi;var Ja=require("obsidian");var Mi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(bilibili.com)\/(video)?\/([a-z0-9]+)?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.getNoteData(e,a),n=this.templateEngine.render(this.plugin.settings.bilibiliNote,s),r=this.templateEngine.render(this.plugin.settings.bilibiliNoteTitle,{title:s.videoTitle,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.bilibiliContentTypeSlug,a)}async getNoteData(e,a){var o,p;let s=await(0,Ja.request)({method:"GET",url:e,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"}}),n=new DOMParser().parseFromString(s,"text/html"),r=(o=this.PATTERN.exec(e)[3])!=null?o:"";return{date:this.getFormattedDateForContent(a),videoId:r,videoTitle:(p=n.querySelector("[property~='og:title']").getAttribute("content"))!=null?p:"",videoURL:e,videoPlayer:`<iframe width="${this.plugin.settings.bilibiliEmbedWidth}" height="${this.plugin.settings.bilibiliEmbedHeight}" src="https://player.bilibili.com/player.html?autoplay=0&bvid=${r}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`}}},Za=Mi;var ti=require("obsidian");function yr(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var a in e)e.hasOwnProperty(a)&&(i[a]=e[a])}return i}function Bi(i,t){return Array(t+1).join(i)}function xr(i){return i.replace(/^\n*/,"")}function Tr(i){for(var t=i.length;t>0&&i[t-1]===`
`;)t--;return i.substring(0,t)}var wr=["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(i){return zi(i,wr)}var tn=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function an(i){return zi(i,tn)}function Nr(i){return rn(i,tn)}var nn=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Er(i){return zi(i,nn)}function Ar(i){return rn(i,nn)}function zi(i,t){return t.indexOf(i.nodeName)>=0}function rn(i,t){return i.getElementsByTagName&&t.some(function(e){return i.getElementsByTagName(e).length})}var pe={};pe.paragraph={filter:"p",replacement:function(i){return`
3 years ago
2 months ago
`+i+`
3 years ago
3 days ago
`}};pe.lineBreak={filter:"br",replacement:function(i,t,e){return e.br+`
`}};pe.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(i,t,e){var a=Number(t.nodeName.charAt(1));if(e.headingStyle==="setext"&&a<3){var s=Bi(a===1?"=":"-",i.length);return`
3 years ago
2 months ago
`+i+`
3 days ago
`+s+`
3 years ago
`}else return`
3 years ago
3 days ago
`+Bi("#",a)+" "+i+`
3 years ago
3 days ago
`}};pe.blockquote={filter:"blockquote",replacement:function(i){return i=i.replace(/^\n+|\n+$/g,""),i=i.replace(/^/gm,"> "),`
3 years ago
2 months ago
`+i+`
3 years ago
3 days ago
`}};pe.list={filter:["ul","ol"],replacement:function(i,t){var e=t.parentNode;return e.nodeName==="LI"&&e.lastElementChild===t?`
2 months ago
`+i:`
3 years ago
2 months ago
`+i+`
3 years ago
3 days ago
`}};pe.listItem={filter:"li",replacement:function(i,t,e){i=i.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
3 days ago
`);var a=e.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var n=s.getAttribute("start"),r=Array.prototype.indexOf.call(s.children,t);a=(n?Number(n)+r:r+1)+". "}return a+i+(t.nextSibling&&!/\n$/.test(i)?`
`:"")}};pe.indentedCodeBlock={filter:function(i,t){return t.codeBlockStyle==="indented"&&i.nodeName==="PRE"&&i.firstChild&&i.firstChild.nodeName==="CODE"},replacement:function(i,t,e){return`
3 years ago
2 months ago
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
3 years ago
3 days ago
`}};pe.fencedCodeBlock={filter:function(i,t){return t.codeBlockStyle==="fenced"&&i.nodeName==="PRE"&&i.firstChild&&i.firstChild.nodeName==="CODE"},replacement:function(i,t,e){for(var a=t.firstChild.getAttribute("class")||"",s=(a.match(/language-(\S+)/)||[null,""])[1],n=t.firstChild.textContent,r=e.fence.charAt(0),o=3,p=new RegExp("^"+r+"{3,}","gm"),c;c=p.exec(n);)c[0].length>=o&&(o=c[0].length+1);var d=Bi(r,o);return`
3 years ago
3 days ago
`+d+s+`
`+n.replace(/\n$/,"")+`
`+d+`
3 years ago
3 days ago
`}};pe.horizontalRule={filter:"hr",replacement:function(i,t,e){return`
3 years ago
2 months ago
`+e.hr+`
3 years ago
3 days ago
`}};pe.inlineLink={filter:function(i,t){return t.linkStyle==="inlined"&&i.nodeName==="A"&&i.getAttribute("href")},replacement:function(i,t){var e=t.getAttribute("href");e&&(e=e.replace(/([()])/g,"\\$1"));var a=Qt(t.getAttribute("title"));return a&&(a=' "'+a.replace(/"/g,'\\"')+'"'),"["+i+"]("+e+a+")"}};pe.referenceLink={filter:function(i,t){return t.linkStyle==="referenced"&&i.nodeName==="A"&&i.getAttribute("href")},replacement:function(i,t,e){var a=t.getAttribute("href"),s=Qt(t.getAttribute("title"));s&&(s=' "'+s+'"');var n,r;switch(e.linkReferenceStyle){case"collapsed":n="["+i+"][]",r="["+i+"]: "+a+s;break;case"shortcut":n="["+i+"]",r="["+i+"]: "+a+s;break;default:var o=this.references.length+1;n="["+i+"]["+o+"]",r="["+o+"]: "+a+s}return this.references.push(r),n},references:[],append:function(i){var t="";return this.references.length&&(t=`
3 years ago
`+this.references.join(`
`)+`
3 years ago
3 days ago
`,this.references=[]),t}};pe.emphasis={filter:["em","i"],replacement:function(i,t,e){return i.trim()?e.emDelimiter+i+e.emDelimiter:""}};pe.strong={filter:["strong","b"],replacement:function(i,t,e){return i.trim()?e.strongDelimiter+i+e.strongDelimiter:""}};pe.code={filter:function(i){var t=i.previousSibling||i.nextSibling,e=i.parentNode.nodeName==="PRE"&&!t;return i.nodeName==="CODE"&&!e},replacement:function(i){if(!i)return"";i=i.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(i)?" ":"",e="`",a=i.match(/`+/gm)||[];a.indexOf(e)!==-1;)e=e+"`";return e+t+i+t+e}};pe.image={filter:"img",replacement:function(i,t){var e=Qt(t.getAttribute("alt")),a=t.getAttribute("src")||"",s=Qt(t.getAttribute("title")),n=s?' "'+s+'"':"";return a?"!["+e+"]("+a+n+")":""}};function Qt(i){return i?i.replace(/(\n+\s*)+/g,`
`):""}function sn(i){this.options=i,this._keep=[],this._remove=[],this.blankRule={replacement:i.blankReplacement},this.keepReplacement=i.keepReplacement,this.defaultRule={replacement:i.defaultReplacement},this.array=[];for(var t in i.rules)this.array.push(i.rules[t])}sn.prototype={add:function(i,t){this.array.unshift(t)},keep:function(i){this._keep.unshift({filter:i,replacement:this.keepReplacement})},remove:function(i){this._remove.unshift({filter:i,replacement:function(){return""}})},forNode:function(i){if(i.isBlank)return this.blankRule;var t;return(t=Oi(this.array,i,this.options))||(t=Oi(this._keep,i,this.options))||(t=Oi(this._remove,i,this.options))?t:this.defaultRule},forEach:function(i){for(var t=0;t<this.array.length;t++)i(this.array[t],t)}};function Oi(i,t,e){for(var a=0;a<i.length;a++){var s=i[a];if(Sr(s,t,e))return s}}function Sr(i,t,e){var a=i.filter;if(typeof a=="string"){if(a===t.nodeName.toLowerCase())return!0}else if(Array.isArray(a)){if(a.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof a=="function"){if(a.call(i,t,e))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function kr(i){var t=i.element,e=i.isBlock,a=i.isVoid,s=i.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var n=null,r=!1,o=null,p=Qa(o,t,s);p!==t;){if(p.nodeType===3||p.nodeType===4){var c=p.data.replace(/[ \r\n\t]+/g," ");if((!n||/ $/.test(n.data))&&!r&&c[0]===" "&&(c=c.substr(1)),!c){p=Ui(p);continue}p.data=c,n=p}else if(p.nodeType===1)e(p)||p.nodeName==="BR"?(n&&(n.data=n.data.replace(/ $/,"")),n=null,r=!1):a(p)||s(p)?(n=null,r=!0):n&&(r=!1);else{p=Ui(p);continue}var d=Qa(o,p,s);o=p,p=d}n&&(n.data=n.data.replace(/ $/,""),n.data||Ui(n))}}function Ui(i){var t=i.nextSibling||i.parentNode;return i.parentNode.removeChild(i),t}function Qa(i,t,e){return i&&i.parentNode===t||e(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ji=typeof window!="undefined"?window:{};function _r(){var i=ji.DOMParser,t=!1;try{new i().parseFromString("","text/html")&&(t=!0)}catch(e){}return t}function Cr(){var i=function(){};return Dr()?i.prototype.parseFromString=function(t){var e=new window.ActiveXObject("htmlfile");return e.designMode="on",e.open(),e.write(t),e.close(),e}:i.prototype.parseFromString=function(t){var e=document.implementation.createHTMLDocument("");return e.open(),e.write(t),e.close(),e},i}function Dr(){var i=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){ji.ActiveXObject&&(i=!0)}return i}var Rr=_r()?ji.DOMParser:Cr();function Pr(i,t){var e;if(typeof i=="string"){var a=Lr().parseFromString('<x-turndown id="turndown-root">'+i+"</x-turndown>","text/html");e=a.getElementById("turndown-root")}else e=i.cloneNode(!0);return kr({element:e,isBlock:Hi,isVoid:an,isPre:t.preformattedCode?Ir:null}),e}var Vi;function Lr(){return Vi=Vi||new Rr,Vi}function Ir(i){return i.nodeName==="PRE"||i.nodeName==="CODE"}function Fr(i,t){return i.isBlock=Hi(i),i.isCode=i.nodeName==="CODE"||i.parentNode.isCode,i.isBlank=Mr(i),i.flankingWhitespace=Or(i,t),i}function Mr(i){return!an(i)&&!Er(i)&&/^\s*$/i.test(i.textContent)&&!Nr(i)&&!Ar(i)}function Or(i,t){if(i.isBlock||t.preformattedCode&&i.isCode)return{leading:"",trailing:""};var e=Ur(i.textContent);return e.leadingAscii&&en("left",i,t)&&(e.leading=e.leadingNonAscii),e.trailingAscii&&en("right",i,t)&&(e.trailing=e.trailingNonAscii),{leading:e.leading,trailing:e.trailing}}function Ur(i){var t=i.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function en(i,t,e){var a,s,n;return i==="left"?(a=t.previousSibling,s=/ $/):(a=t.nextSibling,s=/^ /),a&&(a.nodeType===3?n=s.test(a.nodeValue):e.preformattedCode&&a.nodeName==="CODE"?n=!1:a.nodeType===1&&!Hi(a)&&(n=s.test(a.textContent))),n}var Vr=Array.prototype.reduce,Br=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\
3 years ago
2 months ago
`:""},keepReplacement:function(e,a){return a.isBlock?`
3 years ago
2 months ago
`+a.outerHTML+`
3 years ago
2 months ago
`:a.outerHTML},defaultReplacement:function(e,a){return a.isBlock?`
3 years ago
2 months ago
`+e+`
3 years ago
3 days ago
`:e}};this.options=yr({},t,i),this.rules=new sn(this.options)}ei.prototype={turndown:function(i){if(!jr(i))throw new TypeError(i+" is not a string, or an element/document/fragment node.");if(i==="")return"";var t=on.call(this,new Pr(i,this.options));return Hr.call(this,t)},use:function(i){if(Array.isArray(i))for(var t=0;t<i.length;t++)this.use(i[t]);else if(typeof i=="function")i(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(i,t){return this.rules.add(i,t),this},keep:function(i){return this.rules.keep(i),this},remove:function(i){return this.rules.remove(i),this},escape:function(i){return Br.reduce(function(t,e){return t.replace(e[0],e[1])},i)}};function on(i){var t=this;return Vr.call(i.childNodes,function(e,a){a=new Fr(a,t.options);var s="";return a.nodeType===3?s=a.isCode?a.nodeValue:t.escape(a.nodeValue):a.nodeType===1&&(s=zr.call(t,a)),ln(e,s)},"")}function Hr(i){var t=this;return this.rules.forEach(function(e){typeof e.append=="function"&&(i=ln(i,e.append(t.options)))}),i.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function zr(i){var t=this.rules.forNode(i),e=on.call(this,i),a=i.flankingWhitespace;return(a.leading||a.trailing)&&(e=e.trim()),a.leading+t.replacement(e,i,this.options)+a.trailing}function ln(i,t){var e=Tr(i),a=xr(t),s=Math.max(i.length-e.length,t.length-a.length),n=`
3 years ago
3 days ago
`.substring(0,s);return e+n+a}function jr(i){return i!=null&&(typeof i=="string"||i.nodeType&&(i.nodeType===1||i.nodeType===9||i.nodeType===11))}var pn=ei;var cn=/highlight-(?:text|source)-([a-z0-9]+)/;function $r(i){i.addRule("highlightedCodeBlock",{filter:function(t){var e=t.firstChild;return t.nodeName==="DIV"&&cn.test(t.className)&&e&&e.nodeName==="PRE"},replacement:function(t,e,a){var s=e.className||"",n=(s.match(cn)||[null,""])[1];return`
3 years ago
3 days ago
`+a.fence+n+`
2 months ago
`+e.firstChild.textContent+`
`+a.fence+`
3 years ago
3 days ago
`}})}function qr(i){i.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var Wr=Array.prototype.indexOf,et={};et.tableCell={filter:["th","td"],replacement:function(i,t){return mn(i,t)+dn(t,"")}};et.tableRow={filter:"tr",replacement:function(i,t){var e="",a={left:":--",right:"--:",center:":-:"};if(Gr(t))for(var s=0;s<t.childNodes.length;s++){var n="---",r=(t.childNodes[s].getAttribute("align")||"").toLowerCase();r&&(n=a[r]||n),e+=mn(n,t.childNodes[s])+dn(t.childNodes[s],n)}return`
2 months ago
`+i+(e?`
3 days ago
`+e:"")}};et.table={filter:function(i){return i.nodeName==="TABLE"&&!un(i)},replacement:function(i){return i=i.replace(`
3 years ago
`,`
`),`
3 years ago
2 months ago
`+i+`
3 years ago
3 days ago
`}};et.tableSection={filter:["thead","tbody","tfoot"],replacement:function(i){return i}};et.captionSection={filter:"caption",replacement:function(i,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?i:""}};function Gr(i){var t=i.parentNode,e=t;return(t.nodeName==="THEAD"||t.nodeName==="TFOOT"||t.nodeName==="TBODY")&&(e=t.parentNode),e.nodeName==="TABLE"&&e.rows[0]===i}function mn(i,t){var e=Wr.call(t.parentNode.childNodes,t),a=" ";return e===0&&(a="| "),i=i.replace(/\r\n/g,`
`).replace(/\n/g," "),i=i.replace(/\|/g,"\\|"),a+i+" |"}function dn(i,t){var e=i.getAttribute("colspan")||1;return e<=1?"":(" "+t+" |").repeat(e-1)}function un(i){for(var t=i.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function Yr(i){i.keep(function(e){return e.nodeName==="TABLE"&&un(e)});for(var t in et)i.addRule(t,et[t])}function Xr(i){i.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,e){return(e.checked?"[x]":"[ ]")+" "}})}function gn(i){i.use([$r,qr,Yr,Xr])}async function $e(i){let t=gn,e=new pn({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return e.use(t),e.addRule("torchlightCodeBlock",{filter:s=>s.nodeName==="PRE"&&s.firstChild.nodeName==="CODE"&&s.firstChild.firstChild.nodeName==="P",replacement:function(s,n,r){return n.querySelectorAll("p").forEach(o=>{o.innerHTML=o.innerHTML+`
2 months ago
`}),`
3 days ago
`+r.fence+n.firstChild.getAttribute("data-lang")+`
`+n.firstChild.textContent+`
`+r.fence+`
3 days ago
`}}),e.addRule("fencedCodeLangBlock",{filter:s=>s.nodeName=="PRE"&&(!s.firstChild||s.firstChild.nodeName!="CODE")&&!s.querySelector("img"),replacement:function(s,n,r){var A;n.innerHTML=n.innerHTML.replaceAll("<br-keep></br-keep>","<br>");let o=(A=n.id)==null?void 0:A.match(/code-lang-(.+)/),p=(o==null?void 0:o.length)>0?o[1]:"",c=n.textContent,d=r.fence.charAt(0),h=3,_=new RegExp("^"+d+"{3,}","gm"),N;for(;N=_.exec(c);)N[0].length>=h&&(h=N[0].length+1);let C=Array(h+1).join(d);return`
2 months ago
3 days ago
`+C+p+`
2 months ago
`+c.replace(/\n$/,"")+`
3 days ago
`+C+`
3 days ago
`}}),e.turndown(i)}var $i=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(https:\/\/(twitter|x).com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=new URL(e);s.hostname==="x.com"&&(s.hostname="twitter.com");let n=await this.getTweetNoteData(s,a),r=this.templateEngine.render(this.plugin.settings.twitterNote,n),o=this.templateEngine.render(this.plugin.settings.twitterNoteTitle,{tweetAuthorName:n.tweetAuthorName,date:this.getFormattedDateForFilename(a)});return new V(o,"md",r,this.plugin.settings.twitterContentTypeSlug,a)}async getTweetNoteData(e,a){let s=JSON.parse(await(0,ti.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${e.href}`})),n=await $e(s.html);return{date:this.getFormattedDateForContent(a),tweetAuthorName:s.author_name,tweetURL:s.url,tweetContent:n,tweetPublishDate:this.getPublishedDateFromDOM(s.html)}}getPublishedDateFromDOM(e){let s=new DOMParser().parseFromString(e,"text/html").querySelector("blockquote > a"),n=(0,ti.moment)(s.textContent);return n.isValid()?n.format(this.plugin.settings.dateContentFmt):""}},hn=$i;var ii=require("obsidian"),Ki=Yt(Yi());var We=require("obsidian");var mt="http:",dt="https:";function Xi(i){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let a=0;a<i;a++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}function vn(i,t){let e=i.trim().split(Pa(t)).filter(s=>s.trim().length>0),a=e.reduce((s,n)=>s&&Oe(n,[mt,dt]),!0);return{urls:e,everyLineIsURL:a}}var Jr=/!\[(?<anchor>.*?)\]\((?<link>.+?)\)/g,Zr=5,Qr=1e3;async function Le(i,t,e,a){return await es(e,Jr,ts(i,t,a))}async function es(i,t,e){try{if(typeof e=="function"){let a=[];return String.prototype.replace.call(i,t,function(s,n,r){return a.push(e(s,n,r)),""}),Promise.all(a).then(function(s){return String.prototype.replace.call(i,t,function(){return s.shift()})})}else return Promise.resolve(String.prototype.replace.call(i,t,e))}catch(a){return console.error(),Promise.reject(a)}}function ts(i,t,e){return async function(s,n,r){if(!Oe(r,[mt,dt]))return s;let o=new URL(r);await i.getVaultRepository().createDirectory(e);try{let{fileContent:p,fileExtension:c}=await as(o),d=0;for(;d<Zr;)try{let{fileName:h,needWrite:_}=await is(i.app.vault.adapter,i.getFileSystemLimits(),e,t,c);if(_&&h!==""){await i.app.vault.createBinary(h,p);let N=h.replace(/\s/g,"%20");return`![${n}](${N})`}else return s}catch(h){console.warn(h),d++}return s}catch(p){return console.warn(p),s}}}async function is(i,t,e,a,s){if(s==="")return{fileName:"",needWrite:!1};let n=!1,r="",o=0;for(;r===""&&o<Qr;){let p;i instanceof We.CapacitorAdapter||i instanceof We.FileSystemAdapter?p=St(e,`${a}-${Xi(10)}.${s}`,i,t):p=`${e}/${a}-${Xi(10)}.${s}`,await i.exists((0,We.normalizePath)(p),!1)||(r=p,n=!0),o++}return{fileName:r,needWrite:n}}async function as(i){var e;let t=await(0,We.requestUrl)({url:i.href,method:"get"});return{fileContent:t.arrayBuffer,fileExtension:(e=ja(t.headers["content-type"]||""))!=null?e:""}}var Ji=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await(0,ii.request)({method:"GET",url:e,headers:{...Ve}}),n=new DOMParser().parseFromString(s,"text/html"),r=await this.parseDocument(n),o=this.templateEngine.render(this.plugin.settings.stackExchangeNoteTitle,{title:r.title,date:this.getFormattedDateForFilename(a)}),p;this.plugin.settings.downloadStackExchangeAssetsInDir?(p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),p=`${p}/${q(o)}`):p=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(o),contentType:this.plugin.settings.stackExchangeContentType});let c=this.templateEngine.render(this.plugin
3 years ago
***
3 years ago
3 days ago
`,this.templateEngine.render(this.plugin.settings.stackExchangeAnswer,{date:this.getFormattedDateForContent(a),answerContent:e.answers[r].content,authorName:e.answers[r].author.name,authorProfileURL:e.answers[r].author.profile}));return{date:this.getFormattedDateForContent(a),questionTitle:e.title,questionURL:e.url,questionContent:e.content,authorName:e.author.name,authorProfileURL:e.author.profile,topAnswer:s,answers:n.trim(),extra:{question:e}}}async parseDocument(e){var r,o,p,c,d,h,_,N,C,A,f,P,L,z,x,W;let a;try{a=new URL((p=(r=e.querySelector('link[rel="canonical"]'))==null?void 0:r.getAttribute("href"))!=null?p:(o=e.querySelector('meta[property="og:url"]'))==null?void 0:o.getAttribute("content"))}catch(E){a=null}let s=e.querySelector('#question [itemprop="author"]'),n=[];for(let E of e.querySelectorAll(".answer")){let I=E.querySelector('[itemprop="author"]');n.push({content:await $e(Ki.sanitize((c=E.querySelector('[itemprop="text"]'))!=null?c:"")),author:{name:(h=(d=I==null?void 0:I.querySelector('[itemprop="name"]'))==null?void 0:d.textContent)!=null?h:"",profile:I instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(N=(_=I.querySelector("a"))==null?void 0:_.getAttribute("href"))!=null?N:""):""}})}return{title:(A=(C=e.querySelector('#question-header [itemprop="name"]'))==null?void 0:C.textContent)!=null?A:"",content:await $e(Ki.sanitize((f=e.querySelector('#question [itemprop="text"]'))!=null?f:"")),url:(P=a==null?void 0:a.href)!=null?P:"",topAnswer:n.slice(0,1).shift(),answers:n.slice(1),author:{name:(z=(L=s==null?void 0:s.querySelector('[itemprop="name"]'))==null?void 0:L.textContent)!=null?z:"",profile:s instanceof Element&&a instanceof URL?String.prototype.concat(a.origin,(W=(x=s.querySelector("a"))==null?void 0:x.getAttribute("href"))!=null?W:""):""}}}},bn=Ji;var tt=require("obsidian"),ai=Yt(En()),An=Yt(Yi());var ea=class extends H{test(t){return this.isValidUrl(t)}async prepareNote(t){let e=new URL(t),a=await this.getDocument(e);return this.makeNote(a,e)}async makeNote(t,e){(0,ai.isProbablyReaderable)(t)||new tt.Notice("@mozilla/readability considers this document to unlikely be readerable.");let a=new Date,s=this.extractPreviewUrl(t),n=new ai.Readability(t).parse();if(n===null||!Object.prototype.hasOwnProperty.call(n,"content"))return this.notParsableArticle(e.href,s,a);let r=await $e(n.content);return this.parsableArticle({date:this.getFormattedDateForContent(a),articleTitle:n.title||"No title",articleURL:e.href,articleReadingTime:this.getEstimatedReadingTime(n),articleContent:r,siteName:n.siteName||"",author:n.byline||"",previewURL:s||"",publishedTime:n.publishedTime!==null?this.getFormattedDateForContent(n.publishedTime):"",readabilityArticle:n},a)}async getDocument(t){var o,p,c,d,h,_,N,C,A;let e=await this.parseHtmlDom(t),a=e.getElementsByTagName("base"),s=null;a.length>0&&(s=a.item(0).getAttribute("href"),Array.from(a).forEach(f=>{f.remove()}));let n=e.createElement("base");n.setAttribute("href",Ha(s!=null?s:t.href,t.origin)),e.head.append(n);let r=An.sanitize(e.body.innerHTML);return e.body.innerHTML=r,(o=e.body.querySelectorAll("pre br"))==null||o.forEach(f=>{f.outerHTML="<br-keep></br-keep>"}),(p=e.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||p.forEach(f=>{f.className=""}),(c=e.body.querySelectorAll("[class*=highlight-text],[class*=highlight-source]"))==null||c.forEach(f=>{var L;let P=(L=f.className.match(/highlight-(?:text|source)-([a-z0-9]+)/))==null?void 0:L[1];f.firstElementChild.nodeName=="PRE"&&(f.removeAttribute("data-snippet-clipboard-copy-content"),f.firstElementChild.id=`code-lang-${P}`)}),(d=e.body.querySelectorAll("[class*=language-]"))==null||d.forEach(f=>{var L;let P=(L=f.className.match(/language-([a-z0-9]+)/))==null?void 0:L[1];f.id=`code-lang-${P}`}),(h=e.body.querySelectorAll(".codehilite > pre"))==null||h.forEach(f=>{f.firstChild.nodeName!=="CODE"&&!f.className.includes("language")&&(f.id="code-lang-text")}),(_=e.body.querySelectorAll(".captioned-image-container figure"))==null||_.forEach(f=>{let P=f.querySelector("img");P&&(f.querySelector(".image-link
***
3 days ago
`,c)}return{date:this.getFormattedDateForContent(n),tootAuthorName:t.account.display_name,tootURL:t.url,tootContent:r,extra:{status:t,replies:e}}}async loadStatus(t,e){return JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:`https://${t}${ia.STATUS}/${e}`}))}async loadReplies(t,e){let a=String.prototype.concat.call("https://",t,String.prototype.replace.call(ia.CONTEXT,"%id%",e));return JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:a})).descendants}async parseStatus(t,e,a){let s=await $e(t.content),n=this.plugin.settings.downloadMastodonMediaAttachments&&gt.Platform.isDesktop?await Le(this.plugin,e,this.prepareMedia(t.media_attachments),a):this.prepareMedia(t.media_attachments);return s.concat(n)}prepareMedia(t){return t.reduce((e,{url:a,description:s})=>{let n=s?`
> *${s}*`:"";return`${e}
3 days ago
![](${a})${n}`},"")}async testIsMastodon(t){if(!t)return!1;let e=new URL(t).hostname;try{let a=JSON.parse(await(0,gt.request)({method:"GET",contentType:"application/json",url:`https://${e}${ia.INSTANCE}`}));return(a==null?void 0:a.domain)===e}catch(a){return!1}}},kn=aa;var _n=require("obsidian");var na=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/(tiktok.com)\/(\S+)\/(video)\/(\d+)/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.parseHtml(e,a),n=this.templateEngine.render(this.plugin.settings.tikTokNote,s),r=this.templateEngine.render(this.plugin.settings.tikTokNoteTitle,{authorName:s.authorName,date:this.getFormattedDateForFilename(a)});return new V(r,"md",n,this.plugin.settings.tikTokContentTypeSlug,a)}async parseHtml(e,a){var o,p,c,d;let s=await(0,_n.request)({method:"GET",url:e,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"}}),n=new DOMParser().parseFromString(s,"text/html"),r=this.PATTERN.exec(e);return{date:this.getFormattedDateForContent(a),videoId:r[4],videoURL:(p=(o=n.querySelector('meta[property="og:url"]'))==null?void 0:o.getAttribute("content"))!=null?p:e,videoDescription:(d=(c=n.querySelector('meta[property="og:description"]'))==null?void 0:c.getAttribute("content"))!=null?d:"",videoPlayer:`<iframe width="${this.plugin.settings.tikTokEmbedWidth}" height="${this.plugin.settings.tikTokEmbedHeight}" src="https://www.tiktok.com/embed/v2/${r[4]}"></iframe>`,authorName:r[2],authorURL:`https://www.tiktok.com/${r[2]}`}}},Cn=na;var _t=class{constructor(t){k(this,"parsers");this.parsers=t}async createParser(t){for(let e of this.parsers)if(await e.test(t))return e}};var Ct=class extends ut{constructor(){super(...arguments);k(this,"PATTERN",/^https?:\/\/(?:www\.)?github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)\/?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new URL(e),s=await this.getDocument(a),n=s.querySelector("article.markdown-body");return n.querySelectorAll('[aria-label^="Permalink:"]').forEach(r=>r.remove()),s.querySelector("body").innerHTML=n.outerHTML,this.makeNote(s,a)}};var Dt=class extends ut{constructor(){super(...arguments);k(this,"PATTERN",/^(?:https?:\/\/)?(?:[a-z]{2,3}(?:-[a-z]{2,3})?)(?:\.m)?\.wikipedia\.org\/wiki\/([^\/]+)/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new URL(e),s=await this.getDocument(a);return s.querySelectorAll(".reference .cite-bracket").forEach(n=>{n.remove()}),s.querySelectorAll(".reference a").forEach(n=>{n.textContent="\xA0"+n.textContent}),s.querySelectorAll(".mw-cite-backlink").forEach(n=>{n.remove()}),s.querySelectorAll(".infobox caption").forEach(n=>{let r=s.createElement("p");r.innerHTML=n.innerHTML,n.parentElement.insertBefore(r,n),n.remove()}),s.querySelectorAll(".wikitable caption").forEach(n=>{let r=s.createElement("p");r.innerHTML=n.innerHTML,n.parentElement.insertBefore(r,n),n.remove()}),this.makeNote(s,a)}};function Rn(i){return i<1e3?String(i):i<1e6?`${Dn(Number(i/1e3),1)}K`:i<1e9?`${Dn(Number(i/1e6),1)}M`:String(i)}function Dn(i,t){return i.toFixed(t).replace(/\.0+$/,"")}var ht=["string","number","bigint","symbol"],ls=/{{(.*?)}}/g,Rt=class{constructor(){k(this,"modifiers");this.modifiers={blockquote:t=>this.validateFilterValueType(t,"blockquote",ht)?t.split(`
2 months ago
`).map(e=>`> ${e}`).join(`
3 days ago
`):t,capitalize:t=>{if(!this.validateFilterValueType(t,"capitalize",ht))return t;let e=String(t);return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},join:(t,e=",")=>this.validateFilterValueType(t,"join",["array"])?t.join(e):t,numberLexify:t=>Rn(t),lower:t=>{if(!this.validateFilterValueType(t,"lower",ht))return t;String(t).toLowerCase()},map:(t,e)=>{if(!this.validateFilterValueType(t,"map",["array"]))return t;try{return t.map(e)}catch(a){return console.warn("Error in map modifier:",a),t}},replace:(t,e,a="")=>this.validateFilterValueType(t,"replace",ht)?t.replaceAll(e,a):t,striptags:(t,e="")=>{if(!this.validateFilterValueType(t,"striptags",ht))return t;let a=new RegExp(`<(?!/?(${e.replace(/[<>]/g,"").split(",").join("|")})s*/?)[^>]+>`,"gi");return t.replace(a,"")},upper:t=>{if(!this.validateFilterValueType(t,"upper",ht))return t;String(t).toUpperCase()}}}render(t,e){try{let a=this.processLoops(t,e);return a=this.processVariables(a,e),a=this.processSimplePattern(a,e),a}catch(a){return console.error("Error rendering template:",a),t}}processSimplePattern(t,e){let a=/%(\w+(?:\.\w+)*)%/g;return t.replace(a,(s,n)=>{try{let r=this.resolveValue(n,e);return r===void 0?(console.warn(`Unable to resolve ${n}`),s):String(r)}catch(r){return console.warn(`Error processing simple pattern "${s}":`,r),s}})}processVariables(t,e){return t.replace(ls,(a,s)=>{try{let[n,...r]=s.split("|").map(h=>h.trim()),p=/(['"])((?:[^\\]|\\.)*?)\1/.exec(n),c;if(p!==null?c=p[2]:c=this.resolveValue(n,e),c===void 0)return console.warn(`Unable to resolve ${n}`),a;let d=c;for(let h of r)d=this.applyModifier(d,h);return String(d)}catch(n){return console.warn(`Error processing variable "${a}":`,n),a}})}processLoops(t,e){let a=/{%\s*for\s+(\w+)\s+in\s+(\w+(?:\.\w+)*)\s*%}([\s\S]*?){%\s*endfor\s*%}/g;return t.replace(a,(s,n,r,o)=>{try{let p=this.resolveValue(r,e);return Array.isArray(p)?p.map(c=>{let d={...e,[n]:c};return this.render(o,d)}).join(""):(console.warn(`Value at "${r}" is not an array`),"")}catch(p){return console.warn(`Error processing loop "${s}":`,p),""}})}resolveValue(t,e){let a=t.trim().split("."),s=e;for(let n of a){if(s==null)return;s=s[n]}return s}addModifier(t,e){if(typeof e!="function")throw new Error("Modifier must be a function");this.modifiers[t]=e}parseModifier(t){let e=t.match(/(\w+)(?:\((.*?)\))?/);if(!e)return{name:t,args:[]};let[,a,s]=e,n=s?this.parseArguments(s):[];return{name:a,args:n}}parseArguments(t){let e=[],a="",s=!1,n="",r=!1,o=0,p=!1,c=()=>{(a.trim()||s)&&e.push(this.evaluateArgument(a.trim())),a=""};for(let d=0;d<t.length;d++){let h=t[d];if(p){a+=h,p=!1;continue}switch(h){case"\\":p=!0;break;case'"':case"'":r||(s&&h===n?s=!1:s||(s=!0,n=h)),a+=h;break;case"(":o++,a+=h;break;case")":o--,a+=h;break;case"=":t[d+1]===">"?(r=!0,a+="=>",d++):a+=h;break;case",":!s&&!r&&o===0?c():a+=h;break;default:a+=h}}return(a||s)&&c(),e}evaluateArgument(t){try{if(t.includes("=>")){let e=Function(`return ${t}`)();return typeof e=="function"?e:t}if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="")return"";if(!isNaN(Number(t)))return Number(t);if(t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){return t}return t}catch(e){return console.warn("Error evaluating argument:",t,e),t}}applyModifier(t,e){try{let{name:a,args:s}=this.parseModifier(e);return this.modifiers[a]?this.modifiers[a](t,...s):(console.warn(`Modifier "${a}" not found`),t)}catch(a){return console.warn(`Error applying modifier "${e}":`,a),t}}validateFilterValueType(t,e,a){let s=typeof t;return a.includes(s)?!0:a.includes("array")?Array.isArray(t):(console.warn(`Filter ${e} supports following types ${a.join(", ")}, but ${s} was provided.`),!1)}};var ra=require("obsidian");var Pt=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^(https?:\/\/(?:(?:www|m)\.)?youtube\.com\/(?:channel\/(UC[\w-]{22})|c\/([^\s\/]+)|@([\w-]+)))(?:\/.*)?$/u)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=this.plugin.settings.youtubeApiKey===""?await this.parseSchema(e,a):awai
${t.content}`)}};var Mt=require("obsidian");var It=require("obsidian");var Ft=class extends It.Modal{constructor(t,e,a){super(t),this.setTitle("Duplicate notes detected");let s=e.map(r=>`<li>${r.fileName}</li>`).join("");this.setContent(Xt(`<ul>${s}</ul>`));let n=!1;new It.Setting(this.contentEl).setName("Do not ask again").addToggle(r=>{r.setValue(!1).onChange(()=>n=!0)}),new It.Setting(this.contentEl).addButton(r=>r.setButtonText("Append to existing").setCta().onClick(()=>{this.close(),a("appendToExisting",n)})).addButton(r=>r.setButtonText("Nothing").onClick(()=>{this.close(),a("nothing",n)}))}};var ni=class{constructor(t,e,a){this.parserCreator=t;this.plugin=e;this.repository=a}async createNote(t){let e=await this.makeNote(t);try{await this.repository.saveNote(e)}catch(a){a instanceof Ge&&this.handleFileExistsError([e])}}async createNotesFromBatch(t){let e=vn(t,this.plugin.settings.batchProcessDelimiter),a=[];for(let s of e.everyLineIsURL?e.urls:[t]){let n=await this.makeNote(s);try{await this.repository.saveNote(n)}catch(r){r instanceof Ge&&a.push(n)}}a.length>0&&this.handleFileExistsError(a)}async insertContentAtEditorCursorPosition(t,e){let a=await this.makeNote(t);e.replaceRange(a.content,e.getCursor())}async makeNote(t){return await(await this.parserCreator.createParser(t)).prepareNote(t)}openNote(t){if(this.plugin.settings.openNewNote||this.plugin.settings.openNewNoteInNewTab)try{let e=this.repository.getFileByPath(t.filePath);this.plugin.app.workspace.getLeaf(this.plugin.settings.openNewNoteInNewTab?"tab":!1).openFile(e)}catch(e){console.error(e),new Mt.Notice(`Unable to open ${t.getFullFilename()}`)}}async handleFileExistsError(t){switch(this.plugin.settings.fileExistsStrategy){case"ask":new Ft(this.plugin.app,t,(e,a)=>{this.handleFileAskModalResponse(e,a,t)}).open();break;case"nothing":this.handleFileExistsStrategyNothing(t);break;case"appendToExisting":this.handleFileExistsStrategyAppend(t);break}}async handleFileAskModalResponse(t,e,a){switch(t){case"nothing":this.handleFileExistsStrategyNothing(a);break;case"appendToExisting":this.handleFileExistsStrategyAppend(a);break}e&&this.plugin.saveSetting("fileExistsStrategy",t),a.length===1&&this.openNote(a.shift())}async handleFileExistsStrategyAppend(t){for(let e of t)try{await this.repository.appendToExistingNote(e),new Mt.Notice(`${e.getFullFilename()} was updated.`)}catch(a){console.error(a),new Mt.Notice(`${e.getFullFilename()} was not updated!`,0)}}handleFileExistsStrategyNothing(t){for(let e of t)new Mt.Notice(`${e.getFullFilename()} already exists.`)}};var ri=class{constructor(t){this.noteService=t}async processContent(t){this.noteService.createNote(t)}async processContentBatch(t){this.noteService.createNotesFromBatch(t)}async insertContentAtEditorCursorPosition(t,e){this.noteService.insertContentAtEditorCursorPosition(t,e)}};var Ye=require("obsidian");var si=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^https:\/\/bsky\.app\/profile\/(?<handle>[a-zA-Z0-9-.:]+)\/post\/(?<postId>[a-zA-Z0-9]+)/);k(this,"AT_URI_PATTERN",/^at:\/\/(?<handle>(?:did:plc:[a-zA-Z0-9]+|[a-zA-Z0-9.-]+(?:\.[a-zA-Z0-9.-]+)*?))\/(?<collection>[a-zA-Z.]+)\/(?<rkey>[a-zA-Z0-9]+)$/)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s=await this.loadPost(e),n=this.formatPostContent(s,a,this.plugin.settings.blueskyNote);this.plugin.settings.saveBlueskyPostReplies&&s.replies.forEach(o=>{n=n.concat(`
***
`,this.formatPostContent(o,a,this.plugin.settings.blueskyPostReply))});let r=this.templateEngine.render(this.plugin.settings.blueskyNoteTitle,{date:this.getFormattedDateForFilename(a),authorHandle:s.author.handle,authorName:q(s.author.displayName,!1)});if(this.plugin.settings.downloadBlueskyEmbeds){let o;this.plugin.settings.downloadBlueskyEmbedsInDir?(o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:"",fileName:"",contentType:""}),o=`${o}/${q(r)}`):o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(r),contentType:this.plugin.settings.mastodonContentTypeSlug}),n=await Le(this.plugin,q(r),n,o)}return new V(r,"md",n,this.plugin.settings.blueskyContentTypeSlug,a)}async loadPost(e){var a,s,n;try{let r=this.getPostUri(this.getPostIdFromUrl(e)),o=JSON.parse(await(0,Ye.request)({method:"GET",contentType:"application/json",url:`https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread?uri=${r}`})),p=[];return o.thread.replies.forEach(c=>{var h,_,N;let d=this.getPostUrl(this.getPostIdFromAtUri(c.post.uri));p.push({url:d,content:c.post.record.text,author:{...c.post.author},embeds:Object.prototype.hasOwnProperty.call(c.post,"embed")?this.makeEmbeds(c.post.embed,d):[],likeCount:c.post.likeCount,replyCount:c.post.replyCount,repostCount:c.post.repostCount,quoteCount:c.post.replyCount,publishedAt:(0,Ye.moment)(c.post.record.createdAt).toDate(),facets:(N=(_=(h=c.post.record)==null?void 0:h.facets)==null?void 0:_.map(C=>this.makeFacet(C)))!=null?N:[]})}),{url:e,content:o.thread.post.record.text,author:{...o.thread.post.author},embeds:Object.prototype.hasOwnProperty.call(o.thread.post,"embed")?this.makeEmbeds(o.thread.post.embed,e):[],likeCount:o.thread.post.likeCount,replyCount:o.thread.post.replyCount,repostCount:o.thread.post.repostCount,quoteCount:o.thread.post.replyCount,publishedAt:(0,Ye.moment)(o.thread.post.record.createdAt).toDate(),facets:(n=(s=(a=o.thread.post.record)==null?void 0:a.facets)==null?void 0:s.map(c=>this.makeFacet(c)))!=null?n:[],replies:p}}catch(r){Ue(r,"Unable to parse Bluesky API response.")}}makeEmbeds(e,a){var r,o,p;let s=[];switch(e.$type){case"app.bsky.embed.images#view":e.images.forEach(c=>{s.push({type:"image",url:c.fullsize,thumbnail:c.thumb,title:"",description:c.alt})});break;case"app.bsky.embed.video#view":s.push({type:"video",url:a,thumbnail:e.thumbnail,title:"",description:""});break;case"app.bsky.embed.external#view":s.push({type:"external",url:e.external.uri,thumbnail:e.external.thumb,title:((r=e.external)==null?void 0:r.title)||"",description:e.external.description||""});break;case"app.bsky.embed.record#view":s.push({type:"record",url:this.getPostUrl(this.getPostIdFromAtUri(e.record.uri)),thumbnail:"",title:`Post from ${((o=e.record.author)==null?void 0:o.displayName)||e.record.author.handle}`,description:e.record.value.text});break;case"app.bsky.embed.record#viewRecord":s.push({type:"record",url:this.getPostUrl(this.getPostIdFromAtUri(e.uri)),thumbnail:"",title:`Post from ${((p=e.author)==null?void 0:p.displayName)||e.author.handle}`,description:e.value.text});break;case"app.bsky.embed.recordWithMedia#view":if(Object.prototype.hasOwnProperty.call(e,"media")){let c=this.makeEmbeds(e.media,a);c&&s.push(...c)}if(Object.prototype.hasOwnProperty.call(e,"record")){let c=this.makeEmbeds(e.record.record,a);c&&s.push(...c)}break}return s}makeFacet(e){var a,s,n,r;switch((a=e.features)==null?void 0:a[0].$type){case"app.bsky.richtext.facet#mention":return{type:"mention",did:(s=e.features)==null?void 0:s[0].did,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd};case"app.bsky.richtext.facet#link":return{type:"link",uri:(n=e.features)==null?void 0:n[0].uri,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd};case"app.bsky.richtext.facet#tag":return{type:"tag",tag:(r=e.features)==null?void 0:r[0].tag,byteStart:e.index.byteStart,byteEnd:e.index.byteEnd}}throw new Error(`Unrecognized facet type ${e}`)}formatPostContent(e,a,s){let n="";e.embeds.forEach(o=>{let p;switch(o.type){case"video":p=`[Watch video on Bluesky](${o.url})`;brea
${o.description}
${o.url}`:p=`[${o.title}](${o.url})
${o.description}`;break;default:p=`![](${o.thumbnail})`}n=n.concat(p,`
`)});let r=this.replaceFacets(e)+`
2 months ago
3 days ago
`+n;return this.renderPost(s,{date:this.getFormattedDateForContent(a),content:r.trim(),postURL:e.url,authorHandle:e.author.handle,authorName:e.author.displayName||e.author.handle,likeCount:e.likeCount,replyCount:e.replyCount,repostCount:e.repostCount,quoteCount:e.quoteCount,publishedAt:this.getFormattedDateForContent(e.publishedAt),extra:{post:e}})}replaceFacets(e){if(e.facets.length===0)return e.content;let a=new TextEncoder,s=new TextDecoder,n=a.encode(e.content),r=[...e.facets].sort((c,d)=>c.byteStart-d.byteStart),o="",p=0;for(let c of r){o+=s.decode(n.slice(p,c.byteStart));let d=s.decode(n.slice(c.byteStart,c.byteEnd));switch(c.type){case"mention":o+=`[${d}](https://bsky.app/profile/${c.did})`;break;case"link":o+=`[${d}](${c.uri})`;break;case"tag":o+=`[${d}](https://bsky.app/search?q=${encodeURIComponent(c.tag)})`;break}p=c.byteEnd}return p<n.length&&(o+=s.decode(n.slice(p))),o}renderPost(e,a){return this.templateEngine.render(e,a)}getPostUrl(e){return`https://bsky.app/profile/${e.handle}/post/${e.id}`}getPostUri(e){return`at://${e.handle}/app.bsky.feed.post/${e.id}`}getPostIdFromUrl(e){let a=e.match(this.PATTERN);if(!a){let s=`Unable to determine handle and id from provided url ${e}`;throw new Ye.Notice(s),new Error(s)}return{handle:a.groups.handle,id:a.groups.postId}}getPostIdFromAtUri(e){let a=e.match(this.AT_URI_PATTERN);if(!a){let s=`Unable to determine handle and id from provided AT uri ${e}`;throw new Ye.Notice(s),new Error(s)}return{handle:a.groups.handle,id:a.groups.rkey}}};var Pn=require("obsidian");var oi=class extends H{constructor(){super(...arguments);k(this,"PATTERN",/^https?:\/\/(?:[a-z]{2}\.|www\.)?pinterest\.(?:com|ca|co\.uk|fr|de|es|it)\/pin\/(\d+)\/?/i)}test(e){return this.isValidUrl(e)&&this.PATTERN.test(e)}async prepareNote(e){let a=new Date,s;try{s=await this.parseHtml(e)}catch(o){Ue(o,"Unable to parse Pinterest note data.")}let n=this.templateEngine.render(this.plugin.settings.pinterestNoteTitle,{date:this.getFormattedDateForFilename(a),authorName:s.author.fullName||s.author.username}),r=this.renderContent({date:this.getFormattedDateForContent(a),pinId:s.id,pinURL:s.url,title:s.title,link:s.link,image:s.image,description:s.description,likeCount:s.likeCount,authorName:s.author.fullName||s.author.username,authorProfileURL:s.author.profileURL});if(this.plugin.settings.downloadPinterestImage){let o=this.templateEngine.render(this.plugin.settings.assetsDir,{date:this.getFormattedDateForFilename(a),fileName:q(n),contentType:this.plugin.settings.pinterestContentTypeSlug});r=await Le(this.plugin,q(n),r,o)}return new V(n,"md",r,this.plugin.settings.pinterestContentTypeSlug,a)}renderContent(e){return this.templateEngine.render(this.plugin.settings.pinterestNote,e)}async parseHtml(e){var c,d,h,_,N,C,A,f,P,L,z,x,W,E,I,Y,J,Q,B,ue,Te,O,U,j,ge,w;let a=await(0,Pn.request)({method:"GET",url:e,headers:{...Ve}}),s=new DOMParser().parseFromString(a,"text/html"),n=s.querySelectorAll("[data-relay-response='true']"),r;n.forEach(G=>{var ae;let R=JSON.parse(G.textContent);((ae=R==null?void 0:R.variables)==null?void 0:ae.isDesktop)===!0&&(r=R)}),r===void 0&&(r=(c=JSON.parse(n==null?void 0:n[0].textContent))!=null?c:{});let o=(_=(h=(d=r==null?void 0:r.response)==null?void 0:d.data)==null?void 0:h.v3GetPinQuery)==null?void 0:_.data;if(o===void 0)throw new Error("pinJsonData is undefined");let p=(C=(N=o==null?void 0:o.originPinner)!=null?N:o==null?void 0:o.pinner)!=null?C:{};return{id:e.match(this.PATTERN)[1],url:e,title:(P=(f=o==null?void 0:o.title)!=null?f:(A=s.querySelector("h1"))==null?void 0:A.textContent)!=null?P:"",description:(x=(z=o==null?void 0:o.descriotion)!=null?z:(L=s.querySelector("[data-test-id='truncated-description'] div div"))==null?void 0:L.textContent)!=null?x:"",link:(Y=(E=o==null?void 0:o.link)!=null?E:(W=s.querySelector("meta[property='pinterestapp:source']"))==null?void 0:W.getAttribute("content"))!=null?Y:(I=s.querySelector("meta[property='og:see_also']"))==null?void 0:I.getAttribute("content"),image:(ue=(B=(J=o==null?void 0:o.imageSpec_orig)==null?void 0:J.url)!=null?B:(Q=s.querySelector("[data
<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:
6 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 *)
*/
2 months ago
/* nosourcemap */