/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var Mi=Object.create;var ft=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var _t=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Rn=(e,n)=>{for(var t in n)ft(e,t,{get:n[t],enumerable:!0})},Vn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Ui(n))!Ni.call(e,i)&&i!==t&&ft(e,i,{get:()=>n[i],enumerable:!(r=_i(n,i))||r.enumerable});return e};var ht=(e,n,t)=>(t=e!=null?Mi(vi(e)):{},Vn(n||!e||!e.__esModule?ft(t,"default",{value:e,enumerable:!0}):t,e)),ji=e=>Vn(ft({},"__esModule",{value:!0}),e);var _n=_t((la,Ut)=>{(function(){var e;typeof Ut!="undefined"?e=Ut.exports=r:e=function(){return this||(0,eval)("this")}(),e.format=r,e.vsprintf=t,typeof console!="undefined"&&typeof console.log=="function"&&(e.printf=n);function n(){console.log(r.apply(null,arguments))}function t(i,u){return r.apply(null,[i].concat(u))}function r(i){for(var u=1,o=[].slice.call(arguments),a=0,s=i.length,l="",c,p=!1,m,f,S=!1,A,k=function(){return o[u++]},F=function(){for(var w="";/\d/.test(i[a]);)w+=i[a++],c=i[a];return w.length>0?parseInt(w):null};a{Rr.exports=function(n){return n!=null&&n.constructor!=null&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}});var Hr=_t((sf,qr)=>{"use strict";var Dt=Object.prototype.hasOwnProperty,jr=Object.prototype.toString,Vr=Object.defineProperty,Mr=Object.getOwnPropertyDescriptor,_r=function(n){return typeof Array.isArray=="function"?Array.isArray(n):jr.call(n)==="[object Array]"},Ur=function(n){if(!n||jr.call(n)!=="[object Object]")return!1;var t=Dt.call(n,"constructor"),r=n.constructor&&n.constructor.prototype&&Dt.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!r)return!1;var i;for(i in n);return typeof i=="undefined"||Dt.call(n,i)},vr=function(n,t){Vr&&t.name==="__proto__"?Vr(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},Nr=function(n,t){if(t==="__proto__")if(Dt.call(n,t)){if(Mr)return Mr(n,t).value}else return;return n[t]};qr.exports=function e(){var n,t,r,i,u,o,a=arguments[0],s=1,l=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},s=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});sOt});module.exports=ji(Go);var Z=require("obsidian");var Ye=class extends Map{constructor(n={}){if(super(),!(n.maxSize&&n.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof n.maxAge=="number"&&n.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=n.maxSize,this.maxAge=n.maxAge||Number.POSITIVE_INFINITY,this.onEviction=n.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(n){if(typeof this.onEviction=="function")for(let[t,r]of n)this.onEviction(t,r.value)}_deleteIfExpired(n,t){return typeof t.expiry=="number"&&t.expiry<=Date.now()?(typeof this.onEviction=="function"&&this.onEviction(n,t.value),this.delete(n)):!1}_getOrDeleteIfExpired(n,t){if(this._deleteIfExpired(n,t)===!1)return t.value}_getItemValue(n,t){return t.expiry?this._getOrDeleteIfExpired(n,t):t.value}_peek(n,t){let r=t.get(n);return this._getItemValue(n,r)}_set(n,t){this.cache.set(n,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(n,t){this.oldCache.delete(n),this._set(n,t)}*_entriesAscending(){for(let n of this.oldCache){let[t,r]=n;this.cache.has(t)||this._deleteIfExpired(t,r)===!1&&(yield n)}for(let n of this.cache){let[t,r]=n;this._deleteIfExpired(t,r)===!1&&(yield n)}}get(n){if(this.cache.has(n)){let t=this.cache.get(n);return this._getItemValue(n,t)}if(this.oldCache.has(n)){let t=this.oldCache.get(n);if(this._deleteIfExpired(n,t)===!1)return this._moveToRecent(n,t),t.value}}set(n,t,{maxAge:r=this.maxAge}={}){let i=typeof r=="number"&&r!==Number.POSITIVE_INFINITY?Date.now()+r:void 0;return this.cache.has(n)?this.cache.set(n,{value:t,expiry:i}):this._set(n,{value:t,expiry:i}),this}has(n){return this.cache.has(n)?!this._deleteIfExpired(n,this.cache.get(n)):this.oldCache.has(n)?!this._deleteIfExpired(n,this.oldCache.get(n)):!1}peek(n){if(this.cache.has(n))return this._peek(n,this.cache);if(this.oldCache.has(n))return this._peek(n,this.oldCache)}delete(n){let t=this.cache.delete(n);return t&&this._size--,this.oldCache.delete(n)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(n){if(!(n&&n>0))throw new TypeError("`maxSize` must be a number greater than 0");let t=[...this._entriesAscending()],r=t.length-n;r<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(r>0&&this._emitEvictions(t.slice(0,r)),this.oldCache=new Map(t.slice(r)),this.cache=new Map,this._size=0),this.maxSize=n}*keys(){for(let[n]of this)yield n}*values(){for(let[,n]of this)yield n}*[Symbol.iterator](){for(let n of this.cache){let[t,r]=n;this._deleteIfExpired(t,r)===!1&&(yield[t,r.value])}for(let n of this.oldCache){let[t,r]=n;this.cache.has(t)||this._deleteIfExpired(t,r)===!1&&(yield[t,r.value])}}*entriesDescending(){let n=[...this.cache];for(let t=n.length-1;t>=0;--t){let r=n[t],[i,u]=r;this._deleteIfExpired(i,u)===!1&&(yield[i,u.value])}n=[...this.oldCache];for(let t=n.length-1;t>=0;--t){let r=n[t],[i,u]=r;this.cache.has(i)||this._deleteIfExpired(i,u)===!1&&(yield[i,u.value])}}*entriesAscending(){for(let[n,t]of this._entriesAscending())yield[n,t.value]}get size(){if(!this._size)return this.oldCache.size;let n=0;for(let t of this.oldCache.keys())this.cache.has(t)||n++;return Math.min(this._size+n,this.maxSize)}entries(){return this.entriesAscending()}forEach(n,t=this){for(let[r,i]of this.entriesAscending())n.call(t,i,r,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}};var W=require("obsidian");var Ve={children(e){return e.children},annotatetextnode(e,n){return e.type==="text"?{offset:{end:e.position.end.offset,start:e.position.start.offset},text:n.substring(e.position.start.offset,e.position.end.offset)}:null},interpretmarkup(e=""){return e}};function qi(e,n,t=Ve){let r=[];function i(u){let o=t.annotatetextnode(u,n);o!==null&&r.push(o);let a=t.children(u);a!==null&&Array.isArray(a)&&a.forEach(i)}return i(e),r}function Hi(e,n,t=Ve){let r=[],i={offset:{end:0,start:0}};for(let o of n){let a=e.substring(i.offset.end,o.offset.start);r.push({interpretAs:t.interpretmarkup(a),markup:a,offset:{end:o.offset.start,start:i.offset.end}}),r.push(o),i=o}let u=e.substring(i.offset.end,e.length);return r.push({interpretAs:t.interpretmarkup(u),markup:u,offset:{end:e.length,start:i.offset.end}}),{annotation:r}}function Mn(e,n,t=Ve){let r=qi(n,e,t);return Hi(e,r,t)}var ea=he(/[A-Za-z]/),ta=he(/[\dA-Za-z]/),na=he(/[#-'*+\--9=?A-Z^-~]/);var ra=he(/\d/),ia=he(/[\dA-Fa-f]/),ua=he(/[!-/:-@[-`{-~]/);function Ge(e){return e!==null&&e<-2}function Je(e){return e===-2||e===-1||e===32}var oa=he(/\p{P}|\p{S}/u),aa=he(/\s/);function he(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}var Un=ht(_n(),1),Xe=Object.assign(Be(Error),{eval:Be(EvalError),range:Be(RangeError),reference:Be(ReferenceError),syntax:Be(SyntaxError),type:Be(TypeError),uri:Be(URIError)});function Be(e){return n.displayName=e.displayName||e.name,n;function n(t,...r){let i=t&&(0,Un.default)(t,...r);return new e(i)}}var gt={}.hasOwnProperty,vn={yaml:"-",toml:"+"};function Me(e){let n=[],t=-1,r=Array.isArray(e)?e:e?[e]:["yaml"];for(;++ti?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);u0?(K(e,e.length,0,n),e):n}var $n={}.hasOwnProperty;function Wn(e){let n={},t=-1;for(;++to))return;let E=n.events.length,L=E,M,_;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){if(M){_=n.events[L][1].end;break}M=!0}for(F(r),d=E;dy;){let T=t[P];n.containerState=T[1],T[0].exit.call(n,e)}t.length=y}function w(){i.write([null]),u=void 0,i=void 0,n.containerState._closeFlow=void 0}}function uu(e,n,t){return I(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var Jn=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var te=de(/[A-Za-z]/),X=de(/[\dA-Za-z]/),Xn=de(/[#-'*+\--9=?A-Z^-~]/);function er(e){return e!==null&&(e<32||e===127)}var et=de(/\d/),tr=de(/[\dA-Fa-f]/),nr=de(/[!-/:-@[-`{-~]/);function D(e){return e!==null&&e<-2}function $(e){return e!==null&&(e<0||e===32)}function R(e){return e===-2||e===-1||e===32}var rr=de(Jn),ir=de(/\s/);function de(e){return n;function n(t){return t!==null&&e.test(String.fromCharCode(t))}}function Qt(e){if(e===null||$(e)||ir(e))return 1;if(rr(e))return 2}function Ue(e,n,t){let r=[],i=-1;for(;++i1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;let p=Object.assign({},e[r][1].end),m=Object.assign({},e[t][1].start);ur(p,-s),ur(m,s),o={type:s>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},e[r][1].end)},a={type:s>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:m},u={type:s>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[t][1].start)},i={type:s>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},o.start),e[t][1].start=Object.assign({},a.end),l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=J(l,[["enter",e[r][1],n],["exit",e[r][1],n]])),l=J(l,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",u,n]]),l=J(l,Ue(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),l=J(l,[["exit",u,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(c=2,l=J(l,[["enter",e[t][1],n],["exit",e[t][1],n]])):c=0,K(e,r-1,t-r+3,l),t=r+l.length-c-2;break}}for(t=-1;++t0&&R(d)?I(e,w,"linePrefix",u+1)(d):w(d)}function w(d){return d===null||D(d)?e.check(ar,A,P)(d):(e.enter("codeFlowValue"),y(d))}function y(d){return d===null||D(d)?(e.exit("codeFlowValue"),w(d)):(e.consume(d),y)}function P(d){return e.exit("codeFenced"),n(d)}function T(d,E,L){let M=0;return _;function _(z){return d.enter("lineEnding"),d.consume(z),d.exit("lineEnding"),N}function N(z){return d.enter("codeFencedFence"),R(z)?I(d,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):V(z)}function V(z){return z===a?(d.enter("codeFencedFenceSequence"),b(z)):L(z)}function b(z){return z===a?(M++,d.consume(z),b):M>=o?(d.exit("codeFencedFenceSequence"),R(z)?I(d,O,"whitespace")(z):O(z)):L(z)}function O(z){return z===null||D(z)?(d.exit("codeFencedFence"),E(z)):L(z)}}}function du(e,n,t){let r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u)}function u(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}var nt={name:"codeIndented",tokenize:Fu},xu={tokenize:Au,partial:!0};function Fu(e,n,t){let r=this;return i;function i(l){return e.enter("codeIndented"),I(e,u,"linePrefix",5)(l)}function u(l){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(l):t(l)}function o(l){return l===null?s(l):D(l)?e.attempt(xu,o,s)(l):(e.enter("codeFlowValue"),a(l))}function a(l){return l===null||D(l)?(e.exit("codeFlowValue"),o(l)):(e.consume(l),a)}function s(l){return e.exit("codeIndented"),n(l)}}function Au(e,n,t){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):D(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):I(e,u,"linePrefix",5)(o)}function u(o){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):D(o)?i(o):t(o)}}var Yt={name:"codeText",tokenize:Eu,resolve:yu,previous:ku};function yu(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}var sr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var el=Fe(/[A-Za-z]/),tl=Fe(/[\dA-Za-z]/),nl=Fe(/[#-'*+\--9=?A-Z^-~]/);function Jt(e){return e!==null&&(e<32||e===127)}var rl=Fe(/\d/),il=Fe(/[\dA-Fa-f]/),ul=Fe(/[!-/:-@[-`{-~]/);function lr(e){return e!==null&&e<-2}function cr(e){return e!==null&&(e<0||e===32)}var ol=Fe(sr),al=Fe(/\s/);function Fe(e){return n;function n(t){return t!==null&&e.test(String.fromCharCode(t))}}function kt(e,n,t,r,i,u,o,a,s){let l=s||Number.POSITIVE_INFINITY,c=0;return p;function p(F){return F===60?(e.enter(r),e.enter(i),e.enter(u),e.consume(F),e.exit(u),m):F===null||F===32||F===41||Jt(F)?t(F):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),A(F))}function m(F){return F===62?(e.enter(u),e.consume(F),e.exit(u),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(F))}function f(F){return F===62?(e.exit("chunkString"),e.exit(a),m(F)):F===null||F===60||lr(F)?t(F):(e.consume(F),F===92?S:f)}function S(F){return F===60||F===62||F===92?(e.consume(F),f):f(F)}function A(F){return!c&&(F===null||F===41||cr(F))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(F)):c999||f===null||f===91||f===93&&!s||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(f):f===93?(e.exit(u),e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):Xt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===null||f===91||f===93||Xt(f)||a++>999?(e.exit("chunkString"),c(f)):(e.consume(f),s||(s=!fr(f)),f===92?m:p)}function m(f){return f===91||f===92||f===93?(e.consume(f),a++,p):p(f)}}var hr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var bl=ye(/[A-Za-z]/),Dl=ye(/[\dA-Za-z]/),Bl=ye(/[#-'*+\--9=?A-Z^-~]/);var Tl=ye(/\d/),Il=ye(/[\dA-Fa-f]/),Ll=ye(/[!-/:-@[-`{-~]/);function en(e){return e!==null&&e<-2}var Pl=ye(hr),zl=ye(/\s/);function ye(e){return n;function n(t){return t!==null&&e.test(String.fromCharCode(t))}}function Ct(e,n,t,r,i,u){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,s):t(m)}function s(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),n):(e.enter(u),l(m))}function l(m){return m===o?(e.exit(u),s(o)):m===null?t(m):en(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),I(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===o||m===null||en(m)?(e.exit("chunkString"),l(m)):(e.consume(m),m===92?p:c)}function p(m){return m===o||m===92?(e.consume(m),c):c(m)}}var gr=/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;var vl=ke(/[A-Za-z]/),Nl=ke(/[\dA-Za-z]/),jl=ke(/[#-'*+\--9=?A-Z^-~]/);var ql=ke(/\d/),Hl=ke(/[\dA-Fa-f]/),$l=ke(/[!-/:-@[-`{-~]/);function mr(e){return e!==null&&e<-2}function dr(e){return e===-2||e===-1||e===32}var Wl=ke(gr),Zl=ke(/\s/);function ke(e){return n;function n(t){return t!==null&&e.test(String.fromCharCode(t))}}function Te(e,n){let t;return r;function r(i){return mr(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):dr(i)?I(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}function pe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var tn={name:"definition",tokenize:Tu},Bu={tokenize:Iu,partial:!0};function Tu(e,n,t){let r=this,i;return u;function u(f){return e.enter("definition"),o(f)}function o(f){return Et.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=pe(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),s):t(f)}function s(f){return $(f)?Te(e,l)(f):l(f)}function l(f){return kt(e,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(Bu,p,p)(f)}function p(f){return R(f)?I(e,m,"whitespace")(f):m(f)}function m(f){return f===null||D(f)?(e.exit("definition"),r.parser.defined.push(i),n(f)):t(f)}}function Iu(e,n,t){return r;function r(a){return $(a)?Te(e,i)(a):t(a)}function i(a){return Ct(e,u,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function u(a){return R(a)?I(e,o,"whitespace")(a):o(a)}function o(a){return a===null||D(a)?n(a):t(a)}}var nn={name:"hardBreakEscape",tokenize:Lu};function Lu(e,n,t){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),i}function i(u){return D(u)?(e.exit("hardBreakEscape"),n(u)):t(u)}}var rn={name:"headingAtx",tokenize:zu,resolve:Pu};function Pu(e,n){let t=e.length-2,r=3,i,u;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},u={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},K(e,r,t-r+1,[["enter",i,n],["enter",u,n],["exit",u,n],["exit",i,n]])),e}function zu(e,n,t){let r=0;return i;function i(c){return e.enter("atxHeading"),u(c)}function u(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||$(c)?(e.exit("atxHeadingSequence"),a(c)):t(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),s(c)):c===null||D(c)?(e.exit("atxHeading"),n(c)):R(c)?I(e,a,"whitespace")(c):(e.enter("atxHeadingText"),l(c))}function s(c){return c===35?(e.consume(c),s):(e.exit("atxHeadingSequence"),a(c))}function l(c){return c===null||c===35||$(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),l)}}var xr=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],un=["pre","script","style","textarea"];var on={name:"htmlFlow",tokenize:Mu,resolveTo:Vu,concrete:!0},Ou={tokenize:Uu,partial:!0},Ru={tokenize:_u,partial:!0};function Vu(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Mu(e,n,t){let r=this,i,u,o,a,s;return l;function l(g){return c(g)}function c(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),p}function p(g){return g===33?(e.consume(g),m):g===47?(e.consume(g),u=!0,A):g===63?(e.consume(g),i=3,r.interrupt?n:h):te(g)?(e.consume(g),o=String.fromCharCode(g),k):t(g)}function m(g){return g===45?(e.consume(g),i=2,f):g===91?(e.consume(g),i=5,a=0,S):te(g)?(e.consume(g),i=4,r.interrupt?n:h):t(g)}function f(g){return g===45?(e.consume(g),r.interrupt?n:h):t(g)}function S(g){let ee="CDATA[";return g===ee.charCodeAt(a++)?(e.consume(g),a===ee.length?r.interrupt?n:V:S):t(g)}function A(g){return te(g)?(e.consume(g),o=String.fromCharCode(g),k):t(g)}function k(g){if(g===null||g===47||g===62||$(g)){let ee=g===47,Oe=o.toLowerCase();return!ee&&!u&&un.includes(Oe)?(i=1,r.interrupt?n(g):V(g)):xr.includes(o.toLowerCase())?(i=6,ee?(e.consume(g),F):r.interrupt?n(g):V(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(g):u?w(g):y(g))}return g===45||X(g)?(e.consume(g),o+=String.fromCharCode(g),k):t(g)}function F(g){return g===62?(e.consume(g),r.interrupt?n:V):t(g)}function w(g){return R(g)?(e.consume(g),w):_(g)}function y(g){return g===47?(e.consume(g),_):g===58||g===95||te(g)?(e.consume(g),P):R(g)?(e.consume(g),y):_(g)}function P(g){return g===45||g===46||g===58||g===95||X(g)?(e.consume(g),P):T(g)}function T(g){return g===61?(e.consume(g),d):R(g)?(e.consume(g),T):y(g)}function d(g){return g===null||g===60||g===61||g===62||g===96?t(g):g===34||g===39?(e.consume(g),s=g,E):R(g)?(e.consume(g),d):L(g)}function E(g){return g===s?(e.consume(g),s=null,M):g===null||D(g)?t(g):(e.consume(g),E)}function L(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||$(g)?T(g):(e.consume(g),L)}function M(g){return g===47||g===62||R(g)?y(g):t(g)}function _(g){return g===62?(e.consume(g),N):t(g)}function N(g){return g===null||D(g)?V(g):R(g)?(e.consume(g),N):t(g)}function V(g){return g===45&&i===2?(e.consume(g),j):g===60&&i===1?(e.consume(g),H):g===62&&i===4?(e.consume(g),ne):g===63&&i===3?(e.consume(g),h):g===93&&i===5?(e.consume(g),oe):D(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Ou,ae,b)(g)):g===null||D(g)?(e.exit("htmlFlowData"),b(g)):(e.consume(g),V)}function b(g){return e.check(Ru,O,ae)(g)}function O(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),z}function z(g){return g===null||D(g)?b(g):(e.enter("htmlFlowData"),V(g))}function j(g){return g===45?(e.consume(g),h):V(g)}function H(g){return g===47?(e.consume(g),o="",re):V(g)}function re(g){if(g===62){let ee=o.toLowerCase();return un.includes(ee)?(e.consume(g),ne):V(g)}return te(g)&&o.length<8?(e.consume(g),o+=String.fromCharCode(g),re):V(g)}function oe(g){return g===93?(e.consume(g),h):V(g)}function h(g){return g===62?(e.consume(g),ne):g===45&&i===2?(e.consume(g),h):V(g)}function ne(g){return g===null||D(g)?(e.exit("htmlFlowData"),ae(g)):(e.consume(g),ne)}function ae(g){return e.exit("htmlFlow"),n(g)}}function _u(e,n,t){let r=this;return i;function i(o){return D(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u):t(o)}function u(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function Uu(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(xe,n,t)}}var an={name:"htmlText",tokenize:vu};function vu(e,n,t){let r=this,i,u,o;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),s}function s(h){return h===33?(e.consume(h),l):h===47?(e.consume(h),T):h===63?(e.consume(h),y):te(h)?(e.consume(h),L):t(h)}function l(h){return h===45?(e.consume(h),c):h===91?(e.consume(h),u=0,S):te(h)?(e.consume(h),w):t(h)}function c(h){return h===45?(e.consume(h),f):t(h)}function p(h){return h===null?t(h):h===45?(e.consume(h),m):D(h)?(o=p,H(h)):(e.consume(h),p)}function m(h){return h===45?(e.consume(h),f):p(h)}function f(h){return h===62?j(h):h===45?m(h):p(h)}function S(h){let ne="CDATA[";return h===ne.charCodeAt(u++)?(e.consume(h),u===ne.length?A:S):t(h)}function A(h){return h===null?t(h):h===93?(e.consume(h),k):D(h)?(o=A,H(h)):(e.consume(h),A)}function k(h){return h===93?(e.consume(h),F):A(h)}function F(h){return h===62?j(h):h===93?(e.consume(h),F):A(h)}function w(h){return h===null||h===62?j(h):D(h)?(o=w,H(h)):(e.consume(h),w)}function y(h){return h===null?t(h):h===63?(e.consume(h),P):D(h)?(o=y,H(h)):(e.consume(h),y)}function P(h){return h===62?j(h):y(h)}function T(h){return te(h)?(e.consume(h),d):t(h)}function d(h){return h===45||X(h)?(e.consume(h),d):E(h)}function E(h){return D(h)?(o=E,H(h)):R(h)?(e.consume(h),E):j(h)}function L(h){return h===45||X(h)?(e.consume(h),L):h===47||h===62||$(h)?M(h):t(h)}function M(h){return h===47?(e.consume(h),j):h===58||h===95||te(h)?(e.consume(h),_):D(h)?(o=M,H(h)):R(h)?(e.consume(h),M):j(h)}function _(h){return h===45||h===46||h===58||h===95||X(h)?(e.consume(h),_):N(h)}function N(h){return h===61?(e.consume(h),V):D(h)?(o=N,H(h)):R(h)?(e.consume(h),N):M(h)}function V(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),i=h,b):D(h)?(o=V,H(h)):R(h)?(e.consume(h),V):(e.consume(h),O)}function b(h){return h===i?(e.consume(h),i=void 0,z):h===null?t(h):D(h)?(o=b,H(h)):(e.consume(h),b)}function O(h){return h===null||h===34||h===39||h===60||h===61||h===96?t(h):h===47||h===62||$(h)?M(h):(e.consume(h),O)}function z(h){return h===47||h===62||$(h)?M(h):t(h)}function j(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),n):t(h)}function H(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),re}function re(h){return R(h)?I(e,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):oe(h)}function oe(h){return e.enter("htmlTextData"),o(h)}}var Ie={name:"labelEnd",tokenize:Wu,resolveTo:$u,resolveAll:Hu},Nu={tokenize:Zu},ju={tokenize:Qu},qu={tokenize:Ku};function Hu(e){let n=-1;for(;++n=3&&(l===null||D(l))?(e.exit("thematicBreak"),n(l)):t(l)}function s(l){return l===i?(e.consume(l),r++,s):(e.exit("thematicBreakSequence"),R(l)?I(e,a,"whitespace")(l):a(l))}}var Y={name:"list",tokenize:no,continuation:{tokenize:ro},exit:uo},eo={tokenize:oo,partial:!0},to={tokenize:io,partial:!0};function no(e,n,t){let r=this,i=r.events[r.events.length-1],u=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){let S=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:et(f)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Le,t,l)(f):l(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(f)}return t(f)}function s(f){return et(f)&&++o<10?(e.consume(f),s):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),l(f)):t(f)}function l(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(xe,r.interrupt?t:c,e.attempt(eo,m,p))}function c(f){return r.containerState.initialBlankLine=!0,u++,m(f)}function p(f){return R(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):t(f)}function m(f){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(f)}}function ro(e,n,t){let r=this;return r.containerState._closeFlow=void 0,e.check(xe,i,u);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,I(e,n,"listItemIndent",r.containerState.size+1)(a)}function u(a){return r.containerState.furtherBlankLines||!R(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(to,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,I(e,e.attempt(Y,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function io(e,n,t){let r=this;return I(e,i,"listItemIndent",r.containerState.size+1);function i(u){let o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(u):t(u)}}function uo(e){e.exit(this.containerState.type)}function oo(e,n,t){let r=this;return I(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(u){let o=r.events[r.events.length-1];return!R(u)&&o&&o[1].type==="listItemPrefixWhitespace"?n(u):t(u)}}var St={name:"setextUnderline",tokenize:so,resolveTo:ao};function ao(e,n){let t=e.length,r,i,u;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!u&&e[t][1].type==="definition"&&(u=t);let o={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",u?(e.splice(i,0,["enter",o,n]),e.splice(u+1,0,["exit",e[r][1],n]),e[r][1].end=Object.assign({},e[u][1].end)):e[r][1]=o,e.push(["exit",o,n]),e}function so(e,n,t){let r=this,i;return u;function u(l){let c=r.events.length,p;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){p=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=l,o(l)):t(l)}function o(l){return e.enter("setextHeadingLineSequence"),a(l)}function a(l){return l===i?(e.consume(l),a):(e.exit("setextHeadingLineSequence"),R(l)?I(e,s,"lineSuffix")(l):s(l))}function s(l){return l===null||D(l)?(e.exit("setextHeadingLine"),n(l)):t(l)}}var Fr={tokenize:lo};function lo(e){let n=this,t=e.attempt(xe,r,e.attempt(this.parser.constructs.flowInitial,i,I(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Gt,i)),"linePrefix")));return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Ar={resolveAll:Cr()},yr=Er("string"),kr=Er("text");function Er(e){return{tokenize:n,resolveAll:Cr(e==="text"?co:void 0)};function n(t){let r=this,i=this.parser.constructs[e],u=t.attempt(i,o,a);return o;function o(c){return l(c)?u(c):a(c)}function a(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),s}function s(c){return l(c)?(t.exit("data"),u(c)):(t.consume(c),s)}function l(c){if(c===null)return!0;let p=i[c],m=-1;if(p)for(;++m-1){let a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}u>0&&o.push(e[i].slice(0,u))}return o}function fo(e,n){let t=-1,r=[],i;for(;++tko,contentInitial:()=>go,disable:()=>Eo,document:()=>ho,flow:()=>xo,flowInitial:()=>mo,insideSpan:()=>yo,string:()=>Fo,text:()=>Ao});var ho={42:Y,43:Y,45:Y,48:Y,49:Y,50:Y,51:Y,52:Y,53:Y,54:Y,55:Y,56:Y,57:Y,62:dt},go={91:tn},mo={[-2]:nt,[-1]:nt,32:nt},xo={35:rn,42:Le,45:[St,Le],60:on,61:St,95:Le,96:At,126:At},Fo={38:Ft,92:xt},Ao={[-5]:rt,[-4]:rt,[-3]:rt,33:sn,38:Ft,42:tt,60:[Kt,an],91:ln,92:[nn,xt],93:Ie,95:tt,96:Yt},yo={null:[tt,Ar]},ko={null:[42,95]},Eo={null:[]};function wr(e){let t=Wn([cn,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:t,content:i(Kn),document:i(Gn),flow:i(Fr),string:i(yr),text:i(kr)};return r;function i(u){return o;function o(a){return Sr(r,u,a)}}}var br=/[\0\t\n\r]/g;function Dr(){let e=1,n="",t=!0,r;return i;function i(u,o,a){let s=[],l,c,p,m,f;for(u=n+u.toString(o),p=0,n="",t&&(u.charCodeAt(0)===65279&&p++,t=void 0);p13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCharCode(t)}var Co=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Tr(e){return e.replace(Co,So)}function So(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){let i=t.charCodeAt(1),u=i===120||i===88;return wt(t.slice(u?2:1),u?16:10)}return ve(t)||e}function Ne(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ir(e.position):"start"in e||"end"in e?Ir(e):"line"in e||"column"in e?pn(e):""}function pn(e){return Lr(e&&e.line)+":"+Lr(e&&e.column)}function Ir(e){return pn(e&&e.start)+"-"+pn(e&&e.end)}function Lr(e){return e&&typeof e=="number"?e:1}var zr={}.hasOwnProperty,fn=function(e,n,t){return typeof n!="string"&&(t=n,n=void 0),wo(t)(Br(wr(t).document().write(Dr()(e,n,!0))))};function wo(e){let n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(zn),autolinkProtocol:N,autolinkEmail:N,atxHeading:a(In),blockQuote:a(Re),characterEscape:N,characterReference:N,codeFenced:a(De),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(De,s),codeText:a(Vt,s),codeTextData:N,data:N,codeFlowValue:N,definition:a(Ti),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(Ii),hardBreakEscape:a(Ln),hardBreakTrailing:a(Ln),htmlFlow:a(Pn,s),htmlFlowData:N,htmlText:a(Pn,s),htmlTextData:N,image:a(Li),label:s,link:a(zn),listItem:a(Pi),listItemValue:S,listOrdered:a(On,f),listUnordered:a(On),paragraph:a(zi),reference:Oe,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(In),strong:a(Oi),thematicBreak:a(Vi)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:se,autolinkProtocol:Ze,blockQuote:c(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:We,characterReferenceMarkerNumeric:We,characterReferenceValue:Q,codeFenced:c(w),codeFencedFence:F,codeFencedFenceInfo:A,codeFencedFenceMeta:k,codeFlowValue:V,codeIndented:c(y),codeText:c(H),codeTextData:V,data:V,definition:c(),definitionDestinationString:d,definitionLabelString:P,definitionTitleString:T,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(z),htmlFlowData:V,htmlText:c(j),htmlTextData:V,image:c(oe),label:ne,labelText:h,lineEnding:b,link:c(re),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Rt,resourceDestinationString:ae,resourceTitleString:g,resource:ee,setextHeading:c(_),setextHeadingLineSequence:M,setextHeadingText:L,strong:c(),thematicBreak:c()}};Or(n,(e||{}).mdastExtensions||[]);let t={};return r;function r(x){let C={type:"root",children:[]},B={stack:[C],tokenStack:[],config:n,enter:l,exit:p,buffer:s,resume:m,setData:u,getData:o},U=[],v=-1;for(;++v0){let ie=B.tokenStack[B.tokenStack.length-1];(ie[1]||Pr).call(B,void 0,ie[0])}for(C.position={start:Ee(x.length>0?x[0][1].start:{line:1,column:1,offset:0}),end:Ee(x.length>0?x[x.length-2][1].end:{line:1,column:1,offset:0})},v=-1;++v{let r=this.data("settings");return fn(t,Object.assign({},r,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function hn(e){if(e)throw e}var ti=ht(gn(),1),Sn=ht(Hr(),1);function it(e){if(typeof e!="object"||e===null)return!1;let n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function mn(){let e=[],n={run:t,use:r};return n;function t(...i){let u=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(s,...l){let c=e[++u],p=-1;if(s){o(s);return}for(;++po.length,s;a&&o.push(i);try{s=e.apply(this,o)}catch(l){let c=l;if(a&&t)throw c;return i(c)}a||(s&&s.then&&typeof s.then=="function"?s.then(u,i):s instanceof Error?i(s):u(s))}function i(o,...a){t||(t=!0,n(o,...a))}function u(o){i(null,o)}}var Gr=ht(gn(),1);function xn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wr(e.position):"start"in e||"end"in e?Wr(e):"line"in e||"column"in e?dn(e):""}function dn(e){return Zr(e&&e.line)+":"+Zr(e&&e.column)}function Wr(e){return dn(e&&e.start)+"-"+dn(e&&e.end)}function Zr(e){return e&&typeof e=="number"?e:1}var G=class extends Error{constructor(n,t,r){let i=[null,null],u={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof t=="string"&&(r=t,t=void 0),typeof r=="string"){let o=r.indexOf(":");o===-1?i[1]=r:(i[0]=r.slice(0,o),i[1]=r.slice(o+1))}t&&("type"in t||"position"in t?t.position&&(u=t.position):"start"in t||"end"in t?u=t:("line"in t||"column"in t)&&(u.start=t)),this.name=xn(t)||"1:1",this.message=typeof n=="object"?n.message:n,this.stack="",typeof n=="object"&&n.stack&&(this.stack=n.stack),this.reason=this.message,this.fatal,this.line=u.start.line,this.column=u.start.column,this.position=u,this.source=i[0],this.ruleId=i[1],this.file,this.actual,this.expected,this.url,this.note}};G.prototype.file="";G.prototype.name="";G.prototype.reason="";G.prototype.message="";G.prototype.stack="";G.prototype.fatal=null;G.prototype.column=null;G.prototype.line=null;G.prototype.source=null;G.prototype.ruleId=null;G.prototype.position=null;var ue={basename:Do,dirname:Bo,extname:To,join:Io,sep:"/"};function Do(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');ut(e);let t=0,r=-1,i=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(u){t=i+1;break}}else r<0&&(u=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let o=-1,a=n.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(u){t=i+1;break}}else o<0&&(u=!0,o=i+1),a>-1&&(e.charCodeAt(i)===n.charCodeAt(a--)?a<0&&(r=i):(a=-1,r=o));return t===r?r=o:r<0&&(r=e.length),e.slice(t,r)}function Bo(e){if(ut(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.charCodeAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.charCodeAt(0)===47?"/":".":n===1&&e.charCodeAt(0)===47?"//":e.slice(0,n)}function To(e){ut(e);let n=e.length,t=-1,r=0,i=-1,u=0,o;for(;n--;){let a=e.charCodeAt(n);if(a===47){if(o){r=n+1;break}continue}t<0&&(o=!0,t=n+1),a===46?i<0?i=n:u!==1&&(u=1):i>-1&&(u=-1)}return i<0||t<0||u===0||u===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function Io(...e){let n=-1,t;for(;++n0&&e.charCodeAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function Po(e,n){let t="",r=0,i=-1,u=0,o=-1,a,s;for(;++o<=e.length;){if(o2){if(s=t.lastIndexOf("/"),s!==t.length-1){s<0?(t="",r=0):(t=t.slice(0,s),r=t.length-1-t.lastIndexOf("/")),i=o,u=0;continue}}else if(t.length>0){t="",r=0,i=o,u=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,o):t=e.slice(i+1,o),r=o-i-1;i=o,u=0}else a===46&&u>-1?u++:u=-1}return t}function ut(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Qr={cwd:zo};function zo(){return"/"}function je(e){return e!==null&&typeof e=="object"&&e.href&&e.origin}function Kr(e){if(typeof e=="string")e=new URL(e);else if(!je(e)){let n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){let n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Oo(e)}function Oo(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let n=e.pathname,t=-1;for(;++t{if(d||!E||!L)T(d);else{let M=u.stringify(E,L);M==null||(_o(M)?L.value=M:L.result=M),T(d,L)}});function T(d,E){d||!E?y(d):w?w(E):k(null,E)}}}function S(A){let k;u.freeze(),kn("processSync",u.Parser),En("processSync",u.Compiler);let F=at(A);return u.process(F,w),ei("processSync","process",k),F;function w(y){k=!0,hn(y)}}}function Jr(e,n){return typeof e=="function"&&e.prototype&&(Vo(e.prototype)||n in e.prototype)}function Vo(e){let n;for(n in e)if(ni.call(e,n))return!0;return!1}function kn(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `Parser`")}function En(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `Compiler`")}function Cn(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Xr(e){if(!it(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ei(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function at(e){return Mo(e)?e:new ot(e)}function Mo(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _o(e){return typeof e=="string"||(0,ti.default)(e)}var bn={children(e){return Ve.children(e)},annotatetextnode(e,n){return Ve.annotatetextnode(e,n)},interpretmarkup(e=""){return` `.repeat((e.match(/\n/g)||[]).length)},remarkoptions:{}};function ii(e,n=bn){let t=wn().use(bt,n.remarkoptions).use(mt,["yaml","toml"]).parse(e);return Mn(e,t,n)}var Pe=require("obsidian");function Ce(e){return e.cm}function Bt(e){let n=e.getConfig("spellcheckDictionary");return Array.isArray(n)?n:[]}function ui(e,n){e.setConfig("spellcheckDictionary",[...Bt(e),n])}function oi(e,n){e.setConfig("spellcheckDictionary",Bt(e).filter(t=>t!==n))}var ai=/frontmatter|code|math|templater|blockid|hashtag|internal/;function si(e){let n=0;if(e.length===0)return n;for(let t=0;tt.value).filter(t=>t.trim())}function st(e){return e.replace(/\/+$/,"").replace(/\/v2(\/check)?$/,"")}function li(e){let n=e.normalize("NFC");if(n===e)return null;let t=/\p{M}/u,r=[],i=[],u=0,o=0;for(;o65535?2:1);for(;avo&&qe.shift()}var Se="ok",No=/^\s*(-|\d+\.) $/m;function jo(e){if(typeof e!="string"||!e.startsWith("`"))return!1;let n=e.match(/^`+/);if(!n)return!1;let t=n[0].length,r="`".repeat(t),i=e.lastIndexOf(r);if(i<=t-1)return!1;let u=e.slice(t,i);if(u==="")return!1;u=u.replace(/\n/g," "),u.length>0&&/[^ ]/.test(u)&&u.startsWith(" ")&&u.endsWith(" ")&&(u=u.slice(1,-1));let o=Array.from(u.matchAll(/`+/g));return!((o.length?Math.max(...o.map(s=>s[0].length)):0)>=t)}async function fi(e,n,t){let r=ii(e,{...bn,interpretmarkup(p=""){var S,A;if(jo(p))return p;let m=(A=((S=p.match(/\n/g))!=null?S:[]).length)!=null?A:0,f=` `.repeat(m);return No.exec(p)?`${f}\u2022 `:f}}),i=n(),{enabledCategories:u,disabledCategories:o}=ci(i),a={data:JSON.stringify(r),language:"auto",enabledOnly:"false",level:i.pickyMode?"picky":"default"};u.length&&(a.enabledCategories=u.join(",")),o.length&&(a.disabledCategories=o.join(",")),i.ruleOtherRules&&(a.enabledRules=i.ruleOtherRules),i.ruleOtherDisabledRules&&(a.disabledRules=i.ruleOtherDisabledRules),i.englishVeriety&&(a.preferredVariants=`${a.preferredVariants?`${a.preferredVariants},`:""}${i.englishVeriety}`),i.germanVeriety&&(a.preferredVariants=`${a.preferredVariants?`${a.preferredVariants},`:""}${i.germanVeriety}`),i.portugueseVeriety&&(a.preferredVariants=`${a.preferredVariants?`${a.preferredVariants},`:""}${i.portugueseVeriety}`),i.catalanVeriety&&(a.preferredVariants=`${a.preferredVariants?`${a.preferredVariants},`:""}${i.catalanVeriety}`),t.apikey&&t.username&&(a.username=t.username,a.apiKey=t.apikey),i.staticLanguage&&i.staticLanguage.length>0&&i.staticLanguage!=="auto"&&(a.language=i.staticLanguage),i.motherTongue&&i.motherTongue.length>0&&(a.motherTongue=i.motherTongue);let s=`${i.serverUrl}/v2/check`,l;try{l=await(0,Pe.requestUrl)({url:s,method:"POST",body:Object.keys(a).map(p=>`${encodeURIComponent(p)}=${encodeURIComponent(a[p])}`).join("&"),headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},throw:!1})}catch(p){let m="request-failed";return pi(`request to ${s} failed: ${String(p)}`),(Se!==m||!i.shouldAutoCheck)&&(new Pe.Notice("Request to LanguageTool server failed. Please check your connection and LanguageTool server URL",3e3),Se=m),Promise.reject(p instanceof Error?p:new Error(String(p)))}if(l.status<200||l.status>=300){let p="request-not-ok";return qo(s,l,i,t),(Se!==p||!i.shouldAutoCheck)&&(new Pe.Notice(`Request to LanguageTool failed: ${l.status} Check the plugin settings for logs`,3e3),Se=p),Promise.reject(new Error(`unexpected status ${l.status}, see plugin logs`))}let c;try{c=l.json}catch(p){let m="json-parse-error";return(Se!==m||!i.shouldAutoCheck)&&(new Pe.Notice("Error processing response from LanguageTool server",3e3),Se=m),Promise.reject(p instanceof Error?p:new Error(String(p)))}return Se!=="ok"&&(new Pe.Notice("LanguageTool detection restored",5e3),Se="ok"),c}function qo(e,n,t,r){var u,o;let i=`url used for request: ${e} Status: ${n.status} Body: ${n.text.slice(0,200)} Settings: ${JSON.stringify({...t,username:"REDACTED",apikey:"REDACTED"})} `;(r.username||r.apikey)&&(i=i.replaceAll((u=r.username)!=null?u:"username","<>").replaceAll((o=r.apikey)!=null?o:"apiKey","<>")),pi(i)}var gi=60,mi=1e3,Ho=20,$o=80,Wo=5e3,di=50,xi=gi/Ho*mi,Zo=gi/$o*mi,Fi={serverUrl:"https://api.languagetool.org",urlMode:"standard",glassBg:!1,shouldAutoCheck:!1,autoCheckDelay:xi,pickyMode:!1};function Lt(e){return e==="standard"?"https://api.languagetool.org":e==="premium"?"https://api.languagetoolplus.com":""}function Qo(e){return e==="standard"?xi:e==="premium"?Zo:di}function hi(e){e.descEl.createEl("br"),e.descEl.createEl("a",{text:"Click here for information about Premium Access",href:"https://github.com/Clemens-E/obsidian-languagetool-plugin#premium-accounts"},n=>{n.setAttr("target","_blank")})}function Dn(e){e.descEl.createEl("br"),e.descEl.createEl("a",{text:"Click here for a list of rules and categories",href:"https://community.languagetool.org/rule/list"},n=>{n.setAttr("target","_blank")})}var Pt=class extends W.PluginSettingTab{constructor(n,t){super(n,t),this.plugin=t}configureAutoCheckDelaySlider(n,t){let r=Qo(n);this.plugin.settings.autoCheckDelay{if(t.status<200||t.status>=300)throw new Error(`unexpected status ${t.status}`);return t.json});this.languagesPromise=n,n.catch(t=>{console.error(t),new W.Notice("Failed to fetch the list of languages from the LanguageTool server. Check the endpoint URL, then reopen the settings to retry. Auto-detect keeps working in the meantime.",8e3),this.languagesPromise===n&&(this.languagesPromise=void 0)})}return this.languagesPromise}maybeWarnNonPremium(n,t,r,i){if(!n||this.plugin.settings.urlMode==="premium"||r)return;let u=new W.Modal(this.app);u.titleEl.setText("Warning"),u.contentEl.addClass("lt-premium-warning"),u.contentEl.createEl("p",{text:"You have entered an API Key but you are not using the Premium Endpoint"});let o=u.contentEl.createDiv({cls:"lt-premium-warning-buttons"});o.createEl("button",{text:"I know what I'm doing",cls:"lt-premium-warning-ack"}).onclick=()=>{t(),u.close()},o.createEl("button",{text:"Change to Premium",cls:"lt-premium-warning-switch"}).onclick=async()=>(this.plugin.settings.urlMode="premium",i==null||i.setValue("premium"),this.plugin.settings.serverUrl=Lt("premium"),await this.plugin.saveSettings(),u.close()),u.open()}rerender(){(0,W.requireApiVersion)("1.13.0")?this.update():this.display()}getSections(){let n={},t=!1;return[{items:[{name:"Failed request logs",desc:"Copy the logs of recent failed LanguageTool requests",render:o=>{o.addButton(a=>{a.setButtonText("Copy failed Request Logs").onClick(async()=>{if(qe.length===0){new W.Notice("No failed requests have been logged yet");return}await window.navigator.clipboard.writeText(qe.join(` `)),new W.Notice("Logs copied to clipboard")})})}},{name:"Endpoint",desc:"Endpoint that will be used to make requests to",render:o=>{o.controlEl.addClass("lt-settings-endpoint-control"),o.addDropdown(a=>{n.urlDropdown=a,a.addOptions({standard:"(Standard) api.languagetool.org",premium:"(Premium) api.languagetoolplus.com",custom:"Custom URL"}).setValue(this.plugin.settings.urlMode).onChange(async s=>{var l,c;this.plugin.settings.urlMode=s,this.plugin.settings.serverUrl=Lt(s),this.languagesPromise=void 0,(l=n.endpointInput)==null||l.setValue(this.plugin.settings.serverUrl),(c=n.endpointInput)==null||c.setDisabled(s!=="custom"),this.configureAutoCheckDelaySlider(s,n.autoCheckDelaySlider),await this.plugin.saveSettings()})}),o.addText(a=>{n.endpointInput=a,a.setPlaceholder("https://your-custom-url.com").setValue(this.plugin.settings.serverUrl).setDisabled(this.plugin.settings.urlMode!=="custom").onChange(async s=>{this.plugin.settings.serverUrl=st(s),this.languagesPromise=void 0,await this.plugin.saveSettings()})})}},{name:"API Username",desc:"Enter a username/email for API Access",render:o=>{o.addText(a=>{var s;return a.setPlaceholder("peterlustig@gmail.com").setValue((s=this.plugin.settings.username)!=null?s:"").onChange(async l=>{this.plugin.settings.username=l.replace(/\s+/g,""),await this.plugin.saveSettings()})}),hi(o)}},{name:"API Key",desc:"Enter an API Key",render:o=>{let a=this.plugin.settings.apiKeyStorage==="secret"&&this.plugin.isSecretStorageAvailable();(0,W.requireApiVersion)("1.11.4")&&a?o.setDesc("Select or create a secret in Obsidian's SecretStorage. Stored encrypted on this device only.").addComponent(s=>{var l;return new W.SecretComponent(this.app,s).setValue((l=this.plugin.settings.apikeySecretName)!=null?l:"").onChange(async c=>{this.plugin.settings.apikeySecretName=c,await this.plugin.saveSettings(),this.maybeWarnNonPremium(c.length>0,()=>{t=!0},t,n.urlDropdown)})}):o.addText(s=>{var l;s.setValue((l=this.plugin.settings.apikey)!=null?l:"").onChange(async c=>{this.plugin.settings.apikey=c.replace(/\s+/g,""),await this.plugin.saveSettings()}),s.inputEl.addEventListener("blur",()=>{this.maybeWarnNonPremium(!!this.plugin.settings.apikey,()=>{t=!0},t,n.urlDropdown)})}),hi(o)}},{name:"Store API key securely (this device only)",desc:"Store your API key in Obsidian's encrypted SecretStorage instead of in plaintext in data.json. Secrets are not synced across devices, so you'll need to set your key once on each device. Your username stays in your synced settings.",render:o=>{o.addToggle(a=>{let s=this.plugin.isSecretStorageAvailable();a.setValue(this.plugin.settings.apiKeyStorage==="secret").setDisabled(!s).onChange(async l=>{if(l){let c=!!this.plugin.settings.apikey;await this.plugin.enableSecretStorage(),new W.Notice(c?"API key moved to secure storage on this device. It will not sync to your other devices.":"Secure storage enabled. Select or create a secret for your API key in the setting above.",5e3)}else await this.plugin.disableSecretStorage();this.rerender()})}),o.descEl.createEl("br"),o.descEl.createEl("a",{text:"Read about the trade-offs of both storage options",href:"https://github.com/Clemens-E/obsidian-languagetool-plugin#api-key-storage-synced-plaintext-vs-secure-storage"},a=>{a.setAttr("target","_blank")}),this.plugin.isSecretStorageAvailable()||(o.descEl.createEl("br"),o.descEl.createSpan({text:"Not available on this device (requires Obsidian 1.11.4 or newer).",cls:"lt-settings-error-text"}))}},{name:"Autocheck Text",desc:"Check text as you type",render:o=>{o.addToggle(a=>{a.setValue(this.plugin.settings.shouldAutoCheck).onChange(async s=>{this.plugin.settings.shouldAutoCheck=s,await this.plugin.saveSettings()})})}},{name:"AutoCheck Delay (ms)",desc:"Length of time to wait for AutoCheck after last key press",render:o=>{o.addSlider(a=>{n.autoCheckDelaySlider=a,this.configureAutoCheckDelaySlider(this.plugin.settings.urlMode,a),a.setValue(this.plugin.settings.autoCheckDelay).onChange(async s=>{this.plugin.settings.autoCheckDelay=s,await this.plugin.saveSettings()}),a.setDynamicTooltip()})}},{name:"Glass Background",desc:"Use the secondary background color of the theme or a glass background",render:o=>{o.addToggle(a=>{a.setValue(this.plugin.settings.glassBg).onChange(async s=>{this.plugin.settings.glassBg=s,await this.plugin.saveSettings()})})}},{name:"Static Language",desc:"Set a static language that will always be used (LanguageTool tries to auto detect the language, this is usually not necessary)",render:o=>{o.addDropdown(a=>{var s;n.staticLanguageComponent=a,a.addOption("auto","Auto Detect"),a.setValue((s=this.plugin.settings.staticLanguage)!=null?s:"auto"),a.onChange(async l=>{var c,p,m,f;this.plugin.settings.staticLanguage=l,l!=="auto"&&(this.plugin.settings.englishVeriety=void 0,(c=n.englishVarietyDropdown)==null||c.setValue("default"),this.plugin.settings.germanVeriety=void 0,(p=n.germanVarietyDropdown)==null||p.setValue("default"),this.plugin.settings.portugueseVeriety=void 0,(m=n.portugueseVarietyDropdown)==null||m.setValue("default"),this.plugin.settings.catalanVeriety=void 0,(f=n.catalanVarietyDropdown)==null||f.setValue("default")),await this.plugin.saveSettings()}),this.requestLanguages().then(l=>{var c;l.forEach(p=>{a.addOption(p.longCode,p.name)}),a.setValue((c=this.plugin.settings.staticLanguage)!=null?c:"auto")}).catch(()=>{})})}},{name:"Mother Tongue",desc:"Set the language you are most comfortable with. This will be used to interpret the language you are writing in",render:o=>{o.addDropdown(a=>{var s;a.addOption("default","---"),a.setValue((s=this.plugin.settings.motherTongue)!=null?s:"default"),a.onChange(async l=>{this.plugin.settings.motherTongue=l==="default"?void 0:l,await this.plugin.saveSettings()}),this.requestLanguages().then(l=>{var c;l.forEach(p=>{a.addOption(p.longCode,p.name)}),a.setValue((c=this.plugin.settings.motherTongue)!=null?c:"default")}).catch(()=>{})})}}]},{heading:"Language Varieties",items:[{name:"Interpret English as",render:o=>{o.addDropdown(a=>{var s;n.englishVarietyDropdown=a,a.addOptions({default:"---","en-US":"English (US)","en-GB":"English (British)","en-CA":"English (Canada)","en-AU":"English (Australia)","en-ZA":"English (South Africa)","en-NZ":"English (New Zealand)"}).setValue((s=this.plugin.settings.englishVeriety)!=null?s:"default").onChange(async l=>{var c;l==="default"?this.plugin.settings.englishVeriety=void 0:(this.plugin.settings.staticLanguage="auto",(c=n.staticLanguageComponent)==null||c.setValue("auto"),this.plugin.settings.englishVeriety=l),await this.plugin.saveSettings()})})}},{name:"Interpret German as",render:o=>{o.addDropdown(a=>{var s;n.germanVarietyDropdown=a,a.addOptions({default:"---","de-DE":"German (Germany)","de-CH":"German (Switzerland)","de-AT":"German (Austria)"}).setValue((s=this.plugin.settings.germanVeriety)!=null?s:"default").onChange(async l=>{var c;l==="default"?this.plugin.settings.germanVeriety=void 0:(this.plugin.settings.staticLanguage="auto",(c=n.staticLanguageComponent)==null||c.setValue("auto"),this.plugin.settings.germanVeriety=l),await this.plugin.saveSettings()})})}},{name:"Interpret Portuguese as",render:o=>{o.addDropdown(a=>{var s;n.portugueseVarietyDropdown=a,a.addOptions({default:"---","pt-BR":"Portuguese (Brazil)","pt-PT":"Portuguese (Portugal)","pt-AO":"Portuguese (Angola)","pt-MZ":"Portuguese (Mozambique)"}).setValue((s=this.plugin.settings.portugueseVeriety)!=null?s:"default").onChange(async l=>{var c;l==="default"?this.plugin.settings.portugueseVeriety=void 0:(this.plugin.settings.staticLanguage="auto",(c=n.staticLanguageComponent)==null||c.setValue("auto"),this.plugin.settings.portugueseVeriety=l),await this.plugin.saveSettings()})})}},{name:"Interpret Catalan as",render:o=>{o.addDropdown(a=>{var s;n.catalanVarietyDropdown=a,a.addOptions({default:"---","ca-ES":"Catalan","ca-ES-valencia":"Catalan (Valencian)"}).setValue((s=this.plugin.settings.catalanVeriety)!=null?s:"default").onChange(async l=>{var c;l==="default"?this.plugin.settings.catalanVeriety=void 0:(this.plugin.settings.staticLanguage="auto",(c=n.staticLanguageComponent)==null||c.setValue("auto"),this.plugin.settings.catalanVeriety=l),await this.plugin.saveSettings()})})}}]},{heading:"Rule Categories",items:[{name:"Picky Mode",desc:"Provides more style and tonality suggestions, detects long or complex sentences, recognizes colloquialism and redundancies, proactively suggests synonyms for commonly overused words",render:o=>{o.addToggle(a=>{a.setValue(this.plugin.settings.pickyMode).onChange(async s=>{this.plugin.settings.pickyMode=s,await this.plugin.saveSettings()})})}},{name:"Other rule categories",desc:"Enter a comma-separated list of categories",render:o=>{o.addText(a=>{var s;return a.setPlaceholder("Eg. CATEGORY_1,CATEGORY_2").setValue((s=this.plugin.settings.ruleOtherCategories)!=null?s:"").onChange(async l=>{this.plugin.settings.ruleOtherCategories=l.replace(/\s+/g,""),await this.plugin.saveSettings()})}),Dn(o)}},{name:"Enable Specific Rules",desc:"Enter a comma-separated list of rules",render:o=>{o.addText(a=>{var s;return a.setPlaceholder("Eg. RULE_1,RULE_2").setValue((s=this.plugin.settings.ruleOtherRules)!=null?s:"").onChange(async l=>{this.plugin.settings.ruleOtherRules=l.replace(/\s+/g,""),await this.plugin.saveSettings()})}),Dn(o)}},{name:"Disable Specific Rules",desc:"Enter a comma-separated list of rules",render:o=>{o.addText(a=>{var s;return a.setPlaceholder("Eg. RULE_1,RULE_2").setValue((s=this.plugin.settings.ruleOtherDisabledRules)!=null?s:"").onChange(async l=>{this.plugin.settings.ruleOtherDisabledRules=l.replace(/\s+/g,""),await this.plugin.saveSettings()})}),Dn(o)}}]}]}getSettingDefinitions(){return this.getSections().map(n=>({type:"group",heading:n.heading,items:n.items}))}display(){let{containerEl:n}=this;n.empty();for(let t of this.getSections()){t.heading&&new W.Setting(n).setName(t.heading).setHeading();for(let r of t.items){let i=new W.Setting(n).setName(r.name);r.desc&&i.setDesc(r.desc),r.render(i)}}}};var bi=require("@codemirror/view");var Ai=require("@codemirror/view"),yi=require("obsidian");function ki(e){return Ai.ViewPlugin.define(n=>{let t=-1,r=1/0,i=-1/0;return{update(u){!e.settings.shouldAutoCheck||!u.docChanged||(r!==1/0&&(r=u.changes.mapPos(r,-1),i=u.changes.mapPos(i,1)),u.changes.iterChangedRanges((o,a,s,l)=>{r=Math.min(r,s),i=Math.max(i,l)}),window.clearTimeout(t),t=window.setTimeout(()=>{let o=n.state.doc.length,a=Math.min(r,o),s=Math.min(i,o);r=1/0,i=-1/0;let l=n.lineBlockAt(a),c=n.lineBlockAt(s),p=n.state.field(yi.editorInfoField);e.runDetection(n,p,l.from,c.to).catch(m=>{console.error(m)})},e.settings.autoCheckDelay))},destroy(){window.clearTimeout(t)}}})}var Ci=require("@codemirror/view"),Si=require("@codemirror/state");var $e=require("obsidian");var we=require("@codemirror/view"),be=require("@codemirror/state"),lt=require("@codemirror/language");var ct=be.StateEffect.define(),pt=be.StateEffect.define(),He=be.StateEffect.define(),zt=be.StateEffect.define();function Bn(e,n,t,r){return!(e>=t&&e<=r||n>=t&&n<=r||t>=e&&t<=n||r>=e&&r<=n)}var Tn=be.StateField.define({create(){return{marks:we.Decoration.none,ignoredRanges:new Set}},update(e,n){e.marks=e.marks.map(n.changes),e.ignoredRanges.clear(),e.marks.between(0,n.newDoc.length,(t,r)=>{e.ignoredRanges.add(`${t},${r}`)}),n.docChanged&&n.selection&&e.marks.size&&(e.marks=e.marks.update({filter:(t,r)=>{let i=Bn(t,r,n.selection.main.from,n.selection.main.to);return i||e.ignoredRanges.delete(`${t},${r}`),i}}));for(let t of n.effects)if(t.is(zt)){let{from:r,to:i}=t.value;e.ignoredRanges.add(`${r},${i}`),e.marks=e.marks.update({add:[we.Decoration.mark({}).range(r,i)]})}return e}}),ze=be.StateField.define({create(){return we.Decoration.none},update(e,n){let{ignoredRanges:t}=n.state.field(Tn),r=new Set,i={},u=(0,lt.syntaxTree)(n.state);e=e.map(n.changes);let o=s=>{if(i[s]!==void 0)return i[s];let l=u.resolveInner(s,1).type.prop(lt.tokenClassNodeProp);return l&&ai.test(l)?i[s]=!1:i[s]=!0,i[s]},a=(s,l,c)=>{if(s.rule.category.id==="TYPOS"){let{app:m}=window,f=n.state.sliceDoc(l,c);if(Bt(m.vault).includes(f))return!1}let p=u.resolve(n.newDoc.lineAt(l).from,1).type.prop(lt.tokenClassNodeProp);return!(p!=null&&p.includes("table")&&s.rule.id==="WHITESPACE_RULE")};n.docChanged&&n.selection&&e.size&&(e=e.update({filter:(s,l)=>Bn(s,l,n.selection.main.from,n.selection.main.to)}));for(let s of n.effects)if(s.is(ct)){let{from:l,to:c,match:p}=s.value,m=`${l},${c}`;!t.has(m)&&!r.has(m)&&o(l)&&o(c)&&a(p,l,c)&&(r.add(m),e=e.update({add:[we.Decoration.mark({class:`lt-underline ${It(p.rule.category.id)}`,match:p}).range(l,c)]}))}else s.is(pt)?e=we.Decoration.none:(s.is(He)||s.is(zt))&&(e=e.update({filter:(l,c)=>Bn(l,c,s.value.from,s.value.to)}));return e},provide:e=>we.EditorView.decorations.from(e)});function Ko(e,n,t){let r=t.match,i=r.message,u=r.shortMessage,o=Tt(r),a=r.rule.category.id,s=r.rule.id,l=e.settings.glassBg?"lt-predictions-container-glass":"lt-predictions-container";return createDiv({cls:[l,It(a)]},c=>{c.addEventListener("mousedown",f=>{f.preventDefault()}),u&&c.createSpan({cls:"lt-title"},f=>{f.createSpan({text:u})}),i&&c.createSpan({cls:"lt-message",text:i});let p=He.of({from:t.from,to:t.to}),m=zt.of({from:t.from,to:t.to});c.createDiv({cls:"lt-bottom"},f=>{o.length&&f.createDiv({cls:"lt-buttoncontainer"},S=>{for(let A of o)S.createEl("button",{text:A},k=>{k.onclick=()=>{n.dispatch({changes:[{from:t.from,to:t.to,insert:A}],effects:[p]})}})}),f.createDiv({cls:"lt-info-container"},S=>{S.createEl("button",{cls:"lt-info-button clickable-icon"},A=>{(0,$e.setIcon)(A,"info"),A.onclick=()=>{let k=document.getElementsByClassName("lt-info-box").item(0);if(!k)throw Error("Programming error: failed to create popup. Please notify the LanguageTool maintainer if this problem persists.");k.hasClass("hidden")?k.removeClass("hidden"):k.addClass("hidden")}}),S.createDiv({cls:"lt-info-box hidden"},A=>{A.createDiv({cls:"lt-info",text:`Category:\xA0${a}`}),A.createDiv({cls:"lt-info",text:`Rule:\xA0${s}`})})})}),c.createDiv({cls:"lt-ignorecontainer"},f=>{f.createEl("button",{cls:"lt-ignore-btn"},S=>{a==="TYPOS"?((0,$e.setIcon)(S.createSpan(),"plus-with-circle"),S.createSpan({text:"Add to personal dictionary"}),S.onclick=()=>{let A=n.state.sliceDoc(t.from,t.to);ui(e.app.vault,A),n.dispatch({effects:[p]});let k=new $e.Notice(createFragment(F=>{F.appendText(`Added "${A}" to the personal dictionary `),F.createEl("button",{text:"Undo",cls:"lt-dict-undo-btn"},w=>{w.onclick=()=>{oi(e.app.vault,A),n.state.sliceDoc(t.from,t.to)===A&&n.dispatch({effects:[ct.of(t)]}),k.hide()}})}),1e4)}):((0,$e.setIcon)(S.createSpan(),"cross"),S.createSpan({text:"Ignore suggestion"}),S.onclick=()=>{n.dispatch({effects:[m]})})})})})}function Ei(e,n,t){var s;let r=t.field(ze);if(r.size===0||t.selection.ranges.length>1)return[];let i=t.selection.main,u=i.from!==i.to,o=[];r.between(t.selection.main.from,t.selection.main.to,(l,c,p)=>{o.push({from:l,to:c,match:p.spec.match})});let a=(s=o[o.length-1])!=null?s:null;if(a!==null){let{from:l,to:c}=a;if(u&&!(i.from===l&&i.to===c))return[];if(e.length){let p=e[0];if(p.pos===l&&p.end===c)return e}return[{pos:l,end:c,above:!0,strictSide:!1,arrow:!1,create:p=>({dom:Ko(n,p,a)})}]}return[]}function wi(e){return Si.StateField.define({create:n=>Ei([],e,n),update:(n,t)=>t.docChanged?[]:Ei(n,e,t.state),provide:n=>Ci.showTooltip.computeN([n],t=>t.field(n))})}function Di(e){return[(0,bi.tooltips)({position:"absolute",tooltipSpace:n=>{let t=n.dom.getBoundingClientRect();return{top:t.top,left:t.left,bottom:t.bottom,right:t.right}}}),Tn,ze,wi(e),ki(e)]}var Yo="languagetool-api-key";function Bi(e,n,t,r){let i=null;return e.state.field(ze).between(n,t,(u,o)=>{(!i||(r==="first"?i.from>u:i.from{var i,u;let t=(i=this.statusBarText.parentElement)==null?void 0:i.getBoundingClientRect(),r=this.statusBarText.getBoundingClientRect();new Z.Menu().addItem(o=>{o.setTitle("Check current document"),o.setIcon("checkbox-glyph"),o.onClick(async()=>{let a=this.app.workspace.getActiveViewOfType(Z.MarkdownView);if(!a||a.getMode()!=="source"){new Z.Notice("Open a note in editing mode to check it",3e3);return}try{await this.runDetection(Ce(a.editor),a)}catch(s){console.error(s)}})}).addItem(o=>{o.setTitle(this.settings.shouldAutoCheck?"Disable automatic checking":"Enable automatic checking"),o.setIcon("uppercase-lowercase-a"),o.onClick(async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()})}).addItem(o=>{o.setTitle("Clear suggestions"),o.setIcon("reset"),o.onClick(()=>{let a=this.app.workspace.getActiveViewOfType(Z.MarkdownView);a&&Ce(a.editor).dispatch({effects:[pt.of(null)]})})}).showAtPosition({x:r.right+5,y:((u=t==null?void 0:t.top)!=null?u:0)-5})}}async onload(){await this.loadSettings();let t=await this.loadData();if((!t||Object.keys(t).length===0)&&(t=this.settings),!t.urlMode||t.urlMode.length===0){let i=st(this.settings.serverUrl);this.settings.urlMode=i==="https://api.languagetool.org"?"standard":i==="https://api.languagetoolplus.com"?"premium":"custom";try{await this.saveSettings(),await this.loadSettings(),new Z.Notice("updated LanguageTool Settings, please confirm your server URL in the settings tab",1e4)}catch(u){console.error(u)}}let r=this.settings.urlMode==="standard"||this.settings.urlMode==="premium"?Lt(this.settings.urlMode):st(this.settings.serverUrl);if(r!==this.settings.serverUrl){this.settings.serverUrl=r;try{await this.saveSettings()}catch(i){console.error(i)}}if(this.settings.motherTongue==="empty"){this.settings.motherTongue=void 0;try{await this.saveSettings()}catch(i){console.error(i)}}await this.resolveApiKeyStorageMode(),await this.migrateStrayPlaintextKey(),this.addSettingTab(new Pt(this.app,this)),this.app.workspace.onLayoutReady(()=>{this.statusBarText=this.addStatusBarItem(),this.setStatusBarReady(),this.registerDomEvent(this.statusBarText,"click",this.handleStatusBarClick)}),this.registerEditorExtension(Di(this)),this.registerCommands()}onunload(){this.hashLru.clear()}registerCommands(){this.addCommand({id:"ltcheck-text",name:"Check Text",editorCallback:(t,r)=>{this.runDetection(Ce(t),r).catch(i=>{console.error(i)})}}),this.addCommand({id:"ltautocheck-text",name:"Toggle Automatic Checking",callback:async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()}}),this.addCommand({id:"ltclear",name:"Clear Suggestions",editorCallback:t=>{Ce(t).dispatch({effects:[pt.of(null)]})}}),this.addCommand({id:"ltjump-to-next-suggestion",name:"Jump to next Suggestion",editorCheckCallback:(t,r)=>{let i=Ce(r),u=r.posToOffset(r.getCursor("to")),o=Bi(i,u+1,1/0,"first");if(t)return!!o;o&&i.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0})}}),this.addCommand({id:"ltjump-to-previous-suggestion",name:"Jump to previous Suggestion",editorCheckCallback:(t,r)=>{let i=Ce(r),u=r.posToOffset(r.getCursor("from")),o=Bi(i,0,u-1,"last");if(t)return!!o;o&&i.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0})}}),this.addCommand(this.getApplySuggestionCommand(1)),this.addCommand(this.getApplySuggestionCommand(2)),this.addCommand(this.getApplySuggestionCommand(3))}getApplySuggestionCommand(t){return{id:`ltaccept-suggestion-${t}`,name:`Accept suggestion #${t} when the cursor is within a Language-Tool-Hint`,editorCheckCallback(r,i){var A;let u=Ce(i),o=i.posToOffset(i.getCursor()),a=[];u.state.field(ze).between(o,o,(k,F,w)=>{a.push({from:k,to:F,value:w})});let s=(A=a[0])==null?void 0:A.value.spec,l=s==null?void 0:s.match,c=l?Tt(l):[],p=a.length===1&&c.length>=t;if(r)return p;if(!p){console.error("Preconditions were not successfull to apply LT-suggestions.");return}let{from:m,to:f}=a[0],S={from:m,to:f,insert:c[t-1]};u.dispatch({changes:[S],effects:[He.of({from:m,to:f})]})}}}setStatusBarReady(){this.isloading=!1,this.statusBarText.empty(),this.statusBarText.createSpan({cls:"lt-status-bar-btn"},t=>{t.createSpan({cls:"lt-status-bar-check-icon",text:"Aa"})})}setStatusBarWorking(){this.isloading||(this.isloading=!0,this.statusBarText.empty(),this.statusBarText.createSpan({cls:["lt-status-bar-btn","lt-loading"]},t=>{(0,Z.setIcon)(t,"sync-small")}))}async runDetection(t,r,i,u){var E,L,M;let o=i===void 0&&u===void 0,a=r.file?(E=this.app.metadataCache.getFileCache(r.file))==null?void 0:E.frontmatter:void 0,s=a==null?void 0:a.tags;if((Array.isArray(s)?s.map(String):typeof s=="string"?s.split(",").map(_=>_.trim()):[]).includes("lt-ignore"))return;this.setStatusBarWorking();let c=t.state,p=c.selection.main,m=c.doc,f=r.data,S=0,A=!1,k=0,F=0;i===void 0&&p&&p.from!==p.to&&(i=p.from,u=p.to),i!==void 0&&u!==void 0&&(f=c.sliceDoc(i,u),S=i,k=i,F=u,A=!0);let w=li(f);w&&(f=f.normalize("NFC"));let y=_=>{var N;return w&&(N=w[_])!=null?N:_},P=si(f),T;if(this.hashLru.has(P))T=this.hashLru.get(P);else{try{T=await fi(f,()=>this.settings,this.getCredentials()),this.hashLru.set(P,T)}catch(_){return this.setStatusBarReady(),Promise.reject(_ instanceof Error?_:new Error(String(_)))}if(m!==t.state.doc){this.setStatusBarReady();return}}let d=[];if(A?d.push(He.of({from:k,to:F})):d.push(pt.of(null)),T.matches)for(let _ of T.matches){let N=y(_.offset)+S,V=y(_.offset+_.length)+S;d.push(ct.of({from:N,to:V,match:_}))}d.length&&t.dispatch({effects:d}),o&&((M=(L=T.matches)==null?void 0:L.length)!=null?M:0)===0&&new Z.Notice("LanguageTool found no issues",3e3),this.setStatusBarReady()}async loadSettings(){this.settings=Object.assign({},Fi,await this.loadData())}async saveSettings(){this.hashLru.clear(),await this.saveData(this.settings)}isSecretStorageAvailable(){return(0,Z.requireApiVersion)("1.11.4")?!!this.app.secretStorage:!1}getCredentials(){var r;let t=this.settings.username;return(0,Z.requireApiVersion)("1.11.4")&&this.settings.apiKeyStorage==="secret"&&this.isSecretStorageAvailable()&&this.settings.apikeySecretName?{username:t,apikey:(r=this.app.secretStorage.getSecret(this.settings.apikeySecretName))!=null?r:void 0}:{username:t,apikey:this.settings.apikey}}async enableSecretStorage(){var t;if(this.isSecretStorageAvailable()){if((0,Z.requireApiVersion)("1.11.4")&&this.settings.apikey){let r=(t=this.settings.apikeySecretName)!=null?t:Yo;this.app.secretStorage.setSecret(r,this.settings.apikey),this.settings.apikeySecretName=r}this.settings.apikey=void 0,this.settings.apiKeyStorage="secret",await this.saveSettings()}}async disableSecretStorage(){if((0,Z.requireApiVersion)("1.11.4")&&this.settings.apikeySecretName&&this.isSecretStorageAvailable()){let t=this.app.secretStorage.getSecret(this.settings.apikeySecretName);if(t===null)return new Z.Notice(`The secret "${this.settings.apikeySecretName}" is not set on this device, so there is no API key to copy back into the synced settings. Set the secret here first, or disable secure storage on the device that holds the key.`,1e4),!1;this.settings.apikey=t}return this.settings.apikeySecretName=void 0,this.settings.apiKeyStorage="local",await this.saveSettings(),!0}async migrateStrayPlaintextKey(){this.settings.apiKeyStorage==="secret"&&this.isSecretStorageAvailable()&&this.settings.apikey&&await this.enableSecretStorage()}async resolveApiKeyStorageMode(){var r,i,u,o;if(this.settings.apiKeyStorage)return;((i=(r=this.settings.apikey)==null?void 0:r.length)!=null?i:0)>0||((o=(u=this.settings.username)==null?void 0:u.length)!=null?o:0)>0?this.settings.apiKeyStorage="local":this.isSecretStorageAvailable()?this.settings.apiKeyStorage="secret":this.settings.apiKeyStorage="local";try{await this.saveSettings()}catch(a){console.error(a)}}}; /*! Bundled license information: is-buffer/index.js: (*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT *) */ /* nosourcemap */