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

166 lines
124 KiB

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