You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
1.1 MiB

8 months ago
"use strict";var G3=Object.defineProperty;var q3=(e,t,n)=>t in e?G3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var he=(e,t,n)=>(q3(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("obsidian"),y0=require("@codemirror/language"),Qh=require("@codemirror/state"),Ci=require("@codemirror/view");var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tI={exports:{}},Nh={},nI={exports:{}},Nt={},Pb;function J3(){if(Pb)return Nt;Pb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function w(Z){return Z===null||typeof Z!="object"?null:(Z=g&&Z[g]||Z["@@iterator"],typeof Z=="function"?Z:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function E(Z,$,X){this.props=Z,this.context=$,this.refs=T,this.updater=X||D}E.prototype.isReactComponent={},E.prototype.setState=function(Z,$){if(typeof Z!="object"&&typeof Z!="function"&&Z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Z,$,"setState")},E.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function A(){}A.prototype=E.prototype;function N(Z,$,X){this.props=Z,this.context=$,this.refs=T,this.updater=X||D}var R=N.prototype=new A;R.constructor=N,S(R,E.prototype),R.isPureReactComponent=!0;var F=Array.isArray,H=Object.prototype.hasOwnProperty,P={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function z(Z,$,X){var ve,De={},be=null,ke=null;if($!=null)for(ve in $.ref!==void 0&&(ke=$.ref),$.key!==void 0&&(be=""+$.key),$)H.call($,ve)&&!L.hasOwnProperty(ve)&&(De[ve]=$[ve]);var Be=arguments.length-2;if(Be===1)De.children=X;else if(1<Be){for(var _e=Array(Be),it=0;it<Be;it++)_e[it]=arguments[it+2];De.children=_e}if(Z&&Z.defaultProps)for(ve in Be=Z.defaultProps,Be)De[ve]===void 0&&(De[ve]=Be[ve]);return{$$typeof:e,type:Z,key:be,ref:ke,props:De,_owner:P.current}}function U(Z,$){return{$$typeof:e,type:Z.type,key:$,ref:Z.ref,props:Z.props,_owner:Z._owner}}function W(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function K(Z){var $={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(X){return $[X]})}var ae=/\/+/g;function ce(Z,$){return typeof Z=="object"&&Z!==null&&Z.key!=null?K(""+Z.key):$.toString(36)}function fe(Z,$,X,ve,De){var be=typeof Z;(be==="undefined"||be==="boolean")&&(Z=null);var ke=!1;if(Z===null)ke=!0;else switch(be){case"string":case"number":ke=!0;break;case"object":switch(Z.$$typeof){case e:case t:ke=!0}}if(ke)return ke=Z,De=De(ke),Z=ve===""?"."+ce(ke,0):ve,F(De)?(X="",Z!=null&&(X=Z.replace(ae,"$&/")+"/"),fe(De,$,X,"",function(it){return it})):De!=null&&(W(De)&&(De=U(De,X+(!De.key||ke&&ke.key===De.key?"":(""+De.key).replace(ae,"$&/")+"/")+Z)),$.push(De)),1;if(ke=0,ve=ve===""?".":ve+":",F(Z))for(var Be=0;Be<Z.length;Be++){be=Z[Be];var _e=ve+ce(be,Be);ke+=fe(be,$,X,_e,De)}else if(_e=w(Z),typeof _e=="function")for(Z=_e.call(Z),Be=0;!(be=Z.next()).done;)be=be.value,_e=ve+ce(be,Be++),ke+=fe(be,$,X,_e,De);else if(be==="object")throw $=String(Z),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.");return ke}function ie(Z,$,X){if(Z==null)return Z;var ve=[],De=0;return fe(Z,ve,"","",function(be){return $.call(X,be,De++)}),ve}function ge(Z){if(Z._status===-1){var $=Z._result;$=
`);o.length===0&&await e.vault.adapter.write(xc(e),JSON.stringify({queries:[]},null,2));const s=[];for(let u=0;u<o.length;u++){const d=u,m="Memos";let p="未命名";const g=o[u];let w=x.moment().format("YYYY/MM/DD HH:mm:ss"),D="[]";const S=g.match(/^\d{14,16}/);S&&(w=x.moment(S[0].slice(0,14),"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:ss"));const T=g.match(/\[\{(.+)\}\]/);T&&(D=T[0]);const E=g.match(/\s(.+)\s\[\{/);E&&(p=E[0].slice(1,-3)),s.push({id:d,pinnedAt:"",createdAt:w,updatedAt:w,title:p,querystring:D,userId:m})}await e.vault.adapter.write(xc(e),JSON.stringify({queries:s},null,2))}},TN=async()=>{const{app:e}=Ee.getState().dailyNotesState;return await II(e,xc(e))||await TI(e),await Bd(e)||[]},EN=(e,t)=>({createdAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:k("Temp Filter"),updatedAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),xN=async(e,t)=>{const n=await Bd(Ee.getState().dailyNotesState.app)||[],r={createdAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),id:x.moment().format("YYYYMMDDHHmmss")+n.length,pinnedAt:"",querystring:t,title:e,updatedAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"};return n.push(r),await bm(Ee.getState().dailyNotesState.app,n),r};var nv={exports:{}};nv.exports;(function(e,t){(function(){var n,r="4.17.21",a=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",m=500,p="__lodash_placeholder__",g=1,w=2,D=4,S=1,T=2,E=1,A=2,N=4,R=8,F=16,H=32,P=64,L=128,z=256,U=512,W=30,K="...",ae=800,ce=16,fe=1,ie=2,ge=3,Te=1/0,se=9007199254740991,we=17976931348623157e292,Z=NaN,$=4294967295,X=$-1,ve=$>>>1,De=[["ary",L],["bind",E],["bindKey",A],["curry",R],["curryRight",F],["flip",U],["partial",H],["partialRight",P],["rearg",z]],be="[object Arguments]",ke="[object Array]",Be="[object AsyncFunction]",_e="[object Boolean]",it="[object Date]",Vt="[object DOMException]",Se="[object Error]",Ue="[object Function]",Je="[object GeneratorFunction]",$e="[object Map]",lt="[object Number]",ft="[object Null]",Dt="[object Object]",Et="[object Promise]",$t="[object Proxy]",rn="[object RegExp]",At="[object Set]",an="[object String]",Sn="[object Symbol]",In="[object Undefined]",vr="[object WeakMap]",Sa="[object WeakSet]",Mr="[object ArrayBuffer]",Nr="[object DataView]",Ss="[object Float32Array]",mo="[object Float64Array]",po="[object Int8Array]",Nl="[object Int16Array]",Fi="[object Int32Array]",Pi="[object Uint8Array]",Is="[object Uint8ClampedArray]",Yo="[object Uint16Array]",ji="[object Uint32Array]",V=/\b__p \+= '';/g,ne=/\b(__p \+=) '' \+/g,me=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ce=/&(?:amp|lt|gt|quot|#39);/g,je=/[&<>"']/g,Ye=RegExp(Ce.source),ze=RegExp(je.source),pt=/<%-([\s\S]+?)%>/g,Yt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,na=/^\w*$/,Fn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yr=/[\\^$.*+?()[\]{}|]/g,ra=RegExp(yr.source),kl=/^\s+/,Jt=/\s/,Ia=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ta=/\{\n\/\* \[wrapped with (.+)\] \*/,Ea=/,? & /,zo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Uo=/[()=,{}\[\]\/\s]/,vy=/\\(\\)?/g,Li=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,of=/\w*$/,Um=/^[-+]0x[0-9a-f]+$/i,yy=/^0b[01]+$/i,Vm=/^\[object .+?Constructor\]$/,Zm=/^0o[0-7]+$/i,Wm=/^(?:0|[1-9]\d*)$/,$m=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zc=/($^)/,wy=/['\n\r\u2028\u2029\\]/g,on="\\ud800-\\udfff",by="\\u0300-\\u036f",sf="\\ufe20-\\ufe2f",Gm="\\u20d0-\\u20ff",Al=by+sf+Gm,qm="\\u2700-\\u27bf",lf="a-z\\xdf-\\xf6\\xf8-\\xff",Uc="\\xac\\xb1\\xd7\\xf7",Za="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Dy="\\u2000-\\u206f",xa=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Jm="A-Z\\xc0-\\xd6\\xd8-\\xde",Km="\\ufe0e\\ufe0f",Qm=Uc+Za+Dy+xa,Ts="[']",Vc="["+on+"]",Es="["+Qm+"]",Ri="["+Al+"]",Xm="\\d+",Sy="["+qm+"]",Zc="["+lf+"]",cf="[^"+on+Qm+Xm+qm+lf+Jm
8 months ago
/* [wrapped with `+f+`] */
8 months ago
`)}function Zy(c){return Tt(c)||wc(c)||!!(Ip&&c&&c[Ip])}function ua(c,f){var b=typeof c;return f=f??se,!!f&&(b=="number"||b!="symbol"&&Wm.test(c))&&c>-1&&c%1==0&&c<f}function Bt(c,f,b){if(!bn(b))return!1;var M=typeof f;return(M=="number"?ha(b)&&ua(f,b.length):M=="string"&&f in b)?Mo(b[f],c):!1}function ih(c,f){if(Tt(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||La(c)?!0:na.test(c)||!yn.test(c)||f!=null&&c in Zt(f)}function Xe(c){var f=typeof c;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?c!=="__proto__":c===null}function di(c){var f=dc(c),b=B[f];if(typeof b!="function"||!(f in St.prototype))return!1;if(c===b)return!0;var M=uc(b);return!!M&&c===M[0]}function sh(c){return!!iu&&iu in c}var Qp=Ps?as:v0;function fc(c){var f=c&&c.constructor,b=typeof f=="function"&&f.prototype||$a;return c===b}function nl(c){return c===c&&!bn(c)}function hc(c,f){return function(b){return b==null?!1:b[c]===f&&(f!==n||c in Zt(b))}}function lh(c){var f=re(c,function(M){return b.size===m&&b.clear(),M}),b=f.cache;return f}function Xp(c,f){var b=c[1],M=f[1],j=b|M,Y=j<(E|A|L),J=M==L&&b==R||M==L&&b==z&&c[7].length<=f[8]||M==(L|z)&&f[7].length<=f[8]&&b==R;if(!(Y||J))return c;M&E&&(c[2]=f[2],j|=b&E?0:N);var te=f[3];if(te){var le=c[3];c[3]=le?Jf(le,te,f[4]):te,c[4]=le?aa(c[3],p):f[4]}return te=f[5],te&&(le=c[5],c[5]=le?_u(le,te,f[6]):te,c[6]=le?aa(c[5],p):f[6]),te=f[7],te&&(c[7]=te),M&L&&(c[8]=c[8]==null?f[8]:tr(c[8],f[8])),c[9]==null&&(c[9]=f[9]),c[0]=f[0],c[1]=j,c}function eg(c){var f=[];if(c!=null)for(var b in Zt(c))f.push(b);return f}function tg(c){return Yl.call(c)}function Wu(c,f,b){return f=En(f===n?c.length-1:f,0),function(){for(var M=arguments,j=-1,Y=En(M.length-f,0),J=pe(Y);++j<Y;)J[j]=M[f+j];j=-1;for(var te=pe(f+1);++j<f;)te[j]=M[j];return te[f]=b(J),br(c,this,te)}}function $u(c,f){return f.length<2?c:Wr(c,sr(f,0,-1))}function Gn(c,f){for(var b=c.length,M=tr(f.length,b),j=Ir(c);M--;){var Y=f[M];c[M]=ua(Y,b)?j[Y]:n}return c}function $r(c,f){if(!(f==="constructor"&&typeof c[f]=="function")&&f!="__proto__")return c[f]}var xo=ch(jn),rl=Nf||function(c,f){return sn.setTimeout(c,f)},Gu=ch(ku);function da(c,f,b){var M=f+"";return Gu(c,Vy(M,rg(ah(M),b)))}function ch(c){var f=0,b=0;return function(){var M=By(),j=ce-(M-b);if(b=M,j>0){if(++f>=ae)return arguments[0]}else f=0;return c.apply(n,arguments)}}function Gr(c,f){var b=-1,M=c.length,j=M-1;for(f=f===n?M:f;++b<f;){var Y=nc(b,j),J=c[Y];c[Y]=c[b],c[b]=J}return c.length=f,c}var ng=lh(function(c){var f=[];return c.charCodeAt(0)===46&&f.push(""),c.replace(Fn,function(b,M,j,Y){f.push(j?Y.replace(vy,"$1"):M||b)}),f});function Pa(c){if(typeof c=="string"||La(c))return c;var f=c+"";return f=="0"&&1/c==-Te?"-0":f}function fi(c){if(c!=null){try{return Bl.call(c)}catch{}try{return c+""}catch{}}return""}function rg(c,f){return er(De,function(b){var M="_."+b[0];f&b[1]&&!eu(c,M)&&c.push(M)}),c.sort()}function uh(c){if(c instanceof St)return c.clone();var f=new nr(c.__wrapped__,c.__chain__);return f.__actions__=Ir(c.__actions__),f.__index__=c.__index__,f.__values__=c.__values__,f}function Wy(c,f,b){(b?Bt(c,f,b):f===n)?f=1:f=En(xt(f),0);var M=c==null?0:c.length;if(!M||f<1)return[];for(var j=0,Y=0,J=pe(Ui(M/f));j<M;)J[Y++]=sr(c,j,j+=f);return J}function qu(c){for(var f=-1,b=c==null?0:c.length,M=0,j=[];++f<b;){var Y=c[f];Y&&(j[M++]=Y)}return j}function dh(){var c=arguments.length;if(!c)return[];for(var f=pe(c-1),b=arguments[0],M=c;M--;)f[M-1]=arguments[M];return qo(Tt(b)?Ir(b):[b],Pn(f,1))}var fa=It(function(c,f){return Bn(c)?Xa(c,Pn(f,1,Bn,!0)):[]}),Ot=It(function(c,f){var b=Hn(f);return Bn(b)&&(b=n),Bn(c)?Xa(c,Pn(f,1,Bn,!0),ct(b,2)):[]}),Un=It(function(c,f){var b=Hn(f);return Bn(b)&&(b=n),Bn(c)?Xa(c,Pn(f,1,Bn,!0),n,b):[]});function xn(c,f,b){var M=c==null?0:c.length;return M?(f=b||f===n?1:xt(f),sr(c,f<0?0:f,M)):[]}function qn(c,f,b){var M=c==null?0:c.length;return M?(f=b||f===n?1:xt(f),f=M-f,sr(c,0,f<0?0:f)):[]}function qr(c,f){return c&&c.length?qs(c,ct(f,3),!0,!0):[]}function al(c,f){return c&&c.length?qs(c,ct(f,3),!0):[]}function _n(c,f,b,M){var j=c==null?0:c.leng
`;c.replace(Ve,function(vt,Mt,Ft,Ra,Kr,_a){return Ft||(Ft=Ra),Pe+=c.slice(Me,_a).replace(wy,vp),Mt&&(te=!0,Pe+=`' +
8 months ago
__e(`+Mt+`) +
8 months ago
'`),Kr&&(le=!0,Pe+=`';
`+Kr+`;
__p += '`),Ft&&(Pe+=`' +
((__t = (`+Ft+`)) == null ? '' : __t) +
'`),Me=_a+vt.length,vt}),Pe+=`';
`;var gt=jt.call(f,"variable")&&f.variable;if(!gt)Pe=`with (obj) {
`+Pe+`
8 months ago
}
8 months ago
`;else if(Uo.test(gt))throw new bt(u);Pe=(le?Pe.replace(V,""):Pe).replace(ne,"$1").replace(me,"$1;"),Pe="function("+(gt||"obj")+`) {
8 months ago
`+(gt?"":`obj || (obj = {});
8 months ago
`)+"var __t, __p = ''"+(te?", __e = _.escape":"")+(le?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
8 months ago
`)+Pe+`return __p
}`;var Ct=Ab(function(){return Pt(Y,ot+"return "+Pe).apply(n,J)});if(Ct.source=Pe,s0(Ct))throw Ct;return Ct}function t3(c){return Wt(c).toLowerCase()}function n3(c){return Wt(c).toUpperCase()}function r3(c,f,b){if(c=Wt(c),c&&(b||f===n))return fp(c);if(!c||!(f=mn(f)))return c;var M=Ur(c),j=Ur(f),Y=hp(M,j),J=Ef(M,j)+1;return Io(M,Y,J).join("")}function a3(c,f,b){if(c=Wt(c),c&&(b||f===n))return c.slice(0,ou(c)+1);if(!c||!(f=mn(f)))return c;var M=Ur(c),j=Ef(M,Ur(f))+1;return Io(M,0,j).join("")}function o3(c,f,b){if(c=Wt(c),c&&(b||f===n))return c.replace(kl,"");if(!c||!(f=mn(f)))return c;var M=Ur(c),j=hp(M,Ur(f));return Io(M,j).join("")}function i3(c,f){var b=W,M=K;if(bn(f)){var j="separator"in f?f.separator:j;b="length"in f?xt(f.length):b,M="omission"in f?mn(f.omission):M}c=Wt(c);var Y=c.length;if(Os(c)){var J=Ur(c);Y=J.length}if(b>=Y)return c;var te=b-Yi(M);if(te<1)return M;var le=J?Io(J,0,te).join(""):c.slice(0,te);if(j===n)return le+M;if(J&&(te+=le.length-te),l0(j)){if(c.slice(te).search(j)){var Me,Ne=le;for(j.global||(j=Hl(j.source,Wt(of.exec(j))+"g")),j.lastIndex=0;Me=j.exec(Ne);)var Pe=Me.index;le=le.slice(0,Pe===n?te:Pe)}}else if(c.indexOf(mn(j),te)!=te){var Ve=le.lastIndexOf(j);Ve>-1&&(le=le.slice(0,Ve))}return le+M}function s3(c){return c=Wt(c),c&&Ye.test(c)?c.replace(Ce,yp):c}var l3=To(function(c,f,b){return c+(b?" ":"")+f.toUpperCase()}),d0=Qf("toUpperCase");function kb(c,f,b){return c=Wt(c),f=b?n:f,f===n?Fy(c)?Ry(c):ky(c):c.match(f)||[]}var Ab=It(function(c,f){try{return br(c,n,f)}catch(b){return s0(b)?b:new bt(b)}}),c3=no(function(c,f){return er(f,function(b){b=Pa(b),Qa(c,b,Fe(c[b],c))}),c});function u3(c){var f=c==null?0:c.length,b=ct();return c=f?Gt(c,function(M){if(typeof M[1]!="function")throw new oa(s);return[b(M[0]),M[1]]}):[],It(function(M){for(var j=-1;++j<f;){var Y=c[j];if(br(Y[0],this,M))return br(Y[1],this,M)}})}function d3(c){return Op(Pr(c,g))}function f0(c){return function(){return c}}function f3(c,f){return c==null||c!==c?f:c}var h3=Xi(),m3=Xi(!0);function pa(c){return c}function h0(c){return Xl(typeof c=="function"?c:Pr(c,g))}function p3(c){return Ws(Pr(c,g))}function g3(c,f){return Oa(c,Pr(f,g))}var v3=It(function(c,f){return function(b){return ii(b,c,f)}}),y3=It(function(c,f){return function(b){return ii(c,b,f)}});function m0(c,f,b){var M=fr(f),j=Sr(f,M);b==null&&!(bn(f)&&(j.length||!M.length))&&(b=f,f=c,c=this,j=Sr(f,fr(f)));var Y=!(bn(b)&&"chain"in b)||!!b.chain,J=as(c);return er(j,function(te){var le=f[te];c[te]=le,J&&(c.prototype[te]=function(){var Me=this.__chain__;if(Y||Me){var Ne=c(this.__wrapped__),Pe=Ne.__actions__=Ir(this.__actions__);return Pe.push({func:le,args:arguments,thisArg:c}),Ne.__chain__=Me,Ne}return le.apply(c,qo([this.value()],arguments))})}),c}function w3(){return sn._===this&&(sn._=Dp),this}function p0(){}function b3(c){return c=xt(c),It(function(f){return ci(f,c)})}var D3=Yu(Gt),S3=Yu(vf),I3=Yu(bf);function Ob(c){return ih(c)?Sf(Pa(c)):zf(c)}function T3(c){return function(f){return c==null?n:Wr(c,f)}}var E3=Xf(),x3=Xf(!0);function g0(){return[]}function v0(){return!1}function C3(){return{}}function M3(){return""}function N3(){return!0}function k3(c,f){if(c=xt(c),c<1||c>se)return[];var b=$,M=tr(c,$);f=ct(f),c-=$;for(var j=Tf(M,f);++b<c;)f(b);return j}function A3(c){return Tt(c)?Gt(c,Pa):La(c)?[c]:Ir(ng(Wt(c)))}function O3(c){var f=++js;return Wt(c)+f}var F3=Bu(function(c,f){return c+f},0),P3=lr("ceil"),j3=Bu(function(c,f){return c/f},1),L3=lr("floor");function R3(c){return c&&c.length?qi(c,pa,ka):n}function _3(c,f){return c&&c.length?qi(c,ct(f,2),ka):n}function H3(c){return up(c,pa)}function B3(c,f){return up(c,ct(f,2))}function Y3(c){return c&&c.length?qi(c,pa,si):n}function z3(c,f){return c&&c.length?qi(c,ct(f,2),si):n}var U3=Bu(function(c,f){return c*f},1),V3=lr("round"),Z3=Bu(function(c,f){return c-f},0);function W3(c){return c&&c.length?If(c,pa):0}function $3(c,f){return c&&c.length?If(c,ct(f,2)):0}return B.after=G,B.ary=ee,B.assign=nM,B.assignIn=Ib,B.assignInWith=wg,B.assignWith=rM,B.at=aM,B.before=ye,B.bind=Fe,B.bindAll=c3,B.bindKey=Le,B.castArray=CC,B.chain=Jr,B
`);let r="",a=[],o=!1,s=1;for(let u=0;u<n.length;u++){const d=n[u];if(d.startsWith("#")){if(o&&bg(d)<=bg(t))break;r=d,r===t?(o=!0,s=u+1):o&&bg(d)>bg(t)?a.push(d):(o=!1,a=[])}else o&&a.push(d)}return t?EI.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(`
`),startLine:s}:{content:e,startLine:0}}function MN(e){const t=e.split(/\r?\n/),n=[];for(let r=0;r<t.length;r++)new RegExp(fN).test(t[r])&&n.push({line:t[r],index:r+1});return n}async function NN(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new x.Notice(k("File not found for the given thino path, is creating a new file")),n=await t.vault.create(e,'{"nodes": [], "edges": []}'),Qe.setChangedByMemos(!0)),n}async function kN(e,t){let n;try{n=await t.vault.read(e)}catch(a){console.error(a),n=await t.vault.cachedRead(e)}const r=n.split(/---\n/);return r.length<3?n:r[2].trim()}function AN(e){const t=e.split(/\r?\n/),n=[];let r="",a=[],o=0;for(let s=0;s<t.length;s++){const u=t[s];u.startsWith("#")?(r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:s-1}}),r=u,a=[],o=s):a.push(u)}return r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:t.length-1}}),n}function ON(e){const t=e.split(/\r?\n/),n=[];let r=!1,a=[],o="";for(let s=0;s<t.length;s++){const u=t[s];u.startsWith("> [!thino]")?(r&&(n.push({metadata:o,content:a.join(`
`).trim()}),a=[]),r=!0,o=u.replace("> [!thino]","").trim()):r&&u.startsWith(">")?a.push(u.replace(/^> /,"")):r&&!u.startsWith(">")&&(r=!1,n.push({metadata:o,content:a.join(`
`).trim()}),a=[],o="")}return r&&n.push({metadata:o,content:a.join(`
`).trim()}),n}const FN=e=>{let t;switch(e){case" ":t="TASK-TODO";break;case"x":case"X":t="TASK-DONE";break;default:t="TASK-"+e;break}return t};async function PN(e,t){if(!t)return 0;const{vault:n}=Ee.getState().dailyNotesState.app,r=e==null?void 0:e.DefaultMemoComposition,a=(e==null?void 0:e.ProcessEntriesBelow)||"";let o;try{o=await n.read(t)}catch(g){console.error(g),o=await n.cachedRead(t)}let s;r!=""&&/{TIME}/g.test(r)&&/{CONTENT}/g.test(r)?s="(-|\\*) (\\[(.{1})\\]\\s)?"+r.replace(/{TIME}/g,"((\\<time\\>)?\\d{1,2}:\\d{2}(\\:\\d{2})?)?").replace(/ {CONTENT}/g,""):s="(-|\\*) (\\[(.{1})\\]\\s)?((\\<time\\>)?\\d{1,2}\\:\\d{2}(\\:\\d{2})?)?";const u=new RegExp(s,"g"),d=(o.match(u)||[]).length,m=new RegExp(a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),p=(o.match(m)||[]).length;return o=null,p?d:0}function jN(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)$/g,"$4")}function LN(e,t){return RN(e,t)}const RN=(e,t)=>{var a;let n;return e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*[\\-\\*]\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"(\\<time\\>)?((\\d{1,2})\\:(\\d{2}))?(\\<\\/time\\>)?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*[\\-\\*]\\s(\\[(.{1})\\]\\s?)?(\\<time\\>)?((\\d{1,2})\\:(\\d{2}))?(\\<\\/time\\>)?\\s?(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[8]},_N=(e,t)=>{var a;let n;e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(.*)$";const r=new RegExp(n,"");return t.includes("42:22"),(a=r.exec(t))==null?void 0:a[6]},HN=(e,t)=>{var a;let n;return e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\<time\\>)?(\\d{1,2})\\:(\\d{2})(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[7]},BN=e=>{var r;const t="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\d{1,2})\\:(\\d{2})\\:(\\d{2})(.*)$";return(r=new RegExp(t,"").exec(e))==null?void 0:r[7]},YN=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)$/.exec(e))==null?void 0:t[2]},xI=()=>vI()?!0:(new x.Notice(k("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function CI(e,t){if(!e)return t;const n=Ee.getState().dailyNotesState.app,r=await kN(e,n);if(!r.trim())return t;let a=x.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss");await n.fileManager.processFrontMatter(e,o=>{if(!o)return t;const s=!!o.pinned,u=o.rowStatus&&o.rowStatus==="ARCHIVED",d=!!o.deletedAt;o.createdAt&&(a=x.moment(o.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?o.createdAt:a);const m=o.deletedAt?o.deletedAt:"",p=o.visibility?o.visibility:"PRIVATE",g=o.thinoType?o.thinoType:"JOURNAL",w=o.webId?o.webId:"";o.id||(o.id=Re.randomId(16));const D=o.id?o.id:"",S=o.hasId?o.hasId:"",T=o.linkId?o.linkId:"",E=e.path,A="Memo",N="MULTI",R=[];return t.push({id:D,content:r,createdAt:a,updatedAt:a,deletedAt:d?x.moment(m,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:s,rowStatus:u?"ARCHIVED":"NORMAL",visibility:p,thinoType:g,hasId:S,linkId:T,path:E,creatorName:A,sourceType:N,resourceList:R,webId:w}),t})}async function mw(e,t){var D,S,T,E,A,N;if(!e)return t;const{vault:n}=Ee.getState().dailyNotesState.app;let r;try{r=await n.read(e)}catch(R){console.error(R),r=await n.cachedRead(e)}if(!r)return;const a=x.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),o=x.moment(e.stat.mtime).format("YYYY/MM/DD HH:mm:ss"),s=e.path,u="Thino",d="FILE",m="",p="",g=[],w=await AN(r);for(const R of w){const F=ON(R.content);for(const H of F){const P=H.metadata.match(/\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/g);if(!P)continue;const L=(S=(D=H.metadata.match(/id::([^\]]*)/g))==null?void 0:D[0])==null?void 0:S.replace("id::","");if(!L)continue;const z=P?P[0]:a,U=P?P[0]:o,W=H.metadata.match(/webId::([^\]]*)/g)?(E=(T=H.metadata.match(/webId::([^\]]*)/g))==n
`);const F=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(N),H=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(N),P=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(N),L=(g=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(N))==null?void 0:g[2],z=(w=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(N))==null?void 0:w[2],U=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(N)?"PUBLIC":"PRIVATE",W=(D=new RegExp(/\s\^([0-9a-zA-Z-]+)$/).exec(N))==null?void 0:D[1];R=R.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,"").replace(/\s\^([0-9a-zA-Z-]+)$/g,""),t.push({id:o.format("YYYYMMDDHHmmss")+`${S.index+m-1}`,content:R,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:s,hasId:W||"",linkId:"",path:e.path,deletedAt:P?x.moment(L,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:H?"ARCHIVED":"NORMAL",visibility:U,pinned:F,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:z})}}async function gw(e,t){const{app:n}=Ee.getState().dailyNotesState;if(!(e instanceof x.TFile))return;let r;try{r=await n.vault.read(e)}catch(s){console.error(s),r=await n.vault.cachedRead(e)}if(!r)return;const a=JSON.parse(r),o=a==null?void 0:a.nodes;for(const s of o){if(s.type==="group"||s.createdAt===void 0||s.text.trim()==="")continue;const u=x.moment(s==null?void 0:s.createdAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"),d=x.moment(s==null?void 0:s.updatedAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"),m=s!=null&&s.deletedAt?x.moment(s==null?void 0:s.deletedAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",p=!!(s!=null&&s.pinned),g=s!=null&&s.archived?"ARCHIVED":"NORMAL",w=s!=null&&s.visibility?s==null?void 0:s.visibility:"PRIVATE",D=s!=null&&s.thinoType?s==null?void 0:s.thinoType:"JOURNAL",S=s!=null&&s.text?s==null?void 0:s.text:"",T=s!=null&&s.id?s==null?void 0:s.id:"",E=s!=null&&s.hasId?s==null?void 0:s.hasId:"",A=s!=null&&s.linkId?s==null?void 0:s.linkId:"",N=e.path,R="Memo",F="CANVAS",H=[],P=s!=null&&s.webId?s==null?void 0:s.webId:void 0;t.push({id:T,content:S,createdAt:u,updatedAt:d,deletedAt:m,pinned:p,rowStatus:g,visibility:w,thinoType:D,hasId:E,linkId:A,path:N,creatorName:R,sourceType:F,resourceList:H,webId:P})}}async function Bb(e=[]){const t=[],n=[],r=Ee.getState().dailyNotesState.app,{vault:a}=r,{settings:o}=Ee.getState().dailyNotesState,s=r.loadLocalStorage("tokenForSync"),u=async(d,m)=>{for(const p of d)try{await m(p,t)}catch(g){console.error(g),new x.Notice(g)}};if(e.includes("CANVAS")){const d=zN(a);await u(d,gw)}if(e.includes("MULTI")){const d=UN(a,o);await u(d,CI)}if(e.includes("DAILY")){const d=await VN(a);await u(d,pw)}if(e.includes("FILE")||s){const d=ZN(a);await u(d,mw)}return{memos:t,commentMemos:n}}function zN(e){return e.getAllLoadedFiles().filter(t=>t instanceof x.TFile&&t.extension==="canvas"&&t.name.includes(".thino"))}function UN(e,t){return e.getMarkdownFiles().filter(n=>{var r;return n instanceof x.TFile&&((r=n.parent)==null?void 0:r.path.includes(t.MemoOtherSaveLocation.MemoDefaultMultiFilePath.trim()))})}async function VN(e){const t=DI();t===void 0&&new x.Notice(k("Please check your daily note plugin OR periodic notes plugin settings")+"folder path is empty or undefined"),e.getAbstractFileByPath(x.normalizePath(t))||new x.Notice(k("Failed to find daily notes folder"));const r=ws();return Object.values(r).filter(a=>a instanceof x.TFile&&a.extension==="md")}function ZN(e){return e.getMarkdownFiles().filter(t=>t instanceof x.TFile&&t.name.trim().includes("thino"))}const WN=async(e,t,n)=>{const r=await Bd(Ee.getState().dailyNotesState.app)||[],a=r.find(u=>u.id===e),o={...a,title:t,querystring:n},s=r.findIndex(u=>u.id===e);return r[s]=o,await bm(Ee.getState().dailyNotesState.app,r),[a]};function $N(e){return(e==null?void 0:e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))||e}function GN(e){const t=[];let n=e;for(;n.contains(`
8 months ago
`);){const r=n.indexOf(`
8 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function qN({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=x.moment(),a=Re.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",s=`${o}/${r.format("YYYYMMDD")}-${a}.md`,u={id:a,content:e,deletedAt:"",path:s,createdAt:r.format("YYYY/MM/DD HH:mm:ss"),updatedAt:r.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"MULTI"},d=rt.getState().app,{vault:m,fileManager:p}=d,g=m.getAbstractFileByPath(o);(!g||!(g instanceof x.TFolder))&&(new x.Notice(k("Folder not found for the given thino path, is creating a new folder")),await m.createFolder(o)),Qe.setChangedByMemos(!0);const w=await m.create(s,e);return await p.processFrontMatter(w,D=>{D.id=a,D.createdAt=r.format("YYYY/MM/DD HH:mm:ss"),D.updatedAt=r.format("YYYY/MM/DD HH:mm:ss"),D.thinoType=t?"JOURNAL":"TASK-TODO",D.pinned=!1,D.visibility="PUBLIC",D.rowStatus="NORMAL"}),u}async function JN({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=x.moment(),a=Re.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",s={id:a,content:e,deletedAt:"",path:o,createdAt:r.format("YYYY/MM/DD HH:mm:ss"),updatedAt:r.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE"},u=rt.getState().app,{vault:d}=u;let m=d.getAbstractFileByPath(o);(!m||!(m instanceof x.TFile))&&(new x.Notice(k("File not found for the given thino path, is creating a new file")),m=await d.create(o,""));let p="";try{p=await d.read(m)||await d.cachedRead(m)}catch(A){console.error(A),new x.Notice(k("Failed to read current daily note, check if it exists."))}const g=p.indexOf(`# ${r.format("YYYY-MM-DD")}`);let w=p.indexOf(`
#`,g+1);w===-1&&(w=p.length);const D=`> [!thino] ${r.format("YYYY/MM/DD HH:mm:ss")} %% [id::${a}] [thinoType::${t?"JOURNAL":"TASK-TODO"}] %%`,S=e.replace(/\n/g,`
8 months ago
> `),T=`
8 months ago
${D}
> ${S}
`;let E;if(g===-1){const A=`# ${r.format("YYYY-MM-DD")}`;E=`${p.substring(0,w)}
${A}${T}
${p.substring(w)}`}else E=`${p.substring(0,w)}${T}${p.substring(w)}`;return setTimeout(async()=>{Qe.setChangedByMemos(!0),await d.modify(m,E)},200),s}async function Yb(e){const t=Ee.getState().dailyNotesState.settings,n=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),r=e.id,a=(t==null?void 0:t.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",o={id:r,content:e.content,deletedAt:e.deletedAt||"",path:a,createdAt:n.format("YYYY/MM/DD HH:mm:ss"),updatedAt:n.format("YYYY/MM/DD HH:mm:ss"),thinoType:"JOURNAL",hasId:"",linkId:"",pinned:e.pinned,visibility:"PUBLIC",rowStatus:e.rowStatus||"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE",webId:e.id},s=rt.getState().app,{vault:u}=s;let d=u.getAbstractFileByPath(a);(!d||!(d instanceof x.TFile))&&(new x.Notice(k("File not found for the given thino path, is creating a new file")),d=await u.create(a,""));let m="";try{m=await u.read(d)||await u.cachedRead(d)}catch(E){console.error(E),new x.Notice(k("Failed to read current daily note, check if it exists."))}const p=m.indexOf(`# ${n.format("YYYY-MM-DD")}`);let g=m.indexOf(`
#`,p+1);g===-1&&(g=m.length);const w=`> [!thino] ${n.format("YYYY/MM/DD HH:mm:ss")} %% [id::${r}] [thinoType::JOURNAL]${e.rowStatus==="ARCHIVED"?" [archived::true]":""}${e.pinned===!0?" [pinned::true]":""}${e.deletedAt?` [deleted::${e.deletedAt}]`:""}${e.id?` [webId::${e.id}]`:""} %%`,D=e.content.replace(/\n/g,`
> `),S=`
8 months ago
${w}
8 months ago
> ${D}
`;let T;if(p===-1){const E=`# ${n.format("YYYY-MM-DD")}`;T=`${m.substring(0,g)}
${E}${S}
${m.substring(g)}`}else T=`${m.substring(0,g)}${S}${m.substring(g)}`;return Qe.setChangedByMemos(!0),await u.modify(d,T),o}async function KN({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=x.moment(),o=Re.randomId(16),s={id:o,content:e,deletedAt:"",path:r,createdAt:a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:a.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"CANVAS"},u=rt.getState().app,{vault:d}=u,m=await NN(r,u);if(!m||!(m instanceof x.TFile)){new x.Notice(k("File not found for the given thino path, is creating a new file"));return}const p=await d.read(m),g=JSON.parse(p);if(g.nodes.find(E=>E.id===s.id))return;let D;g.nodes.length>0&&(D=[...g.nodes].reduce((E,A)=>{if(!E.createdAt)return A;const N=x.moment(E.createdAt,"YYYY/MM/DD HH:mm:ss"),R=x.moment(A.createdAt,"YYYY/MM/DD HH:mm:ss");return N.isAfter(R)?E:A}));const S=D?{x:D.x,y:D.y+100,width:D.width,height:D.height}:{x:0,y:0,width:200,height:100};g.nodes.push({...S,type:"text",id:o,text:e,deletedAt:"",createdAt:a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:a.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[]}),Qe.setChangedByMemos(!0);const T=JSON.stringify(g,null,2);return await d.modify(m,T),s}async function zb(e,t,n){var N;const{vault:r}=Ee.getState().dailyNotesState.app||app,a=Ee.getState().dailyNotesState.settings,o=e.replace(/\n/g,"<br>"),s=n||x.moment(),u=s.format("HH"),d=s.format("mm"),m=`${u}:${d}`,p=t?"- ":"- [ ] ",g=a!=null&&a.DefaultMemoComposition?`${p}${(N=a==null?void 0:a.DefaultMemoComposition)==null?void 0:N.replace(/{TIME}/g,m).replace(/{CONTENT}/g,o)}`:`${p}${m} ${o}`,w=ws(),D=kv(s,w);let S;if(D?S=D:S=await Re.createDailyNoteCheck(s),!S){new x.Notice(k("Failed to create daily note, check if it exists."));return}D||await rt.fechLocalDailyNotes();let T="";try{T=await r.read(S)||await r.cachedRead(S)}catch(R){console.error(R),new x.Notice(k("Failed to read current daily note, check if it exists."))}const E=await MI(a==null?void 0:a.InsertAfter,g,T);n?await r.modify(S,E.content):setTimeout(async()=>{await r.modify(S,E.content)},200);const A=E.posNum===-1?NI(E.content).length-1:E.posNum+1;return Qe.setChangedByMemos(!0),{id:s.format("YYYYMMDDHHmm")+"00"+A,content:e,deletedAt:"",createdAt:s.format("YYYY/MM/DD HH:mm:ss"),updatedAt:s.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:S.path,hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function QN(e){const{vault:t}=Ee.getState().dailyNotesState.app??app,{DefaultMemoComposition:n,InsertAfter:r}=Ee.getState().dailyNotesState.settings;let a=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const R=" [webId::"+e.id+"]";a+=R}const o=x.moment();if(e.deletedAt){const R=" [deleted::"+o.format("YYYYMMDDHHmmss")+"]";a+=R}const s=e.content.replace(/\n/g,"<br>")+a,u=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),d=u.format("HH"),m=u.format("mm"),p=`${d}:${m}`,g=e.thinoType?"- [ ] ":"- ",w=n?`${g}${n==null?void 0:n.replace(/{TIME}/g,p).replace(/{CONTENT}/g,s)}`:`${g}${p} ${s}`,D=ws(),S=kv(u,D);let T;if(S?T=S:T=await Re.createDailyNoteCheck(u),!T){new x.Notice(k("Failed to create daily note, check if it exists."));return}S||await rt.fechLocalDailyNotes();let E="";try{E=await t.read(T)||await t.cachedRead(T)}catch(R){console.error(R),new x.Notice(k("Failed to read current daily note, check if it exists."))}const A=await MI(r,w,E);await t.modify(T,A.content);const N=A.posNum===-1?NI(A.content).length-1:A.posNum+1;return Qe.setChangedByMemos(!0),{id:u.format("YYYYMMDDHHmm")+"00"+N,content:e.content,deletedAt:e.deletedAt??"",createdAt:u.format("YYYY/MM/DD HH:mm:ss"),updatedAt:u.format(
${e}`,posNum:-1};const a=t.split(`
`),o=a.slice(0,n+1).join(`
`),s=a.slice(n+1).join(`
`),u=s.trim().length>0;return{content:`${o}${!u&&!r||!o.endsWith(`
8 months ago
`)?`
8 months ago
`:""}${e}${(u||r?`
`:"")+s}`,posNum:n}}const NI=e=>e.split(/\r?\n/);async function XN(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof x.TFile)){new x.Notice(k("File not found for the given thino path"));return}await t.vault.delete(n)}async function ek(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof x.TFile)){new x.Notice(k("File not found for the given thino path"));return}const a=(await t.vault.read(n)).split(`
`),o=a.findIndex(d=>d.includes(e.id));if(o===-1){new x.Notice(k("Thino not found"));return}const s=a.findIndex((d,m)=>m>o&&d.trim()==="");s===-1?a.splice(o,a.length-o):a.splice(o,s-o);const u=a.join(`
`);if(!u){new x.Notice(k("Thino not found"));return}Qe.setChangedByMemos(!0),await t.vault.modify(n,u)}async function tk(e){const t=Ee.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new x.Notice(k("File not found for the given thino path"));return}const r=await t.vault.read(n),a=JSON.parse(r),o=a.nodes,s=o.findIndex(p=>p.id===e.id);if(s===-1){new x.Notice(k("Thino not found"));return}o.splice(s,1);const u=a.edges;u.filter(p=>p.fromNode===e.id||p.toNode===e.id).forEach(p=>{const g=u.findIndex(w=>w.id===p.id);g!==-1&&u.splice(g,1)}),Qe.setChangedByMemos(!0);const m=JSON.stringify(a,null,2);await t.vault.modify(n,m)}async function nk(e){xI()||new x.Notice(k("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."),5e3);const{vault:t}=Ee.getState().dailyNotesState.app,n=e.id.toString().slice(0,14),r=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(x.moment(n,"YYYYMMDDHHmmss"))?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):x.moment(n,"YYYYMMDDHHmmss"),a=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(r,"day"),o=e.path,s=t.getAbstractFileByPath(o);if(!s){new x.Notice(k("Please check your daily note plugin OR periodic notes plugin settings"));return}const u=await t.read(s),d=u.split(`
`),m=a?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm"):(parseInt(e.id.toString().slice(10,12))+24).toString()+":"+e.id.toString().slice(12,14),p=d.findIndex(S=>S.includes(e.content.replace(/\n/g,"<br>").trim())&&S.includes(m)),g=parseInt(e.id.slice(14));let w=p;p===-1&&(w=g-1);const D=d[p]||d[g-1];if(!u){new x.Notice(k("Thino not found"));return}if(D===d[w]){Qe.setChangedByMemos(!0),d.splice(w,1),await t.modify(s,d.join(`
`));return}}async function rk(){const{vault:e,metadataCache:t}=Ee.getState().dailyNotesState.app,n=Ee.getState().dailyNotesState.settings,a=DI()+"/"+n.DeleteFileName+".md",o=[],s=t.getFirstLinkpathDest("",a);if(s instanceof x.TFile){let u=await e.read(s),d=ak(u);if(d.length===0)return o;for(let m=0;m<d.length;m++){const p=d[m];if(/- /.test(p)){const w=ok(p).slice(0,13),D=x.moment(w,"YYYYMMDDHHmmss"),S=sk(d[m]),T=x.moment(S.slice(0,13),"YYYYMMDDHHmmss"),E=ik(d[m]);o.push({id:S,content:E,user_id:1,createdAt:D.format("YYYY/MM/DD HH:mm:SS"),updatedAt:D.format("YYYY/MM/DD HH:mm:SS"),deletedAt:T})}else continue}d=null,u=null}return o}const ak=e=>e.split(/\r?\n/),ok=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},ik=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},sk=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function lk(e){const t=await Bd(Ee.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await bm(Ee.getState().dailyNotesState.app,t)}const ck=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await Bd(t)||[],r=n.find(a=>a.id===e);if(r){const a=x.moment().format("YYYY/MM/DD HH:mm:ss");return r.pinnedAt=a,await bm(t,n),a}else{new x.Notice(k("Query not found"));return}},uk=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await Bd(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await bm(t,n);return}else{new x.Notice(k("Query not found"));return}};function dk(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const a=r[1].trim(),o={};a.split(" ").forEach(u=>{const[d,m]=u.slice(1,-1).split("::");o[d]=m});for(const u of Object.keys(t))if(u!=="id"&&u!=="content"){if(u==="rowStatus"&&t.rowStatus==="ARCHIVED"){o.archived="true";continue}else if(u==="rowStatus"&&t.rowStatus==="NORMAL"){delete o.archived;continue}if(u==="deleted"&&t.deleted){const d=x.moment().format("YYYYMMDDHHmmss");o.deleted=d}else typeof t[u]=="boolean"?t[u]?o[u]="true":delete o[u]:t[u]&&(o[u]=t[u])}const s=Object.entries(o).map(([u,d])=>`[${u}::${d}]`).join(" ");return e.replace(n,`%% ${s} %%`)}async function Po(e,t){if(!e.sourceType||e.sourceType!=="MULTI")return e;const{vault:n,fileManager:r}=Ee.getState().dailyNotesState.app,a=n.getAbstractFileByPath(e.path);if(!a)return e;const o=x.moment();if(await r.processFrontMatter(a,s=>{(t.pinned||t.thinoType||t.rowStatus||t.visibility||t.deleted)&&Qe.setChangedByMemos(!0),t.id&&(s.id=t.id),t.thinoType&&(s.thinoType=t.thinoType),t.rowStatus&&(s.rowStatus=t.rowStatus),t.visibility&&(s.visibility=t.visibility),t.webId&&(s.webId=t.webId),t.pinned!==void 0&&(s.pinned=t.pinned),t.deleted!==void 0&&(s.deletedAt=t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):""),s.createdAt||(s.createdAt=o.format("YYYY/MM/DD HH:mm:ss")),s.updatedAt=o.format("YYYY/MM/DD HH:mm:ss")}),t.content){const s=await n.read(a);let u=s;const d=t.content.replace(/\$/g,"$$$$");u=s.replace(e.content,d),await n.modify(a,u)}return Qe.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:e.updatedAt,content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned||e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Si(e,t){if(!e.sourceType||e.sourceType!=="FILE")return e;const{vault:n}=Ee.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=x.moment();let o="";try{o=await n.read(r)}catch(A){console.error(A),o=await n.cachedRead(r)}const s=o.split(/\r?\n/),u=s.findIndex(A=>A.includes(e.id)||e.webId&&A.includes(e.webId)),d=s[u];if(!d)return e;const m=dk(d,t);if(!d)return e;const p=m+`
`,g=s.findIndex((A,N)=>N>u&&A.trim()==="");let w="";g===-1&&(w=s.slice(u+1).join(`
`)),g!==-1&&(w=s.slice(u+1,g).join(`
`));let D=w;t!=null&&t.content&&(D=t.content.split(/\r?\n/).map(F=>"> "+F).join(`
`));const T=(p+D).split(/\r?\n/);s.splice(u,g?g-u:s.length-u,...T);const E=s.join(`
`);return await n.modify(r,E),Qe.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:e.updatedAt,content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned||e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?a.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Ii(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=Ee.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=await n.read(r),o=JSON.parse(a),s=o.nodes.find(m=>m.id===e.id);if(!s)return e;t.content&&(s.text=t.content),t.thinoType&&(s.thinoType=t.thinoType),t.rowStatus&&(s.rowStatus=t.rowStatus),t.visibility&&(s.visibility=t.visibility),t.pinned!==void 0&&(s.pinned=t.pinned),t.webId&&(s.webId=t.webId);const u=x.moment();t.deleted!==void 0&&(s.deletedAt=t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):""),s.updatedAt=u.format("YYYY/MM/DD HH:mm:ss");const d=JSON.stringify(o,null,2);return await n.modify(r,d),Qe.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:e.updatedAt,content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Ti(e,t){xI()||new x.Notice(k("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."));const{vault:n}=Ee.getState().dailyNotesState.app,r=e.id.toString().slice(0,14),a=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(x.moment(r,"YYYYMMDDHHmmss"))?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):x.moment(r,"YYYYMMDDHHmmss"),o=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(a,"day"),s=e.path,u=n.getAbstractFileByPath(s)||n.getAbstractFileByPath(e.path);if(!u)return new x.Notice(k("Please check your daily note plugin OR periodic notes plugin settings")),e;const m=(await n.read(u)).split(`
`),p=o?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm"):(parseInt(e.id.toString().slice(10,12))+24).toString()+":"+e.id.toString().slice(12,14);let g,w,D;try{g=m.findIndex(A=>{const N=A.replace(/^(-|\*|\d\.|-\s\[.?\])\s\d{2}:\d{2}/,"").trim(),R=e.content.replace(/\n/g,"<br>").trim(),F=A.includes(p),H=N.includes(R);return F&&(H||N===R)}),D=!1,w=parseInt(e.id.slice(14))}catch(A){console.error(A)}let S=g!==-1&&g===w?g:w;g===-1&&(S=w,m[w-1]&&(D=!0));let T=m[w]||m[g];if(T=T.replace(/\s\^([0-9a-zA-Z-]+)$/g,""),!T)return new x.Notice(k("Thino not found")),e;if(t.content)if(D){const A=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",N=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PUBLIC"?' [visibility::"PUBLIC"]':"");T=`${A}${p} ${t.content.trim()} ${N}`}else{const A=/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2})/.exec(T)[1];T=T.replace(/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2})/,"").replace(e.content.trim().replace(/\n/g,"<br>"),t.content.trim().replace(/\n/g,"<br>")).trim(),T=A+" "+T}if(t.thinoType){const A=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";T=T.replace(/^((- \[.\] )|((-|\*) ))/,A)}if(t.rowStatus){const A=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";T=T.includes("[archived::")?T.replace(/\[archived::(true|false)\]/,A):T+" "+A}if(t.visibility){const A='[visibility::"'+t.visibility+'"]';T=T.includes("[visibility::")?T.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,A):T+" "+A}if(t.pinned!==void 0){const A=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";T=T.includes("[pinned::")?T.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":A):T+" "+A}if(t.webId!==void 0){const A="[webId::"+t.webId+"]";T=T.includes("[webId::")?T.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":A):T+" "+A}const E=x.moment();if(t.deleted!==void 0){const A="[deleted::"+E.format("YYYYMMDDHHmmss")+"]";t.deleted?(T=T.replace(/\[deleted::([^\]]+)\]/,""),T=T+" "+A):t.deleted===!1&&(T=T.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId){const A=" ^"+e.hasId;T=T.replace(/\s\^([0-9a-zA-Z-]+)$/g,"")+A}return T!==m[S]?(m.splice(S,1,T),await n.modify(u,m.join(`
`)),Qe.setChangedByMemos(!0),{...e,thinoType:t.thinoType??e.thinoType,createdAt:e.createdAt,updatedAt:e.updatedAt,content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?E.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}const fk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Ii(e,{id:e.id,pinned:!0});case"DAILY":return Ti(e,{id:e.id,pinned:!0});case"MULTI":return Po(e,{id:e.id,pinned:!0});case"FILE":return Si(e,{id:e.id,pinned:!0})}},hk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Ii(e,{id:e.id,pinned:!1});case"DAILY":return Ti(e,{id:e.id,pinned:!1});case"MULTI":return Po(e,{id:e.id,pinned:!1});case"FILE":return Si(e,{id:e.id,pinned:!1})}};var vw;(e=>{async function t(T){return await Bb(T)}e.getMyMemos=t;async function n(T){return await Bb([T])}e.updateSpecificTypeMemo=n;function r(){return rk()}e.getMyDeletedMemos=r;function a(T){const E=Ie.getMemoById(T);if(E)switch(E==null?void 0:E.sourceType){case"DAILY":return Ti(E,{id:E.id,deleted:!1});case"CANVAS":return Ii(E,{id:E.id,deleted:!1});case"MULTI":return Po(E,{id:E.id,deleted:!1});case"FILE":return Si(E,{id:E.id,deleted:!1})}}e.restoreMemo=a;function o(T){return ek(T)}e.deleteMemoInSingleFile=o;function s(T){return XN(T)}e.deleteMemoInMultiFiles=s;function u(T){return nk(T)}e.deleteMemoInDailyNote=u;function d(T){return tk(T)}e.deleteMemoInCanvas=d;function m(){return TN()}e.getMyQueries=m;async function p(T,E){return await xN(T,E)}e.createQuery=p;function g(T,E,A){return WN(T,E,A)}e.updateQuery=g;function w(T){return lk(T)}e.deleteQueryById=w;function D(T){return ck(T)}e.pinQuery=D;function S(T){return uk(T)}e.unpinQuery=S})(vw||(vw={}));const va=vw;var bs={};Object.defineProperty(bs,"__esModule",{value:!0});class Hc extends Error{}class mk extends Hc{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class pk extends Hc{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class gk extends Hc{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Yh extends Hc{}class kI extends Hc{constructor(t){super(`Invalid unit ${t}`)}}class io extends Hc{}class ll extends Hc{constructor(){super("Zone is an abstract class")}}const Ze="numeric",Ro="short",Ya="long",rv={year:Ze,month:Ze,day:Ze},AI={year:Ze,month:Ro,day:Ze},vk={year:Ze,month:Ro,day:Ze,weekday:Ro},OI={year:Ze,month:Ya,day:Ze},FI={year:Ze,month:Ya,day:Ze,weekday:Ya},PI={hour:Ze,minute:Ze},jI={hour:Ze,minute:Ze,second:Ze},LI={hour:Ze,minute:Ze,second:Ze,timeZoneName:Ro},RI={hour:Ze,minute:Ze,second:Ze,timeZoneName:Ya},_I={hour:Ze,minute:Ze,hourCycle:"h23"},HI={hour:Ze,minute:Ze,second:Ze,hourCycle:"h23"},BI={hour:Ze,minute:Ze,second:Ze,hourCycle:"h23",timeZoneName:Ro},YI={hour:Ze,minute:Ze,second:Ze,hourCycle:"h23",timeZoneName:Ya},zI={year:Ze,month:Ze,day:Ze,hour:Ze,minute:Ze},UI={year:Ze,month:Ze,day:Ze,hour:Ze,minute:Ze,second:Ze},VI={year:Ze,month:Ro,day:Ze,hour:Ze,minute:Ze},ZI={year:Ze,month:Ro,day:Ze,hour:Ze,minute:Ze,second:Ze},yk={year:Ze,month:Ro,day:Ze,weekday:Ro,hour:Ze,minute:Ze},WI={year:Ze,month:Ya,day:Ze,hour:Ze,minute:Ze,timeZoneName:Ro},$I={year:Ze,month:Ya,day:Ze,hour:Ze,minute:Ze,second:Ze,timeZoneName:Ro},GI={year:Ze,month:Ya,day:Ze,weekday:Ya,hour:Ze,minute:Ze,timeZoneName:Ya},qI={year:Ze,month:Ya,day:Ze,weekday:Ya,hour:Ze,minute:Ze,second:Ze,timeZoneName:Ya};class Dm{get type(){throw new ll}get name(){throw new ll}get ianaName(){return this.name}get isUniversal(){throw new ll}offsetName(t,n){throw new ll}formatOffset(t,n){throw new ll}offset(t){throw new ll}equals(t){throw new ll}get isValid(){throw new ll}}let b0=null;class Ov extends Dm{static get instance(){return b0===null&&(b0=new Ov),b0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return KI(t,n,r)}formatOffset(t,n){return $h(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isV
`||V.charAt(ze)==="\r"&&V.charAt(ze+1)!==`
`)&&(je++,Ye===0&&(Ye=ze+1)),ze--}var pt=Ce+je,Yt=ne-Ye;return me[ne]={line:pt,lineStart:Ye},{offset:ne,line:pt+1,column:Yt+1}}function ae(V){if(!F(V))throw new Error("not a parser: "+V)}function ce(V,ne){return typeof V=="string"?V.charAt(ne):V[ne]}function fe(V){if(typeof V!="number")throw new Error("not a number: "+V)}function ie(V){if(typeof V!="function")throw new Error("not a function: "+V)}function ge(V){if(typeof V!="string")throw new Error("not a string: "+V)}var Te=2,se=3,we=8,Z=5*we,$=4*we,X=" ";function ve(V,ne){return new Array(ne+1).join(V)}function De(V,ne,me){var Ce=ne-V.length;return Ce<=0?V:ve(me,Ce)+V}function be(V,ne,me,Ce){return{from:V-ne>0?V-ne:0,to:V+me>Ce?Ce:V+me}}function ke(V,ne){var me,Ce,je,Ye,ze,pt=ne.index,Yt=pt.offset,On=1;if(Yt===V.length)return"Got the end of the input";if(P(V)){var yn=Yt-Yt%we,na=Yt-yn,Fn=be(yn,Z,$+we,V.length),yr=m(function(Jt){return m(function(Ia){return De(Ia.toString(16),2,"0")},Jt)},function(Jt,Ia){var Ta=Jt.length,Ea=[],zo=0;if(Ta<=Ia)return[Jt.slice()];for(var Uo=0;Uo<Ta;Uo++)Ea[zo]||Ea.push([]),Ea[zo].push(Jt[Uo]),(Uo+1)%Ia==0&&zo++;return Ea}(V.slice(Fn.from,Fn.to).toJSON().data,we));Ye=function(Jt){return Jt.from===0&&Jt.to===1?{from:Jt.from,to:Jt.to}:{from:Jt.from/we,to:Math.floor(Jt.to/we)}}(Fn),Ce=yn/we,me=3*na,na>=4&&(me+=1),On=2,je=m(function(Jt){return Jt.length<=4?Jt.join(" "):Jt.slice(0,4).join(" ")+" "+Jt.slice(4).join(" ")},yr),(ze=(8*(Ye.to>0?Ye.to-1:Ye.to)).toString(16).length)<2&&(ze=2)}else{var ra=V.split(/\r\n|[\n\r\u2028\u2029]/);me=pt.column-1,Ce=pt.line-1,Ye=be(Ce,Te,se,ra.length),je=ra.slice(Ye.from,Ye.to),ze=Ye.to.toString().length}var kl=Ce-Ye.from;return P(V)&&(ze=(8*(Ye.to>0?Ye.to-1:Ye.to)).toString(16).length)<2&&(ze=2),d(function(Jt,Ia,Ta){var Ea,zo=Ta===kl,Uo=zo?"> ":X;return Ea=P(V)?De((8*(Ye.from+Ta)).toString(16),ze,"0"):De((Ye.from+Ta+1).toString(),ze," "),[].concat(Jt,[Uo+Ea+" | "+Ia],zo?[X+ve(" ",ze)+" | "+De("",me," ")+ve("^",On)]:[])},[],je).join(`
`)}function Be(V,ne){return[`
`,"-- PARSING FAILED "+ve("-",50),`
8 months ago
8 months ago
`,ke(V,ne),`
8 months ago
8 months ago
`,(me=ne.expected,me.length===1?`Expected:
8 months ago
8 months ago
`+me[0]:`Expected one of the following:
8 months ago
8 months ago
`+me.join(", ")),`
`].join("");var me}function _e(V){return V.flags!==void 0?V.flags:[V.global?"g":"",V.ignoreCase?"i":"",V.multiline?"m":"",V.unicode?"u":"",V.sticky?"y":""].join("")}function it(){for(var V=[].slice.call(arguments),ne=V.length,me=0;me<ne;me+=1)ae(V[me]);return o(function(Ce,je){for(var Ye,ze=new Array(ne),pt=0;pt<ne;pt+=1){if(!(Ye=U(V[pt]._(Ce,je),Ye)).status)return Ye;ze[pt]=Ye.value,je=Ye.index}return U(L(je,ze),Ye)})}function Vt(){var V=[].slice.call(arguments);if(V.length===0)throw new Error("seqMap needs at least one argument");var ne=V.pop();return ie(ne),it.apply(null,V).map(function(me){return ne.apply(null,me)})}function Se(){var V=[].slice.call(arguments),ne=V.length;if(ne===0)return Dt("zero alternates");for(var me=0;me<ne;me+=1)ae(V[me]);return o(function(Ce,je){for(var Ye,ze=0;ze<V.length;ze+=1)if((Ye=U(V[ze]._(Ce,je),Ye)).status)return Ye;return Ye})}function Ue(V,ne){return Je(V,ne).or(ft([]))}function Je(V,ne){return ae(V),ae(ne),Vt(V,ne.then(V).many(),function(me,Ce){return[me].concat(Ce)})}function $e(V){ge(V);var ne="'"+V+"'";return o(function(me,Ce){var je=Ce+V.length,Ye=me.slice(Ce,je);return Ye===V?L(je,Ye):z(Ce,ne)})}function lt(V,ne){(function(je){if(!(je instanceof RegExp))throw new Error("not a regexp: "+je);for(var Ye=_e(je),ze=0;ze<Ye.length;ze++){var pt=Ye.charAt(ze);if(pt!=="i"&&pt!=="m"&&pt!=="u"&&pt!=="s")throw new Error('unsupported regexp flag "'+pt+'": '+je)}})(V),arguments.length>=2?fe(ne):ne=0;var me=function(je){return RegExp("^(?:"+je.source+")",_e(je))}(V),Ce=""+V;return o(function(je,Ye){var ze=me.exec(je.slice(Ye));if(ze){if(0<=ne&&ne<=ze.length){var pt=ze[0],Yt=ze[ne];return L(Ye+pt.length,Yt)}return z(Ye,"valid match group (0 to "+ze.length+") in "+Ce)}return z(Ye,Ce)})}function ft(V){return o(function(ne,me){return L(me,V)})}function Dt(V){return o(function(ne,me){return z(me,V)})}function Et(V){if(F(V))return o(function(ne,me){var Ce=V._(ne,me);return Ce.index=me,Ce.value="",Ce});if(typeof V=="string")return Et($e(V));if(V instanceof RegExp)return Et(lt(V));throw new Error("not a string, regexp, or parser: "+V)}function $t(V){return ae(V),o(function(ne,me){var Ce=V._(ne,me),je=ne.slice(me,Ce.index);return Ce.status?z(me,'not "'+je+'"'):L(me,null)})}function rn(V){return ie(V),o(function(ne,me){var Ce=ce(ne,me);return me<ne.length&&V(Ce)?L(me+1,Ce):z(me,"a character/byte matching "+V)})}function At(V,ne){arguments.length<2&&(ne=V,V=void 0);var me=o(function(Ce,je){return me._=ne()._,me._(Ce,je)});return V?me.desc(V):me}function an(){return Dt("fantasy-land/empty")}s.parse=function(V){if(typeof V!="string"&&!P(V))throw new Error(".parse must be called with a string or Buffer as its argument");var ne,me=this.skip(Sa)._(V,0);return ne=me.status?{status:!0,value:me.value}:{status:!1,index:K(V,me.furthest),expected:me.expected},delete W[V],ne},s.tryParse=function(V){var ne=this.parse(V);if(ne.status)return ne.value;var me=Be(V,ne),Ce=new Error(me);throw Ce.type="ParsimmonError",Ce.result=ne,Ce},s.assert=function(V,ne){return this.chain(function(me){return V(me)?ft(me):Dt(ne)})},s.or=function(V){return Se(this,V)},s.trim=function(V){return this.wrap(V,V)},s.wrap=function(V,ne){return Vt(V,this,ne,function(me,Ce){return Ce})},s.thru=function(V){return V(this)},s.then=function(V){return ae(V),it(this,V).map(function(ne){return ne[1]})},s.many=function(){var V=this;return o(function(ne,me){for(var Ce=[],je=void 0;;){if(!(je=U(V._(ne,me),je)).status)return U(L(me,Ce),je);if(me===je.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");me=je.index,Ce.push(je.value)}})},s.tieWith=function(V){return ge(V),this.map(function(ne){if(function(je){if(!H(je))throw new Error("not an array: "+je)}(ne),ne.length){ge(ne[0]);for(var me=ne[0],Ce=1;Ce<ne.length;Ce++)ge(ne[Ce]),me+=V+ne[Ce];return me}return""})},s.tie=function(){return this.tieWith("")},s.times=function(V,ne){var me=this;return arguments.length<2&&(ne=V),fe(V),fe(ne),o(function(Ce,je){for(var Ye=[],ze=void 0,pt=void 0,Yt=0;Yt<V;Yt+=1){if(pt
`),Is=$e(`\r
`),Yo=Se(Is,Pi,Fi).desc("newline"),ji=Se(Yo,Sa);o.all=vr,o.alt=Se,o.any=In,o.cr=Fi,o.createLanguage=function(V){var ne={};for(var me in V)({}).hasOwnProperty.call(V,me)&&function(Ce){ne[Ce]=At(function(){return V[Ce](ne)})}(me);return ne},o.crlf=Is,o.custom=function(V){return o(V(L,z))},o.digit=Mr,o.digits=Nr,o.empty=an,o.end=ji,o.eof=Sa,o.fail=Dt,o.formatError=Be,o.index=Sn,o.isParser=F,o.lazy=At,o.letter=Ss,o.letters=mo,o.lf=Pi,o.lookahead=Et,o.makeFailure=z,o.makeSuccess=L,o.newline=Yo,o.noneOf=function(V){return rn(function(ne){return V.indexOf(ne)<0}).desc("none of '"+V+"'")},o.notFollowedBy=$t,o.of=ft,o.oneOf=function(V){for(var ne=V.split(""),me=0;me<ne.length;me++)ne[me]="'"+ne[me]+"'";return rn(function(Ce){return V.indexOf(Ce)>=0}).desc(ne)},o.optWhitespace=po,o.Parser=o,o.range=function(V,ne){return rn(function(me){return V<=me&&me<=ne}).desc(V+"-"+ne)},o.regex=lt,o.regexp=lt,o.sepBy=Ue,o.sepBy1=Je,o.seq=it,o.seqMap=Vt,o.seqObj=function(){for(var V,ne={},me=0,Ce=(V=arguments,Array.prototype.slice.call(V)),je=Ce.length,Ye=0;Ye<je;Ye+=1){var ze=Ce[Ye];if(!F(ze)){if(H(ze)&&ze.length===2&&typeof ze[0]=="string"&&F(ze[1])){var pt=ze[0];if(Object.prototype.hasOwnProperty.call(ne,pt))throw new Error("seqObj: duplicate key "+pt);ne[pt]=!0,me++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(me===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(Yt,On){for(var yn,na={},Fn=0;Fn<je;Fn+=1){var yr,ra;if(H(Ce[Fn])?(yr=Ce[Fn][0],ra=Ce[Fn][1]):(yr=null,ra=Ce[Fn]),!(yn=U(ra._(Yt,On),yn)).status)return yn;yr&&(na[yr]=yn.value),On=yn.index}return U(L(On,na),yn)})},o.string=$e,o.succeed=ft,o.takeWhile=function(V){return ie(V),o(function(ne,me){for(var Ce=me;Ce<ne.length&&V(ce(ne,Ce));)Ce++;return L(Ce,ne.slice(me,Ce))})},o.test=rn,o.whitespace=Nl,o["fantasy-land/empty"]=an,o["fantasy-land/of"]=ft,o.Binary={bitSeq:D,bitSeqObj:function(V){w();var ne={},me=0,Ce=m(function(Ye){if(H(Ye)){var ze=Ye;if(ze.length!==2)throw new Error("["+ze.join(", ")+"] should be length 2, got length "+ze.length);if(ge(ze[0]),fe(ze[1]),Object.prototype.hasOwnProperty.call(ne,ze[0]))throw new Error("duplicate key in bitSeqObj: "+ze[0]);return ne[ze[0]]=!0,me++,ze}return fe(Ye),[null,Ye]},V);if(me<1)throw new Error("bitSeqObj expects at least one named pair, got ["+V.join(", ")+"]");var je=m(function(Ye){return Ye[0]},Ce);return D(m(function(Ye){return Ye[1]},Ce)).map(function(Ye){return d(function(ze,pt){return pt[0]!==null&&(ze[pt[0]]=pt[1]),ze},{},m(function(ze,pt){return[ze,Ye[pt]]},je))})},byte:function(V){if(w(),fe(V),V>255)throw new Error("Value specified to byte constructor ("+V+"=0x"+V.toString(16)+") is larger in value than a single byte.");var ne=(V>15?"0x":"0x0")+V.toString(16);return o(function(me,Ce){var je=ce(me,Ce);return je===V?L(Ce+1,je):z(Ce,ne)})},buffer:function(V){return S("buffer",V).map(function(ne){return Buffer.from(ne)})},encodedString:function(V,ne){return S("string",ne).map(function(me){return me.toString(V)})},uintBE:E,uint8BE:E(1),uint16BE:E(2),uint32BE:E(4),uintLE:A,uint8LE:A(1),uint16LE:A(2),uint32LE:A(4),intBE:N,int8BE:N(1),int16BE:N(2),int32BE:N(4),intLE:R,int8LE:R(1),int16LE:R(2),int32LE:R(4),floatBE:S("floatBE",4).map(function(V){return V.readFloatBE(0)}),floatLE:S("floatLE",4).map(function(V){return V.readFloatLE(0)}),doubleBE:S("doubleBE",8).map(function(V){return V.readDoubleBE(0)}),doubleLE:S("doubleLE",8).map(function(V){return V.readDoubleLE(0)})},n.exports=o}])})})(Q);var f1=()=>/(?:[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\
8 months ago
${e}`,posNum:-1};const r=t.split(`
8 months ago
`),a=r.slice(0,n+1).join(`
`),o=r.slice(n+1).join(`
`);return/^\s*$/g.test(r[n+1])?{content:`${a}
8 months ago
${e}
8 months ago
${o}`,posNum:n}:{content:`${a}
8 months ago
${e}
8 months ago
${o}`,posNum:n}}const m1=async e=>{const t=rt.getState().app,n=t.metadataCache.getFirstLinkpathDest("",e);if(!n){new x.Notice(k("File not found for the given thino path"));return}await t.workspace.getLeaf("split").openFile(n)},p1=async(e,t)=>{const{app:n}=rt.getState(),r=parseInt(e.slice(14)),a=n.metadataCache.getFirstLinkpathDest("",t);if(!x.Platform.isMobile)await n.workspace.getLeaf("split").openFile(a,{eState:{line:r}});else{let o=n.workspace.activeLeaf;o===null&&(o=n.workspace.getLeaf(!1)),await o.openFile(a,{eState:{line:r}})}},g1=async(e,t)=>{var d;const n=rt.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new x.Notice(k("File not found for the given thino path"));return}let a="";try{a=await n.vault.read(r)}catch(m){console.error(m),a=await n.vault.cachedRead(r)}const s=a.split(/\r?\n/).findIndex(m=>m.contains(e)),u=n.workspace.getLeaf("split");await u.openFile(r,{eState:{line:s}});try{(d=u.view.editor)==null||d.setCursor({line:s,ch:1})}catch(m){console.error(m)}},v1=async(e,t)=>{var u;const n=rt.getState().app,r=(d,m)=>{var g;const p=(g=Array.from(d.nodes.values()))==null?void 0:g.find(w=>w.id===m);return p?(d.selectOnly(p),d.zoomToSelection(),!0):!1},a=n.workspace.getLeavesOfType("canvas");for(const d of a){const m=d.view;if(((u=m==null?void 0:m.file)==null?void 0:u.path)===t&&r(m.canvas,e))return}const o=n.metadataCache.getFirstLinkpathDest("",t);if(!o){new x.Notice(k("File not found for the given thino path"));return}const s=n.workspace.getLeaf("split");await s.openFile(o),setTimeout(()=>{var d;r((d=s.view)==null?void 0:d.canvas,e)},10)},OA="https://api.thino.pkmer.cn/test",Zd=OA,FA="unknown",PA=/!\[(?<content>[^\]]+)\]\((?<link>[^)]+)\)/g;function jA(e){return e.substring(e.lastIndexOf(".")+1)}function LA(e){return{id:e.id,createdAt:Date.now().toString(),filename:e.id,type:`${jA(e.id)}`,size:e.size.toString()}}function RA(e){const t=e==null?void 0:e.matchAll(PA);return t?Array.from(t).map(n=>{var r;return LA({url:(r=n.groups)==null?void 0:r.link,id:FA,size:0,mtime:""})}).filter(n=>n.type!="html"):[]}function Em(e){var t;return{id:e.id,createdAt:x.moment(e.ctime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),updatedAt:x.moment(e.mtime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),deletedAt:(t=e.ttime)!=null&&t.toString()?x.moment(e.ttime.toString(),"x").format("YYYY-MM-DD HH:mm:ss"):"",rowStatus:e.rowStatus,content:e.content,pinned:e.pinned,resourceList:RA(e.content),creatorName:"thino",sourceType:(e==null?void 0:e.thinoType)||"FILE",visibility:"PUBLIC",localId:e.originalId,deleted:!!e.dtime}}async function _A(e){const n={url:`${Zd}/thino/getThinos${e?`?since=${e}&includeDeleted=true`:""}`,method:"GET",headers:{Authorization:`Bearer ${Wd()}`}};return x.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to fetch memos: ${r.status}`);try{return r.json.payload.map(o=>Em(o))}catch(a){console.error(`Error processing memo response: ${a}`)}}).catch(r=>(console.error(r),[]))}function Wd(){const e=Ee.getState().dailyNotesState.app||app;return(e==null?void 0:e.loadLocalStorage("tokenForSync"))||""}async function kT(e){const t=`${Zd}/thino/createThino`,n={content:e.content,thinoType:(e==null?void 0:e.thinoType)||"FILE",pinned:!1,rowStatus:"NORMAL",encrypted:!1},r={url:t,method:"POST",contentType:"application/json",body:JSON.stringify(n),headers:{Authorization:`Bearer ${Wd()}`}};return x.requestUrl(r).then(a=>{a.status>=400&&console.error(`Failed to create memo: ${a.status}`);try{const o=a.json;return Em(o.payload)}catch(o){console.error(`Error processing memo creation response: ${o}`)}}).catch(a=>(console.error(a),null))}function HA(e){return{id:e.id,ctime:x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").valueOf(),mtime:x.moment(e.updatedAt,"YYYY/MM/DD HH:mm:ss").valueOf(),ttime:e.deletedAt?x.moment(e.deletedAt,"YYYY/MM/DD HH:mm:ss").valueOf():void 0,rowStatus:e.rowStatus,content:e.content,pinned:e.pinned,encrypted:!1,thinoType:e.sourceType==="DAILY"?"DAILY":"FILE",tags:[]}}async function BA(e){const t=`${Zd}/thino/createThinosByData`,n=e.map(a=>HA(a)),r={url:t,method:"POST",contentType:"applicatio
`+$+i}var ve=!1;function De(i,l){if(!i||ve)return"";ve=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(ye){var v=ye}Reflect.construct(i,[],l)}else{try{l.call()}catch(ye){v=ye}i.call(l.prototype)}else{try{throw Error()}catch(ye){v=ye}i()}}catch(ye){if(ye&&v&&typeof ye.stack=="string"){for(var I=ye.stack.split(`
`),C=v.stack.split(`
`),_=I.length-1,G=C.length-1;1<=_&&0<=G&&I[_]!==C[G];)G--;for(;1<=_&&0<=G;_--,G--)if(I[_]!==C[G]){if(_!==1||G!==1)do if(_--,G--,0>G||I[_]!==C[G]){var ee=`
`+I[_].replace(" at new "," at ");return i.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",i.displayName)),ee}while(1<=_&&0<=G);break}}}finally{ve=!1,Error.prepareStackTrace=h}return(i=i?i.displayName||i.name:"")?X(i):""}function be(i){switch(i.tag){case 5:return X(i.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 2:case 15:return i=De(i.type,!1),i;case 11:return i=De(i.type.render,!1),i;case 1:return i=De(i.type,!0),i;default:return""}}function ke(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case L:return"Fragment";case P:return"Portal";case U:return"Profiler";case z:return"StrictMode";case ce:return"Suspense";case fe:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case K:return(i.displayName||"Context")+".Consumer";case W:return(i._context.displayName||"Context")+".Provider";case ae:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ie:return l=i.displayName||null,l!==null?l:ke(i.type)||"Memo";case ge:l=i._payload,i=i._init;try{return ke(i(l))}catch{}}return null}function Be(i){var l=i.type;switch(i.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=l.render,i=i.displayName||i.name||"",l.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(l);case 8:return l===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function _e(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function it(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Vt(i){var l=it(i)?"checked":"value",h=Object.getOwnPropertyDescriptor(i.constructor.prototype,l),v=""+i[l];if(!i.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var I=h.get,C=h.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return I.call(this)},set:function(_){v=""+_,C.call(this,_)}}),Object.defineProperty(i,l,{enumerable:h.enumerable}),{getValue:function(){return v},setValue:function(_){v=""+_},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Se(i){i._valueTracker||(i._valueTracker=Vt(i))}function Ue(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var h=l.getValue(),v="";return i&&(v=it(i)?i.checked?"true":"false":i.value),i=v,i!==h?(l.setValue(i),!0):!1}function Je(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function $e(i,l){var h=l.checked;return Z({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??i._wrapperState.initialChecked})}function lt(i,l){var h=l.defaultValue==null?"":l.defaultValue,v=l.checked!=null?l.checked:l.defaultChecked;h=_e(l.value!=null?l.value:h),i._wrapperState={initialChecked:v,initialValue:h,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function ft(i,l){l=l.checked,l!=null&&R(i,"checked",l,!1)}function Dt(i,l){ft(i,l);var h=_e(l.value),v=l.type;if(h!=null)v==="number"?(h===0&&i.value===""||i.value!=h)&&(i.value=""+h):i.value!==""+h&&(i.value=""+h);else if(v==="submit"||v==="reset"){i.removeAttribute("value");return}l.hasOwnProperty("value")?$t(i,l.type,h):l.hasOwnProperty("defaultValue")&&$t(i,l.type,_e(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(i.defaultChecked=!!l.defaultChecked)}function Et(i,l,h){if(l.hasOwnProperty("value")||l.ha
`).replace(By,"")}function Zl(i,l,h){if(l=Ep(l),Ep(i)!==l&&h)throw Error(n(425))}function hu(){}var Wl=null,Vi=null;function $l(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Qo=typeof setTimeout=="function"?setTimeout:void 0,Gl=typeof clearTimeout=="function"?clearTimeout:void 0,_s=typeof Promise=="function"?Promise:void 0,mu=typeof queueMicrotask=="function"?queueMicrotask:typeof _s<"u"?function(i){return _s.resolve(null).then(i).catch(Hs)}:Qo;function Hs(i){setTimeout(function(){throw i})}function Af(i,l){var h=l,v=0;do{var I=h.nextSibling;if(i.removeChild(h),I&&I.nodeType===8)if(h=I.data,h==="/$"){if(v===0){i.removeChild(I),Ht(l);return}v--}else h!=="$"&&h!=="$?"&&h!=="$!"||v++;h=I}while(h);Ht(l)}function Xo(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return i}function xp(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var h=i.data;if(h==="$"||h==="$!"||h==="$?"){if(l===0)return i;l--}else h==="/$"&&l++}i=i.previousSibling}return null}var Bs=Math.random().toString(36).slice(2),Ga="__reactFiber$"+Bs,ei="__reactProps$"+Bs,Vr="__reactContainer$"+Bs,pu="__reactEvents$"+Bs,B="__reactListeners$"+Bs,Ys="__reactHandles$"+Bs;function qa(i){var l=i[Ga];if(l)return l;for(var h=i.parentNode;h;){if(l=h[Vr]||h[Ga]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(i=xp(i);i!==null;){if(h=i[Ga])return h;i=xp(i)}return l}i=h,h=i.parentNode}return null}function nr(i){return i=i[Ga]||i[Vr],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function St(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function gu(i){return i[ei]||null}var Of=[],zs=-1;function Ar(i){return{current:i}}function Qt(i){0>zs||(i.current=Of[zs],Of[zs]=null,zs--)}function qt(i,l){zs++,Of[zs]=i.current,i.current=l}var ti={},rr=Ar(ti),Or=Ar(!1),Dr=ti;function Us(i,l){var h=i.type.contextTypes;if(!h)return ti;var v=i.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===l)return v.__reactInternalMemoizedMaskedChildContext;var I={},C;for(C in h)I[C]=l[C];return v&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=l,i.__reactInternalMemoizedMaskedChildContext=I),I}function Fr(i){return i=i.childContextTypes,i!=null}function vu(){Qt(Or),Qt(rr)}function Cp(i,l,h){if(rr.current!==ti)throw Error(n(168));qt(rr,l),qt(Or,h)}function Mp(i,l,h){var v=i.stateNode;if(l=l.childContextTypes,typeof v.getChildContext!="function")return h;v=v.getChildContext();for(var I in v)if(!(I in l))throw Error(n(108,Be(i)||"Unknown",I));return Z({},h,v)}function ia(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ti,Dr=rr.current,qt(rr,i),qt(Or,Or.current),!0}function Np(i,l,h){var v=i.stateNode;if(!v)throw Error(n(169));h?(i=Mp(i,l,Dr),v.__reactInternalMemoizedMergedChildContext=i,Qt(Or),Qt(rr),qt(rr,i)):Qt(Or),qt(Or,h)}var bo=null,yu=!1,Ff=!1;function kp(i){bo===null?bo=[i]:bo.push(i)}function Zi(i){yu=!0,kp(i)}function ni(){if(!Ff&&bo!==null){Ff=!0;var i=0,l=_t;try{var h=bo;for(_t=1;i<h.length;i++){var v=h[i];do v=v(!0);while(v!==null)}bo=null,yu=!1}catch(I){throw bo!==null&&(bo=bo.slice(i+1)),Wm(sf,ni),I}finally{_t=l,Ff=!1}}return null}var Vs=[],ar=0,wu=null,bu=0,sa=[],la=0,Wi=null,Ja=1,Ka="";function $i(i,l){Vs[ar++]=bu,Vs[ar++]=wu,wu=i,bu=l}function Ap(i,l,h){sa[la++]=Ja,sa[la++]=Ka,sa[la++]=Wi,Wi=i;var v=Ja;i=Ka;var I=32-xa(v)-1;v&=~(1<<I),h+=1;var C=32-xa(l)+I;if(30<C){var _=I-I%5;C=(v&(1<<_)-1).toString(32),v>>=_,I-=_,Ja=1<<32-xa(l)+I|h<<I|v,Ka=C+i}else Ja=1<<C|h<<I|v,Ka=i}function ql(i){i.return!==null&&($i(i,1),Ap(i,1,0))}function Gi(i){for(;i===wu;)wu=Vs[--ar],Vs[ar]=null,bu=Vs[--ar],Vs[ar]=null;for(;i===Wi;)Wi=sa[--la],sa[la]=null,Ka=sa[--la],sa[la]=null,Ja=sa[--la],sa[la]=null}var or=null,Zr=null,Xt=!1,Ma=null;function Qa(i,l){var h=Jr(5,null,null,0);h.elementType="DELETED",h.stateNode=l,h.return=i,l=i.deletions
Error generating stack: `+C.message+`
`+C.stack}return{value:i,source:l,stack:I,digest:null}}function Xs(i,l,h){return{value:i,source:null,stack:h??null,digest:l??null}}function Hu(i,l){try{console.error(l.value)}catch(h){setTimeout(function(){throw h})}}var Bu=typeof WeakMap=="function"?WeakMap:Map;function Yu(i,l,h){h=Aa(-1,h),h.tag=3,h.payload={element:null};var v=l.value;return h.callback=function(){Ku||(Ku=!0,hh=v),Hu(i,l)},h}function sc(i,l,h){h=Aa(-1,h),h.tag=3;var v=i.type.getDerivedStateFromError;if(typeof v=="function"){var I=l.value;h.payload=function(){return v(I)},h.callback=function(){Hu(i,l)}}var C=i.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(h.callback=function(){Hu(i,l),typeof v!="function"&&(mi===null?mi=new Set([this]):mi.add(this));var _=l.stack;this.componentDidCatch(l.value,{componentStack:_!==null?_:""})}),h}function Zp(i,l,h){var v=i.pingCache;if(v===null){v=i.pingCache=new Bu;var I=new Set;v.set(l,I)}else I=v.get(l),I===void 0&&(I=new Set,v.set(l,I));I.has(h)||(I.add(h),i=Ky.bind(null,i,l,h),l.then(i,i))}function Xf(i){do{var l;if((l=i.tag===13)&&(l=i.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return i;i=i.return}while(i!==null);return null}function lc(i,l,h,v,I){return i.mode&1?(i.flags|=65536,i.lanes=I,i):(i===l?i.flags|=65536:(i.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(l=Aa(-1,1),l.tag=2,oi(h,l,1))),h.lanes|=1),i)}var Wp=F.ReactCurrentOwner,lr=!1;function Tr(i,l,h,v){l.child=i===null?Bf(l,null,h,v):si(l,i.child,h,v)}function eh(i,l,h,v,I){h=h.render;var C=l.ref;return ri(l,I),v=Au(i,l,h,v,C,I),h=Ou(),i!==null&&!lr?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~I,ro(i,l,I)):(Xt&&h&&ql(l),l.flags|=1,Tr(i,l,v,I),l.child)}function to(i,l,h,v,I){if(i===null){var C=h.type;return typeof C=="function"&&!Dh(C)&&C.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(l.tag=15,l.type=C,th(i,l,C,v,I)):(i=rd(h.type,null,v,l,l.mode,I),i.ref=l.ref,i.return=l,l.child=i)}if(C=i.child,!(i.lanes&I)){var _=C.memoizedProps;if(h=h.compare,h=h!==null?h:Ge,h(_,v)&&i.ref===l.ref)return ro(i,l,I)}return l.flags|=1,i=yi(C,v),i.ref=l.ref,i.return=l,l.child=i}function th(i,l,h,v,I){if(i!==null){var C=i.memoizedProps;if(Ge(C,v)&&i.ref===l.ref)if(lr=!1,l.pendingProps=v=C,(i.lanes&I)!==0)i.flags&131072&&(lr=!0);else return l.lanes=i.lanes,ro(i,l,I)}return zu(i,l,h,v,I)}function nh(i,l,h){var v=l.pendingProps,I=v.children,C=i!==null?i.memoizedState:null;if(v.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null,transitions:null},qt(al,qr),qr|=h;else{if(!(h&1073741824))return i=C!==null?C.baseLanes|h:h,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:i,cachePool:null,transitions:null},l.updateQueue=null,qt(al,qr),qr|=i,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=C!==null?C.baseLanes:h,qt(al,qr),qr|=v}else C!==null?(v=C.baseLanes|h,l.memoizedState=null):v=h,qt(al,qr),qr|=v;return Tr(i,l,I,h),l.child}function $p(i,l){var h=l.ref;(i===null&&h!==null||i!==null&&i.ref!==h)&&(l.flags|=512,l.flags|=2097152)}function zu(i,l,h,v,I){var C=Fr(h)?Dr:rr.current;return C=Us(l,C),ri(l,I),h=Au(i,l,h,v,C,I),v=Ou(),i!==null&&!lr?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~I,ro(i,l,I)):(Xt&&v&&ql(l),l.flags|=1,Tr(i,l,h,I),l.child)}function Gp(i,l,h,v,I){if(Fr(h)){var C=!0;ia(l)}else C=!1;if(ri(l,I),l.stateNode===null)el(i,l),_f(l,h,v),Hf(l,h,v,I),v=!0;else if(i===null){var _=l.stateNode,G=l.memoizedProps;_.props=G;var ee=_.context,ye=h.contextType;typeof ye=="object"&&ye!==null?ye=Sr(ye):(ye=Fr(h)?Dr:rr.current,ye=Us(l,ye));var Fe=h.getDerivedStateFromProps,Le=typeof Fe=="function"||typeof _.getSnapshotBeforeUpdate=="function";Le||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(G!==v||ee!==ye)&&Lp(l,_,v,ye),ai=!1;var Oe=l.memoizedState;_.state=Oe,Eu(l,v,_,I),ee=l.memoizedState,G!==v||Oe!==ee||Or.current||ai?(typeof Fe=="function"&&(Rf(l,h,Fe,v),ee=l.memoizedState),(G=ai||Cu(l,h,G,v,Oe,ee,ye))?(Le||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMo
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return e.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error(`Unsupported platform: ${process.platform}`)}}function zn(e=!1){return new Promise((t,n)=>{o8(l8[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=d8(a.toString());return t(e?o:u8(o))})})}const ID={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},f8=e=>{const{dailyNotesState:{app:t,view:n,verifyState:r,settings:a},globalState:{manifest:o,isMobileView:s}}=O.useContext(wt),u=O.useRef(null),d=O.useRef(null),[m,p]=O.useState((window.app||t).loadLocalStorage("thinoListView")||"list"),[g,w]=O.useState(null);O.useEffect(()=>{if(!o||!t)return;const S=t==null?void 0:t.plugins.getPlugin(o.id);w(S),p(S==null?void 0:S.settings.MemoListView),Qe.setMemoListView(S==null?void 0:S.settings.MemoListView)},[o,t]),O.useEffect(()=>{if(!t||!n||!g||!g.settings)return;const S=()=>{var E;if(n.leaf.height===0)return;const T=(E=g==null?void 0:g.settings)==null?void 0:E.MemoListView;T==="chat"||T==="moments"||(n.leaf.width>950?(p(T||"list"),Qe.setMemoListView(T||"list")):n.leaf.width<=950&&(Qe.setMemoListView("list"),p("list")))};S(),d.current||(d.current=t.workspace.on("resize",S),n.registerEvent(d.current))},[t,n,g]),O.useEffect(()=>{u&&(x.setIcon(u.current,ID[m]),Qe.setMemoListView(m),x.requireApiVersion("1.4.4")&&x.setTooltip(u.current,k("Switch view")))},[m]);const D=async S=>{var F;const T=!x.Platform.isDesktop&&await((F=window.Capacitor)==null?void 0:F.Plugins.Device.getId()),E=x.Platform.isDesktop?await zn():T.identifier||T.uuid;if(!r||(r==null?void 0:r.appId)!==E){fn();return}const A=async H=>{Qe.setMemoListView(H),g&&(g.settings.MemoListView=H,await g.saveSettings()),p(H)},N=[{view:"list",title:k("List")},{view:"chat",title:k("Chat")},{view:"moments",title:k("Moments")}];s||N.push({view:"waterfall",title:k("Waterfall")},{view:"calendar",title:k("Calendar")},{view:"table",title:k("Table")});const R=new x.Menu;N.forEach(({view:H,title:P})=>{R.addItem(L=>{L.setChecked(m===H).setIcon(ID[H]).setTitle(P).onClick(()=>{m!==H&&A(H)})})}),R.showAtMouseEvent(S.nativeEvent)};return y.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:u,onClick:D})},h8=()=>{const e=O.useRef(null);return O.useEffect(()=>{e&&(x.setIcon(e.current,"calendar-check"),x.setTooltip&&x.setTooltip(e.current,k("Daily Memos")))},[e]),y.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{We.setPathname("/daily")}})},A0=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),TD={initialValue:"",interval:300};class m8{constructor(t,n=TD){this.listeners=[],this.runUndo=()=>{const r=this.actions[this.currentIndex].selectionStart;this.currentIndex>0&&this.currentIndex--,this.element.value=this.actions[this.currentIndex].value,this.element.setSelectionRange(r,r),this.dispatchChange()},this.runRedo=()=>{this.currentIndex<this.actions.length-1&&this.currentIndex++;const r=this.actions[this.currentIndex].selectionEnd;this.element.value=this.actions[this.currentIndex].value,this.element.setSelectionRange(r,r),this.dispatchChange()},this.getActions=()=>this.actions,this.setState=(r,a)=>{this.actions=[...r],this.currentIndex=a<this.actions.length?a:this.actions.length-1,this.dispatchChange()},this.resetState=()=>{this.actions=[A0()],this.currentIndex=0,this.dispatchChange()},this.destroy=()=>{this.rmEventListeners()},this.subscribe=r=>{this.listeners.push(r)},this.handleElementKeydown=r=>{const a=r;a.key==="z"&&!a.shiftKey&&(a.metaKey||a.ctrlKey)?(r.preventDefault(),this.runUndo()):(a.key==="z"&&a.shiftKey&&(a.metaKey||a.ctrlKey)||a.key==="y"&&(a.metaKey||a.ctrlKey))&&(r.preventDefault(),this.runRedo())},this.handleElementInput=r=>{const a=r,o=this.actions[th
8 months ago
8 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},O8=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],xg=function(t){return C8(t).map(function(n){return O8.includes(n)?"\\".concat(n):n}).join("")},F8=function(e){Bv(t,e);function t(){return Cm(this,t),Hv(this,kd(t).apply(this,arguments))}return _v(t,[{key:"componentDidMount",value:function(){var r=this.props.boundariesElement;if(typeof r=="string"){var a=document.querySelector(r);if(!a)throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");this.containerElem=a}else if(r instanceof HTMLElement)this.containerElem=r;else throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");if(!this.containerElem||!this.containerElem.contains(this.ref))throw new Error("RTA: Invalid prop boundariesElement: it has to be one of the parents of the RTA.")}},{key:"componentDidUpdate",value:function(){var r,a,o=this.props.top||0,s=this.props.left||0,u=[],d=[],m=0,p=0,g=this.containerElem.getBoundingClientRect(),w=this.ref.getBoundingClientRect(),D=this.props.textareaRef.getBoundingClientRect(),S=window.getComputedStyle(this.ref),T=parseInt(S.getPropertyValue("margin-top"),10),E=parseInt(S.getPropertyValue("margin-bottom"),10),A=parseInt(S.getPropertyValue("margin-left"),10),N=parseInt(S.getPropertyValue("margin-right"),10),R=T+E+D.top+o+w.height,F=A+N+D.left+s+w.width;F>g.right&&D.left+s>w.width?(p=s-w.width,u.push(ul.X.LEFT),d.push(ul.X.RIGHT)):(p=s,u.push(ul.X.RIGHT),d.push(ul.X.LEFT)),R>g.bottom&&D.top+o>w.height?(m=o-w.height,u.push(ul.Y.TOP),d.push(ul.Y.BOTTOM)):(m=o,u.push(ul.Y.BOTTOM),d.push(ul.Y.TOP)),this.props.renderToBody&&(m+=D.top,p+=D.left),this.ref.style.top="".concat(m,"px"),this.ref.style.left="".concat(p,"px"),(r=this.ref.classList).remove.apply(r,d),(a=this.ref.classList).add.apply(a,u)}},{key:"render",value:function(){var r=this,a=this.props,o=a.style,s=a.className,u=a.innerRef,d=a.children,m=a.renderToBody,p=document.body,g=q.createElement("div",{ref:function(D){r.ref=D,u(D)},className:"rta__autocomplete ".concat(s||""),style:o},d);return m&&p!==null?b1.createPortal(g,p):g}}]),t}(q.Component),BT=function(e){Bv(t,e);function t(n){var r;Cm(this,t),r=Hv(this,kd(t).call(this,n)),r.state={top:null,left:null,currentTrigger:null,actualToken:"",data:null,value:"",dataLoading:!1,selectionEnd:0,component:null,textToReplace:null},r.escListenerInit=function(){r.escListener||(r.escListener=Ec.add(Ha.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(Ec.remove(r.escListener),r.escListener=null)},r.getSelectionPosition=function(){return r.textareaRef?{selectionStart:r.textareaRef.selectionStart,selectionEnd:r.textareaRef.selectionEnd}:null},r.getSelectedText=function(){if(!r.textareaRef)return null;var d=r.textareaRef,m=d.selectionStart,p=d.selectionEnd;return m===p?null:r.state.value.substr(m,p-m)},r.setCaretPosition=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;r.textareaRef&&(r.textareaRef.focus(),r.textareaRef.setSelectionRange(d,d))},r.getCaretPosition=function(){if(!r.textareaRef)return 0;var d=r.textareaRef.selectionEnd;return d},r._handleCaretChange=function(d){var m=function(){var w=r.getCaretPosition()-1;r.lastTrigger=r.lastTrigger?w:0};if(d.type==="keydown"){var p=d.keyCode||d.which;switch(p){case Ha.UP:case Ha.DOWN:r._isAutocompleteOpen()||m();break;case Ha.LEFT:case Ha.RIGHT:m();break}return}m()},r._onSelect=function(d){var m=r.state,p=m.selectionEnd,g=m.currentTrigger,w=m.value,D=r.props.onItemSelected;if(g){var S=r._getTextToReplace(g);if(!S){r._closeAutocomplete();return}var T=S(d);if(!T){r._closeAutocomplete();return}D&&D({currentTrigger:g,item:d});var E=function(W,K,ae){switch(W){case"start":return ae;case"next":case"end":return ae+K.length;default:if(!Number.isInteger(W))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return W}},A=w.slice(0,p),N=xg(g),R=A.length-A.lastIndexOf(g),F=A.search(new RegExp("(?!".concat(N,")$"
8 months ago
Got "`.concat(String(w),'". Check the implementation for trigger "').concat(d,`"
See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.
8 months ago
`));if(w===null)return null;if(typeof w=="string")return{text:w,caretPosition:xD};if(!w.text&&typeof w.text!="string")throw new Error('Output "text" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
8 months ago
`));if(!w.caretPosition)throw new Error('Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
8 months ago
`));return w}if(typeof g!="string")throw new Error(`Output item should be string
`);return{text:"".concat(d).concat(g).concat(d),caretPosition:xD}}},r._getCurrentTriggerSettings=function(){var d=r.state.currentTrigger;return d?r.props.trigger[d]:null},r._getValuesFromProvider=function(){var d=r.state,m=d.currentTrigger,p=d.actualToken,g=r._getCurrentTriggerSettings();if(!(!m||!g)){var w=g.dataProvider,D=g.component;if(typeof w!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var S=w(p);S instanceof Promise||(S=Promise.resolve(S)),S.then(function(T){if(!Array.isArray(T))throw new Error("Trigger provider has to provide an array!");if(typeof D!="function")throw new Error("Component should be defined!");if(m===r.state.currentTrigger){if(!T.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:T,component:D})}}).catch(function(T){return CD(T.message)})}},r._getSuggestions=function(){var d=r.state,m=d.currentTrigger,p=d.data;return!m||!p||p&&!p.length?null:p},r._createRegExp=function(){var d=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(d).sort(function(m,p){return m<p?1:m>p?-1:0}).map(function(m){return xg(m)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(d).sort(function(m,p){return m<p?1:m>p?-1:0}).map(function(m){return xg(m)}).join("|"),")$"))},r._closeAutocomplete=function(){var d=r.state.currentTrigger;r.escListenerDestroy(),r.setState({data:null,dataLoading:!1,currentTrigger:null},function(){d&&r._onItemHighlightedHandler(null)})},r._cleanUpProps=function(){var d=S8({},r.props),m=["loadingComponent","boundariesElement","containerStyle","minChar","scrollToItem","ref","innerRef","onChange","onCaretPositionChange","className","value","trigger","listStyle","itemStyle","containerStyle","loaderStyle","className","containerClassName","listClassName","itemClassName","loaderClassName","dropdownStyle","dropdownClassName","movePopupAsYouType","textAreaComponent","renderToBody","onItemSelected","onItemHighlighted"];for(var p in d)m.includes(p)&&delete d[p];return d},r._changeHandler=function(d){var m=r.props,p=m.trigger,g=m.onChange,w=m.minChar,D=m.onCaretPositionChange,S=m.movePopupAsYouType,T=r.state,E=T.top,A=T.left,N=d;N||(N=new b8("change",{bubbles:!0}),r.textareaRef.dispatchEvent(N));var R=N.target||r.textareaRef,F=R.selectionEnd,H=R.value;if(r.lastValueBubbledEvent=H,g&&N&&(N.persist&&N.persist(),g(new Proxy(N,{get:function(Z,$,X){return $==="target"?R:Reflect.get(Z,$,X)}}))),D){var P=r.getCaretPosition();D(P)}r.setState({value:H});var L=function(){var Z=v8(R,F),$=Z.top,X=Z.left;r.setState({top:$-r.textareaRef.scrollTop||0,left:X})},z=function(Z){r.lastTrigger=F-Z,r._closeAutocomplete(),L()};if(F<=r.lastTrigger){var U=H.slice(0,F),W=r.tokenRegExp.exec(U);z(W?W[0].length:0)}var K=H.slice(r.lastTrigger,F),ae=r.tokenRegExp.exec(K),ce=ae&&ae[0],fe=ae&&ae[1]||null,ie=fe?fe.length-1:0,ge=r.tokenRegExpEnding.exec(K);if(ge?z(ge[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!ce||ce.length<=w+ie)&&(r.state.currentTrigger&&!p[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(fe&&p[fe].afterWhitespace&&!/\s/.test(H[F-ce.length-1])&&H[F-ce.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&p[r.state.currentTrigger].allowWhitespace){if(ae=new RegExp("".concat(xg(r.state.currentTrigger),".*$")).exec(H.slice(0,F)),ce=ae&&ae[0],!ce){r._closeAutocomplete();return}fe=Object.keys(p).find(function(we){return we.slice(0,ie+1)===ce.slice(0,ie+1)})||null}var Te=ce.slice(1);if(fe){(S||E===null&&A===null||r.state.currentTrigger!==fe)&&L(),r.escListenerInit();var se=r._getTextToReplace(fe);r.setState({selectionEnd:F,currentTrigger:fe,textToReplace:se,actualToken:Te},function(){try{r._getValuesFromProvider()}catch(we){CD(we.message)}})}},r._selectHandler=function(d){var m=r.props,p=m.onCaretPositionChange,g=m.onSelect;if(p){var w=r.getCaretPosition();p(w)}g&&(d.persist(),g(d))},r._shouldStayOpen=function(d){var m=d.relatedTarget;return m===null&&(m=document.activeElement),!!(r.dropdownRef&&m instanceof Node&&r.dro
`,Ue.id);else{const lt=Se.toPNG(),ft=new Blob([lt],{type:"image/png"}),Dt=new File([ft],"image.png",{type:"image/png",lastModified:Date.now()});if(!Dt)return;const Et=await se(Dt);Et&&(($e=S.current)==null||$e.insertText(Et+`
`,Ue.id))}})))},[S,s,a]),O.useEffect(()=>{o&&m(o.DefaultPrefix==="List")},[o==null?void 0:o.DefaultPrefix]),O.useEffect(()=>{if(o){if(o.EnabledLocationList.length===1){K(o.EnabledLocationList[0].value);return}K(o.MemoSaveLocation||"DAILY")}},[o==null?void 0:o.MemoSaveLocation,o==null?void 0:o.EnabledLocationList]),O.useEffect(()=>{var Je;if(!o||!U.current)return;const Se=(Je=Md.find($e=>$e.title===W))==null?void 0:Je.icon;x.setIcon(U.current,Se),x.requireApiVersion("1.4.4")&&x.setTooltip(U.current,k("Thino Save To: ")+W),ae.current=W;const Ue=r.manifest;if(Ue){const $e=a==null?void 0:a.plugins.getPlugin(Ue.id);if($e){if($e.settings.MemoSaveLocation===W)return;$e.settings.MemoSaveLocation=W,$e.saveSettings()}}},[W,g]),O.useEffect(()=>{S.current&&o.MemoSaveLocation&&K(o.MemoSaveLocation)},[U,o]),O.useEffect(()=>{if(!S.current||!o||x.Platform.isDesktop||r.globalEditorShown)return;const Se=x.Platform.isMobile===!0,Ue=o.UseButtonToShowEditor&&o.DefaultEditorLocation==="Bottom";if(x.Platform.isDesktop){w(!0);return}if(w(Se&&!Ue),t&&t==="inline")return;const Je=document.body.find(".memolist-wrapper");Je&&(Je.onscroll=()=>{if(r.globalEditorShown)return;const $e=S.current.getContent();Se&&Ue&&!$e&&w(!1)})},[r.globalEditorShown,S,o==null?void 0:o.UseButtonToShowEditor,o==null?void 0:o.DefaultEditorLocation]);const ce=()=>{R(!1)};O.useEffect(()=>{var Se,Ue,Je,$e,lt,ft,Dt,Et;if(r.markMemoId){const $t=`${k("MARK")}: [@THINO](${r.markMemoId})`;(Se=S.current)==null||Se.insertText($t),(Ue=S.current)==null||Ue.focus(),Qe.setMarkMemoId("");return}if((Je=r.editMemoId)!=null&&Je.trim()&&r.editMemoId!==T.current.editMemoId){const $t=Ie.getMemoById(r.editMemoId);if($t)switch(o.EditorType){case"memos":($e=S.current)==null||$e.setContent($t.content.replace(/ \^\S{6}$/,"")||""),(lt=S.current)==null||lt.focus();break;case"obsidian":(ft=S.current)==null||ft.clear(),(Dt=S.current)==null||Dt.setContent($t.content.replace(/ \^\S{6}$/,"")||""),(Et=S.current)==null||Et.focus();break}}T.current=r},[r.markMemoId,r.editMemoId]),O.useEffect(()=>{var Se,Ue,Je;!S.current||E||o.EditorType==="memos"&&((Se=S.current)==null||Se.element.addEventListener("paste",fe),(Ue=S.current)==null||Ue.element.addEventListener("drop",ie),(Je=S.current)==null||Je.element.addEventListener("click",ge),A(!0))},[S.current]);const fe=async Se=>{var Ue;if(Se.clipboardData&&Se.clipboardData.files.length>0){Se.preventDefault();const Je=Se.clipboardData.files;for(const $e of Je){const lt=await se($e);lt&&((Ue=S.current)==null||Ue.insertText(lt))}}},ie=async Se=>{var Ue;if(Se.dataTransfer&&Se.dataTransfer.files.length>0){Se.preventDefault();const Je=Se.dataTransfer.files;for(const $e of Je){const lt=await se($e);lt&&((Ue=S.current)==null||Ue.insertText(lt))}}},ge=()=>{var Se;$(((Se=S.current)==null?void 0:Se.element.value)||"")},Te=async(Se,Ue)=>{var lt,ft,Dt;const Je=Se.ctrlKey||Se.metaKey,$e=Se.altKey;if(Se.key==="Escape"&&r.globalEditorShown&&(Qe.setGlobalEditorShown(!1),Se.preventDefault()),Je&&Se.key==="Enter"){Se.preventDefault(),Se.stopPropagation(),Ue?(await we((ft=S.current)==null?void 0:ft.getContent()),(Dt=S.current)==null||Dt.clear()):await we((lt=S.current)==null?void 0:lt.element.value);return}if($e)for(let Et=0;Et<o.EnabledLocationList.length;Et++)Se.key===(Et+1).toString()&&K(o.EnabledLocationList[Et].value);setTimeout(()=>{var Et;Ue||$(((Et=S.current)==null?void 0:Et.element.value)||"")})},se=O.useCallback(async Se=>{const{type:Ue}=Se;if(Ue.startsWith("image"))try{return`${await y1.upload(Se)}`}catch(Je){new x.Notice(Je)}},[]),we=async Se=>{if(!Se||Se.trim()===""){new x.Notice(k("Content cannot be empty"));return}const Ue=rt.getState().settings,Je=Ue==null?void 0:Ue.addTagAutomatically,$e=Ue==null?void 0:Ue.addTagWithNewline,lt=Ue==null?void 0:Ue.addTagPosition,Dt=(a5()||[]).filter(At=>!Se.includes(`#${At}`)),Et=async(At,an)=>{an=an.replaceAll("&nbsp;"," "),Mg("");try{if(!At){let In;switch(ae.current){case"CANVAS":In=await Ie.createMemoCanvas({text:an,isList:p.current});break;case"MULTI":In=await Ie.createMemoMultiFile({content:an,isList:p.current});break;case"DAILY":I
`:""}${Se}`:`${Se} ${$e?`
`:""}${Dt.map(At=>`#${At}`).join(" ")}`:Se;await Et($t,rn),n&&n(),Mg("")},Z=O.useCallback(()=>{var Se;Qe.setEditMemoId(""),(Se=S.current)==null||Se.setContent(""),Mg("")},[]),$=O.useCallback(Se=>{if(Mg(Se??""),!S.current)return;const Ue=S.current.getContent(),Je=S.current.element.selectionStart,$e=Ue.slice(0,Je),lt=Ue.slice(Je);($e.endsWith("@")||$e.endsWith("📆"))&&lt.startsWith(" ")||($e.endsWith("@")||$e.endsWith("📆"))&&lt===""?(Be(),R(!0)):R(!1),setTimeout(()=>{var ft;(ft=S.current)==null||ft.focus()})},[o.EditorType]),X=Se=>{if(!S.current||!o)return;Se&&(ce(),m(!1));const Ue=S.current.getContent(),Je=S.current.element.selectionStart,$e=Ue.slice(0,Je),lt=Ue.slice(Je),ft=x.moment(Se);if($e.endsWith("@"))switch(o.InsertDateFormat){case"Dataview":S.current.element.value=Ue.slice(0,S.current.element.selectionStart-1)+"[due::"+ft.format("YYYY-MM-DD")+"]"+lt,S.current.element.setSelectionRange(Je+17,Je+17),S.current.focus(),$(S.current.element.value);break;case"Tasks":S.current.element.value=Ue.slice(0,S.current.element.selectionStart-1)+"📆"+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Je+11,Je+11),S.current.focus(),$(S.current.element.value)}else{S.current.element.value=$e+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Je+10,Je+10),S.current.focus(),$(S.current.element.value);return}},ve=()=>{S.current&&m()},De=async()=>{var Je;const Se=!x.Platform.isDesktop&&await((Je=window.Capacitor)==null?void 0:Je.Plugins.Device.getId()),Ue=x.Platform.isDesktop?await zn():Se.identifier||Se.uuid;return!u||(u==null?void 0:u.appId)!==Ue?(fn(),!1):!0},be=async Se=>{if(!await De())return;const Ue=new x.Menu;o.EnabledLocationList.forEach(ft=>{Ue.addItem(Dt=>{var Et;Dt.setTitle(ft.value).setIcon(((Et=Md.find($t=>$t.title===ft.value))==null?void 0:Et.icon)??"file").setChecked(W===ft.value).onClick(()=>{K(ft.value)})})});let Je=Se.target,$e=null;for(;!Je.hasClass("location-wrapper")&&($e=Je.parentElement,$e);)Je=$e;const lt=Je.getBoundingClientRect();setTimeout(()=>{Ue.showAtPosition({x:lt.x,y:lt.bottom,width:lt.width,left:!1,overlap:!0})},200)},ke=O.useCallback(()=>{var Se,Ue;if(!(!S.current&&o.EditorType==="memos"))switch(o.EditorType){case"obsidian":(Se=S.current)==null||Se.focus(),(Ue=a==null?void 0:a.commands)==null||Ue.executeCommandById("editor:insert-tag");break;case"memos":{const Je=S.current.getContent(),$e=S.current.element.selectionStart,lt=Je.slice(0,$e),ft=Je.slice($e);let Dt=lt+"# "+ft,Et=lt.length+1;lt.endsWith("#")&&ft.startsWith(" ")&&(Dt=lt.slice(0,lt.length-1)+ft.slice(1),Et=lt.length-1),S.current.element.value=Dt,S.current.element.setSelectionRange(Et,Et),S.current.focus();const $t=new Event("input",{bubbles:!0,cancelable:!0});S.current.element.dispatchEvent($t),$(S.current.element.value)}}},[a]),Be=O.useCallback(()=>{if(!S.current||!H.current||!o||!a)return;const Je=a.workspace.getLeavesOfType(Hr)[0].view.containerEl,$e=280,lt=Je.clientWidth,{x:ft,y:Dt}=o5(S.current.element);let Et,$t;x.Platform.isMobile?(window.innerWidth-ft>$e?Et=(ft+$e+16>lt,ft+18):window.innerWidth-ft<$e?Et=(ft+$e+16>lt,ft+34):Et=S.current.element.clientWidth/2,o.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?$t=Dt+4:o.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?$t=Dt+19:o.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&($t=Dt+36)):(Et=(ft+$e+16>lt,ft+18),$t=Dt+34),F(ft),H.current.style.left=`${Et}px`,H.current.style.top=`${$t}px`},[o,a]),_e=O.useCallback(()=>{const Se=document.createElement("input");document.body.appendChild(Se),Se.type="file",Se.multiple=!1,Se.accept="image/png, image/gif, image/jpeg",Se.onchange=async()=>{var $e;if(!Se.files||Se.files.length===0)return;const Ue=Se.files[0],Je=await se(Ue);Je&&(($e=S.current)==null||$e.insertText(Je)),document.body.removeChild(Se)},Se.click()},[]),it=!!r.editMemoId,Vt=O.useMemo(()=>({className:"memo-editor",inputerType:o.EditorType||"obsidian",initialContent:i5(),placeholder:k("What do you think now..."),showConfirmBtn:!0,showCancelBtn:it,showTools:!0,onConfirmBtnClick:we,onCancelBtnClick:Z,onContentChange:$}),[it,o.EditorType]
`},"")),w+r+E.replace(/ \^\S{6}/g,"")+`
`+A},"");return e.reduce((g,w)=>{const D=t!=null&&t.ShowDate?`- [[${x.moment(w.date,"YYYY-MM-DD").format(n)}]]
`:"",S=p(w.have),T=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?`
`:"";return g+D+S+T},"").replace(/<br>/g,`
`)},u5=[{label:k("Today"),value:x.moment().format("YYYY-MM-DD")},{label:k("Yesterday"),value:x.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:k("Last 7 days"),value:x.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:k("Last 30 days"),value:x.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:k("Last 90 days"),value:x.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:k("Last 180 days"),value:x.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:k("Last 365 days"),value:x.moment().subtract(365,"days").format("YYYY-MM-DD")}],lE=e=>{const{handleValueChange:t,setShownStatus:n}=e;return y.jsxs(y.Fragment,{children:[e.type==="icon"&&y.jsx("div",{className:"quick-date-btn-group",children:u5.map((r,a)=>y.jsx("div",{className:"btn action-btn quick-date-btn",onClick:()=>{t(r.value),n&&n(!1)},children:r.label},a))}),y.jsx(Nm,{className:"calendar-date-picker",datestamp:(e==null?void 0:e.defaultValue)||x.moment().startOf("day").valueOf(),handleDateStampChange:(r,a)=>{t(e.type==="icon"?x.moment(r).format("YYYY-MM-DD"):r.toString()),n&&n(!1)}})]})},dv=e=>{const{handleValueChange:t}=e,[n,r]=q.useState(!1),a=q.useRef(null),o=q.useRef(null),s=zv(o.current,a.current,{placement:"bottom-start"});return Mm(a,()=>{r(!1)}),y.jsxs(y.Fragment,{children:[y.jsx("span",{ref:d=>{o.current=d,d&&e.type==="icon"&&x.setIcon(d,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!x.Platform.isMobile&&r(!n),!x.Platform.isMobile&&(s!=null&&s.update)&&(s==null||s.update()),x.Platform.isMobile&&new cE(rt.getState().app,e.type,t).open()},children:e.type==="text"&&e.defaultValue?e.defaultText?e.defaultText:x.moment(e.defaultValue,"x").subtract(e.startOrEnd==="end"?1:0,"days").format("YYYY/MM/DD"):""}),y.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:s.styles.popper,children:y.jsx(lE,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class cE extends x.Modal{constructor(n,r,a){super(n);he(this,"root");he(this,"type");he(this,"handleValueChange");this.type=r,this.handleValueChange=a}onOpen(){const{contentEl:n}=this;this.root=Lv(n),this.root.render(y.jsx(lE,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const d5=(e,t)=>(e%t+t)%t;class f5{constructor(t,n,r){he(this,"owner");he(this,"values");he(this,"suggestions");he(this,"selectedItem");he(this,"containerEl");this.owner=t,this.containerEl=n,n.on("click",".suggestion-item",this.onSuggestionClick.bind(this)),n.on("mousemove",".suggestion-item",this.onSuggestionMouseover.bind(this)),r.register([],"ArrowUp",a=>{if(!a.isComposing)return this.setSelectedItem(this.selectedItem-1,!0),!1}),r.register([],"ArrowDown",a=>{if(!a.isComposing)return this.setSelectedItem(this.selectedItem+1,!0),!1}),r.register([],"Enter",a=>{if(!a.isComposing)return this.useSelectedItem(a),!1})}onSuggestionClick(t,n){t.preventDefault();const r=this.suggestions.indexOf(n);this.setSelectedItem(r,!1),this.useSelectedItem(t)}onSuggestionMouseover(t,n){const r=this.suggestions.indexOf(n);this.setSelectedItem(r,!1)}setSuggestions(t){this.containerEl.empty();const n=[];t.forEach(r=>{const a=this.containerEl.createDiv("suggestion-item");this.owner.renderSuggestion(r,a),n.push(a)}),this.values=t,this.suggestions=n,this.setSelectedItem(0,!1)}useSelectedItem(t){const n=this.values[this.selectedItem];n&&this.owner.selectSuggestion(n,t)}setSelectedItem(t,n){const r=d5(t,this.suggestions.length),a=this.suggestions[this.selectedItem],o=this.suggestions[r];a==null||a.removeClass("is-selected"),o==null||o.addClass("is-selected"),this.selectedItem=r,n&&o.scrollIntoView(!1)}}class uE{constructor(t,n){he(this,"inputEl");he(this,"popper");he(this,"scope");he(this,"suggestEl");he(this,"suggest");he(this,"cb");this.inputEl=t,this.scope=new x.Scope,this.cb=n,this.suggestEl=createDiv("suggestion-container");const r=this.suggestEl.createDiv("suggestion");this.suggest=new f5(this,r,this.scope),this.scope.register([],"Escape",this.
`:""}${z}`:`${z} ${H?`
`:""}${R.map(U=>`#${U}`).join(" ")}`),L&&L.content!==z){const U=await Ie.updateMemo(L.id,z==null?void 0:z.trim());P.push(U)}}P.length>0&&Ie.editMemoBulk(P),P.length>0&&We.clearQuery()};return y.jsxs("div",{className:"thino-tag-operation",children:[y.jsx("div",{className:"tag-operation-title",children:k("Tag Bulk Edit")}),y.jsxs("div",{className:"tag-operation-content",children:[y.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[y.jsx("div",{className:"name",children:k("Exist Tags")}),y.jsx("div",{className:"desc",children:k("Click to remove exist tag")})]}),y.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(N=>y.jsx("div",{className:mr("tag-operation-content-tag",u.includes(N)&&"tag-operation-content-tag-removed"),onClick:()=>{u.includes(N)||d([...u,N]),u.includes(N)&&d(u.filter(R=>R!==N)),o.includes(N)&&s(o.filter(R=>R!==N))},children:N},N))}),y.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[y.jsx("div",{className:"name",children:k("Selected Tags")}),y.jsx("div",{className:"desc",children:k("Click to remove selected tag")})]}),y.jsx("div",{className:"tag-operation-content-tags selected-tags",children:o.map(N=>y.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{s(o.filter(R=>R!==N))},children:N},N))}),y.jsx("div",{className:"tag-operation-content-inputer",children:y.jsx("input",{placeholder:k("Input to select exist tag"),ref:S})}),y.jsxs("div",{className:"tag-operation-settings",children:[y.jsx("div",{ref:p}),y.jsx("div",{ref:g})]}),y.jsxs("div",{className:"tag-operation-content-btn-group",children:[y.jsx("button",{className:"cancel-btn",onClick:n,children:k("Cancel")}),y.jsx("button",{className:"save-btn",onClick:E,children:k("Save")})]})]})]})},vd=async()=>{var r;const{verifyState:e}=rt.getState(),t=!x.Platform.isDesktop&&await((r=window.Capacitor)==null?void 0:r.Plugins.Device.getId()),n=x.Platform.isDesktop?await zn():t.identifier||t.uuid;return e&&(e==null?void 0:e.appId)===n};class yd extends x.Modal{constructor(t,n,r){super(t),this.title=n,this.cb=r}onOpen(){super.onOpen(),this.containerEl.toggleClass("thino-bulk-action-dialog",!0),this.titleEl.setText(this.title+k("Confirm?")),this.contentEl.createEl("button",{text:k("Confirm?").replace(/\?|/,"")}).onclick=()=>{this.cb("confirm"),this.close()},this.contentEl.createEl("button",{text:k("Cancel")}).onclick=()=>{this.cb("cancel"),this.close()}}onClose(){super.onClose()}}class g5 extends x.Modal{constructor(n,r){super(n);he(this,"root");this.thinos=r}onOpen(){super.onOpen(),this.containerEl.toggleClass(["thino-bulk-action-dialog","tag-actions"],!0),this.root=hs.createRoot(this.contentEl),this.root.render(y.jsx(Sl,{store:Ee,context:wt,children:y.jsx(p5,{app:this.app,closeDialog:this.close.bind(this),thinos:this.thinos})}))}onClose(){var n;super.onClose(),(n=this.root)==null||n.unmount()}}const Om=({thinosCount:e,thinos:t})=>{const{locationState:{query:n,pathname:r},dailyNotesState:{settings:a,app:o}}=O.useContext(wt),{tag:s,duration:u,type:d,text:m,filter:p}=n,g=tn.getQueryById(p),w=!!(s||u&&u.from<u.to||d||m||g),D=O.useRef(null);O.useEffect(()=>{D&&x.setIcon(D.current,"more-horizontal")},[D]);const S=async()=>{if(!((t==null?void 0:t.length)>0))return;const P=s5(t),L=c5(P);await Re.copyTextToClipboard(L),new x.Notice(k("Copied to clipboard Successfully"))},T=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await vd()){fn();return}const P=[...t],L=a.DeleteThinoDirectly;try{for(const z of P)if(L)await Ie.deleteMemoById(z.id);else{const U=await Ie.hideMemoById(z.id);U&&Ie.editMemo(U)}We.clearQuery()}catch(z){console.error("error",z),new x.Notice(z.message)}},E=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await vd()){fn();return}const P=[...t];try{for(const L of P)await Ie.deleteMemoById(L.id);We.clearQuery(),new x.Notice(k("DELETE SUCCEED"))}catch(L){console.error("error",L),new x.Notice(L.message)}},A=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await vd()){fn();return}const P=[...t];try{const L=await Ie.unarchiveThinoBulk(P);for(const z of L)z&&Ie.ed
`,s.current,r.path,n),(g=s.current)==null||g.toggleClass(["markdown-rendered"],!0);const p=(w=s.current)==null?void 0:w.querySelectorAll(".internal-link");p==null||p.forEach(D=>{const S=D,T=S.getAttribute("data-href");if(!T)return;t.metadataCache.getFirstLinkpathDest(T,r.path)||D.classList.add("is-unresolved"),S.addEventListener("mouseover",A=>{A.stopPropagation(),t.workspace.trigger("hover-link",{event:A,source:"thino",hoverParent:n.containerEl,targetEl:S,linktext:T,sourcePath:S.href})})})})()},[r.content,n,t]),y.jsx("div",{ref:s,className:"memo-content-text",onClick:m=>a(m,r),onDoubleClick:o,onContextMenu:m=>{m.preventDefault()}})},fE=O.memo(v5),y5=e=>{const[t,n]=O.useState({...e.memo,createdAtStr:Re.getDateTimeString(e.memo.createdAt)}),[r,a]=O.useState([]),[o,s]=O.useState([]);O.useEffect(()=>{(async()=>{try{const g=[],w=[...t.content.matchAll(Il)];for(const S of w)if(S&&S.length===3){const T=S[2],E=Ie.getMemoById(T);E&&g.push({...E,createdAtStr:Re.getDateTimeString(E.createdAt),dateStr:Re.getDateString(E.createdAt)})}a([...g]);const D=await Ie.getLinkedMemos(t.id);s(D.sort((S,T)=>Re.getTimeStampByDate(T.createdAt)-Re.getTimeStampByDate(S.createdAt)).map(S=>({...S,createdAtStr:Re.getDateTimeString(S.createdAt),dateStr:Re.getDateString(S.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const u=O.useCallback(async p=>{var w;const g=p.target;if(g.className==="memo-link-text"){const D=(w=g.dataset)==null?void 0:w.value,S=Ie.getMemoById(D??"");if(S){const T={...S,createdAtStr:Re.getDateTimeString(S.createdAt)};a([]),s([]),n(T)}else new x.Notice(k("Thino not found")),g.classList.remove("memo-link-text")}},[]),d=O.useCallback(p=>{a([]),s([]),n({...p,createdAtStr:Re.getDateTimeString(p.createdAt)})},[t.id]),m=O.useCallback(()=>{e.destroy(),Qe.setEditMemoId(t.id)},[t.id]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"memo-card-container",children:[y.jsxs("div",{className:"header-container",children:[y.jsx("span",{className:"time-text",children:t.createdAtStr}),y.jsxs("div",{className:"btns-container",children:[y.jsx("button",{ref:p=>{p&&x.setIcon(p,"edit")},className:"btn edit-btn",onClick:m}),y.jsx("button",{ref:p=>{p&&x.setIcon(p,"x")},className:"btn close-btn",onClick:e.destroy})]})]}),y.jsx("div",{className:"memo-container",children:y.jsx("div",{className:"memo-content-text",children:y.jsx(fE,{memo:t,handleMemoContentClick:u,handleMemoDoubleClick:()=>{}})})}),y.jsx("div",{className:"layer-container"})]}),r.length>0?y.jsxs("div",{className:"linked-memos-wrapper",children:[y.jsxs("span",{className:"normal-text",children:[k("LINKED")," ",r.length," THINO"," "]}),r.map(p=>{const g=_b(hw(p.content)).replaceAll(`
`," ");return y.jsxs("div",{className:"linked-memo-container",onClick:()=>d(p),children:[y.jsxs("span",{className:"time-text",children:[p.dateStr," "]}),g]},p.id)})]}):null,o.length>0?y.jsxs("div",{className:"linked-memos-wrapper",children:[y.jsxs("span",{className:"normal-text",children:[o.length," THINO ",k("LINK TO THE")," THINO"]}),o.map(p=>{const g=_b(hw(p.content)).replaceAll(`
`," ");return y.jsxs("div",{className:"linked-memo-container",onClick:()=>d(p),children:[y.jsxs("span",{className:"time-text",children:[p.dateStr," "]}),g]},p.id)})]}):null]})};function Gd(e){xm({className:"memo-card-dialog"},y5,{memo:e})}const Aw=new Map,Gg=async(e,t=!0)=>{const{vault:n,metadataCache:r}=rt.getState().app;if(t&&Aw.has(e))return Promise.resolve(Aw.get(e));let a;const o=await n.adapter.exists(e);let s="";try{if(!o&&!/(http|https)/g.test(e)){const u=r.getFirstLinkpathDest(e,"");if(!u){new x.Notice(k("File not exist"));return}s=u.path}else s=e}catch(u){console.error(u)}if(s){if(/(http|https)/g.test(s))try{const u=await x.requestUrl(e),d=new Uint8Array(u.arrayBuffer);a=new Blob([d],{type:"image/png"})}catch{}else if(s){const u=await n.adapter.readBinary(s),d=new Uint8Array(u);a=new Blob([d],{type:"image/png"})}return a?w5(a,e):""}},w5=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;Aw.set(t,a),n(a)},r.readAsDataURL(e)}),b5=async e=>{const t=document.createElement(e.tagName);t.innerHTML=e.innerHTML;const n=async(r,a)=>{if(!r||!a)return;const o=window.getComputedStyle(r);if(r.tagName==="IMG")try{let s="";const u=r.getAttribute("src");u!=null&&u.startsWith("http")&&!u.startsWith("http://localhost")?s=await Gg(r==null?void 0:r.getAttribute("src")):s=await Gg(r.getAttribute("path")||x.normalizePath(r==null?void 0:r.parentElement.getAttribute("src"))),a.src=s}catch(s){console.error(s)}else if(r.className==="property-image")try{const s=r.style.backgroundImage,u=await Gg(s);a.style.backgroundImage=u}catch(s){console.error(s)}for(const s of o)a.style.setProperty(s,o.getPropertyValue(s),o.getPropertyPriority(s));for(let s=0;s<a.childElementCount;s++)await n(r.children[s],a.children[s])};return await n(e,t),t},D5=async e=>{const t=e.ownerDocument.styleSheets,n=[];for(const a of t)for(const o of a.cssRules)o.constructor.name==="CSSFontFaceRule"&&n.push(o.style);return document.createElement("style")},hE=e=>{const{width:t,height:n}=window.getComputedStyle(e);return{width:parseInt(t.replace("px","")),height:parseInt(n.replace("px",""))}},S5=e=>{const t=new XMLSerializer().serializeToString(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`},I5=(e,t,n)=>{const r="http://www.w3.org/2000/svg",a=document.createElementNS(r,"svg");a.setAttribute("width",`${e}`),a.setAttribute("height",`${t}`),a.setAttribute("viewBox",`0 0 ${e} ${t}`);const o=document.createElementNS(r,"foreignObject");return o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),o.appendChild(n),a.appendChild(o),a},T5=async(e,t)=>{const{width:n,height:r}=hE(e),a=await b5(e);t!=null&&t.backgroundColor&&(a.style.backgroundColor=t.backgroundColor);const o=I5(n,r,a);return o.prepend(await D5(e)),S5(o)},E5=async(e,t)=>{const n=await T5(e,t),r=new Image;r.src=n;const a=(t==null?void 0:t.pixelRatio)||1,{width:o,height:s}=hE(e),u=document.createElement("canvas"),d=u.getContext("2d");return d?(u.width=o*a,u.height=s*a,u.style.width=`${o}`,u.style.height=`${s}`,(t!=null&&t.backgroundColor||document.body.className.contains("theme-dark"))&&(d.fillStyle=t.backgroundColor||"#1f1f1f",d.fillRect(0,0,u.width,u.height)),new Promise(m=>{r.onload=()=>{d.drawImage(r,0,0,u.width,u.height),m(u)}})):Promise.reject("Canvas error")},Uv=async(e,t)=>(await E5(e,t)).toDataURL(),x5='<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="1146.31828" height="801.00361" viewBox="0 0 1146.31828 801.00361" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M1050.69918,514.5082a456.24913,456.24913,0,0,1-37.38013-261.87c3.6001-23.1,9.44006-46.85,24.43018-64.79,14.38989-17.23,39.34985-27.37,60.0299-19.29-13.56994-29.61-47.76-46.5-80.59-47.33-34.09-.86-66.92,12.5-97.25,28.1-30.33,15.6-59.65,33.81006-92.21,43.99-53.5,16.72-111.91,10.34-165.5-6.09-53.58-16.44-103.62-42.47-154.62-65.71-51.01-23.24-104.17-44.03-160.01-48.91-55.84-4.87-115.25,7.89-157.24,45.01s-61.87,101.28-38.27,152.11c14.25,30.7,42.22,54.32,52.04,86.7,12.32,40.65-7.08,
`,R.current,t.path,a)}K(),setTimeout(()=>{if(k5(),!N.current)return;let ae;document.body.hasClass("theme-dark")?ae="#727171":ae="#eaeaea",Uv(N.current,{backgroundColor:ae,pixelRatio:window.devicePixelRatio*2}).then(ce=>{A(ce),m(!0)}).catch(()=>{})},bI)},[N,R,u]);const z=()=>{n()},U=O.useCallback(K=>{D(K)},[w]),W=async()=>{U(!0);const{vault:K}=Ee.getState().dailyNotesState.app,ae=N.current.querySelector(".memo-shortcut-img");if(!ae)return;const ce=ae==null?void 0:ae.getAttribute("src").split("base64,")[1],fe=M5(ce,"image/png");let ie;if(s!=null&&s.AutoSaveWhenOnMobile&&x.Platform.isMobile&&fe.arrayBuffer().then(async Te=>{const se="png",we=ws();for(const Z in we)if(we[Z]instanceof x.TFile){ie=we[Z];break}ie!==void 0&&await K.createBinary(await K.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,se,ie),Te)}),!fe){new x.Notice("Copy to clipboard failed");return}const ge=new ClipboardItem({"image/png":fe});window.navigator.clipboard.write([ge]).then(()=>{setTimeout(()=>{U(!1)},500)}),new x.Notice("Copy to clipboard successfully")};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"dialog-header-container",children:[y.jsxs("p",{className:"title-text",children:[y.jsx("span",{className:"icon-text",children:"🥰"}),k("Share Memo Image")]}),y.jsxs("div",{className:"btn-group",children:[y.jsx("button",{ref:S,className:"btn copy-btn",onClick:W}),y.jsx("button",{ref:T,className:"btn close-btn",onClick:z})]})]}),y.jsxs("div",{className:"dialog-content-container",children:[y.jsx("div",{className:`tip-words-container ${E?"finish":"loading"}`,children:y.jsx("p",{className:"tip-text",children:k(E?"↗Click the button to save":"Image is generating...")})}),y.jsxs("div",{className:"memo-container",ref:N,children:[y.jsx(lo,{when:E!=="",children:y.jsx("img",{className:"memo-shortcut-img",onClick:W,src:E})}),y.jsxs("div",{className:"memo-background",children:[y.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat"}}),y.jsx("span",{className:"background-container"}),y.jsx("div",{ref:R,className:"memo-content-text"}),y.jsxs("div",{className:"watermark-container",children:[y.jsxs("span",{className:"normal-text footer-start",children:[y.jsx("div",{className:"property-social-icons"}),y.jsx("span",{className:"name-text",children:L})]}),y.jsx("span",{className:"normal-text footer-end",children:y.jsx("span",{className:"name-text",children:P})})]})]})]})]})]})};function O5(e){xm({className:"share-memo-image-dialog"},A5,{memo:e})}const BD=async e=>{e.startsWith("http")&&(e=await Gg(e));const t=e.split("base64,")[1],n=Av(t,"image/png");await mE(n),new x.Notice(k("Send to clipboard successfully"))},F5=async(e,t)=>{const n=await e.vault.adapter.exists(t);let r="";if(n)r=t;else{const u=e.metadataCache.getFirstLinkpathDest(t,"");if(!u){new x.Notice(k("File not exist"));return}r=u.path}const a=await e.vault.adapter.readBinary(r),o=new Uint8Array(a),s=new Blob([o],{type:"image/png"});await mE(s)},mE=async e=>{const t=new ClipboardItem({"image/png":e});await window.navigator.clipboard.write([t])},YD=1.1,zD=300,UD=20,P5=({destroy:e,imgUrl:t,filepath:n,otherIMGEls:r,currentIndex:a})=>{const o=O.useRef(null),[s,u]=O.useState(-1),d=Ee.getState().dailyNotesState.app,[m,p]=O.useState(a),[g,w]=O.useState(t),D={close:O.useRef(null),previous:O.useRef(null),next:O.useRef(null),decrease:O.useRef(null),increase:O.useRef(null),zoom:O.useRef(null),copy:O.useRef(null)};O.useEffect(()=>{!n&&!t||(x.setIcon(D.close.current,"x"),D.previous.current&&x.setIcon(D.previous.current,"arrow-left"),D.next.current&&x.setIcon(D.next.current,"arrow-right"),x.setIcon(D.decrease.current,"zoom-out"),x.setIcon(D.increase.current,"zoom-in"),x.setIcon(D.zoom.current,"circle"),x.setIcon(D.copy.current,"clipboard"))},[D]),O.useEffect(()=>{Re.getImageSize(g).then(({width:P})=>{u(P!==0?40:0)})},[g]);const S=()=>{let P=m-1;P<0&&(P=r.length-1),p(P),w(r[P].src)},T=()=>{let P=m+1;P>=r.length&&(P=0),p(P),w(r[P].src)},E=()=>{e()},A=()=>{s>30&&u(s-10)},N=()=>{u(s+10)},R=P=>{P.target!==o.current&&P.target===o.current.p
`).trim();if(e&&e.content!==D){const S=await Ie.updateMemo(e.id,D);Ie.editMemo(S)}}},z5=e=>{const{globalState:{editMemoId:t},dailyNotesState:{app:n,view:r,settings:a,verifyState:o},locationState:{pathname:s}}=O.useContext(wt),{memo:u,type:d="inline"}=e,m=O.useRef(null),p=O.useRef(null),[g,w]=O.useState(!1);O.useEffect(()=>{g&&setTimeout(()=>{Qe.setEditMemoId(u.id)},100)},[g]),O.useEffect(()=>{(s==="/review"||s==="/daily")&&t!==u.id&&g&&w(!1)},[t]);const D=()=>{Gd(u)},S=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"){const ie=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");ie&&ie.trigger("click")}Qe.setMarkMemoId(u.id)},T=async()=>{var Te;const ie=!x.Platform.isDesktop&&await((Te=window.Capacitor)==null?void 0:Te.Plugins.Device.getId()),ge=x.Platform.isDesktop?await zn():ie.identifier||ie.uuid;if(!o||(o==null?void 0:o.appId)!==ge){fn();return}u.pinned?await Ie.unpinMemoById(u.id):await Ie.pinMemoById(u.id)},E=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"&&x.Platform.isMobile){const ie=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");ie&&ie.trigger("click")}(s==="/review"||s==="/daily")&&w(!0),s!=="/review"&&s!=="/daily"&&Qe.setEditMemoId(u.id)},A=async ie=>{ie.sourceType==="MULTI"&&ie.id.trim()===""&&await Ie.updateMemoProperty(ie)},N=async ie=>{await Ie.openThinoByID(ie.id)},R=async ie=>{try{const ge=await Ie.archiveMemo(ie);ge&&Ie.editMemo(ge)}catch(ge){console.error(ge),new x.Notice(ge.message)}},F=async(ie,ge)=>{if(!ge&&p.current&&!p.current.confirmStatus){p.current&&p.current.toggleConfirm();return}try{if(a.DeleteThinoDirectly)await Ie.deleteMemoById(u.id);else{const Te=await Ie.hideMemoById(u.id);Te&&Ie.editMemo(Te)}}catch(Te){new x.Notice(Te.message)}Qe.getState().editMemoId===u.id&&Qe.setEditMemoId("")},H=()=>{if(p.current&&!p.current.confirmStatus){p.current&&p.current.toggleConfirm(!1);return}},P=()=>{O5(u)},L=async()=>{const ie=await Ie.updateMemo(u.id,u.content,u.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");ie&&Ie.editMemo(ie)},z=async ie=>{ie.stopPropagation(),navigator.clipboard.writeText(u.content).then(()=>{new x.Notice(k("COPY SUCCEED"))}).catch(()=>{new x.Notice(k("COPY FAILED"))})},U=ie=>{ie&&E()},W=async(ie,ge)=>{ie.preventDefault();const Te=ie.target;if(ie.ctrlKey||ie.metaKey){await N(ge);return}if(Te.tagName==="A"){await R5(n,r,Te);return}if(Te.tagName==="IMG"){H5(m.current,Te);return}if(Te.tagName==="A"&&Te.getAttribute("href")){const se=Te.getAttribute("href");window.open(se,"_blank");return}if(Te.className==="memo-link-text"){B5(Te);return}if(Te.tagName==="INPUT"&&Te.hasClass("task-list-item-checkbox")){await Y5(ge,m.current,Te);return}},K=ie=>{const ge=new x.Menu;ge.dom.toggleClass("memo-context-menu",!0);const Te=window.getSelection();(Te==null?void 0:Te.toString().length)>0&&ge.addItem(se=>{se.setIcon("copy").setTitle(k("COPY")).onClick(()=>{navigator.clipboard.writeText(Te.toString()).then(()=>{new x.Notice(k("COPY SUCCEED"))}).catch(()=>{new x.Notice(k("COPY FAILED"))})})}).addSeparator(),ge.addItem(se=>{se.setIcon("book-open").setTitle(k("READ")).onClick(D)}).addItem(se=>{se.setIcon(u.pinned?"pin-off":"pin").setTitle(u.pinned?k("UNPIN"):k("PIN")).onClick(T)}).addItem(se=>{se.setIcon("bookmark").setTitle(k("MARK")).onClick(S)}).addItem(se=>{se.setIcon("share-2").setTitle(k("SHARE")).onClick(P)}).addItem(se=>{se.setIcon("pencil").setTitle(k("EDIT")).onClick(E)}).addItem(se=>{se.setIcon("home").setTitle(k("SOURCE")).onClick(()=>N(u))}).addSeparator().addItem(se=>{se.setIcon("archive").setTitle(k("ARCHIVE")).onClick(()=>R(u))}).addItem(se=>{se.setIcon("trash").setTitle(k("DELETE")).onClick(async we=>{await F(we,!0)})}),ge.showAtMouseEvent(ie.nativeEvent)},ae=O.useMemo(()=>({memo:u,handlePinMemoClick:T,handleFixMemoClick:A,handleSourceMemoClick:N,handleArchiveMemo:R,handleDeleteMemoClick:F,handleGenMemoImageBtnClick:P,handleMarkMemoClick:S,handleEditMemoClick:E,handleCopyMemoClick:z,ha
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function us(e,t){return yE(e)||q5(e,t)||N1(e,t)||wE()}function kn(){return kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kn.apply(this,arguments)}var J5=function(e,t,n,r,a,o,s,u){if(!e){var d;if(t===void 0)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[n,r,a,o,s,u],p=0;d=new Error(t.replace(/%s/g,function(){return m[p++]})),d.name="Invariant Violation"}throw d.framesToPop=1,d}},K5=J5;const nm=Xn(K5);var Q5=function(){};function X5(e,t){var n={};return Object.keys(e).forEach(function(r){n[qg(r)]=Q5}),n}function GD(e,t){return e[t]!==void 0}function qg(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function eO(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function tO(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,pv(e,t)}function bE(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function DE(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function SE(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}bE.__suppressDeprecationWarning=!0;DE.__suppressDeprecationWarning=!0;SE.__suppressDeprecationWarning=!0;function nO(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if(typeof e.getDerivedStateFromProps!="function"&&typeof t.getSnapshotBeforeUpdate!="function")return e;var n=null,r=null,a=null;if(typeof t.componentWillMount=="function"?n="componentWillMount":typeof t.UNSAFE_componentWillMount=="function"&&(n="UNSAFE_componentWillMount"),typeof t.componentWillReceiveProps=="function"?r="componentWillReceiveProps":typeof t.UNSAFE_componentWillReceiveProps=="function"&&(r="UNSAFE_componentWillReceiveProps"),typeof t.componentWillUpdate=="function"?a="componentWillUpdate":typeof t.UNSAFE_componentWillUpdate=="function"&&(a="UNSAFE_componentWillUpdate"),n!==null||r!==null||a!==null){var o=e.displayName||e.name,s=typeof e.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.
8 months ago
8 months ago
`+o+" uses "+s+" but also contains the following legacy lifecycles:"+(n!==null?`
8 months ago
`+n:"")+(r!==null?`
8 months ago
`+r:"")+(a!==null?`
`+a:"")+`
8 months ago
The above lifecycles should be removed. Learn more about this warning here:
8 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=bE,t.componentWillReceiveProps=DE),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=SE;var u=t.componentDidUpdate;t.componentDidUpdate=function(m,p,g){var w=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:g;u.call(this,m,p,w)}}return e}var rO="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function IE(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=eO(e),o=Object.keys(t),s=o.map(qg);a||!n.length||nm(!1);var u=function(m){tO(p,m);function p(){for(var w,D=arguments.length,S=new Array(D),T=0;T<D;T++)S[T]=arguments[T];w=m.call.apply(m,[this].concat(S))||this,w.handlers=Object.create(null),o.forEach(function(A){var N=t[A],R=function(H){if(w.props[N]){var P;w._notifying=!0;for(var L=arguments.length,z=new Array(L>1?L-1:0),U=1;U<L;U++)z[U-1]=arguments[U];(P=w.props)[N].apply(P,[H].concat(z)),w._notifying=!1}w.unmounted||w.setState(function(W){var K,ae=W.values;return{values:kn(Object.create(null),ae,(K={},K[A]=H,K))}})};w.handlers[N]=R}),n.length&&(w.attachRef=function(A){w.inner=A});var E=Object.create(null);return o.forEach(function(A){E[A]=w.props[qg(A)]}),w.state={values:E,prevProps:{}},w}var g=p.prototype;return g.shouldComponentUpdate=function(){return!this._notifying},p.getDerivedStateFromProps=function(D,S){var T=S.values,E=S.prevProps,A={values:kn(Object.create(null),T),prevProps:{}};return o.forEach(function(N){A.prevProps[N]=D[N],!GD(D,N)&&GD(E,N)&&(A.values[N]=D[qg(N)])}),A},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var D=this,S=this.props,T=S.innerRef,E=Zv(S,["innerRef"]);s.forEach(function(N){delete E[N]});var A={};return o.forEach(function(N){var R=D.props[N];A[N]=R!==void 0?R:D.state.values[N]}),q.createElement(e,kn({},E,A,this.handlers,{ref:T||this.attachRef}))},p}(q.Component);nO(u),u.displayName="Uncontrolled("+r+")",u.propTypes=kn({innerRef:function(){}},X5(t)),n.forEach(function(m){u.prototype[m]=function(){var g;return(g=this.inner)[m].apply(g,arguments)}});var d=u;return q.forwardRef&&(d=q.forwardRef(function(m,p){return q.createElement(u,kn({},m,{innerRef:p,__source:{fileName:rO,lineNumber:128},__self:this}))}),d.propTypes=u.propTypes),d.ControlledComponent=e,d.deferControlTo=function(m,p,g){return p===void 0&&(p={}),IE(m,kn({},t,p),g)},d}function TE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=TE(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Qn(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=TE(e))&&(r&&(r+=" "),r+=t);return r}var EE={exports:{}},P0,qD;function aO(){if(qD)return P0;qD=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return P0=e,P0}var j0,JD;function oO(){if(JD)return j0;JD=1;var e=aO();function t(){}function n(){}return n.resetWarningCache=t,j0=function(){function r(s,u,d,m,p,g){if(g!==e){var w=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw w.name="Invariant Violation",w}}r.isRequired=r;function a(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},j0}EE.exports=oO()();var iO=EE.exports;const Ae=Xn(iO);var gv="milliseconds",rm="seconds",am="minutes",om="hours",Ac="day",jd="week",im="month",Oc="year",Fc="decade",Pc="century",xE={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},sO={month:1,year:12,decade:10*12,century:100*12};function lO(e){return[31,
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jg(e){return gO(e)||FE(e)||N1(e)||vO()}function yO(e,t,n){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(a);++r<a;)o[r]=e[r+t];return o}var PE=yO;function wO(e,t){return e===t||e!==e&&t!==t}var jm=wO,bO=typeof Jn=="object"&&Jn&&Jn.Object===Object&&Jn,jE=bO,DO=jE,SO=typeof self=="object"&&self&&self.Object===Object&&self,IO=DO||SO||Function("return this")(),Oi=IO,TO=Oi,EO=TO.Symbol,Kd=EO,QD=Kd,LE=Object.prototype,xO=LE.hasOwnProperty,CO=LE.toString,Rh=QD?QD.toStringTag:void 0;function MO(e){var t=xO.call(e,Rh),n=e[Rh];try{e[Rh]=void 0;var r=!0}catch{}var a=CO.call(e);return r&&(t?e[Rh]=n:delete e[Rh]),a}var NO=MO,kO=Object.prototype,AO=kO.toString;function OO(e){return AO.call(e)}var FO=OO,XD=Kd,PO=NO,jO=FO,LO="[object Null]",RO="[object Undefined]",eS=XD?XD.toStringTag:void 0;function _O(e){return e==null?e===void 0?RO:LO:eS&&eS in Object(e)?PO(e):jO(e)}var Qd=_O;function HO(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ds=HO,BO=Qd,YO=Ds,zO="[object AsyncFunction]",UO="[object Function]",VO="[object GeneratorFunction]",ZO="[object Proxy]";function WO(e){if(!YO(e))return!1;var t=BO(e);return t==UO||t==VO||t==zO||t==ZO}var O1=WO,$O=9007199254740991;function GO(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$O}var F1=GO,qO=O1,JO=F1;function KO(e){return e!=null&&JO(e.length)&&!qO(e)}var Lm=KO,QO=9007199254740991,XO=/^(?:0|[1-9]\d*)$/;function eF(e,t){var n=typeof e;return t=t??QO,!!t&&(n=="number"||n!="symbol"&&XO.test(e))&&e>-1&&e%1==0&&e<t}var P1=eF,tF=jm,nF=Lm,rF=P1,aF=Ds;function oF(e,t,n){if(!aF(n))return!1;var r=typeof t;return(r=="number"?nF(n)&&rF(t,n.length):r=="string"&&t in n)?tF(n[t],e):!1}var $v=oF,iF=/\s/;function sF(e){for(var t=e.length;t--&&iF.test(e.charAt(t)););return t}var lF=sF,cF=lF,uF=/^\s+/;function dF(e){return e&&e.slice(0,cF(e)+1).replace(uF,"")}var fF=dF;function hF(e){return e!=null&&typeof e=="object"}var xl=hF,mF=Qd,pF=xl,gF="[object Symbol]";function vF(e){return typeof e=="symbol"||pF(e)&&mF(e)==gF}var Rm=vF,yF=fF,tS=Ds,wF=Rm,nS=NaN,bF=/^[-+]0x[0-9a-f]+$/i,DF=/^0b[01]+$/i,SF=/^0o[0-7]+$/i,IF=parseInt;function TF(e){if(typeof e=="number")return e;if(wF(e))return nS;if(tS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=tS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=yF(e);var n=DF.test(e);return n||SF.test(e)?IF(e.slice(2),n?2:8):bF.test(e)?nS:+e}var EF=TF,xF=EF,rS=1/0,CF=17976931348623157e292;function MF(e){if(!e)return e===0?e:0;if(e=xF(e),e===rS||e===-rS){var t=e<0?-1:1;return t*CF}return e===e?e:0}var RE=MF,NF=RE;function kF(e){var t=NF(e),n=t%1;return t===t?n?t-n:t:0}var _E=kF,AF=PE,OF=$v,FF=_E,PF=Math.ceil,jF=Math.max;function LF(e,t,n){(n?OF(e,t,n):t===void 0)?t=1:t=jF(FF(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,s=Array(PF(r/t));a<r;)s[o++]=AF(e,a,a+=t);return s}var RF=LF;const _F=Xn(RF);function _m(e){return e&&e.ownerDocument||document}function HF(e){var t=_m(e);return t&&t.defaultView||window}function BF(e,t){return HF(e).getComputedStyle(e,t)}var YF=/([A-Z])/g;function zF(e){return e.replace(YF,"-$1").toLowerCase()}var UF=/^ms-/;function Ng(e){return zF(e).replace(UF,"-ms-")}var VF=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function ZF(e){return!!(e&&VF.test(e))}function Sd(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Ng(t))||BF(e).getPropertyValue(Ng(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(Ng(a)):ZF(a)?r+=a+"("+o+") ":n+=Ng(a)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function dm(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function WF(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function j1(e){return"window"in e&&e.window===e?e:WF(e)&&e.defaultView||!1}function HE(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,a){var o=j1(r);if(a===void 0)retu
`)[0].slice(0,20),r=q.useRef(null),a=q.useRef(null),o=q.useRef(null);O.useEffect(()=>{if(a.current)return x.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const s=O.useCallback(d=>{o.current&&(o.current.unmount(),o.current=null),o.current=d},[]),u=O.useCallback(d=>{if(!r.current||!x.Keymap.isModifier(d.nativeEvent,"Mod"))return;const m=new x.HoverPopover(rt.getState().view,r.current,100),p=RG(m,t);s(p)},[r.current]);return y.jsxs("span",{className:"rbc-event-renderer","data-source-type":t.sourceType,"data-thino-type":t.thinoType,"data-thino-id":t.id,ref:r,"aria-label":t.path,onMouseOver:u,children:[y.jsx(HG,{event:e}),y.jsx("strong",{children:n})]})}const HG=({event:e})=>{const t=q.useRef(null),n=e.resource;O.useEffect(()=>{t.current&&x.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=O.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const s=await Ie.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");s&&Ie.editMemo(s)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return y.jsx(y.Fragment,{children:y.jsxs("span",{className:"rbc-event-icon-group",children:[y.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),y.jsx("span",{className:mr("rbc-event-time","hidden"),children:y.jsx("span",{className:"rbc-event-time-text",children:x.moment(e.start).format("HH:mm")})})]})})};function Zx({views:e,view:t,messages:n,onView:r}){return e.map(a=>y.jsx("button",{type:"button",className:mr({"rbc-active":t===a}),onClick:()=>r(a),children:n[a]},a))}Zx.propTypes={messages:Ae.object,onView:Ae.func,view:Ae.string,views:Ae.array};function Wx({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:s}){const u={previous:O.useRef(null),today:O.useRef(null),next:O.useRef(null)};O.useEffect(()=>{u&&(x.setIcon(u.previous.current,"chevron-left"),x.setIcon(u.today.current,"dot"),x.setIcon(u.next.current,"chevron-right"))},[u]);const d=O.useMemo(()=>y.jsxs(y.Fragment,{children:[y.jsx("button",{ref:u.previous,type:"button",onClick:()=>r(Td.PREVIOUS),"aria-label":n.previous,children:"<"}),y.jsx("button",{ref:u.today,type:"button",onClick:()=>r(Td.TODAY),"aria-label":n.today,children:"•"}),y.jsx("button",{ref:u.next,type:"button",onClick:()=>r(Td.NEXT),"aria-label":n.next,children:">"})]}),[n]);return y.jsxs("div",{className:"rbc-toolbar",children:[y.jsx("span",{className:mr("rbc-btn-group","thino-view-custom-toolbar"),children:d}),y.jsx("span",{className:"rbc-toolbar-label",children:y.jsx(dv,{type:"text",handleValueChange:m=>{r(Td.DATE,x.moment(m,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(o==="week"?x.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:x.moment(e.valueOf(),"x").valueOf()})}),y.jsx("span",{className:"rbc-btn-group",children:y.jsx(Zx,{view:o,views:s,messages:n,onView:a})})]})}Wx.propTypes={date:Ae.instanceOf(Date),label:Ae.string,localizer:Ae.object,messages:Ae.object,onNavigate:Ae.func,onView:Ae.func,view:Ae.string,views:Ae.array};function BG({event:e,children:t,showPopup:n,callRender:r,...a}){const o=O.useRef(null),s=O.useRef(null),u=O.useCallback(d=>{if(!d.isTrusted){r();return}s.current=d.nativeEvent.target,s.current&&(s.current.hasClass("rbc-event")||(s.current=s.current.closest(".rbc-event")),o.current!==null?(window.clearTimeout(o.current),o.current=null):o.current=window.setTimeout(()=>{n(e,s.current),o.current=null},250))},[e,n]);return y.jsx(y.Fragment,{children:y.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:u,children:t})})}const YG=jG(x.moment),zG=({event:e})=>{const t=e.resource;return y.jsx(y.Fragment,{children:y.jsx(Ua,{memo:t})})},UG=e=>{var ae;const{thinos:t}=e,[n,r]=q.useState([]),[a,o]=q.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[s,u]=q.useState(null),d=q.useRef(null),m=q.useRef(null),[p,g]=q.useState(!1),w=O.useRef(null),[D,S]=O.useState(new Date);O.useEffect(()=>()=>{d.current&&(d.current=null),m
`,o.current,t.path,E);const N=(R=o.current)==null?void 0:R.querySelectorAll(".internal-link");N==null||N.forEach(F=>{const H=F,P=H.getAttribute("data-href");if(!P)return;r.app.metadataCache.getFirstLinkpathDest(P,t.path)||F.classList.add("is-unresolved"),H.addEventListener("mouseover",z=>{z.stopPropagation(),r.app.workspace.trigger("hover-link",{event:z,source:"thino",hoverParent:E.containerEl,targetEl:H,linktext:P,sourcePath:H.href})})})}A()},[t.content,s]);const w=async()=>{if(m)try{await Ie.deleteMemoById(a.id),n(a.id)}catch(E){new x.Notice(E.message)}else p()},D=async()=>{switch(a.sourceType){case"DAILY":await p1(a.id,a.path);break;case"CANVAS":await v1(a.id,a.path);break;case"MULTI":await m1(a.path);break;case"FILE":await g1(a.id,a.path);break}},S=async()=>{try{const E=await Ie.restoreMemoById(a.id),A=r.app,N=A==null?void 0:A.loadLocalStorage("tokenForSync");E&&E.webId&&N&&r.settings.startSync&&await AT(E.webId),E&&Ie.editMemo(E),n(a.id),new x.Notice(k("RESTORE SUCCEED"))}catch(E){new x.Notice(E.message)}},T=()=>{m&&p(!1)};return y.jsxs("div",{ref:s,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:T,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[k("DELETE AT")," ",a.deletedAtStr]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:E=>{E&&x.setIcon(E,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:S,children:k("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:D,children:k("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${m?"final-confirm":""}`,onClick:w,children:k(m?"CONFIRM":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:o,className:"memo-content-text",onContextMenu:E=>{E.preventDefault(),E.stopPropagation()}})]})},LJ=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:u}=t,d=tn.getQueryById(u);return!!(r||a&&a.from<a.to||o||s||d)||d||n?e.filter(p=>{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),d){const w=JSON.parse(d.querystring);Array.isArray(w)&&(g=$d(p,w))}if(r){const w=new Set;for(const D of Array.from(p.content.match(An)||[])){const T=D.replace(An,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match(hr)||[])){const T=D.replace(hr,"$2").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}w.has(r)||(g=!1)}return a&&a.from<a.to&&(Re.getTimeStampByDate(p.createdAt)<a.from||Re.getTimeStampByDate(p.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match(An)!==null||p.content.match(hr)!==null||p.content.match($n)!==null)||o==="LINKED"&&p.content.match(Rc)===null||o==="IMAGED"&&p.content.match(_c)===null||o==="CONNECTED"&&p.content.match(Il)===null)&&(g=!1),s&&!p.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},RJ=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=O.useContext(wt),r=Yc(),[a,o]=O.useState([]),s=q.useRef(null);O.useEffect(()=>{const m=LJ({memos:n.filter(p=>p.deletedAt!==""&&p.deletedAt),query:e,HideDoneTasks:!1});o(m),r.setFinish()},[n,s.current,e]);const u=O.useCallback(m=>{o(p=>p.filter(g=>g.id!==m))},[]),d=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[y.jsxs("div",{classNam
8 months ago
* **开源项目**
* 😋 精美且细节的视觉样式
8 months ago
* 📑 体验优良的交互逻辑`,s=()=>{Qe.setAppSetting({useTinyUndoHistoryCache:!t})},u=()=>{Qe.setAppSetting({shouldSplitMemoWord:!r})},d=()=>{Qe.setAppSetting({shouldHideImageUrl:!n})},m=()=>{Qe.setAppSetting({shouldUseMarkdownParser:!a})},p=async()=>{const g=Ie.getState().memos.map(S=>({...S})),w=JSON.stringify(g),D=document.createElement("a");D.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(w)),D.setAttribute("download","data.json"),D.style.display="none",document.body.appendChild(D),D.click(),document.body.removeChild(D)};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"Memo 显示相关"}),y.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:hw(o)}}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:u,children:[y.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),y.jsx("img",{className:"icon-img",src:r?Rg:_g})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:m,children:[y.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),y.jsx("img",{className:"icon-img",src:a?Rg:_g})]}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:d,children:[y.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),y.jsx("img",{className:"icon-img",src:n?Rg:_g})]})]}),y.jsxs("div",{className:"section-container preferences-section-container",children:[y.jsx("p",{className:"title-text",children:"编辑器"}),y.jsxs("label",{className:"form-label checkbox-form-label",onClick:s,children:[y.jsxs("span",{className:"normal-text",children:["启用"," ",y.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),y.jsx("img",{className:"icon-img",src:t?Rg:_g})]})]}),y.jsxs("div",{className:"section-container hidden",children:[y.jsx("p",{className:"title-text",children:"其他"}),y.jsx("div",{className:"btn-container",children:y.jsx("button",{className:"btn export-btn",onClick:p,children:"导出数据(JSON)"})})]})]})},HJ=()=>{const{globalState:{isMobileView:e}}=O.useContext(wt);O.useEffect(()=>{Ie.fetchAllMemos()},[]);const t=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"preference-wrapper",children:[y.jsx("div",{className:"section-header-container",children:y.jsxs("div",{className:"title-text",children:[y.jsx(lo,{when:e,children:y.jsx("button",{className:"action-btn",onClick:t})}),y.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),y.jsx("div",{className:"sections-wrapper",children:y.jsx(_J,{})})]})},BJ=e=>{const{dailyNotesState:{app:t,settings:n,view:r}}=O.useContext(wt),{memo:a,handleUnarchivedMemoAction:o}=e,s=q.useRef(null),u=q.useRef(null),[d,m]=q.useState(""),p={...a,createdAtStr:Re.getDateTimeString(a.createdAt),deletedAtStr:Re.getDateTimeString(a.deletedAt||a.createdAt)},[g,w]=_o(!1),D={restore:O.useRef(null),delete:O.useRef(null),source:O.useRef(null)};O.useEffect(()=>{u&&(x.setIcon(D.restore.current,"archive-restore"),x.setIcon(D.delete.current,"trash"),x.setIcon(D.source.current,"home"))},[u]),O.useEffect(()=>{if(!s.current||!u.current||s.current.hasChildNodes()&&a.content===d||!r)return;m(a.content),s.current.hasChildNodes()&&s.current.empty();async function N(){var F;await x.MarkdownRenderer.render(t,a.content+`
`,s.current,a.path,r);const R=(F=s.current)==null?void 0:F.querySelectorAll(".internal-link");R==null||R.forEach(H=>{const P=H,L=P.getAttribute("data-href");if(!L)return;t.metadataCache.getFirstLinkpathDest(L,a.path)||H.classList.add("is-unresolved"),P.addEventListener("mouseover",U=>{U.stopPropagation(),t.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:r.containerEl,targetEl:P,linktext:L,sourcePath:P.href})})})}N()},[a.content,u]);const S=async()=>{switch(p.sourceType){case"DAILY":await p1(p.id,p.path);break;case"CANVAS":await v1(p.id,p.path);break;case"MULTI":await m1(p.path);break;case"FILE":await g1(p.id,p.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await Ie.deleteMemoById(p.id);else{const N=await Ie.hideMemoById(p.id);N&&Ie.editMemo(N)}}catch(N){new x.Notice(N.message)}else w()},E=async()=>{try{const N=await Ie.unarchiveMemo(p);N&&Ie.editMemo(N),o(p.id),new x.Notice(k("RESTORE SUCCEED"))}catch(N){new x.Notice(N.message)}},A=()=>{g&&w(!1)};return y.jsxs("div",{ref:u,className:`memo-wrapper ${"memos-"+p.id}`,onMouseLeave:A,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[k("ARCHIVED AT")," ",p.updatedAt]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:N=>{N&&x.setIcon(N,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:D.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:E,children:k("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:D.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:S,children:k("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:D.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:T,children:k(g?"CONFIRM":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:s,className:"memo-content-text"})]})},YJ=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:u}=t,d=tn.getQueryById(u);return!!(r||a&&a.from<a.to||o||s||d)||d||n?e.filter(p=>{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),d){const w=JSON.parse(d.querystring);Array.isArray(w)&&(g=$d(p,w))}if(r){const w=new Set;for(const D of Array.from(p.content.match(An)||[])){const T=D.replace(An,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}for(const D of Array.from(p.content.match(hr)||[])){const T=D.replace(hr,"$2").trim().split("/");let E="";for(const A of T)E+=A,w.add(E),E+="/"}w.has(r)||(g=!1)}return a&&a.from<a.to&&(Re.getTimeStampByDate(p.createdAt)<a.from||Re.getTimeStampByDate(p.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match(An)!==null||p.content.match(hr)!==null||p.content.match($n)!==null)||o==="LINKED"&&p.content.match(Rc)===null||o==="IMAGED"&&p.content.match(_c)===null||o==="CONNECTED"&&p.content.match(Il)===null)&&(g=!1),s&&!p.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},zJ=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=O.useContext(wt),r=Yc(),[a,o]=O.useState([]),s=q.useRef(null);O.useEffect(()=>{const p=YJ({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});o(p),r.setFinish()},[n,s.current,e]);const u=O.useCallback(p=>{o(g=>g.filter(w=>w.id!==p))},[]),d=O.useCallback(p=>{o(g=>g.filter(w=>w.id!==p))},[]),m=O.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[y.jsxs("div",{className:"section-header-container",children:[y.jsx
`,s.current,r.path,n);const w=(D=s.current)==null?void 0:D.querySelectorAll(".internal-link");w==null||w.forEach(S=>{const T=S,E=T.getAttribute("data-href");if(!E)return;t.metadataCache.getFirstLinkpathDest(E,r.path)||S.classList.add("is-unresolved"),T.addEventListener("mouseover",N=>{N.stopPropagation(),t.workspace.trigger("hover-link",{event:N,source:"thino",hoverParent:n.containerEl,targetEl:T,linktext:E,sourcePath:T.href})})})}g()},[e.memo.content]);const u=()=>{e.onClickThino&&e.onClickThino(a)},d=async(g,w,D)=>{var E;const S=((E=D.parentElement.dataset)==null?void 0:E.task)==="x"?"DONE":"TODO",T=[...(w==null?void 0:w.querySelectorAll("li.task-list-item"))||[]];for(const A of T)if(A===D||A===D.closest("li.task-list-item")){const N=T.indexOf(A),R=g.content.split(/\n/),F=[];for(let U=0;U<R.length;U++)(R[U].trim().startsWith("- [ ]")||R[U].trim().startsWith("- [x]"))&&F.push(U);const H=F[N],L=R[H].replace(/- \[ \] |- \[x\] /g,S==="TODO"?"- [x] ":"- [ ] ");R[H]=L;const z=R.join(`
`).trim();if(g&&g.content!==z){const U=await Ie.updateMemo(g.id,z);Ie.editMemo(U)}}},m=async g=>{g.preventDefault();const w=g.target;if(w.tagName==="INPUT"&&w.hasClass("task-list-item-checkbox")){await d(a,o.current,w);return}};return O.useMemo(()=>y.jsxs("div",{ref:o,className:"daily-memo-wrapper",children:[y.jsx("div",{className:"time-wrapper",onClick:u,children:y.jsx("span",{className:"normal-text",children:a.timeStr})}),y.jsx("div",{className:"memo-content-container",children:y.jsx("div",{ref:s,onClick:m,className:"memo-content-text"})})]}),[r.content])},vK=e=>{const{memoState:{memos:t}}=O.useContext(wt),n=Yc(),[r,a]=O.useState([]),[o,s]=O.useState(Re.getDateStampByDate(Re.getDateString(e.currentDateStamp))),[u,d]=_o(!1),m=O.useRef(null),p=new Date(o),{vault:g}=Ee.getState().dailyNotesState.app,w=Ee.getState().dailyNotesState.settings,[D,S]=O.useState("");O.useEffect(()=>{(()=>{const R=t.filter(F=>Re.getTimeStampByDate(F.createdAt)>=o&&Re.getTimeStampByDate(F.createdAt)<o+Ba).filter(F=>F.deletedAt==="").sort((F,H)=>Re.getTimeStampByDate(F.createdAt)-Re.getTimeStampByDate(H.createdAt));a(R),n.setFinish()})()},[o,t]);const T=async()=>{d(!1),setTimeout(()=>{m.current&&Uv(m.current,{backgroundColor:"#ffffff",pixelRatio:window.devicePixelRatio*2}).then(N=>{if(w!=null&&w.AutoSaveWhenOnMobile&&x.Platform.isMobile){const R=N.split("base64,")[1];Av(R,"image/png").arrayBuffer().then(async H=>{let P;const L="png",z=ws();for(const U in z)if(z[U]instanceof x.TFile){P=z[U];break}P!==void 0&&await g.createBinary(await g.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,L,P),H)})}Vv({imgUrl:N})}).catch(()=>{})},0)},E=N=>{s(N),d(!1)},A=O.useMemo(()=>y.jsxs("div",{className:"header-wrapper",children:[y.jsx("span",{className:"title-text",children:k("Daily Memos")}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-left")},className:"btn btn-text",onClick:()=>s(N=>N-Ba)}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"chevron-right")},className:"btn btn-text",onClick:()=>s(N=>N+Ba)}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"share")},className:"btn btn-text share-btn",onClick:T}),y.jsx("span",{ref:N=>{x.setIcon&&N&&x.setIcon(N,"x")},className:"btn btn-text",onClick:()=>e.destroy()})]})]}),[]);return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"dialog-header-container",children:A}),y.jsx("div",{className:"dialog-header-container",children:y.jsx("input",{onChange:N=>S(N.target.value),value:D,placeholder:k("Search")})}),y.jsxs("div",{className:"dialog-content-container",ref:m,children:[y.jsxs("div",{className:"date-card-container",onClick:()=>d(),children:[y.jsx("div",{className:"year-text",children:p.getFullYear()}),y.jsxs("div",{className:"date-container",children:[y.jsx("div",{className:"month-text",children:k("months")[p.getMonth()]}),y.jsx("div",{className:"date-text",children:p.getDate()}),y.jsx("div",{className:"day-text",children:k("weekDays")[p.getDay()]})]})]}),y.jsx(Nm,{className:`date-picker ${u?"":"hidden"}`,datestamp:o,handleDateStampChange:E}),n.isLoading?y.jsx("div",{className:"tip-container",children:y.jsx("span",{className:"tip-text",children:k("Loading...")})}):r.length===0?y.jsx("div",{className:"tip-container",children:y.jsx("span",{className:"tip-text",children:k("Noooop!")})}):y.jsx("div",{className:"dailymemos-wrapper",children:r.filter(N=>N.content.toLowerCase().includes(D.toLowerCase())).map(N=>y.jsx(gK,{memo:N,onClickThino:R=>{e.destroy(),Gd(R)}},`${N.id}-${N.updatedAt}`))})]})]})};function aw(e=Date.now()){xm({className:"daily-memo-diary-dialog"},vK,{currentDateStamp:e})}function uy(e){return e.split("-")[0]}function hC(e){return e.split("-")[1]}function db(e){return["top","bottom"].includes(uy(e))?"x":"y"}function mC(e){return e==="y"?"height":"width"}function R2(e){let{reference:t,floating:n,placement:r}=e;const a=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2;let s;switch(uy(r)){case"top":s={x:a,y:t.y-n.height};break;case"bottom":s={x:a,y:t.y+t.height};break;case"right":s={x:t.x+t.width,y:o};bre
${N}`}}}const T=await Ie.createThino({content:g,isList:d,type:m});T&&(Ie.pushMemo(T),We.clearQuery()),r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:T,link:`obsidian://thino?openId=${T.id}`}))})}else if(a.pathname==="/search"&&n.method==="GET"){const o=a.query,{keyword:s}=o,u=Ie.getThinoViaKeyword(s);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:u});r.end(d)}else r.statusCode=404,r.end()}}catch(a){console.error(a),r.statusCode=500,r.end({status:"error",message:a.message})}});return{listen(n,r){try{t.listen({port:parseInt(r),host:n})}catch(a){console.error(a),new x.Notice(k("Thino - Failed to start HTTP server, please check the port is available."))}new x.Notice(`${k("Thino - Started HTTP server on port")} ${r}`)},close(){t.close(),new x.Notice(k("Thino - Terminated HTTP server"))}}}const{clipboard:gn}=x.Platform.isDesktop?require("electron"):"";class SQ{constructor(){he(this,"eventListeners");this.eventListeners={}}on(t,n){this.eventListeners[t]=this.eventListeners[t]||[],this.eventListeners[t].push(n)}once(t,n){n.$emitOnce=!0,this.on(t,n)}removeListener(t,n){if(this.eventListeners[t]){const r=this.eventListeners[t].findIndex(a=>a===n);r>=0&&this.eventListeners[t].splice(r,1)}}removeAllListeners(t){this.eventListeners[t]&&(this.eventListeners[t].length=0)}emit(t,...n){this.eventListeners[t]&&this.eventListeners[t].forEach(r=>{r.call(this,...n),r.$emitOnce&&this.removeListener(t,r)})}}const Dd=new SQ;let Bh=null,Z2=gn==null?void 0:gn.readText(),W2=gn==null?void 0:gn.readImage();gn&&(gn.on=(e,t)=>(Dd.on(e,t),gn),gn.once=(e,t)=>(Dd.once(e,t),gn),gn.off=(e,t)=>(t?Dd.removeListener(e,t):Dd.removeAllListeners(e),gn),gn.startWatching=()=>(Bh||(Bh=setInterval(()=>{IQ(Z2,Z2=gn==null?void 0:gn.readText())&&Dd.emit("text-changed"),TQ(W2,W2=gn==null?void 0:gn.readImage())&&Dd.emit("image-changed")},500)),gn),gn.stopWatching=()=>(Bh&&clearInterval(Bh),Bh=null,gn));function IQ(e,t){return t&&e!==t}function TQ(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var Q2;const iw=(Q2=require("electron"))==null?void 0:Q2.remote;var X2,eI;const $2=(eI=(X2=require("electron"))==null?void 0:X2.remote)==null?void 0:eI.screen;class EQ{constructor(t,n){he(this,"isRegisted");he(this,"leaf");he(this,"clipboard");he(this,"isScreenTop",!1);he(this,"currentSplitWindow");he(this,"intervalNum");he(this,"allowsCopy",!1);he(this,"plugin");he(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=gn}async onload(){x.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{iw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:k("Global copy"),callback:()=>{this.allowsCopy=!this.allowsCopy,!this.allowsCopy&&this.clipboard.stopWatching(),this.allowsCopy&&this.clipboard.startWatching(),this.leaf&&this.allowsCopy&&(this.actionEl=this.leaf.view.addAction("clipboard-x","Stop global copying",()=>{var t;this.allowsCopy=!1,this.clipboard.stopWatching(),(t=this.actionEl)==null||t.remove()}))}})}onunload(){this.isRegisted&&(iw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally),this.clipboard.off("text-changed"),this.clipboard.off("image-changed"),this.clipboard.stopWatching(),this.leaf&&this.leaf.detach())}getCurrentLeaf(){var n;return this.leaf?this.app.workspace.getLeavesOfType("thino_view").length>0&&!!this.app.workspace.getLeafById(this.leaf.id)?!0:((n=this.leaf)==null||n.detach(),this.currentSplitWindow.close(),this.currentSplitWindow=null,this.leaf=null,this.isScreenTop=!1,!1):!1}async registerAllShortcuts(){iw.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,a,o,s;const t=$2.getCursorScreenPoint(),n
`),!1);Ie.pushMemo(s)})})})))}registerCommands(){zg.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),x.Platform.isDesktop&&this.addCommand({id:"show-thino-editor",name:k("Show thino editor"),checkCallback:n=>{if(Ie.initialized&&rt.initialized)return n||new aC(this.app).open(),!0}}),this.addCommand({id:"lock-thino",name:k("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(yl)&&this.settings.needVerify)return n||Qe.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:k("Copy debug info"),callback:()=>{try{const n={settings:{...this.settings,tokenForVerify:"***"},manifest:this.manifest,obsidianVer:this.app.version,platform:x.Platform.resourcePathPrefix};navigator.clipboard.writeText(JSON.stringify(n,null,2)),new x.Notice(k("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"toggle-minimal-thino",name:k("Toggle minimal mode"),callback:()=>{const n=document.body.hasClass("minimal-thino");document.body.toggleClass("minimal-thino",!n)}}),this.addCommand({id:"focus-on-thino-editor",name:k("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:k("ReSync web thinos to local"),callback:()=>{pJ(this.app)}}),this.addCommand({id:"init-thino-sync",name:k("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new x.Notice(k("Please input token first"));return}if(!this.settings.startSync){new x.Notice(k("Please enable sync first"));return}try{await Ie.initSync()}catch(a){console.error(a),new x.Notice(k("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:k("Show daily thino dialog"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:k("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:k("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){this.initApp(),await this.initServer(),this.initGlobalManifest(),await this.initMemos(),this.autoOpenMemos(),this.registerThinoWidget(),await this.registerToolbarCheck(),await this.initCaptureService(),rt.setPlugin(this);const n=this.app.workspace.editorSuggest.suggests.findIndex(r=>r.type==="customTag");n!==-1?(this.app.workspace.editorSuggest.suggests.splice(n,1),this.app.workspace.editorSuggest.suggests.unshift(new G2(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(new G2(this.app,this))}async initMemos(){try{await this.initDailyNotes()}catch(n){console.error(n)}rt.getState(),Ie.getState(),await Ie.fetchAllMemos()}async initDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&await rt.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!x.requireApiVersion("1.2.0"))return;const n=o=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{const s=o.canvas.getData(),u=s.nodes.find(d=>d.id===o.id);if(u&&(r(u),o.canvas.setData(s),Ie.getMemoById(o.id))){const m=await Ie.updateMemo(o.id,u.text,u.thinoType);Ie.editMemo(m)}o.canvas.requestSave(!0)},0)},800)},r=o=>{o.createdAt||(o.createdAt=x.moment().format("YYYY-MM-DD HH:mm:ss")),o.updatedAt=x.moment().format("YYYY-MM-DD HH:mm:ss"),o.deletedAt=o.deletedAt?o.deletedAt:"",o.pinned=o.pinned?o.pinned:!1,o.visibility=o.visibility?o.visibility:"PUBLIC",o.rowStatus=o.rowStatus?o.rowStatus:"NORMAL",o.thinoType=o.thinoType?o.thinoType:"JOURNAL",o.hasId=o.hasId?o.hasId:"",o.linkId=o.linkId?o.linkId:"",o.resourceList=[]},a=()=>{var w,D;const o=(w=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:w.view;if(!o||!(o==null?void 0:o.canvas))return!1;const u=((D=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:D.view).canvas.nodes.values(),m=Array.from(u).filter(S=>S.text!==void 0);if(!m||m.length===0)return!1;const p=m[0].child;if(!p)return!1;const g=cv(p.constructor.prototype,{save:S=>function(...T){S.call(this,...T),this.node.isEditing&&
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
8 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:m}=await GQ(o,d),p=JSON.parse(new TextDecoder().decode(m));return!p||p.iss!=="pkmer"||p.type!=="thino"||p.appId!==n?!1:(rt.setVerifyState(p),!0)}catch(m){console.error(m)}}return await r(this.settings.tokenForVerify[n])}async checkVersionAndShowChangeLog(){const n=this.manifest.version,r=this.settings.LastUpdatedVersion;n!==r&&(this.settings.LastUpdatedVersion=n,await this.saveSettings(),this.showChangeLog())}showChangeLog(){new pb(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(Hr).length>0||this.settings.MobileAndDesktop==="Mobile"&&x.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&x.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){const n=this.app.workspace.getLeavesOfType(Hr);if(!this.settings.OpenDailyMemosWithMemos){aw();return}if(n.length>0){aw();return}await this.openMemos(),aw()}async openMemos(n="center",r){const a=this.app.workspace;if(a.getLeavesOfType(Hr).length>0){const s=a.getLeavesOfType(Hr)[0];a.setActiveLeaf(s),a.revealLeaf(s);return}a.detachLeavesOfType(Hr);let o;switch(n){case"left":o=a.getLeftLeaf(!1);break;case"right":o=a.getRightLeaf(!1);break;case"float":o=a.getLeaf("window");break;default:o=a.getLeaf(!1);break}if(o&&(await o.setViewState({type:Hr}),a.revealLeaf(o)),this.settings.FocusOnEditor){const s=o.view.containerEl.querySelector("textarea");s&&s.focus()}r==null||r()}searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(Hr);if(!(r.length>0)){this.openMemos();return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".search-bar-inputer .text-input").focus()}async focusOnEditor(){if(!(this.app.workspace.getLeavesOfType(Hr).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(Hr);if(!(r.length>0)){new x.Notice(k("Please Open Memos First"));return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var o,s,u;const n=this.app.workspace;if(n.detachLeavesOfType(Hr),!this.app.plugins.getPlugin("obsidian-hover-editor")){new x.Notice(k("Please install obsidian-hover-editor plugin first"));return}const a=await((o=this.app.plugins.getPlugin("obsidian-hover-editor"))==null?void 0:o.spawnPopover());a&&(await a.setViewState({type:Hr}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(s=this.settings)!=null&&s.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((u=a.view.containerEl.querySelector("textarea"))==null||u.focus()))}}class pb extends x.Modal{constructor(n,r){super(n);he(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;n.createEl("h2",{text:k("Thino update info")+` version ${this.version}`});try{n.createEl("h3",{text:k("Latest version")});const r=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:k("Previous version")});const a=n.createDiv("prev-change-log"),s=await x.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new x.Component;const[u,d]=this.getLatestVersionContent(s.text);await x.MarkdownRenderer.render(this.app,u,r,"",this.component),await x.MarkdownRenderer.render(this.app,d,a,"",this.component)}catch(r){console.error(r),n.createEl("p",{text:k("Failed to load changelog")}),n.createEl("a",{text:k("View online"),attr:{href:"https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md",target:"_blank"}})}}getLatestVersionContent(n){const r=/^# .+/gm,a=[...n.matchAll(r)];if(a.length===0)return[n,""];const o=a[0].index||0;a[0][0].length;let s=n.length;a.length>1&&(s=a[1].index||n.length);const u=n.substring(o,s).trim(),d=n.substring(s).trim();return[u,d]}onClose(){var r;const{contentEl:n}=this;n.empty(),(r=this.component)==null||r.unload()}}exports.ChangeLogModal=pb;exports.default=XQ;