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

2 months ago
"use strict";var GL=Object.defineProperty;var JL=(e,t,n)=>t in e?GL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Se=(e,t,n)=>(JL(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 KL(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 QL(){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,oe,De){this.props=X,this.context=oe,this.refs=D,this.updater=De||w}I.prototype.isReactComponent={},I.prototype.setState=function(X,oe){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,oe,"setState")},I.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function M(){}M.prototype=I.prototype;function N(X,oe,De){this.props=X,this.context=oe,this.refs=D,this.updater=De||w}var B=N.prototype=new M;B.constructor=N,S(B,I.prototype),B.isPureReactComponent=!0;var k=Array.isArray,R=Object.prototype.hasOwnProperty,L={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function V(X,oe,De){var je,Re={},Fe=null,Be=null;if(oe!=null)for(je in oe.ref!==void 0&&(Be=oe.ref),oe.key!==void 0&&(Fe=""+oe.key),oe)R.call(oe,je)&&!_.hasOwnProperty(je)&&(Re[je]=oe[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 U(X,oe){return{$$typeof:e,type:X.type,key:oe,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 oe={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(De){return oe[De]})}var G=/\/+/g;function re(X,oe){return typeof X=="object"&&X!==null&&X.key!=null?Q(""+X.key):oe.toString(36)}function de(X,oe,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===""?"."+re(Be,0):je,k(Re)?(De="",X!=null&&(De=X.replace(G,"$&/")+"/"),de(Re,oe,De,"",function(st){return st})):Re!=null&&(Z(Re)&&(Re=U(Re,De+(!Re.key||Be&&Be.key===Re.key?"":(""+Re.key).replace(G,"$&/")+"/")+X)),oe.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+re(Fe,Xe);Be+=de(Fe,oe,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+re(Fe,Xe++),Be+=de(Fe,oe,De,Ze,Re);else if(Fe==="object")throw oe=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))}},kR=async()=>{const{app:e}=Le.getState().dailyNotesState;return await hA(e,ff(e))||await pA(e),await Rp(e)||[]},NR=(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"}),AR=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,B=8,k=16,R=32,L=64,_=128,V=256,U=512,Z=30,Q="...",G=800,re=16,de=1,fe=2,$=3,he=1/0,se=9007199254740991,ue=17976931348623157e292,X=NaN,oe=4294967295,De=oe-1,je=oe>>>1,Re=[["ary",_],["bind",I],["bindKey",M],["curry",B],["curryRight",k],["flip",U],["partial",R],["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]",Dn="[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,Ue=/&(?:amp|lt|gt|quot|#39);/g,He=/[&<>"']/g,Qe=RegExp(Ue.source),tt=RegExp(He.source),kt=/<%-([\s\S]+?)%>/g,Ut=/<%([\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+",Y="["+uu+"]",K="["+Fo+"]",ie="[^"+An+Qs+A+uu+Fo+Js+
7 months ago
/* [wrapped with `+p+`] */
2 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??se,!!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 Un(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 Un(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|_),ce=j==_&&T==B||j==_&&T==V&&d[7].length<=p[8]||j==(_|V)&&p[7].length<=p[8]&&T==B;if(!(ee||ce))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&_&&(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 Un(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),ce=Oe(ee);++z<ee;)ce[z]=j[p+z];z=-1;for(var ve=Oe(p+1);++z<p;)ve[z]=j[z];return ve[p]=T(ce),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=U1(),z=re-(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),ce=d[ee];d[ee]=d[T],d[T]=ce}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,ce=Oe(vu(j/p));z<j;)ce[ee++]=Sa(d,z,z+=p);return ce}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 Yr(d,p,
3 months ago
`;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+=`' +
7 months ago
__e(`+mn+`) +
3 months ago
'`),Co&&(Te=!0,Ke+=`';
`+Co+`;
__p += '`),Sn&&(Ke+=`' +
7 months ago
((__t = (`+Sn+`)) == null ? '' : __t) +
3 months ago
'`),We=Ii+zt.length,zt}),Ke+=`';
2 months ago
`;var Yt=In.call(p,"variable")&&p.variable;if(!Yt)Ke=`with (obj) {
3 months ago
`+Ke+`
8 months ago
}
2 months ago
`;else if(Oa.test(Yt))throw new Qt(l);Ke=(Te?Ke.replace(te,""):Ke).replace(me,"$1").replace(xe,"$1;"),Ke="function("+(Yt||"obj")+`) {
`+(Yt?"":`obj || (obj = {});
7 months ago
`)+"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
2 months ago
}`;var cn=IC(function(){return Tn(ee,Nt+"return "+Ke).apply(n,ce)});if(cn.source=Ke,lS(cn))throw cn;return cn}function nL(d){return Yn(d).toLowerCase()}function rL(d){return Yn(d).toUpperCase()}function aL(d,p,T){if(d=Yn(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),ce=oa(j,z)+1;return Es(j,ee,ce).join("")}function oL(d,p,T){if(d=Yn(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 iL(d,p,T){if(d=Yn(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 sL(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=Yn(d);var ee=d.length;if(dc(d)){var ce=yo(d);ee=ce.length}if(T>=ee)return d;var ve=T-mu(j);if(ve<1)return j;var Te=ce?Es(ce,0,ve).join(""):d.slice(0,ve);if(z===n)return Te+j;if(ce&&(ve+=Te.length-ve),uS(z)){if(d.slice(ve).search(z)){var We,$e=Te;for(z.global||(z=yd(z.source,Yn(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 lL(d){return d=Yn(d),d&&Qe.test(d)?d.replace(Ue,wy):d}var uL=Cs(function(d,p,T){return d+(T?" ":"")+p.toUpperCase()}),fS=Bm("toUpperCase");function TC(d,p,T){return d=Yn(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)}}),cL=Gi(function(d,p){return wr(p,function(T){T=bi(T),Wi(d,T,Ge(d[T],d))}),d});function dL(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 fL(d){return Oy(no(d,g))}function hS(d){return function(){return d}}function hL(d,p){return d==null||d!==d?p:d}var pL=xu(),mL=xu(!0);function Go(d){return d}function pS(d){return Fd(typeof d=="function"?d:no(d,g))}function gL(d){return Ec(no(d,g))}function vL(d,p){return yi(d,no(p,g))}var yL=rn(function(d,p){return function(T){return vl(T,d,p)}}),wL=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,ce=Fu(d);return wr(z,function(ve){var Te=p[ve];d[ve]=Te,ce&&(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 bL(){return zn._===this&&(zn._=Dy),this}function gS(){}function SL(d){return d=un(d),rn(function(p){return bl(p,d)})}var DL=Ch(jn),TL=Ch(sc),IL=Ch(il);function EC(d){return Zm(d)?F(bi(d)):km(d)}function EL(d){return function(p){return d==null?n:So(d,p)}}var CL=Hm(),xL=Hm(!0);function vS(){return[]}function yS(){return!1}function ML(){return{}}function kL(){return""}function NL(){return!0}function AL(d,p){if(d=un(d),d<1||d>se)return[];var T=oe,j=ma(d,oe);p=Ot(p),d-=oe;for(var z=Ee(j,p);++T<d;)p(T);return z}function FL(d){return an(d)?jn(d,bi):Di(d)?[d]:Ha(r0(Yn(d)))}function OL(d){var p=++pc;return Yn(d)+p}var PL=Eh(function(d,p){return d+p},0),jL=Da("ceil"),LL=Eh(function(d,p){return d/p},1),RL=Da("floor");function _L(d){return d&&d.length?Tu(d,Go,gi):n}function BL(d,p){return d&&d.length?Tu(d,Ot(p,2),gi):n}function HL(d){return gd(d,Go)}function UL(d,p){return gd(d,Ot(p,2))}function YL(d){return d&&d.length?Tu(d,Go,yl):n}function zL(d,p){return d&&d.length?Tu(d,Ot(p,2),yl):n}var VL=Eh(function(d,p){return d*p},1),WL=Da("round"),$L=Eh(function(d,p){return d-p},0);function ZL(d){return d&&d.length?Ae(d,Go):0}function qL(d,p){return d&&d.length?Ae(d,Ot(p,2)):0}return J.after=le,J.ary=ge,J.assign=rj,J.assignIn=gC,J.assignInWith=b0,J.assignWith=aj,J.at=oj,J.before=Pe,J.bind=Ge,J.bindAll=cL,J.bindKey=rt,J.c
3 months ago
`);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(`
2 months ago
`),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 FR(e,t,n){var g;const r={},a=(y,w)=>{for(;y[w]!==void 0&&y[w]!==w;)w=y[w];return w},o=ft.getState().app,i=n.split(`
`),l=t+i.length-1,c=(g=o.metadataCache.getFileCache(e))==null?void 0:g.listItems,f={};if(!c)return[];c.forEach(y=>{var 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,B=i.slice(M,N+1),k=B.join(`
`);if(y.parent&&y.parent>0&&(r[y.position.start.line]=y.parent),y.parent&&f[y.parent]){if(w-y.parent===1){const L=(D=i[M])==null?void 0:D.match(/^(\s*)/);L&&(f[y.parent].indent=L[0])}const R=new RegExp("^"+f[y.parent].indent);f[y.parent].content+=`
7 months ago
`+k.split(`
2 months ago
`).map(L=>L==null?void 0:L.replace(R,"")).join(`
`)}else if(y.parent&&f[a(r,y.parent)]){const R=new RegExp("^"+f[a(r,y.parent)].indent);f[a(r,y.parent)].content+=`
7 months ago
`+k.split(`
2 months ago
`).map(L=>L==null?void 0:L.replace(R,"")).join(`
`)}else if(new RegExp(gR).test(k)){f[w]||(f[w]={content:"",blockId:"",indent:""});const R=B.length>1&&((I=B[1])==null?void 0:I.match(/^(\s*)/));R&&(f[w].indent=R[0]),f[w].content=k.split(`
8 months ago
`).map(L=>L==null?void 0:L.replace(f[w].indent,"")).join(`
2 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 OR(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 PR(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 jR(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(`
2 months ago
`).trim()}),n}const LR=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 RR(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=FR(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=UR(e.DefaultMemoComposition,S.line),I=YR(e.DefaultMemoComposition,S.line),M=zR(S.line);let N=_R(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=VR(S.line);N=BR(S.line),l=LR(Z)}else l="JOURNAL";let B=N.trim().replaceAll(/<br>/g,`
`);const k=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(N),R=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(N),L=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(N),_=(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],U=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(N)?"PUBLIC":"PRIVATE";B=B.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,""),S.blockId&&(B=B.replace("^"+(S==null?void 0:S.blockId),"")),r.push({id:i.format("YYYYMMDDHHmmss")+`${S.index}`,content:B.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(_,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:R?"ARCHIVED":"NORMAL",visibility:U,pinned:k,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:V,fileInfo:h})}}function _R(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,"$4")}function BR(e){return HR(e)}const HR=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]},UR=(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]},zR=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]},VR=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 PR(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:"",B=e.path,k="Memo",R="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:B,creatorName:k,sourceType:R,resourceList:L,webId:D,fileInfo:i}),t})}async function fT(e,t){var I,M,N,B,k,R,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(_){console.error(_),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(`
2 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function s_({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,B=>{B.id=o,B.createdAt=a.format("YYYY/MM/DD HH:mm:ss"),B.updatedAt=a.format("YYYY/MM/DD HH:mm:ss"),B.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 l_({content:e,isList:t}){var B;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:((B=h==null?void 0:h.frontmatter)==null?void 0:B.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(`
7 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}
2 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:e.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(B){console.error(B),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(`
7 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}
2 months ago
`;let M;if(y===-1){const B=`# ${n.format("YYYY-MM-DD")}`;M=`${f.substring(0,w)}
${B}${I}
${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 u_({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 OR(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"),B=x.moment(M.createdAt,"YYYY/MM/DD HH:mm:ss");return N.isAfter(B)?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(`
8 months ago
`).join(`
2 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",thinoStatus:t?"JOURNAL":"TASK-TODO"})).id)}catch(se){console.error(se)}const B=t?"- ":"- [ ] ",k=i!=null&&i.DefaultMemoComposition?`${B}${($=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?`
2 months ago
`+f:" "}${N?`[webId::${N}]`:""}`:`${B}${D} ${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?`
2 months ago
`+f:" "}${N?`[webId::${N}]`:""}`,R=Ju(),L=pb(g,R),_="fake"+ut.randomId(16);let V=!1;const U=o.plugins.getPlugin("templater-obsidian");let Z;if(L?Z=L:(U!=null&&U.templater&&(U!=null&&U.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e,date:g,isList:t,id:_,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(),U&&(U!=null&&U.templater)&&(U!=null&&U.settings.trigger_on_file_creation)&&V)return dt.setChangedByMemos(!0),{id:_,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(se){console.error(se),new x.Notice(E("Failed to read current daily note, check if it exists."))}const G=o.metadataCache.getFileCache(Z),re={tags:((he=G==null?void 0:G.frontmatter)==null?void 0:he.tags)||[],frontmatter:(G==null?void 0:G.frontmatter)||{}},de=await wA(I,k,Q);await a.modify(Z,de.content);const fe=de.posNum===-1?bA(de.content).length-(k.split(`
`).length-1)-1:de.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:re}}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(`
8 months ago
`).join(`
2 months ago
`+w),D=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),I=D.format(o||"HH:mm"),M=!e.thinoType||e.thinoType==="JOURNAL"?"- ":e.thinoType==="TASK-TODO"?"- [ ] ":"- [x] ",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)?`
7 months ago
`+w:"")+S)}${S.split(`
7 months ago
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
7 months ago
`).length-1])&&f.trim()?`
`+w:" "}${f}`:`${M}${I} ${S.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
7 months ago
`+w:""}${S}${S.split(`
7 months ago
`).length>1&&/```/g.test(S.split(`
`)[S.split(`
7 months ago
`).length-1])&&f.trim()?`
2 months ago
`+w:" "}${f}`,B=Ju(),k=pb(D,B),R="fake"+ut.randomId(16);let L=!1;const _=n.plugins.getPlugin("templater-obsidian");let V;if(k?V=k:(_!=null&&_.templater&&(_!=null&&_.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e.content,date:D,isList:e.thinoType&&e.thinoType==="JOURNAL",id:R,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(),_&&(_!=null&&_.templater)&&(_!=null&&_.settings.trigger_on_file_creation)&&L)return dt.setChangedByMemos(!0),{id:R,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 U=n.metadataCache.getFileCache(V),Z={tags:((fe=U==null?void 0:U.frontmatter)==null?void 0:fe.tags)||[],frontmatter:(U==null?void 0:U.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,re=await wA(G,N,Q);await t.modify(V,re.content);const de=re.posNum===-1?bA(re.content).length-1:re.posNum+1;return dt.setChangedByMemos(!0),{id:D.format("YYYYMMDDHHmm")+"00"+de,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 o_(e)}(s*?)`),a=i_(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?`
2 months ago
`:"")+i}`,posNum:n}}const bA=e=>e.split(/\r?\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}await t.vault.delete(n)}async function d_(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(`
3 months ago
`),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(`
2 months ago
`);if(!l){new x.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,l)}async function f_(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 h_(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(`
3 months ago
`),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(`
2 months ago
`))}async function p_(){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=m_(l);if(c.length===0)return o;for(let f=0;f<c.length;f++){const h=c[f];if(/- /.test(h)){const y=g_(h).slice(0,13),w=x.moment(y,"YYYYMMDDHHmmss"),S=y_(c[f]),D=x.moment(S.slice(0,13),"YYYYMMDDHHmmss"),I=v_(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 m_=e=>e.split(/\r?\n/),g_=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},v_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},y_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function w_(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 b_=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}},S_=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 D_(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]&&(typeof t[l]=="string"||typeof t[l]=="boolean")&&(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.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: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=D_(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(`
2 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:""}}function SA(e,t){const n=[];for(const r in t)t[r]===e&&n.push(parseInt(r),...SA(parseInt(r),t));return n}async function Bl(e,t){var G;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;const M=k2(S),N=S.find(re=>re.position.start.line===D);if(!N)return new x.Notice(E("Thino not found")),e;const B=SA(D,M);if(B.length>0){const re=B.map(de=>{const fe=S.find($=>$.position.start.line===de);return fe?fe.position.end.line:-1});I=Math.max(...re,N.position.end.line)}else I=N.position.end.line;const k=y.slice(D,I+1);let R=k.join(`
`);const L=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(!R)return new x.Notice(E("Thino not found")),e;const _=a.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,V=_?1:a.vault.getConfig("tabSize"),U=(_?" ":" ").repeat(V);let Z=L;if(o.DefaultTimePrefix!=="HH:mm"&&(Z=x.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(o.DefaultTimePrefix)),t.content){const re=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",de=(e.pinned?" [pinned::true]":"")+(e.deletedAt?` [deleted::${e.deletedAt}]`:"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.webId?" [webId::"+e.webId+"]":""),fe=t.content.trim().split(`
8 months ago
`)[t.content.trim().split(`
2 months ago
`).length-1].trim(),$=e.hasId&&t.content.trim().split(`
`).length>1&&new RegExp(/(-|\*|\d{1,2}\.)\s/g).test(fe)?" ^"+e.hasId:" ";R=`${re}${Z}${$}${t.content.trim().split(`
8 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(t.content)?`
2 months ago
`+U:""}${t.content.trim().split(`
8 months ago
`).join(`
2 months ago
`+U)}${/((-|\*|\d\.|>)\s|```)/g.test(t.content.split(`
8 months ago
`)[t.content.split(`
`).length-1])?`
2 months ago
`+U:" "}${de.trim()}`}if(t.thinoType){const re=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";R=R.replace(/^((- \[.\] )|((-|\*) ))/,re)}if(t.rowStatus){const re=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";R=R.includes("[archived::")?R.replace(/\[archived::(true|false)\]/,re):R+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re}if(t.visibility){const re='[visibility::"'+t.visibility+'"]';R=R.includes("[visibility::")?R.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,re):R+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re}if(t.pinned!==void 0){const re=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";R=R.includes("[pinned::")?R.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":re):R+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re}if(t.webId!==void 0){const re="[webId::"+t.webId+"]";R=R.includes("[webId::")?R.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":re):R+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re}const Q=x.moment();if(t.deleted!==void 0){const re="[deleted::"+Q.format("YYYYMMDDHHmmss")+"]";t.deleted?(R=R.replace(/\[deleted::([^\]]+)\]/,""),R=R+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re):t.deleted===!1&&(R=R.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId&&((G=t.content)==null?void 0:G.split(`
`).length)===1){const re=" ^"+e.hasId;R=R.trim().replace(/\s\^([0-9a-zA-Z-]+)($|\n)/g,"")+`${/((-|\*|\d\.|>)\s|```)/g.test(R.split(`
`)[R.split(`
8 months ago
`).length-1])?`
2 months ago
`+U:" "}`+re}return R!==k.join(`
`)?(y.splice(D,I-N.position.start.line+1,R.trim()),await n.modify(h,y.join(`
`)),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?Q.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}async function T_(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,B){const k=[];for(const R in B)B[R]===N&&k.push(parseInt(R),...y(parseInt(R),B));return k}const w=x.moment(),S=t.map(N=>{const B=i.find(_=>_.position.start.line===parseInt(N.id.slice(14))),R=y(parseInt(N.id.slice(14)),l).map(_=>{const V=i.find(U=>U.position.start.line===_);return V?V.position.end.line:-1}),L=Math.max(...R,B.position.end.line);return{id:N.id,start:B.position.start.line,end:L}}),I=(await r.read(o)).split(`
7 months ago
`);return S.forEach(N=>{const k=I.slice(N.start,N.end+1).join(`
7 months ago
`),L=k.split(`
`)[k.split(`
2 months ago
`).length-1].trim();let _=k;if(n==="delete"){const V="[deleted::"+w.format("YYYYMMDDHHmmss")+"]";_=_.replace(/\[deleted::([^\]]+)\]/,""),_=k+`${k.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
2 months ago
`+g:" "}`+V}if(n==="restoreFromDelete"&&(_=_.replace(/ ?\[deleted::([^\]]+)\]/,"")),n==="archive"){const V="[archived::true]";_=_.includes("[archived::")?_.replace(/\[archived::(true|false)\]/,V):_+`${_.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
2 months ago
`+g:" "}`+V}n==="restoreFromArchive"&&(_=_.replace(/ ?\[archived::(true|false)\]/,"")),n==="deleteForever"?I.splice(N.start,N.end-N.start+1):I.splice(N.start,N.end-N.start+1,_),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(`
`)),dt.setChangedByMemos(!0),c}const I_=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})}},E_=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 p_()}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 d_(D)}e.deleteMemoInSingleFile=o;function i(D){return c_(D)}e.deleteMemoInMultiFiles=i;function l(D){return h_(D)}e.deleteMemoInDailyNote=l;function c(D){return f_(D)}e.deleteMemoInCanvas=c;function f(){return kR()}e.getMyQueries=f;async function h(D,I){return await AR(D,I)}e.createQuery=h;function g(D,I,M){return GR(D,I,M)}e.updateQuery=g;function y(D){return w_(D)}e.deleteQueryById=y;function w(D){return b_(D)}e.pinQuery=w;function S(D){return S_(D)}e.unpinQuery=S})(hT||(hT={}));const Ko=hT;var Ku={};Object.defineProperty(Ku,"__esModule",{value:!0});class Of extends Error{}class C_ extends Of{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class x_ extends Of{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class M_ extends Of{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class jg extends Of{}class DA extends Of{constructor(t){super(`Invalid unit ${t}`)}}class Xi extends Of{}class Uc extends Of{constructor(){super("Zone is an abstract class")}}const gt="numeric",zs="short",Mi="long",xw={year:gt,month:gt,day:gt},TA={year:gt,month:zs,day:gt},k_={year:gt,month:zs,day:gt,weekday:zs},IA={year:gt,month:Mi,day:gt},EA={year:gt,month:Mi,day:gt,weekday:Mi},CA={hour:gt,minute:gt},xA={hour:gt,minute:gt,second:gt},MA={hour:gt,minute:gt,second:gt,timeZoneName:zs},kA={hour:gt,minute:gt,second:gt,timeZoneName:Mi},NA={hour:gt,minute:gt,hourCycle:"h23"},AA={hour:gt,minute:gt,second:gt,hourCycle:"h23"},FA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:zs},OA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:Mi},PA={year:gt,month:gt,day:gt,hour:gt,minute:gt},jA={year:gt,month:gt,day:gt,hour:gt,minute:gt,second:gt},LA={year:gt,month:zs,day:gt,hour:gt,minute:gt},RA={year:gt,month:zs,day:gt,hour:gt,minute:gt,second:gt},N_={year:gt,month:zs,day:gt,weekday:zs,hour:gt,minute:gt},_A={year:gt,month:Mi,day:gt,hour:gt,minute:gt,timeZoneName:zs},BA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,second:gt,timeZoneName:zs},HA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,timeZoneName:Mi},UA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,second:gt,timeZoneName:Mi};class Ov{get type(){throw new Uc}get name(){throw new Uc}get ianaName(){return this.name}get isUniversal(){throw new Uc}offsetName(t,n){throw new Uc}formatOffset(t,n){throw new Uc}offset(t){throw new Uc}equals(t){throw new Uc}get isValid(){throw new Uc}}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 zA(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 A_(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 F_={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function O_(e,t){const n=e.format(t).rep
7 months ago
`||te.charAt(tt)==="\r"&&te.charAt(tt+1)!==`
2 months ago
`)&&(He++,Qe===0&&(Qe=tt+1)),tt--}var kt=Ue+He,Ut=me-Qe;return xe[me]={line:kt,lineStart:Qe},{offset:me,line:kt+1,column:Ut+1}}function G(te){if(!k(te))throw new Error("not a parser: "+te)}function re(te,me){return typeof te=="string"?te.charAt(me):te[me]}function de(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,se=3,ue=8,X=5*ue,oe=4*ue,De=" ";function je(te,me){return new Array(me+1).join(te)}function Re(te,me,xe){var Ue=me-te.length;return Ue<=0?te:je(xe,Ue)+te}function Fe(te,me,xe,Ue){return{from:te-me>0?te-me:0,to:te+xe>Ue?Ue:te+xe}}function Be(te,me){var xe,Ue,He,Qe,tt,kt=me.index,Ut=kt.offset,On=1;if(Ut===te.length)return"Got the end of the input";if(L(te)){var yn=Ut-Ut%ue,Cr=Ut-yn,Jn=Fe(yn,X,oe+ue,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,ue));Qe=function(Nn){return Nn.from===0&&Nn.to===1?{from:Nn.from,to:Nn.to}:{from:Nn.from/ue,to:Math.floor(Nn.to/ue)}}(Jn),Ue=yn/ue,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,Ue=kt.line-1,Qe=Fe(Ue,he,se,ta.length),He=ta.slice(Qe.from,Qe.to),tt=Qe.to.toString().length}var Pi=Ue-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(`
7 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(", ")),`
2 months ago
`].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(Ue,He){for(var Qe,tt=new Array(me),kt=0;kt<me;kt+=1){if(!(Qe=U(te[kt]._(Ue,He),Qe)).status)return Qe;tt[kt]=Qe.value,He=Qe.index}return U(_(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(Ue,He){for(var Qe,tt=0;tt<te.length;tt+=1)if((Qe=U(te[tt]._(Ue,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,Ue){return[xe].concat(Ue)})}function nt(te){$(te);var me="'"+te+"'";return o(function(xe,Ue){var He=Ue+te.length,Qe=xe.slice(Ue,He);return Qe===te?_(He,Qe):V(Ue,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?de(me):me=0;var xe=function(He){return RegExp("^(?:"+He.source+")",Ze(He))}(te),Ue=""+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],Ut=tt[me];return _(Qe+kt.length,Ut)}return V(Qe,"valid match group (0 to "+tt.length+") in "+Ue)}return V(Qe,Ue)})}function St(te){return o(function(me,xe){return _(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 Ue=te._(me,xe);return Ue.index=xe,Ue.value="",Ue});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 Ue=te._(me,xe),He=me.slice(xe,Ue.index);return Ue.status?V(xe,'not "'+He+'"'):_(xe,null)})}function Vt(te){return fe(te),o(function(me,xe){var Ue=re(me,xe);return xe<me.length&&te(Ue)?_(xe+1,Ue):V(xe,"a character/byte matching "+te)})}function Xt(te,me){arguments.length<2&&(me=te,te=void 0);var xe=o(function(Ue,He){return xe._=me()._,xe._(Ue,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),Ue=new Error(xe);throw Ue.type="ParsimmonError",Ue.result=me,Ue},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,Ue){return Ue})},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 Ue=[],He=void 0;;){if(!(He=U(te._(me,xe),He)).status)return U(_(xe,Ue),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,Ue.push(He.value)}})},i.tieWith=function(te){return $(te),this.map(function(me){if(function(He){if(!R(He))throw new Error("not an array: "+He)}(me),me.length){$(me[0]);for(var xe=me[0],Ue=1;Ue<me.length;Ue++)$(me[Ue]),xe+=te+me[Ue];return xe}return""})},i.tie=function(){return this.tieWith("")},i.times=function(te,me){var xe=this;return arguments.length<2&&(me=te),de(te),
7 months ago
`),jr=nt(`\r
2 months ago
`),nr=tn(jr,ha,fr).desc("newline"),Lr=tn(nr,Er);o.all=Dn,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(Ue){me[Ue]=Xt(function(){return te[Ue](me)})}(xe);return me},o.crlf=jr,o.custom=function(te){return o(te(_,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=_,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(Ue){return te.indexOf(Ue)>=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,Ue=(te=arguments,Array.prototype.slice.call(te)),He=Ue.length,Qe=0;Qe<He;Qe+=1){var tt=Ue[Qe];if(!k(tt)){if(R(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(Ut,On){for(var yn,Cr={},Jn=0;Jn<He;Jn+=1){var yr,ta;if(R(Ue[Jn])?(yr=Ue[Jn][0],ta=Ue[Jn][1]):(yr=null,ta=Ue[Jn]),!(yn=U(ta._(Ut,On),yn)).status)return yn;yr&&(Cr[yr]=yn.value),On=yn.index}return U(_(On,Cr),yn)})},o.string=nt,o.succeed=St,o.takeWhile=function(te){return fe(te),o(function(me,xe){for(var Ue=xe;Ue<me.length&&te(re(me,Ue));)Ue++;return _(Ue,me.slice(xe,Ue))})},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,Ue=f(function(Qe){if(R(Qe)){var tt=Qe;if(tt.length!==2)throw new Error("["+tt.join(", ")+"] should be length 2, got length "+tt.length);if($(tt[0]),de(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 de(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]},Ue);return w(f(function(Qe){return Qe[1]},Ue)).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(),de(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,Ue){var He=re(xe,Ue);return He===te?_(Ue+1,He):V(Ue,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:B,int8LE:B(1),int16LE:B(2),int32LE:B(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 Y2=()=>/(?:[#*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}
2 months ago
${o}`,posNum:n}}function VH(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(VH(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 WH{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
`+oe+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(`
2 months ago
`),W=C.length-1,le=O.length-1;1<=W&&0<=le&&C[W]!==O[le];)le--;for(;1<=W&&0<=le;W--,le--)if(C[W]!==O[le]){if(W!==1||le!==1)do if(W--,le--,0>le||C[W]!==O[le]){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<=le);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 _:return"Fragment";case L:return"Portal";case U:return"Profiler";case V:return"StrictMode";case re:return"Suspense";case de: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&&B(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(U1,"")}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),Ui="__reactFiber$"+wc,dl="__reactProps$"+wc,wo="__reactContainer$"+wc,eh="__reactEvents$"+wc,J="__reactListeners$"+wc,bc="__reactHandles$"+wc;function Yi(s){var u=s[Ui];if(u)return u;for(var m=s.parentNode;m;){if(u=m[wo]||m[Ui]){if(m=u.alternate,u.child!==null||m!==null&&m.child!==null)for(s=xy(s);s!==null;){if(m=s[Ui])return m;s=xy(s)}return u}s=m,m=s.parentNode}return null}function ga(s){return s=s[Ui]||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,Uo=[],Yo=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){Uo[Yo++]=zi,Uo[Yo++]=Vi,Uo[Yo++]=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=Uo[--Yo],Uo[Yo]=null,Vi=Uo[--Yo],Uo[Yo]=null,zi=Uo[--Yo],Uo[Yo]=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+`
2 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 Ud(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 Ua(s,u,m,b){u.child=s===null?xm(u,null,m,b):yl(u,s.child,m,b)}function Um(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,Ua(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,Ym(s,u,O,b,C)):(s=Yh(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 Ym(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 Ua(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,Ua(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,le=u.memoizedProps;W.props=le;var ge=W.context,Pe=m.contextType;typeof Pe=="object"&&Pe!==null?Pe=Ba(Pe):(Pe=to(m)?_a:va.current,Pe=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"||(le!==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,le!==b||qe!==ge||eo.current||ml?(typeof Ge=="function"&&(Im(u,m,Ge,b),ge=u.memoizedState),(le=ml||fh(u,m,le,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)=>{pU(vU[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=bU(a.toString());return t(e?o:wU(o))})})}const Dx={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},SU=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 R=>{dt.setMemoListView(R),g&&(g.settings.MemoListView=R,await g.saveSettings()),h(R)},N=[{view:"list",title:E("List")},{view:"chat",title:E("Chat")},{view:"moments",title:E("Moments")}];(!i||a!=null&&a.SupportSelectOtherView)&&N.push({view:"waterfall",title:E("Waterfall")},{view:"calendar",title:E("Calendar")},{view:"table",title:E("Table")});const B=new x.Menu;N.forEach(({view:R,title:L})=>{B.addItem(_=>{_.setChecked(f===R).setIcon(Dx[R]).setTitle(L).onClick(()=>{f!==R&&M(R)})})}),B.showAtMouseEvent(S.nativeEvent)};return v.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:l,onClick:w})},DU=()=>{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 TU{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
2 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},UU=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],x0=function(t){return LU(t).map(function(n){return UU.includes(n)?"\\".concat(n):n}).join("")},YU=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),B=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)),B>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),A6=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),B=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
2 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=AU({},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 kU("change",{bubbles:!0}),r.textareaRef.dispatchEvent(N));var B=N.target||r.textareaRef,k=B.selectionEnd,R=B.value;if(r.lastValueBubbledEvent=R,g&&N&&(N.persist&&N.persist(),g(new Proxy(N,{get:function(X,oe,De){return oe==="target"?B:Reflect.get(X,oe,De)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:R});var _=function(){var X=CU(B,k),oe=X.top,De=X.left;r.setState({top:oe-r.textareaRef.scrollTop||0,left:De})},V=function(X){r.lastTrigger=k-X,r._closeAutocomplete(),_()};if(k<=r.lastTrigger){var U=R.slice(0,k),Z=r.tokenRegExp.exec(U);V(Z?Z[0].length:0)}var Q=R.slice(r.lastTrigger,k),G=r.tokenRegExp.exec(Q),re=G&&G[0],de=G&&G[1]||null,fe=de?de.length-1:0,$=r.tokenRegExpEnding.exec(Q);if($?V($[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!re||re.length<=y+fe)&&(r.state.currentTrigger&&!h[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(de&&h[de].afterWhitespace&&!/\s/.test(R[k-re.length-1])&&R[k-re.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(R.slice(0,k)),re=G&&G[0],!re){r._closeAutocomplete();return}de=Object.keys(h).find(function(ue){return ue.slice(0,fe+1)===re.slice(0,fe+1)})||null}var he=re.slice(1);if(de){(S||I===null&&M===null||r.state.currentTrigger!==de)&&_(),r.escListenerInit();var se=r._getTextToReplace(de);r.setState({selectionEnd:k,currentTrigger:de,textToReplace:se,actualToken:he},function(){try{r._getValuesFromProvider()}catch(ue){Cx(ue.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
`,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 ue(Gt);_t&&((ht=D.current)==null||ht.insertText(_t+`
`,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),re.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 de=()=>{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 ue(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 ue(ht);St&&((et=D.current)==null||et.insertText(St))}}},he=()=>{var _e;De(((_e=D.current)==null?void 0:_e.element.value)||"")},se=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)||"")})},ue=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=(pz()||[]).filter(dn=>!_e.include
7 months ago
`:""}${_e}`:`${_e} ${ht?`
2 months ago
`:""}${Gt.map(dn=>`#${dn}`).join(" ")}`:_e;await _t(Vt,Xt),k0("")},oe=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&&(de(),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}=mz(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),R(Tt),L.current.style.left=`${_t}px`,L.current.style.top=`${Vt}px`},[i,o]),st=P.useCallback(()=>{const _e=document.createElement("input");document.body.appendChild(_e),_e.type="file",_e.multiple=!1,_e.accept="image/png, image/gif, image/jpeg",_e.onchange=async()=>{var ht;if(!_e.files||_e.files.length===0)return;const et=_e.files[0],nt=await ue(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:gz(),placeholder:E("What do you think now..."),showConfirmBtn:!0,showCancelBtn:Ct,showTools:!0,onConfirmBtnClick:X,onCancelBtnClick:oe,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)}]]
7 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,`
2 months ago
`)},bz=[{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")}],X6=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:bz.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 e9(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?"":"thino-hidden"}`,ref:a,style:i.styles.popper,children:v.jsx(X6,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class e9 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(X6,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const Sz=(e,t)=>(e%t+t)%t;class Dz{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=Sz(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 t9{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 Dz(this,r,this.scope),this.scope.register([],"Esca
`:""}${V}`:`${V} ${R?`
`:""}${B.map(U=>`#${U}`).join(" ")}`),_&&_.content!==V){const U=await we.updateMemo(_.id,V==null?void 0:V.trim());L.push(U)}}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(B=>B!==N)),o.includes(N)&&i(o.filter(B=>B!==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(B=>B!==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 Mz(a,e):""}},Mz=(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},kz=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=Bz(),jw=Hz(),n9=Uz(),r9=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 zz(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 Vz(e,t,n,r,a){const o=wn.impl.options.copyDefaultStyles?$z(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);zz(i,l,c,g)}})}let N0=null,cw={};const Wz=["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 $z(e,t){const n=l(t),r=c(n);if(cw[r])return cw[r];const a=Zz(),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),Wz.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 Zz(){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 qz(){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>
2 months ago
</div>`)},P.useEffect(()=>{t(e)},[e])}var fV=typeof window>"u"?P.useEffect:P.useLayoutEffect;function hV({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=s9(n),f=sV(i?`${i}`:void 0),[h,g]=Xz(r,a),y=P.useRef(h),[w,S]=P.useState(!1),D=tV(),I=o??D,M=P.useRef(),N=P.useRef(),B=P.useRef(null),[k,R]=P.useState(null);dV(B);const L=`${l.collapsedHeight||0}px`;function _(V){if(!B.current)return;const U=B.current;for(const Z in V){const Q=V[Z];Q?U.style[Z]=Q:U.style.removeProperty(Z)}}return fV(()=>{if(!B.current||h===y.current)return;y.current=h;function U(G){return I?0:e??uV(G)}const Z=G=>`height ${U(G)}ms ${t}`,Q=G=>{function re(){h?(_({height:"",overflow:"",transition:"",display:""}),c("expandEnd")):(_({transition:""}),c("collapseEnd")),S(!1)}N.current&&Vx(N.current),N.current=lV(re,G)};return S(!0),h?M.current=requestAnimationFrame(()=>{c("expandStart"),_({display:"block",overflow:"hidden",height:L}),M.current=requestAnimationFrame(()=>{c("expanding");const G=Wx(B);Q(U(G)),B.current&&(B.current.style.transition=Z(G),B.current.style.height=`${G}px`)})}):M.current=requestAnimationFrame(()=>{c("collapseStart");const G=Wx(B);Q(U(G)),_({transition:Z(G),height:`${G}px`}),M.current=requestAnimationFrame(()=>{c("collapsing"),_({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:U,onClick:Z,refKey:Q,...G}={refKey:"ref",onClick(){},disabled:!1,...V},re=k?k.tagName==="BUTTON":void 0,de=V==null?void 0:V[Q||"ref"],fe={id:`react-collapsed-toggle-${f}`,"aria-controls":`react-collapsed-panel-${f}`,"aria-expanded":h,onClick(se){U||(Z==null||Z(se),g(ue=>!ue))},[Q||"ref"]:$x(de,R)},$={type:"button",disabled:U?!0:void 0},he={"aria-disabled":U?!0:void 0,role:"button",tabIndex:U?-1:0};return re===!1?{...fe,...he,...G}:re===!0?{...fe,...$,...G}:{...fe,...$,...he,...G}},getCollapseProps(V){const{style:U,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(B,Q),style:{boxSizing:"border-box",...!w&&!h?{display:L==="0px"?"none":"block",height:L,overflow:"hidden"}:{},...U}}}}}const pV=e=>{const{dailyNotesState:{app:t,view:n,settings:r},globalState:{memoListView:a}}=P.useContext(Lt),{getCollapseProps:o,getToggleProps:i,isExpanded:l,setExpanded:c}=hV({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),[B,k]=ne.useState(!1),R=x.debounce((_,V,U)=>{for(const Z of _){const{height:Q}=Z.contentRect,G=(V==null?void 0:V.ThinoMaxHeight)||340,re=Q>G;N(re),c(!re),U.disconnect()}},500);P.useEffect(()=>{var _;if(f.content!==D.current){if(r!=null&&r.OptimizeForCallout&&f.content.split("> [!").length>3&&f.content.split(`
`).length>10&&!B){const V=y.current.createEl("button");V.setText(E("Render content")),V.onclick=async()=>{k(!0),await L()};const U=y.current.createEl("textarea");U.setText(f.content),U.disabled=!0,(_=y.current)==null||_.toggleClass(["raw-content"],!0),c(!0),N(!1);return}L()}},[f.content]),P.useEffect(()=>{B&&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(!B)return;const _=y.current;if(!_)return;if(!(r!=null&&r.ThinoMaxHeight)){c(!0),N(!1);return}const V=new ResizeObserver(U=>{R(U,r,V)});return V.observe(_),()=>V.disconnect()},[B]);const L=async()=>{var _,V,U;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=(_=y.current)==null?void 0:_.querySelectorAll(".internal-link");Z==null||Z.forEach(Q=>{const G=Q,re=G.getAttribute("data-href");if(!re)return;t.metadataCache.getFirstLinkpathDest(re,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:re,sourcePath:G.href})})})}D.current=f.content,(V=y.current)==null||V.toggleClass(["markdown-rendered"],!0),(U=y.current)==null||U.toggleClass(["raw-content"],!1),k&&k(!0),I.current=(r==null?void 0:r.ThinoMaxHeight)||340};return v.jsxs(v.Fragment,{children:[M&&a==="moments"&&v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"thino-collapse-button",...i({style:{display:"block",marginTop:2}}),children:E(l?"Collapse":"Expand")}),!l&&(r==null?void 0:r.ThinoCollapsedHeight)!==0&&v.jsx("div",{className:"thino-collapse-shadowOverlay",onDoubleClick:g})]}),v.jsx("div",{...o({style:{margin:0}}),ref:y,className:"memo-content-text",onClick:_=>h(_,f),onDoubleClick:g,onContextMenu:_=>{_.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")})]})]})},l9=P.memo(pV,(e,t)=>e.memo.content===t.memo.content),mV=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(l9,{memo:t,handleMemoContentClick:l,handleMemoDoubleClick:()=>{}})})}),v.jsx("div",{className:"layer-container"})]}),r.length>0?v.jsxs("div",{classN
3 months ago
`," ");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(`
2 months ago
`," ");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"},mV,{memo:e})}function gV({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 vV=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(U=>U.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)},[B,k]=gV({mouseEnterDelayMS:500}),R=P.useRef();P.useEffect(()=>{if(!N.typeRef)return;const U=Qg.find(Z=>Z.title===t.sourceType);x.setIcon(N.typeRef.current,U.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 U;if(B&&N.moreRef.current){if(R.current&&R.current._loaded||(U=R.current)!=null&&U.useNativeMenu||document.body.find(".more-action-btns-wrapper"))return;const Z=_(),Q=N.moreRef.current.getBoundingClientRect();Z.showAtPosition({x:Q.left,y:Q.bottom})}},200);P.useEffect(()=>{L()},[B]);const _=()=>{var Z;const U=new x.Menu;return U.dom.toggleClass(["more-action-btns-wrapper"],!0),U.useNativeMenu?(U.setNoIcon(),U.addItem(Q=>{Q.setTitle(E("COPY")).onClick(i)}),U.addItem(Q=>{Q.setTitle(E("EDIT")).onClick(l)}),U.addItem(Q=>{Q.setTitle(E("SHARE")).onClick(c)})):U.addItem(Q=>{const G=Q.dom;Q.dom.empty(),Q.dom.toggleClass(["more-action-btn-group","more-action-menu-item"],!0);const re=G.createEl("span");new x.ExtraButtonComponent(re).setIcon("copy"),re.toggleClass(["menu-item-icon","more-action-item-icon"],!0),re.onclick=$=>{$.stopPropagation(),$.preventDefault(),i(),U.close()};const de=G.createEl("span");de.toggleClass(["menu-item-icon","more-action-item-icon"],!0),de.onclick=$=>{$.stopPropagation(),$.preventDefault(),l(),U.close()},new x.ExtraButtonComponent(de).setIcon("pencil");const fe=G.createEl("span");fe.toggleClass(["menu-item-icon","more-action-item-icon"],!0),fe.onclick=$=>{$.stopPropagation(),$.preventDefault(),c(),U.close()},new x.ExtraButtonComponent(fe).setIcon("share-2")}),U.addSeparator(),U.addItem(Q=>{Q.setIcon("book-open").setTitle(E("READ")).onClick(o)}),U.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&&U.addItem(Q=>{Q.setIcon("separator-horizontal").setTitle(E("SPLIT")).onClick(y)}),U.addItem(Q=>{Q.setIcon("home").setTitle(E("SOURCE")).onClick(()=>a(t))}),U.addSeparator(),U.addItem(Q=>{Q.setWarning(!0).setIcon("archive").setTitle(E("ARCHIVE").toUpperCase()).onClick(()=>h(t))}),U.addItem(Q=>{Q.setWarning(!0).setIcon("trash").setTitle(w.DeleteThinoDirectly?E("DELETE"):E("TRASH BOX").toUpperCase().toUpperCase()).onClick(G=>{if(U.useNativeMenu)g(G),U.close();else if(G.stopPropagation(),G.preventDefault(),!D){I(!0),Q.setTitle(E("CONFIRM")).onClick(re=>{g(re),U.close()});return}})}),U.addSeparator(),U.addItem(Q=>{Q.setDisabled(!0).setTitle(ut.getWordCount(t.content.replace(/```[^\S\r\n]*[a-z]*\n.*?\n```/g,""))+` ${E("words")}`)}),U.onHide(()=>{I(!1)}),R.current=U,U},V=U=>{_().showAtMouseEvent(U.nativeEvent)};return v.jsx("div",{ref:M,className:"memo-top-right-wrapper",children:v.jsxs(
3 months ago
`),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(`
2 months ago
`),`[[${a[c]}]]`)});const i=await we.updateMemo(this.thino.id,o);i&&we.editMemo(i),this.close()}}const bV=async(e,t,n)=>{const r=n.getAttribute("href"),a=n.className;if(a.contains("tag"))SV(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")},SV=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)},DV=(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})},TV=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"))},IV=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)}}},EV=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(.thino-hidden)");$&&$.trigger("click")}dt.setMarkMemoId(l.id)},D=async()=>{var se;const $=!x.Platform.isDesktop&&await((se=window.Capacitor)==null?void 0:se.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(.thino-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)},B=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("")},R=()=>{if(h.current&&!h.current.confirmStatus){h.current&&h.current.toggleConfirm(!1);return}},L=()=>{uf(l)},_=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"))})},U=async()=>{new wV(n,l).open()},Z=$=>{$&&$.target.tagName!=="INPUT"&&I()},Q=async($,he)=>{$.preventDefault(),$.stopPropagation();const se=$.target;if($.ctrlKey||$.metaKey){await N(he);return}if(se.tagName==="A"){await bV(n,r,se);return}if(se.tagName==="IMG"){DV(f.current,se);return}if(se.tagName==="A"&&se.getAttribute("href")){const ue=se.getAttribute("href");window.open(ue,"_blank");return}if(se.className==="memo-link-text"){TV(se);return}if(se.tagName==="INPUT"&&se.hasClass("task-list-item-checkbox")){await IV(a,he,f.current,se);return}},G=$=>{const he=new x.Menu;he.dom.toggleClass("memo-context-menu",!0);const se=window.getSelection();(se==null?void 0:se.toString().length)>0&&he.addItem(ue=>{ue.setIcon("copy").setTitle(E("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(se.toString()).then(()=>{new x.Notice(E("COPY SUCCEED"))}).catch(()=>{new x.Notice(E("COPY FAILED"))})})}).addSeparator(),he.addItem(ue=>{ue.setIcon("copy").setTitle(E("Copy thino").toLocaleUpperCase()).onClick(async()=>{await V(),he.close()})}).addItem(ue=>{ue.setIcon("book-open").setTitle(E("READ")).onClick(w)}).addItem(ue=>{ue.setIcon(l.pinned?"pin-off":"pin").setTitle(l.pinned?E("UNPIN"):E("PIN")).onClick(D)}).addItem(ue=>{ue.setIcon("bookmark").setTitle(E("MARK")).onClick(S)}).addItem(ue=>{ue.setIcon("share-2").setTitle(E("SHARE")).onClick(L)}).addItem(ue=>{ue.setIcon("pencil").setTitle(E("EDIT")).onClick(I)}).addItem(ue=>{ue.setIcon("home").setTitle(E("SOURCE")).onClick(()=>N(l))}).addSeparator().addItem(ue=>{ue.setIcon("archive").setTitle(E("ARCHIVE").toLocaleUpperCase()).onClick(()=>B(l))}).addItem(ue=>{ue.setIcon("trash").setTitle(E("DELETE")).onClick(async()=>{await k()})}),he.showAtMouseEv
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _u(e,t){return p9(e)||JV(e,t)||sI(e,t)||m9()}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 KV=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}},QV=KV;const ov=qt(QV);var XV=function(){};function eW(e,t){var n={};return Object.keys(e).forEach(function(r){n[dw(r)]=XV}),n}function Xx(e,t){return e[t]!==void 0}function dw(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function tW(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function nW(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Hw(e,t)}function g9(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function v9(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function y9(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}}g9.__suppressDeprecationWarning=!0;v9.__suppressDeprecationWarning=!0;y9.__suppressDeprecationWarning=!0;function rW(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:
2 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=g9,t.componentWillReceiveProps=v9),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=y9;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 aW="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function w9(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=tW(e),o=Object.keys(t),i=o.map(dw);a||!n.length||ov(!1);var l=function(f){nW(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],B=function(R){if(y.props[N]){var L;y._notifying=!0;for(var _=arguments.length,V=new Array(_>1?_-1:0),U=1;U<_;U++)V[U-1]=arguments[U];(L=y.props)[N].apply(L,[R].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]=R,Q))}})};y.handlers[N]=B}),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 B=w.props[N];M[N]=B!==void 0?B:w.state.values[N]}),ne.createElement(e,Pr({},I,M,this.handlers,{ref:D||this.attachRef}))},h}(ne.Component);rW(l),l.displayName="Uncontrolled("+r+")",l.propTypes=Pr({innerRef:function(){}},eW(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:aW,lineNumber:128},__self:this}))}),c.propTypes=l.propTypes),c.ControlledComponent=e,c.deferControlTo=function(f,h,g){return h===void 0&&(h={}),w9(f,Pr({},t,h),g)},c}function b9(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=b9(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=b9(e))&&(r&&(r+=" "),r+=t);return r}var S9={exports:{}},BS,eM;function oW(){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 iW(){if(tM)return HS;tM=1;var e=oW();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}S9.exports=iW()();var sW=S9.exports;const ke=qt(sW);var Uw="milliseconds",iv="seconds",sv="minutes",lv="hours",Tf="day",Cp="week",uv="month",If="year",Ef="decade",Cf="century",D9={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},lW={month:1,year:12,decade:10*12,century:100*12};function uW(e){return[
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fw(e){return vW(e)||k9(e)||sI(e)||yW()}function wW(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 N9=wW;function bW(e,t){return e===t||e!==e&&t!==t}var $v=bW,SW=typeof dr=="object"&&dr&&dr.Object===Object&&dr,A9=SW,DW=A9,TW=typeof self=="object"&&self&&self.Object===Object&&self,IW=DW||TW||Function("return this")(),nu=IW,EW=nu,CW=EW.Symbol,Zp=CW,rM=Zp,F9=Object.prototype,xW=F9.hasOwnProperty,MW=F9.toString,Ig=rM?rM.toStringTag:void 0;function kW(e){var t=xW.call(e,Ig),n=e[Ig];try{e[Ig]=void 0;var r=!0}catch{}var a=MW.call(e);return r&&(t?e[Ig]=n:delete e[Ig]),a}var NW=kW,AW=Object.prototype,FW=AW.toString;function OW(e){return FW.call(e)}var PW=OW,aM=Zp,jW=NW,LW=PW,RW="[object Null]",_W="[object Undefined]",oM=aM?aM.toStringTag:void 0;function BW(e){return e==null?e===void 0?_W:RW:oM&&oM in Object(e)?jW(e):LW(e)}var qp=BW;function HW(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Qu=HW,UW=qp,YW=Qu,zW="[object AsyncFunction]",VW="[object Function]",WW="[object GeneratorFunction]",$W="[object Proxy]";function ZW(e){if(!YW(e))return!1;var t=UW(e);return t==VW||t==WW||t==zW||t==$W}var cI=ZW,qW=9007199254740991;function GW(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=qW}var dI=GW,JW=cI,KW=dI;function QW(e){return e!=null&&KW(e.length)&&!JW(e)}var Zv=QW,XW=9007199254740991,e$=/^(?:0|[1-9]\d*)$/;function t$(e,t){var n=typeof e;return t=t??XW,!!t&&(n=="number"||n!="symbol"&&e$.test(e))&&e>-1&&e%1==0&&e<t}var fI=t$,n$=$v,r$=Zv,a$=fI,o$=Qu;function i$(e,t,n){if(!o$(n))return!1;var r=typeof t;return(r=="number"?r$(n)&&a$(t,n.length):r=="string"&&t in n)?n$(n[t],e):!1}var Ob=i$,s$=/\s/;function l$(e){for(var t=e.length;t--&&s$.test(e.charAt(t)););return t}var u$=l$,c$=u$,d$=/^\s+/;function f$(e){return e&&e.slice(0,c$(e)+1).replace(d$,"")}var h$=f$;function p$(e){return e!=null&&typeof e=="object"}var sd=p$,m$=qp,g$=sd,v$="[object Symbol]";function y$(e){return typeof e=="symbol"||g$(e)&&m$(e)==v$}var qv=y$,w$=h$,iM=Qu,b$=qv,sM=NaN,S$=/^[-+]0x[0-9a-f]+$/i,D$=/^0b[01]+$/i,T$=/^0o[0-7]+$/i,I$=parseInt;function E$(e){if(typeof e=="number")return e;if(b$(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=w$(e);var n=D$.test(e);return n||T$.test(e)?I$(e.slice(2),n?2:8):S$.test(e)?sM:+e}var C$=E$,x$=C$,lM=1/0,M$=17976931348623157e292;function k$(e){if(!e)return e===0?e:0;if(e=x$(e),e===lM||e===-lM){var t=e<0?-1:1;return t*M$}return e===e?e:0}var O9=k$,N$=O9;function A$(e){var t=N$(e),n=t%1;return t===t?n?t-n:t:0}var P9=A$,F$=N9,O$=Ob,P$=P9,j$=Math.ceil,L$=Math.max;function R$(e,t,n){(n?O$(e,t,n):t===void 0)?t=1:t=L$(P$(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,i=Array(j$(r/t));a<r;)i[o++]=F$(e,a,a+=t);return i}var _$=R$;const B$=qt(_$);function Gv(e){return e&&e.ownerDocument||document}function H$(e){var t=Gv(e);return t&&t.defaultView||window}function U$(e,t){return H$(e).getComputedStyle(e,t)}var Y$=/([A-Z])/g;function z$(e){return e.replace(Y$,"-$1").toLowerCase()}var V$=/^ms-/;function A0(e){return z$(e).replace(V$,"-ms-")}var W$=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function $$(e){return!!(e&&W$.test(e))}function dp(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(A0(t))||U$(e).getPropertyValue(A0(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(A0(a)):$$(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 Z$(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function hI(e){return"window"in e&&e.window===e?e:Z$(e)&&e.defaultView||!1}function j9(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=_le(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(Hle,{event:e}),v.jsx("span",{children:n})]})}const Hle=({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","thino-hidden"),children:v.jsx("span",{className:"rbc-event-time-text",children:x.moment(e.start).format("HH:mm")})})]})})};function UF({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))}UF.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(UF,{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 Ule({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=Lle(x.moment),zle=({event:e})=>{const t=e.resource;return v.jsx(v.Fragment,{children:v.jsx(ai,{memo:t})})},Vle=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.curren
`,Jue="\uFEFF",e8=e=>Object.assign({},que,e);let Kue=class extends Error{constructor(t){super(t),this.name="CsvGenerationError"}},Que=class extends Error{constructor(t){super(t),this.name="EmptyHeadersError"}};var ey=e=>e,Ys=e=>e,Jb=ey,Mp=ey,C3=ey,x3=ey,Xue=function(e,t){return t=='"'&&e.indexOf('"')>-1?e.replace(/"/g,'""'):e},ece=e=>C3(typeof e=="object"?e.key:e),tce=e=>x3(typeof e=="object"?e.displayLabel:e),nce=(e,...t)=>t.reduce((n,r)=>r(n),e),rce=e=>t=>e.useBom?Jb(Ys(t)+Jue):t,ace=e=>t=>e.showTitle?UI(Jb(Ys(t)+e.title))(Mp("")):t,UI=e=>t=>Jb(Ys(e)+Ys(t)+Gue),t8=e=>(t,n)=>oce(e)(Mp(t+n)),oce=e=>t=>ey(Ys(t)+e.fieldSeparator),ice=(e,t)=>n=>{if(!e.showColumnHeaders)return n;if(t.length<1)throw new Que("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=tce(t[a]);r=t8(e)(r,n8(e,o))}return r=Mp(Ys(r).slice(0,-1)),UI(n)(r)},sce=(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=ece(t[l]),f=typeof n[o][Ys(c)]>"u"?e.replaceUndefinedWith:n[o][Ys(c)];i=t8(e)(i,n8(e,f))}i=Mp(Ys(i).slice(0,-1)),a=UI(a)(i)}return a},lce=Ys,M3=e=>+e===e&&(!isFinite(e)||!!(e%1)),n8=(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+Xue(t,e.quoteCharacter)+e.quoteCharacter),n}if(typeof t=="boolean"&&e.boolDisplay){const n=t?"true":"false";return e.boolDisplay[n]}return t},uce=e=>t=>{const n=e8(e),r=n.useKeysAsHeaders?Object.keys(t[0]):n.columnHeaders;let a=nce(Jb(""),rce(n),ace(n),ice(n,r),sce(n,r,t));if(Ys(a).length<1)throw new Kue("Output is empty. Is your data formatted correctly?");return a};const cce=({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})},dce=({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"})})},fce=({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"})]})},hce=({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=Uue(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=Vue((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},pce=e8({fieldSeparator:",",decimalSeparator:".",useKeysAsHeaders:!0}),mce=e=>e+`
`;function gce({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(dce,{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(hce,{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(cce,{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(fce,{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=Rue({data:l,columns:i,filterFns:{fuzzy:k3},initialState:{pagination:{pageSize:20}},state:{columnFilters:n,globalFilter:a},onColumnFiltersChange:r,onGlobalFilterChange:o,globalFilterFn:k3,getCoreRowModel:Iue(),getFilteredRowModel:xue(),getSortedRowModel:Aue(),getPaginationRowModel:Oue(),getFacetedRowModel:Mue(),getFacetedUniqueValues:kue(),getFacetedMinMaxValues:Nue(),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"),B=E("Path"),k=S.map(U=>({[I]:U.createdAt,[M]:U.updatedAt,[N]:U.content,Thino:`=hyperlink("obsidian://thino?openId=${U.id}","${U.id}")`,[B]:`=hyperlink("obsidian://open?path=${x.normalizePath(U.path)},"${U.path}")`})),R=uce(pce)(k),L=ft.getState().app||window.app,_=mce(lce(R));return{file:await L.vault.create(`${D}-${ut.randomId(6)}.csv`,_),app:L}}async function y(S){const{file:D,app:I}=await g(S.map(B=>B.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(B=>{B.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(yce,{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 Ul(e,t){return Pfe(e)||Gye(e,t)||T5(e,t)||dwe()}var I5={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})()})(I5);var fwe=I5.exports;const wE=qt(fwe);var E5={exports:{}},OD,Kk;function hwe(){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 pwe(){if(Qk)return PD;Qk=1;var e=hwe();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}E5.exports=pwe()();var mwe=E5.exports;const kn=qt(mwe);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 gwe(){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 vwe(e){return P.useContext(Xk[e]||Xk[0])}function ywe(){var e=vwe(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 wwe(){return P.useContext(m1)}function IE(){var e=wwe(),t=e.styleToClassName;return t}var bwe={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=ywe(),o=Ul(a,1),i=o[0],l=IE()(bwe),c=gwe();return!i&&ne.createElement("button",{className:wE(l,(r||"")+""),onClick:c,type:"button"},n)};EE.defaultProps={children:void 0,className:""};EE.propTypes={children:kn.any,className:kn.string};var C5={exports:{}},Swe=Gn,Dwe=ii,e4=$s.f;Swe({target:"Object",stat:!0,forced:Object.defineProperty!==e4,sham:!Dwe},{defineProperty:e4});var Twe=qa,x5=Twe.Object,Iwe=C5.exports=function(t,n,r){return x5.defineProperty(t,n,r)};x5.defineProperty.sham&&(Iwe.sham=!0);var Ewe=C5.exports,Cwe=Ewe,M5=Cwe,xwe=M5,Mwe=xwe,kwe=Mwe,Nwe=kwe,Awe=Nwe;const Fwe=qt(Awe);var Owe=ly,Pwe=Owe.f("iterator"),jwe=Pwe,Lwe=jwe,Rwe=Lwe,_we=Rwe,Bwe=_we,Hwe=Bwe,Uwe=Hwe;const Ywe=qt(Uwe);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 zwe=ly,Vwe=zwe.f("toPrimitive"),Wwe=Vwe,$we=Wwe,Zwe=$we,qwe=Zwe,Gwe=qwe,Jwe=Gwe,Kwe=Jwe;const Qwe=qt(Kwe);function Xwe(e,t){if(yv(e)!="object"||!e)return e;var n=e[Qwe];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 Cn(e){return nbe(e)||rbe(e)||T5(e)||abe()}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}},obe=Zs,Rf=!obe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),k5={},N5={}.propertyIsEnumerable,A5=Object.getOwnPropertyDescriptor,ibe=A5&&!N5.call({1:2},1);k5.f=ibe?function(t){var n=A5(this,t);return!!n&&n.enumerable}:N5;var F5=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},sbe={}.toString,xE=function(e){return sbe.call(e).slice(8,-1)},lbe=Zs,ube=xE,cbe="".split,dbe=lbe(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return ube(e)=="String"?cbe.call(e,""):Object(e)}:Object,g1=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},fbe=dbe,hbe=g1,ME=function(e){return fbe(hbe(e))},ls=function(e){return typeof e=="function"},pbe=ls,fy=function(e){return typeof e=="object"?e!==null:pbe(e)},jD=Oi,mbe=ls,gbe=function(e){return mbe(e)?e:void 0},v1=function(e,t){return arguments.length<2?gbe(jD[e]):jD[e]&&jD[e][t]},vbe=v1,ybe=vbe("navigator","userAgent")||"",O5=Oi,LD=ybe,t4=O5.process,n4=O5.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 wbe=tb&&+tb,o4=wbe,bbe=Zs,P5=!!Object.getOwnPropertySymbols&&!bbe(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&o4&&o4<41}),Sbe=P5,j5=Sbe&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Dbe=ls,Tbe=v1,Ibe=j5,L5=Ibe?function(e){return typeof e=="symbol"}:function(e){var t=Tbe("Symbol");return Dbe(t)&&Object(e)instanceof t},Ebe=function(e){try{return String(e)}catch{return"Object"}},Cbe=ls,xbe=Ebe,Mbe=function(e){if(Cbe(e))return e;throw TypeError(xbe(e)+" is not a function")},kbe=Mbe,R5=function(e,t){var n=e[t];return n==null?void 0:kbe(n)},RD=ls,_D=fy,Nbe=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")},_5={exports:{}},i4=Oi,kE=function(e,t){try{Object.defineProperty(i4,e,{value:t,configurable:!0,writable:!0})}catch{i4[e]=t}return t},Abe=Oi,Fbe=kE,s4="__core-js_shared__",Obe=Abe[s4]||Fbe(s4,{}),NE=Obe,l4=NE;(_5.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=_5.exports,Pbe=g1,B5=function(e){return Object(Pbe(e))},jbe=B5,Lbe={}.hasOwnProperty,_f=Object.hasOwn||function(t,n){return Lbe.call(jbe(t),n)},Rbe=0,_be=Math.random(),H5=function(e){return"Symbol("+String(e===void 0?"":e)+")_"+(++Rbe+_be).toString(36)},Bbe=Oi,Hbe=AE,u4=_f,Ube=H5,c4=P5,Ybe=j5,Mg=Hbe("wks"),Zg=Bbe.Symbol,zbe=Ybe?Zg:Zg&&Zg.withoutSetter||Ube,hy=function(e){return(!u4(Mg,e)||!(c4||typeof Mg[e]=="string"))&&(c4&&u4(Zg,e)?Mg[e]=Zg[e]:Mg[e]=zbe("Symbol."+e)),Mg[e]},d4=fy,f4=L5,Vbe=R5,Wbe=Nbe,$be=hy,Zbe=$be("toPrimitive"),qbe=function(e,t){if(!d4(e)||f4(e))return e;var n=Vbe(e,Zbe),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"),Wbe(e,t)},Gbe=qbe,Jbe=L5,U5=function(e){var t=Gbe(e,"string");return Jbe(t)?t:String(t)},Kbe=Oi,h4=fy,l2=Kbe.document,Qbe=h4(l2)&&h4(l2.createElement),Y5=function(e){return Qbe?l2.createElement(e):{}},Xbe=Rf,e1e=Zs,t1e=Y5,z5=!Xbe&&!e1e(function(){return Object.defineProperty(t1e("div"),"a",{get:function(){return 7}}).a!=7}),n1e=Rf,r1e=k5,a1e=F5,o1e=ME,i1e=U5,s1e=_f,l1e=z5,p4=Object.getOwnPropertyDescriptor;CE.f=n1e?p4:function(t,n){if(t=o1e(t),n=i1e(n),l1e)
`)&&e.flags==="s")}),vDe=Zs,yDe=Oi,wDe=yDe.RegExp,bDe=vDe(function(){var e=wDe("(?<a>b)","g");return e.exec("b").groups.a!=="b"||"b".replace(e,"$<a>c")!=="bc"}),SDe=b1,DDe=nO,M4=RE,TDe=AE,IDe=fDe,EDe=Z5.get,CDe=gDe,xDe=bDe,ab=RegExp.prototype.exec,MDe=TDe("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}(),sO=M4.UNSUPPORTED_Y||M4.BROKEN_CARET,m2=/()??/.exec("")[1]!==void 0,kDe=p2||m2||sO||CDe||xDe;kDe&&(h2=function(t){var n=this,r=EDe(n),a=SDe(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=sO&&n.sticky,D=DDe.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&&MDe.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=IDe(null),h=0;h<w.length;h++)y=w[h],g[y[0]]=f[y[1]];return f});var _E=h2,NDe=RSe,k4=_E;NDe({target:"RegExp",proto:!0,forced:/./.exec!==k4},{exec:k4});var N4=my,ADe=_E,A4=Zs,lO=hy,FDe=y1,ODe=lO("species"),VD=RegExp.prototype,PDe=function(e,t,n,r){var a=lO(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[ODe]=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===ADe||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&&FDe(VD[a],"sham",!0)},jDe=w1,LDe=b1,RDe=g1,F4=function(e){return function(t,n){var r=LDe(RDe(t)),a=jDe(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)}},_De={codeAt:F4(!1),charAt:F4(!0)},BDe=_De.charAt,HDe=function(e,t,n){return t+(n?BDe(e,t).length:1)},UDe=B5,YDe=Math.floor,zDe="".replace,VDe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,WDe=/\$([$&'`]|\d{1,2})/g,$De=function(e,t,n,r,a,o){var i=n+e.length,l=r.length,c=WDe;return a!==void 0&&(a=UDe(a),c=VDe),zDe.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})},ZDe=ud,qDe=ls,GDe=xE,JDe=_E,KDe=function(e,t){var n=e.exec;if(qDe(n)){var r=n.call(e,t);return r!==null&&ZDe(r),r}if(GDe(e)==="RegExp")return JDe.call(e,t);throw TypeError("RegExp#exec called on incompatible receiver")},QDe=PDe,XDe=Zs,eTe=ud,tTe=ls,nTe=w1,rTe=K5,up=b1,aTe=g1,oTe=HDe,iTe=R5,sTe=$De,lTe=KDe,uTe=hy,g2=uTe("replace"),cTe=Math.max,dTe=Math.min,fTe=function(e){return e===void 0?e:String(e)},hTe=function(){return"a".replace(/./,"$0")==="$0"}(),O4=function(){return/./[g2]?/./[g2]("a","$0")==="":!1}(),pTe=!XDe(function(){var e=/./;return e.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(e,"$<a>")!=="7"});QDe("replace",function(e,t,n){var r=O4?"$":"$0";return[function(o,i){var l=aTe(this),c=o==null?void 0:iTe(o,g2);return c?c.call(o,l,i):t.call(up(l),o,i)},function(a,o){var i=eTe(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=tTe(o);f||(o=up(o));var h=i.global;if(h){var g=i.unicode;i.lastIndex=0}for(var y=[];;){var w=lTe(i,l);if(w===null||(y.push(w),!h))break;var S=up(w[0]);S===""&&(i.lastIndex=oTe(l,rTe(i.lastIndex),g))}for(var D="",I=0,M=0;M<y.length;M++){w=y[M];for(var N=up(w[0]),B=cTe(dTe(nTe(w.index),l.length),0),k=[],R=1;R<w.length;R++)k.push(fTe(w[R]));var L=w.groups;if(f){var _=[N].concat(k,B,l);L!==void 0&&_.push(L);var V=up(o.apply(void 0,_))}else V=sTe(N,l,B,k,L,o);B>=I&&(D+=l.slice(I,B)+V,I=B+N.length)}return D+l.slice(I)}]},!pTe||!hTe||O4);var mTe=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",gTe=TypeError,vTe=function(e,t){if(e<t)throw new gTe("Not enough arguments");return e},uO=Za,yTe=YI,wTe=co,bTe=mTe,STe=c8,DTe=i1,TTe=vTe,ITe=uO.Function,ETe=/MSIE .\./.test(STe)||bTe&&function(){var e=uO.Bun.version.split(".");return e.length<3||e[0]==="0"&&(e[1]<3||e[1]==="3"&&e[2]==="0")}(),cO=function(e,t){var n=t?2:1;return ETe?function(r,a){var o=TTe(arguments.length,1)>n,i=wTe(r)?r:ITe(r),l=o?DTe(arguments,n):[],c=o?function()
`,L.current,t.path,a||e.view)}he(),setTimeout(async()=>{await G()},cA)},[R,L,l,M]);const G=async()=>{R.current&&(await pxe(R.current),await qE(R.current),mxe(M).then(he=>{he&&setTimeout(()=>{kb(R.current,{pixelRatio:window.devicePixelRatio*2}).then(se=>{k(se),f(!0)}).catch(()=>{})},600)}))},re=()=>{n()},de=P.useCallback(he=>{w(he)},[y]),fe=async()=>{const{vault:he}=Le.getState().dailyNotesState.app,se=R.current.querySelector(".memo-shortcut-img");if(!se)return;const ue=se==null?void 0:se.getAttribute("src").split("base64,")[1],X=sN(ue,"image/png");let oe;X.arrayBuffer().then(async De=>{const je="png",Re=Ju();for(const Fe in Re)if(Re[Fe]instanceof x.TFile){oe=Re[Fe];break}if(oe!==void 0){const Fe=await he.getAvailablePathForAttachments(`Pasted Image ${x.moment().format("YYYYMMDDHHmmss")}`,je,oe);await he.createBinary(Fe,De),new x.Notice(E("Save image successfully"))}})},$=async()=>{de(!0);const he=R.current.querySelector(".memo-shortcut-img");if(!he)return;const se=he==null?void 0:he.getAttribute("src").split("base64,")[1],ue=sN(se,"image/png");if(!ue){new x.Notice(E("Copy to clipboard failed"));return}const X=new ClipboardItem({"image/png":ue});window.navigator.clipboard.write([X]).then(()=>{setTimeout(()=>{de(!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:re})]})]}),v.jsxs("div",{className:ar("dialog-content-container",M),children:[v.jsx("div",{className:`tip-words-container ${B?"finish":"loading"}`,children:v.jsx("p",{className:"tip-text",children:E(B?"↗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:R,children:[v.jsx(ts,{when:B!=="",children:v.jsx("img",{className:"memo-shortcut-img",onClick:$,src:B})}),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("${_}")`}}),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=(R=i.current)==null?void 0:R.querySelectorAll(".internal-link");B==null||B.forEach(L=>{const _=L,V=_.getAttribute("data-href");if(!V)return;t.metadataCache.getFirstLinkpathDest(V,a.path)||L.classList.add("is-unresolved"),_.addEventListener("mouseover",Z=>{Z.stopPropagation(),t.workspace.trigger("hover-link",{event:Z,source:"thino",hoverParent:r.containerEl,targetEl:_,linktext:V,sourcePath:_.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}))},yxe=({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:"))},wxe=()=>{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=yxe({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=
${de.content.split(`
7 months ago
`).map($=>$.trim()?`> ${$}
8 months ago
`:`>
`)}
7 months ago
`+(fe===t.length-1?`
8 months ago
`:`
8 months ago
------
2 months ago
`)});const re={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(re,"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 R()}).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 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"/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(U.nativeEvent)};return v.jsxs("div",{className:`filter-query-container ${S?"":"thino-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?"":"thino-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?"":"thino-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?"":"thino-hidden"),onClick:()=>{at.setMemoTypeQuery("")},children:[v.jsx("span",{className:"icon-text",children:"📦"})," ",dU(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:U=>{const Z=x.moment(c.to,"x"),Q=x.moment(U,"x"),G=Q.isAfter(Z)||Q.isSame(Z);at.setFromAndToQuery(G?Z.startOf("day").valueOf():x.moment(U,"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:U=>{const Z=x.moment(c.from,"x"),Q=x.moment(U,"x"),G=Q.isBefore(Z)||Q.isSame(Z),re=x.moment(U,"x").endOf("day").valueOf();at.setFromAndToQuery(c.from,G?Z.endOf("day").valueOf():re)}})]}),v.jsx("div",{ref:U=>U&&x.setIcon(U,"x"),className:"btn close-btn",onClick:()=>{at.setFromAndToQuery(0,0)}})]}),v.jsxs("div",{className:"filter-item-container "+(h?"":"thino-hidden"),onClick:()=>{at.setTextQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🔍"})," ",h]}),v.jsxs("div",{className:"filter-item-container "+(y?"":"thino-hidden"),onClick:()=>{at.setPathQuery("")},children:[v.jsx("span",{className:"icon-text",children:"📦"})," ",v.jsx("span",{className:"path-text",children:y})]})]}),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 n_(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++){cons
7 months ago
`&&A.push(`
2 months ago
`),Ie!==null&&A.push(S(""+Ie)),null;case"input":A.push(G("input")),ct=$t=it=Ie=null;for(Ye in K)if(n.call(K,Ye)&&(Ft=K[Ye],Ft!=null))switch(Ye){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,ie,Ye,Ft)}return $t!==null?L(A,ie,"checked",$t):ct!==null&&L(A,ie,"checked",ct),Ie!==null?L(A,ie,"value",Ie):it!==null&&L(A,ie,"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,ie,Ga,Ie)}return A.push(">"),null;case"title":A.push(G("title")),Ie=null;for(Pn in K)if(n.call(K,Pn)&&(Ye=K[Pn],Ye!=null))switch(Pn){case"children":Ie=Ye;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:L(A,ie,Pn,Ye)}return A.push(">"),Ie;case"listing":case"pre":A.push(G(Y)),Ye=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":Ye=it;break;default:L(A,ie,ct,it)}if(A.push(">"),Ye!=null){if(Ie!=null)throw Error(t(60));if(typeof Ye!="object"||!("__html"in Ye))throw Error(t(61));K=Ye.__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(`
2 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(Y));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,Y));default:L(A,ie,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 U(A,K,Y,ie);case"html":return Ne.insertionMode===0&&A.push("<!DOCTYPE html>"),U(A,K,Y,ie);default:if(Y.indexOf("-")===-1&&typeof K.is!="string")return U(A,K,Y,ie);A.push(G(Y)),Ye=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":Ye=it;break;case"style":R(A,ie,it);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:i(Ft)&&typeof it!="function"&&typeof it!="symbol"&&A.push(" ",Ft,'="',S(it),'"')}return A.push(">"),_(A,Ye,Ie),Ie}}function de(A,Y,K){if(A.push('<!--$?--><template id="'),K===null)throw Error(t(395));return A.push(K),A.push('"></template>')}function fe(A,Y,K,ie){switch(K.insertionMode){case 0:case 1:return A.push('<div hidden id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 2:return A.push('<svg aria-hidden="true" style="display:none" id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 3:return A.push('<math aria-hidden="true" style="display:none" id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 4:return A.push('<table hidden id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 5:return A.push('<table hidden><tbody id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 6:return A.push('<table hidden><tr id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');case 7:return A.push('<table hidden><colgroup id="'),A.push(Y.segmentPrefix),Y=ie.toString(16),A.push(Y),A.push('">');default:throw Error(t(397))}}function $(A,Y){switch(Y.insertionMode){case 0:case 1:return A.push("</div>");case 2:return A.push("</svg>");case 3:return A.push("</math>");case 4:return A.push("</table>");case 5:return A.push("</tbody></table>");case 6:return A.push("</tr></table>");case 7:return A.push("</colgroup></table>");default:throw Error(t(397))}}var he=/[<\u2028\u2029]/g;function se(A){return JSON.stringify(A).replace(he,function(Y){switch(Y){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function ue(A,Y){return Y=Y===void 0?"":Y,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:Y+"P:",segmentPrefix:Y+"S:",boundaryPrefix:Y+"B:",idPrefix:Y,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:A}}function X(A,Y,K,ie){return K.generateStaticMarkup?(A.push(S(Y)),!1):(Y===""?A=ie:(ie&&A.push("<!-- -->"),A.push(S(Y)),A=!0),A)}var oe=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
`),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 Dn(F,H,q,ae,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,ae,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,ae,Ee,Hn)}}if(Ve!=null)if(q=It!==null?""+It:Tt(ot),Z(Ve)){for(ae=0;ae<Ve.length;ae++)if(""+Ve[ae]===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,ae,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]===`
`&&F.push(Vt),Ee!==null&&F.push(c(_(""+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,ae,Ve,Kt)}return Rt!==null?et(F,ae,"checked",Rt):It!==null&&et(F,ae,"checked",It),Ee!==null?et(F,ae,"value",Ee):ot!==null&&et(F,ae,"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,ae,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,ae,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,ae,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]===`
2 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,ae,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,ae);case"html":return Ae.insertionMode===0&&F.push(Zn),_t(F,q,H,ae);default:if(H.indexOf("-")===-1&&typeof q.is!="string")return _t(F,q,H,ae);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,ae,ot);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:D(Kt)&&typeof ot!="function"&&typeof ot!="symbol"&&F.push(st,c(Kt),Ct,c(_(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="'),Ue=f('">'),He=f("</div>"),Qe=f('<svg aria-hidden="true" style="display:none" id="'),tt=f('">'),kt=f("</svg>"),Ut=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,ae){switch(q.insertionMode){case 0:case 1:return a(F,xe),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,Ue);case 2:return a(F,Qe),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,tt);case 3:return a(F,Ut),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,On);case 4:return a(F,Cr),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,Jn);case 5:return a(F,ta),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,Pi);case 6:return a(F,Aa),a(F,H.segmentPrefix),a(F,c(ae.toString(16))),o(F,Fa);case 7:return a(F,fo),a(F,H.segmentPrefix),a(F,c(ae.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=(B=o.current)==null?void 0:B.querySelectorAll(".internal-link");N==null||N.forEach(k=>{const R=k,L=R.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||k.classList.add("is-unresolved"),R.addEventListener("mouseover",V=>{V.stopPropagation(),r.app.workspace.trigger("hover-link",{event:V,source:"thino",hoverParent:I.containerEl,targetEl:R,linktext:L,sourcePath:R.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()}})]})},Qxe=({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:"))},Xxe=()=>{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=Qxe({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)}
8 months ago
* **开源项目**
* 😋 精美且细节的视觉样式
2 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 thino-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)"})})]})]})},tMe=()=>{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(eMe,{})})]})},nMe=()=>{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:R,HideDoneTasks:L})=>{const{tag:_,duration:V,type:U,text:Z,filter:Q}=R,G=on.getQueryById(Q);return!!(_||V&&V.from<V.to||U||Z||G)||G||L?k.filter(de=>{let fe=!0;if(de.thinoType!==void 0&&L&&de.thinoType==="TASK-DONE"&&(fe=!1),de.content.contains("comment:")&&(fe=!1),G){const $=JSON.parse(G.querystring);Array.isArray($)&&(fe=Vp(de,$))}if(_){const $=new Set;for(const he of Array.from(de.content.match($r)||[])){const ue=he.replace($r,"$1").trim().split("/");let X="";for(const oe of ue)X+=oe,$.add(X),X+="/"}for(const he of Array.from(de.content.match(ua)||[])){const ue=he.replace(ua,"$1").trim().split("/");let X="";for(const oe of ue)X+=oe,$.add(X),X+="/"}for(const he of Array.from(de.content.match(Wa)||[])){const ue=he.replace(Wa,"$2").trim().split("/");let X="";for(const oe of ue)X+=oe,$.add(X),X+="/"}$.has(_)||(fe=!1)}return V&&V.from<V.to&&(ut.getTimeStampByDate(de.createdAt)<V.from||ut.getTimeStampByDate(de.createdAt)>V.to)&&(fe=!1),U&&(U==="NOT_TAGGED"&&(de.content.mat
${L}`}}}let M=h;M||(M=t.MemoSaveLocation),(B=e.settings)!=null&&B.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"?`
2 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 j3e{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 j3e;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(()=>{L3e(jN,jN=mr==null?void 0:mr.readText())&&cp.emit("text-changed"),R3e(LN,LN=mr==null?void 0:mr.readImage())&&cp.emit("image-changed")},500)),mr),mr.stopWatching=()=>(Pg&&clearInterval(Pg),Pg=null,mr));function L3e(e,t){return t&&e!==t}function R3e(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 _3e{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 CP(e,y,w=>{c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w,f()}).open();break}case"selectTags":new Ez(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 fke=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)}
2 months ago
\`\`\``),new x.Notice(E("Debug info copied to clipboard"))}catch(t){console.error(t)}}class hke 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=fke(this.app),ft.setPlugin(this),await this.loadSettings(),gMe(),this.registerRibbon(),await this.verify();try{this.settings.ShowUpdateMessage&&await this.checkVersionAndShowChangeLog()}catch(n){console.error(n)}this.settingTab=new kMe(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 hMe(this.app,this)),this.registerEditorExtension([E3e]),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;M3e(h,this.app),k3e(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 fP();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 YN(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:()=>{Txe(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
2 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:f}=await ske(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