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.

270 lines
1.4 MiB

3 months ago
"use strict";var qL=Object.defineProperty;var GL=(e,t,n)=>t in e?qL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Se=(e,t,n)=>(GL(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("obsidian"),wS=require("@codemirror/language"),Jg=require("@codemirror/state"),$l=require("@codemirror/view");function JL(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 $N={exports:{}},gg={},ZN={exports:{}},gn={},xC;function KL(){if(xC)return gn;xC=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"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(X){return X===null||typeof X!="object"?null:(X=g&&X[g]||X["@@iterator"],typeof X=="function"?X:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,D={};function I(X,ae,De){this.props=X,this.context=ae,this.refs=D,this.updater=De||w}I.prototype.isReactComponent={},I.prototype.setState=function(X,ae){if(typeof X!="object"&&typeof X!="function"&&X!=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,X,ae,"setState")},I.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function M(){}M.prototype=I.prototype;function N(X,ae,De){this.props=X,this.context=ae,this.refs=D,this.updater=De||w}var _=N.prototype=new M;_.constructor=N,S(_,I.prototype),_.isPureReactComponent=!0;var k=Array.isArray,B=Object.prototype.hasOwnProperty,L={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function V(X,ae,De){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)B.call(ae,je)&&!R.hasOwnProperty(je)&&(Re[je]=ae[je]);var Xe=arguments.length-2;if(Xe===1)Re.children=De;else if(1<Xe){for(var Ze=Array(Xe),st=0;st<Xe;st++)Ze[st]=arguments[st+2];Re.children=Ze}if(X&&X.defaultProps)for(je in Xe=X.defaultProps,Xe)Re[je]===void 0&&(Re[je]=Xe[je]);return{$$typeof:e,type:X,key:Fe,ref:Be,props:Re,_owner:L.current}}function Y(X,ae){return{$$typeof:e,type:X.type,key:ae,ref:X.ref,props:X.props,_owner:X._owner}}function Z(X){return typeof X=="object"&&X!==null&&X.$$typeof===e}function Q(X){var ae={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(De){return ae[De]})}var G=/\/+/g;function le(X,ae){return typeof X=="object"&&X!==null&&X.key!=null?Q(""+X.key):ae.toString(36)}function se(X,ae,De,je,Re){var Fe=typeof X;(Fe==="undefined"||Fe==="boolean")&&(X=null);var Be=!1;if(X===null)Be=!0;else switch(Fe){case"string":case"number":Be=!0;break;case"object":switch(X.$$typeof){case e:case t:Be=!0}}if(Be)return Be=X,Re=Re(Be),X=je===""?"."+le(Be,0):je,k(Re)?(De="",X!=null&&(De=X.replace(G,"$&/")+"/"),se(Re,ae,De,"",function(st){return st})):Re!=null&&(Z(Re)&&(Re=Y(Re,De+(!Re.key||Be&&Be.key===Re.key?"":(""+Re.key).replace(G,"$&/")+"/")+X)),ae.push(Re)),1;if(Be=0,je=je===""?".":je+":",k(X))for(var Xe=0;Xe<X.length;Xe++){Fe=X[Xe];var Ze=je+le(Fe,Xe);Be+=se(Fe,ae,De,Ze,Re)}else if(Ze=y(X),typeof Ze=="function")for(X=Ze.call(X),Xe=0;!(Fe=X.next()).done;)Fe=Fe.value,Ze=je+le(Fe,Xe++),Be+=se(Fe,ae,De,Ze,Re);else if(Fe==="object")throw ae=String(X),Error("O
`);o.length===0&&await e.vault.adapter.write(ff(e),JSON.stringify({queries:[]},null,2));const i=[];for(let l=0;l<o.length;l++){const c=l,f="Memos";let h="未命名";const g=o[l];let y=x.moment().format("YYYY/MM/DD HH:mm:ss"),w="[]";const S=g.match(/^\d{14,16}/);S&&(y=x.moment(S[0].slice(0,14),"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:ss"));const D=g.match(/\[\{(.+)\}\]/);D&&(w=D[0]);const I=g.match(/\s(.+)\s\[\{/);I&&(h=I[0].slice(1,-3)),i.push({id:c,pinnedAt:"",createdAt:y,updatedAt:y,title:h,querystring:w,userId:f})}await e.vault.adapter.write(ff(e),JSON.stringify({queries:i},null,2))}},MR=async()=>{const{app:e}=Le.getState().dailyNotesState;return await hA(e,ff(e))||await pA(e),await Rp(e)||[]},kR=(e,t)=>({createdAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:E("Temp Filter"),updatedAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),NR=async(e,t)=>{const n=await Rp(Le.getState().dailyNotesState.app)||[],r={createdAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),id:x.moment().format("YYYYMMDDHHmmss")+n.length,pinnedAt:"",querystring:t,title:e,updatedAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"};return n.push(r),await Av(Le.getState().dailyNotesState.app,n),r};var Ew={exports:{}};Ew.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,h="__lodash_placeholder__",g=1,y=2,w=4,S=1,D=2,I=1,M=2,N=4,_=8,k=16,B=32,L=64,R=128,V=256,Y=512,Z=30,Q="...",G=800,le=16,se=1,fe=2,$=3,he=1/0,ie=9007199254740991,ce=17976931348623157e292,X=NaN,ae=4294967295,De=ae-1,je=ae>>>1,Re=[["ary",R],["bind",I],["bindKey",M],["curry",_],["curryRight",k],["flip",Y],["partial",B],["partialRight",L],["rearg",V]],Fe="[object Arguments]",Be="[object Array]",Xe="[object AsyncFunction]",Ze="[object Boolean]",st="[object Date]",Ct="[object DOMException]",tn="[object Error]",_e="[object Function]",et="[object GeneratorFunction]",nt="[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]",sn="[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,xe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ye=/&(?:amp|lt|gt|quot|#39);/g,He=/[&<>"']/g,Qe=RegExp(Ye.source),tt=RegExp(He.source),kt=/<%-([\s\S]+?)%>/g,Yt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cr=/^\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]/,iu=/\\(\\)?/g,si=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,li=/\w*$/,nc=/^[-+]0x[0-9a-f]+$/i,su=/^0b[01]+$/i,us=/^\[object .+?Constructor\]$/,ji=/^0o[0-7]+$/i,cs=/^(?:0|[1-9]\d*)$/,lu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ds=/($^)/,rc=/['\n\r\u2028\u2029\\]/g,An="\\ud800-\\udfff",na="\\u0300-\\u036f",qs="\\ufe20-\\ufe2f",Gs="\\u20d0-\\u20ff",ui=na+qs+Gs,uu="\\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",Js="A-Z\\xc0-\\xd6\\xd8-\\xde",Ks="\\ufe0e\\ufe0f",Qs=ho+Pa+fs+Rr,po="[']",hs="["+An+"]",ci="["+Qs+"]",mo="["+ui+"]",A="\\d+",U="["+uu+"]",K="["+Fo+"]",oe="[^"+An+Qs+A+uu+Fo+Js+
6 months ago
/* [wrapped with `+p+`] */
3 months ago
`)}function $1(d){return an(d)||Qd(d)||!!(Iy&&d&&d[Iy])}function Vo(d,p){var T=typeof d;return p=p??ie,!!p&&(T=="number"||T!="symbol"&&cs.test(d))&&d>-1&&d%1==0&&d<p}function Fn(d,p,T){if(!Sr(T))return!1;var j=typeof p;return(j=="number"?Zo(T)&&Vo(p,T.length):j=="string"&&p in T)?Ns(T[p],d):!1}function Zm(d,p){if(an(d))return!1;var T=typeof d;return T=="number"||T=="symbol"||T=="boolean"||d==null||Di(d)?!0:Cr.test(d)||!yn.test(d)||p!=null&&d in Yn(p)}function wt(d){var p=typeof d;return p=="string"||p=="number"||p=="symbol"||p=="boolean"?d!=="__proto__":d===null}function Dl(d){var p=Vd(d),T=J[p];if(typeof T!="function"||!(p in nn.prototype))return!1;if(d===T)return!0;var j=zd(T);return!!j&&d===j[0]}function qm(d){return!!Wf&&Wf in d}var Xy=hc?Fu:yS;function Wd(d){var p=d&&d.constructor,T=typeof p=="function"&&p.prototype||Hi;return d===T}function jc(d){return d===d&&!Sr(d)}function $d(d,p){return function(T){return T==null?!1:T[d]===p&&(p!==n||d in Yn(T))}}function Gm(d){var p=ye(d,function(j){return T.size===f&&T.clear(),j}),T=p.cache;return p}function e0(d,p){var T=d[1],j=p[1],z=T|j,ee=z<(I|M|R),de=j==R&&T==_||j==R&&T==V&&d[7].length<=p[8]||j==(R|V)&&p[7].length<=p[8]&&T==_;if(!(ee||de))return d;j&I&&(d[2]=p[2],z|=T&I?0:N);var ve=p[3];if(ve){var Te=d[3];d[3]=Te?Rm(Te,ve,p[4]):ve,d[4]=Te?_o(d[3],h):p[4]}return ve=p[5],ve&&(Te=d[5],d[5]=Te?Th(Te,ve,p[6]):ve,d[6]=Te?_o(d[5],h):p[6]),ve=p[7],ve&&(d[7]=ve),j&R&&(d[8]=d[8]==null?p[8]:ma(d[8],p[8])),d[9]==null&&(d[9]=p[9]),d[0]=p[0],d[1]=z,d}function t0(d){var p=[];if(d!=null)for(var T in Yn(d))p.push(T);return p}function n0(d){return bd.call(d)}function Ah(d,p,T){return p=kr(p===n?d.length-1:p,0),function(){for(var j=arguments,z=-1,ee=kr(j.length-p,0),de=Oe(ee);++z<ee;)de[z]=j[p+z];z=-1;for(var ve=Oe(p+1);++z<p;)ve[z]=j[z];return ve[p]=T(de),xr(d,this,ve)}}function Fh(d,p){return p.length<2?d:So(d,Sa(p,0,-1))}function ia(d,p){for(var T=d.length,j=ma(p.length,T),z=Ha(d);j--;){var ee=p[j];d[j]=Vo(ee,T)?z[ee]:n}return d}function Do(d,p){if(!(p==="constructor"&&typeof d[p]=="function")&&p!="__proto__")return d[p]}var Ms=Jm(Br),Lc=gm||function(d,p){return zn.setTimeout(d,p)},Oh=Jm(mh);function Wo(d,p,T){var j=p+"";return Oh(d,W1(j,a0(Wm(j),T)))}function Jm(d){var p=0,T=0;return function(){var j=Y1(),z=le-(j-T);if(T=j,z>0){if(++p>=G)return arguments[0]}else p=0;return d.apply(n,arguments)}}function To(d,p){var T=-1,j=d.length,z=j-1;for(p=p===n?j:p;++T<p;){var ee=jd(T,z),de=d[ee];d[ee]=d[T],d[T]=de}return d.length=p,d}var r0=Gm(function(d){var p=[];return d.charCodeAt(0)===46&&p.push(""),d.replace(Jn,function(T,j,z,ee){p.push(z?ee.replace(iu,"$1"):j||T)}),p});function bi(d){if(typeof d=="string"||Di(d))return d;var p=d+"";return p=="0"&&1/d==-he?"-0":p}function Tl(d){if(d!=null){try{return wd.call(d)}catch{}try{return d+""}catch{}}return""}function a0(d,p){return wr(Re,function(T){var j="_."+T[0];p&T[1]&&!ol(d,j)&&d.push(j)}),d.sort()}function Km(d){if(d instanceof nn)return d.clone();var p=new ga(d.__wrapped__,d.__chain__);return p.__actions__=Ha(d.__actions__),p.__index__=d.__index__,p.__values__=d.__values__,p}function Z1(d,p,T){(T?Fn(d,p,T):p===n)?p=1:p=kr(un(p),0);var j=d==null?0:d.length;if(!j||p<1)return[];for(var z=0,ee=0,de=Oe(vu(j/p));z<j;)de[ee++]=Sa(d,z,z+=p);return de}function Ph(d){for(var p=-1,T=d==null?0:d.length,j=0,z=[];++p<T;){var ee=d[p];ee&&(z[j++]=ee)}return z}function Qm(){var d=arguments.length;if(!d)return[];for(var p=Oe(d-1),T=arguments[0],j=d;j--;)p[j-1]=arguments[j];return Ro(an(T)?Ha(T):[T],_r(p,1))}var $o=rn(function(d,p){return Vr(d)?$i(d,_r(p,1,Vr,!0)):[]}),bn=rn(function(d,p){var T=zr(p);return Vr(T)&&(T=n),Vr(d)?$i(d,_r(p,1,Vr,!0),Ot(T,2)):[]}),Jr=rn(function(d,p){var T=zr(p);return Vr(T)&&(T=n),Vr(d)?$i(d,_r(p,1,Vr,!0),n,T):[]});function Nr(d,p,T){var j=d==null?0:d.length;return j?(p=T||p===n?1:un(p),Sa(d,p<0?0:p,j)):[]}function sa(d,p,T){var j=d==null?0:d.length;return j?(p=T||p===n?1:un(p),p=j-p,Sa(d,0,p<0?0:p)):[]}function Io(d,p){return d&&d.length?Mc(d,Ot(p,3),!0,!0):[]}function Rc(d,p){return d&&d.length?Mc(d,Ot(p,3),!0):[]}function Ur(d,p,
`;d.replace(mt,function(zt,mn,Sn,Ti,Co,Ii){return Sn||(Sn=Ti),Ke+=d.slice(We,Ii).replace(rc,vd),mn&&(ve=!0,Ke+=`' +
6 months ago
__e(`+mn+`) +
3 months ago
'`),Co&&(Te=!0,Ke+=`';
`+Co+`;
__p += '`),Sn&&(Ke+=`' +
6 months ago
((__t = (`+Sn+`)) == null ? '' : __t) +
3 months ago
'`),We=Ii+zt.length,zt}),Ke+=`';
`;var Ut=Tn.call(p,"variable")&&p.variable;if(!Ut)Ke=`with (obj) {
`+Ke+`
8 months ago
}
3 months ago
`;else if(Oa.test(Ut))throw new Qt(l);Ke=(Te?Ke.replace(te,""):Ke).replace(me,"$1").replace(xe,"$1;"),Ke="function("+(Ut||"obj")+`) {
7 months ago
`+(Ut?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(Te?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
3 months ago
`)+Ke+`return __p
}`;var cn=IC(function(){return Dn(ee,Nt+"return "+Ke).apply(n,de)});if(cn.source=Ke,lS(cn))throw cn;return cn}function tL(d){return Un(d).toLowerCase()}function nL(d){return Un(d).toUpperCase()}function rL(d,p,T){if(d=Un(d),d&&(T||p===n))return ot(d);if(!d||!(p=hr(p)))return d;var j=yo(d),z=yo(p),ee=Hn(j,z),de=oa(j,z)+1;return Es(j,ee,de).join("")}function aL(d,p,T){if(d=Un(d),d&&(T||p===n))return d.slice(0,Vf(d)+1);if(!d||!(p=hr(p)))return d;var j=yo(d),z=oa(j,yo(p))+1;return Es(j,0,z).join("")}function oL(d,p,T){if(d=Un(d),d&&(T||p===n))return d.replace(Pi,"");if(!d||!(p=hr(p)))return d;var j=yo(d),z=Hn(j,yo(p));return Es(j,z).join("")}function iL(d,p){var T=Z,j=Q;if(Sr(p)){var z="separator"in p?p.separator:z;T="length"in p?un(p.length):T,j="omission"in p?hr(p.omission):j}d=Un(d);var ee=d.length;if(dc(d)){var de=yo(d);ee=de.length}if(T>=ee)return d;var ve=T-mu(j);if(ve<1)return j;var Te=de?Es(de,0,ve).join(""):d.slice(0,ve);if(z===n)return Te+j;if(de&&(ve+=Te.length-ve),uS(z)){if(d.slice(ve).search(z)){var We,$e=Te;for(z.global||(z=yd(z.source,Un(li.exec(z))+"g")),z.lastIndex=0;We=z.exec($e);)var Ke=We.index;Te=Te.slice(0,Ke===n?ve:Ke)}}else if(d.indexOf(hr(z),ve)!=ve){var mt=Te.lastIndexOf(z);mt>-1&&(Te=Te.slice(0,mt))}return Te+j}function sL(d){return d=Un(d),d&&Qe.test(d)?d.replace(Ye,wy):d}var lL=Cs(function(d,p,T){return d+(T?" ":"")+p.toUpperCase()}),fS=Bm("toUpperCase");function TC(d,p,T){return d=Un(d),p=T?n:p,p===n?P1(d)?_1(d):lc(d):d.match(p)||[]}var IC=rn(function(d,p){try{return xr(d,n,p)}catch(T){return lS(T)?T:new Qt(T)}}),uL=Gi(function(d,p){return wr(p,function(T){T=bi(T),Wi(d,T,Ge(d[T],d))}),d});function cL(d){var p=d==null?0:d.length,T=Ot();return d=p?jn(d,function(j){if(typeof j[1]!="function")throw new Bo(i);return[T(j[0]),j[1]]}):[],rn(function(j){for(var z=-1;++z<p;){var ee=d[z];if(xr(ee[0],this,j))return xr(ee[1],this,j)}})}function dL(d){return Oy(no(d,g))}function hS(d){return function(){return d}}function fL(d,p){return d==null||d!==d?p:d}var hL=xu(),pL=xu(!0);function Go(d){return d}function pS(d){return Fd(typeof d=="function"?d:no(d,g))}function mL(d){return Ec(no(d,g))}function gL(d,p){return yi(d,no(p,g))}var vL=rn(function(d,p){return function(T){return vl(T,d,p)}}),yL=rn(function(d,p){return function(T){return vl(d,T,p)}});function mS(d,p,T){var j=Ca(p),z=Ba(p,j);T==null&&!(Sr(p)&&(z.length||!j.length))&&(T=p,p=d,d=this,z=Ba(p,Ca(p)));var ee=!(Sr(T)&&"chain"in T)||!!T.chain,de=Fu(d);return wr(z,function(ve){var Te=p[ve];d[ve]=Te,de&&(d.prototype[ve]=function(){var We=this.__chain__;if(ee||We){var $e=d(this.__wrapped__),Ke=$e.__actions__=Ha(this.__actions__);return Ke.push({func:Te,args:arguments,thisArg:d}),$e.__chain__=We,$e}return Te.apply(d,Ro([this.value()],arguments))})}),d}function wL(){return zn._===this&&(zn._=Dy),this}function gS(){}function bL(d){return d=un(d),rn(function(p){return bl(p,d)})}var SL=Ch(jn),DL=Ch(sc),TL=Ch(il);function EC(d){return Zm(d)?F(bi(d)):km(d)}function IL(d){return function(p){return d==null?n:So(d,p)}}var EL=Hm(),CL=Hm(!0);function vS(){return[]}function yS(){return!1}function xL(){return{}}function ML(){return""}function kL(){return!0}function NL(d,p){if(d=un(d),d<1||d>ie)return[];var T=ae,j=ma(d,ae);p=Ot(p),d-=ae;for(var z=Ee(j,p);++T<d;)p(T);return z}function AL(d){return an(d)?jn(d,bi):Di(d)?[d]:Ha(r0(Un(d)))}function FL(d){var p=++pc;return Un(d)+p}var OL=Eh(function(d,p){return d+p},0),PL=Da("ceil"),jL=Eh(function(d,p){return d/p},1),LL=Da("floor");function RL(d){return d&&d.length?Tu(d,Go,gi):n}function _L(d,p){return d&&d.length?Tu(d,Ot(p,2),gi):n}function BL(d){return gd(d,Go)}function HL(d,p){return gd(d,Ot(p,2))}function YL(d){return d&&d.length?Tu(d,Go,yl):n}function UL(d,p){return d&&d.length?Tu(d,Ot(p,2),yl):n}var zL=Eh(function(d,p){return d*p},1),VL=Da("round"),WL=Eh(function(d,p){return d-p},0);function $L(d){return d&&d.length?Ae(d,Go):0}function ZL(d,p){return d&&d.length?Ae(d,Ot(p,2)):0}return J.after=ue,J.ary=ge,J.assign=nj,J.assignIn=gC,J.assignInWith=b0,J.assignWith=rj,J.at=aj,J.before=Pe,J.bind=Ge,J.bindAll=uL,J.bindKey=rt,J.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&&S0(c)<=S0(t))break;r=c,r===t?(o=!0,i=l+1):o&&S0(c)>S0(t)?a.push(c):(o=!1,a=[])}else o&&a.push(c)}return t?vb.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(`
`),startLine:i}:{content:e,startLine:0}}function k2(e){const t={};for(const n of e)n.parent&&n.parent>0&&(t[n.position.start.line]=n.parent);return t}function AR(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(`
6 months ago
`),l=t+i.length-1,c=(g=o.metadataCache.getFileCache(e))==null?void 0:g.listItems,f={};if(!c)return[];c.forEach(y=>{var D,I;const w=y.position.start.line,S=y.position.end.line;if(w>=t&&S<=l){const M=w-t,N=S-t,_=i.slice(M,N+1),k=_.join(`
6 months ago
`);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=(D=i[M])==null?void 0:D.match(/^(\s*)/);L&&(f[y.parent].indent=L[0])}const B=new RegExp("^"+f[y.parent].indent);f[y.parent].content+=`
7 months ago
`+k.split(`
6 months ago
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
`)}else if(y.parent&&f[a(r,y.parent)]){const B=new RegExp("^"+f[a(r,y.parent)].indent);f[a(r,y.parent)].content+=`
7 months ago
`+k.split(`
6 months ago
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
3 months ago
`)}else if(new RegExp(mR).test(k)){f[w]||(f[w]={content:"",blockId:"",indent:""});const B=_.length>1&&((I=_[1])==null?void 0:I.match(/^(\s*)/));B&&(f[w].indent=B[0]),f[w].content=k.split(`
7 months ago
`).map(L=>L==null?void 0:L.replace(f[w].indent,"")).join(`
3 months ago
`),f[w].blockId=y.id}}});const h=Object.keys(f).map(y=>({line:f[y].content,blockId:f[y].blockId||"",index:parseInt(y)}));return e.path.includes("2024-04-07"),h}async function FR(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new x.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 OR(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 PR(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(`
7 months ago
`).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(`
3 months ago
`).trim()}),n}const jR=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 LR(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(S){console.error(S),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,h=new RegExp(a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),g=new RegExp(o.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),y=(i.match(h)||[]).length,w=(i.match(g)||[]).length;return i=null,y||w?f:0}function PC(e,t,n,r,a){var g,y,w;const o=Le.getState().dailyNotesState.app||window.app,i=hp(a,"day")||x.moment(a.stat.ctime);let l;const c=AR(a,n,t),f=o==null?void 0:o.metadataCache.getFileCache(a),h={frontmatter:(f==null?void 0:f.frontmatter)||{},tags:((g=f==null?void 0:f.frontmatter)==null?void 0:g.tags)||[]};for(const S of c){const D=HR(e.DefaultMemoComposition,S.line),I=YR(e.DefaultMemoComposition,S.line),M=UR(S.line);let N=RR(S.line);if(i.hours(parseInt(D)),i.minutes(parseInt(I)),M&&i.seconds(parseInt(M)),!M&&i.seconds(0),/^\s*[-*]\s(\[(.)\])\s/g.test(S.line)){const Z=zR(S.line);N=_R(S.line),l=jR(Z)}else l="JOURNAL";let _=N.trim().replaceAll(/<br>/g,`
`);const k=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(N),B=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(N),L=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(N),R=(y=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(N))==null?void 0:y[2],V=(w=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(N))==null?void 0:w[2],Y=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(N)?"PUBLIC":"PRIVATE";_=_.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,""),S.blockId&&(_=_.replace("^"+(S==null?void 0:S.blockId),"")),r.push({id:i.format("YYYYMMDDHHmmss")+`${S.index}`,content:_.trim(),createdAt:i.format("YYYY/MM/DD HH:mm:ss"),updatedAt:i.format("YYYY/MM/DD HH:mm:ss"),thinoType:l,hasId:S.blockId?S.blockId:"",linkId:"",path:a.path,deletedAt:L?x.moment(R,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:B?"ARCHIVED":"NORMAL",visibility:Y,pinned:k,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:V,fileInfo:h})}}function RR(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,"$4")}function _R(e){return BR(e)}const BR=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]},HR=(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]},YR=(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]},UR=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]},zR=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)/.exec(e))==null?void 0:t[2]},mA=()=>Kg()?!0:(new x.Notice(E("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function gA(e,t){var l;if(!e)return t;const n=Le.getState().dailyNotesState.app||window.app,r=await OR(e,n);let a=x.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss");const o=n==null?void 0:n.metadataCache.getFileCache(e),i={frontmatter:(o==null?void 0:o.frontmatter)||{},tags:((l=o==null?void 0:o.frontmatter)==null?void 0:l.tags)||[]};await n.fileManager.processFrontMatter(e,c=>{if(c.id||(c.id=ut.randomId(16)),c.createdAt?a=x.moment(c.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?c.createdAt:a:c.createdAt=a,!r.trim())return t;const f=!!c.pinned,h=c.rowStatus&&c.rowStatus==="ARCHIVED",g=!!c.deletedAt,y=c.deletedAt?c.deletedAt:"",w=c.visibility?c.visibility:"PRIVATE",S=c.thinoType?c.thinoType:"JOURNAL",D=c.webId?c.webId:"",I=c.id?c.id:"",M=c.hasId?c.hasId:"",N=c.linkId?c.linkId:"",_=e.path,k="Memo",B="MULTI",L=[];return t.push({id:I,content:r,createdAt:a,updatedAt:a,deletedAt:g?x.moment(y,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:f,rowStatus:h?"ARCHIVED":"NORMAL",visibility:w,thinoType:S,hasId:M,linkId:N,path:_,creatorName:k,sourceType:B,resourceList:L,webId:D,fileInfo:i}),t})}async function fT(e,t){var I,M,N,_,k,B,L;if(!e)return t;const{vault:n,metadataCache:r}=Le.getState().dailyNotesState.app||window.app;let a;try{a=await n.read(e)}catch(R){console.error(R),a=await n.cachedRead(e)}if(!a)return;const o=x.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),i=x.moment(e.stat.mtime).format("YYYY/MM/DD HH:mm:ss"),l=e.path,c="Thino",f="FILE",h="",g="",y=[],w=r.getFileCache(e),S={frontmatter:(w==null?void 0:w.frontmatter)||{},tags:((I=w==null?void 0:w.frontmatter)==null?void 0:I.tags)||[]},D=
8 months ago
`);){const r=n.indexOf(`
3 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function i_({content:e,isList:t,name:n}){var N;const r=Le.getState().dailyNotesState.settings,a=x.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",fileInfo:{tags:[],frontmatter:{}}},h=ft.getState().app||window.app,{vault:g,fileManager:y}=h,w=g.getAbstractFileByPath(i);(!w||!(w instanceof x.TFolder))&&(new x.Notice(E("Folder not found for the given thino path, is creating a new folder")),await g.createFolder(i)),dt.setChangedByMemos(!0);let S;const D=h.vault.getFileByPath(c);D?S=await g.create(`${i}/${a.format("YYYYMMDD")}-${o}.md`,e):S=await g.create(c,e),await y.processFrontMatter(S,_=>{_.id=o,_.createdAt=a.format("YYYY/MM/DD HH:mm:ss"),_.updatedAt=a.format("YYYY/MM/DD HH:mm:ss"),_.thinoType=t?"JOURNAL":"TASK-TODO"}),(!n||D)&&(r!=null&&r.SetFileNameAfterCreate)&&h.fileManager.promptForFileRename(S);const I=h.metadataCache.getFileCache(S),M={tags:((N=I==null?void 0:I.frontmatter)==null?void 0:N.tags)||[],frontmatter:(I==null?void 0:I.frontmatter)||{}};return{...f,fileInfo:M}}async function s_({content:e,isList:t}){var _;const n=Le.getState().dailyNotesState.settings,r=x.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",fileInfo:{tags:[],frontmatter:{}}},l=ft.getState().app,{vault:c}=l;let f=c.getAbstractFileByPath(o);(!f||!(f instanceof x.TFile))&&(new x.Notice(E("File not found for the given thino path, is creating a new file")),f=await c.create(o,""));const h=l.metadataCache.getFileCache(f),g={tags:((_=h==null?void 0:h.frontmatter)==null?void 0:_.tags)||[],frontmatter:(h==null?void 0:h.frontmatter)||{}};let y="";try{y=await c.read(f)||await c.cachedRead(f)}catch(k){console.error(k),new x.Notice(E("Failed to read current daily note, check if it exists."))}const w=y.indexOf(`# ${r.format("YYYY-MM-DD")}`);let S=y.indexOf(`
6 months ago
#`,w+1);S===-1&&(S=y.length);const D=`> [!thino] ${r.format("YYYY/MM/DD HH:mm:ss")} %% [id::${a}] [thinoType::${t?"JOURNAL":"TASK-TODO"}] %%`,I=e.replace(/\n/g,`
> `),M=`
${D}
> ${I}
`;let N;if(w===-1){const k=`# ${r.format("YYYY-MM-DD")}`;N=`${y.substring(0,S)}
${k}${M}
3 months ago
${y.substring(S)}`}else N=`${y.substring(0,S)}${M}${y.substring(S)}`;return setTimeout(async()=>{dt.setChangedByMemos(!0),await c.modify(f,N)},200),{...i,fileInfo:g}}async function LC(e){var N;const t=Le.getState().dailyNotesState.settings,n=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),r=e.id,a=(t==null?void 0:t.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",o={id:r,content:e.content,deletedAt:e.deletedAt||"",path:a,createdAt:n.format("YYYY/MM/DD HH:mm:ss"),updatedAt:n.format("YYYY/MM/DD HH:mm:ss"),thinoType:"JOURNAL",hasId:"",linkId:"",pinned:e.pinned,visibility:"PUBLIC",rowStatus:e.rowStatus||"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE",webId:e.id,fileInfo:e==null?void 0:e.fileInfo},i=ft.getState().app,{vault:l}=i;let c=l.getAbstractFileByPath(a);(!c||!(c instanceof x.TFile))&&(new x.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(_){console.error(_),new x.Notice(E("Failed to read current daily note, check if it exists."))}const h=i.metadataCache.getFileCache(c),g={tags:((N=h==null?void 0:h.frontmatter)==null?void 0:N.tags)||[],frontmatter:(h==null?void 0:h.frontmatter)||{}},y=f.indexOf(`# ${n.format("YYYY-MM-DD")}`);let w=f.indexOf(`
6 months ago
#`,y+1);w===-1&&(w=f.length);const S=`> [!thino] ${n.format("YYYY/MM/DD HH:mm:ss")} %% [id::${r}] [thinoType::JOURNAL]${e.rowStatus==="ARCHIVED"?" [archived::true]":""}${e.pinned===!0?" [pinned::true]":""}${e.deletedAt?` [deleted::${e.deletedAt}]`:""}${e.id?` [webId::${e.id}]`:""} %%`,D=e.content.replace(/\n/g,`
> `),I=`
${S}
> ${D}
6 months ago
`;let M;if(y===-1){const _=`# ${n.format("YYYY-MM-DD")}`;M=`${f.substring(0,w)}
${_}${I}
3 months ago
${f.substring(w)}`}else M=`${f.substring(0,w)}${I}${f.substring(w)}`;return dt.setChangedByMemos(!0),await l.modify(c,M),{...o,fileInfo:g}}async function l_({content:e,isList:t}){const n=Le.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=x.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",fileInfo:{tags:[],frontmatter:{}}},l=ft.getState().app,{vault:c}=l,f=await FR(r,l);if(!f||!(f instanceof x.TFile)){new x.Notice(E("File not found for the given thino path, is creating a new file"));return}const h=await c.read(f),g=JSON.parse(h);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=x.moment(I.createdAt,"YYYY/MM/DD HH:mm:ss"),_=x.moment(M.createdAt,"YYYY/MM/DD HH:mm:ss");return N.isAfter(_)?I:M}));const S=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({...S,type:"text",id:o,text:e,deletedAt:"",createdAt:a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:a.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[]}),dt.setChangedByMemos(!0);const D=JSON.stringify(g,null,2);return await c.modify(f,D),i}async function DS(e,t,n,r){var $,he;const{vault:a}=Le.getState().dailyNotesState.app||window.app,o=Le.getState().dailyNotesState.app||window.app,i=Le.getState().dailyNotesState.settings,l=o.vault.getConfig("useTab")===void 0||window.app.vault.getConfig("useTab")===!0,c=l?1:o.vault.getConfig("tabSize"),f=(l?" ":" ").repeat(c),h=e.split(`
7 months ago
`).join(`
3 months ago
`+f),g=n||x.moment(),{DifferentInsertTarget:y,InsertAfterForTask:w,InsertType:S}=i,D=g.format(i.DefaultTimePrefix||"HH:mm"),I=S==="end"?"":t?i.InsertAfter:y&&w||i.InsertAfter,M=o==null?void 0:o.loadLocalStorage("tokenForSync");let N="";try{!r&&e&&M&&i.startSync&&(N=(await N2({content:e,thinoType:"DAILY"})).id)}catch(ie){console.error(ie)}const _=t?"- ":"- [ ] ",k=i!=null&&i.DefaultMemoComposition?`${_}${($=i==null?void 0:i.DefaultMemoComposition)==null?void 0:$.replace(/{TIME}/g,D).replace(/{CONTENT}/g,(h.split(`
6 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(h)?`
`+f:"")+h)}${h.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(h.split(`
`)[h.split(`
`).length-1])&&N?`
`+f:" "}${N?`[webId::${N}]`:""}`:`${_}${D} ${h.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(h)?`
`+f:""}${h}${h.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(h.split(`
`)[h.split(`
`).length-1])&&N?`
3 months ago
`+f:" "}${N?`[webId::${N}]`:""}`,B=Ju(),L=pb(g,B),R="fake"+ut.randomId(16);let V=!1;const Y=o.plugins.getPlugin("templater-obsidian");let Z;if(L?Z=L:(Y!=null&&Y.templater&&(Y!=null&&Y.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e,date:g,isList:t,id:R,type:N?"web":"local"}),V=!0),Z=await ut.createDailyNoteCheck(g)),!Z){new x.Notice(E("Failed to create daily note, check if it exists."));return}if(L||await ft.fechLocalDailyNotes(),Y&&(Y!=null&&Y.templater)&&(Y!=null&&Y.settings.trigger_on_file_creation)&&V)return dt.setChangedByMemos(!0),{id:R,content:e,deletedAt:"",createdAt:g.format("YYYY/MM/DD HH:mm:ss"),updatedAt:g.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:Z.path,hasId:"",linkId:"",webId:N,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:{tags:[],frontmatter:{}}};let Q="";try{Q=await a.read(Z)||await a.cachedRead(Z)}catch(ie){console.error(ie),new x.Notice(E("Failed to read current daily note, check if it exists."))}const G=o.metadataCache.getFileCache(Z),le={tags:((he=G==null?void 0:G.frontmatter)==null?void 0:he.tags)||[],frontmatter:(G==null?void 0:G.frontmatter)||{}},se=await wA(I,k,Q);await a.modify(Z,se.content);const fe=se.posNum===-1?bA(se.content).length-(k.split(`
`).length-1)-1:se.posNum+1;return dt.setChangedByMemos(!0),{id:g.format("YYYYMMDDHHmm")+"00"+fe,content:e,deletedAt:"",createdAt:g.format("YYYY/MM/DD HH:mm:ss"),updatedAt:g.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:Z.path,hasId:"",linkId:"",webId:N,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:le}}async function RC(e){var fe;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}=Le.getState().dailyNotesState.settings;let f=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const $=" [webId::"+e.id+"]";f+=$}const h=x.moment();if(e.deletedAt){const $=" [deleted::"+h.format("YYYYMMDDHHmmss")+"]";f+=$}const g=n.vault.getConfig("useTab")===void 0||n.vault.getConfig("useTab")===!0,y=g?1:n.vault.getConfig("tabSize"),w=(g?" ":" ").repeat(y),S=e.content.split(`
7 months ago
`).join(`
3 months ago
`+w),D=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),I=D.format(o||"HH:mm"),M=e.thinoType?"- [ ] ":"- ",N=r?`${M}${r==null?void 0:r.replace(/{TIME}/g,I).replace(/{CONTENT}/g,(S.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
6 months ago
`+w:"")+S)}${S.split(`
7 months ago
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
6 months ago
`).length-1])&&f.trim()?`
`+w:" "}${f}`:`${M}${I} ${S.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
6 months ago
`+w:""}${S}${S.split(`
7 months ago
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
6 months ago
`).length-1])&&f.trim()?`
3 months ago
`+w:" "}${f}`,_=Ju(),k=pb(D,_),B="fake"+ut.randomId(16);let L=!1;const R=n.plugins.getPlugin("templater-obsidian");let V;if(k?V=k:(R!=null&&R.templater&&(R!=null&&R.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e.content,date:D,isList:e.thinoType&&e.thinoType==="JOURNAL",id:B,type:"local"}),L=!0),V=await ut.createDailyNoteCheck(D)),!V){new x.Notice(E("Failed to create daily note, check if it exists.")),new x.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 $=n.workspace.getLeavesOfType("thino_view").first();n.workspace.trigger("send-to-thino",e.content,$);return}if(k||await ft.fechLocalDailyNotes(),R&&(R!=null&&R.templater)&&(R!=null&&R.settings.trigger_on_file_creation)&&L)return dt.setChangedByMemos(!0),{id:B,content:e.content,deletedAt:e.deletedAt??"",createdAt:D.format("YYYY/MM/DD HH:mm:ss"),updatedAt:D.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:V.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.webId||e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:(e==null?void 0:e.fileInfo)||{tags:[],frontmatter:{}}};const Y=n.metadataCache.getFileCache(V),Z={tags:((fe=Y==null?void 0:Y.frontmatter)==null?void 0:fe.tags)||[],frontmatter:(Y==null?void 0:Y.frontmatter)||{}};let Q="";try{Q=await t.read(V)||await t.cachedRead(V)}catch($){console.error($),new x.Notice(E("Failed to read current daily note, check if it exists."))}const G=c==="end"?"":e.thinoType&&i&&l||a,le=await wA(G,N,Q);await t.modify(V,le.content);const se=le.posNum===-1?bA(le.content).length-1:le.posNum+1;return dt.setChangedByMemos(!0),{id:D.format("YYYYMMDDHHmm")+"00"+se,content:e.content,deletedAt:e.deletedAt??"",createdAt:D.format("YYYY/MM/DD HH:mm:ss"),updatedAt:D.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:V.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:Z}}async function wA(e,t,n){const r=new RegExp(`(s*?)${await a_(e)}(s*?)`),a=o_(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 h=l+o;h>o;h--)if(!/^[\s\n ]*$/.test(a[h])){f=h;break}return f||(f=o),await _C(t,n,i?-1:f,c)}else return await _C(t,n,a.length-1,c)}async function _C(e,t,n,r){if(n<-1)throw new Error("Invalid position");if(n===-1)return{content:`${t}
7 months ago
${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?`
3 months ago
`:"")+i}`,posNum:n}}const bA=e=>e.split(/\r?\n/);async function u_(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof x.TFile)){new x.Notice(E("File not found for the given thino path"));return}await t.vault.delete(n)}async function c_(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof x.TFile)){new x.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 x.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 x.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,l)}async function d_(e){const t=Le.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new x.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(h=>h.id===e.id);if(i===-1){new x.Notice(E("Thino not found"));return}o.splice(i,1);const l=a.edges;l.filter(h=>h.fromNode===e.id||h.toNode===e.id).forEach(h=>{const g=l.findIndex(y=>y.id===h.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 f_(e){mA()||new x.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 x.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 h=f;function g(D,I){const M=[];for(const N in I)I[N]===D&&M.push(parseInt(N),...g(parseInt(N),I));return M}const y=k2(c),w=c.find(D=>D.position.start.line===f),S=g(f,y);if(S.length>0){const D=S.map(I=>{const M=c.find(N=>N.position.start.line===I);return M?M.position.end.line:-1});h=Math.max(...D,w.position.end.line)}else h=w.position.end.line;if(!o){new x.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),i.splice(f,h-f+1),await t.modify(a,i.join(`
`))}async function h_(){const{vault:e,metadataCache:t}=Le.getState().dailyNotesState.app,n=Le.getState().dailyNotesState.settings,a=mb()+"/"+n.DeleteFileName+".md",o=[],i=t.getFirstLinkpathDest("",a);if(i instanceof x.TFile){let l=await e.read(i),c=p_(l);if(c.length===0)return o;for(let f=0;f<c.length;f++){const h=c[f];if(/- /.test(h)){const y=m_(h).slice(0,13),w=x.moment(y,"YYYYMMDDHHmmss"),S=v_(c[f]),D=x.moment(S.slice(0,13),"YYYYMMDDHHmmss"),I=g_(c[f]);o.push({id:S,content:I,user_id:1,createdAt:w.format("YYYY/MM/DD HH:mm:SS"),updatedAt:w.format("YYYY/MM/DD HH:mm:SS"),deletedAt:D})}else continue}c=null,l=null}return o}const p_=e=>e.split(/\r?\n/),m_=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},g_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},v_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function y_(e){const t=await Rp(Le.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await Av(Le.getState().dailyNotesState.app,t)}const w_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await Rp(t)||[],r=n.find(a=>a.id===e);if(r){const a=x.moment().format("YYYY/MM/DD HH:mm:ss");return r.pinnedAt=a,await Av(t,n),a}else{new x.Notice(E("Query not found"));return}},b_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await Rp(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await Av(t,n);return}else{new x.Notice(E("Query not found"));return}};function S_(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=x.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=x.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:x.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 Rl(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=x.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("id::"+e.id)||M.includes("Id::"+e.id)||e.webId&&M.includes(e.webId)),c=i[l];if(!c)return e;const f=S_(c,t);if(!c)return e;const h=f+`
7 months ago
`,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(`
6 months ago
`));const D=(h+w).split(/\r?\n/);i.splice(l,g!==-1?g-l:i.length-l,...D);const I=i.join(`
3 months ago
`);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:x.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 _l(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=x.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:x.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 Bl(e,t){var le;mA()||new x.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=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(x.moment(i,"YYYYMMDDHHmmss"))?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):x.moment(i,"YYYYMMDDHHmmss"),c=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(l,"day"),f=e.path,h=n.getAbstractFileByPath(f)||n.getAbstractFileByPath(e.path);if(!h)return new x.Notice(E("Please check your daily note plugin OR periodic notes plugin settings")),e;const y=(await n.read(h)).split(`
`),w=r.getFileCache(h),S=(w==null?void 0:w.listItems)||[];if(S.length===0)return new x.Notice(E("Thino not found")),e;const D=parseInt(e.id.slice(14));let I=D;function M(se,fe){const $=[];for(const he in fe)fe[he]===se&&$.push(parseInt(he),...M(parseInt(he),fe));return $}const N=k2(S),_=S.find(se=>se.position.start.line===D);if(!_)return new x.Notice(E("Thino not found")),e;const k=M(D,N);if(k.length>0){const se=k.map(fe=>{const $=S.find(he=>he.position.start.line===fe);return $?$.position.end.line:-1});I=Math.max(...se,_.position.end.line)}else I=_.position.end.line;const B=y.slice(D,I+1);let L=B.join(`
`);const R=c?x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm"):(parseInt(e.id.toString().slice(10,12))+24).toString()+":"+e.id.toString().slice(12,14);if(!L)return new x.Notice(E("Thino not found")),e;const V=a.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,Y=V?1:a.vault.getConfig("tabSize"),Z=(V?" ":" ").repeat(Y);let Q=R;if(o.DefaultTimePrefix!=="HH:mm"&&(Q=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(o.DefaultTimePrefix)),t.content){const se=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+"]":""),$=t.content.trim().split(`
7 months ago
`)[t.content.trim().split(`
6 months ago
`).length-1].trim(),he=e.hasId&&t.content.trim().split(`
6 months ago
`).length>1&&new RegExp(/(-|\*|\d{1,2}\.)\s/g).test($)?" ^"+e.hasId:" ";L=`${se}${Q}${he}${t.content.trim().split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(t.content)?`
6 months ago
`+Z:""}${t.content.trim().split(`
7 months ago
`).join(`
6 months ago
`+Z)}${/((-|\*|\d\.|>)\s|```)/g.test(t.content.split(`
7 months ago
`)[t.content.split(`
`).length-1])?`
6 months ago
`+Z:" "}${fe.trim()}`}if(t.thinoType){const se=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";L=L.replace(/^((- \[.\] )|((-|\*) ))/,se)}if(t.rowStatus){const se=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";L=L.includes("[archived::")?L.replace(/\[archived::(true|false)\]/,se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.visibility){const se='[visibility::"'+t.visibility+'"]';L=L.includes("[visibility::")?L.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.pinned!==void 0){const se=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";L=L.includes("[pinned::")?L.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.webId!==void 0){const se="[webId::"+t.webId+"]";L=L.includes("[webId::")?L.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
3 months ago
`+Z:" "}`+se}const G=x.moment();if(t.deleted!==void 0){const se="[deleted::"+G.format("YYYYMMDDHHmmss")+"]";t.deleted?(L=L.replace(/\[deleted::([^\]]+)\]/,""),L=L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
7 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se):t.deleted===!1&&(L=L.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId&&((le=t.content)==null?void 0:le.split(`
`).length)===1){const se=" ^"+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])?`
6 months ago
`+Z:" "}`+se}return L!==B.join(`
`)?(y.splice(D,I-_.position.start.line+1,L.trim()),await n.modify(h,y.join(`
3 months ago
`)),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:x.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?G.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}async function D_(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=k2(i),c=[],f=r.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,h=f?1:r.getConfig("tabSize"),g=(f?" ":" ").repeat(h);function y(N,_){const k=[];for(const B in _)_[B]===N&&k.push(parseInt(B),...y(parseInt(B),_));return k}const w=x.moment(),S=t.map(N=>{const _=i.find(R=>R.position.start.line===parseInt(N.id.slice(14))),B=y(parseInt(N.id.slice(14)),l).map(R=>{const V=i.find(Y=>Y.position.start.line===R);return V?V.position.end.line:-1}),L=Math.max(...B,_.position.end.line);return{id:N.id,start:_.position.start.line,end:L}}),I=(await r.read(o)).split(`
6 months ago
`);return S.forEach(N=>{const k=I.slice(N.start,N.end+1).join(`
7 months ago
`),L=k.split(`
`)[k.split(`
6 months ago
`).length-1].trim();let R=k;if(n==="delete"){const V="[deleted::"+w.format("YYYYMMDDHHmmss")+"]";R=R.replace(/\[deleted::([^\]]+)\]/,""),R=k+`${k.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
6 months ago
`+g:" "}`+V}if(n==="restoreFromDelete"&&(R=R.replace(/ ?\[deleted::([^\]]+)\]/,"")),n==="archive"){const V="[archived::true]";R=R.includes("[archived::")?R.replace(/\[archived::(true|false)\]/,V):R+`${R.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
6 months ago
`+g:" "}`+V}n==="restoreFromArchive"&&(R=R.replace(/ ?\[archived::(true|false)\]/,"")),n==="deleteForever"?I.splice(N.start,N.end-N.start+1):I.splice(N.start,N.end-N.start+1,R),c.push({...t.find(V=>V.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(`
3 months ago
`)),dt.setChangedByMemos(!0),c}const T_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return _l(e,{id:e.id,pinned:!0});case"DAILY":return Bl(e,{id:e.id,pinned:!0});case"MULTI":return js(e,{id:e.id,pinned:!0});case"FILE":return Rl(e,{id:e.id,pinned:!0})}},I_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return _l(e,{id:e.id,pinned:!1});case"DAILY":return Bl(e,{id:e.id,pinned:!1});case"MULTI":return js(e,{id:e.id,pinned:!1});case"FILE":return Rl(e,{id:e.id,pinned:!1})}};var hT;(e=>{async function t(D){return await jC(D)}e.getMyMemos=t;async function n(D){return await jC([D])}e.updateSpecificTypeMemo=n;function r(){return h_()}e.getMyDeletedMemos=r;function a(D){const I=we.getMemoById(D);if(I)switch(I==null?void 0:I.sourceType){case"DAILY":return Bl(I,{id:I.id,deleted:!1});case"CANVAS":return _l(I,{id:I.id,deleted:!1});case"MULTI":return js(I,{id:I.id,deleted:!1});case"FILE":return Rl(I,{id:I.id,deleted:!1})}}e.restoreMemo=a;function o(D){return c_(D)}e.deleteMemoInSingleFile=o;function i(D){return u_(D)}e.deleteMemoInMultiFiles=i;function l(D){return f_(D)}e.deleteMemoInDailyNote=l;function c(D){return d_(D)}e.deleteMemoInCanvas=c;function f(){return MR()}e.getMyQueries=f;async function h(D,I){return await NR(D,I)}e.createQuery=h;function g(D,I,M){return qR(D,I,M)}e.updateQuery=g;function y(D){return y_(D)}e.deleteQueryById=y;function w(D){return w_(D)}e.pinQuery=w;function S(D){return b_(D)}e.unpinQuery=S})(hT||(hT={}));const Ko=hT;var Ku={};Object.defineProperty(Ku,"__esModule",{value:!0});class Of extends Error{}class E_ extends Of{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class C_ extends Of{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class x_ extends Of{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class jg extends Of{}class SA extends Of{constructor(t){super(`Invalid unit ${t}`)}}class Xi extends Of{}class Yc extends Of{constructor(){super("Zone is an abstract class")}}const gt="numeric",zs="short",Mi="long",xw={year:gt,month:gt,day:gt},DA={year:gt,month:zs,day:gt},M_={year:gt,month:zs,day:gt,weekday:zs},TA={year:gt,month:Mi,day:gt},IA={year:gt,month:Mi,day:gt,weekday:Mi},EA={hour:gt,minute:gt},CA={hour:gt,minute:gt,second:gt},xA={hour:gt,minute:gt,second:gt,timeZoneName:zs},MA={hour:gt,minute:gt,second:gt,timeZoneName:Mi},kA={hour:gt,minute:gt,hourCycle:"h23"},NA={hour:gt,minute:gt,second:gt,hourCycle:"h23"},AA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:zs},FA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:Mi},OA={year:gt,month:gt,day:gt,hour:gt,minute:gt},PA={year:gt,month:gt,day:gt,hour:gt,minute:gt,second:gt},jA={year:gt,month:zs,day:gt,hour:gt,minute:gt},LA={year:gt,month:zs,day:gt,hour:gt,minute:gt,second:gt},k_={year:gt,month:zs,day:gt,weekday:zs,hour:gt,minute:gt},RA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,timeZoneName:zs},_A={year:gt,month:Mi,day:gt,hour:gt,minute:gt,second:gt,timeZoneName:zs},BA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,timeZoneName:Mi},HA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,second:gt,timeZoneName:Mi};class Ov{get type(){throw new Yc}get name(){throw new Yc}get ianaName(){return this.name}get isUniversal(){throw new Yc}offsetName(t,n){throw new Yc}formatOffset(t,n){throw new Yc}offset(t){throw new Yc}equals(t){throw new Yc}get isValid(){throw new Yc}}let TS=null;class yb extends Ov{static get instance(){return TS===null&&(TS=new yb),TS}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return UA(t,n,r)}formatOffset(t,n){return zg(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}}let aw={};function N_(e){return aw[e]||(aw[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"})),aw[e]}const A_={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function F_(e,t){const n=e.format(t).rep
6 months ago
`||te.charAt(tt)==="\r"&&te.charAt(tt+1)!==`
3 months ago
`)&&(He++,Qe===0&&(Qe=tt+1)),tt--}var kt=Ye+He,Yt=me-Qe;return xe[me]={line:kt,lineStart:Qe},{offset:me,line:kt+1,column:Yt+1}}function G(te){if(!k(te))throw new Error("not a parser: "+te)}function le(te,me){return typeof te=="string"?te.charAt(me):te[me]}function se(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 $(te){if(typeof te!="string")throw new Error("not a string: "+te)}var he=2,ie=3,ce=8,X=5*ce,ae=4*ce,De=" ";function je(te,me){return new Array(me+1).join(te)}function Re(te,me,xe){var Ye=me-te.length;return Ye<=0?te:je(xe,Ye)+te}function Fe(te,me,xe,Ye){return{from:te-me>0?te-me:0,to:te+xe>Ye?Ye:te+xe}}function Be(te,me){var xe,Ye,He,Qe,tt,kt=me.index,Yt=kt.offset,On=1;if(Yt===te.length)return"Got the end of the input";if(L(te)){var yn=Yt-Yt%ce,Cr=Yt-yn,Jn=Fe(yn,X,ae+ce,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,ce));Qe=function(Nn){return Nn.from===0&&Nn.to===1?{from:Nn.from,to:Nn.to}:{from:Nn.from/ce,to:Math.floor(Nn.to/ce)}}(Jn),Ye=yn/ce,xe=3*Cr,Cr>=4&&(xe+=1),On=2,He=f(function(Nn){return Nn.length<=4?Nn.join(" "):Nn.slice(0,4).join(" ")+" "+Nn.slice(4).join(" ")},yr),(tt=(8*(Qe.to>0?Qe.to-1:Qe.to)).toString(16).length)<2&&(tt=2)}else{var ta=te.split(/\r\n|[\n\r\u2028\u2029]/);xe=kt.column-1,Ye=kt.line-1,Qe=Fe(Ye,he,ie,ta.length),He=ta.slice(Qe.from,Qe.to),tt=Qe.to.toString().length}var Pi=Ye-Qe.from;return L(te)&&(tt=(8*(Qe.to>0?Qe.to-1:Qe.to)).toString(16).length)<2&&(tt=2),c(function(Nn,Aa,Fa){var Zr,fo=Fa===Pi,Oa=fo?"> ":De;return Zr=L(te)?Re((8*(Qe.from+Fa)).toString(16),tt,"0"):Re((Qe.from+Fa+1).toString(),tt," "),[].concat(Nn,[Oa+Zr+" | "+Aa],fo?[De+je(" ",tt)+" | "+Re("",xe," ")+je("^",On)]:[])},[],He).join(`
6 months ago
`)}function Xe(te,me){return[`
7 months ago
`,"-- PARSING FAILED "+je("-",50),`
8 months ago
7 months ago
`,Be(te,me),`
8 months ago
3 months ago
`,(xe=me.expected,xe.length===1?`Expected:
8 months ago
3 months ago
`+xe[0]:`Expected one of the following:
8 months ago
3 months ago
`+xe.join(", ")),`
`].join("");var xe}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,xe=0;xe<me;xe+=1)G(te[xe]);return o(function(Ye,He){for(var Qe,tt=new Array(me),kt=0;kt<me;kt+=1){if(!(Qe=Y(te[kt]._(Ye,He),Qe)).status)return Qe;tt[kt]=Qe.value,He=Qe.index}return Y(R(He,tt),Qe)})}function Ct(){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(xe){return me.apply(null,xe)})}function tn(){var te=[].slice.call(arguments),me=te.length;if(me===0)return Tt("zero alternates");for(var xe=0;xe<me;xe+=1)G(te[xe]);return o(function(Ye,He){for(var Qe,tt=0;tt<te.length;tt+=1)if((Qe=Y(te[tt]._(Ye,He),Qe)).status)return Qe;return Qe})}function _e(te,me){return et(te,me).or(St([]))}function et(te,me){return G(te),G(me),Ct(te,me.then(te).many(),function(xe,Ye){return[xe].concat(Ye)})}function nt(te){$(te);var me="'"+te+"'";return o(function(xe,Ye){var He=Ye+te.length,Qe=xe.slice(Ye,He);return Qe===te?R(He,Qe):V(Ye,me)})}function ht(te,me){(function(He){if(!(He instanceof RegExp))throw new Error("not a regexp: "+He);for(var Qe=Ze(He),tt=0;tt<Qe.length;tt++){var kt=Qe.charAt(tt);if(kt!=="i"&&kt!=="m"&&kt!=="u"&&kt!=="s")throw new Error('unsupported regexp flag "'+kt+'": '+He)}})(te),arguments.length>=2?se(me):me=0;var xe=function(He){return RegExp("^(?:"+He.source+")",Ze(He))}(te),Ye=""+te;return o(function(He,Qe){var tt=xe.exec(He.slice(Qe));if(tt){if(0<=me&&me<=tt.length){var kt=tt[0],Yt=tt[me];return R(Qe+kt.length,Yt)}return V(Qe,"valid match group (0 to "+tt.length+") in "+Ye)}return V(Qe,Ye)})}function St(te){return o(function(me,xe){return R(xe,te)})}function Tt(te){return o(function(me,xe){return V(xe,te)})}function Gt(te){if(k(te))return o(function(me,xe){var Ye=te._(me,xe);return Ye.index=xe,Ye.value="",Ye});if(typeof te=="string")return Gt(nt(te));if(te instanceof RegExp)return Gt(ht(te));throw new Error("not a string, regexp, or parser: "+te)}function _t(te){return G(te),o(function(me,xe){var Ye=te._(me,xe),He=me.slice(xe,Ye.index);return Ye.status?V(xe,'not "'+He+'"'):R(xe,null)})}function Vt(te){return fe(te),o(function(me,xe){var Ye=le(me,xe);return xe<me.length&&te(Ye)?R(xe+1,Ye):V(xe,"a character/byte matching "+te)})}function Xt(te,me){arguments.length<2&&(me=te,te=void 0);var xe=o(function(Ye,He){return xe._=me()._,xe._(Ye,He)});return te?xe.desc(te):xe}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,xe=this.skip(Er)._(te,0);return me=xe.status?{status:!0,value:xe.value}:{status:!1,index:Q(te,xe.furthest),expected:xe.expected},delete Z[te],me},i.tryParse=function(te){var me=this.parse(te);if(me.status)return me.value;var xe=Xe(te,me),Ye=new Error(xe);throw Ye.type="ParsimmonError",Ye.result=me,Ye},i.assert=function(te,me){return this.chain(function(xe){return te(xe)?St(xe):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 Ct(te,this,me,function(xe,Ye){return Ye})},i.thru=function(te){return te(this)},i.then=function(te){return G(te),st(this,te).map(function(me){return me[1]})},i.many=function(){var te=this;return o(function(me,xe){for(var Ye=[],He=void 0;;){if(!(He=Y(te._(me,xe),He)).status)return Y(R(xe,Ye),He);if(xe===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");xe=He.index,Ye.push(He.value)}})},i.tieWith=function(te){return $(te),this.map(function(me){if(function(He){if(!B(He))throw new Error("not an array: "+He)}(me),me.length){$(me[0]);for(var xe=me[0],Ye=1;Ye<me.length;Ye++)$(me[Ye]),xe+=te+me[Ye];return xe}return""})},i.tie=function(){return this.tieWith("")},i.times=function(te,me){var xe=this;return arguments.length<2&&(me=te),se(te),
6 months ago
`),jr=nt(`\r
3 months ago
`),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 xe in te)({}).hasOwnProperty.call(te,xe)&&function(Ye){me[Ye]=Xt(function(){return te[Ye](me)})}(xe);return me},o.crlf=jr,o.custom=function(te){return o(te(R,V))},o.digit=pt,o.digits=Mt,o.empty=dn,o.end=Lr,o.eof=Er,o.fail=Tt,o.formatError=Xe,o.index=en,o.isParser=k,o.lazy=Xt,o.letter=Jt,o.letters=sn,o.lf=ha,o.lookahead=Gt,o.makeFailure=V,o.makeSuccess=R,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(""),xe=0;xe<me.length;xe++)me[xe]="'"+me[xe]+"'";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(xe){return te<=xe&&xe<=me}).desc(te+"-"+me)},o.regex=ht,o.regexp=ht,o.sepBy=_e,o.sepBy1=et,o.seq=st,o.seqMap=Ct,o.seqObj=function(){for(var te,me={},xe=0,Ye=(te=arguments,Array.prototype.slice.call(te)),He=Ye.length,Qe=0;Qe<He;Qe+=1){var tt=Ye[Qe];if(!k(tt)){if(B(tt)&&tt.length===2&&typeof tt[0]=="string"&&k(tt[1])){var kt=tt[0];if(Object.prototype.hasOwnProperty.call(me,kt))throw new Error("seqObj: duplicate key "+kt);me[kt]=!0,xe++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(xe===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(Yt,On){for(var yn,Cr={},Jn=0;Jn<He;Jn+=1){var yr,ta;if(B(Ye[Jn])?(yr=Ye[Jn][0],ta=Ye[Jn][1]):(yr=null,ta=Ye[Jn]),!(yn=Y(ta._(Yt,On),yn)).status)return yn;yr&&(Cr[yr]=yn.value),On=yn.index}return Y(R(On,Cr),yn)})},o.string=nt,o.succeed=St,o.takeWhile=function(te){return fe(te),o(function(me,xe){for(var Ye=xe;Ye<me.length&&te(le(me,Ye));)Ye++;return R(Ye,me.slice(xe,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={},xe=0,Ye=f(function(Qe){if(B(Qe)){var tt=Qe;if(tt.length!==2)throw new Error("["+tt.join(", ")+"] should be length 2, got length "+tt.length);if($(tt[0]),se(tt[1]),Object.prototype.hasOwnProperty.call(me,tt[0]))throw new Error("duplicate key in bitSeqObj: "+tt[0]);return me[tt[0]]=!0,xe++,tt}return se(Qe),[null,Qe]},te);if(xe<1)throw new Error("bitSeqObj expects at least one named pair, got ["+te.join(", ")+"]");var He=f(function(Qe){return Qe[0]},Ye);return w(f(function(Qe){return Qe[1]},Ye)).map(function(Qe){return c(function(tt,kt){return kt[0]!==null&&(tt[kt[0]]=kt[1]),tt},{},f(function(tt,kt){return[tt,Qe[kt]]},He))})},byte:function(te){if(y(),se(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(xe,Ye){var He=le(xe,Ye);return He===te?R(Ye+1,He):V(Ye,me)})},buffer:function(te){return S("buffer",te).map(function(me){return Buffer.from(me)})},encodedString:function(te,me){return S("string",me).map(function(xe){return xe.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:S("floatBE",4).map(function(te){return te.readFloatBE(0)}),floatLE:S("floatLE",4).map(function(te){return te.readFloatLE(0)}),doubleBE:S("doubleBE",8).map(function(te){return te.readDoubleBE(0)}),doubleLE:S("doubleLE",8).map(function(te){return te.readDoubleLE(0)})},n.exports=o}])})})(pe);var U2=()=>/(?:[#*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}
3 months ago
${o}`,posNum:n}}function zH(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 V2=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 x.Notice(E("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},W2=async(e,t)=>{const{app:n}=ft.getState(),r=parseInt(e.slice(14));if(zH(t,n,r))return;const a=n.metadataCache.getFirstLinkpathDest("",t);if(!x.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}})}},$2=async(e,t)=>{var f,h,g;const n=ft.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new x.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{(h=y.view.editor)==null||h.setCursor({line:i,ch:1});return}catch(S){console.error(S)}}}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)}},Z2=async(e,t)=>{var l;const n=ft.getState().app,r=(c,f)=>{var g;const h=(g=Array.from(c.nodes.values()))==null?void 0:g.find(y=>y.id===f);return h?(c.selectOnly(h),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 x.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 VH{constructor(){Se(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 DS(n.origin,n.isList,n.date,!0):await RC(r);await this.replaceOldThinoWithNewThino(n.id,a),Le.dispatch({type:"REMOVE_PARTICULAR_PREPARE_UPDATE_THINO",payload:{id:n.id}})}}async replaceOldThinoWithNew
`+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 C=Pe.stack.split(`
7 months ago
`),O=b.stack.split(`
3 months ago
`),W=C.length-1,ue=O.length-1;1<=W&&0<=ue&&C[W]!==O[ue];)ue--;for(;1<=W&&0<=ue;W--,ue--)if(C[W]!==O[ue]){if(W!==1||ue!==1)do if(W--,ue--,0>ue||C[W]!==O[ue]){var ge=`
`+C[W].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=W&&0<=ue);break}}}finally{je=!1,Error.prepareStackTrace=m}return(s=s?s.displayName||s.name:"")?De(s):""}function Fe(s){switch(s.tag){case 5:return De(s.type);case 16:return De("Lazy");case 13:return De("Suspense");case 19:return De("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 R:return"Fragment";case L:return"Portal";case Y:return"Profiler";case V:return"StrictMode";case le:return"Suspense";case se:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case Q:return(s.displayName||"Context")+".Consumer";case Z:return(s._context.displayName||"Context")+".Provider";case G: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 $:u=s._payload,s=s._init;try{return Be(s(u))}catch{}}return null}function Xe(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===V?"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 Ct(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 C=m.get,O=m.set;return Object.defineProperty(s,u,{configurable:!0,get:function(){return C.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=Ct(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 et(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 nt(s,u){var m=u.checked;return X({},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(Y1,"")}function Id(s,u,m){if(u=Cy(u),Cy(s)!==u&&m)throw Error(n(425))}function Qf(){}var Ed=null,yu=null;function Cd(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 ul=typeof setTimeout=="function"?setTimeout:void 0,xd=typeof clearTimeout=="function"?clearTimeout:void 0,vc=typeof Promise=="function"?Promise:void 0,Xf=typeof queueMicrotask=="function"?queueMicrotask:typeof vc<"u"?function(s){return vc.resolve(null).then(s).catch(yc)}:ul;function yc(s){setTimeout(function(){throw s})}function ym(s,u){var m=u,b=0;do{var C=m.nextSibling;if(s.removeChild(m),C&&C.nodeType===8)if(m=C.data,m==="/$"){if(b===0){s.removeChild(C),pn(u);return}b--}else m!=="$"&&m!=="$?"&&m!=="$!"||b++;m=C}while(m);pn(u)}function cl(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 xy(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 wc=Math.random().toString(36).slice(2),Yi="__reactFiber$"+wc,dl="__reactProps$"+wc,wo="__reactContainer$"+wc,eh="__reactEvents$"+wc,J="__reactListeners$"+wc,bc="__reactHandles$"+wc;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=xy(s);s!==null;){if(m=s[Yi])return m;s=xy(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 th(s){return s[dl]||null}var wm=[],Sc=-1;function Xa(s){return{current:s}}function Qn(s){0>Sc||(s.current=wm[Sc],wm[Sc]=null,Sc--)}function qn(s,u){Sc++,wm[Sc]=s.current,s.current=u}var fl={},va=Xa(fl),eo=Xa(!1),_a=fl;function Dc(s,u){var m=s.type.contextTypes;if(!m)return fl;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===u)return b.__reactInternalMemoizedMaskedChildContext;var C={},O;for(O in m)C[O]=u[O];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=u,s.__reactInternalMemoizedMaskedChildContext=C),C}function to(s){return s=s.childContextTypes,s!=null}function nh(){Qn(eo),Qn(va)}function My(s,u,m){if(va.current!==fl)throw Error(n(168));qn(va,u),qn(eo,m)}function ky(s,u,m){var b=s.stateNode;if(u=u.childContextTypes,typeof b.getChildContext!="function")return m;b=b.getChildContext();for(var C in b)if(!(C in u))throw Error(n(108,Xe(s)||"Unknown",C));return X({},m,b)}function Ho(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||fl,_a=va.current,qn(va,s),qn(eo,eo.current),!0}function Ny(s,u,m){var b=s.stateNode;if(!b)throw Error(n(169));m?(s=ky(s,u,_a),b.__reactInternalMemoizedMergedChildContext=s,Qn(eo),Qn(va),qn(va,s)):Qn(eo),qn(eo,m)}var Ds=null,rh=!1,bm=!1;function Ay(s){Ds===null?Ds=[s]:Ds.push(s)}function wu(s){rh=!0,Ay(s)}function hl(){if(!bm&&Ds!==null){bm=!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,rh=!1}catch(C){throw Ds!==null&&(Ds=Ds.slice(s+1)),cs(qs,hl),C}finally{ct=u,bm=!1}}return null}var Tc=[],ya=0,ah=null,oh=0,Yo=[],Uo=0,bu=null,zi=1,Vi="";function Su(s,u){Tc[ya++]=oh,Tc[ya++]=ah,ah=s,oh=u}function Fy(s,u,m){Yo[Uo++]=zi,Yo[Uo++]=Vi,Yo[Uo++]=bu,bu=s;var b=zi;s=Vi;var C=32-Rr(b)-1;b&=~(1<<C),m+=1;var O=32-Rr(u)+C;if(30<O){var W=C-C%5;O=(b&(1<<W)-1).toString(32),b>>=W,C-=W,zi=1<<32-Rr(u)+C|m<<C|b,Vi=O+s}else zi=1<<O|m<<C|b,Vi=s}function Md(s){s.return!==null&&(Su(s,1),Fy(s,1,0))}function Du(s){for(;s===ah;)ah=Tc[--ya],Tc[ya]=null,oh=Tc[--ya],Tc[ya]=null;for(;s===bu;)bu=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
7 months ago
Error generating stack: `+O.message+`
3 months ago
`+O.stack}return{value:s,source:u,stack:C,digest:null}}function Fc(s,u,m){return{value:s,source:null,stack:m??null,digest:u??null}}function Ih(s,u){try{console.error(u.value)}catch(m){setTimeout(function(){throw m})}}var Eh=typeof WeakMap=="function"?WeakMap:Map;function Ch(s,u,m){m=vi(-1,m),m.tag=3,m.payload={element:null};var b=u.value;return m.callback=function(){Lh||(Lh=!0,eg=b),Ih(s,u)},m}function Hd(s,u,m){m=vi(-1,m),m.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var C=u.value;m.payload=function(){return b(C)},m.callback=function(){Ih(s,u)}}var O=s.stateNode;return O!==null&&typeof O.componentDidCatch=="function"&&(m.callback=function(){Ih(s,u),typeof b!="function"&&(El===null?El=new Set([this]):El.add(this));var W=u.stack;this.componentDidCatch(u.value,{componentStack:W!==null?W:""})}),m}function $y(s,u,m){var b=s.pingCache;if(b===null){b=s.pingCache=new Eh;var C=new Set;b.set(u,C)}else C=b.get(u),C===void 0&&(C=new Set,b.set(u,C));C.has(m)||(C.add(m),s=Q1.bind(null,s,u,m),u.then(s,s))}function Hm(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 Yd(s,u,m,b,C){return s.mode&1?(s.flags|=65536,s.lanes=C,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,gl(m,u,1))),m.lanes|=1),s)}var Zy=k.ReactCurrentOwner,Da=!1;function Ya(s,u,m,b){u.child=s===null?xm(u,null,m,b):yl(u,s.child,m,b)}function Ym(s,u,m,b,C){m=m.render;var O=u.ref;return pl(u,C),b=gh(s,u,m,b,O,C),m=vh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~C,Ji(s,u,C)):(Xn&&m&&Md(u),u.flags|=1,Ya(s,u,b,C),u.child)}function qi(s,u,m,b,C){if(s===null){var O=m.type;return typeof O=="function"&&!lg(O)&&O.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(u.tag=15,u.type=O,Um(s,u,O,b,C)):(s=Uh(m.type,null,b,u,u.mode,C),s.ref=u.ref,s.return=u,u.child=s)}if(O=s.child,!(s.lanes&C)){var W=O.memoizedProps;if(m=m.compare,m=m!==null?m:vt,m(W,b)&&s.ref===u.ref)return Ji(s,u,C)}return u.flags|=1,s=kl(O,b),s.ref=u.ref,s.return=u,u.child=s}function Um(s,u,m,b,C){if(s!==null){var O=s.memoizedProps;if(vt(O,b)&&s.ref===u.ref)if(Da=!1,u.pendingProps=b=O,(s.lanes&C)!==0)s.flags&131072&&(Da=!0);else return u.lanes=s.lanes,Ji(s,u,C)}return xh(s,u,m,b,C)}function zm(s,u,m){var b=u.pendingProps,C=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(Rc,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(Rc,Io),Io|=s,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=O!==null?O.baseLanes:m,qn(Rc,Io),Io|=b}else O!==null?(b=O.baseLanes|m,u.memoizedState=null):b=m,qn(Rc,Io),Io|=b;return Ya(s,u,C,m),u.child}function qy(s,u){var m=u.ref;(s===null&&m!==null||s!==null&&s.ref!==m)&&(u.flags|=512,u.flags|=2097152)}function xh(s,u,m,b,C){var O=to(m)?_a:va.current;return O=Dc(u,O),pl(u,C),m=gh(s,u,m,b,O,C),b=vh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~C,Ji(s,u,C)):(Xn&&b&&Md(u),u.flags|=1,Ya(s,u,m,C),u.child)}function Gy(s,u,m,b,C){if(to(m)){var O=!0;Ho(u)}else O=!1;if(pl(u,C),u.stateNode===null)Oc(s,u),Em(u,m,b),Cm(u,m,b,C),b=!0;else if(s===null){var W=u.stateNode,ue=u.memoizedProps;W.props=ue;var ge=W.context,Pe=m.contextType;typeof Pe=="object"&&Pe!==null?Pe=Ba(Pe):(Pe=to(m)?_a:va.current,Pe=Dc(u,Pe));var Ge=m.getDerivedStateFromProps,rt=typeof Ge=="function"||typeof W.getSnapshotBeforeUpdate=="function";rt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(ue!==b||ge!==Pe)&&Ry(u,W,b,Pe),ml=!1;var qe=u.memoizedState;W.state=qe,ch(u,b,W,C),ge=u.memoizedState,ue!==b||qe!==ge||eo.current||ml?(typeof Ge=="function"&&(Im(u,m,Ge,b),ge=u.memoizedState),(ue=ml||fh(u,m,ue,b,qe,ge,Pe))?(rt||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)=>{hY(gY[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=wY(a.toString());return t(e?o:yY(o))})})}const Dx={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},bY=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,h]=P.useState((window.app||t).loadLocalStorage("thinoListView")),[g,y]=P.useState(null);P.useEffect(()=>{if(!o||!t)return;const S=t==null?void 0:t.plugins.getPlugin(o.id);y(S),h(S==null?void 0:S.settings.MemoListView),dt.setMemoListView(S==null?void 0:S.settings.MemoListView)},[o,t]),P.useEffect(()=>{if(!t||!n||!g||!g.settings)return;const S=()=>{var I,M;if(n.leaf.height===0)return;const D=(I=g==null?void 0:g.settings)==null?void 0:I.MemoListView;(M=g==null?void 0:g.settings)!=null&&M.SupportSelectOtherView||D==="chat"||D==="moments"||(n.leaf.width>950?(h(D),dt.setMemoListView(D)):n.leaf.width<=950&&(dt.setMemoListView("list"),h("list")))};S(),c.current||(c.current=t.workspace.on("resize",S),n.registerEvent(c.current))},[t,n,g]),P.useEffect(()=>{l&&(x.setIcon(l.current,Dx[f||"list"]),dt.setMemoListView(f),x.requireApiVersion("1.4.4")&&x.setTooltip(l.current,E("Switch view")))},[f]);const w=async S=>{var k;const D=!x.Platform.isDesktop&&await((k=window.Capacitor)==null?void 0:k.Plugins.Device.getId()),I=x.Platform.isDesktop?await cr():D.identifier||D.uuid;if(!r||(r==null?void 0:r.appId)!==I){fn();return}const M=async B=>{dt.setMemoListView(B),g&&(g.settings.MemoListView=B,await g.saveSettings()),h(B)},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 x.Menu;N.forEach(({view:B,title:L})=>{_.addItem(R=>{R.setChecked(f===B).setIcon(Dx[B]).setTitle(L).onClick(()=>{f!==B&&M(B)})})}),_.showAtMouseEvent(S.nativeEvent)};return v.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:l,onClick:w})},SY=()=>{const e=P.useRef(null);return P.useEffect(()=>{e&&(x.setIcon(e.current,"calendar-check"),x.setTooltip&&x.setTooltip(e.current,E("Daily Memos")))},[e]),v.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{at.setPathname("/daily")}})},OS=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),Tx={initialValue:"",interval:300};class DY{constructor(t,n=Tx){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=[OS()],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
3 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},HY=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],x0=function(t){return jY(t).map(function(n){return HY.includes(n)?"\\".concat(n):n}).join("")},YY=function(e){Eb(t,e);function t(){return Bv(this,t),Ib(this,Sp(t).apply(this,arguments))}return Tb(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,h=0,g=this.containerElem.getBoundingClientRect(),y=this.ref.getBoundingClientRect(),w=this.props.textareaRef.getBoundingClientRect(),S=window.getComputedStyle(this.ref),D=parseInt(S.getPropertyValue("margin-top"),10),I=parseInt(S.getPropertyValue("margin-bottom"),10),M=parseInt(S.getPropertyValue("margin-left"),10),N=parseInt(S.getPropertyValue("margin-right"),10),_=D+I+w.top+o+y.height,k=M+N+w.left+i+y.width;k>g.right&&w.left+i>y.width?(h=i-y.width,l.push(zc.X.LEFT),c.push(zc.X.RIGHT)):(h=i,l.push(zc.X.RIGHT),c.push(zc.X.LEFT)),_>g.bottom&&w.top+o>y.height?(f=o-y.height,l.push(zc.Y.TOP),c.push(zc.Y.BOTTOM)):(f=o,l.push(zc.Y.BOTTOM),c.push(zc.Y.TOP)),this.props.renderToBody&&(f+=w.top,h+=w.left),this.ref.style.top="".concat(f,"px"),this.ref.style.left="".concat(h,"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,h=document.body,g=ne.createElement("div",{ref:function(w){r.ref=w,l(w)},className:"rta__autocomplete ".concat(i||""),style:o},c);return f&&h!==null?J2.createPortal(g,h):g}}]),t}(ne.Component),N6=function(e){Eb(t,e);function t(n){var r;Bv(this,t),r=Ib(this,Sp(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=df.add(xi.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(df.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,h=c.selectionEnd;return f===h?null:r.state.value.substr(f,h-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 h=c.keyCode||c.which;switch(h){case xi.UP:case xi.DOWN:r._isAutocompleteOpen()||f();break;case xi.LEFT:case xi.RIGHT:f();break}return}f()},r._onSelect=function(c){var f=r.state,h=f.selectionEnd,g=f.currentTrigger,y=f.value,w=r.props.onItemSelected;if(g){var S=r._getTextToReplace(g);if(!S){r._closeAutocomplete();return}var D=S(c);if(!D){r._closeAutocomplete();return}w&&w({currentTrigger:g,item:c});var I=function(Z,Q,G){switch(Z){case"start":return G;case"next":case"end":return G+Q.length;default:if(!Number.isInteger(Z))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return Z}},M=y.slice(0,h),N=x0(g),_=M.length-M.lastIndexOf(g),k=M.search(new RegExp("(?!".concat(N,")$")
7 months ago
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.
3 months ago
`));if(y===null)return null;if(typeof y=="string")return{text:y,caretPosition:Ex};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,`"
7 months ago
`));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
3 months ago
`);return{text:"".concat(c).concat(g).concat(c),caretPosition:Ex}}},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,h=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 S=y(h);S instanceof Promise||(S=Promise.resolve(S)),S.then(function(D){if(!Array.isArray(D))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(!D.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:D,component:w})}}).catch(function(D){return Cx(D.message)})}},r._getSuggestions=function(){var c=r.state,f=c.currentTrigger,h=c.data;return!f||!h||h&&!h.length?null:h},r._createRegExp=function(){var c=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(c).sort(function(f,h){return f<h?1:f>h?-1:0}).map(function(f){return x0(f)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(c).sort(function(f,h){return f<h?1:f>h?-1:0}).map(function(f){return x0(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=NY({},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 h in c)f.includes(h)&&delete c[h];return c},r._changeHandler=function(c){var f=r.props,h=f.trigger,g=f.onChange,y=f.minChar,w=f.onCaretPositionChange,S=f.movePopupAsYouType,D=r.state,I=D.top,M=D.left,N=c;N||(N=new MY("change",{bubbles:!0}),r.textareaRef.dispatchEvent(N));var _=N.target||r.textareaRef,k=_.selectionEnd,B=_.value;if(r.lastValueBubbledEvent=B,g&&N&&(N.persist&&N.persist(),g(new Proxy(N,{get:function(X,ae,De){return ae==="target"?_:Reflect.get(X,ae,De)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:B});var R=function(){var X=EY(_,k),ae=X.top,De=X.left;r.setState({top:ae-r.textareaRef.scrollTop||0,left:De})},V=function(X){r.lastTrigger=k-X,r._closeAutocomplete(),R()};if(k<=r.lastTrigger){var Y=B.slice(0,k),Z=r.tokenRegExp.exec(Y);V(Z?Z[0].length:0)}var Q=B.slice(r.lastTrigger,k),G=r.tokenRegExp.exec(Q),le=G&&G[0],se=G&&G[1]||null,fe=se?se.length-1:0,$=r.tokenRegExpEnding.exec(Q);if($?V($[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!le||le.length<=y+fe)&&(r.state.currentTrigger&&!h[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(se&&h[se].afterWhitespace&&!/\s/.test(B[k-le.length-1])&&B[k-le.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&h[r.state.currentTrigger].allowWhitespace){if(G=new RegExp("".concat(x0(r.state.currentTrigger),".*$")).exec(B.slice(0,k)),le=G&&G[0],!le){r._closeAutocomplete();return}se=Object.keys(h).find(function(ce){return ce.slice(0,fe+1)===le.slice(0,fe+1)})||null}var he=le.slice(1);if(se){(S||I===null&&M===null||r.state.currentTrigger!==se)&&R(),r.escListenerInit();var ie=r._getTextToReplace(se);r.setState({selectionEnd:k,currentTrigger:se,textToReplace:ie,actualToken:he},function(){try{r._getValuesFromProvider()}catch(ce){Cx(ce.message)}})}},r._selectHandler=function(c){var f=r.props,h=f.onCaretPositionChange,g=f.onSelect;if(h){var y=r.getCaretPosition();h(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
6 months ago
`,et.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 ce(Gt);_t&&((ht=D.current)==null||ht.insertText(_t+`
3 months ago
`,et.id))}})))},[D,l,o]),P.useEffect(()=>{i&&h(i.DefaultPrefix==="List")},[i==null?void 0:i.DefaultPrefix]),P.useEffect(()=>{if(i){if(i.EnabledLocationList.length===1){G(i.EnabledLocationList[0].value);return}G(i.MemoSaveLocation||"DAILY")}},[i==null?void 0:i.MemoSaveLocation,i==null?void 0:i.EnabledLocationList]),P.useEffect(()=>{var nt;if(!i||!Z.current)return;const _e=(nt=Qg.find(ht=>ht.title===Q))==null?void 0:nt.icon;x.setIcon(Z.current,_e),x.requireApiVersion("1.4.4")&&x.setTooltip(Z.current,E("Thino Save To: ")+Q),le.current=Q;const et=a.manifest;if(et){const ht=o==null?void 0:o.plugins.getPlugin(et.id);if(ht){if(ht.settings.MemoSaveLocation===Q)return;ht.settings.MemoSaveLocation=Q,ht.saveSettings()}}},[Q,y]),P.useEffect(()=>{D.current&&i.MemoSaveLocation&&G(i.MemoSaveLocation)},[Z,i]),P.useEffect(()=>{if(!D.current||!i||x.Platform.isDesktop||a.globalEditorShown)return;const _e=i.UseButtonToShowEditor&&i.DefaultEditorLocation==="Bottom";if(x.Platform.isDesktop){w(!0);return}if(t&&t==="inline"){w(!0);return}if(w(x.Platform.isMobile&&!_e),!_e||a.memoListView==="chat")return;const et=document.body.find(".memolist-scrollview");et&&(et.onscroll=()=>{if(a.globalEditorShown)return;if(!a.memoListView&&dt.getState().memoListView==="chat"){et.onscroll=null;return}const nt=D.current.getContent();x.Platform.isMobile&&_e&&!nt&&w(!1)})},[a.globalEditorShown,t,D]);const se=()=>{k(!1)};P.useEffect(()=>{var _e,et,nt,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})`;(et=D.current)==null||et.insertText(Xt),(nt=D.current)==null||nt.focus(),dt.setMarkMemoId("");return}if((ht=a.editMemoId)!=null&&ht.trim()&&a.editMemoId!==I.current.editMemoId){const Xt=we.getMemoById(a.editMemoId);if(Xt)switch(h(Xt.thinoType==="JOURNAL"),i.EditorType){case"memos":(St=D.current)==null||St.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Tt=D.current)==null||Tt.focus();break;case"obsidian":(Gt=D.current)==null||Gt.clear(),(_t=D.current)==null||_t.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Vt=D.current)==null||Vt.focus();break}}I.current=a},[a.markMemoId,a.editMemoId]),P.useEffect(()=>{var _e,et,nt;!D.current||M||i.EditorType==="memos"&&((_e=D.current)==null||_e.element.addEventListener("paste",fe),(et=D.current)==null||et.element.addEventListener("drop",$),(nt=D.current)==null||nt.element.addEventListener("click",he),N(!0))},[D.current]);const fe=async _e=>{var et;if(_e.clipboardData&&_e.clipboardData.files.length>0){_e.preventDefault();const nt=_e.clipboardData.files;for(const ht of nt){const St=await ce(ht);St&&((et=D.current)==null||et.insertText(St))}}},$=async _e=>{var et;if(_e.dataTransfer&&_e.dataTransfer.files.length>0){_e.preventDefault();const nt=_e.dataTransfer.files;for(const ht of nt){const St=await ce(ht);St&&((et=D.current)==null||et.insertText(St))}}},he=()=>{var _e;De(((_e=D.current)==null?void 0:_e.element.value)||"")},ie=async(_e,et)=>{var St,Tt,Gt;const nt=_e.ctrlKey||_e.metaKey,ht=_e.altKey;if(_e.key==="Escape"&&a.globalEditorShown&&(dt.setGlobalEditorShown(!1),_e.preventDefault()),nt&&_e.key==="Enter"){_e.preventDefault(),_e.stopPropagation(),et?(await X((Tt=D.current)==null?void 0:Tt.getContent()),(Gt=D.current)==null||Gt.clear()):await X((St=D.current)==null?void 0:St.element.value);return}if(ht)for(let _t=0;_t<i.EnabledLocationList.length;_t++)_e.key===(_t+1).toString()&&G(i.EnabledLocationList[_t].value);setTimeout(()=>{var _t;et||De(((_t=D.current)==null?void 0:_t.element.value)||"")})},ce=P.useCallback(async _e=>{const{type:et}=_e;if(et.startsWith("image"))try{return`${await q2.upload(_e)}`}catch(nt){new x.Notice(nt)}},[]),X=async _e=>{if(!_e||_e.trim()===""){new x.Notice(E("Content cannot be empty"));return}const et=ft.getState().settings,nt=et==null?void 0:et.addTagAutomatically,ht=et==null?void 0:et.addTagWithNewline,St=et==null?void 0:et.addTagPosition,Gt=(hz()||[]).filter(dn=>!_e.include
7 months ago
`:""}${_e}`:`${_e} ${ht?`
3 months ago
`:""}${Gt.map(dn=>`#${dn}`).join(" ")}`:_e;await _t(Vt,Xt),k0("")},ae=P.useCallback(()=>{var _e;dt.setEditMemoId(""),(_e=D.current)==null||_e.setContent(""),k0("")},[]),De=P.useCallback(_e=>{if(k0(_e??""),!D.current)return;const et=D.current.getContent(),nt=D.current.element.selectionStart,ht=et.slice(0,nt),St=et.slice(nt);(ht.endsWith("@")||ht.endsWith("📆"))&&St.startsWith(" ")||(ht.endsWith("@")||ht.endsWith("📆"))&&St===""?(Ze(),k(!0)):k(!1),setTimeout(()=>{var Tt;(Tt=D.current)==null||Tt.focus()})},[i.EditorType]),je=_e=>{if(!D.current||!i)return;_e&&(se(),h(!1));const et=D.current.getContent(),nt=D.current.element.selectionStart,ht=et.slice(0,nt),St=et.slice(nt),Tt=x.moment(_e);if(ht.endsWith("@"))switch(i.InsertDateFormat){case"Dataview":D.current.element.value=et.slice(0,D.current.element.selectionStart-1)+"[due:: "+Tt.format("YYYY-MM-DD")+"]"+St,D.current.element.setSelectionRange(nt+17,nt+17),D.current.focus(),De(D.current.element.value);break;case"Tasks":D.current.element.value=et.slice(0,D.current.element.selectionStart-1)+"📅 "+Tt.format("YYYY-MM-DD")+St,D.current.element.setSelectionRange(nt+11,nt+11),D.current.focus(),De(D.current.element.value)}else{D.current.element.value=ht+Tt.format("YYYY-MM-DD")+St,D.current.element.setSelectionRange(nt+10,nt+10),D.current.focus(),De(D.current.element.value);return}},Re=()=>{D.current&&h()},Fe=async()=>{var nt;const _e=!x.Platform.isDesktop&&await((nt=window.Capacitor)==null?void 0:nt.Plugins.Device.getId()),et=x.Platform.isDesktop?await cr():_e.identifier||_e.uuid;return!c||(c==null?void 0:c.appId)!==et?(fn(),!1):!0},Be=async _e=>{if(!await Fe())return;const et=new x.Menu;i.EnabledLocationList.forEach(Tt=>{et.addItem(Gt=>{var _t;Gt.setTitle(E(Tt.value)).setIcon(((_t=Qg.find(Vt=>Vt.title===Tt.value))==null?void 0:_t.icon)??"file").setChecked(Q===Tt.value).onClick(()=>{G(Tt.value)})})});let nt=_e.target,ht=null;for(;!nt.hasClass("location-wrapper")&&(ht=nt.parentElement,ht);)nt=ht;const St=nt.getBoundingClientRect();setTimeout(()=>{et.showAtPosition({x:St.x,y:St.bottom,width:St.width,left:!1,overlap:!0})},200)},Xe=P.useCallback(()=>{var _e,et;if(!(!D.current&&i.EditorType==="memos"))switch(i.EditorType){case"obsidian":(_e=D.current)==null||_e.focus(),(et=D.current)==null||et.insertTag();break;case"memos":{const nt=D.current.getContent(),ht=D.current.element.selectionStart,St=nt.slice(0,ht),Tt=nt.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),D.current.element.value=Gt,D.current.element.setSelectionRange(_t,_t),D.current.focus();const Vt=new Event("input",{bubbles:!0,cancelable:!0});D.current.element.dispatchEvent(Vt),De(D.current.element.value)}}},[o]),Ze=P.useCallback(()=>{if(!D.current||!L.current||!i||!o)return;const nt=o.workspace.getLeavesOfType(lo)[0].view.containerEl,ht=280,St=nt.clientWidth,{x:Tt,y:Gt}=pz(D.current.element);let _t,Vt;x.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=D.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),B(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 et=_e.files[0],nt=await ce(et);nt&&((ht=D.current)==null||ht.insertText(nt)),document.body.removeChild(_e)},_e.click()},[]),Ct=!!a.editMemoId,tn=P.useMemo(()=>({className:"memo-editor",inputerType:i.EditorType||"obsidian",modal:r,initialContent:mz(),placeholder:E("What do you think now..."),showConfirmBtn:!0,showCancelBtn:Ct,showTools:!0,onConfirmBtnClick:X,onCancelBtnClick:ae,onContentChange:De}),[Ct,i.EditorType]);return v.jsxs(v.Fragment,{ch
7 months ago
`},"")),y+r+I.replace(/ \^\S{6}/g,"")+`
3 months ago
`+M},"");return e.reduce((g,y)=>{const w=t!=null&&t.ShowDate?`- [[${x.moment(y.date,"YYYY-MM-DD").format(n)}]]
6 months ago
`:"",S=h(y.have),D=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?`
`:"";return g+w+S+D},"").replace(/<br>/g,`
3 months ago
`)},wz=[{label:E("Today"),value:x.moment().format("YYYY-MM-DD")},{label:E("Yesterday"),value:x.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:E("Last 7 days"),value:x.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:E("Last 30 days"),value:x.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:E("Last 90 days"),value:x.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:E("Last 180 days"),value:x.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:E("Last 365 days"),value:x.moment().subtract(365,"days").format("YYYY-MM-DD")}],Q6=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:wz.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(Cb,{className:"calendar-date-picker",datestamp:(e==null?void 0:e.defaultValue)||x.moment().startOf("day").valueOf(),handleDateStampChange:(r,a)=>{t(e.type==="icon"?x.moment(r).format("YYYY-MM-DD"):r.toString()),n&&n(!1)}})]})},Pw=e=>{const{handleValueChange:t}=e,[n,r]=ne.useState(!1),a=ne.useRef(null),o=ne.useRef(null),i=Mb(o.current,a.current,{placement:"bottom-start"});return Hv(a,()=>{r(!1)}),v.jsxs(v.Fragment,{children:[v.jsx("span",{ref:c=>{o.current=c,c&&e.type==="icon"&&x.setIcon(c,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!x.Platform.isMobile&&r(!n),!x.Platform.isMobile&&(i!=null&&i.update)&&(i==null||i.update()),x.Platform.isMobile&&new X6(ft.getState().app,e.type,t).open()},children:e.type==="text"&&e.defaultValue?e.defaultText?e.defaultText:x.moment(e.defaultValue,"x").subtract(e.startOrEnd==="end"?1:0,"days").format("YYYY/MM/DD"):""}),v.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:i.styles.popper,children:v.jsx(Q6,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class X6 extends x.Modal{constructor(n,r,a){super(n);Se(this,"root");Se(this,"type");Se(this,"handleValueChange");this.type=r,this.handleValueChange=a}onOpen(){const{contentEl:n}=this;this.root=Rv(n),this.root.render(v.jsx(Q6,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const bz=(e,t)=>(e%t+t)%t;class Sz{constructor(t,n,r){Se(this,"owner");Se(this,"values");Se(this,"suggestions");Se(this,"selectedItem");Se(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=bz(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 e9{constructor(t,n){Se(this,"inputEl");Se(this,"popper");Se(this,"scope");Se(this,"suggestEl");Se(this,"suggest");Se(this,"cb");this.inputEl=t,this.scope=new x.Scope,this.cb=n,this.suggestEl=createDiv("suggestion-container");const r=this.suggestEl.createDiv("suggestion");this.suggest=new Sz(this,r,this.scope),this.scope.register([],"Escape",th
6 months ago
`:""}${V}`:`${V} ${B?`
3 months ago
`:""}${_.map(Y=>`#${Y}`).join(" ")}`),R&&R.content!==V){const Y=await we.updateMemo(R.id,V==null?void 0:V.trim());L.push(Y)}}L.length>0&&we.editMemoBulk(L),L.length>0&&at.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:S,onKeyDown:N=>{N.key==="Enter"&&D(S.current.value)}})}),v.jsxs("div",{className:"tag-operation-settings",children:[v.jsx("div",{ref:h}),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")})]})]})]})},xT=new Map,Sf=async(e,t=!0)=>{const{vault:n,metadataCache:r}=ft.getState().app;if(t&&xT.has(e))return Promise.resolve(xT.get(e));if(e.contains("data:image"))return e;let a;const o=await n.adapter.exists(x.normalizePath(e));let i="";try{if(!o&&!/(http|https)/g.test(e)&&!e.includes("data:image")){let l;if(e.startsWith("app://")){const c=x.normalizePath(decodeURIComponent(e).replace(x.Platform.resourcePathPrefix,"").replace(/\?(.*)$/,"").replace(x.normalizePath(app==null?void 0:app.vault.adapter.basePath),""));i=x.normalizePath(decodeURIComponent(c))}else{if(l=r.getFirstLinkpathDest(e,""),!l){new x.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=x.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 x.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 xz(a,e):""}},xz=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;xT.set(t,a),n(a)},r.readAsDataURL(e)}),Rg=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=x.normalizePath(decodeURIComponent(t))),await Sf(t)):void 0},Mz=async e=>{var n;return e.getAttribute("src")?(n=e==null?void 0:e.src)!=null&&n.startsWith("http://localhost")?await Sf(e.getAttribute("path")||x.normalizePath(e==null?void 0:e.parentElement.getAttribute("src"))):await Sf(e.getAttribute("src")):void 0},Zt=_z(),jw=Bz(),t9=Hz(),n9=Yz(),ef={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 jw.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 jw.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?jw.inlineAll(c).then(function(h){a.style.setProperty(l,h,f)}):Promise.resolve()});return Promise.all(i).then(function(){return a})}}}function Uz(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 zz(e,t,n,r,a){const o=wn.impl.options.copyDefaultStyles?Wz(e,t):{},i=a.style;Zt.asArray(n).forEach(function(l){const c=n.getPropertyValue(l),f=o[l],h=r?r.getPropertyValue(l):void 0;if(c!==f||r&&c!==h){const g=n.getPropertyPriority(l);Uz(i,l,c,g)}})}let N0=null,cw={};const Vz=["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 Wz(e,t){const n=l(t),r=c(n);if(cw[r])return cw[r];const a=$z(),o=f(a.document,n),i=h(a,o);return g(o),cw[r]=i,i;function l(y){const w=[];do{if(y.nodeType===iI){const S=y.tagName;if(w.push(S),Vz.includes(S))break}y=y.parentNode}while(y);return w}function c(y){return e.styleCaching==="relaxed"?y.filter((w,S,D)=>S===0||S===D.length-1).join(">"):y.join(">")}function f(y,w){let S=y.body;do{const D=w.pop(),I=y.createElement(D);S.appendChild(I),S=I}while(w.length>0);return S.textContent="",S}function h(y,w){const S={},D=y.getComputedStyle(w);return Zt.asArray(D).forEach(function(I){S[I]=I==="width"||I==="height"?"auto":D.getPropertyValue(I)}),S}function g(y){do{const w=y.parentElement;w!==null&&w.removeChild(y),y=w}while(y&&y.tagName!=="BODY")}}function $z(){if(Ci)return Ci.contentWindow;const e=document.characterSet||"UTF-8",t=document.doctype,n=t?`<!DOCTYPE ${r(t.name)} ${r(t.publicId)} ${r(t.systemId)}`.trim()+">":"";return Ci=document.createElement("iframe"),Ci.id="domtoimage-sandbox-"+Zt.uid(),Ci.className="domtoimage-thino",Ci.style.visibility="hidden",Ci.style.position="fixed",document.body.appendChild(Ci),a(Ci,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 h=document.implementation.createHTMLDocument(c);h.head.appendChild(f);const g=i+h.documentElement.outerHTML;return o.setAttribute("srcdoc",g),o.contentWindow}catch{}return o.contentDocument.head.appendChild(f),o.contentDocument.title=c,o.contentWindow}}function Zz(){Ci&&(document.body.removeChild(Ci),Ci=null),N0&&clearTi
7 months ago
Before: <div {...getCollapseProps({style: {padding: 10}})}>{children}</div>
After: <div {...getCollapseProps()}>
<div style={{padding: 10}}>
{children}
</div>
3 months ago
</div>`)},P.useEffect(()=>{t(e)},[e])}var dV=typeof window>"u"?P.useEffect:P.useLayoutEffect;function fV({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=i9(n),f=iV(i?`${i}`:void 0),[h,g]=Qz(r,a),y=P.useRef(h),[w,S]=P.useState(!1),D=eV(),I=o??D,M=P.useRef(),N=P.useRef(),_=P.useRef(null),[k,B]=P.useState(null);cV(_);const L=`${l.collapsedHeight||0}px`;function R(V){if(!_.current)return;const Y=_.current;for(const Z in V){const Q=V[Z];Q?Y.style[Z]=Q:Y.style.removeProperty(Z)}}return dV(()=>{if(!_.current||h===y.current)return;y.current=h;function Y(G){return I?0:e??lV(G)}const Z=G=>`height ${Y(G)}ms ${t}`,Q=G=>{function le(){h?(R({height:"",overflow:"",transition:"",display:""}),c("expandEnd")):(R({transition:""}),c("collapseEnd")),S(!1)}N.current&&Vx(N.current),N.current=sV(le,G)};return S(!0),h?M.current=requestAnimationFrame(()=>{c("expandStart"),R({display:"block",overflow:"hidden",height:L}),M.current=requestAnimationFrame(()=>{c("expanding");const G=Wx(_);Q(Y(G)),_.current&&(_.current.style.transition=Z(G),_.current.style.height=`${G}px`)})}):M.current=requestAnimationFrame(()=>{c("collapseStart");const G=Wx(_);Q(Y(G)),R({transition:Z(G),height:`${G}px`}),M.current=requestAnimationFrame(()=>{c("collapsing"),R({height:L,overflow:"hidden"})})}),()=>{M.current&&cancelAnimationFrame(M.current),N.current&&Vx(N.current)}},[h,L,I,e,t,c]),{isExpanded:h,setExpanded:g,getToggleProps(V){const{disabled:Y,onClick:Z,refKey:Q,...G}={refKey:"ref",onClick(){},disabled:!1,...V},le=k?k.tagName==="BUTTON":void 0,se=V==null?void 0:V[Q||"ref"],fe={id:`react-collapsed-toggle-${f}`,"aria-controls":`react-collapsed-panel-${f}`,"aria-expanded":h,onClick(ie){Y||(Z==null||Z(ie),g(ce=>!ce))},[Q||"ref"]:$x(se,B)},$={type:"button",disabled:Y?!0:void 0},he={"aria-disabled":Y?!0:void 0,role:"button",tabIndex:Y?-1:0};return le===!1?{...fe,...he,...G}:le===!0?{...fe,...$,...G}:{...fe,...$,...he,...G}},getCollapseProps(V){const{style:Y,refKey:Z}={refKey:"ref",style:{},...V},Q=V==null?void 0:V[Z||"ref"];return{id:`react-collapsed-panel-${f}`,"aria-hidden":!h,"aria-labelledby":`react-collapsed-toggle-${f}`,role:"region",...V,[Z||"ref"]:$x(_,Q),style:{boxSizing:"border-box",...!w&&!h?{display:L==="0px"?"none":"block",height:L,overflow:"hidden"}:{},...Y}}}}}const hV=e=>{const{dailyNotesState:{app:t,view:n,settings:r},globalState:{memoListView:a}}=P.useContext(Lt),{getCollapseProps:o,getToggleProps:i,isExpanded:l,setExpanded:c}=fV({defaultExpanded:!0,collapsedHeight:(r==null?void 0:r.ThinoCollapsedHeight)??100}),{memo:f,handleMemoContentClick:h,handleMemoDoubleClick:g}=e,y=ne.useRef(null),[w,S]=ne.useState(""),D=ne.useRef(w),I=ne.useRef(0),[M,N]=ne.useState(!1),[_,k]=ne.useState(!1),B=x.debounce((R,V,Y)=>{for(const Z of R){const{height:Q}=Z.contentRect,G=(V==null?void 0:V.ThinoMaxHeight)||340,le=Q>G;N(le),c(!le),Y.disconnect()}},500);P.useEffect(()=>{var R;if(f.content!==D.current){if(r!=null&&r.OptimizeForCallout&&f.content.split("> [!").length>3&&f.content.split(`
`).length>10&&!_){const V=y.current.createEl("button");V.setText(E("Render content")),V.onclick=async()=>{k(!0),await L()};const Y=y.current.createEl("textarea");Y.setText(f.content),Y.disabled=!0,(R=y.current)==null||R.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 R=y.current;if(!R)return;if(!(r!=null&&r.ThinoMaxHeight)){c(!0),N(!1);return}const V=new ResizeObserver(Y=>{B(Y,r,V)});return V.observe(R),()=>V.disconnect()},[_]);const L=async()=>{var R,V,Y;if(y.current&&n&&t&&f.content!==D.current){y.current.empty(),await x.MarkdownRenderer.render(t,f.content,y.current,f.path,n);const Z=(R=y.current)==null?void 0:R.querySelectorAll(".internal-link");Z==null||Z.forEach(Q=>{const G=Q,le=G.getAttribute("data-href");if(!le)return;t.metadataCache.getFirstLinkpathDest(le,f.path)||Q.classList.add("is-unresolved"),G.addEventListener("mouseover",fe=>{fe.stopPropagation(),t.workspace.trigger("hover-link",{event:fe,source:"thino",hoverParent:n.containerEl,targetEl:G,linktext:le,sourcePath:G.href})})})}D.current=f.content,(V=y.current)==null||V.toggleClass(["markdown-rendered"],!0),(Y=y.current)==null||Y.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:R=>h(R,f),onDoubleClick:g,onContextMenu:R=>{R.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")})]})]})},s9=P.memo(hV,(e,t)=>e.memo.content===t.memo.content),pV=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(ad)];for(const S of y)if(S&&S.length===3){const D=S[2],I=we.getMemoById(D);I&&g.push({...I,createdAtStr:ut.getDateTimeString(I.createdAt),dateStr:ut.getDateString(I.createdAt)})}a([...g]);const w=await we.getLinkedMemos(t.id);i(w.sort((S,D)=>ut.getTimeStampByDate(D.createdAt)-ut.getTimeStampByDate(S.createdAt)).map(S=>({...S,createdAtStr:ut.getDateTimeString(S.createdAt),dateStr:ut.getDateString(S.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const l=P.useCallback(async h=>{var y;const g=h.target;if(g.className==="memo-link-text"){const w=(y=g.dataset)==null?void 0:y.value,S=we.getMemoById(w??"");if(S){const D={...S,createdAtStr:ut.getDateTimeString(S.createdAt)};a([]),i([]),n(D)}else new x.Notice(E("Thino not found")),g.classList.remove("memo-link-text")}},[]),c=P.useCallback(h=>{a([]),i([]),n({...h,createdAtStr:ut.getDateTimeString(h.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:h=>{h&&x.setIcon(h,"edit")},className:"btn edit-btn",onClick:f}),v.jsx("button",{ref:h=>{h&&x.setIcon(h,"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(s9,{memo:t,handleMemoContentClick:l,handleMemoDoubleClick:()=>{}})})}),v.jsx("div",{className:"layer-container"})]}),r.length>0?v.jsxs("div",{classN
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(h),children:[v.jsxs("span",{className:"time-text",children:[h.dateStr," "]}),g]},h.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(h=>{const g=AC(dT(h.content)).replaceAll(`
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(h),children:[v.jsxs("span",{className:"time-text",children:[h.dateStr," "]}),g]},h.id)})]}):null]})};function Df(e){Db({className:"memo-card-dialog"},pV,{memo:e})}function mV({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 gV=e=>{const{memo:t,handlePinMemoClick:n,handleFixMemoClick:r,handleSourceMemoClick:a,handleShowMemoStoryDialog:o,handleCopyMemoClick:i,handleEditMemoClick:l,handleGenMemoImageBtnClick:c,handleMarkMemoClick:f,handleArchiveMemo:h,handleDeleteMemoClick:g,handleSplitMemoClick:y}=e,w=Le.getState().dailyNotesState.settings,S=w.EnabledLocationList.find(Y=>Y.value==="MULTI"),[D,I]=Xl(!1),M=P.useRef(null),N={pinRef:P.useRef(null),fixRef:P.useRef(null),typeRef:P.useRef(null),moreRef:P.useRef(null)},[_,k]=mV({mouseEnterDelayMS:500}),B=P.useRef();P.useEffect(()=>{if(!N.typeRef)return;const Y=Qg.find(Z=>Z.title===t.sourceType);x.setIcon(N.typeRef.current,Y.icon),x.requireApiVersion("1.4.4")&&x.setTooltip(N.typeRef.current,t.path),N.fixRef&&(x.setIcon(N.fixRef.current,"shield-alert"),x.requireApiVersion("1.4.4")&&x.setTooltip(N.fixRef.current,"Update Thino property"))},[N.typeRef]),P.useEffect(()=>{N.pinRef&&(t.pinned?(x.setIcon(N.pinRef.current,"pin-off"),x.requireApiVersion("1.4.4")&&x.setTooltip(N.pinRef.current,E("UNPIN"))):(x.setIcon(N.pinRef.current,"pin"),x.requireApiVersion("1.4.4")&&x.setTooltip(N.pinRef.current,E("PIN"))))},[N.pinRef,t.pinned]);const L=x.debounce(()=>{var Y;if(_&&N.moreRef.current){if(B.current&&B.current._loaded||(Y=B.current)!=null&&Y.useNativeMenu||document.body.find(".more-action-btns-wrapper"))return;const Z=R(),Q=N.moreRef.current.getBoundingClientRect();Z.showAtPosition({x:Q.left,y:Q.bottom})}},200);P.useEffect(()=>{L()},[_]);const R=()=>{var Z;const Y=new x.Menu;return Y.dom.toggleClass(["more-action-btns-wrapper"],!0),Y.useNativeMenu?(Y.setNoIcon(),Y.addItem(Q=>{Q.setTitle(E("COPY")).onClick(i)}),Y.addItem(Q=>{Q.setTitle(E("EDIT")).onClick(l)}),Y.addItem(Q=>{Q.setTitle(E("SHARE")).onClick(c)})):Y.addItem(Q=>{const G=Q.dom;Q.dom.empty(),Q.dom.toggleClass(["more-action-btn-group","more-action-menu-item"],!0);const le=G.createEl("span");new x.ExtraButtonComponent(le).setIcon("copy"),le.toggleClass(["menu-item-icon","more-action-item-icon"],!0),le.onclick=$=>{$.stopPropagation(),$.preventDefault(),i(),Y.close()};const se=G.createEl("span");se.toggleClass(["menu-item-icon","more-action-item-icon"],!0),se.onclick=$=>{$.stopPropagation(),$.preventDefault(),l(),Y.close()},new x.ExtraButtonComponent(se).setIcon("pencil");const fe=G.createEl("span");fe.toggleClass(["menu-item-icon","more-action-item-icon"],!0),fe.onclick=$=>{$.stopPropagation(),$.preventDefault(),c(),Y.close()},new x.ExtraButtonComponent(fe).setIcon("share-2")}),Y.addSeparator(),Y.addItem(Q=>{Q.setIcon("book-open").setTitle(E("READ")).onClick(o)}),Y.addItem(Q=>{Q.setIcon("bookmark").setTitle(E("MARK")).onClick(f)}),((Z=/(^|\n)#{1,6}\s/g.exec(t.content))==null?void 0:Z.length)>1&&S&&Y.addItem(Q=>{Q.setIcon("separator-horizontal").setTitle(E("SPLIT")).onClick(y)}),Y.addItem(Q=>{Q.setIcon("home").setTitle(E("SOURCE")).onClick(()=>a(t))}),Y.addSeparator(),Y.addItem(Q=>{Q.setWarning(!0).setIcon("archive").setTitle(E("ARCHIVE").toUpperCase()).onClick(()=>h(t))}),Y.addItem(Q=>{Q.setWarning(!0).setIcon("trash").setTitle(w.DeleteThinoDirectly?E("DELETE"):E("TRASH BOX").toUpperCase().toUpperCase()).onClick(G=>{if(Y.useNativeMenu)g(G),Y.close();else if(G.stopPropagation(),G.preventDefault(),!D){I(!0),Q.setTitle(E("CONFIRM")).onClick(le=>{g(le),Y.close()});return}})}),Y.addSeparator(),Y.addItem(Q=>{Q.setDisabled(!0).setTitle(ut.getWordCount(t.content.replace(/```[^\S\r\n]*[a-z]*\n.*?\n```/g,""))+` ${E("words")}`)}),Y.onHide(()=>{I(!1)}),B.current=Y,Y},V=Y=>{R().showAtMouseEvent(Y.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 x.Notice("No headings found"),this.close();return}const a=this.ensureUniqueFileNames(r);for(const l of r){const c=r.indexOf(l),f=await we.createThino({content:l.join(`
6 months ago
`),name:a[c],type:"MULTI",isList:!0});we.pushMemo(f)}let o=this.thino.content;r.forEach((l,c)=>{o=o.replace(l.join(`
3 months ago
`),`[[${a[c]}]]`)});const i=await we.updateMemo(this.thino.id,o);i&&we.editMemo(i),this.close()}}const wV=async(e,t,n)=>{const r=n.getAttribute("href"),a=n.className;if(a.contains("tag"))bV(n.innerText.slice(1));else if(a.contains("internal-link")){const o=n.getAttribute("data-href"),i=we.getMemoById(o??"");i?Df(i):await e.workspace.openLinkText(o,o,!x.Platform.isMobile&&t.navigation!==!0)}else r&&window.open(r,"_blank")},bV=e=>{const t=at.getState().query.tag;at.setTagQuery(t.contains(",")?t.split(",").includes(e)?t.split(",").filter(n=>n!==e).join(","):t+","+e:t===e?"":e)},SV=(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);Nb({imgUrl:n,filepath:n.startsWith("app")?r:void 0,otherIMGEls:a,currentIndex:o})},DV=e=>{var r;const t=(r=e.dataset)==null?void 0:r.value,n=we.getMemoById(t??"");n?Df(n):(new x.Notice("Thino Not Found"),e.classList.remove("memo-link-text"))},TV=async(e,t,n,r)=>{var l;const a=e!=null&&e.AppendDateWhenTaskDone?" ✅ "+x.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),h=t.content.split(/\n/),g=[];for(let M=0;M<h.length;M++)/^\s*(-|\*|\d+\.)\s\[.\]\s/.test(h[M])&&g.push(M);const y=g[f],w=h[y],S=w.match(/^\s*(-|\*|\d+\.)\s\[.\]\s/)[0];let D=w.replace(/^\s*(-|\*|\d+\.)\s\[.\]\s/,S.replace(/\[.\]/,o==="TODO"?"[x]":"[ ]"))+(o==="TODO"?a:"");e.AppendDateWhenTaskDone&&o!=="TODO"&&(D=D.replace(/ ✅ \d{4}-\d{2}-\d{2}/g,"")),h[y]=D;const I=h.join(`
`).trim();if(t&&t.content!==I){const M=await we.updateMemo(t.id,I);we.editMemo(M)}}},IV=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),h=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=$=>{if($.ctrlKey||$.metaKey){const he=x.moment(l.createdAt,"YYYY/MM/DD HH:mm:ss");at.setFromAndToQuery(he.startOf("day").valueOf(),he.endOf("day").valueOf());return}Df(l)},S=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"){const $=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");$&&$.trigger("click")}dt.setMarkMemoId(l.id)},D=async()=>{var ie;const $=!x.Platform.isDesktop&&await((ie=window.Capacitor)==null?void 0:ie.Plugins.Device.getId()),he=x.Platform.isDesktop?await cr():$.identifier||$.uuid;if(!o||(o==null?void 0:o.appId)!==he){fn();return}l.pinned?await we.unpinMemoById(l.id):await we.pinMemoById(l.id)},I=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"&&x.Platform.isMobile){const $=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");$&&$.trigger("click")}(i==="/review"||i==="/daily")&&y(!0),i!=="/review"&&i!=="/daily"&&dt.setEditMemoId(l.id)},M=async $=>{$.sourceType==="MULTI"&&$.id.trim()===""&&await we.updateMemoProperty($)},N=async $=>{await we.openThinoByID($.id)},_=async $=>{try{const he=await we.archiveMemo($);he&&we.editMemo(he)}catch(he){console.error(he),new x.Notice(he.message)}},k=async()=>{try{if(a.DeleteThinoDirectly)await we.deleteMemoById(l.id);else{const $=await we.hideMemoById(l.id);$&&we.editMemo($)}}catch($){new x.Notice($.message)}dt.getState().editMemoId===l.id&&dt.setEditMemoId("")},B=()=>{if(h.current&&!h.current.confirmStatus){h.current&&h.current.toggleConfirm(!1);return}},L=()=>{uf(l)},R=async()=>{const $=await we.updateMemo(l.id,l.content,l.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");$&&we.editMemo($)},V=async()=>{navigator.clipboard.writeText(l.content).then(()=>{new x.Notice(E("COPY SUCCEED"))}).catch(()=>{new x.Notice(E("COPY FAILED"))})},Y=async()=>{new yV(n,l).open()},Z=$=>{$&&$.target.tagName!=="INPUT"&&I()},Q=async($,he)=>{$.preventDefault(),$.stopPropagation();const ie=$.target;if($.ctrlKey||$.metaKey){await N(he);return}if(ie.tagName==="A"){await wV(n,r,ie);return}if(ie.tagName==="IMG"){SV(f.current,ie);return}if(ie.tagName==="A"&&ie.getAttribute("href")){const ce=ie.getAttribute("href");window.open(ce,"_blank");return}if(ie.className==="memo-link-text"){DV(ie);return}if(ie.tagName==="INPUT"&&ie.hasClass("task-list-item-checkbox")){await TV(a,he,f.current,ie);return}},G=$=>{const he=new x.Menu;he.dom.toggleClass("memo-context-menu",!0);const ie=window.getSelection();(ie==null?void 0:ie.toString().length)>0&&he.addItem(ce=>{ce.setIcon("copy").setTitle(E("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(ie.toString()).then(()=>{new x.Notice(E("COPY SUCCEED"))}).catch(()=>{new x.Notice(E("COPY FAILED"))})})}).addSeparator(),he.addItem(ce=>{ce.setIcon("copy").setTitle(E("Copy thino").toLocaleUpperCase()).onClick(async()=>{await V(),he.close()})}).addItem(ce=>{ce.setIcon("book-open").setTitle(E("READ")).onClick(w)}).addItem(ce=>{ce.setIcon(l.pinned?"pin-off":"pin").setTitle(l.pinned?E("UNPIN"):E("PIN")).onClick(D)}).addItem(ce=>{ce.setIcon("bookmark").setTitle(E("MARK")).onClick(S)}).addItem(ce=>{ce.setIcon("share-2").setTitle(E("SHARE")).onClick(L)}).addItem(ce=>{ce.setIcon("pencil").setTitle(E("EDIT")).onClick(I)}).addItem(ce=>{ce.setIcon("home").setTitle(E("SOURCE")).onClick(()=>N(l))}).addSeparator().addItem(ce=>{ce.setIcon("archive").setTitle(E("ARCHIVE").toLocaleUpperCase()).onClick(()=>_(l))}).addItem(ce=>{ce.setIcon("trash").setTitle(E("DELETE")).onClick(async()=>{await k()})}),he.showAtMouseEvent($.native
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _u(e,t){return h9(e)||GV(e,t)||sI(e,t)||p9()}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 JV=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],h=0;c=new Error(t.replace(/%s/g,function(){return f[h++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},KV=JV;const ov=qt(KV);var QV=function(){};function XV(e,t){var n={};return Object.keys(e).forEach(function(r){n[dw(r)]=QV}),n}function Xx(e,t){return e[t]!==void 0}function dw(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function eW(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function tW(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Hw(e,t)}function m9(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function g9(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function v9(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}}m9.__suppressDeprecationWarning=!0;g9.__suppressDeprecationWarning=!0;v9.__suppressDeprecationWarning=!0;function nW(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:
3 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=m9,t.componentWillReceiveProps=g9),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=v9;var l=t.componentDidUpdate;t.componentDidUpdate=function(f,h,g){var y=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:g;l.call(this,f,h,y)}}return e}var rW="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function y9(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=eW(e),o=Object.keys(t),i=o.map(dw);a||!n.length||ov(!1);var l=function(f){tW(h,f);function h(){for(var y,w=arguments.length,S=new Array(w),D=0;D<w;D++)S[D]=arguments[D];y=f.call.apply(f,[this].concat(S))||this,y.handlers=Object.create(null),o.forEach(function(M){var N=t[M],_=function(B){if(y.props[N]){var L;y._notifying=!0;for(var R=arguments.length,V=new Array(R>1?R-1:0),Y=1;Y<R;Y++)V[Y-1]=arguments[Y];(L=y.props)[N].apply(L,[B].concat(V)),y._notifying=!1}y.unmounted||y.setState(function(Z){var Q,G=Z.values;return{values:Pr(Object.create(null),G,(Q={},Q[M]=B,Q))}})};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[dw(M)]}),y.state={values:I,prevProps:{}},y}var g=h.prototype;return g.shouldComponentUpdate=function(){return!this._notifying},h.getDerivedStateFromProps=function(w,S){var D=S.values,I=S.prevProps,M={values:Pr(Object.create(null),D),prevProps:{}};return o.forEach(function(N){M.prevProps[N]=w[N],!Xx(w,N)&&Xx(I,N)&&(M.values[N]=w[dw(N)])}),M},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var w=this,S=this.props,D=S.innerRef,I=Ab(S,["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:D||this.attachRef}))},h}(ne.Component);nW(l),l.displayName="Uncontrolled("+r+")",l.propTypes=Pr({innerRef:function(){}},XV(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,h){return ne.createElement(l,Pr({},f,{innerRef:h,__source:{fileName:rW,lineNumber:128},__self:this}))}),c.propTypes=l.propTypes),c.ControlledComponent=e,c.deferControlTo=function(f,h,g){return h===void 0&&(h={}),y9(f,Pr({},t,h),g)},c}function w9(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=w9(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=w9(e))&&(r&&(r+=" "),r+=t);return r}var b9={exports:{}},BS,eM;function aW(){if(eM)return BS;eM=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return BS=e,BS}var HS,tM;function oW(){if(tM)return HS;tM=1;var e=aW();function t(){}function n(){}return n.resetWarningCache=t,HS=function(){function r(i,l,c,f,h,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},HS}b9.exports=oW()();var iW=b9.exports;const ke=qt(iW);var Yw="milliseconds",iv="seconds",sv="minutes",lv="hours",Tf="day",Cp="week",uv="month",If="year",Ef="decade",Cf="century",S9={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},sW={month:1,year:12,decade:10*12,century:100*12};function lW(e){return[
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fw(e){return gW(e)||M9(e)||sI(e)||vW()}function yW(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 k9=yW;function wW(e,t){return e===t||e!==e&&t!==t}var $v=wW,bW=typeof dr=="object"&&dr&&dr.Object===Object&&dr,N9=bW,SW=N9,DW=typeof self=="object"&&self&&self.Object===Object&&self,TW=SW||DW||Function("return this")(),nu=TW,IW=nu,EW=IW.Symbol,Zp=EW,rM=Zp,A9=Object.prototype,CW=A9.hasOwnProperty,xW=A9.toString,Ig=rM?rM.toStringTag:void 0;function MW(e){var t=CW.call(e,Ig),n=e[Ig];try{e[Ig]=void 0;var r=!0}catch{}var a=xW.call(e);return r&&(t?e[Ig]=n:delete e[Ig]),a}var kW=MW,NW=Object.prototype,AW=NW.toString;function FW(e){return AW.call(e)}var OW=FW,aM=Zp,PW=kW,jW=OW,LW="[object Null]",RW="[object Undefined]",oM=aM?aM.toStringTag:void 0;function _W(e){return e==null?e===void 0?RW:LW:oM&&oM in Object(e)?PW(e):jW(e)}var qp=_W;function BW(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Qu=BW,HW=qp,YW=Qu,UW="[object AsyncFunction]",zW="[object Function]",VW="[object GeneratorFunction]",WW="[object Proxy]";function $W(e){if(!YW(e))return!1;var t=HW(e);return t==zW||t==VW||t==UW||t==WW}var cI=$W,ZW=9007199254740991;function qW(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ZW}var dI=qW,GW=cI,JW=dI;function KW(e){return e!=null&&JW(e.length)&&!GW(e)}var Zv=KW,QW=9007199254740991,XW=/^(?:0|[1-9]\d*)$/;function e$(e,t){var n=typeof e;return t=t??QW,!!t&&(n=="number"||n!="symbol"&&XW.test(e))&&e>-1&&e%1==0&&e<t}var fI=e$,t$=$v,n$=Zv,r$=fI,a$=Qu;function o$(e,t,n){if(!a$(n))return!1;var r=typeof t;return(r=="number"?n$(n)&&r$(t,n.length):r=="string"&&t in n)?t$(n[t],e):!1}var Ob=o$,i$=/\s/;function s$(e){for(var t=e.length;t--&&i$.test(e.charAt(t)););return t}var l$=s$,u$=l$,c$=/^\s+/;function d$(e){return e&&e.slice(0,u$(e)+1).replace(c$,"")}var f$=d$;function h$(e){return e!=null&&typeof e=="object"}var sd=h$,p$=qp,m$=sd,g$="[object Symbol]";function v$(e){return typeof e=="symbol"||m$(e)&&p$(e)==g$}var qv=v$,y$=f$,iM=Qu,w$=qv,sM=NaN,b$=/^[-+]0x[0-9a-f]+$/i,S$=/^0b[01]+$/i,D$=/^0o[0-7]+$/i,T$=parseInt;function I$(e){if(typeof e=="number")return e;if(w$(e))return sM;if(iM(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=iM(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=y$(e);var n=S$.test(e);return n||D$.test(e)?T$(e.slice(2),n?2:8):b$.test(e)?sM:+e}var E$=I$,C$=E$,lM=1/0,x$=17976931348623157e292;function M$(e){if(!e)return e===0?e:0;if(e=C$(e),e===lM||e===-lM){var t=e<0?-1:1;return t*x$}return e===e?e:0}var F9=M$,k$=F9;function N$(e){var t=k$(e),n=t%1;return t===t?n?t-n:t:0}var O9=N$,A$=k9,F$=Ob,O$=O9,P$=Math.ceil,j$=Math.max;function L$(e,t,n){(n?F$(e,t,n):t===void 0)?t=1:t=j$(O$(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,i=Array(P$(r/t));a<r;)i[o++]=A$(e,a,a+=t);return i}var R$=L$;const _$=qt(R$);function Gv(e){return e&&e.ownerDocument||document}function B$(e){var t=Gv(e);return t&&t.defaultView||window}function H$(e,t){return B$(e).getComputedStyle(e,t)}var Y$=/([A-Z])/g;function U$(e){return e.replace(Y$,"-$1").toLowerCase()}var z$=/^ms-/;function A0(e){return U$(e).replace(z$,"-ms-")}var V$=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function W$(e){return!!(e&&V$.test(e))}function dp(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(A0(t))||H$(e).getPropertyValue(A0(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(A0(a)):W$(a)?r+=a+"("+o+") ":n+=A0(a)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function pv(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function $$(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function hI(e){return"window"in e&&e.window===e?e:$$(e)&&e.defaultView||!1}function P9(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,a){var o=hI(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 x.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||!x.Keymap.isModifier(c.nativeEvent,"Mod"))return;const f=new x.HoverPopover(ft.getState().view,r.current,100),h=Rle(f,t);i(h)},[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(Ble,{event:e}),v.jsx("span",{children:n})]})}const Ble=({event:e})=>{const t=ne.useRef(null),n=e.resource;P.useEffect(()=>{t.current&&x.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=P.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const i=await we.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");i&&we.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:x.moment(e.start).format("HH:mm")})})]})})};function HF({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))}HF.propTypes={messages:ke.object,onView:ke.func,view:ke.string,views:ke.array};function YF({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&&(x.setIcon(l.previous.current,"chevron-left"),x.setIcon(l.today.current,"dot"),x.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(pp.PREVIOUS),"aria-label":n.previous,children:"<"}),v.jsx("button",{ref:l.today,type:"button",onClick:()=>r(pp.TODAY),"aria-label":n.today,children:"•"}),v.jsx("button",{ref:l.next,type:"button",onClick:()=>r(pp.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(Pw,{type:"text",handleValueChange:f=>{r(pp.DATE,x.moment(f,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(o==="week"?x.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:x.moment(e.valueOf(),"x").valueOf()})}),v.jsx("span",{className:"rbc-btn-group",children:v.jsx(HF,{view:o,views:i,messages:n,onView:a})})]})}YF.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 Hle({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=jle(x.moment),Ule=({event:e})=>{const t=e.resource;return v.jsx(v.Fragment,{children:v.jsx(ai,{memo:t})})},zle=e=>{var G;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),[h,g]=ne.useState(!1),y=P.useRef(null),[w,S]=P.useState(new Date);P.useEffect(()=>()=>{c.current&&(c.
`,Gue="\uFEFF",XF=e=>Object.assign({},Zue,e);let Jue=class extends Error{constructor(t){super(t),this.name="CsvGenerationError"}},Kue=class extends Error{constructor(t){super(t),this.name="EmptyHeadersError"}};var ey=e=>e,Us=e=>e,Jb=ey,Mp=ey,C3=ey,x3=ey,Que=function(e,t){return t=='"'&&e.indexOf('"')>-1?e.replace(/"/g,'""'):e},Xue=e=>C3(typeof e=="object"?e.key:e),ece=e=>x3(typeof e=="object"?e.displayLabel:e),tce=(e,...t)=>t.reduce((n,r)=>r(n),e),nce=e=>t=>e.useBom?Jb(Us(t)+Gue):t,rce=e=>t=>e.showTitle?YI(Jb(Us(t)+e.title))(Mp("")):t,YI=e=>t=>Jb(Us(e)+Us(t)+que),e8=e=>(t,n)=>ace(e)(Mp(t+n)),ace=e=>t=>ey(Us(t)+e.fieldSeparator),oce=(e,t)=>n=>{if(!e.showColumnHeaders)return n;if(t.length<1)throw new Kue("Option to show headers but none supplied. Make sure there are keys in your collection or that you've supplied headers through the config options.");let r=Mp("");for(let a=0;a<t.length;a++){const o=ece(t[a]);r=e8(e)(r,t8(e,o))}return r=Mp(Us(r).slice(0,-1)),YI(n)(r)},ice=(e,t,n)=>r=>{let a=r;for(var o=0;o<n.length;o++){let i=Mp("");for(let l=0;l<t.length;l++){const c=Xue(t[l]),f=typeof n[o][Us(c)]>"u"?e.replaceUndefinedWith:n[o][Us(c)];i=e8(e)(i,t8(e,f))}i=Mp(Us(i).slice(0,-1)),a=YI(a)(i)}return a},sce=Us,M3=e=>+e===e&&(!isFinite(e)||!!(e%1)),t8=(e,t)=>{if(e.decimalSeparator==="locale"&&M3(t))return t.toLocaleString();if(e.decimalSeparator!=="."&&M3(t))return t.toString().replace(".",e.decimalSeparator);if(typeof t=="string"){let n=t;return(e.quoteStrings||e.fieldSeparator&&t.indexOf(e.fieldSeparator)>-1||e.quoteCharacter&&t.indexOf(e.quoteCharacter)>-1||t.indexOf(`
`)>-1||t.indexOf("\r")>-1)&&(n=e.quoteCharacter+Que(t,e.quoteCharacter)+e.quoteCharacter),n}if(typeof t=="boolean"&&e.boolDisplay){const n=t?"true":"false";return e.boolDisplay[n]}return t},lce=e=>t=>{const n=XF(e),r=n.useKeysAsHeaders?Object.keys(t[0]):n.columnHeaders;let a=tce(Jb(""),nce(n),rce(n),oce(n,r),ice(n,r,t));if(Us(a).length<1)throw new Jue("Output is empty. Is your data formatted correctly?");return a};const uce=({thino:e})=>{const t=P.useRef(null);P.useEffect(()=>(t.current&&x.setIcon(t.current,"pin"),()=>{t.current&&(t.current=null)}),[t]);const n=P.useCallback(async()=>{e.pinned?await we.unpinMemoById(e.id):await we.pinMemoById(e.id)},[e]);return v.jsx("span",{ref:t,className:ar("pinned-status",e.pinned?"pinned":"not-pinned"),onClick:n})},cce=({thino:e})=>{var r;const t=P.useRef(null);P.useEffect(()=>(t.current&&x.setIcon(t.current,e.thinoType==="JOURNAL"?"calendar":"check-square"),()=>{t.current&&(t.current=null)}),[t,e==null?void 0:e.thinoType]);const n=P.useCallback(async()=>{if(e.thinoType==="JOURNAL")return;const a=await we.updateMemo(e.id,e.content,e.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");a&&we.editMemo(a)},[e]);return v.jsx(v.Fragment,{children:e.thinoType!=="JOURNAL"?v.jsx("input",{className:ar("thino-type-status","task-list-item-checkbox"),type:"checkbox",checked:e.thinoType!=="TASK-TODO","data-task":e.thinoType==="TASK-TODO"?"":e.thinoType==="TASK-DONE"?"x":(r=e.thinoType)==null?void 0:r.slice(5),onClick:n}):v.jsx("span",{ref:t,className:"thino-type-status"})})},dce=({id:e,path:t})=>{const n=P.useRef(null);P.useEffect(()=>(n.current&&x.setIcon(n.current,"link"),()=>{n.current&&(n.current=null)}),[]);const r=P.useCallback(()=>{!e||!t||we.openThinoByID(e)},[e,t]);return v.jsxs("span",{className:"source-thino",onClick:r,children:[v.jsx("span",{children:t}),v.jsx("span",{ref:n,className:"source-thino-icon"})]})},fce=({id:e,sourceType:t})=>{const n=P.useRef(null);P.useEffect(()=>{var a;return n.current&&x.setIcon(n.current,((a=Qg.find(o=>o.title===t))==null?void 0:a.icon)||"list"),()=>{n.current&&(n.current=null)}},[]);const r=P.useCallback(async()=>{e&&await we.openThinoByID(e)},[e]);return v.jsx("span",{ref:n,className:"source-type-icon",onClick:r})},k3=(e,t,n,r)=>{const a=Hue(e.getValue(t),n);return r({itemRank:a}),a.passed},N3=(e,t,n)=>{var a,o;let r=0;return e.columnFiltersMeta[n]&&(r=zue((a=e.columnFiltersMeta[n])==null?void 0:a.itemRank,(o=t.columnFiltersMeta[n])==null?void 0:o.itemRank)),r===0?fp.alphanumeric(e,t,n):r},hce=XF({fieldSeparator:",",decimalSeparator:".",useKeysAsHeaders:!0}),pce=e=>e+`
`;function mce({thinos:e,isFiltering:t}){var w;ne.useReducer(()=>({}),{})[1];const[n,r]=ne.useState([]),[a,o]=ne.useState(""),i=ne.useMemo(()=>[{header:E("Basic Info"),footer:S=>S.column.id,columns:[{accessorKey:"createdAt",header:()=>v.jsx("span",{className:"create-at-header-cell",children:E("Created At")}),cell:S=>S.getValue(),footer:S=>S.column.id,enableColumnFilter:!1},{accessorFn:S=>S.content,id:"content",header:()=>v.jsx("span",{className:"thino-header-cell",children:E("Thino")}),cell:S=>v.jsx(ai,{memo:S.row.original,type:"table"}),footer:S=>S.column.id,filterFn:"fuzzy",sortingFn:N3},{accessorFn:S=>S.thinoType,id:"thinoType",cell:S=>v.jsx(cce,{thino:S.row.original}),header:()=>v.jsx("span",{children:E("Thino Type")}),footer:S=>S.column.id},{accessorFn:S=>S.sourceType,id:"sourceType",cell:S=>v.jsx(fce,{id:S.row.original.id,sourceType:S.getValue()}),header:()=>v.jsx("span",{children:E("Source Type")}),footer:S=>S.column.id}]},{header:E("Additional Info"),footer:S=>S.column.id,columns:[{accessorKey:"pinned",header:()=>v.jsx("span",{children:E("Pinned Status")}),cell:S=>v.jsx(uce,{thino:S.row.original}),footer:S=>S.column.id,filterFn:"fuzzy",sortingFn:N3},{accessorKey:"rowStatus",header:()=>v.jsx("span",{children:E("Row status")}),cell:S=>v.jsx("span",{children:S.getValue()==="NORMAL"?"":S.getValue()}),footer:S=>S.column.id},{accessorKey:"path",header:()=>E("Path"),cell:S=>v.jsx(dce,{id:S.row.original.id,path:S.getValue()}),footer:S=>S.column.id}]}],[]),[l,c]=ne.useState(()=>e),f=()=>c(S=>e);P.useEffect(()=>{f()},[e]);const h=Lue({data:l,columns:i,filterFns:{fuzzy:k3},initialState:{pagination:{pageSize:20}},state:{columnFilters:n,globalFilter:a},onColumnFiltersChange:r,onGlobalFilterChange:o,globalFilterFn:k3,getCoreRowModel:Tue(),getFilteredRowModel:Cue(),getSortedRowModel:Nue(),getPaginationRowModel:Fue(),getFacetedRowModel:xue(),getFacetedUniqueValues:Mue(),getFacetedMinMaxValues:kue(),debugTable:!1,debugHeaders:!1,debugColumns:!1});ne.useEffect(()=>{var S,D;((S=h.getState().columnFilters[0])==null?void 0:S.id)==="createdAt"&&((D=h.getState().sorting[0])==null?void 0:D.id)!=="createdAt"&&h.setSorting([{id:"createdAt",desc:!1}])},[(w=h.getState().columnFilters[0])==null?void 0:w.id]);async function g(S,D){const I=E("Created At"),M=E("Updated At"),N=E("Content"),_=E("Path"),k=S.map(Y=>({[I]:Y.createdAt,[M]:Y.updatedAt,[N]:Y.content,Thino:`=hyperlink("obsidian://thino?openId=${Y.id}","${Y.id}")`,[_]:`=hyperlink("obsidian://open?path=${x.normalizePath(Y.path)},"${Y.path}")`})),B=lce(hce)(k),L=ft.getState().app||window.app,R=pce(sce(B));return{file:await L.vault.create(`${D}-${ut.randomId(6)}.csv`,R),app:L}}async function y(S){const{file:D,app:I}=await g(S.map(_=>_.original),"thino-export"),M=document.createDocumentFragment(),N=M.createEl("div",{cls:"export-file-btn-group"});M.createEl("div",{cls:"open-file-button"}),new x.Setting(N).setName(E("Exported CSV file")).addButton(_=>{_.setButtonText(E("Open File")).onClick(()=>{const k=x.normalizePath(D.path);I.openWithDefaultApp(k)})}),new x.Notice(M)}return v.jsxs("div",{className:"table-view",children:[v.jsxs("div",{children:[v.jsx(mw,{value:a||"",onChange:S=>o(String(S)),className:"table-search-bar",placeholder:E("Search all columns...")}),x.Platform.isDesktop&&(a||n.length>0||t)&&v.jsx("button",{className:"mod-cta",disabled:h.getPrePaginationRowModel().rows.length===0,onClick:()=>y(h.getPrePaginationRowModel().rows),children:E("Export to CSV")})]}),v.jsxs("table",{className:"thino-table",children:[v.jsx("thead",{children:h.getHeaderGroups().map(S=>v.jsx("tr",{children:S.headers.map(D=>v.jsx("th",{colSpan:D.colSpan,children:D.isPlaceholder?null:v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:ar(D.column.getCanSort()?"filter-header":"","table-header",D.column.id==="content"?"content-header":""),onClick:D.column.getToggleSortingHandler(),children:[D3(D.column.columnDef.header,D.getContext()),{asc:" 🔼",desc:" 🔽"}[D.column.getIsSorted()]??null]}),D.column.getCanFilter()?v.jsx(vce,{column:D.column,table:h}):null]})},D.id))},S.id))}),v.jsx("tbody",{children:h.getRow
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yl(e,t){return Ofe(e)||qye(e,t)||D5(e,t)||cwe()}var T5={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})()})(T5);var dwe=T5.exports;const wE=qt(dwe);var I5={exports:{}},OD,Kk;function fwe(){if(Kk)return OD;Kk=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return OD=e,OD}var PD,Qk;function hwe(){if(Qk)return PD;Qk=1;var e=fwe();function t(){}function n(){}return n.resetWarningCache=t,PD=function(){function r(i,l,c,f,h,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},PD}I5.exports=hwe()();var pwe=I5.exports;const Mn=qt(pwe);var bE=ne.createContext({scrollTo:function(){return 0},scrollToBottom:function(){return 0},scrollToEnd:function(){return 0},scrollToStart:function(){return 0},scrollToTop:function(){return 0}});bE.displayName="ScrollToBottomFunctionContext";function p1(){return P.useContext(bE)}function mwe(){var e=p1(),t=e.scrollToEnd;return t}var SE=ne.createContext({atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom"});SE.displayName="ScrollToBottomState1Context";var DE=ne.createContext({animating:!1,animatingToEnd:!1,sticky:!0});DE.displayName="ScrollToBottomState2Context";var TE=ne.createContext({animating:!1,animatingToEnd:!1,atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom",sticky:!0});TE.displayName="ScrollToBottomStateContext";var Xk=[TE,SE,DE];function gwe(e){return P.useContext(Xk[e]||Xk[0])}function vwe(){var e=gwe(2),t=e.sticky;return[t]}var m1=ne.createContext({offsetHeight:0,scrollHeight:0,setTarget:function(){return 0},styleToClassName:function(){return""}});m1.displayName="ScrollToBottomInternalContext";function ywe(){return P.useContext(m1)}function IE(){var e=ywe(),t=e.styleToClassName;return t}var wwe={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)"}},EE=function(t){var n=t.children,r=t.className,a=vwe(),o=Yl(a,1),i=o[0],l=IE()(wwe),c=mwe();return!i&&ne.createElement("button",{className:wE(l,(r||"")+""),onClick:c,type:"button"},n)};EE.defaultProps={children:void 0,className:""};EE.propTypes={children:Mn.any,className:Mn.string};var E5={exports:{}},bwe=Gn,Swe=ii,e4=$s.f;bwe({target:"Object",stat:!0,forced:Object.defineProperty!==e4,sham:!Swe},{defineProperty:e4});var Dwe=qa,C5=Dwe.Object,Twe=E5.exports=function(t,n,r){return C5.defineProperty(t,n,r)};C5.defineProperty.sham&&(Twe.sham=!0);var Iwe=E5.exports,Ewe=Iwe,x5=Ewe,Cwe=x5,xwe=Cwe,Mwe=xwe,kwe=Mwe,Nwe=kwe;const Awe=qt(Nwe);var Fwe=ly,Owe=Fwe.f("iterator"),Pwe=Owe,jwe=Pwe,Lwe=jwe,Rwe=Lwe,_we=Rwe,Bwe=_we,Hwe=Bwe;const Ywe=qt(Hwe);function yv(e){"@babel/helpers - typeof";return yv=typeof gp=="function"&&typeof Ywe=="symbol"?function(t){return typeof t}:function(t){return t&&typeof gp=="function"&&t.constructor===gp&&t!==gp.prototype?"symbol":typeof t},yv(e)}var Uwe=ly,zwe=Uwe.f("toPrimitive"),Vwe=zwe,Wwe=Vwe,$we=Wwe,Zwe=$we,qwe=Zwe,Gwe=qwe,Jwe=Gwe;const Kwe=qt(Jwe);function Qwe(e,t){if(yv(e)!="object"||!e)return e;var n=e[Kwe];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 tbe(e)||nbe(e)||D5(e)||rbe()}var W0=function(e){return e&&e.Math==Math&&e},Oi=W0(typeof globalThis=="object"&&globalThis)||W0(typeof window=="object"&&window)||W0(typeof self=="object"&&self)||W0(typeof dr=="object"&&dr)||function(){return this}()||Function("return this")(),CE={},Zs=function(e){try{return!!e()}catch{return!0}},abe=Zs,Rf=!abe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),M5={},k5={}.propertyIsEnumerable,N5=Object.getOwnPropertyDescriptor,obe=N5&&!k5.call({1:2},1);M5.f=obe?function(t){var n=N5(this,t);return!!n&&n.enumerable}:k5;var A5=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},ibe={}.toString,xE=function(e){return ibe.call(e).slice(8,-1)},sbe=Zs,lbe=xE,ube="".split,cbe=sbe(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return lbe(e)=="String"?ube.call(e,""):Object(e)}:Object,g1=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},dbe=cbe,fbe=g1,ME=function(e){return dbe(fbe(e))},ls=function(e){return typeof e=="function"},hbe=ls,fy=function(e){return typeof e=="object"?e!==null:hbe(e)},jD=Oi,pbe=ls,mbe=function(e){return pbe(e)?e:void 0},v1=function(e,t){return arguments.length<2?mbe(jD[e]):jD[e]&&jD[e][t]},gbe=v1,vbe=gbe("navigator","userAgent")||"",F5=Oi,LD=vbe,t4=F5.process,n4=F5.Deno,r4=t4&&t4.versions||n4&&n4.version,a4=r4&&r4.v8,Ol,tb;a4?(Ol=a4.split("."),tb=Ol[0]<4?1:Ol[0]+Ol[1]):LD&&(Ol=LD.match(/Edge\/(\d+)/),(!Ol||Ol[1]>=74)&&(Ol=LD.match(/Chrome\/(\d+)/),Ol&&(tb=Ol[1])));var ybe=tb&&+tb,o4=ybe,wbe=Zs,O5=!!Object.getOwnPropertySymbols&&!wbe(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&o4&&o4<41}),bbe=O5,P5=bbe&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Sbe=ls,Dbe=v1,Tbe=P5,j5=Tbe?function(e){return typeof e=="symbol"}:function(e){var t=Dbe("Symbol");return Sbe(t)&&Object(e)instanceof t},Ibe=function(e){try{return String(e)}catch{return"Object"}},Ebe=ls,Cbe=Ibe,xbe=function(e){if(Ebe(e))return e;throw TypeError(Cbe(e)+" is not a function")},Mbe=xbe,L5=function(e,t){var n=e[t];return n==null?void 0:Mbe(n)},RD=ls,_D=fy,kbe=function(e,t){var n,r;if(t==="string"&&RD(n=e.toString)&&!_D(r=n.call(e))||RD(n=e.valueOf)&&!_D(r=n.call(e))||t!=="string"&&RD(n=e.toString)&&!_D(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},R5={exports:{}},i4=Oi,kE=function(e,t){try{Object.defineProperty(i4,e,{value:t,configurable:!0,writable:!0})}catch{i4[e]=t}return t},Nbe=Oi,Abe=kE,s4="__core-js_shared__",Fbe=Nbe[s4]||Abe(s4,{}),NE=Fbe,l4=NE;(R5.exports=function(e,t){return l4[e]||(l4[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.18.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});var AE=R5.exports,Obe=g1,_5=function(e){return Object(Obe(e))},Pbe=_5,jbe={}.hasOwnProperty,_f=Object.hasOwn||function(t,n){return jbe.call(Pbe(t),n)},Lbe=0,Rbe=Math.random(),B5=function(e){return"Symbol("+String(e===void 0?"":e)+")_"+(++Lbe+Rbe).toString(36)},_be=Oi,Bbe=AE,u4=_f,Hbe=B5,c4=O5,Ybe=P5,Mg=Bbe("wks"),Zg=_be.Symbol,Ube=Ybe?Zg:Zg&&Zg.withoutSetter||Hbe,hy=function(e){return(!u4(Mg,e)||!(c4||typeof Mg[e]=="string"))&&(c4&&u4(Zg,e)?Mg[e]=Zg[e]:Mg[e]=Ube("Symbol."+e)),Mg[e]},d4=fy,f4=j5,zbe=L5,Vbe=kbe,Wbe=hy,$be=Wbe("toPrimitive"),Zbe=function(e,t){if(!d4(e)||f4(e))return e;var n=zbe(e,$be),r;if(n){if(t===void 0&&(t="default"),r=n.call(e,t),!d4(r)||f4(r))return r;throw TypeError("Can't convert object to primitive value")}return t===void 0&&(t="number"),Vbe(e,t)},qbe=Zbe,Gbe=j5,H5=function(e){var t=qbe(e,"string");return Gbe(t)?t:String(t)},Jbe=Oi,h4=fy,l2=Jbe.document,Kbe=h4(l2)&&h4(l2.createElement),Y5=function(e){return Kbe?l2.createElement(e):{}},Qbe=Rf,Xbe=Zs,e1e=Y5,U5=!Qbe&&!Xbe(function(){return Object.defineProperty(e1e("div"),"a",{get:function(){return 7}}).a!=7}),t1e=Rf,n1e=M5,r1e=A5,a1e=ME,o1e=H5,i1e=_f,s1e=U5,p4=Object.getOwnPropertyDescriptor;CE.f=t1e?p4:function(t,n){if(t=a1e(t),n=o1e(n),s1e)
`)&&e.flags==="s")}),gDe=Zs,vDe=Oi,yDe=vDe.RegExp,wDe=gDe(function(){var e=yDe("(?<a>b)","g");return e.exec("b").groups.a!=="b"||"b".replace(e,"$<a>c")!=="bc"}),bDe=b1,SDe=tO,M4=RE,DDe=AE,TDe=dDe,IDe=$5.get,EDe=mDe,CDe=wDe,ab=RegExp.prototype.exec,xDe=DDe("native-string-replace",String.prototype.replace),h2=ab,p2=function(){var e=/a/,t=/b*/g;return ab.call(e,"a"),ab.call(t,"a"),e.lastIndex!==0||t.lastIndex!==0}(),iO=M4.UNSUPPORTED_Y||M4.BROKEN_CARET,m2=/()??/.exec("")[1]!==void 0,MDe=p2||m2||iO||EDe||CDe;MDe&&(h2=function(t){var n=this,r=IDe(n),a=bDe(t),o=r.raw,i,l,c,f,h,g,y;if(o)return o.lastIndex=n.lastIndex,i=h2.call(o,a),n.lastIndex=o.lastIndex,i;var w=r.groups,S=iO&&n.sticky,D=SDe.call(n),I=n.source,M=0,N=a;if(S&&(D=D.replace("y",""),D.indexOf("g")===-1&&(D+="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+")",D)),m2&&(l=new RegExp("^"+I+"$(?!\\s)",D)),p2&&(c=n.lastIndex),f=ab.call(S?l:n,N),S?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:p2&&f&&(n.lastIndex=n.global?f.index+f[0].length:c),m2&&f&&f.length>1&&xDe.call(f[0],l,function(){for(h=1;h<arguments.length-2;h++)arguments[h]===void 0&&(f[h]=void 0)}),f&&w)for(f.groups=g=TDe(null),h=0;h<w.length;h++)y=w[h],g[y[0]]=f[y[1]];return f});var _E=h2,kDe=LSe,k4=_E;kDe({target:"RegExp",proto:!0,forced:/./.exec!==k4},{exec:k4});var N4=my,NDe=_E,A4=Zs,sO=hy,ADe=y1,FDe=sO("species"),VD=RegExp.prototype,ODe=function(e,t,n,r){var a=sO(e),o=!A4(function(){var f={};return f[a]=function(){return 7},""[e](f)!=7}),i=o&&!A4(function(){var f=!1,h=/a/;return e==="split"&&(h={},h.constructor={},h.constructor[FDe]=function(){return h},h.flags="",h[a]=/./[a]),h.exec=function(){return f=!0,null},h[a](""),!f});if(!o||!i||n){var l=/./[a],c=t(a,""[e],function(f,h,g,y,w){var S=h.exec;return S===NDe||S===VD.exec?o&&!w?{done:!0,value:l.call(h,g,y)}:{done:!0,value:f.call(g,h,y)}:{done:!1}});N4(String.prototype,e,c[0]),N4(VD,a,c[1])}r&&ADe(VD[a],"sham",!0)},PDe=w1,jDe=b1,LDe=g1,F4=function(e){return function(t,n){var r=jDe(LDe(t)),a=PDe(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)}},RDe={codeAt:F4(!1),charAt:F4(!0)},_De=RDe.charAt,BDe=function(e,t,n){return t+(n?_De(e,t).length:1)},HDe=_5,YDe=Math.floor,UDe="".replace,zDe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,VDe=/\$([$&'`]|\d{1,2})/g,WDe=function(e,t,n,r,a,o){var i=n+e.length,l=r.length,c=VDe;return a!==void 0&&(a=HDe(a),c=zDe),UDe.call(o,c,function(f,h){var g;switch(h.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(i);case"<":g=a[h.slice(1,-1)];break;default:var y=+h;if(y===0)return f;if(y>l){var w=YDe(y/10);return w===0?f:w<=l?r[w-1]===void 0?h.charAt(1):r[w-1]+h.charAt(1):f}g=r[y-1]}return g===void 0?"":g})},$De=ud,ZDe=ls,qDe=xE,GDe=_E,JDe=function(e,t){var n=e.exec;if(ZDe(n)){var r=n.call(e,t);return r!==null&&$De(r),r}if(qDe(e)==="RegExp")return GDe.call(e,t);throw TypeError("RegExp#exec called on incompatible receiver")},KDe=ODe,QDe=Zs,XDe=ud,eTe=ls,tTe=w1,nTe=J5,up=b1,rTe=g1,aTe=BDe,oTe=L5,iTe=WDe,sTe=JDe,lTe=hy,g2=lTe("replace"),uTe=Math.max,cTe=Math.min,dTe=function(e){return e===void 0?e:String(e)},fTe=function(){return"a".replace(/./,"$0")==="$0"}(),O4=function(){return/./[g2]?/./[g2]("a","$0")==="":!1}(),hTe=!QDe(function(){var e=/./;return e.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(e,"$<a>")!=="7"});KDe("replace",function(e,t,n){var r=O4?"$":"$0";return[function(o,i){var l=rTe(this),c=o==null?void 0:oTe(o,g2);return c?c.call(o,l,i):t.call(up(l),o,i)},function(a,o){var i=XDe(this),l=up(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=eTe(o);f||(o=up(o));var h=i.global;if(h){var g=i.unicode;i.lastIndex=0}for(var y=[];;){var w=sTe(i,l);if(w===null||(y.push(w),!h))break;var S=up(w[0]);S===""&&(i.lastIndex=aTe(l,nTe(i.lastIndex),g))}for(var D="",I=0,M=0;M<y.length;M++){w=y[M];for(var N=up(w[0]),_=uTe(cTe(tTe(w.index),l.length),0),k=[],B=1;B<w.length;B++)k.push(dTe(w[B]));var L=w.groups;if(f){var R=[N].concat(k,_,l);L!==void 0&&R.push(L);var V=up(o.apply(void 0,R))}else V=iTe(N,l,_,k,L,o);_>=I&&(D+=l.slice(I,_)+V,I=_+N.length)}return D+l.slice(I)}]},!hTe||!fTe||O4);var pTe=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",mTe=TypeError,gTe=function(e,t){if(e<t)throw new mTe("Not enough arguments");return e},lO=Za,vTe=UI,yTe=co,wTe=pTe,bTe=u8,STe=i1,DTe=gTe,TTe=lO.Function,ITe=/MSIE .\./.test(bTe)||wTe&&function(){var e=lO.Bun.version.split(".");return e.length<3||e[0]==="0"&&(e[1]<3||e[1]==="3"&&e[2]==="0")}(),uO=function(e,t){var n=t?2:1;return ITe?function(r,a){var o=DTe(arguments.length,1)>n,i=yTe(r)?r:TTe(r),l=o?STe(arguments,n):[],c=o?function()
`,L.current,t.path,a||e.view)}he(),setTimeout(async()=>{await G()},cA)},[B,L,l,M]);const G=async()=>{B.current&&(await hxe(B.current),await qE(B.current),pxe(M).then(he=>{he&&setTimeout(()=>{kb(B.current,{pixelRatio:window.devicePixelRatio*2}).then(ie=>{k(ie),f(!0)}).catch(()=>{})},600)}))},le=()=>{n()},se=P.useCallback(he=>{w(he)},[y]),fe=async()=>{const{vault:he}=Le.getState().dailyNotesState.app,ie=B.current.querySelector(".memo-shortcut-img");if(!ie)return;const ce=ie==null?void 0:ie.getAttribute("src").split("base64,")[1],X=sN(ce,"image/png");let ae;X.arrayBuffer().then(async De=>{const je="png",Re=Ju();for(const Fe in Re)if(Re[Fe]instanceof x.TFile){ae=Re[Fe];break}if(ae!==void 0){const Fe=await he.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,je,ae);await he.createBinary(Fe,De),new x.Notice(E("Save image successfully"))}})},$=async()=>{se(!0);const he=B.current.querySelector(".memo-shortcut-img");if(!he)return;const ie=he==null?void 0:he.getAttribute("src").split("base64,")[1],ce=sN(ie,"image/png");if(!ce){new x.Notice(E("Copy to clipboard failed"));return}const X=new ClipboardItem({"image/png":ce});window.navigator.clipboard.write([X]).then(()=>{setTimeout(()=>{se(!1)},500)}),new x.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:[x.Platform.isMobile&&v.jsx("button",{ref:I,className:"btn download-btn",onClick:fe}),v.jsx("button",{ref:S,className:"btn copy-btn",onClick:$}),v.jsx("button",{ref:D,className:"btn close-btn",onClick:le})]})]}),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 he=>{he.currentTarget.value!==M&&(f(!1),k(""),N(he.currentTarget.value),(o||window.app).saveLocalStorage("memoShareDialogStyle",he.currentTarget.value),await G())},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:B,children:[v.jsx(ts,{when:_!=="",children:v.jsx("img",{className:"memo-shortcut-img",onClick:$,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:he=>{if(i!=null&&i.MomentsIcon){he==null||he.empty();return}i!=null&&i.MomentsIcon||he&&x.setIcon(he,"Memos")},style:{backgroundImage:`url("${R}")`}}),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 _=(B=i.current)==null?void 0:B.querySelectorAll(".internal-link");_==null||_.forEach(L=>{const R=L,V=R.getAttribute("data-href");if(!V)return;t.metadataCache.getFirstLinkpathDest(V,a.path)||L.classList.add("is-unresolved"),R.addEventListener("mouseover",Z=>{Z.stopPropagation(),t.workspace.trigger("hover-link",{event:Z,source:"thino",hoverParent:r.containerEl,targetEl:R,linktext:V,sourcePath:R.href})})})}N()},[a.content,l]);const S=async()=>{switch(h.sourceType){case"DAILY":await W2(h.id,h.path);break;case"CANVAS":await Z2(h.id,h.path);break;case"MULTI":await V2(h.path);break;case"FILE":await $2(h.id,h.path);break}},D=async()=>{if(g)try{if(n.DeleteThinoDirectly)await we.deleteMemoById(h.id);else{const N=await we.hideMemoById(h.id);N&&we.editMemo(N)}}catch(N){new x.Notice(N.message)}else y()},I=async()=>{try{const N=await we.unarchiveMemo(h);N&&we.editMemo(N),o(h.id),new x.Notice(E("RESTORE SUCCEED"))}catch(N){new x.Notice(N.message)}},M=()=>{g&&y(!1)};return v.jsxs("div",{ref:l,className:`memo-wrapper ${"memos-"+h.id}`,onMouseLeave:M,children:[v.jsxs("div",{className:"memo-top-wrapper",children:[v.jsxs("span",{className:"time-text",children:[E("ARCHIVED AT")," ",h.updatedAt]}),v.jsxs("div",{className:"btns-container",children:[v.jsx("span",{ref:N=>{N&&x.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:S,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:D,children:E(g?"CONFIRM":"DELETE")})]})]})})]})]}),v.jsx("div",{ref:i,className:"memo-content-text"})]})},Bu=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}))},vxe=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:i,filter:l}=t,c=on.getQueryById(l);return!!(r||a&&a.from<a.to||o||i||c)||c||n?e.filter(h=>{let g=!0;if(h.thinoType!==void 0&&n&&h.thinoType==="TASK-DONE"&&(g=!1),h.content.contains("comment:")&&(g=!1),c){const y=JSON.parse(c.querystring);Array.isArray(y)&&(g=Vp(h,y))}if(r){const y=new Set;for(const w of Array.from(h.content.match($r)||[])){const D=w.replace($r,"$1").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}for(const w of Array.from(h.content.match(ua)||[])){const D=w.replace(ua,"$1").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}for(const w of Array.from(h.content.match(Wa)||[])){const D=w.replace(Wa,"$2").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}y.has(r)||(g=!1)}return a&&a.from<a.to&&(ut.getTimeStampByDate(h.createdAt)<a.from||ut.getTimeStampByDate(h.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(h.content.match($r)!==null||h.content.match(Wa)!==null||h.content.match(ua)!==null)||o==="LINKED"&&h.content.match(Af)===null||o==="IMAGED"&&h.content.match(Ff)===null||o==="CONNECTED"&&h.content.match(ad)===null)&&(g=!1),i&&!h.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(h=>!h.content.contains("comment:"))},yxe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=lm(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&x.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const S=vxe({memos:n.filter(D=>D.rowStatus==="ARCHIVED"&&D.deletedAt===""),query:e,HideDoneTasks:!1});o(S),r.setFinish()},[n,i.current,e]);const c=P.useCallback(S=>{o(D=>D.filter(I=
6 months ago
${se.content.split(`
6 months ago
`).map($=>$.trim()?`> ${$}
7 months ago
`:`>
`)}
6 months ago
`+(fe===t.length-1?`
7 months ago
`:`
7 months ago
------
3 months ago
`)});const le={createdAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),updatedAt:x.moment().format("YYYY/MM/DD HH:mm:ss"),content:G.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:[]};uf(le,"clean")})}),Z.addSeparator(),a){case"/":Z.addItem(Q=>{Q.setTitle(E("Bulk tag operation")).setIcon("hash").onClick(async()=>{await L()})}).addItem(Q=>{Q.setTitle(E("Bulk archive")).setIcon("archive").onClick(async()=>{new _s(i,E("ARCHIVE"),async G=>{G==="confirm"&&await B()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await M()}).open()})});break;case"/archive":Z.addItem(Q=>{Q.setTitle(E("Bulk restore")).setIcon("archive").onClick(async()=>{new _s(i,E("RESTORE"),async G=>{G==="confirm"&&await _()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await M()}).open()})});break;case"/recycle":Z.addItem(Q=>{Q.setTitle(E("Bulk restore")).setIcon("archive-restore").onClick(async()=>{new _s(i,E("RESTORE"),async G=>{G==="confirm"&&await k()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await N()}).open()})});break}Z.showAtMouseEvent(Y.nativeEvent)};return v.jsxs("div",{className:`filter-query-container ${S?"":"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 "+(w?"":"hidden"),onClick:()=>{at.setMemoFilter("")},children:[v.jsx("span",{className:"icon-text",children:"🔖"})," ",w==null?void 0:w.title]}),v.jsxs("div",{"data-filter-type":"tag",className:"filter-item-container "+(l?"":"hidden"),onClick:()=>{at.setTagQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🏷️"})," ",l]}),v.jsxs("div",{"data-filter-type":"type",className:"filter-item-container "+(f?"":"hidden"),onClick:()=>{at.setMemoTypeQuery("")},children:[v.jsx("span",{className:"icon-text",children:"📦"})," ",cY(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(Pw,{type:"text",startOrEnd:"start",defaultValue:x.moment(c.from,"x").valueOf(),handleValueChange:Y=>{const Z=x.moment(c.to,"x"),Q=x.moment(Y,"x"),G=Q.isAfter(Z)||Q.isSame(Z);at.setFromAndToQuery(G?Z.startOf("day").valueOf():x.moment(Y,"x").startOf("day").valueOf(),c.to)}}),v.jsx("span",{children:E("to")}),v.jsx(Pw,{type:"text",startOrEnd:"end",defaultValue:x.moment(c.to,"x").add(1,"days").valueOf(),handleValueChange:Y=>{const Z=x.moment(c.from,"x"),Q=x.moment(Y,"x"),G=Q.isBefore(Z)||Q.isSame(Z),le=x.moment(Y,"x").endOf("day").valueOf();at.setFromAndToQuery(c.from,G?Z.endOf("day").valueOf():le)}})]}),v.jsx("div",{ref:Y=>Y&&x.setIcon(Y,"x"),className:"btn close-btn",onClick:()=>{at.setFromAndToQuery(0,0)}})]}),v.jsxs("div",{className:"filter-item-container "+(h?"":"hidden"),onClick:()=>{at.setTextQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🔍"})," ",h]}),v.jsxs("div",{className:"filter-item-container "+(y?"":"hidden"),onClick:()=>{at.setPathQuery("")},children:[v.jsx("span",{className:"icon-text"})," ",h]})]}),v.jsxs("div",{className:"thino-filter-items",children:[e&&v.jsx("div",{className:"thinos-count",children:`${e?`${e} Thinos `:""}`}),v.jsx("div",{ref:D,className:"btn memo-action-menu",onClick:V})]})]})},cf=async e=>{const{app:t,settings:n}=ft.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await t_(e);if(!r||r.length===0)return;r.sort((i,l)=>x.moment(i.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(x.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 we.createOrPatchThinoFromWeb(l);c&&we.pushMemo(c)}for(let i=0;i<o.length;i++){cons
7 months ago
`&&A.push(`
6 months ago
`),Ie!==null&&A.push(S(""+Ie)),null;case"input":A.push(G("input")),ct=$t=it=Ie=null;for(Ue in K)if(n.call(K,Ue)&&(Ft=K[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(G("menuitem"));for(var Ga in K)if(n.call(K,Ga)&&(Ie=K[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(G("title")),Ie=null;for(Pn in K)if(n.call(K,Pn)&&(Ue=K[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(G(U)),Ue=Ie=null;for(ct in K)if(n.call(K,ct)&&(it=K[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));K=Ue.__html,K!=null&&(typeof K=="string"&&0<K.length&&K[0]===`
7 months ago
`?A.push(`
6 months ago
`,K):A.push(""+K))}return typeof Ie=="string"&&Ie[0]===`
7 months ago
`&&A.push(`
3 months ago
`),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(G(U));for(var ja in K)if(n.call(K,ja)&&(Ie=K[ja],Ie!=null))switch(ja){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,U));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 Y(A,K,U,oe);case"html":return Ne.insertionMode===0&&A.push("<!DOCTYPE html>"),Y(A,K,U,oe);default:if(U.indexOf("-")===-1&&typeof K.is!="string")return Y(A,K,U,oe);A.push(G(U)),Ue=Ie=null;for(Ft in K)if(n.call(K,Ft)&&(it=K[Ft],it!=null))switch(Ft){case"children":Ie=it;break;case"dangerouslySetInnerHTML":Ue=it;break;case"style":B(A,oe,it);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:i(Ft)&&typeof it!="function"&&typeof it!="symbol"&&A.push(" ",Ft,'="',S(it),'"')}return A.push(">"),R(A,Ue,Ie),Ie}}function se(A,U,K){if(A.push('<!--$?--><template id="'),K===null)throw Error(t(395));return A.push(K),A.push('"></template>')}function fe(A,U,K,oe){switch(K.insertionMode){case 0:case 1:return A.push('<div hidden id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 2:return A.push('<svg aria-hidden="true" style="display:none" id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 3:return A.push('<math aria-hidden="true" style="display:none" id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 4:return A.push('<table hidden id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 5:return A.push('<table hidden><tbody id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 6:return A.push('<table hidden><tr id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 7:return A.push('<table hidden><colgroup id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');default:throw Error(t(397))}}function $(A,U){switch(U.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 he=/[<\u2028\u2029]/g;function ie(A){return JSON.stringify(A).replace(he,function(U){switch(U){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 ce(A,U){return U=U===void 0?"":U,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:U+"P:",segmentPrefix:U+"S:",boundaryPrefix:U+"B:",idPrefix:U,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:A}}function X(A,U,K,oe){return K.generateStaticMarkup?(A.push(S(U)),!1):(U===""?A=oe:(oe&&A.push("<!-- -->"),A.push(S(U)),A=!0),A)}var ae=Object.assign,De=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"),Xe=Symbol.for("react.provider"),Ze=Symbol.for("react.context"),st=Symbol.for("react.forward_ref"),Ct=Symbol.for("react.suspense"),tn=Symbol.for("react.suspense_list"),_e=Symbol.for("react.memo"),et=Symbol.for("react.lazy"),nt=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 Ct:return"Suspense";ca
6 months ago
`),Xt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,dn=new Map;function en(F){var H=dn.get(F);if(H===void 0){if(!Xt.test(F))throw Error(t(65,F));H=f("<"+F),dn.set(F,H)}return H}var Zn=f("<!DOCTYPE html>");function kn(F,H,q,re,Ae){switch(H){case"select":F.push(en("select"));var Ee=null,Ve=null;for(Rt in q)if(g.call(q,Rt)){var ot=q[Rt];if(ot!=null)switch(Rt){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;case"defaultValue":case"value":break;default:et(F,re,Rt,ot)}}return F.push(nt),St(F,Ve,Ee),Ee;case"option":Ve=Ae.selectedValue,F.push(en("option"));var It=ot=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":ot=Hn;break;case"selected":Kt=Hn;break;case"dangerouslySetInnerHTML":Rt=Hn;break;case"value":It=Hn;default:et(F,re,Ee,Hn)}}if(Ve!=null)if(q=It!==null?""+It:Tt(ot),Z(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(nt),St(F,Rt,ot),ot;case"textarea":F.push(en("textarea")),Rt=Ve=Ee=null;for(ot in q)if(g.call(q,ot)&&(It=q[ot],It!=null))switch(ot){case"children":Rt=It;break;case"value":Ee=It;break;case"defaultValue":Ve=It;break;case"dangerouslySetInnerHTML":throw Error(t(91));default:et(F,re,ot,It)}if(Ee===null&&Ve!==null&&(Ee=Ve),F.push(nt),Rt!=null){if(Ee!=null)throw Error(t(92));if(Z(Rt)&&1<Rt.length)throw Error(t(93));Ee=""+Rt}return typeof Ee=="string"&&Ee[0]===`
6 months ago
`&&F.push(Vt),Ee!==null&&F.push(c(R(""+Ee))),null;case"input":F.push(en("input")),It=Rt=ot=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":ot=Kt;break;case"checked":Rt=Kt;break;case"value":Ee=Kt;break;default:et(F,re,Ve,Kt)}return Rt!==null?et(F,re,"checked",Rt):It!==null&&et(F,re,"checked",It),Ee!==null?et(F,re,"value",Ee):ot!==null&&et(F,re,"value",ot),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:et(F,re,oa,Ee)}return F.push(nt),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:et(F,re,Hn,Ve)}return F.push(nt),Ee;case"listing":case"pre":F.push(en(H)),Ve=Ee=null;for(It in q)if(g.call(q,It)&&(ot=q[It],ot!=null))switch(It){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;default:et(F,re,It,ot)}if(F.push(nt),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]===`
7 months ago
`?F.push(Vt,c(q)):F.push(c(""+q)))}return typeof Ee=="string"&&Ee[0]===`
3 months ago
`&&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(H));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,H));default:et(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,H,re);case"html":return Ae.insertionMode===0&&F.push(Zn),_t(F,q,H,re);default:if(H.indexOf("-")===-1&&typeof q.is!="string")return _t(F,q,H,re);F.push(en(H)),Ve=Ee=null;for(Kt in q)if(g.call(q,Kt)&&(ot=q[Kt],ot!=null))switch(Kt){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;case"style":Ze(F,re,ot);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:D(Kt)&&typeof ot!="function"&&typeof ot!="symbol"&&F.push(st,c(Kt),Ct,c(R(ot)),tn)}return F.push(nt),St(F,Ve,Ee),Ee}}var Er=f("</"),pt=f(">"),Mt=f('<template id="'),Jt=f('"></template>'),sn=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,H,q){if(a(F,ln),q===null)throw Error(t(395));return a(F,q),o(F,vr)}var xe=f('<div hidden id="'),Ye=f('">'),He=f("</div>"),Qe=f('<svg aria-hidden="true" style="display:none" id="'),tt=f('">'),kt=f("</svg>"),Yt=f('<math aria-hidden="true" style="display:none" id="'),On=f('">'),yn=f("</math>"),Cr=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('">'),iu=f("</colgroup></table>");function si(F,H,q,re){switch(q.insertionMode){case 0:case 1:return a(F,xe),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Ye);case 2:return a(F,Qe),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,tt);case 3:return a(F,Yt),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,On);case 4:return a(F,Cr),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Jn);case 5:return a(F,ta),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Pi);case 6:return a(F,Aa),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Fa);case 7:return a(F,fo),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Oa);default:throw Error(t(397))}}function li(F,H){switch(H.insertionMode){case 0:case 1:return o(F,He);case 2:return o(F,kt);case 3:return o(F,yn);case 4:return o(F,yr);case 5:return o(F,Nn);case 6:return o(F,Zr);case 7:return o(F,iu);default:throw Error(t(397))}}var nc=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("'),su=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("'),lu=f('$RC("'),ds=f('","'),rc=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("'),qs=f('"'),Gs=f(")<\/script>"),ui=f(","),uu=/[<\u2028\u2029]/g;function Fo(F){return JSON.stringify(F).replace(uu,function(H){switch(H){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 B=k,L=B.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||k.classList.add("is-unresolved"),B.addEventListener("mouseover",V=>{V.stopPropagation(),r.app.workspace.trigger("hover-link",{event:V,source:"thino",hoverParent:I.containerEl,targetEl:B,linktext:L,sourcePath:B.href})})})}M()},[t.content,i]);const y=async()=>{if(f)try{await we.deleteMemoById(a.id),n(a.id)}catch(I){new x.Notice(I.message)}else h()},w=async()=>{switch(a.sourceType){case"DAILY":await W2(a.id,a.path);break;case"CANVAS":await Z2(a.id,a.path);break;case"MULTI":await V2(a.path);break;case"FILE":await $2(a.id,a.path);break}},S=async()=>{try{const I=await we.restoreMemoById(a.id),M=r.app,N=M==null?void 0:M.loadLocalStorage("tokenForSync");I&&I.webId&&N&&r.settings.startSync&&await Xg(I.webId),I&&we.editMemo(I),n(a.id),new x.Notice(E("RESTORE SUCCEED"))}catch(I){new x.Notice(I.message)}},D=()=>{f&&h(!1)};return v.jsxs("div",{ref:i,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:D,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&&x.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:S,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()}})]})},Kxe=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:i,filter:l}=t,c=on.getQueryById(l);return!!(r||a&&a.from<a.to||o||i||c)||c||n?e.filter(h=>{let g=!0;if(h.thinoType!==void 0&&n&&h.thinoType==="TASK-DONE"&&(g=!1),h.content.contains("comment:")&&(g=!1),c){const y=JSON.parse(c.querystring);Array.isArray(y)&&(g=Vp(h,y))}if(r){const y=new Set;for(const w of Array.from(h.content.match($r)||[])){const D=w.replace($r,"$1").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}for(const w of Array.from(h.content.match(ua)||[])){const D=w.replace(ua,"$1").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}for(const w of Array.from(h.content.match(Wa)||[])){const D=w.replace(Wa,"$2").trim().split("/");let I="";for(const M of D)I+=M,y.add(I),I+="/"}y.has(r)||(g=!1)}return a&&a.from<a.to&&(ut.getTimeStampByDate(h.createdAt)<a.from||ut.getTimeStampByDate(h.createdAt)>a.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(h.content.match($r)!==null||h.content.match(Wa)!==null||h.content.match(ua)!==null)||o==="LINKED"&&h.content.match(Af)===null||o==="IMAGED"&&h.content.match(Ff)===null||o==="CONNECTED"&&h.content.match(ad)===null)&&(g=!1),i&&!h.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(h=>!h.content.contains("comment:"))},Qxe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=lm(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&x.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const w=Kxe({memos:n.filter(S=>S.deletedAt!==""&&S.deletedAt),query:e,HideDoneTasks:!1});o(w),r.setFinish()},[n,i.current,e]);const c=P.useCallback(w=>{o(S=>S.filter(D=>D.id!==w))},[]),f=P.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)}
7 months ago
* **开源项目**
* 😋 精美且细节的视觉样式
3 months ago
* 📑 体验优良的交互逻辑`,i=()=>{dt.setAppSetting({useTinyUndoHistoryCache:!t})},l=()=>{dt.setAppSetting({shouldSplitMemoWord:!r})},c=()=>{dt.setAppSetting({shouldHideImageUrl:!n})},f=()=>{dt.setAppSetting({shouldUseMarkdownParser:!a})},h=async()=>{const g=we.getState().memos.map(S=>({...S})),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:dT(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?Q0:X0})]}),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?Q0:X0})]}),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?Q0:X0})]})]}),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?Q0:X0})]})]}),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:h,children:"导出数据(JSON)"})})]})]})},eMe=()=>{const{globalState:{isMobileView:e}}=P.useContext(Lt);P.useEffect(()=>{we.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(Xxe,{})})]})},tMe=()=>{const{dailyNotesState:{app:e},locationState:{query:t},globalState:{isMobileView:n,changedByMemos:r},memoState:{memos:a}}=P.useContext(Lt),o=lm(),[i,l]=P.useState([]),[c,f]=P.useState([]),h=ne.useRef(null),g=ne.useRef(null),[y,w]=P.useState(!1),[S,D]=P.useState([]),I=ne.useRef([]),M=P.useCallback(({memos:k,query:B,HideDoneTasks:L})=>{const{tag:R,duration:V,type:Y,text:Z,filter:Q}=B,G=on.getQueryById(Q);return!!(R||V&&V.from<V.to||Y||Z||G)||G||L?k.filter(se=>{let fe=!0;if(se.thinoType!==void 0&&L&&se.thinoType==="TASK-DONE"&&(fe=!1),se.content.contains("comment:")&&(fe=!1),G){const $=JSON.parse(G.querystring);Array.isArray($)&&(fe=Vp(se,$))}if(R){const $=new Set;for(const he of Array.from(se.content.match($r)||[])){const ce=he.replace($r,"$1").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}for(const he of Array.from(se.content.match(ua)||[])){const ce=he.replace(ua,"$1").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}for(const he of Array.from(se.content.match(Wa)||[])){const ce=he.replace(Wa,"$2").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}$.has(R)||(fe=!1)}return V&&V.from<V.to&&(ut.getTimeStampByDate(se.createdAt)<V.from||ut.getTimeStampByDate(se.createdAt)>V.to)&&(fe=!1),Y&&(Y==="NOT_TAGGED"&&(se.content.match($r)
6 months ago
${L}`}}}let M=h;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"?`
7 months ago
`:""}${w}${(t==null?void 0:t.WithNewLineViaServer)==="append"||(t==null?void 0:t.WithNewLineViaServer)==="both"?`
3 months ago
`:""}${t==null?void 0:t.AppendViaServer}`);const N=await we.createThino({content:w,isList:f,type:M});N&&(we.pushMemo(N),at.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=we.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=we.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 x.Notice(E("Thino - Failed to start HTTP server, please check the port is available."))}new x.Notice(`${E("Thino - Started HTTP server on port")} ${a}`)},close(){n.close(),new x.Notice(E("Thino - Terminated HTTP server"))}}}const{clipboard:mr}=x.Platform.isDesktop?require("electron"):"";class P3e{constructor(){Se(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 cp=new P3e;let Pg=null,jN=mr==null?void 0:mr.readText(),LN=mr==null?void 0:mr.readImage();mr&&(mr.on=(e,t)=>(cp.on(e,t),mr),mr.once=(e,t)=>(cp.once(e,t),mr),mr.off=(e,t)=>(t?cp.removeListener(e,t):cp.removeAllListeners(e),mr),mr.startWatching=()=>(Pg||(Pg=setInterval(()=>{j3e(jN,jN=mr==null?void 0:mr.readText())&&cp.emit("text-changed"),L3e(LN,LN=mr==null?void 0:mr.readImage())&&cp.emit("image-changed")},500)),mr),mr.stopWatching=()=>(Pg&&clearInterval(Pg),Pg=null,mr));function j3e(e,t){return t&&e!==t}function L3e(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var zN;const aT=(zN=require("electron"))==null?void 0:zN.remote;var VN,WN;const RN=(WN=(VN=require("electron"))==null?void 0:VN.remote)==null?void 0:WN.screen;class R3e{constructor(t,n){Se(this,"isRegisted");Se(this,"leaf");Se(this,"clipboard");Se(this,"isScreenTop",!1);Se(this,"currentSplitWindow");Se(this,"intervalNum");Se(this,"allowsCopy",!1);Se(this,"plugin");Se(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=mr}async onload(){x.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{aT.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&&(aT.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 EP(e,y,w=>{c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w,f()}).open();break}case"selectTags":new Iz(e,y=>{const w=y.length>0?y.map(S=>"#"+S).join(" "):"";c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w.trim(),f()}).open();break;default:h(new Error("Invalid configuration type."))}});Promise.all([l("append"),l("prepend")]).then(()=>n(o,i)).then(()=>r()).catch(a)})}const dke=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 sC(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:x.Platform.resourcePathPrefix},t&&(n={...n,dailyNotePluginInfo:{options:t.instance.options}}),await navigator.clipboard.writeText(`\`\`\`json
7 months ago
${JSON.stringify(n,null,2)}
3 months ago
\`\`\``),new x.Notice(E("Debug info copied to clipboard"))}catch(t){console.error(t)}}class fke extends x.Plugin{constructor(){super(...arguments);Se(this,"settings");Se(this,"settingTab");Se(this,"triggerBySelf",!1);Se(this,"updatedID","");Se(this,"debounceTimer",0);Se(this,"apiHttpServer",null);Se(this,"captureService",null);Se(this,"loaded",!1);Se(this,"MarkdownEditor")}async onload(){this.MarkdownEditor=dke(this.app),ft.setPlugin(this),await this.loadSettings(),mMe(),this.registerRibbon(),await this.verify();try{this.settings.ShowUpdateMessage&&await this.checkVersionAndShowChangeLog()}catch(n){console.error(n)}this.settingTab=new MMe(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(),x.Platform.isMobile&&this.registerMobileNavbar(),this.updateLayoutSettings(),this.registerEditorContextMenu(),this.registerEditorSuggest(new fMe(this.app,this)),this.registerEditorExtension([I3e]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(lo,n=>new wf(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,a;this.app.workspace.detachLeavesOfType(lo),we.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");if(n&&((r=n.parentElement)==null||r.detach()),this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null),this.captureService&&this.captureService.onunload(),x.Platform.isMobile){const o=this.app.mobileNavbar;o&&o.showThinoBtnEl&&((a=this.settings)!=null&&a.NavbarButton)&&(o.showThinoBtnEl.detach(),o.showThinoBtnEl=null)}new x.Notice(E("Close Memos Successfully"))}initEditor(){this.register(Hg(x.MetadataCache.prototype,{getFileCache:r=>function(a){return!(a!=null&&a.path)&&!a?null:r.call(this,a)}})),(r=>{const a=r.app.embedRegistry.embedByExtension.md({app:r.app,containerEl:document.createElement("div")},null,"");a.editable=!0,a.showEditor();const o=Object.getPrototypeOf(Object.getPrototypeOf(a.editMode)),i=Hg(o.constructor.prototype,{triggerClickableToken:l=>async function(...c){if(c[0].type==="internal-link"){if(this.editorEl.closest(".memo-editor-wrapper")){const f=we.getMemoById(c[0].text??"");if(f){Df(f);return}return l.apply(this,c)}return l.apply(this,c)}return l.apply(this,c)}});this.register(i),a.unload()})(this)}initApp(){ft.setApp(this.app)}initURIHandler(){this.registerObsidianProtocolHandler("thino",async n=>{var i,l,c,f;if(!n)return;if(n.openSettings&&(this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos")),n.userid)try{const h=n.userid;x3e(h,this.app),M3e(x.moment().add(30,"days").valueOf(),this.app),dt.setRefresh(!0)}catch(h){console.error(h),new x.Notice(E("Failed to verify"))}if(n.token)try{const h=n.token;(i=this.app)==null||i.saveLocalStorage("tokenForSync",h),setTimeout(()=>{this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos"),this.settingTab.display()},200),new x.Notice(E("Saved sync token successfully"))}catch(h){console.error(h),new x.Notice(E("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const h=await dP();await navigator.clipboard.writeText(h),new x.Notice(E("Copied app id successfully"))}const r=(l=ft.getState())==null?void 0:l.verifyState,a=!x.Platform.isDesktop&&await((f=(c=window.Capacitor)==null?void 0:c.Plugins.Device)==null?void 0:f.getId()),o=x.Platform.isDesktop?await cr():(a==null?void 0:a.identifier)||(a==null?void 0:a.uuid);if(!(!r||(r==null?void 0:r.appId)!==o)){if(n.content){const h=n.type,g=decodeURI(n.content)!==n.content?decodeURI(n.content):n.content,y=n.task,w=await we.createThino(
`);try{await UN(this.app,this.settings,async(l,c)=>{i=l+i+c;const f=await we.createThino({content:i,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});we.pushMemo(f)})}catch(l){console.error("Configuration failed:",l);return}})})})))}registerCommands(){rw.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:x.moment().format("YYYY-MM-DD HH:mm:ss"),updatedAt:x.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,fileInfo:{tags:[],frontmatter:{}}};uf(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(we.initialized&&ft.initialized){if(!n){if(!ft.getState().view){new x.Notice(E("Please open thino first"));return}new MT(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:E("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(wf)&&this.settings.needVerify)return n||dt.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:E("Copy debug info"),callback:async()=>{await sC(this)}}),this.addCommand({id:"insert-editor",name:E("Insert editor"),checkCallback:n=>{const r=this.app.workspace.getActiveViewOfType(x.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:()=>{Dxe(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 x.Notice(E("Please input token first"));return}if(!this.settings.startSync){new x.Notice(E("Please enable sync first"));return}try{await we.initSync()}catch(a){console.error(a),new x.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(){a
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
3 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:f}=await ike(o,c),h=JSON.parse(new TextDecoder().decode(f));return!h||h.iss!=="pkmer"||h.type!=="thino"||h.appId!==n?!1:(ft.setVerifyState(h),!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 lC(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(lo).length>0||this.settings.MobileAndDesktop==="Mobile"&&x.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&x.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){if(this.app.workspace.getLeavesOfType(lo).length>0){at.setPathname("/daily");return}await this.openMemos(),at.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 x.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 x.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 lC extends x.Modal{constructor(n,r){super(n);Se(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 x.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new x.Component;const[c,f]=this.getLatestVersionContent(l.text);let h=c,g=f;try{const y=localStorage.getItem("language"),w=y&&(y==="zh"||y==="zh-TW");h=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 x.MarkdownRenderer.render(this.app,h,a,"",this.component),await x.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