38 lines
134 KiB
JavaScript
38 lines
134 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var _i=Object.create;var yt=Object.defineProperty;var Mi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames;var Ni=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var $t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Hn=(e,t)=>{for(var n in t)yt(e,n,{get:t[n],enumerable:!0})},qn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vi(t))!Ui.call(e,i)&&i!==n&&yt(e,i,{get:()=>t[i],enumerable:!(r=Mi(t,i))||r.enumerable});return e};var Et=(e,t,n)=>(n=e!=null?_i(Ni(e)):{},qn(t||!e||!e.__esModule?yt(n,"default",{value:e,enumerable:!0}):n,e)),ji=e=>qn(yt({},"__esModule",{value:!0}),e);var Yn=$t((cs,Ht)=>{(function(){var e;typeof Ht!="undefined"?e=Ht.exports=r:e=function(){return this||(0,eval)("this")}(),e.format=r,e.vsprintf=n,typeof console!="undefined"&&typeof console.log=="function"&&(e.printf=t);function t(){console.log(r.apply(null,arguments))}function n(i,u){return r.apply(null,[i].concat(u))}function r(i){for(var u=1,o=[].slice.call(arguments),s=0,c=i.length,a="",l,h=!1,f,p,F=!1,E,C=function(){return o[u++]},x=function(){for(var b="";/\d/.test(i[s]);)b+=i[s++],l=i[s];return b.length>0?parseInt(b):null};s<c;++s)if(l=i[s],h)switch(h=!1,l=="."?(F=!1,l=i[++s]):l=="0"&&i[s+1]=="."?(F=!0,s+=2,l=i[s]):F=!0,E=x(),l){case"b":a+=parseInt(C(),10).toString(2);break;case"c":f=C(),typeof f=="string"||f instanceof String?a+=f:a+=String.fromCharCode(parseInt(f,10));break;case"d":a+=parseInt(C(),10);break;case"f":p=String(parseFloat(C()).toFixed(E||6)),a+=F?p:p.replace(/^0/,"");break;case"j":a+=JSON.stringify(C());break;case"o":a+="0"+parseInt(C(),10).toString(8);break;case"s":a+=C();break;case"x":a+="0x"+parseInt(C(),10).toString(16);break;case"X":a+="0x"+parseInt(C(),10).toString(16).toUpperCase();break;default:a+=l;break}else l==="%"?h=!0:a+=l;return a}})()});var En=$t((sh,Hr)=>{Hr.exports=function(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}});var Jr=$t((ah,Gr)=>{"use strict";var It=Object.prototype.hasOwnProperty,Xr=Object.prototype.toString,qr=Object.defineProperty,Wr=Object.getOwnPropertyDescriptor,Yr=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Xr.call(t)==="[object Array]"},Qr=function(t){if(!t||Xr.call(t)!=="[object Object]")return!1;var n=It.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&It.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i=="undefined"||It.call(t,i)},Kr=function(t,n){qr&&n.name==="__proto__"?qr(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Zr=function(t,n){if(n==="__proto__")if(It.call(t,n)){if(Wr)return Wr(t,n).value}else return;return t[n]};Gr.exports=function e(){var t,n,r,i,u,o,s=arguments[0],c=1,a=arguments.length,l=!1;for(typeof s=="boolean"&&(l=s,s=arguments[1]||{},c=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});c<a;++c)if(t=arguments[c],t!=null)for(n in t)r=Zr(s,n),i=Zr(t,n),s!==i&&(l&&i&&(Qr(i)||(u=Yr(i)))?(u?(u=!1,o=r&&Yr(r)?r:[]):o=r&&Qr(r)?r:{},Kr(s,{name:n,newValue:e(l,o,i)})):typeof i!="undefined"&&Kr(s,{name:n,newValue:i}));return s}});var Jo={};Hn(Jo,{SUGGESTIONS:()=>vt,default:()=>Nt,getElectronWindow:()=>Xo});module.exports=ji(Jo);var oe=require("obsidian");var N=require("obsidian");var je={children(e){return e.children},annotatetextnode(e,t){return e.type==="text"?{offset:{end:e.position.end.offset,start:e.position.start.offset},text:t.substring(e.position.start.offset,e.position.end.offset)}:null},interpretmarkup(e=""){return e}};function Vi(e,t,n=je){let r=[];function i(u){let o=n.annotatetextnode(u,t);o!==null&&r.push(o);let s=n.children(u);s!==null&&Array.isArray(s)&&s.forEach(i)}return i(e),r}function $i(e,t,n=je){let r=[],i={offset:{end:0,start:0}};for(let o of t){let s=e.substring(i.offset.end,o.offset.start);r.push({interpretAs:n.interpretmarkup(s),markup:s,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:n.interpretmarkup(u),markup:u,offset:{end:e.length,start:i.offset.end}}),{annotation:r}}function Wn(e,t,n=je){let r=Vi(t,e,n);return $i(e,r,n)}var ts=ye(/[A-Za-z]/),ns=ye(/[\dA-Za-z]/),rs=ye(/[#-'*+\--9=?A-Z^-~]/);var is=ye(/\d/),us=ye(/[\dA-Fa-f]/),os=ye(/[!-/:-@[-`{-~]/);function it(e){return e!==null&&e<-2}function ut(e){return e===-2||e===-1||e===32}var ss=ye(/\p{P}|\p{S}/u),as=ye(/\s/);function ye(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}var Qn=Et(Yn(),1),ot=Object.assign(Ie(Error),{eval:Ie(EvalError),range:Ie(RangeError),reference:Ie(ReferenceError),syntax:Ie(SyntaxError),type:Ie(TypeError),uri:Ie(URIError)});function Ie(e){return t.displayName=e.displayName||e.name,t;function t(n,...r){let i=n&&(0,Qn.default)(n,...r);return new e(i)}}var Ft={}.hasOwnProperty,Kn={yaml:"-",toml:"+"};function Ve(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:["yaml"];for(;++n<r.length;)t[n]=qi(r[n]);return t}function qi(e){let t=e;if(typeof t=="string"){if(!Ft.call(Kn,t))throw ot("Missing matter definition for `%s`",t);t={type:t,marker:Kn[t]}}else if(typeof t!="object")throw ot("Expected matter to be an object, not `%j`",t);if(!Ft.call(t,"type"))throw ot("Missing `type` in matter `%j`",t);if(!Ft.call(t,"fence")&&!Ft.call(t,"marker"))throw ot("Missing `marker` or `fence` in matter `%j`",t);return t}function Wt(e){let t=Ve(e),n={},r=-1;for(;++r<t.length;){let i=t[r],u=qt(i,"open").charCodeAt(0),o=Wi(i),s=n[u];Array.isArray(s)?s.push(o):n[u]=[o]}return{flow:n}}function Wi(e){let t=e.anywhere,n=e.type,r=n+"Fence",i=r+"Sequence",u=n+"Value",o={tokenize:l,partial:!0},s,c=0;return{tokenize:a,concrete:!0};function a(h,f,p){let F=this;return E;function E(w){let S=F.now();return S.column===1&&(S.line===1||t)&&(s=qt(e,"open"),c=0,w===s.charCodeAt(c))?(h.enter(n),h.enter(r),h.enter(i),C(w)):p(w)}function C(w){return c===s.length?(h.exit(i),ut(w)?(h.enter("whitespace"),x(w)):b(w)):w===s.charCodeAt(c++)?(h.consume(w),C):p(w)}function x(w){return ut(w)?(h.consume(w),x):(h.exit("whitespace"),b(w))}function b(w){return it(w)?(h.exit(r),h.enter("lineEnding"),h.consume(w),h.exit("lineEnding"),s=qt(e,"close"),c=0,h.attempt(o,g,A)):p(w)}function A(w){return w===null||it(w)?L(w):(h.enter(u),O(w))}function O(w){return w===null||it(w)?(h.exit(u),L(w)):(h.consume(w),O)}function L(w){return w===null?p(w):(h.enter("lineEnding"),h.consume(w),h.exit("lineEnding"),h.attempt(o,g,A))}function g(w){return h.exit(n),f(w)}}function l(h,f,p){let F=0;return E;function E(A){return A===s.charCodeAt(F)?(h.enter(r),h.enter(i),C(A)):p(A)}function C(A){return F===s.length?(h.exit(i),ut(A)?(h.enter("whitespace"),x(A)):b(A)):A===s.charCodeAt(F++)?(h.consume(A),C):p(A)}function x(A){return ut(A)?(h.consume(A),x):(h.exit("whitespace"),b(A))}function b(A){return A===null||it(A)?(h.exit(r),f(A)):p(A)}}}function qt(e,t){return e.marker?Zn(e.marker,t).repeat(3):Zn(e.fence,t)}function Zn(e,t){return typeof e=="string"?e:e[t]}function Yt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Kt(e){let t=Ve(e),n={},r={},i=-1;for(;++i<t.length;){let u=t[i];n[u.type]=Yi(u),r[u.type]=Qi,r[u.type+"Value"]=Ki}return{enter:n,exit:r}}function Yi(e){return t;function t(n){this.enter({type:e.type,value:""},n),this.buffer()}}function Qi(e){let t=this.resume(),n=this.stack[this.stack.length-1];"value"in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function Ki(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function Zt(e){let t=[],n={},r=Ve(e),i=-1;for(;++i<r.length;){let u=r[i];n[u.type]=Zi(u);let o=Qt(u,"open");t.push({atBreak:!0,character:o.charAt(0),after:Yt(o.charAt(1))})}return{unsafe:t,handlers:n}}function Zi(e){let t=Qt(e,"open"),n=Qt(e,"close");return r;function r(i){return t+(i.value?`
|
|
`+i.value:"")+`
|
|
`+n}}function Qt(e,t){return e.marker?Xn(e.marker,t).repeat(3):Xn(e.fence,t)}function Xn(e,t){return typeof e=="string"?e:e[t]}var Xi="yaml";function At(e){let t=this,n=e||Xi,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Wt(n)),u.push(Kt(n)),o.push(Zt(n))}var Gi={};function Xt(e,t){let n=t||Gi,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Jn(e,r,i)}function Jn(e,t,n){if(Ji(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gn(e.children,t,n)}return Array.isArray(e)?Gn(e,t,n):""}function Gn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Jn(e[i],t,n);return r.join("")}function Ji(e){return!!(e&&typeof e=="object")}function Z(e,t,n,r){let i=e.length,u=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);u<r.length;)o=r.slice(u,u+1e4),o.unshift(t,0),e.splice(...o),u+=1e4,t+=1e4}function J(e,t){return e.length>0?(Z(e,e.length,0,t),e):t}var er={}.hasOwnProperty;function tr(e){let t={},n=-1;for(;++n<e.length;)eu(t,e[n]);return t}function eu(e,t){let n;for(n in t){let i=(er.call(e,n)?e[n]:void 0)||(e[n]={}),u=t[n],o;if(u)for(o in u){er.call(i,o)||(i[o]=[]);let s=u[o];tu(i[o],Array.isArray(s)?s:s?[s]:[])}}}function tu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Z(e,0,0,r)}var nr=/[!-\/:-@\[-`\{-~\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 Ns=Ee(/[A-Za-z]/),Us=Ee(/[\dA-Za-z]/),js=Ee(/[#-'*+\--9=?A-Z^-~]/);var Vs=Ee(/\d/),$s=Ee(/[\dA-Fa-f]/),Hs=Ee(/[!-/:-@[-`{-~]/);function Gt(e){return e===-2||e===-1||e===32}var qs=Ee(nr),Ws=Ee(/\s/);function Ee(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function P(e,t,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,u=0;return o;function o(c){return Gt(c)?(e.enter(n),s(c)):t(c)}function s(c){return Gt(c)&&u++<i?(e.consume(c),s):(e.exit(n),t(c))}}var rr=/[!-\/:-@\[-`\{-~\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 Gs=Fe(/[A-Za-z]/),Js=Fe(/[\dA-Za-z]/),ea=Fe(/[#-'*+\--9=?A-Z^-~]/);var ta=Fe(/\d/),na=Fe(/[\dA-Fa-f]/),ra=Fe(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}var ia=Fe(rr),ua=Fe(/\s/);function Fe(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}var ir={tokenize:nu};function nu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),P(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),u(s)}function u(s){let c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return $e(s)?(e.consume(s),e.exit("chunkText"),u):(e.consume(s),o)}}var or={tokenize:ru},ur={tokenize:iu};function ru(e){let t=this,n=[],r=0,i,u,o;return s;function s(A){if(r<n.length){let O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,c,a)(A)}return a(A)}function c(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&b();let O=t.events.length,L=O,g;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){g=t.events[L][1].end;break}x(r);let w=O;for(;w<t.events.length;)t.events[w][1].end=Object.assign({},g),w++;return Z(t.events,L+1,0,t.events.slice(O)),t.events.length=w,a(A)}return s(A)}function a(A){if(r===n.length){if(!i)return f(A);if(i.currentConstruct&&i.currentConstruct.concrete)return F(A);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ur,l,h)(A)}function l(A){return i&&b(),x(r),f(A)}function h(A){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,F(A)}function f(A){return t.containerState={},e.attempt(ur,p,F)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),f(A)}function F(A){if(A===null){i&&b(),x(0),e.consume(A);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:u,_tokenizer:i}),E(A)}function E(A){if(A===null){C(e.exit("chunkFlow"),!0),x(0),e.consume(A);return}return $e(A)?(e.consume(A),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(A),E)}function C(A,O){let L=t.sliceStream(A);if(O&&L.push(null),A.previous=u,u&&(u.next=A),u=A,i.defineSkip(A.start),i.write(L),t.parser.lazy[A.start.line]){let g=i.events.length;for(;g--;)if(i.events[g][1].start.offset<o&&(!i.events[g][1].end||i.events[g][1].end.offset>o))return;let w=t.events.length,S=w,I,H;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(I){H=t.events[S][1].end;break}I=!0}for(x(r),g=w;g<t.events.length;)t.events[g][1].end=Object.assign({},H),g++;Z(t.events,S+1,0,t.events.slice(w)),t.events.length=g}}function x(A){let O=n.length;for(;O-- >A;){let L=n[O];t.containerState=L[1],L[0].exit.call(t,e)}n.length=A}function b(){i.write([null]),u=void 0,i=void 0,t.containerState._closeFlow=void 0}}function iu(e,t,n){return P(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}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 re=Ae(/[A-Za-z]/),ee=Ae(/[\dA-Za-z]/),ar=Ae(/[#-'*+\--9=?A-Z^-~]/);function lr(e){return e!==null&&(e<32||e===127)}var st=Ae(/\d/),cr=Ae(/[\dA-Fa-f]/),pr=Ae(/[!-/:-@[-`{-~]/);function T(e){return e!==null&&e<-2}function Q(e){return e!==null&&(e<0||e===32)}function _(e){return e===-2||e===-1||e===32}var hr=Ae(sr),fr=Ae(/\s/);function Ae(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Jt(e){if(e===null||Q(e)||fr(e))return 1;if(hr(e))return 2}function He(e,t,n){let r=[],i=-1;for(;++i<e.length;){let u=e[i].resolveAll;u&&!r.includes(u)&&(t=u(t,n),r.push(u))}return t}var at={name:"attention",tokenize:ou,resolveAll:uu};function uu(e,t){let n=-1,r,i,u,o,s,c,a,l;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let h=Object.assign({},e[r][1].end),f=Object.assign({},e[n][1].start);mr(h,-c),mr(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},s={type:c>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:f},u={type:c>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:c>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[r][1].end=Object.assign({},o.start),e[n][1].start=Object.assign({},s.end),a=[],e[r][1].end.offset-e[r][1].start.offset&&(a=J(a,[["enter",e[r][1],t],["exit",e[r][1],t]])),a=J(a,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",u,t]]),a=J(a,He(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),a=J(a,[["exit",u,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(l=2,a=J(a,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,Z(e,r-1,n-r+3,a),n=r+a.length-l-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ou(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Jt(r),u;return o;function o(c){return u=c,e.enter("attentionSequence"),s(c)}function s(c){if(c===u)return e.consume(c),s;let a=e.exit("attentionSequence"),l=Jt(c),h=!l||l===2&&i||n.includes(c),f=!i||i===2&&l||n.includes(r);return a._open=!!(u===42?h:h&&(i||!f)),a._close=!!(u===42?f:f&&(l||!h)),t(c)}}function mr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var en={name:"autolink",tokenize:su};function su(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(p){return re(p)?(e.consume(p),o):a(p)}function o(p){return p===43||p===45||p===46||ee(p)?(r=1,s(p)):a(p)}function s(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||ee(p))&&r++<32?(e.consume(p),s):(r=0,a(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||lr(p)?n(p):(e.consume(p),c)}function a(p){return p===64?(e.consume(p),l):ar(p)?(e.consume(p),a):n(p)}function l(p){return ee(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,l):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||ee(p))&&r++<63){let F=p===45?f:h;return e.consume(p),F}return n(p)}}var Ce={tokenize:au,partial:!0};function au(e,t,n){return r;function r(u){return _(u)?P(e,i,"linePrefix")(u):i(u)}function i(u){return u===null||T(u)?t(u):n(u)}}var Ct={name:"blockQuote",tokenize:lu,continuation:{tokenize:cu},exit:pu};function lu(e,t,n){let r=this;return i;function i(o){if(o===62){let s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),u}return n(o)}function u(o){return _(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function cu(e,t,n){let r=this;return i;function i(o){return _(o)?P(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):u(o)}function u(o){return e.attempt(Ct,t,n)(o)}}function pu(e){e.exit("blockQuote")}var wt={name:"characterEscape",tokenize:hu};function hu(e,t,n){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),i}function i(u){return pr(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(u)}}var dr=document.createElement("i");function qe(e){let t="&"+e+";";dr.innerHTML=t;let n=dr.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}var kt={name:"characterReference",tokenize:fu};function fu(e,t,n){let r=this,i=0,u,o;return s;function s(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),u=31,o=ee,l(h))}function a(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,o=cr,l):(e.enter("characterReferenceValue"),u=7,o=st,l(h))}function l(h){if(h===59&&i){let f=e.exit("characterReferenceValue");return o===ee&&!qe(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<u?(e.consume(h),l):n(h)}}var gr={tokenize:du,partial:!0},bt={name:"codeFenced",tokenize:mu,concrete:!0};function mu(e,t,n){let r=this,i={tokenize:L,partial:!0},u=0,o=0,s;return c;function c(g){return a(g)}function a(g){let w=r.events[r.events.length-1];return u=w&&w[1].type==="linePrefix"?w[2].sliceSerialize(w[1],!0).length:0,s=g,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(g)}function l(g){return g===s?(o++,e.consume(g),l):o<3?n(g):(e.exit("codeFencedFenceSequence"),_(g)?P(e,h,"whitespace")(g):h(g))}function h(g){return g===null||T(g)?(e.exit("codeFencedFence"),r.interrupt?t(g):e.check(gr,E,O)(g)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===null||T(g)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(g)):_(g)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),P(e,p,"whitespace")(g)):g===96&&g===s?n(g):(e.consume(g),f)}function p(g){return g===null||T(g)?h(g):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),F(g))}function F(g){return g===null||T(g)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(g)):g===96&&g===s?n(g):(e.consume(g),F)}function E(g){return e.attempt(i,O,C)(g)}function C(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),x}function x(g){return u>0&&_(g)?P(e,b,"linePrefix",u+1)(g):b(g)}function b(g){return g===null||T(g)?e.check(gr,E,O)(g):(e.enter("codeFlowValue"),A(g))}function A(g){return g===null||T(g)?(e.exit("codeFlowValue"),b(g)):(e.consume(g),A)}function O(g){return e.exit("codeFenced"),t(g)}function L(g,w,S){let I=0;return H;function H(R){return g.enter("lineEnding"),g.consume(R),g.exit("lineEnding"),$}function $(R){return g.enter("codeFencedFence"),_(R)?P(g,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):M(R)}function M(R){return R===s?(g.enter("codeFencedFenceSequence"),D(R)):S(R)}function D(R){return R===s?(I++,g.consume(R),D):I>=o?(g.exit("codeFencedFenceSequence"),_(R)?P(g,z,"whitespace")(R):z(R)):S(R)}function z(R){return R===null||T(R)?(g.exit("codeFencedFence"),w(R)):S(R)}}}function du(e,t,n){let r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u)}function u(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}var lt={name:"codeIndented",tokenize:xu},gu={tokenize:yu,partial:!0};function xu(e,t,n){let r=this;return i;function i(a){return e.enter("codeIndented"),P(e,u,"linePrefix",5)(a)}function u(a){let l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?o(a):n(a)}function o(a){return a===null?c(a):T(a)?e.attempt(gu,o,c)(a):(e.enter("codeFlowValue"),s(a))}function s(a){return a===null||T(a)?(e.exit("codeFlowValue"),o(a)):(e.consume(a),s)}function c(a){return e.exit("codeIndented"),t(a)}}function yu(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):T(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):P(e,u,"linePrefix",5)(o)}function u(o){let s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):T(o)?i(o):n(o)}}var tn={name:"codeText",tokenize:Au,resolve:Eu,previous:Fu};function Eu(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Fu(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Au(e,t,n){let r=this,i=0,u,o;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),c(f)}function c(f){return f===96?(e.consume(f),i++,c):(e.exit("codeTextSequence"),a(f))}function a(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),a):f===96?(o=e.enter("codeTextSequence"),u=0,h(f)):T(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(f))}function l(f){return f===null||f===32||f===96||T(f)?(e.exit("codeTextData"),a(f)):(e.consume(f),l)}function h(f){return f===96?(e.consume(f),u++,h):u===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",l(f))}}function St(e){let t={},n=-1,r,i,u,o,s,c,a;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,u=0,u<c.length&&c[u][1].type==="lineEndingBlank"&&(u+=2),u<c.length&&c[u][1].type==="content"))for(;++u<c.length&&c[u][1].type!=="content";)c[u][1].type==="chunkText"&&(c[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Cu(e,n)),n=t[n],a=!0);else if(r[1]._container){for(u=n,i=void 0;u--&&(o=e[u],o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(e[i][1].type="lineEndingBlank"),o[1].type="lineEnding",i=u);i&&(r[1].end=Object.assign({},e[i][1].start),s=e.slice(i,n),s.unshift(r),Z(e,i,n-i+1,s))}}return!a}function Cu(e,t){let n=e[t][1],r=e[t][2],i=t-1,u=[],o=n._tokenizer||r.parser[n.contentType](n.start),s=o.events,c=[],a={},l,h,f=-1,p=n,F=0,E=0,C=[E];for(;p;){for(;e[++i][1]!==p;);u.push(i),p._tokenizer||(l=r.sliceStream(p),p.next||l.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(l),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(E=f+1,C.push(E),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),f=C.length;f--;){let x=s.slice(C[f],C[f+1]),b=u.pop();c.unshift([b,b+x.length-1]),Z(e,b,2,x)}for(f=-1;++f<c.length;)a[F+c[f][0]]=F+c[f][1],F+=c[f][1]-c[f][0]-1;return a}var nn={tokenize:bu,resolve:ku},wu={tokenize:Su,partial:!0};function ku(e){return St(e),e}function bu(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?u(s):T(s)?e.check(wu,o,u)(s):(e.consume(s),i)}function u(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Su(e,t,n){let r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),P(e,u,"linePrefix")}function u(o){if(o===null||T(o))return n(o);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}var xr=/[!-\/:-@\[-`\{-~\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 tl=we(/[A-Za-z]/),nl=we(/[\dA-Za-z]/),rl=we(/[#-'*+\--9=?A-Z^-~]/);function rn(e){return e!==null&&(e<32||e===127)}var il=we(/\d/),ul=we(/[\dA-Fa-f]/),ol=we(/[!-/:-@[-`{-~]/);function yr(e){return e!==null&&e<-2}function Er(e){return e!==null&&(e<0||e===32)}var sl=we(xr),al=we(/\s/);function we(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Dt(e,t,n,r,i,u,o,s,c){let a=c||Number.POSITIVE_INFINITY,l=0;return h;function h(x){return x===60?(e.enter(r),e.enter(i),e.enter(u),e.consume(x),e.exit(u),f):x===null||x===32||x===41||rn(x)?n(x):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),E(x))}function f(x){return x===62?(e.enter(u),e.consume(x),e.exit(u),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(s),f(x)):x===null||x===60||yr(x)?n(x):(e.consume(x),x===92?F:p)}function F(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function E(x){return!l&&(x===null||x===41||Er(x))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(x)):l<a&&x===40?(e.consume(x),l++,E):x===41?(e.consume(x),l--,E):x===null||x===32||x===40||rn(x)?n(x):(e.consume(x),x===92?C:E)}function C(x){return x===40||x===41||x===92?(e.consume(x),E):E(x)}}var Fr=/[!-\/:-@\[-`\{-~\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 ml=ke(/[A-Za-z]/),dl=ke(/[\dA-Za-z]/),gl=ke(/[#-'*+\--9=?A-Z^-~]/);var xl=ke(/\d/),yl=ke(/[\dA-Fa-f]/),El=ke(/[!-/:-@[-`{-~]/);function un(e){return e!==null&&e<-2}function Ar(e){return e===-2||e===-1||e===32}var Fl=ke(Fr),Al=ke(/\s/);function ke(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Tt(e,t,n,r,i,u){let o=this,s=0,c;return a;function a(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(u),l}function l(p){return s>999||p===null||p===91||p===93&&!c||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(u),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):un(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||un(p)||s++>999?(e.exit("chunkString"),l(p)):(e.consume(p),c||(c=!Ar(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,h):h(p)}}var Cr=/[!-\/:-@\[-`\{-~\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 Dl=be(/[A-Za-z]/),Tl=be(/[\dA-Za-z]/),Ol=be(/[#-'*+\--9=?A-Z^-~]/);var Bl=be(/\d/),Pl=be(/[\dA-Fa-f]/),Ll=be(/[!-/:-@[-`{-~]/);function on(e){return e!==null&&e<-2}var Il=be(Cr),Rl=be(/\s/);function be(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Ot(e,t,n,r,i,u){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,c):n(f)}function c(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(u),a(f))}function a(f){return f===o?(e.exit(u),c(o)):f===null?n(f):on(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),P(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(f))}function l(f){return f===o||f===null||on(f)?(e.exit("chunkString"),a(f)):(e.consume(f),f===92?h:l)}function h(f){return f===o||f===92?(e.consume(f),l):l(f)}}var wr=/[!-\/:-@\[-`\{-~\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 jl=Se(/[A-Za-z]/),Vl=Se(/[\dA-Za-z]/),$l=Se(/[#-'*+\--9=?A-Z^-~]/);var Hl=Se(/\d/),ql=Se(/[\dA-Fa-f]/),Wl=Se(/[!-/:-@[-`{-~]/);function kr(e){return e!==null&&e<-2}function br(e){return e===-2||e===-1||e===32}var Yl=Se(wr),Ql=Se(/\s/);function Se(e){return t;function t(n){return n!==null&&e.test(String.fromCharCode(n))}}function Re(e,t){let n;return r;function r(i){return kr(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):br(i)?P(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function de(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var sn={name:"definition",tokenize:Tu},Du={tokenize:Ou,partial:!0};function Tu(e,t,n){let r=this,i;return u;function u(p){return e.enter("definition"),o(p)}function o(p){return Tt.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=de(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Q(p)?Re(e,a)(p):a(p)}function a(p){return Dt(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function l(p){return e.attempt(Du,h,h)(p)}function h(p){return _(p)?P(e,f,"whitespace")(p):f(p)}function f(p){return p===null||T(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function Ou(e,t,n){return r;function r(s){return Q(s)?Re(e,i)(s):n(s)}function i(s){return Ot(e,u,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function u(s){return _(s)?P(e,o,"whitespace")(s):o(s)}function o(s){return s===null||T(s)?t(s):n(s)}}var an={name:"hardBreakEscape",tokenize:Bu};function Bu(e,t,n){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),i}function i(u){return T(u)?(e.exit("hardBreakEscape"),t(u)):n(u)}}var ln={name:"headingAtx",tokenize:Lu,resolve:Pu};function Pu(e,t){let n=e.length-2,r=3,i,u;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},u={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Z(e,r,n-r+1,[["enter",i,t],["enter",u,t],["exit",u,t],["exit",i,t]])),e}function Lu(e,t,n){let r=0;return i;function i(l){return e.enter("atxHeading"),u(l)}function u(l){return e.enter("atxHeadingSequence"),o(l)}function o(l){return l===35&&r++<6?(e.consume(l),o):l===null||Q(l)?(e.exit("atxHeadingSequence"),s(l)):n(l)}function s(l){return l===35?(e.enter("atxHeadingSequence"),c(l)):l===null||T(l)?(e.exit("atxHeading"),t(l)):_(l)?P(e,s,"whitespace")(l):(e.enter("atxHeadingText"),a(l))}function c(l){return l===35?(e.consume(l),c):(e.exit("atxHeadingSequence"),s(l))}function a(l){return l===null||l===35||Q(l)?(e.exit("atxHeadingText"),s(l)):(e.consume(l),a)}}var Sr=["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"],cn=["pre","script","style","textarea"];var pn={name:"htmlFlow",tokenize:_u,resolveTo:zu,concrete:!0},Iu={tokenize:vu,partial:!0},Ru={tokenize:Mu,partial:!0};function zu(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _u(e,t,n){let r=this,i,u,o,s,c;return a;function a(d){return l(d)}function l(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),h}function h(d){return d===33?(e.consume(d),f):d===47?(e.consume(d),u=!0,E):d===63?(e.consume(d),i=3,r.interrupt?t:m):re(d)?(e.consume(d),o=String.fromCharCode(d),C):n(d)}function f(d){return d===45?(e.consume(d),i=2,p):d===91?(e.consume(d),i=5,s=0,F):re(d)?(e.consume(d),i=4,r.interrupt?t:m):n(d)}function p(d){return d===45?(e.consume(d),r.interrupt?t:m):n(d)}function F(d){let ne="CDATA[";return d===ne.charCodeAt(s++)?(e.consume(d),s===ne.length?r.interrupt?t:M:F):n(d)}function E(d){return re(d)?(e.consume(d),o=String.fromCharCode(d),C):n(d)}function C(d){if(d===null||d===47||d===62||Q(d)){let ne=d===47,Ne=o.toLowerCase();return!ne&&!u&&cn.includes(Ne)?(i=1,r.interrupt?t(d):M(d)):Sr.includes(o.toLowerCase())?(i=6,ne?(e.consume(d),x):r.interrupt?t(d):M(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(d):u?b(d):A(d))}return d===45||ee(d)?(e.consume(d),o+=String.fromCharCode(d),C):n(d)}function x(d){return d===62?(e.consume(d),r.interrupt?t:M):n(d)}function b(d){return _(d)?(e.consume(d),b):H(d)}function A(d){return d===47?(e.consume(d),H):d===58||d===95||re(d)?(e.consume(d),O):_(d)?(e.consume(d),A):H(d)}function O(d){return d===45||d===46||d===58||d===95||ee(d)?(e.consume(d),O):L(d)}function L(d){return d===61?(e.consume(d),g):_(d)?(e.consume(d),L):A(d)}function g(d){return d===null||d===60||d===61||d===62||d===96?n(d):d===34||d===39?(e.consume(d),c=d,w):_(d)?(e.consume(d),g):S(d)}function w(d){return d===c?(e.consume(d),c=null,I):d===null||T(d)?n(d):(e.consume(d),w)}function S(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||Q(d)?L(d):(e.consume(d),S)}function I(d){return d===47||d===62||_(d)?A(d):n(d)}function H(d){return d===62?(e.consume(d),$):n(d)}function $(d){return d===null||T(d)?M(d):_(d)?(e.consume(d),$):n(d)}function M(d){return d===45&&i===2?(e.consume(d),q):d===60&&i===1?(e.consume(d),Y):d===62&&i===4?(e.consume(d),ue):d===63&&i===3?(e.consume(d),m):d===93&&i===5?(e.consume(d),ce):T(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Iu,pe,D)(d)):d===null||T(d)?(e.exit("htmlFlowData"),D(d)):(e.consume(d),M)}function D(d){return e.check(Ru,z,pe)(d)}function z(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),R}function R(d){return d===null||T(d)?D(d):(e.enter("htmlFlowData"),M(d))}function q(d){return d===45?(e.consume(d),m):M(d)}function Y(d){return d===47?(e.consume(d),o="",se):M(d)}function se(d){if(d===62){let ne=o.toLowerCase();return cn.includes(ne)?(e.consume(d),ue):M(d)}return re(d)&&o.length<8?(e.consume(d),o+=String.fromCharCode(d),se):M(d)}function ce(d){return d===93?(e.consume(d),m):M(d)}function m(d){return d===62?(e.consume(d),ue):d===45&&i===2?(e.consume(d),m):M(d)}function ue(d){return d===null||T(d)?(e.exit("htmlFlowData"),pe(d)):(e.consume(d),ue)}function pe(d){return e.exit("htmlFlow"),t(d)}}function Mu(e,t,n){let r=this;return i;function i(o){return T(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),u):n(o)}function u(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function vu(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ce,t,n)}}var hn={name:"htmlText",tokenize:Nu};function Nu(e,t,n){let r=this,i,u,o;return s;function s(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),c}function c(m){return m===33?(e.consume(m),a):m===47?(e.consume(m),L):m===63?(e.consume(m),A):re(m)?(e.consume(m),S):n(m)}function a(m){return m===45?(e.consume(m),l):m===91?(e.consume(m),u=0,F):re(m)?(e.consume(m),b):n(m)}function l(m){return m===45?(e.consume(m),p):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),f):T(m)?(o=h,Y(m)):(e.consume(m),h)}function f(m){return m===45?(e.consume(m),p):h(m)}function p(m){return m===62?q(m):m===45?f(m):h(m)}function F(m){let ue="CDATA[";return m===ue.charCodeAt(u++)?(e.consume(m),u===ue.length?E:F):n(m)}function E(m){return m===null?n(m):m===93?(e.consume(m),C):T(m)?(o=E,Y(m)):(e.consume(m),E)}function C(m){return m===93?(e.consume(m),x):E(m)}function x(m){return m===62?q(m):m===93?(e.consume(m),x):E(m)}function b(m){return m===null||m===62?q(m):T(m)?(o=b,Y(m)):(e.consume(m),b)}function A(m){return m===null?n(m):m===63?(e.consume(m),O):T(m)?(o=A,Y(m)):(e.consume(m),A)}function O(m){return m===62?q(m):A(m)}function L(m){return re(m)?(e.consume(m),g):n(m)}function g(m){return m===45||ee(m)?(e.consume(m),g):w(m)}function w(m){return T(m)?(o=w,Y(m)):_(m)?(e.consume(m),w):q(m)}function S(m){return m===45||ee(m)?(e.consume(m),S):m===47||m===62||Q(m)?I(m):n(m)}function I(m){return m===47?(e.consume(m),q):m===58||m===95||re(m)?(e.consume(m),H):T(m)?(o=I,Y(m)):_(m)?(e.consume(m),I):q(m)}function H(m){return m===45||m===46||m===58||m===95||ee(m)?(e.consume(m),H):$(m)}function $(m){return m===61?(e.consume(m),M):T(m)?(o=$,Y(m)):_(m)?(e.consume(m),$):I(m)}function M(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,D):T(m)?(o=M,Y(m)):_(m)?(e.consume(m),M):(e.consume(m),z)}function D(m){return m===i?(e.consume(m),i=void 0,R):m===null?n(m):T(m)?(o=D,Y(m)):(e.consume(m),D)}function z(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Q(m)?I(m):(e.consume(m),z)}function R(m){return m===47||m===62||Q(m)?I(m):n(m)}function q(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function Y(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),se}function se(m){return _(m)?P(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ce(m)}function ce(m){return e.enter("htmlTextData"),o(m)}}var ze={name:"labelEnd",tokenize:qu,resolveTo:Hu,resolveAll:$u},Uu={tokenize:Wu},ju={tokenize:Yu},Vu={tokenize:Qu};function $u(e){let t=-1;for(;++t<e.length;){let n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function Hu(e,t){let n=e.length,r=0,i,u,o,s;for(;n--;)if(i=e[n][1],u){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(u=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);let c={type:e[u][1].type==="labelLink"?"link":"image",start:Object.assign({},e[u][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"label",start:Object.assign({},e[u][1].start),end:Object.assign({},e[o][1].end)},l={type:"labelText",start:Object.assign({},e[u+r+2][1].end),end:Object.assign({},e[o-2][1].start)};return s=[["enter",c,t],["enter",a,t]],s=J(s,e.slice(u+1,u+r+3)),s=J(s,[["enter",l,t]]),s=J(s,He(t.parser.constructs.insideSpan.null,e.slice(u+r+4,o-3),t)),s=J(s,[["exit",l,t],e[o-2],e[o-1],["exit",a,t]]),s=J(s,e.slice(o+1)),s=J(s,[["exit",c,t]]),Z(e,u,e.length,s),e}function qu(e,t,n){let r=this,i=r.events.length,u,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){u=r.events[i][1];break}return s;function s(f){return u?u._inactive?h(f):(o=r.parser.defined.includes(de(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(Uu,l,o?l:h)(f):f===91?e.attempt(ju,l,o?a:h)(f):o?l(f):h(f)}function a(f){return e.attempt(Vu,l,h)(f)}function l(f){return t(f)}function h(f){return u._balanced=!0,n(f)}}function Wu(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Q(h)?Re(e,u)(h):u(h)}function u(h){return h===41?l(h):Dt(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Q(h)?Re(e,c)(h):l(h)}function s(h){return n(h)}function c(h){return h===34||h===39||h===40?Ot(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):l(h)}function a(h){return Q(h)?Re(e,l)(h):l(h)}function l(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Yu(e,t,n){let r=this;return i;function i(s){return Tt.call(r,e,u,o,"reference","referenceMarker","referenceString")(s)}function u(s){return r.parser.defined.includes(de(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Qu(e,t,n){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),i}function i(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):n(u)}}var fn={name:"labelStartImage",tokenize:Ku,resolveAll:ze.resolveAll};function Ku(e,t,n){let r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),u}function u(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}var mn={name:"labelStartLink",tokenize:Zu,resolveAll:ze.resolveAll};function Zu(e,t,n){let r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),u}function u(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}var ct={name:"lineEnding",tokenize:Xu};function Xu(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),P(e,t,"linePrefix")}}var _e={name:"thematicBreak",tokenize:Gu};function Gu(e,t,n){let r=0,i;return u;function u(a){return e.enter("thematicBreak"),o(a)}function o(a){return i=a,s(a)}function s(a){return a===i?(e.enter("thematicBreakSequence"),c(a)):r>=3&&(a===null||T(a))?(e.exit("thematicBreak"),t(a)):n(a)}function c(a){return a===i?(e.consume(a),r++,c):(e.exit("thematicBreakSequence"),_(a)?P(e,s,"whitespace")(a):s(a))}}var X={name:"list",tokenize:to,continuation:{tokenize:no},exit:io},Ju={tokenize:uo,partial:!0},eo={tokenize:ro,partial:!0};function to(e,t,n){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 s;function s(p){let F=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(F==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:st(p)){if(r.containerState.type||(r.containerState.type=F,e.enter(F,{_container:!0})),F==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(_e,n,a)(p):a(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return st(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),a(p)):n(p)}function a(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ce,r.interrupt?n:l,e.attempt(Ju,f,h))}function l(p){return r.containerState.initialBlankLine=!0,u++,f(p)}function h(p){return _(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function no(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ce,i,u);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,P(e,t,"listItemIndent",r.containerState.size+1)(s)}function u(s){return r.containerState.furtherBlankLines||!_(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(eo,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,P(e,e.attempt(X,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function ro(e,t,n){let r=this;return P(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?t(u):n(u)}}function io(e){e.exit(this.containerState.type)}function uo(e,t,n){let r=this;return P(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!_(u)&&o&&o[1].type==="listItemPrefixWhitespace"?t(u):n(u)}}var Bt={name:"setextUnderline",tokenize:so,resolveTo:oo};function oo(e,t){let n=e.length,r,i,u;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!u&&e[n][1].type==="definition"&&(u=n);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,t]),e.splice(u+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[u][1].end)):e[r][1]=o,e.push(["exit",o,t]),e}function so(e,t,n){let r=this,i;return u;function u(a){let l=r.events.length,h;for(;l--;)if(r.events[l][1].type!=="lineEnding"&&r.events[l][1].type!=="linePrefix"&&r.events[l][1].type!=="content"){h=r.events[l][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=a,o(a)):n(a)}function o(a){return e.enter("setextHeadingLineSequence"),s(a)}function s(a){return a===i?(e.consume(a),s):(e.exit("setextHeadingLineSequence"),_(a)?P(e,c,"lineSuffix")(a):c(a))}function c(a){return a===null||T(a)?(e.exit("setextHeadingLine"),t(a)):n(a)}}var Dr={tokenize:ao};function ao(e){let t=this,n=e.attempt(Ce,r,e.attempt(this.parser.constructs.flowInitial,i,P(e,e.attempt(this.parser.constructs.flow,i,e.attempt(nn,i)),"linePrefix")));return n;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var Tr={resolveAll:Lr()},Or=Pr("string"),Br=Pr("text");function Pr(e){return{tokenize:t,resolveAll:Lr(e==="text"?lo:void 0)};function t(n){let r=this,i=this.parser.constructs[e],u=n.attempt(i,o,s);return o;function o(l){return a(l)?u(l):s(l)}function s(l){if(l===null){n.consume(l);return}return n.enter("data"),n.consume(l),c}function c(l){return a(l)?(n.exit("data"),u(l)):(n.consume(l),c)}function a(l){if(l===null)return!0;let h=i[l],f=-1;if(h)for(;++f<h.length;){let p=h[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Lr(e){return t;function t(n,r){let i=-1,u;for(;++i<=n.length;)u===void 0?n[i]&&n[i][1].type==="data"&&(u=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==u+2&&(n[u][1].end=n[i-1][1].end,n.splice(u+2,i-u-2),i=u+2),u=void 0);return e?e(n,r):n}}function lo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){let r=e[n-1][1],i=t.sliceStream(r),u=i.length,o=-1,s=0,c;for(;u--;){let a=i[u];if(typeof a=="string"){for(o=a.length;a.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(a===-2)c=!0,s++;else if(a!==-1){u++;break}}if(s){let a={type:n===e.length||c||s<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-s,offset:r.end.offset-s,_index:r.start._index+u,_bufferIndex:u?o:r.start._bufferIndex+o},end:Object.assign({},r.end)};r.end=Object.assign({},a.start),r.start.offset===r.end.offset?Object.assign(r,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}function Ir(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),i={},u=[],o=[],s=[],c=!0,a={consume:O,enter:L,exit:g,attempt:I(w),check:I(S),interrupt:I(S,{interrupt:!0})},l={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:E,sliceSerialize:F,now:C,defineSkip:x,write:p},h=t.tokenize.call(l,a),f;return t.resolveAll&&u.push(t),l;function p(D){return o=J(o,D),b(),o[o.length-1]!==null?[]:(H(t,0),l.events=He(u,l.events,l),l.events)}function F(D,z){return po(E(D),z)}function E(D){return co(o,D)}function C(){let{line:D,column:z,offset:R,_index:q,_bufferIndex:Y}=r;return{line:D,column:z,offset:R,_index:q,_bufferIndex:Y}}function x(D){i[D.line]=D.column,M()}function b(){let D;for(;r._index<o.length;){let z=o[r._index];if(typeof z=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<z.length;)A(z.charCodeAt(r._bufferIndex));else A(z)}}function A(D){c=void 0,f=D,h=h(D)}function O(D){$e(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,M()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=D,c=!0}function L(D,z){let R=z||{};return R.type=D,R.start=C(),l.events.push(["enter",R,l]),s.push(R),R}function g(D){let z=s.pop();return z.end=C(),l.events.push(["exit",z,l]),z}function w(D,z){H(D,z.from)}function S(D,z){z.restore()}function I(D,z){return R;function R(q,Y,se){let ce,m,ue,pe;return Array.isArray(q)?ne(q):"tokenize"in q?ne([q]):d(q);function d(K){return tt;function tt(he){let Ue=he!==null&&K[he],Le=he!==null&&K.null,jt=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ne(jt)(he)}}function ne(K){return ce=K,m=0,K.length===0?se:Ne(K[m])}function Ne(K){return tt;function tt(he){return pe=$(),ue=K,K.partial||(l.currentConstruct=K),K.name&&l.parser.constructs.disable.null.includes(K.name)?et(he):K.tokenize.call(z?Object.assign(Object.create(l),z):l,a,Ut,et)(he)}}function Ut(K){return c=!0,D(ue,pe),Y}function et(K){return c=!0,pe.restore(),++m<ce.length?Ne(ce[m]):se}}}function H(D,z){D.resolveAll&&!u.includes(D)&&u.push(D),D.resolve&&Z(l.events,z,l.events.length-z,D.resolve(l.events.slice(z),l)),D.resolveTo&&(l.events=D.resolveTo(l.events,l))}function $(){let D=C(),z=l.previous,R=l.currentConstruct,q=l.events.length,Y=Array.from(s);return{restore:se,from:q};function se(){r=D,l.previous=z,l.currentConstruct=R,l.events.length=q,s=Y,M()}}function M(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function co(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,u=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,u)];else{if(o=e.slice(n,i),r>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}u>0&&o.push(e[i].slice(0,u))}return o}function po(e,t){let n=-1,r=[],i;for(;++n<e.length;){let u=e[n],o;if(typeof u=="string")o=u;else switch(u){case-5:{o="\r";break}case-4:{o=`
|
|
`;break}case-3:{o=`\r
|
|
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(u)}i=u===-2,r.push(o)}return r.join("")}var dn={};Hn(dn,{attentionMarkers:()=>Fo,contentInitial:()=>fo,disable:()=>Ao,document:()=>ho,flow:()=>go,flowInitial:()=>mo,insideSpan:()=>Eo,string:()=>xo,text:()=>yo});var ho={42:X,43:X,45:X,48:X,49:X,50:X,51:X,52:X,53:X,54:X,55:X,56:X,57:X,62:Ct},fo={91:sn},mo={[-2]:lt,[-1]:lt,32:lt},go={35:ln,42:_e,45:[Bt,_e],60:pn,61:Bt,95:_e,96:bt,126:bt},xo={38:kt,92:wt},yo={[-5]:ct,[-4]:ct,[-3]:ct,33:fn,38:kt,42:at,60:[en,hn],91:mn,92:[an,wt],93:ze,95:at,96:tn},Eo={null:[at,Tr]},Fo={null:[42,95]},Ao={null:[]};function Rr(e){let n=tr([dn,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(ir),document:i(or),flow:i(Dr),string:i(Or),text:i(Br)};return r;function i(u){return o;function o(s){return Ir(r,u,s)}}}var zr=/[\0\t\n\r]/g;function _r(){let e=1,t="",n=!0,r;return i;function i(u,o,s){let c=[],a,l,h,f,p;for(u=t+u.toString(o),h=0,t="",n&&(u.charCodeAt(0)===65279&&h++,n=void 0);h<u.length;){if(zr.lastIndex=h,a=zr.exec(u),f=a&&a.index!==void 0?a.index:u.length,p=u.charCodeAt(f),!a){t=u.slice(h);break}if(p===10&&h===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<f&&(c.push(u.slice(h,f)),e+=f-h),p){case 0:{c.push(65533),e++;break}case 9:{for(l=Math.ceil(e/4)*4,c.push(-2);e++<l;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return s&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}function Mr(e){for(;!St(e););return e}function Pt(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCharCode(n)}var Co=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vr(e){return e.replace(Co,wo)}function wo(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let i=n.charCodeAt(1),u=i===120||i===88;return Pt(n.slice(u?2:1),u?16:10)}return qe(n)||e}function De(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Nr(e.position):"start"in e||"end"in e?Nr(e):"line"in e||"column"in e?gn(e):""}function gn(e){return Ur(e&&e.line)+":"+Ur(e&&e.column)}function Nr(e){return gn(e&&e.start)+"-"+gn(e&&e.end)}function Ur(e){return e&&typeof e=="number"?e:1}var Vr={}.hasOwnProperty,xn=function(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ko(n)(Mr(Rr(n).document().write(_r()(e,t,!0))))};function ko(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Vn),autolinkProtocol:$,autolinkEmail:$,atxHeading:s(Nn),blockQuote:s(Ue),characterEscape:$,characterReference:$,codeFenced:s(Le),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:s(Le,c),codeText:s(jt,c),codeTextData:$,data:$,codeFlowValue:$,definition:s(Ti),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:s(Oi),hardBreakEscape:s(Un),hardBreakTrailing:s(Un),htmlFlow:s(jn,c),htmlFlowData:$,htmlText:s(jn,c),htmlTextData:$,image:s(Bi),label:c,link:s(Vn),listItem:s(Pi),listItemValue:F,listOrdered:s($n,p),listUnordered:s($n),paragraph:s(Li),reference:Ne,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:s(Nn),strong:s(Ii),thematicBreak:s(zi)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:he,autolinkProtocol:tt,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:et,characterReferenceMarkerNumeric:et,characterReferenceValue:K,codeFenced:l(b),codeFencedFence:x,codeFencedFenceInfo:E,codeFencedFenceMeta:C,codeFlowValue:M,codeIndented:l(A),codeText:l(Y),codeTextData:M,data:M,definition:l(),definitionDestinationString:g,definitionLabelString:O,definitionTitleString:L,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(R),htmlFlowData:M,htmlText:l(q),htmlTextData:M,image:l(ce),label:ue,labelText:m,lineEnding:D,link:l(se),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Ut,resourceDestinationString:pe,resourceTitleString:d,resource:ne,setextHeading:l(H),setextHeadingLineSequence:I,setextHeadingText:S,strong:l(),thematicBreak:l()}};$r(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(y){let k={type:"root",children:[]},B={stack:[k],tokenStack:[],config:t,enter:a,exit:h,buffer:c,resume:f,setData:u,getData:o},U=[],V=-1;for(;++V<y.length;)if(y[V][1].type==="listOrdered"||y[V][1].type==="listUnordered")if(y[V][0]==="enter")U.push(V);else{let ae=U.pop();V=i(y,ae,V)}for(V=-1;++V<y.length;){let ae=t[y[V][0]];Vr.call(ae,y[V][1].type)&&ae[y[V][1].type].call(Object.assign({sliceSerialize:y[V][2].sliceSerialize},B),y[V][1])}if(B.tokenStack.length>0){let ae=B.tokenStack[B.tokenStack.length-1];(ae[1]||jr).call(B,void 0,ae[0])}for(k.position={start:Te(y.length>0?y[0][1].start:{line:1,column:1,offset:0}),end:Te(y.length>0?y[y.length-2][1].end:{line:1,column:1,offset:0})},V=-1;++V<t.transforms.length;)k=t.transforms[V](k)||k;return k}function i(y,k,B){let U=k-1,V=-1,ae=!1,xe,fe,nt,rt;for(;++U<=B;){let W=y[U];if(W[1].type==="listUnordered"||W[1].type==="listOrdered"||W[1].type==="blockQuote"?(W[0]==="enter"?V++:V--,rt=void 0):W[1].type==="lineEndingBlank"?W[0]==="enter"&&(xe&&!rt&&!V&&!nt&&(nt=U),rt=void 0):W[1].type==="linePrefix"||W[1].type==="listItemValue"||W[1].type==="listItemMarker"||W[1].type==="listItemPrefix"||W[1].type==="listItemPrefixWhitespace"||(rt=void 0),!V&&W[0]==="enter"&&W[1].type==="listItemPrefix"||V===-1&&W[0]==="exit"&&(W[1].type==="listUnordered"||W[1].type==="listOrdered")){if(xe){let Vt=U;for(fe=void 0;Vt--;){let me=y[Vt];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;fe&&(y[fe][1].type="lineEndingBlank",ae=!0),me[1].type="lineEnding",fe=Vt}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}nt&&(!fe||nt<fe)&&(xe._spread=!0),xe.end=Object.assign({},fe?y[fe][1].start:W[1].end),y.splice(fe||U,0,["exit",xe,W[2]]),U++,B++}W[1].type==="listItemPrefix"&&(xe={type:"listItem",_spread:!1,start:Object.assign({},W[1].start),end:void 0},y.splice(U,0,["enter",xe,W[2]]),U++,B++,nt=void 0,rt=!0)}}return y[k][1]._spread=ae,B}function u(y,k){n[y]=k}function o(y){return n[y]}function s(y,k){return B;function B(U){a.call(this,y(U),U),k&&k.call(this,U)}}function c(){this.stack.push({type:"fragment",children:[]})}function a(y,k,B){return this.stack[this.stack.length-1].children.push(y),this.stack.push(y),this.tokenStack.push([k,B]),y.position={start:Te(k.start)},y}function l(y){return k;function k(B){y&&y.call(this,B),h.call(this,B)}}function h(y,k){let B=this.stack.pop(),U=this.tokenStack.pop();if(U)U[0].type!==y.type&&(k?k.call(this,y,U[0]):(U[1]||jr).call(this,y,U[0]));else throw new Error("Cannot close `"+y.type+"` ("+De({start:y.start,end:y.end})+"): it\u2019s not open");return B.position.end=Te(y.end),B}function f(){return Xt(this.stack.pop())}function p(){u("expectingFirstListItemValue",!0)}function F(y){if(o("expectingFirstListItemValue")){let k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(y),10),u("expectingFirstListItemValue")}}function E(){let y=this.resume(),k=this.stack[this.stack.length-1];k.lang=y}function C(){let y=this.resume(),k=this.stack[this.stack.length-1];k.meta=y}function x(){o("flowCodeInside")||(this.buffer(),u("flowCodeInside",!0))}function b(){let y=this.resume(),k=this.stack[this.stack.length-1];k.value=y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u("flowCodeInside")}function A(){let y=this.resume(),k=this.stack[this.stack.length-1];k.value=y.replace(/(\r?\n|\r)$/g,"")}function O(y){let k=this.resume(),B=this.stack[this.stack.length-1];B.label=k,B.identifier=de(this.sliceSerialize(y)).toLowerCase()}function L(){let y=this.resume(),k=this.stack[this.stack.length-1];k.title=y}function g(){let y=this.resume(),k=this.stack[this.stack.length-1];k.url=y}function w(y){let k=this.stack[this.stack.length-1];if(!k.depth){let B=this.sliceSerialize(y).length;k.depth=B}}function S(){u("setextHeadingSlurpLineEnding",!0)}function I(y){let k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(y).charCodeAt(0)===61?1:2}function H(){u("setextHeadingSlurpLineEnding")}function $(y){let k=this.stack[this.stack.length-1],B=k.children[k.children.length-1];(!B||B.type!=="text")&&(B=Ri(),B.position={start:Te(y.start)},k.children.push(B)),this.stack.push(B)}function M(y){let k=this.stack.pop();k.value+=this.sliceSerialize(y),k.position.end=Te(y.end)}function D(y){let k=this.stack[this.stack.length-1];if(o("atHardBreak")){let B=k.children[k.children.length-1];B.position.end=Te(y.end),u("atHardBreak");return}!o("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(k.type)&&($.call(this,y),M.call(this,y))}function z(){u("atHardBreak",!0)}function R(){let y=this.resume(),k=this.stack[this.stack.length-1];k.value=y}function q(){let y=this.resume(),k=this.stack[this.stack.length-1];k.value=y}function Y(){let y=this.resume(),k=this.stack[this.stack.length-1];k.value=y}function se(){let y=this.stack[this.stack.length-1];if(o("inReference")){let k=o("referenceType")||"shortcut";y.type+="Reference",y.referenceType=k,delete y.url,delete y.title}else delete y.identifier,delete y.label;u("referenceType")}function ce(){let y=this.stack[this.stack.length-1];if(o("inReference")){let k=o("referenceType")||"shortcut";y.type+="Reference",y.referenceType=k,delete y.url,delete y.title}else delete y.identifier,delete y.label;u("referenceType")}function m(y){let k=this.sliceSerialize(y),B=this.stack[this.stack.length-2];B.label=vr(k),B.identifier=de(k).toLowerCase()}function ue(){let y=this.stack[this.stack.length-1],k=this.resume(),B=this.stack[this.stack.length-1];if(u("inReference",!0),B.type==="link"){let U=y.children;B.children=U}else B.alt=k}function pe(){let y=this.resume(),k=this.stack[this.stack.length-1];k.url=y}function d(){let y=this.resume(),k=this.stack[this.stack.length-1];k.title=y}function ne(){u("inReference")}function Ne(){u("referenceType","collapsed")}function Ut(y){let k=this.resume(),B=this.stack[this.stack.length-1];B.label=k,B.identifier=de(this.sliceSerialize(y)).toLowerCase(),u("referenceType","full")}function et(y){u("characterReferenceType",y.type)}function K(y){let k=this.sliceSerialize(y),B=o("characterReferenceType"),U;B?(U=Pt(k,B==="characterReferenceMarkerNumeric"?10:16),u("characterReferenceType")):U=qe(k);let V=this.stack.pop();V.value+=U,V.position.end=Te(y.end)}function tt(y){M.call(this,y);let k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(y)}function he(y){M.call(this,y);let k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(y)}function Ue(){return{type:"blockquote",children:[]}}function Le(){return{type:"code",lang:null,meta:null,value:""}}function jt(){return{type:"inlineCode",value:""}}function Ti(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oi(){return{type:"emphasis",children:[]}}function Nn(){return{type:"heading",depth:void 0,children:[]}}function Un(){return{type:"break"}}function jn(){return{type:"html",value:""}}function Bi(){return{type:"image",title:null,url:"",alt:null}}function Vn(){return{type:"link",title:null,url:"",children:[]}}function $n(y){return{type:"list",ordered:y.type==="listOrdered",start:null,spread:y._spread,children:[]}}function Pi(y){return{type:"listItem",spread:y._spread,checked:null,children:[]}}function Li(){return{type:"paragraph",children:[]}}function Ii(){return{type:"strong",children:[]}}function Ri(){return{type:"text",value:""}}function zi(){return{type:"thematicBreak"}}}function Te(e){return{line:e.line,column:e.column,offset:e.offset}}function $r(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?$r(e,r):bo(e,r)}}function bo(e,t){let n;for(n in t)if(Vr.call(t,n)){if(n==="canContainEols"){let r=t[n];r&&e[n].push(...r)}else if(n==="transforms"){let r=t[n];r&&e[n].push(...r)}else if(n==="enter"||n==="exit"){let r=t[n];r&&Object.assign(e[n],r)}}}function jr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+De({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+De({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+De({start:t.start,end:t.end})+") is still open")}function Lt(e){Object.assign(this,{Parser:n=>{let r=this.data("settings");return xn(n,Object.assign({},r,e,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function yn(e){if(e)throw e}var ai=Et(En(),1),Dn=Et(Jr(),1);function pt(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Fn(){let e=[],t={run:n,use:r};return t;function n(...i){let u=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(c,...a){let l=e[++u],h=-1;if(c){o(c);return}for(;++h<i.length;)(a[h]===null||a[h]===void 0)&&(a[h]=i[h]);i=a,l?ei(l,s)(...a):o(null,...a)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function ei(e,t){let n;return r;function r(...o){let s=e.length>o.length,c;s&&o.push(i);try{c=e.apply(this,o)}catch(a){let l=a;if(s&&n)throw l;return i(l)}s||(c&&c.then&&typeof c.then=="function"?c.then(u,i):c instanceof Error?i(c):u(c))}function i(o,...s){n||(n=!0,t(o,...s))}function u(o){i(null,o)}}var ii=Et(En(),1);var G=class extends Error{constructor(t,n,r){let i=[null,null],u={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof n=="string"&&(r=n,n=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))}n&&("type"in n||"position"in n?n.position&&(u=n.position):"start"in n||"end"in n?u=n:("line"in n||"column"in n)&&(u.start=n)),this.name=De(n)||"1:1",this.message=typeof t=="object"?t.message:t,this.stack="",typeof t=="object"&&t.stack&&(this.stack=t.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 le={basename:So,dirname:Do,extname:To,join:Oo,sep:"/"};function So(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ht(e);let n=0,r=-1,i=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.charCodeAt(i)===47){if(u){n=i+1;break}}else r<0&&(u=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.charCodeAt(i)===47){if(u){n=i+1;break}}else o<0&&(u=!0,o=i+1),s>-1&&(e.charCodeAt(i)===t.charCodeAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Do(e){if(ht(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.charCodeAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.charCodeAt(0)===47?"/":".":t===1&&e.charCodeAt(0)===47?"//":e.slice(0,t)}function To(e){ht(e);let t=e.length,n=-1,r=0,i=-1,u=0,o;for(;t--;){let s=e.charCodeAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:u!==1&&(u=1):i>-1&&(u=-1)}return i<0||n<0||u===0||u===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Oo(...e){let t=-1,n;for(;++t<e.length;)ht(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Bo(n)}function Bo(e){ht(e);let t=e.charCodeAt(0)===47,n=Po(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.charCodeAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Po(e,t){let n="",r=0,i=-1,u=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.charCodeAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||u===1))if(i!==o-1&&u===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,u=0;continue}}else if(n.length>0){n="",r=0,i=o,u=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,u=0}else s===46&&u>-1?u++:u=-1}return n}function ht(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var ti={cwd:Lo};function Lo(){return"/"}function We(e){return e!==null&&typeof e=="object"&&e.href&&e.origin}function ni(e){if(typeof e=="string")e=new URL(e);else if(!We(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Io(e)}function Io(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 t=e.pathname,n=-1;for(;++n<t.length;)if(t.charCodeAt(n)===37&&t.charCodeAt(n+1)===50){let r=t.charCodeAt(n+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}var An=["history","path","basename","stem","extname","dirname"],ft=class{constructor(t){let n;t?typeof t=="string"||Ro(t)?n={value:t}:We(t)?n={path:t}:n=t:n={},this.data={},this.messages=[],this.history=[],this.cwd=ti.cwd(),this.value,this.stored,this.result,this.map;let r=-1;for(;++r<An.length;){let u=An[r];u in n&&n[u]!==void 0&&n[u]!==null&&(this[u]=u==="history"?[...n[u]]:n[u])}let i;for(i in n)An.includes(i)||(this[i]=n[i])}get path(){return this.history[this.history.length-1]}set path(t){We(t)&&(t=ni(t)),wn(t,"path"),this.path!==t&&this.history.push(t)}get dirname(){return typeof this.path=="string"?le.dirname(this.path):void 0}set dirname(t){ri(this.basename,"dirname"),this.path=le.join(t||"",this.basename)}get basename(){return typeof this.path=="string"?le.basename(this.path):void 0}set basename(t){wn(t,"basename"),Cn(t,"basename"),this.path=le.join(this.dirname||"",t)}get extname(){return typeof this.path=="string"?le.extname(this.path):void 0}set extname(t){if(Cn(t,"extname"),ri(this.dirname,"extname"),t){if(t.charCodeAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=le.join(this.dirname,this.stem+(t||""))}get stem(){return typeof this.path=="string"?le.basename(this.path,this.extname):void 0}set stem(t){wn(t,"stem"),Cn(t,"stem"),this.path=le.join(this.dirname||"",t+(this.extname||""))}toString(t){return(this.value||"").toString(t||void 0)}message(t,n,r){let i=new G(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}info(t,n,r){let i=this.message(t,n,r);return i.fatal=null,i}fail(t,n,r){let i=this.message(t,n,r);throw i.fatal=!0,i}};function Cn(e,t){if(e&&e.includes(le.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+le.sep+"`")}function wn(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ri(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Ro(e){return(0,ii.default)(e)}var Tn=ci().freeze(),li={}.hasOwnProperty;function ci(){let e=Fn(),t=[],n={},r,i=-1;return u.data=o,u.Parser=void 0,u.Compiler=void 0,u.freeze=s,u.attachers=t,u.use=c,u.parse=a,u.stringify=l,u.run=h,u.runSync=f,u.process=p,u.processSync=F,u;function u(){let E=ci(),C=-1;for(;++C<t.length;)E.use(...t[C]);return E.data((0,Dn.default)(!0,{},n)),E}function o(E,C){return typeof E=="string"?arguments.length===2?(Sn("data",r),n[E]=C,u):li.call(n,E)&&n[E]||null:E?(Sn("data",r),n=E,u):n}function s(){if(r)return u;for(;++i<t.length;){let[E,...C]=t[i];if(C[0]===!1)continue;C[0]===!0&&(C[0]=void 0);let x=E.call(u,...C);typeof x=="function"&&e.use(x)}return r=!0,i=Number.POSITIVE_INFINITY,u}function c(E,...C){let x;if(Sn("use",r),E!=null)if(typeof E=="function")L(E,...C);else if(typeof E=="object")Array.isArray(E)?O(E):A(E);else throw new TypeError("Expected usable value, not `"+E+"`");return x&&(n.settings=Object.assign(n.settings||{},x)),u;function b(g){if(typeof g=="function")L(g);else if(typeof g=="object")if(Array.isArray(g)){let[w,...S]=g;L(w,...S)}else A(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function A(g){O(g.plugins),g.settings&&(x=Object.assign(x||{},g.settings))}function O(g){let w=-1;if(g!=null)if(Array.isArray(g))for(;++w<g.length;){let S=g[w];b(S)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function L(g,w){let S=-1,I;for(;++S<t.length;)if(t[S][0]===g){I=t[S];break}I?(pt(I[1])&&pt(w)&&(w=(0,Dn.default)(!0,I[1],w)),I[1]=w):t.push([...arguments])}}function a(E){u.freeze();let C=mt(E),x=u.Parser;return kn("parse",x),ui(x,"parse")?new x(String(C),C).parse():x(String(C),C)}function l(E,C){u.freeze();let x=mt(C),b=u.Compiler;return bn("stringify",b),oi(E),ui(b,"compile")?new b(E,x).compile():b(E,x)}function h(E,C,x){if(oi(E),u.freeze(),!x&&typeof C=="function"&&(x=C,C=void 0),!x)return new Promise(b);b(null,x);function b(A,O){e.run(E,mt(C),L);function L(g,w,S){w=w||E,g?O(g):A?A(w):x(null,w,S)}}}function f(E,C){let x,b;return u.run(E,C,A),si("runSync","run",b),x;function A(O,L){yn(O),x=L,b=!0}}function p(E,C){if(u.freeze(),kn("process",u.Parser),bn("process",u.Compiler),!C)return new Promise(x);x(null,C);function x(b,A){let O=mt(E);u.run(u.parse(O),O,(g,w,S)=>{if(g||!w||!S)L(g);else{let I=u.stringify(w,S);I==null||(Mo(I)?S.value=I:S.result=I),L(g,S)}});function L(g,w){g||!w?A(g):b?b(w):C(null,w)}}}function F(E){let C;u.freeze(),kn("processSync",u.Parser),bn("processSync",u.Compiler);let x=mt(E);return u.process(x,b),si("processSync","process",C),x;function b(A){C=!0,yn(A)}}}function ui(e,t){return typeof e=="function"&&e.prototype&&(zo(e.prototype)||t in e.prototype)}function zo(e){let t;for(t in e)if(li.call(e,t))return!0;return!1}function kn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `Parser`")}function bn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `Compiler`")}function Sn(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oi(e){if(!pt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function si(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function mt(e){return _o(e)?e:new ft(e)}function _o(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Mo(e){return typeof e=="string"||(0,ai.default)(e)}var On={children(e){return je.children(e)},annotatetextnode(e,t){return je.annotatetextnode(e,t)},interpretmarkup(e=""){return`
|
|
`.repeat((e.match(/\n/g)||[]).length)},remarkoptions:{}};function pi(e,t=On){let n=Tn().use(Lt,t.remarkoptions).use(At,["yaml","toml"]).parse(e);return Wn(e,n,t)}var Be=require("obsidian");var Pn=class{add(t,n,r){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],n&&this[i][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}},Ln=class{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(i=>{if(typeof i!="object"||!i.name||!i.init)throw new Error("Invalid JSEP plugin format");this.registered[i.name]||(i.init(this.jsep),this.registered[i.name]=i)})}},te=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,n,r){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=n,r?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,n){return e.literals[t]=n,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){let n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(e.hooks[t]){let r={context:this,node:n};return e.hooks.run(t,r),r.node}return n}searchHook(t){if(e.hooks[t]){let n={context:this};return e.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,i;for(;this.index<this.expr.length;)if(r=this.code,r===e.SEMCOL_CODE||r===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(r===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),n=t.length;for(;n>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,r,i,u,o,s,c,a;if(o=this.gobbleToken(),!o||(n=this.gobbleBinaryOp(),!n))return o;for(u={value:n,prec:e.binaryPrecedence(n),right_a:e.right_associative.has(n)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+n),i=[o,u,s];n=this.gobbleBinaryOp();){if(r=e.binaryPrecedence(n),r===0){this.index-=n.length;break}u={value:n,prec:r,right_a:e.right_associative.has(n)},a=n;let l=h=>u.right_a&&h.right_a?r>h.prec:r<=h.prec;for(;i.length>2&&l(i[i.length-2]);)s=i.pop(),n=i.pop().value,o=i.pop(),t={type:e.BINARY_EXP,operator:n,left:o,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+a),i.push(u,t)}for(c=i.length-1,t=i[c];c>1;)t={type:e.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:t},c-=2;return t}gobbleToken(){let t,n,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,e.max_unop_len),r=n.length;r>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;let u=this.gobbleToken();return u||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:n,argument:u,prefix:!0})}n=n.substr(0,--r)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===e.PERIOD_CODE||n===e.OBRACK_CODE||n===e.OPAREN_CODE||n===e.QUMARK_CODE;){let r;if(n===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(n===e.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,r;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return r=this.code,e.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(r===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",n=this.index,r=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let u=this.expr.charAt(this.index++);if(u===r){i=!0;break}else if(u==="\\")switch(u=this.expr.charAt(this.index++),u){case"n":t+=`
|
|
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=u}else t+=u}return i||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){let n=[],r=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let u=this.code;if(u===t){r=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(u===e.COMMA_CODE){if(this.index++,i++,i!==n.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let o=n.length;o<i;o++)n.push(null)}}else if(n.length!==i&&i!==0)this.throwError("Expected comma");else{let o=this.gobbleExpression();(!o||o.type===e.COMPOUND)&&this.throwError("Expected comma"),n.push(o)}}return r||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},No=new Pn;Object.assign(te,{hooks:No,plugins:new Ln(te),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});te.max_unop_len=te.getMaxKeyLen(te.unary_ops);te.max_binop_len=te.getMaxKeyLen(te.binary_ops);var ge=e=>new te(e).parse(),Uo=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(te).filter(e=>!Uo.includes(e)&&ge[e]===void 0).forEach(e=>{ge[e]=te[e]});ge.Jsep=te;var jo="ConditionalExpression",Vo={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;let r=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let u=this.gobbleExpression();if(u||this.throwError("Expected expression"),n.node={type:jo,test:r,consequent:i,alternate:u},r.operator&&e.binary_ops[r.operator]<=.9){let o=r;for(;o.right.operator&&e.binary_ops[o.right.operator]<=.9;)o=o.right;n.node.test=o.right,o.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};ge.plugins.register(Vo);var hi=47,$o=92,Ho={name:"regex",init(e){e.hooks.add("gobble-token",function(n){if(this.code===hi){let r=++this.index,i=!1;for(;this.index<this.expr.length;){if(this.code===hi&&!i){let u=this.expr.slice(r,this.index),o="";for(;++this.index<this.expr.length;){let c=this.code;if(c>=97&&c<=122||c>=65&&c<=90||c>=48&&c<=57)o+=this.char;else break}let s;try{s=new RegExp(u,o)}catch(c){this.throwError(c.message)}return n.node={type:e.LITERAL,value:s,raw:this.expr.slice(r-1,this.index)},n.node=this.gobbleTokenProperty(n.node),n.node}this.code===e.OBRACK_CODE?i=!0:i&&this.code===e.CBRACK_CODE&&(i=!1),this.index+=this.code===$o?2:1}this.throwError("Unclosed Regex")}})}},Bn=43,qo=45,Ye={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Bn,qo],assignmentPrecedence:.9,init(e){let t=[e.IDENTIFIER,e.MEMBER_EXP];Ye.assignmentOperators.forEach(r=>e.addBinaryOp(r,Ye.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(i){let u=this.code;Ye.updateOperators.some(o=>o===u&&o===this.expr.charCodeAt(this.index+1))&&(this.index+=2,i.node={type:"UpdateExpression",operator:u===Bn?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!i.node.argument||!t.includes(i.node.argument.type))&&this.throwError(`Unexpected ${i.node.operator}`))}),e.hooks.add("after-token",function(i){if(i.node){let u=this.code;Ye.updateOperators.some(o=>o===u&&o===this.expr.charCodeAt(this.index+1))&&(t.includes(i.node.type)||this.throwError(`Unexpected ${i.node.operator}`),this.index+=2,i.node={type:"UpdateExpression",operator:u===Bn?"++":"--",argument:i.node,prefix:!1})}}),e.hooks.add("after-expression",function(i){i.node&&n(i.node)});function n(r){Ye.assignmentOperators.has(r.operator)?(r.type="AssignmentExpression",n(r.left),n(r.right)):r.operator||Object.values(r).forEach(i=>{i&&typeof i=="object"&&n(i)})}}};ge.plugins.register(Ho,Ye);ge.addUnaryOp("typeof");ge.addLiteral("null",null);ge.addLiteral("undefined",void 0);var Wo=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),j={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return j.evalBinaryExpression(e,t);case"Compound":return j.evalCompound(e,t);case"ConditionalExpression":return j.evalConditionalExpression(e,t);case"Identifier":return j.evalIdentifier(e,t);case"Literal":return j.evalLiteral(e,t);case"MemberExpression":return j.evalMemberExpression(e,t);case"UnaryExpression":return j.evalUnaryExpression(e,t);case"ArrayExpression":return j.evalArrayExpression(e,t);case"CallExpression":return j.evalCallExpression(e,t);case"AssignmentExpression":return j.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,i)=>r||i(),"&&":(r,i)=>r&&i(),"|":(r,i)=>r|i(),"^":(r,i)=>r^i(),"&":(r,i)=>r&i(),"==":(r,i)=>r==i(),"!=":(r,i)=>r!=i(),"===":(r,i)=>r===i(),"!==":(r,i)=>r!==i(),"<":(r,i)=>r<i(),">":(r,i)=>r>i(),"<=":(r,i)=>r<=i(),">=":(r,i)=>r>=i(),"<<":(r,i)=>r<<i(),">>":(r,i)=>r>>i(),">>>":(r,i)=>r>>>i(),"+":(r,i)=>r+i(),"-":(r,i)=>r-i(),"*":(r,i)=>r*i(),"/":(r,i)=>r/i(),"%":(r,i)=>r%i()}[e.operator](j.evalAst(e.left,t),()=>j.evalAst(e.right,t))},evalCompound(e,t){let n;for(let r=0;r<e.body.length;r++){e.body[r].type==="Identifier"&&["var","let","const"].includes(e.body[r].name)&&e.body[r+1]&&e.body[r+1].type==="AssignmentExpression"&&(r+=1);let i=e.body[r];n=j.evalAst(i,t)}return n},evalConditionalExpression(e,t){return j.evalAst(e.test,t)?j.evalAst(e.consequent,t):j.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){let n=e.computed?j.evalAst(e.property):e.property.name,r=j.evalAst(e.object,t);if(r==null)throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);if(!Object.hasOwn(r,n)&&Wo.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);let i=r[n];return typeof i=="function"?i.bind(r):i},evalUnaryExpression(e,t){return{"-":r=>-j.evalAst(r,t),"!":r=>!j.evalAst(r,t),"~":r=>~j.evalAst(r,t),"+":r=>+j.evalAst(r,t),typeof:r=>typeof j.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(n=>j.evalAst(n,t))},evalCallExpression(e,t){let n=e.arguments.map(i=>j.evalAst(i,t));return j.evalAst(e.callee,t)(...n)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");let n=e.left.name,r=j.evalAst(e.right,t);return t[n]=r,t[n]}},In=class{constructor(t){this.code=t,this.ast=ge(this.code)}runInNewContext(t){let n=Object.assign(Object.create(null),t);return j.evalAst(this.ast,n)}};function Oe(e,t){return e=e.slice(),e.push(t),e}function Rn(e,t){return t=t.slice(),t.unshift(e),t}var zn=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function v(e,t,n,r,i){if(!(this instanceof v))try{return new v(e,t,n,r,i)}catch(o){if(!o.avoidNew)throw o;return o.value}typeof e=="string"&&(i=r,r=n,n=t,t=e,e=null);let u=e&&typeof e=="object";if(e=e||{},this.json=e.json||n,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors=="undefined"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||r||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let o={path:u?e.path:t};u?"json"in e&&(o.json=e.json):o.json=n;let s=this.evaluate(o);if(!s||typeof s!="object")throw new zn(s);return s}}v.prototype.evaluate=function(e,t,n,r){let i=this.parent,u=this.parentProperty,{flatten:o,wrap:s}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=Object.hasOwn(e,"flatten")?e.flatten:o,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,s=Object.hasOwn(e,"wrap")?e.wrap:s,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,n=Object.hasOwn(e,"callback")?e.callback:n,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(e,"parent")?e.parent:i,u=Object.hasOwn(e,"parentProperty")?e.parentProperty:u,e=e.path}if(i=i||null,u=u||null,Array.isArray(e)&&(e=v.toPathString(e)),!e&&e!==""||!t)return;let c=v.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;let a=this._trace(c,t,["$"],i,u,n).filter(function(l){return l&&!l.isParentSelector});return a.length?!s&&a.length===1&&!a[0].hasArrExpr?this._getPreferredOutput(a[0]):a.reduce((l,h)=>{let f=this._getPreferredOutput(h);return o&&Array.isArray(f)?l=l.concat(f):l.push(f),l},[]):s?[]:void 0};v.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let n=Array.isArray(e.path)?e.path:v.toPathArray(e.path);return e.pointer=v.toPointer(n),e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return v.toPathString(e[t]);case"pointer":return v.toPointer(e.path);default:throw new TypeError("Unknown result type")}};v.prototype._handleCallback=function(e,t,n){if(t){let r=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),t(r,n,e)}};v.prototype._trace=function(e,t,n,r,i,u,o,s){let c;if(!e.length)return c={path:n,value:t,parent:r,parentProperty:i,hasArrExpr:o},this._handleCallback(c,u,"value"),c;let a=e[0],l=e.slice(1),h=[];function f(p){Array.isArray(p)?p.forEach(F=>{h.push(F)}):h.push(p)}if((typeof a!="string"||s)&&t&&Object.hasOwn(t,a))f(this._trace(l,t[a],Oe(n,a),t,a,u,o));else if(a==="*")this._walk(t,p=>{f(this._trace(l,t[p],Oe(n,p),t,p,u,!0,!0))});else if(a==="..")f(this._trace(l,t,n,r,i,u,o)),this._walk(t,p=>{typeof t[p]=="object"&&f(this._trace(e.slice(),t[p],Oe(n,p),t,p,u,!0))});else{if(a==="^")return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:l,isParentSelector:!0};if(a==="~")return c={path:Oe(n,a),value:i,parent:r,parentProperty:null},this._handleCallback(c,u,"property"),c;if(a==="$")f(this._trace(l,t,n,null,null,u,o));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(a))f(this._slice(a,l,t,n,r,i,u));else if(a.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let p=a.replace(/^\?\((.*?)\)$/u,"$1"),F=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(p);F?this._walk(t,E=>{let C=[F[2]],x=F[1]?t[E][F[1]]:t[E];this._trace(C,x,n,r,i,u,!0).length>0&&f(this._trace(l,t[E],Oe(n,E),t,E,u,!0))}):this._walk(t,E=>{this._eval(p,t[E],E,n,r,i)&&f(this._trace(l,t[E],Oe(n,E),t,E,u,!0))})}else if(a[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(Rn(this._eval(a,t,n.at(-1),n.slice(0,-1),r,i),l),t,n,r,i,u,o))}else if(a[0]==="@"){let p=!1,F=a.slice(1,-2);switch(F){case"scalar":(!t||!["object","function"].includes(typeof t))&&(p=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===F&&(p=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(p=!0);break;case"number":Number.isFinite(t)&&(p=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(p=!0);break;case"object":t&&typeof t===F&&(p=!0);break;case"array":Array.isArray(t)&&(p=!0);break;case"other":p=this.currOtherTypeCallback(t,n,r,i);break;case"null":t===null&&(p=!0);break;default:throw new TypeError("Unknown value type "+F)}if(p)return c={path:n,value:t,parent:r,parentProperty:i},this._handleCallback(c,u,"value"),c}else if(a[0]==="`"&&t&&Object.hasOwn(t,a.slice(1))){let p=a.slice(1);f(this._trace(l,t[p],Oe(n,p),t,p,u,o,!0))}else if(a.includes(",")){let p=a.split(",");for(let F of p)f(this._trace(Rn(F,l),t,n,r,i,u,!0))}else!s&&t&&Object.hasOwn(t,a)&&f(this._trace(l,t[a],Oe(n,a),t,a,u,o,!0))}if(this._hasParentSelector)for(let p=0;p<h.length;p++){let F=h[p];if(F&&F.isParentSelector){let E=this._trace(F.expr,t,F.path,r,i,u,o);if(Array.isArray(E)){h[p]=E[0];let C=E.length;for(let x=1;x<C;x++)p++,h.splice(p,0,E[x])}else h[p]=E}}return h};v.prototype._walk=function(e,t){if(Array.isArray(e)){let n=e.length;for(let r=0;r<n;r++)t(r)}else e&&typeof e=="object"&&Object.keys(e).forEach(n=>{t(n)})};v.prototype._slice=function(e,t,n,r,i,u,o){if(!Array.isArray(n))return;let s=n.length,c=e.split(":"),a=c[2]&&Number.parseInt(c[2])||1,l=c[0]&&Number.parseInt(c[0])||0,h=c[1]&&Number.parseInt(c[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),h=h<0?Math.max(0,h+s):Math.min(s,h);let f=[];for(let p=l;p<h;p+=a)this._trace(Rn(p,t),n,r,i,u,o,!0).forEach(E=>{f.push(E)});return f};v.prototype._eval=function(e,t,n,r,i,u){this.currSandbox._$_parentProperty=u,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let o=e.includes("@path");o&&(this.currSandbox._$_path=v.toPathString(r.concat([n])));let s=this.currEval+"Script:"+e;if(!v.cache[s]){let c=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(o&&(c=c.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)v.cache[s]=new this.safeVm.Script(c);else if(this.currEval==="native")v.cache[s]=new this.vm.Script(c);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){let a=this.currEval;v.cache[s]=new a(c)}else if(typeof this.currEval=="function")v.cache[s]={runInNewContext:a=>this.currEval(c,a)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return v.cache[s].runInNewContext(this.currSandbox)}catch(c){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+c.message+": "+e)}};v.cache={};v.toPathString=function(e){let t=e,n=t.length,r="$";for(let i=1;i<n;i++)/^(~|\^|@.*?\(\))$/u.test(t[i])||(r+=/^[0-9*]+$/u.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return r};v.toPointer=function(e){let t=e,n=t.length,r="";for(let i=1;i<n;i++)/^(~|\^|@.*?\(\))$/u.test(t[i])||(r+="/"+t[i].toString().replaceAll("~","~0").replaceAll("/","~1"));return r};v.toPathArray=function(e){let{cache:t}=v;if(t[e])return t[e].concat();let n=[],i=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(u,o){return"[#"+(n.push(o)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(u,o){return"['"+o.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(u,o){return";"+o.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(u){let o=u.match(/#(\d+)/u);return!o||!o[1]?u:n[o[1]]});return t[e]=i,t[e].concat()};v.prototype.safeVm={Script:In};var Yo=function(e,t,n){let r=e.length;for(let i=0;i<r;i++){let u=e[i];n(u)&&t.push(e.splice(i--,1)[0])}},_n=class{constructor(t){this.code=t}runInNewContext(t){let n=this.code,r=Object.keys(t),i=[];Yo(r,i,a=>typeof t[a]=="function");let u=r.map(a=>t[a]);n=i.reduce((a,l)=>{let h=t[l].toString();return/function/u.test(h)||(h="function "+h),"var "+l+"="+h+";"+a},"")+n,!/(['"])use strict\1/u.test(n)&&!r.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;\s*$/u,"");let s=n.lastIndexOf(";"),c=s!==-1?n.slice(0,s+1)+" return "+n.slice(s+1):" return "+n;return new Function(...r,c)(...u)}};v.prototype.vm={Script:_n};var ie;(h=>{async function e(f,p,F,E){var w;let C=pi(F,{...On,interpretmarkup(S=""){var H,$;if(/^`[^`]+`$/.test(S))return S;let I=`
|
|
`.repeat(($=(H=S.match(/\n/g))==null?void 0:H.length)!=null?$:0);return S.match(/^\s*(-|\d+\.) $/m)?I+"\u2022 ":I}}),x=JSON.stringify(C),b=fi(f.serverUrl);if(x.length>b.maxSize)throw new Error(`Text too long for LanguageTool
|
|
${x.length} characters, max is ${b.maxSize}
|
|
|
|
Select a portion of the document and try again!`);let A=(w=E!=null?E:f.staticLanguage)!=null?w:"auto",O={data:x,language:A,enabledOnly:"false",level:f.pickyMode?"picky":"default"};f.motherTongue&&(O.motherTongue=f.motherTongue),f.enabledCategories&&(O.enabledCategories=f.enabledCategories),f.disabledCategories&&(O.disabledCategories=f.disabledCategories),f.enabledRules&&(O.enabledRules=f.enabledRules),f.disabledRules&&(O.disabledRules=f.disabledRules),A=="auto"&&(O.preferredVariants=Object.values(f.languageVariety).join(",")),f.apikey&&f.username&&(O.username=f.username,O.apiKey=f.apikey);let L;try{console.log(`LanguageTool: Checking ${x.length} characters`),L=await(0,Be.requestUrl)({url:`${f.serverUrl}/v2/check`,method:"POST",body:new URLSearchParams(O).toString(),throw:!0,headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}})}catch(S){throw new Error(`Request to LanguageTool failed: Please check your connection and server URL.
|
|
${S}`)}if(L.json==null)throw new Error("Error processing response from LanguageTool.");return a("$.matches[*]",L.json).map(S=>{let I=c("$.offset@number()",S),H=I+c("$.length@number()",S);return{text:F.slice(I,H),from:p+I,to:p+H,title:c("$.shortMessage@string()",S),message:c("$.message@string()",S),replacements:a("$.replacements[*].value@string()",S),categoryId:c("$.rule.category.id@string()",S),ruleId:c("$.rule.id@string()",S)}})}h.check=e;async function t(f){let p=await(0,Be.requestUrl)({url:`${f}/v2/languages`}).json;if(p==null||!(p instanceof Array))throw new Error("Error processing response from LanguageTool.");return p}h.languages=t;async function n(f){if(f.username==null||f.apikey==null)throw Error("Syncing words is only supported for premium users");try{let p=await(0,Be.requestUrl)({url:l(`${f.serverUrl}/v2/words`,{username:f.username,apiKey:f.apikey,limit:"1000"}).href}).json;return a("$.words[*]@string()",p)}catch(p){throw new Error(`Requesting words failed
|
|
${p}`)}}h.words=n;async function r(f,p){if(f.username==null||f.apikey==null)throw Error("Syncing words is only supported for premium users");try{let F=await(0,Be.requestUrl)({url:l(`${f.serverUrl}/v2/words/add`,{username:f.username,apiKey:f.apikey,word:p}).href,method:"POST"}).json;return c("$.added@boolean()",F)}catch(F){throw new Error(`Adding words failed
|
|
${F}`)}}h.wordsAdd=r;async function i(f,p){if(f.username==null||f.apikey==null)throw Error("Syncing words is only supported for premium users");try{let F=await(0,Be.requestUrl)({url:l(`${f.serverUrl}/v2/words/delete`,{username:f.username,apiKey:f.apikey,word:p}).href,method:"POST"}).json;return c("$.deleted@boolean()",F)}catch(F){throw new Error(`Deleting words failed
|
|
${F}`)}}h.wordsDel=i;class u{constructor(){this.url="https://qb-grammar-en.languagetool.org/phrasal-paraphraser/subscribe"}async query(p,F){let E=p.slice(0,F.from).split(/\s+/).length,C=p.slice(F.from,F.to),x={message:{indices:[E],mode:0,phrases:[C],text:p},meta:{clientStatus:"string",product:"string",traceID:"string",userID:"string"},response_queue:"string"};try{let b=await(0,Be.requestUrl)({url:this.url,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}).json;return a("$.data.suggestions[*][*]@string()",b)}catch(b){throw new Error(`Requesting synonyms failed
|
|
${b}`)}}}class o{constructor(){this.url="https://synonyms.languagetool.org/synonyms/de"}async query(p,F){let E=p.slice(F.from,F.to).trim(),C=p.slice(0,F.from).split(/\s+/).join("+"),x=p.slice(F.to).split(/\s+/).join("+");try{let b=await(0,Be.requestUrl)({url:l(`${this.url}/${E}`,{before:C,after:x}).href,method:"GET"}).json;return a("$.synsets[*].terms[*].term@string()",b)}catch(b){throw new Error(`Requesting synonyms failed
|
|
${b}`)}}}h.SYNONYMS={en:new u,de:new o};function c(f,p){let F=v({path:f,json:p,wrap:!1,eval:!1});if(F==null)throw new Error("Error parsing response.");return F}function a(f,p){let F=v({path:f,json:p,wrap:!0,eval:!1});if(F==null||!(F instanceof Array))throw new Error("Error parsing response.");return F}function l(f,p){let F=new URL(f);return F.search=new URLSearchParams(p).toString(),F}})(ie||(ie={}));function Rt(e){switch(e){case"COLLOQUIALISMS":case"REDUNDANCY":case"STYLE":case"SYNONYMS":return"lt-style";case"TYPOS":return"lt-major"}return"lt-minor"}function Qe(e,t){let n=new Set(e);for(let r of t)n.delete(r);return n}function Mn(e,t){let n=new Set(e);for(let r of t)n.add(r);return n}function mi(e,t){let n=new Set;for(let r of t)e.has(r)&&n.add(r);return n}function Ke(e,t){return e=e.toLowerCase(),t=t.toLowerCase(),e>t?1:e<t?-1:0}var di=5e3,Qo=250,dt=class{constructor(t,n,r){this.url=t,this.requestsPerSec=n,this.maxSize=r}get minDelay(){return 60/this.requestsPerSec*1e3}},Xe={standard:new dt("https://api.languagetool.org",20,2e4),premium:new dt("https://api.languagetoolplus.com",80,75e3),custom:new dt("",120,1e6)};function Ze(e){for(let[t,n]of Object.entries(Xe))if(n.url===e)return t;return"custom"}function fi(e){return Xe[Ze(e)]}var xi={serverUrl:Xe.standard.url,autoCheckDelay:Xe.standard.minDelay,shouldAutoCheck:!1,languageVariety:{en:"en-US",de:"de-DE",pt:"pt-PT",ca:"ca-ES"},dictionary:[],syncDictionary:!1,remoteDictionary:[],pickyMode:!1};function gi(e,t){return e=e.filter(n=>n.code===t).filter(n=>n.longCode!==n.code),Object.fromEntries(e.map(n=>[n.longCode,n.name]))}var zt=class extends N.PluginSettingTab{constructor(n,r){super(n,r);this.endpointListeners=[];this.languageListeners=[];this.languages=[];this.plugin=r}configureCheckDelay(n,r){let i=Xe[r].minDelay;this.plugin.settings.autoCheckDelay=Math.clamp(this.plugin.settings.autoCheckDelay,i,di),n.setLimits(i,di,Qo)}async notifyEndpointChange(n){for(let r of this.endpointListeners)await r(n.serverUrl)}async configureLanguageVariants(n,r){var o;let i=this.plugin.settings.languageVariety,u=gi(this.languages,r);i[r]=(o=i[r])!=null?o:Object.keys(u)[0],n.addOptions(u).setValue(i[r]).onChange(async s=>{i[r]=s,await this.plugin.saveSettings()}),this.languageListeners.push(async s=>{var a;for(;n.selectEl.options.length>0;)n.selectEl.remove(0);let c=gi(s,r);i[r]=(a=i[r])!=null?a:Object.keys(c)[0],n.addOptions(c).setValue(i[r])})}async display(){let{containerEl:n}=this;n.empty();let r=this.plugin.settings;this.endpointListeners=[],this.endpointListeners.push(async a=>{let l=[];a&&(l=await ie.languages(a)),this.languages=l;for(let h of this.languageListeners)await h(l)}),this.endpointListeners.push(async a=>{await this.plugin.syncDictionary()}),this.languageListeners=[],new N.Setting(n).setName("Error logs").setDesc(`${this.plugin.logs.length} messages`).addButton(a=>{a.setButtonText("Copy to clipboard").onClick(async()=>{await window.navigator.clipboard.writeText(this.plugin.logs.join(`
|
|
`)),new N.Notice("Logs copied to clipboard")})});let i=Ze(r.serverUrl),u=null;new N.Setting(n).setName("Endpoint").setDesc("Choose the LanguageTool server url").then(a=>{a.controlEl.classList.add("lt-settings-grid");let l=null,h=null;a.addDropdown(f=>{l=f,f.addOptions({standard:"(Standard) api.languagetool.org",premium:"(Premium) api.languagetoolplus.com",custom:"Custom URL"}).setValue(i).onChange(async p=>{i=p,r.serverUrl=Xe[i].url,h&&h.setValue(r.serverUrl).setDisabled(p!=="custom"),u&&this.configureCheckDelay(u,i),await this.notifyEndpointChange(r),await this.plugin.saveSettings()})}),a.addText(f=>{h=f,f.setPlaceholder("https://your-custom-url.com").setValue(r.serverUrl).setDisabled(i!=="custom").onChange(async p=>{r.serverUrl=p.replace(/\/v2\/check\/$/,"").replace(/\/$/,""),i=Ze(r.serverUrl),i!=="custom"&&(l==null||l.setValue(i),h==null||h.setDisabled(!0)),await this.notifyEndpointChange(r),await this.plugin.saveSettings()})})}),new N.Setting(n).setName("API username").setDesc("Enter a username/mail for API access").addText(a=>a.setPlaceholder("peterlustig@example.com").setValue(r.username||"").onChange(async l=>{r.username=l.replace(/\s+/g,""),await this.plugin.saveSettings()})),new N.Setting(n).setName("API key").setDesc(createFragment(a=>{a.createEl("a",{text:"Click here for information about Premium Access",href:"https://github.com/wrenger/obsidian-languagetool#premium-accounts",attr:{target:"_blank"}})})).addText(a=>a.setValue(r.apikey||"").onChange(async l=>{r.apikey=l.replace(/\s+/g,""),r.apikey&&i!=="premium"&&new N.Notice("You have entered an API Key but you are not using the Premium Endpoint"),await this.plugin.saveSettings()})),new N.Setting(n).setName("Auto check text").setDesc("Check text as you type").addToggle(a=>{a.setValue(r.shouldAutoCheck).onChange(async l=>{r.shouldAutoCheck=l,await this.plugin.saveSettings()})}),new N.Setting(n).setName("Auto check delay (ms)").setDesc("Time to wait for autocheck after the last key press").addSlider(a=>{u=a,this.configureCheckDelay(a,i),a.setValue(r.autoCheckDelay).onChange(async l=>{r.autoCheckDelay=l,await this.plugin.saveSettings()}).setDynamicTooltip()});function o(a){if(a.appendText("Enables the context menu for synonyms fetched from"),a.createEl("br"),r.synonyms!=null){let l=ie.SYNONYMS[r.synonyms];if(!l){a.appendText(" (unknown API)");return}a.createEl("a",{text:l.url,href:l.url,attr:{target:"_blank"}})}else a.appendText("(none)")}let s=new N.Setting(n).setName("Find synonyms").setDesc(createFragment(o));s.addDropdown(a=>{var l;a.addOption("none","---");for(let h of Object.keys(ie.SYNONYMS))a.addOption(h,h);a.setValue((l=r.synonyms)!=null?l:"none").onChange(async h=>{r.synonyms=h!=="none"?h:void 0,await this.plugin.saveSettings(),s.setDesc(createFragment(o))})}),new N.Setting(n).setName("Language settings").setHeading(),new N.Setting(n).setName("Mother tongue").setDesc("Set mother tongue if you want to be warned about false friends when writing in other languages. This setting will also be used for automatic language detection.").addDropdown(a=>{this.languageListeners.push(async l=>{var h;for(;a.selectEl.options.length>0;)a.selectEl.remove(0);a.addOption("none","---").addOptions(Object.fromEntries(l.filter(f=>f.longCode==f.code).map(f=>[f.longCode,f.name]))).setValue((h=r.motherTongue)!=null?h:"none").onChange(async f=>{r.motherTongue=f!=="none"?f:void 0,await this.plugin.saveSettings()})})}),new N.Setting(n).setName("Static language").setDesc("Set a static language that will always be used (LanguageTool tries to auto detect the language, this is usually not necessary)").addDropdown(a=>{this.languageListeners.push(async l=>{var h;for(;a.selectEl.options.length>0;)a.selectEl.remove(0);a.addOption("auto","Auto Detect").addOptions(Object.fromEntries(l.map(f=>[f.longCode,f.name]))).setValue((h=r.staticLanguage)!=null?h:"auto").onChange(async f=>{r.staticLanguage=f!=="auto"?f:void 0,await this.plugin.saveSettings()})})}),new N.Setting(n).setName("Language varieties").setHeading().setDesc("Some languages have varieties depending on the country they are spoken in.");let c={en:"English",de:"German",pt:"Portuguese",ca:"Catalan"};for(let[a,l]of Object.entries(c))new N.Setting(n).setName(`Interpret ${l} as`).addDropdown(async h=>{this.configureLanguageVariants(h,a)});new N.Setting(n).setName("Spellcheck Dictionary").setHeading(),new N.Setting(n).setName("Ignored Words").setDesc("Words that should not be highlighted as spelling mistakes.").addButton(a=>{a.setIcon("settings").setTooltip("Edit dictionary").onClick(()=>{new vn(this.app,this.plugin).open()})}),new N.Setting(n).setName("Sync with LanguageTool").setDesc("This is only supported for premium users.").addToggle(a=>{a.setDisabled(i!=="premium").setValue(r.syncDictionary).onChange(async l=>{r.syncDictionary=l,await this.plugin.syncDictionary()}),this.endpointListeners.push(async l=>{a.setDisabled(Ze(l)!=="premium")})}),new N.Setting(n).setName("Rule categories").setHeading().setDesc(createFragment(a=>{a.appendText("The picky mode enables a lot of extra categories and rules. Additionally, you can enable or disable specific rules down below."),a.createEl("br"),a.createEl("a",{text:"Click here for a list of rules and categories",href:"https://community.languagetool.org/rule/list",attr:{target:"_blank"}})})),new N.Setting(n).setName("Picky mode").setDesc("Provides more style and tonality suggestions, detects long or complex sentences, recognizes colloquialism and redundancies, proactively suggests synonyms for commonly overused words").addToggle(a=>{a.setValue(r.pickyMode).onChange(async l=>{r.pickyMode=l,await this.plugin.saveSettings()})}),new N.Setting(n).setName("Enabled categories").setDesc("Comma-separated list of categories").addText(a=>{var l;return a.setPlaceholder("CATEGORY_1,CATEGORY_2").setValue((l=r.enabledCategories)!=null?l:"").onChange(async h=>{r.enabledCategories=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Disabled categories").setDesc("Comma-separated list of categories").addText(a=>{var l;return a.setPlaceholder("CATEGORY_1,CATEGORY_2").setValue((l=r.disabledCategories)!=null?l:"").onChange(async h=>{r.disabledCategories=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Enabled rules").setDesc("Comma-separated list of rules").addText(a=>{var l;return a.setPlaceholder("RULE_1,RULE_2").setValue((l=r.enabledRules)!=null?l:"").onChange(async h=>{r.enabledRules=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),new N.Setting(n).setName("Disabled rules").setDesc("Comma-separated list of rules").addText(a=>{var l;return a.setPlaceholder("RULE_1,RULE_2").setValue((l=r.disabledRules)!=null?l:"").onChange(async h=>{r.disabledRules=h.replace(/\s+/g,""),await this.plugin.saveSettings()})}),await this.notifyEndpointChange(r)}},vn=class extends N.Modal{constructor(t,n){super(t),this.setTitle("Spellcheck dictionary"),this.plugin=n,this.words=n.settings.dictionary}async onOpen(){this.words=this.plugin.settings.dictionary;let{contentEl:t}=this,n=s=>{s.replaceChildren(...this.words.map(c=>s.createDiv({cls:"multi-select-pill"},a=>{a.createDiv({cls:"multi-select-pill-content"},l=>l.createSpan({text:c})),a.createDiv({cls:"multi-select-pill-remove-button"},l=>{l.appendChild((0,N.getIcon)("x")),l.onClickEvent(()=>{this.words.remove(c),n(s)})})})))},r=null;t.createDiv({cls:"multi-select-container"},s=>{r=s,n(s)}),this.plugin.syncDictionary().then(s=>{s&&(this.words=this.plugin.settings.dictionary,r&&n(r))});let i="",u=null,o=()=>{i&&(this.words=[...new Set([...this.words,i])].sort(Ke),r&&n(r),u&&u.setValue(""),i="")};new N.Setting(t).setName("Add").addText(s=>{u=s.setValue(i).onChange(c=>i=c.trim()),s.inputEl.addEventListener("keypress",c=>{c.key==="Enter"&&o()})}).addExtraButton(s=>{s.setIcon("plus").setTooltip("Add").onClick(()=>{o()})})}async onClose(){this.contentEl.empty(),this.plugin.settings.dictionary=this.words,await this.plugin.syncDictionary()}};var bi=require("@codemirror/view");var yi=require("@codemirror/view");function Ei(e){let t=-1,n=1/0,r=-1/0;return yi.EditorView.updateListener.of(i=>{if(!i.docChanged||!e.settings.shouldAutoCheck)return;i.changes.iterChangedRanges((o,s,c,a)=>{n=Math.min(n,c,a),r=Math.max(r,c,a)});let u=i.view;clearTimeout(t),t=window.setTimeout(()=>{e.runDetection(u,{from:n,to:r}).catch(o=>{console.error(o)}),n=1/0,r=-1/0},e.settings.autoCheckDelay)})}var Ci=require("@codemirror/view"),wi=require("@codemirror/state");var xt=require("obsidian");var Ge=require("@codemirror/view"),Me=require("@codemirror/state"),Je=require("@codemirror/language");var Ko=/(frontmatter|code|math|templater|blockid|hashtag|internal)/,_t=Me.StateEffect.define(),gt=Me.StateEffect.define(),ve=Me.StateEffect.define(),Mt=Me.StateEffect.define();function Fi(e,t){return e.from<=t.from&&t.from<=e.to||e.from<=t.to&&t.to<=e.to||t.from<=e.from&&e.from<=t.to||t.from<=e.to&&e.to<=t.to}var Pe=Me.StateField.define({create(){return Ge.Decoration.none},update(e,t){e=e.map(t.changes);let n=new Set,r={},i=null,u=s=>{if(r[s]==null){i||(i=(0,Je.syntaxTree)(t.state));let c=i.resolveInner(s,1).type.prop(Je.tokenClassNodeProp);r[s]=!(c&&Ko.test(c))}return r[s]},o=s=>{i||(i=(0,Je.syntaxTree)(t.state));let c=i.resolve(t.newDoc.lineAt(s.from).from,1).type.prop(Je.tokenClassNodeProp);return!(c!=null&&c.includes("table")&&s.ruleId==="WHITESPACE_RULE")};t.docChanged&&t.selection&&e.size&&(e=e.update({filter:(s,c)=>!Fi({from:s,to:c},t.selection.main)}));for(let s of t.effects)if(s.is(_t)){let c=s.value,a=`${c.from},${c.to}`;!n.has(a)&&u(c.from)&&u(c.to)&&o(c)&&(n.add(a),e=e.update({add:[Ge.Decoration.mark({class:`lt-underline ${Rt(c.categoryId)}`,underline:c}).range(c.from,c.to)]}))}else s.is(gt)?e=Ge.Decoration.none:s.is(ve)?e=e.update({filterFrom:s.value.from,filterTo:s.value.to,filter:(c,a)=>!Fi({from:c,to:a},s.value)}):s.is(Mt)&&(e=e.update({filter:(c,a,l)=>!s.value(l.spec.underline)}));return e},provide:e=>Ge.EditorView.decorations.from(e)});function Zo(e,t,n){let r=n.replacements.slice(0,vt),i=n.categoryId,u=n.ruleId;return createDiv({cls:["lt-predictions-container",Rt(i)]},o=>{n.title&&o.createSpan({cls:"lt-title"},c=>{c.createSpan({text:n.title})}),n.message&&o.createSpan({cls:"lt-message",text:n.message});let s=ve.of({...n});o.createDiv({cls:"lt-bottom"},c=>{r.length&&c.createDiv({cls:"lt-buttoncontainer"},a=>{for(let l of r)a.createEl("button",{text:l||"(delete)"},h=>{h.onclick=()=>{t.dispatch({changes:[{from:n.from,to:n.to,insert:l}],effects:[s]})}})}),c.createDiv({cls:"lt-info-container"},a=>{a.createEl("button",{cls:"lt-info-button clickable-icon"},l=>{(0,xt.setIcon)(l,"info"),l.onclick=()=>{let h=document.getElementsByClassName("lt-info-box").item(0);if(!h)throw Error("Programming error: failed to create popup.");h.hasClass("hidden")?h.removeClass("hidden"):h.addClass("hidden")}}),a.createDiv({cls:"lt-info-box hidden"},l=>{l.createDiv({cls:"lt-info",text:`Category:\xA0${i}`}),l.createDiv({cls:"lt-info",text:`Rule:\xA0${u}`})})})}),o.createDiv({cls:"lt-ignorecontainer"},c=>{c.createEl("button",{cls:"lt-ignore-btn"},a=>{i==="TYPOS"?((0,xt.setIcon)(a.createSpan(),"plus-with-circle"),a.createSpan({text:"Add to personal dictionary"}),a.onclick=async()=>{e.settings.dictionary.push(n.text),await e.syncDictionary(),t.dispatch({effects:[Mt.of(l=>l.text===n.text)]})}):((0,xt.setIcon)(a.createSpan(),"cross"),a.createSpan({text:"Ignore suggestion"}),a.onclick=()=>{t.dispatch({effects:[s]})})}),i!=="TYPOS"&&i!=="SYNONYMS"&&c.createEl("button",{cls:"lt-ignore-btn"},a=>{(0,xt.setIcon)(a.createSpan(),"circle-off"),a.createSpan({text:"Disable rule"}),a.onclick=()=>{e.settings.disabledRules?e.settings.disabledRules+=","+u:e.settings.disabledRules=u,e.saveSettings(),t.dispatch({effects:[Mt.of(l=>l.ruleId===u)]})}})})})}function Ai(e,t,n){let r=n.field(Pe);if(r.size===0||n.selection.ranges.length>1)return[];let i=null;if(r.between(n.selection.main.from,n.selection.main.to,(u,o,s)=>{i={...s.spec.underline,from:u,to:o}}),i!=null){let{from:u,to:o}=i;if(e.length){let s=e[0];if(s.pos===u&&s.end===o)return e}return[{pos:u,end:o,above:!0,strictSide:!1,arrow:!1,create:s=>({dom:Zo(t,s,i)})}]}return[]}function ki(e){return wi.StateField.define({create:t=>Ai([],e,t),update:(t,n)=>Ai(t,e,n.state),provide:t=>Ci.showTooltip.computeN([t],n=>n.field(t))})}function Si(e){return[(0,bi.tooltips)({position:"absolute",tooltipSpace:t=>t.dom.getBoundingClientRect()}),Pe,ki(e),Ei(e)]}var Di=require("@codemirror/language");var vt=5;function Xo(){if(window.electronWindow==null)throw Error("Electron not found!");return window.electronWindow}var Nt=class extends oe.Plugin{constructor(){super(...arguments);this.isLoading=!1;this.logs=[]}async onload(){await this.loadSettings(),this.settingTab=new zt(this.app,this),this.addSettingTab(this.settingTab),this.app.workspace.onLayoutReady(()=>{this.statusBarText=this.addStatusBarItem(),this.setStatusBarReady(),this.registerDomEvent(this.statusBarText,"click",()=>this.handleStatusBarClick())}),this.registerEditorExtension(Si(this)),this.registerCommands(),this.registerMenuItems();let n=new Set(this.settings.dictionary.map(r=>r.trim()));n.delete(""),this.settings.dictionary=[...n].sort(Ke),this.syncDictionary(),await this.saveSettings()}onunload(){this.logs=[],this.isLoading=!1}registerCommands(){this.addCommand({id:"check",name:"Check text",editorCallback:(n,r)=>{let i=n.cm;this.runDetection(i).catch(u=>{console.error(u)})}}),this.addCommand({id:"toggle-auto-check",name:"Toggle automatic checking",callback:async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()}}),this.addCommand({id:"clear",name:"Clear suggestions",editorCallback:n=>{n.cm.dispatch({effects:[gt.of(null)]})}}),this.addCommand({id:"accept-all",name:"Accept all suggestions",editorCallback:n=>{let r=n.cm,i=[],u=[];r.state.field(Pe).between(0,1/0,(o,s,c)=>{var a,l,h;(h=(l=(a=c.spec)==null?void 0:a.underline)==null?void 0:l.replacements)!=null&&h.length&&(i.push({from:o,to:s,insert:c.spec.underline.replacements[0]}),u.push(ve.of({from:o,to:s})))}),r.dispatch({changes:i,effects:u})}}),this.addCommand({id:"next",name:"Jump to next suggestion",editorCheckCallback:(n,r)=>{let i=r.cm,u=r.posToOffset(r.getCursor()),o=null;if(i.state.field(Pe).between(u+1,1/0,(s,c)=>{(!o||o.from>s)&&(o={from:s,to:c})}),n)return o!=null;o!=null&&i.dispatch({selection:{anchor:o.from,head:o.to}})}});for(let n=1;n<=vt;n++)this.addCommand(this.applySuggestionCommand(n));this.addCommand({id:"synonyms",name:"Show synonyms",editorCheckCallback:(n,r)=>this.showSynonyms(r,n)})}applySuggestionCommand(n){return{id:`accept-${n}`,name:`Accept suggestion ${n}`,editorCheckCallback(r,i){var p,F,E;let u=i.cm,o=i.posToOffset(i.getCursor()),s=[];u.state.field(Pe).between(o,o,(C,x,b)=>{s.push({from:C,to:x,value:b})});let c=s.length===1&&((E=(F=(p=s[0].value.spec)==null?void 0:p.underline)==null?void 0:F.replacements)==null?void 0:E.length)>=n;if(r)return c;if(!c)return;let{from:a,to:l,value:h}=s[0],f={from:a,to:l,insert:h.spec.underline.replacements[n-1]};u.dispatch({changes:[f],effects:[ve.of({from:a,to:l})]})}}}registerMenuItems(){this.registerEvent(this.app.workspace.on("editor-menu",(n,r,i)=>{this.showSynonyms(r,!0)&&n.addItem(u=>{u.setTitle("Synonyms"),u.setIcon("square-stack"),u.onClick(()=>this.showSynonyms(r))})}))}showSynonyms(n,r=!1){if(!this.settings.synonyms||!(this.settings.synonyms in ie.SYNONYMS))return!1;let i=ie.SYNONYMS[this.settings.synonyms];if(!i)return!1;let u=n.cm,o=u.state.selection.main;if(o.empty)return!1;let s=u.state.sliceDoc(u.state.selection.main.from,u.state.selection.main.to);if(s.match(/[\s\.]/))return!1;if(r)return!0;let c=u.state.doc.lineAt(o.from),a=c.text.slice(0,o.from-c.from).lastIndexOf(".")+1,l=c.text.slice(a),h=l.trimStart(),f=c.from+a+l.length-h.length,p={from:o.from-f,to:o.to-f};h=h.trimEnd();let F=h.indexOf(".");return F!==-1&&(h=h.slice(0,F+1)),i.query(h,p).then(E=>u.dispatch({effects:[_t.of({text:s,from:o.from,to:o.to,title:"Synonyms",message:"",categoryId:"SYNONYMS",ruleId:"SYNONYMS",replacements:E})]})).catch(E=>{this.pushLogs(E),new oe.Notice(E.message,5e3)}),!0}setStatusBarReady(){this.isLoading=!1,this.statusBarText.empty(),this.statusBarText.createSpan({cls:"lt-status-bar-btn"},n=>{n.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"]},n=>{(0,oe.setIcon)(n,"sync-small")}))}handleStatusBarClick(){var i;let n=(i=this.statusBarText.parentElement)==null?void 0:i.getBoundingClientRect(),r=this.statusBarText.getBoundingClientRect();new oe.Menu().addItem(u=>{u.setTitle("Check text"),u.setIcon("checkbox-glyph"),u.onClick(async()=>{let o=this.app.workspace.getActiveViewOfType(oe.MarkdownView);if(o&&o.getMode()==="source")try{let s=o.editor.cm;await this.runDetection(s)}catch(s){console.error(s)}})}).addItem(u=>{u.setTitle(this.settings.shouldAutoCheck?"Disable automatic checking":"Enable automatic checking"),u.setIcon("uppercase-lowercase-a"),u.onClick(async()=>{this.settings.shouldAutoCheck=!this.settings.shouldAutoCheck,await this.saveSettings()})}).addItem(u=>{u.setTitle("Clear suggestions"),u.setIcon("reset"),u.onClick(()=>{let o=this.app.workspace.getActiveViewOfType(oe.MarkdownView);if(!o)return;o.editor.cm.dispatch({effects:[gt.of(null)]})})}).showAtPosition({x:r.right+5,y:((n==null?void 0:n.top)||0)-5})}async runDetection(n,r){var f;let i=this.app.workspace.getActiveFile(),u=i&&this.app.metadataCache.getFileCache(i),o=(f=u==null?void 0:u.frontmatter)==null?void 0:f.lt_language,s=n.state.selection.main;!r&&!s.empty&&(r={...s});let c=0,a="";if(r?(r=Go(n,r),c=r.from,a=n.state.sliceDoc(r.from,r.to)):a=n.state.sliceDoc(0),!a.trim())return;let l;try{this.setStatusBarWorking(),l=await ie.check(this.settings,c,a,o)}catch(p){console.error(p),p instanceof Error&&(this.pushLogs(p),new oe.Notice(p.message,8e3));return}finally{this.setStatusBarReady()}let h=[];if(r?h.push(ve.of(r)):h.push(gt.of(null)),l){let p=this.settings.dictionary;for(let F of l)F.to>n.state.doc.length||F.categoryId==="TYPOS"&&p.includes(F.text)||h.push(_t.of(F))}h.length&&n.dispatch({effects:h})}async pushLogs(n){let r=`${new Date().toLocaleString()}:
|
|
Error: '${n.message}'
|
|
Settings: ${JSON.stringify({...this.settings,username:"REDACTED",apikey:"REDACTED"})}
|
|
`;this.settings.username&&(r=r.replaceAll(this.settings.username,"<<username>>")),this.settings.apikey&&(r=r.replaceAll(this.settings.apikey,"<<username>>")),this.logs.push(r),this.logs.length>10&&this.logs.shift()}async loadSettings(){this.settings=Object.assign({},xi,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onExternalSettingsChange(){this.settingTab.notifyEndpointChange(this.settings)}async syncDictionary(){if(!this.settings.syncDictionary||Ze(this.settings.serverUrl)!=="premium")return await this.saveSettings(),!1;try{let n=new Set(this.settings.remoteDictionary),r=new Set(this.settings.dictionary),i=new Set(await ie.words(this.settings)),u=Qe(n,r);u=mi(u,i);for(let h of u)await ie.wordsDel(this.settings,h);let o=Qe(n,i);i=Qe(i,u),r=Qe(r,o);let s=Qe(r,i);for(let h of s)await ie.wordsAdd(this.settings,h);let c=Mn(i,r),a=new Set(this.settings.dictionary),l=a.size!==c.size;return Mn(a,c).size,c.size,this.settings.dictionary=[...c].sort(Ke),this.settings.remoteDictionary=[...c].sort(Ke),await this.saveSettings(),l}catch(n){this.pushLogs(n),console.error("Failed sync spellcheck with LanguageTool",n)}return await this.saveSettings(),!1}};function Go(e,t){let n=null;if(t.from>0){n=(0,Di.syntaxTree)(e.state);let r=n.resolveInner(t.from,-1);r.type.name.startsWith("list-")?t.from=r.from:t.from=e.state.doc.lineAt(t.from).from}else t.from=0;return t.to<e.state.doc.length?t.to=e.state.doc.lineAt(t.to).to:t.to=e.state.doc.length,t}
|
|
/*! Bundled license information:
|
|
|
|
is-buffer/index.js:
|
|
(*!
|
|
* Determine if an object is a Buffer
|
|
*
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
* @license MIT
|
|
*)
|
|
*/
|
|
|
|
/* nosourcemap */ |