18 lines
225 KiB
JavaScript
18 lines
225 KiB
JavaScript
|
|
"use strict";var _c=Object.defineProperty;var pc=(t,e,s)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Le=(t,e,s)=>pc(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ca=require("siyuan");function Ct(){}function wc(t,e){for(const s in e)t[s]=e[s];return t}function To(t){return t()}function zr(){return Object.create(null)}function st(t){t.forEach(To)}function Oo(t){return typeof t=="function"}function an(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function bc(t){return Object.keys(t).length===0}function Qs(t,e,s,n){if(t){const i=Yo(t,e,s,n);return t[0](i)}}function Yo(t,e,s,n){return t[1]&&n?wc(s.ctx.slice(),t[1](n(e))):s.ctx}function Xs(t,e,s,n){if(t[2]&&n){const i=t[2](n(s));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],f=Math.max(e.dirty.length,i.length);for(let c=0;c<f;c+=1)o[c]=e.dirty[c]|i[c];return o}return e.dirty|i}return e.dirty}function Ks(t,e,s,n,i,o){if(i){const f=Yo(e,s,n,o);t.p(f,i)}}function en(t){if(t.ctx.length>32){const e=[],s=t.ctx.length/32;for(let n=0;n<s;n++)e[n]=-1;return e}return-1}function He(t,e){t.appendChild(e)}function j(t,e,s){t.insertBefore(e,s||null)}function B(t){t.parentNode&&t.parentNode.removeChild(t)}function $e(t){return document.createElement(t)}function qr(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function rn(t){return document.createTextNode(t)}function te(){return rn(" ")}function $a(){return rn("")}function We(t,e,s,n){return t.addEventListener(e,s,n),()=>t.removeEventListener(e,s,n)}function V(t,e,s){s==null?t.removeAttribute(e):t.getAttribute(e)!==s&&t.setAttribute(e,s)}function Zr(t,e,s){t.setAttributeNS("http://www.w3.org/1999/xlink",e,s)}function pi(t){return t===""?null:+t}function yc(t){return Array.from(t.childNodes)}function Ri(t,e){e=""+e,t.data!==e&&(t.data=e)}function ht(t,e){t.value=e??""}function la(t,e,s,n){s==null?t.style.removeProperty(e):t.style.setProperty(e,s,"")}function Jr(t,e,s){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e){i.selected=!0;return}}(!s||e!==void 0)&&(t.selectedIndex=-1)}function kc(t){const e=t.querySelector(":checked");return e&&e.__value}function z(t,e,s){t.classList.toggle(e,!!s)}function Dc(t,e,{bubbles:s=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:s,cancelable:n})}let Pn;function On(t){Pn=t}function vc(){if(!Pn)throw new Error("Function called outside component initialization");return Pn}function Co(){const t=vc();return(e,s,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Dc(e,s,{cancelable:n});return i.slice().forEach(f=>{f.call(t,o)}),!o.defaultPrevented}return!0}}const Vs=[],Qr=[];let zs=[];const Xr=[],Mc=Promise.resolve();let wi=!1;function Sc(){wi||(wi=!0,Mc.then($o))}function wa(t){zs.push(t)}const fi=new Set;let Us=0;function $o(){if(Us!==0)return;const t=Pn;do{try{for(;Us<Vs.length;){const e=Vs[Us];Us++,On(e),Tc(e.$$)}}catch(e){throw Vs.length=0,Us=0,e}for(On(null),Vs.length=0,Us=0;Qr.length;)Qr.pop()();for(let e=0;e<zs.length;e+=1){const s=zs[e];fi.has(s)||(fi.add(s),s())}zs.length=0}while(Vs.length);for(;Xr.length;)Xr.pop()();wi=!1,fi.clear(),On(t)}function Tc(t){if(t.fragment!==null){t.update(),st(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(wa)}}function Oc(t){const e=[],s=[];zs.forEach(n=>t.indexOf(n)===-1?e.push(n):s.push(n)),s.forEach(n=>n()),zs=e}const ha=new Set;let Ss;function ba(){Ss={r:0,c:[],p:Ss}}function ya(){Ss.r||st(Ss.c),Ss=Ss.p}function P(t,e){t&&t.i&&(ha.delete(t),t.i(e))}function R(t,e,s,n){if(t&&t.o){if(ha.has(t))return;ha.add(t),Ss.c.push(()=>{ha.delete(t),n&&(s&&t.d(1),n())}),t.o(e)}else n&&n()}function ka(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Yc(t,e){t.d(1),e.delete(t.key)}function Cc(t,e){R(t,1,1,()=>{e.delete(t.key)})}function No(t,e,s,n,i,o,f,c,h,_,k,$){let p=t.length,b=o.length,g=p;const y={};for(;g--;)y[t[g].key]=g;const w=[],H=new Map,be=new Map,v=[];for(g=b;g
|
||
|
|
[`+m+"] ";for(D in arguments[0])c(arguments[0],D)&&(d+=D+": "+arguments[0][D]+", ");d=d.slice(0,-2)}else d=arguments[m];u.push(d)}ye(a+`
|
||
|
|
Arguments: `+Array.prototype.slice.call(u).join("")+`
|
||
|
|
`+new Error().stack),l=!1}return r.apply(this,arguments)},r)}var qe={};function nt(a,r){n.deprecationHandler!=null&&n.deprecationHandler(a,r),qe[a]||(ye(r),qe[a]=!0)}n.suppressDeprecationWarnings=!1,n.deprecationHandler=null;function ve(a){return typeof Function<"u"&&a instanceof Function||Object.prototype.toString.call(a)==="[object Function]"}function _t(a){var r,l;for(l in a)c(a,l)&&(r=a[l],ve(r)?this[l]=r:this["_"+l]=r);this._config=a,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Ze(a,r){var l=b({},a),u;for(u in r)c(r,u)&&(f(a[u])&&f(r[u])?(l[u]={},b(l[u],a[u]),b(l[u],r[u])):r[u]!=null?l[u]=r[u]:delete l[u]);for(u in a)c(a,u)&&!c(r,u)&&f(a[u])&&(l[u]=b({},l[u]));return l}function Je(a){a!=null&&this.set(a)}var Qe;Object.keys?Qe=Object.keys:Qe=function(a){var r,l=[];for(r in a)c(a,r)&&l.push(r);return l};var It={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function St(a,r,l){var u=this._calendar[a]||this._calendar.sameElse;return ve(u)?u.call(r,l):u}function Ae(a,r,l){var u=""+Math.abs(a),d=r-u.length,m=a>=0;return(m?l?"+":"":"-")+Math.pow(10,Math.max(0,d)).toString().substr(1)+u}var ss=/(\[[^\[]*\])|(\\)?([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,ut=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,pt={},wt={};function F(a,r,l,u){var d=u;typeof u=="string"&&(d=function(){return this[u]()}),a&&(wt[a]=d),r&&(wt[r[0]]=function(){return Ae(d.apply(this,arguments),r[1],r[2])}),l&&(wt[l]=function(){return this.localeData().ordinal(d.apply(this,arguments),a)})}function A(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function cn(a){var r=a.match(ss),l,u;for(l=0,u=r.length;l<u;l++)wt[r[l]]?r[l]=wt[r[l]]:r[l]=A(r[l]);return function(d){var m="",D;for(D=0;D<u;D++)m+=ve(r[D])?r[D].call(d,a):r[D];return m}}function ps(a,r){return a.isValid()?(r=hn(r,a.localeData()),pt[r]=pt[r]||cn(r),pt[r](a)):a.localeData().invalidDate()}function hn(a,r){var l=5;function u(d){return r.longDateFormat(d)||d}for(ut.lastIndex=0;l>=0&&ut.test(a);)a=a.replace(ut,u),ut.lastIndex=0,l-=1;return a}var Vn={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 Bn(a){var r=this._longDateFormat[a],l=this._longDateFormat[a.toUpperCase()];return r||!l?r:(this._longDateFormat[a]=l.match(ss).map(function(u){return u==="MMMM"||u==="MM"||u==="DD"||u==="dddd"?u.slice(1):u}).join(""),this._longDateFormat[a])}var Ha="Invalid date";function Ns(){return this._invalidDate}var Gn="%d",ns=/\d{1,2}/;function Va(a){return this._ordinal.replace("%d",a)}var mn={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 ws(a,r,l,u){var d=this._relativeTime[l];return ve(d)?d(a,r,l,u):d.replace(/%d/i,a)}function Ps(a,r){var l=this._relativeTime[a>0?"future":"past"];return ve(l)?l(r):l.replace(/%s/i,r)}var jn={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 Be(a){return typeof
|
||
|
|
return n.version="2.30.1",i(Me),n.fn=O,n.min=nf,n.max=af,n.now=rf,n.utc=g,n.unix=Id,n.months=Ed,n.isDate=$,n.locale=rs,n.invalid=v,n.duration=yt,n.isMoment=M,n.weekdays=Ld,n.parseZone=xd,n.localeData=At,n.isDuration=ta,n.monthsShort=Fd,n.weekdaysMin=Ad,n.defineLocale=Ja,n.updateLocale=Iu,n.locales=xu,n.weekdaysShort=Wd,n.normalizeUnits=Be,n.relativeTimeRounding=hc,n.relativeTimeThreshold=mc,n.calendarFormat=Nf,n.prototype=O,n.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},n})})(Wo);var Oh=Wo.exports;const Mi=Lo(Oh);//! moment.js
|
||
|
|
//! version : 2.30.1
|
||
|
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
||
|
|
//! license : MIT
|
||
|
|
//! momentjs.com
|
||
|
|
var Ao;function N(){return Ao.apply(null,arguments)}function Yh(t){Ao=t}function Dt(t){return t instanceof Array||Object.prototype.toString.call(t)==="[object Array]"}function Ys(t){return t!=null&&Object.prototype.toString.call(t)==="[object Object]"}function ce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ei(t){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(t).length===0;var e;for(e in t)if(ce(t,e))return!1;return!0}function Ke(t){return t===void 0}function Kt(t){return typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]"}function Wn(t){return t instanceof Date||Object.prototype.toString.call(t)==="[object Date]"}function Uo(t,e){var s=[],n,i=t.length;for(n=0;n<i;++n)s.push(e(t[n],n));return s}function ms(t,e){for(var s in e)ce(e,s)&&(t[s]=e[s]);return ce(e,"toString")&&(t.toString=e.toString),ce(e,"valueOf")&&(t.valueOf=e.valueOf),t}function Pt(t,e,s,n){return fl(t,e,s,n,!0).utc()}function Ch(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function X(t){return t._pf==null&&(t._pf=Ch()),t._pf}var Si;Array.prototype.some?Si=Array.prototype.some:Si=function(t){var e=Object(this),s=e.length>>>0,n;for(n=0;n<s;n++)if(n in e&&t.call(this,e[n],n,e))return!0;return!1};function Fi(t){var e=null,s=!1,n=t._d&&!isNaN(t._d.getTime());if(n&&(e=X(t),s=Si.call(e.parsedDateParts,function(i){return i!=null}),n=e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&s),t._strict&&(n=n&&e.charsLeftOver===0&&e.unusedTokens.length===0&&e.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(t))t._isValid=n;else return n;return t._isValid}function Na(t){var e=Pt(NaN);return t!=null?ms(X(e),t):X(e).userInvalidated=!0,e}var _o=N.momentProperties=[],hi=!1;function Li(t,e){var s,n,i,o=_o.length;if(Ke(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),Ke(e._i)||(t._i=e._i),Ke(e._f)||(t._f=e._f),Ke(e._l)||(t._l=e._l),Ke(e._strict)||(t._strict=e._strict),Ke(e._tzm)||(t._tzm=e._tzm),Ke(e._isUTC)||(t._isUTC=e._isUTC),Ke(e._offset)||(t._offset=e._offset),Ke(e._pf)||(t._pf=X(e)),Ke(e._locale)||(t._locale=e._locale),o>0)for(s=0;s<o;s++)n=_o[s],i=e[n],Ke(i)||(t[n]=i);return t}function An(t){Li(this,t),this._d=new Date(t._d!=null?t._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),hi===!1&&(hi=!0,N.updateOffset(this),hi=!1)}function vt(t){return t instanceof An||t!=null&&t._isAMomentObject!=null}function Ho(t){N.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+t)}function mt(t,e){var s=!0;return ms(function(){if(N.deprecationHandler!=null&&N.deprecationHandler(null,t),s){var n=[],i,o,f,c=arguments.length;for(o=0;o<c;o++){if(i="",typeof arguments[o]=="object"){i+=`
|
||
|
|
[`+o+"] ";for(f in arguments[0])ce(arguments[0],f)&&(i+=f+": "+arguments[0][f]+", ");i=i.slice(0,-2)}else i=arguments[o];n.push(i)}Ho(t+`
|
||
|
|
Arguments: `+Array.prototype.slice.call(n).join("")+`
|
||
|
|
`+new Error().stack),s=!1}return e.apply(this,arguments)},e)}var po={};function Vo(t,e){N.deprecationHandler!=null&&N.deprecationHandler(t,e),po[t]||(Ho(e),po[t]=!0)}N.suppressDeprecationWarnings=!1;N.deprecationHandler=null;function Rt(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function $h(t){var e,s;for(s in t)ce(t,s)&&(e=t[s],Rt(e)?this[s]=e:this["_"+s]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Ti(t,e){var s=ms({},t),n;for(n in e)ce(e,n)&&(Ys(t[n])&&Ys(e[n])?(s[n]={},ms(s[n],t[n]),ms(s[n],e[n])):e[n]!=null?s[n]=e[n]:delete s[n]);for(n in t)ce(t,n)&&!ce(e,n)&&Ys(t[n])&&(s[n]=ms({},s[n]));return s}function Wi(t){t!=null&&this.set(t)}var Oi;Object.keys?Oi=Object.keys:Oi=function(t){var e,s=[];for(e in t)ce(t,e)&&s.push(e);return s};var Nh={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Ph(t,e,s){var n=this._calendar[t]||this._calendar.sameElse;return Rt(n)?n.call(e,s):n}function $t(t,e,s){var n=""+Math.abs(t),i=e-n.length,o=t>=0;return(o?s?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+n}var Ai=/(\[[^\[]*\])|(\\)?([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,fa=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,mi={},qs={};function G(t,e,s,n){var i=n;typeof n=="string"&&(i=function(){return this[n]()}),t&&(qs[t]=i),e&&(qs[e[0]]=function(){return $t(i.apply(this,arguments),e[1],e[2])}),s&&(qs[s]=function(){return this.localeData().ordinal(i.apply(this,arguments),t)})}function Rh(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Ih(t){var e=t.match(Ai),s,n;for(s=0,n=e.length;s<n;s++)qs[e[s]]?e[s]=qs[e[s]]:e[s]=Rh(e[s]);return function(i){var o="",f;for(f=0;f<n;f++)o+=Rt(e[f])?e[f].call(i,t):e[f];return o}}function ga(t,e){return t.isValid()?(e=Bo(e,t.localeData()),mi[e]=mi[e]||Ih(e),mi[e](t)):t.localeData().invalidDate()}function Bo(t,e){var s=5;function n(i){return e.longDateFormat(i)||i}for(fa.lastIndex=0;s>=0&&fa.test(t);)t=t.replace(fa,n),fa.lastIndex=0,s-=1;return t}var xh={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 Eh(t){var e=this._longDateFormat[t],s=this._longDateFormat[t.toUpperCase()];return e||!s?e:(this._longDateFormat[t]=s.match(Ai).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[t])}var Fh="Invalid date";function Lh(){return this._invalidDate}var Wh="%d",Ah=/\d{1,2}/;function Uh(t){return this._ordinal.replace("%d",t)}var Hh={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 Vh(t,e,s,n){var i=this._relativeTime[s];return Rt(i)?i(t,e,s,n):i.replace(/%d/i,t)}function Bh(t,e){var s=this._relativeTime[t>0?"future":"past"];return Rt(s)?s(e):s.replace(/%s/i,e)}var wo={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 gt(t)
|
||
|
|
N.version="2.30.1";Yh(Te);N.fn=Y;N.min=_g;N.max=pg;N.now=wg;N.utc=Pt;N.unix=j_;N.months=q_;N.isDate=Wn;N.locale=_s;N.invalid=Na;N.duration=Mt;N.isMoment=vt;N.weekdays=J_;N.parseZone=z_;N.localeData=es;N.isDuration=_a;N.monthsShort=Z_;N.weekdaysMin=X_;N.defineLocale=Zi;N.updateLocale=zm;N.locales=qm;N.weekdaysShort=Q_;N.normalizeUnits=gt;N.relativeTimeRounding=Sp;N.relativeTimeThreshold=Tp;N.calendarFormat=Vg;N.prototype=Y;N.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};function Cn(t){return N(t).utcOffset("+08:00").format("YYYY-MM-DD HH:mm:ss")}function Yt(t){const e=typeof t=="number"?t*1e3:t;return N(e).format(exports.pluginConfigData.advanced.formatDataTime)}function Yp(t){const e=typeof t=="number"?t*1e3:t;return N(e).format("YYYY-MM-DD")}class $n{static async getAllMemos(){C(exports.pluginConfigData.debug.isDebug,"正在获取 Memos 数据...");const e=exports.pluginConfigData.filter.lastSyncTime,s=10;let n=0,i=[];for(;;){const f=await vh({offset:n,limit:s});C(exports.pluginConfigData.debug.isDebug,"resData",f);const c=f.filter(h=>Mi(Yt(h.updatedTs)).isSameOrAfter(Yt(e)));if(i.push(...c),C(exports.pluginConfigData.debug.isDebug,"memos",c),f.length===0)break;n+=s}return C(exports.pluginConfigData.debug.isDebug,"获取结果",i),i}static async checkAccessToken(){const e=await Dh();return!K(e)}static async checkNew(){return(await this.getAllMemos()).length>0}static async getMemos(){let e=await this.getAllMemos();C(exports.pluginConfigData.debug.isDebug,"正在整理 Memos 数据...");const s=exports.pluginConfigData.filter.lastSyncTime;let n=e.filter(o=>Mi(Yt(o.createdTs)).isBefore(Yt(s))),i={new:e,old:n};return C(exports.pluginConfigData.debug.isDebug,"整理结果",i),i}static async downloadResource(e){return await Mh(e)}}function Pi(t){return K(t)?null:t.join(" && ")}async function Do(){return await Nt.send(je.POST,"/api/v1/auth/status")}async function vo(t,e,s,n){return await Nt.send(je.GET,"/api/v1/memos",{pageSize:t,pageToken:e,filter:Pi(s),view:n})}async function Cp(t,e,s,n,i,o,f,c){return await Nt.send(je.GET,"/api/v1/memos",{parent:t,pageSize:e,pageToken:s,state:n,sort:i,direction:o,filter:Pi(f),oldFilter:Pi(c)})}async function $p(t,e){return await Nt.get(`/file/${t}/${e}`)}async function Np(t){return await Nt.get(`/file/${t}`)}async function Pp(t){return await Nt.send(je.GET,`/api/v1/memos/${t}`)}const Ca=class Ca{static async initData(){const e=await this.getUserData();this.username=e.name}static async tagFilter(e){const s=exports.pluginConfigData.filter.tagFilterMode;if(s===ze.all)return e;if(s===ze.syncNoTag)return console.log("仅同步无标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?e.filter(o=>o.tags.length===0):e.filter(o=>o.property.tags.length===0);if(s===ze.notSyncNoTag)return console.log("不同步无标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?e.filter(o=>o.tags.length>0):e.filter(o=>o.property.tags.length>0);let i=exports.pluginConfigData.filter.tagList.split(";");return s===ze.syncSpecTag?(console.log("仅同步指定标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?(console.log(i),e.filter(o=>us(o.tags,i))):e.filter(o=>us(o.property.tags,i))):s===ze.notSyncSpecTag?(console.log("不同步指定标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?e.filter(o=>!us(o.tags,i)):e.filter(o=>!us(o.property.tags,i))):s===ze.syncSpecTagAndNoTag?(console.log("同步指定标签及无标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?e.filter(o=>us(o.tags,i)||o.tags.length===0):e.filter(o=>us(o.property.tags,i)||o.property.tags.length===0)):s===ze.notSyncSpecTagAndNoTag?(console.log("不同步指定标签及无标签的数据"),Se.V2_Y2025_M02_D05.includes(exports.pluginConfigData.base.version)?e.filter(o=>!us(o.tags,i)&&o.tags
|
||
|
|
$2`)}static handleHref(e){let s=dt.href;return e.replace(s,n=>`[${n}](${n})`)}static async handleBacklinks(e){let s=dt.backlinks,n=e.match(s);for(let i of n){let o=await et.getDocumentIdByName(i);e=e.replace(`((${i}))`,`((${o} "${i}"))`)}return e}static handleEmbeddedContent(e){let s=dt.embedded;return e.match(s)[0].split("/").pop()}static handleImage(e,s){return``}static handleResource(e,s){return`[${e}](${s})`}static handleVideo(e){return`<video controls='controls' src='${e}' data-src='${e}' style='width: 1384px; height: 723px;'></video>`}}class js{constructor(){Le(this,"relations");Le(this,"resources");Le(this,"newMemos");this.newMemos=[],this.relations=[],this.resources=[]}async handleMemos(e){for(let s of e)this.newMemos.push(await this.handelMemo(s))}async handelMemo(e){C(exports.pluginConfigData.debug.isDebug,"开始处理 Memos",e);let s=this.getMemoId(e),n=this.getMemoUid(e),i=this.getUpdateTime(e),o=`${i}・#${s}`,f=await this.getContents(e);this.handleResources(e,f),this.handleRelations(e);let c={id:s,uid:n,title:o,updateTime:i,contents:f,memo:e};return C(exports.pluginConfigData.debug.isDebug,"处理结果",c),c}async getContents(e){let s=[],n="",i=Rp(e.content,`
|
||
|
|
`,!1);C(exports.pluginConfigData.debug.isDebug,"内容根据换行符拆分成列表",i);let o=dt.embedded;for(let f=0;f<i.length;f++){let c=i[f];o.test(c)?(this.saveContents(s,n,cs.text),this.saveContents(s,c,cs.embedded),n=""):(n+=c,f===i.length-1?this.saveContents(s,n,cs.text):n+=`
|
||
|
|
`),o.lastIndex=0}return C(exports.pluginConfigData.debug.isDebug,"处理后的内容",s),await this.handleContent(s),s}saveContents(e,s,n){if(K(s))return;let i={type:n,content:s};e.push(i)}async handleContent(e){for(let s=0;s<e.length;s++){let n=e[s].type,i=e[s].content;n===cs.embedded&&(i=fs.handleEmbeddedContent(i)),exports.pluginConfigData.advanced.isHandleBacklinks&&dt.backlinks.test(i)&&(i=await fs.handleBacklinks(i)),dt.backlinks.lastIndex=0,exports.pluginConfigData.advanced.isHandleHref&&dt.href.test(i)&&!dt.mdLink.test(i)?i=fs.handleHref(i):(dt.tag.test(i)&&(i=fs.handleTags(i),i=fs.handleTagBlock(i)),dt.tag.lastIndex=0),dt.href.lastIndex=0,e[s].content=i}}getResourceContents(e,s){for(let n of s){let i=this.getResourceMarkdown(n);e.push({type:cs.resource,content:i})}}getResourceMarkdown(e){let s=e.filename,n="",i="";K(e.externalLink)?(n=this.getResourcePath(e),i=s.split(".").pop()):(n=e.externalLink,i=e.externalLink.split(".").pop());let o=e.type.split("/")[0];return o==Mo.image?fs.handleImage(s,n):o==Mo.video&&exports.pluginConfigData.advanced.isHandleVideo&&exports.pluginConfigData.advanced.videoFormats.split(";").includes(i)?fs.handleVideo(n):fs.handleResource(s,n)}static sortMemos(e,s){e.sort((n,i)=>{const o=new Date(n.updateTime).getTime(),f=new Date(i.updateTime).getTime();return s?o-f:f-o})}}class Fn extends js{getMemoId(e){return e.id.toString()}getMemoUid(e){return e.name}getCreateTime(e){return Yt(e.createdTs)}getUpdateTime(e){return Yt(e.updatedTs)}handleRelations(e){let s=e.relationList;for(let n of s)this.relations.some(o=>n.memoId===o.memoId&&n.relatedMemoId===o.relatedMemoId)||this.relations.push(n)}handleResources(e,s){let n=e.resourceList;this.getResourceContents(s,n),this.resources=this.resources.concat(n)}getResourcePath(e){let s=e.filename,n=e.id.toString(),i=e.updatedTs,o=s.split(".").pop();return`${exports.pluginConfigData.base.resourceSavePath}/${n}_${i}.${o}`}static getResourcePathString(e){return new Fn().getResourcePath(e)}static async run(e){C(exports.pluginConfigData.debug.isDebug,"数据处理","",!0);let s=new Fn;await s.handleMemos(e.new);let n={resources:s.resources,relations:s.relations,oldMemos:e.old,newMemos:s.newMemos};return C(exports.pluginConfigData.debug.isDebug,"数据处理结果",n),n}}class Nl{constructor(e){Le(this,"memoIdLinkBlockId");Le(this,"memoUidLinkBlockId");Le(this,"blockIdLinkEmbeddedContent");Le(this,"data");Le(this,"deleteList");Le(this,"nowDeleteMode");this.memoIdLinkBlockId={},this.memoUidLinkBlockId={},this.blockIdLinkEmbeddedContent={},this.data=e,this.deleteList=[],exports.pluginConfigData.base.syncPlan===ot.singleDoc?this.nowDeleteMode=Ms.path:this.nowDeleteMode=Ms.blockId}async main(){await this.initData(),await this.saveData(),await this.clearData()}async initData(){C(exports.pluginConfigData.debug.isDebug,"正在初始化数据..."),await this.initDict(),C(exports.pluginConfigData.debug.isDebug,"初始化完成!"),C(exports.pluginConfigData.debug.isDebug,"正在更新删除列表..."),await this.updateDeleteList(),C(exports.pluginConfigData.debug.isDebug,"更新完成!")}async initDict(){await this.initDictByAttrName(Nn,this.memoIdLinkBlockId),C(exports.pluginConfigData.debug.isDebug,"MemoId: BlockId",this.memoIdLinkBlockId),await this.initDictByAttrName(Ya,this.memoUidLinkBlockId),C(exports.pluginConfigData.debug.isDebug,"MemoUid: BlockId",this.memoUidLinkBlockId)}async initDictByAttrName(e,s){let n=await et.getAttrByName(e);if(!K(n)&&n.length>0)for(let i of n)s[i.value]=i.block_id}async updateDeleteList(){this.nowDeleteMode===Ms.blockId?await this.updateDeleteListById():this.nowDeleteMode===Ms.path&&await this.updateDeleteListByPath(),C(exports.pluginConfigData.debug.isDebug,"删除列表",this.deleteList)}async updateDeleteListById(){for(let e of this.data.oldMemos){let s=this.getMemoId(e),n=this.memoIdLinkBlockId[s];K(n)?C(exports.pluginConfigData.debug.isDebug,"未找到对应删除数据",s):(C(exports.pluginConfigData.debug.isDebug,"已找到对应删除数据",s),this.deleteList.push(n))}}async updateDeleteListByPath(){for(let e of this.
|