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

160 lines
121 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var yn=Object.create;var mt=Object.defineProperty;var Tn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_n=(e,t)=>{for(var i in t)mt(e,i,{get:t[i],enumerable:!0})},Ki=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Nn(t))!En.call(e,o)&&o!==i&&mt(e,o,{get:()=>t[o],enumerable:!(r=Tn(t,o))||r.enumerable});return e};var He=(e,t,i)=>(i=e!=null?yn(An(e)):{},Ki(t||!e||!e.__esModule?mt(i,"default",{value:e,enumerable:!0}):i,e)),wn=e=>Ki(mt({},"__esModule",{value:!0}),e);var ir=we((er,tr)=>{(function(e){if(typeof er=="object")tr.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch(i){t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(p,g){return p+g&4294967295},i=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(p,g,l,s,h,c){return g=t(t(g,p),t(s,c)),t(g<<h|g>>>32-h,l)}function o(p,g){var l=p[0],s=p[1],h=p[2],c=p[3];l+=(s&h|~s&c)+g[0]-680876936|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[1]-389564586|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[2]+606105819|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[3]-1044525330|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[4]-176418897|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[5]+1200080426|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[6]-1473231341|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[7]-45705983|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[8]+1770035416|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[9]-1958414417|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[10]-42063|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[11]-1990404162|0,s=(s<<22|s>>>10)+h|0,l+=(s&h|~s&c)+g[12]+1804603682|0,l=(l<<7|l>>>25)+s|0,c+=(l&s|~l&h)+g[13]-40341101|0,c=(c<<12|c>>>20)+l|0,h+=(c&l|~c&s)+g[14]-1502002290|0,h=(h<<17|h>>>15)+c|0,s+=(h&c|~h&l)+g[15]+1236535329|0,s=(s<<22|s>>>10)+h|0,l+=(s&c|h&~c)+g[1]-165796510|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[6]-1069501632|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[11]+643717713|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[0]-373897302|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[5]-701558691|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[10]+38016083|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[15]-660478335|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[4]-405537848|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[9]+568446438|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[14]-1019803690|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[3]-187363961|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[8]+1163531501|0,s=(s<<20|s>>>12)+h|0,l+=(s&c|h&~c)+g[13]-1444681467|0,l=(l<<5|l>>>27)+s|0,c+=(l&h|s&~h)+g[2]-51403784|0,c=(c<<9|c>>>23)+l|0,h+=(c&s|l&~s)+g[7]+1735328473|0,h=(h<<14|h>>>18)+c|0,s+=(h&l|c&~l)+g[12]-1926607734|0,s=(s<<20|s>>>12)+h|0,l+=(s^h^c)+g[5]-378558|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[8]-2022574463|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[11]+1839030562|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[14]-35309556|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[1]-1530992060|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[4]+1272893353|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[7]-155497632|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[10]-1094730640|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[13]+681279174|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[0]-358537222|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[3]-722521979|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[6]+76029189|0,s=(s<<23|s>>>9)+h|0,l+=(s^h^c)+g[9]-640364487|0,l=(l<<4|l>>>28)+s|0,c+=(l^s^h)+g[12]-421815835|0,c=(c<<11|c>>>21)+l|0,h+=(c^l^s)+g[15]+530742520|0,h=(h<<16|h>>>16)+c|0,s+=(h^c^l)+g[2]-995338651|0,s=(s<<23|s>>>9)+h|0,l+=(h^(s|~c))+g[0]-198630844|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[7]+1126891415|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[14]-1416354905|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[5]-57434055|0,s=(s<<21|s>>>11)+h|0,l+=(h^(s|~c))+g[12]+1700485571|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[3]-1894986606|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[10]-1051523|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[1]-2054922799|0,s=(s<<21|s>>>11)+h|0,l+=(h^(s|~c))+g[8]+1873313359|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[15]-30611744|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[6]-1560198380|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[13]+1309151649|0,s=(s<<21|s>>>11)+h|0,l+=(h^(s|~c))+g[4]-145523070|0,l=(l<<6|l>>>26)+s|0,c+=(s^(l|~h))+g[11]-1120210379|0,c=(c<<10|c>>>22)+l|0,h+=(l^(c|~s))+g[2]+718787259|0,h=(h<<15|h>>>17)+c|0,s+=(c^(h|~l))+g[9]-343485551|0,s=(s<<21|s>>>11)+h|0,p[0]=l+p[0]|0,p[1]=s+p[1]|0,p[2]=h+p[2]|0,p[3]=c+p[3]|0}function n(p){var g=[],l;for(l=0;l<64;l+=4)g[l>>2]=p.charCodeAt(l)+(p.charCodeAt(l+1)<<8)+(p.charCodeAt(l+2)<<16)+(p.charCodeAt(l+3)<<24);return g}function a(p){var g=[],l;for(l=0;l<64;l+=4)g[l>>2]=p[l]+(p[l+1]<<8)+(p[l+2]<<16)+(p[l+3]<<24);return g}function m(p){var g=p.length,l=[1732584193,-271733879,-1732584194,271733878],s,h,c,P,W,K;for(s=64;s<=g;s+=64)o(l,n(p.substring(s-64,s)));for(p=p.substring(s-64),h=p.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s=0;s<h;s+=1)c[s>>2]|=p.charCodeAt(s)<<(s%4<<3);if(c[s>>2]|=128<<(s%4<<3),s>55)for(o(l,c),s=0;s<16;s+=1)c[s]=0;return P=g*8,P=P.toString(16).match(/(.*?)(.{0,8})$/),W=parseInt(P[2],16),K=parseInt(P[1],16)||0,c[14]=W,c[15]=K,o(l,c),l}function d(p){var g=p.length,l=[1732584193,-271733879,-1732584194,271733878],s,h,c,P,W,K;for(s=64;s<=g;s+=64)o(l,a(p.subarray(s-64,s)));for(p=s-64<g?p.subarray(s-64):new Uint8Array(0),h=p.length,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s=0;s<h;s+=1)c[s>>2]|=p[s]<<(s%4<<3);if(c[s>>2]|=128<<(s%4<<3),s>55)for(o(l,c),s=0;s<16;s+=1)c[s]=0;return P=g*8,P=P.toString(16).match(/(.*?)(.{0,8})$/),W=parseInt(P[2],16),K=parseInt(P[1],16)||0,c[14]=W,c[15]=K,o(l,c),l}function f(p){var g="",l;for(l=0;l<4;l+=1)g+=i[p>>l*8+4&15]+i[p>>l*8&15];return g}function b(p){var g;for(g=0;g<p.length;g+=1)p[g]=f(p[g]);return p.join("")}b(m("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(t=function(p,g){var l=(p&65535)+(g&65535),s=(p>>16)+(g>>16)+(l>>16);return s<<16|l&65535}),typeof ArrayBuffer!="undefined"&&!ArrayBuffer.prototype.slice&&function(){function p(g,l){return g=g|0||0,g<0?Math.max(g+l,0):Math.min(g,l)}ArrayBuffer.prototype.slice=function(g,l){var s=this.byteLength,h=p(g,s),c=s,P,W,K,pe;return l!==e&&(c=p(l,s)),h>c?new ArrayBuffer(0):(P=c-h,W=new ArrayBuffer(P),K=new Uint8Array(W),pe=new Uint8Array(this,h,P),K.set(pe),W)}}();function S(p){return/[\u0080-\uFFFF]/.test(p)&&(p=unescape(encodeURIComponent(p))),p}function I(p,g){var l=p.length,s=new ArrayBuffer(l),h=new Uint8Array(s),c;for(c=0;c<l;c+=1)h[c]=p.charCodeAt(c);return g?h:s}function x(p){return String.fromCharCode.apply(null,new Uint8Array(p))}function O(p,g,l){var s=new Uint8Array(p.byteLength+g.byteLength);return s.set(new Uint8Array(p)),s.set(new Uint8Array(g),p.byteLength),l?s:s.buffer}function L(p){var g=[],l=p.length,s;for(s=0;s<l-1;s+=2)g.push(parseInt(p.substr(s,2),16));return String.fromCharCode.apply(String,g)}function N(){this.reset()}return N.prototype.append=function(p){return this.appendBinary(S(p)),this},N.prototype.appendBinary=function(p){this._buff+=p,this._length+=p.length;var g=this._buff.length,l;for(l=64;l<=g;l+=64)o(this._hash,n(this._buff.substring(l-64,l)));return this._buff=this._buff.substring(l-64),this},N.prototype.end=function(p){var g=this._buff,l=g.length,s,h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c;for(s=0;s<l;s+=1)h[s>>2]|=g.charCodeAt(s)<<(s%4<<3);return this._finish(h,l),c=b(this._hash),p&&(c=L(c)),this.reset(),c},N.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},N.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},N.prototype.setState=function(p){return this._buff=p.buff,this._length=p.length,this._hash=p.hash,this},N.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},N.prototype._finish=function(p,g){var l=g,s,h,c;if(p[l>>2]|=128<<(l%4<<3),l>55)for(o(this._hash,p),l=0;l<16;l+=1)p[l]=0;s=this._length*8,s=s.toString(16).match(/(.*?)(.{0,8})$/),h=parseInt(s[2],16),c=parseInt(s[1],16)||0,p[14]=h,p[15]=c,o(this._hash,p)},N.hash=function(p,g){return N.hashBinary(S(p),g)},N.hashBinary=function(p,g){var l=m(p),s=b(l);return g?L(s):s},N.ArrayBuffer=function(){this.reset()},N.ArrayBuffer.prototype.append=function(p){var g=O(this._buff.buffer,p,!0),l=g.length,s;for(this._length+=p.byteLength,s=64;s<=l;s+=64)o(this._hash,a(g.subarray(s-64,s)));return this._buff=s-64<l?new Uint8Array(g.buffer.slice(s-64)):new Uint8Array(0),this},N.ArrayBuffer.prototype.end=function(p){var g=this._buff,l=g.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h,c;for(h=0;h<l;h+=1)s[h>>2]|=g[h]<<(h%4<<3);return this._finish(s,l),c=b(this._hash),p&&(c=L(c)),this.reset(),c},N.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},N.ArrayBuffer.prototype.getState=function(){var p=N.prototype.getState.call(this);return p.buff=x(p.buff),p},N.ArrayBuffer.prototype.setState=function(p){return p.buff=I(p.buff,!0),N.prototype.setState.call(this,p)},N.ArrayBuffer.prototype.destroy=N.prototype.destroy,N.ArrayBuffer.prototype._finish=N.prototype._finish,N.ArrayBuffer.hash=function(p,g){var l=d(new Uint8Array(p)),s=b(l);return g?L(s):s},N})});var or=we(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.toSeconds=X.end=X.parse=X.pattern=void 0;var Ge="\\d+",ei="".concat(Ge,"(?:[\\.,]").concat(Ge,")?"),Pn="(".concat(Ge,"Y)?(").concat(Ge,"M)?(").concat(Ge,"W)?(").concat(Ge,"D)?"),Mn="T(".concat(ei,"H)?(").concat(ei,"M)?(").concat(ei,"S)?"),On="P(?:".concat(Pn,"(?:").concat(Mn,")?)"),kn=["years","months","weeks","days","hours","minutes","seconds"],sr=Object.freeze({years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0});X.pattern=new RegExp(On);var Fn=function(e){var t=e.replace(/,/g,".").match(X.pattern);if(!t)throw new RangeError("invalid duration: ".concat(e));var i=t.slice(1);if(i.filter(function(r){return r!=null}).length===0)throw new RangeError("invalid duration: ".concat(e));if(i.filter(function(r){return/\./.test(r||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");return i.reduce(function(r,o,n){return r[kn[n]]=parseFloat(o||"0")||0,r},{})};X.parse=Fn;var Un=function(e,t){t===void 0&&(t=new Date);var i=Object.assign({},sr,e),r=t.getTime(),o=new Date(r);o.setFullYear(o.getFullYear()+i.years),o.setMonth(o.getMonth()+i.months),o.setDate(o.getDate()+i.days);var n=i.hours*3600*1e3,a=i.minutes*60*1e3;return o.setMilliseconds(o.getMilliseconds()+i.seconds*1e3+n+a),o.setDate(o.getDate()+i.weeks*7),o};X.end=Un;var Bn=function(e,t){t===void 0&&(t=new Date);var i=Object.assign({},sr,e),r=t.getTime(),o=new Date(r),n=(0,X.end)(i,o),a=t.getTimezoneOffset(),m=n.getTimezoneOffset(),d=(a-m)*60,f=(n.getTime()-o.getTime())/1e3;return f+d};X.toSeconds=Bn;X.default={end:X.end,toSeconds:X.toSeconds,pattern:X.pattern,parse:X.parse}});var mi=we((gi,pi)=>{(function(e,t){typeof gi=="object"&&typeof pi!="undefined"?pi.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis!="undefined"?globalThis:e||self,e.DOMPurify=t())})(gi,function(){"use strict";function e(T){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},e(T)}function t(T,A){return t=Object.setPrototypeOf||function(C,G){return C.__proto__=G,C},t(T,A)}function i(){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(T){return!1}}function r(T,A,D){return i()?r=Reflect.construct:r=function(G,ne,re){var ue=[null];ue.push.apply(ue,ne);var Ne=Function.bind.apply(G,ue),Ke=new Ne;return re&&t(Ke,re.prototype),Ke},r.apply(null,arguments)}function o(T){return n(T)||a(T)||m(T)||f()}function n(T){if(Array.isArray(T))return d(T)}function a(T){if(typeof Symbol!="undefined"&&T[Symbol.iterator]!=null||T["@@iterator"]!=null)return Array.from(T)}function m(T,A){if(T){if(typeof T=="string")return d(T,A);var D=Object.prototype.toString.call(T).slice(8,-1);if(D==="Object"&&T.constructor&&(D=T.constructor.name),D==="Map"||D==="Set")return Array.from(T);if(D==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D))return d(T,A)}}function d(T,A){(A==null||A>T.length)&&(A=T.length);for(var D=0,C=new Array(A);D<A;D++)C[D]=T[D];return C}function f(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var b=Object.hasOwnProperty,S=Object.setPrototypeOf,I=Object.isFrozen,x=Object.getPrototypeOf,O=Object.getOwnPropertyDescriptor,L=Object.freeze,N=Object.seal,p=Object.create,g=typeof Reflect!="undefined"&&Reflect,l=g.apply,s=g.construct;l||(l=function(A,D,C){return A.apply(D,C)}),L||(L=function(A){return A}),N||(N=function(A){return A}),s||(s=function(A,D){return r(A,o(D))});var h=ee(Array.prototype.forEach),c=ee(Array.prototype.pop),P=ee(Array.prototype.push),W=ee(String.prototype.toLowerCase),K=ee(String.prototype.toString),pe=ee(String.prototype.match),Q=ee(String.prototype.replace),$e=ee(String.prototype.indexOf),xt=ee(String.prototype.trim),B=ee(RegExp.prototype.test),H=ze(TypeError);function ee(T){return function(A){for(var D=arguments.length,C=new Array(D>1?D-1:0),G=1;G<D;G++)C[G-1]=arguments[G];return l(T,A,C)}}function ze(T){return function(){for(var A=arguments.length,D=new Array(A),C=0;C<A;C++)D[C]=arguments[C];return s(T,D)}}function R(T,A,D){var C;D=(C=D)!==null&&C!==void 0?C:W,S&&S(T,null);for(var G=A.length;G--;){var ne=A[G];if(typeof ne=="string"){var re=D(ne);re!==ne&&(I(A)||(A[G]=re),ne=re)}T[ne]=!0}return T}function le(T){var A=p(null),D;for(D in T)l(b,T,[D])===!0&&(A[D]=T[D]);return A}function k(T,A){for(;T!==null;){var D=O(T,A);if(D){if(D.get)return ee(D.get);if(typeof D.value=="function")return ee(D.value)}T=x(T)}function C(G){return console.warn("fallback value for",G),null}return C}var be=L(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xe=L(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Le=L(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rt=L(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Te=L(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),Ie=L(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ce=L(["#text"]),ye=L(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),qe=L(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),je=L(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),te=L(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ce=N(/\{\{[\w\W]*|[\w\W]*\}\}/gm),nt=N(/<%[\w\W]*|[\w\W]*%>/gm),Pe=N(/\${[\w\W]*}/gm),me=N(/^data-[\-\w.\u00B7-\uFFFF]/),Ye=N(/^aria-[\-\w]+$/),Xe=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wr=N(/^(?:\w+script|data):/i),$r=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zr=N(/^html$/i),qr=N(/^[a-z][.\w]*(-[.\w]+)+$/i),jr=function(){return typeof window=="undefined"?null:window},Yr=function(A,D){if(e(A)!=="object"||typeof A.createPolicy!="function")return null;var C=null,G="data-tt-policy-suffix";D.currentScript&&D.currentScript.hasAttribute(G)&&(C=D.currentScript.getAttribute(G));var ne="dompurify"+(C?"#"+C:"");try{return A.createPolicy(ne,{createHTML:function(ue){return ue},createScriptURL:function(ue){return ue}})}catch(re){return console.warn("TrustedTypes policy "+ne+" could not be created."),null}};function wi(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jr(),A=function(u){return wi(u)};if(A.version="2.5.6",A.removed=[],!T||!T.document||T.document.nodeType!==9)return A.isSupported=!1,A;var D=T.document,C=T.document,G=T.DocumentFragment,ne=T.HTMLTemplateElement,re=T.Node,ue=T.Element,Ne=T.NodeFilter,Ke=T.NamedNodeMap,Kr=Ke===void 0?T.NamedNodeMap||T.MozNamedAttrMap:Ke,Jr=T.HTMLFormElement,Zr=T.DOMParser,at=T.trustedTypes,st=ue.prototype,Qr=k(st,"cloneNode"),en=k(st,"nextSibling"),tn=k(st,"childNodes"),Lt=k(st,"parentNode");if(typeof ne=="function"){var It=C.createElement("template");It.content&&It.content.ownerDocument&&(C=It.content.ownerDocument)}var se=Yr(at,D),Ct=se?se.createHTML(""):"",ot=C,Pt=ot.implementation,rn=ot.createNodeIterator,nn=ot.createDocumentFragment,an=ot.getElementsByTagName,sn=D.importNode,Si={};try{Si=le(C).documentMode?C.documentMode:{}}catch(E){}var he={};A.isSupported=typeof Lt=="function"&&Pt&&Pt.createHTMLDocument!==void 0&&Si!==9;var Mt=ce,Ot=nt,kt=Pe,on=me,ln=Ye,cn=Wr,Di=$r,un=qr,Ft=Xe,z=null,Ri=R({},[].concat(o(be),o(xe),o(Le),o(Te),o(Ce))),q=null,xi=R({},[].concat(o(ye),o(qe),o(je),o(te))),F=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,Ut=null,Li=!0,Bt=!0,Ii=!1,Ci=!0,Me=!1,Ht=!0,Ae=!1,Gt=!1,Vt=!1,Oe=!1,lt=!1,ct=!1,Pi=!0,Mi=!1,hn="user-content-",Wt=!0,Ze=!1,ke={},Fe=null,Oi=R({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ki=null,Fi=R({},["audio","video","img","source","image","track"]),$t=null,Ui=R({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ut="http://www.w3.org/1998/Math/MathML",ht="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml",Ue=fe,zt=!1,qt=null,gn=R({},[ut,ht,fe],K),Ee,pn=["application/xhtml+xml","text/html"],mn="text/html",j,Be=null,fn=C.createElement("form"),Bi=function(u){return u instanceof RegExp||u instanceof Function},jt=function(u){Be&&Be===u||((!u||e(u)!=="object")&&(u={}),u=le(u),Ee=pn.indexOf(u.PARSER_MEDIA_TYPE)===-1?Ee=mn:Ee=u.PARSER_MEDIA_TYPE,j=Ee==="application/xhtml+xml"?K:W,z="ALLOWED_TAGS"in u?R({},u.ALLOWED_TAGS,j):Ri,q="ALLOWED_ATTR"in u?R({},u.ALLOWED_ATTR,j):xi,qt="ALLOWED_NAMESPACES"in u?R({},u.ALLOWED_NAMESPACES,K):gn,$t="ADD_URI_SAFE_ATTR"in u?R(le(Ui),u.ADD_URI_SAFE_ATTR,j):Ui,ki="ADD_DATA_URI_TAGS"in u?R(le(Fi),u.ADD_DATA_URI_TAGS,j):Fi,Fe="FORBID_CONTENTS"in u?R({},u.FORBID_CONTENTS,j):Oi,Je="FORBID_TAGS"in u?R({},u.FORBID_TAGS,j):{},Ut="FORBID_ATTR"in u?R({},u.FORBID_ATTR,j):{},ke="USE_PROFILES"in u?u.USE_PROFILES:!1,Li=u.ALLOW_ARIA_ATTR!==!1,Bt=u.ALLOW_DATA_ATTR!==!1,Ii=u.ALLOW_UNKNOWN_PROTOCOLS||!1,Ci=u.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=u.SAFE_FOR_TEMPLATES||!1,Ht=u.SAFE_FOR_XML!==!1,Ae=u.WHOLE_DOCUMENT||!1,Oe=u.RETURN_DOM||!1,lt=u.RETURN_DOM_FRAGMENT||!1,ct=u.RETURN_TRUSTED_TYPE||!1,Vt=u.FORCE_BODY||!1,Pi=u.SANITIZE_DOM!==!1,Mi=u.SANITIZE_NAMED_PROPS||!1,Wt=u.KEEP_CONTENT!==!1,Ze=u.IN_PLACE||!1,Ft=u.ALLOWED_URI_REGEXP||Ft,Ue=u.NAMESPACE||fe,F=u.CUSTOM_ELEMENT_HANDLING||{},u.CUSTOM_ELEMENT_HANDLING&&Bi(u.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=u.CUSTOM_ELEMENT_HANDLING.tagNameCheck),u.CUSTOM_ELEMENT_HANDLING&&Bi(u.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=u.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),u.CUSTOM_ELEMENT_HANDLING&&typeof u.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(F.allowCustomizedBuiltInElements=u.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Bt=!1),lt&&(Oe=!0),ke&&(z=R({},o(Ce)),q=[],ke.html===!0&&(R(z,be),R(q,ye)),ke.svg===!0&&(R(z,xe),R(q,qe),R(q,te)),ke.svgFilters===!0&&(R(z,Le),R(q,qe),R(q,te)),ke.mathMl===!0&&(R(z,Te),R(q,je),R(q,te))),u.ADD_TAGS&&(z===Ri&&(z=le(z)),R(z,u.ADD_TAGS,j)),u.ADD_ATTR&&(q===xi&&(q=le(q)),R(q,u.ADD_ATTR,j)),u.ADD_URI_SAFE_ATTR&&R($t,u.ADD_URI_SAFE_ATTR,j),u.FORBID_CONTENTS&&(Fe===Oi&&(Fe=le(Fe)),R(Fe,u.FORBID_CONTENTS,j)),Wt&&(z["#text"]=!0),Ae&&R(z,["html","head","body"]),z.table&&(R(z,["tbody"]),delete Je.tbody),L&&L(u),Be=u)},Hi=R({},["mi","mo","mn","ms","mtext"]),Gi=R({},["foreignobject","annotation-xml"]),dn=R({},["title","style","font","a","script"]),gt=R({},xe);R(gt,Le),R(gt,rt);var Yt=R({},Te);R(Yt,Ie);var vn=function(u){var v=Lt(u);(!v||!v.tagName)&&(v={namespaceURI:Ue,tagName:"template"});var y=W(u.tagName),M=W(v.tagName);return qt[u.namespaceURI]?u.namespaceURI===ht?v.namespaceURI===fe?y==="svg":v.namespaceURI===ut?y==="svg"&&(M==="annotation-xml"||Hi[M]):!!gt[y]:u.namespaceURI===ut?v.namespaceURI===fe?y==="math":v.namespaceURI===ht?y==="math"&&Gi[M]:!!Yt[y]:u.namespaceURI===fe?v.namespaceURI===ht&&!Gi[M]||v.namespaceURI===ut&&!Hi[M]?!1:!Yt[y]&&(dn[y]||!gt[y]):!!(Ee==="application/xhtml+xml"&&qt[u.namespaceURI]):!1},ae=function(u){P(A.removed,{element:u});try{u.parentNode.removeChild(u)}catch(v){try{u.outerHTML=Ct}catch(y){u.remove()}}},pt=function(u,v){try{P(A.removed,{attribute:v.getAttributeNode(u),from:v})}catch(y){P(A.removed,{attribute:null,from:v})}if(v.removeAttribute(u),u==="is"&&!q[u])if(Oe||lt)try{ae(v)}catch(y){}else try{v.setAttribute(u,"")}catch(y){}},Vi=function(u){var v,y;if(Vt)u="<remove></remove>"+u;else{var M=pe(u,/^[\r\n\t ]+/);y=M&&M[0]}Ee==="application/xhtml+xml"&&Ue===fe&&(u='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+u+"</body></html>");var ie=se?se.createHTML(u):u;if(Ue===fe)try{v=new Zr().parseFromString(ie,Ee)}catch(Y){}if(!v||!v.documentElement){v=Pt.createDocument(Ue,"template",null);try{v.documentElement.innerHTML=zt?Ct:ie}catch(Y){}}var J=v.body||v.documentElement;return u&&y&&J.insertBefore(C.createTextNode(y),J.childNodes[0]||null),Ue===fe?an.call(v,Ae?"html":"body")[0]:Ae?v.documentElement:J},Wi=function(u){return rn.call(u.ownerDocument||u,u,Ne.SHOW_ELEMENT|Ne.SHOW_COMMENT|Ne.SHOW_TEXT|Ne.SHOW_PROCESSING_INSTRUCTION|Ne.SHOW_CDATA_SECTION,null,!1)},$i=function(u){return u instanceof Jr&&(typeof u.nodeName!="string"||typeof u.textContent!="string"||typeof u.removeChild!="function"||!(u.attributes instanceof Kr)||typeof u.removeAttribute!="function"||typeof u.setAttribute!="function"||typeof u.namespaceURI!="string"||typeof u.insertBefore!="function"||typeof u.hasChildNodes!="function")},Qe=function(u){return e(re)==="object"?u instanceof re:u&&e(u)==="object"&&typeof u.nodeType=="number"&&typeof u.nodeName=="string"},de=function(u,v,y){he[u]&&h(he[u],function(M){M.call(A,v,y,Be)})},zi=function(u){var v;if(de("beforeSanitizeElements",u,null),$i(u)||B(/[\u0080-\uFFFF]/,u.nodeName))return ae(u),!0;var y=j(u.nodeName);if(de("uponSanitizeElement",u,{tagName:y,allowedTags:z}),u.hasChildNodes()&&!Qe(u.firstElementChild)&&(!Qe(u.content)||!Qe(u.content.firstElementChild))&&B(/<[/\w]/g,u.innerHTML)&&B(/<[/\w]/g,u.textContent)||y==="select"&&B(/<template/i,u.innerHTML)||u.nodeType===7||Ht&&u.nodeType===8&&B(/<[/\w]/g,u.data))return ae(u),!0;if(!z[y]||Je[y]){if(!Je[y]&&ji(y)&&(F.tagNameCheck instanceof RegExp&&B(F.tagNameCheck,y)||F.tagNameCheck instanceof Function&&F.tagNameCheck(y)))return!1;if(Wt&&!Fe[y]){var M=Lt(u)||u.parentNode,ie=tn(u)||u.childNodes;if(ie&&M)for(var J=ie.length,Y=J-1;Y>=0;--Y){var _e=Qr(ie[Y],!0);_e.__removalCount=(u.__removalCount||0)+1,M.insertBefore(_e,en(u))}}return ae(u),!0}return u instanceof ue&&!vn(u)||(y==="noscript"||y==="noembed"||y==="noframes")&&B(/<\/no(script|embed|frames)/i,u.innerHTML)?(ae(u),!0):(Me&&u.nodeType===3&&(v=u.textContent,v=Q(v,Mt," "),v=Q(v,Ot," "),v=Q(v,kt," "),u.textContent!==v&&(P(A.removed,{element:u.cloneNode()}),u.textContent=v)),de("afterSanitizeElements",u,null),!1)},qi=function(u,v,y){if(Pi&&(v==="id"||v==="name")&&(y in C||y in fn))return!1;if(!(Bt&&!Ut[v]&&B(on,v))){if(!(Li&&B(ln,v))){if(!q[v]||Ut[v]){if(!(ji(u)&&(F.tagNameCheck instanceof RegExp&&B(F.tagNameCheck,u)||F.tagNameCheck instanceof Function&&F.tagNameCheck(u))&&(F.attributeNameCheck instanceof RegExp&&B(F.attributeNameCheck,v)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(v))||v==="is"&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&B(F.tagNameCheck,y)||F.tagNameCheck instanceof Function&&F.tagNameCheck(y))))return!1}else if(!$t[v]){if(!B(Ft,Q(y,Di,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&u!=="script"&&$e(y,"data:")===0&&ki[u])){if(!(Ii&&!B(cn,Q(y,Di,"")))){if(y)return!1}}}}}}return!0},ji=function(u){return u!=="annotation-xml"&&pe(u,un)},Yi=function(u){var v,y,M,ie;de("beforeSanitizeAttributes",u,null);var J=u.attributes;if(J){var Y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q};for(ie=J.length;ie--;){v=J[ie];var _e=v,$=_e.name,Xt=_e.namespaceURI;if(y=$==="value"?v.value:xt(v.value),M=j($),Y.attrName=M,Y.attrValue=y,Y.keepAttr=!0,Y.forceKeepAttr=void 0,de("uponSanitizeAttribute",u,Y),y=Y.attrValue,Ht&&B(/((--!?|])>)|<\/(style|title)/i,y)){pt($,u);continue}if(!Y.forceKeepAttr&&(pt($,u),!!Y.keepAttr)){if(!Ci&&B(/\/>/i,y)){pt($,u);continue}Me&&(y=Q(y,Mt," "),y=Q(y,Ot," "),y=Q(y,kt," "));var Xi=j(u.nodeName);if(qi(Xi,M,y)){if(Mi&&(M==="id"||M==="name")&&(pt($,u),y=hn+y),se&&e(at)==="object"&&typeof at.getAttributeType=="function"&&!Xt)switch(at.getAttributeType(Xi,M)){case"TrustedHTML":{y=se.createHTML(y);break}case"TrustedScriptURL":{y=se.createScriptURL(y);break}}try{Xt?u.setAttributeNS(Xt,$,y):u.setAttribute($,y),$i(u)?ae(u):c(A.removed)}catch(_a){}}}}de("afterSanitizeAttributes",u,null)}},bn=function E(u){var v,y=Wi(u);for(de("beforeSanitizeShadowDOM",u,null);v=y.nextNode();)de("uponSanitizeShadowNode",v,null),!zi(v)&&(v.content instanceof G&&E(v.content),Yi(v));de("afterSanitizeShadowDOM",u,null)};return A.sanitize=function(E){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v,y,M,ie,J;if(zt=!E,zt&&(E="<!-->"),typeof E!="string"&&!Qe(E))if(typeof E.toString=="function"){if(E=E.toString(),typeof E!="string")throw H("dirty is not a string, aborting")}else throw H("toString is not a function");if(!A.isSupported){if(e(T.toStaticHTML)==="object"||typeof T.toStaticHTML=="function"){if(typeof E=="string")return T.toStaticHTML(E);if(Qe(E))return T.toStaticHTML(E.outerHTML)}return E}if(Gt||jt(u),A.removed=[],typeof E=="string"&&(Ze=!1),Ze){if(E.nodeName){var Y=j(E.nodeName);if(!z[Y]||Je[Y])throw H("root node is forbidden and cannot be sanitized in-place")}}else if(E instanceof re)v=Vi("<!---->"),y=v.ownerDocument.importNode(E,!0),y.nodeType===1&&y.nodeName==="BODY"||y.nodeName==="HTML"?v=y:v.appendChild(y);else{if(!Oe&&!Me&&!Ae&&E.indexOf("<")===-1)return se&&ct?se.createHTML(E):E;if(v=Vi(E),!v)return Oe?null:ct?Ct:""}v&&Vt&&ae(v.firstChild);for(var _e=Wi(Ze?E:v);M=_e.nextNode();)M.nodeType===3&&M===ie||zi(M)||(M.content instanceof G&&bn(M.content),Yi(M),ie=M);if(ie=null,Ze)return E;if(Oe){if(lt)for(J=nn.call(v.ownerDocument);v.firstChild;)J.appendChild(v.firstChild);else J=v;return(q.shadowroot||q.shadowrootmod)&&(J=sn.call(D,J,!0)),J}var $=Ae?v.outerHTML:v.innerHTML;return Ae&&z["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&B(zr,v.ownerDocument.doctype.name)&&($="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
`+$),Me&&($=Q($,Mt," "),$=Q($,Ot," "),$=Q($,kt," ")),se&&ct?se.createHTML($):$},A.setConfig=function(E){jt(E),Gt=!0},A.clearConfig=function(){Be=null,Gt=!1},A.isValidAttribute=function(E,u,v){Be||jt({});var y=j(E),M=j(u);return qi(y,M,v)},A.addHook=function(E,u){typeof u=="function"&&(he[E]=he[E]||[],P(he[E],u))},A.removeHook=function(E){if(he[E])return c(he[E])},A.removeHooks=function(E){he[E]&&(he[E]=[])},A.removeAllHooks=function(){he={}},A}var Xr=wi();return Xr})});var fi=we((Ns,xr)=>{xr.exports=window.DOMPurify||(window.DOMPurify=mi().default||mi())});var Cr=we((Rs,bi)=>{function Ir(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(i){return i.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._allowedVideoRegex=t.allowedVideoRegex||this.REGEXPS.videos,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let i=function(r){if(r.nodeType==r.TEXT_NODE)return`${r.nodeName} ("${r.textContent}")`;let o=Array.from(r.attributes||[],function(n){return`${n.name}="${n.value}"`}).join(" ");return`<${r.localName} ${o}>`};this.log=function(){if(typeof console!="undefined"){let o=Array.from(arguments,n=>n&&n.nodeType==this.ELEMENT_NODE?i(n):n);o.unshift("Reader: (Readability)"),console.log.apply(console,o)}else if(typeof dump!="undefined"){var r=Array.prototype.map.call(arguments,function(o){return o&&o.nodeName?i(o):o}).join(" ");dump("Reader: (Readability) "+r+`
`)}}}else this.log=function(){}}Ir.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,tokenize:/\W+/g,whitespace:/^\s*$/,hasContent:/\S$/,hashUrl:/^#.+/,srcsetUrl:/(\S+)(\s+[\d.]+[xw])?(\s*(?:,|$))/g,b64DataUrl:/^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,commas:/\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,jsonLdArticleTypes:/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/},UNLIKELY_ROLES:["menu","menubar","complementary","navigation","alert","alertdialog","dialog"],DIV_TO_P_ELEMS:new Set(["BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL"]),ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],HTML_ESCAPE_MAP:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"},_postProcessContent:function(e){this._fixRelativeUris(e),this._simplifyNestedElements(e),this._keepClasses||this._cleanClasses(e)},_removeNodes:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _removeNodes");for(var i=e.length-1;i>=0;i--){var r=e[i],o=r.parentNode;o&&(!t||t.call(this,r,i,e))&&o.removeChild(r)}},_replaceNodeTags:function(e,t){if(this._docJSDOMParser&&e._isLiveNodeList)throw new Error("Do not pass live node lists to _replaceNodeTags");for(let i of e)this._setNodeTag(i,t)},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_findNode:function(e,t){return Array.prototype.find.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments),i=t.map(function(r){return e.call(r)});return Array.prototype.concat.apply([],i)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(i){var r=e.getElementsByTagName(i);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,i=(e.getAttribute("class")||"").split(/\s+/).filter(function(r){return t.indexOf(r)!=-1}).join(" ");for(i?e.setAttribute("class",i):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,i=this._doc.documentURI;function r(a){if(t==i&&a.charAt(0)=="#")return a;try{return new URL(a,t).href}catch(m){}return a}var o=this._getAllNodesWithTag(e,["a"]);this._forEachNode(o,function(a){var m=a.getAttribute("href");if(m)if(m.indexOf("javascript:")===0)if(a.childNodes.length===1&&a.childNodes[0].nodeType===this.TEXT_NODE){var d=this._doc.createTextNode(a.textContent);a.parentNode.replaceChild(d,a)}else{for(var f=this._doc.createElement("span");a.firstChild;)f.appendChild(a.firstChild);a.parentNode.replaceChild(f,a)}else a.setAttribute("href",r(m))});var n=this._getAllNodesWithTag(e,["img","picture","figure","video","audio","source"]);this._forEachNode(n,function(a){var m=a.getAttribute("src"),d=a.getAttribute("poster"),f=a.getAttribute("srcset");if(m&&a.setAttribute("src",r(m)),d&&a.setAttribute("poster",r(d)),f){var b=f.replace(this.REGEXPS.srcsetUrl,function(S,I,x,O){return r(I)+(x||"")+O});a.setAttribute("srcset",b)}})},_simplifyNestedElements:function(e){for(var t=e;t;){if(t.parentNode&&["DIV","SECTION"].includes(t.tagName)&&!(t.id&&t.id.startsWith("readability"))){if(this._isElementWithoutContent(t)){t=this._removeAndGetNext(t);continue}else if(this._hasSingleTagInsideElement(t,"DIV")||this._hasSingleTagInsideElement(t,"SECTION")){for(var i=t.children[0],r=0;r<t.attributes.length;r++)i.setAttribute(t.attributes[r].name,t.attributes[r].value);t.parentNode.replaceChild(i,t),t=i;continue}}t=this._getNextNode(t)}},_getArticleTitle:function(){var e=this._doc,t="",i="";try{t=i=e.title.trim(),typeof t!="string"&&(t=i=this._getInnerText(e.getElementsByTagName("title")[0]))}catch(b){}var r=!1;function o(b){return b.split(/\s+/).length}if(/ [\|\-\\\/>»] /.test(t))r=/ [\\\/>»] /.test(t),t=i.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"),o(t)<3&&(t=i.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(t.indexOf(": ")!==-1){var n=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),a=t.trim(),m=this._someNode(n,function(b){return b.textContent.trim()===a});m||(t=i.substring(i.lastIndexOf(":")+1),o(t)<3?t=i.substring(i.indexOf(":")+1):o(i.substr(0,i.indexOf(":")))>5&&(t=i))}else if(t.length>150||t.length<15){var d=e.getElementsByTagName("h1");d.length===1&&(t=this._getInnerText(d[0]))}t=t.trim().replace(this.REGEXPS.normalize," ");var f=o(t);return f<=4&&(!r||f!=o(i.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=i),t},_prepDocument:function(){var e=this._doc;this._removeNodes(this._getAllNodesWithTag(e,["style"])),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(this._getAllNodesWithTag(e,["font"]),"SPAN")},_nextNode:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(t){for(var i=t.nextSibling,r=!1;(i=this._nextNode(i))&&i.tagName=="BR";){r=!0;var o=i.nextSibling;i.parentNode.removeChild(i),i=o}if(r){var n=this._doc.createElement("p");for(t.parentNode.replaceChild(n,t),i=n.nextSibling;i;){if(i.tagName=="BR"){var a=this._nextNode(i.nextSibling);if(a&&a.tagName=="BR")break}if(!this._isPhrasingContent(i))break;var m=i.nextSibling;n.appendChild(i),i=m}for(;n.lastChild&&this._isWhitespace(n.lastChild);)n.removeChild(n.lastChild);n.parentNode.tagName==="P"&&this._setNodeTag(n.parentNode,"DIV")}})},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),this._docJSDOMParser)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var i=e.ownerDocument.createElement(t);e.firstChild;)i.appendChild(e.firstChild);e.parentNode.replaceChild(i,e),e.readability&&(i.readability=e.readability);for(var r=0;r<e.attributes.length;r++)try{i.setAttribute(e.attributes[r].name,e.attributes[r].value)}catch(o){}return i},_prepArticle:function(e){this._cleanStyles(e),this._markDataTables(e),this._fixLazyImages(e),this._cleanConditionally(e,"form"),this._cleanConditionally(e,"fieldset"),this._clean(e,"object"),this._clean(e,"embed"),this._clean(e,"footer"),this._clean(e,"link"),this._clean(e,"aside");var t=this.DEFAULT_CHAR_THRESHOLD;this._forEachNode(e.children,function(i){this._cleanMatchedNodes(i,function(r,o){return this.REGEXPS.shareElements.test(o)&&r.textContent.length<t})}),this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._replaceNodeTags(this._getAllNodesWithTag(e,["h1"]),"h2"),this._removeNodes(this._getAllNodesWithTag(e,["p"]),function(i){var r=i.getElementsByTagName("img").length,o=i.getElementsByTagName("embed").length,n=i.getElementsByTagName("object").length,a=i.getElementsByTagName("iframe").length,m=r+o+n+a;return m===0&&!this._getInnerText(i,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(i){var r=this._nextNode(i.nextSibling);r&&r.tagName=="P"&&i.parentNode.removeChild(i)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(i){var r=this._hasSingleTagInsideElement(i,"TBODY")?i.firstElementChild:i;if(this._hasSingleTagInsideElement(r,"TR")){var o=r.firstElementChild;if(this._hasSingleTagInsideElement(o,"TD")){var n=o.firstElementChild;n=this._setNodeTag(n,this._everyNode(n.childNodes,this._isPhrasingContent)?"P":"DIV"),i.parentNode.replaceChild(n,i)}}})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5;break}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do e=e.parentNode;while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_textSimilarity:function(e,t){var i=e.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean),r=t.toLowerCase().split(this.REGEXPS.tokenize).filter(Boolean);if(!i.length||!r.length)return 0;var o=r.filter(a=>!i.includes(a)),n=o.join(" ").length/r.join(" ").length;return 1-n},_checkByline:function(e,t){if(this._articleByline)return!1;if(e.getAttribute!==void 0)var i=e.getAttribute("rel"),r=e.getAttribute("itemprop");return(i==="author"||r&&r.indexOf("author")!==-1||this.REGEXPS.byline.test(t))&&this._isValidByline(e.textContent)?(this._articleByline=e.textContent.trim(),!0):!1},_getNodeAncestors:function(e,t){t=t||0;for(var i=0,r=[];e.parentNode&&(r.push(e.parentNode),!(t&&++i===t));)e=e.parentNode;return r},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,i=e!==null;if(e=e||this._doc.body,!e)return this.log("No body found in document. Abort."),null;for(var r=e.innerHTML;;){this.log("Starting grabArticle loop");var o=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),n=[],a=this._doc.documentElement;let je=!0;for(;a;){a.tagName==="HTML"&&(this._articleLang=a.getAttribute("lang"));var m=a.className+" "+a.id;if(!this._isProbablyVisible(a)){this.log("Removing hidden node - "+m),a=this._removeAndGetNext(a);continue}if(a.getAttribute("aria-modal")=="true"&&a.getAttribute("role")=="dialog"){a=this._removeAndGetNext(a);continue}if(this._checkByline(a,m)){a=this._removeAndGetNext(a);continue}if(je&&this._headerDuplicatesTitle(a)){this.log("Removing header: ",a.textContent.trim(),this._articleTitle.trim()),je=!1,a=this._removeAndGetNext(a);continue}if(o){if(this.REGEXPS.unlikelyCandidates.test(m)&&!this.REGEXPS.okMaybeItsACandidate.test(m)&&!this._hasAncestorTag(a,"table")&&!this._hasAncestorTag(a,"code")&&a.tagName!=="BODY"&&a.tagName!=="A"){this.log("Removing unlikely candidate - "+m),a=this._removeAndGetNext(a);continue}if(this.UNLIKELY_ROLES.includes(a.getAttribute("role"))){this.log("Removing content with role "+a.getAttribute("role")+" - "+m),a=this._removeAndGetNext(a);continue}}if((a.tagName==="DIV"||a.tagName==="SECTION"||a.tagName==="HEADER"||a.tagName==="H1"||a.tagName==="H2"||a.tagName==="H3"||a.tagName==="H4"||a.tagName==="H5"||a.tagName==="H6")&&this._isElementWithoutContent(a)){a=this._removeAndGetNext(a);continue}if(this.DEFAULT_TAGS_TO_SCORE.indexOf(a.tagName)!==-1&&n.push(a),a.tagName==="DIV"){for(var d=null,f=a.firstChild;f;){var b=f.nextSibling;if(this._isPhrasingContent(f))d!==null?d.appendChild(f):this._isWhitespace(f)||(d=t.createElement("p"),a.replaceChild(d,f),d.appendChild(f));else if(d!==null){for(;d.lastChild&&this._isWhitespace(d.lastChild);)d.removeChild(d.lastChild);d=null}f=b}if(this._hasSingleTagInsideElement(a,"P")&&this._getLinkDensity(a)<.25){var S=a.children[0];a.parentNode.replaceChild(S,a),a=S,n.push(a)}else this._hasChildBlockElement(a)||(a=this._setNodeTag(a,"P"),n.push(a))}a=this._getNextNode(a)}var I=[];this._forEachNode(n,function(te){if(!(!te.parentNode||typeof te.parentNode.tagName=="undefined")){var ce=this._getInnerText(te);if(!(ce.length<25)){var nt=this._getNodeAncestors(te,5);if(nt.length!==0){var Pe=0;Pe+=1,Pe+=ce.split(this.REGEXPS.commas).length,Pe+=Math.min(Math.floor(ce.length/100),3),this._forEachNode(nt,function(me,Ye){if(!(!me.tagName||!me.parentNode||typeof me.parentNode.tagName=="undefined")){if(typeof me.readability=="undefined"&&(this._initializeNode(me),I.push(me)),Ye===0)var Xe=1;else Ye===1?Xe=2:Xe=Ye*3;me.readability.contentScore+=Pe/Xe}})}}}});for(var x=[],O=0,L=I.length;O<L;O+=1){var N=I[O],p=N.readability.contentScore*(1-this._getLinkDensity(N));N.readability.contentScore=p,this.log("Candidate:",N,"with score "+p);for(var g=0;g<this._nbTopCandidates;g++){var l=x[g];if(!l||p>l.readability.contentScore){x.splice(g,0,N),x.length>this._nbTopCandidates&&x.pop();break}}}var s=x[0]||null,h=!1,c;if(s===null||s.tagName==="BODY"){for(s=t.createElement("DIV"),h=!0;e.firstChild;)this.log("Moving child out:",e.firstChild),s.appendChild(e.firstChild);e.appendChild(s),this._initializeNode(s)}else if(s){for(var P=[],W=1;W<x.length;W++)x[W].readability.contentScore/s.readability.contentScore>=.75&&P.push(this._getNodeAncestors(x[W]));var K=3;if(P.length>=K)for(c=s.parentNode;c.tagName!=="BODY";){for(var pe=0,Q=0;Q<P.length&&pe<K;Q++)pe+=Number(P[Q].includes(c));if(pe>=K){s=c;break}c=c.parentNode}s.readability||this._initializeNode(s),c=s.parentNode;for(var $e=s.readability.contentScore,xt=$e/3;c.tagName!=="BODY";){if(!c.readability){c=c.parentNode;continue}var B=c.readability.contentScore;if(B<xt)break;if(B>$e){s=c;break}$e=c.readability.contentScore,c=c.parentNode}for(c=s.parentNode;c.tagName!="BODY"&&c.children.length==1;)s=c,c=s.parentNode;s.readability||this._initializeNode(s)}var H=t.createElement("DIV");i&&(H.id="readability-content");var ee=Math.max(10,s.readability.contentScore*.2);c=s.parentNode;for(var ze=c.children,R=0,le=ze.length;R<le;R++){var k=ze[R],be=!1;if(this.log("Looking at sibling node:",k,k.readability?"with score "+k.readability.contentScore:""),this.log("Sibling has score",k.readability?k.readability.contentScore:"Unknown"),k===s)be=!0;else{var xe=0;if(k.className===s.className&&s.className!==""&&(xe+=s.readability.contentScore*.2),k.readability&&k.readability.contentScore+xe>=ee)be=!0;else if(k.nodeName==="P"){var Le=this._getLinkDensity(k),rt=this._getInnerText(k),Te=rt.length;(Te>80&&Le<.25||Te<80&&Te>0&&Le===0&&rt.search(/\.( |$)/)!==-1)&&(be=!0)}}be&&(this.log("Appending node:",k),this.ALTER_TO_DIV_EXCEPTIONS.indexOf(k.nodeName)===-1&&(this.log("Altering sibling:",k,"to div."),k=this._setNodeTag(k,"DIV")),H.appendChild(k),ze=c.children,R-=1,le-=1)}if(this._debug&&this.log("Article content pre-prep: "+H.innerHTML),this._prepArticle(H),this._debug&&this.log("Article content post-prep: "+H.innerHTML),h)s.id="readability-page-1",s.className="page";else{var Ie=t.createElement("DIV");for(Ie.id="readability-page-1",Ie.className="page";H.firstChild;)Ie.appendChild(H.firstChild);H.appendChild(Ie)}this._debug&&this.log("Article content after paging: "+H.innerHTML);var Ce=!0,ye=this._getInnerText(H,!0).length;if(ye<this._charThreshold)if(Ce=!1,e.innerHTML=r,this._flagIsActive(this.FLAG_STRIP_UNLIKELYS))this._removeFlag(this.FLAG_STRIP_UNLIKELYS),this._attempts.push({articleContent:H,textLength:ye});else if(this._flagIsActive(this.FLAG_WEIGHT_CLASSES))this._removeFlag(this.FLAG_WEIGHT_CLASSES),this._attempts.push({articleContent:H,textLength:ye});else if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY))this._removeFlag(this.FLAG_CLEAN_CONDITIONALLY),this._attempts.push({articleContent:H,textLength:ye});else{if(this._attempts.push({articleContent:H,textLength:ye}),this._attempts.sort(function(te,ce){return ce.textLength-te.textLength}),!this._attempts[0].textLength)return null;H=this._attempts[0].articleContent,Ce=!0}if(Ce){var qe=[c,s].concat(this._getNodeAncestors(c));return this._someNode(qe,function(te){if(!te.tagName)return!1;var ce=te.getAttribute("dir");return ce?(this._articleDir=ce,!0):!1}),H}}},_isValidByline:function(e){return typeof e=="string"||e instanceof String?(e=e.trim(),e.length>0&&e.length<100):!1},_unescapeHtmlEntities:function(e){if(!e)return e;var t=this.HTML_ESCAPE_MAP;return e.replace(/&(quot|amp|apos|lt|gt);/g,function(i,r){return t[r]}).replace(/&#(?:x([0-9a-z]{1,4})|([0-9]{1,4}));/gi,function(i,r,o){var n=parseInt(r||o,r?16:10);return String.fromCharCode(n)})},_getJSONLD:function(e){var t=this._getAllNodesWithTag(e,["script"]),i;return this._forEachNode(t,function(r){if(!i&&r.getAttribute("type")==="application/ld+json")try{var o=r.textContent.replace(/^\s*<!\[CDATA\[|\]\]>\s*$/g,""),n=JSON.parse(o);if(!n["@context"]||!n["@context"].match(/^https?\:\/\/schema\.org$/)||(!n["@type"]&&Array.isArray(n["@graph"])&&(n=n["@graph"].find(function(f){return(f["@type"]||"").match(this.REGEXPS.jsonLdArticleTypes)})),!n||!n["@type"]||!n["@type"].match(this.REGEXPS.jsonLdArticleTypes)))return;if(i={},typeof n.name=="string"&&typeof n.headline=="string"&&n.name!==n.headline){var a=this._getArticleTitle(),m=this._textSimilarity(n.name,a)>.75,d=this._textSimilarity(n.headline,a)>.75;d&&!m?i.title=n.headline:i.title=n.name}else typeof n.name=="string"?i.title=n.name.trim():typeof n.headline=="string"&&(i.title=n.headline.trim());n.author&&(typeof n.author.name=="string"?i.byline=n.author.name.trim():Array.isArray(n.author)&&n.author[0]&&typeof n.author[0].name=="string"&&(i.byline=n.author.filter(function(f){return f&&typeof f.name=="string"}).map(function(f){return f.name.trim()}).join(", "))),typeof n.description=="string"&&(i.excerpt=n.description.trim()),n.publisher&&typeof n.publisher.name=="string"&&(i.siteName=n.publisher.name.trim()),typeof n.datePublished=="string"&&(i.datePublished=n.datePublished.trim());return}catch(f){this.log(f.message)}}),i||{}},_getArticleMetadata:function(e){var t={},i={},r=this._doc.getElementsByTagName("meta"),o=/\s*(article|dc|dcterm|og|twitter)\s*:\s*(author|creator|description|published_time|title|site_name)\s*/gi,n=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(a){var m=a.getAttribute("name"),d=a.getAttribute("property"),f=a.getAttribute("content");if(f){var b=null,S=null;d&&(b=d.match(o),b&&(S=b[0].toLowerCase().replace(/\s/g,""),i[S]=f.trim())),!b&&m&&n.test(m)&&(S=m,f&&(S=S.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),i[S]=f.trim()))}}),t.title=e.title||i["dc:title"]||i["dcterm:title"]||i["og:title"]||i["weibo:article:title"]||i["weibo:webpage:title"]||i.title||i["twitter:title"],t.title||(t.title=this._getArticleTitle()),t.byline=e.byline||i["dc:creator"]||i["dcterm:creator"]||i.author,t.excerpt=e.excerpt||i["dc:description"]||i["dcterm:description"]||i["og:description"]||i["weibo:article:description"]||i["weibo:webpage:description"]||i.description||i["twitter:description"],t.siteName=e.siteName||i["og:site_name"],t.publishedTime=e.datePublished||i["article:published_time"]||null,t.title=this._unescapeHtmlEntities(t.title),t.byline=this._unescapeHtmlEntities(t.byline),t.excerpt=this._unescapeHtmlEntities(t.excerpt),t.siteName=this._unescapeHtmlEntities(t.siteName),t.publishedTime=this._unescapeHtmlEntities(t.publishedTime),t},_isSingleImage:function(e){return e.tagName==="IMG"?!0:e.children.length!==1||e.textContent.trim()!==""?!1:this._isSingleImage(e.children[0])},_unwrapNoscriptImages:function(e){var t=Array.from(e.getElementsByTagName("img"));this._forEachNode(t,function(r){for(var o=0;o<r.attributes.length;o++){var n=r.attributes[o];switch(n.name){case"src":case"srcset":case"data-src":case"data-srcset":return}if(/\.(jpg|jpeg|png|webp)/i.test(n.value))return}r.parentNode.removeChild(r)});var i=Array.from(e.getElementsByTagName("noscript"));this._forEachNode(i,function(r){var o=e.createElement("div");if(o.innerHTML=r.innerHTML,!!this._isSingleImage(o)){var n=r.previousElementSibling;if(n&&this._isSingleImage(n)){var a=n;a.tagName!=="IMG"&&(a=n.getElementsByTagName("img")[0]);for(var m=o.getElementsByTagName("img")[0],d=0;d<a.attributes.length;d++){var f=a.attributes[d];if(f.value!==""&&(f.name==="src"||f.name==="srcset"||/\.(jpg|jpeg|png|webp)/i.test(f.value))){if(m.getAttribute(f.name)===f.value)continue;var b=f.name;m.hasAttribute(b)&&(b="data-old-"+b),m.setAttribute(b,f.value)}}r.parentNode.replaceChild(o.firstElementChild,n)}}})},_removeScripts:function(e){this._removeNodes(this._getAllNodesWithTag(e,["script","noscript"]))},_hasSingleTagInsideElement:function(e,t){return e.children.length!=1||e.children[0].tagName!==t?!1:!this._someNode(e.childNodes,function(i){return i.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(i.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&e.textContent.trim().length==0&&(e.children.length==0||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(t){return this.DIV_TO_P_ELEMS.has(t.tagName)||this._hasChildBlockElement(t)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||this.PHRASING_ELEMS.indexOf(e.tagName)!==-1||(e.tagName==="A"||e.tagName==="DEL"||e.tagName==="INS")&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&e.textContent.trim().length===0||e.nodeType===this.ELEMENT_NODE&&e.tagName==="BR"},_getInnerText:function(e,t){t=typeof t=="undefined"?!0:t;var i=e.textContent.trim();return t?i.replace(this.REGEXPS.normalize," "):i},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){if(!(!e||e.tagName.toLowerCase()==="svg")){for(var t=0;t<this.PRESENTATIONAL_ATTRIBUTES.length;t++)e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[t]);this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName)!==-1&&(e.removeAttribute("width"),e.removeAttribute("height"));for(var i=e.firstElementChild;i!==null;)this._cleanStyles(i),i=i.nextElementSibling}},_getLinkDensity:function(e){var t=this._getInnerText(e).length;if(t===0)return 0;var i=0;return this._forEachNode(e.getElementsByTagName("a"),function(r){var o=r.getAttribute("href"),n=o&&this.REGEXPS.hashUrl.test(o)?.3:1;i+=this._getInnerText(r).length*n}),i/t},_getClassWeight:function(e){if(!this._flagIsActive(this.FLAG_WEIGHT_CLASSES))return 0;var t=0;return typeof e.className=="string"&&e.className!==""&&(this.REGEXPS.negative.test(e.className)&&(t-=25),this.REGEXPS.positive.test(e.className)&&(t+=25)),typeof e.id=="string"&&e.id!==""&&(this.REGEXPS.negative.test(e.id)&&(t-=25),this.REGEXPS.positive.test(e.id)&&(t+=25)),t},_clean:function(e,t){var i=["object","embed","iframe"].indexOf(t)!==-1;this._removeNodes(this._getAllNodesWithTag(e,[t]),function(r){if(i){for(var o=0;o<r.attributes.length;o++)if(this._allowedVideoRegex.test(r.attributes[o].value))return!1;if(r.tagName==="object"&&this._allowedVideoRegex.test(r.innerHTML))return!1}return!0})},_hasAncestorTag:function(e,t,i,r){i=i||3,t=t.toUpperCase();for(var o=0;e.parentNode;){if(i>0&&o>i)return!1;if(e.parentNode.tagName===t&&(!r||r(e.parentNode)))return!0;e=e.parentNode,o++}return!1},_getRowAndColumnCount:function(e){for(var t=0,i=0,r=e.getElementsByTagName("tr"),o=0;o<r.length;o++){var n=r[o].getAttribute("rowspan")||0;n&&(n=parseInt(n,10)),t+=n||1;for(var a=0,m=r[o].getElementsByTagName("td"),d=0;d<m.length;d++){var f=m[d].getAttribute("colspan")||0;f&&(f=parseInt(f,10)),a+=f||1}i=Math.max(i,a)}return{rows:t,columns:i}},_markDataTables:function(e){for(var t=e.getElementsByTagName("table"),i=0;i<t.length;i++){var r=t[i],o=r.getAttribute("role");if(o=="presentation"){r._readabilityDataTable=!1;continue}var n=r.getAttribute("datatable");if(n=="0"){r._readabilityDataTable=!1;continue}var a=r.getAttribute("summary");if(a){r._readabilityDataTable=!0;continue}var m=r.getElementsByTagName("caption")[0];if(m&&m.childNodes.length>0){r._readabilityDataTable=!0;continue}var d=["col","colgroup","tfoot","thead","th"],f=function(S){return!!r.getElementsByTagName(S)[0]};if(d.some(f)){this.log("Data table because found data-y descendant"),r._readabilityDataTable=!0;continue}if(r.getElementsByTagName("table")[0]){r._readabilityDataTable=!1;continue}var b=this._getRowAndColumnCount(r);if(b.rows>=10||b.columns>4){r._readabilityDataTable=!0;continue}r._readabilityDataTable=b.rows*b.columns>10}},_fixLazyImages:function(e){this._forEachNode(this._getAllNodesWithTag(e,["img","picture","figure"]),function(t){if(t.src&&this.REGEXPS.b64DataUrl.test(t.src)){var i=this.REGEXPS.b64DataUrl.exec(t.src);if(i[1]==="image/svg+xml")return;for(var r=!1,o=0;o<t.attributes.length;o++){var n=t.attributes[o];if(n.name!=="src"&&/\.(jpg|jpeg|png|webp)/i.test(n.value)){r=!0;break}}if(r){var a=t.src.search(/base64\s*/i)+7,m=t.src.length-a;m<133&&t.removeAttribute("src")}}if(!((t.src||t.srcset&&t.srcset!="null")&&t.className.toLowerCase().indexOf("lazy")===-1)){for(var d=0;d<t.attributes.length;d++)if(n=t.attributes[d],!(n.name==="src"||n.name==="srcset"||n.name==="alt")){var f=null;if(/\.(jpg|jpeg|png|webp)\s+\d/.test(n.value)?f="srcset":/^\s*\S+\.(jpg|jpeg|png|webp)\S*\s*$/.test(n.value)&&(f="src"),f){if(t.tagName==="IMG"||t.tagName==="PICTURE")t.setAttribute(f,n.value);else if(t.tagName==="FIGURE"&&!this._getAllNodesWithTag(t,["img","picture"]).length){var b=this._doc.createElement("img");b.setAttribute(f,n.value),t.appendChild(b)}}}}})},_getTextDensity:function(e,t){var i=this._getInnerText(e,!0).length;if(i===0)return 0;var r=0,o=this._getAllNodesWithTag(e,t);return this._forEachNode(o,n=>r+=this._getInnerText(n,!0).length),r/i},_cleanConditionally:function(e,t){this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)&&this._removeNodes(this._getAllNodesWithTag(e,[t]),function(i){var r=function(c){return c._readabilityDataTable},o=t==="ul"||t==="ol";if(!o){var n=0,a=this._getAllNodesWithTag(i,["ul","ol"]);this._forEachNode(a,c=>n+=this._getInnerText(c).length),o=n/this._getInnerText(i).length>.9}if(t==="table"&&r(i)||this._hasAncestorTag(i,"table",-1,r)||this._hasAncestorTag(i,"code"))return!1;var m=this._getClassWeight(i);this.log("Cleaning Conditionally",i);var d=0;if(m+d<0)return!0;if(this._getCharCount(i,",")<10){for(var f=i.getElementsByTagName("p").length,b=i.getElementsByTagName("img").length,S=i.getElementsByTagName("li").length-100,I=i.getElementsByTagName("input").length,x=this._getTextDensity(i,["h1","h2","h3","h4","h5","h6"]),O=0,L=this._getAllNodesWithTag(i,["object","embed","iframe"]),N=0;N<L.length;N++){for(var p=0;p<L[N].attributes.length;p++)if(this._allowedVideoRegex.test(L[N].attributes[p].value))return!1;if(L[N].tagName==="object"&&this._allowedVideoRegex.test(L[N].innerHTML))return!1;O++}var g=this._getLinkDensity(i),l=this._getInnerText(i).length,s=b>1&&f/b<.5&&!this._hasAncestorTag(i,"figure")||!o&&S>f||I>Math.floor(f/3)||!o&&x<.9&&l<25&&(b===0||b>2)&&!this._hasAncestorTag(i,"figure")||!o&&m<25&&g>.2||m>=25&&g>.5||O===1&&l<75||O>1;if(o&&s){for(var h=0;h<i.children.length;h++)if(i.children[h].children.length>1)return s;let c=i.getElementsByTagName("li").length;if(b==c)return!1}return s}return!1})},_cleanMatchedNodes:function(e,t){for(var i=this._getNextNode(e,!0),r=this._getNextNode(e);r&&r!=i;)t.call(this,r,r.className+" "+r.id)?r=this._removeAndGetNext(r):r=this._getNextNode(r)},_cleanHeaders:function(e){let t=this._getAllNodesWithTag(e,["h1","h2"]);this._removeNodes(t,function(i){let r=this._getClassWeight(i)<0;return r&&this.log("Removing header with low class weight:",i),r})},_headerDuplicatesTitle:function(e){if(e.tagName!="H1"&&e.tagName!="H2")return!1;var t=this._getInnerText(e,!1);return this.log("Evaluating similarity of header:",t,this._articleTitle),this._textSimilarity(this._articleTitle,t)>.75},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return(!e.style||e.style.display!="none")&&(!e.style||e.style.visibility!="hidden")&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||e.getAttribute("aria-hidden")!="true"||e.className&&e.className.indexOf&&e.className.indexOf("fallback-image")!==-1)},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._unwrapNoscriptImages(this._doc);var t=this._disableJSONLD?{}:this._getJSONLD(this._doc);this._removeScripts(this._doc),this._prepDocument();var i=this._getArticleMetadata(t);this._articleTitle=i.title;var r=this._grabArticle();if(!r)return null;if(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),!i.excerpt){var o=r.getElementsByTagName("p");o.length>0&&(i.excerpt=o[0].textContent.trim())}var n=r.textContent;return{title:this._articleTitle,byline:i.byline||this._articleByline,dir:this._articleDir,lang:this._articleLang,content:this._serializer(r),textContent:n,length:n.length,excerpt:i.excerpt,siteName:i.siteName||this._articleSiteName,publishedTime:i.publishedTime}}};typeof bi=="object"&&(bi.exports=Ir)});var Mr=we((xs,yi)=>{var Pr={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};function ba(e){return(!e.style||e.style.display!="none")&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||e.getAttribute("aria-hidden")!="true"||e.className&&e.className.indexOf&&e.className.indexOf("fallback-image")!==-1)}function ya(e,t={}){typeof t=="function"&&(t={visibilityChecker:t});var i={minScore:20,minContentLength:140,visibilityChecker:ba};t=Object.assign(i,t);var r=e.querySelectorAll("p, pre, article"),o=e.querySelectorAll("div > br");if(o.length){var n=new Set(r);[].forEach.call(o,function(m){n.add(m.parentNode)}),r=Array.from(n)}var a=0;return[].some.call(r,function(m){if(!t.visibilityChecker(m))return!1;var d=m.className+" "+m.id;if(Pr.unlikelyCandidates.test(d)&&!Pr.okMaybeItsACandidate.test(d)||m.matches("li p"))return!1;var f=m.textContent.trim().length;return f<t.minContentLength?!1:(a+=Math.sqrt(f-t.minContentLength),a>t.minScore)})}typeof yi=="object"&&(yi.exports=ya)});var kr=we((Ls,Or)=>{var Ta=Cr(),Na=Mr();Or.exports={Readability:Ta,isProbablyReaderable:Na}});var Ea={};_n(Ea,{default:()=>Rt});module.exports=wn(Ea);var ge=require("obsidian");var Ji=require("obsidian");async function Kt(e){return{fileContent:await(await(0,Ji.requestUrl)({url:e.href,method:"get"})).arrayBuffer,fileExtension:e.pathname.slice(e.pathname.lastIndexOf(".")+1)}}var ft=require("obsidian");async function et(e,t){t=(0,ft.normalizePath)(t);let i=e.getAbstractFileByPath(t);i&&i instanceof ft.TFolder||await e.createFolder(t)}var rr=require("path");var Zi=He(require("path")),Qi=require("obsidian");function tt(e){try{new URL(e)}catch(t){return!1}return!0}function Jt(e,t){return new URL(e,t).href}function oe(e){return e.replace(/[:#/\\|?*<>"]/g,"")}function dt(e,t){let i=Zi.default.join(e,t);return(0,Qi.normalizePath)(i.replace(/\\/g,"/"))}var Zt=He(ir()),Qt=class{constructor(){this.linksInfo={}}ensureHashGenerated(t,i){this.linksInfo[t.href]||(this.linksInfo[t.href]=Zt.ArrayBuffer.hash(i))}isSame(t,i){let r=Zt.ArrayBuffer.hash(i);return this.linksInfo[t.href]==r}},vt=new Qt;var Sn=/!\[(?<anchor>.*?)\]\((?<link>.+?)\)/g;async function Se(e,t,i){return await Dn(t,Sn,xn(e,i))}function Dn(e,t,i){try{if(typeof i=="function"){let r=[];return String.prototype.replace.call(e,t,function(o,n,a){return r.push(i(o,n,a)),""}),Promise.all(r).then(function(o){return String.prototype.replace.call(e,t,function(){return o.shift()})})}else return Promise.resolve(String.prototype.replace.call(e,t,i))}catch(r){return Promise.reject(r)}}var Rn=5;function xn(e,t){return async function(r,o,n){if(!tt(n))return r;let a=new URL(n);await et(e.vault,t);try{let{fileContent:m,fileExtension:d}=await Kt(a),f=0;for(;f<Rn;)try{let{fileName:b,needWrite:S}=await Cn(e.vault.adapter,t,o,a,m,d);if(S&&b&&await e.vault.createBinary(b,m),b){let I=b.replace(/\s/g,"%20");return`![${o}](${I})`}else return r}catch(b){if(b.message==="File already exists.")f++;else throw b}return r}catch(m){return console.warn("Image processing failed: ",m),r}}}var Ln="media",In=1e3;async function Cn(e,t,i,r,o,n){if(!n)return{fileName:"",needWrite:!1};i||(i=(0,rr.basename)(r.pathname)),i||(i=Ln),i.endsWith(`.${n}`)&&(i=i.slice(0,-1*(n.length+1))),i=oe(i);let a="",m=!0,d=0;for(;!a&&d<In;){let f=d?dt(t,`${i}-${d}.${n}`):dt(t,`${i}.${n}`);if(await e.exists(f,!1)){vt.ensureHashGenerated(r,o);let b=await e.readBinary(f);vt.isSame(r,b)&&(a=f,m=!1)}else a=f;d++}if(!a)throw new Error("Failed to generate file name for media file.");return vt.ensureHashGenerated(r,o),{fileName:a,needWrite:m}}var nr=require("obsidian");function bt(e){throw new nr.Notice("Error occured. Please check console output for detailed information."),e}var ar=require("obsidian");function yt(e){return Tt(new Date,e)}function Tt(e,t){return(0,ar.moment)(e).format(t)}var _={inboxDir:"ReadItLater Inbox",assetsDir:"ReadItLater Inbox/assets",openNewNote:!1,youtubeNoteTitle:"Youtube - %title%",youtubeNote:`[[ReadItLater]] [[Youtube]]
# [%videoTitle%](%videoURL%)
%videoPlayer%`,youtubeEmbedWidth:"560",youtubeEmbedHeight:"315",youtubeUsePrivacyEnhancedEmbed:!0,vimeoNoteTitle:"Vimeo - %title%",vimeoNote:`[[ReadItLater]] [[Vimeo]]
# [%videoTitle%](%videoURL%)
%videoPlayer%`,vimeoEmbedWidth:"560",vimeoEmbedHeight:"315",bilibiliNoteTitle:"Bilibili - %title%",bilibiliNote:`[[ReadItLater]] [[Bilibili]]
# [%videoTitle%](%videoURL%)
%videoPlayer%`,bilibiliEmbedWidth:"560",bilibiliEmbedHeight:"315",twitterNoteTitle:"Tweet from %tweetAuthorName% (%date%)",twitterNote:`[[ReadItLater]] [[Tweet]]
# [%tweetAuthorName%](%tweetURL%)
%tweetContent%`,parseableArticleNoteTitle:"%title%",parsableArticleNote:`[[ReadItLater]] [[Article]]
# [%articleTitle%](%articleURL%)
%articleContent%`,notParseableArticleNoteTitle:"Article %date%",notParsableArticleNote:`[[ReadItLater]] [[Article]]
[%articleURL%](%articleURL%)`,textSnippetNoteTitle:"Note %date%",textSnippetNote:`[[ReadItLater]] [[Textsnippet]]
%content%`,mastodonNoteTitle:"Toot from %tootAuthorName% (%date%)",mastodonNote:`[[ReadItLater]] [[Toot]]
# [%tootAuthorName%](%tootURL%)
> %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%)
> %tootContent%`,stackExchangeNoteTitle:"%title%",stackExchangeNote:`[[ReadItLater]] [[StackExchange]]
# [%questionTitle%](%questionURL%)
Author: [%authorName%](%authorProfileURL%)
%questionContent%
***
%topAnswer%
%answers%`,stackExchangeAnswer:`Answered by: [%authorName%](%authorProfileURL%)
%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 w=require("obsidian");var Nt=class extends w.PluginSettingTab{constructor(t,i){super(t,i),this.plugin=i}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"General"}),new w.Setting(t).setName("Inbox dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.inboxDir||_.inboxDir).onChange(async a=>{this.plugin.settings.inboxDir=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Assets dir").setDesc("Enter valid folder name. For nested folders use this format: Folder A/Folder B. If no folder is entered, new note will be created in vault root.").addText(n=>n.setPlaceholder("Defaults to root").setValue(this.plugin.settings.assetsDir||_.inboxDir+"/assets").onChange(async a=>{this.plugin.settings.assetsDir=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Open new note").setDesc("If enabled, new note will open in current workspace").addToggle(n=>n.setValue(this.plugin.settings.openNewNote||_.openNewNote).onChange(async a=>{this.plugin.settings.openNewNote=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Date format string").setDesc("Format of the %date% variable. NOTE: do not use symbols forbidden in file names.").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD HH-mm-ss").setValue(this.plugin.settings.dateTitleFmt||_.dateTitleFmt).onChange(async a=>{this.plugin.settings.dateTitleFmt=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Date format string in contents").setDesc("Format of the %date% variable for contents").addText(n=>n.setPlaceholder("Defaults to YYYY-MM-DD").setValue(this.plugin.settings.dateContentFmt||_.dateContentFmt).onChange(async a=>{this.plugin.settings.dateContentFmt=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Extend share menu").setDesc("If enabled, share menu will be extended with shortcut to create note directly from it. Requires plugin reload or Obsidian restart to apply change.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"extendShareMenu")?this.plugin.settings.extendShareMenu:_.extendShareMenu).onChange(async a=>{this.plugin.settings.extendShareMenu=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"YouTube"}),new w.Setting(t).setName("Youtube note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.youtubeNoteTitle||_.youtubeNoteTitle).onChange(async a=>{this.plugin.settings.youtubeNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %videoThumbnail%, %channelId%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.youtubeNote||_.youtubeNote).onChange(async a=>{this.plugin.settings.youtubeNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Youtube Data API v3 key").setDesc("If entered, additional template variables are available").addText(n=>n.setPlaceholder("").setValue(this.plugin.settings.youtubeApiKey||_.youtubeApiKey).onChange(async a=>{this.plugin.settings.youtubeApiKey=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube embed player width").addText(n=>n.setPlaceholder(_.youtubeEmbedWidth).setValue(this.plugin.settings.youtubeEmbedWidth||_.youtubeEmbedWidth).onChange(async a=>{this.plugin.settings.youtubeEmbedWidth=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Youtube embed player height").addText(n=>n.setPlaceholder(_.youtubeEmbedHeight).setValue(this.plugin.settings.youtubeEmbedHeight||_.youtubeEmbedHeight).onChange(async a=>{this.plugin.settings.youtubeEmbedHeight=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Embed in privacy enhanced mode").setDesc("If enabled, content will be embeded in privacy enhanced mode, which prevents the use of views of it from influencing the viewer\u2019s browsing experience on YouTube.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"youtubeUsePrivacyEnhancedEmbed")?this.plugin.settings.youtubeUsePrivacyEnhancedEmbed:_.youtubeUsePrivacyEnhancedEmbed).onChange(async a=>{this.plugin.settings.youtubeUsePrivacyEnhancedEmbed=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Vimeo"}),new w.Setting(t).setName("Vimeo note title template").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.vimeoNoteTitle||_.vimeoNoteTitle).onChange(async a=>{this.plugin.settings.vimeoNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Vimeo note template").setDesc("Available variables: %date%, %videoTitle%, %videoURL%, %videoId%, %videoPlayer%, %channelName%, %channelURL%").addTextArea(n=>{n.setValue(this.plugin.settings.vimeoNote||_.vimeoNote).onChange(async a=>{this.plugin.settings.vimeoNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Vimeo embed player width").addText(n=>n.setPlaceholder(_.vimeoEmbedWidth).setValue(this.plugin.settings.vimeoEmbedWidth||_.vimeoEmbedWidth).onChange(async a=>{this.plugin.settings.vimeoEmbedWidth=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Vimeo embed player height").addText(n=>n.setPlaceholder(_.vimeoEmbedHeight).setValue(this.plugin.settings.vimeoEmbedHeight||_.vimeoEmbedHeight).onChange(async a=>{this.plugin.settings.vimeoEmbedHeight=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Bilibili"}),new w.Setting(t).setName("Bilibili note template title").setDesc("Available variables: %title%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.bilibiliNoteTitle||_.bilibiliNoteTitle).onChange(async a=>{this.plugin.settings.bilibiliNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Bilibili note template").setDesc("Available variables: %videoTitle%, %videoURL%, %videoId%, %videoPlayer%").addTextArea(n=>{n.setValue(this.plugin.settings.bilibiliNote||_.bilibiliNote).onChange(async a=>{this.plugin.settings.bilibiliNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Bilibili embed player width").addText(n=>n.setPlaceholder(_.bilibiliEmbedWidth).setValue(this.plugin.settings.bilibiliEmbedWidth||_.bilibiliEmbedWidth).onChange(async a=>{this.plugin.settings.bilibiliEmbedWidth=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Bilibili embed player height").addText(n=>n.setPlaceholder(_.bilibiliEmbedHeight).setValue(this.plugin.settings.bilibiliEmbedHeight||_.bilibiliEmbedHeight).onChange(async a=>{this.plugin.settings.bilibiliEmbedHeight=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Twitter"}),new w.Setting(t).setName("Twitter note template title").setDesc("Available variables: %tweetAuthorName%, %date%").addText(n=>n.setPlaceholder("Defaults to %tweetAuthorName%").setValue(this.plugin.settings.twitterNoteTitle||_.twitterNoteTitle).onChange(async a=>{this.plugin.settings.twitterNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Twitter note template").setDesc("Available variables: %date%, %tweetAuthorName%, %tweetURL%, %tweetContent%").addTextArea(n=>{n.setValue(this.plugin.settings.twitterNote||_.twitterNote).onChange(async a=>{this.plugin.settings.twitterNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"Stack Exchange"}),new w.Setting(t).setName("Stack Exchange note title template").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.stackExchangeNoteTitle||_.stackExchangeNoteTitle).onChange(async a=>{this.plugin.settings.stackExchangeNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Stack Exchange question note template").setDesc("Available variables: %date%, %questionTitle%, %questionURL%, %authorName%, %authorProfileURL%, %questionContent%, %topAnswer%, %answers%").addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeNote||_.stackExchangeNote).onChange(async a=>{this.plugin.settings.stackExchangeNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Stack Exchange answer template").setDesc("Available variables: %date%, %answerContent%, %authorName%, %authorProfileURL%").addTextArea(n=>{n.setValue(this.plugin.settings.stackExchangeAnswer||_.stackExchangeAnswer).onChange(async a=>{this.plugin.settings.stackExchangeAnswer=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Download media attachments").setDesc("If enabled, media attachments are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssets")?this.plugin.settings.downloadStackExchangeAssets:_.downloadStackExchangeAssets).onChange(async a=>{this.plugin.settings.downloadStackExchangeAssets=a,i.setDisabled(!a),await this.plugin.saveSettings()}));let i=new w.Setting(t).setName("Download media attachments to folder").setDesc("If enabled, the media attachments are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadStackExchangeAssetsInDir")?this.plugin.settings.downloadStackExchangeAssetsInDir:_.downloadStackExchangeAssetsInDir).onChange(async a=>{this.plugin.settings.downloadStackExchangeAssetsInDir=a,await this.plugin.saveSettings()}));t.createEl("h2",{text:"Mastodon"}),new w.Setting(t).setName("Mastodon note template title").setDesc("Available variables: %tootAuthorName%, %date%").addText(n=>n.setPlaceholder("Defaults to %tootAuthorName%").setValue(this.plugin.settings.mastodonNoteTitle||_.mastodonNoteTitle).onChange(async a=>{this.plugin.settings.mastodonNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Mastodon note template").setDesc("Available variables: %date%, %tootAuthorName%, %tootURL%, %tootContent%").addTextArea(n=>{n.setValue(this.plugin.settings.mastodonNote||_.mastodonNote).onChange(async a=>{this.plugin.settings.mastodonNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Download media attachments").setDesc("If enabled, media attachments of toot are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachments")?this.plugin.settings.downloadMastodonMediaAttachments:_.downloadMastodonMediaAttachments).onChange(async a=>{this.plugin.settings.downloadMastodonMediaAttachments=a,r.setDisabled(!a),await this.plugin.saveSettings()}));let r=new w.Setting(t).setName("Download media attachments to folder").setDesc("If enabled, the media attachments of toot are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadMastodonMediaAttachmentsInDir")?this.plugin.settings.downloadMastodonMediaAttachmentsInDir:_.downloadMastodonMediaAttachmentsInDir).onChange(async a=>{this.plugin.settings.downloadMastodonMediaAttachmentsInDir=a,await this.plugin.saveSettings()}));new w.Setting(t).setName("Save replies").setDesc("If enabled, replies of toot will be saved.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"saveMastodonReplies")?this.plugin.settings.saveMastodonReplies:_.saveMastodonReplies).onChange(async a=>{this.plugin.settings.saveMastodonReplies=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Mastodon reply template").setDesc("Available variables: %tootAuthorName%, %tootURL%, %tootContent%").addTextArea(n=>{n.setValue(this.plugin.settings.mastodonReply||_.mastodonReply).onChange(async a=>{this.plugin.settings.mastodonReply=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"TikTok"}),new w.Setting(t).setName("TikTok note title template").setDesc("Available variables: %authorName%, %date%").addText(n=>n.setPlaceholder("TikTok from %authorName% (%date%)").setValue(this.plugin.settings.tikTokNoteTitle||_.tikTokNoteTitle).onChange(async a=>{this.plugin.settings.tikTokNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("TikTok note template").setDesc("Available variables: %date%, %videoDescription%, %videoURL%, %videoId%, %videoPlayer%, %authorName%, %authorURL%").addTextArea(n=>{n.setValue(this.plugin.settings.tikTokNote||_.tikTokNote).onChange(async a=>{this.plugin.settings.tikTokNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("TikTok embed player width").addText(n=>n.setPlaceholder(_.tikTokEmbedWidth).setValue(this.plugin.settings.tikTokEmbedWidth||_.tikTokEmbedWidth).onChange(async a=>{this.plugin.settings.tikTokEmbedWidth=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("TikTok embed player height").addText(n=>n.setPlaceholder(_.tikTokEmbedHeight).setValue(this.plugin.settings.tikTokEmbedHeight||_.tikTokEmbedHeight).onChange(async a=>{this.plugin.settings.tikTokEmbedHeight=a,await this.plugin.saveSettings()})),t.createEl("h2",{text:"Readable Article"}),new w.Setting(t).setName("Readable article note template title").setDesc("Available variables: %title%, %date%").addText(n=>n.setPlaceholder("Defaults to %title%").setValue(this.plugin.settings.parseableArticleNoteTitle||_.parseableArticleNoteTitle).onChange(async a=>{this.plugin.settings.parseableArticleNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Readable article note template").setDesc("Available variables: %date%, %articleTitle%, %articleURL%, %articleContent%, %author%, %siteName%, %articleReadingTime%, %previewURL%, %publishedTime%").addTextArea(n=>{n.setValue(this.plugin.settings.parsableArticleNote||_.parsableArticleNote).onChange(async a=>{this.plugin.settings.parsableArticleNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),new w.Setting(t).setName("Download images").setDesc("If enabled, images in article are downloaded to the assets folder (only Desktop App feature)").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImages")?this.plugin.settings.downloadImages:_.downloadImages).onChange(async a=>{this.plugin.settings.downloadImages=a,o.setDisabled(!a),await this.plugin.saveSettings()}));let o=new w.Setting(t).setName("Download images to note folder").setDesc("If enabled, the images in article are stored in their own folder.").addToggle(n=>n.setValue(Object.prototype.hasOwnProperty.call(this.plugin.settings,"downloadImagesInArticleDir")?this.plugin.settings.downloadImagesInArticleDir:_.downloadImagesInArticleDir).onChange(async a=>{this.plugin.settings.downloadImagesInArticleDir=a,await this.plugin.saveSettings()}));t.createEl("h2",{text:"Nonreadable Article"}),new w.Setting(t).setName("Nonreadable article note template title").setDesc("Available variables: %date%").addText(n=>n.setPlaceholder("Defaults to 'Article %date%'").setValue(this.plugin.settings.notParseableArticleNoteTitle||_.notParseableArticleNoteTitle).onChange(async a=>{this.plugin.settings.notParseableArticleNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Nonreadable article note template").setDesc("Available variables: %date%, %articleURL%, %previewURL%").addTextArea(n=>{n.setValue(this.plugin.settings.notParsableArticleNote||_.notParsableArticleNote).onChange(async a=>{this.plugin.settings.notParsableArticleNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25}),t.createEl("h2",{text:"Text Snippet"}),new w.Setting(t).setName("Text snippet note template title").setDesc("Available variables: %date%").addText(n=>n.setPlaceholder("Defaults to 'Note %date%'").setValue(this.plugin.settings.textSnippetNoteTitle||_.textSnippetNoteTitle).onChange(async a=>{this.plugin.settings.textSnippetNoteTitle=a,await this.plugin.saveSettings()})),new w.Setting(t).setName("Text snippet note template").setDesc("Available variables: %date%, %content%").addTextArea(n=>{n.setValue(this.plugin.settings.textSnippetNote||_.textSnippetNote).onChange(async a=>{this.plugin.settings.textSnippetNote=a,await this.plugin.saveSettings()}),n.inputEl.rows=10,n.inputEl.cols=25})}};var Ve=require("obsidian"),At=He(or());var U=class{constructor(t,i){this.fileName=t,this.content=i}};var V=class{constructor(t,i){this.app=t,this.settings=i}isValidUrl(t){try{new URL(t)}catch(i){return!1}return!0}getFormattedDateForFilename(){return yt(this.settings.dateTitleFmt)}getFormattedDateForContent(){return yt(this.settings.dateContentFmt)}};var ti=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(youtube.com|youtu.be)\/(watch|shorts)?(\?v=|\/)?([^&#?]*)/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=this.settings.youtubeApiKey===""?await this.parseSchema(i):await this.parseApiResponse(i),o=this.settings.youtubeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,r.title).replace(/%videoId%/g,r.id).replace(/%videoDescription%/g,r.description).replace(/%videoThumbnail%/g,r.thumbnail).replace(/%videoDuration%/g,r.duration.toString()).replace(/%videoDurationFormatted%/g,r.durationFormatted).replace(/%videoPublishDate%/g,r.pubDate.toString()).replace(/%videoViewsCount%/g,r.viewsCount.toString()).replace(/%videoURL%/g,r.url).replace(/%channelId%/g,r.channel.id).replace(/%channelName%/g,r.channel.name).replace(/%channelURL%/g,r.channel.url).replace(/%videoTags%/g,r.tags.join(" ")).replace(/%videoPlayer%/g,r.player),a=`${this.settings.youtubeNoteTitle.replace(/%title%/g,r.title).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(a,o)}async parseApiResponse(i){var o,n,a,m,d,f,b,S,I,x;let r=this.PATTERN.exec(i)[4];try{let O=await(0,Ve.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,statistics,status,topicDetails&id=${r}&key=${this.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),L=JSON.parse(O);if(L.items.length===0)throw new Error(`Video (${i}) cannot be fetched from API`);let N=L.items[0],p=await(0,Ve.request)({method:"GET",url:`https://www.googleapis.com/youtube/v3/channels?part=snippet,contentDetails,statistics&id=${N.snippet.channelId}&key=${this.settings.youtubeApiKey}`,headers:{Accept:"application/json"}}),g=JSON.parse(p);if(g.items.length===0)throw new Error(`Channel (${N.snippet.channelId}) cannot be fetched from API`);let l=g.items[0],s=(0,At.parse)(N.contentDetails.duration);return{id:N.id,url:i,title:N.snippet.title,description:N.snippet.description,thumbnail:(I=(S=(d=(n=(o=N.snippet.thumbnails)==null?void 0:o.maxres)==null?void 0:n.url)!=null?d:(m=(a=N.snippet.thumbnails)==null?void 0:a.medium)==null?void 0:m.url)!=null?S:(b=(f=N.snippet.thumbnails)==null?void 0:f.default)==null?void 0:b.url)!=null?I:"",player:this.getEmbedPlayer(N.id),duration:(0,At.toSeconds)(s),durationFormatted:this.formatDuration(s),pubDate:(0,Ve.moment)(N.snippet.publishedAt).format(this.settings.dateContentFmt),viewsCount:N.statistics.viewCount,tags:Object.prototype.hasOwnProperty.call(N,"tags")?N.snippet.tags.map(h=>h.replace(/[\s:\-_.]/g,"").replace(/^/,"#")):[],channel:{id:l.id,url:`https://www.youtube.com/channel/${l.id}`,name:(x=l.snippet.title)!=null?x:""}}}catch(O){bt(O)}}async parseSchema(i){var r,o,n,a,m,d,f,b,S,I,x,O;try{let L=await(0,Ve.request)({method:"GET",url:i,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"}}),N=new DOMParser().parseFromString(L,"text/html"),p=N.querySelector('[itemtype="http://schema.org/VideoObject"]'),g=(o=(r=p==null?void 0:p.querySelector('[itemprop="identifier"]'))==null?void 0:r.getAttribute("content"))!=null?o:"",l=p.querySelector('[itemtype="http://schema.org/Person"]');return{id:g,url:i,title:(a=(n=p==null?void 0:p.querySelector('[itemprop="name"]'))==null?void 0:n.getAttribute("content"))!=null?a:"",description:"",thumbnail:(d=(m=N.querySelector('meta[property="og:image"]'))==null?void 0:m.getAttribute("content"))!=null?d:"",player:this.getEmbedPlayer(g),duration:0,durationFormatted:"",pubDate:"",viewsCount:0,tags:[],channel:{id:(b=(f=p==null?void 0:p.querySelector('[itemprop="channelId"'))==null?void 0:f.getAttribute("content"))!=null?b:"",url:(I=(S=l==null?void 0:l.querySelector('[itemprop="url"]'))==null?void 0:S.getAttribute("href"))!=null?I:"",name:(O=(x=l==null?void 0:l.querySelector('[itemprop="name"]'))==null?void 0:x.getAttribute("content"))!=null?O:""}}}catch(L){bt(L)}}formatDuration(i){let r="";return i.years>0&&(r=r.concat(" ",`${i.years}y`)),i.months>0&&(r=r.concat(" ",`${i.months}m`)),i.weeks>0&&(r=r.concat(" ",`${i.weeks}w`)),i.days>0&&(r=r.concat(" ",`${i.days}d`)),i.hours>0&&(r=r.concat(" ",`${i.hours}h`)),i.minutes>0&&(r=r.concat(" ",`${i.minutes}m`)),i.seconds>0&&(r=r.concat(" ",`${i.seconds}s`)),r.trim()}getEmbedPlayer(i){let r=this.settings.youtubeUsePrivacyEnhancedEmbed?"youtube-nocookie.com":"youtube.com";return`<iframe width="${this.settings.youtubeEmbedWidth}" height="${this.settings.youtubeEmbedHeight}" src="https://www.${r}/embed/${i}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`}},lr=ti;var cr=require("obsidian");var ii=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(vimeo.com)\/(\d+)?/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await this.parseSchema(i),o=this.settings.vimeoNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,r.title).replace(/%videoId%/g,r.id).replace(/%videoURL%/g,r.url).replace(/%channelName%/g,r.channel.name).replace(/%channelURL%/g,r.channel.url).replace(/%videoPlayer%/g,r.player),a=`${this.settings.vimeoNoteTitle.replace(/%title%/g,r.title).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(a,o)}async parseSchema(i){var f,b,S,I,x,O;let r=await(0,cr.request)({method:"GET",url:i,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"}}),n=new DOMParser().parseFromString(r,"text/html").querySelector('script[type="application/ld+json"]'),m=JSON.parse(n.textContent)[0],d=this.PATTERN.exec(i);return{id:d.length===3?d[2]:"",url:(f=m==null?void 0:m.url)!=null?f:"",title:(b=m==null?void 0:m.name)!=null?b:"",player:`<iframe width="${this.settings.vimeoEmbedWidth}" height="${this.settings.vimeoEmbedHeight}" src="${m==null?void 0:m.embedUrl}" title="Vimeo video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,channel:{name:(I=(S=m==null?void 0:m.author)==null?void 0:S.name)!=null?I:"",url:(O=(x=m==null?void 0:m.author)==null?void 0:x.url)!=null?O:""}}}},ur=ii;var hr=require("obsidian");var ri=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(bilibili.com)\/(video)?\/([a-z0-9]+)?/i}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await(0,hr.request)({method:"GET",url:i,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(r,"text/html").querySelector("[property~='og:title']").getAttribute("content"),a=this.PATTERN.exec(i)[3],m=`<iframe width="${this.settings.bilibiliEmbedWidth}" height="${this.settings.bilibiliEmbedHeight}" src="https://player.bilibili.com/player.html?autoplay=0&bvid=${a}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`,d=this.settings.bilibiliNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoTitle%/g,n).replace(/%videoURL%/g,i).replace(/%videoId%/g,a).replace(/%videoPlayer%/g,m),b=`${this.settings.bilibiliNoteTitle.replace(/%title%/g,n).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(b,d)}},gr=ri;var wt=require("obsidian");function Hn(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}function oi(e,t){return Array(t+1).join(e)}function Gn(e){return e.replace(/^\n*/,"")}function Vn(e){for(var t=e.length;t>0&&e[t-1]===`
`;)t--;return e.substring(0,t)}var Wn=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function li(e){return ci(e,Wn)}var fr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function dr(e){return ci(e,fr)}function $n(e){return br(e,fr)}var vr=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function zn(e){return ci(e,vr)}function qn(e){return br(e,vr)}function ci(e,t){return t.indexOf(e.nodeName)>=0}function br(e,t){return e.getElementsByTagName&&t.some(function(i){return e.getElementsByTagName(i).length})}var Z={};Z.paragraph={filter:"p",replacement:function(e){return`
`+e+`
`}};Z.lineBreak={filter:"br",replacement:function(e,t,i){return i.br+`
`}};Z.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,i){var r=Number(t.nodeName.charAt(1));if(i.headingStyle==="setext"&&r<3){var o=oi(r===1?"=":"-",e.length);return`
`+e+`
`+o+`
`}else return`
`+oi("#",r)+" "+e+`
`}};Z.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
`+e+`
`}};Z.list={filter:["ul","ol"],replacement:function(e,t){var i=t.parentNode;return i.nodeName==="LI"&&i.lastElementChild===t?`
`+e:`
`+e+`
`}};Z.listItem={filter:"li",replacement:function(e,t,i){e=e.replace(/^\n+/,"").replace(/\n+$/,`
`).replace(/\n/gm,`
`);var r=i.bulletListMarker+" ",o=t.parentNode;if(o.nodeName==="OL"){var n=o.getAttribute("start"),a=Array.prototype.indexOf.call(o.children,t);r=(n?Number(n)+a:a+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
`:"")}};Z.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,i){return`
`+t.firstChild.textContent.replace(/\n/g,`
`)+`
`}};Z.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,i){for(var r=t.firstChild.getAttribute("class")||"",o=(r.match(/language-(\S+)/)||[null,""])[1],n=t.firstChild.textContent,a=i.fence.charAt(0),m=3,d=new RegExp("^"+a+"{3,}","gm"),f;f=d.exec(n);)f[0].length>=m&&(m=f[0].length+1);var b=oi(a,m);return`
`+b+o+`
`+n.replace(/\n$/,"")+`
`+b+`
`}};Z.horizontalRule={filter:"hr",replacement:function(e,t,i){return`
`+i.hr+`
`}};Z.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var i=t.getAttribute("href");i&&(i=i.replace(/([()])/g,"\\$1"));var r=Et(t.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+e+"]("+i+r+")"}};Z.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,i){var r=t.getAttribute("href"),o=Et(t.getAttribute("title"));o&&(o=' "'+o+'"');var n,a;switch(i.linkReferenceStyle){case"collapsed":n="["+e+"][]",a="["+e+"]: "+r+o;break;case"shortcut":n="["+e+"]",a="["+e+"]: "+r+o;break;default:var m=this.references.length+1;n="["+e+"]["+m+"]",a="["+m+"]: "+r+o}return this.references.push(a),n},references:[],append:function(e){var t="";return this.references.length&&(t=`
`+this.references.join(`
`)+`
`,this.references=[]),t}};Z.emphasis={filter:["em","i"],replacement:function(e,t,i){return e.trim()?i.emDelimiter+e+i.emDelimiter:""}};Z.strong={filter:["strong","b"],replacement:function(e,t,i){return e.trim()?i.strongDelimiter+e+i.strongDelimiter:""}};Z.code={filter:function(e){var t=e.previousSibling||e.nextSibling,i=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!i},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",i="`",r=e.match(/`+/gm)||[];r.indexOf(i)!==-1;)i=i+"`";return i+t+e+t+i}};Z.image={filter:"img",replacement:function(e,t){var i=Et(t.getAttribute("alt")),r=t.getAttribute("src")||"",o=Et(t.getAttribute("title")),n=o?' "'+o+'"':"";return r?"!["+i+"]("+r+n+")":""}};function Et(e){return e?e.replace(/(\n+\s*)+/g,`
`):""}function yr(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}yr.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ni(this.array,e,this.options))||(t=ni(this._keep,e,this.options))||(t=ni(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ni(e,t,i){for(var r=0;r<e.length;r++){var o=e[r];if(jn(o,t,i))return o}}function jn(e,t,i){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,i))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Yn(e){var t=e.element,i=e.isBlock,r=e.isVoid,o=e.isPre||function(S){return S.nodeName==="PRE"};if(!(!t.firstChild||o(t))){for(var n=null,a=!1,m=null,d=pr(m,t,o);d!==t;){if(d.nodeType===3||d.nodeType===4){var f=d.data.replace(/[ \r\n\t]+/g," ");if((!n||/ $/.test(n.data))&&!a&&f[0]===" "&&(f=f.substr(1)),!f){d=ai(d);continue}d.data=f,n=d}else if(d.nodeType===1)i(d)||d.nodeName==="BR"?(n&&(n.data=n.data.replace(/ $/,"")),n=null,a=!1):r(d)||o(d)?(n=null,a=!0):n&&(a=!1);else{d=ai(d);continue}var b=pr(m,d,o);m=d,d=b}n&&(n.data=n.data.replace(/ $/,""),n.data||ai(n))}}function ai(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function pr(e,t,i){return e&&e.parentNode===t||i(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var ui=typeof window!="undefined"?window:{};function Xn(){var e=ui.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch(i){}return t}function Kn(){var e=function(){};return Jn()?e.prototype.parseFromString=function(t){var i=new window.ActiveXObject("htmlfile");return i.designMode="on",i.open(),i.write(t),i.close(),i}:e.prototype.parseFromString=function(t){var i=document.implementation.createHTMLDocument("");return i.open(),i.write(t),i.close(),i},e}function Jn(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch(t){ui.ActiveXObject&&(e=!0)}return e}var Zn=Xn()?ui.DOMParser:Kn();function Qn(e,t){var i;if(typeof e=="string"){var r=ea().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");i=r.getElementById("turndown-root")}else i=e.cloneNode(!0);return Yn({element:i,isBlock:li,isVoid:dr,isPre:t.preformattedCode?ta:null}),i}var si;function ea(){return si=si||new Zn,si}function ta(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function ia(e,t){return e.isBlock=li(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=ra(e),e.flankingWhitespace=na(e,t),e}function ra(e){return!dr(e)&&!zn(e)&&/^\s*$/i.test(e.textContent)&&!$n(e)&&!qn(e)}function na(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var i=aa(e.textContent);return i.leadingAscii&&mr("left",e,t)&&(i.leading=i.leadingNonAscii),i.trailingAscii&&mr("right",e,t)&&(i.trailing=i.trailingNonAscii),{leading:i.leading,trailing:i.trailing}}function aa(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function mr(e,t,i){var r,o,n;return e==="left"?(r=t.previousSibling,o=/ $/):(r=t.nextSibling,o=/^ /),r&&(r.nodeType===3?n=o.test(r.nodeValue):i.preformattedCode&&r.nodeName==="CODE"?n=!1:r.nodeType===1&&!li(r)&&(n=o.test(r.textContent))),n}var sa=Array.prototype.reduce,oa=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function _t(e){if(!(this instanceof _t))return new _t(e);var t={rules:Z,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(i,r){return r.isBlock?`
`:""},keepReplacement:function(i,r){return r.isBlock?`
`+r.outerHTML+`
`:r.outerHTML},defaultReplacement:function(i,r){return r.isBlock?`
`+i+`
`:i}};this.options=Hn({},t,e),this.rules=new yr(this.options)}_t.prototype={turndown:function(e){if(!ua(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Tr.call(this,new Qn(e,this.options));return la.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return oa.reduce(function(t,i){return t.replace(i[0],i[1])},e)}};function Tr(e){var t=this;return sa.call(e.childNodes,function(i,r){r=new ia(r,t.options);var o="";return r.nodeType===3?o=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(o=ca.call(t,r)),Nr(i,o)},"")}function la(e){var t=this;return this.rules.forEach(function(i){typeof i.append=="function"&&(e=Nr(e,i.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function ca(e){var t=this.rules.forNode(e),i=Tr.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(i=i.trim()),r.leading+t.replacement(i,e,this.options)+r.trailing}function Nr(e,t){var i=Vn(e),r=Gn(t),o=Math.max(e.length-i.length,t.length-r.length),n=`
`.substring(0,o);return i+n+r}function ua(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var Ar=_t;var Er=/highlight-(?:text|source)-([a-z0-9]+)/;function ha(e){e.addRule("highlightedCodeBlock",{filter:function(t){var i=t.firstChild;return t.nodeName==="DIV"&&Er.test(t.className)&&i&&i.nodeName==="PRE"},replacement:function(t,i,r){var o=i.className||"",n=(o.match(Er)||[null,""])[1];return`
`+r.fence+n+`
`+i.firstChild.textContent+`
`+r.fence+`
`}})}function ga(e){e.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(t){return"~"+t+"~"}})}var pa=Array.prototype.indexOf,De={};De.tableCell={filter:["th","td"],replacement:function(e,t){return _r(e,t)+wr(t,"")}};De.tableRow={filter:"tr",replacement:function(e,t){var i="",r={left:":--",right:"--:",center:":-:"};if(ma(t))for(var o=0;o<t.childNodes.length;o++){var n="---",a=(t.childNodes[o].getAttribute("align")||"").toLowerCase();a&&(n=r[a]||n),i+=_r(n,t.childNodes[o])+wr(t.childNodes[o],n)}return`
`+e+(i?`
`+i:"")}};De.table={filter:function(e){return e.nodeName==="TABLE"&&!Sr(e)},replacement:function(e){return e=e.replace(`
`,`
`),`
`+e+`
`}};De.tableSection={filter:["thead","tbody","tfoot"],replacement:function(e){return e}};De.captionSection={filter:"caption",replacement:function(e,t){return t.parentNode.nodeName==="TABLE"&&t.parentNode.childNodes[0]===t?e:""}};function ma(e){var t=e.parentNode,i=t;return(t.nodeName==="THEAD"||t.nodeName==="TFOOT"||t.nodeName==="TBODY")&&(i=t.parentNode),i.nodeName==="TABLE"&&i.rows[0]===e}function _r(e,t){var i=pa.call(t.parentNode.childNodes,t),r=" ";return i===0&&(r="| "),e=e.replace(/\r\n/g,`
`).replace(/\n/g," "),e=e.replace(/\|/g,"\\|"),r+e+" |"}function wr(e,t){var i=e.getAttribute("colspan")||1;return i<=1?"":(" "+t+" |").repeat(i-1)}function Sr(e){for(var t=e.parentNode;t;){if(t.nodeName==="TABLE")return!0;t=t.parentNode}return!1}function fa(e){e.keep(function(i){return i.nodeName==="TABLE"&&Sr(i)});for(var t in De)e.addRule(t,De[t])}function da(e){e.addRule("taskListItems",{filter:function(t){return t.type==="checkbox"&&t.parentNode.nodeName==="LI"},replacement:function(t,i){return(i.checked?"[x]":"[ ]")+" "}})}function Dr(e){e.use([ha,ga,fa,da])}async function ve(e){let t=Dr,i=new Ar({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*"});return i.use(t),i.turndown(e)}var hi=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(https:\/\/(twitter|x).com\/([a-zA-Z0-9_]+\/)([a-zA-Z0-9_]+\/[a-zA-Z0-9_]+))/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=new URL(i);r.hostname==="x.com"&&(r.hostname="twitter.com");let o=JSON.parse(await(0,wt.request)({method:"GET",contentType:"application/json",url:`https://publish.twitter.com/oembed?url=${r.href}`})),n=o.author_name,a=await ve(o.html),m=this.settings.twitterNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tweetAuthorName%/g,n).replace(/%tweetURL%/g,o.url).replace(/%tweetContent%/g,a).replace(/%tweetPublishDate%/g,this.getPublishedDateFromDOM(o.html)),f=`${this.settings.twitterNoteTitle.replace(/%tweetAuthorName%/g,n).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(f,m)}getPublishedDateFromDOM(i){let o=new DOMParser().parseFromString(i,"text/html").querySelector("blockquote > a"),n=(0,wt.moment)(o.textContent);return n.isValid()?n.format(this.settings.dateContentFmt):""}},Rr=hi;var St=require("obsidian"),di=He(fi());var vi=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(https:\/\/|http:\/\/)(stackoverflow\.com|serverfault\.com|superuser\.com|askubuntu\.com|stackapps\.com|.*\.stackexchange\.com)\/(q|a|questions)\/(\d+)/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await(0,St.request)({method:"GET",url:i}),o=new DOMParser().parseFromString(r,"text/html"),n=await this.parseDocument(o),a=this.settings.stackExchangeNoteTitle.replace(/%title%/g,n.title).replace(/%date%/g,this.getFormattedDateForFilename()),m=n.topAnswer?this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,n.topAnswer.content).replace(/%authorName%/g,n.topAnswer.author.name).replace(/%authorProfileURL%/g,n.topAnswer.author.profile):"",d="";for(let I=0;I<n.answers.length;I++){let x=this.settings.stackExchangeAnswer.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%answerContent%/g,n.answers[I].content).replace(/%authorName%/g,n.answers[I].author.name).replace(/%authorProfileURL%/g,n.answers[I].author.profile);d=d.concat(`
***
`,x)}let f=this.settings.stackExchangeNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%questionTitle%/g,n.title).replace(/%questionURL%/g,n.url).replace(/%questionContent%/g,n.content).replace(/%authorName%/g,n.author.name).replace(/%authorProfileURL%/g,n.author.profile).replace(/%topAnswer%/g,m).replace(/%answers%/g,d.trim()),b=this.settings.downloadStackExchangeAssetsInDir?`${this.settings.assetsDir}/${oe(a)}/`:this.settings.assetsDir;this.settings.downloadStackExchangeAssets&&St.Platform.isDesktop&&(f=await Se(app,f,b));let S=`${a}.md`;return new U(S,f)}async parseDocument(i){var a,m,d,f,b,S,I,x,O,L,N,p,g,l,s,h;let r;try{r=new URL((d=(a=i.querySelector('link[rel="canonical"]'))==null?void 0:a.getAttribute("href"))!=null?d:(m=i.querySelector('meta[property="og:url"]'))==null?void 0:m.getAttribute("content"))}catch(c){r=null}let o=i.querySelector('#question [itemprop="author"]'),n=[];for(let c of i.querySelectorAll(".answer")){let P=c.querySelector('[itemprop="author"]');n.push({content:await ve(di.sanitize((f=c.querySelector('[itemprop="text"]'))!=null?f:"")),author:{name:(S=(b=P==null?void 0:P.querySelector('[itemprop="name"]'))==null?void 0:b.textContent)!=null?S:"",profile:P instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(x=(I=P.querySelector("a"))==null?void 0:I.getAttribute("href"))!=null?x:""):""}})}return{title:(L=(O=i.querySelector('#question-header [itemprop="name"]'))==null?void 0:O.textContent)!=null?L:"",content:await ve(di.sanitize((N=i.querySelector('#question [itemprop="text"]'))!=null?N:"")),url:(p=r==null?void 0:r.href)!=null?p:"",topAnswer:n.slice(0,1).shift(),answers:n.slice(1),author:{name:(l=(g=o==null?void 0:o.querySelector('[itemprop="name"]'))==null?void 0:g.textContent)!=null?l:"",profile:o instanceof Element&&r instanceof URL?String.prototype.concat(r.origin,(h=(s=o.querySelector("a"))==null?void 0:s.getAttribute("href"))!=null?h:""):""}}}},Lr=vi;var Re=require("obsidian"),Dt=He(kr()),Fr=He(fi());var Ti=class extends V{constructor(t,i){super(t,i)}test(t){return this.isValidUrl(t)}async prepareNote(t){var S,I;let i=new URL(t),r=await(0,Re.request)({method:"GET",url:i.href}),o=new DOMParser().parseFromString(r,"text/html"),n=o.getElementsByTagName("base"),a=null;n.length>0&&(a=n.item(0).getAttribute("href"),Array.from(n).forEach(x=>{x.remove()}));let m=o.createElement("base");m.setAttribute("href",Jt(a!=null?a:i.href,i.origin)),o.head.append(m);let d=Fr.sanitize(o.body.innerHTML);o.body.innerHTML=d,(S=o.body.querySelectorAll("pre br"))==null||S.forEach(x=>{x.outerHTML="<br-keep></br-keep>"}),(I=o.body.querySelectorAll("h1, h2, h3, h4, h5, h6"))==null||I.forEach(x=>{x.className=""}),(0,Dt.isProbablyReaderable)(o)||new Re.Notice("@mozilla/readability considers this document to unlikely be readerable.");let f=this.extractPreviewUrl(o),b=new Dt.Readability(o).parse();return Object.prototype.hasOwnProperty.call(b,"content")||this.notParsableArticle(i.href,f),this.parsableArticle({url:i.href,previewImageUrl:f,...b})}async parsableArticle(t){let i=t.title||"No title",r=await ve(t.content),o=t.publishedTime!==null?Tt(t.publishedTime,this.settings.dateContentFmt):"",n=this.settings.parseableArticleNoteTitle.replace(/%title%/g,i).replace(/%date%/g,this.getFormattedDateForFilename()),a=this.settings.parsableArticleNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%articleTitle%/g,i).replace(/%articleURL%/g,t.url).replace(/%articleReadingTime%/g,`${this.getEstimatedReadingTime(t)}`).replace(/%articleContent%/g,r).replace(/%siteName%/g,t.siteName||"").replace(/%author%/g,t.byline||"").replace(/%previewURL%/g,t.previewImageUrl||"").replace(/%publishedTime%/g,o);return this.settings.downloadImages&&Re.Platform.isDesktop&&(a=await this.replaceImages(n,a)),new U(`${n}.md`,a)}async notParsableArticle(t,i){console.error("Website not parseable");let r=this.settings.notParsableArticleNote.replace(/%articleURL%/g,t).replace(/%previewURL%/g,i||""),o=this.settings.notParseableArticleNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename());return this.settings.downloadImages&&Re.Platform.isDesktop&&(r=await this.replaceImages(o,r)),new U(`${o}.md`,r)}getEstimatedReadingTime(t){let i=this.getReadingSpeed(t.lang||"en"),r=t.textContent.trim().split(/\s+/).length;return Math.ceil(r/i)}getReadingSpeed(t){let i=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",199],["tr",166],["zh",158]]);return i.get(t)||i.get("en")}extractPreviewUrl(t){let i=t.querySelector('meta[property="og:image"]');return i==null&&(i=t.querySelector('meta[name="twitter:image"]')),i==null?void 0:i.getAttribute("content")}async replaceImages(t,i){let r=this.settings.downloadImagesInArticleDir?`${this.settings.assetsDir}/${oe(t)}/`:this.settings.assetsDir;return Se(this.app,i,r)}},Ur=Ti;var Ni=class extends V{constructor(t,i){super(t,i)}test(){return!0}async prepareNote(t){let r=`${this.settings.textSnippetNoteTitle.replace(/%date%/g,this.getFormattedDateForFilename())}.md`,o=this.settings.textSnippetNote.replace(/%content%/g,t).replace(/%date%/g,this.getFormattedDateForContent());return new U(r,o)}},Br=Ni;var We=require("obsidian");var Ai={INSTANCE:"/api/v2/instance",OEMBED:"/api/oembed",STATUS:"/api/v1/statuses",CONTEXT:"/api/v1/statuses/%id%/context"},Ei=class extends V{constructor(t,i){super(t,i)}async test(t){return tt(t)&&await this.testIsMastodon(t)}async prepareNote(t){let i=new URL(t),r=i.pathname.split("/")[2],o=await this.loadStatus(i.hostname,r),n=this.settings.mastodonNoteTitle.replace(/%tootAuthorName%/g,o.account.display_name).replace(/%date%/g,this.getFormattedDateForFilename()),a=this.settings.downloadMastodonMediaAttachmentsInDir?`${this.settings.assetsDir}/${oe(n)}/`:this.settings.assetsDir,m=await this.parseStatus(o,a);if(this.settings.saveMastodonReplies){let b=await this.loadReplies(i.hostname,r);for(let S=0;S<b.length;S++){let I=await this.parseStatus(b[S],a),x=this.settings.mastodonReply.replace(/%tootAuthorName%/g,b[S].account.display_name).replace(/%tootURL%/g,b[S].url).replace(/%tootContent%/g,I);m=m.concat(`
***
`,x)}}let d=this.settings.mastodonNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%tootAuthorName%/g,o.account.display_name).replace(/%tootURL%/g,o.url).replace(/%tootContent%/g,m),f=`${n}.md`;return new U(f,d)}async loadStatus(t,i){return JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:`https://${t}${Ai.STATUS}/${i}`}))}async loadReplies(t,i){let r=String.prototype.concat.call("https://",t,String.prototype.replace.call(Ai.CONTEXT,"%id%",i));return JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:r})).descendants}async parseStatus(t,i){let r=await ve(t.content),o=this.settings.downloadMastodonMediaAttachments&&We.Platform.isDesktop?await Se(app,this.prepareMedia(t.media_attachments),i):this.prepareMedia(t.media_attachments);return r.concat(o)}prepareMedia(t){return t.reduce((i,{url:r,description:o})=>{let n=o?`
> *${o}*`:"";return`${i}
![](${r})${n}`},"")}async testIsMastodon(t){if(!t)return!1;let i=new URL(t).hostname;try{let r=JSON.parse(await(0,We.request)({method:"GET",contentType:"application/json",url:`https://${i}${Ai.INSTANCE}`}));return(r==null?void 0:r.domain)===i}catch(r){return!1}}},Hr=Ei;var Gr=require("obsidian");var _i=class extends V{constructor(i,r){super(i,r);this.PATTERN=/(tiktok.com)\/(\S+)\/(video)\/(\d+)/}test(i){return this.isValidUrl(i)&&this.PATTERN.test(i)}async prepareNote(i){let r=await this.parseHtml(i),o=this.settings.tikTokNote.replace(/%date%/g,this.getFormattedDateForContent()).replace(/%videoDescription%/g,r.description).replace(/%videoId%/g,r.id).replace(/%videoURL%/g,r.url).replace(/%authorName%/g,r.author.name).replace(/%authorURL%/g,r.author.url).replace(/%videoPlayer%/g,r.player),a=`${this.settings.tikTokNoteTitle.replace(/%authorName%/g,r.author.name).replace(/%date%/g,this.getFormattedDateForFilename())}.md`;return new U(a,o)}async parseHtml(i){var a,m,d,f;let r=await(0,Gr.request)({method:"GET",url:i,headers:{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"}}),o=new DOMParser().parseFromString(r,"text/html"),n=this.PATTERN.exec(i);return{id:n[4],url:(m=(a=o.querySelector('meta[property="og:url"]'))==null?void 0:a.getAttribute("content"))!=null?m:i,description:(f=(d=o.querySelector('meta[property="og:description"]'))==null?void 0:d.getAttribute("content"))!=null?f:"",player:`<iframe width="${this.settings.tikTokEmbedWidth}" height="${this.settings.tikTokEmbedHeight}" src="https://www.tiktok.com/embed/v2/${n[4]}"></iframe>`,author:{name:n[2],url:`https://www.tiktok.com/${n[2]}`}}}},Vr=_i;var it=class{constructor(t){this.parsers=t}async createParser(t){for(let i of this.parsers)if(await i.test(t))return i}};var Rt=class extends ge.Plugin{async onload(){await this.loadSettings(),this.parserCreator=new it([new lr(this.app,this.settings),new ur(this.app,this.settings),new gr(this.app,this.settings),new Rr(this.app,this.settings),new Lr(this.app,this.settings),new Hr(this.app,this.settings),new Vr(this.app,this.settings),new Ur(this.app,this.settings),new Br(this.app,this.settings)]),(0,ge.addIcon)("read-it-later",Aa),this.addRibbonIcon("read-it-later","ReadItLater: Save clipboard",async()=>{await this.processClipboard()}),this.addCommand({id:"save-clipboard-to-notice",name:"Save clipboard",callback:async()=>{await this.processClipboard()}}),this.addSettingTab(new Nt(this.app,this)),this.settings.extendShareMenu&&this.registerEvent(this.app.workspace.on("receive-text-menu",(t,i)=>{t.addItem(r=>{r.setTitle("ReadItLater"),r.setIcon("read-it-later"),r.onClick(()=>this.processContent(i))})}))}async loadSettings(){this.settings=Object.assign({},_,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async processClipboard(){let t=await navigator.clipboard.readText(),r=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(r.fileName,r.content)}async processContent(t){let r=await(await this.parserCreator.createParser(t)).prepareNote(t);await this.writeFile(r.fileName,r.content)}async writeFile(t,i){let r;if(t=oe(t),await et(this.app.vault,this.settings.inboxDir),this.settings.inboxDir?r=(0,ge.normalizePath)(`${this.settings.inboxDir}/${t}`):r=(0,ge.normalizePath)(`/${t}`),await this.app.vault.adapter.exists(r))new ge.Notice(`${t} already exists!`);else{let o=await this.app.vault.create(r,i);this.settings.openNewNote&&this.app.workspace.getLeaf(!1).openFile(o),new ge.Notice(`${t} created successful`)}}},Aa=`
<svg fill="currentColor" stroke="currentColor" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<g>
<path d="m365.9,144.9c-12.3,0-24.2,1.8-35.4,5.2v-114.7h-96.9l7.3-35.4h-150.2l6.8,35.4h-97.5v454.6h330.5v-102.1c11.2,3.4 23.1,5.2 35.4,5.2 68.8-0.1 124.1-56.4 124.1-124.1 0-67.8-55.3-124.1-124.1-124.1zm-150.1-124l-10.4,50h-79.2l-9.4-50h99zm93.8,448.2h-288.7v-412.8h80.7l6.8,35.4h113.6l7.3-35.4h80.3v102.2c-27.3,14-48.8,37.9-59.7,66.7h-200.9v20.8h195c-1.4,7.4-2.2,15.1-2.2,22.9 0,13.4 2.2,26.4 6.2,38.6h-199v20.9h208.1c12,21.8 30.3,39.7 52.5,51.1v89.6zm56.3-98c-57.3,0-103.2-46.9-103.2-103.2s46.9-103.2 103.2-103.2c57.3,0 103.2,46.9 103.2,103.2s-45.8,103.2-103.2,103.2z"/>
<polygon points="426.4,223.1 346.1,303.4 313.8,271.1 299.2,285.7 346.1,332.6 441,237.7 "/>
<rect width="233.5" x="49" y="143.9" height="20.9"/>
<rect width="233.5" x="49" y="388.9" height="20.9"/>
</g>
</svg>`;
/*! Bundled license information:
dompurify/dist/purify.js:
(*! @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 *)
*/