vartr=Object.create;varEt=Object.defineProperty;varir=Object.getOwnPropertyDescriptor;varar=Object.getOwnPropertyNames;varnr=Object.getPrototypeOf,rr=Object.prototype.hasOwnProperty;varsr=(i,t,e)=>tini?Et(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;varlt=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),or=(i,t)=>{for(vareint)Et(i,e,{get:t[e],enumerable:!0})},Da=(i,t,e,a)=>{if(t&&typeoft=="object"||typeoft=="function")for(letsofar(t))!rr.call(i,s)&&s!==e&&Et(i,s,{get:()=>t[s],enumerable:!(a=ir(t,s))||a.enumerable});returni};varYt=(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);vark=(i,t,e)=>sr(i,typeoft!="symbol"?t+"":t,e);varqa=lt(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.toSeconds=re.end=re.parse=re.pattern=void0;varct="\\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=newRegExp(dr);vargr=function(i){vart=i.replace(/,/g,".").match(re.pattern);if(!t)thrownewRangeError("invalid duration: ".concat(i));vare=t.slice(1);if(e.filter(function(a){returna!=null}).length===0)thrownewRangeError("invalid duration: ".concat(i));if(e.filter(function(a){return/\./.test(a||"")}).length>1)thrownewRangeError("only the smallest unit can be fractional");returne.reduce(function(a,s,n){returna[ur[n]]=parseFloat(s||"0")||0,a},{})};re.parse=gr;varhr=function(i,t){t===void0&&(t=newDate);vare=Object.assign({},$a,i),a=t.getTime(),s=newDate(a);s.setFullYear(s.getFullYear()+e.years),s.setMonth(s.getMonth()+e.months),s.setDate(s.getDate()+e.days);varn=e.hours*3600*1e3,r=e.minutes*60*1e3;returns.setMilliseconds(s.getMilliseconds()+e.seconds*1e3+n+r),s.setDate(s.getDate()+e.weeks*7),s};re.end=hr;varfr=function(i,t){t===void0&&(t=newDate);vare=Object.assign({},$a,i),a=t.getTime(),s=newDate(a),n=(0,re.end)(e,s),r=t.getTimezoneOffset(),o=n.getTimezoneOffset(),p=(r-o)*60,c=(n.getTime()-s.getTime())/1e3;returnc+p};re.toSeconds=fr;re.default={end:re.end,toSeconds:re.toSeconds,pattern:re.pattern,parse:re.parse}});varGi=lt((qi,Wi)=>{(function(i,t){typeofqi=="object"&&typeofWi!="undefined"?Wi.exports=t():typeofdefine=="function"&&define.amd?define(t):(i=typeofglobalThis!="undefined"?globalThis:i||self,i.DOMPurify=t())})(qi,function(){"use strict";functioni(v){"@babel/helpers - typeof";returni=typeofSymbol=="function"&&typeofSymbol.iterator=="symbol"?function(b){returntypeofb}:function(b){returnb&&typeofSymbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeofb},i(v)}functiont(v,b){returnt=Object.setPrototypeOf||function(D,$){returnD.__proto__=$,D},t(v,b)}functione(){if(typeofReflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeofProxy=="function")return!0;try{returnBoolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(v){return!1}}functiona(v,b,S){returne()?a=Reflect.construct:a=function($,ve,me){varFe=[null];Fe.push.apply(Fe,ve);varXe=Function.bind.apply($,Fe),xt=newXe;returnme&&t(xt,me.prototype),xt},a.apply(null,arguments)}functions(v){returnn(v)||r(v)||o(v)||c()}functionn(v){if(Array.isArray(v))returnp(v)}functionr(v){if(typeofSymbol!="undefined"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)returnArray.from(v)}functiono(v,b){if(v){if(typeofv=="string")returnp(v,b);varS=Object.prototype.toString.call(v).slice(8,-1);if(S==="Object"&&v.constructor&&(S=v.constructor.name),S==="Map"||S==="Set")returnArray.from(v);if(S==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S))returnp(v,b)}}functionp(v,b){(b==null||b>v.length)&&(b=v.length);for(varS=0,D=newArray(b);S<b;S++)D[S]=v[S];returnD}func
`+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]]
{{videoPlayer}}`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoContentTypeSlug:"vimeo",vimeoNoteTitle:"Vimeo - {{ title }}",vimeoNote:`[[ReadItLater]][[Vimeo]]
{{videoChapters}}`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliContentTypeSlug:"bilibili",bilibiliNoteTitle:"Bilibili - {{ title }}",bilibiliNote:`[[ReadItLater]][[Bilibili]]
{{videoPlayer}}`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterContentTypeSlug:"xcom",twitterNoteTitle:"Tweet from {{ tweetAuthorName }} ({{ date }})",twitterNote:`[[ReadItLater]][[Tweet]]
{{articleContent}}`,notParseableArticleContentType:"article",notParseableArticleNoteTitle:"Article {{ date }}",notParsableArticleNote:`[[ReadItLater]][[Article]]
[{{articleURL}}]({{articleURL}})`,textSnippetContentType:"textsnippet",textSnippetNoteTitle:"Note {{ date }}",textSnippetNote:`[[ReadItLater]][[Textsnippet]]
{{answerContent}}`,downloadStackExchangeAssets:!0,downloadStackExchangeAssetsInDir:!1,youtubeApiKey:"",tikTokContentTypeSlug:"tiktok",tikTokNoteTitle:"TikTok from {{ authorName }} ({{ date }})",tikTokNote:`[[ReadItLater]][[TikTok]]
{{videoPlayer}}`,tikTokEmbedWidth:"325",tikTokEmbedHeight:"760",extendShareMenu:!0,filesystemLimitPath:null,filesystemLimitFileName:null,youtubeChannelContentTypeSlug:"youtube-channel",youtubeChannelNoteTitle:"{{ title }}",youtubeChannelNote:`[[ReadItLater]][[YoutubeChannel]]
{{channelSubscribersCount|numberLexify}}subscribers`,fileExistsStrategy:"ask",blueskyContentTypeSlug:"bluesky",blueskyNoteTitle:"Status from {{ authorName }} ({{ date }})",blueskyNote:`[[ReadItLater]][[Bluesky]]
{{content|blockquote}}`,pinterestContentTypeSlug:"pinterest",pinterestNoteTitle:"Pin from {{ authorName }} ({{ date }})",pinterestNote:`[[ReadItLater]][[Pinterest]]
`: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=`
`+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