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.

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