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.

269 lines
1.4 MiB

7 months ago
"use strict";var N7=Object.defineProperty;var A7=(e,t,n)=>t in e?N7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var De=(e,t,n)=>(A7(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("obsidian"),hS=require("@codemirror/language"),Vg=require("@codemirror/state"),Vl=require("@codemirror/view");function F7(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(r,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var FN={exports:{}},fg={},ON={exports:{}},mn={},wx;function O7(){if(wx)return mn;wx=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"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function y(K){return K===null||typeof K!="object"?null:(K=g&&K[g]||K["@@iterator"],typeof K=="function"?K:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,S={};function I(K,ae,Se){this.props=K,this.context=ae,this.refs=S,this.updater=Se||w}I.prototype.isReactComponent={},I.prototype.setState=function(K,ae){if(typeof K!="object"&&typeof K!="function"&&K!=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,K,ae,"setState")},I.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function M(){}M.prototype=I.prototype;function N(K,ae,Se){this.props=K,this.context=ae,this.refs=S,this.updater=Se||w}var _=N.prototype=new M;_.constructor=N,T(_,I.prototype),_.isPureReactComponent=!0;var k=Array.isArray,R=Object.prototype.hasOwnProperty,L={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function U(K,ae,Se){var je,Re={},Fe=null,Be=null;if(ae!=null)for(je in ae.ref!==void 0&&(Be=ae.ref),ae.key!==void 0&&(Fe=""+ae.key),ae)R.call(ae,je)&&!H.hasOwnProperty(je)&&(Re[je]=ae[je]);var Qe=arguments.length-2;if(Qe===1)Re.children=Se;else if(1<Qe){for(var Ze=Array(Qe),st=0;st<Qe;st++)Ze[st]=arguments[st+2];Re.children=Ze}if(K&&K.defaultProps)for(je in Qe=K.defaultProps,Qe)Re[je]===void 0&&(Re[je]=Qe[je]);return{$$typeof:e,type:K,key:Fe,ref:Be,props:Re,_owner:L.current}}function z(K,ae){return{$$typeof:e,type:K.type,key:ae,ref:K.ref,props:K.props,_owner:K._owner}}function $(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function X(K){var ae={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(Se){return ae[Se]})}var Q=/\/+/g;function se(K,ae){return typeof K=="object"&&K!==null&&K.key!=null?X(""+K.key):ae.toString(36)}function ue(K,ae,Se,je,Re){var Fe=typeof K;(Fe==="undefined"||Fe==="boolean")&&(K=null);var Be=!1;if(K===null)Be=!0;else switch(Fe){case"string":case"number":Be=!0;break;case"object":switch(K.$$typeof){case e:case t:Be=!0}}if(Be)return Be=K,Re=Re(Be),K=je===""?"."+se(Be,0):je,k(Re)?(Se="",K!=null&&(Se=K.replace(Q,"$&/")+"/"),ue(Re,ae,Se,"",function(st){return st})):Re!=null&&($(Re)&&(Re=z(Re,Se+(!Re.key||Be&&Be.key===Re.key?"":(""+Re.key).replace(Q,"$&/")+"/")+K)),ae.push(Re)),1;if(Be=0,je=je===""?".":je+":",k(K))for(var Qe=0;Qe<K.length;Qe++){Fe=K[Qe];var Ze=je+se(Fe,Qe);Be+=ue(Fe,ae,Se,Ze,Re)}else if(Ze=y(K),typeof Ze=="function")for(K=Ze.call(K),Qe=0;!(Fe=K.next()).done;)Fe=Fe.value,Ze=je+se(Fe,Qe++),Be+=ue(Fe,ae,Se,Ze,Re);else if(Fe==="object")throw ae=String(K),Error("O
`);o.length===0&&await e.vault.adapter.write(uf(e),JSON.stringify({queries:[]},null,2));const i=[];for(let l=0;l<o.length;l++){const c=l,f="Memos";let p="未命名";const g=o[l];let y=C.moment().format("YYYY/MM/DD HH:mm:ss"),w="[]";const T=g.match(/^\d{14,16}/);T&&(y=C.moment(T[0].slice(0,14),"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:ss"));const S=g.match(/\[\{(.+)\}\]/);S&&(w=S[0]);const I=g.match(/\s(.+)\s\[\{/);I&&(p=I[0].slice(1,-3)),i.push({id:c,pinnedAt:"",createdAt:y,updatedAt:y,title:p,querystring:w,userId:f})}await e.vault.adapter.write(uf(e),JSON.stringify({queries:i},null,2))}},cR=async()=>{const{app:e}=Le.getState().dailyNotesState;return await XN(e,uf(e))||await eA(e),await Fp(e)||[]},dR=(e,t)=>({createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:E("Temp Filter"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),fR=async(e,t)=>{const n=await Fp(Le.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 Ev(Le.getState().dailyNotesState.app,n),r};var bw={exports:{}};bw.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.",i="Expected a function",l="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",f=500,p="__lodash_placeholder__",g=1,y=2,w=4,T=1,S=2,I=1,M=2,N=4,_=8,k=16,R=32,L=64,H=128,U=256,z=512,$=30,X="...",Q=800,se=16,ue=1,fe=2,Z=3,pe=1/0,ie=9007199254740991,de=17976931348623157e292,K=NaN,ae=4294967295,Se=ae-1,je=ae>>>1,Re=[["ary",H],["bind",I],["bindKey",M],["curry",_],["curryRight",k],["flip",z],["partial",R],["partialRight",L],["rearg",U]],Fe="[object Arguments]",Be="[object Array]",Qe="[object AsyncFunction]",Ze="[object Boolean]",st="[object Date]",xt="[object DOMException]",tn="[object Error]",_e="[object Function]",Xe="[object GeneratorFunction]",tt="[object Map]",ht="[object Number]",St="[object Null]",Tt="[object Object]",Gt="[object Promise]",_t="[object Proxy]",Vt="[object RegExp]",Xt="[object Set]",dn="[object String]",en="[object Symbol]",Zn="[object Undefined]",kn="[object WeakMap]",Er="[object WeakSet]",pt="[object ArrayBuffer]",Mt="[object DataView]",Jt="[object Float32Array]",on="[object Float64Array]",ln="[object Int8Array]",vr="[object Int16Array]",fr="[object Int32Array]",ha="[object Uint8Array]",jr="[object Uint8ClampedArray]",nr="[object Uint16Array]",Lr="[object Uint32Array]",te=/\b__p \+= '';/g,me=/\b(__p \+=) '' \+/g,Ce=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ye=/&(?:amp|lt|gt|quot|#39);/g,He=/[&<>"']/g,Ke=RegExp(Ye.source),et=RegExp(He.source),kt=/<%-([\s\S]+?)%>/g,Yt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,vn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xr=/^\w*$/,Jn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yr=/[\\^$.*+?()[\]{}|]/g,ta=RegExp(yr.source),Pi=/^\s+/,Nn=/\s/,Aa=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fa=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Oa=/[()=,{}\[\]\/\s]/,ru=/\\(\\)?/g,si=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,li=/\w*$/,Xu=/^[-+]0x[0-9a-f]+$/i,au=/^0b[01]+$/i,us=/^\[object .+?Constructor\]$/,ji=/^0o[0-7]+$/i,cs=/^(?:0|[1-9]\d*)$/,ou=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ds=/($^)/,ec=/['\n\r\u2028\u2029\\]/g,An="\\ud800-\\udfff",na="\\u0300-\\u036f",Zs="\\ufe20-\\ufe2f",qs="\\u20d0-\\u20ff",ui=na+Zs+qs,iu="\\u2700-\\u27bf",Fo="a-z\\xdf-\\xf6\\xf8-\\xff",ho="\\xac\\xb1\\xd7\\xf7",Pa="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fs="\\u2000-\\u206f",Rr=" \\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",Gs="A-Z\\xc0-\\xd6\\xd8-\\xde",Js="\\ufe0e\\ufe0f",Ks=ho+Pa+fs+Rr,po="[']",hs="["+An+"]",ci="["+Ks+"]",mo="["+ui+"]",A="\\d+",Y="["+iu+"]",J="["+Fo+"]",oe="[^"+An+Ks+A+iu+Fo+Gs+
7 months ago
/* [wrapped with `+h+`] */
7 months ago
`)}function H1(d){return an(d)||Jd(d)||!!(vy&&d&&d[vy])}function Vo(d,h){var D=typeof d;return h=h??ie,!!h&&(D=="number"||D!="symbol"&&cs.test(d))&&d>-1&&d%1==0&&d<h}function Fn(d,h,D){if(!Sr(D))return!1;var j=typeof h;return(j=="number"?Zo(D)&&Vo(h,D.length):j=="string"&&h in D)?Ns(D[h],d):!1}function zm(d,h){if(an(d))return!1;var D=typeof d;return D=="number"||D=="symbol"||D=="boolean"||d==null||Di(d)?!0:xr.test(d)||!vn.test(d)||h!=null&&d in Yn(h)}function wt(d){var h=typeof d;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?d!=="__proto__":d===null}function Sl(d){var h=Ud(d),D=G[h];if(typeof D!="function"||!(h in nn.prototype))return!1;if(d===D)return!0;var j=Yd(D);return!!j&&d===j[0]}function Vm(d){return!!Yf&&Yf in d}var $y=cc?ku:fS;function zd(d){var h=d&&d.constructor,D=typeof h=="function"&&h.prototype||Hi;return d===D}function Fc(d){return d===d&&!Sr(d)}function Vd(d,h){return function(D){return D==null?!1:D[d]===h&&(h!==n||d in Yn(D))}}function Wm(d){var h=ye(d,function(j){return D.size===f&&D.clear(),j}),D=h.cache;return h}function Zy(d,h){var D=d[1],j=h[1],V=D|j,ee=V<(I|M|H),ce=j==H&&D==_||j==H&&D==U&&d[7].length<=h[8]||j==(H|U)&&h[7].length<=h[8]&&D==_;if(!(ee||ce))return d;j&I&&(d[2]=h[2],V|=D&I?0:N);var ve=h[3];if(ve){var Te=d[3];d[3]=Te?Om(Te,ve,h[4]):ve,d[4]=Te?_o(d[3],p):h[4]}return ve=h[5],ve&&(Te=d[5],d[5]=Te?wh(Te,ve,h[6]):ve,d[6]=Te?_o(d[5],p):h[6]),ve=h[7],ve&&(d[7]=ve),j&H&&(d[8]=d[8]==null?h[8]:ma(d[8],h[8])),d[9]==null&&(d[9]=h[9]),d[0]=h[0],d[1]=V,d}function qy(d){var h=[];if(d!=null)for(var D in Yn(d))h.push(D);return h}function Gy(d){return yd.call(d)}function Ch(d,h,D){return h=kr(h===n?d.length-1:h,0),function(){for(var j=arguments,V=-1,ee=kr(j.length-h,0),ce=Oe(ee);++V<ee;)ce[V]=j[h+V];V=-1;for(var ve=Oe(h+1);++V<h;)ve[V]=j[V];return ve[h]=D(ce),Cr(d,this,ve)}}function Mh(d,h){return h.length<2?d:So(d,Sa(h,0,-1))}function ia(d,h){for(var D=d.length,j=ma(h.length,D),V=Ha(d);j--;){var ee=h[j];d[j]=Vo(ee,D)?V[ee]:n}return d}function Do(d,h){if(!(h==="constructor"&&typeof d[h]=="function")&&h!="__proto__")return d[h]}var Ms=$m(Br),Oc=fm||function(d,h){return zn.setTimeout(d,h)},kh=$m(dh);function Wo(d,h,D){var j=h+"";return kh(d,B1(j,Ky(Ym(j),D)))}function $m(d){var h=0,D=0;return function(){var j=j1(),V=se-(j-D);if(D=j,V>0){if(++h>=Q)return arguments[0]}else h=0;return d.apply(n,arguments)}}function To(d,h){var D=-1,j=d.length,V=j-1;for(h=h===n?j:h;++D<h;){var ee=Od(D,V),ce=d[ee];d[ee]=d[D],d[D]=ce}return d.length=h,d}var Jy=Wm(function(d){var h=[];return d.charCodeAt(0)===46&&h.push(""),d.replace(Jn,function(D,j,V,ee){h.push(V?ee.replace(ru,"$1"):j||D)}),h});function bi(d){if(typeof d=="string"||Di(d))return d;var h=d+"";return h=="0"&&1/d==-pe?"-0":h}function Dl(d){if(d!=null){try{return vd.call(d)}catch{}try{return d+""}catch{}}return""}function Ky(d,h){return wr(Re,function(D){var j="_."+D[0];h&D[1]&&!al(d,j)&&d.push(j)}),d.sort()}function Zm(d){if(d instanceof nn)return d.clone();var h=new ga(d.__wrapped__,d.__chain__);return h.__actions__=Ha(d.__actions__),h.__index__=d.__index__,h.__values__=d.__values__,h}function Y1(d,h,D){(D?Fn(d,h,D):h===n)?h=1:h=kr(un(h),0);var j=d==null?0:d.length;if(!j||h<1)return[];for(var V=0,ee=0,ce=Oe(pu(j/h));V<j;)ce[ee++]=Sa(d,V,V+=h);return ce}function Nh(d){for(var h=-1,D=d==null?0:d.length,j=0,V=[];++h<D;){var ee=d[h];ee&&(V[j++]=ee)}return V}function qm(){var d=arguments.length;if(!d)return[];for(var h=Oe(d-1),D=arguments[0],j=d;j--;)h[j-1]=arguments[j];return Ro(an(D)?Ha(D):[D],_r(h,1))}var $o=rn(function(d,h){return Vr(d)?$i(d,_r(h,1,Vr,!0)):[]}),wn=rn(function(d,h){var D=zr(h);return Vr(D)&&(D=n),Vr(d)?$i(d,_r(h,1,Vr,!0),Ot(D,2)):[]}),Jr=rn(function(d,h){var D=zr(h);return Vr(D)&&(D=n),Vr(d)?$i(d,_r(h,1,Vr,!0),n,D):[]});function Nr(d,h,D){var j=d==null?0:d.length;return j?(h=D||h===n?1:un(h),Sa(d,h<0?0:h,j)):[]}function sa(d,h,D){var j=d==null?0:d.length;return j?(h=D||h===n?1:un(h),h=j-h,Sa(d,0,h<0?0:h)):[]}function Io(d,h){return d&&d.length?Ec(d,Ot(h,3),!0,!0):[]}function Pc(d,h){return d&&d.length?Ec(d,Ot(h,3),!0):[]}function Ur(d,h,
`;d.replace(mt,function(zt,pn,bn,Ti,xo,Ii){return bn||(bn=Ti),Je+=d.slice(We,Ii).replace(ec,md),pn&&(ve=!0,Je+=`' +
__e(`+pn+`) +
'`),xo&&(Te=!0,Je+=`';
`+xo+`;
__p += '`),bn&&(Je+=`' +
((__t = (`+bn+`)) == null ? '' : __t) +
'`),We=Ii+zt.length,zt}),Je+=`';
`;var Ut=Tn.call(h,"variable")&&h.variable;if(!Ut)Je=`with (obj) {
`+Je+`
8 months ago
}
7 months ago
`;else if(Oa.test(Ut))throw new Qt(l);Je=(Te?Je.replace(te,""):Je).replace(me,"$1").replace(Ce,"$1;"),Je="function("+(Ut||"obj")+`) {
`+(Ut?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(Te?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
7 months ago
`)+Je+`return __p
}`;var cn=gx(function(){return Dn(ee,Nt+"return "+Je).apply(n,ce)});if(cn.source=Je,nS(cn))throw cn;return cn}function Rj(d){return Un(d).toLowerCase()}function _j(d){return Un(d).toUpperCase()}function Bj(d,h,D){if(d=Un(d),d&&(D||h===n))return at(d);if(!d||!(h=hr(h)))return d;var j=yo(d),V=yo(h),ee=Hn(j,V),ce=oa(j,V)+1;return Es(j,ee,ce).join("")}function Hj(d,h,D){if(d=Un(d),d&&(D||h===n))return d.slice(0,Hf(d)+1);if(!d||!(h=hr(h)))return d;var j=yo(d),V=oa(j,yo(h))+1;return Es(j,0,V).join("")}function Yj(d,h,D){if(d=Un(d),d&&(D||h===n))return d.replace(Pi,"");if(!d||!(h=hr(h)))return d;var j=yo(d),V=Hn(j,yo(h));return Es(j,V).join("")}function Uj(d,h){var D=$,j=X;if(Sr(h)){var V="separator"in h?h.separator:V;D="length"in h?un(h.length):D,j="omission"in h?hr(h.omission):j}d=Un(d);var ee=d.length;if(lc(d)){var ce=yo(d);ee=ce.length}if(D>=ee)return d;var ve=D-fu(j);if(ve<1)return j;var Te=ce?Es(ce,0,ve).join(""):d.slice(0,ve);if(V===n)return Te+j;if(ce&&(ve+=Te.length-ve),rS(V)){if(d.slice(ve).search(V)){var We,$e=Te;for(V.global||(V=gd(V.source,Un(li.exec(V))+"g")),V.lastIndex=0;We=V.exec($e);)var Je=We.index;Te=Te.slice(0,Je===n?ve:Je)}}else if(d.indexOf(hr(V),ve)!=ve){var mt=Te.lastIndexOf(V);mt>-1&&(Te=Te.slice(0,mt))}return Te+j}function zj(d){return d=Un(d),d&&Ke.test(d)?d.replace(Ye,fy):d}var Vj=xs(function(d,h,D){return d+(D?" ":"")+h.toUpperCase()}),iS=jm("toUpperCase");function mx(d,h,D){return d=Un(d),h=D?n:h,h===n?M1(d)?F1(d):oc(d):d.match(h)||[]}var gx=rn(function(d,h){try{return Cr(d,n,h)}catch(D){return nS(D)?D:new Qt(D)}}),Wj=Gi(function(d,h){return wr(h,function(D){D=bi(D),Wi(d,D,Ge(d[D],d))}),d});function $j(d){var h=d==null?0:d.length,D=Ot();return d=h?jn(d,function(j){if(typeof j[1]!="function")throw new Bo(i);return[D(j[0]),j[1]]}):[],rn(function(j){for(var V=-1;++V<h;){var ee=d[V];if(Cr(ee[0],this,j))return Cr(ee[1],this,j)}})}function Zj(d){return xy(no(d,g))}function sS(d){return function(){return d}}function qj(d,h){return d==null||d!==d?h:d}var Gj=Iu(),Jj=Iu(!0);function Go(d){return d}function lS(d){return Nd(typeof d=="function"?d:no(d,g))}function Kj(d){return Dc(no(d,g))}function Qj(d,h){return yi(d,no(h,g))}var Xj=rn(function(d,h){return function(D){return gl(D,d,h)}}),e7=rn(function(d,h){return function(D){return gl(d,D,h)}});function uS(d,h,D){var j=xa(h),V=Ba(h,j);D==null&&!(Sr(h)&&(V.length||!j.length))&&(D=h,h=d,d=this,V=Ba(h,xa(h)));var ee=!(Sr(D)&&"chain"in D)||!!D.chain,ce=ku(d);return wr(V,function(ve){var Te=h[ve];d[ve]=Te,ce&&(d.prototype[ve]=function(){var We=this.__chain__;if(ee||We){var $e=d(this.__wrapped__),Je=$e.__actions__=Ha(this.__actions__);return Je.push({func:Te,args:arguments,thisArg:d}),$e.__chain__=We,$e}return Te.apply(d,Ro([this.value()],arguments))})}),d}function t7(){return zn._===this&&(zn._=my),this}function cS(){}function n7(d){return d=un(d),rn(function(h){return wl(h,d)})}var r7=Dh(jn),a7=Dh(ac),o7=Dh(ol);function vx(d){return zm(d)?F(bi(d)):Em(d)}function i7(d){return function(h){return d==null?n:So(d,h)}}var s7=Lm(),l7=Lm(!0);function dS(){return[]}function fS(){return!1}function u7(){return{}}function c7(){return""}function d7(){return!0}function f7(d,h){if(d=un(d),d<1||d>ie)return[];var D=ae,j=ma(d,ae);h=Ot(h),d-=ae;for(var V=Ee(j,h);++D<d;)h(D);return V}function h7(d){return an(d)?jn(d,bi):Di(d)?[d]:Ha(Jy(Un(d)))}function p7(d){var h=++dc;return Un(d)+h}var m7=Sh(function(d,h){return d+h},0),g7=Da("ceil"),v7=Sh(function(d,h){return d/h},1),y7=Da("floor");function w7(d){return d&&d.length?bu(d,Go,gi):n}function b7(d,h){return d&&d.length?bu(d,Ot(h,2),gi):n}function S7(d){return pd(d,Go)}function D7(d,h){return pd(d,Ot(h,2))}function T7(d){return d&&d.length?bu(d,Go,vl):n}function I7(d,h){return d&&d.length?bu(d,Ot(h,2),vl):n}var E7=Sh(function(d,h){return d*h},1),x7=Da("round"),C7=Sh(function(d,h){return d-h},0);function M7(d){return d&&d.length?Ae(d,Go):0}function k7(d,h){return d&&d.length?Ae(d,Ot(h,2)):0}return G.after=le,G.ary=ge,G.assign=_P,G.assignIn=lx,G.assignInWith=h0,G.assignWith=BP,G.at=HP,G.before=Pe,G.bind=Ge,G.bindAll=Wj,G.bindKey=nt,G.c
`);let r="",a=[],o=!1,i=1;for(let l=0;l<n.length;l++){const c=n[l];if(c.startsWith("#")&&/^#{1,6}\s/g.test(c)){if(o&&p0(c)<=p0(t))break;r=c,r===t?(o=!0,i=l+1):o&&p0(c)>p0(t)?a.push(c):(o=!1,a=[])}else o&&a.push(c)}return t?fb.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(`
`),startLine:i}:{content:e,startLine:0}}function D2(e){const t={};for(const n of e)n.parent&&n.parent>0&&(t[n.position.start.line]=n.parent);return t}function hR(e,t,n){var g;const r={},a=(y,w)=>{for(;y[w]!==void 0&&y[w]!==w;)w=y[w];return w},o=ft.getState().app,i=n.split(`
`),l=t+i.length-1,c=(g=o.metadataCache.getFileCache(e))==null?void 0:g.listItems,f={};if(!c)return[];c.forEach(y=>{var S,I;const w=y.position.start.line,T=y.position.end.line;if(w>=t&&T<=l){const M=w-t,N=T-t,_=i.slice(M,N+1),k=_.join(`
`);if(y.parent&&y.parent>0&&(r[y.position.start.line]=y.parent),y.parent&&f[y.parent]){if(w-y.parent===1){const L=(S=i[M])==null?void 0:S.match(/^(\s*)/);L&&(f[y.parent].indent=L[0])}const R=new RegExp("^"+f[y.parent].indent);f[y.parent].content+=`
`+k.split(`
`).map(L=>L==null?void 0:L.replace(R,"")).join(`
`)}else if(y.parent&&f[a(r,y.parent)]){const R=new RegExp("^"+f[a(r,y.parent)].indent);f[a(r,y.parent)].content+=`
`+k.split(`
`).map(L=>L==null?void 0:L.replace(R,"")).join(`
`)}else if(new RegExp(KL).test(k)){f[w]||(f[w]={content:"",blockId:"",indent:""});const R=_.length>1&&((I=_[1])==null?void 0:I.match(/^(\s*)/));R&&(f[w].indent=R[0]),f[w].content=k.split(`
7 months ago
`).map(L=>L==null?void 0:L.replace(f[w].indent,"")).join(`
7 months ago
`),f[w].blockId=y.id}}});const p=Object.keys(f).map(y=>({line:f[y].content,blockId:f[y].blockId||"",index:parseInt(y)}));return e.path.includes("2024-04-07"),p}async function pR(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new C.Notice(E("File not found for the given thino path, is creating a new file")),n=await t.vault.create(e,'{"nodes": [], "edges": []}'),dt.setChangedByMemos(!0)),n}async function mR(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 gR(e){const t=e.split(/\r?\n/),n=[];let r="",a=[],o=0;for(let i=0;i<t.length;i++){const l=t[i];l.startsWith("#")?(r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:i-1}}),r=l,a=[],o=i):a.push(l)}return r&&n.push({header:r,content:a.join(`
`).trim(),pos:{start:o,end:t.length-1}}),n}function vR(e){const t=e.split(/\r?\n/),n=[];let r=!1,a=[],o="";for(let i=0;i<t.length;i++){const l=t[i];l.startsWith("> [!thino]")?(r&&(n.push({metadata:o,content:a.join(`
`).trim()}),a=[]),r=!0,o=l.replace("> [!thino]","").trim()):r&&l.startsWith(">")?a.push(l.replace(/^> /,"")):r&&!l.startsWith(">")&&(r=!1,n.push({metadata:o,content:a.join(`
`).trim()}),a=[],o="")}return r&&n.push({metadata:o,content:a.join(`
`).trim()}),n}const yR=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 wR(e,t){if(!t)return 0;const{vault:n}=Le.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 i;try{i=await n.read(t)}catch(T){console.error(T),i=await n.cachedRead(t)}let l;r!=""&&/{TIME}/g.test(r)&&/{CONTENT}/g.test(r)?l="(-|\\*) (\\[(.{1})\\]\\s)?"+r.replace(/{TIME}/g,"((\\<time\\>)?\\d{1,2}:\\d{2}(\\:\\d{2})?)?").replace(/ {CONTENT}/g,""):l="(-|\\*) (\\[(.{1})\\]\\s)?((\\<time\\>)?\\d{1,2}\\:\\d{2}(\\:\\d{2})?)?";const c=new RegExp(l,"g"),f=(i.match(c)||[]).length,p=new RegExp(a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),g=new RegExp(o.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),y=(i.match(p)||[]).length,w=(i.match(g)||[]).length;return i=null,y||w?f:0}function xx(e,t,n,r,a){var c,f;const o=up(a,"day")||C.moment(a.stat.ctime);let i;const l=hR(a,n,t);for(const p of l){const g=TR(e.DefaultMemoComposition,p.line),y=IR(e.DefaultMemoComposition,p.line),w=ER(p.line);let T=bR(p.line);if(o.hours(parseInt(g)),o.minutes(parseInt(y)),w&&o.seconds(parseInt(w)),!w&&o.seconds(0),/^\s*[-*]\s(\[(.)\])\s/g.test(p.line)){const L=xR(p.line);T=SR(p.line),i=yR(L)}else i="JOURNAL";let S=T.trim().replaceAll(/<br>/g,`
`);const I=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(T),M=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(T),N=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(T),_=(c=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(T))==null?void 0:c[2],k=(f=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(T))==null?void 0:f[2],R=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(T)?"PUBLIC":"PRIVATE";a.path.includes("2024-04-07"),S=S.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,""),p.blockId&&(S=S.replace("^"+(p==null?void 0:p.blockId),"")),r.push({id:o.format("YYYYMMDDHHmmss")+`${p.index}`,content:S.trim(),createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:i,hasId:p.blockId?p.blockId:"",linkId:"",path:a.path,deletedAt:N?C.moment(_,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:M?"ARCHIVED":"NORMAL",visibility:R,pinned:I,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:k})}}function bR(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,"$4")}function SR(e){return DR(e)}const DR=e=>{var r;let t;return t="^(-|\\*|\\d\\.)\\s+\\[.\\]\\s(\\d{1,2}:\\d{2}(:\\d{2})?)\\s([\\w\\W]*)",(r=new RegExp(t,"").exec(e))==null?void 0:r[4]},TR=(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]},IR=(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]},ER=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]},xR=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)/.exec(e))==null?void 0:t[2]},tA=()=>Wg()?!0:(new C.Notice(E("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function nA(e,t){if(!e)return t;const n=Le.getState().dailyNotesState.app||window.app,r=await mR(e,n);let a=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss");await n.fileManager.processFrontMatter(e,o=>{if(o.id||(o.id=ut.randomId(16)),o.createdAt?a=C.moment(o.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?o.createdAt:a:o.createdAt=a,!r.trim())return t;const i=!!o.pinned,l=o.rowStatus&&o.rowStatus==="ARCHIVED",c=!!o.deletedAt,f=o.deletedAt?o.deletedAt:"",p=o.visibility?o.visibility:"PRIVATE",g=o.thinoType?o.thinoType:"JOURNAL",y=o.webId?o.webId:"",w=o.id?o.id:"",T=o.hasId?o.hasId:"",S=o.linkId?o.linkId:"",I=e.path,M="Memo",N="MULTI",_=[];return t.push({id:w,content:r,createdAt:a,updatedAt:a,deletedAt:c?C.moment(f,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:i,rowStatus:l?"ARCHIVED":"NORMAL",visibility:p,thinoType:g,hasId:T,linkId:S,path:I,creatorName:M,sourceType:N,resourceList:_,webId:y}),t})}async function iT(e,t){var w,T,S,I,M,N;if(!e)return t;const{vault:n}=Le.getState().dailyNotesState.app||window.app;let r;try{r=await n.read(e)}catch(_){console.error(_),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"),i=e.path,l="Thino",c="FILE",f="",p="",g=[],y=await gR(r);for(const _ of y){const k=vR(_.content);for(const R of k){const L=R.metadata.match(/\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/g);if(!L)continue;const H=(T=(w=R.metadata.match(/id::([^\]]*)/g))==null?void 0:w[0])==null?void 0:T.replace("id::","");if(!H)continue;const U=L?L[0]:a,z=L?L[0]:o,$=R.metadata.match(/webI
8 months ago
`);){const r=n.indexOf(`
7 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function zR({content:e,isList:t,name:n}){const r=Le.getState().dailyNotesState.settings,a=C.moment(),o=ut.randomId(16),i=(r==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",l=n||`${a.format("YYYYMMDD")}-${o}`,c=`${i}/${l}.md`,f={id:o,content:e,deletedAt:"",path:c,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:"MULTI"},p=ft.getState().app||window.app,{vault:g,fileManager:y}=p,w=g.getAbstractFileByPath(i);(!w||!(w instanceof C.TFolder))&&(new C.Notice(E("Folder not found for the given thino path, is creating a new folder")),await g.createFolder(i)),dt.setChangedByMemos(!0);let T;const S=p.vault.getFileByPath(c);return S?T=await g.create(`${i}/${a.format("YYYYMMDD")}-${o}.md`,e):T=await g.create(c,e),await y.processFrontMatter(T,I=>{I.id=o,I.createdAt=a.format("YYYY/MM/DD HH:mm:ss"),I.updatedAt=a.format("YYYY/MM/DD HH:mm:ss"),I.thinoType=t?"JOURNAL":"TASK-TODO"}),(!n||S)&&(r!=null&&r.SetFileNameAfterCreate)&&p.fileManager.promptForFileRename(T),f}async function VR({content:e,isList:t}){const n=Le.getState().dailyNotesState.settings,r=C.moment(),a=ut.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",i={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"},l=ft.getState().app,{vault:c}=l;let f=c.getAbstractFileByPath(o);(!f||!(f instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),f=await c.create(o,""));let p="";try{p=await c.read(f)||await c.cachedRead(f)}catch(M){console.error(M),new C.Notice(E("Failed to read current daily note, check if it exists."))}const g=p.indexOf(`# ${r.format("YYYY-MM-DD")}`);let y=p.indexOf(`
#`,g+1);y===-1&&(y=p.length);const w=`> [!thino] ${r.format("YYYY/MM/DD HH:mm:ss")} %% [id::${a}] [thinoType::${t?"JOURNAL":"TASK-TODO"}] %%`,T=e.replace(/\n/g,`
> `),S=`
7 months ago
${w}
7 months ago
> ${T}
`;let I;if(g===-1){const M=`# ${r.format("YYYY-MM-DD")}`;I=`${p.substring(0,y)}
${M}${S}
${p.substring(y)}`}else I=`${p.substring(0,y)}${S}${p.substring(y)}`;return setTimeout(async()=>{dt.setChangedByMemos(!0),await c.modify(f,I)},200),i}async function Mx(e){const t=Le.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},i=ft.getState().app,{vault:l}=i;let c=l.getAbstractFileByPath(a);(!c||!(c instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),c=await l.create(a,""));let f="";try{f=await l.read(c)||await l.cachedRead(c)}catch(I){console.error(I),new C.Notice(E("Failed to read current daily note, check if it exists."))}const p=f.indexOf(`# ${n.format("YYYY-MM-DD")}`);let g=f.indexOf(`
#`,p+1);g===-1&&(g=f.length);const y=`> [!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}]`:""} %%`,w=e.content.replace(/\n/g,`
> `),T=`
${y}
7 months ago
> ${w}
7 months ago
`;let S;if(p===-1){const I=`# ${n.format("YYYY-MM-DD")}`;S=`${f.substring(0,g)}
${I}${T}
${f.substring(g)}`}else S=`${f.substring(0,g)}${T}${f.substring(g)}`;return dt.setChangedByMemos(!0),await l.modify(c,S),o}async function WR({content:e,isList:t}){const n=Le.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=C.moment(),o=ut.randomId(16),i={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"},l=ft.getState().app,{vault:c}=l,f=await pR(r,l);if(!f||!(f instanceof C.TFile)){new C.Notice(E("File not found for the given thino path, is creating a new file"));return}const p=await c.read(f),g=JSON.parse(p);if(g.nodes.find(I=>I.id===i.id))return;let w;g.nodes.length>0&&(w=[...g.nodes].reduce((I,M)=>{if(!I.createdAt)return M;const N=C.moment(I.createdAt,"YYYY/MM/DD HH:mm:ss"),_=C.moment(M.createdAt,"YYYY/MM/DD HH:mm:ss");return N.isAfter(_)?I:M}));const T=w?{x:w.x,y:w.y+100,width:w.width,height:w.height}:{x:0,y:0,width:200,height:100};g.nodes.push({...T,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:[]}),dt.setChangedByMemos(!0);const S=JSON.stringify(g,null,2);return await c.modify(f,S),i}async function gS(e,t,n){var se;const{vault:r}=Le.getState().dailyNotesState.app||window.app,a=Le.getState().dailyNotesState.app||window.app,o=Le.getState().dailyNotesState.settings,i=a.vault.getConfig("useTab")===void 0||window.app.vault.getConfig("useTab")===!0,l=i?1:a.vault.getConfig("tabSize"),c=(i?" ":" ").repeat(l),f=e.split(`
7 months ago
`).join(`
7 months ago
`+c),p=n||C.moment(),{DifferentInsertTarget:g,InsertAfterForTask:y,InsertType:w}=o,T=p.format(o.DefaultTimePrefix||"HH:mm"),S=w==="end"?"":t?o.InsertAfter:g&&y||o.InsertAfter,I=a==null?void 0:a.loadLocalStorage("tokenForSync");let M="";try{e&&I&&o.startSync&&(M=(await T2({content:e,thinoType:"DAILY"})).id)}catch(ue){console.error(ue)}const N=t?"- ":"- [ ] ",_=o!=null&&o.DefaultMemoComposition?`${N}${(se=o==null?void 0:o.DefaultMemoComposition)==null?void 0:se.replace(/{TIME}/g,T).replace(/{CONTENT}/g,(f.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(f)?`
7 months ago
`+c:"")+f)}${f.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(f.split(`
7 months ago
`)[f.split(`
7 months ago
`).length-1])&&M?`
`+c:" "}${M?`[webId::${M}]`:""}`:`${N}${T} ${f.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(f)?`
7 months ago
`+c:""}${f}${f.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(f.split(`
7 months ago
`)[f.split(`
7 months ago
`).length-1])&&M?`
`+c:" "}${M?`[webId::${M}]`:""}`,k=Zu(),R=ub(p,k),L="fake"+ut.randomId(16);let H=!1;const U=a.plugins.getPlugin("templater-obsidian");let z;if(R?z=R:(U!=null&&U.templater&&(U!=null&&U.settings.trigger_on_file_creation)&&(be.setWaitingForTemplater({origin:e,date:p,isList:t,id:L,type:"local"}),H=!0),z=await ut.createDailyNoteCheck(p)),!z){new C.Notice(E("Failed to create daily note, check if it exists."));return}if(R||await ft.fechLocalDailyNotes(),U&&(U!=null&&U.templater)&&(U!=null&&U.settings.trigger_on_file_creation)&&H)return dt.setChangedByMemos(!0),{id:L,content:e,deletedAt:"",createdAt:p.format("YYYY/MM/DD HH:mm:ss"),updatedAt:p.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:z.path,hasId:"",linkId:"",webId:M,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"};let $="";try{$=await r.read(z)||await r.cachedRead(z)}catch(ue){console.error(ue),new C.Notice(E("Failed to read current daily note, check if it exists."))}const X=await oA(S,_,$);await r.modify(z,X.content);const Q=X.posNum===-1?iA(X.content).length-(_.split(`
`).length-1)-1:X.posNum+1;return dt.setChangedByMemos(!0),{id:p.format("YYYYMMDDHHmm")+"00"+Q,content:e,deletedAt:"",createdAt:p.format("YYYY/MM/DD HH:mm:ss"),updatedAt:p.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:z.path,hasId:"",linkId:"",webId:M,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function kx(e){const{vault:t}=Le.getState().dailyNotesState.app||window.app,n=Le.getState().dailyNotesState.app||window.app,{DefaultMemoComposition:r,InsertAfter:a,DefaultTimePrefix:o,DifferentInsertTarget:i,InsertAfterForTask:l,InsertType:c,WaitTemplaterToFinishParse:f}=Le.getState().dailyNotesState.settings;let p=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const ue=" [webId::"+e.id+"]";p+=ue}const g=C.moment();if(e.deletedAt){const ue=" [deleted::"+g.format("YYYYMMDDHHmmss")+"]";p+=ue}const y=n.vault.getConfig("useTab")===void 0||n.vault.getConfig("useTab")===!0,w=y?1:n.vault.getConfig("tabSize"),T=(y?" ":" ").repeat(w),S=e.content.split(`
7 months ago
`).join(`
7 months ago
`+T),I=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),M=I.format(o||"HH:mm"),N=e.thinoType?"- [ ] ":"- ",_=r?`${N}${r==null?void 0:r.replace(/{TIME}/g,M).replace(/{CONTENT}/g,(S.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
`+T:"")+S)}${S.split(`
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
`).length-1])&&p.trim()?`
`+T:" "}${p}`:`${N}${M} ${S.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
`+T:""}${S}${S.split(`
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
`).length-1])&&p.trim()?`
`+T:" "}${p}`,k=Zu(),R=ub(I,k),L="fake"+ut.randomId(16);let H=!1;const U=n.plugins.getPlugin("templater-obsidian");let z;if(R?z=R:(U!=null&&U.templater&&(U!=null&&U.settings.trigger_on_file_creation)&&(be.setWaitingForTemplater({origin:e.content,date:I,isList:e.thinoType&&e.thinoType==="JOURNAL",id:L,type:"web"}),H=!0),z=await ut.createDailyNoteCheck(I)),!z){new C.Notice(E("Failed to create daily note, check if it exists.")),new C.Notice(E("Your content has been copied to clipboard, and inserted into the editor. Please try it again")),await navigator.clipboard.writeText(e.content);const ue=n.workspace.getLeavesOfType("thino_view").first();n.workspace.trigger("send-to-thino",e.content,ue);return}if(R||await ft.fechLocalDailyNotes(),U&&(U!=null&&U.templater)&&(U!=null&&U.settings.trigger_on_file_creation)&&H)return dt.setChangedByMemos(!0),{id:L,content:e.content,deletedAt:e.deletedAt??"",createdAt:I.format("YYYY/MM/DD HH:mm:ss"),updatedAt:I.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:z.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.webId||e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY"};let $="";try{$=await t.read(z)||await t.cachedRead(z)}catch(ue){console.error(ue),new C.Notice(E("Failed to read current daily note, check if it exists."))}const X=c==="end"?"":e.thinoType&&i&&l||a,Q=await oA(X,_,$);await t.modify(z,Q.content);const se=Q.posNum===-1?iA(Q.content).length-1:Q.posNum+1;return dt.setChangedByMemos(!0),{id:I.format("YYYYMMDDHHmm")+"00"+se,content:e.content,deletedAt:e.deletedAt??"",createdAt:I.format("YYYY/MM/DD HH:mm:ss"),updatedAt:I.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:z.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function oA(e,t,n){const r=new RegExp(`(s*?)${await YR(e)}(s*?)`),a=UR(n),o=a.findIndex(f=>r.test(f)),i=(e==null?void 0:e.trim())===""?!0:o===-1;i&&console.error("unable to find insert after line in file.");const l=a.slice(o+1).findIndex(f=>/(^#+ |---|^\^[a-zA-Z0-9-]{2,}$)/.test(f)),c=l!==-1;if(c){let f;for(let p=l+o;p>o;p--)if(!/^[\s\n ]*$/.test(a[p])){f=p;break}return f||(f=o),await Nx(t,n,i?-1:f,c)}else return await Nx(t,n,a.length-1,c)}async function Nx(e,t,n,r){if(n<-1)throw new Error("Invalid position");if(n===-1)return{content:`${t}
${e}`,posNum:-1};const a=t.split(`
`),o=a.slice(0,n+1).join(`
`),i=a.slice(n+1).join(`
`),l=i.trim().length>0;return{content:`${o}${!l&&!r||!o.endsWith(`
8 months ago
`)?`
7 months ago
`:""}${e}${(l||r?`
`:"")+i}`,posNum:n}}const iA=e=>e.split(/\r?\n/);async function $R(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}await t.vault.delete(n)}async function ZR(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}const a=(await t.vault.read(n)).split(`
`),o=a.findIndex(c=>c.includes(e.id));if(o===-1){new C.Notice(E("Thino not found"));return}const i=a.findIndex((c,f)=>f>o&&c.trim()==="");i===-1?a.splice(o,a.length-o):a.splice(o,i-o);const l=a.join(`
`);if(!l){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,l)}async function qR(e){const t=Le.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new C.Notice(E("File not found for the given thino path"));return}const r=await t.vault.read(n),a=JSON.parse(r),o=a.nodes,i=o.findIndex(p=>p.id===e.id);if(i===-1){new C.Notice(E("Thino not found"));return}o.splice(i,1);const l=a.edges;l.filter(p=>p.fromNode===e.id||p.toNode===e.id).forEach(p=>{const g=l.findIndex(y=>y.id===p.id);g!==-1&&l.splice(g,1)}),dt.setChangedByMemos(!0);const f=JSON.stringify(a,null,2);await t.vault.modify(n,f)}async function GR(e){tA()||new C.Notice(E("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,metadataCache:n}=Le.getState().dailyNotesState.app,r=e.path,a=t.getAbstractFileByPath(r);if(!a){new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings"));return}const o=await t.read(a),i=o.split(`
`),l=n.getFileCache(a),c=(l==null?void 0:l.listItems)||[],f=parseInt(e.id.slice(14));let p=f;function g(S,I){const M=[];for(const N in I)I[N]===S&&M.push(parseInt(N),...g(parseInt(N),I));return M}const y=D2(c),w=c.find(S=>S.position.start.line===f),T=g(f,y);if(T.length>0){const S=T.map(I=>{const M=c.find(N=>N.position.start.line===I);return M?M.position.end.line:-1});p=Math.max(...S,w.position.end.line)}else p=w.position.end.line;if(!o){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),i.splice(f,p-f+1),await t.modify(a,i.join(`
`))}async function JR(){const{vault:e,metadataCache:t}=Le.getState().dailyNotesState.app,n=Le.getState().dailyNotesState.settings,a=cb()+"/"+n.DeleteFileName+".md",o=[],i=t.getFirstLinkpathDest("",a);if(i instanceof C.TFile){let l=await e.read(i),c=KR(l);if(c.length===0)return o;for(let f=0;f<c.length;f++){const p=c[f];if(/- /.test(p)){const y=QR(p).slice(0,13),w=C.moment(y,"YYYYMMDDHHmmss"),T=e_(c[f]),S=C.moment(T.slice(0,13),"YYYYMMDDHHmmss"),I=XR(c[f]);o.push({id:T,content:I,user_id:1,createdAt:w.format("YYYY/MM/DD HH:mm:SS"),updatedAt:w.format("YYYY/MM/DD HH:mm:SS"),deletedAt:S})}else continue}c=null,l=null}return o}const KR=e=>e.split(/\r?\n/),QR=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},XR=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},e_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function t_(e){const t=await Fp(Le.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await Ev(Le.getState().dailyNotesState.app,t)}const n_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await Fp(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 Ev(t,n),a}else{new C.Notice(E("Query not found"));return}},r_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await Fp(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await Ev(t,n);return}else{new C.Notice(E("Query not found"));return}};function a_(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const a=r[1].trim(),o={};a.split(" ").forEach(l=>{const[c,f]=l.slice(1,-1).split("::");o[c]=f});for(const l of Object.keys(t))if(l!=="id"&&l!=="content"){if(l==="rowStatus"&&t.rowStatus==="ARCHIVED"){o.archived="true";continue}else if(l==="rowStatus"&&t.rowStatus==="NORMAL"){delete o.archived;continue}if(l==="deleted"&&t.deleted){const c=C.moment().format("YYYYMMDDHHmmss");o.deleted=c}else typeof t[l]=="boolean"?t[l]?o[l]="true":delete o[l]:t[l]&&(o[l]=t[l])}const i=Object.entries(o).map(([l,c])=>`[${l}::${c}]`).join(" ");return e.replace(n,`%% ${i} %%`)}async function js(e,t){if(!e.sourceType||e.sourceType!=="MULTI")return e;const{vault:n,fileManager:r}=Le.getState().dailyNotesState.app,a=n.getAbstractFileByPath(e.path);if(!a)return e;const o=C.moment();if(await r.processFrontMatter(a,i=>{(t.pinned!==void 0||t.thinoType||t.rowStatus||t.visibility||t.deleted)&&dt.setChangedByMemos(!0),t.id&&(i.id=t.id),t.thinoType&&(i.thinoType=t.thinoType),t.rowStatus&&(i.rowStatus=t.rowStatus),t.visibility&&(i.visibility=t.visibility),t.webId&&(i.webId=t.webId),t.pinned!==void 0&&(i.pinned=t.pinned),t.deleted!==void 0&&(i.deletedAt=t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):""),i.createdAt||(i.createdAt=o.format("YYYY/MM/DD HH:mm:ss")),i.updatedAt=o.format("YYYY/MM/DD HH:mm:ss")}),t.content){const i=await n.read(a);let l=i;const c=t.content.replace(/\$/g,"$$$$");l=i.replace(e.content,c),await n.modify(a,l)}return dt.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:C.moment().format("YYYY/MM/DD HH:mm:ss"),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 jl(e,t){if(!e.sourceType||e.sourceType!=="FILE")return e;const{vault:n}=Le.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(M){console.error(M),o=await n.cachedRead(r)}const i=o.split(/\r?\n/),l=i.findIndex(M=>M.includes(e.id)||e.webId&&M.includes(e.webId)),c=i[l];if(!c)return e;const f=a_(c,t);if(!c)return e;const p=f+`
`,g=i.findIndex((M,N)=>N>l&&M.trim()==="");let y="";g===-1&&(y=i.slice(l+1).join(`
`)),g!==-1&&(y=i.slice(l+1,g).join(`
`));let w=y;t!=null&&t.content&&(w=t.content.split(/\r?\n/).map(k=>"> "+k).join(`
`));const S=(p+w).split(/\r?\n/);i.splice(l,g?g-l:i.length-l,...S);const I=i.join(`
`);return await n.modify(r,I),dt.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:C.moment().format("YYYY/MM/DD HH:mm:ss"),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 Ll(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=Le.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=await n.read(r),o=JSON.parse(a),i=o.nodes.find(f=>f.id===e.id);if(!i)return e;t.content&&(i.text=t.content),t.thinoType&&(i.thinoType=t.thinoType),t.rowStatus&&(i.rowStatus=t.rowStatus),t.visibility&&(i.visibility=t.visibility),t.pinned!==void 0&&(i.pinned=t.pinned),t.webId&&(i.webId=t.webId);const l=C.moment();t.deleted!==void 0&&(i.deletedAt=t.deleted?l.format("YYYY/MM/DD HH:mm:ss"):""),i.updatedAt=l.format("YYYY/MM/DD HH:mm:ss");const c=JSON.stringify(o,null,2);return await n.modify(r,c),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),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?l.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Rl(e,t){var se;tA()||new C.Notice(E("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,metadataCache:r}=Le.getState().dailyNotesState.app,a=Le.getState().dailyNotesState.app,{settings:o}=Le.getState().dailyNotesState,i=e.id.toString().slice(0,14),l=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(i,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(i,"YYYYMMDDHHmmss"),c=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(l,"day"),f=e.path,p=n.getAbstractFileByPath(f)||n.getAbstractFileByPath(e.path);if(!p)return new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings")),e;const y=(await n.read(p)).split(`
`),w=r.getFileCache(p),T=(w==null?void 0:w.listItems)||[];if(T.length===0)return new C.Notice(E("Thino not found")),e;const S=parseInt(e.id.slice(14));let I=S;function M(ue,fe){const Z=[];for(const pe in fe)fe[pe]===ue&&Z.push(parseInt(pe),...M(parseInt(pe),fe));return Z}const N=D2(T),_=T.find(ue=>ue.position.start.line===S);if(!_)return new C.Notice(E("Thino not found")),e;const k=M(S,N);if(k.length>0){const ue=k.map(fe=>{const Z=T.find(pe=>pe.position.start.line===fe);return Z?Z.position.end.line:-1});I=Math.max(...ue,_.position.end.line)}else I=_.position.end.line;const R=y.slice(S,I+1);let L=R.join(`
`);const H=c?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);if(!L)return new C.Notice(E("Thino not found")),e;const U=a.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,z=U?1:a.vault.getConfig("tabSize"),$=(U?" ":" ").repeat(z);let X=H;if(o.DefaultTimePrefix!=="HH:mm"&&(X=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(o.DefaultTimePrefix)),t.content){const ue=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",fe=(e.pinned?" [pinned::true]":"")+(e.deletedAt?` [deleted::${e.deletedAt}]`:"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.webId?" [webId::"+e.webId+"]":""),Z=t.content.trim().split(`
7 months ago
`)[t.content.trim().split(`
7 months ago
`).length-1].trim(),pe=e.hasId&&t.content.trim().split(`
`).length>1&&new RegExp(/(-|\*|\d{1,2}\.)\s/g).test(Z)?" ^"+e.hasId:" ";L=`${ue}${X}${pe}${t.content.trim().split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(t.content)?`
`+$:""}${t.content.trim().split(`
`).join(`
7 months ago
`+$)}${/((-|\*|\d\.|>)\s|```)/g.test(t.content.split(`
7 months ago
`)[t.content.split(`
`).length-1])?`
7 months ago
`+$:" "}${fe.trim()}`}if(t.thinoType){const ue=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";L=L.replace(/^((- \[.\] )|((-|\*) ))/,ue)}if(t.rowStatus){const ue=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";L=L.includes("[archived::")?L.replace(/\[archived::(true|false)\]/,ue):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue}if(t.visibility){const ue='[visibility::"'+t.visibility+'"]';L=L.includes("[visibility::")?L.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,ue):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue}if(t.pinned!==void 0){const ue=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";L=L.includes("[pinned::")?L.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":ue):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue}if(t.webId!==void 0){const ue="[webId::"+t.webId+"]";L=L.includes("[webId::")?L.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":ue):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue}const Q=C.moment();if(t.deleted!==void 0){const ue="[deleted::"+Q.format("YYYYMMDDHHmmss")+"]";t.deleted?(L=L.replace(/\[deleted::([^\]]+)\]/,""),L=L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue):t.deleted===!1&&(L=L.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId&&((se=t.content)==null?void 0:se.split(`
`).length)===1){const ue=" ^"+e.hasId;L=L.trim().replace(/\s\^([0-9a-zA-Z-]+)($|\n)/g,"")+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
7 months ago
`+$:" "}`+ue}return L!==R.join(`
`)?(y.splice(S,I-_.position.start.line+1,L.trim()),await n.modify(p,y.join(`
`)),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),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?Q.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}async function o_(e,t,n){var M;const{vault:r,metadataCache:a}=Le.getState().dailyNotesState.app||window.app,o=r.getFileByPath(e);if(!o)return;const i=((M=a.getFileCache(o))==null?void 0:M.listItems)||[],l=D2(i),c=[],f=r.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,p=f?1:r.getConfig("tabSize"),g=(f?" ":" ").repeat(p);function y(N,_){const k=[];for(const R in _)_[R]===N&&k.push(parseInt(R),...y(parseInt(R),_));return k}const w=C.moment(),T=t.map(N=>{const _=i.find(H=>H.position.start.line===parseInt(N.id.slice(14))),R=y(parseInt(N.id.slice(14)),l).map(H=>{const U=i.find(z=>z.position.start.line===H);return U?U.position.end.line:-1}),L=Math.max(...R,_.position.end.line);return{id:N.id,start:_.position.start.line,end:L}}),I=(await r.read(o)).split(`
`);return T.forEach(N=>{const k=I.slice(N.start,N.end+1).join(`
`),L=k.split(`
`)[k.split(`
`).length-1].trim();let H=k;if(n==="delete"){const U="[deleted::"+w.format("YYYYMMDDHHmmss")+"]";H=H.replace(/\[deleted::([^\]]+)\]/,""),H=k+`${k.split(`
`).length>1&&/```/g.test(L)?`
`+g:" "}`+U}if(n==="restoreFromDelete"&&(H=H.replace(/ ?\[deleted::([^\]]+)\]/,"")),n==="archive"){const U="[archived::true]";H=H.includes("[archived::")?H.replace(/\[archived::(true|false)\]/,U):H+`${H.split(`
`).length>1&&/```/g.test(L)?`
`+g:" "}`+U}n==="restoreFromArchive"&&(H=H.replace(/ ?\[archived::(true|false)\]/,"")),n==="deleteForever"?I.splice(N.start,N.end-N.start+1):I.splice(N.start,N.end-N.start+1,H),c.push({...t.find(U=>U.id===N.id),deletedAt:n==="delete"?w.format("YYYY/MM/DD HH:mm:ss"):"",rowStatus:n==="archive"?"ARCHIVED":"NORMAL"})}),await r.modify(o,I.join(`
`)),dt.setChangedByMemos(!0),c}const i_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Ll(e,{id:e.id,pinned:!0});case"DAILY":return Rl(e,{id:e.id,pinned:!0});case"MULTI":return js(e,{id:e.id,pinned:!0});case"FILE":return jl(e,{id:e.id,pinned:!0})}},s_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Ll(e,{id:e.id,pinned:!1});case"DAILY":return Rl(e,{id:e.id,pinned:!1});case"MULTI":return js(e,{id:e.id,pinned:!1});case"FILE":return jl(e,{id:e.id,pinned:!1})}};var sT;(e=>{async function t(S){return await Cx(S)}e.getMyMemos=t;async function n(S){return await Cx([S])}e.updateSpecificTypeMemo=n;function r(){return JR()}e.getMyDeletedMemos=r;function a(S){const I=be.getMemoById(S);if(I)switch(I==null?void 0:I.sourceType){case"DAILY":return Rl(I,{id:I.id,deleted:!1});case"CANVAS":return Ll(I,{id:I.id,deleted:!1});case"MULTI":return js(I,{id:I.id,deleted:!1});case"FILE":return jl(I,{id:I.id,deleted:!1})}}e.restoreMemo=a;function o(S){return ZR(S)}e.deleteMemoInSingleFile=o;function i(S){return $R(S)}e.deleteMemoInMultiFiles=i;function l(S){return GR(S)}e.deleteMemoInDailyNote=l;function c(S){return qR(S)}e.deleteMemoInCanvas=c;function f(){return cR()}e.getMyQueries=f;async function p(S,I){return await fR(S,I)}e.createQuery=p;function g(S,I,M){return AR(S,I,M)}e.updateQuery=g;function y(S){return t_(S)}e.deleteQueryById=y;function w(S){return n_(S)}e.pinQuery=w;function T(S){return r_(S)}e.unpinQuery=T})(sT||(sT={}));const Ko=sT;var qu={};Object.defineProperty(qu,"__esModule",{value:!0});class kf extends Error{}class l_ extends kf{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class u_ extends kf{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class c_ extends kf{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Ng extends kf{}class sA extends kf{constructor(t){super(`Invalid unit ${t}`)}}class Xi extends kf{}class _c extends kf{constructor(){super("Zone is an abstract class")}}const gt="numeric",Us="short",Mi="long",Dw={year:gt,month:gt,day:gt},lA={year:gt,month:Us,day:gt},d_={year:gt,month:Us,day:gt,weekday:Us},uA={year:gt,month:Mi,day:gt},cA={year:gt,month:Mi,day:gt,weekday:Mi},dA={hour:gt,minute:gt},fA={hour:gt,minute:gt,second:gt},hA={hour:gt,minute:gt,second:gt,timeZoneName:Us},pA={hour:gt,minute:gt,second:gt,timeZoneName:Mi},mA={hour:gt,minute:gt,hourCycle:"h23"},gA={hour:gt,minute:gt,second:gt,hourCycle:"h23"},vA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:Us},yA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:Mi},wA={year:gt,month:gt,day:gt,hour:gt,minute:gt},bA={year:gt,month:gt,day:gt,hour:gt,minute:gt,second:gt},SA={year:gt,month:Us,day:gt,hour:gt,minute:gt},DA={year:gt,month:Us,day:gt,hour:gt,minute:gt,second:gt},f_={year:gt,month:Us,day:gt,weekday:Us,hour:gt,minute:gt},TA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,timeZoneName:Us},IA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,second:gt,timeZoneName:Us},EA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,timeZoneName:Mi},xA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,second:gt,timeZoneName:Mi};class Cv{get type(){throw new _c}get name(){throw new _c}get ianaName(){return this.name}get isUniversal(){throw new _c}offsetName(t,n){throw new _c}formatOffset(t,n){throw new _c}offset(t){throw new _c}equals(t){throw new _c}get isValid(){throw new _c}}let vS=null;class hb extends Cv{static get instance(){return vS===null&&(vS=new hb),vS}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return MA(t,n,r)}formatOffset(t,n){return Rg(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}}let Q0={};function h_(e){return Q0[e]||(Q0[e]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),Q0[e]}const p_={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function m_(e,t){const n=e.format(t).rep
`||te.charAt(et)==="\r"&&te.charAt(et+1)!==`
`)&&(He++,Ke===0&&(Ke=et+1)),et--}var kt=Ye+He,Yt=me-Ke;return Ce[me]={line:kt,lineStart:Ke},{offset:me,line:kt+1,column:Yt+1}}function Q(te){if(!k(te))throw new Error("not a parser: "+te)}function se(te,me){return typeof te=="string"?te.charAt(me):te[me]}function ue(te){if(typeof te!="number")throw new Error("not a number: "+te)}function fe(te){if(typeof te!="function")throw new Error("not a function: "+te)}function Z(te){if(typeof te!="string")throw new Error("not a string: "+te)}var pe=2,ie=3,de=8,K=5*de,ae=4*de,Se=" ";function je(te,me){return new Array(me+1).join(te)}function Re(te,me,Ce){var Ye=me-te.length;return Ye<=0?te:je(Ce,Ye)+te}function Fe(te,me,Ce,Ye){return{from:te-me>0?te-me:0,to:te+Ce>Ye?Ye:te+Ce}}function Be(te,me){var Ce,Ye,He,Ke,et,kt=me.index,Yt=kt.offset,On=1;if(Yt===te.length)return"Got the end of the input";if(L(te)){var vn=Yt-Yt%de,xr=Yt-vn,Jn=Fe(vn,K,ae+de,te.length),yr=f(function(Nn){return f(function(Aa){return Re(Aa.toString(16),2,"0")},Nn)},function(Nn,Aa){var Fa=Nn.length,Zr=[],fo=0;if(Fa<=Aa)return[Nn.slice()];for(var Oa=0;Oa<Fa;Oa++)Zr[fo]||Zr.push([]),Zr[fo].push(Nn[Oa]),(Oa+1)%Aa==0&&fo++;return Zr}(te.slice(Jn.from,Jn.to).toJSON().data,de));Ke=function(Nn){return Nn.from===0&&Nn.to===1?{from:Nn.from,to:Nn.to}:{from:Nn.from/de,to:Math.floor(Nn.to/de)}}(Jn),Ye=vn/de,Ce=3*xr,xr>=4&&(Ce+=1),On=2,He=f(function(Nn){return Nn.length<=4?Nn.join(" "):Nn.slice(0,4).join(" ")+" "+Nn.slice(4).join(" ")},yr),(et=(8*(Ke.to>0?Ke.to-1:Ke.to)).toString(16).length)<2&&(et=2)}else{var ta=te.split(/\r\n|[\n\r\u2028\u2029]/);Ce=kt.column-1,Ye=kt.line-1,Ke=Fe(Ye,pe,ie,ta.length),He=ta.slice(Ke.from,Ke.to),et=Ke.to.toString().length}var Pi=Ye-Ke.from;return L(te)&&(et=(8*(Ke.to>0?Ke.to-1:Ke.to)).toString(16).length)<2&&(et=2),c(function(Nn,Aa,Fa){var Zr,fo=Fa===Pi,Oa=fo?"> ":Se;return Zr=L(te)?Re((8*(Ke.from+Fa)).toString(16),et,"0"):Re((Ke.from+Fa+1).toString(),et," "),[].concat(Nn,[Oa+Zr+" | "+Aa],fo?[Se+je(" ",et)+" | "+Re("",Ce," ")+je("^",On)]:[])},[],He).join(`
`)}function Qe(te,me){return[`
`,"-- PARSING FAILED "+je("-",50),`
8 months ago
7 months ago
`,Be(te,me),`
8 months ago
7 months ago
`,(Ce=me.expected,Ce.length===1?`Expected:
8 months ago
7 months ago
`+Ce[0]:`Expected one of the following:
8 months ago
7 months ago
`+Ce.join(", ")),`
`].join("");var Ce}function Ze(te){return te.flags!==void 0?te.flags:[te.global?"g":"",te.ignoreCase?"i":"",te.multiline?"m":"",te.unicode?"u":"",te.sticky?"y":""].join("")}function st(){for(var te=[].slice.call(arguments),me=te.length,Ce=0;Ce<me;Ce+=1)Q(te[Ce]);return o(function(Ye,He){for(var Ke,et=new Array(me),kt=0;kt<me;kt+=1){if(!(Ke=z(te[kt]._(Ye,He),Ke)).status)return Ke;et[kt]=Ke.value,He=Ke.index}return z(H(He,et),Ke)})}function xt(){var te=[].slice.call(arguments);if(te.length===0)throw new Error("seqMap needs at least one argument");var me=te.pop();return fe(me),st.apply(null,te).map(function(Ce){return me.apply(null,Ce)})}function tn(){var te=[].slice.call(arguments),me=te.length;if(me===0)return Tt("zero alternates");for(var Ce=0;Ce<me;Ce+=1)Q(te[Ce]);return o(function(Ye,He){for(var Ke,et=0;et<te.length;et+=1)if((Ke=z(te[et]._(Ye,He),Ke)).status)return Ke;return Ke})}function _e(te,me){return Xe(te,me).or(St([]))}function Xe(te,me){return Q(te),Q(me),xt(te,me.then(te).many(),function(Ce,Ye){return[Ce].concat(Ye)})}function tt(te){Z(te);var me="'"+te+"'";return o(function(Ce,Ye){var He=Ye+te.length,Ke=Ce.slice(Ye,He);return Ke===te?H(He,Ke):U(Ye,me)})}function ht(te,me){(function(He){if(!(He instanceof RegExp))throw new Error("not a regexp: "+He);for(var Ke=Ze(He),et=0;et<Ke.length;et++){var kt=Ke.charAt(et);if(kt!=="i"&&kt!=="m"&&kt!=="u"&&kt!=="s")throw new Error('unsupported regexp flag "'+kt+'": '+He)}})(te),arguments.length>=2?ue(me):me=0;var Ce=function(He){return RegExp("^(?:"+He.source+")",Ze(He))}(te),Ye=""+te;return o(function(He,Ke){var et=Ce.exec(He.slice(Ke));if(et){if(0<=me&&me<=et.length){var kt=et[0],Yt=et[me];return H(Ke+kt.length,Yt)}return U(Ke,"valid match group (0 to "+et.length+") in "+Ye)}return U(Ke,Ye)})}function St(te){return o(function(me,Ce){return H(Ce,te)})}function Tt(te){return o(function(me,Ce){return U(Ce,te)})}function Gt(te){if(k(te))return o(function(me,Ce){var Ye=te._(me,Ce);return Ye.index=Ce,Ye.value="",Ye});if(typeof te=="string")return Gt(tt(te));if(te instanceof RegExp)return Gt(ht(te));throw new Error("not a string, regexp, or parser: "+te)}function _t(te){return Q(te),o(function(me,Ce){var Ye=te._(me,Ce),He=me.slice(Ce,Ye.index);return Ye.status?U(Ce,'not "'+He+'"'):H(Ce,null)})}function Vt(te){return fe(te),o(function(me,Ce){var Ye=se(me,Ce);return Ce<me.length&&te(Ye)?H(Ce+1,Ye):U(Ce,"a character/byte matching "+te)})}function Xt(te,me){arguments.length<2&&(me=te,te=void 0);var Ce=o(function(Ye,He){return Ce._=me()._,Ce._(Ye,He)});return te?Ce.desc(te):Ce}function dn(){return Tt("fantasy-land/empty")}i.parse=function(te){if(typeof te!="string"&&!L(te))throw new Error(".parse must be called with a string or Buffer as its argument");var me,Ce=this.skip(Er)._(te,0);return me=Ce.status?{status:!0,value:Ce.value}:{status:!1,index:X(te,Ce.furthest),expected:Ce.expected},delete $[te],me},i.tryParse=function(te){var me=this.parse(te);if(me.status)return me.value;var Ce=Qe(te,me),Ye=new Error(Ce);throw Ye.type="ParsimmonError",Ye.result=me,Ye},i.assert=function(te,me){return this.chain(function(Ce){return te(Ce)?St(Ce):Tt(me)})},i.or=function(te){return tn(this,te)},i.trim=function(te){return this.wrap(te,te)},i.wrap=function(te,me){return xt(te,this,me,function(Ce,Ye){return Ye})},i.thru=function(te){return te(this)},i.then=function(te){return Q(te),st(this,te).map(function(me){return me[1]})},i.many=function(){var te=this;return o(function(me,Ce){for(var Ye=[],He=void 0;;){if(!(He=z(te._(me,Ce),He)).status)return z(H(Ce,Ye),He);if(Ce===He.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");Ce=He.index,Ye.push(He.value)}})},i.tieWith=function(te){return Z(te),this.map(function(me){if(function(He){if(!R(He))throw new Error("not an array: "+He)}(me),me.length){Z(me[0]);for(var Ce=me[0],Ye=1;Ye<me.length;Ye++)Z(me[Ye]),Ce+=te+me[Ye];return Ce}return""})},i.tie=function(){return this.tieWith("")},i.times=function(te,me){var Ce=this;return arguments.length<2&&(me=te),ue(te),
`),jr=tt(`\r
`),nr=tn(jr,ha,fr).desc("newline"),Lr=tn(nr,Er);o.all=kn,o.alt=tn,o.any=Zn,o.cr=fr,o.createLanguage=function(te){var me={};for(var Ce in te)({}).hasOwnProperty.call(te,Ce)&&function(Ye){me[Ye]=Xt(function(){return te[Ye](me)})}(Ce);return me},o.crlf=jr,o.custom=function(te){return o(te(H,U))},o.digit=pt,o.digits=Mt,o.empty=dn,o.end=Lr,o.eof=Er,o.fail=Tt,o.formatError=Qe,o.index=en,o.isParser=k,o.lazy=Xt,o.letter=Jt,o.letters=on,o.lf=ha,o.lookahead=Gt,o.makeFailure=U,o.makeSuccess=H,o.newline=nr,o.noneOf=function(te){return Vt(function(me){return te.indexOf(me)<0}).desc("none of '"+te+"'")},o.notFollowedBy=_t,o.of=St,o.oneOf=function(te){for(var me=te.split(""),Ce=0;Ce<me.length;Ce++)me[Ce]="'"+me[Ce]+"'";return Vt(function(Ye){return te.indexOf(Ye)>=0}).desc(me)},o.optWhitespace=ln,o.Parser=o,o.range=function(te,me){return Vt(function(Ce){return te<=Ce&&Ce<=me}).desc(te+"-"+me)},o.regex=ht,o.regexp=ht,o.sepBy=_e,o.sepBy1=Xe,o.seq=st,o.seqMap=xt,o.seqObj=function(){for(var te,me={},Ce=0,Ye=(te=arguments,Array.prototype.slice.call(te)),He=Ye.length,Ke=0;Ke<He;Ke+=1){var et=Ye[Ke];if(!k(et)){if(R(et)&&et.length===2&&typeof et[0]=="string"&&k(et[1])){var kt=et[0];if(Object.prototype.hasOwnProperty.call(me,kt))throw new Error("seqObj: duplicate key "+kt);me[kt]=!0,Ce++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(Ce===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(Yt,On){for(var vn,xr={},Jn=0;Jn<He;Jn+=1){var yr,ta;if(R(Ye[Jn])?(yr=Ye[Jn][0],ta=Ye[Jn][1]):(yr=null,ta=Ye[Jn]),!(vn=z(ta._(Yt,On),vn)).status)return vn;yr&&(xr[yr]=vn.value),On=vn.index}return z(H(On,xr),vn)})},o.string=tt,o.succeed=St,o.takeWhile=function(te){return fe(te),o(function(me,Ce){for(var Ye=Ce;Ye<me.length&&te(se(me,Ye));)Ye++;return H(Ye,me.slice(Ce,Ye))})},o.test=Vt,o.whitespace=vr,o["fantasy-land/empty"]=dn,o["fantasy-land/of"]=St,o.Binary={bitSeq:w,bitSeqObj:function(te){y();var me={},Ce=0,Ye=f(function(Ke){if(R(Ke)){var et=Ke;if(et.length!==2)throw new Error("["+et.join(", ")+"] should be length 2, got length "+et.length);if(Z(et[0]),ue(et[1]),Object.prototype.hasOwnProperty.call(me,et[0]))throw new Error("duplicate key in bitSeqObj: "+et[0]);return me[et[0]]=!0,Ce++,et}return ue(Ke),[null,Ke]},te);if(Ce<1)throw new Error("bitSeqObj expects at least one named pair, got ["+te.join(", ")+"]");var He=f(function(Ke){return Ke[0]},Ye);return w(f(function(Ke){return Ke[1]},Ye)).map(function(Ke){return c(function(et,kt){return kt[0]!==null&&(et[kt[0]]=kt[1]),et},{},f(function(et,kt){return[et,Ke[kt]]},He))})},byte:function(te){if(y(),ue(te),te>255)throw new Error("Value specified to byte constructor ("+te+"=0x"+te.toString(16)+") is larger in value than a single byte.");var me=(te>15?"0x":"0x0")+te.toString(16);return o(function(Ce,Ye){var He=se(Ce,Ye);return He===te?H(Ye+1,He):U(Ye,me)})},buffer:function(te){return T("buffer",te).map(function(me){return Buffer.from(me)})},encodedString:function(te,me){return T("string",me).map(function(Ce){return Ce.toString(te)})},uintBE:I,uint8BE:I(1),uint16BE:I(2),uint32BE:I(4),uintLE:M,uint8LE:M(1),uint16LE:M(2),uint32LE:M(4),intBE:N,int8BE:N(1),int16BE:N(2),int32BE:N(4),intLE:_,int8LE:_(1),int16LE:_(2),int32LE:_(4),floatBE:T("floatBE",4).map(function(te){return te.readFloatBE(0)}),floatLE:T("floatLE",4).map(function(te){return te.readFloatLE(0)}),doubleBE:T("doubleBE",8).map(function(te){return te.readDoubleBE(0)}),doubleLE:T("doubleLE",8).map(function(te){return te.readDoubleLE(0)})},n.exports=o}])})})(he);var j2=()=>/(?:[#*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\u26F
8 months ago
${e}`,posNum:-1};const r=t.split(`
7 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}
7 months ago
${o}`,posNum:n}:{content:`${a}
8 months ago
${e}
7 months ago
${o}`,posNum:n}}function xH(e,t,n){var a;const r=t.workspace.getLeavesOfType("markdown");for(const o of r){const i=o.view;if(((a=i==null?void 0:i.file)==null?void 0:a.path)===e){t.workspace.revealLeaf(o);try{return o.view.setEphemeralState({line:n}),!0}catch(l){return console.error(l),!1}}}return!1}const R2=async e=>{var o;const t=ft.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const i of n){const l=i.view;if(((o=l==null?void 0:l.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(i);return}}const r=t.metadataCache.getFirstLinkpathDest("",e);if(!r){new C.Notice(E("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},_2=async(e,t)=>{const{app:n}=ft.getState(),r=parseInt(e.slice(14));if(xH(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}})}},B2=async(e,t)=>{var f,p,g;const n=ft.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(E("File not found for the given thino path"));return}let a="";try{a=await n.vault.read(r)}catch(y){console.error(y),a=await n.vault.cachedRead(r)}const i=a.split(/\r?\n/).findIndex(y=>y.contains(e)),l=n.workspace.getLeavesOfType("markdown");for(const y of l){const w=y.view;if(((f=w==null?void 0:w.file)==null?void 0:f.path)===r.path){n.workspace.revealLeaf(y);try{(p=y.view.editor)==null||p.setCursor({line:i,ch:1});return}catch(T){console.error(T)}}}const c=n.workspace.getLeaf(!0);await c.openFile(r,{eState:{line:i}});try{(g=c.view.editor)==null||g.setCursor({line:i,ch:1})}catch(y){console.error(y)}},H2=async(e,t)=>{var l;const n=ft.getState().app,r=(c,f)=>{var g;const p=(g=Array.from(c.nodes.values()))==null?void 0:g.find(y=>y.id===f);return p?(c.selectOnly(p),c.zoomToSelection(),!0):!1},a=n.workspace.getLeavesOfType("canvas");for(const c of a){const f=c.view;if(((l=f==null?void 0:f.file)==null?void 0:l.path)===t&&(n.workspace.revealLeaf(c),r(f.canvas,e)))return}const o=n.metadataCache.getFirstLinkpathDest("",t);if(!o){new C.Notice(E("File not found for the given thino path"));return}const i=n.workspace.getLeaf(!0);await i.openFile(o),setTimeout(()=>{var c;r((c=i.view)==null?void 0:c.canvas,e)},10)};class CH{constructor(){De(this,"initialized",!1)}getState(){return Le.getState().memoState}async fetchAllMemos(){const t=ft.getState().settings;ut.checkDailyInMulti(t);const n=await Ko.getMyMemos(t.EnabledLocationList.map(o=>o.value)),r=[...n.memos],a=[...n.commentMemos];return Le.dispatch({type:"SET_MEMOS",payload:{memos:r}}),Le.dispatch({type:"SET_COMMENT_MEMOS",payload:{commentMemos:a}}),this.initialized||(this.initialized=!0,dt.setLoaded(!0)),r}async updateTypeMemos(t){const n=await Ko.updateSpecificTypeMemo(t),r=this.getState().memos.filter(a=>a.sourceType!==t);Le.dispatch({type:"SET_MEMOS",payload:{memos:[...r,...n.memos]}})}async removeTypeMemos(t){const n=this.getState().memos.filter(r=>r.sourceType!==t);Le.dispatch({type:"SET_MEMOS",payload:{memos:[...n]}})}async fetchDeletedMemos(){const t=await Ko.getMyDeletedMemos();return t.sort((n,r)=>ut.getTimeStampByDate(r.deletedAt)-ut.getTimeStampByDate(n.deletedAt)),t}pushMemo(t){Le.dispatch({type:"INSERT_MEMO",payload:{memo:{...t}}})}pushCommentMemo(t){Le.dispatch({type:"INSERT_COMMENT_MEMO",payload:{memo:{...t}}})}getMemoById(t){for(const n of this.getState().memos)if(n.id===t)return n;return null}getCommentMemoById(t){for(const n of this.getState().commentMemos)if(n.id===t)return n;return null}getMemoByWebId(t){for(const n of this.getState().memos)if(n.webId===t||n.id===t)return n;return null}async finishWaitingForTemplaterThinos(){const t=this.getState().preparingUpdateMemo;if(t.length!==0)for(const n of t){const r=this.getMemoById(n.id),a=n.type==="local"?await gS(n.origin,n.isList,n.date):await kx(r);await this.replaceOldThinoWithNewThino(n.id,a),Le.dispatch({type:"REMOVE_PARTICULAR_PREPARE_UPDATE_THINO",payload:{id:n.id}})}}async replaceOldThinoWithNewThi
`+ae+s}var je=!1;function Re(s,u){if(!s||je)return"";je=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Pe){var b=Pe}Reflect.construct(s,[],u)}else{try{u.call()}catch(Pe){b=Pe}s.call(u.prototype)}else{try{throw Error()}catch(Pe){b=Pe}s()}}catch(Pe){if(Pe&&b&&typeof Pe.stack=="string"){for(var x=Pe.stack.split(`
`),O=b.stack.split(`
`),W=x.length-1,le=O.length-1;1<=W&&0<=le&&x[W]!==O[le];)le--;for(;1<=W&&0<=le;W--,le--)if(x[W]!==O[le]){if(W!==1||le!==1)do if(W--,le--,0>le||x[W]!==O[le]){var ge=`
`+x[W].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=W&&0<=le);break}}}finally{je=!1,Error.prepareStackTrace=m}return(s=s?s.displayName||s.name:"")?Se(s):""}function Fe(s){switch(s.tag){case 5:return Se(s.type);case 16:return Se("Lazy");case 13:return Se("Suspense");case 19:return Se("SuspenseList");case 0:case 2:case 15:return s=Re(s.type,!1),s;case 11:return s=Re(s.type.render,!1),s;case 1:return s=Re(s.type,!0),s;default:return""}}function Be(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case H:return"Fragment";case L:return"Portal";case z:return"Profiler";case U:return"StrictMode";case se:return"Suspense";case ue:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case X:return(s.displayName||"Context")+".Consumer";case $:return(s._context.displayName||"Context")+".Provider";case Q:var u=s.render;return s=s.displayName,s||(s=u.displayName||u.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case fe:return u=s.displayName||null,u!==null?u:Be(s.type)||"Memo";case Z:u=s._payload,s=s._init;try{return Be(s(u))}catch{}}return null}function Qe(s){var u=s.type;switch(s.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=u.render,s=s.displayName||s.name||"",u.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Be(u);case 8:return u===U?"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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function Ze(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function st(s){var u=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function xt(s){var u=st(s)?"checked":"value",m=Object.getOwnPropertyDescriptor(s.constructor.prototype,u),b=""+s[u];if(!s.hasOwnProperty(u)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var x=m.get,O=m.set;return Object.defineProperty(s,u,{configurable:!0,get:function(){return x.call(this)},set:function(W){b=""+W,O.call(this,W)}}),Object.defineProperty(s,u,{enumerable:m.enumerable}),{getValue:function(){return b},setValue:function(W){b=""+W},stopTracking:function(){s._valueTracker=null,delete s[u]}}}}function tn(s){s._valueTracker||(s._valueTracker=xt(s))}function _e(s){if(!s)return!1;var u=s._valueTracker;if(!u)return!0;var m=u.getValue(),b="";return s&&(b=st(s)?s.checked?"true":"false":s.value),s=b,s!==m?(u.setValue(s),!0):!1}function Xe(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function tt(s,u){var m=u.checked;return K({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??s._wrapperState.initialChecked})}function ht(s,u){var m=u.defaultValue==null?"":u.defaultValue,b=u.checked!=null?u.checked:u.defaultChecked;m=Ze(u.value!=null?u.value:m),s._wrapperState={initialChecked:b,initialValue:m,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function St(s,u){u=u.checked,u!=null&&_(s,"checked",u,!1)}function Tt(s,u){St(s,u);var m=Ze(u.value),b=u.type;if(m!=null)b==="number"?(m===0&&s.value===""||s.value!=m)&&(s.value=""+m):s.value!==""+m&&(s.value=""+m);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}u.hasOwnProperty("value")?_t(s,u.type,m):u.hasOwnProperty("defaultValue")&&_t(s,u.type,Ze(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(s.defaultChecked=!!u.defaultChecked)}function Gt(s,u,m){if(u.hasOwnProperty("value")||
`).replace(j1,"")}function Dd(s,u,m){if(u=wy(u),wy(s)!==u&&m)throw Error(n(425))}function qf(){}var Td=null,mu=null;function Id(s,u){return s==="textarea"||s==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var ll=typeof setTimeout=="function"?setTimeout:void 0,Ed=typeof clearTimeout=="function"?clearTimeout:void 0,pc=typeof Promise=="function"?Promise:void 0,Gf=typeof queueMicrotask=="function"?queueMicrotask:typeof pc<"u"?function(s){return pc.resolve(null).then(s).catch(mc)}:ll;function mc(s){setTimeout(function(){throw s})}function pm(s,u){var m=u,b=0;do{var x=m.nextSibling;if(s.removeChild(m),x&&x.nodeType===8)if(m=x.data,m==="/$"){if(b===0){s.removeChild(x),hn(u);return}b--}else m!=="$"&&m!=="$?"&&m!=="$!"||b++;m=x}while(m);hn(u)}function ul(s){for(;s!=null;s=s.nextSibling){var u=s.nodeType;if(u===1||u===3)break;if(u===8){if(u=s.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return s}function by(s){s=s.previousSibling;for(var u=0;s;){if(s.nodeType===8){var m=s.data;if(m==="$"||m==="$!"||m==="$?"){if(u===0)return s;u--}else m==="/$"&&u++}s=s.previousSibling}return null}var gc=Math.random().toString(36).slice(2),Yi="__reactFiber$"+gc,cl="__reactProps$"+gc,wo="__reactContainer$"+gc,Jf="__reactEvents$"+gc,G="__reactListeners$"+gc,vc="__reactHandles$"+gc;function Ui(s){var u=s[Yi];if(u)return u;for(var m=s.parentNode;m;){if(u=m[wo]||m[Yi]){if(m=u.alternate,u.child!==null||m!==null&&m.child!==null)for(s=by(s);s!==null;){if(m=s[Yi])return m;s=by(s)}return u}s=m,m=s.parentNode}return null}function ga(s){return s=s[Yi]||s[wo],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function nn(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Kf(s){return s[cl]||null}var mm=[],yc=-1;function Xa(s){return{current:s}}function Qn(s){0>yc||(s.current=mm[yc],mm[yc]=null,yc--)}function qn(s,u){yc++,mm[yc]=s.current,s.current=u}var dl={},va=Xa(dl),eo=Xa(!1),_a=dl;function wc(s,u){var m=s.type.contextTypes;if(!m)return dl;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===u)return b.__reactInternalMemoizedMaskedChildContext;var x={},O;for(O in m)x[O]=u[O];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=u,s.__reactInternalMemoizedMaskedChildContext=x),x}function to(s){return s=s.childContextTypes,s!=null}function Qf(){Qn(eo),Qn(va)}function Sy(s,u,m){if(va.current!==dl)throw Error(n(168));qn(va,u),qn(eo,m)}function Dy(s,u,m){var b=s.stateNode;if(u=u.childContextTypes,typeof b.getChildContext!="function")return m;b=b.getChildContext();for(var x in b)if(!(x in u))throw Error(n(108,Qe(s)||"Unknown",x));return K({},m,b)}function Ho(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||dl,_a=va.current,qn(va,s),qn(eo,eo.current),!0}function Ty(s,u,m){var b=s.stateNode;if(!b)throw Error(n(169));m?(s=Dy(s,u,_a),b.__reactInternalMemoizedMergedChildContext=s,Qn(eo),Qn(va),qn(va,s)):Qn(eo),qn(eo,m)}var Ds=null,Xf=!1,gm=!1;function Iy(s){Ds===null?Ds=[s]:Ds.push(s)}function gu(s){Xf=!0,Iy(s)}function fl(){if(!gm&&Ds!==null){gm=!0;var s=0,u=ct;try{var m=Ds;for(ct=1;s<m.length;s++){var b=m[s];do b=b(!0);while(b!==null)}Ds=null,Xf=!1}catch(x){throw Ds!==null&&(Ds=Ds.slice(s+1)),cs(Zs,fl),x}finally{ct=u,gm=!1}}return null}var bc=[],ya=0,eh=null,th=0,Yo=[],Uo=0,vu=null,zi=1,Vi="";function yu(s,u){bc[ya++]=th,bc[ya++]=eh,eh=s,th=u}function Ey(s,u,m){Yo[Uo++]=zi,Yo[Uo++]=Vi,Yo[Uo++]=vu,vu=s;var b=zi;s=Vi;var x=32-Rr(b)-1;b&=~(1<<x),m+=1;var O=32-Rr(u)+x;if(30<O){var W=x-x%5;O=(b&(1<<W)-1).toString(32),b>>=W,x-=W,zi=1<<32-Rr(u)+x|m<<x|b,Vi=O+s}else zi=1<<O|m<<x|b,Vi=s}function xd(s){s.return!==null&&(yu(s,1),Ey(s,1,0))}function wu(s){for(;s===eh;)eh=bc[--ya],bc[ya]=null,th=bc[--ya],bc[ya]=null;for(;s===vu;)vu=Yo[--Uo],Yo[Uo]=null,Vi=Yo[--Uo],Yo[Uo]=null,zi=Yo[--Uo],Yo[Uo]=null}var wa=null,bo=null,Xn=!1,pi=null;function Wi(s,u){var m=Eo(5,null,null,0);m.elementType="DELETED",m.stateNode=u,m.return=s,u=s.deletions
Error generating stack: `+O.message+`
`+O.stack}return{value:s,source:u,stack:x,digest:null}}function kc(s,u,m){return{value:s,source:null,stack:m??null,digest:u??null}}function bh(s,u){try{console.error(u.value)}catch(m){setTimeout(function(){throw m})}}var Sh=typeof WeakMap=="function"?WeakMap:Map;function Dh(s,u,m){m=vi(-1,m),m.tag=3,m.payload={element:null};var b=u.value;return m.callback=function(){Fh||(Fh=!0,Jm=b),bh(s,u)},m}function _d(s,u,m){m=vi(-1,m),m.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var x=u.value;m.payload=function(){return b(x)},m.callback=function(){bh(s,u)}}var O=s.stateNode;return O!==null&&typeof O.componentDidCatch=="function"&&(m.callback=function(){bh(s,u),typeof b!="function"&&(Il===null?Il=new Set([this]):Il.add(this));var W=u.stack;this.componentDidCatch(u.value,{componentStack:W!==null?W:""})}),m}function By(s,u,m){var b=s.pingCache;if(b===null){b=s.pingCache=new Sh;var x=new Set;b.set(u,x)}else x=b.get(u),x===void 0&&(x=new Set,b.set(u,x));x.has(m)||(x.add(m),s=$1.bind(null,s,u,m),u.then(s,s))}function Lm(s){do{var u;if((u=s.tag===13)&&(u=s.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return s;s=s.return}while(s!==null);return null}function Bd(s,u,m,b,x){return s.mode&1?(s.flags|=65536,s.lanes=x,s):(s===u?s.flags|=65536:(s.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(u=vi(-1,1),u.tag=2,ml(m,u,1))),m.lanes|=1),s)}var Hy=k.ReactCurrentOwner,Da=!1;function Ya(s,u,m,b){u.child=s===null?Tm(u,null,m,b):vl(u,s.child,m,b)}function Rm(s,u,m,b,x){m=m.render;var O=u.ref;return hl(u,x),b=fh(s,u,m,b,O,x),m=hh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~x,Ji(s,u,x)):(Xn&&m&&xd(u),u.flags|=1,Ya(s,u,b,x),u.child)}function qi(s,u,m,b,x){if(s===null){var O=m.type;return typeof O=="function"&&!ag(O)&&O.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(u.tag=15,u.type=O,_m(s,u,O,b,x)):(s=_h(m.type,null,b,u,u.mode,x),s.ref=u.ref,s.return=u,u.child=s)}if(O=s.child,!(s.lanes&x)){var W=O.memoizedProps;if(m=m.compare,m=m!==null?m:vt,m(W,b)&&s.ref===u.ref)return Ji(s,u,x)}return u.flags|=1,s=Ml(O,b),s.ref=u.ref,s.return=u,u.child=s}function _m(s,u,m,b,x){if(s!==null){var O=s.memoizedProps;if(vt(O,b)&&s.ref===u.ref)if(Da=!1,u.pendingProps=b=O,(s.lanes&x)!==0)s.flags&131072&&(Da=!0);else return u.lanes=s.lanes,Ji(s,u,x)}return Th(s,u,m,b,x)}function Bm(s,u,m){var b=u.pendingProps,x=b.children,O=s!==null?s.memoizedState:null;if(b.mode==="hidden")if(!(u.mode&1))u.memoizedState={baseLanes:0,cachePool:null,transitions:null},qn(Pc,Io),Io|=m;else{if(!(m&1073741824))return s=O!==null?O.baseLanes|m:m,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:s,cachePool:null,transitions:null},u.updateQueue=null,qn(Pc,Io),Io|=s,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=O!==null?O.baseLanes:m,qn(Pc,Io),Io|=b}else O!==null?(b=O.baseLanes|m,u.memoizedState=null):b=m,qn(Pc,Io),Io|=b;return Ya(s,u,x,m),u.child}function Yy(s,u){var m=u.ref;(s===null&&m!==null||s!==null&&s.ref!==m)&&(u.flags|=512,u.flags|=2097152)}function Th(s,u,m,b,x){var O=to(m)?_a:va.current;return O=wc(u,O),hl(u,x),m=fh(s,u,m,b,O,x),b=hh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~x,Ji(s,u,x)):(Xn&&b&&xd(u),u.flags|=1,Ya(s,u,m,x),u.child)}function Uy(s,u,m,b,x){if(to(m)){var O=!0;Ho(u)}else O=!1;if(hl(u,x),u.stateNode===null)Nc(s,u),Sm(u,m,b),Dm(u,m,b,x),b=!0;else if(s===null){var W=u.stateNode,le=u.memoizedProps;W.props=le;var ge=W.context,Pe=m.contextType;typeof Pe=="object"&&Pe!==null?Pe=Ba(Pe):(Pe=to(m)?_a:va.current,Pe=wc(u,Pe));var Ge=m.getDerivedStateFromProps,nt=typeof Ge=="function"||typeof W.getSnapshotBeforeUpdate=="function";nt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(le!==b||ge!==Pe)&&Ny(u,W,b,Pe),pl=!1;var qe=u.memoizedState;W.state=qe,ih(u,b,W,x),ge=u.memoizedState,le!==b||qe!==ge||eo.current||pl?(typeof Ge=="function"&&(bm(u,m,Ge,b),ge=u.memoizedState),(le=pl||lh(u,m,le,b,qe,ge,Pe))?(nt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.component
`)[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 cr(e=!1){return new Promise((t,n)=>{VH(ZH[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=JH(a.toString());return t(e?o:GH(o))})})}const dC={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},KH=e=>{const{dailyNotesState:{app:t,view:n,verifyState:r,settings:a},globalState:{manifest:o,isMobileView:i}}=P.useContext(Lt),l=P.useRef(null),c=P.useRef(null),[f,p]=P.useState((window.app||t).loadLocalStorage("thinoListView")),[g,y]=P.useState(null);P.useEffect(()=>{if(!o||!t)return;const T=t==null?void 0:t.plugins.getPlugin(o.id);y(T),p(T==null?void 0:T.settings.MemoListView),dt.setMemoListView(T==null?void 0:T.settings.MemoListView)},[o,t]),P.useEffect(()=>{if(!t||!n||!g||!g.settings)return;const T=()=>{var I,M;if(n.leaf.height===0)return;const S=(I=g==null?void 0:g.settings)==null?void 0:I.MemoListView;(M=g==null?void 0:g.settings)!=null&&M.SupportSelectOtherView||S==="chat"||S==="moments"||(n.leaf.width>950?(p(S),dt.setMemoListView(S)):n.leaf.width<=950&&(dt.setMemoListView("list"),p("list")))};T(),c.current||(c.current=t.workspace.on("resize",T),n.registerEvent(c.current))},[t,n,g]),P.useEffect(()=>{l&&(C.setIcon(l.current,dC[f||"list"]),dt.setMemoListView(f),C.requireApiVersion("1.4.4")&&C.setTooltip(l.current,E("Switch view")))},[f]);const w=async T=>{var k;const S=!C.Platform.isDesktop&&await((k=window.Capacitor)==null?void 0:k.Plugins.Device.getId()),I=C.Platform.isDesktop?await cr():S.identifier||S.uuid;if(!r||(r==null?void 0:r.appId)!==I){Sn();return}const M=async R=>{dt.setMemoListView(R),g&&(g.settings.MemoListView=R,await g.saveSettings()),p(R)},N=[{view:"list",title:E("List")},{view:"chat",title:E("Chat")},{view:"moments",title:E("Moments")}];(!i||a!=null&&a.SupportSelectOtherView)&&N.push({view:"waterfall",title:E("Waterfall")},{view:"calendar",title:E("Calendar")},{view:"table",title:E("Table")});const _=new C.Menu;N.forEach(({view:R,title:L})=>{_.addItem(H=>{H.setChecked(f===R).setIcon(dC[R]).setTitle(L).onClick(()=>{f!==R&&M(R)})})}),_.showAtMouseEvent(T.nativeEvent)};return v.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:l,onClick:w})},QH=()=>{const e=P.useRef(null);return P.useEffect(()=>{e&&(C.setIcon(e.current,"calendar-check"),C.setTooltip&&C.setTooltip(e.current,E("Daily Memos")))},[e]),v.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{ot.setPathname("/daily")}})},CS=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),fC={initialValue:"",interval:300};class XH{constructor(t,n=fC){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=[CS()],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.pr
8 months ago
7 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},vY=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],b0=function(t){return fY(t).map(function(n){return vY.includes(n)?"\\".concat(n):n}).join("")},yY=function(e){bb(t,e);function t(){return Ov(this,t),wb(this,vp(t).apply(this,arguments))}return yb(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,i=this.props.left||0,l=[],c=[],f=0,p=0,g=this.containerElem.getBoundingClientRect(),y=this.ref.getBoundingClientRect(),w=this.props.textareaRef.getBoundingClientRect(),T=window.getComputedStyle(this.ref),S=parseInt(T.getPropertyValue("margin-top"),10),I=parseInt(T.getPropertyValue("margin-bottom"),10),M=parseInt(T.getPropertyValue("margin-left"),10),N=parseInt(T.getPropertyValue("margin-right"),10),_=S+I+w.top+o+y.height,k=M+N+w.left+i+y.width;k>g.right&&w.left+i>y.width?(p=i-y.width,l.push(Hc.X.LEFT),c.push(Hc.X.RIGHT)):(p=i,l.push(Hc.X.RIGHT),c.push(Hc.X.LEFT)),_>g.bottom&&w.top+o>y.height?(f=o-y.height,l.push(Hc.Y.TOP),c.push(Hc.Y.BOTTOM)):(f=o,l.push(Hc.Y.BOTTOM),c.push(Hc.Y.TOP)),this.props.renderToBody&&(f+=w.top,p+=w.left),this.ref.style.top="".concat(f,"px"),this.ref.style.left="".concat(p,"px"),(r=this.ref.classList).remove.apply(r,c),(a=this.ref.classList).add.apply(a,l)}},{key:"render",value:function(){var r=this,a=this.props,o=a.style,i=a.className,l=a.innerRef,c=a.children,f=a.renderToBody,p=document.body,g=ne.createElement("div",{ref:function(w){r.ref=w,l(w)},className:"rta__autocomplete ".concat(i||""),style:o},c);return f&&p!==null?z2.createPortal(g,p):g}}]),t}(ne.Component),p6=function(e){bb(t,e);function t(n){var r;Ov(this,t),r=wb(this,vp(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=lf.add(Ci.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(lf.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 c=r.textareaRef,f=c.selectionStart,p=c.selectionEnd;return f===p?null:r.state.value.substr(f,p-f)},r.setCaretPosition=function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;r.textareaRef&&(r.textareaRef.focus(),r.textareaRef.setSelectionRange(c,c))},r.getCaretPosition=function(){if(!r.textareaRef)return 0;var c=r.textareaRef.selectionEnd;return c},r._handleCaretChange=function(c){var f=function(){var y=r.getCaretPosition()-1;r.lastTrigger=r.lastTrigger?y:0};if(c.type==="keydown"){var p=c.keyCode||c.which;switch(p){case Ci.UP:case Ci.DOWN:r._isAutocompleteOpen()||f();break;case Ci.LEFT:case Ci.RIGHT:f();break}return}f()},r._onSelect=function(c){var f=r.state,p=f.selectionEnd,g=f.currentTrigger,y=f.value,w=r.props.onItemSelected;if(g){var T=r._getTextToReplace(g);if(!T){r._closeAutocomplete();return}var S=T(c);if(!S){r._closeAutocomplete();return}w&&w({currentTrigger:g,item:c});var I=function($,X,Q){switch($){case"start":return Q;case"next":case"end":return Q+X.length;default:if(!Number.isInteger($))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return $}},M=y.slice(0,p),N=b0(g),_=M.length-M.lastIndexOf(g),k=M.search(new RegExp("(?!".concat(N,")$")
Got "`.concat(String(y),'". Check the implementation for trigger "').concat(c,`"
8 months ago
See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.
7 months ago
`));if(y===null)return null;if(typeof y=="string")return{text:y,caretPosition:pC};if(!y.text&&typeof y.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(c,`"
`));if(!y.caretPosition)throw new Error('Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(c,`"
`));return y}if(typeof g!="string")throw new Error(`Output item should be string
`);return{text:"".concat(c).concat(g).concat(c),caretPosition:pC}}},r._getCurrentTriggerSettings=function(){var c=r.state.currentTrigger;return c?r.props.trigger[c]:null},r._getValuesFromProvider=function(){var c=r.state,f=c.currentTrigger,p=c.actualToken,g=r._getCurrentTriggerSettings();if(!(!f||!g)){var y=g.dataProvider,w=g.component;if(typeof y!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var T=y(p);T instanceof Promise||(T=Promise.resolve(T)),T.then(function(S){if(!Array.isArray(S))throw new Error("Trigger provider has to provide an array!");if(typeof w!="function")throw new Error("Component should be defined!");if(f===r.state.currentTrigger){if(!S.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:S,component:w})}}).catch(function(S){return mC(S.message)})}},r._getSuggestions=function(){var c=r.state,f=c.currentTrigger,p=c.data;return!f||!p||p&&!p.length?null:p},r._createRegExp=function(){var c=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(c).sort(function(f,p){return f<p?1:f>p?-1:0}).map(function(f){return b0(f)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(c).sort(function(f,p){return f<p?1:f>p?-1:0}).map(function(f){return b0(f)}).join("|"),")$"))},r._closeAutocomplete=function(){var c=r.state.currentTrigger;r.escListenerDestroy(),r.setState({data:null,dataLoading:!1,currentTrigger:null},function(){c&&r._onItemHighlightedHandler(null)})},r._cleanUpProps=function(){var c=sY({},r.props),f=["loadingComponent","boundariesElement","containerStyle","minChar","scrollToItem","ref","innerRef","onChange","onCaretPositionChange","className","value","trigger","listStyle","itemStyle","containerStyle","loaderStyle","className","containerClassName","listClassName","itemClassName","loaderClassName","dropdownStyle","dropdownClassName","movePopupAsYouType","textAreaComponent","renderToBody","onItemSelected","onItemHighlighted"];for(var p in c)f.includes(p)&&delete c[p];return c},r._changeHandler=function(c){var f=r.props,p=f.trigger,g=f.onChange,y=f.minChar,w=f.onCaretPositionChange,T=f.movePopupAsYouType,S=r.state,I=S.top,M=S.left,N=c;N||(N=new oY("change",{bubbles:!0}),r.textareaRef.dispatchEvent(N));var _=N.target||r.textareaRef,k=_.selectionEnd,R=_.value;if(r.lastValueBubbledEvent=R,g&&N&&(N.persist&&N.persist(),g(new Proxy(N,{get:function(K,ae,Se){return ae==="target"?_:Reflect.get(K,ae,Se)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:R});var H=function(){var K=nY(_,k),ae=K.top,Se=K.left;r.setState({top:ae-r.textareaRef.scrollTop||0,left:Se})},U=function(K){r.lastTrigger=k-K,r._closeAutocomplete(),H()};if(k<=r.lastTrigger){var z=R.slice(0,k),$=r.tokenRegExp.exec(z);U($?$[0].length:0)}var X=R.slice(r.lastTrigger,k),Q=r.tokenRegExp.exec(X),se=Q&&Q[0],ue=Q&&Q[1]||null,fe=ue?ue.length-1:0,Z=r.tokenRegExpEnding.exec(X);if(Z?U(Z[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!se||se.length<=y+fe)&&(r.state.currentTrigger&&!p[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(ue&&p[ue].afterWhitespace&&!/\s/.test(R[k-se.length-1])&&R[k-se.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&p[r.state.currentTrigger].allowWhitespace){if(Q=new RegExp("".concat(b0(r.state.currentTrigger),".*$")).exec(R.slice(0,k)),se=Q&&Q[0],!se){r._closeAutocomplete();return}ue=Object.keys(p).find(function(de){return de.slice(0,fe+1)===se.slice(0,fe+1)})||null}var pe=se.slice(1);if(ue){(T||I===null&&M===null||r.state.currentTrigger!==ue)&&H(),r.escListenerInit();var ie=r._getTextToReplace(ue);r.setState({selectionEnd:k,currentTrigger:ue,textToReplace:ie,actualToken:pe},function(){try{r._getValuesFromProvider()}catch(de){mC(de.message)}})}},r._selectHandler=function(c){var f=r.props,p=f.onCaretPositionChange,g=f.onSelect;if(p){var y=r.getCaretPosition();p(y)}g&&(c.persist(),g(c))},r._shouldStayOpen=function(c){var f=c.relatedTarget;return f===null&&(f=document.activeElement),!!(r.dropdownRef&&f instanceof Node&&r.dropd
`,Xe.id);else{const St=_e.toPNG(),Tt=new Blob([St],{type:"image/png"}),Gt=new File([Tt],"image.png",{type:"image/png",lastModified:Date.now()});if(!Gt)return;const _t=await de(Gt);_t&&((ht=S.current)==null||ht.insertText(_t+`
`,Xe.id))}})))},[S,l,o]),P.useEffect(()=>{i&&p(i.DefaultPrefix==="List")},[i==null?void 0:i.DefaultPrefix]),P.useEffect(()=>{if(i){if(i.EnabledLocationList.length===1){Q(i.EnabledLocationList[0].value);return}Q(i.MemoSaveLocation||"DAILY")}},[i==null?void 0:i.MemoSaveLocation,i==null?void 0:i.EnabledLocationList]),P.useEffect(()=>{var tt;if(!i||!$.current)return;const _e=(tt=$g.find(ht=>ht.title===X))==null?void 0:tt.icon;C.setIcon($.current,_e),C.requireApiVersion("1.4.4")&&C.setTooltip($.current,E("Thino Save To: ")+X),se.current=X;const Xe=a.manifest;if(Xe){const ht=o==null?void 0:o.plugins.getPlugin(Xe.id);if(ht){if(ht.settings.MemoSaveLocation===X)return;ht.settings.MemoSaveLocation=X,ht.saveSettings()}}},[X,y]),P.useEffect(()=>{S.current&&i.MemoSaveLocation&&Q(i.MemoSaveLocation)},[$,i]),P.useEffect(()=>{if(!S.current||!i||C.Platform.isDesktop||a.globalEditorShown)return;const _e=i.UseButtonToShowEditor&&i.DefaultEditorLocation==="Bottom";if(C.Platform.isDesktop){w(!0);return}if(t&&t==="inline"){w(!0);return}if(w(C.Platform.isMobile&&!_e),!_e||a.memoListView==="chat")return;const Xe=document.body.find(".memolist-scrollview");Xe&&(Xe.onscroll=()=>{if(a.globalEditorShown)return;if(!a.memoListView&&dt.getState().memoListView==="chat"){Xe.onscroll=null;return}const tt=S.current.getContent();C.Platform.isMobile&&_e&&!tt&&w(!1)})},[a.globalEditorShown,t,S]);const ue=()=>{k(!1)};P.useEffect(()=>{var _e,Xe,tt,ht,St,Tt,Gt,_t,Vt;if(o&&(a.markMemoId||(_e=a.editMemoId)!=null&&_e.trim()&&a.editMemoId!==I.current.editMemoId)){const Xt=o.workspace.getLeavesOfType("thino_view");Xt.length>0&&o.workspace.revealLeaf(Xt[0])}if(a.markMemoId){const Xt=`${E("MARK")}: [@THINO](${a.markMemoId})`;(Xe=S.current)==null||Xe.insertText(Xt),(tt=S.current)==null||tt.focus(),dt.setMarkMemoId("");return}if((ht=a.editMemoId)!=null&&ht.trim()&&a.editMemoId!==I.current.editMemoId){const Xt=be.getMemoById(a.editMemoId);if(Xt)switch(p(Xt.thinoType==="JOURNAL"),i.EditorType){case"memos":(St=S.current)==null||St.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Tt=S.current)==null||Tt.focus();break;case"obsidian":(Gt=S.current)==null||Gt.clear(),(_t=S.current)==null||_t.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Vt=S.current)==null||Vt.focus();break}}I.current=a},[a.markMemoId,a.editMemoId]),P.useEffect(()=>{var _e,Xe,tt;!S.current||M||i.EditorType==="memos"&&((_e=S.current)==null||_e.element.addEventListener("paste",fe),(Xe=S.current)==null||Xe.element.addEventListener("drop",Z),(tt=S.current)==null||tt.element.addEventListener("click",pe),N(!0))},[S.current]);const fe=async _e=>{var Xe;if(_e.clipboardData&&_e.clipboardData.files.length>0){_e.preventDefault();const tt=_e.clipboardData.files;for(const ht of tt){const St=await de(ht);St&&((Xe=S.current)==null||Xe.insertText(St))}}},Z=async _e=>{var Xe;if(_e.dataTransfer&&_e.dataTransfer.files.length>0){_e.preventDefault();const tt=_e.dataTransfer.files;for(const ht of tt){const St=await de(ht);St&&((Xe=S.current)==null||Xe.insertText(St))}}},pe=()=>{var _e;Se(((_e=S.current)==null?void 0:_e.element.value)||"")},ie=async(_e,Xe)=>{var St,Tt,Gt;const tt=_e.ctrlKey||_e.metaKey,ht=_e.altKey;if(_e.key==="Escape"&&a.globalEditorShown&&(dt.setGlobalEditorShown(!1),_e.preventDefault()),tt&&_e.key==="Enter"){_e.preventDefault(),_e.stopPropagation(),Xe?(await K((Tt=S.current)==null?void 0:Tt.getContent()),(Gt=S.current)==null||Gt.clear()):await K((St=S.current)==null?void 0:St.element.value);return}if(ht)for(let _t=0;_t<i.EnabledLocationList.length;_t++)_e.key===(_t+1).toString()&&Q(i.EnabledLocationList[_t].value);setTimeout(()=>{var _t;Xe||Se(((_t=S.current)==null?void 0:_t.element.value)||"")})},de=P.useCallback(async _e=>{const{type:Xe}=_e;if(Xe.startsWith("image"))try{return`${await Y2.upload(_e)}`}catch(tt){new C.Notice(tt)}},[]),K=async _e=>{if(!_e||_e.trim()===""){new C.Notice(E("Content cannot be empty"));return}const Xe=ft.getState().settings,tt=Xe==null?void 0:Xe.addTagAutomatically,ht=Xe==null?void 0:Xe.addTagWithNewline,St=Xe==null?void 0:Xe.addTagPosition,Gt=(VU()||[]).filter(dn=>!_e.include
`:""}${_e}`:`${_e} ${ht?`
`:""}${Gt.map(dn=>`#${dn}`).join(" ")}`:_e;await _t(Vt,Xt),D0("")},ae=P.useCallback(()=>{var _e;dt.setEditMemoId(""),(_e=S.current)==null||_e.setContent(""),D0("")},[]),Se=P.useCallback(_e=>{if(D0(_e??""),!S.current)return;const Xe=S.current.getContent(),tt=S.current.element.selectionStart,ht=Xe.slice(0,tt),St=Xe.slice(tt);(ht.endsWith("@")||ht.endsWith("📆"))&&St.startsWith(" ")||(ht.endsWith("@")||ht.endsWith("📆"))&&St===""?(Ze(),k(!0)):k(!1),setTimeout(()=>{var Tt;(Tt=S.current)==null||Tt.focus()})},[i.EditorType]),je=_e=>{if(!S.current||!i)return;_e&&(ue(),p(!1));const Xe=S.current.getContent(),tt=S.current.element.selectionStart,ht=Xe.slice(0,tt),St=Xe.slice(tt),Tt=C.moment(_e);if(ht.endsWith("@"))switch(i.InsertDateFormat){case"Dataview":S.current.element.value=Xe.slice(0,S.current.element.selectionStart-1)+"[due:: "+Tt.format("YYYY-MM-DD")+"]"+St,S.current.element.setSelectionRange(tt+17,tt+17),S.current.focus(),Se(S.current.element.value);break;case"Tasks":S.current.element.value=Xe.slice(0,S.current.element.selectionStart-1)+"📅 "+Tt.format("YYYY-MM-DD")+St,S.current.element.setSelectionRange(tt+11,tt+11),S.current.focus(),Se(S.current.element.value)}else{S.current.element.value=ht+Tt.format("YYYY-MM-DD")+St,S.current.element.setSelectionRange(tt+10,tt+10),S.current.focus(),Se(S.current.element.value);return}},Re=()=>{S.current&&p()},Fe=async()=>{var tt;const _e=!C.Platform.isDesktop&&await((tt=window.Capacitor)==null?void 0:tt.Plugins.Device.getId()),Xe=C.Platform.isDesktop?await cr():_e.identifier||_e.uuid;return!c||(c==null?void 0:c.appId)!==Xe?(Sn(),!1):!0},Be=async _e=>{if(!await Fe())return;const Xe=new C.Menu;i.EnabledLocationList.forEach(Tt=>{Xe.addItem(Gt=>{var _t;Gt.setTitle(E(Tt.value)).setIcon(((_t=$g.find(Vt=>Vt.title===Tt.value))==null?void 0:_t.icon)??"file").setChecked(X===Tt.value).onClick(()=>{Q(Tt.value)})})});let tt=_e.target,ht=null;for(;!tt.hasClass("location-wrapper")&&(ht=tt.parentElement,ht);)tt=ht;const St=tt.getBoundingClientRect();setTimeout(()=>{Xe.showAtPosition({x:St.x,y:St.bottom,width:St.width,left:!1,overlap:!0})},200)},Qe=P.useCallback(()=>{var _e,Xe;if(!(!S.current&&i.EditorType==="memos"))switch(i.EditorType){case"obsidian":(_e=S.current)==null||_e.focus(),(Xe=S.current)==null||Xe.insertTag();break;case"memos":{const tt=S.current.getContent(),ht=S.current.element.selectionStart,St=tt.slice(0,ht),Tt=tt.slice(ht);let Gt=St+"# "+Tt,_t=St.length+1;St.endsWith("#")&&Tt.startsWith(" ")&&(Gt=St.slice(0,St.length-1)+Tt.slice(1),_t=St.length-1),S.current.element.value=Gt,S.current.element.setSelectionRange(_t,_t),S.current.focus();const Vt=new Event("input",{bubbles:!0,cancelable:!0});S.current.element.dispatchEvent(Vt),Se(S.current.element.value)}}},[o]),Ze=P.useCallback(()=>{if(!S.current||!L.current||!i||!o)return;const tt=o.workspace.getLeavesOfType(lo)[0].view.containerEl,ht=280,St=tt.clientWidth,{x:Tt,y:Gt}=WU(S.current.element);let _t,Vt;C.Platform.isMobile?(window.innerWidth-Tt>ht?_t=(Tt+ht+16>St,Tt+18):window.innerWidth-Tt<ht?_t=(Tt+ht+16>St,Tt+34):_t=S.current.element.clientWidth/2,i.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?Vt=Gt+4:i.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?Vt=Gt+19:i.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&(Vt=Gt+36)):(_t=(Tt+ht+16>St,Tt+18),Vt=Gt+34),R(Tt),L.current.style.left=`${_t}px`,L.current.style.top=`${Vt}px`},[i,o]),st=P.useCallback(()=>{const _e=document.createElement("input");document.body.appendChild(_e),_e.type="file",_e.multiple=!1,_e.accept="image/png, image/gif, image/jpeg",_e.onchange=async()=>{var ht;if(!_e.files||_e.files.length===0)return;const Xe=_e.files[0],tt=await de(Xe);tt&&((ht=S.current)==null||ht.insertText(tt)),document.body.removeChild(_e)},_e.click()},[]),xt=!!a.editMemoId,tn=P.useMemo(()=>({className:"memo-editor",inputerType:i.EditorType||"obsidian",modal:r,initialContent:$U(),placeholder:E("What do you think now..."),showConfirmBtn:!0,showCancelBtn:xt,showTools:!0,onConfirmBtnClick:K,onCancelBtnClick:ae,onContentChange:Se}),[xt,i.EditorType]);return v.jsxs(v.Fragment,{ch
`},"")),y+r+I.replace(/ \^\S{6}/g,"")+`
`+M},"");return e.reduce((g,y)=>{const w=t!=null&&t.ShowDate?`- [[${C.moment(y.date,"YYYY-MM-DD").format(n)}]]
`:"",T=p(y.have),S=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?`
`:"";return g+w+T+S},"").replace(/<br>/g,`
`)},JU=[{label:E("Today"),value:C.moment().format("YYYY-MM-DD")},{label:E("Yesterday"),value:C.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:E("Last 7 days"),value:C.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:E("Last 30 days"),value:C.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:E("Last 90 days"),value:C.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:E("Last 180 days"),value:C.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:E("Last 365 days"),value:C.moment().subtract(365,"days").format("YYYY-MM-DD")}],L6=e=>{const{handleValueChange:t,setShownStatus:n}=e;return v.jsxs(v.Fragment,{children:[e.type==="icon"&&v.jsx("div",{className:"quick-date-btn-group",children:JU.map((r,a)=>v.jsx("div",{className:"btn action-btn quick-date-btn",onClick:()=>{t(r.value),n&&n(!1)},children:r.label},a))}),v.jsx(Sb,{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)}})]})},kw=e=>{const{handleValueChange:t}=e,[n,r]=ne.useState(!1),a=ne.useRef(null),o=ne.useRef(null),i=Tb(o.current,a.current,{placement:"bottom-start"});return Pv(a,()=>{r(!1)}),v.jsxs(v.Fragment,{children:[v.jsx("span",{ref:c=>{o.current=c,c&&e.type==="icon"&&C.setIcon(c,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!C.Platform.isMobile&&r(!n),!C.Platform.isMobile&&(i!=null&&i.update)&&(i==null||i.update()),C.Platform.isMobile&&new R6(ft.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"):""}),v.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:i.styles.popper,children:v.jsx(L6,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class R6 extends C.Modal{constructor(n,r,a){super(n);De(this,"root");De(this,"type");De(this,"handleValueChange");this.type=r,this.handleValueChange=a}onOpen(){const{contentEl:n}=this;this.root=Av(n),this.root.render(v.jsx(L6,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const KU=(e,t)=>(e%t+t)%t;class QU{constructor(t,n,r){De(this,"owner");De(this,"values");De(this,"suggestions");De(this,"selectedItem");De(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=KU(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 _6{constructor(t,n){De(this,"inputEl");De(this,"popper");De(this,"scope");De(this,"suggestEl");De(this,"suggest");De(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 QU(this,r,this.scope),this.scope.register([],"Escape",th
`:""}${U}`:`${U} ${R?`
`:""}${_.map(z=>`#${z}`).join(" ")}`),H&&H.content!==U){const z=await be.updateMemo(H.id,U==null?void 0:U.trim());L.push(z)}}L.length>0&&be.editMemoBulk(L),L.length>0&&ot.clearQuery()};return v.jsxs("div",{className:"thino-tag-operation",children:[v.jsx("div",{className:"tag-operation-title",children:E("Tag Bulk Edit")}),v.jsxs("div",{className:"tag-operation-content",children:[r.length>0&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[v.jsx("div",{className:"name",children:E("Exist Tags")}),v.jsx("div",{className:"desc",children:E("Click to remove exist tag")})]}),v.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(N=>v.jsx("div",{className:ar("tag-operation-content-tag",l.includes(N)&&"tag-operation-content-tag-removed"),onClick:()=>{l.includes(N)||c([...l,N]),l.includes(N)&&c(l.filter(_=>_!==N)),o.includes(N)&&i(o.filter(_=>_!==N))},children:N},N))})]}),v.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[v.jsx("div",{className:"name",children:E("Selected Tags")}),v.jsx("div",{className:"desc",children:E("Click to remove selected tag")})]}),v.jsx("div",{className:"tag-operation-content-tags selected-tags",children:o.map(N=>v.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{i(o.filter(_=>_!==N))},children:N},N))}),v.jsx("div",{className:"tag-operation-content-inputer",children:v.jsx("input",{placeholder:E("Input to select exist tag"),ref:T,onKeyDown:N=>{N.key==="Enter"&&S(T.current.value)}})}),v.jsxs("div",{className:"tag-operation-settings",children:[v.jsx("div",{ref:p}),v.jsx("div",{ref:g})]}),v.jsxs("div",{className:"tag-operation-content-btn-group",children:[v.jsx("button",{className:"cancel-btn",onClick:n,children:E("Cancel")}),v.jsx("button",{className:"save-btn",onClick:I,children:E("Save")})]})]})]})},ST=new Map,yf=async(e,t=!0)=>{const{vault:n,metadataCache:r}=ft.getState().app;if(t&&ST.has(e))return Promise.resolve(ST.get(e));if(e.contains("data:image"))return e;let a;const o=await n.adapter.exists(C.normalizePath(e));let i="";try{if(!o&&!/(http|https)/g.test(e)&&!e.includes("data:image")){let l;if(e.startsWith("app://")){const c=C.normalizePath(decodeURIComponent(e).replace(C.Platform.resourcePathPrefix,"").replace(/\?(.*)$/,"").replace(C.normalizePath(app==null?void 0:app.vault.adapter.basePath),""));i=C.normalizePath(decodeURIComponent(c))}else{if(l=r.getFirstLinkpathDest(e,""),!l){new C.Notice(E("File not exist"));return}i=l.path}}else i=e}catch(l){console.error(l)}if(i){if(/(http|https)/g.test(i))if(i.startsWith("http://localhost")){let l=i;l=l.replace("http://localhost/_capacitor_file_",""),l=decodeURIComponent(l).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),l=C.normalizePath(decodeURIComponent(l));const c=await n.adapter.readBinary(l),f=new Uint8Array(c);a=new Blob([f],{type:"image/png"})}else try{const l=await C.requestUrl(e),c=new Uint8Array(l.arrayBuffer);a=new Blob([c],{type:"image/png"})}catch{}else if(i){const l=await n.adapter.readBinary(i),c=new Uint8Array(l);a=new Blob([c],{type:"image/png"})}return a?await az(a,e):""}},az=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;ST.set(t,a),n(a)},r.readAsDataURL(e)}),Fg=async e=>{if(!e.style.backgroundImage.includes("url(")&&!e.style.backgroundImage.includes("http"))return;let t=e.style.backgroundImage.includes("url(")?e.style.backgroundImage.slice(5,-2):e.style.backgroundImage;return t?(t.startsWith("http://localhost")&&(t=t.replace("http://localhost/_capacitor_file_",""),t=decodeURIComponent(t).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),t=C.normalizePath(decodeURIComponent(t))),await yf(t)):void 0},oz=async e=>{var n;return e.getAttribute("src")?(n=e==null?void 0:e.src)!=null&&n.startsWith("http://localhost")?await yf(e.getAttribute("path")||C.normalizePath(e==null?void 0:e.parentElement.getAttribute("src"))):await yf(e.getAttribute("src")):void 0},Zt=mz(),Nw=gz(),B6=vz(),H6=yz(),Qd={copyDefaultStyles:!0,imagePlaceholder:void 0,cach
`)})}function t(){return Promise.resolve(Zt.asArray(document.styleSheets)).then(r).then(n).then(function(o){return o.map(a)});function n(o){return o.filter(function(i){return i.type===CSSRule.FONT_FACE_RULE}).filter(function(i){return Nw.shouldProcess(i.style.getPropertyValue("src"))})}function r(o){const i=[];return o.forEach(function(l){if(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(l),"cssRules"))try{Zt.asArray(l.cssRules||[]).forEach(i.push.bind(i))}catch(c){console.error(`domtoimage: Error while reading CSS rules from ${l.href}`,c.toString())}}),i}function a(o){return{resolve:function(){const l=(o.parentStyleSheet||{}).href;return Nw.inlineAll(o.cssText,l)},src:function(){return o.style.getPropertyValue("src")}}}}}function yz(){return{inlineAll:t,impl:{newImage:e}};function e(n){return{inline:r};function r(a){return Zt.isDataUrl(n.src)?Promise.resolve():Promise.resolve(n.src).then(a||Zt.getAndEncode).then(function(o){return new Promise(function(i){n.onload=i,n.onerror=i,n.src=o})})}}function t(n){if(!Zt.isElement(n))return Promise.resolve(n);return r(n).then(function(){return Zt.isHTMLImageElement(n)?e(n).inline():Promise.all(Zt.asArray(n.childNodes).map(function(a){return t(a)}))});function r(a){const i=["background","background-image"].map(function(l){const c=a.style.getPropertyValue(l),f=a.style.getPropertyPriority(l);return c?Nw.inlineAll(c).then(function(p){a.style.setProperty(l,p,f)}):Promise.resolve()});return Promise.all(i).then(function(){return a})}}}function wz(e,t,n,r){const a=["background-clip"].indexOf(t)>=0;r?(e.setProperty(t,n,r),a&&e.setProperty(`-webkit-${t}`,n,r)):(e.setProperty(t,n),a&&e.setProperty(`-webkit-${t}`,n))}function bz(e,t,n,r,a){const o=yn.impl.options.copyDefaultStyles?Dz(e,t):{},i=a.style;Zt.asArray(n).forEach(function(l){const c=n.getPropertyValue(l),f=o[l],p=r?r.getPropertyValue(l):void 0;if(c!==f||r&&c!==p){const g=n.getPropertyPriority(l);wz(i,l,c,g)}})}let T0=null,aw={};const Sz=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"];function Dz(e,t){const n=l(t),r=c(n);if(aw[r])return aw[r];const a=Tz(),o=f(a.document,n),i=p(a,o);return g(o),aw[r]=i,i;function l(y){const w=[];do{if(y.nodeType===X2){const T=y.tagName;if(w.push(T),Sz.includes(T))break}y=y.parentNode}while(y);return w}function c(y){return e.styleCaching==="relaxed"?y.filter((w,T,S)=>T===0||T===S.length-1).join(">"):y.join(">")}function f(y,w){let T=y.body;do{const S=w.pop(),I=y.createElement(S);T.appendChild(I),T=I}while(w.length>0);return T.textContent="",T}function p(y,w){const T={},S=y.getComputedStyle(w);return Zt.asArray(S).forEach(function(I){T[I]=I==="width"||I==="height"?"auto":S.getPropertyValue(I)}),T}function g(y){do{const w=y.parentElement;w!==null&&w.removeChild(y),y=w}while(y&&y.tagName!=="BODY")}}function Tz(){if(xi)return xi.contentWindow;const e=document.characterSet||"UTF-8",t=document.doctype,n=t?`<!DOCTYPE ${r(t.name)} ${r(t.publicId)} ${r(t.systemId)}`.trim()+">":"";return xi=document.createElement("iframe"),xi.id="domtoimage-sandbox-"+Zt.uid(),xi.className="domtoimage-thino",xi.style.visibility="hidden",xi.style.position="fixed",document.body.appendChild(xi),a(xi,n,e,"domtoimage-sandbox");function r(o){if(o){const i=document.createElement("div");return i.innerText=o,i.innerHTML}else return""}function a(o,i,l,c){try{return o.contentWindow.document.write(`${i}<html><head><meta charset='${l}'><title>${c}</title></head><body></body></html>`),o.contentWindow}catch{}const f=document.createElement("meta");f.setAttribute("charset",l);try{const p=document.implementation.createHTMLDocument(c);p.head.appendChild(f);const g=i+p.documentElement.outerHTML;return o.setAttribute("srcdoc",g),o.contentWindow}catch{}return o.contentDocument.head.appendChild(f),o.contentDocument.title=c,o.contentWindow}}function Iz(){xi&&(document.body.removeChild(xi),xi=null),T0&&clearTi
Before: <div {...getCollapseProps({style: {padding: 10}})}>{children}</div>
After: <div {...getCollapseProps()}>
<div style={{padding: 10}}>
{children}
</div>
</div>`)},P.useEffect(()=>{t(e)},[e])}var Uz=typeof window>"u"?P.useEffect:P.useLayoutEffect;function zz({duration:e,easing:t="cubic-bezier(0.4, 0, 0.2, 1)",onTransitionStateChange:n=()=>{},isExpanded:r,defaultExpanded:a=!1,hasDisabledAnimation:o,id:i,...l}={}){const c=V6(n),f=Rz(i?`${i}`:void 0),[p,g]=kz(r,a),y=P.useRef(p),[w,T]=P.useState(!1),S=Az(),I=o??S,M=P.useRef(),N=P.useRef(),_=P.useRef(null),[k,R]=P.useState(null);Yz(_);const L=`${l.collapsedHeight||0}px`;function H(U){if(!_.current)return;const z=_.current;for(const $ in U){const X=U[$];X?z.style[$]=X:z.style.removeProperty($)}}return Uz(()=>{if(!_.current||p===y.current)return;y.current=p;function z(Q){return I?0:e??Bz(Q)}const $=Q=>`height ${z(Q)}ms ${t}`,X=Q=>{function se(){p?(H({height:"",overflow:"",transition:"",display:""}),c("expandEnd")):(H({transition:""}),c("collapseEnd")),T(!1)}N.current&&OC(N.current),N.current=_z(se,Q)};return T(!0),p?M.current=requestAnimationFrame(()=>{c("expandStart"),H({display:"block",overflow:"hidden",height:L}),M.current=requestAnimationFrame(()=>{c("expanding");const Q=PC(_);X(z(Q)),_.current&&(_.current.style.transition=$(Q),_.current.style.height=`${Q}px`)})}):M.current=requestAnimationFrame(()=>{c("collapseStart");const Q=PC(_);X(z(Q)),H({transition:$(Q),height:`${Q}px`}),M.current=requestAnimationFrame(()=>{c("collapsing"),H({height:L,overflow:"hidden"})})}),()=>{M.current&&cancelAnimationFrame(M.current),N.current&&OC(N.current)}},[p,L,I,e,t,c]),{isExpanded:p,setExpanded:g,getToggleProps(U){const{disabled:z,onClick:$,refKey:X,...Q}={refKey:"ref",onClick(){},disabled:!1,...U},se=k?k.tagName==="BUTTON":void 0,ue=U==null?void 0:U[X||"ref"],fe={id:`react-collapsed-toggle-${f}`,"aria-controls":`react-collapsed-panel-${f}`,"aria-expanded":p,onClick(ie){z||($==null||$(ie),g(de=>!de))},[X||"ref"]:jC(ue,R)},Z={type:"button",disabled:z?!0:void 0},pe={"aria-disabled":z?!0:void 0,role:"button",tabIndex:z?-1:0};return se===!1?{...fe,...pe,...Q}:se===!0?{...fe,...Z,...Q}:{...fe,...Z,...pe,...Q}},getCollapseProps(U){const{style:z,refKey:$}={refKey:"ref",style:{},...U},X=U==null?void 0:U[$||"ref"];return{id:`react-collapsed-panel-${f}`,"aria-hidden":!p,"aria-labelledby":`react-collapsed-toggle-${f}`,role:"region",...U,[$||"ref"]:jC(_,X),style:{boxSizing:"border-box",...!w&&!p?{display:L==="0px"?"none":"block",height:L,overflow:"hidden"}:{},...z}}}}}const Vz=e=>{const{dailyNotesState:{app:t,view:n,settings:r},globalState:{memoListView:a}}=P.useContext(Lt),{getCollapseProps:o,getToggleProps:i,isExpanded:l,setExpanded:c}=zz({defaultExpanded:!0,collapsedHeight:(r==null?void 0:r.ThinoCollapsedHeight)??100}),{memo:f,handleMemoContentClick:p,handleMemoDoubleClick:g}=e,y=ne.useRef(null),[w,T]=ne.useState(""),S=ne.useRef(w),I=ne.useRef(0),[M,N]=ne.useState(!1),[_,k]=ne.useState(!1),R=C.debounce((H,U,z)=>{for(const $ of H){const{height:X}=$.contentRect,Q=(U==null?void 0:U.ThinoMaxHeight)||340,se=X>Q;N(se),c(!se),z.disconnect()}},500);P.useEffect(()=>{var H;if(f.content!==S.current){if(r!=null&&r.OptimizeForCallout&&f.content.split("> [!").length>3&&f.content.split(`
`).length>10&&!_){const U=y.current.createEl("button");U.setText(E("Render content")),U.onclick=async()=>{k(!0),await L()};const z=y.current.createEl("textarea");z.setText(f.content),z.disabled=!0,(H=y.current)==null||H.toggleClass(["raw-content"],!0),c(!0),N(!1);return}L()}},[f.content]),P.useEffect(()=>{_&&I.current!==(r==null?void 0:r.ThinoMaxHeight)&&(y!=null&&y.current.hasChildNodes()&&k(!1),L())},[r==null?void 0:r.ThinoMaxHeight]),P.useEffect(()=>{if(!_)return;const H=y.current;if(!H)return;if(!(r!=null&&r.ThinoMaxHeight)){c(!0),N(!1);return}const U=new ResizeObserver(z=>{R(z,r,U)});return U.observe(H),()=>U.disconnect()},[_]);const L=async()=>{var H,U;y.current&&n&&t&&f.content!==S.current&&(y.current.empty(),await C.MarkdownRenderer.render(t,f.content,y.current,f.path,n),S.current=f.content,(H=y.current)==null||H.toggleClass(["markdown-rendered"],!0),(U=y.current)==null||U.toggleClass(["raw-content"],!1),k&&k(!0),I.current=(r==null?void 0:r.ThinoMaxHeight)||340)};return v.jsxs(v.Fragment,{children:[M&&a==="moments"&&v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"thino-collapse-button",...i({style:{display:"block",marginTop:2}}),children:E(l?"Collapse":"Expand")}),!l&&(r==null?void 0:r.ThinoCollapsedHeight)!==0&&v.jsx("div",{className:"thino-collapse-shadowOverlay",onDoubleClick:g})]}),v.jsx("div",{...o({style:{margin:0}}),ref:y,className:"memo-content-text",onClick:H=>p(H,f),onDoubleClick:g,onContextMenu:H=>{H.preventDefault()}}),M&&a!=="moments"&&v.jsxs(v.Fragment,{children:[!l&&(r==null?void 0:r.ThinoCollapsedHeight)!==0&&v.jsx("div",{className:"thino-collapse-shadowOverlay",onDoubleClick:g}),v.jsx("button",{className:"thino-collapse-button",...i({style:{display:"block",marginTop:2}}),children:E(l?"Collapse":"Expand")})]})]})},W6=P.memo(Vz,(e,t)=>e.memo.content===t.memo.content),Wz=e=>{const[t,n]=P.useState({...e.memo,createdAtStr:ut.getDateTimeString(e.memo.createdAt)}),[r,a]=P.useState([]),[o,i]=P.useState([]);P.useEffect(()=>{(async()=>{try{const g=[],y=[...t.content.matchAll(nd)];for(const T of y)if(T&&T.length===3){const S=T[2],I=be.getMemoById(S);I&&g.push({...I,createdAtStr:ut.getDateTimeString(I.createdAt),dateStr:ut.getDateString(I.createdAt)})}a([...g]);const w=await be.getLinkedMemos(t.id);i(w.sort((T,S)=>ut.getTimeStampByDate(S.createdAt)-ut.getTimeStampByDate(T.createdAt)).map(T=>({...T,createdAtStr:ut.getDateTimeString(T.createdAt),dateStr:ut.getDateString(T.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const l=P.useCallback(async p=>{var y;const g=p.target;if(g.className==="memo-link-text"){const w=(y=g.dataset)==null?void 0:y.value,T=be.getMemoById(w??"");if(T){const S={...T,createdAtStr:ut.getDateTimeString(T.createdAt)};a([]),i([]),n(S)}else new C.Notice(E("Thino not found")),g.classList.remove("memo-link-text")}},[]),c=P.useCallback(p=>{a([]),i([]),n({...p,createdAtStr:ut.getDateTimeString(p.createdAt)})},[t.id]),f=P.useCallback(()=>{e.destroy(),dt.setEditMemoId(t.id)},[t.id]);return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"memo-card-container",children:[v.jsxs("div",{className:"header-container",children:[v.jsx("span",{className:"time-text",children:t.createdAtStr}),v.jsxs("div",{className:"btns-container",children:[v.jsx("button",{ref:p=>{p&&C.setIcon(p,"edit")},className:"btn edit-btn",onClick:f}),v.jsx("button",{ref:p=>{p&&C.setIcon(p,"x")},className:"btn close-btn",onClick:e.destroy})]})]}),v.jsx("div",{className:"memo-container",children:v.jsx("div",{className:"memo-content-text",children:v.jsx(W6,{memo:t,handleMemoContentClick:l,handleMemoDoubleClick:()=>{}})})}),v.jsx("div",{className:"layer-container"})]}),r.length>0?v.jsxs("div",{className:"linked-memos-wrapper",children:[v.jsxs("span",{className:"normal-text",children:[E("LINKED")," ",r.length," THINO"," "]}),r.map(p=>{const g=Tx(oT(p.content)).replaceAll(`
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(p),children:[v.jsxs("span",{className:"time-text",children:[p.dateStr," "]}),g]},p.id)})]}):null,o.length>0?v.jsxs("div",{className:"linked-memos-wrapper",children:[v.jsxs("span",{className:"normal-text",children:[o.length," THINO ",E("LINK TO THE")," THINO"]}),o.map(p=>{const g=Tx(oT(p.content)).replaceAll(`
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(p),children:[v.jsxs("span",{className:"time-text",children:[p.dateStr," "]}),g]},p.id)})]}):null]})};function Hp(e){vb({className:"memo-card-dialog"},Wz,{memo:e})}function $z({mouseEnterDelayMS:e=0,mouseLeaveDelayMS:t=0}={}){const[n,r]=P.useState(!1);let a,o;return[n,{onMouseEnter:()=>{clearTimeout(o),a=window.setTimeout(()=>r(!0),e)},onMouseLeave:()=>{clearTimeout(a),o=window.setTimeout(()=>r(!1),t)}}]}const Zz=e=>{const{memo:t,handlePinMemoClick:n,handleFixMemoClick:r,handleSourceMemoClick:a,handleShowMemoStoryDialog:o,handleCopyMemoClick:i,handleEditMemoClick:l,handleGenMemoImageBtnClick:c,handleMarkMemoClick:f,handleArchiveMemo:p,handleDeleteMemoClick:g,handleSplitMemoClick:y}=e,w=Le.getState().dailyNotesState.settings,T=w.EnabledLocationList.find(z=>z.value==="MULTI"),[S,I]=Jl(!1),M=P.useRef(null),N={pinRef:P.useRef(null),fixRef:P.useRef(null),typeRef:P.useRef(null),moreRef:P.useRef(null)},[_,k]=$z({mouseEnterDelayMS:500}),R=P.useRef();P.useEffect(()=>{if(!N.typeRef)return;const z=$g.find($=>$.title===t.sourceType);C.setIcon(N.typeRef.current,z.icon),C.requireApiVersion("1.4.4")&&C.setTooltip(N.typeRef.current,t.path),N.fixRef&&(C.setIcon(N.fixRef.current,"shield-alert"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.fixRef.current,"Update Thino property"))},[N.typeRef]),P.useEffect(()=>{N.pinRef&&(t.pinned?(C.setIcon(N.pinRef.current,"pin-off"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.pinRef.current,E("UNPIN"))):(C.setIcon(N.pinRef.current,"pin"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.pinRef.current,E("PIN"))))},[N.pinRef,t.pinned]);const L=C.debounce(()=>{var z;if(_&&N.moreRef.current){if(R.current&&R.current._loaded||(z=R.current)!=null&&z.useNativeMenu||document.body.find(".more-action-btns-wrapper"))return;const $=H(),X=N.moreRef.current.getBoundingClientRect();$.showAtPosition({x:X.left,y:X.bottom})}},200);P.useEffect(()=>{L()},[_]);const H=()=>{var $;const z=new C.Menu;return z.dom.toggleClass(["more-action-btns-wrapper"],!0),z.useNativeMenu?(z.setNoIcon(),z.addItem(X=>{X.setTitle(E("COPY")).onClick(i)}),z.addItem(X=>{X.setTitle(E("EDIT")).onClick(l)}),z.addItem(X=>{X.setTitle(E("SHARE")).onClick(c)})):z.addItem(X=>{const Q=X.dom;X.dom.empty(),X.dom.toggleClass(["more-action-btn-group","more-action-menu-item"],!0);const se=Q.createEl("span");new C.ExtraButtonComponent(se).setIcon("copy"),se.toggleClass(["menu-item-icon","more-action-item-icon"],!0),se.onclick=Z=>{Z.stopPropagation(),Z.preventDefault(),i(),z.close()};const ue=Q.createEl("span");ue.toggleClass(["menu-item-icon","more-action-item-icon"],!0),ue.onclick=Z=>{Z.stopPropagation(),Z.preventDefault(),l(),z.close()},new C.ExtraButtonComponent(ue).setIcon("pencil");const fe=Q.createEl("span");fe.toggleClass(["menu-item-icon","more-action-item-icon"],!0),fe.onclick=Z=>{Z.stopPropagation(),Z.preventDefault(),c(),z.close()},new C.ExtraButtonComponent(fe).setIcon("share-2")}),z.addSeparator(),z.addItem(X=>{X.setIcon("book-open").setTitle(E("READ")).onClick(o)}),z.addItem(X=>{X.setIcon("bookmark").setTitle(E("MARK")).onClick(f)}),(($=/(^|\n)#{1,6}\s/g.exec(t.content))==null?void 0:$.length)>1&&T&&z.addItem(X=>{X.setIcon("separator-horizontal").setTitle(E("SPLIT")).onClick(y)}),z.addItem(X=>{X.setIcon("home").setTitle(E("SOURCE")).onClick(()=>a(t))}),z.addSeparator(),z.addItem(X=>{X.setWarning(!0).setIcon("archive").setTitle(E("ARCHIVE").toUpperCase()).onClick(()=>p(t))}),z.addItem(X=>{X.setWarning(!0).setIcon("trash").setTitle(w.DeleteThinoDirectly?E("DELETE"):E("TRASH BOX").toUpperCase().toUpperCase()).onClick(Q=>{if(z.useNativeMenu)g(Q),z.close();else if(Q.stopPropagation(),Q.preventDefault(),!S){I(!0),X.setTitle(E("CONFIRM")).onClick(se=>{g(se),z.close()});return}})}),z.addSeparator(),z.addItem(X=>{X.setDisabled(!0).setTitle(ut.getWordCount(t.content.replace(/```[^\S\r\n]*[a-z]*\n.*?\n```/g,""))+` ${E("words")}`)}),z.onHide(()=>{I(!1)}),R.current=z,z},U=z=>{H().showAtMouseEvent(z.nativeEvent)};return v.jsx("div",{ref:M,className:"memo-top-right-wrapper",children:v.jsxs(
`),a=new Array(n).join("#")+" ",o=new Array(n+1).join("#")+" ",i=[];let l=[];return r.forEach((c,f)=>{c.startsWith(o)?(l.length>0&&(i.push(l),l=[]),l.push(c)):l.length>0&&!c.startsWith(a)?l.push(c):l.length>0&&(i.push(l),l=[]),f===r.length-1&&l.length>0&&i.push(l)}),i}onChooseSuggestion(t,n){this.selectSuggestion(t,n)}renderSuggestion(t,n){n.setText(t.title)}getSuggestions(){return[{id:"splitByHeading1",title:E("Split by Heading 1")},{id:"splitByHeading2",title:E("Split by Heading 2")},{id:"splitByHeading3",title:E("Split by Heading 3")}]}async selectSuggestion(t,n){let r=[];if(t.id==="splitByHeading1"?r=this.contentSplitByHeading(this.thino.content,1):t.id==="splitByHeading2"?r=this.contentSplitByHeading(this.thino.content,2):t.id==="splitByHeading3"&&(r=this.contentSplitByHeading(this.thino.content,3)),r.length===0){new C.Notice("No headings found"),this.close();return}const a=this.ensureUniqueFileNames(r);for(const l of r){const c=r.indexOf(l),f=await be.createThino({content:l.join(`
`),name:a[c],type:"MULTI",isList:!0});be.pushMemo(f)}let o=this.thino.content;r.forEach((l,c)=>{o=o.replace(l.join(`
`),`[[${a[c]}]]`)});const i=await be.updateMemo(this.thino.id,o);i&&be.editMemo(i),this.close()}}const Jz=async(e,t,n)=>{const r=n.getAttribute("href"),a=n.className;if(a.contains("tag"))Kz(n.innerText.slice(1));else if(a.contains("internal-link")){const o=n.getAttribute("data-href"),i=be.getMemoById(o??"");i?Hp(i):await e.workspace.openLinkText(o,o,!C.Platform.isMobile&&t.navigation!==!0)}else r&&window.open(r,"_blank")},Kz=e=>{const t=ot.getState().query.tag;ot.setTagQuery(t.contains(",")?t.split(",").includes(e)?t.split(",").filter(n=>n!==e).join(","):t+","+e:t===e?"":e)},Qz=(e,t)=>{const n=t==null?void 0:t.getAttribute("src"),r=t==null?void 0:t.parentElement.getAttribute("src"),a=[...(e==null?void 0:e.querySelectorAll("img"))||[]],o=a.indexOf(t);Eb({imgUrl:n,filepath:n.startsWith("app")?r:void 0,otherIMGEls:a,currentIndex:o})},Xz=e=>{var r;const t=(r=e.dataset)==null?void 0:r.value,n=be.getMemoById(t??"");n?Hp(n):(new C.Notice("Thino Not Found"),e.classList.remove("memo-link-text"))},eV=async(e,t,n,r)=>{var l;const a=e!=null&&e.AppendDateWhenTaskDone?" ✅ "+C.moment().format("YYYY-MM-DD"):"",o=((l=r.parentElement.dataset)==null?void 0:l.task)==="x"?"DONE":"TODO",i=[...(n==null?void 0:n.querySelectorAll("li.task-list-item"))||[]];for(const c of i)if(c===r||c===r.closest("li.task-list-item")){const f=i.indexOf(c),p=t.content.split(/\n/),g=[];for(let M=0;M<p.length;M++)/^\s*(-|\*|\d+\.)\s\[.\]\s/.test(p[M])&&g.push(M);const y=g[f],w=p[y],T=w.match(/^\s*(-|\*|\d+\.)\s\[.\]\s/)[0];let S=w.replace(/^\s*(-|\*|\d+\.)\s\[.\]\s/,T.replace(/\[.\]/,o==="TODO"?"[x]":"[ ]"))+(o==="TODO"?a:"");e.AppendDateWhenTaskDone&&o!=="TODO"&&(S=S.replace(/ ✅ \d{4}-\d{2}-\d{2}/g,"")),p[y]=S;const I=p.join(`
`).trim();if(t&&t.content!==I){const M=await be.updateMemo(t.id,I);be.editMemo(M)}}},tV=e=>{const{globalState:{editMemoId:t},dailyNotesState:{app:n,view:r,settings:a,verifyState:o},locationState:{pathname:i}}=P.useContext(Lt),{memo:l,type:c="inline"}=e,f=P.useRef(null),p=P.useRef(null),[g,y]=P.useState(!1);P.useEffect(()=>{g&&setTimeout(()=>{dt.setEditMemoId(l.id)},100)},[g]),P.useEffect(()=>{(i==="/review"||i==="/daily")&&t!==l.id&&g&&y(!1)},[t]);const w=Z=>{if(Z.ctrlKey||Z.metaKey){const pe=C.moment(l.createdAt,"YYYY/MM/DD HH:mm:ss");ot.setFromAndToQuery(pe.startOf("day").valueOf(),pe.endOf("day").valueOf());return}Hp(l)},T=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"){const Z=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");Z&&Z.trigger("click")}dt.setMarkMemoId(l.id)},S=async()=>{var ie;const Z=!C.Platform.isDesktop&&await((ie=window.Capacitor)==null?void 0:ie.Plugins.Device.getId()),pe=C.Platform.isDesktop?await cr():Z.identifier||Z.uuid;if(!o||(o==null?void 0:o.appId)!==pe){Sn();return}l.pinned?await be.unpinMemoById(l.id):await be.pinMemoById(l.id)},I=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"&&C.Platform.isMobile){const Z=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");Z&&Z.trigger("click")}(i==="/review"||i==="/daily")&&y(!0),i!=="/review"&&i!=="/daily"&&dt.setEditMemoId(l.id)},M=async Z=>{Z.sourceType==="MULTI"&&Z.id.trim()===""&&await be.updateMemoProperty(Z)},N=async Z=>{await be.openThinoByID(Z.id)},_=async Z=>{try{const pe=await be.archiveMemo(Z);pe&&be.editMemo(pe)}catch(pe){console.error(pe),new C.Notice(pe.message)}},k=async()=>{try{if(a.DeleteThinoDirectly)await be.deleteMemoById(l.id);else{const Z=await be.hideMemoById(l.id);Z&&be.editMemo(Z)}}catch(Z){new C.Notice(Z.message)}dt.getState().editMemoId===l.id&&dt.setEditMemoId("")},R=()=>{if(p.current&&!p.current.confirmStatus){p.current&&p.current.toggleConfirm(!1);return}},L=()=>{of(l)},H=async()=>{const Z=await be.updateMemo(l.id,l.content,l.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");Z&&be.editMemo(Z)},U=async()=>{navigator.clipboard.writeText(l.content).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})},z=async()=>{new Gz(n,l).open()},$=Z=>{Z&&Z.target.tagName!=="INPUT"&&I()},X=async(Z,pe)=>{Z.preventDefault(),Z.stopPropagation();const ie=Z.target;if(Z.ctrlKey||Z.metaKey){await N(pe);return}if(ie.tagName==="A"){await Jz(n,r,ie);return}if(ie.tagName==="IMG"){Qz(f.current,ie);return}if(ie.tagName==="A"&&ie.getAttribute("href")){const de=ie.getAttribute("href");window.open(de,"_blank");return}if(ie.className==="memo-link-text"){Xz(ie);return}if(ie.tagName==="INPUT"&&ie.hasClass("task-list-item-checkbox")){await eV(a,pe,f.current,ie);return}},Q=Z=>{const pe=new C.Menu;pe.dom.toggleClass("memo-context-menu",!0);const ie=window.getSelection();(ie==null?void 0:ie.toString().length)>0&&pe.addItem(de=>{de.setIcon("copy").setTitle(E("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(ie.toString()).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})})}).addSeparator(),pe.addItem(de=>{de.setIcon("copy").setTitle(E("Copy thino").toLocaleUpperCase()).onClick(async()=>{await U(),pe.close()})}).addItem(de=>{de.setIcon("book-open").setTitle(E("READ")).onClick(w)}).addItem(de=>{de.setIcon(l.pinned?"pin-off":"pin").setTitle(l.pinned?E("UNPIN"):E("PIN")).onClick(S)}).addItem(de=>{de.setIcon("bookmark").setTitle(E("MARK")).onClick(T)}).addItem(de=>{de.setIcon("share-2").setTitle(E("SHARE")).onClick(L)}).addItem(de=>{de.setIcon("pencil").setTitle(E("EDIT")).onClick(I)}).addItem(de=>{de.setIcon("home").setTitle(E("SOURCE")).onClick(()=>N(l))}).addSeparator().addItem(de=>{de.setIcon("archive").setTitle(E("ARCHIVE").toLocaleUpperCase()).onClick(()=>_(l))}).addItem(de=>{de.setIcon("trash").setTitle(E("DELETE")).onClick(async()=>{await k()})}),pe.showAtMouseEvent(Z.native
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ju(e,t){return Q6(e)||xV(e,t)||eI(e,t)||X6()}function Pr(){return Pr=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},Pr.apply(this,arguments)}var CV=function(e,t,n,r,a,o,i,l){if(!e){var c;if(t===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,a,o,i,l],p=0;c=new Error(t.replace(/%s/g,function(){return f[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},MV=CV;const Xg=qt(MV);var kV=function(){};function NV(e,t){var n={};return Object.keys(e).forEach(function(r){n[ow(r)]=kV}),n}function UC(e,t){return e[t]!==void 0}function ow(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function AV(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function FV(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,jw(e,t)}function e8(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function t8(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function n8(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}}e8.__suppressDeprecationWarning=!0;t8.__suppressDeprecationWarning=!0;n8.__suppressDeprecationWarning=!0;function OV(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,i=typeof e.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.
8 months ago
7 months ago
`+o+" uses "+i+" but also contains the following legacy lifecycles:"+(n!==null?`
8 months ago
`+n:"")+(r!==null?`
7 months ago
`+r:"")+(a!==null?`
`+a:"")+`
8 months ago
The above lifecycles should be removed. Learn more about this warning here:
7 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=e8,t.componentWillReceiveProps=t8),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=n8;var l=t.componentDidUpdate;t.componentDidUpdate=function(f,p,g){var y=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:g;l.call(this,f,p,y)}}return e}var PV="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function r8(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=AV(e),o=Object.keys(t),i=o.map(ow);a||!n.length||Xg(!1);var l=function(f){FV(p,f);function p(){for(var y,w=arguments.length,T=new Array(w),S=0;S<w;S++)T[S]=arguments[S];y=f.call.apply(f,[this].concat(T))||this,y.handlers=Object.create(null),o.forEach(function(M){var N=t[M],_=function(R){if(y.props[N]){var L;y._notifying=!0;for(var H=arguments.length,U=new Array(H>1?H-1:0),z=1;z<H;z++)U[z-1]=arguments[z];(L=y.props)[N].apply(L,[R].concat(U)),y._notifying=!1}y.unmounted||y.setState(function($){var X,Q=$.values;return{values:Pr(Object.create(null),Q,(X={},X[M]=R,X))}})};y.handlers[N]=_}),n.length&&(y.attachRef=function(M){y.inner=M});var I=Object.create(null);return o.forEach(function(M){I[M]=y.props[ow(M)]}),y.state={values:I,prevProps:{}},y}var g=p.prototype;return g.shouldComponentUpdate=function(){return!this._notifying},p.getDerivedStateFromProps=function(w,T){var S=T.values,I=T.prevProps,M={values:Pr(Object.create(null),S),prevProps:{}};return o.forEach(function(N){M.prevProps[N]=w[N],!UC(w,N)&&UC(I,N)&&(M.values[N]=w[ow(N)])}),M},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var w=this,T=this.props,S=T.innerRef,I=xb(T,["innerRef"]);i.forEach(function(N){delete I[N]});var M={};return o.forEach(function(N){var _=w.props[N];M[N]=_!==void 0?_:w.state.values[N]}),ne.createElement(e,Pr({},I,M,this.handlers,{ref:S||this.attachRef}))},p}(ne.Component);OV(l),l.displayName="Uncontrolled("+r+")",l.propTypes=Pr({innerRef:function(){}},NV(t)),n.forEach(function(f){l.prototype[f]=function(){var g;return(g=this.inner)[f].apply(g,arguments)}});var c=l;return ne.forwardRef&&(c=ne.forwardRef(function(f,p){return ne.createElement(l,Pr({},f,{innerRef:p,__source:{fileName:PV,lineNumber:128},__self:this}))}),c.propTypes=l.propTypes),c.ControlledComponent=e,c.deferControlTo=function(f,p,g){return p===void 0&&(p={}),r8(f,Pr({},t,p),g)},c}function a8(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=a8(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function ca(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a8(e))&&(r&&(r+=" "),r+=t);return r}var o8={exports:{}},OS,zC;function jV(){if(zC)return OS;zC=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return OS=e,OS}var PS,VC;function LV(){if(VC)return PS;VC=1;var e=jV();function t(){}function n(){}return n.resetWarningCache=t,PS=function(){function r(i,l,c,f,p,g){if(g!==e){var y=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 y.name="Invariant Violation",y}}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},PS}o8.exports=LV()();var RV=o8.exports;const ke=qt(RV);var Lw="milliseconds",ev="seconds",tv="minutes",nv="hours",wf="day",Dp="week",rv="month",bf="year",Sf="decade",Df="century",i8={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},_V={month:1,year:12,decade:10*12,century:100*12};function BV(e){return[
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iw(e){return ZV(e)||h8(e)||eI(e)||qV()}function GV(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 p8=GV;function JV(e,t){return e===t||e!==e&&t!==t}var Hv=JV,KV=typeof dr=="object"&&dr&&dr.Object===Object&&dr,m8=KV,QV=m8,XV=typeof self=="object"&&self&&self.Object===Object&&self,eW=QV||XV||Function("return this")(),Xl=eW,tW=Xl,nW=tW.Symbol,zp=nW,$C=zp,g8=Object.prototype,rW=g8.hasOwnProperty,aW=g8.toString,bg=$C?$C.toStringTag:void 0;function oW(e){var t=rW.call(e,bg),n=e[bg];try{e[bg]=void 0;var r=!0}catch{}var a=aW.call(e);return r&&(t?e[bg]=n:delete e[bg]),a}var iW=oW,sW=Object.prototype,lW=sW.toString;function uW(e){return lW.call(e)}var cW=uW,ZC=zp,dW=iW,fW=cW,hW="[object Null]",pW="[object Undefined]",qC=ZC?ZC.toStringTag:void 0;function mW(e){return e==null?e===void 0?pW:hW:qC&&qC in Object(e)?dW(e):fW(e)}var Vp=mW;function gW(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Gu=gW,vW=Vp,yW=Gu,wW="[object AsyncFunction]",bW="[object Function]",SW="[object GeneratorFunction]",DW="[object Proxy]";function TW(e){if(!yW(e))return!1;var t=vW(e);return t==bW||t==SW||t==wW||t==DW}var rI=TW,IW=9007199254740991;function EW(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=IW}var aI=EW,xW=rI,CW=aI;function MW(e){return e!=null&&CW(e.length)&&!xW(e)}var Yv=MW,kW=9007199254740991,NW=/^(?:0|[1-9]\d*)$/;function AW(e,t){var n=typeof e;return t=t??kW,!!t&&(n=="number"||n!="symbol"&&NW.test(e))&&e>-1&&e%1==0&&e<t}var oI=AW,FW=Hv,OW=Yv,PW=oI,jW=Gu;function LW(e,t,n){if(!jW(n))return!1;var r=typeof t;return(r=="number"?OW(n)&&PW(t,n.length):r=="string"&&t in n)?FW(n[t],e):!1}var Mb=LW,RW=/\s/;function _W(e){for(var t=e.length;t--&&RW.test(e.charAt(t)););return t}var BW=_W,HW=BW,YW=/^\s+/;function UW(e){return e&&e.slice(0,HW(e)+1).replace(YW,"")}var zW=UW;function VW(e){return e!=null&&typeof e=="object"}var od=VW,WW=Vp,$W=od,ZW="[object Symbol]";function qW(e){return typeof e=="symbol"||$W(e)&&WW(e)==ZW}var Uv=qW,GW=zW,GC=Gu,JW=Uv,JC=NaN,KW=/^[-+]0x[0-9a-f]+$/i,QW=/^0b[01]+$/i,XW=/^0o[0-7]+$/i,e$=parseInt;function t$(e){if(typeof e=="number")return e;if(JW(e))return JC;if(GC(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=GC(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=GW(e);var n=QW.test(e);return n||XW.test(e)?e$(e.slice(2),n?2:8):KW.test(e)?JC:+e}var n$=t$,r$=n$,KC=1/0,a$=17976931348623157e292;function o$(e){if(!e)return e===0?e:0;if(e=r$(e),e===KC||e===-KC){var t=e<0?-1:1;return t*a$}return e===e?e:0}var v8=o$,i$=v8;function s$(e){var t=i$(e),n=t%1;return t===t?n?t-n:t:0}var y8=s$,l$=p8,u$=Mb,c$=y8,d$=Math.ceil,f$=Math.max;function h$(e,t,n){(n?u$(e,t,n):t===void 0)?t=1:t=f$(c$(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,i=Array(d$(r/t));a<r;)i[o++]=l$(e,a,a+=t);return i}var p$=h$;const m$=qt(p$);function zv(e){return e&&e.ownerDocument||document}function g$(e){var t=zv(e);return t&&t.defaultView||window}function v$(e,t){return g$(e).getComputedStyle(e,t)}var y$=/([A-Z])/g;function w$(e){return e.replace(y$,"-$1").toLowerCase()}var b$=/^ms-/;function I0(e){return w$(e).replace(b$,"-ms-")}var S$=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function D$(e){return!!(e&&S$.test(e))}function sp(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(I0(t))||v$(e).getPropertyValue(I0(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(I0(a)):D$(a)?r+=a+"("+o+") ":n+=I0(a)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function lv(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function T$(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function iI(e){return"window"in e&&e.window===e?e:T$(e)&&e.defaultView||!1}function w8(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,a){var o=iI(r);if(a===void 0)retu
`)[0].slice(0,20),r=ne.useRef(null),a=ne.useRef(null),o=ne.useRef(null);P.useEffect(()=>{if(a.current)return C.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const i=P.useCallback(c=>{o.current&&(o.current.unmount(),o.current=null),o.current=c},[]),l=P.useCallback(c=>{if(!r.current||!C.Keymap.isModifier(c.nativeEvent,"Mod"))return;const f=new C.HoverPopover(ft.getState().view,r.current,100),p=ple(f,t);i(p)},[r.current]);return v.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:l,children:[v.jsx(gle,{event:e}),v.jsx("span",{children:n})]})}const gle=({event:e})=>{const t=ne.useRef(null),n=e.resource;P.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=P.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const i=await be.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");i&&be.editMemo(i)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return v.jsx(v.Fragment,{children:v.jsxs("span",{className:"rbc-event-icon-group",children:[v.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),v.jsx("span",{className:ar("rbc-event-time","hidden"),children:v.jsx("span",{className:"rbc-event-time-text",children:C.moment(e.start).format("HH:mm")})})]})})};function E9({views:e,view:t,messages:n,onView:r}){return e.map(a=>v.jsx("button",{type:"button",className:ar({"rbc-active":t===a}),onClick:()=>r(a),children:n[a]},a))}E9.propTypes={messages:ke.object,onView:ke.func,view:ke.string,views:ke.array};function x9({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:i}){const l={previous:P.useRef(null),today:P.useRef(null),next:P.useRef(null)};P.useEffect(()=>{l&&(C.setIcon(l.previous.current,"chevron-left"),C.setIcon(l.today.current,"dot"),C.setIcon(l.next.current,"chevron-right"))},[l]);const c=P.useMemo(()=>v.jsxs(v.Fragment,{children:[v.jsx("button",{ref:l.previous,type:"button",onClick:()=>r(cp.PREVIOUS),"aria-label":n.previous,children:"<"}),v.jsx("button",{ref:l.today,type:"button",onClick:()=>r(cp.TODAY),"aria-label":n.today,children:"•"}),v.jsx("button",{ref:l.next,type:"button",onClick:()=>r(cp.NEXT),"aria-label":n.next,children:">"})]}),[n]);return v.jsxs("div",{className:"rbc-toolbar",children:[v.jsx("span",{className:ar("rbc-btn-group","thino-view-custom-toolbar"),children:c}),v.jsx("span",{className:"rbc-toolbar-label",children:v.jsx(kw,{type:"text",handleValueChange:f=>{r(cp.DATE,C.moment(f,"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()})}),v.jsx("span",{className:"rbc-btn-group",children:v.jsx(E9,{view:o,views:i,messages:n,onView:a})})]})}x9.propTypes={date:ke.instanceOf(Date),label:ke.string,localizer:ke.object,messages:ke.object,onNavigate:ke.func,onView:ke.func,view:ke.string,views:ke.array};function vle({event:e,children:t,showPopup:n,callRender:r,...a}){const o=P.useRef(null),i=P.useRef(null),l=P.useCallback(c=>{if(!c.isTrusted){r();return}i.current=c.nativeEvent.target,i.current&&(i.current.hasClass("rbc-event")||(i.current=i.current.closest(".rbc-event")),o.current!==null?(window.clearTimeout(o.current),o.current=null):o.current=window.setTimeout(()=>{n(e,i.current),o.current=null},250))},[e,n]);return v.jsx(v.Fragment,{children:v.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:l,children:t})})}const yle=fle(C.moment),wle=({event:e})=>{const t=e.resource;return v.jsx(v.Fragment,{children:v.jsx(ai,{memo:t})})},ble=e=>{var Q;const{thinos:t}=e,[n,r]=ne.useState([]),[a,o]=ne.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[i,l]=ne.useState(null),c=ne.useRef(null),f=ne.useRef(null),[p,g]=ne.useState(!1),y=P.useRef(null),[w,T]=P.useState(new Date);P.useEffect(()=>()=>{c.current&&(c.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bl(e,t){return $de(e)||sye(e,t)||aF(e,t)||T0e()}var oF={exports:{}};(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var o=arguments[a];if(o){var i=typeof o;if(i==="string"||i==="number")r.push(o);else if(Array.isArray(o)){if(o.length){var l=n.apply(null,o);l&&r.push(l)}}else if(i==="object")if(o.toString===Object.prototype.toString)for(var c in o)t.call(o,c)&&o[c]&&r.push(c);else r.push(o.toString())}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(oF);var I0e=oF.exports;const dE=qt(I0e);var iF={exports:{}},CD,Rk;function E0e(){if(Rk)return CD;Rk=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return CD=e,CD}var MD,_k;function x0e(){if(_k)return MD;_k=1;var e=E0e();function t(){}function n(){}return n.resetWarningCache=t,MD=function(){function r(i,l,c,f,p,g){if(g!==e){var y=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 y.name="Invariant Violation",y}}r.isRequired=r;function a(){return r}var o={array: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},MD}iF.exports=x0e()();var C0e=iF.exports;const Mn=qt(C0e);var fE=ne.createContext({scrollTo:function(){return 0},scrollToBottom:function(){return 0},scrollToEnd:function(){return 0},scrollToStart:function(){return 0},scrollToTop:function(){return 0}});fE.displayName="ScrollToBottomFunctionContext";function l1(){return P.useContext(fE)}function M0e(){var e=l1(),t=e.scrollToEnd;return t}var hE=ne.createContext({atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom"});hE.displayName="ScrollToBottomState1Context";var pE=ne.createContext({animating:!1,animatingToEnd:!1,sticky:!0});pE.displayName="ScrollToBottomState2Context";var mE=ne.createContext({animating:!1,animatingToEnd:!1,atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom",sticky:!0});mE.displayName="ScrollToBottomStateContext";var Bk=[mE,hE,pE];function k0e(e){return P.useContext(Bk[e]||Bk[0])}function N0e(){var e=k0e(2),t=e.sticky;return[t]}var u1=ne.createContext({offsetHeight:0,scrollHeight:0,setTarget:function(){return 0},styleToClassName:function(){return""}});u1.displayName="ScrollToBottomInternalContext";function A0e(){return P.useContext(u1)}function gE(){var e=A0e(),t=e.styleToClassName;return t}var F0e={backgroundColor:"rgba(0, 0, 0, .2)",borderRadius:10,borderWidth:0,bottom:5,cursor:"pointer",height:20,outline:0,position:"absolute",right:20,width:20,"&:hover":{backgroundColor:"rgba(0, 0, 0, .4)"},"&:active":{backgroundColor:"rgba(0, 0, 0, .6)"}},vE=function(t){var n=t.children,r=t.className,a=N0e(),o=Bl(a,1),i=o[0],l=gE()(F0e),c=M0e();return!i&&ne.createElement("button",{className:dE(l,(r||"")+""),onClick:c,type:"button"},n)};vE.defaultProps={children:void 0,className:""};vE.propTypes={children:Mn.any,className:Mn.string};var sF={exports:{}},O0e=Gn,P0e=ii,Hk=Ws.f;O0e({target:"Object",stat:!0,forced:Object.defineProperty!==Hk,sham:!P0e},{defineProperty:Hk});var j0e=qa,lF=j0e.Object,L0e=sF.exports=function(t,n,r){return lF.defineProperty(t,n,r)};lF.defineProperty.sham&&(L0e.sham=!0);var R0e=sF.exports,_0e=R0e,uF=_0e,B0e=uF,H0e=B0e,Y0e=H0e,U0e=Y0e,z0e=U0e;const V0e=qt(z0e);var W0e=ty,$0e=W0e.f("iterator"),Z0e=$0e,q0e=Z0e,G0e=q0e,J0e=G0e,K0e=J0e,Q0e=K0e,X0e=Q0e;const ewe=qt(X0e);function fv(e){"@babel/helpers - typeof";return fv=typeof fp=="function"&&typeof ewe=="symbol"?function(t){return typeof t}:function(t){return t&&typeof fp=="function"&&t.constructor===fp&&t!==fp.prototype?"symbol":typeof t},fv(e)}var twe=ty,nwe=twe.f("toPrimitive"),rwe=nwe,awe=rwe,owe=awe,iwe=owe,swe=iwe,lwe=swe,uwe=lwe;const cwe=qt(uwe);function dwe(e,t){if(fv(e)!="object"||!e)return e;var n=e[cwe];if(n!==void 0){var r=n.call(e,t||"defa
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function En(e){return pwe(e)||mwe(e)||aF(e)||gwe()}var _0=function(e){return e&&e.Math==Math&&e},Oi=_0(typeof globalThis=="object"&&globalThis)||_0(typeof window=="object"&&window)||_0(typeof self=="object"&&self)||_0(typeof dr=="object"&&dr)||function(){return this}()||Function("return this")(),yE={},$s=function(e){try{return!!e()}catch{return!0}},vwe=$s,Of=!vwe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),cF={},dF={}.propertyIsEnumerable,fF=Object.getOwnPropertyDescriptor,ywe=fF&&!dF.call({1:2},1);cF.f=ywe?function(t){var n=fF(this,t);return!!n&&n.enumerable}:dF;var hF=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},wwe={}.toString,wE=function(e){return wwe.call(e).slice(8,-1)},bwe=$s,Swe=wE,Dwe="".split,Twe=bwe(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return Swe(e)=="String"?Dwe.call(e,""):Object(e)}:Object,c1=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},Iwe=Twe,Ewe=c1,bE=function(e){return Iwe(Ewe(e))},ls=function(e){return typeof e=="function"},xwe=ls,oy=function(e){return typeof e=="object"?e!==null:xwe(e)},kD=Oi,Cwe=ls,Mwe=function(e){return Cwe(e)?e:void 0},d1=function(e,t){return arguments.length<2?Mwe(kD[e]):kD[e]&&kD[e][t]},kwe=d1,Nwe=kwe("navigator","userAgent")||"",pF=Oi,ND=Nwe,Yk=pF.process,Uk=pF.Deno,zk=Yk&&Yk.versions||Uk&&Uk.version,Vk=zk&&zk.v8,Fl,Jw;Vk?(Fl=Vk.split("."),Jw=Fl[0]<4?1:Fl[0]+Fl[1]):ND&&(Fl=ND.match(/Edge\/(\d+)/),(!Fl||Fl[1]>=74)&&(Fl=ND.match(/Chrome\/(\d+)/),Fl&&(Jw=Fl[1])));var Awe=Jw&&+Jw,Wk=Awe,Fwe=$s,mF=!!Object.getOwnPropertySymbols&&!Fwe(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Wk&&Wk<41}),Owe=mF,gF=Owe&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Pwe=ls,jwe=d1,Lwe=gF,vF=Lwe?function(e){return typeof e=="symbol"}:function(e){var t=jwe("Symbol");return Pwe(t)&&Object(e)instanceof t},Rwe=function(e){try{return String(e)}catch{return"Object"}},_we=ls,Bwe=Rwe,Hwe=function(e){if(_we(e))return e;throw TypeError(Bwe(e)+" is not a function")},Ywe=Hwe,yF=function(e,t){var n=e[t];return n==null?void 0:Ywe(n)},AD=ls,FD=oy,Uwe=function(e,t){var n,r;if(t==="string"&&AD(n=e.toString)&&!FD(r=n.call(e))||AD(n=e.valueOf)&&!FD(r=n.call(e))||t!=="string"&&AD(n=e.toString)&&!FD(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},wF={exports:{}},$k=Oi,SE=function(e,t){try{Object.defineProperty($k,e,{value:t,configurable:!0,writable:!0})}catch{$k[e]=t}return t},zwe=Oi,Vwe=SE,Zk="__core-js_shared__",Wwe=zwe[Zk]||Vwe(Zk,{}),DE=Wwe,qk=DE;(wF.exports=function(e,t){return qk[e]||(qk[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.18.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});var TE=wF.exports,$we=c1,bF=function(e){return Object($we(e))},Zwe=bF,qwe={}.hasOwnProperty,Pf=Object.hasOwn||function(t,n){return qwe.call(Zwe(t),n)},Gwe=0,Jwe=Math.random(),SF=function(e){return"Symbol("+String(e===void 0?"":e)+")_"+(++Gwe+Jwe).toString(36)},Kwe=Oi,Qwe=TE,Gk=Pf,Xwe=SF,Jk=mF,ebe=gF,Ig=Qwe("wks"),Yg=Kwe.Symbol,tbe=ebe?Yg:Yg&&Yg.withoutSetter||Xwe,iy=function(e){return(!Gk(Ig,e)||!(Jk||typeof Ig[e]=="string"))&&(Jk&&Gk(Yg,e)?Ig[e]=Yg[e]:Ig[e]=tbe("Symbol."+e)),Ig[e]},Kk=oy,Qk=vF,nbe=yF,rbe=Uwe,abe=iy,obe=abe("toPrimitive"),ibe=function(e,t){if(!Kk(e)||Qk(e))return e;var n=nbe(e,obe),r;if(n){if(t===void 0&&(t="default"),r=n.call(e,t),!Kk(r)||Qk(r))return r;throw TypeError("Can't convert object to primitive value")}return t===void 0&&(t="number"),rbe(e,t)},sbe=ibe,lbe=vF,DF=function(e){var t=sbe(e,"string");return lbe(t)?t:String(t)},ube=Oi,Xk=oy,t2=ube.document,cbe=Xk(t2)&&Xk(t2.createElement),TF=function(e){return cbe?t2.createElement(e):{}},dbe=Of,fbe=$s,hbe=TF,IF=!dbe&&!fbe(function(){return Object.defineProperty(hbe("div"),"a",{get:function(){return 7}}).a!=7}),pbe=Of,mbe=cF,gbe=hF,vbe=bE,ybe=DF,wbe=Pf,bbe=IF,e4=Object.getOwnPropertyDescriptor;yE.f=pbe?e4:function(t,n){if(t=vbe(t),n=ybe(n),bbe)
`)&&e.flags==="s")}),kSe=$s,NSe=Oi,ASe=NSe.RegExp,FSe=kSe(function(){var e=ASe("(?<a>b)","g");return e.exec("b").groups.a!=="b"||"b".replace(e,"$<a>c")!=="bc"}),OSe=p1,PSe=RF,p4=kE,jSe=TE,LSe=ISe,RSe=MF.get,_Se=MSe,BSe=FSe,Xw=RegExp.prototype.exec,HSe=jSe("native-string-replace",String.prototype.replace),i2=Xw,s2=function(){var e=/a/,t=/b*/g;return Xw.call(e,"a"),Xw.call(t,"a"),e.lastIndex!==0||t.lastIndex!==0}(),UF=p4.UNSUPPORTED_Y||p4.BROKEN_CARET,l2=/()??/.exec("")[1]!==void 0,YSe=s2||l2||UF||_Se||BSe;YSe&&(i2=function(t){var n=this,r=RSe(n),a=OSe(t),o=r.raw,i,l,c,f,p,g,y;if(o)return o.lastIndex=n.lastIndex,i=i2.call(o,a),n.lastIndex=o.lastIndex,i;var w=r.groups,T=UF&&n.sticky,S=PSe.call(n),I=n.source,M=0,N=a;if(T&&(S=S.replace("y",""),S.indexOf("g")===-1&&(S+="g"),N=a.slice(n.lastIndex),n.lastIndex>0&&(!n.multiline||n.multiline&&a.charAt(n.lastIndex-1)!==`
`)&&(I="(?: "+I+")",N=" "+N,M++),l=new RegExp("^(?:"+I+")",S)),l2&&(l=new RegExp("^"+I+"$(?!\\s)",S)),s2&&(c=n.lastIndex),f=Xw.call(T?l:n,N),T?f?(f.input=f.input.slice(M),f[0]=f[0].slice(M),f.index=n.lastIndex,n.lastIndex+=f[0].length):n.lastIndex=0:s2&&f&&(n.lastIndex=n.global?f.index+f[0].length:c),l2&&f&&f.length>1&&HSe.call(f[0],l,function(){for(p=1;p<arguments.length-2;p++)arguments[p]===void 0&&(f[p]=void 0)}),f&&w)for(f.groups=g=LSe(null),p=0;p<w.length;p++)y=w[p],g[y[0]]=f[y[1]];return f});var NE=i2,USe=G1e,m4=NE;USe({target:"RegExp",proto:!0,forced:/./.exec!==m4},{exec:m4});var g4=ly,zSe=NE,v4=$s,zF=iy,VSe=f1,WSe=zF("species"),_D=RegExp.prototype,$Se=function(e,t,n,r){var a=zF(e),o=!v4(function(){var f={};return f[a]=function(){return 7},""[e](f)!=7}),i=o&&!v4(function(){var f=!1,p=/a/;return e==="split"&&(p={},p.constructor={},p.constructor[WSe]=function(){return p},p.flags="",p[a]=/./[a]),p.exec=function(){return f=!0,null},p[a](""),!f});if(!o||!i||n){var l=/./[a],c=t(a,""[e],function(f,p,g,y,w){var T=p.exec;return T===zSe||T===_D.exec?o&&!w?{done:!0,value:l.call(p,g,y)}:{done:!0,value:f.call(g,p,y)}:{done:!1}});g4(String.prototype,e,c[0]),g4(_D,a,c[1])}r&&VSe(_D[a],"sham",!0)},ZSe=h1,qSe=p1,GSe=c1,y4=function(e){return function(t,n){var r=qSe(GSe(t)),a=ZSe(n),o=r.length,i,l;return a<0||a>=o?e?"":void 0:(i=r.charCodeAt(a),i<55296||i>56319||a+1===o||(l=r.charCodeAt(a+1))<56320||l>57343?e?r.charAt(a):i:e?r.slice(a,a+2):(i-55296<<10)+(l-56320)+65536)}},JSe={codeAt:y4(!1),charAt:y4(!0)},KSe=JSe.charAt,QSe=function(e,t,n){return t+(n?KSe(e,t).length:1)},XSe=bF,eDe=Math.floor,tDe="".replace,nDe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,rDe=/\$([$&'`]|\d{1,2})/g,aDe=function(e,t,n,r,a,o){var i=n+e.length,l=r.length,c=rDe;return a!==void 0&&(a=XSe(a),c=nDe),tDe.call(o,c,function(f,p){var g;switch(p.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(i);case"<":g=a[p.slice(1,-1)];break;default:var y=+p;if(y===0)return f;if(y>l){var w=eDe(y/10);return w===0?f:w<=l?r[w-1]===void 0?p.charAt(1):r[w-1]+p.charAt(1):f}g=r[y-1]}return g===void 0?"":g})},oDe=sd,iDe=ls,sDe=wE,lDe=NE,uDe=function(e,t){var n=e.exec;if(iDe(n)){var r=n.call(e,t);return r!==null&&oDe(r),r}if(sDe(e)==="RegExp")return lDe.call(e,t);throw TypeError("RegExp#exec called on incompatible receiver")},cDe=$Se,dDe=$s,fDe=sd,hDe=ls,pDe=h1,mDe=FF,ap=p1,gDe=c1,vDe=QSe,yDe=yF,wDe=aDe,bDe=uDe,SDe=iy,u2=SDe("replace"),DDe=Math.max,TDe=Math.min,IDe=function(e){return e===void 0?e:String(e)},EDe=function(){return"a".replace(/./,"$0")==="$0"}(),w4=function(){return/./[u2]?/./[u2]("a","$0")==="":!1}(),xDe=!dDe(function(){var e=/./;return e.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(e,"$<a>")!=="7"});cDe("replace",function(e,t,n){var r=w4?"$":"$0";return[function(o,i){var l=gDe(this),c=o==null?void 0:yDe(o,u2);return c?c.call(o,l,i):t.call(ap(l),o,i)},function(a,o){var i=fDe(this),l=ap(a);if(typeof o=="string"&&o.indexOf(r)===-1&&o.indexOf("$<")===-1){var c=n(t,i,l,o);if(c.done)return c.value}var f=hDe(o);f||(o=ap(o));var p=i.global;if(p){var g=i.unicode;i.lastIndex=0}for(var y=[];;){var w=bDe(i,l);if(w===null||(y.push(w),!p))break;var T=ap(w[0]);T===""&&(i.lastIndex=vDe(l,mDe(i.lastIndex),g))}for(var S="",I=0,M=0;M<y.length;M++){w=y[M];for(var N=ap(w[0]),_=DDe(TDe(pDe(w.index),l.length),0),k=[],R=1;R<w.length;R++)k.push(IDe(w[R]));var L=w.groups;if(f){var H=[N].concat(k,_,l);L!==void 0&&H.push(L);var U=ap(o.apply(void 0,H))}else U=wDe(N,l,_,k,L,o);_>=I&&(S+=l.slice(I,_)+U,I=_+N.length)}return S+l.slice(I)}]},!xDe||!EDe||w4);var CDe=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",MDe=TypeError,kDe=function(e,t){if(e<t)throw new MDe("Not enough arguments");return e},VF=Za,NDe=PI,ADe=co,FDe=CDe,ODe=W9,PDe=e1,jDe=kDe,LDe=VF.Function,RDe=/MSIE .\./.test(ODe)||FDe&&function(){var e=VF.Bun.version.split(".");return e.length<3||e[0]==="0"&&(e[1]<3||e[1]==="3"&&e[2]==="0")}(),WF=function(e,t){var n=t?2:1;return RDe?function(r,a){var o=jDe(arguments.length,1)>n,i=ADe(r)?r:LDe(r),l=o?PDe(arguments,n):[],c=o?function()
`,L.current,t.path,a||e.view)}pe(),setTimeout(async()=>{await Q()},JN)},[R,L,l,M]);const Q=async()=>{R.current&&(await Exe(R.current),await HE(R.current),xxe(M).then(pe=>{pe&&setTimeout(()=>{Ib(R.current,{pixelRatio:window.devicePixelRatio*2}).then(ie=>{k(ie),f(!0)}).catch(()=>{})},600)}))},se=()=>{n()},ue=P.useCallback(pe=>{w(pe)},[y]),fe=async()=>{const{vault:pe}=Le.getState().dailyNotesState.app,ie=R.current.querySelector(".memo-shortcut-img");if(!ie)return;const de=ie==null?void 0:ie.getAttribute("src").split("base64,")[1],K=Z4(de,"image/png");let ae;K.arrayBuffer().then(async Se=>{const je="png",Re=Zu();for(const Fe in Re)if(Re[Fe]instanceof C.TFile){ae=Re[Fe];break}if(ae!==void 0){const Fe=await pe.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,je,ae);await pe.createBinary(Fe,Se),new C.Notice(E("Save image successfully"))}})},Z=async()=>{ue(!0);const pe=R.current.querySelector(".memo-shortcut-img");if(!pe)return;const ie=pe==null?void 0:pe.getAttribute("src").split("base64,")[1],de=Z4(ie,"image/png");if(!de){new C.Notice(E("Copy to clipboard failed"));return}const K=new ClipboardItem({"image/png":de});window.navigator.clipboard.write([K]).then(()=>{setTimeout(()=>{ue(!1)},500)}),new C.Notice(E("Copy to clipboard successfully"))};return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:ar("dialog-header-container"),children:[v.jsxs("p",{className:"title-text",children:[v.jsx("span",{className:"icon-text",children:"🥰"}),E("Share Memo Image")]}),v.jsxs("div",{className:"btn-group",children:[C.Platform.isMobile&&v.jsx("button",{ref:I,className:"btn download-btn",onClick:fe}),v.jsx("button",{ref:T,className:"btn copy-btn",onClick:Z}),v.jsx("button",{ref:S,className:"btn close-btn",onClick:se})]})]}),v.jsxs("div",{className:ar("dialog-content-container",M),children:[v.jsx("div",{className:`tip-words-container ${_?"finish":"loading"}`,children:v.jsx("p",{className:"tip-text",children:E(_?"↗Click the button to save":"Image is generating...")})}),v.jsxs("div",{className:"setting-item",children:[v.jsxs("div",{className:"setting-item-info",children:[v.jsx("div",{className:"setting-item-name",children:E("Default sharing style")}),v.jsx("div",{className:"setting-item-description",children:E("Set the default style for sharing thino, 'Modern' by default.")})]}),v.jsx("div",{className:"setting-item-control",children:v.jsxs("select",{className:"dropdown",defaultValue:M,onChange:async pe=>{pe.currentTarget.value!==M&&(f(!1),k(""),N(pe.currentTarget.value),(o||window.app).saveLocalStorage("memoShareDialogStyle",pe.currentTarget.value),await Q())},children:[v.jsx("option",{value:"modern",children:E("Modern")}),v.jsx("option",{value:"clean",children:E("Clean")}),v.jsx("option",{value:"minimal",children:E("Minimal")}),v.jsx("option",{value:"gradient",children:E("Gradient")})]})})]}),v.jsxs("div",{className:ar("memo-container",M),ref:R,children:[v.jsx(ts,{when:_!=="",children:v.jsx("img",{className:"memo-shortcut-img",onClick:Z,src:_})}),v.jsxs("div",{className:"memo-background",children:[v.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),v.jsx("span",{className:"background-container"}),v.jsxs("div",{className:"thino-user-header",children:[v.jsx("div",{className:"thino-user-icon",ref:pe=>{if(i!=null&&i.MomentsIcon){pe==null||pe.empty();return}i!=null&&i.MomentsIcon||pe&&C.setIcon(pe,"Memos")},style:{backgroundImage:`url("${H}")`}}),v.jsxs("div",{className:"thino-user-info",children:[v.jsx("div",{className:"thino-user-name",children:i==null?void 0:i.UserName}),(i==null?void 0:i.MomentsQuote)&&v.jsx("div",{className:"thino-user-quote",children:i==null?void 0:i.MomentsQuote})]})]}),v.jsx("div",{ref:L,className:"memo-content-text",style:{minHeight:i.MinHeightForShare||"200px"}}),v.jsx("div",{className:"thino-time-footer",children:l.createdAt}),v.jsxs("div",{className:"watermark-container",children:[v.jsxs("span",{className:"normal-text footer-start",children:[v.jsx("div",{className:"property-social-icons"}),v.jsx("spa
`,i.current,a.path,r);const _=(R=i.current)==null?void 0:R.querySelectorAll(".internal-link");_==null||_.forEach(L=>{const H=L,U=H.getAttribute("data-href");if(!U)return;t.metadataCache.getFirstLinkpathDest(U,a.path)||L.classList.add("is-unresolved"),H.addEventListener("mouseover",$=>{$.stopPropagation(),t.workspace.trigger("hover-link",{event:$,source:"thino",hoverParent:r.containerEl,targetEl:H,linktext:U,sourcePath:H.href})})})}N()},[a.content,l]);const T=async()=>{switch(p.sourceType){case"DAILY":await _2(p.id,p.path);break;case"CANVAS":await H2(p.id,p.path);break;case"MULTI":await R2(p.path);break;case"FILE":await B2(p.id,p.path);break}},S=async()=>{if(g)try{if(n.DeleteThinoDirectly)await be.deleteMemoById(p.id);else{const N=await be.hideMemoById(p.id);N&&be.editMemo(N)}}catch(N){new C.Notice(N.message)}else y()},I=async()=>{try{const N=await be.unarchiveMemo(p);N&&be.editMemo(N),o(p.id),new C.Notice(E("RESTORE SUCCEED"))}catch(N){new C.Notice(N.message)}},M=()=>{g&&y(!1)};return v.jsxs("div",{ref:l,className:`memo-wrapper ${"memos-"+p.id}`,onMouseLeave:M,children:[v.jsxs("div",{className:"memo-top-wrapper",children:[v.jsxs("span",{className:"time-text",children:[E("ARCHIVED AT")," ",p.updatedAt]}),v.jsxs("div",{className:"btns-container",children:[v.jsx("span",{ref:N=>{N&&C.setIcon(N,"more-horizontal")},className:"btn more-action-btn"}),v.jsx("div",{className:"more-action-btns-wrapper",children:v.jsxs("div",{className:"more-action-btns-container",children:[v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:w.restore,className:"more-action-item-icon"}),v.jsx("span",{className:"btn restore-btn",onClick:I,children:E("RESTORE")})]}),v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:w.source,className:"more-action-item-icon"}),v.jsx("span",{className:"btn",onClick:T,children:E("SOURCE")})]}),v.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[v.jsx("span",{ref:w.delete,className:"more-action-item-icon"}),v.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:S,children:E(g?"CONFIRM":"DELETE")})]})]})})]})]}),v.jsx("div",{ref:i,className:"memo-content-text"})]})},Lu=e=>{var n;const t=new Map;for(const r of e){const a=r.path;t.has(a)||t.set(a,[]),(n=t.get(a))==null||n.push(r)}return Array.from(t).map(([r,a])=>({path:r,thinos:a}))},kxe=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:i,filter:l}=t,c=sn.getQueryById(l);return!!(r||a&&a.from<a.to||o||i||c)||c||n?e.filter(p=>{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),c){const y=JSON.parse(c.querystring);Array.isArray(y)&&(g=Bp(p,y))}if(r){const y=new Set;for(const w of Array.from(p.content.match($r)||[])){const S=w.replace($r,"$1").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}for(const w of Array.from(p.content.match(ua)||[])){const S=w.replace(ua,"$1").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}for(const w of Array.from(p.content.match(Wa)||[])){const S=w.replace(Wa,"$2").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}y.has(r)||(g=!1)}return a&&a.from<a.to&&(ut.getTimeStampByDate(p.createdAt)<a.from||ut.getTimeStampByDate(p.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match($r)!==null||p.content.match(Wa)!==null||p.content.match(ua)!==null)||o==="LINKED"&&p.content.match(Cf)===null||o==="IMAGED"&&p.content.match(Mf)===null||o==="CONNECTED"&&p.content.match(nd)===null)&&(g=!1),i&&!p.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},Nxe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=am(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&C.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const T=kxe({memos:n.filter(S=>S.rowStatus==="ARCHIVED"&&S.deletedAt===""),query:e,HideDoneTasks:!1});o(T),r.setFinish()},[n,i.current,e]);const c=P.useCallback(T=>{o(S=>S.filter(I=
${se.content.split(`
`).map(fe=>fe.trim()?`> ${fe}
7 months ago
`:`>
`)}
7 months ago
`+(ue===t.length-1?`
7 months ago
`:`
7 months ago
------
7 months ago
`)});const Q={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:X.replace(/(^|\n),>/g,`
>`),id:"temp-"+Math.random().toString(36).substr(2,9),thinoType:"JOURNAL",sourceType:"DAILY",rowStatus:"NORMAL",visibility:"PRIVATE",pinned:!1,creatorName:"thino",deletedAt:"",path:"",resourceList:[]};of(Q,"clean")})}),z.addSeparator(),a){case"/":z.addItem($=>{$.setTitle(E("Bulk tag operation")).setIcon("hash").onClick(async()=>{await R()})}).addItem($=>{$.setTitle(E("Bulk archive")).setIcon("archive").onClick(async()=>{new _s(i,E("ARCHIVE"),async X=>{X==="confirm"&&await k()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async X=>{X==="confirm"&&await I()}).open()})});break;case"/archive":z.addItem($=>{$.setTitle(E("Bulk restore")).setIcon("archive").onClick(async()=>{new _s(i,E("RESTORE"),async X=>{X==="confirm"&&await N()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async X=>{X==="confirm"&&await I()}).open()})});break;case"/recycle":z.addItem($=>{$.setTitle(E("Bulk restore")).setIcon("archive-restore").onClick(async()=>{new _s(i,E("RESTORE"),async X=>{X==="confirm"&&await _()}).open()})}).addItem($=>{$.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async X=>{X==="confirm"&&await M()}).open()})});break}z.showAtMouseEvent(U.nativeEvent)};return v.jsxs("div",{className:`filter-query-container ${w?"":"hidden"}`,children:[v.jsxs("div",{className:"filter-query",children:[v.jsx("span",{className:"tip-text",children:E("FILTER")}),v.jsxs("div",{"data-filter-type":"query",className:"filter-item-container "+(y?"":"hidden"),onClick:()=>{ot.setMemoFilter("")},children:[v.jsx("span",{className:"icon-text",children:"🔖"})," ",y==null?void 0:y.title]}),v.jsxs("div",{"data-filter-type":"tag",className:"filter-item-container "+(l?"":"hidden"),onClick:()=>{ot.setTagQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🏷️"})," ",l]}),v.jsxs("div",{"data-filter-type":"type",className:"filter-item-container "+(f?"":"hidden"),onClick:()=>{ot.setMemoTypeQuery("")},children:[v.jsx("span",{className:"icon-text",children:"📦"})," ",YH(f)]}),c&&c.from<c.to&&v.jsxs("div",{"data-filter-type":"date",className:"filter-item-container",children:[v.jsxs("div",{className:"day-picker-component-group",children:[v.jsx("span",{className:"icon-text",children:"🗓️"})," ",v.jsx(kw,{type:"text",startOrEnd:"start",defaultValue:C.moment(c.from,"x").valueOf(),handleValueChange:U=>{const z=C.moment(c.to,"x"),$=C.moment(U,"x"),X=$.isAfter(z)||$.isSame(z);ot.setFromAndToQuery(X?z.startOf("day").valueOf():C.moment(U,"x").startOf("day").valueOf(),c.to)}}),v.jsx("span",{children:E("to")}),v.jsx(kw,{type:"text",startOrEnd:"end",defaultValue:C.moment(c.to,"x").add(1,"days").valueOf(),handleValueChange:U=>{const z=C.moment(c.from,"x"),$=C.moment(U,"x"),X=$.isBefore(z)||$.isSame(z),Q=C.moment(U,"x").endOf("day").valueOf();ot.setFromAndToQuery(c.from,X?z.endOf("day").valueOf():Q)}})]}),v.jsx("div",{ref:U=>U&&C.setIcon(U,"x"),className:"btn close-btn",onClick:()=>{ot.setFromAndToQuery(0,0)}})]}),v.jsxs("div",{className:"filter-item-container "+(p?"":"hidden"),onClick:()=>{ot.setTextQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🔍"})," ",p]})]}),v.jsxs("div",{className:"thino-filter-items",children:[e&&v.jsx("div",{className:"thinos-count",children:`${e?`${e} Thinos `:""}`}),v.jsx("div",{ref:T,className:"btn memo-action-menu",onClick:H})]})]})},sf=async e=>{const{app:t,settings:n}=ft.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await _R(e);if(!r||r.length===0)return;r.sort((i,l)=>C.moment(i.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(C.moment(l.createdAt,"YYYY/MM/DD HH:mm:ss"))?1:-1);const a=r.filter(i=>!i.deleted),o=r.filter(i=>i.deleted);for(let i=0;i<a.length;i++){const l=a[i],c=await be.createOrPatchThinoFromWeb(l);c&&be.pushMemo(c)}for(let i=0;i<o.length;i++){const l=o[i],c=be.getMemoByWebId(l.id);c&&await be.deleteMemoById(c.id,"local")}be.updateTagsState(),jxe(t)};function Oxe(){const{settings:e,app:t,view:n}=ft.getSt
`&&A.push(`
`),Ie!==null&&A.push(T(""+Ie)),null;case"input":A.push(Q("input")),ct=$t=it=Ie=null;for(Ue in J)if(n.call(J,Ue)&&(Ft=J[Ue],Ft!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":ct=Ft;break;case"defaultValue":it=Ft;break;case"checked":$t=Ft;break;case"value":Ie=Ft;break;default:L(A,oe,Ue,Ft)}return $t!==null?L(A,oe,"checked",$t):ct!==null&&L(A,oe,"checked",ct),Ie!==null?L(A,oe,"value",Ie):it!==null&&L(A,oe,"value",it),A.push("/>"),null;case"menuitem":A.push(Q("menuitem"));for(var Ga in J)if(n.call(J,Ga)&&(Ie=J[Ga],Ie!=null))switch(Ga){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:L(A,oe,Ga,Ie)}return A.push(">"),null;case"title":A.push(Q("title")),Ie=null;for(Pn in J)if(n.call(J,Pn)&&(Ue=J[Pn],Ue!=null))switch(Pn){case"children":Ie=Ue;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:L(A,oe,Pn,Ue)}return A.push(">"),Ie;case"listing":case"pre":A.push(Q(Y)),Ue=Ie=null;for(ct in J)if(n.call(J,ct)&&(it=J[ct],it!=null))switch(ct){case"children":Ie=it;break;case"dangerouslySetInnerHTML":Ue=it;break;default:L(A,oe,ct,it)}if(A.push(">"),Ue!=null){if(Ie!=null)throw Error(t(60));if(typeof Ue!="object"||!("__html"in Ue))throw Error(t(61));J=Ue.__html,J!=null&&(typeof J=="string"&&0<J.length&&J[0]===`
`?A.push(`
`,J):A.push(""+J))}return typeof Ie=="string"&&Ie[0]===`
`&&A.push(`
`),Ie;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":A.push(Q(Y));for(var ja in J)if(n.call(J,ja)&&(Ie=J[ja],Ie!=null))switch(ja){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,Y));default:L(A,oe,ja,Ie)}return A.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return z(A,J,Y,oe);case"html":return Ne.insertionMode===0&&A.push("<!DOCTYPE html>"),z(A,J,Y,oe);default:if(Y.indexOf("-")===-1&&typeof J.is!="string")return z(A,J,Y,oe);A.push(Q(Y)),Ue=Ie=null;for(Ft in J)if(n.call(J,Ft)&&(it=J[Ft],it!=null))switch(Ft){case"children":Ie=it;break;case"dangerouslySetInnerHTML":Ue=it;break;case"style":R(A,oe,it);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:i(Ft)&&typeof it!="function"&&typeof it!="symbol"&&A.push(" ",Ft,'="',T(it),'"')}return A.push(">"),H(A,Ue,Ie),Ie}}function ue(A,Y,J){if(A.push('<!--$?--><template id="'),J===null)throw Error(t(395));return A.push(J),A.push('"></template>')}function fe(A,Y,J,oe){switch(J.insertionMode){case 0:case 1:return A.push('<div hidden id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 2:return A.push('<svg aria-hidden="true" style="display:none" id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 3:return A.push('<math aria-hidden="true" style="display:none" id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 4:return A.push('<table hidden id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 5:return A.push('<table hidden><tbody id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 6:return A.push('<table hidden><tr id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');case 7:return A.push('<table hidden><colgroup id="'),A.push(Y.segmentPrefix),Y=oe.toString(16),A.push(Y),A.push('">');default:throw Error(t(397))}}function Z(A,Y){switch(Y.insertionMode){case 0:case 1:return A.push("</div>");case 2:return A.push("</svg>");case 3:return A.push("</math>");case 4:return A.push("</table>");case 5:return A.push("</tbody></table>");case 6:return A.push("</tr></table>");case 7:return A.push("</colgroup></table>");default:throw Error(t(397))}}var pe=/[<\u2028\u2029]/g;function ie(A){return JSON.stringify(A).replace(pe,function(Y){switch(Y){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function de(A,Y){return Y=Y===void 0?"":Y,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:Y+"P:",segmentPrefix:Y+"S:",boundaryPrefix:Y+"B:",idPrefix:Y,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:A}}function K(A,Y,J,oe){return J.generateStaticMarkup?(A.push(T(Y)),!1):(Y===""?A=oe:(oe&&A.push("<!-- -->"),A.push(T(Y)),A=!0),A)}var ae=Object.assign,Se=Symbol.for("react.element"),je=Symbol.for("react.portal"),Re=Symbol.for("react.fragment"),Fe=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Qe=Symbol.for("react.provider"),Ze=Symbol.for("react.context"),st=Symbol.for("react.forward_ref"),xt=Symbol.for("react.suspense"),tn=Symbol.for("react.suspense_list"),_e=Symbol.for("react.memo"),Xe=Symbol.for("react.lazy"),tt=Symbol.for("react.scope"),ht=Symbol.for("react.debug_trace_mode"),St=Symbol.for("react.legacy_hidden"),Tt=Symbol.for("react.default_value"),Gt=Symbol.iterator;function _t(A){if(A==null)return null;if(typeof A=="function")return A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case Re:return"Fragment";case je:return"Portal";case Be:return"Profiler";case Fe:return"StrictMode";case xt:return"Suspense";ca
`),Xt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,dn=new Map;function en(F){var B=dn.get(F);if(B===void 0){if(!Xt.test(F))throw Error(t(65,F));B=f("<"+F),dn.set(F,B)}return B}var Zn=f("<!DOCTYPE html>");function kn(F,B,q,re,Ae){switch(B){case"select":F.push(en("select"));var Ee=null,Ve=null;for(Rt in q)if(g.call(q,Rt)){var at=q[Rt];if(at!=null)switch(Rt){case"children":Ee=at;break;case"dangerouslySetInnerHTML":Ve=at;break;case"defaultValue":case"value":break;default:Xe(F,re,Rt,at)}}return F.push(tt),St(F,Ve,Ee),Ee;case"option":Ve=Ae.selectedValue,F.push(en("option"));var It=at=null,Kt=null,Rt=null;for(Ee in q)if(g.call(q,Ee)){var Hn=q[Ee];if(Hn!=null)switch(Ee){case"children":at=Hn;break;case"selected":Kt=Hn;break;case"dangerouslySetInnerHTML":Rt=Hn;break;case"value":It=Hn;default:Xe(F,re,Ee,Hn)}}if(Ve!=null)if(q=It!==null?""+It:Tt(at),$(Ve)){for(re=0;re<Ve.length;re++)if(""+Ve[re]===q){F.push(Gt);break}}else""+Ve===q&&F.push(Gt);else Kt&&F.push(Gt);return F.push(tt),St(F,Rt,at),at;case"textarea":F.push(en("textarea")),Rt=Ve=Ee=null;for(at in q)if(g.call(q,at)&&(It=q[at],It!=null))switch(at){case"children":Rt=It;break;case"value":Ee=It;break;case"defaultValue":Ve=It;break;case"dangerouslySetInnerHTML":throw Error(t(91));default:Xe(F,re,at,It)}if(Ee===null&&Ve!==null&&(Ee=Ve),F.push(tt),Rt!=null){if(Ee!=null)throw Error(t(92));if($(Rt)&&1<Rt.length)throw Error(t(93));Ee=""+Rt}return typeof Ee=="string"&&Ee[0]===`
`&&F.push(Vt),Ee!==null&&F.push(c(H(""+Ee))),null;case"input":F.push(en("input")),It=Rt=at=Ee=null;for(Ve in q)if(g.call(q,Ve)&&(Kt=q[Ve],Kt!=null))switch(Ve){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":It=Kt;break;case"defaultValue":at=Kt;break;case"checked":Rt=Kt;break;case"value":Ee=Kt;break;default:Xe(F,re,Ve,Kt)}return Rt!==null?Xe(F,re,"checked",Rt):It!==null&&Xe(F,re,"checked",It),Ee!==null?Xe(F,re,"value",Ee):at!==null&&Xe(F,re,"value",at),F.push(ht),null;case"menuitem":F.push(en("menuitem"));for(var oa in q)if(g.call(q,oa)&&(Ee=q[oa],Ee!=null))switch(oa){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:Xe(F,re,oa,Ee)}return F.push(tt),null;case"title":F.push(en("title")),Ee=null;for(Hn in q)if(g.call(q,Hn)&&(Ve=q[Hn],Ve!=null))switch(Hn){case"children":Ee=Ve;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:Xe(F,re,Hn,Ve)}return F.push(tt),Ee;case"listing":case"pre":F.push(en(B)),Ve=Ee=null;for(It in q)if(g.call(q,It)&&(at=q[It],at!=null))switch(It){case"children":Ee=at;break;case"dangerouslySetInnerHTML":Ve=at;break;default:Xe(F,re,It,at)}if(F.push(tt),Ve!=null){if(Ee!=null)throw Error(t(60));if(typeof Ve!="object"||!("__html"in Ve))throw Error(t(61));q=Ve.__html,q!=null&&(typeof q=="string"&&0<q.length&&q[0]===`
`?F.push(Vt,c(q)):F.push(c(""+q)))}return typeof Ee=="string"&&Ee[0]===`
`&&F.push(Vt),Ee;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":F.push(en(B));for(var Ka in q)if(g.call(q,Ka)&&(Ee=q[Ka],Ee!=null))switch(Ka){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,B));default:Xe(F,re,Ka,Ee)}return F.push(ht),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return _t(F,q,B,re);case"html":return Ae.insertionMode===0&&F.push(Zn),_t(F,q,B,re);default:if(B.indexOf("-")===-1&&typeof q.is!="string")return _t(F,q,B,re);F.push(en(B)),Ve=Ee=null;for(Kt in q)if(g.call(q,Kt)&&(at=q[Kt],at!=null))switch(Kt){case"children":Ee=at;break;case"dangerouslySetInnerHTML":Ve=at;break;case"style":Ze(F,re,at);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:S(Kt)&&typeof at!="function"&&typeof at!="symbol"&&F.push(st,c(Kt),xt,c(H(at)),tn)}return F.push(tt),St(F,Ve,Ee),Ee}}var Er=f("</"),pt=f(">"),Mt=f('<template id="'),Jt=f('"></template>'),on=f("<!--$-->"),ln=f('<!--$?--><template id="'),vr=f('"></template>'),fr=f("<!--$!-->"),ha=f("<!--/$-->"),jr=f("<template"),nr=f('"'),Lr=f(' data-dgst="');f(' data-msg="'),f(' data-stck="');var te=f("></template>");function me(F,B,q){if(a(F,ln),q===null)throw Error(t(395));return a(F,q),o(F,vr)}var Ce=f('<div hidden id="'),Ye=f('">'),He=f("</div>"),Ke=f('<svg aria-hidden="true" style="display:none" id="'),et=f('">'),kt=f("</svg>"),Yt=f('<math aria-hidden="true" style="display:none" id="'),On=f('">'),vn=f("</math>"),xr=f('<table hidden id="'),Jn=f('">'),yr=f("</table>"),ta=f('<table hidden><tbody id="'),Pi=f('">'),Nn=f("</tbody></table>"),Aa=f('<table hidden><tr id="'),Fa=f('">'),Zr=f("</tr></table>"),fo=f('<table hidden><colgroup id="'),Oa=f('">'),ru=f("</colgroup></table>");function si(F,B,q,re){switch(q.insertionMode){case 0:case 1:return a(F,Ce),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,Ye);case 2:return a(F,Ke),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,et);case 3:return a(F,Yt),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,On);case 4:return a(F,xr),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,Jn);case 5:return a(F,ta),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,Pi);case 6:return a(F,Aa),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,Fa);case 7:return a(F,fo),a(F,B.segmentPrefix),a(F,c(re.toString(16))),o(F,Oa);default:throw Error(t(397))}}function li(F,B){switch(B.insertionMode){case 0:case 1:return o(F,He);case 2:return o(F,kt);case 3:return o(F,vn);case 4:return o(F,yr);case 5:return o(F,Nn);case 6:return o(F,Zr);case 7:return o(F,ru);default:throw Error(t(397))}}var Xu=f('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),au=f('$RS("'),us=f('","'),ji=f('")<\/script>'),cs=f('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),ou=f('$RC("'),ds=f('","'),ec=f('")<\/script>'),An=f('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),na=f('$RX("'),Zs=f('"'),qs=f(")<\/script>"),ui=f(","),iu=/[<\u2028\u2029]/g;function Fo(F){return JSON.stringify(F).replace(iu,function(B){switch(B){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no
`,o.current,t.path,I);const N=(_=o.current)==null?void 0:_.querySelectorAll(".internal-link");N==null||N.forEach(k=>{const R=k,L=R.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||k.classList.add("is-unresolved"),R.addEventListener("mouseover",U=>{U.stopPropagation(),r.app.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:I.containerEl,targetEl:R,linktext:L,sourcePath:R.href})})})}M()},[t.content,i]);const y=async()=>{if(f)try{await be.deleteMemoById(a.id),n(a.id)}catch(I){new C.Notice(I.message)}else p()},w=async()=>{switch(a.sourceType){case"DAILY":await _2(a.id,a.path);break;case"CANVAS":await H2(a.id,a.path);break;case"MULTI":await R2(a.path);break;case"FILE":await B2(a.id,a.path);break}},T=async()=>{try{const I=await be.restoreMemoById(a.id),M=r.app,N=M==null?void 0:M.loadLocalStorage("tokenForSync");I&&I.webId&&N&&r.settings.startSync&&await Zg(I.webId),I&&be.editMemo(I),n(a.id),new C.Notice(E("RESTORE SUCCEED"))}catch(I){new C.Notice(I.message)}},S=()=>{f&&p(!1)};return v.jsxs("div",{ref:i,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:S,children:[v.jsxs("div",{className:"memo-top-wrapper",children:[v.jsxs("span",{className:"time-text",children:[E("DELETE AT")," ",a.deletedAtStr]}),v.jsxs("div",{className:"btns-container",children:[v.jsx("span",{ref:I=>{I&&C.setIcon(I,"more-horizontal")},className:"btn more-action-btn"}),v.jsx("div",{className:"more-action-btns-wrapper",children:v.jsxs("div",{className:"more-action-btns-container",children:[v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),v.jsx("span",{className:"btn restore-btn",onClick:T,children:E("RESTORE")})]}),v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:g.source,className:"more-action-item-icon"}),v.jsx("span",{className:"btn",onClick:w,children:E("SOURCE")})]}),v.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[v.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),v.jsx("span",{className:`btn delete-btn ${f?"final-confirm":""}`,onClick:y,children:E(f?"CONFIRM":"DELETE")})]})]})})]})]}),v.jsx("div",{ref:o,className:"memo-content-text",onContextMenu:I=>{I.preventDefault(),I.stopPropagation()}})]})},uCe=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:i,filter:l}=t,c=sn.getQueryById(l);return!!(r||a&&a.from<a.to||o||i||c)||c||n?e.filter(p=>{let g=!0;if(p.thinoType!==void 0&&n&&p.thinoType==="TASK-DONE"&&(g=!1),p.content.contains("comment:")&&(g=!1),c){const y=JSON.parse(c.querystring);Array.isArray(y)&&(g=Bp(p,y))}if(r){const y=new Set;for(const w of Array.from(p.content.match($r)||[])){const S=w.replace($r,"$1").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}for(const w of Array.from(p.content.match(ua)||[])){const S=w.replace(ua,"$1").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}for(const w of Array.from(p.content.match(Wa)||[])){const S=w.replace(Wa,"$2").trim().split("/");let I="";for(const M of S)I+=M,y.add(I),I+="/"}y.has(r)||(g=!1)}return a&&a.from<a.to&&(ut.getTimeStampByDate(p.createdAt)<a.from||ut.getTimeStampByDate(p.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(p.content.match($r)!==null||p.content.match(Wa)!==null||p.content.match(ua)!==null)||o==="LINKED"&&p.content.match(Cf)===null||o==="IMAGED"&&p.content.match(Mf)===null||o==="CONNECTED"&&p.content.match(nd)===null)&&(g=!1),i&&!p.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(p=>!p.content.contains("comment:"))},cCe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=am(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&C.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const w=uCe({memos:n.filter(T=>T.deletedAt!==""&&T.deletedAt),query:e,HideDoneTasks:!1});o(w),r.setFinish()},[n,i.current,e]);const c=P.useCallback(w=>{o(T=>T.filter(S=>S.id!==w))},[]),f=P.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)}
7 months ago
* **开源项目**
* 😋 精美且细节的视觉样式
7 months ago
* 📑 体验优良的交互逻辑`,i=()=>{dt.setAppSetting({useTinyUndoHistoryCache:!t})},l=()=>{dt.setAppSetting({shouldSplitMemoWord:!r})},c=()=>{dt.setAppSetting({shouldHideImageUrl:!n})},f=()=>{dt.setAppSetting({shouldUseMarkdownParser:!a})},p=async()=>{const g=be.getState().memos.map(T=>({...T})),y=JSON.stringify(g),w=document.createElement("a");w.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(y)),w.setAttribute("download","data.json"),w.style.display="none",document.body.appendChild(w),w.click(),document.body.removeChild(w)};return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"section-container preferences-section-container",children:[v.jsx("p",{className:"title-text",children:"Memo 显示相关"}),v.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:oT(o)}}),v.jsxs("label",{className:"form-label checkbox-form-label",onClick:l,children:[v.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),v.jsx("img",{className:"icon-img",src:r?$0:Z0})]}),v.jsxs("label",{className:"form-label checkbox-form-label",onClick:f,children:[v.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),v.jsx("img",{className:"icon-img",src:a?$0:Z0})]}),v.jsxs("label",{className:"form-label checkbox-form-label",onClick:c,children:[v.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),v.jsx("img",{className:"icon-img",src:n?$0:Z0})]})]}),v.jsxs("div",{className:"section-container preferences-section-container",children:[v.jsx("p",{className:"title-text",children:"编辑器"}),v.jsxs("label",{className:"form-label checkbox-form-label",onClick:i,children:[v.jsxs("span",{className:"normal-text",children:["启用"," ",v.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),v.jsx("img",{className:"icon-img",src:t?$0:Z0})]})]}),v.jsxs("div",{className:"section-container hidden",children:[v.jsx("p",{className:"title-text",children:"其他"}),v.jsx("div",{className:"btn-container",children:v.jsx("button",{className:"btn export-btn",onClick:p,children:"导出数据(JSON)"})})]})]})},fCe=()=>{const{globalState:{isMobileView:e}}=P.useContext(Lt);P.useEffect(()=>{be.fetchAllMemos()},[]);const t=P.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return v.jsxs("div",{className:"preference-wrapper",children:[v.jsx("div",{className:"section-header-container",children:v.jsxs("div",{className:"title-text",children:[v.jsx(ts,{when:e,children:v.jsx("button",{className:"action-btn",onClick:t})}),v.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),v.jsx("div",{className:"sections-wrapper",children:v.jsx(dCe,{})})]})},hCe=()=>{const{dailyNotesState:{app:e},locationState:{query:t},globalState:{isMobileView:n,changedByMemos:r},memoState:{memos:a}}=P.useContext(Lt),o=am(),[i,l]=P.useState([]),[c,f]=P.useState([]),p=ne.useRef(null),g=ne.useRef(null),[y,w]=P.useState(!1),[T,S]=P.useState([]),I=ne.useRef([]),M=P.useCallback(({memos:k,query:R,HideDoneTasks:L})=>{const{tag:H,duration:U,type:z,text:$,filter:X}=R,Q=sn.getQueryById(X);return!!(H||U&&U.from<U.to||z||$||Q)||Q||L?k.filter(ue=>{let fe=!0;if(ue.thinoType!==void 0&&L&&ue.thinoType==="TASK-DONE"&&(fe=!1),ue.content.contains("comment:")&&(fe=!1),Q){const Z=JSON.parse(Q.querystring);Array.isArray(Z)&&(fe=Bp(ue,Z))}if(H){const Z=new Set;for(const pe of Array.from(ue.content.match($r)||[])){const de=pe.replace($r,"$1").trim().split("/");let K="";for(const ae of de)K+=ae,Z.add(K),K+="/"}for(const pe of Array.from(ue.content.match(ua)||[])){const de=pe.replace(ua,"$1").trim().split("/");let K="";for(const ae of de)K+=ae,Z.add(K),K+="/"}for(const pe of Array.from(ue.content.match(Wa)||[])){const de=pe.replace(Wa,"$2").trim().split("/");let K="";for(const ae of de)K+=ae,Z.add(K),K+="/"}Z.has(H)||(fe=!1)}return U&&U.from<U.to&&(ut.getTimeStampByDate(ue.createdAt)<U.from||ut.getTimeStampByDate(ue.createdAt)>U.to)&&(fe=!1),z&&(z==="NOT_TAGGED"&&(ue.content.match($r)
${L}`}}}let M=p;M||(M=t.MemoSaveLocation),(_=e.settings)!=null&&_.AppendOrPrependTextViaServer&&(w=`${t==null?void 0:t.PrependViaServer}${(t==null?void 0:t.WithNewLineViaServer)==="prepend"||(t==null?void 0:t.WithNewLineViaServer)==="both"?`
`:""}${w}${(t==null?void 0:t.WithNewLineViaServer)==="append"||(t==null?void 0:t.WithNewLineViaServer)==="both"?`
`:""}${t==null?void 0:t.AppendViaServer}`);const N=await be.createThino({content:w,isList:f,type:M});N&&(be.pushMemo(N),ot.clearQuery()),a.statusCode=200,a.setHeader("Content-Type","application/json"),a.end(JSON.stringify({status:"success",thino:N,link:`obsidian://thino?openId=${N.id}`}))});break}case"/search":{if(r.method!=="GET"){a.statusCode=404,a.end();break}const i=o.query,{keyword:l}=i,c=be.getThinoViaKeyword(l);a.statusCode=200,a.setHeader("Content-Type","application/json");const f=JSON.stringify({status:"success",thinos:c});a.end(f);break}case"/list":{if(r.method!=="GET"){a.statusCode=404,a.end();break}const{count:i}=o.query,l=be.getState().memos.slice(0,parseInt(i));a.statusCode=200,a.setHeader("Content-Type","application/json"),a.end(JSON.stringify({status:"success",thinos:l}));break}case"/info":{if(r.method!=="GET"){a.statusCode=404,a.end();break}const{getSettings:i}=o.query;if(!i){a.statusCode=404,a.end();break}const l=ft.getState().settings;a.statusCode=200,a.setHeader("Content-Type","application/json");const c=JSON.stringify({status:"success",infoSettings:l});a.end(c);break}default:a.statusCode=404,a.end();break}}}catch(o){console.error(o),a.statusCode=500,a.end({status:"error",message:o.message})}});return{listen(r,a){try{n.listen({port:parseInt(a),host:r})}catch(o){console.error(o),new C.Notice(E("Thino - Failed to start HTTP server, please check the port is available."))}new C.Notice(`${E("Thino - Started HTTP server on port")} ${a}`)},close(){n.close(),new C.Notice(E("Thino - Terminated HTTP server"))}}}const{clipboard:mr}=C.Platform.isDesktop?require("electron"):"";class $Me{constructor(){De(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 ip=new $Me;let kg=null,SN=mr==null?void 0:mr.readText(),DN=mr==null?void 0:mr.readImage();mr&&(mr.on=(e,t)=>(ip.on(e,t),mr),mr.once=(e,t)=>(ip.once(e,t),mr),mr.off=(e,t)=>(t?ip.removeListener(e,t):ip.removeAllListeners(e),mr),mr.startWatching=()=>(kg||(kg=setInterval(()=>{ZMe(SN,SN=mr==null?void 0:mr.readText())&&ip.emit("text-changed"),qMe(DN,DN=mr==null?void 0:mr.readImage())&&ip.emit("image-changed")},500)),mr),mr.stopWatching=()=>(kg&&clearInterval(kg),kg=null,mr));function ZMe(e,t){return t&&e!==t}function qMe(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var kN;const QD=(kN=require("electron"))==null?void 0:kN.remote;var NN,AN;const TN=(AN=(NN=require("electron"))==null?void 0:NN.remote)==null?void 0:AN.screen;class GMe{constructor(t,n){De(this,"isRegisted");De(this,"leaf");De(this,"clipboard");De(this,"isScreenTop",!1);De(this,"currentSplitWindow");De(this,"intervalNum");De(this,"allowsCopy",!1);De(this,"plugin");De(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=mr}async onload(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{QD.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:E("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&&(QD.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally),this.clipboard.off("text-changed"),this.cli
`:" ";switch(t[c==="prepend"?"SharePrependType":"ShareAppendType"]){case"none":f();break;case"preset":t.ShareToThinoWithText&&(c==="prepend"?o=t.ShareToThinoWithTextPrepend+g:i=g+t.ShareToThinoWithTextAppend),f();break;case"input":{const y="Thino "+E(c==="prepend"?"Prepend text":"Append text");new sP(e,y,w=>{c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w,f()}).open();break}case"selectTags":new tz(e,y=>{const w=y.length>0?y.map(T=>"#"+T).join(" "):"";c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w.trim(),f()}).open();break;default:p(new Error("Invalid configuration type."))}});Promise.all([l("append"),l("prepend")]).then(()=>n(o,i)).then(()=>r()).catch(a)})}const T3e=e=>{const t=e.embedRegistry;if(!t)return!1;const n=t.embedByExtension.md,r=n({app:e,containerEl:createDiv()},null,null);return r.editable=!0,r.set(""),r.showEditor(),Object.getPrototypeOf(Object.getPrototypeOf(r.editMode)).constructor};async function XE(e){try{const t=e.app.internalPlugins.plugins["daily-notes"];let n;n={settings:{...e.settings,tokenForVerify:"***"},plugins:Object.keys(e.app.plugins.plugins),manifest:e.manifest,platform:C.Platform.resourcePathPrefix},t&&(n={...n,dailyNotePluginInfo:{options:t.instance.options}}),await navigator.clipboard.writeText(`\`\`\`json
${JSON.stringify(n,null,2)}
\`\`\``),new C.Notice(E("Debug info copied to clipboard"))}catch(t){console.error(t)}}class I3e extends C.Plugin{constructor(){super(...arguments);De(this,"settings");De(this,"settingTab");De(this,"triggerBySelf",!1);De(this,"updatedID","");De(this,"debounceTimer",0);De(this,"apiHttpServer",null);De(this,"captureService",null);De(this,"loaded",!1);De(this,"MarkdownEditor")}async onload(){this.MarkdownEditor=T3e(this.app),await this.loadSettings(),CCe(),this.registerRibbon(),await this.verify();try{await this.checkVersionAndShowChangeLog()}catch(n){console.error(n)}this.settingTab=new HCe(this.app,this),this.addSettingTab(this.settingTab),this.initApp(),this.initEditor(),this.initURIHandler(),this.registerMobileEvent(),this.registerCommands(),this.registerCanvasNodeMemos(),this.registerHoverEvent(),this.registerLinkOpen(),this.registerCodeBlocks(),this.registerEditorContextMenu(),this.registerEditorSuggest(new ICe(this.app,this)),this.registerEditorExtension([LMe]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(lo,n=>new gf(n,this))}async loadSettings(){this.settings=Object.assign({},Ei,await this.loadData()),ft.setSettings(this.settings)}async saveSettings(){await this.saveData(this.settings),ft.setSettings(this.settings)}onunload(){var r;this.app.workspace.detachLeavesOfType(lo),be.clearMemos(),Le.dispatch({type:"CLEAR_MEMOS",payload:null}),Le.dispatch({type:"CLEAR_FILES",payload:null}),Le.dispatch({type:"CLEAR_VIEW",payload:null});const n=document.body.find(".dialog-wrapper");n&&((r=n.parentElement)==null||r.detach()),this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null),this.captureService&&this.captureService.onunload(),new C.Notice(E("Close Memos Successfully"))}initEditor(){this.register(ww(C.MetadataCache.prototype,{getFileCache:n=>function(r){return!(r!=null&&r.path)&&!r?null:n.call(this,r)}}))}initApp(){ft.setApp(this.app)}initURIHandler(){this.registerObsidianProtocolHandler("thino",async n=>{var i,l,c;if(!n)return;if(n.openSettings&&(this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos")),n.userid)try{const f=n.userid;BMe(f,this.app),HMe(C.moment().add(30,"days").valueOf(),this.app),dt.setRefresh(!0)}catch(f){console.error(f),new C.Notice(E("Failed to verify"))}if(n.token)try{const f=n.token;(i=this.app)==null||i.saveLocalStorage("tokenForSync",f),setTimeout(()=>{this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos"),this.settingTab.display()},200),new C.Notice(E("Saved sync token successfully"))}catch(f){console.error(f),new C.Notice(E("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const f=await ZO();await navigator.clipboard.writeText(f),new C.Notice(E("Copied app id successfully"))}const r=(l=ft.getState())==null?void 0:l.verifyState,a=!C.Platform.isDesktop&&await((c=window.Capacitor)==null?void 0:c.Plugins.Device.getId()),o=C.Platform.isDesktop?await cr():a.identifier||a.uuid;if(!(!r||(r==null?void 0:r.appId)!==o)){if(n.content){const f=n.type,p=decodeURI(n.content)!==n.content?decodeURI(n.content):n.content,g=n.task,y=await be.createThino({content:p,type:f,isList:!!g});if(!y)return;be.pushMemo(y),ot.clearQuery()}n.openId&&await be.openThinoByID(n.openId)}})}initGlobalManifest(){dt.setPluginManifest(this.manifest)}stopServer(){this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null)}async stopEnableList(){var o,i;const n=(o=ft.getState())==null?void 0:o.verifyState,r=!C.Platform.isDesktop&&await((i=window.Capacitor)==null?void 0:i.Plugins.Device.getId()),a=C.Platform.isDesktop?await cr():r.identifier||r.uuid;if(!n||(n==null?void 0:n.appId)!==a){this.settings.EnabledLocationList=[{value:"DAILY",target:"ProcessEntriesBelow",insert:"InsertAfter"}],this.settingTab.debounceApplySettingsUpdate();return}}async initServer(){var o,i;if(C.Platform.isMobile||!this.settings.EnabledHttpApi)return;const n=(o=ft.getState())==null?void 0:o.verifyState,r=!C.Platform.isDesktop&&await((i=window.Capacitor)==null?v
`);try{await MN(this.app,this.settings,async(l,c)=>{i=l+i+c;const f=await be.createThino({content:i,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});be.pushMemo(f)})}catch(l){console.error("Configuration failed:",l);return}})})})))}registerCommands(){K0.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),["Modern","Clean","Minimal","Gradient"].forEach(n=>{this.addCommand({id:`share-thino-via-${n.toLowerCase()}`,name:E("Share thino")+` [${E(n)}]`,editorCallback:(r,a)=>{const o=r.getSelection();if(o.length===0)return;const i={id:`temp-${Date.now()}`,content:o,createdAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),updatedAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),deletedAt:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",thinoType:"JOURNAL",hasId:"",linkId:"",resourceList:[],creatorName:"thino",sourceType:"DAILY",path:a.file.path};of(i,n.toLowerCase(),a)}})}),this.addCommand({id:"focus-mode",name:"Focus mode",callback:()=>{const n=document.body.hasClass("thino-focus");document.body.toggleClass("thino-focus",!n)}}),this.addCommand({id:"hide-side-bar",name:E("Toggle sidebar visibility"),callback:()=>{const n=dt.getState().isMobileView,r=document.body.hasClass("thino-hide-side-bar");document.body.toggleClass("thino-hide-side-bar",n?!1:!r)}}),this.addCommand({id:"hide-tags",name:E("Toggle tags visibility"),callback:()=>{const n=document.body.hasClass("thino-hide-tags");document.body.toggleClass("thino-hide-tags",!n)}}),this.addCommand({id:"hide-query-list",name:E("Toggle query list visibility"),callback:()=>{const n=document.body.hasClass("thino-hide-query-list");document.body.toggleClass("thino-hide-query-list",!n)}}),this.addCommand({id:"insert-task",name:E("Insert task"),checkCallback:n=>{const r=this.app.plugins.getPlugin("obsidian-tasks-plugin"),a=this.app.workspace.getLeavesOfType("thino_view").first();if(r&&a)return n||this.app.plugins.plugins["obsidian-tasks-plugin"].apiV1.createTaskLineModal().then(i=>{var c;const l=this.app.workspace.activeEditor;l&&((c=l.editor)==null||c.insertText(i))}),!0}}),this.addCommand({id:"show-thino-editor",name:E("Show thino editor"),checkCallback:n=>{if(be.initialized&&ft.initialized){if(!n){if(!ft.getState().view){new C.Notice(E("Please open thino first"));return}new q6(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:E("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(gf)&&this.settings.needVerify)return n||dt.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:E("Copy debug info"),callback:async()=>{await XE(this)}}),this.addCommand({id:"insert-editor",name:E("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:E("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:E("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:E("ReSync web thinos to local"),callback:()=>{Pxe(this.app)}}),this.addCommand({id:"init-thino-sync",name:E("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new C.Notice(E("Please input token first"));return}if(!this.settings.startSync){new C.Notice(E("Please enable sync first"));return}try{await be.initSync()}catch(a){console.error(a),new C.Notice(E("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:E("Show daily thino"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:E("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:E("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){await this.stopEnableList(),await t
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
7 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:f}=await y3e(o,c),p=JSON.parse(new TextDecoder().decode(f));return!p||p.iss!=="pkmer"||p.type!=="thino"||p.appId!==n?!1:(ft.setVerifyState(p),!0)}catch(f){console.error(f)}}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 ex(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(lo).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(lo).length>0){ot.setPathname("/daily");return}await this.openMemos(),ot.setPathname("/daily")}async openMemos(n="center",r){const a=this.app.workspace;if(a.getLeavesOfType(lo).length>0){const l=a.getLeavesOfType(lo)[0];a.setActiveLeaf(l),a.revealLeaf(l);return}a.detachLeavesOfType(lo);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:lo}),a.revealLeaf(o));const i=o.view.containerEl.querySelector("textarea");i&&i.focus(),r==null||r()}async searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(lo);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(lo).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(lo);if(!(r.length>0)){new C.Notice(E("Please Open Memos First"));return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var o,i,l;const n=this.app.workspace;if(n.detachLeavesOfType(lo),!this.app.plugins.getPlugin("obsidian-hover-editor")){new C.Notice(E("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:lo}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(i=this.settings)!=null&&i.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((l=a.view.containerEl.querySelector("textarea"))==null||l.focus()))}}class ex extends C.Modal{constructor(n,r){super(n);De(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;this.containerEl.toggleClass("thino-changelog-modal",!0),n.createEl("h2",{text:E("Thino update info"),cls:"thino-changelog-title"}).createDiv({cls:"thino-changelog-version",text:`${this.version}`});try{n.createEl("h3",{text:E("Latest version")});const a=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:E("Previous version")});const o=n.createDiv("prev-change-log"),l=await C.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new C.Component;const[c,f]=this.getLatestVersionContent(l.text);let p=c,g=f;try{const y=localStorage.getItem("language"),w=y&&(y==="zh"||y==="zh-TW");p=w?c.replaceAll("> [!tips]+","> [!tips]-").replaceAll("> [!note]-","> [!note]+"):c,g=w?f.replaceAll("> [!tips]+","> [!tips]-").replaceAll("> [!note]-","> [!note]+"):f}catch(y){console.error(y)}await C.MarkdownRenderer.render(this.app,p,a,"",this.component),await C.MarkdownRenderer.render(this.app,g,o,"",this.component)}catch(a){console.error(a),n.createEl("p",{text:E("Failed to load changelog")}),n.createEl("a",{text:E("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 i=n.length;a.leng