1
0
wiki/.obsidian/plugins/obsidian-linter/main.js

321 lines
1.4 MiB
JavaScript
Raw Normal View History

2023-11-09 17:30:33 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
2024-09-05 22:23:37 +08:00
var Nm=Object.create;var $n=Object.defineProperty;var Yc=Object.getOwnPropertyDescriptor;var jm=Object.getOwnPropertyNames;var Ym=Object.getPrototypeOf,Pm=Object.prototype.hasOwnProperty;var mn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pc=(e,t)=>{for(var i in t)$n(e,i,{get:t[i],enumerable:!0})},Hc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jm(t))!Pm.call(e,r)&&r!==i&&$n(e,r,{get:()=>t[r],enumerable:!(n=Yc(t,r))||n.enumerable});return e};var gn=(e,t,i)=>(i=e!=null?Nm(Ym(e)):{},Hc(t||!e||!e.__esModule?$n(i,"default",{value:e,enumerable:!0}):i,e)),Hm=e=>Hc($n({},"__esModule",{value:!0}),e),z=(e,t,i,n)=>{for(var r=n>1?void 0:n?Yc(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=(n?s(t,i,r):s(r))||r);return n&&r&&$n(t,i,r),r};var Ko=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};var _=(e,t,i)=>(Ko(e,t,"read from private field"),i?i.call(e):t.get(e)),ke=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Me=(e,t,i,n)=>(Ko(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);var _o=(e,t,i,n)=>({set _(r){Me(e,t,r,i)},get _(){return _(e,t,n)}}),me=(e,t,i)=>(Ko(e,t,"access private method"),i);var Za=mn((Bd,Qa)=>{(function(e,t){"use strict";typeof define=="function"&&define.amd?define(t):typeof Qa=="object"&&Qa.exports?Qa.exports=t():e.log=t()})(Bd,function(){"use strict";var e=function(){},t="undefined",i=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],r={},a=null;function s(g,b){var f=g[b];if(typeof f.bind=="function")return f.bind(g);try{return Function.prototype.bind.call(f,g)}catch{return function(){return Function.prototype.apply.apply(f,[g,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(g){return g==="debug"&&(g="log"),typeof console===t?!1:g==="trace"&&i?o:console[g]!==void 0?s(console,g):console.log!==void 0?s(console,"log"):e}function c(){for(var g=this.getLevel(),b=0;b<n.length;b++){var f=n[b];this[f]=b<g?e:this.methodFactory(f,g,this.name)}if(this.log=this.debug,typeof console===t&&g<this.levels.SILENT)return"No console available for logging"}function d(g){return function(){typeof console!==t&&(c.call(this),this[g].apply(this,arguments))}}function u(g,b,f){return l(g)||d.apply(this,arguments)}function m(g,b){var f=this,x,k,L,E="loglevel";typeof g=="string"?E+=":"+g:typeof g=="symbol"&&(E=void 0);function O(D){var U=(n[D]||"silent").toUpperCase();if(!(typeof window===t||!E)){try{window.localStorage[E]=U;return}catch{}try{window.document.cookie=encodeURIComponent(E)+"="+U+";"}catch{}}}function S(){var D;if(!(typeof window===t||!E)){try{D=window.localStorage[E]}catch{}if(typeof D===t)try{var U=window.document.cookie,$=encodeURIComponent(E),F=U.indexOf($+"=");F!==-1&&(D=/^([^;]+)/.exec(U.slice(F+$.length+1))[1])}catch{}return f.levels[D]===void 0&&(D=void 0),D}}function I(){if(!(typeof window===t||!E)){try{window.localStorage.removeItem(E)}catch{}try{window.document.cookie=encodeURIComponent(E)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function K(D){var U=D;if(typeof U=="string"&&f.levels[U.toUpperCase()]!==void 0&&(U=f.levels[U.toUpperCase()]),typeof U=="number"&&U>=0&&U<=f.levels.SILENT)return U;throw new TypeError("log.setLevel() called with invalid level: "+D)}f.name=g,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=b||u,f.getLevel=function(){return L??k??x},f.setLevel=function(D,U){return L=K(D),U!==!1&&O(L),c.call(f)},f.setDefaultLevel=function(D){k=K(D),S()||f.setLevel(D,!1)},f.resetLevel=function(){L=null,I(),c.call(f)},f.enableAll=function(D){f.setLevel(f.levels.TRACE,D)},f.disableAll=function(D){f.setLevel(f.levels.SILENT,D)},f.rebuild=function(){if(a!==f&&(x=K(a.getLevel())),c.call(f),a===f)for(var D in r)r[D].rebuild()},x=K(a?a.getLevel():"WARN");var B=S();B!=null&&(L=K(B)),c.call(f)}a=new m,a.getLogger=f
`,d),u==-1&&(u=l.length-1);var p=l.substring(d,u+1);(n.hasOwnProperty?n.hasOwnProperty(p):n[p]!==void 0)?c+=String.fromCharCode(n[p]):(m==a&&(p=l.substring(d),u=l.length),c+=String.fromCharCode(m),n[p]=m,i[m++]=p),d=u+1}return c}var a=4e4,s=r(e);a=65535;var o=r(t);return{chars1:s,chars2:o,lineArray:i}};C.prototype.diff_charsToLines_=function(e,t){for(var i=0;i<e.length;i++){for(var n=e[i][1],r=[],a=0;a<n.length;a++)r[a]=t[n.charCodeAt(a)];e[i][1]=r.join("")}};C.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var i=0,n=Math.min(e.length,t.length),r=n,a=0;i<r;)e.substring(a,r)==t.substring(a,r)?(i=r,a=i):n=r,r=Math.floor((n-i)/2+i);return r};C.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var i=0,n=Math.min(e.length,t.length),r=n,a=0;i<r;)e.substring(e.length-r,e.length-a)==t.substring(t.length-r,t.length-a)?(i=r,a=i):n=r,r=Math.floor((n-i)/2+i);return r};C.prototype.diff_commonOverlap_=function(e,t){var i=e.length,n=t.length;if(i==0||n==0)return 0;i>n?e=e.substring(i-n):i<n&&(t=t.substring(0,i));var r=Math.min(i,n);if(e==t)return r;for(var a=0,s=1;;){var o=e.substring(r-s),l=t.indexOf(o);if(l==-1)return a;s+=l,(l==0||e.substring(r-s)==t.substring(0,s))&&(a=s,s++)}};C.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var i=e.length>t.length?e:t,n=e.length>t.length?t:e;if(i.length<4||n.length*2<i.length)return null;var r=this;function a(g,b,f){for(var x=g.substring(f,f+Math.floor(g.length/4)),k=-1,L="",E,O,S,I;(k=b.indexOf(x,k+1))!=-1;){var K=r.diff_commonPrefix(g.substring(f),b.substring(k)),B=r.diff_commonSuffix(g.substring(0,f),b.substring(0,k));L.length<B+K&&(L=b.substring(k-B,k)+b.substring(k,k+K),E=g.substring(0,f-B),O=g.substring(f+K),S=b.substring(0,k-B),I=b.substring(k+K))}return L.length*2>=g.length?[E,O,S,I,L]:null}var s=a(i,n,Math.ceil(i.length/4)),o=a(i,n,Math.ceil(i.length/2)),l;if(!s&&!o)return null;o?s?l=s[4].length>o[4].length?s:o:l=o:l=s;var c,d,u,m;e.length>t.length?(c=l[0],d=l[1],u=l[2],m=l[3]):(u=l[0],m=l[1],c=l[2],d=l[3]);var p=l[4];return[c,d,u,m,p]};C.prototype.diff_cleanupSemantic=function(e){for(var t=!1,i=[],n=0,r=null,a=0,s=0,o=0,l=0,c=0;a<e.length;)e[a][0]==G?(i[n++]=a,s=l,o=c,l=0,c=0,r=e[a][1]):(e[a][0]==se?l+=e[a][1].length:c+=e[a][1].length,r&&r.length<=Math.max(s,o)&&r.length<=Math.max(l,c)&&(e.splice(i[n-1],0,new C.Diff(ne,r)),e[i[n-1]+1][0]=se,n--,n--,a=n>0?i[n-1]:-1,s=0,o=0,l=0,c=0,r=null,t=!0)),a++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),a=1;a<e.length;){if(e[a-1][0]==ne&&e[a][0]==se){var d=e[a-1][1],u=e[a][1],m=this.diff_commonOverlap_(d,u),p=this.diff_commonOverlap_(u,d);m>=p?(m>=d.length/2||m>=u.length/2)&&(e.splice(a,0,new C.Diff(G,u.substring(0,m))),e[a-1][1]=d.substring(0,d.length-m),e[a+1][1]=u.substring(m),a++):(p>=d.length/2||p>=u.length/2)&&(e.splice(a,0,new C.Diff(G,d.substring(0,p))),e[a-1][0]=se,e[a-1][1]=u.substring(0,u.length-p),e[a+1][0]=ne,e[a+1][1]=d.substring(p),a++),a++}a++}};C.prototype.diff_cleanupSemanticLossless=function(e){function t(p,g){if(!p||!g)return 6;var b=p.charAt(p.length-1),f=g.charAt(0),x=b.match(C.nonAlphaNumericRegex_),k=f.match(C.nonAlphaNumericRegex_),L=x&&b.match(C.whitespaceRegex_),E=k&&f.match(C.whitespaceRegex_),O=L&&b.match(C.linebreakRegex_),S=E&&f.match(C.linebreakRegex_),I=O&&p.match(C.blanklineEndRegex_),K=S&&g.match(C.blanklineStartRegex_);return I||K?5:O||S?4:x&&!L&&E?3:L||E?2:x||k?1:0}for(var i=1;i<e.length-1;){if(e[i-1][0]==G&&e[i+1][0]==G){var n=e[i-1][1],r=e[i][1],a=e[i+1][1],s=this.diff_commonSuffix(n,r);if(s){var o=r.substring(r.length-s);n=n.substring(0,n.length-s),r=o+r.substring(0,r.length-s),a=o+a}for(var l=n,c=r,d=a,u=t(n,r)+t(r,a);r.charAt(0)===a.charAt(0);){n+=r.charAt(0),r=r.substring(1)+a.charAt(0),a=a.substring(1);var m=t(n,r)+t(r,a);m>=u&&(u=m,l=n,c=r,d=a)}e[i-1][1]!=l&&(l?e[i-1][1]=l:(e.splice(i-1,1),i--),e[i][1]=c,d?e[i+1][1]=d:(e.splice(i+1,1),i--))}i++}};C.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;C.whitespaceRegex_=/\s/;C.linebreakRegex_=/[\r\n]/;C.blanklineEnd
`),n=0,r=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;n<i.length;){var a=i[n].match(r);if(!a)throw new Error("Invalid patch string: "+i[n]);var s=new C.patch_obj;for(t.push(s),s.start1=parseInt(a[1],10),a[2]===""?(s.start1--,s.length1=1):a[2]=="0"?s.length1=0:(s.start1--,s.length1=parseInt(a[2],10)),s.start2=parseInt(a[3],10),a[4]===""?(s.start2--,s.length2=1):a[4]=="0"?s.length2=0:(s.start2--,s.length2=parseInt(a[4],10)),n++;n<i.length;){var o=i[n].charAt(0);try{var l=decodeURI(i[n].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+l)}if(o=="-")s.diffs.push(new C.Diff(ne,l));else if(o=="+")s.diffs.push(new C.Diff(se,l));else if(o==" ")s.diffs.push(new C.Diff(G,l));else{if(o=="@")break;if(o!=="")throw new Error('Invalid patch mode "'+o+'" in: '+l)}n++}}return t};C.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0};C.patch_obj.prototype.toString=function(){var e,t;this.length1===0?e=this.start1+",0":this.length1==1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2==1?t=this.start2+1:t=this.start2+1+","+this.length2;for(var i=["@@ -"+e+" +"+t+` @@
`],n,r=0;r<this.diffs.length;r++){switch(this.diffs[r][0]){case se:n="+";break;case ne:n="-";break;case G:n=" ";break}i[r+1]=n+encodeURI(this.diffs[r][1])+`
`}return i.join("").replace(/%20/g," ")};Dn.exports=C;Dn.exports.diff_match_patch=C;Dn.exports.DIFF_DELETE=ne;Dn.exports.DIFF_INSERT=se;Dn.exports.DIFF_EQUAL=G});var ym=mn((XK,fm)=>{fm.exports=_w;var Fx=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Rx=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Dx=["Su","Mo","Tu","We","Th","Fr","Sa"],xo=["January","February","March","April","May","June","July","August","September","October","November","December"],Kx=["ACDT","ACST","ACWT","ADT","ACT","AEDT","AEST","AFT","AKDT","AKST","ALMT","AMT","AMST","ANAT","ANAST","AQTT","ART","AST","AWDT","AWST","AZOT","AZOST","AZT","AZST","BNT","BDT","BOT","BRT","BRST","BST","BTT","B","CAST","CAT","CCT","CDT","CEDT","CEST","CET","CHADT","CHAST","CHOT","CHOST","CHsT","CHUT","CIT","CKT","CLST","CLT","COT","CST","CVT","CWST","CXT","C","DAVT","DDUT","DST","EASST","EAST","EAT","ECT","EDT","EEDT","EEST","EET","EGT","EGST","EST","E","EIT","FET","FJT","FJST","FKST","FKT","FNT","F","GALT","GAMT","GET","GFT","GILT","GMT","GST","GYT","G","HADT","HAST","HKT","HOVT","HOVST","HST","ICT","IDT","IOT","IRDT","IRKT","IRKST","IRST","IST","JST","KGT","KOST","KRAT","KRAST","KST","KUYT","LHDT","LHST","LINT","L","MAGT","MAGST","MART","MAWT","MDT","MeST","MHT","MIST","MMT","MSD","MSK","MST","MUT","MVT","MYT","NCT","NDT","NFT","N","NOVT","NOVST","NPT","NRT","NST","NT","NUT","NZDT","NZST","OMST","OMSST","ORAT","O","PDT","PET","PETT","PETST","PGT","PHT","PHOT","PKT","PMDT","PMST","PONT","PST","PWT","PYT","PYST","P","QYZT","RET","ROTT","R","SAKT","SAMT","SAST","SBT","SCT","SGT","SRT","SLT","SLST","SRET","SST","SYOT","TAHT","TFT","TJT","TKT","TLT","TMT","TOT","TRUT","TVT","T","ULAT","ULAST","UTC","UYST","UYT","UZT","U","VET","VLAT","VLAST","VOLT","VUT","V","WAKT","WAT","WAST","WDT","WEDT","WEST","WET","WFT","WGT","WGST","WIB","WIT","WITA","WST","WT","YAKT","YAKST","YAP","YEK","YEKS"],wo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_x=new RegExp(Fx.join("|"),"i"),Nx=new RegExp(Rx.join("|"),"i"),jx=new RegExp("\\b("+Dx.join("|")+")\\b","i"),Yx=new RegExp(xo.join("|"),"i"),Px=new RegExp(wo.join("|"),"i"),Hx=new RegExp("\\b("+Kx.join("|")+")\\b","i"),Ux=/(\d+)(st|nd|rd|th)\b/i,Wx=/(\d{1,4})([/.-])(\d{1,2})[/.-](\d{1,4})/,Vx=/((\+|-)(12:00|11:00|10:00|09:30|09:00|08:00|07:00|06:00|05:00|04:00|03:30|03:00|02:00|01:00|00:00|01:00|02:00|03:00|03:30|04:00|04:30|05:00|05:30|05:45|06:00|06:30|07:00|08:00|08:45|09:00|09:30|10:00|10:30|11:00|12:00|12:45|13:00|14:00))$/,$x=/((\+|-)(1200|1100|1000|0930|0900|0800|0700|0600|0500|0400|0330|0300|0200|0100|0000|0100|0200|0300|0330|0400|0430|0500|0530|0545|0600|0630|0700|0800|0845|0900|0930|1000|1030|1100|1200|1245|1300|1400))$/,jn="("+["AM?","PM?"].join("|")+")",Gx=new RegExp("0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)"+jn,"i"),Qx=new RegExp("0\\d\\:\\d{1,2}(\\s*)"+jn,"i"),Zx=new RegExp("0\\d(\\s*)"+jn,"i"),Jx=new RegExp("\\d{1,2}\\:\\d{1,2}\\:\\d{1,2}(\\s*)"+jn,"i"),Xx=new RegExp("\\d{1,2}\\:\\d{1,2}(\\s*)"+jn,"i"),ew=new RegExp("\\d{1,2}(\\s*)"+jn,"i"),iw=new RegExp("\\d{1,2}"),tw=new RegExp(xo.join("|")+"-\\d{2}","i"),nw=new RegExp(wo.join("|")+"-\\d{2}","i"),Dc=new RegExp("(\\d{1,2})(\\D+)("+xo.join("|")+"|"+wo.join("|")+")(\\2)('?\\d{2,4})"),rw=/\d{2}:\d{2}:\d{2}\.\d{3}/,aw=/\d{2}:\d{2}:\d{2}\.\d{2}/,sw=/\d{2}:\d{2}:\d{2}\.\d{1}/,ow=/T\d{2}:\d{2}:\d{2}/,lw=/0\d:\d{2}:\d{2}/,cw=/0\d:\d{2}/,dw=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}/,uw=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{3}/,pw=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{2}/,mw=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{1}/,gw=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]/,hw=/24:00:\d{2}/,fw=/24:00:\d{2}\.\d{3}/,yw=/24:00:\d{2}\.\d{2}/,bw=/24:00:\d{2}\.\d{1}/,vw=/24:00/,xw=/\d{4}/,ww=/\d{2}/,kw=/'\d{2}/,um=/0\d/,pm=/\d{1,2}/,zw=/0\d/,Aw=/\d{1,2}/,Sw=/^([1-9])\/([1-9]|0[1-9])$/,Lw=/^([1-9])\/(1[012])$/,Tw=/^(0[1-9]|[12][0-9]|3[01])\/([1-9])$/,Ew=/^(0[1-9]|[12][0-9]|3[01])\/(1[012]|0[1-9])$/,Cw=/^([1-9])(\D)([1-9][0-9])$/,Ow=/^([1-9])(\D)([0][0-9])$/,Mw=/^(0[1-9]|1[012])(\D)([1-9][0-9])$/,qw=/^(0[1-9]|1[012])(\D)([0][0-9])$/,Kc=/([/][M]|[M][/]|[MM]|[M
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`+e.mark.snippet),n+" "+i):n}function Qn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=od(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Qn.prototype=Object.create(Error.prototype);Qn.prototype.constructor=Qn;Qn.prototype.toString=function(t){return this.name+": "+od(this,t)};var We=Qn;function No(e,t,i,n,r){var a="",s="",o=Math.floor(r/2)-1;return n-t>o&&(a=" ... ",t=n-o+a.length),i-n>o&&(s=" ...",i=n+o-s.length),{str:a+e.slice(t,i).replace(/\t/g,"\u2192")+s,pos:n-t+a.length}}function jo(e,t){return Se.repeat(" ",t-e.length)+e}function tg(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var i=/\r?\n|\r|\0/g,n=[0],r=[],a,s=-1;a=i.exec(e.buffer);)r.push(a.index),n.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var o="",l,c,d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=No(e.buffer,n[s-l],r[s-l],e.position-(n[s]-n[s-l]),u),o=Se.repeat(" ",t.indent)+jo((e.line-l+1).toString(),d)+" | "+c.str+`
`+o;for(c=No(e.buffer,n[s],r[s],e.position,u),o+=Se.repeat(" ",t.indent)+jo((e.line+1).toString(),d)+" | "+c.str+`
`,o+=Se.repeat("-",t.indent+d+3+c.pos)+`^
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=No(e.buffer,n[s+l],r[s+l],e.position-(n[s]-n[s+l]),u),o+=Se.repeat(" ",t.indent)+jo((e.line+l+1).toString(),d)+" | "+c.str+`
`;return o.replace(/\n$/,"")}var ng=tg,rg=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ag=["scalar","sequence","mapping"];function sg(e){var t={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(n){t[String(n)]=i})}),t}function og(e,t){if(t=t||{},Object.keys(t).forEach(function(i){if(rg.indexOf(i)===-1)throw new We('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(i){return i},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=sg(t.styleAliases||null),ag.indexOf(this.kind)===-1)throw new We('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Ne=og;function Uc(e,t){var i=[];return e[t].forEach(function(n){var r=i.length;i.forEach(function(a,s){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(r=s)}),i[r]=n}),i}function lg(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,i;function n(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(t=0,i=arguments.length;t<i;t+=1)arguments[t].forEach(n);return e}function Po(e){return this.extend(e)}Po.prototype.extend=function(t){var i=[],n=[];if(t instanceof Ne)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(i=i.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new We("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(a){if(!(a instanceof Ne))throw new We("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new We("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new We("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof Ne))throw new We("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Po.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=Uc(r,"implicit"),r.compiledExplicit=Uc(r,"explicit"),r.compiledTypeMap=lg(r.compiledImplicit,r.compiledExplicit),r};var cg=Po,dg=new Ne("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ug=new Ne("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),pg=new Ne("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),mg=new cg({explicit:[dg,ug,pg]});function gg(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function hg(){return null}function fg(e){return e===null}var yg=new Ne("tag:yaml.org,2002:null",{kind:"scalar",resolve:gg,construct:hg,predicate:fg,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function bg(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function vg(e){return e==="true"||e==="True"||e==="TRUE"}function xg(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var wg=new Ne("tag:yaml.org,2002:bool",{kind:"scalar",resolve:bg,construct:vg,predicate:xg,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});functio
\r`;function Hg(e){if(e===null)return!1;var t,i,n=0,r=e.length,a=$o;for(i=0;i<r;i++)if(t=a.indexOf(e.charAt(i)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function Ug(e){var t,i,n=e.replace(/[\r\n=]/g,""),r=n.length,a=$o,s=0,o=[];for(t=0;t<r;t++)t%4===0&&t&&(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return i=r%4*6,i===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):i===18?(o.push(s>>10&255),o.push(s>>2&255)):i===12&&o.push(s>>4&255),new Uint8Array(o)}function Wg(e){var t="",i=0,n,r,a=e.length,s=$o;for(n=0;n<a;n++)n%3===0&&n&&(t+=s[i>>18&63],t+=s[i>>12&63],t+=s[i>>6&63],t+=s[i&63]),i=(i<<8)+e[n];return r=a%3,r===0?(t+=s[i>>18&63],t+=s[i>>12&63],t+=s[i>>6&63],t+=s[i&63]):r===2?(t+=s[i>>10&63],t+=s[i>>4&63],t+=s[i<<2&63],t+=s[64]):r===1&&(t+=s[i>>2&63],t+=s[i<<4&63],t+=s[64],t+=s[64]),t}function Vg(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var $g=new Ne("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Hg,construct:Ug,predicate:Vg,represent:Wg}),Gg=Object.prototype.hasOwnProperty,Qg=Object.prototype.toString;function Zg(e){if(e===null)return!0;var t=[],i,n,r,a,s,o=e;for(i=0,n=o.length;i<n;i+=1){if(r=o[i],s=!1,Qg.call(r)!=="[object Object]")return!1;for(a in r)if(Gg.call(r,a))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function Jg(e){return e!==null?e:[]}var Xg=new Ne("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Zg,construct:Jg}),eh=Object.prototype.toString;function ih(e){if(e===null)return!0;var t,i,n,r,a,s=e;for(a=new Array(s.length),t=0,i=s.length;t<i;t+=1){if(n=s[t],eh.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;a[t]=[r[0],n[r[0]]]}return!0}function th(e){if(e===null)return[];var t,i,n,r,a,s=e;for(a=new Array(s.length),t=0,i=s.length;t<i;t+=1)n=s[t],r=Object.keys(n),a[t]=[r[0],n[r[0]]];return a}var nh=new Ne("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ih,construct:th}),rh=Object.prototype.hasOwnProperty;function ah(e){if(e===null)return!0;var t,i=e;for(t in i)if(rh.call(i,t)&&i[t]!==null)return!1;return!0}function sh(e){return e!==null?e:{}}var oh=new Ne("tag:yaml.org,2002:set",{kind:"mapping",resolve:ah,construct:sh}),dd=Dg.extend({implicit:[jg,Pg],explicit:[$g,Xg,nh,oh]}),Zi=Object.prototype.hasOwnProperty,Ha=1,ud=2,pd=3,Ua=4,Yo=1,lh=2,Wc=3,ch=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dh=/[\x85\u2028\u2029]/,uh=/[,\[\]\{\}]/,md=/^(?:!|!!|![a-z\-]+!)$/i,gd=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Vc(e){return Object.prototype.toString.call(e)}function Ti(e){return e===10||e===13}function kt(e){return e===9||e===32}function Xe(e){return e===9||e===32||e===10||e===13}function fn(e){return e===44||e===91||e===93||e===123||e===125}function ph(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function mh(e){return e===120?2:e===117?4:e===85?8:0}function gh(e){return 48<=e&&e<=57?e-48:-1}function $c(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function hh(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var hd=new Array(256),fd=new Array(256);for(wt=0;wt<256;wt++)hd[wt]=$c(wt)?1:0,fd[wt]=$c(wt);var wt;function fh(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||dd,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function yd(e,t){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=ng(i),new We(t,i)}function N(e,t){throw yd(e,t)}function Wa(e,t){e.onWarning&&e.onWarning.call(null,yd(e,t))}var Gc={YAML:function(t,i,n){var r,a,s;t.version!==null&&N(t,"duplication of %YAML directive"),n.length!==1&&N(t,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&N(t,"ill-formed argument of the YAML directive"),a=parseInt(r[1],10),s=parseInt(r[2],10),a!==1&&N(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Wa(t,"unsupported YAML version of the document")},TAG:function(t,i,n){var r,a;n.length!==2&&N(t,"TAG directive accepts exactly two arguments"),r=n[0],a=n[1],md.test(r)||N(t,"ill-formed tag handle (first argument) of the TAG directive"),Zi.call(t.tagMap,r)&&N(t,'there is a previously declared suffix for "'+r+'" tag handle'),gd.test(a)||N(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{N(t,"tag prefix is malformed: "+a)}t.tagMap[r]=a}};function Qi(e,t,i,n){var r,a,s,o;if(t<i){if(o=e.input.slice(t,i),n)for(r=0,a=o.length;r<a;r+=1)s=o.charCodeAt(r),s===9||32<=s&&s<=1114111||N(e,"expected valid JSON character");else ch.test(o)&&N(e,"the stream contains non-printable characters");e.result+=o}}function Qc(e,t,i,n){var r,a,s,o;for(Se.isObject(i)||N(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),s=0,o=r.length;s<o;s+=1)a=r[s],Zi.call(t,a)||(t[a]=i[a],n[a]=!0)}function yn(e,t,i,n,r,a,s,o,l){var c,d;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),c=0,d=r.length;c<d;c+=1)Array.isArray(r[c])&&N(e,"nested arrays are not supported inside keys"),typeof r=="object"&&Vc(r[c])==="[object Object]"&&(r[c]="[object Object]");if(typeof r=="object"&&Vc(r)==="[object Object]"&&(r="[object Object]"),r=String(r),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(c=0,d=a.length;c<d;c+=1)Qc(e,t,a[c],i);else Qc(e,t,a,i);else!e.json&&!Zi.call(i,r)&&Zi.call(t,r)&&(e.line=s||e.line,e.lineStart=o||e.lineStart,e.position=l||e.position,N(e,"duplicated mapping key")),r==="__proto__"?Object.defineProperty(t,r,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[r]=a,delete i[r];return t}function Go(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):N(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ze(e,t,i){for(var n=0,r=e.input.charCodeAt(e.position);r!==0;){for(;kt(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(Ti(r))for(Go(e),r=e.input.charCodeAt(e.position),n++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return i!==-1&&n!==0&&e.lineIndent<i&&Wa(e,"deficient indentation"),n}function Ga(e){var t=e.position,i;return i=e.input.charCodeAt(t),!!((i===45||i===46)&&i===e.input.charCodeAt(t+1)&&i===e.input.charCodeAt(t+2)&&(t+=3,i=e.input.charCodeAt(t),i===0||Xe(i)))}function Qo(e,t){t===1?e.result+=" ":t>1&&(e.result+=Se.rep
`,t-1))}function yh(e,t,i){var n,r,a,s,o,l,c,d,u=e.kind,m=e.result,p;if(p=e.input.charCodeAt(e.position),Xe(p)||fn(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(r=e.input.charCodeAt(e.position+1),Xe(r)||i&&fn(r)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,o=!1;p!==0;){if(p===58){if(r=e.input.charCodeAt(e.position+1),Xe(r)||i&&fn(r))break}else if(p===35){if(n=e.input.charCodeAt(e.position-1),Xe(n))break}else{if(e.position===e.lineStart&&Ga(e)||i&&fn(p))break;if(Ti(p))if(l=e.line,c=e.lineStart,d=e.lineIndent,ze(e,!1,-1),e.lineIndent>=t){o=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=d;break}}o&&(Qi(e,a,s,!1),Qo(e,e.line-l),a=s=e.position,o=!1),kt(p)||(s=e.position+1),p=e.input.charCodeAt(++e.position)}return Qi(e,a,s,!1),e.result?!0:(e.kind=u,e.result=m,!1)}function bh(e,t){var i,n,r;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(Qi(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0;else Ti(i)?(Qi(e,n,r,!0),Qo(e,ze(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Ga(e)?N(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);N(e,"unexpected end of the stream within a single quoted scalar")}function vh(e,t){var i,n,r,a,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return Qi(e,i,e.position,!0),e.position++,!0;if(o===92){if(Qi(e,i,e.position,!0),o=e.input.charCodeAt(++e.position),Ti(o))ze(e,!1,t);else if(o<256&&hd[o])e.result+=fd[o],e.position++;else if((s=mh(o))>0){for(r=s,a=0;r>0;r--)o=e.input.charCodeAt(++e.position),(s=ph(o))>=0?a=(a<<4)+s:N(e,"expected hexadecimal character");e.result+=hh(a),e.position++}else N(e,"unknown escape sequence");i=n=e.position}else Ti(o)?(Qi(e,i,n,!0),Qo(e,ze(e,!1,t)),i=n=e.position):e.position===e.lineStart&&Ga(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}function xh(e,t){var i=!0,n,r,a,s=e.tag,o,l=e.anchor,c,d,u,m,p,g=Object.create(null),b,f,x,k;if(k=e.input.charCodeAt(e.position),k===91)d=93,p=!1,o=[];else if(k===123)d=125,p=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),k=e.input.charCodeAt(++e.position);k!==0;){if(ze(e,!0,t),k=e.input.charCodeAt(e.position),k===d)return e.position++,e.tag=s,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=o,!0;i?k===44&&N(e,"expected the node content, but found ','"):N(e,"missed comma between flow collection entries"),f=b=x=null,u=m=!1,k===63&&(c=e.input.charCodeAt(e.position+1),Xe(c)&&(u=m=!0,e.position++,ze(e,!0,t))),n=e.line,r=e.lineStart,a=e.position,bn(e,t,Ha,!1,!0),f=e.tag,b=e.result,ze(e,!0,t),k=e.input.charCodeAt(e.position),(m||e.line===n)&&k===58&&(u=!0,k=e.input.charCodeAt(++e.position),ze(e,!0,t),bn(e,t,Ha,!1,!0),x=e.result),p?yn(e,o,g,f,b,x,n,r,a):u?o.push(yn(e,null,g,f,b,x,n,r,a)):o.push(b),ze(e,!0,t),k=e.input.charCodeAt(e.position),k===44?(i=!0,k=e.input.charCodeAt(++e.position)):i=!1}N(e,"unexpected end of the stream within a flow collection")}function wh(e,t){var i,n,r=Yo,a=!1,s=!1,o=t,l=0,c=!1,d,u;if(u=e.input.charCodeAt(e.position),u===124)n=!1;else if(u===62)n=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)Yo===r?r=u===43?Wc:lh:N(e,"repeat of a chomping mode identifier");else if((d=gh(u))>=0)d===0?N(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?N(e,"repeat of an indentation width identifier"):(o=t+d-1,s=!0);else break;if(kt(u)){do u=e.input.charCodeAt(++e.position);while(kt(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!Ti(u)&&u!==0)}for(;u!==0;){for(Go(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!s||e.lineIn
`,a?1+l:l):r===Yo&&a&&(e.result+=`
`);break}for(n?kt(u)?(c=!0,e.result+=Se.repeat(`
`,a?1+l:l)):c?(c=!1,e.result+=Se.repeat(`
`,l+1)):l===0?a&&(e.result+=" "):e.result+=Se.repeat(`
`,l):e.result+=Se.repeat(`
`,a?1+l:l),a=!0,s=!0,l=0,i=e.position;!Ti(u)&&u!==0;)u=e.input.charCodeAt(++e.position);Qi(e,i,e.position,!1)}return!0}function Zc(e,t){var i,n=e.tag,r=e.anchor,a=[],s,o=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,N(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!Xe(s))));){if(o=!0,e.position++,ze(e,!0,-1)&&e.lineIndent<=t){a.push(null),l=e.input.charCodeAt(e.position);continue}if(i=e.line,bn(e,t,pd,!1,!0),a.push(e.result),ze(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>t)&&l!==0)N(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=n,e.anchor=r,e.kind="sequence",e.result=a,!0):!1}function kh(e,t,i){var n,r,a,s,o,l,c=e.tag,d=e.anchor,u={},m=Object.create(null),p=null,g=null,b=null,f=!1,x=!1,k;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),k=e.input.charCodeAt(e.position);k!==0;){if(!f&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,N(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),a=e.line,(k===63||k===58)&&Xe(n))k===63?(f&&(yn(e,u,m,p,g,null,s,o,l),p=g=b=null),x=!0,f=!0,r=!0):f?(f=!1,r=!0):N(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,k=n;else{if(s=e.line,o=e.lineStart,l=e.position,!bn(e,i,ud,!1,!0))break;if(e.line===a){for(k=e.input.charCodeAt(e.position);kt(k);)k=e.input.charCodeAt(++e.position);if(k===58)k=e.input.charCodeAt(++e.position),Xe(k)||N(e,"a whitespace character is expected after the key-value separator within a block mapping"),f&&(yn(e,u,m,p,g,null,s,o,l),p=g=b=null),x=!0,f=!1,r=!1,p=e.tag,g=e.result;else if(x)N(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=d,!0}else if(x)N(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=d,!0}if((e.line===a||e.lineIndent>t)&&(f&&(s=e.line,o=e.lineStart,l=e.position),bn(e,t,Ua,!0,r)&&(f?g=e.result:b=e.result),f||(yn(e,u,m,p,g,b,s,o,l),p=g=b=null),ze(e,!0,-1),k=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&k!==0)N(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return f&&yn(e,u,m,p,g,null,s,o,l),x&&(e.tag=c,e.anchor=d,e.kind="mapping",e.result=u),x}function zh(e){var t,i=!1,n=!1,r,a,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&N(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(i=!0,s=e.input.charCodeAt(++e.position)):s===33?(n=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,i){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):N(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!Xe(s);)s===33&&(n?N(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),md.test(r)||N(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),uh.test(a)&&N(e,"tag suffix cannot contain flow indicator characters")}a&&!gd.test(a)&&N(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{N(e,"tag name is malformed: "+a)}return i?e.tag=a:Zi.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:r==="!"?e.tag="!"+a:r==="!!"?e.tag="tag:yaml.org,2002:"+a:N(e,'undeclared tag handle "'+r+'"'),!0}function Ah(e){var t,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&N(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!Xe(i)&&!fn(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&N(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Sh(e){var t,i,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new fh(e,t),n=e.indexOf("\0");for(n!==-1&&(i.position=n,N(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Lh(i);return i.documents}function Th(e,t,i){t!==null&&typeof t=="object"&&typeof i>"u"&&(i=t,t=null);var n=bd(e,i);if(typeof t!="function")return n;for(var r=0,a=n.length;r<a;r+=1)t(n[r])}function Eh(e,t){var i=bd(e,t);if(i.length!==0){if(i.length===1)return i[0];throw new We("expected a single document in the stream, but found more")}}var Ch=Th,Oh=Eh,vd={loadAll:Ch,load:Oh},xd=Object.prototype.toString,wd=Object.prototype.hasOwnProperty,Zo=65279,Mh=9,Zn=10,qh=13,Ih=32,Bh=33,Fh=34,Ho=35,Rh=37,Dh=38,Kh=39,_h=42,kd=44,Nh=45,Va=58,jh=61,Yh=62,Ph=63,Hh=64,zd=91,Ad=93,Uh=96,Sd=123,Wh=124,Ld=125,je={};je[0]="\\0";je[7]="\\a";je[8]="\\b";je[9]="\\t";je[10]="\\n";je[11]="\\v";je[12]="\\f";je[13]="\\r";je[27]="\\e";je[34]='\\"';je[92]="\\\\";je[133]="\\N";je[160]="\\_";je[8232]="\\L";je[8233]="\\P";var Vh=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],$h=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Gh(e,t){var i,n,r,a,s,o,l;if(t===null)return{};for(i={},n=Object.keys(t),r=0,a=n.length;r<a;r+=1)s=n[r],o=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&wd.call(l.styleAliases,o)&&(o=l.styleAliases[o]),i[s]=o;return i}function Qh(e){var t,i,n;if(t=e.toString(16).toUpperCase(),e<=255)i="x",n=2;else if(e<=65535)i="u",n=4;else if(e<=4294967295)i="U",n=8;else throw new We("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+Se.repeat("0",n-t.length)+t}var Zh=1,Jn=2;function Jh(e){this.schema=e.schema||dd,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Se.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Gh(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Jn:Zh,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Jc(e,t){for(var i=Se.repeat(" ",t),n=0,r=-1,a="",s,o=e.length;n<o;)r=e.indexOf(`
2023-11-09 17:30:33 +08:00
`,n),r===-1?(s=e.slice(n),n=o):(s=e.slice(n,r+1),n=r+1),s.length&&s!==`
2024-09-05 22:23:37 +08:00
`&&(a+=i),a+=s;return a}function Uo(e,t){return`
`+Se.repeat(" ",e.indent*t)}function Xh(e,t){var i,n,r;for(i=0,n=e.implicitTypes.length;i<n;i+=1)if(r=e.implicitTypes[i],r.resolve(t))return!0;return!1}function $a(e){return e===Ih||e===Mh}function Xn(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Zo||65536<=e&&e<=1114111}function Xc(e){return Xn(e)&&e!==Zo&&e!==qh&&e!==Zn}function ed(e,t,i){var n=Xc(e),r=n&&!$a(e);return(i?n:n&&e!==kd&&e!==zd&&e!==Ad&&e!==Sd&&e!==Ld)&&e!==Ho&&!(t===Va&&!r)||Xc(t)&&!$a(t)&&e===Ho||t===Va&&r}function ef(e){return Xn(e)&&e!==Zo&&!$a(e)&&e!==Nh&&e!==Ph&&e!==Va&&e!==kd&&e!==zd&&e!==Ad&&e!==Sd&&e!==Ld&&e!==Ho&&e!==Dh&&e!==_h&&e!==Bh&&e!==Wh&&e!==jh&&e!==Yh&&e!==Kh&&e!==Fh&&e!==Rh&&e!==Hh&&e!==Uh}function tf(e){return!$a(e)&&e!==Va}function Gn(e,t){var i=e.charCodeAt(t),n;return i>=55296&&i<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(i-55296)*1024+n-56320+65536:i}function Td(e){var t=/^\n* /;return t.test(e)}var Ed=1,Wo=2,Cd=3,Od=4,hn=5;function nf(e,t,i,n,r,a,s,o){var l,c=0,d=null,u=!1,m=!1,p=n!==-1,g=-1,b=ef(Gn(e,0))&&tf(Gn(e,e.length-1));if(t||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Gn(e,l),!Xn(c))return hn;b=b&&ed(c,d,o),d=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Gn(e,l),c===Zn)u=!0,p&&(m=m||l-g-1>n&&e[g+1]!==" ",g=l);else if(!Xn(c))return hn;b=b&&ed(c,d,o),d=c}m=m||p&&l-g-1>n&&e[g+1]!==" "}return!u&&!m?b&&!s&&!r(e)?Ed:a===Jn?hn:Wo:i>9&&Td(e)?hn:s?a===Jn?hn:Wo:m?Od:Cd}function rf(e,t,i,n,r){e.dump=function(){if(t.length===0)return e.quotingType===Jn?'""':"''";if(!e.noCompatMode&&(Vh.indexOf(t)!==-1||$h.test(t)))return e.quotingType===Jn?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,i),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),o=n||e.flowLevel>-1&&i>=e.flowLevel;function l(c){return Xh(e,c)}switch(nf(t,o,e.indent,s,l,e.quotingType,e.forceQuotes&&!n,r)){case Ed:return t;case Wo:return"'"+t.replace(/'/g,"''")+"'";case Cd:return"|"+id(t,e.indent)+td(Jc(t,a));case Od:return">"+id(t,e.indent)+td(Jc(af(t,s),a));case hn:return'"'+sf(t)+'"';default:throw new We("impossible error: invalid scalar style")}}()}function id(e,t){var i=Td(e)?String(t):"",n=e[e.length-1]===`
2023-11-09 17:30:33 +08:00
`,r=n&&(e[e.length-2]===`
`||e===`
`),a=r?"+":n?"":"-";return i+a+`
2024-09-05 22:23:37 +08:00
`}function td(e){return e[e.length-1]===`
`?e.slice(0,-1):e}function af(e,t){for(var i=/(\n+)([^\n]*)/g,n=function(){var c=e.indexOf(`
`);return c=c!==-1?c:e.length,i.lastIndex=c,nd(e.slice(0,c),t)}(),r=e[0]===`
2023-11-09 17:30:33 +08:00
`||e[0]===" ",a,s;s=i.exec(e);){var o=s[1],l=s[2];a=l[0]===" ",n+=o+(!r&&!a&&l!==""?`
2024-09-05 22:23:37 +08:00
`:"")+nd(l,t),r=a}return n}function nd(e,t){if(e===""||e[0]===" ")return e;for(var i=/ [^ ]/g,n,r=0,a,s=0,o=0,l="";n=i.exec(e);)o=n.index,o-r>t&&(a=s>r?s:o,l+=`
2023-11-09 17:30:33 +08:00
`+e.slice(r,a),r=a+1),s=o;return l+=`
`,e.length-r>t&&s>r?l+=e.slice(r,s)+`
2024-09-05 22:23:37 +08:00
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function sf(e){for(var t="",i=0,n,r=0;r<e.length;i>=65536?r+=2:r++)i=Gn(e,r),n=je[i],!n&&Xn(i)?(t+=e[r],i>=65536&&(t+=e[r+1])):t+=n||Qh(i);return t}function of(e,t,i){var n="",r=e.tag,a,s,o;for(a=0,s=i.length;a<s;a+=1)o=i[a],e.replacer&&(o=e.replacer.call(i,String(a),o)),(ji(e,t,o,!1,!1)||typeof o>"u"&&ji(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=r,e.dump="["+n+"]"}function rd(e,t,i,n){var r="",a=e.tag,s,o,l;for(s=0,o=i.length;s<o;s+=1)l=i[s],e.replacer&&(l=e.replacer.call(i,String(s),l)),(ji(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&ji(e,t+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=Uo(e,t)),e.dump&&Zn===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=a,e.dump=r||"[]"}function lf(e,t,i){var n="",r=e.tag,a=Object.keys(i),s,o,l,c,d;for(s=0,o=a.length;s<o;s+=1)d="",n!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=a[s],c=i[l],e.replacer&&(c=e.replacer.call(i,l,c)),ji(e,t,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ji(e,t,c,!1,!1)&&(d+=e.dump,n+=d));e.tag=r,e.dump="{"+n+"}"}function cf(e,t,i,n){var r="",a=e.tag,s=Object.keys(i),o,l,c,d,u,m;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new We("sortKeys must be a boolean or a function");for(o=0,l=s.length;o<l;o+=1)m="",(!n||r!=="")&&(m+=Uo(e,t)),c=s[o],d=i[c],e.replacer&&(d=e.replacer.call(i,c,d)),ji(e,t+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&Zn===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,u&&(m+=Uo(e,t)),ji(e,t+1,d,!0,u)&&(e.dump&&Zn===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,r+=m));e.tag=a,e.dump=r||"{}"}function ad(e,t,i){var n,r,a,s,o,l;for(r=i?e.explicitTypes:e.implicitTypes,a=0,s=r.length;a<s;a+=1)if(o=r[a],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof t=="object"&&t instanceof o.instanceOf)&&(!o.predicate||o.predicate(t))){if(i?o.multi&&o.representName?e.tag=o.representName(t):e.tag=o.tag:e.tag="?",o.represent){if(l=e.styleMap[o.tag]||o.defaultStyle,xd.call(o.represent)==="[object Function]")n=o.represent(t,l);else if(wd.call(o.represent,l))n=o.represent[l](t,l);else throw new We("!<"+o.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function ji(e,t,i,n,r,a,s){e.tag=null,e.dump=i,ad(e,i,!1)||ad(e,i,!0);var o=xd.call(e.dump),l=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var d=o==="[object Object]"||o==="[object Array]",u,m;if(d&&(u=e.duplicates.indexOf(i),m=u!==-1),(e.tag!==null&&e.tag!=="?"||m||e.indent!==2&&t>0)&&(r=!1),m&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&m&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(cf(e,t,e.dump,r),m&&(e.dump="&ref_"+u+e.dump)):(lf(e,t,e.dump),m&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?rd(e,t-1,e.dump,r):rd(e,t,e.dump,r),m&&(e.dump="&ref_"+u+e.dump)):(of(e,t,e.dump),m&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&rf(e,e.dump,t,a,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new We("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function df(e,t){var i=[],n=[],r,a;for(Vo(e,i,n),r=0,a=n.length;r<a;r+=1)t.duplicates.push(i[n[r]]);t.usedDuplicates=new Array(a)}function Vo(e,t,i){var n,r,a;if(e!==null&&typeof e=="object")if(r=t.indexOf(e),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(t.push(e),Array.isArray(e))for(r=0,a=e.length;r<a;r+=1)Vo(e[r],t,i);else for(n=Object.keys(e),r=0,a=n.length;r<a;r+=1)Vo(e[n[r]],t,i)}function uf(e,t){t=t||{};var i=new Jh(t);i.noRefs||df(e,i);var n=e;return i.replacer&&(n=i.replacer.call({"":n},"",n)),ji(i,0,n,!0,!0)?i.dump+`
`:""}var pf=uf,mf={dump:pf};function Jo(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Xo=vd.load,hk=vd.loadAll,el=mf.dump,Md=We;var fk=Jo("safeLoad","load"),yk=Jo("safeLoadAll","loadAll"),bk=Jo("safeDump","dump");function er(e,t){if(e==null)return null;let i=il(e,t);return typeof i=="string"?i:null}function qd(e,t){if(e==null)return null;let i=il(e,t);return typeof i=="number"?i:null}function Id(e,t){if(e==null)return null;let i=il(e,t);return typeof i=="boolean"?i:null}function il(e,t){t=t.replace("..",".");let i=t.split(".");i!=null&&i[i.length-1]==""&&(i[i.length-1]=".");let n=e;for(let r of i)if(n=n[r],n==null)return null;return n}var re=gn(Za());var Ja="[Obsidian Linter]",tl=new Map,ir=!1;var Xa=[];function Fd(e,t){let i=`${Ja} ${e}:
2023-11-09 17:30:33 +08:00
`;i+=`${t.name} ${t.message}`,t.stack&&(i+=`
2024-09-05 22:23:37 +08:00
`+t.stack),re.default.error(i),ir&&es(i.substring(i.indexOf("]")+2),re.default.levels.TRACE)}function vn(e){re.default.info(`${Ja} ${e}`),ir&&es(e,re.default.levels.INFO)}function ii(e){re.default.debug(`${Ja} ${e}`),ir&&es(e,re.default.levels.DEBUG)}function Yi(e){re.default.warn(`${Ja} ${e}`),ir&&es(e,re.default.levels.WARN)}function zt(e){re.default.getLevel()>re.default.levels.DEBUG||tl.set(e,performance.now())}function Ji(e){if(re.default.getLevel()>re.default.levels.DEBUG)return;tl.has(e)||Yi(A("logs.timing-key-not-found").replace("{TIMING_KEY}",e));let t=performance.now()-tl.get(e);ii(`${e}: ${t} `+A("logs.milliseconds-abbreviation"))}function es(e,t){re.default.getLevel()<=t&&Xa.push(e)}function Rd(){Xa=[]}function nl(e){ir=e}function is(e){switch(e){case"INFO":{re.default.setLevel("info");break}case"TRACE":{re.default.setLevel("trace");break}case"DEBUG":{re.default.setLevel("debug");break}case"SILENT":{re.default.setLevel("silent");break}case"ERROR":{re.default.setLevel("error");break}case"WARN":{re.default.setLevel("warn");break}}}function Dd(e){switch(e){case re.default.levels.INFO:return"INFO";case re.default.levels.TRACE:return"TRACE";case re.default.levels.DEBUG:return"DEBUG";case re.default.levels.SILENT:return"SILENT";case re.default.levels.ERROR:return"ERROR";case re.default.levels.WARN:return"WARN"}}var Kd={};var _d={};var Nd={};var jd={commands:{"lint-file":{name:"Linten Sie die aktuelle Datei","error-message":"Lint-Datei-Fehler in der Datei"},"lint-file-unless-ignored":{name:"Linten Sie die aktuelle Datei, es sei denn, sie wird ignoriert"},"lint-all-files":{name:"Linten Sie alle Dateien im Vault","error-message":"Beim Linten aller Dateien Fehler in der Datei","success-message":"Alle Dateien gelinted","errors-message-singular":"Beim Linten aller Dateien gab es einen Fehler.","errors-message-plural":"Beim Linten aller Dateien gab es {NUM} Fehler.","start-message":"Dadurch werden alle Ihre Dateien ver\xE4ndert und es k\xF6nnen Fehler entstehen.","submit-button-text":"Linte alle","submit-button-notice-text":"Linte alle Dateien..."},"lint-all-files-in-folder":{name:"Linte alle Dateien im aktuellen Ordner","start-message":"Dadurch werden alle Ihre Dateien in {FOLDER_NAME} bearbeitet, einschlie\xDFlich der Dateien in den Unterordnern, was zu Fehlern f\xFChren kann.","submit-button-text":"Linte alle Dateien in {FOLDER_NAME}","submit-button-notice-text":"Linten aller Dateien in {FOLDER_NAME}...","error-message":"Beim Linten aller Dateien im Ordner gab es Fehler in der Datei","success-message":"Alle {NUM}-Dateien in {FOLDER_NAME} wurden gelinted.","message-singular":"Alle {NUM}-Dateien in {FOLDER_NAME} wurden gelinted und es trat ein Fehler auf.","message-plural":"Alle {FILE_COUNT}-Dateien in {FOLDER_NAME} wurden gelinted und es gab {ERROR_COUNT} Fehler."},"paste-as-plain-text":{name:"Einf\xFCgen als reiner Text und ohne \xC4nderungen"},"lint-file-pop-up-menu-text":{name:"Linte Datei"},"lint-folder-pop-up-menu-text":{name:"Linte Ordner"}},logs:{"plugin-load":"Plugin wird geladen","plugin-unload":"Plugin entladen","folder-lint":"Linting-Ordner ","linter-run":"Laufender Linter","paste-link-warning":"Abgebrochenes Einf\xFCgen des Lints, da der Inhalt der Zwischenablage ein Link ist, wodurch Konflikte mit anderen Plugins vermieden werden, die das Einf\xFCgen \xE4ndern.","see-console":"Weitere Informationen finden Sie in der Konsole.","unknown-error":"Beim Linten ist ein unbekannter Fehler aufgetreten.","moment-locale-not-found":"Beim Versuch, Moment.js locale auf {MOMENT_LOCALE} umzustellen, wurde {CURRENT_LOCALE} angezeigt","file-change-lint-message-start":"Linted","pre-rules":"Regeln vor regul\xE4ren Regeln","post-rules":"Regeln nach regul\xE4ren Regeln","rule-running":"Laufende Regeln","custom-regex":"Benutzerdefinierte Regex-Regeln","running-custom-regex":"Ausf\xFChren von benutzerdefinierten Regex","running-custom-lint-command":"Ausf\xFChren von benutzerdefinierten Lint-Befehlen","custom-lint-duplicate-warning":'Sie k\xF6nnen denselben Befehl ("{COMMAND_NAME}") nicht zweimal als benutzerdefinierte Lint-Regel
`)break;r.trim()===""||r===">"?i=r+i:i="",n--}return[i,n]}function ll(e=""){let[t]=xn(e,e.length);return`
`+t.trim()}function cu(e="",t=!1,i=1){let n=ll(e),r=Xi(n,">");return(t||us.test(e))&&i===r||i<r?n.substring(0,n.lastIndexOf(">")):n}function xf(e,t){if(t===0)return e;let i=t,n=t;for(;i>=0;){let r=e.charAt(i);if(r.trim()!=="")break;r===`
2023-11-09 17:30:33 +08:00
`&&(n=i),i--}return i<0||n===0?e.substring(t+1):e.substring(0,n)+`
2024-09-05 22:23:37 +08:00
`+e.substring(t)}function wf(e,t,i,n=!1,r=!1){if(i===0)return e;let a=t.split(">").length-1,s=i,o=i,l=0,c=!1,d="";for(;s>=0;){let k=e.charAt(s);if(k.trim()!==""&&k!==">")break;if(k===">"){if(c)break;l++}else if(k===`
2023-12-10 12:54:30 +08:00
`)if(l===0||l===a||l+1===a)o=s,l=0,d===`
2024-09-05 22:23:37 +08:00
`&&(c=!0);else break;s--,d=k}if(s<0||o===0)return e.substring(i+1);let u=e.substring(o,i);if(u===`
2023-11-09 17:30:33 +08:00
`||u.startsWith(`
`))return e.substring(0,o)+`
2024-09-05 22:23:37 +08:00
`+e.substring(i);let p=e.lastIndexOf(`
`,o-1),g="";p===-1?g=e.substring(0,o):g=e.substring(p,o);let b,f=e.indexOf(`
`,i+1);f===-1?b=e.substring(i):b=e.substring(i,f);let x;return r?x=cu(g,n,a):Xi(g,">")!=0&&!us.test(g)&&(tr.test(g)||tr.test(b))?x=e.substring(o,i).trimEnd():x=ll(g),e.substring(0,o)+x+e.substring(i)}function kf(e,t){if(t===e.length-1)return e;let i=t,n=t,r=!0;for(;i<e.length;){let a=e.charAt(i);if(a.trim()!=="")break;a===`
2023-11-09 17:30:33 +08:00
`&&(r?r=!1:n=i),i++}return i===e.length||n===e.length-1?e.substring(0,t):e.substring(0,t)+`
2024-09-05 22:23:37 +08:00
`+e.substring(n)}function zf(e,t,i,n=!1,r=!1){if(i===e.length-1)return e;let a=t.split(">").length-1,s=i,o=i,l=!0,c=0,d=!1,u="",m=!0,p=e.charAt(s-1);for(;s<e.length;){let O=e.charAt(s);if(O.trim()!==""&&O!==">")break;if(O===">"){if(d)break;c++}else if(O===`
2023-12-10 12:54:30 +08:00
`)if(c===0||c===a||c+1===a)c=0,l?l=!1:o=s,u===`
2024-09-05 22:23:37 +08:00
`&&(d=!0);else break;if(s++,u=O,m&&O===`
`&&r&&p===`
`){o=s;break}m=!1}if(s===e.length||o===e.length-1)return e.substring(0,i);let g=e.substring(i,o);if(g===`
`||g.endsWith(`
2023-11-09 17:30:33 +08:00
`))return e.substring(0,i)+`
2024-09-05 22:23:37 +08:00
`+e.substring(o);let f=e.indexOf(`
`,o+1),x="";f===-1?x=e.substring(o):x=e.substring(o+1,f);let k,L=e.lastIndexOf(`
`,i-1);L===-1?k=e.substring(0,o):k=e.substring(L+1,i);let E;return r?E=cu(x,n,a):tr.test(x)||tr.test(k)?E=e.substring(i,o).trimEnd():E=ll(x),e.substring(0,i)+E+e.substring(o)}function St(e,t,i,n=!1){let[r,a]=xn(e,t);if(r.trim()!==""){let o=us.test(e.substring(t,i)),l=Xi(r,">"),c=Sf(e,i,l),d=zf(e,r,c,o,n);return a=Af(d,a,l),wf(d,r,a,o,n)}let s=kf(e,i);return xf(s,a)}function du(e,t=0){let i=3735928559^t,n=1103547991^t;for(let r=0,a;r<e.length;r++)a=e.charCodeAt(r),i=Math.imul(i^a,2654435761),n=Math.imul(n^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&n)+(i>>>0)}function uu(e){return e=e.replaceAll("\\b","\b"),e=e.replaceAll("\\f","\f"),e=e.replaceAll("\\n",`
`),e=e.replaceAll("\\r","\r"),e=e.replaceAll("\\t"," "),e=e.replaceAll("\\v","\v"),e}function rr(e,t){if(t==0)return t;let i=t;for(;i>0&&e.charAt(i-1)!==`
`;)i--;return i}function pu(e,t,i,n){return n>e.length-1?e:e.slice(0,n)+e.slice(n,e.length).replace(t,i)}function Xi(e,t){let i=0;for(let n=0,r=e.length;n<r;n++){let a=e.indexOf(t,n);a>-1&&(i++,n=a)}return i}function cs(e){let t=typeof e;return t!="string"?t==="number":!isNaN(e)&&!isNaN(parseFloat(e))}function mu(e,t){let i=[],n=-1;for(;(n=t.indexOf(e,n+1))>=0;)i.push(n);return i}function Af(e,t,i){let n=t,r=t+1,a="",s=!1,o=0;for(;r<e.length;){if(a=e.charAt(r),a.trim()!==""&&a!==">"){s=!0;break}else if(a===`
`){if(o!==i)break;o=0,n=r}else a===">"&&o++;r++}return s?n:t}function Sf(e,t,i){let n=t,r=t-1,a="",s=!1,o=0;for(;r>=0;){if(a=e.charAt(r),a.trim()!==""&&a!==">"){s=!0;break}else if(a===`
`){if(o!==i)break;o=0,n=r}else a===">"&&o++;r--}return s?n:t}function ds(e){let t=wn(e),i=new Map,n="",r=[],a=[];for(let s of t){n=e.substring(s.startIndex,s.endIndex),r=n.split(`
`),r.splice(0,2);for(let o of r){if(a=o.split("|"),a.length!==4){Yi(A("options.custom-auto-correct.custom-row-parse-warning").replace("{ROW}",o));continue}i.set(a[1].trim().toLowerCase(),a[2].trim())}}return i}function Fe(e,t,i,n){let r=e.length,a=0,s;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,i=i>0?i:0,n.length<1e4)s=Array.from(n),s.unshift(t,i),e.splice(...s);else for(i&&e.splice(t,i);a<n.length;)s=n.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function Ve(e,t){return e.length>0?(Fe(e,e.length,0,t),e):t}var Lf=et(/\p{P}/u),ti=et(/[A-Za-z]/),$e=et(/[\dA-Za-z]/),gu=et(/[#-'*+\--9=?A-Z^-~]/);function ar(e){return e!==null&&(e<32||e===127)}var sr=et(/\d/),hu=et(/[\dA-Fa-f]/),cl=et(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function te(e){return e!==null&&(e<0||e===32)}function V(e){return e===-2||e===-1||e===32}function fu(e){return cl(e)||Lf(e)}var yu=et(/\s/);function et(e){return t;function t(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function dl(e){if(e===null||te(e)||yu(e))return 1;if(fu(e))return 2}function kn(e,t,i){let n=[],r=-1;for(;++r<e.length;){let a=e[r].resolveAll;a&&!n.includes(a)&&(t=a(t,i),n.push(a))}return t}var or={name:"attention",tokenize:Ef,resolveAll:Tf};function Tf(e,t){let i=-1,n,r,a,s,o,l,c,d;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(n=i;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[n][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;let u=Object.assign({},e[n][1].end),m=Object.assign({},e[i][1].start);bu(u,-l),bu(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:u,end:Object.assign({},e[n][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[i][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[i][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[n][1].end=Object.assign({},s.start),e[i][1].start=Object.assign({},o.end),c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=Ve(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Ve(c,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",a,t]]),c=Ve(c,kn(t.parser.constructs.insideSpan.null,e.slice(n+1,i),t)),c=Ve(c,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[i][1].end.offset-e[i][1].start.offset?(d=2,c=Ve(c,[["enter",e[i][1],t],["exit",e[i][1],t]])):d=0,Fe(e,n-1,i-n+3,c),i=n+c.length-d-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function Ef(e,t){let i=this.parser.constructs.attentionMarkers.null,n=this.previous,r=dl(n),a;return s;function s(l){return a=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===a)return e.consume(l),o;let c=e.exit("attentionSequence"),d=dl(l),u=!d||d===2&&r||i.includes(l),m=!r||r===2&&d||i.includes(n);return c._open=!!(a===42?u:u&&(r||!m)),c._close=!!(a===42?m:m&&(d||!u)),t(l)}}function bu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ul={name:"autolink",tokenize:Cf};function Cf(e,t,i){let n=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return ti(p)?(e.consume(p),s):c(p)}function s(p){return p===43||p===45||p===46||$e(p)?(n=1,o(p)):c(p)}function o(p){return p===58?(e.consume(p),n=0,l):(p===43||p===45||p===46||$e(p))&&n++<32?(e.consume(p),o):(n=0,c(p))}function l(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||ar(p)?i(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),d):gu(p)?(e.consume(p),c):i(p)}function d(p){return $e(p)?u(p):i(p)}function u(p){return p===46?(e.consu
2023-11-09 17:30:33 +08:00
`;break}case-3:{s=`\r
2024-09-05 22:23:37 +08:00
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&r)continue;s=" ";break}default:s=String.fromCharCode(a)}r=a===-2,n.push(s)}return n.join("")}var Tl={};Pc(Tl,{attentionMarkers:()=>cb,contentInitial:()=>nb,disable:()=>db,document:()=>tb,flow:()=>ab,flowInitial:()=>rb,insideSpan:()=>lb,string:()=>sb,text:()=>ob});var tb={42:Pe,43:Pe,45:Pe,48:Pe,49:Pe,50:Pe,51:Pe,52:Pe,53:Pe,54:Pe,55:Pe,56:Pe,57:Pe,62:ps},nb={91:gl},rb={[-2]:lr,[-1]:lr,32:lr},ab={35:fl,42:Et,45:[xs,Et],60:bl,61:xs,95:Et,96:hs,126:hs},sb={38:gs,92:ms},ob={[-5]:cr,[-4]:cr,[-3]:cr,33:xl,38:gs,42:or,60:[ul,vl],91:wl,92:[hl,ms],93:Tt,95:or,96:pl},lb={null:[or,qu]},cb={null:[42,95]},db={null:[]};function El(e){let i=ws([Tl,...(e||{}).extensions||[]]),n={defined:[],lazy:{},constructs:i,content:r(Eu),document:r(Ou),flow:r(Mu),string:r(Iu),text:r(Bu)};return n;function r(a){return s;function s(o){return Du(n,a,o)}}}function Cl(e){for(;!fs(e););return e}var Ku=/[\0\t\n\r]/g;function Ol(){let e=1,t="",i=!0,n;return r;function r(a,s,o){let l=[],c,d,u,m,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),u=0,t="",i&&(a.charCodeAt(0)===65279&&u++,i=void 0);u<a.length;){if(Ku.lastIndex=u,c=Ku.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){t=a.slice(u);break}if(p===10&&u===m&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),u<m&&(l.push(a.slice(u,m)),e+=m-u),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:n=!0,e=1}u=m+1}return o&&(n&&l.push(-5),t&&l.push(t),l.push(null)),l}}var ub=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _u(e){return e.replace(ub,pb)}function pb(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){let r=i.charCodeAt(1),a=r===120||r===88;return ks(i.slice(a?2:1),a?16:10)}return zn(i)||e}function An(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Nu(e.position):"start"in e||"end"in e?Nu(e):"line"in e||"column"in e?Ml(e):""}function Ml(e){return ju(e&&e.line)+":"+ju(e&&e.column)}function Nu(e){return Ml(e&&e.start)+"-"+Ml(e&&e.end)}function ju(e){return e&&typeof e=="number"?e:1}var Pu={}.hasOwnProperty;function ql(e,t,i){return typeof t!="string"&&(i=t,t=void 0),mb(i)(Cl(El(i).document().write(Ol()(e,t,!0))))}function mb(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Na),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(Da),blockQuote:a(Di),characterEscape:B,characterReference:B,codeFenced:a(oi),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(oi,s),codeText:a(Li,s),codeTextData:B,data:B,codeFlowValue:B,definition:a(Gi),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(dn),hardBreakEscape:a(Ka),hardBreakTrailing:a(Ka),htmlFlow:a(Hn,s),htmlFlowData:B,htmlText:a(Hn,s),htmlTextData:B,image:a(_a),label:s,link:a(Na),listItem:a(Ki),listItemValue:m,listOrdered:a(ja,u),listUnordered:a(ja),paragraph:a(un),reference:w,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(Da),strong:a(Ya),thematicBreak:a(Un)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:oe,autolinkProtocol:Ri,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Fi,codeFenced:l(f),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:D,codeIndented:l(x),codeText:l(P),codeTextData:D,data:D,definition:l(),definitionDestinationString:E,definitionLabelString:k,definitionTitleString:L,emphasis:l(),hardBreakEscape:l($),hardBreakTrailing:l($),htmlFlow:l(F),htmlFlowData:D,htmlText:l(Y),htmlTextData:D,image:l(J),label:Oe,labelText:De,lineEnding:U,link:l(Z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:we,resourceDestinationString:v,resourceTitleString:Ke,resource:Ue,setextHeading:l(K),setextHeadingLineSequence:I,setextHeadingText:S,strong:l(),thematicBreak:l()}};Hu(t,(e||{}).mdastExtensions||[]);let i={};return n;function n
2024-01-10 16:42:54 +08:00
`&&(e=e.substring(0,s.end.offset)+e.substring(s.end.offset+1)),s.end.offset<e.length&&e[s.end.offset]===`
2024-09-05 22:23:37 +08:00
`&&(e=e.substring(0,s.end.offset)+e.substring(s.end.offset+1)),e=e.substring(0,s.start.offset)+e.substring(s.end.offset),a(e,o,s.start.offset)}for(let s of n){let o=s[1],l=o.referencePositions.length-o.footnotesReferencingKey.length;l=l>=0?l:0;let c=0;for(let d of o.footnotesReferencingKey){if(c+l>=o.referencePositions.length)throw new Error(A("logs.missing-footnote-error-message").replace("{FOOTNOTE}",d));r.set(d,o.referencePositions[l+c++])}}i=i.sort((s,o)=>r.get(s)-r.get(o)),i.length>0&&(e=e.trimEnd()+`
2023-11-09 17:30:33 +08:00
`);for(let s of i)e+=`
2024-09-05 22:23:37 +08:00
`+s;return e}function Ju(e){let t=ye("footnoteDefinition",e),i=[],n=new Map,r=new Map,a=[],s=new Set,o=[],l=function(u,m,p){let g=m.match(/\[\^.*?\]/)[0];n.set(m,g);let b=s.has(g);if(b&&i.includes(m)){o.unshift(m);return}else if(b)throw new Error(A("logs.too-many-footnotes-error-message").replace("{FOOTNOTE_KEY}",g));let f;do f=u.lastIndexOf(g,p),f!==-1&&((f+m.length>u.length||u.substring(f,f+m.length)!==m)&&a.push({key:g,position:f}),p=f-1);while(f>0);s.add(g)};for(let u of t){let m=e.substring(u.start.offset,u.end.offset);i.unshift(m),l(e,m,u.start.offset)}let c=1,d=new Set;for(let u of i){if(d.has(u))continue;d.add(u);let m=n.get(u),p=`[^${c++}]`;r.set(m,p)}a.sort((u,m)=>m.position-u.position);for(let u of a){let m=r.get(u.key);e=pu(e,u.key,m,u.position)}for(let u of d){let m=n.get(u),p=r.get(m);e=e.replace(u,u.replace(m,p))}for(let u of o){let m=e.replace(`
2024-01-10 16:42:54 +08:00
${u}
`,`
2024-09-05 22:23:37 +08:00
`);e===m&&(m=e.replace(u,"")),e=m}return e}function Ss(e,t,i){let n=ye(i,e);if(n.length===0)return e;let r="";if(t==="underscore")r="_";else if(t==="asterisk")r="*";else{let a=n[n.length-1];r=e.substring(a.start.offset,a.start.offset+1)}i==="strong"&&(r+=r);for(let a of n){let s=r+e.substring(a.start.offset+r.length,a.end.offset-r.length)+r;e=le(e,a.start.offset,a.end.offset,s)}return e}function Xu(e,t){let i=ye("paragraph",e);if(i.length===0)return e;for(let n of i){let r=e.substring(n.start.offset,n.end.offset).split(`
`),a=r.length-1;if(!(a<1)){for(let s=0;s<a;s++){let o=r[s];Tb(o,t)||(r[s]=Eb(o,t))}e=le(e,n.start.offset,n.end.offset,r.join(`
`))}}return e}function Tb(e,t){return!!(e.endsWith("<br>")&&t=="<br>"||e.endsWith("<br/>")&&t=="<br/>"||e.endsWith(" ")&&t==" "||!e.endsWith("\\\\")&&e.endsWith("\\")&&t=="\\")}function Eb(e,t){e=e.trimEnd();let i=0;return e.endsWith("<br>")&&(i=4),e.endsWith("<br/>")&&(i=5),!e.endsWith("\\\\")&&e.endsWith("\\")&&(i=1),i&&(e=e.substring(0,e.length-i)),e.trimEnd()+t}function ep(e){let t=e.endsWith(`
`),i=ye("paragraph",e);if(i.length===0)return e;for(let n of i){let r=n.start.offset;for(r>0&&r--;r>=0&&e.charAt(r)!=`
2023-11-09 17:30:33 +08:00
`;)r--;r++;let a=e.substring(r,n.end.offset).split(`
2024-09-05 22:23:37 +08:00
`),s=a[0].trimStart();if(s.startsWith(">")||s.match(Ts)||s.match(Es))continue;let o=a.length,l=[],c=!1;for(let g=0;g<o;g++){let b=a[g];if(c){let f=l.length-1;l[f]+=`
`+b}else l.push(b);c=b.endsWith("<br>")||b.endsWith("<br/>")||b.endsWith(" ")||!b.endsWith("\\\\")&&b.endsWith("\\")}for(;r>0&&e.charAt(r-1)==`
2023-12-10 12:54:30 +08:00
`;)r--;let d=e.length,u=n.end.offset;for(u<d&&u++;u<d&&e.charAt(u)==`
2024-09-05 22:23:37 +08:00
`;)u++;let m=`
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`;r==0&&(m="");let p=`
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`;u==d&&(p=""),e=le(e,r,u,m+l.join(`
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`)+p)}return t&&!e.endsWith(`
2023-11-09 17:30:33 +08:00
`)&&(e+=`
2024-09-05 22:23:37 +08:00
`),e}function ip(e){let t=ye("link",e);for(let i of t){if(i==null)continue;let n=e.substring(i.start.offset,i.end.offset);if(!n.match(yr))continue;let r=n.indexOf("]"),a=n.substring(0,1)+n.substring(1,r).trim()+n.substring(r);e=le(e,i.start.offset,i.end.offset,a)}return e}function tp(e,t){let i=ye("emphasis",e);for(let n of i){let r=e.substring(n.start.offset+1,n.end.offset-1);r=t(r),e=le(e,n.start.offset+1,n.end.offset-1,r)}return e}function np(e,t){let i=ye("strong",e);for(let n of i){let r=e.substring(n.start.offset+2,n.end.offset-2);r=t(r),e=le(e,n.start.offset+2,n.end.offset-2,r)}return e}function Ls(e,t){let i=Lb(e);for(let n of i){let r=n.start.offset;for(;r>0&&e.charAt(r-1).trim()==="";)r--;(r===0||e.charAt(r-1).trim()!="")&&r++;let a=e.substring(r,n.end.offset);yp.test(a)&&(r+=4,a=a.substring(4)),a=t(a),e=le(e,r,n.end.offset,a)}return e}function rp(e){let t=ye("code",e);for(let i of t){let n=e.substring(i.start.offset,i.end.offset);!n.startsWith("```")&&!n.startsWith("~~~")||(e=St(e,i.start.offset,i.end.offset))}return e}function ap(e,t){let i=ye("math",e);for(let n of i)e=St(e,n.start.offset,n.end.offset);i=ye("inlineMath",e);for(let n of i)e.substring(n.start.offset,n.end.offset).startsWith("$".repeat(t))&&(e=St(e,n.start.offset,n.end.offset));return e}function sp(e){let t=ye("blockquote",e);for(let i of t){let n=i.end.offset;for(;n<e.length-1&&e.charAt(n)!==`
`;)n++;e=St(e,i.start.offset,n,!0)}return e}function op(e,t,i){let n=ye("list",e);if(!n)return e;for(let r of n){let a=r.start.offset;for(;a>0&&e.charAt(a-1)!==`
`;)a--;let s=e.substring(a,r.end.offset),o=function(u){let m=u.lastIndexOf("> ");return m!==-1&&(u=u.substring(m+2)),u=u.replaceAll(" "," "),Math.floor((u.split(" ").length-1)/2)+1},l=new Map,c=function(u,m){let p=m;for(;p>u;)l.delete(p--)},d=-1;s=s.replace(/^(( |\t|> )*)((\d+(\.|\)))|[-*+])([^\n]*)$/gm,(u,m="",p,g,b,f,x)=>{let k=1,L=o(m);if(!/^\d/.test(g)){let E=L>d?L:d;return c(L,E),u}return l.has(L)?t==="ascending"&&(k=l.get(L)+1,l.set(L,k)):l.set(L,1),d>L&&c(L,d),d=L,`${m}${k}${i}${x}`}),e=le(e,a,r.end.offset,s)}return e}function lp(e,t){let i=ye("listItem",e);if(!i)return e;let n=/^((\d+[.)])|(- \[[ x]\]))/m,r=t;if(t=="consistent"){let a=i.length-1;for(;a>=0;){let s=e.substring(i[a].start.offset,i[a].end.offset);if(a--,!s.match(n)){r=s.charAt(0);break}}if(a==-1)return e}for(let a of i){let s=e.substring(a.start.offset,a.end.offset);s.match(n)||(s=r+s.substring(1),e=le(e,a.start.offset,a.end.offset,s))}return e}function Pl(e,t){let i=ye("blockquote",e);for(let n of i){let r=n.end.offset;for(;r<e.length-1&&e.charAt(r)!==`
`;)r++;let a=e.substring(n.start.offset,r);a=t(a),e=le(e,n.start.offset,r,a)}return e}function cp(e,t){let i=ye("math",e),n=new RegExp("^(\\${"+t+",})(\\n*)"),r=new RegExp("(\\n*)(\\${"+t+",})([^\\$]*)$");for(let a of i){let s=e.substring(a.start.offset,a.end.offset),o=Cb(s,t,a.start.offset);for(let l of o)e=$u(e,l.startIndex,l.endIndex,n,r)}i=ye("inlineMath",e);for(let a of i)e.substring(a.start.offset,a.end.offset).startsWith("$".repeat(t))&&(e=$u(e,a.start.offset,a.end.offset,n,r));return e}function Cb(e,t,i){let n="$".repeat(t),r=t;for(;e.charAt(r)==="$";)n+="$",r++;let a=[],s=Xi(e,n);if(s<=1)return[];if(s===2)return a.unshift({startIndex:i,endIndex:i+e.length}),a;s===3&&a.unshift({startIndex:i,endIndex:i+e.indexOf(n,n.length)+n.length}),s%2===1&&s--;let o=i,l=n.length;for(;s>2;){let c=e.indexOf(n,l)+n.length;a.unshift({startIndex:o,endIndex:i+c}),o=i+c+1,l=c+1,s-=2}return a.unshift({startIndex:i+e.indexOf(n,l),endIndex:i+e.length}),a}function $u(e,t,i,n,r){let a=e.substring(rr(e,t),t)??"",[s]=xn(a,a.length),o=e.substring(rr(e,i),i)??"",l=e.substring(t,i),c=pp.test(a.trim()),d=!1;for(l=l.replace(n,(u,m,p="")=>{let g="";return!c&&a.trim()!=""?(g+=`
`,d=!0):c&&!jl.test(a)&&(g+=`
`+s,d=!0),g+=m+`
`,p===""&&c&&(g+=s),g}),l=l.replace(r,(u,m="",p,g)=>{let b=m==="";return b&&c&&jl.test(o.trim())?u:b&&c?`
`+s+p+g:`
`+p+g});d&&t>0;){let u=e[t-1];if(u!==" "&&u!==" ")break;t--}return le(e,t,i,l)}function wn(e){let t=[...e.matchAll(mp)],i=[];for(let n of t){let r=rr(e,n.index);if(r===0)continue;let a=rr(e,r-1),s=n[0],o=e.substring(r,n.index+s.length);if(Ob(o,s))continue;let l=a,c=e.substring(a,r-1);if(!s.includes("|")&&!c.includes("|"))continue;c=c.replace(Yl,g=>{let b=g.trim();return b===""||b==="|"||(l+=g.length-1),""});let d=s.replace(Yl,"");if(c.endsWith("|")&&(c=c.slice(0,-1)),d.endsWith("|")&&(d=d.slice(0,-1)),Gu(c)!==Gu(d))continue;let u=n.index+n[0].length;if(u>=e.length-1){i.push({startIndex:l,endIndex:e.length});continue}let m=e.substring(u+1).split(`
`),p=0;for(;p<m.length&&gp.test(m[p]);)u+=m[p].length+1,p++;i.push({startIndex:l,endIndex:u})}return i.reverse()}function Ob(e,t){if(e.trim()===""||t.includes("||"))return!0;let i=e.replace(t,"");return/[^\s>]/.test(i)}function Gu(e){let t=!1,i=0,n=0,r="";for(let a=0;a<e.length;a++)r=e[a],r==="\\"?(i++,t=i%2==1):(i=0,r==="|"&&!t&&n++,t=!1);return n}function dp(e){let t=0,i=[],n=[...e.matchAll(hp)];if(!n||n.length===0)return i;let r=[...e.matchAll(fp)];return n.forEach(a=>{t=a.index;let s=!1,o=e.length-1;for(;r&&r.length!==0&&!s;)if(r[0].index<=t)r.shift();else{s=!0;let l=r[0];o=l.index+l[0].length}i.push({startIndex:t,endIndex:o}),!r||r.length}),i.reverse()}function up(e,t){let i=ye("code",e);for(let n of i){let r=e.substring(n.start.offset,n.end.offset);!r.startsWith("```")||r.substring(3,r.indexOf(`
`)).trim()!==""||(e=le(e,n.start.offset+3,n.start.offset+3,t))}return e}var rt=/^([ \t]*)(#+)([ \t]+)([^\n\r]*?)([ \t]+#+)?$/gm,bp=`^XXX\\.*?
2023-11-09 17:30:33 +08:00
(?:((?:.|
)*?)
2024-09-05 22:23:37 +08:00
)?XXX(?=\\s|$)$`,Ge=/^---\n((?:(((?!---)(?:.|\n)*?)\n)?))---(?=\n|$)/,Mb=bp.replaceAll("X","`"),qb=bp.replaceAll("X","~"),Ib=`^(( |( {4})).*
)+`,ZT=new RegExp(`${Mb}|${qb}|${Ib}`,"gm"),Cs=/(!?)\[{2}([^\][\n|]+)(\|([^\][\n|]+))?(\|([^\][\n|]+))?\]{2}/g,yr=/(!?)\[([^[]*)\](\(.*\))/g,br=/(\s|^)(#[\p{L}\-_\d/\p{Emoji_Presentation}]+)/gu,vp=/^%%\n[^%]*\n%%/gm,vr=/[,\s]+/,Os=/(\. ?){2}\./g,xr="\\s*(>\\s*)*",jl=/^(>( |\t)*)+\$*?$/m,pp=/^\s*(>\s*)+/m,mp=/(\|? *:?-{1,}:? *\|?)(\| *:?-{1,}:? *\|?)*( |\t)*$/gm,Yl=/^(((>[ ]?)*)|([ ]{0,3}))\|/m,gp=/[^\n]*?\|[^\n]*?(\n|$)/m,xp=/(([a-z\-0-9]+:)\/{2,3})([^\s/?#]*[^\s")'.?!/]|[/])?(([/?#][^\s")']*[^\s")'.?!])|[/])?/gi,Ct=/(?:(?:(?:[a-z]+:)?\/\/)|www\.)(?:localhost|(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?|(?:(?:[a-z0-9][-_]*)*[a-z0-9]+)(?:\.(?:[a-z0-9]-*)*[a-z0-9]+)*(?:\.(?:[a-z]{2,})))(?::\d{2,5})?(?:(?:[/?#][a-z0-9-_%/&=?$.+~!*(,#@]*[a-z0-9-%_/$+~!*(,])|[/])?/gi,JT=new RegExp("^"+Ct.source+"$","si"),wp=/<a[\s]+([^>]+)>((?:.(?!<\/a>))*.)<\/a>/g,kp=/[\p{L}\p{N}\p{Pc}\p{M}\-'`]+/gu,zp=/&[^\s]+;$/mi,hp=Mp(!0),fp=Mp(!1),Ap=/[“”„«»]/g,Sp=/[]/g,Lp=/<%[^]*?%>/g,Ot="\\[.\\]",yp=new RegExp(`^${Ot}`),Tp=new RegExp(`^${xr}- ${Ot} `),Ms=new RegExp(`^\\s*- ${Ot} `),Ts=new RegExp(`^\\s*(-|\\*|\\+|\\d+[.)]|- (${Ot}))`,"m"),Es=/^(\[\^[^\]]*\]) ?([,.;!:?])/gm,us=/^(>\s*)+\[![^\s]*\]/m,tr=/^\n?(>\s*)+((```)|(~~~))/m,Hl=RegExp(/\p{L}/,"u");function Qe(e){return e.replace(/\$/g,"$$$$")}function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ep(e){let t=e.match(Cs);if(t){for(let i of t)if(i.includes("|")){let n=i.indexOf("|"),r=i.substring(0,n+1)+i.substring(n+1,i.length-2).trim()+"]]";e=e.replace(i,r)}}return e}function Cp(e){let t=wn(e);if(t.length===0)return e;for(let i of t)e=St(e,i.startIndex,i.endIndex);return e}function qs(e){let t=e.match(/^#\s+(.*)/m);if(t&&t[1]){let i=t[1];return i=i.replaceAll(Cs,(n,r,a,s)=>s!=null?s.replace("|",""):a),i.replaceAll(yr,"$2")}return""}function Op(e){return[...e.matchAll(br)].map(t=>t[2])}function Mp(e){let t="(?:<!-{2,}|%%) *linter-{ENDING_TEXT} *(?:-{2,}>|%%)",i="";return e?i+="disable":i+="enable",new RegExp(t.replace("{ENDING_TEXT}",i),"g")}var Ul="tag",wr="tags",yi=[Ul,wr],Bb="alias",Wl="aliases",bi=[Bb,Wl],Vl="linter-yaml-title-alias",Sn="disabled rules";function Ci(e){return e.match(Ge)===null&&(e=`---
2023-11-09 17:30:33 +08:00
---
2024-09-05 22:23:37 +08:00
`+e),e}function Ln(e){let t=e.match(Ge);return t?t[1]:null}function he(e,t){if(!e.match(Ge))return e;let i=e.match(Ge)[0],n=t(i);return e=e.replace(i,Qe(n)),e}function $l(e,t=!0){return t?new RegExp(`^([\\t ]*)${e}:[ \\t]*(\\S.*|(?:(?:\\n *- \\S.*)|((?:\\n *- *))*|(\\n([ \\t]+[^\\n]*))*)*)\\n`,"m"):new RegExp(`^${e}:[ \\t]*(\\S.*|(?:(?:\\n *- \\S.*)|((?:\\n *- *))*|(\\n([ \\t]+[^\\n]*))*)*)\\n`,"m")}function ae(e,t,i){let n=`${t}:${i}
`,r=!1,a=e.replace($l(t),(s,o)=>(r=!0,o+n));return r||(a=`${e}${n}`),a}function de(e,t,i=!0){let n=e.match($l(t,i));if(n==null)return null;let r=n[2];return i||(r=n[1]),r}function Mt(e,t,i=!0){return e.replace($l(t,i),"")}function ri(e){if(e==null)return null;let t=Xo(e.replace(/\n(\t)+/g,`
`));return t??{}}function be(e,t,i,n,r=!1){if(typeof e=="string"&&(e=[e]),e==null||e.length===0)return Fb(t);let a=n&&(t=="multi-line"||t=="single string to multi-line"&&e.length>1);if(r||a)for(let s=0;s<e.length;s++){let o=e[s],l=Tn(o);l&&(o=o.substring(1,o.length-1));let c=r&&cs(o);l&&c||(c||l&&a)&&(e[s]=vi(o,i,c))}switch(t){case"single string to single-line":if(e.length===1)return" "+e[0];case"single-line":return" "+qp(e);case"single string to multi-line":if(e.length===1)return" "+e[0];case"multi-line":return Rb(e);case"single string space delimited":return e.length===1?" "+e[0]:" "+e.join(" ");case"single string comma delimited":return e.length===1?" "+e[0]:" "+e.join(", ");case"single-line space delimited":return e.length===1?" "+e[0]:" "+qp(e).replaceAll(", "," ")}}function Fb(e){switch(e){case"single-line":case"single-line space delimited":case"multi-line":return" []";case"single string to single-line":case"single string to multi-line":case"single string space delimited":case"single string comma delimited":return" "}}function qp(e){return e==null||e.length===0?"[]":"["+e.join(", ")+"]"}function Rb(e){return e==null||e.length===0?"[]":`
2023-11-09 17:30:33 +08:00
- `+e.join(`
2024-09-05 22:23:37 +08:00
- `)}function qe(e){if(e==null||e.length===0)return null;if(e=e.trimEnd(),e.startsWith("["))return e=e.substring(1),e.endsWith("]")&&(e=e.substring(0,e.length-1)),e.length===0?null:Is(e,",").filter(i=>i!="");if(e.includes(`
`)){let t=e.split(/[ \t]*\n[ \t]*-[ \t]*/);return t.splice(0,1),t=t.filter(i=>i!=""),t==null||t.length===0?null:t}return e}function st(e){if(e==null)return[];let t=[],i=[];Array.isArray(e)?i=e:e.includes(",")?i=Is(e,","):i=Is(e," ");for(let n of i)t.push(n.trim());return t}function ot(e){return typeof e=="string"?Is(e,","):e}function Is(e,t=","){if(e==""||e==null)return null;if(t.length>1)throw new Error(A("logs.invalid-delimiter-error-message"));let i=[],n="",r=0;for(;r<e.length;){let a=e.charAt(r);if(a===t)i.push(n.trim()),n="";else if(a==='"'||a==="'"){let s=e.indexOf(a,r+1);s!=-1?(n+=e.substring(r,s+1),r=s):n+=a}else n+=a;r++}return n.trim()!=""&&i.push(n.trim()),i}function Tn(e){return e.length>1&&(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))}function vi(e,t,i=!1,n=!1){let r=Db(e,t,i);if(n)return r;try{if(Xo(r)===e)return r}catch{}let a=el(e,{lineWidth:-1,quotingType:t,forceQuotes:i}).slice(0,-1),s=el(e,{lineWidth:-1,quotingType:t=='"'?"'":'"',forceQuotes:i}).slice(0,-1);return s===e||s.length<a.length?s:a}function Db(e,t,i=!1){if(Tn(e))return e;let n=e.includes("'"),r=e.includes('"'),a=e.includes(": ");return!n&&!r&&!a&&!i||n&&r?e:n?`"${e}"`:r?`'${e}'`:`${t}${e}${t}`}function Ip(e){let t=de(e,Sn);if(t==null)return[];let i=t.includes(`
2024-06-12 15:46:38 +08:00
`)?`${Sn}:
2024-09-05 22:23:37 +08:00
`:`${Sn}: `;i+=t;let r=ri(i)["disabled rules"];return r?(typeof r=="string"&&(r=[r]),r):[]}var Fn=require("obsidian");var Bp=require("obsidian");function Oi(e,t,i){Bp.MarkdownRenderer.renderMarkdown(e,t,"",i);let n=t.innerHTML.trim();n.startsWith("<p>")&&(n=n.substring(3)),n.endsWith("</p>")&&(n=n.substring(0,n.length-4)),t.innerHTML=n}function ci(e){e.addClass("linter-visually-hidden")}function Mi(e){e.removeClass("linter-visually-hidden")}var In=require("obsidian");var Fp=require("obsidian");var di=class{constructor(t,i,n,r,a,s,o,l){this.containerEl=t;this.parentComponent=i;this.name=n;this.description=r;this.warning=a;this.addInputBtnText=s;this.saveSettings=o;this.onAddInput=l}display(){this.containerEl.createDiv({cls:"setting-item-name",text:this.name});let t=this.containerEl.createDiv({cls:"setting-item-description"});Oi(this.description,t.createEl("p",{cls:"custom-row-description"}),this.parentComponent),this.warning!=null&&this.warning.trim()!=""&&t.createEl("p",{text:this.warning,cls:"mod-warning"}),new Fp.Setting(this.containerEl).addButton(i=>{i.setButtonText(this.addInputBtnText).setCta().onClick(()=>this.onAddInput())}),this.inputElDiv=this.containerEl.createDiv(),this.showInputEls()}resetInputEls(){this.inputElDiv.empty(),this.showInputEls()}};var nm=require("obsidian");var fe="top",Le="bottom",Ae="right",ve="left",Bs="auto",lt=[fe,Le,Ae,ve],Pi="start",qt="end",Rp="clippingParents",Fs="viewport",En="popper",Dp="reference",Gl=lt.reduce(function(e,t){return e.concat([t+"-"+Pi,t+"-"+qt])},[]),Rs=[].concat(lt,[Bs]).reduce(function(e,t){return e.concat([t,t+"-"+Pi,t+"-"+qt])},[]),Kb="beforeRead",_b="read",Nb="afterRead",jb="beforeMain",Yb="main",Pb="afterMain",Hb="beforeWrite",Ub="write",Wb="afterWrite",Kp=[Kb,_b,Nb,jb,Yb,Pb,Hb,Ub,Wb];function Ie(e){return e?(e.nodeName||"").toLowerCase():null}function ue(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ui(e){var t=ue(e).Element;return e instanceof t||e instanceof Element}function Te(e){var t=ue(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Cn(e){if(typeof ShadowRoot>"u")return!1;var t=ue(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Vb(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var n=t.styles[i]||{},r=t.attributes[i]||{},a=t.elements[i];!Te(a)||!Ie(a)||(Object.assign(a.style,n),Object.keys(r).forEach(function(s){var o=r[s];o===!1?a.removeAttribute(s):a.setAttribute(s,o===!0?"":o)}))})}function $b(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(n){var r=t.elements[n],a=t.attributes[n]||{},s=Object.keys(t.styles.hasOwnProperty(n)?t.styles[n]:i[n]),o=s.reduce(function(l,c){return l[c]="",l},{});!Te(r)||!Ie(r)||(Object.assign(r.style,o),Object.keys(a).forEach(function(l){r.removeAttribute(l)}))})}}var _p={name:"applyStyles",enabled:!0,phase:"write",fn:Vb,effect:$b,requires:["computeStyles"]};function Be(e){return e.split("-")[0]}var xi=Math.max,It=Math.min,Hi=Math.round;function On(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function kr(){return!/^((?!chrome|android).)*safari/i.test(On())}function pi(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var n=e.getBoundingClientRect(),r=1,a=1;t&&Te(e)&&(r=e.offsetWidth>0&&Hi(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Hi(n.height)/e.offsetHeight||1);var s=ui(e)?ue(e):window,o=s.visualViewport,l=!kr()&&i,c=(n.left+(l&&o?o.offsetLeft:0))/r,d=(n.top+(l&&o?o.offsetTop:0))/a,u=n.width/r,m=n.height/a;return{width:u,height:m,top:d,right:c+u,bottom:d+m,left:c,x:c,y:d}}function Bt(e){var t=pi(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t
---`)},wikiLink:{replaceAction:Cs,placeholder:"{WIKI_LINK_PLACEHOLDER}"},obsidianMultiLineComments:{replaceAction:vp,placeholder:"{OBSIDIAN_COMMENT_PLACEHOLDER}"},footnoteAtStartOfLine:{replaceAction:Es,placeholder:"{FOOTNOTE_AT_START_OF_LINE_PLACEHOLDER}"},footnoteAfterATask:{replaceAction:/- \[.] (\[\^\w+\]) ?([,.;!:?])/gm,placeholder:"{FOOTNOTE_AFTER_A_TASK_PLACEHOLDER}"},url:{replaceAction:Ct,placeholder:"{URL_PLACEHOLDER}"},anchorTag:{replaceAction:wp,placeholder:"{ANCHOR_PLACEHOLDER}"},templaterCommand:{replaceAction:Lp,placeholder:"{TEMPLATER_PLACEHOLDER}"},link:{replaceAction:xv,placeholder:"{REGULAR_LINK_PLACEHOLDER}"},tag:{replaceAction:wv,placeholder:"#tag-placeholder"},table:{replaceAction:kv,placeholder:"{TABLE_PLACEHOLDER}"},customIgnore:{replaceAction:zv,placeholder:"{CUSTOM_IGNORE_PLACEHOLDER}"}};function Ee(e,t,i){let n=[];for(let r of e){let a;if(typeof r.replaceAction=="string")a=bv(t,r.placeholder,r.replaceAction);else if(r.replaceAction instanceof RegExp)a=vv(t,r.placeholder,r.replaceAction);else if(typeof r.replaceAction=="function"){let s=r.replaceAction;a=s(t,r.placeholder)}t=a.newText,n.push({replacedValues:a.replacedValues,placeholder:r.placeholder})}return t=i(t),n=n.reverse(),n!=null&&n.length>0&&n.forEach(r=>{r.replacedValues.forEach(a=>{t=t.replace(new RegExp(r.placeholder,"i"),Qe(a))})}),t}function bv(e,t,i){let n=ye(i,e),r=[];for(let a of n){let s=e.substring(a.start.offset,a.end.offset);r.push(s),e=le(e,a.start.offset,a.end.offset,t)}return r.reverse(),{newText:e,replacedValues:r}}function vv(e,t,i){let n=e.match(i),r=[];if(i.flags.includes("g")){if(e=e.replaceAll(i,t),n)for(let a of n)r.push(a)}else e=e.replace(i,t),n&&r.push(n[0]);return{newText:e,replacedValues:r}}function xv(e,t){let i=ye("link",e),n=[];for(let r of i){if(r==null)continue;let a=e.substring(r.start.offset,r.end.offset);a.match(yr)&&(n.push(a),e=le(e,r.start.offset,r.end.offset,t))}return n.reverse(),{newText:e,replacedValues:n}}function wv(e,t){let i=[];return e=e.replace(br,(n,r,a)=>(i.push(a),r+t)),{newText:e,replacedValues:i}}function kv(e,t){let i=wn(e),n=new Array(i.length),r=0,a=n.length;for(let s of i)n[a-1-r++]=e.substring(s.startIndex,s.endIndex),e=le(e,s.startIndex,s.endIndex,t);return{newText:e,replacedValues:n}}function zv(e,t){let i=dp(e),n=new Array(i.length),r=0,a=n.length;for(let s of i)n[a-1-r++]=e.substring(s.startIndex,s.endIndex),e=le(e,s.startIndex,s.endIndex,t);return{newText:e,replacedValues:n}}var R=(s=>(s.YAML="YAML",s.HEADING="Heading",s.FOOTNOTE="Footnote",s.CONTENT="Content",s.SPACING="Spacing",s.PASTE="Paste",s))(R||{}),Vs=class{constructor(t,i,n,r,a,s,o=[],l=!1,c=[]){this.nameKey=t;this.descriptionKey=i;this.settingsKey=n;this.alias=r;this.type=a;this.applyAfterIgnore=s;this.options=o;this.hasSpecialExecutionOrder=l;this.ignoreTypes=c;this.ruleHeading=this.getName().toLowerCase().replaceAll(" ","-"),o.unshift(new Bn("enabled",this.descriptionKey,"",!1));for(let d of o)d.ruleAlias=r}getDefaultOptions(){let t={};for(let i of this.options)t[i.configKey]=i.defaultValue;return t}getOptions(t){return t.ruleConfigs[this.settingsKey]}getName(){return A(this.nameKey)}getDescription(){return A(this.descriptionKey)}getURL(){return"https://platers.github.io/obsidian-linter/settings/"+this.type.toLowerCase()+"-rules/#"+this.ruleHeading}enabledOptionName(){return this.options[0].configKey}apply(t,i){return Ee(this.ignoreTypes,t,n=>this.applyAfterIgnore(n,i))}};var om=Object.values(R);function $s(e){let t=Ln(e);if(t===null)return[[],!1];let i=Ip(t);return i.includes("all")?[qi.map(n=>n.alias),!0]:[i,!1]}var qi=[],Av={},Nt=new Map;function lm(e){qi.push(e),qi.sort((t,i)=>om.indexOf(t.type)-om.indexOf(i.type)||t.settingsKey.localeCompare(i.settingsKey)),Av[e.alias]=e,Nt.has(e.type)?Nt.get(e.type).push(e):Nt.set(e.type,[e])}function Gs(e,t){let i;throw e instanceof Md?(i=e.toString(),i=A("logs.wrapper-yaml-error").replace("{ERROR_MESSAGE}",i.substring(i.indexOf(":")+1))):i=A("logs.wrapper-unknown-error").replace("{ERROR_MESSAGE}",e.message),new Rn(`"${t}" encountered an ${i}`,e)}var vt=gn(cm());function Sv
2023-11-09 17:30:33 +08:00
[ ]{`+Math.min.apply(Math,r)+"}","g");n=n.map(function(o){return o.replace(a,`
2023-12-10 12:54:30 +08:00
`)})}n[0]=n[0].replace(/^\r?\n/,"");var s=n[0];return t.forEach(function(o,l){var c=s.match(/(?:^|\n)( *)$/),d=c?c[1]:"",u=o;typeof o=="string"&&o.includes(`
2023-11-09 17:30:33 +08:00
`)&&(u=String(o).split(`
2024-09-05 22:23:37 +08:00
`).map(function(m,p){return p===0?m:""+d+m}).join(`
`)),s+=u+n[l+1]}),s}var dm=Sv;var Ro=require("obsidian");var Kn,Or,pt,Je=class Je{static getRule(){if(!_(Je,Kn).has(this.name)){let t=new this,i=new Vs(t.nameKey,t.descriptionKey,t.settingsKey,t.alias,t.type,t.safeApply.bind(t),t.optionBuilders.map(n=>n.option),t.hasSpecialExecutionOrder,t.ignoreTypes);_(Je,Kn).set(this.name,i),_(Je,Or).set(t.alias,t)}return _(Je,Kn).get(this.name)}static applyIfEnabledBase(t,i,n,r){let a=t.getOptions(n);if(a[t.enabledOptionName()]){zt(t.alias);let s=Object.assign({},a,r);ii(`${A("logs.run-rule-text")} ${t.getName()}`);try{let o=t.apply(i,s);return Ji(t.alias),ii(o),[o,!0]}catch(o){Ji(t.alias),Gs(o,t.getName())}}else return[i,!1]}static getBuilderByName(t){return _(Je,Or).get(t)}static setNoSettingControl(t,i){_(Je,pt).has(t)||_(Je,pt).set(t,[]),_(Je,pt).get(t).push(i)}static hasSettingControl(t,i){return!_(Je,pt).has(t)||!_(Je,pt).get(t).includes(i)}};Kn=new WeakMap,Or=new WeakMap,pt=new WeakMap,ke(Je,Kn,new Map),ke(Je,Or,new Map),ke(Je,pt,new Map);var mt=Je,y=class extends mt{constructor(t){super(),this.alias=t.nameKey.replace(/rules\.(.*)\.name/,"$1"),this.settingsKey=t.nameKey.replace(/rules\.(.*)\.name/,"$1"),this.nameKey=t.nameKey,this.descriptionKey=t.descriptionKey,this.type=t.type,this.hasSpecialExecutionOrder=t.hasSpecialExecutionOrder??!1,t.ruleIgnoreTypes?this.ignoreTypes=[h.customIgnore,...t.ruleIgnoreTypes]:this.ignoreTypes=[h.customIgnore]}static register(t){let i=t.getRule();lm(i)}safeApply(t,i){return this.apply(t,this.buildRuleOptions(i))}buildRuleOptions(t){t=t??{};let i=new this.OptionsClass,n=Object.assign(i,t);for(let r of this.optionBuilders)r.setRuleOption(n,t);return n}static applyIfEnabled(t,i,n,r){let a=this.getRule();return n.includes(a.alias)?(ii(a.alias+" "+A("logs.disabled-text")),[t,!1]):mt.applyIfEnabledBase(a,t,i,r)}static getRuleOptions(t){let i=mt.getRule.bind(this)(),n=new this,r=i.getOptions(t);return n.buildRuleOptions(r)}static noSettingControl(){return(t,i)=>{let n=t.constructor.name;mt.setNoSettingControl(n,i)}}};var _n,Wi=class{constructor(t){ke(this,_n,void 0);this.OptionsClass=t.OptionsClass;let i=t.nameKey.split(".");i.length==1?this.configKey=i[0]:this.configKey=i[i.length-2],this.nameKey=t.nameKey,this.descriptionKey=t.descriptionKey,this.optionsKey=t.optionsKey}get defaultValue(){return new this.OptionsClass()[this.optionsKey]}get option(){return _(this,_n)||Me(this,_n,this.buildOption()),_(this,_n)}setRuleOption(t,i){let n=i[this.configKey];n!==void 0&&(t[this.optionsKey]=n)}};_n=new WeakMap;var H=class extends Wi{buildOption(){return new Bn(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},Qs=class extends Wi{buildOption(){return new Cr(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},ee=class extends Wi{constructor(t){super(t),this.records=t.records.map(i=>new Hs("enums."+i.value,i.description))}buildOption(){return new Us(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue,this.records)}},pe=class extends Wi{constructor(t){super(t),this.separator=t.separator??`
`,this.splitter=t.splitter??/\n/}buildOption(){return new Ys(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue.join(this.separator))}setRuleOption(t,i){if(i[this.configKey]!==void 0){let n=i[this.configKey].split(this.splitter).filter(function(r){return r!=""});t[this.optionsKey]=n}}},xe=class extends Wi{buildOption(){return new Cr(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},Zs=class extends Wi{buildOption(){return new Ps(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},Js=class extends Wi{buildOption(){return new Ws(this.configKey,this.nameKey,this.descriptionKey)}};var dc=class{},Mr=class extends y{constructor(){super({nameKey:"rules.add-blank-line-after-yaml.name",descriptionKey:"rules.add-blank-line-after-yaml.description",type:"YAML"})}get OptionsClass(){return dc}apply(t,i){let n=t.match(Ge);if(n===null)return t;let r=n[0],a=t.indexOf(r)+r.length;return a+1>=t.length||t.trimEnd()===r.trimEnd()||t.charAt(a+1)===`
2023-12-10 12:54:30 +08:00
`?t:t.replace(r,r+`
2024-09-05 22:23:37 +08:00
`)}get optionBuilders(){return[]}};Mr=z([y.register],Mr);var uc=new Map([["1nd","1st"],["2rd","2nd"],["2st","2nd"],["3nd","3rd"],["3st","3rd"],["4rd","4th"],["a-diaerers","a-diaereses"],["aaccess","access"],["aaccessibility","accessibility"],["aaccession","accession"],["aack","ack"],["aactual","actual"],["aactually","actually"],["aadd","add"],["aagain","again"],["aaggregation","aggregation"],["aanother","another"],["aapply","apply"],["aaproximate","approximate"],["aaproximated","approximated"],["aaproximately","approximately"],["aaproximates","approximates"],["aaproximating","approximating"],["aare","are"],["aassign","assign"],["aassignment","assignment"],["aassignments","assignments"],["aassociated","associated"],["aassumed","assumed"],["aautomatic","automatic"],["aautomatically","automatically"],["abailable","available"],["abanden","abandon"],["abandonded","abandoned"],["abandone","abandon"],["abandonned","abandoned"],["abandonning","abandoning"],["abbbreviated","abbreviated"],["abberation","aberration"],["abberations","aberrations"],["abberivates","abbreviates"],["abberration","aberration"],["abborted","aborted"],["abborting","aborting"],["abbrevate","abbreviate"],["abbrevation","abbreviation"],["abbrevations","abbreviations"],["abbreviaton","abbreviation"],["abbreviatons","abbreviations"],["abbriviate","abbreviate"],["abbriviation","abbreviation"],["abbriviations","abbreviations"],["aberation","aberration"],["abigious","ambiguous"],["abiguity","ambiguity"],["abilityes","abilities"],["abilties","abilities"],["abilty","ability"],["abiss","abyss"],["abitrarily","arbitrarily"],["abitrary","arbitrary"],["abitrate","arbitrate"],["abitration","arbitration"],["abizmal","abysmal"],["abnoramlly","abnormally"],["abnormalty","abnormally"],["abnormaly","abnormally"],["abnornally","abnormally"],["abnove","above"],["abnrormal","abnormal"],["aboluste","absolute"],["abolustely","absolutely"],["abolute","absolute"],["abondon","abandon"],["abondoned","abandoned"],["abondoning","abandoning"],["abondons","abandons"],["aboout","about"],["aborigene","aborigine"],["abortificant","abortifacient"],["aboslute","absolute"],["aboslutely","absolutely"],["abosulte","absolute"],["abosultely","absolutely"],["abosulute","absolute"],["abosulutely","absolutely"],["abotu","about"],["abount","about"],["aboutit","about it"],["aboutthe","about the"],["abouve","above"],["abov","above"],["aboved","above"],["abovemtioned","abovementioned"],["aboves","above"],["abovmentioned","abovementioned"],["abreviate","abbreviate"],["abreviated","abbreviated"],["abreviates","abbreviates"],["abreviating","abbreviating"],["abreviation","abbreviation"],["abreviations","abbreviations"],["abritrarily","arbitrarily"],["abritrary","arbitrary"],["abriviate","abbreviate"],["absail","abseil"],["absailing","abseiling"],["absance","absence"],["abscence","absence"],["abscound","abscond"],["abselutely","absolutely"],["abselutly","absolutely"],["absense","absence"],["absodefly","absolute"],["absodeflyly","absolutely"],["absolate","absolute"],["absolately","absolutely"],["absolaute","absolute"],["absolautely","absolutely"],["absoleted","obsoleted"],["absoletely","absolutely"],["absoliute","absolute"],["absoliutely","absolutely"],["absoloute","absolute"],["absoloutely","absolutely"],["absolte","absolute"],["absoltely","absolutely"],["absoltue","absolute"],["absoltuely","absolutely"],["absoluate","absolute"],["absoluately","absolutely"],["absolue","absolute"],["absoluely","absolutely"],["absoluet","absolute"],["absoluetly","absolutely"],["absolule","absolute"],["absolulte","absolute"],["absolultely","absolutely"],["absolune","absolute"],["absolunely","absolutely"],["absolure","absolute"],["absolurely","absolutely"],["absolut","absolute"],["absolutelly","absolutely"],["absoluth","absolute"],["absoluthe","absolute"],["absoluthely","absolutely"],["absoluthly","absolutely"],["absolutley","absolutely"],["absolutly","absolutely"],["absolutlye","absolutely"],["absoluute","absolute"],["absoluutely","absolutely"],["absoluve","absolute"],["absoluvely","absolutely"],["absoolute","absolute"],["absool
`,n),r===-1&&(r=l.length-1,c=!0),[a,o]=xn(l,r-1);let d=o+a.length+1,u=r;c&&u++;let m=l.substring(d,u);if(m.includes(h.math.placeholder)||m.includes(h.code.placeholder)){n++;continue}let p=Ts.test(m);s=i(a,p),o++,l=le(l,o,o+a.length,s),n=r+1+s.length-a.length}while(!c);return l}get optionBuilders(){return[new ee({OptionsClass:Xs,nameKey:"rules.blockquote-style.style.name",descriptionKey:"rules.blockquote-style.style.description",optionsKey:"style",records:[{value:"space",description:"> indicator is followed by a space"},{value:"no space",description:">indicator is not followed by a space"}]})]}};jt=z([y.register],jt);var eo=class{};z([y.noSettingControl()],eo.prototype,"lineContent",2);var Yt=class extends y{constructor(){super({nameKey:"rules.add-blockquote-indentation-on-paste.name",descriptionKey:"rules.add-blockquote-indentation-on-paste.description",type:"Paste"})}get OptionsClass(){return eo}apply(t,i){let n=/^(\s*)((> ?)+) .*/,r=i.lineContent.match(n);if(!r)return t;let a=r[1]??"",s=r[2]??"";return t.trim().replace(/\n/gm,`
${a}${s} `)}get optionBuilders(){return[]}};Yt=z([y.register],Yt);var Pt=class{constructor(){this.style="Title Case";this.ignoreWords=["macOS","iOS","iPhone","iPad","JavaScript","TypeScript","AppleScript","I"];this.lowercaseWords=["a","an","the","aboard","about","abt.","above","abreast","absent","across","after","against","along","aloft","alongside","amid","amidst","mid","midst","among","amongst","anti","apropos","around","round","as","aslant","astride","at","atop","ontop","bar","barring","before","B4","behind","below","beneath","neath","beside","besides","between","'tween","beyond","but","by","chez","circa","c.","ca.","come","concerning","contra","counting","cum","despite","spite","down","during","effective","ere","except","excepting","excluding","failing","following","for","from","in","including","inside","into","less","like","minus","modulo","mod","near","nearer","nearest","next","notwithstanding","of","o'","off","offshore","on","onto","opposite","out","outside","over","o'er","pace","past","pending","per","plus","post","pre","pro","qua","re","regarding","respecting","sans","save","saving","short","since","sub","than","through","thru","throughout","thruout","till","times","to","t'","touching","toward","towards","under","underneath","unlike","until","unto","up","upon","versus","vs.","v.","via","vice","vis-\xE0-vis","wanting","with","w/","w.","c\u0304","within","w/i","without","'thout","w/o","abroad","adrift","aft","afterward","afterwards","ahead","apart","ashore","aside","away","back","backward","backwards","beforehand","downhill","downstage","downstairs","downstream","downward","downwards","downwind","east","eastward","eastwards","forth","forward","forwards","heavenward","heavenwards","hence","henceforth","here","hereby","herein","hereof","hereto","herewith","home","homeward","homewards","indoors","inward","inwards","leftward","leftwards","north","northeast","northward","northwards","northwest","now","onward","onwards","outdoors","outward","outwards","overboard","overhead","overland","overseas","rightward","rightwards","seaward","seawards","skywards","skyward","south","southeast","southwards","southward","southwest","then","thence","thenceforth","there","thereby","therein","thereof","thereto","therewith","together","underfoot","underground","uphill","upstage","upstairs","upstream","upward","upwards","upwind","west","westward","westwards","when","whence","where","whereby","wherein","whereto","wherewith","although","because","considering","given","granted","if","lest","once","provided","providing","seeing","so","supposing","though","unless","whenever","whereas","wherever","while","whilst","ago","according to","as regards","counter to","instead of","owing to","pertaining to","at the behest of","at the expense of","at the hands of","at risk of","at the risk of","at variance with","by dint of","by means of","by virtue of","by way of","for the sake of","for sake of","for lack of","for want of","from want of","in accordance with","in addition to","in case of","in charge of","in compliance with","in conformity with","in contact with","in exchange for","in favor of","in front of","in lieu of","in light of","in the light of","in line with","in place of","in point of","in quest of","in relation to","in regard to","with regard to","in respect to","with respect to","in return for","in search of","in step with","in touch with","in terms of","in the name of","in view of","on account of","on behalf of","on grounds of","on the grounds of","on the part of","on top of","with a view to","with the exception of","\xE0 la","a la","as soon as","as well as","close to","due to","far from","in case","other than","prior to","pursuant to","regardless of","subsequent to","as long as","as much as","as far as","by the time","in as much as","inasmuch","in order to","in order that","even","provide that","if only","whether","whose","whoever","why","how","or not","whatever","what","both","and","or","not only","but also","either","neither","nor","just","rather","no sooner","such","that","yet","is","it"];this.ignoreCasedWords=!0}},Ht=class extends y{const
2023-11-09 17:30:33 +08:00
`),n=n.replace(/\n+---/,`
---`),i.innerNewLines&&(n=n.replaceAll(/\n{2,}/g,`
2024-09-05 22:23:37 +08:00
`)),n))}get optionBuilders(){return[new H({OptionsClass:io,nameKey:"rules.compact-yaml.inner-new-lines.name",descriptionKey:"rules.compact-yaml.inner-new-lines.description",optionsKey:"innerNewLines"})]}};Br=z([y.register],Br);var pc=class{},Fr=class extends y{constructor(){super({nameKey:"rules.consecutive-blank-lines.name",descriptionKey:"rules.consecutive-blank-lines.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return pc}apply(t,i){return t.replace(/(\n([\t\v\f\r \u00a0\u2000-\u200b\u2028-\u2029\u3000]+)?){2,}\n/g,`
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`)}get optionBuilders(){return[]}};Fr=z([y.register],Fr);var mc=class{},Rr=class extends y{constructor(){super({nameKey:"rules.convert-bullet-list-markers.name",descriptionKey:"rules.convert-bullet-list-markers.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return mc}apply(t,i){return t.replace(/^([^\S\n]*)([•§])([^\S\n]*)/gm,"$1-$3")}get optionBuilders(){return[]}};Rr=z([y.register],Rr);var to=class{constructor(){this.tabsize=4}},Dr=class extends y{constructor(){super({nameKey:"rules.convert-spaces-to-tabs.name",descriptionKey:"rules.convert-spaces-to-tabs.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return to}apply(t,i){let n=String(i.tabsize),r=new RegExp("^( *) {"+n+"}","gm");t=this.replaceAllRegexMatches(t,r);let a=new RegExp("^((>( | *))*(>( | )) *) {"+n+"}","gm");return t=this.replaceAllRegexMatches(t,a),t}replaceAllRegexMatches(t,i){for(;t.match(i)!=null;)t=t.replace(i,"$1 ");return t}get optionBuilders(){return[new Qs({OptionsClass:to,nameKey:"rules.convert-spaces-to-tabs.tabsize.name",descriptionKey:"rules.convert-spaces-to-tabs.tabsize.description",optionsKey:"tabsize"})]}};Dr=z([y.register],Dr);var zi=class{constructor(){this.aliasArrayStyle="single-line";this.dedupeAliasKey=!0;this.tagArrayStyle="single-line";this.dedupeTagKey=!0;this.dedupeArrayKeys=!0;this.ignoreDedupeArrayKeys=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};z([y.noSettingControl()],zi.prototype,"aliasArrayStyle",2),z([y.noSettingControl()],zi.prototype,"tagArrayStyle",2),z([y.noSettingControl()],zi.prototype,"defaultEscapeCharacter",2),z([y.noSettingControl()],zi.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var Kr=class extends y{constructor(){super({nameKey:"rules.dedupe-yaml-array-values.name",descriptionKey:"rules.dedupe-yaml-array-values.description",type:"YAML"})}get OptionsClass(){return zi}apply(t,i){return he(t,n=>{let r=ri(n.replace(`---
2024-02-26 20:05:21 +08:00
`,"").replace(`
2024-09-05 22:23:37 +08:00
---`,""));if(!r)return n;for(let a of bi)if(i.dedupeAliasKey&&Object.keys(r).includes(a)){n=ae(n,a,be(ot(this.getUniqueArray(qe(de(n,a)))),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of yi)if(i.dedupeTagKey&&Object.keys(r).includes(a)){n=ae(n,a,be(st(this.getUniqueArray(qe(de(n,a)))),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.dedupeArrayKeys){let a=[...bi,...yi,...i.ignoreDedupeArrayKeys];for(let s of Object.keys(r)){if(a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null)continue;let o=de(n,s),l="single-line";o.includes(`
`)&&(l="multi-line");let c=this.getUniqueArray(qe(o));n=ae(n,s,be(c,l,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}}return n})}getUniqueArray(t){return t==null||typeof t=="string"||t.length<=1?t:[...new Set(t)]}get optionBuilders(){return[new H({OptionsClass:zi,nameKey:"rules.dedupe-yaml-array-values.dedupe-alias-key.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-alias-key.description",optionsKey:"dedupeAliasKey"}),new H({OptionsClass:zi,nameKey:"rules.dedupe-yaml-array-values.dedupe-tag-key.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-tag-key.description",optionsKey:"dedupeTagKey"}),new H({OptionsClass:zi,nameKey:"rules.dedupe-yaml-array-values.dedupe-array-keys.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-array-keys.description",optionsKey:"dedupeArrayKeys"}),new pe({OptionsClass:zi,nameKey:"rules.dedupe-yaml-array-values.ignore-keys.name",descriptionKey:"rules.dedupe-yaml-array-values.ignore-keys.description",optionsKey:"ignoreDedupeArrayKeys"})]}};Kr=z([y.register],Kr);var no=class{constructor(){this.defaultLanguage=""}},_r=class extends y{constructor(){super({nameKey:"rules.default-language-for-code-fences.name",descriptionKey:"rules.default-language-for-code-fences.description",type:"Content",ruleIgnoreTypes:[h.yaml,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return no}apply(t,i){return up(t,i.defaultLanguage)}get optionBuilders(){return[new xe({OptionsClass:no,nameKey:"rules.default-language-for-code-fences.default-language.name",descriptionKey:"rules.default-language-for-code-fences.default-language.description",optionsKey:"defaultLanguage"})]}};_r=z([y.register],_r);var ro=class{constructor(){this.style="consistent"}},Nr=class extends y{constructor(){super({nameKey:"rules.emphasis-style.name",descriptionKey:"rules.emphasis-style.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag,h.math,h.inlineMath]})}get OptionsClass(){return ro}apply(t,i){return Ss(t,i.style,"emphasis")}get optionBuilders(){return[new ee({OptionsClass:ro,nameKey:"rules.emphasis-style.style.name",descriptionKey:"rules.emphasis-style.style.description",optionsKey:"style",records:[{value:"consistent",description:"Makes sure the first instance of emphasis is the style that will be used throughout the document"},{value:"asterisk",description:"Makes sure * is the emphasis indicator"},{value:"underscore",description:"Makes sure _ is the emphasis indicator"}]})]}};Nr=z([y.register],Nr);var gc=class{},jr=class extends y{constructor(){super({nameKey:"rules.empty-line-around-blockquotes.name",descriptionKey:"rules.empty-line-around-blockquotes.description",type:"Spacing"})}get OptionsClass(){return gc}apply(t,i){return sp(t)}get optionBuilders(){return[]}};jr=z([y.register],jr);var hc=class{},Yr=class extends y{constructor(){super({nameKey:"rules.empty-line-around-code-fences.name",descriptionKey:"rules.empty-line-around-code-fences.description",type:"Spacing"})}get OptionsClass(){return hc}apply(t,i){return rp(t)}get optionBuilders(){return[]}};Yr=z([y.register],Yr);var ao=class{constructor(){this.minimumNumberOfDollarSignsToBeAMathBlock=2}};z([y.noSettingControl()],ao.prototype,"minimumNumberOfDollarSignsToBeAMathBlock",2);var Pr=class extends y{constructor(){super({nameKey:"rules.empty-line-around-math-blocks.name",descriptionKey:"rules.empty-line-around-math-blocks.description",type:"Spacing",ruleIgnoreTypes:[h.yaml,h.code]})}get OptionsClass(){return ao}apply(t,i){return ap(t,i.minimumNumberOfDollarSignsToBeAMathBlock)}get optionBuilders(){return[]}};Pr=z([y.register],Pr);var fc=class{},Hr=class extends y{constructor(){super({nameKey:"rules.empty-line-around-tables.name",descriptionKey:"rules.empty-line-around-tables.description",type:"Spacing",ruleIgnoreTypes:[h.yaml,h.code,h.math,h.inlineMath,h.wikiLink,h.link]})}get OptionsClass(){return fc}apply(t,i){return Cp(t)}get optionBuilders(){return[]}};Hr=z([y.register],Hr);var Ur=class{constructor(){this.defaultEscapeCharacter='"';this.tryToEscapeSingleLineArrays=!1}};z([y.n
`),a=r.length;if(a<1)return n;for(let s=0;s<a;s++){let o=r[s].trim(),l=o.indexOf(":"),c=l<0||l+1>=o.length,d=o.startsWith("-"),u=d&&o.length<2;if(c&&u)continue;let m=1;if(!d)m+=l;else if(l!==-1&&s+1<a){let g=r[s],b=g.indexOf("-")+1;for(;b<g.length&&g.charAt(b)===" ";)b++;let f=0,x=r[s+1];for(;f<x.length&&x.charAt(f)===" ";)f++;b<=f&&(m+=l)}let p=o.substring(m).trim();if(p.startsWith("[")){if(i.tryToEscapeSingleLineArrays){if(p.length<3)continue;let g=p.substring(1,p.length-1).split(","),b=g.length;for(let f=0;f<b;f++){let x=g[f].trim();x.startsWith("[")&&(x=x.substring(1).trimStart()),x.endsWith("]")&&(x=x.substring(0,x.length-1).trimEnd()),g[f]=g[f].replace(x,vi(x,i.defaultEscapeCharacter,!1,!0))}r[s]=r[s].replace(p,"["+g.join(",")+"]")}continue}r[s]=r[s].replace(p,vi(p,i.defaultEscapeCharacter,!1,!0))}return r.join(`
`)})}get optionBuilders(){return[new H({OptionsClass:Ur,nameKey:"rules.escape-yaml-special-characters.try-to-escape-single-line-arrays.name",descriptionKey:"rules.escape-yaml-special-characters.try-to-escape-single-line-arrays.description",optionsKey:"tryToEscapeSingleLineArrays"})]}};Ut=z([y.register],Ut);var so=class{};z([y.noSettingControl()],so.prototype,"fileName",2);var Wr=class extends y{constructor(){super({nameKey:"rules.file-name-heading.name",descriptionKey:"rules.file-name-heading.description",type:"Heading",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return so}apply(t,i){if(t.match(/^#\s.*/m))return t;let r=i.fileName,a=t.indexOf(`
2023-11-09 17:30:33 +08:00
---`);a=a==-1||!t.startsWith(`---
`)?0:a+5;let s=`# ${r}
`;return t.length<a&&(s=`
2024-09-05 22:23:37 +08:00
`+s),At(t,a,s)}get optionBuilders(){return[]}};Wr=z([y.register],Wr);var yc=class{},Vr=class extends y{constructor(){super({nameKey:"rules.footnote-after-punctuation.name",descriptionKey:"rules.footnote-after-punctuation.description",type:"Footnote",ruleIgnoreTypes:[h.code,h.inlineCode,h.math,h.yaml,h.link,h.wikiLink,h.tag,h.footnoteAtStartOfLine,h.footnoteAfterATask]})}get OptionsClass(){return yc}apply(t,i){return t.replace(/(\[\^[^\]]+\]) ?([,.;!:?])/gm,"$2$1")}get optionBuilders(){return[]}};Vr=z([y.register],Vr);var $r=class{constructor(){this.defaultEscapeCharacter='"';this.forceYamlEscape=[]}};z([y.noSettingControl()],$r.prototype,"defaultEscapeCharacter",2);var Wt=class extends y{constructor(){super({nameKey:"rules.force-yaml-escape.name",descriptionKey:"rules.force-yaml-escape.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return $r}apply(t,i){return he(t,n=>{for(let r of i.forceYamlEscape){let a=de(n,r);if(a!=null){if(a.includes(`
`)||a.startsWith(" [")||Tn(a))continue;a=vi(a,i.defaultEscapeCharacter,!0),n=ae(n,r," "+a)}}return n})}get optionBuilders(){return[new pe({OptionsClass:$r,nameKey:"rules.force-yaml-escape.force-yaml-escape-keys.name",descriptionKey:"rules.force-yaml-escape.force-yaml-escape-keys.description",optionsKey:"forceYamlEscape"})]}};Wt=z([y.register],Wt);var bc=class{},Vt=class extends y{constructor(){super({nameKey:"rules.format-tags-in-yaml.name",descriptionKey:"rules.format-tags-in-yaml.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return bc}apply(t,i){return he(t,n=>n.replace(new RegExp(`^(${wr}|${Ul}):[ \\t]*(\\S.*|(?:(?:\\n *- \\S.*)|((?:\\n *- *))*|(\\n([ \\t]+[^\\n]*))*)*)\\n`,"m"),function(r){return r.replaceAll("#","")}))}get optionBuilders(){return[]}};Vt=z([y.register],Vt);var ai=class{constructor(){this.aliasArrayStyle="single-line";this.formatAliasKey=!0;this.tagArrayStyle="single-line";this.formatTagKey=!0;this.defaultArrayStyle="single-line";this.formatArrayKeys=!0;this.forceSingleLineArrayStyle=[];this.forceMultiLineArrayStyle=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};z([y.noSettingControl()],ai.prototype,"aliasArrayStyle",2),z([y.noSettingControl()],ai.prototype,"tagArrayStyle",2),z([y.noSettingControl()],ai.prototype,"defaultEscapeCharacter",2),z([y.noSettingControl()],ai.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var Gr=class extends y{constructor(){super({nameKey:"rules.format-yaml-array.name",descriptionKey:"rules.format-yaml-array.description",type:"YAML"})}get OptionsClass(){return ai}apply(t,i){return he(t,n=>{let r=ri(n.replace(`---
2023-11-09 17:30:33 +08:00
`,"").replace(`
2024-09-05 22:23:37 +08:00
---`,""));if(!r)return n;for(let a of bi)if(i.formatAliasKey&&Object.keys(r).includes(a)){n=ae(n,a,be(ot(qe(de(n,a))),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of yi)if(i.formatTagKey&&Object.keys(r).includes(a)){n=ae(n,a,be(st(qe(de(n,a))),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.formatArrayKeys){let a=[...bi,...yi,...i.forceMultiLineArrayStyle,...i.forceSingleLineArrayStyle];for(let s of Object.keys(r))a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null||(n=ae(n,s,be(qe(de(n,s)),i.defaultArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)))}for(let a of i.forceSingleLineArrayStyle)Object.keys(r).includes(a)&&(n=ae(n,a,be(qe(de(n,a)),"single-line",i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)));for(let a of i.forceMultiLineArrayStyle)Object.keys(r).includes(a)&&(n=ae(n,a,be(qe(de(n,a)),"multi-line",i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)));return n})}get optionBuilders(){return[new H({OptionsClass:ai,nameKey:"rules.format-yaml-array.alias-key.name",descriptionKey:"rules.format-yaml-array.alias-key.description",optionsKey:"formatAliasKey"}),new H({OptionsClass:ai,nameKey:"rules.format-yaml-array.tag-key.name",descriptionKey:"rules.format-yaml-array.tag-key.description",optionsKey:"formatTagKey"}),new ee({OptionsClass:ai,nameKey:"rules.format-yaml-array.default-array-style.name",descriptionKey:"rules.format-yaml-array.default-array-style.description",optionsKey:"defaultArrayStyle",records:[{value:"multi-line",description:"```key:\\n - value```"},{value:"single-line",description:"```key: [value]```"}]}),new H({OptionsClass:ai,nameKey:"rules.format-yaml-array.default-array-keys.name",descriptionKey:"rules.format-yaml-array.default-array-keys.description",optionsKey:"formatArrayKeys"}),new pe({OptionsClass:ai,nameKey:"rules.format-yaml-array.force-single-line-array-style.name",descriptionKey:"rules.format-yaml-array.force-single-line-array-style.description",optionsKey:"forceSingleLineArrayStyle"}),new pe({OptionsClass:ai,nameKey:"rules.format-yaml-array.force-multi-line-array-style.name",descriptionKey:"rules.format-yaml-array.force-multi-line-array-style.description",optionsKey:"forceMultiLineArrayStyle"})]}};Gr=z([y.register],Gr);var oo=class{constructor(){this.startAtH2=!1}},Qr=class extends y{constructor(){super({nameKey:"rules.header-increment.name",descriptionKey:"rules.header-increment.description",type:"Heading",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return oo}apply(t,i){let n=0,r=i.startAtH2?2:1,a=[],s=[0,0,0,0,0,0],o=s.length;return t.replace(rt,(l,c="",d="",u="",m="",p="")=>{let g=d.length;if(g=g<=o?g:o,s[g-1]>=0&&g<n){let b=s.length;for(;a.length!==0&&g<=a[a.length-1];)b=a.pop();a.length===0?b=0:b--;for(let f=s.length-1;f>=b;f--)s[f]=0}if(s[g-1]<=0){let b=n,f=a.length+r;f=f<=o?f:o;for(let x=b;x<g-1;x++)s[x]=f-1;a.push(g),s[g-1]=f}return n=g,c+"#".repeat(s[g-1])+u+m+p})}get optionBuilders(){return[new H({OptionsClass:oo,nameKey:"rules.header-increment.start-at-h2.name",descriptionKey:"rules.header-increment.start-at-h2.description",optionsKey:"startAtH2"})]}};Qr=z([y.register],Qr);var Jr=class{constructor(){this.bottom=!0;this.emptyLineAfterYaml=!0}},Zr=class extends y{constructor(){super({nameKey:"rules.heading-blank-lines.name",descriptionKey:"rules.heading-blank-lines.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink]})}get OptionsClass(){return Jr}apply(t,i){return i.bottom?(t=t.replace(/^(#+\s.*)/gm,`
2023-11-09 17:30:33 +08:00
$1
`),t=t.replace(/\n+(#+\s.*)/g,`
$1`),t=t.replace(/(^#+\s.*)\n+/gm,`$1
2024-02-26 20:05:21 +08:00
`)):t=t.replace(/^([^#\n][^\n]+)\n+(#+\s.*)/gm,`$1
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
$2`),t=t.replace(/^\n+(#+\s.*)/,"$1"),t=t.replace(/(#+\s.*)\n+$/,"$1"),i.emptyLineAfterYaml||(t=t.replace(new RegExp("("+Ge.source+")\\n+(#+\\s.*)"),`$1
$5`)),t}get optionBuilders(){return[new H({OptionsClass:Jr,nameKey:"rules.heading-blank-lines.bottom.name",descriptionKey:"rules.heading-blank-lines.bottom.description",optionsKey:"bottom"}),new H({OptionsClass:Jr,nameKey:"rules.heading-blank-lines.empty-line-after-yaml.name",descriptionKey:"rules.heading-blank-lines.empty-line-after-yaml.description",optionsKey:"emptyLineAfterYaml"})]}};Zr=z([y.register],Zr);var vc=class{},Xr=class extends y{constructor(){super({nameKey:"rules.headings-start-line.name",descriptionKey:"rules.headings-start-line.description",type:"Heading",ruleIgnoreTypes:[h.code,h.math,h.yaml]})}get OptionsClass(){return vc}apply(t,i){return t.replaceAll(rt,n=>n.trimStart())}get optionBuilders(){return[]}};Xr=z([y.register],Xr);var lo=class{constructor(){this.textToInsert=["aliases: ","tags: "]}},ea=class extends y{constructor(){super({nameKey:"rules.insert-yaml-attributes.name",descriptionKey:"rules.insert-yaml-attributes.description",type:"YAML"})}get OptionsClass(){return lo}apply(t,i){return t=Ci(t),he(t,n=>{let r=i.textToInsert.reverse(),a=ri(n.match(Ge)[1]);for(let s of r){let o=s.split(":")[0];Object.prototype.hasOwnProperty.call(a,o)||(n=n.replace(/^---\n/,Qe(`---
2023-11-09 17:30:33 +08:00
${s}
2024-09-05 22:23:37 +08:00
`)))}return n})}get optionBuilders(){return[new pe({OptionsClass:lo,nameKey:"rules.insert-yaml-attributes.text-to-insert.name",descriptionKey:"rules.insert-yaml-attributes.text-to-insert.description",optionsKey:"textToInsert"})]}};ea=z([y.register],ea);var xc=class{},ia=class extends y{constructor(){super({nameKey:"rules.line-break-at-document-end.name",descriptionKey:"rules.line-break-at-document-end.description",type:"Spacing"})}get OptionsClass(){return xc}apply(t,i){return t=t.replace(/\n+$/g,""),t+=`
`,t}get optionBuilders(){return[]}};ia=z([y.register],ia);var wc=class{},ta=class extends y{constructor(){super({nameKey:"rules.move-footnotes-to-the-bottom.name",descriptionKey:"rules.move-footnotes-to-the-bottom.description",type:"Footnote",ruleIgnoreTypes:[h.code,h.inlineCode,h.math,h.yaml]})}get OptionsClass(){return wc}apply(t,i){return Zu(t)}get optionBuilders(){return[]}};ta=z([y.register],ta);var co=class{constructor(){this.minimumNumberOfDollarSignsToBeAMathBlock=2}};z([y.noSettingControl()],co.prototype,"minimumNumberOfDollarSignsToBeAMathBlock",2);var $t=class extends y{constructor(){super({nameKey:"rules.move-math-block-indicators-to-their-own-line.name",descriptionKey:"rules.move-math-block-indicators-to-their-own-line.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.inlineCode],hasSpecialExecutionOrder:!0})}get OptionsClass(){return co}apply(t,i){return cp(t,i.minimumNumberOfDollarSignsToBeAMathBlock)}get optionBuilders(){return[]}};$t=z([y.register],$t);var gt=class{constructor(){this.tagArrayStyle="single-line";this.howToHandleExistingTags="Nothing";this.tagsToIgnore=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};z([y.noSettingControl()],gt.prototype,"tagArrayStyle",2),z([y.noSettingControl()],gt.prototype,"defaultEscapeCharacter",2),z([y.noSettingControl()],gt.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var na=class extends y{constructor(){super({nameKey:"rules.move-tags-to-yaml.name",descriptionKey:"rules.move-tags-to-yaml.description",type:"YAML",ruleIgnoreTypes:[h.code,h.inlineCode,h.math,h.html,h.wikiLink,h.link]})}get OptionsClass(){return gt}apply(t,i){let n;return Ee([h.yaml],t,r=>(n=Op(r),r)),n.length===0||(t=Ci(t),t=he(t,r=>{r=r.replace(`---
`,"").replace("---","");let a=[],s=wr;for(let c of yi){let d=de(r,c);if(d!=null){a=st(qe(d)),s=c;break}}let o=new Set;if(typeof a=="string")o.add(a),a=[a];else if(a!=null)for(let c of a)o.add(c);else a=[];for(let c of n){let d=c.trim().substring(1);!o.has(d)&&!i.tagsToIgnore.includes(d)&&(o.add(d),a.push(d))}return`---
${ae(r,s,be(a,i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}---`}),t=Ee([h.yaml],t,r=>(i.howToHandleExistingTags!=="Nothing"&&(r=r.replace(br,a=>{let s=a.indexOf("#"),o=a.substring(s+1);return i.tagsToIgnore.includes(o)?a:i.howToHandleExistingTags==="Remove hashtag"?a.substring(0,s)+o:""})),r)),t=t.replace(/(\n---)( |\t)+/,"$1")),t}get optionBuilders(){return[new ee({OptionsClass:gt,nameKey:"rules.move-tags-to-yaml.how-to-handle-existing-tags.name",descriptionKey:"rules.move-tags-to-yaml.how-to-handle-existing-tags.description",optionsKey:"howToHandleExistingTags",records:[{value:"Nothing",description:"Leaves tags in the body of the file alone"},{value:"Remove hashtag",description:"Removes `#` from tags in content body after moving them to the YAML frontmatter"},{value:"Remove whole tag",description:"Removes the whole tag in content body after moving them to the YAML frontmatter. _Note that this removes the first space prior to the tag as well_"}]}),new pe({OptionsClass:gt,nameKey:"rules.move-tags-to-yaml.tags-to-ignore.name",descriptionKey:"rules.move-tags-to-yaml.tags-to-ignore.description",optionsKey:"tagsToIgnore"})]}};na=z([y.register],na);var po=class{constructor(){this.noBareURIs=!1}},uo="'\"\u2018\u2019\u201C\u201D`[]",nx=["http","ftp","https","smtp"],ra=class extends y{constructor(){super({nameKey:"rules.no-bare-urls.name",descriptionKey:"rules.no-bare-urls.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag,h.image,h.inlineCode,h.anchorTag,h.html]})}get OptionsClass(){return po}apply(t,i){let n=t.match(Ct);if(n&&(t=this.handleMatches(t,n,!1)),i.noBareURIs){let r=t.match(xp);r&&(t=this.handleMatches(t,r,!0))}return t}handleMatches(t,i,n){let r=0,a=i.length;for(let s=0;s<a;s++){let o=i[s],l=t.indexOf(o,r),c=l+o.length;o.charAt(0)==="<"&&(o=o.substring(1),l++),o.charAt(o.length-1)===">"&&(o=o.substring(0,o.length-1),c--);let d=l===0?void 0:t.charAt(l-1),u=c>=t.length?void 0:t.charAt(c),m=Xi(o,"(");if(m!=0&&m!=Xi(o,")")&&u==")"?(o+=u,c++,u=c>=t.length?void 0:t.charAt(c)):m==0&&o.endsWith(")")&&(u=")",c--,o=o.substring(0,o.length-1)),this.skipMatch(d,u,o,n)){r=l+o.length;continue}if(d!=null&&d==="<"&&u!=null&&u===">"){let p=l-1;for(;p>0&&t.charAt(p-1)==="<";)p--;let g=c;for(;g<t.length-1&&t.charAt(g+1)===">";)g++;t=le(t,p,g+1,"<"+o+">"),r=l+o.length;continue}t=le(t,l,l+o.length,"<"+o+">"),r=l+o.length+2}return t}skipMatch(t,i,n,r){let a=t!=null&&uo.includes(t)||uo.includes(n.charAt(0)),s=i!=null&&uo.includes(i)||uo.includes(n.charAt(n.length-1));return a&&s?!0:r?nx.includes(n.substring(0,n.indexOf(":"))):!1}get optionBuilders(){return[new H({OptionsClass:po,nameKey:"rules.no-bare-urls.no-bare-uris.name",descriptionKey:"rules.no-bare-urls.no-bare-uris.description",optionsKey:"noBareURIs"})]}};ra=z([y.register],ra);var sa=class{constructor(){this.numberStyle="ascending";this.listEndStyle="."}},aa=class extends y{constructor(){super({nameKey:"rules.ordered-list-style.name",descriptionKey:"rules.ordered-list-style.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.tag]})}get OptionsClass(){return sa}apply(t,i){return op(t,i.numberStyle,i.listEndStyle)}get optionBuilders(){return[new ee({OptionsClass:sa,nameKey:"rules.ordered-list-style.number-style.name",descriptionKey:"rules.ordered-list-style.number-style.description",optionsKey:"numberStyle",records:[{value:"ascending",description:"Makes sure ordered list items are ascending (i.e. 1, 2, 3, etc.)"},{value:"lazy",description:"Makes sure ordered list item indicators all are the number 1"}]}),new ee({OptionsClass:sa,nameKey:"rules.ordered-list-style.list-end-style.name",descriptionKey:"rules.ordered-list-style.list-end-style.description",optionsKey:"listEndStyle",records:[{value:".",description:"Makes sure ordered list items indicators end in '.' (i.e `1.`)"},{value:")",description:"Makes sure ordered list item indicators end in ')' (i.e. `1)`)"}]})]}};aa=z([y.register],aa);var kc=class{},oa=class extends y{constructor(){super({nameKey:"rules.paragraph-blank-lines.name",
2023-11-09 17:30:33 +08:00
{2,}${n}$`,"gm"),a,s=i;do a=s.match(r),s=s.replaceAll(r,`$1
2024-09-05 22:23:37 +08:00
$4`);while(a);return s}}get OptionsClass(){return Tc}apply(i,n){let r=`(( |\\t)*- ${Ot}( |\\t)+.+)`;i=this.replaceEmptyLinesBetweenList(i,r),i=this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\d+\\.( |\\t)+.+)"),i=this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\+( |\\t)+.+)");let o=`(( |\\t)*-(?! ${Ot})( |\\t)+.+)`;return i=this.replaceEmptyLinesBetweenList(i,o),this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\*( |\\t)+.+)")}get optionBuilders(){return[]}};ga=z([y.register],ga);var Ec=class{},ha=class extends y{constructor(){super({nameKey:"rules.remove-empty-list-markers.name",descriptionKey:"rules.remove-empty-list-markers.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return Ec}apply(t,i){let n=new RegExp(`^${xr}(-|\\*|\\+|\\d+[.)]|- (\\[(.)\\]))\\s*?$`,"gm");return t=t.replace(new RegExp(n.source+"\\n","gm"),""),t=t.replace(new RegExp("\\n"+n.source,"gm"),""),t.replace(n,"")}get optionBuilders(){return[]}};ha=z([y.register],ha);var Cc=class{},fa=class extends y{constructor(){super({nameKey:"rules.remove-hyphenated-line-breaks.name",descriptionKey:"rules.remove-hyphenated-line-breaks.description",type:"Content",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return Cc}apply(t,i){return t.replace(/\b[-] \b/g,"")}get optionBuilders(){return[]}};fa=z([y.register],fa);var Oc=class{},Xt=class extends y{constructor(){super({nameKey:"rules.remove-hyphens-on-paste.name",descriptionKey:"rules.remove-hyphens-on-paste.description",type:"Paste"})}get OptionsClass(){return Oc}apply(t,i){return t.replace(/([^\s-])[-]\s+\n?(?=\w)/g,"$1")}get optionBuilders(){return[]}};Xt=z([y.register],Xt);var Mc=class{},en=class extends y{constructor(){super({nameKey:"rules.remove-leading-or-trailing-whitespace-on-paste.name",descriptionKey:"rules.remove-leading-or-trailing-whitespace-on-paste.description",type:"Paste"})}get OptionsClass(){return Mc}apply(t,i){return t.replace(/^[\n ]+|\s+$/g,"")}get optionBuilders(){return[]}};en=z([y.register],en);var qc=class{},tn=class extends y{constructor(){super({nameKey:"rules.remove-leftover-footnotes-from-quote-on-paste.name",descriptionKey:"rules.remove-leftover-footnotes-from-quote-on-paste.description",ruleIgnoreTypes:[h.wikiLink,h.link,h.image],type:"Paste"})}get OptionsClass(){return qc}apply(t,i){return t.replace(/(\D)[.,]\d+/g,"$1")}get optionBuilders(){return[]}};tn=z([y.register],tn);var Ic=class{},ya=class extends y{constructor(){super({nameKey:"rules.remove-link-spacing.name",descriptionKey:"rules.remove-link-spacing.description",type:"Spacing"})}get OptionsClass(){return Ic}apply(t,i){return t=ip(t),Ep(t)}get optionBuilders(){return[]}};ya=z([y.register],ya);var Bc=class{},nn=class extends y{constructor(){super({nameKey:"rules.remove-multiple-blank-lines-on-paste.name",descriptionKey:"rules.remove-multiple-blank-lines-on-paste.description",type:"Paste"})}get OptionsClass(){return Bc}apply(t,i){return t.replace(/\n{3,}/g,`
2023-11-09 17:30:33 +08:00
2024-09-05 22:23:37 +08:00
`)}get optionBuilders(){return[]}};nn=z([y.register],nn);var Fc=class{},ba=class extends y{constructor(){super({nameKey:"rules.remove-multiple-spaces.name",descriptionKey:"rules.remove-multiple-spaces.description",type:"Content",ruleIgnoreTypes:[h.code,h.inlineCode,h.math,h.inlineMath,h.yaml,h.link,h.wikiLink,h.tag,h.table]})}get OptionsClass(){return Fc}apply(t,i){return t=t.replace(/(?!^>)([^\s])( ){2,}([^\s])/gm,"$1 $3"),t}get optionBuilders(){return[]}};ba=z([y.register],ba);var rn=class{constructor(){this.includeFullwidthForms=!0;this.includeCJKSymbolsAndPunctuation=!0;this.includeDashes=!0;this.otherSymbols=""}},va=class extends y{constructor(){super({nameKey:"rules.remove-space-around-characters.name",descriptionKey:"rules.remove-space-around-characters.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.inlineCode,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return rn}apply(t,i){let n="";if(i.includeFullwidthForms&&(n+="\uFF01-\uFF5E"),i.includeCJKSymbolsAndPunctuation&&(n+="\u3000-\u303F"),i.includeDashes&&(n+="\u2013\u2014"),n+=at(i.otherSymbols),!n)return t;let r=new RegExp(`([ ])+([${n}])`,"g"),a=new RegExp(`([${n}])([ ])+`,"g"),s=function(l){return l.replace(r,"$2").replace(a,"$1")},o=Ee([h.list],t,s);return o=Ls(o,s),o}get optionBuilders(){return[new H({nameKey:"rules.remove-space-around-characters.include-fullwidth-forms.name",descriptionKey:"rules.remove-space-around-characters.include-fullwidth-forms.description",OptionsClass:rn,optionsKey:"includeFullwidthForms"}),new H({nameKey:"rules.remove-space-around-characters.include-cjk-symbols-and-punctuation.name",descriptionKey:"rules.remove-space-around-characters.include-cjk-symbols-and-punctuation.description",OptionsClass:rn,optionsKey:"includeCJKSymbolsAndPunctuation"}),new H({nameKey:"rules.remove-space-around-characters.include-dashes.name",descriptionKey:"rules.remove-space-around-characters.include-dashes.description",OptionsClass:rn,optionsKey:"includeDashes"}),new xe({nameKey:"rules.remove-space-around-characters.other-symbols.name",descriptionKey:"rules.remove-space-around-characters.other-symbols.description",OptionsClass:rn,optionsKey:"otherSymbols"})]}};va=z([y.register],va);var wa=class{constructor(){this.charactersToRemoveSpacesBefore=",!?;:).\u2019\u201D]";this.charactersToRemoveSpacesAfter="\xBF\xA1\u2018\u201C(["}},xa=class extends y{constructor(){super({nameKey:"rules.remove-space-before-or-after-characters.name",descriptionKey:"rules.remove-space-before-or-after-characters.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return wa}apply(t,i){let n=at(i.charactersToRemoveSpacesBefore),r=at(i.charactersToRemoveSpacesAfter);if(!n&&!r)return t;let a=new RegExp(`([ ])+([${n}])`,"g"),s=new RegExp(`([${r}])([ ])+`,"g"),o=function(c){return c.replace(a,"$2").replace(s,"$1")},l=Ee([h.list,h.html],t,o);return l=Ls(l,o),l}get optionBuilders(){return[new xe({nameKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-before.name",descriptionKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-before.description",OptionsClass:wa,optionsKey:"charactersToRemoveSpacesBefore"}),new xe({nameKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-after.name",descriptionKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-after.description",OptionsClass:wa,optionsKey:"charactersToRemoveSpacesAfter"})]}};xa=z([y.register],xa);var mo=class{constructor(){this.punctuationToRemove=".,;:!\u3002\uFF0C\uFF1B\uFF1A\uFF01"}},ka=class extends y{constructor(){super({nameKey:"rules.remove-trailing-punctuation-in-heading.name",descriptionKey:"rules.remove-trailing-punctuation-in-heading.description",type:"Heading",ruleIgnoreTypes:[h.code,h.math,h.yaml]})}get OptionsClass(){return mo}apply(t,i){return t.replaceAll(rt,(n,r="",a="",s="",o="",l="")=>{if(o==""||o.match(zp))return n;let c=o.trimEnd(),d=c.charAt(c.length-1);return i.punctuationToRemove.includes(d)?r+a+s+o.substring(0,c.length-1)+o.subs
2024-02-26 20:05:21 +08:00
`,"").replace(`
2024-09-05 22:23:37 +08:00
---`,""));if(!r)return n;for(let a of bi)if(i.sortAliasKey&&Object.keys(r).includes(a)){n=ae(n,a,be(ot(this.sortArray(qe(de(n,a)),i.sortOrder)),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of yi)if(i.sortTagKey&&Object.keys(r).includes(a)){n=ae(n,a,be(st(this.sortArray(qe(de(n,a)),i.sortOrder)),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.sortArrayKeys){let a=[...bi,...yi,...i.ignoreSortArrayKeys];for(let s of Object.keys(r)){if(a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null)continue;let o=de(n,s),l="single-line";o.includes(`
`)&&(l="multi-line");let c=this.sortArray(qe(o),i.sortOrder);n=ae(n,s,be(c,l,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}}return n})}sortArray(t,i){return t==null||typeof t=="string"||t.length<=1||(t.sort(function(n,r){let a=n.toLowerCase().localeCompare(r.toLowerCase());return a===0?n.localeCompare(r):a}),i==="Ascending Alphabetical")||t.reverse(),t}get optionBuilders(){return[new H({OptionsClass:gi,nameKey:"rules.sort-yaml-array-values.sort-alias-key.name",descriptionKey:"rules.sort-yaml-array-values.sort-alias-key.description",optionsKey:"sortAliasKey"}),new H({OptionsClass:gi,nameKey:"rules.sort-yaml-array-values.sort-tag-key.name",descriptionKey:"rules.sort-yaml-array-values.sort-tag-key.description",optionsKey:"sortTagKey"}),new H({OptionsClass:gi,nameKey:"rules.sort-yaml-array-values.sort-array-keys.name",descriptionKey:"rules.sort-yaml-array-values.sort-array-keys.description",optionsKey:"sortArrayKeys"}),new pe({OptionsClass:gi,nameKey:"rules.sort-yaml-array-values.ignore-keys.name",descriptionKey:"rules.sort-yaml-array-values.ignore-keys.description",optionsKey:"ignoreSortArrayKeys"}),new ee({OptionsClass:gi,nameKey:"rules.sort-yaml-array-values.sort-order.name",descriptionKey:"rules.sort-yaml-array-values.sort-order.description",optionsKey:"sortOrder",records:[{value:"Ascending Alphabetical",description:"Sorts the array values from a to z"},{value:"Descending Alphabetical",description:"Sorts the array values from z to a"}]})]}};Aa=z([y.register],Aa);var Rc=class{},Sa=class extends y{constructor(){super({nameKey:"rules.space-after-list-markers.name",descriptionKey:"rules.space-after-list-markers.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.math,h.yaml,h.link,h.wikiLink,h.tag]})}get OptionsClass(){return Rc}apply(t,i){return t=t.replace(/^(\s*\d+\.|\s*[-+*])[^\S\r\n]+/gm,"$1 "),t.replace(/^(\s*\d+\.|\s*[-+*]\s+\[[ xX]\])[^\S\r\n]+/gm,"$1 ")}get optionBuilders(){return[]}};Sa=z([y.register],Sa);var Ta=class{constructor(){this.englishNonLetterCharactersAfterCJKCharacters=`-+'"([\xA5$`;this.englishNonLetterCharactersBeforeCJKCharacters=`-+;:'"\xB0%$)]`}},La=class extends y{constructor(){super({nameKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.name",descriptionKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.description",type:"Spacing",ruleIgnoreTypes:[h.code,h.inlineCode,h.yaml,h.image,h.link,h.wikiLink,h.tag,h.math,h.inlineMath,h.html]})}get OptionsClass(){return Ta}apply(t,i){let n=this.buildHeadRegex(i.englishNonLetterCharactersAfterCJKCharacters),r=this.buildTailRegex(i.englishNonLetterCharactersBeforeCJKCharacters),a=`${h.link.placeholder}|${h.inlineMath.placeholder}|${h.inlineCode.placeholder}|${h.wikiLink.placeholder}`.replaceAll("{","\\{").replaceAll("}","\\}"),s=new RegExp(`(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})( *)(${a})`,"gmu"),o=new RegExp(`(${a})( *)(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})`,"gmu"),l=function(d){return d.replace(n,"$1 $3").replace(r,"$1 $3")},c=Ee([h.italics,h.bold],t,l);return c=c.replace(s,"$1 $3").replace(o,"$1 $3"),c=tp(c,l),c=np(c,l),c}buildHeadRegex(t){t&&t!==""&&(t=t.replaceAll(/\s/g,""));let i="";return t&&t.length!=0&&(i=`|[${at(t)}]`),new RegExp(`(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})( *)(\\[[^[]*\\]\\(.*\\)|\`[^\`]*\`|\\w+${i}|\\*[^*])`,"gmu")}buildTailRegex(t){t&&t!==""&&(t=t.replaceAll(/\s/g,""));let i="";return t&&t.length!=0&&(i=`|[${at(t)}]`),new RegExp(`(\\[[^[]*\\]\\(.*\\)|\`[^\`]*\`|\\w+${i}|[^*]\\*)( *)(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})`,"gmu")}get optionBuilders(){return[new xe({OptionsClass:Ta,nameKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-before.name",descriptionKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-before.description",optionsKey:"englishNonLetterCharactersBeforeCJKCharacters"}),new xe({OptionsClass:Ta,nameKey:"rules.space-between-chinese-japanese-or
2024-01-10 16:42:54 +08:00
`)?r+=`${a}:${s}
`:r+=`${a}: ${s}
2024-09-05 22:23:37 +08:00
`,t=Mt(t,a,!1))}return{remainingYaml:t,sortedYamlKeyValues:r}}updateDateModifiedIfYamlChanged(t,i,n,r){return t==i?i:ae(i,n," "+r)}getTextWithNewYamlFrontmatter(t,i,n,r,a,s,o,l){let c=`${r}${n}`;return a&&(c=`${n}${r}`),l&&(c=this.updateDateModifiedIfYamlChanged(i,c,s,o)),t.replace(i,c)}sortAlphabeticallyAsc(t,i){return t=t.toLowerCase(),i=i.toLowerCase(),t<i?-1:i<t?1:0}sortAlphabeticallyDesc(t,i){return t=t.toLowerCase(),i=i.toLowerCase(),t>i?-1:i>t?1:0}get optionBuilders(){return[new pe({OptionsClass:Vi,nameKey:"rules.yaml-key-sort.yaml-key-priority-sort-order.name",descriptionKey:"rules.yaml-key-sort.yaml-key-priority-sort-order.description",optionsKey:"yamlKeyPrioritySortOrder"}),new H({OptionsClass:Vi,nameKey:"rules.yaml-key-sort.priority-keys-at-start-of-yaml.name",descriptionKey:"rules.yaml-key-sort.priority-keys-at-start-of-yaml.description",optionsKey:"priorityKeysAtStartOfYaml"}),new ee({OptionsClass:Vi,nameKey:"rules.yaml-key-sort.yaml-sort-order-for-other-keys.name",descriptionKey:"rules.yaml-key-sort.yaml-sort-order-for-other-keys.description",optionsKey:"yamlSortOrderForOtherKeys",records:[{value:"None",description:"No sorting other than what is in the YAML Key Priority Sort Order text area"},{value:"Ascending Alphabetical",description:"Sorts the keys based on key value from a to z"},{value:"Descending Alphabetical",description:"Sorts the keys based on key value from z to a"}]})]}};sn=z([y.register],sn);var Ai=require("obsidian");var Nc=gn(xm());var He=class{constructor(){this.dateCreatedKey="date created";this.dateCreated=!0;this.forceRetentionOfCreatedValue=!1;this.format="dddd, MMMM Do YYYY, h:mm:ss a";this.dateModified=!0;this.dateModifiedKey="date modified";this.convertToUTC=!1;this.locale="en"}};z([y.noSettingControl()],He.prototype,"alreadyModified",2),z([y.noSettingControl()],He.prototype,"fileCreatedTime",2),z([y.noSettingControl()],He.prototype,"fileModifiedTime",2),z([y.noSettingControl()],He.prototype,"locale",2),z([y.noSettingControl()],He.prototype,"currentTime",2),z([y.noSettingControl()],He.prototype,"fileName",2);var ht=class extends y{constructor(){super({nameKey:"rules.yaml-timestamp.name",descriptionKey:"rules.yaml-timestamp.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return He}apply(t,i){let n=i.alreadyModified,r=Ci(t);return n=n||r!==t,i.format=i.format.trimEnd(),he(r,a=>{if(i.dateCreated){let s=!1;[a,s]=this.handleDateCreatedValue(a,i),n=n||s}return i.dateModified&&(a=this.handleDateModifiedValue(a,n,i)),a})}handleDateCreatedValue(t,i){let n=!1,r=`
2023-11-09 17:30:33 +08:00
${i.dateCreatedKey}: [^
]+
`,a=`
${i.dateCreatedKey}:[ ]*
2024-09-05 22:23:37 +08:00
`,s=new RegExp(a),o=new RegExp(r),l=(0,Ai.moment)(i.fileCreatedTime);l.locale(i.locale);let c=i.convertToUTC?l.utc().format(i.format):l.format(i.format),d=`
${i.dateCreatedKey}: ${c}`,u=o.test(t);if(!u&&s.test(t))t=t.replace(s,Qe(d)+`
`),n=!0;else if(u){if(u){let m=this.getYAMLTimestampString(t,o,i.dateCreatedKey),p=(0,Nc.default)(m);if(i.forceRetentionOfCreatedValue&&i.format!==p){let g=this.parseValueToCurrentFormatIfPossible(m,i.format,i.locale,i.convertToUTC);if(g==null)throw new Error(A("logs.invalid-date-format-error").replace("{DATE}",m).replace("{FILE_NAME}",i.fileName));let b=i.convertToUTC?g.utc().format(i.format):g.format(i.format);if(b!==m){let f=`
${i.dateCreatedKey}: ${b}`;t=t.replace(o,Qe(f)+`
`),n=!0}}else if(!i.forceRetentionOfCreatedValue){let g=(0,Ai.moment)(m,i.format,i.locale,!0);(g==null||!g.isValid())&&(t=t.replace(o,Qe(d)+`
`),n=!0)}}}else{let m=t.indexOf(`
---`);t=At(t,m,`
2023-12-10 12:54:30 +08:00
${i.dateCreatedKey}: ${c}`),n=!0}return[t,n]}handleDateModifiedValue(t,i,n){let r=`
2023-11-09 17:30:33 +08:00
${n.dateModifiedKey}: [^
]+
`,a=`
${n.dateModifiedKey}:[ ]*
2024-09-05 22:23:37 +08:00
`,s=new RegExp(a),o=new RegExp(r),l=(0,Ai.moment)(n.fileModifiedTime);l.locale(n.locale);let c=n.convertToUTC?n.currentTime.utc().format(n.format):n.currentTime.format(n.format),d=`
${n.dateModifiedKey}: ${c}`,u=o.test(t);if(u){let m=(0,Ai.moment)(t.match(o)[0].replace(n.dateModifiedKey+":","").trim(),n.format,n.locale,!0);(i||m==null||!m.isValid()||this.getTimeDifferenceInSeconds(m,l,n)>5)&&(t=t.replace(o,Qe(d)+`
`))}else if(s.test(t))t=t.replace(s,Qe(d)+`
`);else if(!u){let m=t.indexOf(`
---`);t=At(t,m,d)}return t}parseValueToCurrentFormatIfPossible(t,i,n,r){if(t==null)return null;let a=r?Ai.moment.utc(t,i,n,!0):(0,Ai.moment)(t,i,n,!0);if(a!=null&&a.isValid())return a;let s=(0,Nc.default)(t);if(s!=null){let o=r?Ai.moment.utc(t,s):(0,Ai.moment)(t,s);o.locale(n);let l=r?o.utc().format(i):o.format(i);return(0,Ai.moment)(l,i,n,!0)}return null}getYAMLTimestampString(t,i,n){return t.match(i)[0].replace(n+":","").trim()}getTimeDifferenceInSeconds(t,i,n){let r=(0,Ai.moment)(i.format(n.format),n.format,n.locale,!0);return Math.abs(t.diff(r,"seconds"))}get optionBuilders(){return[new H({OptionsClass:He,nameKey:"rules.yaml-timestamp.date-created.name",descriptionKey:"rules.yaml-timestamp.date-created.description",optionsKey:"dateCreated"}),new xe({OptionsClass:He,nameKey:"rules.yaml-timestamp.date-created-key.name",descriptionKey:"rules.yaml-timestamp.date-created-key.description",optionsKey:"dateCreatedKey"}),new H({OptionsClass:He,nameKey:"rules.yaml-timestamp.force-retention-of-create-value.name",descriptionKey:"rules.yaml-timestamp.force-retention-of-create-value.description",optionsKey:"forceRetentionOfCreatedValue"}),new H({OptionsClass:He,nameKey:"rules.yaml-timestamp.date-modified.name",descriptionKey:"rules.yaml-timestamp.date-modified.description",optionsKey:"dateModified"}),new xe({OptionsClass:He,nameKey:"rules.yaml-timestamp.date-modified-key.name",descriptionKey:"rules.yaml-timestamp.date-modified-key.description",optionsKey:"dateModifiedKey"}),new Zs({OptionsClass:He,nameKey:"rules.yaml-timestamp.format.name",descriptionKey:"rules.yaml-timestamp.format.description",optionsKey:"format"}),new H({OptionsClass:He,nameKey:"rules.yaml-timestamp.convert-to-utc.name",descriptionKey:"rules.yaml-timestamp.convert-to-utc.description",optionsKey:"convertToUTC"})]}};ht=z([y.register],ht);var Si=class{constructor(){this.preserveExistingAliasesSectionStyle=!0;this.keepAliasThatMatchesTheFilename=!1;this.useYamlKeyToKeepTrackOfOldFilenameOrHeading=!0;this.aliasHelperKey=Vl;this.aliasArrayStyle="multi-line";this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};z([y.noSettingControl()],Si.prototype,"aliasArrayStyle",2),z([y.noSettingControl()],Si.prototype,"fileName",2),z([y.noSettingControl()],Si.prototype,"defaultEscapeCharacter",2),z([y.noSettingControl()],Si.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var on=class extends y{constructor(){super({nameKey:"rules.yaml-title-alias.name",descriptionKey:"rules.yaml-title-alias.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Si}apply(t,i){t=Ci(t);let[n,r]=this.getTitleInfo(t,i.fileName,i.aliasArrayStyle,i.defaultEscapeCharacter),a=null,s=t.match(Ge)[1],o=!i.keepAliasThatMatchesTheFilename&&n===i.fileName,l=s.replace(`---
2023-11-09 17:30:33 +08:00
`,"").replace(`
2024-09-05 22:23:37 +08:00
---`,""),c=ri(s),d=i.aliasHelperKey??Vl;d.endsWith(":")&&(d=d.substring(0,d.length-1)),a=c[d]??null,a!=null&&(a=a+"",a=vi(a,i.defaultEscapeCharacter,this.forceEscape(a,i.aliasArrayStyle)));let u=null,m=Object.keys(c);for(let p of bi)if(m.includes(p)){u=p;break}if(u!=null){let p=de(l,u),g="multi-line",b=p==="",f=!1;!p.includes(`
`)&&!(p==="[]"&&i.aliasArrayStyle==="multi-line")&&(p.match(/^\[.*\]/)===null?(g="single string to single-line",f=!0):g="single-line");let x=ot(qe(p)),k=this.getNewAliasValue(x,o,r,a);k===""?l=Mt(l,u):i.preserveExistingAliasesSectionStyle?!b&&(f&&r==k||!f||x==k)?l=ae(l,u,be(k,g,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)):l=ae(l,u,be(k,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)):l=ae(l,u,be(k,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0))}else o||(l=ae(l,Wl,be(r,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)));return!i.useYamlKeyToKeepTrackOfOldFilenameOrHeading||o?l=Mt(l,d):l=ae(l,d,` ${r}`),t=t.replace(`---
2023-11-09 17:30:33 +08:00
${s}---`,`---
2024-09-05 22:23:37 +08:00
${l}---`),t}getTitleInfo(t,i,n,r){let a=Ee([h.code,h.math,h.yaml,h.tag],t,qs);a=a||i;let s=vi(a,r,this.forceEscape(a,n));return[a,s]}forceEscape(t,i){return cs(t)||t.includes(",")&&(i==="single-line"||i==="single string to single-line"||i==="single string comma delimited")}getNewAliasValue(t,i,n,r){if(t==null)return i?"":n;if(typeof t=="string")i?t===n&&(t=""):r===t?t=n:t=[n,t];else if(r!==null){let a=t.indexOf(r);a===-1&&Tn(r)&&(a=t.indexOf(r.substring(1,r.length-1))),a!==-1?i?t.splice(a,1):t[a]=n:t=[n,...t]}else{let a=t.indexOf(n);a!==-1?i&&t.splice(a,1):i||(t=[n,...t])}return t===""||t.length===0?"":t}get optionBuilders(){return[new H({OptionsClass:Si,nameKey:"rules.yaml-title-alias.preserve-existing-alias-section-style.name",descriptionKey:"rules.yaml-title-alias.preserve-existing-alias-section-style.description",optionsKey:"preserveExistingAliasesSectionStyle"}),new H({OptionsClass:Si,nameKey:"rules.yaml-title-alias.keep-alias-that-matches-the-filename.name",descriptionKey:"rules.yaml-title-alias.keep-alias-that-matches-the-filename.description",optionsKey:"keepAliasThatMatchesTheFilename"}),new H({OptionsClass:Si,nameKey:"rules.yaml-title-alias.use-yaml-key-to-keep-track-of-old-filename-or-heading.name",descriptionKey:"rules.yaml-title-alias.use-yaml-key-to-keep-track-of-old-filename-or-heading.description",optionsKey:"useYamlKeyToKeepTrackOfOldFilenameOrHeading"}),new xe({OptionsClass:Si,nameKey:"rules.yaml-title-alias.alias-helper-key.name",descriptionKey:"rules.yaml-title-alias.alias-helper-key.description",optionsKey:"aliasHelperKey"})]}};on=z([y.register],on);var ln=class{constructor(){this.defaultEscapeCharacter='"';this.titleKey="title";this.mode="first-h1-or-filename-if-h1-missing"}};z([y.noSettingControl()],ln.prototype,"fileName",2),z([y.noSettingControl()],ln.prototype,"defaultEscapeCharacter",2);var cn=class extends y{constructor(){super({nameKey:"rules.yaml-title.name",descriptionKey:"rules.yaml-title.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return ln}apply(t,i){t=Ci(t);let n="";switch(i.mode){case"filename":n=i.fileName;break;case"first-h1":n=this.getFirstH1Header(t);break;default:n=this.getFirstH1Header(t),n=n||i.fileName}return n=vi(n,i.defaultEscapeCharacter),he(t,r=>{let a=`
2023-11-09 17:30:33 +08:00
${i.titleKey}.*
2024-09-05 22:23:37 +08:00
`,s=new RegExp(a);if(s.test(r))r=r.replace(s,Qe(`
2023-11-09 17:30:33 +08:00
${i.titleKey}: ${n}
`));else{let o=r.indexOf(`
2024-06-12 15:46:38 +08:00
---`);r=At(r,o,`
2024-09-05 22:23:37 +08:00
${i.titleKey}: ${n}`)}return r})}getFirstH1Header(t){return Ee([h.code,h.math,h.yaml,h.tag],t,qs)}get optionBuilders(){return[new xe({OptionsClass:ln,nameKey:"rules.yaml-title.title-key.name",descriptionKey:"rules.yaml-title.title-key.description",optionsKey:"titleKey"}),new ee({OptionsClass:ln,nameKey:"rules.yaml-title.mode.name",descriptionKey:"rules.yaml-title.mode.description",optionsKey:"mode",records:[{value:"first-h1-or-filename-if-h1-missing",description:"Uses the first H1 in the file or the filename of the file if there is not H1"},{value:"filename",description:"Uses the filename as the title"},{value:"first-h1",description:"Uses the first H1 in the file as the title"}]})]}};cn=z([y.register],cn);var Uw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-cog">
2023-11-09 17:30:33 +08:00
<circle cx="6" cy="13" r="3"/>
<path d="m9.7 14.4-.9-.3"/>
<path d="m3.2 11.9-.9-.3"/>
<path d="m4.6 16.7.3-.9"/>
<path d="m7.6 16.7-.4-1"/>
<path d="m4.8 10.3-.4-1"/>
<path d="m2.3 14.6 1-.4"/>
<path d="m8.7 11.8 1-.4"/>
<path d="m7.4 9.3-.3.9"/>
<path d="M14 2v6h6"/>
<path d="M4 5.5V4a2 2 0 0 1 2-2h8.5L20 7.5V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-1.5"/>
2024-09-05 22:23:37 +08:00
</svg>`,Ww=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-cog">
2023-11-09 17:30:33 +08:00
<circle cx="18" cy="18" r="3"/>
<path d="M10.5 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.5"/>
<path d="m21.7 19.4-.9-.3"/>
<path d="m15.2 16.9-.9-.3"/>
<path d="m16.6 21.7.3-.9"/>
<path d="m19.1 15.2.3-.9"/>
<path d="m19.6 21.7-.4-1"/>
<path d="m16.8 15.3-.4-1"/>
<path d="m14.3 19.6 1-.4"/>
<path d="m20.7 16.8 1-.4"/>
2024-09-05 22:23:37 +08:00
</svg>`,Vw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-server-cog">
2023-11-09 17:30:33 +08:00
<circle cx="12" cy="12" r="3"/><path d="M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5"/>
<path d="M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5"/>
<path d="M6 6h.01"/><path d="M6 18h.01"/>
<path d="m15.7 13.4-.9-.3"/>
<path d="m9.2 10.9-.9-.3"/>
<path d="m10.6 15.7.3-.9"/>
<path d="m13.6 15.7-.4-1"/>
<path d="m10.8 9.3-.4-1"/>
<path d="m8.3 13.6 1-.4"/>
<path d="m14.7 10.8 1-.4"/>
<path d="m13.4 8.3-.3.9"/>
2024-09-05 22:23:37 +08:00
</svg>`,$w=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pilcrow">
2023-11-09 17:30:33 +08:00
<path d="M13 4v16"/>
<path d="M17 4v16"/>
<path d="M19 4H9.5a4.5 4.5 0 0 0 0 9H13"/>
2024-09-05 22:23:37 +08:00
</svg>`,Gw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-function-square">
2023-11-09 17:30:33 +08:00
<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/>
<path d="M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"/>
<path d="M9 11.2h5.7"/>
2024-09-05 22:23:37 +08:00
</svg>`,Qw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-gantt-chart-square">
2023-11-09 17:30:33 +08:00
<rect width="18" height="18" x="3" y="3" rx="2"/>
<path d="M9 8h7"/>
<path d="M8 12h6"/>
<path d="M11 16h5"/>
2024-09-05 22:23:37 +08:00
</svg>`,Zw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-list">
2023-11-09 17:30:33 +08:00
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
<path d="M12 11h4"/>
<path d="M12 16h4"/>
<path d="M8 11h.01"/>
<path d="M8 16h.01"/>
2024-09-05 22:23:37 +08:00
</svg>`,Jw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-plus">
2023-11-09 17:30:33 +08:00
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/>
<path d="M9 10h6"/>
<path d="M12 7v6"/>
2024-09-05 22:23:37 +08:00
</svg>`,Xw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-heading-1">
2023-11-09 17:30:33 +08:00
<path d="M4 12h8"/>
<path d="M4 18V6"/>
<path d="M12 18V6"/>
<path d="m17 12 3-2v8"/>
2024-09-05 22:23:37 +08:00
</svg>`,ek=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript">
2023-11-09 17:30:33 +08:00
<path d="m4 19 8-8"/>
<path d="m12 19-8-8"/>
<path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"/>
2024-09-05 22:23:37 +08:00
</svg>`,ik=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-code-2">
2023-11-09 17:30:33 +08:00
<path d="M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v4"/>
<polyline points="14 2 14 8 20 8"/>
<path d="m9 18 3-3-3-3"/>
<path d="m5 12-3 3 3 3"/>
2024-09-05 22:23:37 +08:00
</svg>`,tk=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings">
2023-11-09 17:30:33 +08:00
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/>
<circle cx="12" cy="12" r="3"/>
2024-09-05 22:23:37 +08:00
</svg>`,nk=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug-play">
2023-11-09 17:30:33 +08:00
<path d="m8 2 1.88 1.88"/>
<path d="M14.12 3.88 16 2"/>
<path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/>
<path d="M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5"/>
<path d="M6.53 9C4.6 8.8 3 7.1 3 5"/>
<path d="M6 13H2"/>
<path d="M3 21c0-2.1 1.7-3.9 3.8-4"/>
<path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/>
<path d="m12 12 8 5-8 5Z"/>
2024-09-05 22:23:37 +08:00
</svg>`,rk=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard">
2023-11-09 17:30:33 +08:00
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
2024-09-05 22:23:37 +08:00
</svg>`,ak=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check">
2023-11-09 17:30:33 +08:00
<polyline points="20 6 9 17 4 12"/>
2024-09-05 22:23:37 +08:00
</svg>`,Ce={folder:{id:"lint-folder",source:Ww},file:{id:"lint-file",source:Uw},vault:{id:"lint-vault",source:Vw},whitespace:{id:"lint-whitespace",source:$w},math:{id:"lint-math",source:Gw},content:{id:"lint-content",source:Qw},paste:{id:"lint-paste",source:Zw},custom:{id:"lint-custom",source:Jw},heading:{id:"lint-heading",source:Xw},footer:{id:"lint-footer",source:ek},yaml:{id:"lint-yaml",source:ik},general:{id:"lint-general",source:tk},debug:{id:"lint-debug",source:nk},clipboard:{id:"linter-clipboard",source:rk},success:{id:"linter-success",source:ak}};var Yn=require("obsidian");var ko=class{constructor(){this.disabledRules=[]}lintText(t){this.skipFile=!1;let i=t.oldText;if([this.disabledRules,this.skipFile]=$s(i),this.skipFile)return i;zt(A("logs.rule-running"));let n=A("logs.pre-rules");zt(n);let r=this.runBeforeRegularRules(t);Ji(n);let a=A("logs.disabled-text");for(let o of qi){if(this.disabledRules.includes(o.alias)){ii(o.alias+" "+a);continue}else if(o.hasSpecialExecutionOrder||o.type==="Paste")continue;[r]=mt.applyIfEnabledBase(o,r,t.settings,{fileCreatedTime:t.fileInfo.createdAtFormatted,fileModifiedTime:t.fileInfo.modifiedAtFormatted,fileName:t.fileInfo.name,locale:t.momentLocale,minimumNumberOfDollarSignsToBeAMathBlock:t.settings.commonStyles.minimumNumberOfDollarSignsToBeAMathBlock,aliasArrayStyle:t.settings.commonStyles.aliasArrayStyle,tagArrayStyle:t.settings.commonStyles.tagArrayStyle,defaultEscapeCharacter:t.settings.commonStyles.escapeCharacter,removeUnnecessaryEscapeCharsForMultiLineArrays:t.settings.commonStyles.removeUnnecessaryEscapeCharsForMultiLineArrays})}let s=A("logs.custom-regex");return zt(s),r=this.runCustomRegexReplacement(t.settings.customRegexes,r),Ji(s),t.oldText=r,this.runAfterRegularRules(i,t)}runBeforeRegularRules(t){let i=t.oldText;return[i]=Vt.applyIfEnabled(i,t.settings,this.disabledRules),[i]=Ut.applyIfEnabled(i,t.settings,this.disabledRules,{defaultEscapeCharacter:t.settings.commonStyles.escapeCharacter}),[i]=$t.applyIfEnabled(i,t.settings,this.disabledRules,{minimumNumberOfDollarSignsToBeAMathBlock:t.settings.commonStyles.minimumNumberOfDollarSignsToBeAMathBlock}),i}runAfterRegularRules(t,i){let n=i.oldText,r=A("logs.post-rules");zt(r),[n]=Ht.applyIfEnabled(n,i.settings,this.disabledRules),[n]=cn.applyIfEnabled(n,i.settings,this.disabledRules,{fileName:i.fileInfo.name,defaultEscapeCharacter:i.settings.commonStyles.escapeCharacter}),[n]=on.applyIfEnabled(n,i.settings,this.disabledRules,{fileName:i.fileInfo.name,aliasArrayStyle:i.settings.commonStyles.aliasArrayStyle,defaultEscapeCharacter:i.settings.commonStyles.escapeCharacter,removeUnnecessaryEscapeCharsForMultiLineArrays:i.settings.commonStyles.removeUnnecessaryEscapeCharsForMultiLineArrays}),[n]=jt.applyIfEnabled(n,i.settings,this.disabledRules),[n]=Wt.applyIfEnabled(n,i.settings,this.disabledRules,{defaultEscapeCharacter:i.settings.commonStyles.escapeCharacter}),[n]=an.applyIfEnabled(n,i.settings,this.disabledRules);let a=i.getCurrentTime(),s;[n,s]=ht.applyIfEnabled(n,i.settings,this.disabledRules,{fileCreatedTime:i.fileInfo.createdAtFormatted,fileModifiedTime:i.fileInfo.modifiedAtFormatted,currentTime:a,alreadyModified:t!=n,locale:i.momentLocale});let o=ht.getRuleOptions(i.settings);return a=i.getCurrentTime(),o.convertToUTC&&(a=a.utc()),[n]=sn.applyIfEnabled(n,i.settings,this.disabledRules,{currentTimeFormatted:a.format(o.format.trimEnd()),yamlTimestampDateModifiedEnabled:s&&o.dateModified,dateModifiedKey:o.dateModifiedKey}),Ji(r),Ji(A("logs.rule-running")),n}runCustomCommands(t,i){if(this.skipFile)return;ii(A("logs.running-custom-lint-command"));let n=new Set;for(let r of t){if(r.id){if(n.has(r.id)){Yi(A("logs.custom-lint-duplicate-warning").replace("{COMMAND_NAME}",r.name));continue}}else continue;try{n.add(r.id),i.executeCommandById(r.id)}catch(a){Gs(a,`${A("logs.custom-lint-error-message")} ${r.id}`)}}}runCustomRegexReplacement(t,i){return Ee([h.customIgnore],i,n=>{ii(A("logs.running-custom-regex"));let r=n,a=n;for(let s of t){let o=s.find===void 0||s.find==""||s.find===null,l=s.replace===void 0||s.replace===null;if(o
`),c+=`/${s.find}/${s.flags}/${s.replace}/`,ii(c);let d=new RegExp(`${s.find}`,s.flags);r=r.replace(d,uu(s.replace)),a!=r&&ii(r),a=r}return r})}runPasteLint(t,i,n){let r=n.oldText;return[r]=Xt.applyIfEnabled(r,n.settings,[]),[r]=nn.applyIfEnabled(r,n.settings,[]),[r]=tn.applyIfEnabled(r,n.settings,[]),[r]=Zt.applyIfEnabled(r,n.settings,[]),[r]=en.applyIfEnabled(r,n.settings,[]),[r]=Gt.applyIfEnabled(r,n.settings,[],{lineContent:t,selectedText:i}),[r]=Qt.applyIfEnabled(r,n.settings,[],{lineContent:t,selectedText:i}),[r]=Yt.applyIfEnabled(r,n.settings,[],{lineContent:t}),r}};function Ma(e,t=null,i,n){let r=t?(0,Yn.moment)(t.stat.ctime):(0,Yn.moment)();r.locale(i);let a=t?(0,Yn.moment)(t.stat.mtime):(0,Yn.moment)();a.locale(i);let s=a.format(),o=r.format();return{oldText:e,fileInfo:{name:t?t.basename:"",createdAtFormatted:o,modifiedAtFormatted:s},settings:n,momentLocale:i,getCurrentTime:()=>{let l=(0,Yn.moment)();return l.locale(i),l}}}var zo=require("obsidian");var qa=class extends zo.Modal{constructor(t,i,n,r,a,s=!1){super(t),this.modalEl.addClass("confirm-modal"),this.contentEl.createEl("h3",{text:A("warning-text")}).style.textAlign="center",s&&(this.contentEl.createEl("p",{text:A("custom-command-warning")}).style.fontWeight="bold"),this.contentEl.createEl("p",{text:i+" "+A("file-backup-text")}).id="confirm-dialog",this.contentEl.createDiv("modal-button-container",o=>{o.createEl("button",{text:A("cancel-button-text")}).addEventListener("click",()=>this.close());let l=o.createEl("button",{attr:{type:"submit"},cls:"mod-cta",text:n});l.addEventListener("click",async c=>{new zo.Notice(r),this.close(),await a()}),setTimeout(()=>{l.focus()},50)})}};var yt=require("obsidian");var wm=require("obsidian");var sk={General:Ce.general.id,Custom:Ce.custom.id,YAML:Ce.yaml.id,Heading:Ce.heading.id,Footnote:Ce.footer.id,Content:Ce.content.id,Spacing:Ce.whitespace.id,Paste:Ce.paste.id,Debug:Ce.debug.id},ok={General:"tabs.names.general",Custom:"tabs.names.custom",YAML:"tabs.names.yaml",Heading:"tabs.names.heading",Footnote:"tabs.names.footnote",Content:"tabs.names.content",Spacing:"tabs.names.spacing",Paste:"tabs.names.paste",Debug:"tabs.names.debug"},Ii=class{constructor(t,i,n,r,a){this.name=n;this.isMobile=r;this.plugin=a;this.searchSettingInfo=[];this.navButton=t.createDiv("linter-navigation-item");let s="linter-desktop";r&&(s="linter-mobile"),this.navButton.addClass(s),(0,wm.setIcon)(this.navButton.createSpan({cls:"linter-navigation-item-icon"}),sk[n]);let o=A(ok[n]);this.navButton.createSpan().setText(o),this.contentEl=i.createDiv("linter-tab-settings"),this.contentEl.id=n.toLowerCase().replace(" ","-"),this.headingEl=this.contentEl.createEl("h2",{text:o}),ci(this.headingEl)}addSettingSearchInfo(t,i="",n="",r=null,a=null){this.searchSettingInfo.push({containerEl:t,name:i.toLowerCase(),description:n.toLowerCase(),options:r,alias:a})}addSettingSearchInfoForGeneralSettings(t){this.searchSettingInfo.push({containerEl:t.containerEl,name:t.name.toLowerCase(),description:t.description.toLowerCase(),options:null,alias:null})}updateTabDisplayMode(t,i="the status is still the same"){switch(t?(this.navButton.addClass("linter-navigation-item-selected"),Mi(this.contentEl)):(this.navButton.removeClass("linter-navigation-item-selected"),ci(this.contentEl)),i){case"entering search mode by focusing on the search input box":Mi(this.contentEl),Mi(this.headingEl);for(let n of this.searchSettingInfo)Mi(n.containerEl);break;case"leaving search mode by selecting a tab":ci(this.headingEl);for(let n of this.searchSettingInfo)Mi(n.containerEl);break}}};var Em=require("obsidian");var km=require("obsidian");var Ia={ruleConfigs:{},lintOnSave:!1,recordLintOnSaveLogs:!1,displayChanged:!0,lintOnFileChange:!1,displayLintOnFileChangeNotice:!1,settingsConvertedToConfigKeyValues:!1,foldersToIgnore:[],filesToIgnore:[],linterLocale:"system-default",logLevel:"ERROR",lintCommands:[],customRegexes:[],commonStyles:{aliasArrayStyle:"single-line",tagArrayStyle:"single-line",minimumNumberOfDollarSignsToBeAMathBlock:2,escapeCharacter:'"',removeUnnecessaryEscapeCharsForMultiLineA
`," "));let p=this.contentEl.createDiv(),g=new Lo(p,this.plugin.settingsTab.component,this.plugin.settings.filesToIgnore,()=>{this.plugin.saveSettings()});this.addSettingSearchInfo(p,g.name,g.description.replaceAll(`
`," "))}};var Eo=class extends Ii{constructor(i,n,r,a,s,o){super(i,n,r,s,o);this.rules=a;this.display()}display(){for(let i of this.rules){let n=this.contentEl.createDiv();n.id=i.alias,n.createEl(this.isMobile?"h4":"h3",{},a=>{a.innerHTML=`<a href="${i.getURL()}">${i.getName()}</a>`});let r=[];for(let a of i.options)a.display(n,this.plugin.settings,this.plugin),r.push(a.getSearchInfo());this.addSettingSearchInfo(n,i.getName().toLowerCase(),i.getDescription().toLowerCase(),r,n.id)}}};var Cm=require("obsidian");var Fa=class extends dt{constructor(i,n,r=[]){super(i,n);this.app=i;this.inputEl=n;this.valuesToExclude=r}getSuggestions(i){let n=this.app.commands.listCommands();if(!n)return[];let r=n.filter(o=>{for(let l of this.valuesToExclude)if(l.id==o.id&&!(this.inputEl.hasAttribute("commandId")&&this.inputEl.getAttribute("commandId")==o.id))return!1;return!0}),a=[],s=i.toLowerCase();return r.forEach(o=>{(o.id.contains(s)||o.name.toLowerCase().contains(s))&&a.push(o)}),a}renderSuggestion(i,n){n.setText(i.name)}selectSuggestion(i){this.inputEl.value=i.name,this.inputEl.setAttribute("commandId",i.id),this.inputEl.trigger("input"),this.close()}};var Co=class extends di{constructor(i,n,r,a,s){super(i,n,A("options.custom-command.name"),A("options.custom-command.description"),A("options.custom-command.warning"),A("options.custom-command.add-input-button-text"),s,()=>{let o={id:"",name:""};this.lintCommands.push(o),this.saveSettings(),this.addCommand(o,this.lintCommands.length-1,!0)});this.lintCommands=r;this.app=a;this.display()}showInputEls(){this.lintCommands.forEach((i,n)=>{this.addCommand(i,n)})}addCommand(i,n,r=!1){new Cm.Setting(this.inputElDiv).addSearch(a=>{new Fa(this.app,a.inputEl,this.lintCommands),a.setPlaceholder(A("options.custom-command.command-search-placeholder-text")).setValue(i.name).onChange(s=>{let o={id:a.inputEl.getAttribute("commandId"),name:s};o.name&&o.id?(this.lintCommands[n]=o,this.saveSettings()):!o.name&&!o.id&&(this.lintCommands[n]=o,this.saveSettings())}),a.inputEl.setAttr("tabIndex",n),a.inputEl.addClass("linter-custom-command"),r&&a.inputEl.focus()}).addExtraButton(a=>{a.setIcon("up-chevron-glyph").setTooltip(A("options.custom-command.move-up-tooltip")).onClick(()=>{this.arrayMove(n,n-1),this.saveSettings(),this.resetInputEls()})}).addExtraButton(a=>{a.setIcon("down-chevron-glyph").setTooltip(A("options.custom-command.move-down-tooltip")).onClick(()=>{this.arrayMove(n,n+1),this.saveSettings(),this.resetInputEls()})}).addExtraButton(a=>{a.setIcon("cross").setTooltip(A("options.custom-command.delete-tooltip")).onClick(()=>{this.lintCommands.splice(n,1),this.saveSettings(),this.resetInputEls()})})}arrayMove(i,n){if(n<0||n===this.lintCommands.length)return;let r=this.lintCommands[i];this.lintCommands[i]=this.lintCommands[n],this.lintCommands[n]=r}};var jc=require("obsidian");var ck="gm",Oo=class extends di{constructor(i,n,r,a){super(i,n,A("options.custom-replace.name"),A("options.custom-replace.description"),A("options.custom-replace.warning"),A("options.custom-replace.add-input-button-text"),a,()=>{let s={label:"",find:"",replace:"",flags:ck};this.regexes.push(s),this.saveSettings(),this.addRegex(s,this.regexes.length-1,!0)});this.regexes=r;this.display(),this.inputElDiv.addClass("linter-custom-regex-replacement-container")}showInputEls(){this.regexes.forEach((i,n)=>{this.addRegex(i,n)})}addRegex(i,n,r=!1){let a=this.inputElDiv.createDiv({cls:"linter-custom-regex-replacement"}),s=a.createDiv(),o=new jc.Setting(s).addText(d=>{d.setPlaceholder(A("options.custom-replace.label-placeholder-text")).setValue(i.label).onChange(u=>{this.regexes[n].label=u,this.saveSettings()}),d.inputEl.setAttr("inputIndex",n),d.inputEl.addClass("linter-custom-regex-replacement-label-input"),r&&d.inputEl.focus()});o.controlEl.addClass("linter-custom-regex-replacement-label"),o.descEl.remove(),o.infoEl.remove(),o.nameEl.remove();let l=a.createDiv();new jc.Setting(l).addText(d=>{d.setPlaceholder(A("options.custom-replace.regex-to-find-placeholder-text")).setValue(i.find).onChange(u=>{this.regexes[n].find=u,this.saveSettings()})
2023-11-09 17:30:33 +08:00
`," ")+n.warning.replaceAll(`
2024-09-05 22:23:37 +08:00
`," "));let r=this.contentEl.createDiv(),a=new Oo(r,this.plugin.settingsTab.component,this.plugin.settings.customRegexes,()=>{this.plugin.saveSettings()});this.addSettingSearchInfo(r,a.name,a.description.replaceAll(`
2023-11-09 17:30:33 +08:00
`," ")+a.warning.replaceAll(`
2024-09-05 22:23:37 +08:00
`," "))}};var Om=require("obsidian");var qo=class{constructor(t,i,n,r){this.containerEl=t;this.searchZeroState=i;this.tabNameToTab=n;this.onFocus=r;this.searchSettingInfo=new Map;for(let[a,s]of n)this.searchSettingInfo.set(a,s.searchSettingInfo);this.display()}display(){let t=new Om.Setting(this.containerEl);t.settingEl.style.border="none",t.addSearch(i=>{this.search=i}),this.search.setPlaceholder(A("tabs.default-search-bar-text")),this.search.inputEl.onfocus=()=>{this.onFocus()},this.search.onChange(i=>{this.searchSettings(i.toLowerCase())})}searchSettings(t){let i=new Set,n=function(r,a){Mi(r),i.has(a)||i.add(a)};for(let[r,a]of this.searchSettingInfo)for(let s of a)if(t.trim()===""||s.alias?.includes(t)||s.description.includes(t)||s.name.includes(t))n(s.containerEl,r);else if(s.options)for(let o of s.options){if(o.description.toLowerCase().includes(t)||o.name.toLowerCase().includes(t)){n(s.containerEl,r);break}else if(o.options){for(let l of o.options)if(l.description.toLowerCase().includes(t)||l.value.toLowerCase().includes(t)){n(s.containerEl,r);break}}ci(s.containerEl)}else ci(s.containerEl);for(let[r,a]of this.tabNameToTab)i.has(r)?Mi(a.headingEl):ci(a.headingEl);i.size===0?Mi(this.searchZeroState):ci(this.searchZeroState)}focusOnInput(){this.search.inputEl.focus()}};var Mm=gn(Za());var Pn=require("obsidian");var Ra=class{constructor(t,i,n,r=!0){this.containerEl=t;this.name=i;this.description=n;this.disabled=r;this.display()}display(){let t=this.containerEl.createDiv(),i=t.createDiv("setting-item-info");this.nameEl=i.createDiv("setting-item-name"),this.nameEl.setText(this.name),this.descEl=i.createDiv("setting-item-description"),this.descEl.setText(this.description),this.inputContainerEl=t.createDiv("full-width-textbox-input-wrapper"),this.inputContainerEl.onmouseover=()=>{this.getInput().trim()!=""&&this.copyEl.removeClass("linter-visually-hidden")},this.inputContainerEl.onmouseleave=()=>{this.copyEl.addClass("linter-visually-hidden")},this.inputEl=this.inputContainerEl.createEl("textarea",{cls:"full-width"}),this.inputEl.spellcheck=!1,this.inputEl.disabled=this.disabled,this.copyEl=this.inputContainerEl.createDiv({cls:"settings-copy-button linter-visually-hidden ",attr:{"aria-label":A("copy-aria-label")}}),this.copyIconEl=this.copyEl.createSpan(),(0,Pn.setIcon)(this.copyIconEl,"linter-clipboard"),this.copyIconEl.onclick=()=>{this.handleCopy(this.copyIconEl)}}getInput(){return this.inputEl.value}handleCopy(t){navigator.clipboard.writeText(this.getInput()).then(()=>{(0,Pn.setIcon)(t,"linter-success"),setTimeout(()=>{(0,Pn.setIcon)(t,"linter-clipboard")},1500)},i=>{new Pn.Notice(`${A("notice-text.copy-to-clipboard-failed")+i}`,0)})}};var dk=Object.keys(Mm.default.levels),Io=class extends Ii{constructor(t,i,n,r){super(t,i,"Debug",n,r),this.display()}display(){let t=this.contentEl.createDiv(),i={isForEnum:!0,values:dk,descriptions:[]};this.addSettingSearchInfoForGeneralSettings(new $i(t,"tabs.debug.log-level.name","tabs.debug.log-level.description","logLevel",this.plugin,i,async()=>{is(this.plugin.settings.logLevel)})),t=this.contentEl.createDiv();let n=A("tabs.debug.linter-config.name"),r=A("tabs.debug.linter-config.description");new Ra(t,n,r).inputEl.setText(JSON.stringify(this.plugin.settings,null,2)),this.addSettingSearchInfo(t,n,r),t=this.contentEl.createDiv(),this.addSettingSearchInfoForGeneralSettings(new Bi(t,"tabs.debug.log-collection.name","tabs.debug.log-collection.description","recordLintOnSaveLogs",this.plugin)),t=this.contentEl.createDiv(),n=A("tabs.debug.linter-logs.name"),r=A("tabs.debug.linter-logs.description");let s=new Ra(t,n,"");s.inputEl.setText(Xa.join(`
`)),Oi(r,s.descEl,this.plugin.settingsTab.component),this.addSettingSearchInfo(t,n,r)}};var Bo=class extends yt.PluginSettingTab{constructor(i,n){super(i,n);this.plugin=n;this.tabNameToTab=new Map;this.selectedTab="General";this.component=new yt.Component}display(){let{containerEl:i}=this;this.component.load(),i.empty();let n=i.createDiv("linter-setting-title");yt.Platform.isMobile?n.addClass("linter-mobile"):n.createEl("h1").setText(A("linter-title")),this.navContainer=i.createEl("nav",{cls:"linter-setting-header"}),this.tabNavEl=this.navContainer.createDiv("linter-setting-tab-group"),this.settingsContentEl=i.createDiv("linter-setting-content"),this.addTabs(yt.Platform.isMobile),this.createSearchZeroState(yt.Platform.isMobile),this.generateSearchBar(n),this.selectedTab==""&&this.tabSearcher.focusOnInput()}hide(){this.component.unload()}addTabs(i){this.addTab(new To(this.tabNavEl,this.settingsContentEl,i,this.plugin,this.app));for(let n of Object.values(R))this.addTab(new Eo(this.tabNavEl,this.settingsContentEl,n,Nt.get(n),i,this.plugin));this.addTab(new Mo(this.tabNavEl,this.settingsContentEl,i,this.app,this.plugin)),this.addTab(new Io(this.tabNavEl,this.settingsContentEl,i,this.plugin))}generateSearchBar(i){this.tabSearcher=new qo(i,this.searchZeroState,this.tabNameToTab,()=>{for(let n of this.tabNameToTab.values()){n.updateTabDisplayMode(!1,"entering search mode by focusing on the search input box");let r=this.tabSearcher.search.getValue();this.selectedTab==""&&r.trim()!=""&&this.tabSearcher.searchSettings(r.toLowerCase()),this.selectedTab=""}})}createSearchZeroState(i){this.searchZeroState=this.settingsContentEl.createDiv(),ci(this.searchZeroState),this.searchZeroState.createEl(i?"h3":"h2",{text:A("empty-search-results-text")}).style.textAlign="center"}addTab(i){i.navButton.onclick=()=>{this.onTabClick(i.name)},i.updateTabDisplayMode(this.selectedTab===i.name,"the status is still the same"),this.tabNameToTab.set(i.name,i)}onTabClick(i){if(this.selectedTab!==i){if(this.selectedTab=="")for(let[n,r]of this.tabNameToTab)r.updateTabDisplayMode(n===i,"leaving search mode by selecting a tab");else ci(this.searchZeroState),this.tabNameToTab.get(i).updateTabDisplayMode(!0),this.tabNameToTab.get(this.selectedTab).updateTabDisplayMode(!1);this.selectedTab=i}}};var Im=require("obsidian");var uk=/^---\n/gm,qm=`${Sn}:`,Fo=class extends Im.EditorSuggest{constructor(i){super(i.app);this.plugin=i;this.inline=!1;let n=A("all-rules-option");this.ruleInfo=[{displayName:n,name:n.toLowerCase(),alias:"all"}];for(let r of qi){let a=r.getName();this.ruleInfo.push({displayName:a,name:a.toLowerCase(),alias:r.alias})}}onTrigger(i,n,r){let a=n.getLine(i.line).toLowerCase();if(a.startsWith(qm)||this.disabledRulesIsEndOfStartOfFileToCursor(n.getRange({line:0,ch:0},i))){this.inline=a.startsWith(qm);let o=n.getLine(i.line).substring(0,i.ch),l=o.match(/(\S+)$/)?.first().replaceAll("[","").replaceAll("]","");if(l)return{end:i,start:{ch:o.lastIndexOf(l),line:i.line},query:l}}return null}getSuggestions(i){let[n,r]=$s(i.editor.getValue());if(r)return[];let a=i.query.toLowerCase();return this.ruleInfo.filter(o=>(o.name.contains(a)||o.alias.contains(a))&&!n.includes(o.alias))}renderSuggestion(i,n){n.addClass("mod-complex");let r=n.createDiv({cls:"suggestion-content"});r.createDiv({cls:"suggestion-title"}).setText(`${i.displayName}`),r.createDiv({cls:"suggestion-note"}).setText(`${i.alias}`)}selectSuggestion(i){if(this.context){let n=i.alias;this.inline?n=`${n},`:n=`${n}
-`,this.context.editor.replaceRange(`${n} `,this.context.start,this.context.end)}}disabledRulesIsEndOfStartOfFileToCursor(i){if(!i||!i.length||i.match(uk)?.length!=1)return!1;let n=de(i+`
`,Sn)?.trimEnd();return n===null?!1:i.trimEnd().endsWith(n)}};var Km=gn(Dm()),_m=gn(Za()),pk={en:"en-gb",zh:"zh-cn","zh-TW":"zh-tw",ru:"ru",ko:"ko",it:"it",id:"id",ro:"ro","pt-BR":"pt-br",cz:"cs",da:"da",de:"de",es:"es",fr:"fr",no:"nn",pl:"pl",pt:"pt",tr:"tr",hi:"hi",nl:"nl",ar:"ar",ja:"ja"},bt=0,Do=class extends X.Plugin{constructor(){super(...arguments);this.eventRefs=[];this.isEnabled=!0;this.rulesRunner=new ko;this.overridePaste=!1;this.hasCustomCommands=!1;this.hasLoadedFiles=!1;this.customCommandsLock=new Km.default;this.originalSaveCallback=null;this.editorLintFiles=[];this.fileLintFiles=new Set;this.customCommandsCallback=null;this.currentlyOpeningSidebar=!1}async onload(){rs(window.localStorage.getItem("language")),vn(A("logs.plugin-load")),this.isEnabled=!0;for(let i in Ce){let n=Ce[i];(0,X.addIcon)(n.id,n.source)}await this.loadSettings(),this.addCommands(),this.registerEventsAndSaveCallback(),this.registerEditorSuggest(new Fo(this)),this.settingsTab=new Bo(this.app,this),this.addSettingTab(this.settingsTab)}async onunload(){vn(A("logs.plugin-unload")),this.isEnabled=!1;for(let n of this.eventRefs)this.app.workspace.offref(n);let i=this.app.commands?.commands?.["editor:save-file"];i&&i.callback&&this.originalSaveCallback&&(i.callback=this.originalSaveCallback)}async loadSettings(){let i=await this.loadData();this.settings=Object.assign({},Ia,i),typeof this.settings.logLevel=="number"&&(this.settings.logLevel=Dd(this.settings.logLevel)),is(this.settings.logLevel),this.setOrUpdateMomentInstance(),this.settings.settingsConvertedToConfigKeyValues||this.moveConfigValuesToKeyBasedFormat();for(let n of qi)if(this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]=n.getDefaultOptions()),n.alias=="space-between-chinese-japanese-or-korean-and-english-or-numbers"){let r=n.getDefaultOptions();"english-symbols-punctuation-before"in this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]["english-symbols-punctuation-before"]=r["english-symbols-punctuation-before"]),"english-symbols-punctuation-after"in this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]["english-symbols-punctuation-after"]=r["english-symbols-punctuation-after"])}this.updatePasteOverrideStatus(),this.updateHasCustomCommandStatus()}async saveSettings(){await this.saveData(this.settings),this.updatePasteOverrideStatus(),this.updateHasCustomCommandStatus()}addCommands(){let i=this;this.addCommand({id:"lint-file",name:A("commands.lint-file.name"),editorCheckCallback(n,r,a){if(n)return i.isMarkdownFile(a.file);i.runLinterEditor(r)},icon:Ce.file.id,hotkeys:[{modifiers:["Mod","Alt"],key:"L"}]}),this.addCommand({id:"lint-file-unless-ignored",name:A("commands.lint-file-unless-ignored.name"),editorCheckCallback(n,r,a){if(n)return i.isMarkdownFile(a.file);i.shouldIgnoreFile(a.file)||i.runLinterEditor(r)},icon:Ce.file.id}),this.addCommand({id:"lint-all-files",name:A("commands.lint-all-files.name"),icon:Ce.vault.id,callback:()=>{let n=A("commands.lint-all-files.start-message"),r=A("commands.lint-all-files.submit-button-text"),a=A("commands.lint-all-files.submit-button-notice-text");new qa(this.app,n,r,a,()=>this.runLinterAllFiles(this.app),this.settings.lintCommands&&this.settings.lintCommands.length>0).open()}}),this.addCommand({id:"lint-all-files-in-folder",name:A("commands.lint-all-files-in-folder.name"),icon:Ce.folder.id,editorCheckCallback:(n,r,a)=>{if(n)return!a.file.parent.isRoot();this.createFolderLintModal(a.file.parent)}}),this.addCommand({id:"paste-as-plain-text",name:A("commands.paste-as-plain-text.name"),editorCheckCallback:(n,r)=>{if(n)return this.overridePaste;this.pasteAsPlainText(r)}})}registerEventsAndSaveCallback(){let i=this.app.workspace.on("editor-paste",a=>{a.defaultPrevented||!this.overridePaste||this.modifyPasteEvent(a)});this.registerEvent(i),this.eventRefs.push(i),i=this.app.workspace.on("file-menu",(a,s,o)=>this.onMenuOpenCallback(a,s,o)),this.registerEvent(i),this.eventRefs.push(i),this.lastActiveFile=this.app.workspace.getActiveFile(),i=this.app.workspace.on("active-leaf-change",()=>this.o
${b.frontmatter}---`:(f=b.frontmatter,x+=3),i.replaceRange(f,i.offsetToPos(g.from),i.offsetToPos(g.to)),d=g.from+f.length+x}}let u=!1;l.forEach(g=>{let[b,f]=g;if(u=c.length<d,u&&c.length+f.length>=d&&b==vt.default.DIFF_INSERT){let x=d-c.length;c+=f.substring(0,x),f=f.substring(x),u=!1}if(!u){if(b==vt.default.DIFF_INSERT)i.replaceRange(f,this.endOfDocument(c));else if(b==vt.default.DIFF_DELETE){let x=this.endOfDocument(c),k=c;k+=f;let L=this.endOfDocument(k);i.replaceRange("",x,L)}}b!=vt.default.DIFF_DELETE&&(c+=f)});let m=l.map(g=>g[0]==vt.default.DIFF_INSERT?g[1].length:0).reduce((g,b)=>g+b,0),p=l.map(g=>g[0]==vt.default.DIFF_DELETE?g[1].length:0).reduce((g,b)=>g+b,0);this.displayChangedMessage(m,p),!m&&!p?this.runCustomCommands(n):this.editorLintFiles.push(n),nl(!1)}async setOrUpdateMomentInstance(){let i=localStorage.getItem("language")||"en",n=navigator.language?.toLowerCase(),r=pk[i];this.settings.linterLocale!=="system-default"?r=this.settings.linterLocale:n.startsWith(i)&&(r=n),this.momentLocale=r;let a=Ro.moment.locale(),s=Ro.moment.locale(r);ii(A("logs.moment-locale-not-found").replace("{MOMENT_LOCALE}",r).replace("{CURRENT_LOCALE}",s)),Ro.moment.locale(a)}displayChangedMessage(i,n){if(this.settings.displayChanged){let r=dm`
${i} ${A("notice-text.characters-added")}
${n} ${A("notice-text.characters-removed")}
`;new X.Notice(r)}}handleLintError(i,n,r,a=!0){let s=r.replace("{FILE_PATH}",i.path),o=A("logs.see-console");n instanceof Rn?a?new X.Notice(`${s} ${n.message}.
${o}`,bt):new X.Notice(`${n.message}.
${o}`,bt):new X.Notice(`${A("logs.unknown-error")} ${o}`,bt),Fd(s,n)}async modifyPasteEvent(i){let n=this.getEditor();if(!n)return;let r=i.clipboardData.getData("text/plain");if(!r)return;let a=r.trim();if(Ct.test(a)){console.log('failed: "'+a+'"'),Yi(A("logs.paste-link-warning"));return}if(console.log('passed: "'+a+'"'),i.stopPropagation(),i.preventDefault(),!i.defaultPrevented)return;let s=this.app.vault.getConfig("autoConvertHtml"),o=i.clipboardData.getData("text/html"),l=o&&s?(0,X.htmlToMarkdown)(o):r,c=n.listSelections();if(c.length===1){let d=c[0];l=this.rulesRunner.runPasteLint(this.getLineContent(n,d),n.getSelection()??"",Ma(l,null,this.momentLocale,this.settings)),n.replaceSelection(l)}else this.handleMultiCursorPaste(n,c,l)}handleMultiCursorPaste(i,n,r){let a=this.convertContentIntoProperPasteContent(n,r),s=[];n.forEach((o,l)=>{r=this.rulesRunner.runPasteLint(this.getLineContent(i,o),i.getRange(o.anchor,o.head)??"",Ma(a[l],null,this.momentLocale,this.settings)),s.push({text:r,from:o.anchor,to:o.head})}),i.transaction({changes:s})}convertContentIntoProperPasteContent(i,n){let r=n.split(`
`),a=[];if(r.length%i.length!==0)for(let s=0;s<i.length;s++)a.push(n);else{let s=r.length/i.length,o="";for(let l=0;l<r.length;l++)o+=r[l],(l+1===i.length||(l+1)%s===0)&&(a.push(o),o="")}return a}async pasteAsPlainText(i){let n=await navigator.clipboard.readText();if(!n){new X.Notice(A("notice-text.empty-clipboard"),bt);return}i.replaceSelection(n)}setCustomCommandCallback(i){(0,_m.warn)(A("logs.custom-command-callback-warning")),this.customCommandsCallback=i}async runCustomCommandsInSidebar(i){if(!this.settings.lintCommands||this.settings.lintCommands.length==0||!this.hasCustomCommands)return;let n=this.app.workspace.getRightLeaf(!1),r=this.getEditor();await this.customCommandsLock.acquire("command",async()=>{this.currentlyOpeningSidebar=!0,await n.openFile(i),this.rulesRunner.runCustomCommands(this.settings.lintCommands,this.app.commands),this.customCommandsCallback&&await this.customCommandsCallback(i)}),n.detach(),r&&r.focus(),this.currentlyOpeningSidebar=!1}async runCustomCommands(i){!this.settings.lintCommands||this.settings.lintCommands.length==0||!this.hasCustomCommands||await this.customCommandsLock.acquire("command",async()=>{try{this.rulesRunner.runCustomCommands(this.settings.lintCommands,this.app.commands)}catch(n){this.handleLintError(i,n,A("commands.lint-file.error-message")+" '{FILE_PATH}'",!1)}this.customCommandsCallback&&await this.customCommandsCallback(i)})}getEditor(){let i=this.app.workspace.getActiveViewOfType(X.MarkdownView);return i?i.editor:null}getCurrentMode(){let i=this.app.workspace.getActiveFileView();if(!i)return;let n=i.getState();return Object.hasOwn(n,"source")?n.source?"source":"preview":null}getLineContent(i,n){return i.getLine(n.anchor.line)}moveConfigValuesToKeyBasedFormat(){rs("en");for(let i of qi){let n=A("rules."+i.alias+".name"),r=this.settings.ruleConfigs[n];if(r!=null){let a=A("rules."+i.alias+".description"),s={enabled:r[a]??!1};for(let o of i.options){if(o.configKey==="enabled")continue;let l=A("rules."+i.alias+"."+o.configKey+".name");s[o.configKey]=r[l]??o.defaultValue}this.settings.ruleConfigs[i.alias]=s,delete this.settings.ruleConfigs[n]}}this.settings.settingsConvertedToConfigKeyValues=!0,this.saveSettings(),rs(window.localStorage.getItem("language"))}getAllFilesInFolder(i){let n=[],r=[i];for(let a of r)for(let s of a.children)s instanceof X.TFile&&this.isMarkdownFile(s)?n.push(s):s instanceof X.TFolder&&r.push(s);return n}updatePasteOverrideStatus(){for(let i of Nt.get("Paste"))if(i.getOptions(this.settings).enabled){this.overridePaste=!0;return}this.overridePaste=!1}updateHasCustomCommandStatus(){for(let i of this.settings.lintCommands)if(i.id&&i.id.trim()!=""){this.hasCustomCommands=!0;return}this.hasCustomCommands=!1}endOfDocument(i){let n=i.split(`
`);return{line:n.length-1,ch:n[n.length-1].length}}async loadCustomReplacements(){for(let i of this.settings.ruleConfigs["auto-correct-common-misspellings"]["extra-auto-correct-files"]??[])if(i.filePath!=""){let n=this.getFileFromPath(i.filePath);n&&(i.customReplacements=ds(nr(await this.app.vault.cachedRead(n))))}this.hasLoadedFiles=!0}getFileFromPath(i){let n=this.app.vault.getAbstractFileByPath((0,X.normalizePath)(i));return n instanceof X.TFile?n:null}};
2023-11-09 17:30:33 +08:00
/*! Bundled license information:
js-yaml/dist/js-yaml.mjs:
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
*/