Files
WorkNote/.obsidian/plugins/consistent-attachments-and-links/main.js

151 lines
250 KiB
JavaScript
Raw Normal View History

2025-01-13 11:22:31 +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
*/
2025-03-03 19:56:35 +08:00
(function initCjs() {
const globalThisRecord = globalThis;
globalThisRecord["__name"] ??= name;
const originalRequire = require;
if (originalRequire && !originalRequire.__isPatched) {
require = Object.assign(
(id) => requirePatched(id),
originalRequire,
{
__isPatched: true
}
);
}
const newFuncs = {
__extractDefault: () => extractDefault,
process: () => {
const browserProcess = {
browser: true,
cwd: () => "/",
env: {},
platform: "android"
};
return browserProcess;
}
};
for (const key of Object.keys(newFuncs)) {
globalThisRecord[key] ??= newFuncs[key]?.();
}
function name(obj) {
return obj;
}
function extractDefault(module2) {
2025-01-13 11:22:31 +08:00
return module2 && module2.__esModule && module2.default ? module2.default : module2;
}
2025-03-03 19:56:35 +08:00
function requirePatched(id) {
const module2 = originalRequire?.(id);
if (module2) {
return extractDefault(module2);
}
if (id === "process" || id === "node:process") {
console.error(`Module not found: ${id}. Fake process object is returned instead.`);
return globalThis.process;
}
console.error(`Module not found: ${id}. Empty object is returned instead.`);
return {};
}
})();
2025-01-13 11:22:31 +08:00
2025-03-03 19:56:35 +08:00
"use strict";var pp=Object.create;var ri=Object.defineProperty;var gp=Object.getOwnPropertyDescriptor;var wp=Object.getOwnPropertyNames;var kp=Object.getPrototypeOf,yp=Object.prototype.hasOwnProperty;var Xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),bl=(e,t)=>{for(var n in t)ri(e,n,{get:t[n],enumerable:!0})},vl=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of wp(t))!yp.call(e,o)&&o!==n&&ri(e,o,{get:()=>t[o],enumerable:!(i=gp(t,o))||i.enumerable});return e};var je=(e,t,n)=>(n=e!=null?pp(kp(e)):{},vl(t||!e||!e.__esModule?ri(n,"default",{value:e,enumerable:!0}):n,e)),xp=e=>vl(ri({},"__esModule",{value:!0}),e);var Al=Xe((cy,Tl)=>{"use strict";function kt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function El(e,t){for(var n="",i=0,o=-1,s=0,l,u=0;u<=e.length;++u){if(u<e.length)l=e.charCodeAt(u);else{if(l===47)break;l=47}if(l===47){if(!(o===u-1||s===1))if(o!==u-1&&s===2){if(n.length<2||i!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var f=n.lastIndexOf("/");if(f!==n.length-1){f===-1?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),o=u,s=0;continue}}else if(n.length===2||n.length===1){n="",i=0,o=u,s=0;continue}}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,u):n=e.slice(o+1,u),i=u-o-1;o=u,s=0}else l===46&&s!==-1?++s:s=-1}return n}function Sp(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+e+i:i}var Mn={resolve:function(){for(var t="",n=!1,i,o=arguments.length-1;o>=-1&&!n;o--){var s;o>=0?s=arguments[o]:(i===void 0&&(i=process.cwd()),s=i),kt(s),s.length!==0&&(t=s+"/"+t,n=s.charCodeAt(0)===47)}return t=El(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(t){if(kt(t),t.length===0)return".";var n=t.charCodeAt(0)===47,i=t.charCodeAt(t.length-1)===47;return t=El(t,!n),t.length===0&&!n&&(t="."),t.length>0&&i&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return kt(t),t.length>0&&t.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var t,n=0;n<arguments.length;++n){var i=arguments[n];kt(i),i.length>0&&(t===void 0?t=i:t+="/"+i)}return t===void 0?".":Mn.normalize(t)},relative:function(t,n){if(kt(t),kt(n),t===n||(t=Mn.resolve(t),n=Mn.resolve(n),t===n))return"";for(var i=1;i<t.length&&t.charCodeAt(i)===47;++i);for(var o=t.length,s=o-i,l=1;l<n.length&&n.charCodeAt(l)===47;++l);for(var u=n.length,f=u-l,m=s<f?s:f,h=-1,p=0;p<=m;++p){if(p===m){if(f>m){if(n.charCodeAt(l+p)===47)return n.slice(l+p+1);if(p===0)return n.slice(l+p)}else s>m&&(t.charCodeAt(i+p)===47?h=p:p===0&&(h=0));break}var w=t.charCodeAt(i+p),k=n.charCodeAt(l+p);if(w!==k)break;w===47&&(h=p)}var v="";for(p=i+h+1;p<=o;++p)(p===o||t.charCodeAt(p)===47)&&(v.length===0?v+="..":v+="/..");return v.length>0?v+n.slice(l+h):(l+=h,n.charCodeAt(l)===47&&++l,n.slice(l))},_makeLong:function(t){return t},dirname:function(t){if(kt(t),t.length===0)return".";for(var n=t.charCodeAt(0),i=n===47,o=-1,s=!0,l=t.length-1;l>=1;--l)if(n=t.charCodeAt(l),n===47){if(!s){o=l;break}}else s=!1;return o===-1?i?"/":".":i&&o===1?"//":t.slice(0,o)},basename:function(t,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');kt(t);var i=0,o=-1,s=!0,l;if(n!==void 0&&n.length>0&&n.length<=t.length){if(n.length===t.length&&n===t)return"";var u=n.length-1,f=-1;for(l=t.length-1;l>=0;--l){var m=t.charCodeAt(l);if(m===47){if(!s){i=l+1;break}}else f===-1&&(s=!1,f=l+1),u>=0&&(m===n.charCodeAt(u)?--u===-1&&(o=l):(u=-1,o=f))}return i===o?o=f:o===-1&&(o=t.length),t.slice(i,o)}else{for(l=t.length-1;l>=0;--l)if(t.charCodeAt(l)===47){if(!s){i=l+1;break}}else o===-1&&(s=!1,o=l+1);return o===-1?"":t.slice(i,o)}},extname:function(t){kt(t);for(var n=-1,i=0,o=-1,s=!0,l=0,u=t.length-1;u>=0;--u){var f=t.charCodeAt(u);if(f===47){if(!s){i=u+1;break}continue}o===-1&&(s=!1,o=u+1),f===46?n===-1?n=u:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||o===-1||l===0||l===1&&n===o-1&&n===i+1?"":t.slice(n,o)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathO
2025-01-13 11:22:31 +08:00
`).join(`
2025-03-03 19:56:35 +08:00
`+s),e.push(o+"m+"+hi.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Kp()+t+" "+e[0]}function Kp(){return be.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Xp(...e){return process.stderr.write(di.formatWithOptions(be.inspectOpts,...e)+`
`)}function eg(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function tg(){return process.env.DEBUG}function ng(e){e.inspectOpts={};let t=Object.keys(be.inspectOpts);for(let n=0;n<t.length;n++)e.inspectOpts[t[n]]=be.inspectOpts[t[n]]}hi.exports=cs()(be);var{formatters:eu}=hi.exports;eu.o=function(e){return this.inspectOpts.colors=this.useColors,di.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};eu.O=function(e){return this.inspectOpts.colors=this.useColors,di.inspect(e,this.inspectOpts)}});var nu=Xe((Ny,hs)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?hs.exports=ql():hs.exports=tu()});var gu=Xe((xi,pu)=>{(function(e,t){typeof xi=="object"&&typeof pu<"u"?t(xi):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.compareVersions={}))})(xi,function(e){"use strict";let t=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,n=T=>{if(typeof T!="string")throw new TypeError("Invalid argument expected string");let C=T.match(t);if(!C)throw new Error(`Invalid argument not valid semver ('${T}' received)`);return C.shift(),C},i=T=>T==="*"||T==="x"||T==="X",o=T=>{let C=parseInt(T,10);return isNaN(C)?T:C},s=(T,C)=>typeof T!=typeof C?[String(T),String(C)]:[T,C],l=(T,C)=>{if(i(T)||i(C))return 0;let[A,P]=s(o(T),o(C));return A>P?1:A<P?-1:0},u=(T,C)=>{for(let A=0;A<Math.max(T.length,C.length);A++){let P=l(T[A]||"0",C[A]||"0");if(P!==0)return P}return 0},f=(T,C)=>{let A=n(T),P=n(C),Y=A.pop(),B=P.pop(),_=u(A,P);return _!==0?_:Y&&B?u(Y.split("."),B.split(".")):Y||B?Y?-1:1:0},m=(T,C,A)=>{w(A);let P=f(T,C);return h[A].includes(P)},h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},p=Object.keys(h),w=T=>{if(typeof T!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof T}`);if(p.indexOf(T)===-1)throw new Error(`Invalid operator, expected one of ${p.join("|")}`)},k=(T,C)=>{if(C=C.replace(/([><=]+)\s+/g,"$1"),C.includes("||"))return C.split("||").some(ee=>k(T,ee));if(C.includes(" - ")){let[ee,ue]=C.split(" - ",2);return k(T,`>=${ee} <=${ue}`)}else if(C.includes(" "))return C.trim().replace(/\s{2,}/g," ").split(" ").every(ee=>k(T,ee));let A=C.match(/^([<>=~^]+)/),P=A?A[1]:"=";if(P!=="^"&&P!=="~")return m(T,C,P);let[Y,B,_,,J]=n(T),[j,G,ne,,oe]=n(C),X=[Y,B,_],N=[j,G??"x",ne??"x"];if(oe&&(!J||u(X,N)!==0||u(J.split("."),oe.split("."))===-1))return!1;let H=N.findIndex(ee=>ee!=="0")+1,W=P==="~"?2:H>1?H:1;return!(u(X.slice(0,W),N.slice(0,W))!==0||u(X.slice(W),N.slice(W))===-1)},v=T=>typeof T=="string"&&/^[v\d]/.test(T)&&t.test(T),F=T=>typeof T=="string"&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(T);e.compare=m,e.compareVersions=f,e.satisfies=k,e.validate=v,e.validateStrict=F})});var jc=Xe((L1,$c)=>{"use strict";var $i=Object.prototype.hasOwnProperty,Vc=Object.prototype.toString,Yc=Object.defineProperty,Wc=Object.getOwnPropertyDescriptor,zc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Vc.call(t)==="[object Array]"},Bc=function(t){if(!t||Vc.call(t)!=="[object Object]")return!1;var n=$i.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&$i.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;var o;for(o in t);return typeof o>"u"||$i.call(t,o)},Hc=function(t,n){Yc&&n.name==="__proto__"?Yc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Uc=function(t,n){if(n==="__proto__")if($i.call(t,n)){if(Wc)return Wc(t,n).value}else return;return t[n]};$c.exports=function e(){var t,n,i,o,s,l,u=arguments[0],f=1,m=arguments.length,h=!1;for(typeof u=="boolean"&&(h=u,u=arguments[1]||{},f=2),(u==null||typeof u!="object"&&typeof u!="function")&&(u={});f<m;++f)if(t=arguments[f],t!=null)for(n in t)i=Uc(u,n),o=Uc(t,n),u!==o&&(h&&o&&(Bc(o)||(s=zc(o)))?(s?(s=!1,l=i&&zc(i)?i:[]):l=i&&Bc(i)?i:{},Hc(u,{name:n,newValue:e(h,l,o)})):typeof o<"u"&&Hc(u,{name:n,newValue:o}));return u}});var bn=Xe((Pa,er)=>{(function(e,t){typeof Pa=="object"&&typeof er<"u"?er.exports=t():typeof define=="function"&&define.amd?define(t):e.moment=t()})(Pa,function(){"use strict";var e;function t(){return e.apply(null,arguments)}function n(r){e=r}function i(r){return r instanceof Array||Object.prot
[`+x+"] ";for(S in arguments[0])s(arguments[0],S)&&(g+=S+": "+arguments[0][S]+", ");g=g.slice(0,-2)}else g=arguments[x];d.push(g)}J(r+`
Arguments: `+Array.prototype.slice.call(d).join("")+`
`+new Error().stack),c=!1}return a.apply(this,arguments)},a)}var G={};function ne(r,a){t.deprecationHandler!=null&&t.deprecationHandler(r,a),G[r]||(J(a),G[r]=!0)}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;function oe(r){return typeof Function<"u"&&r instanceof Function||Object.prototype.toString.call(r)==="[object Function]"}function X(r){var a,c;for(c in r)s(r,c)&&(a=r[c],oe(a)?this[c]=a:this["_"+c]=a);this._config=r,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function N(r,a){var c=p({},r),d;for(d in a)s(a,d)&&(o(r[d])&&o(a[d])?(c[d]={},p(c[d],r[d]),p(c[d],a[d])):a[d]!=null?c[d]=a[d]:delete c[d]);for(d in r)s(r,d)&&!s(a,d)&&o(r[d])&&(c[d]=p({},c[d]));return c}function H(r){r!=null&&this.set(r)}var W;Object.keys?W=Object.keys:W=function(r){var a,c=[];for(a in r)s(r,a)&&c.push(a);return c};var ee={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function ue(r,a,c){var d=this._calendar[r]||this._calendar.sameElse;return oe(d)?d.call(a,c):d}function fe(r,a,c){var d=""+Math.abs(r),g=a-d.length,x=r>=0;return(x?c?"+":"":"-")+Math.pow(10,Math.max(0,g)).toString().substr(1)+d}var ze=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,b=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Se={},_e={};function y(r,a,c,d){var g=d;typeof d=="string"&&(g=function(){return this[d]()}),r&&(_e[r]=g),a&&(_e[a[0]]=function(){return fe(g.apply(this,arguments),a[1],a[2])}),c&&(_e[c]=function(){return this.localeData().ordinal(g.apply(this,arguments),r)})}function Pe(r){return r.match(/\[[\s\S]/)?r.replace(/^\[|\]$/g,""):r.replace(/\\/g,"")}function Ct(r){var a=r.match(ze),c,d;for(c=0,d=a.length;c<d;c++)_e[a[c]]?a[c]=_e[a[c]]:a[c]=Pe(a[c]);return function(g){var x="",S;for(S=0;S<d;S++)x+=oe(a[S])?a[S].call(g,r):a[S];return x}}function Wt(r,a){return r.isValid()?(a=tn(a,r.localeData()),Se[a]=Se[a]||Ct(a),Se[a](r)):r.localeData().invalidDate()}function tn(r,a){var c=5;function d(g){return a.longDateFormat(g)||g}for(b.lastIndex=0;c>=0&&b.test(r);)r=r.replace(b,d),b.lastIndex=0,c-=1;return r}var pe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function nn(r){var a=this._longDateFormat[r],c=this._longDateFormat[r.toUpperCase()];return a||!c?a:(this._longDateFormat[r]=c.match(ze).map(function(d){return d==="MMMM"||d==="MM"||d==="DD"||d==="dddd"?d.slice(1):d}).join(""),this._longDateFormat[r])}var st="Invalid date";function St(){return this._invalidDate}var zt="%d",tr=/\d{1,2}/;function Do(r){return this._ordinal.replace("%d",r)}var Yr={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Wr(r,a,c,d){var g=this._relativeTime[c];return oe(g)?g(r,a,c,d):g.replace(/%d/i,r)}function zr(r,a){var c=this._relativeTime[r>0?"future":"past"];return oe(c)?c(a):c.replace(/%s/i,a)}var Br={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Me(r){return typeof r=="string"?
`)}function ln(e=0){return(new Error().stack??"").split(`
`).slice(e+2).join(`
`)}function hr(e,t){t??=globalThis.console;let n=as(e);for(let i of n)i.shouldClearAnsiSequence?t.error(`\x1B[0m${i.message}\x1B[0m`):t.error(i.message)}function Il(e){return ai.on(si,e),()=>ai.off(si,e)}function un(e){throw e}function Tp(e){hr(new Error("An unhandled error occurred executing async operation",{cause:e}))}function as(e,t=0,n=[]){if(e===void 0)return n;if(!(e instanceof Error)){let o;return e===null?o="(null)":typeof e=="string"?o=e:o=JSON.stringify(e)??"undefined",n.push({level:t,message:o}),n}let i=`${e.name}: ${e.message}`;if(n.push({level:t,message:i,shouldClearAnsiSequence:!0}),e.stack){let o=e.stack.startsWith(i)?e.stack.slice(i.length+1):e.stack;n.push({level:t,message:`Error stack:
${o}`})}return e.cause!==void 0&&(n.push({level:t,message:"Caused by:"}),as(e.cause,t+1,n)),n}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();function ls(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ll(e){try{return new RegExp(e),!0}catch{return!1}}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function mr(e,...t){return Ap(e)?await e(...t):e}function Ap(e){return typeof e=="function"}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Fp={"\n":"\\n","\r":"\\r"," ":"\\t","\b":"\\b","\f":"\\f","'":"\\'",'"':'\\"',"\\":"\\\\"},Pp={};for(let[e,t]of Object.entries(Fp))Pp[t]=e;function Ol(e,t,n,i){return i??=n,e.slice(0,n)+t+e.slice(i)}function pr(e){return He(e,/\u00A0|\u202F/g," ").normalize("NFC")}function He(e,t,n){return typeof n>"u"?e:(t instanceof RegExp&&!t.global&&(t=new RegExp(t.source,`${t.flags}g`)),typeof n=="string"?e.replaceAll(t,n):e.replaceAll(t,(i,...o)=>{let l=typeof o.at(-1)=="object",u=l?o.length-2:o.length-1,f={groups:l?o.at(-1):void 0,offset:o.at(u-1),source:o.at(u),substring:i},m=o.slice(0,u-1);return n(f,...m)??f.substring}))}function Dl(e,t,n){if(e.endsWith(t))return e.slice(0,-t.length);if(n)throw new Error(`String ${e} does not end with suffix ${t}`);return e}function Dt(e,t,n){if(e.startsWith(t))return e.slice(t.length);if(n)throw new Error(`String ${e} does not start with prefix ${t}`);return e}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Mp=/[a-zA-Z]:\/[^:]*$/,yt=us.default.posix,Cy=yt.delimiter,Sy=us.default.posix.sep,Re=yt.basename,se=yt.dirname,et=yt.extname,_y=yt.format;var we=yt.join,Ey=yt.normalize,Ty=yt.parse,In=yt.relative;function Rl(e,t){return t?`${e}.${t}`:e}function Nl(...e){let t=yt.resolve(...e);return t=Ip(t),Mp.exec(t)?.[0]??t}function Ip(e){return He(e,"\\","/")}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var ui="md",Lp="canvas";function Wl(e,t,n){if(tt(t))return t.extension===n;if(typeof t=="string"){let i=ce(e,t);return i?i.extension===n:et(t).slice(1)===n}return!1}function gr(e,t,n){if(t===null)return null;if(Hl(t))return t;let i=Yl(e,t,n);if(i)return i;let o=Vl(t);return o===t?null:Yl(e,o,n)}function Ne(e,t,n,i){let o=ce(e,t,i);if(!o)if(n)o=_l(e,t);else throw new Error(`File not found: ${t}`);return o}function ce(e,t,n){let i=gr(e,t,n);return tt(i)?i:null}function Ln(e,t,n,i){let o=ht(e,t,i);if(!o)if(n)o=ii(e,t);else throw new Error(`Folder not found: ${t}`);return o}function ht(e,t,n){let i=gr(e,t,n);return wr(i)?i:null}function zl(e,t,n){let i=Ln(e,t),o=[];return n?xt.Vault.recurseChildren(i,s=>{ke(e,s)&&o.push(s)}):o=i.children.filter(s=>ke(e,s)),o=o.sort((s,l)=>s.path.localeCompare(l.path)),o}async function Bl(e,t){let n=ce(e,t);if(n)return n;let i=dt(t);return await Op(e,i),await e.vault.create(t,"")}async function Op(e,t){let n=ht(e,t);return n||await e.vault.createFolder(t)}function he(e,t){if(Hl(t))return t.path;let n=gr(e,t);return n?n.path:Vl(t)}function Hl(e){return e instanceof xt.TAbstractFile}function cn(e,t){return Wl(e,t,Lp)}function tt(e){return e instanceof xt.TFile}function wr(e){return e instanceof xt.TFolder}function ke(e,t){return Wl(e,t,ui)}function Rt(e,t){return ke(e,t)||cn(e,t)}function Ul(e,t){return ke(e,t)?Dl(t.path,`.${ui}`):t.path}function Yl(e,t,n){return n?e.vault.getAbstractFileByPathInsensitive(t):e.vault.getAbstractFileByPath(t)}function Vl(e){return(0,xt.normalizePath)(Nl("/",e))}var ws=je(nu(),1);(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var ms="19.6.0",mi="obsidian-dev-utils",ru=`.obsidian-dev-utils :invalid {
box-shadow: 0 0 0 2px var(--text-error);
}
.obsidian-dev-utils.modal-container .ok-button {
margin-right: 10px;
margin-top: 20px;
}
.obsidian-dev-utils .multiple-dropdown-component select,
.obsidian-dev-utils .multiple-dropdown-component select:focus,
.obsidian-dev-utils .multiple-dropdown-component .dropdown {
height: auto;
}
.obsidian-dev-utils .multiple-dropdown-component select option:checked,
.obsidian-dev-utils .multiple-dropdown-component select:focus option:checked,
.obsidian-dev-utils .multiple-dropdown-component .dropdown option:checked {
background-color: #1967d2;
color: #fff;
}
.obsidian-dev-utils.prompt-modal .text-box {
width: 100%;
}
/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../src/styles/main.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AACE;EACE;;AAIA;EACE;EACA;;AAKF;AAAA;AAAA;EAGE;;AAEA;AAAA;AAAA;EACE;EACA;;AAMJ;EACE%22,%22file%22:%22styles.css%22,%22sourcesContent%22:%5B%22.obsidian-dev-utils%20%7B%5Cn%20%20:invalid%20%7B%5Cn%20%20%20%20box-shadow:%200%200%200%202px%20var(--text-error);%5Cn%20%20%7D%5Cn%5Cn%20%20&.modal-container%20%7B%5Cn%20%20%20%20.ok-button%20%7B%5Cn%20%20%20%20%20%20margin-right:%2010px;%5Cn%20%20%20%20%20%20margin-top:%2020px;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20.multiple-dropdown-component%20%7B%5Cn%20%20%20%20select,%5Cn%20%20%20%20select:focus,%5Cn%20%20%20%20.dropdown%20%7B%5Cn%20%20%20%20%20%20height:%20auto;%5Cn%5Cn%20%20%20%20%20%20option:checked%20%7B%5Cn%20%20%20%20%20%20%20%20background-color:%20%231967d2;%5Cn%20%20%20%20%20%20%20%20color:%20%23fff;%5Cn%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%5Cn%20%20&.prompt-modal%20%7B%5Cn%20%20%20%20.text-box%20%7B%5Cn%20%20%20%20%20%20width:%20100%25;%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%5Cn%22%5D%7D */
`;(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var ps=class{constructor(t){this.value=t}};function iu(){try{return globalThis.require("obsidian/app")}catch{return globalThis.app??un(new Error("Obsidian app not found"))}}function jt(e,t,n){let i=e;return i.obsidianDevUtilsState??={},i.obsidianDevUtilsState[t]??=new ps(n)}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var gs="__no-plugin-id-initialized__",ou=gs;function rt(){return ou}function su(e){e&&(ou=e)}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var au=",",pi="-";function lu(){return{disable:rg,enable:ig,get:wi,set:kr}}function gi(e,t=0){let n=Nn()(e);return n.log=(i,...o)=>{og(e,t,i,...o)},n.printStackTrace=(i,o)=>{fu(e,i,o)},n}function Ue(e){let t=rt(),n=t===gs?"":`${t}:`;return gi(`${n}${mi}:${e}`)}function uu(e){let t=Nn().enabled(e),n=t?"enabled":"disabled",i=t?"disable":"enable",o=wi();kr(e),gi(e)(`Debug messages for plugin ${e} are ${n}. See https://github.com/mnaoumov/obsidian-dev-utils/?tab=readme-ov-file#debugging how to ${i} them.`),kr(o)}function rg(e){let t=new Set(wi());for(let n of yr(e)){if(n.startsWith(pi))continue;let i=pi+n;t.has(n)&&t.delete(n),t.add(i)}kr(Array.from(t))}function ig(e){let t=new Set(wi());for(let n of yr(e)){if(!n.startsWith(pi)){let i=pi+n;t.has(i)&&t.delete(i)}t.add(n)}kr(Array.from(t))}function wi(){return yr(Nn().load()??"")}function Nn(){if(typeof window>"u")return ws.default;let e=iu();return jt(e,"debug",ws.default).value}function cu(){return typeof window<"u"}function og(e,t,n,...i){if(!Nn().enabled(e))return;let l=(new Error().stack?.split(`
`)??[])[4+t]??"";console.debug(n,...i),cu()&&fu(e,l,"Debug message caller")}function fu(e,t,n){let i=Nn()(e);if(!i.enabled)return;t||(t="(unavailable)"),n||(n="Caller stack trace"),i(n);let o=cu()?`StackTraceFakeError
`:"";console.debug(`${o}${t}`)}function kr(e){Nn().enable(yr(e).join(au))}function yr(e){return typeof e=="string"?e.split(au).filter(Boolean):e.flatMap(yr)}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function dn(e){let t=e.items,n=0,i=new Notice("",0);for(let o of t){if(e.abortSignal?.aborted){i.hide();return}n++;let s=`# ${n.toString()} / ${t.length.toString()}`,l=e.buildNoticeMessage(o,s);i.setMessage(l),Ue("Loop")(l);try{await e.processItem(o)}catch(u){if(e.shouldContinueOnError)throw i.hide(),u;li(u)}}i.hide()}var mu=require("obsidian");(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var $=(e=>(e.AlertModal="alert-modal",e.CancelButton="cancel-button",e.ConfirmModal="confirm-modal",e.DateComponent="date-component",e.DateTimeComponent="datetime-component",e.EmailComponent="email-component",e.FileComponent="file-component",e.LibraryName="obsidian-dev-utils",e.MonthComponent="month-component",e.MultipleDropdownComponent="multiple-dropdown-component",e.MultipleEmailComponent="multiple-email-component",e.MultipleFileComponent="multiple-file-component",e.MultipleTextComponent="multiple-text-component",e.NumberComponent="number-component",e.OkButton="ok-button",e.PluginSettingsTab="plugin-settings-tab",e.PromptModal="prompt-modal",e.SelectItemModal="select-item-modal",e.TextBox="text-box",e.TimeComponent="time-component",e.UrlComponent="url-component",e.WeekComponent="week-component",e))($||{});var du=require("obsidian");(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var ki=class extends du.Modal{constructor(t,n,i){super(t.app),this.resolve=n,this.containerEl.addClass($.LibraryName,rt(),i),t.cssClass&&this.containerEl.addClass(t.cssClass)}};async function hu(e){return await new Promise(t=>{e(t).open()})}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var ks=class extends ki{options;constructor(t,n){super(t,n,$.AlertModal);let i={app:t.app,cssClass:"",message:t.message,okButtonText:"OK",title:""};this.options={...i,...t}}onClose(){this.resolve()}onOpen(){this.titleEl.setText(this.options.title),this.contentEl.createEl("p",{text:this.options.message});let t=new mu.ButtonComponent(this.contentEl);t.setButtonText(this.options.okButtonText),t.setCta(),t.onClick(this.close.bind(this)),t.setClass($.OkButton)}};async function yi(e){await hu(t=>new ks(e,t))}var vi=require("obsidian");var ku=je(gu(),1);(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var wu=`${mi}-styles`;function yu(e,t){su(t),uu(t);let n=jt(e,"lastLibraryVersion","0.0.0");if((0,ku.compareVersions)(ms,n.value)<=0)return;n.value=ms;let i=sg();i.DEBUG=lu(),document.head.querySelector(`#${wu}`)?.remove(),document.head.createEl("style",{attr:{id:wu},text:ru})}function sg(){return window}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var bi=class extends vi.Plugin{get abortSignal(){return this._abortSignal}get settings(){return this._settings}get settingsClone(){return this.createPluginSettings(this.settings.toJSON())}_abortSignal;_settings;notice;consoleDebug(t,...n){gi(this.manifest.id,1)(t,...n)}async onExternalSettingsChange(){await this.loadSettings()}async onload(){yu(this.app,this.manifest.id),this.register(Il(()=>{this.showNotice("An unhandled error occurred. Please check the console for more information.")})),await this.loadSettings();let t=this.createPluginSettingsTab();t&&this.addSettingTab(t);let n=new AbortController;this._abortSignal=n.signal,this.register(()=>{n.abort()}),await this.onloadComplete(),setTimeout(()=>{this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this))},0)}async saveSettings(t){let n=t.toJSON()
${t}`)}async loadSettings(){let t=await this.loadData();this._settings=this.createPluginSettings(t),this.settings.shouldSaveAfterLoad&&await this.saveSettings(this._settings)}};(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function ys(e){try{await e()}catch(t){li(t)}}function xs(e){return(...t)=>{xr(()=>e(...t))}}function xr(e){ys(e)}async function br(e,t,n){let i=Ue("Async:retryWithTimeout");n??=ln(1);let s={...{retryDelayInMilliseconds:100,shouldRetryOnError:!1,timeoutInMilliseconds:5e3},...t};await bs(s.timeoutInMilliseconds,async()=>{let l=0;for(;;){s.abortSignal?.throwIfAborted(),l++;let u;try{u=await e()}catch(f){if(!s.shouldRetryOnError||f.__terminateRetry)throw f;hr(f),u=!1}if(u){l>1&&(i(`Retry completed successfully after ${l.toString()} attempts`),i.printStackTrace(n));return}i(`Retry attempt ${l.toString()} completed unsuccessfully. Trying again in ${s.retryDelayInMilliseconds.toString()} milliseconds`,{fn:e}),i.printStackTrace(n),await xu(s.retryDelayInMilliseconds)}})}async function bs(e,t){let n=!0,i=null,o=performance.now();if(await Promise.race([s(),l()]),n)throw new Error("Timed out");return i;async function s(){i=await t(),n=!1;let u=performance.now()-o;Ue("Async:runWithTimeout")(`Execution time: ${u.toString()} milliseconds`,{fn:t})}async function l(){if(!n||(await xu(e),!n))return;let u=performance.now()-o;console.warn(`Timed out in ${u.toString()} milliseconds`,{fn:t});let f=Ue("Async:runWithTimeout:timeout");f.enabled&&(f(`The execution is not terminated because debugger ${f.namespace} is enabled. See https://github.com/mnaoumov/obsidian-dev-utils/?tab=readme-ov-file#debugging for more information`),await l())}}async function xu(e){await new Promise(t=>{setTimeout(t,e)})}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function bu(e,t,n){let i=Ue("Logger:invokeAsyncAndLog"),o=performance.now();n??=ln(1),i(`${e}:start`,{fn:t,timestampStart:o}),i.printStackTrace(n);try{await t();let s=performance.now();i(`${e}:end`,{duration:s-o,fn:t,timestampEnd:s,timestampStart:o}),i.printStackTrace(n)}catch(s){let l=performance.now();throw i(`${e}:error`,{duration:l-o,error:s,fn:t,timestampEnd:l,timestampStart:o}),i.printStackTrace(n),s}}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();function it(e,t,n,i){i??=ln(1),xr(()=>ag(e,t,n,i))}async function ag(e,t,n,i){n??=6e4,i??=ln(1);let s=vu(e).value;s.items.push({fn:t,stackTrace:i,timeoutInMilliseconds:n}),s.promise=s.promise.then(()=>Cu(e)),await s.promise}function vu(e){return jt(e,"queue",{items:[],promise:Promise.resolve()})}async function Cu(e){let t=vu(e).value,n=t.items[0];n&&(await ys(()=>bs(n.timeoutInMilliseconds,()=>bu(Cu.name,n.fn,n.stackTrace))),t.items.shift())}function Su(e,t){let n=Object.keys(t).map(i=>lg(e,i,t[i]));return n.length===1?n[0]:function(){n.forEach(i=>i())}}function lg(e,t,n){let i=e[t],o=e.hasOwnProperty(t),s=o?i:function(){return Object.getPrototypeOf(e)[t].apply(this,arguments)},l=n(s);return i&&Object.setPrototypeOf(l,i),Object.setPrototypeOf(u,l),e[t]=u,f;function u(...m){return l===s&&e[t]===u&&f(),l.apply(this,m)}function f(){e[t]===u&&(o?e[t]=s:delete e[t]),l!==s&&(l=s,Object.setPrototypeOf(u,i||Function))}}var kf=require("obsidian");(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var _u=".";function Cs(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;let o=e,s=t;for(let l of n)if(!i.includes(l)||!Cs(o[l],s[l]))return!1;return!0}function Ci(e,t){let n=e,i=t.split(_u);for(let o of i){if(n===void 0)return;n=n[o]}return n}function Eu(e,t,n){let i=new Error(`Property path ${t} not found`),o=e,s=t.split(_u);for(let u of s.slice(0,-1)){if(o===void 0)throw i;o=o
--> starting at object with constructor '${i}'
--- property '${t}' closes the circle`)}function dg(e,t,n){if(n.functionHandlingMode==="exclude")return;let i=t.length,o=n.functionHandlingMode==="full"?e.toString():`function ${e.name||"anonymous"}() { /* ... */ }`;return t.push(o),Yn("Function",i)}function hg(e,t,n,i,o,s,l){if(l.has(e))return fg(e,t,o);if(l.add(e),i){let u=pg(e,t,n,o,s,l);if(u!==void 0)return u}return Array.isArray(e)?cg(e,n,i,o,s,l):n>o.maxDepth?Yn("MaxDepthLimitReached"):e instanceof Error&&o.shouldHandleErrors?Ml(e):mg(e,n,i,o,s,l)}function mg(e,t,n,i,o,s){let l=Object.entries(e);return i.shouldSortKeys&&l.sort(([u],[f])=>u.localeCompare(f)),Object.fromEntries(l.map(([u,f])=>[u,_i(f,u,t+1,n,i,o,s)]))}function vs(e){return`{ "[[${e}]]": null }`}function Yn(e,t){return`[[${e}${t?.toString()??""}]]`}function _i(e,t,n,i,o,s,l){return e===void 0?n===0||o.shouldHandleUndefined?Yn("Undefined"):void 0:typeof e=="function"?dg(e,s,o):typeof e!="object"||e===null?e:hg(e,t,n,i,o,s,l)}function pg(e,t,n,i,o,s){let l=e.toJSON;if(typeof l=="function")try{let u=l.call(e,t);return _i(u,t,n,!1,i,o,s)}catch(u){if(i.shouldCatchToJSONErrors)return Yn("ToJSONFailed");throw u}}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function Ss(e,t,n){let i=he(e,t),o=he(e,n),s=Ne(e,o,!0),l=et(i),u=Re(i,l),f=e.vault.getAvailablePathForAttachments;return f.isExtended?f(u,l.slice(1),s,!0):await gg(e,u,l.slice(1),s,!0)}async function Wn(e,t){return dt(await Ss(e,"DUMMY_FILE.pdf",t))}async function gg(e,t,n,i,o){let s=e.vault.getConfig("attachmentFolderPath"),l=s==="."||s==="./",u=null;s.startsWith("./")&&(u=Dt(s,"./")),l?s=i?i.parent?.path??"":"":u&&(s=(i?i.parent?.getParentPrefix()??"":"")+u),s=pr(Tu(s)),t=pr(Tu(t));let f=ht(e,s,!0);!f&&u&&(o?f=Ln(e,s,!0):f=await e.vault.createFolder(s));let m=f?.getParentPrefix()??"";return e.vault.getAvailablePath(m+t,n)}async function _s(e,t){let n=await Wn(e,t),i=await Wn(e,we(se(t),"DUMMY_FILE.md"));return n!==i}function Tu(e){return e=He(e,/(?:[\\/])+/g,"/"),e=He(e,/^\/+|\/+$/g,""),e||"/"}var to=require("obsidian");var wg={};function hn(e,t){let n=t||wg,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Fu(e,i,o)}function Fu(e,t,n){if(kg(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Au(e.children,t,n)}return Array.isArray(e)?Au(e,t,n):""}function Au(e,t,n){let i=[],o=-1;for(;++o<e.length;)i[o]=Fu(e[o],t,n);return i.join("")}function kg(e){return!!(e&&typeof e=="object")}var Pu=document.createElement("i");function zn(e){let t="&"+e+";";Pu.innerHTML=t;let n=Pu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ce(e,t,n,i){let o=e.length,s=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,i.length<1e4)l=Array.from(i),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);s<i.length;)l=i.slice(s,s+1e4),l.unshift(t,0),e.splice(...l),s+=1e4,t+=1e4}function Ye(e,t){return e.length>0?(Ce(e,e.length,0,t),e):t}var Mu={}.hasOwnProperty;function Iu(e){let t={},n=-1;for(;++n<e.length;)yg(t,e[n]);return t}function yg(e,t){let n;for(n in t){let o=(Mu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n],l;if(s)for(l in s){Mu.call(o,l)||(o[l]=[]);let u=s[l];xg(o[l],Array.isArray(u)?u:u?[u]:[])}}}function xg(e,t){let n=-1,i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Ce(e,0,0,i)}function Ei(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function Nt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var qe=Gt(/[A-Za-z]/),We=Gt(/[\dA-Za-z]/),Lu=Gt(/[#-'*+\--9=?A-Z^-~]/);function vr(e){return e!==null&&(e<32||e===127)}var Cr=Gt(/\d/),Ou=Gt(/[\dA-Fa-f]/),Du=Gt(/[!-/:-@[-`{-~]/);function R(e){return e!==null&&e<-2}function me(e){return e!==null&&(e<0||e===32)}function U(e){return e===-2||e===-1||e===32}var Ru=Gt(/\p{P}|\p{S}/u),N
`;break}case-3:{l=`\r
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(s)}o=s===-2,i.push(l)}return i.join("")}function Ys(e){let i={constructs:Iu([Ns,...(e||{}).extensions||[]]),content:o(Yu),defined:[],document:o(zu),flow:o(Vu),lazy:{},string:o(ju),text:o(Gu)};return i;function o(s){return l;function l(u){return Qu(i,s,u)}}}function Ws(e){for(;!Ii(e););return e}var Ju=/[\0\t\n\r]/g;function zs(){let e=1,t="",n=!0,i;return o;function o(s,l,u){let f=[],m,h,p,w,k;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),p=0,t="",n&&(s.charCodeAt(0)===65279&&p++,n=void 0);p<s.length;){if(Ju.lastIndex=p,m=Ju.exec(s),w=m&&m.index!==void 0?m.index:s.length,k=s.charCodeAt(w),!m){t=s.slice(p);break}if(k===10&&p===w&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<w&&(f.push(s.slice(p,w)),e+=w-p),k){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}p=w+1}return u&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}var zw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ni(e){return e.replace(zw,Bw)}function Bw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),s=o===120||o===88;return Ei(n.slice(s?2:1),s?16:10)}return zn(n)||e}function Zt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ku(e.position):"start"in e||"end"in e?Ku(e):"line"in e||"column"in e?Bs(e):""}function Bs(e){return Xu(e&&e.line)+":"+Xu(e&&e.column)}function Ku(e){return Bs(e&&e.start)+"-"+Bs(e&&e.end)}function Xu(e){return e&&typeof e=="number"?e:1}var tc={}.hasOwnProperty;function Hs(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Hw(n)(Ws(Ys(n).document().write(zs()(e,t,!0))))}function Hw(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Me),autolinkProtocol:G,autolinkEmail:G,atxHeading:s(Yr),blockQuote:s(st),characterEscape:G,characterReference:G,codeFenced:s(St),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(St,l),codeText:s(zt,l),codeTextData:G,data:G,codeFlowValue:G,definition:s(tr),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Do),hardBreakEscape:s(Wr),hardBreakTrailing:s(Wr),htmlFlow:s(zr,l),htmlFlowData:G,htmlText:s(zr,l),htmlTextData:G,image:s(Br),label:l,link:s(Me),listItem:s(Ro),listItemValue:w,listOrdered:s(Cn,p),listUnordered:s(Cn),paragraph:s(No),reference:y,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Yr),strong:s(Hr),thematicBreak:s(Ur)},exit:{atxHeading:f(),atxHeadingSequence:B,autolink:f(),autolinkEmail:nn,autolinkProtocol:pe,blockQuote:f(),characterEscapeValue:ne,characterReferenceMarkerHexadecimal:Ct,characterReferenceMarkerNumeric:Ct,characterReferenceValue:Wt,characterReference:tn,codeFenced:f(T),codeFencedFence:F,codeFencedFenceInfo:k,codeFencedFenceMeta:v,codeFlowValue:ne,codeIndented:f(C),codeText:f(W),codeTextData:ne,data:ne,definition:f(),definitionDestinationString:Y,definitionLabelString:A,definitionTitleString:P,emphasis:f(),hardBreakEscape:f(X),hardBreakTrailing:f(X),htmlFlow:f(N),htmlFlowData:ne,htmlText:f(H),htmlTextData:ne,image:f(ue),label:ze,labelText:fe,lineEnding:oe,link:f(ee),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:Pe,resourceDestinationString:b,resourceTitleString:Se,resource:_e,setextHeading:f(j),setextHeadingLineSequence:J,setextHeadingText:_,strong:f(),thematicBreak:f()}};nc(t,(e||{}).mdastExtensions||[]);let n={};return i;function i(E){let I={type:"root",children:[]},L={stack:[I],tokenStack:[],config:t,enter:u,exit:m,buffer:l,resume:h,data:n},q=[],re=-1;for(;++re<E.length;)if(E[re][1].type==="listOrdered"||E[re][1].type==="listUnordered")if(E[re][0]==="enter")q.push(re);else{let Ee=q.pop();re=o(E,Ee,re)}for(re=-1;++re<E.length;){let Ee=t[E[re][0]];tc.call(Ee,E[re][1].type)&&Ee[E[re][1].type].call(Object.assign({sliceSerialize:E[re][2].sliceSerialize},L),E[re][1])}if(L.tokenStack.length>0){let Ee=L.tokenStack[L.token
`&&Yi(n.stack,n.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function lc(e,t){let n=String(e),i=n.indexOf(t),o=i,s=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++s>l&&(l=s):s=1,o=i+t.length,i=n.indexOf(t,o);return l}function Ar(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uc(e){let t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function cc(e,t,n,i){let o=uc(n),s=e.value||"",l=o==="`"?"GraveAccent":"Tilde";if(Ar(e,n)){let p=n.enter("codeIndented"),w=n.indentLines(s,Gw);return p(),w}let u=n.createTracker(i),f=o.repeat(Math.max(lc(s,o)+1,3)),m=n.enter("codeFenced"),h=u.move(f);if(e.lang){let p=n.enter(`codeFencedLang${l}`);h+=u.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...u.current()})),p()}if(e.lang&&e.meta){let p=n.enter(`codeFencedMeta${l}`);h+=u.move(" "),h+=u.move(n.safe(e.meta,{before:h,after:`
`,encode:["`"],...u.current()})),p()}return h+=u.move(`
`),s&&(h+=u.move(s+`
`)),h+=u.move(f),m(),h}function Gw(e,t,n){return(n?"":" ")+e}function Vn(e){let t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function fc(e,t,n,i){let o=Vn(n),s=o==='"'?"Quote":"Apostrophe",l=n.enter("definition"),u=n.enter("label"),f=n.createTracker(i),m=f.move("[");return m+=f.move(n.safe(n.associationId(e),{before:m,after:"]",...f.current()})),m+=f.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(u=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":`
`,...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),m+=f.move(" "+o),m+=f.move(n.safe(e.title,{before:m,after:o,...f.current()})),m+=f.move(o),u()),l(),m}function dc(e){let t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ze(e){return"&#x"+e.toString(16).toUpperCase()+";"}function $n(e,t,n){let i=Bn(e),o=Bn(t);return i===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}$s.peek=qw;function $s(e,t,n,i){let o=dc(n),s=n.enter("emphasis"),l=n.createTracker(i),u=l.move(o),f=l.move(n.containerPhrasing(e,{after:o,before:u,...l.current()})),m=f.charCodeAt(0),h=$n(i.before.charCodeAt(i.before.length-1),m,o);h.inside&&(f=Ze(m)+f.slice(1));let p=f.charCodeAt(f.length-1),w=$n(i.after.charCodeAt(0),p,o);w.inside&&(f=f.slice(0,-1)+Ze(p));let k=l.move(o);return s(),n.attentionEncodeSurroundingInfo={after:w.outside,before:h.outside},u+f+k}function qw(e,t,n){return n.options.emphasis||"*"}var jn=function(e){if(e==null)return Kw;if(typeof e=="function")return Wi(e);if(typeof e=="object")return Array.isArray(e)?Zw(e):Qw(e);if(typeof e=="string")return Jw(e);throw new Error("Expected function, string, or object as test")};function Zw(e){let t=[],n=-1;for(;++n<e.length;)t[n]=jn(e[n]);return Wi(i);function i(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function Qw(e){let t=e;return Wi(n);function n(i){let o=i,s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function Jw(e){return Wi(t);function t(n){return n&&n.type===e}}function Wi(e){return t;function t(n,i,o){return!!(Xw(n)&&e.call(this,n,typeof i=="number"?i:void 0,o||void 0))}}function Kw(){return!0}function Xw(e){return e!==null&&typeof e=="object"&&"type"in e}function hc(e){return"\x1B[33m"+e+"\x1B[39m"}var mc=[],zi=!0,wn=!1,Bi="skip";function js(e,t,n,i){let o;typeof t=="function"&&typeof n!="function"?(i=n,n=t):o=t;let s=jn(o),l=i?-1:1;u(e,void 0,[])();function u(f,m,h){let p=f&&typeof f=="object"?f:{};if(typeof p.type=="string"){let k=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(w,"name",{value:"node ("+hc(f.type+(k?"<"+k+">":""))+")"})}return w;function w(){let k=mc,v,F,T;if((!t||s(f,m,h[h.length-1]||void 0))&&(k=ek(n(f,h)),k[0]===wn))return k;if("children"in f&&f.children){let C=f;if(C.children&&k[0]!==Bi)for(F=(i?C.children.length:-1)+l,T=h.concat(C);F>-1&&F<C.children.length;){let A=C.children[F];if(v=u(A,F,T)(),v[0]===wn)return v;F=typeof v[1]=="number"?v[1]:F+l}}return k}}}function ek(e){return Array.isArray(e)?e:typeof e=="number"?[zi,e]:e==null?mc:[e]}function Gs(e,t,n,i){let o,s,l;typeof t=="function"&&typeof n!="function"?(s=void 0,l=t,o=n):(s=t,l=n,o=i),js(e,s,u,o);function u(f,m){let h=m[m.length-1],p=h?h.children.indexOf(f):void 0;return l(f,p,h)}}function Hi(e,t){let n=!1;return Gs(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,wn}),!!((!e.depth||e.depth<3)&&hn(e)&&(t.options.setext||n))}function pc(e,t,n,i){let o=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(i);if(Hi(e,n)){let h=n.enter("headingSetext"),p=n.enter("phrasing"),w=n.containerPhrasing(e,{...s.current(),before:`
2025-01-13 11:22:31 +08:00
`,after:`
2025-03-03 19:56:35 +08:00
`});return p(),h(),w+`
`+(o===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
`))+1))}let l="#".repeat(o),u=n.enter("headingAtx"),f=n.enter("phrasing");s.move(l+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
`,...s.current()});return/^[\t ]/.test(m)&&(m=Ze(m.charCodeAt(0))+m.slice(1)),m=m?l+" "+m:l,n.options.closeAtx&&(m+=" "+l),f(),u(),m}qs.peek=tk;function qs(e){return e.value||""}function tk(){return"<"}Zs.peek=nk;function Zs(e,t,n,i){let o=Vn(n),s=o==='"'?"Quote":"Apostrophe",l=n.enter("image"),u=n.enter("label"),f=n.createTracker(i),m=f.move("![");return m+=f.move(n.safe(e.alt,{before:m,after:"]",...f.current()})),m+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(u=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),m+=f.move(" "+o),m+=f.move(n.safe(e.title,{before:m,after:o,...f.current()})),m+=f.move(o),u()),m+=f.move(")"),l(),m}function nk(){return"!"}Qs.peek=rk;function Qs(e,t,n,i){let o=e.referenceType,s=n.enter("imageReference"),l=n.enter("label"),u=n.createTracker(i),f=u.move("!["),m=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(m+"]["),l();let h=n.stack;n.stack=[],l=n.enter("reference");let p=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,s(),o==="full"||!m||m!==p?f+=u.move(p+"]"):o==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function rk(){return"!"}Js.peek=ik;function Js(e,t,n){let i=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++s<n.unsafe.length;){let l=n.unsafe[s],u=n.compilePattern(l),f;if(l.atBreak)for(;f=u.exec(i);){let m=f.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(f.index+1)}}return o+i+o}function ik(){return"`"}function Ks(e,t){let n=hn(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Xs.peek=ok;function Xs(e,t,n,i){let o=Vn(n),s=o==='"'?"Quote":"Apostrophe",l=n.createTracker(i),u,f;if(Ks(e,n)){let h=n.stack;n.stack=[],u=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),u(),n.stack=h,p}u=n.enter("link"),f=n.enter("label");let m=l.move("[");return m+=l.move(n.containerPhrasing(e,{before:m,after:"](",...l.current()})),m+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),m+=l.move("<"),m+=l.move(n.safe(e.url,{before:m,after:">",...l.current()})),m+=l.move(">")):(f=n.enter("destinationRaw"),m+=l.move(n.safe(e.url,{before:m,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${s}`),m+=l.move(" "+o),m+=l.move(n.safe(e.title,{before:m,after:o,...l.current()})),m+=l.move(o),f()),m+=l.move(")"),u(),m}function ok(e,t,n){return Ks(e,n)?"<":"["}ea.peek=sk;function ea(e,t,n,i){let o=e.referenceType,s=n.enter("linkReference"),l=n.enter("label"),u=n.createTracker(i),f=u.move("["),m=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(m+"]["),l();let h=n.stack;n.stack=[],l=n.enter("reference");let p=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=h,s(),o==="full"||!m||m!==p?f+=u.move(p+"]"):o==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function sk(){return"["}function Gn(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gc(e){let t=Gn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function wc(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.`
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:kn},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:kn},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:kn},{atBreak:!0,character:"+",after:`(?:[ \r
2025-01-13 11:22:31 +08:00
])`},{atBreak:!0,character:"-",after:`(?:[ \r
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
2025-03-03 19:56:35 +08:00
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:kn},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:kn},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:kn},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:kn},{atBreak:!0,character:"~"}];function Pc(e){return e.label||!e.identifier?e.label||"":Ni(e.identifier)}function Mc(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function Ic(e,t,n){let i=t.indexStack,o=e.children||[],s=[],l=-1,u=n.before,f;i.push(-1);let m=t.createTracker(n);for(;++l<o.length;){let h=o[l],p;if(i[i.length-1]=l,l+1<o.length){let v=t.handle.handlers[o[l+1].type];v&&v.peek&&(v=v.peek),p=v?v(o[l+1],e,t,{before:"",after:"",...m.current()}).charAt(0):""}else p=n.after;s.length>0&&(u==="\r"||u===`
`)&&h.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),u=" ",m=t.createTracker(n),m.move(s.join("")));let w=t.handle(h,e,t,{...m.current(),after:p,before:u});f&&f===w.slice(0,1)&&(w=Ze(f.charCodeAt(0))+w.slice(1));let k=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,f=void 0,k&&(s.length>0&&k.before&&u===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Ze(u.charCodeAt(0))),k.after&&(f=p)),m.move(w),s.push(w),u=w.slice(-1)}return i.pop(),s.join("")}function Lc(e,t,n){let i=t.indexStack,o=e.children||[],s=t.createTracker(n),l=[],u=-1;for(i.push(-1);++u<o.length;){let f=o[u];i[i.length-1]=u,l.push(s.move(t.handle(f,e,t,{before:`
2025-01-13 11:22:31 +08:00
`,after:`
2025-03-03 19:56:35 +08:00
`,...s.current()}))),f.type!=="list"&&(t.bulletLastUsed=void 0),u<o.length-1&&l.push(s.move(uk(f,o[u+1],e,t)))}return i.pop(),l.join("")}function uk(e,t,n,i){let o=i.join.length;for(;o--;){let s=i.join[o](e,t,n,i);if(s===!0||s===1)break;if(typeof s=="number")return`
`.repeat(1+s);if(s===!1)return`
2025-01-13 11:22:31 +08:00
<!---->
`}return`
2025-03-03 19:56:35 +08:00
`}var ck=/\r?\n|\r/g;function Oc(e,t){let n=[],i=0,o=0,s;for(;s=ck.exec(e);)l(e.slice(i,s.index)),n.push(s[0]),i=s.index+s[0].length,o++;return l(e.slice(i)),n.join("");function l(u){n.push(t(u,o,!u))}}function Rc(e,t,n){let i=(n.before||"")+(t||"")+(n.after||""),o=[],s=[],l={},u=-1;for(;++u<e.unsafe.length;){let h=e.unsafe[u];if(!Yi(e.stack,h))continue;let p=e.compilePattern(h),w;for(;w=p.exec(i);){let k="before"in h||!!h.atBreak,v="after"in h,F=w.index+(k?w[1].length:0);o.includes(F)?(l[F].before&&!k&&(l[F].before=!1),l[F].after&&!v&&(l[F].after=!1)):(o.push(F),l[F]={before:k,after:v})}}o.sort(fk);let f=n.before?n.before.length:0,m=i.length-(n.after?n.after.length:0);for(u=-1;++u<o.length;){let h=o[u];h<f||h>=m||h+1<m&&o[u+1]===h+1&&l[h].after&&!l[h+1].before&&!l[h+1].after||o[u-1]===h-1&&l[h].before&&!l[h-1].before&&!l[h-1].after||(f!==h&&s.push(Dc(i.slice(f,h),"\\")),f=h,/[!-/:-@[-`{-~]/.test(i.charAt(h))&&(!n.encode||!n.encode.includes(i.charAt(h)))?s.push("\\"):(s.push(Ze(i.charCodeAt(h))),f++))}return s.push(Dc(i.slice(f,m),n.after)),s.join("")}function fk(e,t){return e-t}function Dc(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,i=[],o=[],s=e+t,l=-1,u=0,f;for(;f=n.exec(s);)i.push(f.index);for(;++l<i.length;)u!==i[l]&&o.push(e.slice(u,i[l])),o.push("\\"),u=i[l];return o.push(e.slice(u)),o.join("")}function Nc(e){let t=e||{},n=t.now||{},i=t.lineShift||0,o=n.line||1,s=n.column||1;return{move:f,current:l,shift:u};function l(){return{now:{line:o,column:s},lineShift:i}}function u(m){i+=m}function f(m){let h=m||"",p=h.split(/\r?\n|\r/g),w=p[p.length-1];return o+=p.length-1,s=p.length===1?s+w.length:1+w.length+i,h}}function ra(e,t){let n=t||{},i={associationId:Pc,containerPhrasing:pk,containerFlow:gk,createTracker:Nc,compilePattern:Mc,enter:s,handlers:{...Tc},handle:void 0,indentLines:Oc,indexStack:[],join:[...Ac],options:{},safe:wk,stack:[],unsafe:[...Fc]};Us(i,n),i.options.tightDefinitions&&i.join.push(mk),i.handle=ic("type",{invalid:dk,unknown:hk,handlers:i.handlers});let o=i.handle(e,void 0,i,{before:`
2025-01-13 11:22:31 +08:00
`,after:`
2025-03-03 19:56:35 +08:00
`,now:{line:1,column:1},lineShift:0});return o&&o.charCodeAt(o.length-1)!==10&&o.charCodeAt(o.length-1)!==13&&(o+=`
`),o;function s(l){return i.stack.push(l),u;function u(){i.stack.pop()}}}function dk(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function hk(e){let t=e;throw new Error("Cannot handle unknown node `"+t.type+"`")}function mk(e,t){if(e.type==="definition"&&e.type===t.type)return 0}function pk(e,t){return Ic(e,this,t)}function gk(e,t){return Lc(e,this,t)}function wk(e,t){return Rc(this,e,t)}function Vi(e){let t=this;t.compiler=n;function n(i){return ra(i,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}}function ia(e){if(e)throw e}var qi=je(jc(),1);function Fr(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oa(){let e=[],t={run:n,use:i};return t;function n(...o){let s=-1,l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...o);function u(f,...m){let h=e[++s],p=-1;if(f){l(f);return}for(;++p<o.length;)(m[p]===null||m[p]===void 0)&&(m[p]=o[p]);o=m,h?Gc(h,u)(...m):l(null,...m)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Gc(e,t){let n;return i;function i(...l){let u=e.length>l.length,f;u&&l.push(o);try{f=e.apply(this,l)}catch(m){let h=m;if(u&&n)throw h;return o(h)}u||(f&&f.then&&typeof f.then=="function"?f.then(s,o):f instanceof Error?o(f):s(f))}function o(l,...u){n||(n=!0,t(l,...u))}function s(l){o(null,l)}}var ve=class extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let o="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(l=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof i=="string"){let f=i.indexOf(":");f===-1?s.ruleId=i:(s.source=i.slice(0,f),s.ruleId=i.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){let f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}let u=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file,this.message=o,this.line=u?u.line:void 0,this.name=Zt(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}};ve.prototype.file="";ve.prototype.name="";ve.prototype.reason="";ve.prototype.message="";ve.prototype.stack="";ve.prototype.column=void 0;ve.prototype.line=void 0;ve.prototype.ancestors=void 0;ve.prototype.cause=void 0;ve.prototype.fatal=void 0;ve.prototype.place=void 0;ve.prototype.ruleId=void 0;ve.prototype.source=void 0;var ot=je(require("node:path"),1);var sa=je(require("node:process"),1);var aa=require("node:url");function ji(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}var la=["history","path","basename","stem","extname","dirname"],Pr=class{constructor(t){let n;t?ji(t)?n={path:t}:typeof t=="string"||kk(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":sa.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<la.length;){let s=la[i];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)la.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ot.default.basename(this.path):void 0}set basename(t){ca(t,"basename"),ua(t,"basename"),this.path=ot.default.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ot.default.dirname(this.path):void 0}set dirname(t){qc(this.basename,"dirname"),this.path=ot.default.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ot.default.extname(this.path):void 0}set extname(t){if(ua(t,"extname"),qc(this.dirname,"extname"),t){if(
${i}---
${e}`}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function sf(e,t,n){let i=Ne(e,t),o=dt(n);await Zn(e,o);let s=Qi(e,n);try{await e.vault.copy(i,s)}catch(l){if(!await e.vault.exists(s))throw l}return s}async function Zn(e,t){if(await e.vault.adapter.exists(t))return!1;try{return await e.vault.createFolder(t),!0}catch(n){if(!await e.vault.exists(t))throw n;return!0}}function Qi(e,t){let n=et(t);return e.vault.getAvailablePath(we(se(t),Re(t,n)),n.slice(1))}function Qn(e){return e.vault.getMarkdownFiles().sort((t,n)=>t.path.localeCompare(n.path))}function ba(e,t,n){let i=he(e,t);if(e.vault.adapter.insensitive){let o=se(n),s=Re(n),l;for(;l=ht(e,o,!0),!l;)s=we(Re(o),s),o=se(o);n=we(l.getParentPrefix(),s)}return i.toLowerCase()===n.toLowerCase()?n:Qi(e,n)}async function va(e,t){let n=await Jn(e,he(e,t));return n.files.length===0&&n.folders.length===0}async function Jn(e,t){let n=he(e,t),i={files:[],folders:[]};if((await e.vault.adapter.stat(n))?.type!=="folder")return i;try{return await e.vault.adapter.list(n)}catch(o){if(await e.vault.exists(n))throw o;return i}}async function af(e,t,n,i={}){let s={...{shouldFailOnMissingFile:!0},...i};await br(async()=>{let l=await Ca(e,t);if(l===null)return h();let u=await mr(n,l);if(u===null)return!1;let f=!0;if(!await lf(e,t,async p=>{await e.vault.process(p,w=>w!==l?(console.warn("Content has changed since it was read. Retrying...",{actualContent:w,expectedContent:l,path:p.path}),f=!1,w):u)}))return h();return f;function h(){if(s.shouldFailOnMissingFile){let p=he(e,t);throw new Error(`File '${p}' not found`)}return!0}},s)}async function Ca(e,t){let n=null;return await lf(e,t,async i=>{n=await e.vault.read(i)}),n}async function Ji(e,t,n){let i=Ne(e,t,!1,!0),o=ba(e,t,n);if(i.path.toLowerCase()===o.toLowerCase())return i.path!==n&&await e.vault.rename(i,o),o;let s=dt(o);await Zn(e,s);try{await e.vault.rename(i,o)}catch(l){if(!await e.vault.exists(o)||await e.vault.exists(i.path))throw l}return o}async function lf(e,t,n){let i=he(e,t),o=ce(e,i);if(!o||o.deleted)return!1;try{return await n(o),!0}catch(s){if(o=ce(e,i),!o||o.deleted)return!1;throw s}}(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();async function Mr(e,t,n,i={}){await af(e,t,async o=>{let s=await mr(n),l=cn(e,t)?Tk(o):Zi(o);for(let h of s)if(xn(h)){let p=o.slice(h.startIndex,h.endIndex);if(p!==h.oldContent)return console.warn("Content mismatch",{actualContent:p,endIndex:h.endIndex,expectedContent:h.oldContent,path:he(e,t),startIndex:h.startIndex}),null}else if(Ki(h)){let p=Ci(l,h.frontmatterKey);if(p!==h.oldContent)return console.warn("Content mismatch",{actualContent:p,expectedContent:h.oldContent,frontmatterKey:h.frontmatterKey,path:he(e,t)}),null}s.sort((h,p)=>xn(h)&&xn(p)?h.startIndex-p.startIndex:Ki(h)&&Ki(p)?h.frontmatterKey.localeCompare(p.frontmatterKey):xn(h)?-1:1),s=s.filter((h,p)=>h.oldContent===h.newContent?!1:p===0?!0:!Cs(h,s[p-1]));for(let h=1;h<s.length;h++){let p=s[h];if(!p)continue;let w=s[h-1];if(w&&xn(w)&&xn(p)&&w.endIndex&&p.startIndex&&w.endIndex>p.startIndex)return console.warn("Overlapping changes",{change:p,previousChange:w}),null}let u="",f=0,m=!1;for(let h of s)xn(h)?(u+=o.slice(f,h.startIndex),u+=h.newContent,f=h.endIndex):Ki(h)&&(Eu(l,h.frontmatterKey,h.newContent),m=!0);return cn(e,t)?u=JSON.stringify(l,null," "):(u+=o.slice(f),m&&(u=of(u,l))),u},i)}function xn(e){return e.startIndex!==void 0}function Ki(e){return e.frontmatterKey!==void 0}function Tk(e){let t;try{t=JSON.parse(e)}catch{t=null}return(t===null||typeof t!="object")&&(t={}),t}var cf=require("obsidian");(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();function Xi(e,t){if(Vt(e))return{endIndex:e.position.end.offset,newContent:t,oldContent:e.original,startIndex:e.position.start.offset};if(Ot(e))return{frontmatterKey:e.key,newContent:t,oldContent:e.original};throw new Err
`)}onChange(t){return this.textAreaComponent.onChange(()=>t(this.getValue())),this}setDisabled(t){return this.textAreaComponent.setDisabled(t),this.disabled=t,this}setPlaceholder(t){return this.textAreaComponent.setPlaceholder(t),this}setValue(t){return this.textAreaComponent.setValue(t.join(`
`)),this}};(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Ao=class extends $e{constructor(t){super(t,"number",$.NumberComponent)}valueFromString(t){return parseInt(t,10)}};var Po=je(bn(),1);(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Fo=class extends $e{constructor(t){super(t,"time",$.TimeComponent)}valueFromString(t){return(0,Po.duration)(t)}valueToString(t){let n;return t.milliseconds()>0?n="HH:mm:ss.SSS":t.seconds()>0?n="HH:mm:ss":n="HH:mm",(0,Po.utc)(t.asMilliseconds()).format(n)}};(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Mo=class extends Ve{constructor(t){super(t,"url",$.UrlComponent)}valueFromString(t){return t}};var Da=je(bn(),1);(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Mf="YYYY-[W]WW",Io=class extends $e{constructor(t){super(t,"week",$.WeekComponent)}valueFromString(t){let n=(0,Da.default)(t,Mf);if(!n.isValid())throw new Error("Invalid week");return{weekNumber:n.isoWeek(),year:n.year()}}valueToString(t){return(0,Da.default)().year(t.year).isoWeek(t.weekNumber).format(Mf)}};(function(){if(globalThis.process)return;let t={browser:!0,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=t})();var Qe=class extends If.Setting{addComponent(t,n){let i=new t(this.controlEl);return this.components.push(i),n(i),this}addDate(t){return this.addComponent(wo,t)}addDateTime(t){return this.addComponent(ko,t)}addEmail(t){return this.addComponent(yo,t)}addFile(t){return this.addComponent(xo,t)}addMonth(t){return this.addComponent(bo,t)}addMultipleDropdown(t){return this.addComponent(vo,t)}addMultipleEmail(t){return this.addComponent(So,t)}addMultipleFile(t){return this.addComponent(_o,t)}addMultipleText(t){return this.addComponent(Eo,t)}addNumber(t){return this.addComponent(Ao,t)}addTime(t){return this.addComponent(Fo,t)}addUrl(t){return this.addComponent(Mo,t)}addWeek(t){return this.addComponent(Io,t)}};var Lo=class extends po{display(){this.containerEl.empty();let t="Move Attachments with Note";new Qe(this.containerEl).setName(t).setDesc("Automatically move attachments when a note is relocated. This includes attachments located in the same folder or any of its subfolders.").addToggle(s=>this.bind(s,"moveAttachmentsWithNote",{onChanged:async()=>{await this.checkDangerousSetting("moveAttachmentsWithNote",t)}}));let n="Delete Unused Attachments with Note";new Qe(this.containerEl).setName(n).setDesc("Automatically remove attachments that are no longer referenced in other notes when the note is deleted.").addToggle(s=>this.bind(s,"deleteAttachmentsWithNote",{onChanged:async()=>{await this.checkDangerousSetting("deleteAttachmentsWithNote",n)}})),new Qe(this.containerEl).setName("Update Links").setDesc("Automatically update links to attachments and other notes when moving notes or attachments.").addToggle(s=>this.bind(s,"updateLinks")),new Qe(this.containerEl).setName("Delete Empty Folders").setDesc("Automatically remove empty folders after moving notes with attachments.").addToggle(s=>this.bind(s,"deleteEmptyFolders"));let i="Delete Duplicate Attachments on Note Move";new Qe(this.containerEl).setName(i).setDesc("Automatically delete attachments when moving a note if a file with the same name exists in the destination folder. If disabled, the file will be renamed and moved.").addToggle(s=>this.bind(s,"deleteExistFilesWhenMoveNote",{onChanged:async()=>{await this.checkDangerousSetting("deleteExistFilesWhenMoveNote",i)}})),new Qe(this.containerEl).setName("Update Backlink Text on Note Rename").setDesc("When a note is renamed, its linked references are automatically updated. If this option is enabled, the text of backlinks to this note will also be modified.").addToggle(s=>this.bind(s,"changeNoteBacklinksAlt")),new Qe(this.containerEl).
`;for(let s of this.keys()){let l=ce(n,s);if(!l)continue;let u=no({app:n,sourcePathOrFile:i,targetPathOrFile:l});o+=`${u}:
`;for(let f of this.get(s)??[])o+=`- (line ${(f.position.start.line+1).toString()}): \`${f.link}\`
`;o+=`
2025-01-13 11:22:31 +08:00
2025-03-03 19:56:35 +08:00
`}return o}return`# ${this.title}
2025-01-13 11:22:31 +08:00
No problems found
2025-03-03 19:56:35 +08:00
`}},Rr=class{constructor(t){this.plugin=t;}async checkConsistency(t,n,i,o,s){if(this.plugin.settings.isPathIgnored(t.path))return;let l=await mt(this.plugin.app,t.path);if(!l)return;let u=l.links??[],f=l.embeds??[];for(let m of u)await this.isValidLink(m,t.path)||n.add(t.path,m),Kn(m.original)&&o.add(t.path,m);for(let m of f)await this.isValidLink(m,t.path)||i.add(t.path,m),Kn(m.original)&&s.add(t.path,m)}async convertAllNoteEmbedsPathsToRelative(t){return await this.convertAllNoteRefPathsToRelative(t,!0)}async convertAllNoteLinksPathsToRelative(t){return await this.convertAllNoteRefPathsToRelative(t,!1)}async getCachedNotesThatHaveLinkToFile(t){let n=ce(this.plugin.app,t);return n?(await Jt(this.plugin.app,n)).keys():[]}getFullPathForLink(t,n){({linkPath:t}=Kt(t));let i=se(n);return we(i,t)}async replaceAllNoteWikilinksWithMarkdownLinks(t,n){if(this.plugin.settings.isPathIgnored(t))return 0;let i=ce(this.plugin.app,t);if(!i)return console.warn(`can't update wikilinks in note, file not found: ${t}`),0;let o=await mt(this.plugin.app,i);if(!o)return 0;let l=((n?o.embeds:o.links)??[]).filter(u=>Kn(u.original)).length;return await io({app:this.plugin.app,newSourcePathOrFile:i,shouldForceMarkdownLinks:!0,shouldUpdateEmbedOnlyLinks:n}),l}async updateChangedPathsInNote(t,n){if(this.plugin.settings.isPathIgnored(t))return;let i=ce(this.plugin.app,t);if(!i){console.warn(`can't update links in note, file not found: ${t}`);return}let o=new Map;for(let s of n)o.set(s.oldPath,s.newPath);await this.updateLinks(i,i.path,o)}async convertAllNoteRefPathsToRelative(t,n){if(this.plugin.settings.isPathIgnored(t))return[];let i=ce(this.plugin.app,t);if(!i)return[];let o=[];return await Mr(this.plugin.app,i,async()=>{let s=await mt(this.plugin.app,i);if(!s)return[];let l=(n?s.embeds:s.links)??[],u=[];for(let f of l){let m={endIndex:f.position.end.offset,newContent:this.convertLink({forceRelativePath:!0,link:f,note:i,oldNotePath:t}),oldContent:f.original,startIndex:f.position.start.offset};u.push(m),o.push({newLink:m.newContent,old:f})}return u}),o}convertLink({forceRelativePath:t,link:n,note:i,oldNotePath:o,pathChangeMap:s}){let{linkPath:l,subpath:u}=Kt(n.link),f=Yt(this.plugin.app,n,o)?.path??we(se(o),l),m=s?s.get(f):Yt(this.plugin.app,n,i.path)?.path??we(se(i.path),l);if(!m)return n.original;let h=ce(this.plugin.app,m)??ce(this.plugin.app,f);if(!h)return n.original;let p=n.displayText&&we(i.parent?.path??"",n.displayText)===f?void 0:n.displayText;return no({alias:p,app:this.plugin.app,originalLink:n.original,shouldForceRelativePath:t,sourcePathOrFile:i.path,subpath:u,targetPathOrFile:h})}async isValidLink(t,n){let{linkPath:i,subpath:o}=Kt(t.link),s;i?i.startsWith("/")?s=(0,Df.normalizePath)(i):s=we(se(n),i):s=n;let l=ce(this.plugin.app,s);if(!l)return!1;if(!o)return!0;let u=l.extension.toLocaleLowerCase();if(u==="pdf")return o.startsWith("#page=");if(u!==ui)return!1;let f=await mt(this.plugin.app,l);if(!f)return!1;let m="#^";if(o.startsWith(m))return Object.keys(f.blocks??{}).includes(Dt(o,m));let h="#";return(f.headings??[]).map(p=>p.heading.replaceAll(h," ")).includes(Dt(o,h))}async updateLinks(t,n,i){await Mr(this.plugin.app,t,async()=>{let o=await mt(this.plugin.app,t);return o?vt(o).map(l=>Xi(l,this.convertLink({link:l,note:t,oldNotePath:n,pathChangeMap:i}))):[]})}};var Nr=class{constructor(t,n){this.plugin=t;this.lh=n;}async collectAttachmentsForCachedNote(t,n,i){if(this.plugin.settings.isPathIgnored(t))return{movedAttachments:[]};let o={movedAttachments:[]},s=await mt(this.plugin.app,t);if(!s)return o;for(let l of vt(s)){let{linkPath:u}=Kt(l.link);if(!u)continue;let f=this.lh.getFullPathForLink(u,t);if(o.movedAttachments.findIndex(w=>w.oldPath===f)!==-1)continue;let m=Yt(this.plugin.app,l,t);if(!m){let w=ro(l.original)?"embed":"link";console.warn(`${t} has bad ${w} (file does not exist): ${u}`);continue}if(!this.isAttachment(m))continue;let h=await Ss(this.plugin.app,m.path,t);if(se(h)===se(m.path))continue;let p=await this.moveAttachment(m,h,[t],n,i);o.movedAttachments=o.movedAttachments.concat(p.movedAttachments)}return o}async del
${t}`),await this.plugin.app.vault.exists(t)))try{await this.plugin.app.vault.adapter.rmdir(t,!1)}catch(i){if(await this.plugin.app.vault.adapter.exists(t))throw i}}async createFolderForAttachmentFromPath(t){await Zn(this.plugin.app,se(t))}async deleteFile(t,n){if(await this.plugin.app.fileManager.trashFile(t),n){let i=t.parent;for(;i&&i.children.length===0;)await this.plugin.app.fileManager.trashFile(i),i=i.parent}}isAttachment(t){return!Rt(this.plugin.app,t)}async moveAttachment(t,n,i,o,s){let l=t.path,u={movedAttachments:[]};if(this.plugin.settings.isPathIgnored(l)||!this.isAttachment(t))return u;if(l===n)return console.warn("Can't move file. Source and destination path the same."),u;await this.createFolderForAttachmentFromPath(n);let f=await this.lh.getCachedNotesThatHaveLinkToFile(l);for(let w of i)f.remove(w);if(l!==t.path)return console.warn("File was moved already"),await this.moveAttachment(t,n,i,o,s);let m=t.parent,h=f.length===0,p=ce(this.plugin.app,n);return p&&(o?(this.plugin.consoleDebug(`delete: ${n}`),await this.deleteFile(p,s)):n=Qi(this.plugin.app,n)),this.plugin.consoleDebug(`${h?"move":"copy"}
from: ${l}
to: ${n}`),u.movedAttachments.push({newPath:n,oldPath:l}),h?await Ji(this.plugin.app,t,n):await sf(this.plugin.app,t,n),this.plugin.settings.deleteEmptyFolders&&await oo(this.plugin.app,m),u}};var Oo=class extends bi{deletedNoteCache=new Map;fh;lh;async saveSettings(t){await super.saveSettings(t),this.lh=new Rr(this),this.fh=new Nr(this,this.lh)}createPluginSettings(t){return new mo(t)}createPluginSettingsTab(){return new Lo(this)}async onLayoutReady(){await this.showBackupWarning()}onloadComplete(){this.registerEvent(this.app.metadataCache.on("deleted",(t,n)=>{n&&this.handleDeletedMetadata(t,n)})),yf(this,()=>({isPathIgnored:n=>this.settings.isPathIgnored(n),shouldDeleteConflictingAttachments:this.settings.deleteExistFilesWhenMoveNote,shouldDeleteEmptyFolders:this.settings.deleteEmptyFolders,shouldHandleDeletions:this.settings.deleteAttachmentsWithNote,shouldHandleRenames:this.settings.updateLinks,shouldRenameAttachmentFolder:this.settings.moveAttachmentsWithNote,shouldUpdateFilenameAliases:this.settings.changeNoteBacklinksAlt})),this.addCommand({callback:()=>this.collectAllAttachments(),id:"collect-all-attachments",name:"Collect All Attachments"}),this.addCommand({checkCallback:t=>this.collectAttachmentsCurrentFolder(t),id:"collect-attachments-current-folder",name:"Collect Attachments in Current Folder"}),this.addCommand({checkCallback:this.collectAttachmentsCurrentNote.bind(this),id:"collect-attachments-current-note",name:"Collect Attachments in Current Note"}),this.addCommand({callback:()=>this.deleteEmptyFolders(),id:"delete-empty-folders",name:"Delete Empty Folders"}),this.addCommand({callback:()=>this.convertAllLinkPathsToRelative(),id:"convert-all-link-paths-to-relative",name:"Convert All Link Paths to Relative"}),this.addCommand({checkCallback:this.convertAllLinkPathsToRelativeCurrentNote.bind(this),id:"convert-all-link-paths-to-relative-current-note",name:"Convert All Link Paths to Relative in Current Note"}),this.addCommand({callback:()=>this.convertAllEmbedsPathsToRelative(),id:"convert-all-embed-paths-to-relative",name:"Convert All Embed Paths to Relative"}),this.addCommand({checkCallback:this.convertAllEmbedsPathsToRelativeCurrentNote.bind(this),id:"convert-all-embed-paths-to-relative-current-note",name:"Convert All Embed Paths to Relative in Current Note"}),this.addCommand({callback:()=>this.replaceAllWikilinksWithMarkdownLinks(),id:"replace-all-wikilinks-with-markdown-links",name:"Replace All Wiki Links with Markdown Links"}),this.addCommand({checkCallback:this.replaceAllWikilinksWithMarkdownLinksCurrentNote.bind(this),id:"replace-all-wikilinks-with-markdown-links-current-note",name:"Replace All Wiki Links with Markdown Links in Current Note"}),this.addCommand({callback:()=>this.replaceAllWikiEmbedsWithMarkdownEmbeds(),id:"replace-all-wiki-embeds-with-markdown-embeds",name:"Replace All Wiki Embeds with Markdown Embeds"}),this.addCommand({checkCallback:this.replaceAllWikiEmbedsWithMarkdownEmbedsCurrentNote.bind(this),id:"replace-all-wiki-embeds-with-markdown-embeds-current-note",name:"Replace All Wiki Embeds with Markdown Embeds in Current Note"}),this.addCommand({callback:()=>this.reorganizeVault(),id:"reorganize-vault",name:"Reorganize Vault"}),this.addCommand({callback:()=>this.checkConsistency(),id:"check-consistency",name:"Check Vault consistency"}),this.registerEvent(this.app.metadataCache.on("changed",t=>{it(this.app,()=>this.handleMetadataCacheChanged(t))})),this.registerEvent(this.app.workspace.on("file-menu",(t,n)=>{this.handleFileMenu(t,n)})),this.lh=new Rr(this),this.fh=new Nr(this,this.lh)}async checkConsistency(){await this.saveAllOpenNotes();let t=new vn("Bad links"),n=new vn("Bad embeds"),i=new vn("Wiki links"),o=new vn("Wiki embeds");await dn({abortSignal:this.abortSignal,buildNoticeMessage:(m,h)=>`Checking note ${h} - ${m.path}`,items:Qn(this.app),processItem:async m=>{await this.lh.checkConsistency(m,t,n,i,o)},shouldContinueOnError:!0});let s=this.settings.consistencyReportFile,l=t.toString(this.app,s)+n.toString(this.app,s)+i.toString(this.app,s)+o.toString(this.app,s);await Zn(this.
/*! Bundled license information:
moment/moment.js:
(*! moment.js *)
(*! version : 2.30.1 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
*/
2025-01-13 11:22:31 +08:00
/* nosourcemap */