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.

156 lines
1.1 MiB

"use strict";var n4=Object.defineProperty;var r4=(e,t,n)=>t in e?n4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var me=(e,t,n)=>(r4(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("obsidian"),b0=require("@codemirror/language"),ep=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 er(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cI={exports:{}},Nh={},dI={exports:{}},kt={},Hb;function a4(){if(Hb)return kt;Hb=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"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;function v(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,G,te){this.props=Z,this.context=G,this.refs=T,this.updater=te||D}E.prototype.isReactComponent={},E.prototype.setState=function(Z,G){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,G,"setState")},E.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function O(){}O.prototype=E.prototype;function k(Z,G,te){this.props=Z,this.context=G,this.refs=T,this.updater=te||D}var j=k.prototype=new O;j.constructor=k,S(j,E.prototype),j.isPureReactComponent=!0;var F=Array.isArray,B=Object.prototype.hasOwnProperty,R={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function H(Z,G,te){var ge,Ie={},De=null,ke=null;if(G!=null)for(ge in G.ref!==void 0&&(ke=G.ref),G.key!==void 0&&(De=""+G.key),G)B.call(G,ge)&&!z.hasOwnProperty(ge)&&(Ie[ge]=G[ge]);var Ye=arguments.length-2;if(Ye===1)Ie.children=te;else if(1<Ye){for(var Re=Array(Ye),rt=0;rt<Ye;rt++)Re[rt]=arguments[rt+2];Ie.children=Re}if(Z&&Z.defaultProps)for(ge in Ye=Z.defaultProps,Ye)Ie[ge]===void 0&&(Ie[ge]=Ye[ge]);return{$$typeof:e,type:Z,key:De,ref:ke,props:Ie,_owner:R.current}}function Y(Z,G){return{$$typeof:e,type:Z.type,key:G,ref:Z.ref,props:Z.props,_owner:Z._owner}}function U(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function J(Z){var G={"=":"=0",":":"=2"};return"$"+Z.replace(/[=:]/g,function(te){return G[te]})}var Q=/\/+/g;function le(Z,G){return typeof Z=="object"&&Z!==null&&Z.key!=null?J(""+Z.key):G.toString(36)}function pe(Z,G,te,ge,Ie){var De=typeof Z;(De==="undefined"||De==="boolean")&&(Z=null);var ke=!1;if(Z===null)ke=!0;else switch(De){case"string":case"number":ke=!0;break;case"object":switch(Z.$$typeof){case e:case t:ke=!0}}if(ke)return ke=Z,Ie=Ie(ke),Z=ge===""?"."+le(ke,0):ge,F(Ie)?(te="",Z!=null&&(te=Z.replace(Q,"$&/")+"/"),pe(Ie,G,te,"",function(rt){return rt})):Ie!=null&&(U(Ie)&&(Ie=Y(Ie,te+(!Ie.key||ke&&ke.key===Ie.key?"":(""+Ie.key).replace(Q,"$&/")+"/")+Z)),G.push(Ie)),1;if(ke=0,ge=ge===""?".":ge+":",F(Z))for(var Ye=0;Ye<Z.length;Ye++){De=Z[Ye];var Re=ge+le(De,Ye);ke+=pe(De,G,te,Re,Ie)}else if(Re=v(Z),typeof Re=="function")for(Z=Re.call(Z),Ye=0;!(De=Z.next()).done;)De=De.value,Re=ge+le(De,Ye++),ke+=pe(De,G,te,Re,Ie);else if(De==="object")throw G=String(Z),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(Z).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return ke}function ie(Z,G,te){if(Z==null)return Z;var ge=[],Ie=0;return pe(Z,ge,"","",function(De){return G.call(te,De,Ie++)}),ge}function se(Z){if(Z._status===-1){var
`);o.length===0&&await e.vault.adapter.write(Cu(e),JSON.stringify({queries:[]},null,2));const s=[];for(let c=0;c<o.length;c++){const d=c,p="Memos";let m="未命名";const g=o[c];let v=C.moment().format("YYYY/MM/DD HH:mm:ss"),D="[]";const S=g.match(/^\d{14,16}/);S&&(v=C.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&&(m=E[0].slice(1,-3)),s.push({id:d,pinnedAt:"",createdAt:v,updatedAt:v,title:m,querystring:D,userId:p})}await e.vault.adapter.write(Cu(e),JSON.stringify({queries:s},null,2))}},FN=async()=>{const{app:e}=Ee.getState().dailyNotesState;return await kI(e,Cu(e))||await AI(e),await _d(e)||[]},ON=(e,t)=>({createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:N("Temp Filter"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),PN=async(e,t)=>{const n=await _d(Ee.getState().dailyNotesState.app)||[],r={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:C.moment().format("YYYYMMDDHHmmss")+n.length,pinnedAt:"",querystring:t,title:e,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"};return n.push(r),await Ep(Ee.getState().dailyNotesState.app,n),r};var iy={exports:{}};iy.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",c="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",p=500,m="__lodash_placeholder__",g=1,v=2,D=4,S=1,T=2,E=1,O=2,k=4,j=8,F=16,B=32,R=64,z=128,H=256,Y=512,U=30,J="...",Q=800,le=16,pe=1,ie=2,se=3,fe=1/0,oe=9007199254740991,we=17976931348623157e292,Z=NaN,G=4294967295,te=G-1,ge=G>>>1,Ie=[["ary",z],["bind",E],["bindKey",O],["curry",j],["curryRight",F],["flip",Y],["partial",B],["partialRight",R],["rearg",H]],De="[object Arguments]",ke="[object Array]",Ye="[object AsyncFunction]",Re="[object Boolean]",rt="[object Date]",Ht="[object DOMException]",Se="[object Error]",Ze="[object Function]",Ke="[object GeneratorFunction]",Je="[object Map]",lt="[object Number]",ft="[object Null]",Dt="[object Object]",Ct="[object Promise]",un="[object Proxy]",Ft="[object RegExp]",Ot="[object Set]",an="[object String]",wn="[object Symbol]",Tn="[object Undefined]",vr="[object WeakMap]",Ia="[object WeakSet]",tr="[object ArrayBuffer]",Nr="[object DataView]",Is="[object Float32Array]",ho="[object Float64Array]",po="[object Int8Array]",Nl="[object Int16Array]",Pi="[object Int32Array]",ji="[object Uint8Array]",Ts="[object Uint8ClampedArray]",Ho="[object Uint16Array]",Li="[object Uint32Array]",W=/\b__p \+= '';/g,re=/\b(__p \+=) '' \+/g,ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,je=/[&<>"']/g,_e=RegExp(xe.source),ze=RegExp(je.source),gt=/<%-([\s\S]+?)%>/g,Vt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,bn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,na=/^\w*$/,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wr=/[\\^$.*+?()[\]{}|]/g,ra=RegExp(wr.source),kl=/^\s+/,Qt=/\s/,Ta=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ea=/\{\n\/\* \[wrapped with (.+)\] \*/,Ca=/,? & /,Yo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zo=/[()=,{}\[\]\/\s]/,wv=/\\(\\)?/g,Ri=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,of=/\w*$/,Gp=/^[-+]0x[0-9a-f]+$/i,bv=/^0b[01]+$/i,qp=/^\[object .+?Constructor\]$/,Jp=/^0o[0-7]+$/i,Kp=/^(?:0|[1-9]\d*)$/,Qp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zu=/($^)/,Dv=/['\n\r\u2028\u2029\\]/g,on="\\ud800-\\udfff",Sv="\\u0300-\\u036f",sf="\\ufe20-\\ufe2f",Xp="\\u20d0-\\u20ff",Al=Sv+sf+Xp,em="\\u2700-\\u27bf",lf="a-z\\xdf-\\xf6\\xf8-\\xff",Uu="\\xac\\xb1\\xd7\\xf7",Va="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Iv="\\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",tm="A-Z\\xc0-\\xd6\\xd8-\\xde",nm="\\ufe0e\\ufe0f",rm=Uu+Va+Iv+xa,Es="[']",Vu="["+on+"]",Cs="["+rm+"]",Bi="["+Al+"]",am="\\d+",Tv="["+em+"]",Zu="["+lf+"]",uf="[^"+on+rm+am+em+lf+tm
8 months ago
/* [wrapped with `+f+`] */
`)}function $v(u){return Tt(u)||wu(u)||!!(Mm&&u&&u[Mm])}function ca(u,f){var b=typeof u;return f=f??oe,!!f&&(b=="number"||b!="symbol"&&Kp.test(u))&&u>-1&&u%1==0&&u<f}function Ut(u,f,b){if(!Sn(b))return!1;var M=typeof f;return(M=="number"?ha(b)&&ca(f,b.length):M=="string"&&f in b)?xo(b[f],u):!1}function ih(u,f){if(Tt(u))return!1;var b=typeof u;return b=="number"||b=="symbol"||b=="boolean"||u==null||Ra(u)?!0:na.test(u)||!bn.test(u)||f!=null&&u in $t(f)}function et(u){var f=typeof u;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?u!=="__proto__":u===null}function ci(u){var f=du(u),b=_[f];if(typeof b!="function"||!(f in St.prototype))return!1;if(u===b)return!0;var M=cu(b);return!!M&&u===M[0]}function sh(u){return!!ic&&ic in u}var rg=js?os:w0;function fu(u){var f=u&&u.constructor,b=typeof f=="function"&&f.prototype||Wa;return u===b}function rl(u){return u===u&&!Sn(u)}function hu(u,f){return function(b){return b==null?!1:b[u]===f&&(f!==n||u in $t(b))}}function lh(u){var f=ae(u,function(M){return b.size===p&&b.clear(),M}),b=f.cache;return f}function ag(u,f){var b=u[1],M=f[1],P=b|M,V=P<(E|O|z),K=M==z&&b==j||M==z&&b==H&&u[7].length<=f[8]||M==(z|H)&&f[7].length<=f[8]&&b==j;if(!(V||K))return u;M&E&&(u[2]=f[2],P|=b&E?0:k);var ne=f[3];if(ne){var ce=u[3];u[3]=ce?Jf(ce,ne,f[4]):ne,u[4]=ce?aa(u[3],m):f[4]}return ne=f[5],ne&&(ce=u[5],u[5]=ce?Bc(ce,ne,f[6]):ne,u[6]=ce?aa(u[5],m):f[6]),ne=f[7],ne&&(u[7]=ne),M&z&&(u[8]=u[8]==null?f[8]:rr(u[8],f[8])),u[9]==null&&(u[9]=f[9]),u[0]=f[0],u[1]=P,u}function og(u){var f=[];if(u!=null)for(var b in $t(u))f.push(b);return f}function ig(u){return Yl.call(u)}function Wc(u,f,b){return f=Cn(f===n?u.length-1:f,0),function(){for(var M=arguments,P=-1,V=Cn(M.length-f,0),K=ve(V);++P<V;)K[P]=M[f+P];P=-1;for(var ne=ve(f+1);++P<f;)ne[P]=M[P];return ne[f]=b(K),Dr(u,this,ne)}}function $c(u,f){return f.length<2?u:Zr(u,ur(f,0,-1))}function Gn(u,f){for(var b=u.length,M=rr(f.length,b),P=Tr(u);M--;){var V=f[M];u[M]=ca(V,b)?P[V]:n}return u}function Wr(u,f){if(!(f==="constructor"&&typeof u[f]=="function")&&f!="__proto__")return u[f]}var Eo=uh(Ln),al=Nf||function(u,f){return sn.setTimeout(u,f)},Gc=uh(kc);function da(u,f,b){var M=f+"";return Gc(u,Wv(M,lg(ah(M),b)))}function uh(u){var f=0,b=0;return function(){var M=zv(),P=le-(M-b);if(b=M,P>0){if(++f>=Q)return arguments[0]}else f=0;return u.apply(n,arguments)}}function $r(u,f){var b=-1,M=u.length,P=M-1;for(f=f===n?M:f;++b<f;){var V=nu(b,P),K=u[V];u[V]=u[b],u[b]=K}return u.length=f,u}var sg=lh(function(u){var f=[];return u.charCodeAt(0)===46&&f.push(""),u.replace(Pn,function(b,M,P,V){f.push(P?V.replace(wv,"$1"):M||b)}),f});function ja(u){if(typeof u=="string"||Ra(u))return u;var f=u+"";return f=="0"&&1/u==-fe?"-0":f}function di(u){if(u!=null){try{return Hl.call(u)}catch{}try{return u+""}catch{}}return""}function lg(u,f){return nr(Ie,function(b){var M="_."+b[0];f&b[1]&&!ec(u,M)&&u.push(M)}),u.sort()}function ch(u){if(u instanceof St)return u.clone();var f=new ar(u.__wrapped__,u.__chain__);return f.__actions__=Tr(u.__actions__),f.__index__=u.__index__,f.__values__=u.__values__,f}function Gv(u,f,b){(b?Ut(u,f,b):f===n)?f=1:f=Cn(xt(f),0);var M=u==null?0:u.length;if(!M||f<1)return[];for(var P=0,V=0,K=ve(Vi(M/f));P<M;)K[V++]=ur(u,P,P+=f);return K}function qc(u){for(var f=-1,b=u==null?0:u.length,M=0,P=[];++f<b;){var V=u[f];V&&(P[M++]=V)}return P}function dh(){var u=arguments.length;if(!u)return[];for(var f=ve(u-1),b=arguments[0],M=u;M--;)f[M-1]=arguments[M];return Go(Tt(b)?Tr(b):[b],jn(f,1))}var fa=It(function(u,f){return Yn(u)?Qa(u,jn(f,1,Yn,!0)):[]}),Pt=It(function(u,f){var b=Hn(f);return Yn(b)&&(b=n),Yn(u)?Qa(u,jn(f,1,Yn,!0),ut(b,2)):[]}),Un=It(function(u,f){var b=Hn(f);return Yn(b)&&(b=n),Yn(u)?Qa(u,jn(f,1,Yn,!0),n,b):[]});function xn(u,f,b){var M=u==null?0:u.length;return M?(f=b||f===n?1:xt(f),ur(u,f<0?0:f,M)):[]}function qn(u,f,b){var M=u==null?0:u.length;return M?(f=b||f===n?1:xt(f),f=M-f,ur(u,0,f<0?0:f)):[]}function Gr(u,f){return u&&u.length?Js(u,ut(f,3),!0,!0):[]}function ol(u,f){return u&&u.length?Js(u,ut(f,3),!0):[]}function _n(u,f,b,M){var P=u==null?0:u.lengt
`;u.replace(We,function(vt,Nt,jt,Ba,Jr,_a){return jt||(jt=Ba),Pe+=u.slice(Me,_a).replace(Dv,Sm),Nt&&(ne=!0,Pe+=`' +
__e(`+Nt+`) +
'`),Jr&&(ce=!0,Pe+=`';
`+Jr+`;
__p += '`),jt&&(Pe+=`' +
((__t = (`+jt+`)) == null ? '' : __t) +
8 months ago
'`),Me=_a+vt.length,vt}),Pe+=`';
`;var yt=Rt.call(f,"variable")&&f.variable;if(!yt)Pe=`with (obj) {
8 months ago
`+Pe+`
8 months ago
}
`;else if(zo.test(yt))throw new bt(c);Pe=(ce?Pe.replace(W,""):Pe).replace(re,"$1").replace(ye,"$1;"),Pe="function("+(yt||"obj")+`) {
`+(yt?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ne?", __e = _.escape":"")+(ce?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
8 months ago
`)+Pe+`return __p
}`;var Mt=Rb(function(){return Lt(V,it+"return "+Pe).apply(n,K)});if(Mt.source=Pe,u0(Mt))throw Mt;return Mt}function u3(u){return Gt(u).toLowerCase()}function c3(u){return Gt(u).toUpperCase()}function d3(u,f,b){if(u=Gt(u),u&&(b||f===n))return ym(u);if(!u||!(f=pn(f)))return u;var M=zr(u),P=zr(f),V=vm(M,P),K=Ef(M,P)+1;return So(M,V,K).join("")}function f3(u,f,b){if(u=Gt(u),u&&(b||f===n))return u.slice(0,oc(u)+1);if(!u||!(f=pn(f)))return u;var M=zr(u),P=Ef(M,zr(f))+1;return So(M,0,P).join("")}function h3(u,f,b){if(u=Gt(u),u&&(b||f===n))return u.replace(kl,"");if(!u||!(f=pn(f)))return u;var M=zr(u),P=vm(M,zr(f));return So(M,P).join("")}function p3(u,f){var b=U,M=J;if(Sn(f)){var P="separator"in f?f.separator:P;b="length"in f?xt(f.length):b,M="omission"in f?pn(f.omission):M}u=Gt(u);var V=u.length;if(Os(u)){var K=zr(u);V=K.length}if(b>=V)return u;var ne=b-zi(M);if(ne<1)return M;var ce=K?So(K,0,ne).join(""):u.slice(0,ne);if(P===n)return ce+M;if(K&&(ne+=ce.length-ne),c0(P)){if(u.slice(ne).search(P)){var Me,Ne=ce;for(P.global||(P=_l(P.source,Gt(of.exec(P))+"g")),P.lastIndex=0;Me=P.exec(Ne);)var Pe=Me.index;ce=ce.slice(0,Pe===n?ne:Pe)}}else if(u.indexOf(pn(P),ne)!=ne){var We=ce.lastIndexOf(P);We>-1&&(ce=ce.slice(0,We))}return ce+M}function m3(u){return u=Gt(u),u&&_e.test(u)?u.replace(xe,Im):u}var g3=Io(function(u,f,b){return u+(b?" ":"")+f.toUpperCase()}),h0=Qf("toUpperCase");function Lb(u,f,b){return u=Gt(u),f=b?n:f,f===n?jv(u)?_v(u):Fv(u):u.match(f)||[]}var Rb=It(function(u,f){try{return Dr(u,n,f)}catch(b){return u0(b)?b:new bt(b)}}),y3=to(function(u,f){return nr(f,function(b){b=ja(b),Ka(u,b,Oe(u[b],u))}),u});function v3(u){var f=u==null?0:u.length,b=ut();return u=f?Jt(u,function(M){if(typeof M[1]!="function")throw new oa(s);return[b(M[0]),M[1]]}):[],It(function(M){for(var P=-1;++P<f;){var V=u[P];if(Dr(V[0],this,M))return Dr(V[1],this,M)}})}function w3(u){return Rm(Pr(u,g))}function p0(u){return function(){return u}}function b3(u,f){return u==null||u!==u?f:u}var D3=es(),S3=es(!0);function ma(u){return u}function m0(u){return Xl(typeof u=="function"?u:Pr(u,g))}function I3(u){return $s(Pr(u,g))}function T3(u,f){return Oa(u,Pr(f,g))}var E3=It(function(u,f){return function(b){return oi(b,u,f)}}),C3=It(function(u,f){return function(b){return oi(u,b,f)}});function g0(u,f,b){var M=pr(f),P=Ir(f,M);b==null&&!(Sn(f)&&(P.length||!M.length))&&(b=f,f=u,u=this,P=Ir(f,pr(f)));var V=!(Sn(b)&&"chain"in b)||!!b.chain,K=os(u);return nr(P,function(ne){var ce=f[ne];u[ne]=ce,K&&(u.prototype[ne]=function(){var Me=this.__chain__;if(V||Me){var Ne=u(this.__wrapped__),Pe=Ne.__actions__=Tr(this.__actions__);return Pe.push({func:ce,args:arguments,thisArg:u}),Ne.__chain__=Me,Ne}return ce.apply(u,Go([this.value()],arguments))})}),u}function x3(){return sn._===this&&(sn._=Cm),this}function y0(){}function M3(u){return u=xt(u),It(function(f){return li(f,u)})}var N3=Yc(Jt),k3=Yc(yf),A3=Yc(bf);function Bb(u){return ih(u)?Sf(ja(u)):zf(u)}function F3(u){return function(f){return u==null?n:Zr(u,f)}}var O3=Xf(),P3=Xf(!0);function v0(){return[]}function w0(){return!1}function j3(){return{}}function L3(){return""}function R3(){return!0}function B3(u,f){if(u=xt(u),u<1||u>oe)return[];var b=G,M=rr(u,G);f=ut(f),u-=G;for(var P=Tf(M,f);++b<u;)f(b);return P}function _3(u){return Tt(u)?Jt(u,ja):Ra(u)?[u]:Tr(sg(Gt(u)))}function H3(u){var f=++Ls;return Gt(u)+f}var Y3=Hc(function(u,f){return u+f},0),z3=cr("ceil"),U3=Hc(function(u,f){return u/f},1),V3=cr("floor");function Z3(u){return u&&u.length?Ji(u,ma,Aa):n}function W3(u,f){return u&&u.length?Ji(u,ut(f,2),Aa):n}function $3(u){return mm(u,ma)}function G3(u,f){return mm(u,ut(f,2))}function q3(u){return u&&u.length?Ji(u,ma,ii):n}function J3(u,f){return u&&u.length?Ji(u,ut(f,2),ii):n}var K3=Hc(function(u,f){return u*f},1),Q3=cr("round"),X3=Hc(function(u,f){return u-f},0);function e4(u){return u&&u.length?If(u,ma):0}function t4(u,f){return u&&u.length?If(u,ut(f,2)):0}return _.after=q,_.ary=ee,_.assign=cM,_.assignIn=Nb,_.assignInWith=Tg,_.assignWith=dM,_.at=fM,_.before=be,_.bind=Oe,_.bindAll=y3,_.bindKey=Le,_.castArray=jx,_.chain=qr,_
`);let r="",a=[],o=!1,s=1;for(let c=0;c<n.length;c++){const d=n[c];if(d.startsWith("#")&&/^#{1,6}\s/g.test(d)){if(o&&Eg(d)<=Eg(t))break;r=d,r===t?(o=!0,s=c+1):o&&Eg(d)>Eg(t)?a.push(d):(o=!1,a=[])}else o&&a.push(d)}return t?FI.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(`
`),startLine:s}:{content:e,startLine:0}}function jN(e){const t=e.split(/\r?\n/),n=[];for(let r=0;r<t.length;r++)new RegExp(bN).test(t[r])&&n.push({line:t[r],index:r+1});return n}async function LN(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new C.Notice(N("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 RN(e,t){var a;let n;try{n=await t.vault.read(e)}catch(o){console.error(o),n=await t.vault.cachedRead(e)}const r=(a=t.metadataCache.getFileCache(e))==null?void 0:a.frontmatterPosition;return r?n.slice(r.end.offset+1):n}function BN(e){const t=e.split(/\r?\n/),n=[];let r="",a=[],o=0;for(let s=0;s<t.length;s++){const c=t[s];c.startsWith("#")?(r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:s-1}}),r=c,a=[],o=s):a.push(c)}return r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:t.length-1}}),n}function _N(e){const t=e.split(/\r?\n/),n=[];let r=!1,a=[],o="";for(let s=0;s<t.length;s++){const c=t[s];c.startsWith("> [!thino]")?(r&&(n.push({metadata:o,content:a.join(`
`).trim()}),a=[]),r=!0,o=c.replace("> [!thino]","").trim()):r&&c.startsWith(">")?a.push(c.replace(/^> /,"")):r&&!c.startsWith(">")&&(r=!1,n.push({metadata:o,content:a.join(`
8 months ago
`).trim()}),a=[],o="")}return r&&n.push({metadata:o,content:a.join(`
`).trim()}),n}const HN=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 YN(e,t){if(!t)return 0;const{vault:n}=Ee.getState().dailyNotesState.app,r=e==null?void 0:e.DefaultMemoComposition,a=e!=null&&e.ProcessEntriesBelow&&(e==null?void 0:e.ProcessContentTarget)!=="whole"?e==null?void 0:e.ProcessEntriesBelow:"",o=(e==null?void 0:e.ProcessContentTarget)!=="whole"?e!=null&&e.DifferentInsertTarget?e!=null&&e.InsertAfterForTask?e==null?void 0:e.InsertAfterForTask:"":a:"";let s;try{s=await n.read(t)}catch(S){console.error(S),s=await n.cachedRead(t)}let c;r!=""&&/{TIME}/g.test(r)&&/{CONTENT}/g.test(r)?c="(-|\\*) (\\[(.{1})\\]\\s)?"+r.replace(/{TIME}/g,"((\\<time\\>)?\\d{1,2}:\\d{2}(\\:\\d{2})?)?").replace(/ {CONTENT}/g,""):c="(-|\\*) (\\[(.{1})\\]\\s)?((\\<time\\>)?\\d{1,2}\\:\\d{2}(\\:\\d{2})?)?";const d=new RegExp(c,"g"),p=(s.match(d)||[]).length,m=new RegExp(a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),g=new RegExp(o.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),v=(s.match(m)||[]).length,D=(s.match(g)||[]).length;return s=null,v||D?p:0}function $b(e,t,n,r,a){var d,p,m;const o=Wh(a,"day");let s;const c=jN(t);for(const g of c){const v=ZN(e.DefaultMemoComposition,g.line),D=WN(e.DefaultMemoComposition,g.line),S=$N(g.line);let T=zN(g.line);if(o.hours(parseInt(v)),o.minutes(parseInt(D)),S&&o.seconds(parseInt(S)),!S&&o.seconds(0),/^\s*[-*]\s(\[(.)\])\s/g.test(g.line)){const H=GN(g.line);T=UN(e.DefaultMemoComposition,g.line),s=HN(H)}else s="JOURNAL";let E=T.replaceAll(/<br>/g,`
`);const O=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(T),k=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(T),j=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(T),F=(d=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(T))==null?void 0:d[2],B=(p=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(T))==null?void 0:p[2],R=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(T)?"PUBLIC":"PRIVATE",z=(m=new RegExp(/\s\^([0-9a-zA-Z-]+)$/).exec(T))==null?void 0:m[1];E=E.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,""),r.push({id:o.format("YYYYMMDDHHmmss")+`${g.index+n-1}`,content:E,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:s,hasId:z||"",linkId:"",path:a.path,deletedAt:j?C.moment(F,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:k?"ARCHIVED":"NORMAL",visibility:R,pinned:O,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:B})}}function zN(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)$/g,"$4")}function UN(e,t){return VN(e,t)}const VN=(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,"((\\d{1,2})\\:(\\d{2}))?(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*[\\-\\*]\\s(\\[(.{1})\\]\\s?)?((\\d{1,2})\\:(\\d{2}))?(\\:\\d{2})?\\s?(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[7]},ZN=(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[6]},WN=(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]},$N=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]},GN=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)$/.exec(e))==null?void 0:t[2]},OI=()=>a1()?!0:(new C.Notice(N("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function PI(e,t){if(!e)return t;const n=Ee.getState().dailyNotesState.app,r=await RN(e,n);if(!r.trim())return t;let a=C.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,c=o.rowStatus&&o.rowStatus==="ARCHIVED",d=!!o.deletedAt;o.createdAt&&(a=C.moment(o.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?o.createdAt:a);const p=o.deletedAt?o.deletedAt:"",m=o.visibility?o.visibility:"PRIVATE",g=o.thinoType?o.thinoType:"JOURNAL",v=o.webId?o.webId:"";o.id||(o.id=Ue.randomId(16));const D=o.id?o.id:"",S=o.hasId?o.hasId:"",T=o.linkId?o.linkId:"",E=e.path,O="Memo",k="MULTI",j=[];return t.push({id:D,content:r,createdAt:a,updatedAt:a,deletedAt:d?C.moment(p,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:s,rowStatus:c?"ARCHIVED":"NORMAL",visibility:m,thinoType:g,hasId:S,linkId:T,path:E,creatorName:O,sourceType:k,resourceList:j,webId:v}),t})}async function mw(e,t){var D,S,T,E,O,k;if(!e)return t;const{vault:n}=Ee.getState().dailyNotesState.app;let r;try{r=await n.read(e)}catch(j){console.error(j),r=await n.cachedRead(e)}if(!r)return;const a=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),o=C.moment(e.stat.mtime).format("YYYY/MM/DD HH:mm:ss"),s=e.path,c="Thino",d="FILE",p="",m="",g=[],v=await BN(r);for(const j of v){const F=_N(j.content);for(const B of F){const R=B.metadata.match(/\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/
8 months ago
`);){const r=n.indexOf(`
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function nk({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=C.moment(),a=Ue.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",s=`${o}/${r.format("YYYYMMDD")}-${a}.md`,c={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=Xe.getState().app,{vault:p,fileManager:m}=d,g=p.getAbstractFileByPath(o);(!g||!(g instanceof C.TFolder))&&(new C.Notice(N("Folder not found for the given thino path, is creating a new folder")),await p.createFolder(o)),Qe.setChangedByMemos(!0);const v=await p.create(s,e);return await m.processFrontMatter(v,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"}),c}async function rk({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=C.moment(),a=Ue.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"},c=Xe.getState().app,{vault:d}=c;let p=d.getAbstractFileByPath(o);(!p||!(p instanceof C.TFile))&&(new C.Notice(N("File not found for the given thino path, is creating a new file")),p=await d.create(o,""));let m="";try{m=await d.read(p)||await d.cachedRead(p)}catch(O){console.error(O),new C.Notice(N("Failed to read current daily note, check if it exists."))}const g=m.indexOf(`# ${r.format("YYYY-MM-DD")}`);let v=m.indexOf(`
#`,g+1);v===-1&&(v=m.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 O=`# ${r.format("YYYY-MM-DD")}`;E=`${m.substring(0,v)}
${O}${T}
${m.substring(v)}`}else E=`${m.substring(0,v)}${T}${m.substring(v)}`;return setTimeout(async()=>{Qe.setChangedByMemos(!0),await d.modify(p,E)},200),s}async function qb(e){const t=Ee.getState().dailyNotesState.settings,n=C.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=Xe.getState().app,{vault:c}=s;let d=c.getAbstractFileByPath(a);(!d||!(d instanceof C.TFile))&&(new C.Notice(N("File not found for the given thino path, is creating a new file")),d=await c.create(a,""));let p="";try{p=await c.read(d)||await c.cachedRead(d)}catch(E){console.error(E),new C.Notice(N("Failed to read current daily note, check if it exists."))}const m=p.indexOf(`# ${n.format("YYYY-MM-DD")}`);let g=p.indexOf(`
#`,m+1);g===-1&&(g=p.length);const v=`> [!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,`
8 months ago
> `),S=`
${v}
8 months ago
> ${D}
`;let T;if(m===-1){const E=`# ${n.format("YYYY-MM-DD")}`;T=`${p.substring(0,g)}
8 months ago
${E}${S}
${p.substring(g)}`}else T=`${p.substring(0,g)}${S}${p.substring(g)}`;return Qe.setChangedByMemos(!0),await c.modify(d,T),o}async function ak({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=C.moment(),o=Ue.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"},c=Xe.getState().app,{vault:d}=c,p=await LN(r,c);if(!p||!(p instanceof C.TFile)){new C.Notice(N("File not found for the given thino path, is creating a new file"));return}const m=await d.read(p),g=JSON.parse(m);if(g.nodes.find(E=>E.id===s.id))return;let D;g.nodes.length>0&&(D=[...g.nodes].reduce((E,O)=>{if(!E.createdAt)return O;const k=C.moment(E.createdAt,"YYYY/MM/DD HH:mm:ss"),j=C.moment(O.createdAt,"YYYY/MM/DD HH:mm:ss");return k.isAfter(j)?E:O}));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(p,T),s}async function Jb(e,t,n){var F;const{vault:r}=Ee.getState().dailyNotesState.app||app,a=Ee.getState().dailyNotesState.settings,o=e.replace(/\n/g,"<br>"),s=n||C.moment(),{DifferentInsertTarget:c,InsertAfterForTask:d,InsertType:p}=a,m=s.format(a.DefaultTimePrefix||"HH:mm"),g=t?"- ":"- [ ] ",v=a!=null&&a.DefaultMemoComposition?`${g}${(F=a==null?void 0:a.DefaultMemoComposition)==null?void 0:F.replace(/{TIME}/g,m).replace(/{CONTENT}/g,o)}`:`${g}${m} ${o}`,D=bs(),S=Fy(s,D);let T;if(S?T=S:T=await Ue.createDailyNoteCheck(s),!T){new C.Notice(N("Failed to create daily note, check if it exists."));return}S||await Xe.fechLocalDailyNotes();let E="";try{E=await r.read(T)||await r.cachedRead(T)}catch(B){console.error(B),new C.Notice(N("Failed to read current daily note, check if it exists."))}const O=p==="end"?"":t?a.InsertAfter:c&&d||a.InsertAfter,k=await jI(O,v,E);n?await r.modify(T,k.content):setTimeout(async()=>{await r.modify(T,k.content)},200);const j=k.posNum===-1?LI(k.content).length-1:k.posNum+1;return Qe.setChangedByMemos(!0),{id:s.format("YYYYMMDDHHmm")+"00"+j,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:T.path,hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function ok(e){const{vault:t}=Ee.getState().dailyNotesState.app??app,{DefaultMemoComposition:n,InsertAfter:r,DefaultTimePrefix:a,DifferentInsertTarget:o,InsertAfterForTask:s,InsertType:c}=Ee.getState().dailyNotesState.settings;let d=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const R=" [webId::"+e.id+"]";d+=R}const p=C.moment();if(e.deletedAt){const R=" [deleted::"+p.format("YYYYMMDDHHmmss")+"]";d+=R}const m=e.content.replace(/\n/g,"<br>")+d,g=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),v=g.format(a||"HH:mm"),D=e.thinoType?"- [ ] ":"- ",S=n?`${D}${n==null?void 0:n.replace(/{TIME}/g,v).replace(/{CONTENT}/g,m)}`:`${D}${v} ${m}`,T=bs(),E=Fy(g,T);let O;if(E?O=E:O=await Ue.createDailyNoteCheck(g),!O){new C.Notice(N("Failed to create daily note, check if it exists."));return}E||await Xe.fechLocalDailyNotes();let k="";try{k=await t.read(O)||await t.cachedRead(O)}catch(R){console.error(R),new C.Notice(N("Failed to read current daily note, check if it exists."))}const j=c==="end"?"":e.thinoType&&o&&s||r,F=await jI(j,S,k);await t.modify(O,F.content);const B=F.posNum===-1?LI(F.content).length-1:F.posNum+1;retur
8 months ago
${e}`,posNum:-1};const a=t.split(`
`),o=a.slice(0,n+1).join(`
`),s=a.slice(n+1).join(`
`),c=s.trim().length>0;return{content:`${o}${!c&&!r||!o.endsWith(`
8 months ago
`)?`
`:""}${e}${(c||r?`
`:"")+s}`,posNum:n}}const LI=e=>e.split(/\r?\n/);async function ik(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(N("File not found for the given thino path"));return}await t.vault.delete(n)}async function sk(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(N("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 C.Notice(N("Thino not found"));return}const s=a.findIndex((d,p)=>p>o&&d.trim()==="");s===-1?a.splice(o,a.length-o):a.splice(o,s-o);const c=a.join(`
`);if(!c){new C.Notice(N("Thino not found"));return}Qe.setChangedByMemos(!0),await t.vault.modify(n,c)}async function lk(e){const t=Ee.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new C.Notice(N("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(m=>m.id===e.id);if(s===-1){new C.Notice(N("Thino not found"));return}o.splice(s,1);const c=a.edges;c.filter(m=>m.fromNode===e.id||m.toNode===e.id).forEach(m=>{const g=c.findIndex(v=>v.id===m.id);g!==-1&&c.splice(g,1)}),Qe.setChangedByMemos(!0);const p=JSON.stringify(a,null,2);await t.vault.modify(n,p)}async function uk(e){OI()||new C.Notice(N("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=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(n,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(n,"YYYYMMDDHHmmss"),a=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(r,"day"),o=e.path,s=t.getAbstractFileByPath(o);if(!s){new C.Notice(N("Please check your daily note plugin OR periodic notes plugin settings"));return}const c=await t.read(s),d=c.split(`
`),p=a?C.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),m=d.findIndex(S=>S.includes(e.content.replace(/\n/g,"<br>").trim())&&S.includes(p)),g=parseInt(e.id.slice(14));let v=m;m===-1&&(v=g-1);const D=d[m]||d[g-1];if(!c){new C.Notice(N("Thino not found"));return}if(D===d[v]){Qe.setChangedByMemos(!0),d.splice(v,1),await t.modify(s,d.join(`
`));return}}async function ck(){const{vault:e,metadataCache:t}=Ee.getState().dailyNotesState.app,n=Ee.getState().dailyNotesState.settings,a=o1()+"/"+n.DeleteFileName+".md",o=[],s=t.getFirstLinkpathDest("",a);if(s instanceof C.TFile){let c=await e.read(s),d=dk(c);if(d.length===0)return o;for(let p=0;p<d.length;p++){const m=d[p];if(/- /.test(m)){const v=fk(m).slice(0,13),D=C.moment(v,"YYYYMMDDHHmmss"),S=pk(d[p]),T=C.moment(S.slice(0,13),"YYYYMMDDHHmmss"),E=hk(d[p]);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,c=null}return o}const dk=e=>e.split(/\r?\n/),fk=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},hk=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},pk=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function mk(e){const t=await _d(Ee.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await Ep(Ee.getState().dailyNotesState.app,t)}const gk=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await _d(t)||[],r=n.find(a=>a.id===e);if(r){const a=C.moment().format("YYYY/MM/DD HH:mm:ss");return r.pinnedAt=a,await Ep(t,n),a}else{new C.Notice(N("Query not found"));return}},yk=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await _d(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await Ep(t,n);return}else{new C.Notice(N("Query not found"));return}};function vk(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const a=r[1].trim(),o={};a.split(" ").forEach(c=>{const[d,p]=c.slice(1,-1).split("::");o[d]=p});for(const c of Object.keys(t))if(c!=="id"&&c!=="content"){if(c==="rowStatus"&&t.rowStatus==="ARCHIVED"){o.archived="true";continue}else if(c==="rowStatus"&&t.rowStatus==="NORMAL"){delete o.archived;continue}if(c==="deleted"&&t.deleted){const d=C.moment().format("YYYYMMDDHHmmss");o.deleted=d}else typeof t[c]=="boolean"?t[c]?o[c]="true":delete o[c]:t[c]&&(o[c]=t[c])}const s=Object.entries(o).map(([c,d])=>`[${c}::${d}]`).join(" ");return e.replace(n,`%% ${s} %%`)}async function Fo(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=C.moment();if(await r.processFrontMatter(a,s=>{(t.pinned!==void 0||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 c=s;const d=t.content.replace(/\$/g,"$$$$");c=s.replace(e.content,d),await n.modify(a,c)}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!==void 0?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 Di(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=C.moment();let o="";try{o=await n.read(r)}catch(O){console.error(O),o=await n.cachedRead(r)}const s=o.split(/\r?\n/),c=s.findIndex(O=>O.includes(e.id)||e.webId&&O.includes(e.webId)),d=s[c];if(!d)return e;const p=vk(d,t);if(!d)return e;const m=p+`
`,g=s.findIndex((O,k)=>k>c&&O.trim()==="");let v="";g===-1&&(v=s.slice(c+1).join(`
`)),g!==-1&&(v=s.slice(c+1,g).join(`
`));let D=v;t!=null&&t.content&&(D=t.content.split(/\r?\n/).map(F=>"> "+F).join(`
`));const T=(m+D).split(/\r?\n/);s.splice(c,g?g-c:s.length-c,...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!==void 0?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 Si(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(p=>p.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 c=C.moment();t.deleted!==void 0&&(s.deletedAt=t.deleted?c.format("YYYY/MM/DD HH:mm:ss"):""),s.updatedAt=c.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?c.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Ii(e,t){OI()||new C.Notice(N("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,{settings:r}=Ee.getState().dailyNotesState,a=e.id.toString().slice(0,14),o=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(a,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(a,"YYYYMMDDHHmmss"),s=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(o,"day"),c=e.path,d=n.getAbstractFileByPath(c)||n.getAbstractFileByPath(e.path);if(!d)return new C.Notice(N("Please check your daily note plugin OR periodic notes plugin settings")),e;const m=(await n.read(d)).split(`
`),g=s?C.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 v,D,S;try{v=m.findIndex(j=>{const F=j.replace(/^(-|\*|\d\.|-\s\[.?\])\s\d{2}:\d{2}(:\d{2})?/,"").trim(),B=e.content.replace(/\n/g,"<br>").trim(),R=j.includes(g),z=F.includes(B);return R&&(z||F===B)}),S=!1,D=parseInt(e.id.slice(14))}catch(j){console.error(j)}let T=v!==-1&&v===D?v:D;v===-1&&(T=D,m[D-1]&&(S=!0));let E=m[D]||m[v];if(E=E.replace(/\s\^([0-9a-zA-Z-]+)$/g,""),!E)return new C.Notice(N("Thino not found")),e;let O=g;if(r.DefaultTimePrefix!=="HH:mm"&&(O=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(r.DefaultTimePrefix)),t.content)if(S){const j=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",F=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PUBLIC"?' [visibility::"PUBLIC"]':"");E=`${j}${O} ${t.content.trim()} ${F}`}else{const j=/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2}(:\d{2})?)/.exec(E)[1];E=E.replace(/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2}(:\d{2})?)/,"").replace(e.content.trim().replace(/\n/g,"<br>"),t.content.trim().replace(/\n/g,"<br>")).trim(),E=j+" "+E}if(t.thinoType){const j=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";E=E.replace(/^((- \[.\] )|((-|\*) ))/,j)}if(t.rowStatus){const j=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";E=E.includes("[archived::")?E.replace(/\[archived::(true|false)\]/,j):E+" "+j}if(t.visibility){const j='[visibility::"'+t.visibility+'"]';E=E.includes("[visibility::")?E.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,j):E+" "+j}if(t.pinned!==void 0){const j=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";E=E.includes("[pinned::")?E.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":j):E+" "+j}if(t.webId!==void 0){const j="[webId::"+t.webId+"]";E=E.includes("[webId::")?E.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":j):E+" "+j}const k=C.moment();if(t.deleted!==void 0){const j="[deleted::"+k.format("YYYYMMDDHHmmss")+"]";t.deleted?(E=E.replace(/\[deleted::([^\]]+)\]/,""),E=E+" "+j):t.deleted===!1&&(E=E.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId){const j=" ^"+e.hasId;E=E.replace(/\s\^([0-9a-zA-Z-]+)$/g,"")+j}return E!==m[T]?(m.splice(T,1,E),await n.modify(d,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?k.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}const wk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Si(e,{id:e.id,pinned:!0});case"DAILY":return Ii(e,{id:e.id,pinned:!0});case"MULTI":return Fo(e,{id:e.id,pinned:!0});case"FILE":return Di(e,{id:e.id,pinned:!0})}},bk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Si(e,{id:e.id,pinned:!1});case"DAILY":return Ii(e,{id:e.id,pinned:!1});case"MULTI":return Fo(e,{id:e.id,pinned:!1});case"FILE":return Di(e,{id:e.id,pinned:!1})}};var vw;(e=>{async function t(T){return await Gb(T)}e.getMyMemos=t;async function n(T){return await Gb([T])}e.updateSpecificTypeMemo=n;function r(){return ck()}e.getMyDeletedMemos=r;function a(T){const E=Te.getMemoById(T);if(E)switch(E==null?void 0:E.sourceType){case"DAILY":return Ii(E,{id:E.id,deleted:!1});case"CANVAS":return Si(E,{id:E.id,deleted:!1});case"MULTI":return Fo(E,{id:E.id,deleted:!1});case"FILE":return Di(E,{id:E.id,deleted:!1})}}e.restoreMemo=a;function o(T){return sk(T)}e.deleteMemoInSingleFile=o;function s(T){return ik(T)}e.deleteMemoInMultiFiles=s;function c(T){return uk(T)}e.deleteMemoInDailyNote=c;function d(T){return lk(T)}e.deleteMemoInCanvas=d;function p(){return FN()}e.getMyQueries=p;async function m(T,E){return await PN(T,E)}e.createQuery=m;function g(T,E,O){return XN(T,E,O)}e.updateQuery=g;function v(T){return mk(T)}e.deleteQueryById=v;function D(T){return gk(T)}e.pinQuery=D;function S(T){return yk(T)}e.unpinQuery=S})(vw||(vw={}));const ya=vw;var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});class Hu extends Error{}class Dk extends Hu{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Sk extends Hu{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class Ik extends Hu{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Yh extends Hu{}class RI extends Hu{constructor(t){super(`Invalid unit ${t}`)}}class oo extends Hu{}class ul extends Hu{constructor(){super("Zone is an abstract class")}}const $e="numeric",jo="short",Ya="long",sy={year:$e,month:$e,day:$e},BI={year:$e,month:jo,day:$e},Tk={year:$e,month:jo,day:$e,weekday:jo},_I={year:$e,month:Ya,day:$e},HI={year:$e,month:Ya,day:$e,weekday:Ya},YI={hour:$e,minute:$e},zI={hour:$e,minute:$e,second:$e},UI={hour:$e,minute:$e,second:$e,timeZoneName:jo},VI={hour:$e,minute:$e,second:$e,timeZoneName:Ya},ZI={hour:$e,minute:$e,hourCycle:"h23"},WI={hour:$e,minute:$e,second:$e,hourCycle:"h23"},$I={hour:$e,minute:$e,second:$e,hourCycle:"h23",timeZoneName:jo},GI={hour:$e,minute:$e,second:$e,hourCycle:"h23",timeZoneName:Ya},qI={year:$e,month:$e,day:$e,hour:$e,minute:$e},JI={year:$e,month:$e,day:$e,hour:$e,minute:$e,second:$e},KI={year:$e,month:jo,day:$e,hour:$e,minute:$e},QI={year:$e,month:jo,day:$e,hour:$e,minute:$e,second:$e},Ek={year:$e,month:jo,day:$e,weekday:jo,hour:$e,minute:$e},XI={year:$e,month:Ya,day:$e,hour:$e,minute:$e,timeZoneName:jo},eT={year:$e,month:Ya,day:$e,hour:$e,minute:$e,second:$e,timeZoneName:jo},tT={year:$e,month:Ya,day:$e,weekday:Ya,hour:$e,minute:$e,timeZoneName:Ya},nT={year:$e,month:Ya,day:$e,weekday:Ya,hour:$e,minute:$e,second:$e,timeZoneName:Ya};class Cp{get type(){throw new ul}get name(){throw new ul}get ianaName(){return this.name}get isUniversal(){throw new ul}offsetName(t,n){throw new ul}formatOffset(t,n){throw new ul}offset(t){throw new ul}equals(t){throw new ul}get isValid(){throw new ul}}let S0=null;class Py extends Cp{static get instance(){return S0===null&&(S0=new Py),S0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return aT(t,n,r)}formatOffset(t,n){return Gh(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isV
`||W.charAt(ze)==="\r"&&W.charAt(ze+1)!==`
`)&&(je++,_e===0&&(_e=ze+1)),ze--}var gt=xe+je,Vt=re-_e;return ye[re]={line:gt,lineStart:_e},{offset:re,line:gt+1,column:Vt+1}}function Q(W){if(!F(W))throw new Error("not a parser: "+W)}function le(W,re){return typeof W=="string"?W.charAt(re):W[re]}function pe(W){if(typeof W!="number")throw new Error("not a number: "+W)}function ie(W){if(typeof W!="function")throw new Error("not a function: "+W)}function se(W){if(typeof W!="string")throw new Error("not a string: "+W)}var fe=2,oe=3,we=8,Z=5*we,G=4*we,te=" ";function ge(W,re){return new Array(re+1).join(W)}function Ie(W,re,ye){var xe=re-W.length;return xe<=0?W:ge(ye,xe)+W}function De(W,re,ye,xe){return{from:W-re>0?W-re:0,to:W+ye>xe?xe:W+ye}}function ke(W,re){var ye,xe,je,_e,ze,gt=re.index,Vt=gt.offset,On=1;if(Vt===W.length)return"Got the end of the input";if(R(W)){var bn=Vt-Vt%we,na=Vt-bn,Pn=De(bn,Z,G+we,W.length),wr=p(function(Qt){return p(function(Ta){return Ie(Ta.toString(16),2,"0")},Qt)},function(Qt,Ta){var Ea=Qt.length,Ca=[],Yo=0;if(Ea<=Ta)return[Qt.slice()];for(var zo=0;zo<Ea;zo++)Ca[Yo]||Ca.push([]),Ca[Yo].push(Qt[zo]),(zo+1)%Ta==0&&Yo++;return Ca}(W.slice(Pn.from,Pn.to).toJSON().data,we));_e=function(Qt){return Qt.from===0&&Qt.to===1?{from:Qt.from,to:Qt.to}:{from:Qt.from/we,to:Math.floor(Qt.to/we)}}(Pn),xe=bn/we,ye=3*na,na>=4&&(ye+=1),On=2,je=p(function(Qt){return Qt.length<=4?Qt.join(" "):Qt.slice(0,4).join(" ")+" "+Qt.slice(4).join(" ")},wr),(ze=(8*(_e.to>0?_e.to-1:_e.to)).toString(16).length)<2&&(ze=2)}else{var ra=W.split(/\r\n|[\n\r\u2028\u2029]/);ye=gt.column-1,xe=gt.line-1,_e=De(xe,fe,oe,ra.length),je=ra.slice(_e.from,_e.to),ze=_e.to.toString().length}var kl=xe-_e.from;return R(W)&&(ze=(8*(_e.to>0?_e.to-1:_e.to)).toString(16).length)<2&&(ze=2),d(function(Qt,Ta,Ea){var Ca,Yo=Ea===kl,zo=Yo?"> ":te;return Ca=R(W)?Ie((8*(_e.from+Ea)).toString(16),ze,"0"):Ie((_e.from+Ea+1).toString(),ze," "),[].concat(Qt,[zo+Ca+" | "+Ta],Yo?[te+ge(" ",ze)+" | "+Ie("",ye," ")+ge("^",On)]:[])},[],je).join(`
`)}function Ye(W,re){return[`
`,"-- PARSING FAILED "+ge("-",50),`
8 months ago
`,ke(W,re),`
8 months ago
`,(ye=re.expected,ye.length===1?`Expected:
8 months ago
`+ye[0]:`Expected one of the following:
8 months ago
`+ye.join(", ")),`
`].join("");var ye}function Re(W){return W.flags!==void 0?W.flags:[W.global?"g":"",W.ignoreCase?"i":"",W.multiline?"m":"",W.unicode?"u":"",W.sticky?"y":""].join("")}function rt(){for(var W=[].slice.call(arguments),re=W.length,ye=0;ye<re;ye+=1)Q(W[ye]);return o(function(xe,je){for(var _e,ze=new Array(re),gt=0;gt<re;gt+=1){if(!(_e=Y(W[gt]._(xe,je),_e)).status)return _e;ze[gt]=_e.value,je=_e.index}return Y(z(je,ze),_e)})}function Ht(){var W=[].slice.call(arguments);if(W.length===0)throw new Error("seqMap needs at least one argument");var re=W.pop();return ie(re),rt.apply(null,W).map(function(ye){return re.apply(null,ye)})}function Se(){var W=[].slice.call(arguments),re=W.length;if(re===0)return Dt("zero alternates");for(var ye=0;ye<re;ye+=1)Q(W[ye]);return o(function(xe,je){for(var _e,ze=0;ze<W.length;ze+=1)if((_e=Y(W[ze]._(xe,je),_e)).status)return _e;return _e})}function Ze(W,re){return Ke(W,re).or(ft([]))}function Ke(W,re){return Q(W),Q(re),Ht(W,re.then(W).many(),function(ye,xe){return[ye].concat(xe)})}function Je(W){se(W);var re="'"+W+"'";return o(function(ye,xe){var je=xe+W.length,_e=ye.slice(xe,je);return _e===W?z(je,_e):H(xe,re)})}function lt(W,re){(function(je){if(!(je instanceof RegExp))throw new Error("not a regexp: "+je);for(var _e=Re(je),ze=0;ze<_e.length;ze++){var gt=_e.charAt(ze);if(gt!=="i"&&gt!=="m"&&gt!=="u"&&gt!=="s")throw new Error('unsupported regexp flag "'+gt+'": '+je)}})(W),arguments.length>=2?pe(re):re=0;var ye=function(je){return RegExp("^(?:"+je.source+")",Re(je))}(W),xe=""+W;return o(function(je,_e){var ze=ye.exec(je.slice(_e));if(ze){if(0<=re&&re<=ze.length){var gt=ze[0],Vt=ze[re];return z(_e+gt.length,Vt)}return H(_e,"valid match group (0 to "+ze.length+") in "+xe)}return H(_e,xe)})}function ft(W){return o(function(re,ye){return z(ye,W)})}function Dt(W){return o(function(re,ye){return H(ye,W)})}function Ct(W){if(F(W))return o(function(re,ye){var xe=W._(re,ye);return xe.index=ye,xe.value="",xe});if(typeof W=="string")return Ct(Je(W));if(W instanceof RegExp)return Ct(lt(W));throw new Error("not a string, regexp, or parser: "+W)}function un(W){return Q(W),o(function(re,ye){var xe=W._(re,ye),je=re.slice(ye,xe.index);return xe.status?H(ye,'not "'+je+'"'):z(ye,null)})}function Ft(W){return ie(W),o(function(re,ye){var xe=le(re,ye);return ye<re.length&&W(xe)?z(ye+1,xe):H(ye,"a character/byte matching "+W)})}function Ot(W,re){arguments.length<2&&(re=W,W=void 0);var ye=o(function(xe,je){return ye._=re()._,ye._(xe,je)});return W?ye.desc(W):ye}function an(){return Dt("fantasy-land/empty")}s.parse=function(W){if(typeof W!="string"&&!R(W))throw new Error(".parse must be called with a string or Buffer as its argument");var re,ye=this.skip(Ia)._(W,0);return re=ye.status?{status:!0,value:ye.value}:{status:!1,index:J(W,ye.furthest),expected:ye.expected},delete U[W],re},s.tryParse=function(W){var re=this.parse(W);if(re.status)return re.value;var ye=Ye(W,re),xe=new Error(ye);throw xe.type="ParsimmonError",xe.result=re,xe},s.assert=function(W,re){return this.chain(function(ye){return W(ye)?ft(ye):Dt(re)})},s.or=function(W){return Se(this,W)},s.trim=function(W){return this.wrap(W,W)},s.wrap=function(W,re){return Ht(W,this,re,function(ye,xe){return xe})},s.thru=function(W){return W(this)},s.then=function(W){return Q(W),rt(this,W).map(function(re){return re[1]})},s.many=function(){var W=this;return o(function(re,ye){for(var xe=[],je=void 0;;){if(!(je=Y(W._(re,ye),je)).status)return Y(z(ye,xe),je);if(ye===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");ye=je.index,xe.push(je.value)}})},s.tieWith=function(W){return se(W),this.map(function(re){if(function(je){if(!B(je))throw new Error("not an array: "+je)}(re),re.length){se(re[0]);for(var ye=re[0],xe=1;xe<re.length;xe++)se(re[xe]),ye+=W+re[xe];return ye}return""})},s.tie=function(){return this.tieWith("")},s.times=function(W,re){var ye=this;return arguments.length<2&&(re=W),pe(W),pe(re),o(function(xe,je){for(var _e=[],ze=void 0,gt=void 0,Vt=0;Vt<W;Vt+=1){if(gt=Y(ze=
`),Ts=Je(`\r
`),Ho=Se(Ts,ji,Pi).desc("newline"),Li=Se(Ho,Ia);o.all=vr,o.alt=Se,o.any=Tn,o.cr=Pi,o.createLanguage=function(W){var re={};for(var ye in W)({}).hasOwnProperty.call(W,ye)&&function(xe){re[xe]=Ot(function(){return W[xe](re)})}(ye);return re},o.crlf=Ts,o.custom=function(W){return o(W(z,H))},o.digit=tr,o.digits=Nr,o.empty=an,o.end=Li,o.eof=Ia,o.fail=Dt,o.formatError=Ye,o.index=wn,o.isParser=F,o.lazy=Ot,o.letter=Is,o.letters=ho,o.lf=ji,o.lookahead=Ct,o.makeFailure=H,o.makeSuccess=z,o.newline=Ho,o.noneOf=function(W){return Ft(function(re){return W.indexOf(re)<0}).desc("none of '"+W+"'")},o.notFollowedBy=un,o.of=ft,o.oneOf=function(W){for(var re=W.split(""),ye=0;ye<re.length;ye++)re[ye]="'"+re[ye]+"'";return Ft(function(xe){return W.indexOf(xe)>=0}).desc(re)},o.optWhitespace=po,o.Parser=o,o.range=function(W,re){return Ft(function(ye){return W<=ye&&ye<=re}).desc(W+"-"+re)},o.regex=lt,o.regexp=lt,o.sepBy=Ze,o.sepBy1=Ke,o.seq=rt,o.seqMap=Ht,o.seqObj=function(){for(var W,re={},ye=0,xe=(W=arguments,Array.prototype.slice.call(W)),je=xe.length,_e=0;_e<je;_e+=1){var ze=xe[_e];if(!F(ze)){if(B(ze)&&ze.length===2&&typeof ze[0]=="string"&&F(ze[1])){var gt=ze[0];if(Object.prototype.hasOwnProperty.call(re,gt))throw new Error("seqObj: duplicate key "+gt);re[gt]=!0,ye++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(ye===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(Vt,On){for(var bn,na={},Pn=0;Pn<je;Pn+=1){var wr,ra;if(B(xe[Pn])?(wr=xe[Pn][0],ra=xe[Pn][1]):(wr=null,ra=xe[Pn]),!(bn=Y(ra._(Vt,On),bn)).status)return bn;wr&&(na[wr]=bn.value),On=bn.index}return Y(z(On,na),bn)})},o.string=Je,o.succeed=ft,o.takeWhile=function(W){return ie(W),o(function(re,ye){for(var xe=ye;xe<re.length&&W(le(re,xe));)xe++;return z(xe,re.slice(ye,xe))})},o.test=Ft,o.whitespace=Nl,o["fantasy-land/empty"]=an,o["fantasy-land/of"]=ft,o.Binary={bitSeq:D,bitSeqObj:function(W){v();var re={},ye=0,xe=p(function(_e){if(B(_e)){var ze=_e;if(ze.length!==2)throw new Error("["+ze.join(", ")+"] should be length 2, got length "+ze.length);if(se(ze[0]),pe(ze[1]),Object.prototype.hasOwnProperty.call(re,ze[0]))throw new Error("duplicate key in bitSeqObj: "+ze[0]);return re[ze[0]]=!0,ye++,ze}return pe(_e),[null,_e]},W);if(ye<1)throw new Error("bitSeqObj expects at least one named pair, got ["+W.join(", ")+"]");var je=p(function(_e){return _e[0]},xe);return D(p(function(_e){return _e[1]},xe)).map(function(_e){return d(function(ze,gt){return gt[0]!==null&&(ze[gt[0]]=gt[1]),ze},{},p(function(ze,gt){return[ze,_e[gt]]},je))})},byte:function(W){if(v(),pe(W),W>255)throw new Error("Value specified to byte constructor ("+W+"=0x"+W.toString(16)+") is larger in value than a single byte.");var re=(W>15?"0x":"0x0")+W.toString(16);return o(function(ye,xe){var je=le(ye,xe);return je===W?z(xe+1,je):H(xe,re)})},buffer:function(W){return S("buffer",W).map(function(re){return Buffer.from(re)})},encodedString:function(W,re){return S("string",re).map(function(ye){return ye.toString(W)})},uintBE:E,uint8BE:E(1),uint16BE:E(2),uint32BE:E(4),uintLE:O,uint8LE:O(1),uint16LE:O(2),uint32LE:O(4),intBE:k,int8BE:k(1),int16BE:k(2),int32BE:k(4),intLE:j,int8LE:j(1),int16LE:j(2),int32LE:j(4),floatBE:S("floatBE",4).map(function(W){return W.readFloatBE(0)}),floatLE:S("floatLE",4).map(function(W){return W.readFloatLE(0)}),doubleBE:S("doubleBE",8).map(function(W){return W.readDoubleBE(0)}),doubleLE:S("doubleLE",8).map(function(W){return W.readDoubleLE(0)})},n.exports=o}])})})(X);var g1=()=>/(?:[#*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}
${o}`,posNum:n}}function _6(e,t,n){var a;const r=t.workspace.getLeavesOfType("markdown");for(const o of r){const s=o.view;if(((a=s==null?void 0:s.file)==null?void 0:a.path)===e){t.workspace.revealLeaf(o);try{return o.view.setEphemeralState({line:n}),!0}catch(c){return console.error(c),!1}}}return!1}const v1=async e=>{var o;const t=Xe.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const s of n){const c=s.view;if(((o=c==null?void 0:c.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(s);return}}const r=t.metadataCache.getFirstLinkpathDest("",e);if(!r){new C.Notice(N("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},w1=async(e,t)=>{const{app:n}=Xe.getState(),r=parseInt(e.slice(14));if(_6(t,n,r))return;const a=n.metadataCache.getFirstLinkpathDest("",t);if(!C.Platform.isMobile)await n.workspace.getLeaf(!0).openFile(a,{eState:{line:r}});else{let o=n.workspace.activeLeaf;o===null&&(o=n.workspace.getLeaf(!0)),await o.openFile(a,{eState:{line:r}})}},b1=async(e,t)=>{var p,m,g;const n=Xe.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(N("File not found for the given thino path"));return}let a="";try{a=await n.vault.read(r)}catch(v){console.error(v),a=await n.vault.cachedRead(r)}const s=a.split(/\r?\n/).findIndex(v=>v.contains(e)),c=n.workspace.getLeavesOfType("markdown");for(const v of c){const D=v.view;if(((p=D==null?void 0:D.file)==null?void 0:p.path)===r.path){n.workspace.revealLeaf(v);try{(m=v.view.editor)==null||m.setCursor({line:s,ch:1});return}catch(S){console.error(S)}}}const d=n.workspace.getLeaf(!0);await d.openFile(r,{eState:{line:s}});try{(g=d.view.editor)==null||g.setCursor({line:s,ch:1})}catch(v){console.error(v)}},D1=async(e,t)=>{var c;const n=Xe.getState().app,r=(d,p)=>{var g;const m=(g=Array.from(d.nodes.values()))==null?void 0:g.find(v=>v.id===p);return m?(d.selectOnly(m),d.zoomToSelection(),!0):!1},a=n.workspace.getLeavesOfType("canvas");for(const d of a){const p=d.view;if(((c=p==null?void 0:p.file)==null?void 0:c.path)===t&&(n.workspace.revealLeaf(d),r(p.canvas,e)))return}const o=n.metadataCache.getFirstLinkpathDest("",t);if(!o){new C.Notice(N("File not found for the given thino path"));return}const s=n.workspace.getLeaf(!0);await s.openFile(o),setTimeout(()=>{var d;r((d=s.view)==null?void 0:d.canvas,e)},10)},H6="https://api.thino.pkmer.cn/test",Vd=H6,Y6="unknown",z6=/!\[(?<content>[^\]]+)\]\((?<link>[^)]+)\)/g;function U6(e){return e.substring(e.lastIndexOf(".")+1)}function V6(e){return{id:e.id,createdAt:Date.now().toString(),filename:e.id,type:`${U6(e.id)}`,size:e.size.toString()}}function Z6(e){const t=e==null?void 0:e.matchAll(z6);return t?Array.from(t).map(n=>{var r;return V6({url:(r=n.groups)==null?void 0:r.link,id:Y6,size:0,mtime:""})}).filter(n=>n.type!="html"):[]}function kp(e){var t;return{id:e.id,createdAt:C.moment(e.ctime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment(e.mtime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),deletedAt:(t=e.ttime)!=null&&t.toString()?C.moment(e.ttime.toString(),"x").format("YYYY-MM-DD HH:mm:ss"):"",rowStatus:e.rowStatus,content:e.content,pinned:e.pinned,resourceList:Z6(e.content),creatorName:"thino",sourceType:(e==null?void 0:e.thinoType)||"FILE",visibility:"PUBLIC",localId:e.originalId,deleted:!!e.dtime}}async function W6(e){const n={url:`${Vd}/thino/getThinos${e?`?since=${e}&includeDeleted=true`:""}`,method:"GET",headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to fetch memos: ${r.status}`);try{return r.json.payload.map(o=>kp(o))}catch(a){console.error(`Error processing memo response: ${a}`)}}).catch(r=>(console.error(r),[]))}function Zd(){const e=Ee.getState().dailyNotesState.app||app;return(e==null?void 0:e.loadLocalStorage("tokenForSync"))||""}async function RT(e){const t=`${Vd}/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:{Auth
`+G+i}var ge=!1;function Ie(i,l){if(!i||ge)return"";ge=!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(be){var y=be}Reflect.construct(i,[],l)}else{try{l.call()}catch(be){y=be}i.call(l.prototype)}else{try{throw Error()}catch(be){y=be}i()}}catch(be){if(be&&y&&typeof be.stack=="string"){for(var I=be.stack.split(`
`),x=y.stack.split(`
`),L=I.length-1,q=x.length-1;1<=L&&0<=q&&I[L]!==x[q];)q--;for(;1<=L&&0<=q;L--,q--)if(I[L]!==x[q]){if(L!==1||q!==1)do if(L--,q--,0>q||I[L]!==x[q]){var ee=`
`+I[L].replace(" at new "," at ");return i.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",i.displayName)),ee}while(1<=L&&0<=q);break}}}finally{ge=!1,Error.prepareStackTrace=h}return(i=i?i.displayName||i.name:"")?te(i):""}function De(i){switch(i.tag){case 5:return te(i.type);case 16:return te("Lazy");case 13:return te("Suspense");case 19:return te("SuspenseList");case 0:case 2:case 15:return i=Ie(i.type,!1),i;case 11:return i=Ie(i.type.render,!1),i;case 1:return i=Ie(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 z:return"Fragment";case R:return"Portal";case Y:return"Profiler";case H:return"StrictMode";case le:return"Suspense";case pe:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case J:return(i.displayName||"Context")+".Consumer";case U:return(i._context.displayName||"Context")+".Provider";case Q: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 se:l=i._payload,i=i._init;try{return ke(i(l))}catch{}}return null}function Ye(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===H?"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 Re(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function rt(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Ht(i){var l=rt(i)?"checked":"value",h=Object.getOwnPropertyDescriptor(i.constructor.prototype,l),y=""+i[l];if(!i.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var I=h.get,x=h.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return I.call(this)},set:function(L){y=""+L,x.call(this,L)}}),Object.defineProperty(i,l,{enumerable:h.enumerable}),{getValue:function(){return y},setValue:function(L){y=""+L},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Se(i){i._valueTracker||(i._valueTracker=Ht(i))}function Ze(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var h=l.getValue(),y="";return i&&(y=rt(i)?i.checked?"true":"false":i.value),i=y,i!==h?(l.setValue(i),!0):!1}function Ke(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 Je(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,y=l.checked!=null?l.checked:l.defaultChecked;h=Re(l.value!=null?l.value:h),i._wrapperState={initialChecked:y,initialValue:h,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function ft(i,l){l=l.checked,l!=null&&j(i,"checked",l,!1)}function Dt(i,l){ft(i,l);var h=Re(l.value),y=l.type;if(h!=null)y==="number"?(h===0&&i.value===""||i.value!=h)&&(i.value=""+h):i.value!==""+h&&(i.value=""+h);else if(y==="submit"||y==="reset"){i.removeAttribute("value");return}l.hasOwnProperty("value")?un(i,l.type,h):l.hasOwnProperty("defaultValue")&&un(i,l.type,Re(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(i.defaultChecked=!!l.defaultChecked)}function Ct(i,l,h){if(l.hasOwnProperty("value")||
`).replace(zv,"")}function Zl(i,l,h){if(l=km(l),km(i)!==l&&h)throw Error(n(425))}function hc(){}var Wl=null,Zi=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 Ko=typeof setTimeout=="function"?setTimeout:void 0,Gl=typeof clearTimeout=="function"?clearTimeout:void 0,_s=typeof Promise=="function"?Promise:void 0,pc=typeof queueMicrotask=="function"?queueMicrotask:typeof _s<"u"?function(i){return _s.resolve(null).then(i).catch(Hs)}:Ko;function Hs(i){setTimeout(function(){throw i})}function Af(i,l){var h=l,y=0;do{var I=h.nextSibling;if(i.removeChild(h),I&&I.nodeType===8)if(h=I.data,h==="/$"){if(y===0){i.removeChild(I),zt(l);return}y--}else h!=="$"&&h!=="$?"&&h!=="$!"||y++;h=I}while(h);zt(l)}function Qo(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 Am(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 Ys=Math.random().toString(36).slice(2),$a="__reactFiber$"+Ys,Xo="__reactProps$"+Ys,Ur="__reactContainer$"+Ys,mc="__reactEvents$"+Ys,_="__reactListeners$"+Ys,zs="__reactHandles$"+Ys;function Ga(i){var l=i[$a];if(l)return l;for(var h=i.parentNode;h;){if(l=h[Ur]||h[$a]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(i=Am(i);i!==null;){if(h=i[$a])return h;i=Am(i)}return l}i=h,h=i.parentNode}return null}function ar(i){return i=i[$a]||i[Ur],!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 gc(i){return i[Xo]||null}var Ff=[],Us=-1;function Ar(i){return{current:i}}function en(i){0>Us||(i.current=Ff[Us],Ff[Us]=null,Us--)}function Kt(i,l){Us++,Ff[Us]=i.current,i.current=l}var ei={},or=Ar(ei),Fr=Ar(!1),Sr=ei;function Vs(i,l){var h=i.type.contextTypes;if(!h)return ei;var y=i.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===l)return y.__reactInternalMemoizedMaskedChildContext;var I={},x;for(x in h)I[x]=l[x];return y&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=l,i.__reactInternalMemoizedMaskedChildContext=I),I}function Or(i){return i=i.childContextTypes,i!=null}function yc(){en(Fr),en(or)}function Fm(i,l,h){if(or.current!==ei)throw Error(n(168));Kt(or,l),Kt(Fr,h)}function Om(i,l,h){var y=i.stateNode;if(l=l.childContextTypes,typeof y.getChildContext!="function")return h;y=y.getChildContext();for(var I in y)if(!(I in l))throw Error(n(108,Ye(i)||"Unknown",I));return Z({},h,y)}function ia(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ei,Sr=or.current,Kt(or,i),Kt(Fr,Fr.current),!0}function Pm(i,l,h){var y=i.stateNode;if(!y)throw Error(n(169));h?(i=Om(i,l,Sr),y.__reactInternalMemoizedMergedChildContext=i,en(Fr),en(or),Kt(or,i)):en(Fr),Kt(Fr,h)}var wo=null,vc=!1,Of=!1;function jm(i){wo===null?wo=[i]:wo.push(i)}function Wi(i){vc=!0,jm(i)}function ti(){if(!Of&&wo!==null){Of=!0;var i=0,l=Yt;try{var h=wo;for(Yt=1;i<h.length;i++){var y=h[i];do y=y(!0);while(y!==null)}wo=null,vc=!1}catch(I){throw wo!==null&&(wo=wo.slice(i+1)),Kp(sf,ti),I}finally{Yt=l,Of=!1}}return null}var Zs=[],ir=0,wc=null,bc=0,sa=[],la=0,$i=null,qa=1,Ja="";function Gi(i,l){Zs[ir++]=bc,Zs[ir++]=wc,wc=i,bc=l}function Lm(i,l,h){sa[la++]=qa,sa[la++]=Ja,sa[la++]=$i,$i=i;var y=qa;i=Ja;var I=32-xa(y)-1;y&=~(1<<I),h+=1;var x=32-xa(l)+I;if(30<x){var L=I-I%5;x=(y&(1<<L)-1).toString(32),y>>=L,I-=L,qa=1<<32-xa(l)+I|h<<I|y,Ja=x+i}else qa=1<<x|h<<I|y,Ja=i}function ql(i){i.return!==null&&(Gi(i,1),Lm(i,1,0))}function qi(i){for(;i===wc;)wc=Zs[--ir],Zs[ir]=null,bc=Zs[--ir],Zs[ir]=null;for(;i===$i;)$i=sa[--la],sa[la]=null,Ja=sa[--la],sa[la]=null,qa=sa[--la],sa[la]=null}var sr=null,Vr=null,tn=!1,Na=null;function Ka(i,l){var h=qr(5,null,null,0);h.elementType="DELETED",h.stateNode=l,h.return=i,l=i.deletions
Error generating stack: `+x.message+`
`+x.stack}return{value:i,source:l,stack:I,digest:null}}function el(i,l,h){return{value:i,source:null,stack:h??null,digest:l??null}}function _c(i,l){try{console.error(l.value)}catch(h){setTimeout(function(){throw h})}}var Hc=typeof WeakMap=="function"?WeakMap:Map;function Yc(i,l,h){h=Fa(-1,h),h.tag=3,h.payload={element:null};var y=l.value;return h.callback=function(){Kc||(Kc=!0,hh=y),_c(i,l)},h}function su(i,l,h){h=Fa(-1,h),h.tag=3;var y=i.type.getDerivedStateFromError;if(typeof y=="function"){var I=l.value;h.payload=function(){return y(I)},h.callback=function(){_c(i,l)}}var x=i.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(h.callback=function(){_c(i,l),typeof y!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var L=l.stack;this.componentDidCatch(l.value,{componentStack:L!==null?L:""})}),h}function Jm(i,l,h){var y=i.pingCache;if(y===null){y=i.pingCache=new Hc;var I=new Set;y.set(l,I)}else I=y.get(l),I===void 0&&(I=new Set,y.set(l,I));I.has(h)||(I.add(h),i=Xv.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 lu(i,l,h,y,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=Fa(-1,1),l.tag=2,ai(h,l,1))),h.lanes|=1),i)}var Km=F.ReactCurrentOwner,cr=!1;function Er(i,l,h,y){l.child=i===null?Hf(l,null,h,y):ii(l,i.child,h,y)}function eh(i,l,h,y,I){h=h.render;var x=l.ref;return ni(l,I),y=Ac(i,l,h,y,x,I),h=Fc(),i!==null&&!cr?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~I,no(i,l,I)):(tn&&h&&ql(l),l.flags|=1,Er(i,l,y,I),l.child)}function eo(i,l,h,y,I){if(i===null){var x=h.type;return typeof x=="function"&&!Dh(x)&&x.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(l.tag=15,l.type=x,th(i,l,x,y,I)):(i=rd(h.type,null,y,l,l.mode,I),i.ref=l.ref,i.return=l,l.child=i)}if(x=i.child,!(i.lanes&I)){var L=x.memoizedProps;if(h=h.compare,h=h!==null?h:Ge,h(L,y)&&i.ref===l.ref)return no(i,l,I)}return l.flags|=1,i=yi(x,y),i.ref=l.ref,i.return=l,l.child=i}function th(i,l,h,y,I){if(i!==null){var x=i.memoizedProps;if(Ge(x,y)&&i.ref===l.ref)if(cr=!1,l.pendingProps=y=x,(i.lanes&I)!==0)i.flags&131072&&(cr=!0);else return l.lanes=i.lanes,no(i,l,I)}return zc(i,l,h,y,I)}function nh(i,l,h){var y=l.pendingProps,I=y.children,x=i!==null?i.memoizedState:null;if(y.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Kt(ol,Gr),Gr|=h;else{if(!(h&1073741824))return i=x!==null?x.baseLanes|h:h,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:i,cachePool:null,transitions:null},l.updateQueue=null,Kt(ol,Gr),Gr|=i,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=x!==null?x.baseLanes:h,Kt(ol,Gr),Gr|=y}else x!==null?(y=x.baseLanes|h,l.memoizedState=null):y=h,Kt(ol,Gr),Gr|=y;return Er(i,l,I,h),l.child}function Qm(i,l){var h=l.ref;(i===null&&h!==null||i!==null&&i.ref!==h)&&(l.flags|=512,l.flags|=2097152)}function zc(i,l,h,y,I){var x=Or(h)?Sr:or.current;return x=Vs(l,x),ni(l,I),h=Ac(i,l,h,y,x,I),y=Fc(),i!==null&&!cr?(l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~I,no(i,l,I)):(tn&&y&&ql(l),l.flags|=1,Er(i,l,h,I),l.child)}function Xm(i,l,h,y,I){if(Or(h)){var x=!0;ia(l)}else x=!1;if(ni(l,I),l.stateNode===null)tl(i,l),Bf(l,h,y),_f(l,h,y,I),y=!0;else if(i===null){var L=l.stateNode,q=l.memoizedProps;L.props=q;var ee=L.context,be=h.contextType;typeof be=="object"&&be!==null?be=Ir(be):(be=Or(h)?Sr:or.current,be=Vs(l,be));var Oe=h.getDerivedStateFromProps,Le=typeof Oe=="function"||typeof L.getSnapshotBeforeUpdate=="function";Le||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(q!==y||ee!==be)&&Ym(l,L,y,be),ri=!1;var Fe=l.memoizedState;L.state=Fe,Ec(l,y,L,I),ee=l.memoizedState,q!==y||Fe!==ee||Fr.current||ri?(typeof Oe=="function"&&(Rf(l,h,Oe,y),ee=l.memoizedState),(q=ri||xc(l,h,q,y,Fe,ee,be))?(Le||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.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 vn(e=!1){return new Promise((t,n)=>{h8(g8[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=w8(a.toString());return t(e?o:v8(o))})})}const AD={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},b8=e=>{const{dailyNotesState:{app:t,view:n,verifyState:r,settings:a},globalState:{manifest:o,isMobileView:s}}=A.useContext(mt),c=A.useRef(null),d=A.useRef(null),[p,m]=A.useState((window.app||t).loadLocalStorage("thinoListView")),[g,v]=A.useState(null);A.useEffect(()=>{if(!o||!t)return;const S=t==null?void 0:t.plugins.getPlugin(o.id);v(S),m(S==null?void 0:S.settings.MemoListView),Qe.setMemoListView(S==null?void 0:S.settings.MemoListView)},[o,t]),A.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?(m(T),Qe.setMemoListView(T)):n.leaf.width<=950&&(Qe.setMemoListView("list"),m("list")))};S(),d.current||(d.current=t.workspace.on("resize",S),n.registerEvent(d.current))},[t,n,g]),A.useEffect(()=>{c&&(C.setIcon(c.current,AD[p||"list"]),Qe.setMemoListView(p),C.requireApiVersion("1.4.4")&&C.setTooltip(c.current,N("Switch view")))},[p]);const D=async S=>{var F;const T=!C.Platform.isDesktop&&await((F=window.Capacitor)==null?void 0:F.Plugins.Device.getId()),E=C.Platform.isDesktop?await vn():T.identifier||T.uuid;if(!r||(r==null?void 0:r.appId)!==E){qt();return}const O=async B=>{Qe.setMemoListView(B),g&&(g.settings.MemoListView=B,await g.saveSettings()),m(B)},k=[{view:"list",title:N("List")},{view:"chat",title:N("Chat")},{view:"moments",title:N("Moments")}];s||k.push({view:"waterfall",title:N("Waterfall")},{view:"calendar",title:N("Calendar")},{view:"table",title:N("Table")});const j=new C.Menu;k.forEach(({view:B,title:R})=>{j.addItem(z=>{z.setChecked(p===B).setIcon(AD[B]).setTitle(R).onClick(()=>{p!==B&&O(B)})})}),j.showAtMouseEvent(S.nativeEvent)};return w.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:c,onClick:D})},D8=()=>{const e=A.useRef(null);return A.useEffect(()=>{e&&(C.setIcon(e.current,"calendar-check"),C.setTooltip&&C.setTooltip(e.current,N("Daily Memos")))},[e]),w.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{He.setPathname("/daily")}})},O0=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),FD={initialValue:"",interval:300};class S8{constructor(t,n=FD){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=[O0()],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[this.currentIndex]
8 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},H8=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],Ag=function(t){return j8(t).map(function(n){return H8.includes(n)?"\\".concat(n):n}).join("")},Y8=function(e){Yy(t,e);function t(){return Op(this,t),Hy(this,Nd(t).apply(this,arguments))}return _y(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,c=[],d=[],p=0,m=0,g=this.containerElem.getBoundingClientRect(),v=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),O=parseInt(S.getPropertyValue("margin-left"),10),k=parseInt(S.getPropertyValue("margin-right"),10),j=T+E+D.top+o+v.height,F=O+k+D.left+s+v.width;F>g.right&&D.left+s>v.width?(m=s-v.width,c.push(dl.X.LEFT),d.push(dl.X.RIGHT)):(m=s,c.push(dl.X.RIGHT),d.push(dl.X.LEFT)),j>g.bottom&&D.top+o>v.height?(p=o-v.height,c.push(dl.Y.TOP),d.push(dl.Y.BOTTOM)):(p=o,c.push(dl.Y.BOTTOM),d.push(dl.Y.TOP)),this.props.renderToBody&&(p+=D.top,m+=D.left),this.ref.style.top="".concat(p,"px"),this.ref.style.left="".concat(m,"px"),(r=this.ref.classList).remove.apply(r,d),(a=this.ref.classList).add.apply(a,c)}},{key:"render",value:function(){var r=this,a=this.props,o=a.style,s=a.className,c=a.innerRef,d=a.children,p=a.renderToBody,m=document.body,g=$.createElement("div",{ref:function(D){r.ref=D,c(D)},className:"rta__autocomplete ".concat(s||""),style:o},d);return p&&m!==null?T1.createPortal(g,m):g}}]),t}($.Component),WT=function(e){Yy(t,e);function t(n){var r;Op(this,t),r=Hy(this,Nd(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=Eu.add(Ha.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(Eu.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,p=d.selectionStart,m=d.selectionEnd;return p===m?null:r.state.value.substr(p,m-p)},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 p=function(){var v=r.getCaretPosition()-1;r.lastTrigger=r.lastTrigger?v:0};if(d.type==="keydown"){var m=d.keyCode||d.which;switch(m){case Ha.UP:case Ha.DOWN:r._isAutocompleteOpen()||p();break;case Ha.LEFT:case Ha.RIGHT:p();break}return}p()},r._onSelect=function(d){var p=r.state,m=p.selectionEnd,g=p.currentTrigger,v=p.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(U,J,Q){switch(U){case"start":return Q;case"next":case"end":return Q+J.length;default:if(!Number.isInteger(U))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return U}},O=v.slice(0,m),k=Ag(g),j=O.length-O.lastIndexOf(g),F=O.search(new RegExp("(?!".concat(k,")$")))
Got "`.concat(String(v),'". Check the implementation for trigger "').concat(d,`"
8 months ago
See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.
`));if(v===null)return null;if(typeof v=="string")return{text:v,caretPosition:PD};if(!v.text&&typeof v.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,`"
`));if(!v.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,`"
`));return v}if(typeof g!="string")throw new Error(`Output item should be string
`);return{text:"".concat(d).concat(g).concat(d),caretPosition:PD}}},r._getCurrentTriggerSettings=function(){var d=r.state.currentTrigger;return d?r.props.trigger[d]:null},r._getValuesFromProvider=function(){var d=r.state,p=d.currentTrigger,m=d.actualToken,g=r._getCurrentTriggerSettings();if(!(!p||!g)){var v=g.dataProvider,D=g.component;if(typeof v!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var S=v(m);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(p===r.state.currentTrigger){if(!T.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:T,component:D})}}).catch(function(T){return jD(T.message)})}},r._getSuggestions=function(){var d=r.state,p=d.currentTrigger,m=d.data;return!p||!m||m&&!m.length?null:m},r._createRegExp=function(){var d=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(d).sort(function(p,m){return p<m?1:p>m?-1:0}).map(function(p){return Ag(p)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(d).sort(function(p,m){return p<m?1:p>m?-1:0}).map(function(p){return Ag(p)}).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=k8({},r.props),p=["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 m in d)p.includes(m)&&delete d[m];return d},r._changeHandler=function(d){var p=r.props,m=p.trigger,g=p.onChange,v=p.minChar,D=p.onCaretPositionChange,S=p.movePopupAsYouType,T=r.state,E=T.top,O=T.left,k=d;k||(k=new M8("change",{bubbles:!0}),r.textareaRef.dispatchEvent(k));var j=k.target||r.textareaRef,F=j.selectionEnd,B=j.value;if(r.lastValueBubbledEvent=B,g&&k&&(k.persist&&k.persist(),g(new Proxy(k,{get:function(Z,G,te){return G==="target"?j:Reflect.get(Z,G,te)}}))),D){var R=r.getCaretPosition();D(R)}r.setState({value:B});var z=function(){var Z=E8(j,F),G=Z.top,te=Z.left;r.setState({top:G-r.textareaRef.scrollTop||0,left:te})},H=function(Z){r.lastTrigger=F-Z,r._closeAutocomplete(),z()};if(F<=r.lastTrigger){var Y=B.slice(0,F),U=r.tokenRegExp.exec(Y);H(U?U[0].length:0)}var J=B.slice(r.lastTrigger,F),Q=r.tokenRegExp.exec(J),le=Q&&Q[0],pe=Q&&Q[1]||null,ie=pe?pe.length-1:0,se=r.tokenRegExpEnding.exec(J);if(se?H(se[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!le||le.length<=v+ie)&&(r.state.currentTrigger&&!m[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(pe&&m[pe].afterWhitespace&&!/\s/.test(B[F-le.length-1])&&B[F-le.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&m[r.state.currentTrigger].allowWhitespace){if(Q=new RegExp("".concat(Ag(r.state.currentTrigger),".*$")).exec(B.slice(0,F)),le=Q&&Q[0],!le){r._closeAutocomplete();return}pe=Object.keys(m).find(function(we){return we.slice(0,ie+1)===le.slice(0,ie+1)})||null}var fe=le.slice(1);if(pe){(S||E===null&&O===null||r.state.currentTrigger!==pe)&&z(),r.escListenerInit();var oe=r._getTextToReplace(pe);r.setState({selectionEnd:F,currentTrigger:pe,textToReplace:oe,actualToken:fe},function(){try{r._getValuesFromProvider()}catch(we){jD(we.message)}})}},r._selectHandler=function(d){var p=r.props,m=p.onCaretPositionChange,g=p.onSelect;if(m){var v=r.getCaretPosition();m(v)}g&&(d.persist(),g(d))},r._shouldStayOpen=function(d){var p=d.relatedTarget;return p===null&&(p=document.activeElement),!!(r.dropdownRef&&p instanceof Node&&r.dropdow
`,Ze.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 Ct=await oe(Dt);Ct&&((Je=S.current)==null||Je.insertText(Ct+`
`,Ze.id))}})))},[S,s,a]),A.useEffect(()=>{o&&p(o.DefaultPrefix==="List")},[o==null?void 0:o.DefaultPrefix]),A.useEffect(()=>{if(o){if(o.EnabledLocationList.length===1){J(o.EnabledLocationList[0].value);return}J(o.MemoSaveLocation||"DAILY")}},[o==null?void 0:o.MemoSaveLocation,o==null?void 0:o.EnabledLocationList]),A.useEffect(()=>{var Ke;if(!o||!Y.current)return;const Se=(Ke=tp.find(Je=>Je.title===U))==null?void 0:Ke.icon;C.setIcon(Y.current,Se),C.requireApiVersion("1.4.4")&&C.setTooltip(Y.current,N("Thino Save To: ")+U),Q.current=U;const Ze=r.manifest;if(Ze){const Je=a==null?void 0:a.plugins.getPlugin(Ze.id);if(Je){if(Je.settings.MemoSaveLocation===U)return;Je.settings.MemoSaveLocation=U,Je.saveSettings()}}},[U,g]),A.useEffect(()=>{S.current&&o.MemoSaveLocation&&J(o.MemoSaveLocation)},[Y,o]),A.useEffect(()=>{if(!S.current||!o||C.Platform.isDesktop||r.globalEditorShown)return;const Se=o.UseButtonToShowEditor&&o.DefaultEditorLocation==="Bottom";if(C.Platform.isDesktop){v(!0);return}if(t&&t==="inline"){v(!0);return}if(v(C.Platform.isMobile&&!Se),!Se||r.memoListView==="chat")return;const Ze=document.body.find(".memolist-wrapper");Ze&&(Ze.onscroll=()=>{if(r.globalEditorShown)return;if(!r.memoListView&&Qe.getState().memoListView==="chat"){Ze.onscroll=null;return}const Ke=S.current.getContent();C.Platform.isMobile&&Se&&!Ke&&v(!1)})},[r.globalEditorShown,t,S]);const le=()=>{j(!1)};A.useEffect(()=>{var Se,Ze,Ke,Je,lt,ft,Dt,Ct,un;if(a&&(r.markMemoId||(Se=r.editMemoId)!=null&&Se.trim()&&r.editMemoId!==T.current.editMemoId)){const Ft=a.workspace.getLeavesOfType("thino_view");Ft.length>0&&a.workspace.revealLeaf(Ft[0])}if(r.markMemoId){const Ft=`${N("MARK")}: [@THINO](${r.markMemoId})`;(Ze=S.current)==null||Ze.insertText(Ft),(Ke=S.current)==null||Ke.focus(),Qe.setMarkMemoId("");return}if((Je=r.editMemoId)!=null&&Je.trim()&&r.editMemoId!==T.current.editMemoId){const Ft=Te.getMemoById(r.editMemoId);if(Ft)switch(p(Ft.thinoType==="JOURNAL"),o.EditorType){case"memos":(lt=S.current)==null||lt.setContent(Ft.content.replace(/ \^\S{6}$/,"")||""),(ft=S.current)==null||ft.focus();break;case"obsidian":(Dt=S.current)==null||Dt.clear(),(Ct=S.current)==null||Ct.setContent(Ft.content.replace(/ \^\S{6}$/,"")||""),(un=S.current)==null||un.focus();break}}T.current=r},[r.markMemoId,r.editMemoId]),A.useEffect(()=>{var Se,Ze,Ke;!S.current||E||o.EditorType==="memos"&&((Se=S.current)==null||Se.element.addEventListener("paste",pe),(Ze=S.current)==null||Ze.element.addEventListener("drop",ie),(Ke=S.current)==null||Ke.element.addEventListener("click",se),O(!0))},[S.current]);const pe=async Se=>{var Ze;if(Se.clipboardData&&Se.clipboardData.files.length>0){Se.preventDefault();const Ke=Se.clipboardData.files;for(const Je of Ke){const lt=await oe(Je);lt&&((Ze=S.current)==null||Ze.insertText(lt))}}},ie=async Se=>{var Ze;if(Se.dataTransfer&&Se.dataTransfer.files.length>0){Se.preventDefault();const Ke=Se.dataTransfer.files;for(const Je of Ke){const lt=await oe(Je);lt&&((Ze=S.current)==null||Ze.insertText(lt))}}},se=()=>{var Se;G(((Se=S.current)==null?void 0:Se.element.value)||"")},fe=async(Se,Ze)=>{var lt,ft,Dt;const Ke=Se.ctrlKey||Se.metaKey,Je=Se.altKey;if(Se.key==="Escape"&&r.globalEditorShown&&(Qe.setGlobalEditorShown(!1),Se.preventDefault()),Ke&&Se.key==="Enter"){Se.preventDefault(),Se.stopPropagation(),Ze?(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(Je)for(let Ct=0;Ct<o.EnabledLocationList.length;Ct++)Se.key===(Ct+1).toString()&&J(o.EnabledLocationList[Ct].value);setTimeout(()=>{var Ct;Ze||G(((Ct=S.current)==null?void 0:Ct.element.value)||"")})},oe=A.useCallback(async Se=>{const{type:Ze}=Se;if(Ze.startsWith("image"))try{return`${await S1.upload(Se)}`}catch(Ke){new C.Notice(Ke)}},[]),we=async Se=>{if(!Se||Se.trim()===""){new C.Notice(N("Content cannot be empty"));return}const Ze=Xe.getState().settings,Ke=Ze==null?void 0:Ze.addTagAutomatically,Je=Ze==null?void 0:Ze.addTagWithNewline,lt=Ze==null?void 0:Ze.addTagPosition,Dt=(h5()||[]).filter(Ot=>!Se.includes
`:""}${Se}`:`${Se} ${Je?`
`:""}${Dt.map(Ot=>`#${Ot}`).join(" ")}`:Se;await Ct(un,Ft),n&&n(),Og("")},Z=A.useCallback(()=>{var Se;Qe.setEditMemoId(""),(Se=S.current)==null||Se.setContent(""),Og("")},[]),G=A.useCallback(Se=>{if(Og(Se??""),!S.current)return;const Ze=S.current.getContent(),Ke=S.current.element.selectionStart,Je=Ze.slice(0,Ke),lt=Ze.slice(Ke);(Je.endsWith("@")||Je.endsWith("📆"))&&lt.startsWith(" ")||(Je.endsWith("@")||Je.endsWith("📆"))&&lt===""?(Ye(),j(!0)):j(!1),setTimeout(()=>{var ft;(ft=S.current)==null||ft.focus()})},[o.EditorType]),te=Se=>{if(!S.current||!o)return;Se&&(le(),p(!1));const Ze=S.current.getContent(),Ke=S.current.element.selectionStart,Je=Ze.slice(0,Ke),lt=Ze.slice(Ke),ft=C.moment(Se);if(Je.endsWith("@"))switch(o.InsertDateFormat){case"Dataview":S.current.element.value=Ze.slice(0,S.current.element.selectionStart-1)+"[due::"+ft.format("YYYY-MM-DD")+"]"+lt,S.current.element.setSelectionRange(Ke+17,Ke+17),S.current.focus(),G(S.current.element.value);break;case"Tasks":S.current.element.value=Ze.slice(0,S.current.element.selectionStart-1)+"📆"+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Ke+11,Ke+11),S.current.focus(),G(S.current.element.value)}else{S.current.element.value=Je+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Ke+10,Ke+10),S.current.focus(),G(S.current.element.value);return}},ge=()=>{S.current&&p()},Ie=async()=>{var Ke;const Se=!C.Platform.isDesktop&&await((Ke=window.Capacitor)==null?void 0:Ke.Plugins.Device.getId()),Ze=C.Platform.isDesktop?await vn():Se.identifier||Se.uuid;return!c||(c==null?void 0:c.appId)!==Ze?(qt(),!1):!0},De=async Se=>{if(!await Ie())return;const Ze=new C.Menu;o.EnabledLocationList.forEach(ft=>{Ze.addItem(Dt=>{var Ct;Dt.setTitle(N(ft.value)).setIcon(((Ct=tp.find(un=>un.title===ft.value))==null?void 0:Ct.icon)??"file").setChecked(U===ft.value).onClick(()=>{J(ft.value)})})});let Ke=Se.target,Je=null;for(;!Ke.hasClass("location-wrapper")&&(Je=Ke.parentElement,Je);)Ke=Je;const lt=Ke.getBoundingClientRect();setTimeout(()=>{Ze.showAtPosition({x:lt.x,y:lt.bottom,width:lt.width,left:!1,overlap:!0})},200)},ke=A.useCallback(()=>{var Se,Ze;if(!(!S.current&&o.EditorType==="memos"))switch(o.EditorType){case"obsidian":(Se=S.current)==null||Se.focus(),(Ze=S.current)==null||Ze.insertTag();break;case"memos":{const Ke=S.current.getContent(),Je=S.current.element.selectionStart,lt=Ke.slice(0,Je),ft=Ke.slice(Je);let Dt=lt+"# "+ft,Ct=lt.length+1;lt.endsWith("#")&&ft.startsWith(" ")&&(Dt=lt.slice(0,lt.length-1)+ft.slice(1),Ct=lt.length-1),S.current.element.value=Dt,S.current.element.setSelectionRange(Ct,Ct),S.current.focus();const un=new Event("input",{bubbles:!0,cancelable:!0});S.current.element.dispatchEvent(un),G(S.current.element.value)}}},[a]),Ye=A.useCallback(()=>{if(!S.current||!B.current||!o||!a)return;const Ke=a.workspace.getLeavesOfType(_r)[0].view.containerEl,Je=280,lt=Ke.clientWidth,{x:ft,y:Dt}=p5(S.current.element);let Ct,un;C.Platform.isMobile?(window.innerWidth-ft>Je?Ct=(ft+Je+16>lt,ft+18):window.innerWidth-ft<Je?Ct=(ft+Je+16>lt,ft+34):Ct=S.current.element.clientWidth/2,o.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?un=Dt+4:o.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?un=Dt+19:o.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&(un=Dt+36)):(Ct=(ft+Je+16>lt,ft+18),un=Dt+34),F(ft),B.current.style.left=`${Ct}px`,B.current.style.top=`${un}px`},[o,a]),Re=A.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 Je;if(!Se.files||Se.files.length===0)return;const Ze=Se.files[0],Ke=await oe(Ze);Ke&&((Je=S.current)==null||Je.insertText(Ke)),document.body.removeChild(Se)},Se.click()},[]),rt=!!r.editMemoId,Ht=A.useMemo(()=>({className:"memo-editor",inputerType:o.EditorType||"obsidian",initialContent:m5(),placeholder:N("What do you think now..."),showConfirmBtn:!0,showCancelBtn:rt,showTools:!0,onConfirmBtnClick:we,onCancelBtnClick:Z,onContentChange:G}),[rt,o.EditorType]);return w.jsxs(w.Fragment,{children:[!r
`},"")),v+r+E.replace(/ \^\S{6}/g,"")+`
`+O},"");return e.reduce((g,v)=>{const D=t!=null&&t.ShowDate?`- [[${C.moment(v.date,"YYYY-MM-DD").format(n)}]]
`:"",S=m(v.have),T=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?`
8 months ago
`:"";return g+D+S+T},"").replace(/<br>/g,`
`)},w5=[{label:N("Today"),value:C.moment().format("YYYY-MM-DD")},{label:N("Yesterday"),value:C.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:N("Last 7 days"),value:C.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:N("Last 30 days"),value:C.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:N("Last 90 days"),value:C.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:N("Last 180 days"),value:C.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:N("Last 365 days"),value:C.moment().subtract(365,"days").format("YYYY-MM-DD")}],pE=e=>{const{handleValueChange:t,setShownStatus:n}=e;return w.jsxs(w.Fragment,{children:[e.type==="icon"&&w.jsx("div",{className:"quick-date-btn-group",children:w5.map((r,a)=>w.jsx("div",{className:"btn action-btn quick-date-btn",onClick:()=>{t(r.value),n&&n(!1)},children:r.label},a))}),w.jsx(zy,{className:"calendar-date-picker",datestamp:(e==null?void 0:e.defaultValue)||C.moment().startOf("day").valueOf(),handleDateStampChange:(r,a)=>{t(e.type==="icon"?C.moment(r).format("YYYY-MM-DD"):r.toString()),n&&n(!1)}})]})},py=e=>{const{handleValueChange:t}=e,[n,r]=$.useState(!1),a=$.useRef(null),o=$.useRef(null),s=Vy(o.current,a.current,{placement:"bottom-start"});return Pp(a,()=>{r(!1)}),w.jsxs(w.Fragment,{children:[w.jsx("span",{ref:d=>{o.current=d,d&&e.type==="icon"&&C.setIcon(d,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!C.Platform.isMobile&&r(!n),!C.Platform.isMobile&&(s!=null&&s.update)&&(s==null||s.update()),C.Platform.isMobile&&new mE(Xe.getState().app,e.type,t).open()},children:e.type==="text"&&e.defaultValue?e.defaultText?e.defaultText:C.moment(e.defaultValue,"x").subtract(e.startOrEnd==="end"?1:0,"days").format("YYYY/MM/DD"):""}),w.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:s.styles.popper,children:w.jsx(pE,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class mE extends C.Modal{constructor(n,r,a){super(n);me(this,"root");me(this,"type");me(this,"handleValueChange");this.type=r,this.handleValueChange=a}onOpen(){const{contentEl:n}=this;this.root=Ap(n),this.root.render(w.jsx(pE,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const b5=(e,t)=>(e%t+t)%t;class D5{constructor(t,n,r){me(this,"owner");me(this,"values");me(this,"suggestions");me(this,"selectedItem");me(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=b5(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 gE{constructor(t,n){me(this,"inputEl");me(this,"popper");me(this,"scope");me(this,"suggestEl");me(this,"suggest");me(this,"cb");this.inputEl=t,this.scope=new C.Scope,this.cb=n,this.suggestEl=createDiv("suggestion-container");const r=this.suggestEl.createDiv("suggestion");this.suggest=new D5(this,r,this.scope),this.scope.register([],"Escape",this.
`:""}${H}`:`${H} ${B?`
`:""}${j.map(Y=>`#${Y}`).join(" ")}`),z&&z.content!==H){const Y=await Te.updateMemo(z.id,H==null?void 0:H.trim());R.push(Y)}}R.length>0&&Te.editMemoBulk(R),R.length>0&&He.clearQuery()};return w.jsxs("div",{className:"thino-tag-operation",children:[w.jsx("div",{className:"tag-operation-title",children:N("Tag Bulk Edit")}),w.jsxs("div",{className:"tag-operation-content",children:[w.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[w.jsx("div",{className:"name",children:N("Exist Tags")}),w.jsx("div",{className:"desc",children:N("Click to remove exist tag")})]}),w.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(k=>w.jsx("div",{className:Xn("tag-operation-content-tag",c.includes(k)&&"tag-operation-content-tag-removed"),onClick:()=>{c.includes(k)||d([...c,k]),c.includes(k)&&d(c.filter(j=>j!==k)),o.includes(k)&&s(o.filter(j=>j!==k))},children:k},k))}),w.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[w.jsx("div",{className:"name",children:N("Selected Tags")}),w.jsx("div",{className:"desc",children:N("Click to remove selected tag")})]}),w.jsx("div",{className:"tag-operation-content-tags selected-tags",children:o.map(k=>w.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{s(o.filter(j=>j!==k))},children:k},k))}),w.jsx("div",{className:"tag-operation-content-inputer",children:w.jsx("input",{placeholder:N("Input to select exist tag"),ref:S,onKeyDown:k=>{k.key==="Enter"&&T(S.current.value)}})}),w.jsxs("div",{className:"tag-operation-settings",children:[w.jsx("div",{ref:m}),w.jsx("div",{ref:g})]}),w.jsxs("div",{className:"tag-operation-content-btn-group",children:[w.jsx("button",{className:"cancel-btn",onClick:n,children:N("Cancel")}),w.jsx("button",{className:"save-btn",onClick:E,children:N("Save")})]})]})]})},Fw=new Map,xd=async(e,t=!0)=>{const{vault:n,metadataCache:r}=Xe.getState().app;if(t&&Fw.has(e))return Promise.resolve(Fw.get(e));if(e.contains("data:image"))return e;let a;const o=await n.adapter.exists(e);let s="";try{if(!o&&!/(http|https)/g.test(e)&&!e.includes("data:image")){const c=r.getFirstLinkpathDest(e,"");if(!c){new C.Notice(N("File not exist"));return}s=c.path}else s=e}catch(c){console.error(c)}if(s){if(/(http|https)/g.test(s))try{const c=await C.requestUrl(e),d=new Uint8Array(c.arrayBuffer);a=new Blob([d],{type:"image/png"})}catch{}else if(s){const c=await n.adapter.readBinary(s),d=new Uint8Array(c);a=new Blob([d],{type:"image/png"})}return a?await E5(a,e):""}},E5=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;Fw.set(t,a),n(a)},r.readAsDataURL(e)}),Uh=async e=>{if(!e.style.backgroundImage.includes("url(")&&!e.style.backgroundImage.includes("http"))return;const t=e.style.backgroundImage.includes("url(")?e.style.backgroundImage.slice(5,-2):e.style.backgroundImage;return await xd(t)},C5=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 c=r.getAttribute("src");c!=null&&c.startsWith("http")&&!c.startsWith("http://localhost")?s=await xd(r==null?void 0:r.getAttribute("src")):s=await xd(r.getAttribute("path")||C.normalizePath(r==null?void 0:r.parentElement.getAttribute("src"))),a.src=s}catch(s){console.error(s)}else if(r.hasClass("property-image")||r.hasClass("moments-view-background"))try{const s=r.style.backgroundImage.includes("url(")?r.style.backgroundImage.slice(5,-2):r.style.backgroundImage,c=await xd(s);a.style.backgroundImage=`url(${c})`}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},x5=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")},vE=e=>{const{width:t,height:n}=window.getComputedStyle(e);return{width:parseInt(t.replace("px","")),height:parseInt(n.replace
`,s.current,r.path,n),(g=s.current)==null||g.toggleClass(["markdown-rendered"],!0);const m=(v=s.current)==null?void 0:v.querySelectorAll(".internal-link");m==null||m.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",O=>{O.stopPropagation(),t.workspace.trigger("hover-link",{event:O,source:"thino",hoverParent:n.containerEl,targetEl:S,linktext:T,sourcePath:S.href})})})})()},[r.content,n,t]),w.jsx("div",{ref:s,className:"memo-content-text",onClick:p=>a(p,r),onDoubleClick:o,onContextMenu:p=>{p.preventDefault()}})},bE=A.memo(L5),R5=e=>{const[t,n]=A.useState({...e.memo,createdAtStr:Ue.getDateTimeString(e.memo.createdAt)}),[r,a]=A.useState([]),[o,s]=A.useState([]);A.useEffect(()=>{(async()=>{try{const g=[],v=[...t.content.matchAll(Il)];for(const S of v)if(S&&S.length===3){const T=S[2],E=Te.getMemoById(T);E&&g.push({...E,createdAtStr:Ue.getDateTimeString(E.createdAt),dateStr:Ue.getDateString(E.createdAt)})}a([...g]);const D=await Te.getLinkedMemos(t.id);s(D.sort((S,T)=>Ue.getTimeStampByDate(T.createdAt)-Ue.getTimeStampByDate(S.createdAt)).map(S=>({...S,createdAtStr:Ue.getDateTimeString(S.createdAt),dateStr:Ue.getDateString(S.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const c=A.useCallback(async m=>{var v;const g=m.target;if(g.className==="memo-link-text"){const D=(v=g.dataset)==null?void 0:v.value,S=Te.getMemoById(D??"");if(S){const T={...S,createdAtStr:Ue.getDateTimeString(S.createdAt)};a([]),s([]),n(T)}else new C.Notice(N("Thino not found")),g.classList.remove("memo-link-text")}},[]),d=A.useCallback(m=>{a([]),s([]),n({...m,createdAtStr:Ue.getDateTimeString(m.createdAt)})},[t.id]),p=A.useCallback(()=>{e.destroy(),Qe.setEditMemoId(t.id)},[t.id]);return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"memo-card-container",children:[w.jsxs("div",{className:"header-container",children:[w.jsx("span",{className:"time-text",children:t.createdAtStr}),w.jsxs("div",{className:"btns-container",children:[w.jsx("button",{ref:m=>{m&&C.setIcon(m,"edit")},className:"btn edit-btn",onClick:p}),w.jsx("button",{ref:m=>{m&&C.setIcon(m,"x")},className:"btn close-btn",onClick:e.destroy})]})]}),w.jsx("div",{className:"memo-container",children:w.jsx("div",{className:"memo-content-text",children:w.jsx(bE,{memo:t,handleMemoContentClick:c,handleMemoDoubleClick:()=>{}})})}),w.jsx("div",{className:"layer-container"})]}),r.length>0?w.jsxs("div",{className:"linked-memos-wrapper",children:[w.jsxs("span",{className:"normal-text",children:[N("LINKED")," ",r.length," THINO"," "]}),r.map(m=>{const g=Vb(pw(m.content)).replaceAll(`
`," ");return w.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[w.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null,o.length>0?w.jsxs("div",{className:"linked-memos-wrapper",children:[w.jsxs("span",{className:"normal-text",children:[o.length," THINO ",N("LINK TO THE")," THINO"]}),o.map(m=>{const g=Vb(pw(m.content)).replaceAll(`
`," ");return w.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[w.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null]})};function $d(e){By({className:"memo-card-dialog"},R5,{memo:e})}const B5='<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,83.96-30.41,119.45-23.34,35.49-51.8,69.58-60.47,111.16-8.01,38.38,2.72,78.02,24.05,111.38a197.34468,197.34468,0,0,0,35.74,41.61c43.09,37.91,98.77,58.15,154.17,73.13,200.27,54.17,416.13,49.29,613.75-13.88,34.99-11.18,69.95-24.43,99.32-46.48,19.16-14.38,35.83-33.02,46.39-54.35a114.10574,114.10574,0,0,0,11.13-36.18005C1104.43917,610.17819,1072.9692,562.05819,1050.69918,514.5082Z" transform="translate(-26.84086 -49.49819)" fill="#6c63ff"/><g opacity="0.17"><path d="M890.75032,246.45145c9.64171-4.20394-9.91163-6.65119-32.09585-7.45582s-49.02061-.76011-63.19756-3.04875c-13.71114-2.21343-12.7009-6.14907-13.85427-9.71489s-6.42446-7.222-27.81928-8.0147c-26.6607-.98774-70.62581,2.81434-90.75171.53173-18.78121-2.13011-7.61723-8.81182-35.00344-9.06755-15.63837-.146-35.7849,2.05682-53.18577,2.58844-16.33647.49909-28.42216-.53441-36.90357-1.924s-14.38875-3.15126-23.93413-4.37864c-25.06068-3.2224-74.09133-2.13925-117.853,1.99071s-81.27344,10.89816-102.42889,17.60175-27.00029,13.30376-22.07239,18.90071c3.14674,3.574,11.19915,6.91585,30.73235,8.352,36.53555,2.68621,101.58387-1.9375,139.33713.50645,21.0415,1.36213,30.3764,4.73924,48.83812,6.58716,19.83407,1.98528,48.86935,2.09051,77.39656,2.04341,59.39721-.09807,120.3137-.70829,182.42994-1.82747,25.94486-.46745,53.13-1.0752,80.73761-3.30289s55.76623-6.52591,61.59076-10.5553" transform="translate(-26.84086 -49.49819)" fill="#fff"/></g><path d="M1099.25911,172.04818c-.46-1.18-.96-2.35-1.48-3.49.84.33,1.68006.69,2.51,1.08Z" transform="translate(-26.84086 -49.49819)" fill="#6c63ff"/><path d="M648.74482,314.5843c-7.66935-12.68445-16.75721-26.22767-30.98955-30.36953-16.482-4.7965-33.41319,4.73193-47.77473,14.13453a1392.15692,1392.15692,0,0,0-123.89338,91.28311l.04331.49239q46.22556-3.18781,92.451-6.37555c22.26532-1.53546,45.29557-3.2827,64.97195-13.8156,7.46652-3.99683,14.74475-9.33579,23.20555-9.70782,10.51175-.46217,19.67733,6.87923,26.8802,14.54931,42.60732,45.371,54.937,114.7541,102.73817,154.61592A1516.99458,1516.99458,0,0,0,648.74482,314.5843Z" transform="translate(-26.84086 -49.49819)" fill="#f2f2f2"/><path d="M910.64576,699.4127c-4.71168-5.94958-6.63691-7.343-11.28457-13.34761Q842.5968,612.64872,792.65327,534.27272q-33.92353-53.23005-64.48275-108.50439-14.54863-26.27808-28.29961-52.96872-10.67043-20.6952-20.8646-41.63793c-1.94357-3.98781-3.83209-7.99393-5.71122-12.00922-4.42788-9.44232-8.7734-18.93047-13.43942-28.24449-5.31687-10.61571-11.78905-21.74485-21.55259-28.877a29.4049,29.4049,0,0,0-15.31855-5.89457c-7.948-.51337-15.28185,2.76854-22.17569,6.35294-50.43858,26.301-97.65921,59.27589-140.36959,96.79771A730.77781,730.77781,0,0,0,346.39748,485.87843c-1.008,1.43927-3.39163.06418-2.37419-1.38422q6.00935-8.49818,12.25681-16.81288A734.81742,734.81742,0,0,1,543.87972,292.6956q18.24825-11.82579,37.18269-22.54245c6.36206-3.60275,12.75188-7.15967,19.25136-10.49653,6.37147-3.27274,13.13684-6.21547,20.41563-6.32547,24.77011-.385,37.5954,27.667,46.40506,46.54248q4.15283,8.9106,8.40636,17.76626,16.07481,33.62106,33.38729,66.628,10.68453,20.379,21.83683,40.51955,34.7071,62.71816,73.77854,122.897c34.5059,53.1429,68.73651,100.08874,108.04586,149.78473C913.67124,698.84433,911.73706,700.80615,910.64576,
`,F.current,t.path,a)}Q(),setTimeout(async()=>{if(await z5(),await Y5(j.current),!j.current)return;let le;document.body.hasClass("theme-dark")?le="#727171":le="#eaeaea",Zy(j.current,{backgroundColor:le,pixelRatio:window.devicePixelRatio*2}).then(pe=>{k(pe),p(!0)}).catch(()=>{})},MI)},[j,F,c]);const H=()=>{n()},Y=A.useCallback(Q=>{D(Q)},[v]),U=async()=>{const{vault:Q}=Ee.getState().dailyNotesState.app,le=j.current.querySelector(".memo-shortcut-img");if(!le)return;const pe=le==null?void 0:le.getAttribute("src").split("base64,")[1],ie=QD(pe,"image/png");let se;ie.arrayBuffer().then(async fe=>{const oe="png",we=bs();for(const Z in we)if(we[Z]instanceof C.TFile){se=we[Z];break}if(se!==void 0){const Z=await Q.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,oe,se);await Q.createBinary(Z,fe),new C.Notice(N("Save image successfully"))}})},J=async()=>{Y(!0);const Q=j.current.querySelector(".memo-shortcut-img");if(!Q)return;const le=Q==null?void 0:Q.getAttribute("src").split("base64,")[1],pe=QD(le,"image/png");if(!pe){new C.Notice("Copy to clipboard failed");return}const ie=new ClipboardItem({"image/png":pe});window.navigator.clipboard.write([ie]).then(()=>{setTimeout(()=>{Y(!1)},500)}),new C.Notice("Copy to clipboard successfully")};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"dialog-header-container",children:[w.jsxs("p",{className:"title-text",children:[w.jsx("span",{className:"icon-text",children:"🥰"}),N("Share Memo Image")]}),w.jsxs("div",{className:"btn-group",children:[C.Platform.isMobile&&w.jsx("button",{ref:E,className:"btn download-btn",onClick:U}),w.jsx("button",{ref:S,className:"btn copy-btn",onClick:J}),w.jsx("button",{ref:T,className:"btn close-btn",onClick:H})]})]}),w.jsxs("div",{className:"dialog-content-container",children:[w.jsx("div",{className:`tip-words-container ${O?"finish":"loading"}`,children:w.jsx("p",{className:"tip-text",children:N(O?"↗Click the button to save":"Image is generating...")})}),w.jsxs("div",{className:"memo-container",ref:j,children:[w.jsx(so,{when:O!=="",children:w.jsx("img",{className:"memo-shortcut-img",onClick:J,src:O})}),w.jsxs("div",{className:"memo-background",children:[w.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),w.jsx("span",{className:"background-container"}),w.jsxs("div",{className:"thino-user-header",children:[w.jsx("div",{className:"thino-user-icon",ref:Q=>{if(s!=null&&s.MomentsIcon){Q==null||Q.empty();return}s!=null&&s.MomentsIcon||Q&&C.setIcon(Q,"Memos")},style:{backgroundImage:`url(${s==null?void 0:s.MomentsIcon})`}}),w.jsxs("div",{className:"thino-user-info",children:[w.jsx("div",{className:"thino-user-name",children:s==null?void 0:s.UserName}),(s==null?void 0:s.MomentsQuote)&&w.jsx("div",{className:"thino-user-quote",children:s==null?void 0:s.MomentsQuote})]})]}),w.jsx("div",{ref:F,className:"memo-content-text"}),w.jsx("div",{className:"thino-time-footer",children:c.createdAt}),w.jsxs("div",{className:"watermark-container",children:[w.jsxs("span",{className:"normal-text footer-start",children:[w.jsx("div",{className:"property-social-icons"}),w.jsx("span",{className:"name-text",children:z})]}),w.jsx("span",{className:"normal-text footer-end",children:w.jsx("span",{className:"name-text",children:"THINO"})})]})]})]})]})]})};function V5(e){By({className:"share-memo-image-dialog"},U5,{memo:e})}const Z5=A.forwardRef((e,t)=>{const{memo:n,handlePinMemoClick:r,handleFixMemoClick:a,handleSourceMemoClick:o,handleShowMemoStoryDialog:s,handleCopyMemoClick:c,handleEditMemoClick:d,handleGenMemoImageBtnClick:p,handleMarkMemoClick:m,handleArchiveMemo:g,handleDeleteMemoClick:v}=e,D=A.useRef(null),S=Ee.getState().dailyNotesState.settings,[T,E]=ki(!1),O=A.useRef(null),k={pinRef:A.useRef(null),fixRef:A.useRef(null),typeRef:A.useRef(null),moreRef:A.useRef(null)},j={copy:A.useRef(null),read:A.useRef(null),mark:A.useRef(null),share:A.useRef(null),edit:A.useRef(null),source:A.useRef(null),archive:A.useRef(null),delete:A.useRef(null)};return A.useEffect(()=>
`).trim();if(e&&e.content!==D){const S=await Te.updateMemo(e.id,D);Te.editMemo(S)}}},Q5=e=>{const{globalState:{editMemoId:t},dailyNotesState:{app:n,view:r,settings:a,verifyState:o},locationState:{pathname:s}}=A.useContext(mt),{memo:c,type:d="inline"}=e,p=A.useRef(null),m=A.useRef(null),[g,v]=A.useState(!1);A.useEffect(()=>{g&&setTimeout(()=>{Qe.setEditMemoId(c.id)},100)},[g]),A.useEffect(()=>{(s==="/review"||s==="/daily")&&t!==c.id&&g&&v(!1)},[t]);const D=()=>{$d(c)},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(c.id)},T=async()=>{var fe;const ie=!C.Platform.isDesktop&&await((fe=window.Capacitor)==null?void 0:fe.Plugins.Device.getId()),se=C.Platform.isDesktop?await vn():ie.identifier||ie.uuid;if(!o||(o==null?void 0:o.appId)!==se){qt();return}c.pinned?await Te.unpinMemoById(c.id):await Te.pinMemoById(c.id)},E=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"&&C.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")&&v(!0),s!=="/review"&&s!=="/daily"&&Qe.setEditMemoId(c.id)},O=async ie=>{ie.sourceType==="MULTI"&&ie.id.trim()===""&&await Te.updateMemoProperty(ie)},k=async ie=>{await Te.openThinoByID(ie.id)},j=async ie=>{try{const se=await Te.archiveMemo(ie);se&&Te.editMemo(se)}catch(se){console.error(se),new C.Notice(se.message)}},F=async(ie,se)=>{if(!se&&m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm();return}try{if(a.DeleteThinoDirectly)await Te.deleteMemoById(c.id);else{const fe=await Te.hideMemoById(c.id);fe&&Te.editMemo(fe)}}catch(fe){new C.Notice(fe.message)}Qe.getState().editMemoId===c.id&&Qe.setEditMemoId("")},B=()=>{if(m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm(!1);return}},R=()=>{V5(c)},z=async()=>{const ie=await Te.updateMemo(c.id,c.content,c.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");ie&&Te.editMemo(ie)},H=async ie=>{ie.stopPropagation(),navigator.clipboard.writeText(c.content).then(()=>{new C.Notice(N("COPY SUCCEED"))}).catch(()=>{new C.Notice(N("COPY FAILED"))})},Y=ie=>{ie&&ie.target.tagName!=="INPUT"&&E()},U=async(ie,se)=>{ie.preventDefault(),ie.stopPropagation();const fe=ie.target;if(ie.ctrlKey||ie.metaKey){await k(se);return}if(fe.tagName==="A"){await $5(n,r,fe);return}if(fe.tagName==="IMG"){q5(p.current,fe);return}if(fe.tagName==="A"&&fe.getAttribute("href")){const oe=fe.getAttribute("href");window.open(oe,"_blank");return}if(fe.className==="memo-link-text"){J5(fe);return}if(fe.tagName==="INPUT"&&fe.hasClass("task-list-item-checkbox")){await K5(se,p.current,fe);return}},J=ie=>{const se=new C.Menu;se.dom.toggleClass("memo-context-menu",!0);const fe=window.getSelection();(fe==null?void 0:fe.toString().length)>0&&se.addItem(oe=>{oe.setIcon("copy").setTitle(N("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(fe.toString()).then(()=>{new C.Notice(N("COPY SUCCEED"))}).catch(()=>{new C.Notice(N("COPY FAILED"))})})}).addSeparator(),se.addItem(oe=>{oe.setIcon("copy").setTitle(N("Copy thino").toLocaleUpperCase()).onClick(async we=>{await H(we),se.close()})}).addItem(oe=>{oe.setIcon("book-open").setTitle(N("READ")).onClick(D)}).addItem(oe=>{oe.setIcon(c.pinned?"pin-off":"pin").setTitle(c.pinned?N("UNPIN"):N("PIN")).onClick(T)}).addItem(oe=>{oe.setIcon("bookmark").setTitle(N("MARK")).onClick(S)}).addItem(oe=>{oe.setIcon("share-2").setTitle(N("SHARE")).onClick(R)}).addItem(oe=>{oe.setIcon("pencil").setTitle(N("EDIT")).onClick(E)}).addItem(oe=>{oe.setIcon("home").setTitle(N("SOURCE")).onClick(()=>k(c))}).addSeparator().addItem(oe=>{oe.setIcon("archive").setTitle(N("ARCHIVE").toLocaleUpperCase()).onClick(()=>j(c))}).addItem(oe=>{oe.setIcon("trash").setTitle(N("DELETE")).onClick(async we=>{await F(we,!0)})}),se.showAtMouseEvent(ie.nativeEvent)},Q=A.useMemo(()=>({memo:c,
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fs(e,t){return TE(e)||oF(e,t)||P1(e,t)||EE()}function An(){return An=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},An.apply(this,arguments)}var iF=function(e,t,n,r,a,o,s,c){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 p=[n,r,a,o,s,c],m=0;d=new Error(t.replace(/%s/g,function(){return p[m++]})),d.name="Invariant Violation"}throw d.framesToPop=1,d}},sF=iF;const op=er(sF);var lF=function(){};function uF(e,t){var n={};return Object.keys(e).forEach(function(r){n[Xg(r)]=lF}),n}function nS(e,t){return e[t]!==void 0}function Xg(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function cF(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function dF(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,vy(e,t)}function CE(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function xE(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function ME(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}}CE.__suppressDeprecationWarning=!0;xE.__suppressDeprecationWarning=!0;ME.__suppressDeprecationWarning=!0;function fF(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:
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=CE,t.componentWillReceiveProps=xE),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=ME;var c=t.componentDidUpdate;t.componentDidUpdate=function(p,m,g){var v=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:g;c.call(this,p,m,v)}}return e}var hF="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function NE(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=cF(e),o=Object.keys(t),s=o.map(Xg);a||!n.length||op(!1);var c=function(p){dF(m,p);function m(){for(var v,D=arguments.length,S=new Array(D),T=0;T<D;T++)S[T]=arguments[T];v=p.call.apply(p,[this].concat(S))||this,v.handlers=Object.create(null),o.forEach(function(O){var k=t[O],j=function(B){if(v.props[k]){var R;v._notifying=!0;for(var z=arguments.length,H=new Array(z>1?z-1:0),Y=1;Y<z;Y++)H[Y-1]=arguments[Y];(R=v.props)[k].apply(R,[B].concat(H)),v._notifying=!1}v.unmounted||v.setState(function(U){var J,Q=U.values;return{values:An(Object.create(null),Q,(J={},J[O]=B,J))}})};v.handlers[k]=j}),n.length&&(v.attachRef=function(O){v.inner=O});var E=Object.create(null);return o.forEach(function(O){E[O]=v.props[Xg(O)]}),v.state={values:E,prevProps:{}},v}var g=m.prototype;return g.shouldComponentUpdate=function(){return!this._notifying},m.getDerivedStateFromProps=function(D,S){var T=S.values,E=S.prevProps,O={values:An(Object.create(null),T),prevProps:{}};return o.forEach(function(k){O.prevProps[k]=D[k],!nS(D,k)&&nS(E,k)&&(O.values[k]=D[Xg(k)])}),O},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var D=this,S=this.props,T=S.innerRef,E=$y(S,["innerRef"]);s.forEach(function(k){delete E[k]});var O={};return o.forEach(function(k){var j=D.props[k];O[k]=j!==void 0?j:D.state.values[k]}),$.createElement(e,An({},E,O,this.handlers,{ref:T||this.attachRef}))},m}($.Component);fF(c),c.displayName="Uncontrolled("+r+")",c.propTypes=An({innerRef:function(){}},uF(t)),n.forEach(function(p){c.prototype[p]=function(){var g;return(g=this.inner)[p].apply(g,arguments)}});var d=c;return $.forwardRef&&(d=$.forwardRef(function(p,m){return $.createElement(c,An({},p,{innerRef:m,__source:{fileName:hF,lineNumber:128},__self:this}))}),d.propTypes=c.propTypes),d.ControlledComponent=e,d.deferControlTo=function(p,m,g){return m===void 0&&(m={}),NE(p,An({},t,m),g)},d}function kE(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=kE(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=kE(e))&&(r&&(r+=" "),r+=t);return r}var AE={exports:{}},L0,rS;function pF(){if(rS)return L0;rS=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return L0=e,L0}var R0,aS;function mF(){if(aS)return R0;aS=1;var e=pF();function t(){}function n(){}return n.resetWarningCache=t,R0=function(){function r(s,c,d,p,m,g){if(g!==e){var v=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 v.name="Invariant Violation",v}}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},R0}AE.exports=mF()();var gF=AE.exports;const Ae=er(gF);var wy="milliseconds",ip="seconds",sp="minutes",lp="hours",Fu="day",Pd="week",up="month",Ou="year",Pu="decade",ju="century",FE={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},yF={month:1,year:12,decade:10*12,century:100*12};function vF(e){return[31,wF
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ey(e){return CF(e)||_E(e)||P1(e)||xF()}function MF(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 HE=MF;function NF(e,t){return e===t||e!==e&&t!==t}var Hp=NF,kF=typeof Jn=="object"&&Jn&&Jn.Object===Object&&Jn,YE=kF,AF=YE,FF=typeof self=="object"&&self&&self.Object===Object&&self,OF=AF||FF||Function("return this")(),Oi=OF,PF=Oi,jF=PF.Symbol,Jd=jF,iS=Jd,zE=Object.prototype,LF=zE.hasOwnProperty,RF=zE.toString,Rh=iS?iS.toStringTag:void 0;function BF(e){var t=LF.call(e,Rh),n=e[Rh];try{e[Rh]=void 0;var r=!0}catch{}var a=RF.call(e);return r&&(t?e[Rh]=n:delete e[Rh]),a}var _F=BF,HF=Object.prototype,YF=HF.toString;function zF(e){return YF.call(e)}var UF=zF,sS=Jd,VF=_F,ZF=UF,WF="[object Null]",$F="[object Undefined]",lS=sS?sS.toStringTag:void 0;function GF(e){return e==null?e===void 0?$F:WF:lS&&lS in Object(e)?VF(e):ZF(e)}var Kd=GF;function qF(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ss=qF,JF=Kd,KF=Ss,QF="[object AsyncFunction]",XF="[object Function]",eO="[object GeneratorFunction]",tO="[object Proxy]";function nO(e){if(!KF(e))return!1;var t=JF(e);return t==XF||t==eO||t==QF||t==tO}var R1=nO,rO=9007199254740991;function aO(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rO}var B1=aO,oO=R1,iO=B1;function sO(e){return e!=null&&iO(e.length)&&!oO(e)}var Yp=sO,lO=9007199254740991,uO=/^(?:0|[1-9]\d*)$/;function cO(e,t){var n=typeof e;return t=t??lO,!!t&&(n=="number"||n!="symbol"&&uO.test(e))&&e>-1&&e%1==0&&e<t}var _1=cO,dO=Hp,fO=Yp,hO=_1,pO=Ss;function mO(e,t,n){if(!pO(n))return!1;var r=typeof t;return(r=="number"?fO(n)&&hO(t,n.length):r=="string"&&t in n)?dO(n[t],e):!1}var qy=mO,gO=/\s/;function yO(e){for(var t=e.length;t--&&gO.test(e.charAt(t)););return t}var vO=yO,wO=vO,bO=/^\s+/;function DO(e){return e&&e.slice(0,wO(e)+1).replace(bO,"")}var SO=DO;function IO(e){return e!=null&&typeof e=="object"}var Cl=IO,TO=Kd,EO=Cl,CO="[object Symbol]";function xO(e){return typeof e=="symbol"||EO(e)&&TO(e)==CO}var zp=xO,MO=SO,uS=Ss,NO=zp,cS=NaN,kO=/^[-+]0x[0-9a-f]+$/i,AO=/^0b[01]+$/i,FO=/^0o[0-7]+$/i,OO=parseInt;function PO(e){if(typeof e=="number")return e;if(NO(e))return cS;if(uS(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=uS(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=MO(e);var n=AO.test(e);return n||FO.test(e)?OO(e.slice(2),n?2:8):kO.test(e)?cS:+e}var jO=PO,LO=jO,dS=1/0,RO=17976931348623157e292;function BO(e){if(!e)return e===0?e:0;if(e=LO(e),e===dS||e===-dS){var t=e<0?-1:1;return t*RO}return e===e?e:0}var UE=BO,_O=UE;function HO(e){var t=_O(e),n=t%1;return t===t?n?t-n:t:0}var VE=HO,YO=HE,zO=qy,UO=VE,VO=Math.ceil,ZO=Math.max;function WO(e,t,n){(n?zO(e,t,n):t===void 0)?t=1:t=ZO(UO(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,s=Array(VO(r/t));a<r;)s[o++]=YO(e,a,a+=t);return s}var $O=WO;const GO=er($O);function Up(e){return e&&e.ownerDocument||document}function qO(e){var t=Up(e);return t&&t.defaultView||window}function JO(e,t){return qO(e).getComputedStyle(e,t)}var KO=/([A-Z])/g;function QO(e){return e.replace(KO,"-$1").toLowerCase()}var XO=/^ms-/;function Pg(e){return QO(e).replace(XO,"-ms-")}var e7=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function t7(e){return!!(e&&e7.test(e))}function Sd(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Pg(t))||JO(e).getPropertyValue(Pg(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(Pg(a)):t7(a)?r+=a+"("+o+") ":n+=Pg(a)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function pp(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function n7(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function H1(e){return"window"in e&&e.window===e?e:n7(e)&&e.defaultView||!1}function ZE(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,a){var o=H1(r);if(a===void 0)retu
`)[0].slice(0,20),r=$.useRef(null),a=$.useRef(null),o=$.useRef(null);A.useEffect(()=>{if(a.current)return C.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const s=A.useCallback(d=>{o.current&&(o.current.unmount(),o.current=null),o.current=d},[]),c=A.useCallback(d=>{if(!r.current||!C.Keymap.isModifier(d.nativeEvent,"Mod"))return;const p=new C.HoverPopover(Xe.getState().view,r.current,100),m=$G(p,t);s(m)},[r.current]);return w.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:c,children:[w.jsx(qG,{event:e}),w.jsx("strong",{children:n})]})}const qG=({event:e})=>{const t=$.useRef(null),n=e.resource;A.useEffect(()=>{t.current&&C.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=A.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const s=await Te.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");s&&Te.editMemo(s)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return w.jsx(w.Fragment,{children:w.jsxs("span",{className:"rbc-event-icon-group",children:[w.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),w.jsx("span",{className:Xn("rbc-event-time","hidden"),children:w.jsx("span",{className:"rbc-event-time-text",children:C.moment(e.start).format("HH:mm")})})]})})};function KC({views:e,view:t,messages:n,onView:r}){return e.map(a=>w.jsx("button",{type:"button",className:Xn({"rbc-active":t===a}),onClick:()=>r(a),children:n[a]},a))}KC.propTypes={messages:Ae.object,onView:Ae.func,view:Ae.string,views:Ae.array};function QC({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:s}){const c={previous:A.useRef(null),today:A.useRef(null),next:A.useRef(null)};A.useEffect(()=>{c&&(C.setIcon(c.previous.current,"chevron-left"),C.setIcon(c.today.current,"dot"),C.setIcon(c.next.current,"chevron-right"))},[c]);const d=A.useMemo(()=>w.jsxs(w.Fragment,{children:[w.jsx("button",{ref:c.previous,type:"button",onClick:()=>r(Td.PREVIOUS),"aria-label":n.previous,children:"<"}),w.jsx("button",{ref:c.today,type:"button",onClick:()=>r(Td.TODAY),"aria-label":n.today,children:"•"}),w.jsx("button",{ref:c.next,type:"button",onClick:()=>r(Td.NEXT),"aria-label":n.next,children:">"})]}),[n]);return w.jsxs("div",{className:"rbc-toolbar",children:[w.jsx("span",{className:Xn("rbc-btn-group","thino-view-custom-toolbar"),children:d}),w.jsx("span",{className:"rbc-toolbar-label",children:w.jsx(py,{type:"text",handleValueChange:p=>{r(Td.DATE,C.moment(p,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(o==="week"?C.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:C.moment(e.valueOf(),"x").valueOf()})}),w.jsx("span",{className:"rbc-btn-group",children:w.jsx(KC,{view:o,views:s,messages:n,onView:a})})]})}QC.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 JG({event:e,children:t,showPopup:n,callRender:r,...a}){const o=A.useRef(null),s=A.useRef(null),c=A.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 w.jsx(w.Fragment,{children:w.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:c,children:t})})}const KG=ZG(C.moment),QG=({event:e})=>{const t=e.resource;return w.jsx(w.Fragment,{children:w.jsx(Sa,{memo:t})})},XG=e=>{var Q;const{thinos:t}=e,[n,r]=$.useState([]),[a,o]=$.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[s,c]=$.useState(null),d=$.useRef(null),p=$.useRef(null),[m,g]=$.useState(!1),v=A.useRef(null),[D,S]=A.useState(new Date);A.useEffect(()=>()=>{d.current&&(d.current=null),p.
`,o.current,t.path,E);const k=(j=o.current)==null?void 0:j.querySelectorAll(".internal-link");k==null||k.forEach(F=>{const B=F,R=B.getAttribute("data-href");if(!R)return;r.app.metadataCache.getFirstLinkpathDest(R,t.path)||F.classList.add("is-unresolved"),B.addEventListener("mouseover",H=>{H.stopPropagation(),r.app.workspace.trigger("hover-link",{event:H,source:"thino",hoverParent:E.containerEl,targetEl:B,linktext:R,sourcePath:B.href})})})}O()},[t.content,s]);const v=async()=>{if(p)try{await Te.deleteMemoById(a.id),n(a.id)}catch(E){new C.Notice(E.message)}else m()},D=async()=>{switch(a.sourceType){case"DAILY":await w1(a.id,a.path);break;case"CANVAS":await D1(a.id,a.path);break;case"MULTI":await v1(a.path);break;case"FILE":await b1(a.id,a.path);break}},S=async()=>{try{const E=await Te.restoreMemoById(a.id),O=r.app,k=O==null?void 0:O.loadLocalStorage("tokenForSync");E&&E.webId&&k&&r.settings.startSync&&await BT(E.webId),E&&Te.editMemo(E),n(a.id),new C.Notice(N("RESTORE SUCCEED"))}catch(E){new C.Notice(E.message)}},T=()=>{p&&m(!1)};return w.jsxs("div",{ref:s,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:T,children:[w.jsxs("div",{className:"memo-top-wrapper",children:[w.jsxs("span",{className:"time-text",children:[N("DELETE AT")," ",a.deletedAtStr]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:E=>{E&&C.setIcon(E,"more-horizontal")},className:"btn more-action-btn"}),w.jsx("div",{className:"more-action-btns-wrapper",children:w.jsxs("div",{className:"more-action-btns-container",children:[w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),w.jsx("span",{className:"btn restore-btn",onClick:S,children:N("RESTORE")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:g.source,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:D,children:N("SOURCE")})]}),w.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[w.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),w.jsx("span",{className:`btn delete-btn ${p?"final-confirm":""}`,onClick:v,children:N(p?"CONFIRM":"DELETE")})]})]})})]})]}),w.jsx("div",{ref:o,className:"memo-content-text",onContextMenu:E=>{E.preventDefault(),E.stopPropagation()}})]})},eK=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:c}=t,d=Et.getQueryById(c);return!!(r||a&&a.from<a.to||o||s||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=Wd(m,v))}if(r){const v=new Set;for(const D of Array.from(m.content.match(Fn)||[])){const T=D.replace(Fn,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match(mr)||[])){const T=D.replace(mr,"$2").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}v.has(r)||(g=!1)}return a&&a.from<a.to&&(Ue.getTimeStampByDate(m.createdAt)<a.from||Ue.getTimeStampByDate(m.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(m.content.match(Fn)!==null||m.content.match(mr)!==null||m.content.match($n)!==null)||o==="LINKED"&&m.content.match(Bu)===null||o==="IMAGED"&&m.content.match(_u)===null||o==="CONNECTED"&&m.content.match(Il)===null)&&(g=!1),s&&!m.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},tK=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=A.useContext(mt),r=af(),[a,o]=A.useState([]),s=$.useRef(null);A.useEffect(()=>{const p=eK({memos:n.filter(m=>m.deletedAt!==""&&m.deletedAt),query:e,HideDoneTasks:!1});o(p),r.setFinish()},[n,s.current,e]);const c=A.useCallback(p=>{o(m=>m.filter(g=>g.id!==p))},[]),d=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[w.jsxs("div",{classNam
8 months ago
* **开源项目**
* 😋 精美且细节的视觉样式
* 📑 体验优良的交互逻辑`,s=()=>{Qe.setAppSetting({useTinyUndoHistoryCache:!t})},c=()=>{Qe.setAppSetting({shouldSplitMemoWord:!r})},d=()=>{Qe.setAppSetting({shouldHideImageUrl:!n})},p=()=>{Qe.setAppSetting({shouldUseMarkdownParser:!a})},m=async()=>{const g=Te.getState().memos.map(S=>({...S})),v=JSON.stringify(g),D=document.createElement("a");D.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(v)),D.setAttribute("download","data.json"),D.style.display="none",document.body.appendChild(D),D.click(),document.body.removeChild(D)};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"section-container preferences-section-container",children:[w.jsx("p",{className:"title-text",children:"Memo 显示相关"}),w.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:pw(o)}}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:c,children:[w.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),w.jsx("img",{className:"icon-img",src:r?zg:Ug})]}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:p,children:[w.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),w.jsx("img",{className:"icon-img",src:a?zg:Ug})]}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:d,children:[w.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),w.jsx("img",{className:"icon-img",src:n?zg:Ug})]})]}),w.jsxs("div",{className:"section-container preferences-section-container",children:[w.jsx("p",{className:"title-text",children:"编辑器"}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:s,children:[w.jsxs("span",{className:"normal-text",children:["启用"," ",w.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),w.jsx("img",{className:"icon-img",src:t?zg:Ug})]})]}),w.jsxs("div",{className:"section-container hidden",children:[w.jsx("p",{className:"title-text",children:"其他"}),w.jsx("div",{className:"btn-container",children:w.jsx("button",{className:"btn export-btn",onClick:m,children:"导出数据(JSON)"})})]})]})},rK=()=>{const{globalState:{isMobileView:e}}=A.useContext(mt);A.useEffect(()=>{Te.fetchAllMemos()},[]);const t=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"preference-wrapper",children:[w.jsx("div",{className:"section-header-container",children:w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:e,children:w.jsx("button",{className:"action-btn",onClick:t})}),w.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),w.jsx("div",{className:"sections-wrapper",children:w.jsx(nK,{})})]})},aK=e=>{const{dailyNotesState:{app:t,settings:n,view:r}}=A.useContext(mt),{memo:a,handleUnarchivedMemoAction:o}=e,s=$.useRef(null),c=$.useRef(null),[d,p]=$.useState(""),m={...a,createdAtStr:Ue.getDateTimeString(a.createdAt),deletedAtStr:Ue.getDateTimeString(a.deletedAt||a.createdAt)},[g,v]=ki(!1),D={restore:A.useRef(null),delete:A.useRef(null),source:A.useRef(null)};A.useEffect(()=>{c&&(C.setIcon(D.restore.current,"archive-restore"),C.setIcon(D.delete.current,"trash"),C.setIcon(D.source.current,"home"))},[c]),A.useEffect(()=>{if(!s.current||!c.current||s.current.hasChildNodes()&&a.content===d||!r)return;p(a.content),s.current.hasChildNodes()&&s.current.empty();async function k(){var F,B;(F=s.current)==null||F.toggleClass(["markdown-rendered"],!0),await C.MarkdownRenderer.render(t,a.content+`
`,s.current,a.path,r);const j=(B=s.current)==null?void 0:B.querySelectorAll(".internal-link");j==null||j.forEach(R=>{const z=R,H=z.getAttribute("data-href");if(!H)return;t.metadataCache.getFirstLinkpathDest(H,a.path)||R.classList.add("is-unresolved"),z.addEventListener("mouseover",U=>{U.stopPropagation(),t.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:r.containerEl,targetEl:z,linktext:H,sourcePath:z.href})})})}k()},[a.content,c]);const S=async()=>{switch(m.sourceType){case"DAILY":await w1(m.id,m.path);break;case"CANVAS":await D1(m.id,m.path);break;case"MULTI":await v1(m.path);break;case"FILE":await b1(m.id,m.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await Te.deleteMemoById(m.id);else{const k=await Te.hideMemoById(m.id);k&&Te.editMemo(k)}}catch(k){new C.Notice(k.message)}else v()},E=async()=>{try{const k=await Te.unarchiveMemo(m);k&&Te.editMemo(k),o(m.id),new C.Notice(N("RESTORE SUCCEED"))}catch(k){new C.Notice(k.message)}},O=()=>{g&&v(!1)};return w.jsxs("div",{ref:c,className:`memo-wrapper ${"memos-"+m.id}`,onMouseLeave:O,children:[w.jsxs("div",{className:"memo-top-wrapper",children:[w.jsxs("span",{className:"time-text",children:[N("ARCHIVED AT")," ",m.updatedAt]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:k=>{k&&C.setIcon(k,"more-horizontal")},className:"btn more-action-btn"}),w.jsx("div",{className:"more-action-btns-wrapper",children:w.jsxs("div",{className:"more-action-btns-container",children:[w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:D.restore,className:"more-action-item-icon"}),w.jsx("span",{className:"btn restore-btn",onClick:E,children:N("RESTORE")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:D.source,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:S,children:N("SOURCE")})]}),w.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[w.jsx("span",{ref:D.delete,className:"more-action-item-icon"}),w.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:T,children:N(g?"CONFIRM":"DELETE")})]})]})})]})]}),w.jsx("div",{ref:s,className:"memo-content-text"})]})},oK=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:c}=t,d=Et.getQueryById(c);return!!(r||a&&a.from<a.to||o||s||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=Wd(m,v))}if(r){const v=new Set;for(const D of Array.from(m.content.match(Fn)||[])){const T=D.replace(Fn,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match(mr)||[])){const T=D.replace(mr,"$2").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}v.has(r)||(g=!1)}return a&&a.from<a.to&&(Ue.getTimeStampByDate(m.createdAt)<a.from||Ue.getTimeStampByDate(m.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(m.content.match(Fn)!==null||m.content.match(mr)!==null||m.content.match($n)!==null)||o==="LINKED"&&m.content.match(Bu)===null||o==="IMAGED"&&m.content.match(_u)===null||o==="CONNECTED"&&m.content.match(Il)===null)&&(g=!1),s&&!m.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},iK=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=A.useContext(mt),r=af(),[a,o]=A.useState([]),s=$.useRef(null);A.useEffect(()=>{const m=oK({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});o(m),r.setFinish()},[n,s.current,e]);const c=A.useCallback(m=>{o(g=>g.filter(v=>v.id!==m))},[]),d=A.useCallback(m=>{o(g=>g.filter(v=>v.id!==m))},[]),p=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[w.jsxs("div",{className:"section-header-container",children:[w.jsx
${k}`}}}const T=await Te.createThino({content:g,isList:d,type:p});T&&(Te.pushMemo(T),He.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,c=Te.getThinoViaKeyword(s);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:c});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 C.Notice(N("Thino - Failed to start HTTP server, please check the port is available."))}new C.Notice(`${N("Thino - Started HTTP server on port")} ${r}`)},close(){t.close(),new C.Notice(N("Thino - Terminated HTTP server"))}}}const{clipboard:gn}=C.Platform.isDesktop?require("electron"):"";class BQ{constructor(){me(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 BQ;let Hh=null,eI=gn==null?void 0:gn.readText(),tI=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=()=>(Hh||(Hh=setInterval(()=>{_Q(eI,eI=gn==null?void 0:gn.readText())&&Dd.emit("text-changed"),HQ(tI,tI=gn==null?void 0:gn.readImage())&&Dd.emit("image-changed")},500)),gn),gn.stopWatching=()=>(Hh&&clearInterval(Hh),Hh=null,gn));function _Q(e,t){return t&&e!==t}function HQ(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var sI;const sw=(sI=require("electron"))==null?void 0:sI.remote;var lI,uI;const nI=(uI=(lI=require("electron"))==null?void 0:lI.remote)==null?void 0:uI.screen;class YQ{constructor(t,n){me(this,"isRegisted");me(this,"leaf");me(this,"clipboard");me(this,"isScreenTop",!1);me(this,"currentSplitWindow");me(this,"intervalNum");me(this,"allowsCopy",!1);me(this,"plugin");me(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=gn}async onload(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{sw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:N("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&&(sw.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(){sw.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,a,o,s;const t=nI.getCursorScreenPoint(),n
`:" "),d=(this.settings.ShareToThinoWithTextNewline==="append"||this.settings.ShareToThinoWithTextNewline==="both"?`
`:" ")+this.settings.ShareToThinoWithTextAppend;o=c+o+d}const s=await Te.createThino({content:o,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});Te.pushMemo(s)})})})),this.registerEvent(this.app.workspace.on("receive-files-menu",(n,r)=>{n.addItem(a=>{a.setIcon("popup-open").setTitle(N("Insert file as memo content")).onClick(async()=>{let s=r.map(d=>this.app.fileManager.generateMarkdownLink(d,d.path)).join(`
`);if(this.settings.ShareToThinoWithText){const d=this.settings.ShareToThinoWithTextPrepend+(this.settings.ShareToThinoWithTextNewline==="prepend"||this.settings.ShareToThinoWithTextNewline==="both"?`
`:" "),p=(this.settings.ShareToThinoWithTextNewline==="append"||this.settings.ShareToThinoWithTextNewline==="both"?`
`:" ")+this.settings.ShareToThinoWithTextAppend;s=d+s+p}const c=await Te.createThino({content:s,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});Te.pushMemo(c)})})})))}registerCommands(){$g.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),this.addCommand({id:"show-thino-editor",name:N("Show thino editor"),checkCallback:n=>{if(Te.initialized&&Xe.initialized){if(!n){if(!Xe.getState().view){new C.Notice(N("Please open thino first"));return}new fx(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:N("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(wl)&&this.settings.needVerify)return n||Qe.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:N("Copy debug info"),callback:()=>{try{const n=this.app.internalPlugins.plugins["daily-notes"];let r;r={settings:{...this.settings,tokenForVerify:"***"},manifest:this.manifest,platform:C.Platform.resourcePathPrefix},n&&(r={...r,dailyNotePluginInfo:{options:n.instance.options}}),navigator.clipboard.writeText(`\`\`\`json
${JSON.stringify(r,null,2)}
\`\`\``),new C.Notice(N("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"insert-editor",name:N("Insert editor"),checkCallback:n=>{const r=this.app.workspace.getActiveViewOfType(C.MarkdownView);if(r&&r.getViewType()==="markdown")return n||r.editor.replaceSelection("\n```thino\n{\n editor: false\n}\n```\n"),!0}}),this.addCommand({id:"toggle-minimal-thino",name:N("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:N("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:N("ReSync web thinos to local"),callback:()=>{HJ(this.app)}}),this.addCommand({id:"init-thino-sync",name:N("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new C.Notice(N("Please input token first"));return}if(!this.settings.startSync){new C.Notice(N("Please enable sync first"));return}try{await Te.initSync()}catch(a){console.error(a),new C.Notice(N("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:N("Show daily thino"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:N("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:N("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(),Xe.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 rI(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(new rI(this.app,this))}async initMemos(){try{await this.initDailyNotes()}catch(n){console.error(n)}Xe.getState(),Te.getState(),await Te.fetchAllMemos()}async initDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&await Xe.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!C.requireApiVersion("1.2.0")||!this.settings.EnabledLocationList.find(o=>o.value==="CANVAS"))return;const n=o=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{const s=o.canvas.getData(),c=s.nodes.find(d=>d.id===o.id);if(c&&(r(c),o.canvas.setData(s),Te.getMemoById(o.id))){const p=await Te.updateMemo(o.id,c.text,c.thinoType);Te.editMemo(p)}o.canvas.requestSave(!0)},0)},800)},r=o=>{o.createdAt||(o.createdAt=C.moment().format("YYYY-MM-DD HH:mm:ss")),o.updatedAt=C.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 v,D;const o=(v=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:v.view;if(!o||!(o==null?void 0:o.canvas))return!1;const c=((D=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:D.view).canvas.nodes.values(),p=Array.from(c).filter(S=>S.text!==void 0);if(!p||p.length===0)return!1;const m=p[0].child;if(!m)return!1;const g=qh(m.constructor.prototype,{save:S=>function(...T){S.call(this,...T),this.node.isEditing&&n(this.node)}});return this.register(g),!0};this.app.workspace.onLayoutReady(()=>{if(!a()){const o=this.app.workspace.on("layout-change",()=>{a()&&this.app.workspace.offref(o)});this.registerEvent(o)}})}registerLinkOpen(){qh(C.Workspace.prototype,{openLinkText:n=>async function(r,a,o,s,...c){const d=Te.getState().memos;if(d.find(p=>p.id===r||p.id===a)){const p=d.find(m=>m.id===r||m.id===a);$d(p);return}n.call(this,r,a,o,s,...c)}})}registerHoverEvent(){this.registerHoverLinkSo
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
-----END PUBLIC KEY-----`,"RS256");try{const{payload:p}=await cX(o,d),m=JSON.parse(new TextDecoder().decode(p));return!m||m.iss!=="pkmer"||m.type!=="thino"||m.appId!==n?!1:(Xe.setVerifyState(m),!0)}catch(p){console.error(p)}}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 Db(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(_r).length>0||this.settings.MobileAndDesktop==="Mobile"&&C.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&C.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){if(this.app.workspace.getLeavesOfType(_r).length>0){He.setPathname("/daily");return}await this.openMemos(),He.setPathname("/daily")}async openMemos(n="center",r){const a=this.app.workspace;if(a.getLeavesOfType(_r).length>0){const c=a.getLeavesOfType(_r)[0];a.setActiveLeaf(c),a.revealLeaf(c);return}a.detachLeavesOfType(_r);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(!0);break}o&&(await o.setViewState({type:_r}),a.revealLeaf(o));const s=o.view.containerEl.querySelector("textarea");s&&s.focus(),r==null||r()}async searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(_r);if(!(r.length>0)){await this.openMemos(),this.app.workspace.trigger("focus-on-searchbar");return}const a=r[0];n.revealLeaf(a),this.app.workspace.trigger("focus-on-searchbar")}async focusOnEditor(){if(!(this.app.workspace.getLeavesOfType(_r).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(_r);if(!(r.length>0)){new C.Notice(N("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,c;const n=this.app.workspace;if(n.detachLeavesOfType(_r),!this.app.plugins.getPlugin("obsidian-hover-editor")){new C.Notice(N("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:_r}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(s=this.settings)!=null&&s.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((c=a.view.containerEl.querySelector("textarea"))==null||c.focus()))}}class Db extends C.Modal{constructor(n,r){super(n);me(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;this.containerEl.toggleClass("thino-changelog-modal",!0),n.createEl("h2",{text:N("Thino update info")+` version ${this.version}`});try{n.createEl("h3",{text:N("Latest version")});const r=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:N("Previous version")});const a=n.createDiv("prev-change-log"),s=await C.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new C.Component;const[c,d]=this.getLatestVersionContent(s.text);await C.MarkdownRenderer.render(this.app,c,r,"",this.component),await C.MarkdownRenderer.render(this.app,d,a,"",this.component)}catch(r){console.error(r),n.createEl("p",{text:N("Failed to load changelog")}),n.createEl("a",{text:N("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;let s=n.length;a.length>1&&(s=a[1].index||n.length);const c=n.substring(o,s).trim(),d=n.substring(s).trim();return[c,d]}onClose(){var r;const{contentEl:n}=this;n.empty(),(r=this.component)==null||r.unload()}}exports.ChangeLogModal=Db;exports.default=mX;