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

5 months ago
"use strict";var YL=Object.defineProperty;var UL=(e,t,n)=>t in e?YL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Se=(e,t,n)=>(UL(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("obsidian"),vS=require("@codemirror/language"),qg=require("@codemirror/state"),Wl=require("@codemirror/view");function zL(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 YN={exports:{}},pg={},UN={exports:{}},gn={},Ex;function VL(){if(Ex)return gn;Ex=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(X){return X===null||typeof X!="object"?null:(X=g&&X[g]||X["@@iterator"],typeof X=="function"?X:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,D={};function I(X,ae,De){this.props=X,this.context=ae,this.refs=D,this.updater=De||w}I.prototype.isReactComponent={},I.prototype.setState=function(X,ae){if(typeof X!="object"&&typeof X!="function"&&X!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,ae,"setState")},I.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function M(){}M.prototype=I.prototype;function N(X,ae,De){this.props=X,this.context=ae,this.refs=D,this.updater=De||w}var _=N.prototype=new M;_.constructor=N,S(_,I.prototype),_.isPureReactComponent=!0;var k=Array.isArray,B=Object.prototype.hasOwnProperty,L={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function V(X,ae,De){var je,Re={},Fe=null,Be=null;if(ae!=null)for(je in ae.ref!==void 0&&(Be=ae.ref),ae.key!==void 0&&(Fe=""+ae.key),ae)B.call(ae,je)&&!R.hasOwnProperty(je)&&(Re[je]=ae[je]);var Xe=arguments.length-2;if(Xe===1)Re.children=De;else if(1<Xe){for(var Ze=Array(Xe),st=0;st<Xe;st++)Ze[st]=arguments[st+2];Re.children=Ze}if(X&&X.defaultProps)for(je in Xe=X.defaultProps,Xe)Re[je]===void 0&&(Re[je]=Xe[je]);return{$$typeof:e,type:X,key:Fe,ref:Be,props:Re,_owner:L.current}}function Y(X,ae){return{$$typeof:e,type:X.type,key:ae,ref:X.ref,props:X.props,_owner:X._owner}}function Z(X){return typeof X=="object"&&X!==null&&X.$$typeof===e}function Q(X){var ae={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(De){return ae[De]})}var G=/\/+/g;function le(X,ae){return typeof X=="object"&&X!==null&&X.key!=null?Q(""+X.key):ae.toString(36)}function se(X,ae,De,je,Re){var Fe=typeof X;(Fe==="undefined"||Fe==="boolean")&&(X=null);var Be=!1;if(X===null)Be=!0;else switch(Fe){case"string":case"number":Be=!0;break;case"object":switch(X.$$typeof){case e:case t:Be=!0}}if(Be)return Be=X,Re=Re(Be),X=je===""?"."+le(Be,0):je,k(Re)?(De="",X!=null&&(De=X.replace(G,"$&/")+"/"),se(Re,ae,De,"",function(st){return st})):Re!=null&&(Z(Re)&&(Re=Y(Re,De+(!Re.key||Be&&Be.key===Re.key?"":(""+Re.key).replace(G,"$&/")+"/")+X)),ae.push(Re)),1;if(Be=0,je=je===""?".":je+":",k(X))for(var Xe=0;Xe<X.length;Xe++){Fe=X[Xe];var Ze=je+le(Fe,Xe);Be+=se(Fe,ae,De,Ze,Re)}else if(Ze=y(X),typeof Ze=="function")for(X=Ze.call(X),Xe=0;!(Fe=X.next()).done;)Fe=Fe.value,Ze=je+le(Fe,Xe++),Be+=se(Fe,ae,De,Ze,Re);else if(Fe==="object")throw ae=String(X),Error("O
6 months ago
`);o.length===0&&await e.vault.adapter.write(cf(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=C.moment().format("YYYY/MM/DD HH:mm:ss"),w="[]";const S=g.match(/^\d{14,16}/);S&&(y=C.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(cf(e),JSON.stringify({queries:i},null,2))}},SR=async()=>{const{app:e}=Le.getState().dailyNotesState;return await lA(e,cf(e))||await uA(e),await jp(e)||[]},DR=(e,t)=>({createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:E("Temp Filter"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),TR=async(e,t)=>{const n=await jp(Le.getState().dailyNotesState.app)||[],r={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:C.moment().format("YYYYMMDDHHmmss")+n.length,pinnedAt:"",querystring:t,title:e,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"};return n.push(r),await kv(Le.getState().dailyNotesState.app,n),r};var Tw={exports:{}};Tw.exports;(function(e,t){(function(){var n,r="4.17.21",a=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",l="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",g=1,y=2,w=4,S=1,D=2,I=1,M=2,N=4,_=8,k=16,B=32,L=64,R=128,V=256,Y=512,Z=30,Q="...",G=800,le=16,se=1,fe=2,$=3,he=1/0,ie=9007199254740991,ce=17976931348623157e292,X=NaN,ae=4294967295,De=ae-1,je=ae>>>1,Re=[["ary",R],["bind",I],["bindKey",M],["curry",_],["curryRight",k],["flip",Y],["partial",B],["partialRight",L],["rearg",V]],Fe="[object Arguments]",Be="[object Array]",Xe="[object AsyncFunction]",Ze="[object Boolean]",st="[object Date]",xt="[object DOMException]",tn="[object Error]",_e="[object Function]",et="[object GeneratorFunction]",nt="[object Map]",ht="[object Number]",St="[object Null]",Tt="[object Object]",Gt="[object Promise]",_t="[object Proxy]",Vt="[object RegExp]",Xt="[object Set]",dn="[object String]",en="[object Symbol]",Zn="[object Undefined]",kn="[object WeakMap]",Er="[object WeakSet]",pt="[object ArrayBuffer]",Mt="[object DataView]",Jt="[object Float32Array]",sn="[object Float64Array]",ln="[object Int8Array]",vr="[object Int16Array]",fr="[object Int32Array]",ha="[object Uint8Array]",jr="[object Uint8ClampedArray]",nr="[object Uint16Array]",Lr="[object Uint32Array]",te=/\b__p \+= '';/g,me=/\b(__p \+=) '' \+/g,Ce=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ye=/&(?:amp|lt|gt|quot|#39);/g,He=/[&<>"']/g,Qe=RegExp(Ye.source),tt=RegExp(He.source),kt=/<%-([\s\S]+?)%>/g,Yt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xr=/^\w*$/,Jn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yr=/[\\^$.*+?()[\]{}|]/g,ta=RegExp(yr.source),Pi=/^\s+/,Nn=/\s/,Aa=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Fa=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,fo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Oa=/[()=,{}\[\]\/\s]/,au=/\\(\\)?/g,si=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,li=/\w*$/,ec=/^[-+]0x[0-9a-f]+$/i,ou=/^0b[01]+$/i,us=/^\[object .+?Constructor\]$/,ji=/^0o[0-7]+$/i,cs=/^(?:0|[1-9]\d*)$/,iu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ds=/($^)/,tc=/['\n\r\u2028\u2029\\]/g,An="\\ud800-\\udfff",na="\\u0300-\\u036f",qs="\\ufe20-\\ufe2f",Gs="\\u20d0-\\u20ff",ui=na+qs+Gs,su="\\u2700-\\u27bf",Fo="a-z\\xdf-\\xf6\\xf8-\\xff",ho="\\xac\\xb1\\xd7\\xf7",Pa="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",fs="\\u2000-\\u206f",Rr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Js="A-Z\\xc0-\\xd6\\xd8-\\xde",Ks="\\ufe0e\\ufe0f",Qs=ho+Pa+fs+Rr,po="[']",hs="["+An+"]",ci="["+Qs+"]",mo="["+ui+"]",A="\\d+",U="["+su+"]",K="["+Fo+"]",oe="[^"+An+Qs+A+su+Fo+Js+
7 months ago
/* [wrapped with `+p+`] */
6 months ago
`)}function V1(d){return an(d)||Kd(d)||!!(Dy&&d&&d[Dy])}function Vo(d,p){var T=typeof d;return p=p??ie,!!p&&(T=="number"||T!="symbol"&&cs.test(d))&&d>-1&&d%1==0&&d<p}function Fn(d,p,T){if(!Sr(T))return!1;var j=typeof p;return(j=="number"?Zo(T)&&Vo(p,T.length):j=="string"&&p in T)?Ns(T[p],d):!1}function Wm(d,p){if(an(d))return!1;var T=typeof d;return T=="number"||T=="symbol"||T=="boolean"||d==null||Di(d)?!0:xr.test(d)||!yn.test(d)||p!=null&&d in Yn(p)}function wt(d){var p=typeof d;return p=="string"||p=="number"||p=="symbol"||p=="boolean"?d!=="__proto__":d===null}function Dl(d){var p=zd(d),T=J[p];if(typeof T!="function"||!(p in nn.prototype))return!1;if(d===T)return!0;var j=Ud(T);return!!j&&d===j[0]}function $m(d){return!!zf&&zf in d}var Ky=dc?Nu:gS;function Vd(d){var p=d&&d.constructor,T=typeof p=="function"&&p.prototype||Hi;return d===T}function Oc(d){return d===d&&!Sr(d)}function Wd(d,p){return function(T){return T==null?!1:T[d]===p&&(p!==n||d in Yn(T))}}function Zm(d){var p=ye(d,function(j){return T.size===f&&T.clear(),j}),T=p.cache;return p}function Qy(d,p){var T=d[1],j=p[1],z=T|j,ee=z<(I|M|R),de=j==R&&T==_||j==R&&T==V&&d[7].length<=p[8]||j==(R|V)&&p[7].length<=p[8]&&T==_;if(!(ee||de))return d;j&I&&(d[2]=p[2],z|=T&I?0:N);var ve=p[3];if(ve){var Te=d[3];d[3]=Te?jm(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?Sh(Te,ve,p[6]):ve,d[6]=Te?_o(d[5],h):p[6]),ve=p[7],ve&&(d[7]=ve),j&R&&(d[8]=d[8]==null?p[8]:ma(d[8],p[8])),d[9]==null&&(d[9]=p[9]),d[0]=p[0],d[1]=z,d}function Xy(d){var p=[];if(d!=null)for(var T in Yn(d))p.push(T);return p}function e0(d){return wd.call(d)}function kh(d,p,T){return p=kr(p===n?d.length-1:p,0),function(){for(var j=arguments,z=-1,ee=kr(j.length-p,0),de=Oe(ee);++z<ee;)de[z]=j[p+z];z=-1;for(var ve=Oe(p+1);++z<p;)ve[z]=j[z];return ve[p]=T(de),Cr(d,this,ve)}}function Nh(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=qm(Br),Pc=pm||function(d,p){return zn.setTimeout(d,p)},Ah=qm(hh);function Wo(d,p,T){var j=p+"";return Ah(d,z1(j,n0(zm(j),T)))}function qm(d){var p=0,T=0;return function(){var j=B1(),z=le-(j-T);if(T=j,z>0){if(++p>=G)return arguments[0]}else p=0;return d.apply(n,arguments)}}function To(d,p){var T=-1,j=d.length,z=j-1;for(p=p===n?j:p;++T<p;){var ee=Pd(T,z),de=d[ee];d[ee]=d[T],d[T]=de}return d.length=p,d}var t0=Zm(function(d){var p=[];return d.charCodeAt(0)===46&&p.push(""),d.replace(Jn,function(T,j,z,ee){p.push(z?ee.replace(au,"$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 yd.call(d)}catch{}try{return d+""}catch{}}return""}function n0(d,p){return wr(Re,function(T){var j="_."+T[0];p&T[1]&&!ol(d,j)&&d.push(j)}),d.sort()}function Gm(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 W1(d,p,T){(T?Fn(d,p,T):p===n)?p=1:p=kr(un(p),0);var j=d==null?0:d.length;if(!j||p<1)return[];for(var z=0,ee=0,de=Oe(mu(j/p));z<j;)de[ee++]=Sa(d,z,z+=p);return de}function Fh(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 Jm(){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?xc(d,Ot(p,3),!0,!0):[]}function jc(d,p){return d&&d.length?xc(d,Ot(p,3),!0):[]}function Ur(d,p,
`;d.replace(mt,function(zt,mn,Sn,Ti,xo,Ii){return Sn||(Sn=Ti),Je+=d.slice(We,Ii).replace(tc,gd),mn&&(ve=!0,Je+=`' +
7 months ago
__e(`+mn+`) +
6 months ago
'`),xo&&(Te=!0,Je+=`';
`+xo+`;
7 months ago
__p += '`),Sn&&(Je+=`' +
((__t = (`+Sn+`)) == null ? '' : __t) +
7 months ago
'`),We=Ii+zt.length,zt}),Je+=`';
7 months ago
`;var Ut=Tn.call(p,"variable")&&p.variable;if(!Ut)Je=`with (obj) {
7 months ago
`+Je+`
8 months ago
}
6 months ago
`;else if(Oa.test(Ut))throw new Qt(l);Je=(Te?Je.replace(te,""):Je).replace(me,"$1").replace(Ce,"$1;"),Je="function("+(Ut||"obj")+`) {
7 months ago
`+(Ut?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(Te?`, __j = Array.prototype.join;
8 months ago
function print() { __p += __j.call(arguments, '') }
`:`;
7 months ago
`)+Je+`return __p
6 months ago
}`;var cn=Dx(function(){return Dn(ee,Nt+"return "+Je).apply(n,de)});if(cn.source=Je,iS(cn))throw cn;return cn}function qj(d){return Un(d).toLowerCase()}function Gj(d){return Un(d).toUpperCase()}function Jj(d,p,T){if(d=Un(d),d&&(T||p===n))return ot(d);if(!d||!(p=hr(p)))return d;var j=yo(d),z=yo(p),ee=Hn(j,z),de=oa(j,z)+1;return Es(j,ee,de).join("")}function Kj(d,p,T){if(d=Un(d),d&&(T||p===n))return d.slice(0,Uf(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 Qj(d,p,T){if(d=Un(d),d&&(T||p===n))return d.replace(Pi,"");if(!d||!(p=hr(p)))return d;var j=yo(d),z=Hn(j,yo(p));return Es(j,z).join("")}function Xj(d,p){var T=Z,j=Q;if(Sr(p)){var z="separator"in p?p.separator:z;T="length"in p?un(p.length):T,j="omission"in p?hr(p.omission):j}d=Un(d);var ee=d.length;if(uc(d)){var de=yo(d);ee=de.length}if(T>=ee)return d;var ve=T-hu(j);if(ve<1)return j;var Te=de?Es(de,0,ve).join(""):d.slice(0,ve);if(z===n)return Te+j;if(de&&(ve+=Te.length-ve),sS(z)){if(d.slice(ve).search(z)){var We,$e=Te;for(z.global||(z=vd(z.source,Un(li.exec(z))+"g")),z.lastIndex=0;We=z.exec($e);)var Je=We.index;Te=Te.slice(0,Je===n?ve:Je)}}else if(d.indexOf(hr(z),ve)!=ve){var mt=Te.lastIndexOf(z);mt>-1&&(Te=Te.slice(0,mt))}return Te+j}function eL(d){return d=Un(d),d&&Qe.test(d)?d.replace(Ye,vy):d}var tL=xs(function(d,p,T){return d+(T?" ":"")+p.toUpperCase()}),cS=Rm("toUpperCase");function Sx(d,p,T){return d=Un(d),p=T?n:p,p===n?F1(d)?L1(d):ic(d):d.match(p)||[]}var Dx=rn(function(d,p){try{return Cr(d,n,p)}catch(T){return iS(T)?T:new Qt(T)}}),nL=Gi(function(d,p){return wr(p,function(T){T=bi(T),Wi(d,T,Ge(d[T],d))}),d});function rL(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(Cr(ee[0],this,j))return Cr(ee[1],this,j)}})}function aL(d){return Ay(no(d,g))}function dS(d){return function(){return d}}function oL(d,p){return d==null||d!==d?p:d}var iL=Eu(),sL=Eu(!0);function Go(d){return d}function fS(d){return Ad(typeof d=="function"?d:no(d,g))}function lL(d){return Tc(no(d,g))}function uL(d,p){return yi(d,no(p,g))}var cL=rn(function(d,p){return function(T){return vl(T,d,p)}}),dL=rn(function(d,p){return function(T){return vl(d,T,p)}});function hS(d,p,T){var j=xa(p),z=Ba(p,j);T==null&&!(Sr(p)&&(z.length||!j.length))&&(T=p,p=d,d=this,z=Ba(p,xa(p)));var ee=!(Sr(T)&&"chain"in T)||!!T.chain,de=Nu(d);return wr(z,function(ve){var Te=p[ve];d[ve]=Te,de&&(d.prototype[ve]=function(){var We=this.__chain__;if(ee||We){var $e=d(this.__wrapped__),Je=$e.__actions__=Ha(this.__actions__);return Je.push({func:Te,args:arguments,thisArg:d}),$e.__chain__=We,$e}return Te.apply(d,Ro([this.value()],arguments))})}),d}function fL(){return zn._===this&&(zn._=by),this}function pS(){}function hL(d){return d=un(d),rn(function(p){return bl(p,d)})}var pL=Ih(jn),mL=Ih(oc),gL=Ih(il);function Tx(d){return Wm(d)?F(bi(d)):Cm(d)}function vL(d){return function(p){return d==null?n:So(d,p)}}var yL=_m(),wL=_m(!0);function mS(){return[]}function gS(){return!1}function bL(){return{}}function SL(){return""}function DL(){return!0}function TL(d,p){if(d=un(d),d<1||d>ie)return[];var T=ae,j=ma(d,ae);p=Ot(p),d-=ae;for(var z=Ee(j,p);++T<d;)p(T);return z}function IL(d){return an(d)?jn(d,bi):Di(d)?[d]:Ha(t0(Un(d)))}function EL(d){var p=++fc;return Un(d)+p}var xL=Th(function(d,p){return d+p},0),CL=Da("ceil"),ML=Th(function(d,p){return d/p},1),kL=Da("floor");function NL(d){return d&&d.length?Su(d,Go,gi):n}function AL(d,p){return d&&d.length?Su(d,Ot(p,2),gi):n}function FL(d){return md(d,Go)}function OL(d,p){return md(d,Ot(p,2))}function PL(d){return d&&d.length?Su(d,Go,yl):n}function jL(d,p){return d&&d.length?Su(d,Ot(p,2),yl):n}var LL=Th(function(d,p){return d*p},1),RL=Da("round"),_L=Th(function(d,p){return d-p},0);function BL(d){return d&&d.length?Ae(d,Go):0}function HL(d,p){return d&&d.length?Ae(d,Ot(p,2)):0}return J.after=ue,J.ary=ge,J.assign=GP,J.assignIn=px,J.assignInWith=y0,J.assignWith=JP,J.at=KP,J.before=Pe,J.bind=Ge,J.bindAll=nL,J.bindKey=rt,J.c
`);let r="",a=[],o=!1,i=1;for(let l=0;l<n.length;l++){const c=n[l];if(c.startsWith("#")&&/^#{1,6}\s/g.test(c)){if(o&&w0(c)<=w0(t))break;r=c,r===t?(o=!0,i=l+1):o&&w0(c)>w0(t)?a.push(c):(o=!1,a=[])}else o&&a.push(c)}return t?mb.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(`
`),startLine:i}:{content:e,startLine:0}}function C2(e){const t={};for(const n of e)n.parent&&n.parent>0&&(t[n.position.start.line]=n.parent);return t}function IR(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,_=i.slice(M,N+1),k=_.join(`
7 months ago
`);if(y.parent&&y.parent>0&&(r[y.position.start.line]=y.parent),y.parent&&f[y.parent]){if(w-y.parent===1){const L=(D=i[M])==null?void 0:D.match(/^(\s*)/);L&&(f[y.parent].indent=L[0])}const B=new RegExp("^"+f[y.parent].indent);f[y.parent].content+=`
7 months ago
`+k.split(`
7 months ago
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
`)}else if(y.parent&&f[a(r,y.parent)]){const B=new RegExp("^"+f[a(r,y.parent)].indent);f[a(r,y.parent)].content+=`
7 months ago
`+k.split(`
7 months ago
`).map(L=>L==null?void 0:L.replace(B,"")).join(`
6 months ago
`)}else if(new RegExp(lR).test(k)){f[w]||(f[w]={content:"",blockId:"",indent:""});const B=_.length>1&&((I=_[1])==null?void 0:I.match(/^(\s*)/));B&&(f[w].indent=B[0]),f[w].content=k.split(`
8 months ago
`).map(L=>L==null?void 0:L.replace(f[w].indent,"")).join(`
6 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 ER(e,t){let n=t.vault.getAbstractFileByPath(e);return n||(new C.Notice(E("File not found for the given thino path, is creating a new file")),n=await t.vault.create(e,'{"nodes": [], "edges": []}'),dt.setChangedByMemos(!0)),n}async function xR(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 CR(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(`
6 months ago
`).trim()}),n}const MR=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 kR(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 Fx(e,t,n,r,a){var g,y,w;const o=Le.getState().dailyNotesState.app||window.app,i=dp(a,"day")||C.moment(a.stat.ctime);let l;const c=IR(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=OR(e.DefaultMemoComposition,S.line),I=PR(e.DefaultMemoComposition,S.line),M=jR(S.line);let N=NR(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=LR(S.line);N=AR(S.line),l=MR(Z)}else l="JOURNAL";let _=N.trim().replaceAll(/<br>/g,`
`);const k=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(N),B=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(N),L=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(N),R=(y=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(N))==null?void 0:y[2],V=(w=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(N))==null?void 0:w[2],Y=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(N)?"PUBLIC":"PRIVATE";a.path.includes("2024-04-07"),_=_.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,""),S.blockId&&(_=_.replace("^"+(S==null?void 0:S.blockId),"")),r.push({id:i.format("YYYYMMDDHHmmss")+`${S.index}`,content:_.trim(),createdAt:i.format("YYYY/MM/DD HH:mm:ss"),updatedAt:i.format("YYYY/MM/DD HH:mm:ss"),thinoType:l,hasId:S.blockId?S.blockId:"",linkId:"",path:a.path,deletedAt:L?C.moment(R,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:B?"ARCHIVED":"NORMAL",visibility:Y,pinned:k,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:V,fileInfo:h})}}function NR(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,"$4")}function AR(e){return FR(e)}const FR=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]},OR=(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]},PR=(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]},jR=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]},LR=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)/.exec(e))==null?void 0:t[2]},cA=()=>Gg()?!0:(new C.Notice(E("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function dA(e,t){var l;if(!e)return t;const n=Le.getState().dailyNotesState.app||window.app,r=await xR(e,n);let a=C.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=C.moment(c.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?c.createdAt:a:c.createdAt=a,!r.trim())return t;const f=!!c.pinned,h=c.rowStatus&&c.rowStatus==="ARCHIVED",g=!!c.deletedAt,y=c.deletedAt?c.deletedAt:"",w=c.visibility?c.visibility:"PRIVATE",S=c.thinoType?c.thinoType:"JOURNAL",D=c.webId?c.webId:"",I=c.id?c.id:"",M=c.hasId?c.hasId:"",N=c.linkId?c.linkId:"",_=e.path,k="Memo",B="MULTI",L=[];return t.push({id:I,content:r,createdAt:a,updatedAt:a,deletedAt:g?C.moment(y,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:f,rowStatus:h?"ARCHIVED":"NORMAL",visibility:w,thinoType:S,hasId:M,linkId:N,path:_,creatorName:k,sourceType:B,resourceList:L,webId:D,fileInfo:i}),t})}async function cT(e,t){var I,M,N,_,k,B,L;if(!e)return t;const{vault:n,metadataCache:r}=Le.getState().dailyNotesState.app||window.app;let a;try{a=await n.read(e)}catch(R){console.error(R),a=await n.cachedRead(e)}if(!a)return;const o=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),i=C.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
8 months ago
`);){const r=n.indexOf(`
6 months ago
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function XR({content:e,isList:t,name:n}){var N;const r=Le.getState().dailyNotesState.settings,a=C.moment(),o=ut.randomId(16),i=(r==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",l=n||`${a.format("YYYYMMDD")}-${o}`,c=`${i}/${l}.md`,f={id:o,content:e,deletedAt:"",path:c,createdAt:a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:a.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"MULTI",fileInfo:{tags:[],frontmatter:{}}},h=ft.getState().app||window.app,{vault:g,fileManager:y}=h,w=g.getAbstractFileByPath(i);(!w||!(w instanceof C.TFolder))&&(new C.Notice(E("Folder not found for the given thino path, is creating a new folder")),await g.createFolder(i)),dt.setChangedByMemos(!0);let S;const D=h.vault.getFileByPath(c);D?S=await g.create(`${i}/${a.format("YYYYMMDD")}-${o}.md`,e):S=await g.create(c,e),await y.processFrontMatter(S,_=>{_.id=o,_.createdAt=a.format("YYYY/MM/DD HH:mm:ss"),_.updatedAt=a.format("YYYY/MM/DD HH:mm:ss"),_.thinoType=t?"JOURNAL":"TASK-TODO"}),(!n||D)&&(r!=null&&r.SetFileNameAfterCreate)&&h.fileManager.promptForFileRename(S);const I=h.metadataCache.getFileCache(S),M={tags:((N=I==null?void 0:I.frontmatter)==null?void 0:N.tags)||[],frontmatter:(I==null?void 0:I.frontmatter)||{}};return{...f,fileInfo:M}}async function e_({content:e,isList:t}){var _;const n=Le.getState().dailyNotesState.settings,r=C.moment(),a=ut.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",i={id:a,content:e,deletedAt:"",path:o,createdAt:r.format("YYYY/MM/DD HH:mm:ss"),updatedAt:r.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE",fileInfo:{tags:[],frontmatter:{}}},l=ft.getState().app,{vault:c}=l;let f=c.getAbstractFileByPath(o);(!f||!(f instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),f=await c.create(o,""));const h=l.metadataCache.getFileCache(f),g={tags:((_=h==null?void 0:h.frontmatter)==null?void 0:_.tags)||[],frontmatter:(h==null?void 0:h.frontmatter)||{}};let y="";try{y=await c.read(f)||await c.cachedRead(f)}catch(k){console.error(k),new C.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}
6 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 Px(e){var N;const t=Le.getState().dailyNotesState.settings,n=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),r=e.id,a=(t==null?void 0:t.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",o={id:r,content:e.content,deletedAt:e.deletedAt||"",path:a,createdAt:n.format("YYYY/MM/DD HH:mm:ss"),updatedAt:n.format("YYYY/MM/DD HH:mm:ss"),thinoType:"JOURNAL",hasId:"",linkId:"",pinned:e.pinned,visibility:"PUBLIC",rowStatus:e.rowStatus||"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"FILE",webId:e.id,fileInfo:e==null?void 0:e.fileInfo},i=ft.getState().app,{vault:l}=i;let c=l.getAbstractFileByPath(a);(!c||!(c instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),c=await l.create(a,""));let f="";try{f=await l.read(c)||await l.cachedRead(c)}catch(_){console.error(_),new C.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}
6 months ago
`;let M;if(y===-1){const _=`# ${n.format("YYYY-MM-DD")}`;M=`${f.substring(0,w)}
${_}${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 t_({content:e,isList:t}){const n=Le.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=C.moment(),o=ut.randomId(16),i={id:o,content:e,deletedAt:"",path:r,createdAt:a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:a.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"CANVAS",fileInfo:{tags:[],frontmatter:{}}},l=ft.getState().app,{vault:c}=l,f=await ER(r,l);if(!f||!(f instanceof C.TFile)){new C.Notice(E("File not found for the given thino path, is creating a new file"));return}const 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=C.moment(I.createdAt,"YYYY/MM/DD HH:mm:ss"),_=C.moment(M.createdAt,"YYYY/MM/DD HH:mm:ss");return N.isAfter(_)?I:M}));const 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 bS(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(`
6 months ago
`+f),g=n||C.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 M2({content:e,thinoType:"DAILY"})).id)}catch(ie){console.error(ie)}const _=t?"- ":"- [ ] ",k=i!=null&&i.DefaultMemoComposition?`${_}${($=i==null?void 0:i.DefaultMemoComposition)==null?void 0:$.replace(/{TIME}/g,D).replace(/{CONTENT}/g,(h.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(h)?`
`+f:"")+h)}${h.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(h.split(`
`)[h.split(`
`).length-1])&&N?`
`+f:" "}${N?`[webId::${N}]`:""}`:`${_}${D} ${h.split(`
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(h)?`
`+f:""}${h}${h.split(`
`).length>1&&/((-|\*|\d\.|>)\s|```)/g.test(h.split(`
`)[h.split(`
`).length-1])&&N?`
`+f:" "}${N?`[webId::${N}]`:""}`,B=qu(),L=fb(g,B),R="fake"+ut.randomId(16);let V=!1;const Y=o.plugins.getPlugin("templater-obsidian");let Z;if(L?Z=L:(Y!=null&&Y.templater&&(Y!=null&&Y.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e,date:g,isList:t,id:R,type:N?"web":"local"}),V=!0),Z=await ut.createDailyNoteCheck(g)),!Z){new C.Notice(E("Failed to create daily note, check if it exists."));return}if(L||await ft.fechLocalDailyNotes(),Y&&(Y!=null&&Y.templater)&&(Y!=null&&Y.settings.trigger_on_file_creation)&&V)return dt.setChangedByMemos(!0),{id:R,content:e,deletedAt:"",createdAt:g.format("YYYY/MM/DD HH:mm:ss"),updatedAt:g.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:Z.path,hasId:"",linkId:"",webId:N,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:{tags:[],frontmatter:{}}};let Q="";try{Q=await a.read(Z)||await a.cachedRead(Z)}catch(ie){console.error(ie),new C.Notice(E("Failed to read current daily note, check if it exists."))}const G=o.metadataCache.getFileCache(Z),le={tags:((he=G==null?void 0:G.frontmatter)==null?void 0:he.tags)||[],frontmatter:(G==null?void 0:G.frontmatter)||{}},se=await pA(I,k,Q);await a.modify(Z,se.content);const fe=se.posNum===-1?mA(se.content).length-(k.split(`
`).length-1)-1:se.posNum+1;return dt.setChangedByMemos(!0),{id:g.format("YYYYMMDDHHmm")+"00"+fe,content:e,deletedAt:"",createdAt:g.format("YYYY/MM/DD HH:mm:ss"),updatedAt:g.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:Z.path,hasId:"",linkId:"",webId:N,pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:le}}async function jx(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=C.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(`
6 months ago
`+w),D=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),I=D.format(o||"HH:mm"),M=e.thinoType?"- [ ] ":"- ",N=r?`${M}${r==null?void 0:r.replace(/{TIME}/g,I).replace(/{CONTENT}/g,(S.split(`
7 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(S)?`
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()?`
6 months ago
`+w:" "}${f}`,_=qu(),k=fb(D,_),B="fake"+ut.randomId(16);let L=!1;const R=n.plugins.getPlugin("templater-obsidian");let V;if(k?V=k:(R!=null&&R.templater&&(R!=null&&R.settings.trigger_on_file_creation)&&(we.setWaitingForTemplater({origin:e.content,date:D,isList:e.thinoType&&e.thinoType==="JOURNAL",id:B,type:"local"}),L=!0),V=await ut.createDailyNoteCheck(D)),!V){new C.Notice(E("Failed to create daily note, check if it exists.")),new C.Notice(E("Your content has been copied to clipboard, and inserted into the editor. Please try it again")),await navigator.clipboard.writeText(e.content);const $=n.workspace.getLeavesOfType("thino_view").first();n.workspace.trigger("send-to-thino",e.content,$);return}if(k||await ft.fechLocalDailyNotes(),R&&(R!=null&&R.templater)&&(R!=null&&R.settings.trigger_on_file_creation)&&L)return dt.setChangedByMemos(!0),{id:B,content:e.content,deletedAt:e.deletedAt??"",createdAt:D.format("YYYY/MM/DD HH:mm:ss"),updatedAt:D.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:V.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.webId||e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:(e==null?void 0:e.fileInfo)||{tags:[],frontmatter:{}}};const Y=n.metadataCache.getFileCache(V),Z={tags:((fe=Y==null?void 0:Y.frontmatter)==null?void 0:fe.tags)||[],frontmatter:(Y==null?void 0:Y.frontmatter)||{}};let Q="";try{Q=await t.read(V)||await t.cachedRead(V)}catch($){console.error($),new C.Notice(E("Failed to read current daily note, check if it exists."))}const G=c==="end"?"":e.thinoType&&i&&l||a,le=await pA(G,N,Q);await t.modify(V,le.content);const se=le.posNum===-1?mA(le.content).length-1:le.posNum+1;return dt.setChangedByMemos(!0),{id:D.format("YYYYMMDDHHmm")+"00"+se,content:e.content,deletedAt:e.deletedAt??"",createdAt:D.format("YYYY/MM/DD HH:mm:ss"),updatedAt:D.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType||"JOURNAL",path:V.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY",fileInfo:Z}}async function pA(e,t,n){const r=new RegExp(`(s*?)${await KR(e)}(s*?)`),a=QR(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 Lx(t,n,i?-1:f,c)}else return await Lx(t,n,a.length-1,c)}async function Lx(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?`
6 months ago
`:"")+i}`,posNum:n}}const mA=e=>e.split(/\r?\n/);async function n_(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}await t.vault.delete(n)}async function r_(e){const t=Le.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(E("File not found for the given thino path"));return}const a=(await t.vault.read(n)).split(`
`),o=a.findIndex(c=>c.includes(e.id));if(o===-1){new C.Notice(E("Thino not found"));return}const i=a.findIndex((c,f)=>f>o&&c.trim()==="");i===-1?a.splice(o,a.length-o):a.splice(o,i-o);const l=a.join(`
`);if(!l){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,l)}async function a_(e){const t=Le.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new C.Notice(E("File not found for the given thino path"));return}const r=await t.vault.read(n),a=JSON.parse(r),o=a.nodes,i=o.findIndex(h=>h.id===e.id);if(i===-1){new C.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 o_(e){cA()||new C.Notice(E("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."),5e3);const{vault:t,metadataCache:n}=Le.getState().dailyNotesState.app,r=e.path,a=t.getAbstractFileByPath(r);if(!a){new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings"));return}const o=await t.read(a),i=o.split(`
`),l=n.getFileCache(a),c=(l==null?void 0:l.listItems)||[],f=parseInt(e.id.slice(14));let 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=C2(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 C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),i.splice(f,h-f+1),await t.modify(a,i.join(`
`))}async function i_(){const{vault:e,metadataCache:t}=Le.getState().dailyNotesState.app,n=Le.getState().dailyNotesState.settings,a=hb()+"/"+n.DeleteFileName+".md",o=[],i=t.getFirstLinkpathDest("",a);if(i instanceof C.TFile){let l=await e.read(i),c=s_(l);if(c.length===0)return o;for(let f=0;f<c.length;f++){const h=c[f];if(/- /.test(h)){const y=l_(h).slice(0,13),w=C.moment(y,"YYYYMMDDHHmmss"),S=c_(c[f]),D=C.moment(S.slice(0,13),"YYYYMMDDHHmmss"),I=u_(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 s_=e=>e.split(/\r?\n/),l_=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},u_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},c_=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function d_(e){const t=await jp(Le.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await kv(Le.getState().dailyNotesState.app,t)}const f_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await jp(t)||[],r=n.find(a=>a.id===e);if(r){const a=C.moment().format("YYYY/MM/DD HH:mm:ss");return r.pinnedAt=a,await kv(t,n),a}else{new C.Notice(E("Query not found"));return}},h_=async e=>{const{app:t}=Le.getState().dailyNotesState,n=await jp(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await kv(t,n);return}else{new C.Notice(E("Query not found"));return}};function p_(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const a=r[1].trim(),o={};a.split(" ").forEach(l=>{const[c,f]=l.slice(1,-1).split("::");o[c]=f});for(const l of Object.keys(t))if(l!=="id"&&l!=="content"){if(l==="rowStatus"&&t.rowStatus==="ARCHIVED"){o.archived="true";continue}else if(l==="rowStatus"&&t.rowStatus==="NORMAL"){delete o.archived;continue}if(l==="deleted"&&t.deleted){const c=C.moment().format("YYYYMMDDHHmmss");o.deleted=c}else typeof t[l]=="boolean"?t[l]?o[l]="true":delete o[l]:t[l]&&(o[l]=t[l])}const i=Object.entries(o).map(([l,c])=>`[${l}::${c}]`).join(" ");return e.replace(n,`%% ${i} %%`)}async function js(e,t){if(!e.sourceType||e.sourceType!=="MULTI")return e;const{vault:n,fileManager:r}=Le.getState().dailyNotesState.app,a=n.getAbstractFileByPath(e.path);if(!a)return e;const o=C.moment();if(await r.processFrontMatter(a,i=>{(t.pinned!==void 0||t.thinoType||t.rowStatus||t.visibility||t.deleted)&&dt.setChangedByMemos(!0),t.id&&(i.id=t.id),t.thinoType&&(i.thinoType=t.thinoType),t.rowStatus&&(i.rowStatus=t.rowStatus),t.visibility&&(i.visibility=t.visibility),t.webId&&(i.webId=t.webId),t.pinned!==void 0&&(i.pinned=t.pinned),t.deleted!==void 0&&(i.deletedAt=t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):""),i.createdAt||(i.createdAt=o.format("YYYY/MM/DD HH:mm:ss")),i.updatedAt=o.format("YYYY/MM/DD HH:mm:ss")}),t.content){const i=await n.read(a);let l=i;const c=t.content.replace(/\$/g,"$$$$");l=i.replace(e.content,c),await n.modify(a,l)}return dt.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned!==void 0?t.pinned:e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Ll(e,t){if(!e.sourceType||e.sourceType!=="FILE")return e;const{vault:n}=Le.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=C.moment();let o="";try{o=await n.read(r)}catch(M){console.error(M),o=await n.cachedRead(r)}const i=o.split(/\r?\n/),l=i.findIndex(M=>M.includes("id::"+e.id)||M.includes("Id::"+e.id)||e.webId&&M.includes(e.webId)),c=i[l];if(!c)return e;const f=p_(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(`
`);return await n.modify(r,I),dt.setChangedByMemos(!0),{...e,id:t.id||e.id,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt||a.format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned!==void 0?t.pinned:e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?a.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Rl(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=Le.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=await n.read(r),o=JSON.parse(a),i=o.nodes.find(f=>f.id===e.id);if(!i)return e;t.content&&(i.text=t.content),t.thinoType&&(i.thinoType=t.thinoType),t.rowStatus&&(i.rowStatus=t.rowStatus),t.visibility&&(i.visibility=t.visibility),t.pinned!==void 0&&(i.pinned=t.pinned),t.webId&&(i.webId=t.webId);const l=C.moment();t.deleted!==void 0&&(i.deletedAt=t.deleted?l.format("YYYY/MM/DD HH:mm:ss"):""),i.updatedAt=l.format("YYYY/MM/DD HH:mm:ss");const c=JSON.stringify(o,null,2);return await n.modify(r,c),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?l.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function _l(e,t){var le;cA()||new C.Notice(E("If you are disabling the daily note plugin, it would be possible that the thino will not be deleted or patched properly. Please enable the plugin and try again."));const{vault:n,metadataCache:r}=Le.getState().dailyNotesState.app,a=Le.getState().dailyNotesState.app,{settings:o}=Le.getState().dailyNotesState,i=e.id.toString().slice(0,14),l=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(i,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(i,"YYYYMMDDHHmmss"),c=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(l,"day"),f=e.path,h=n.getAbstractFileByPath(f)||n.getAbstractFileByPath(e.path);if(!h)return new C.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 C.Notice(E("Thino not found")),e;const D=parseInt(e.id.slice(14));let I=D;function M(se,fe){const $=[];for(const he in fe)fe[he]===se&&$.push(parseInt(he),...M(parseInt(he),fe));return $}const N=C2(S),_=S.find(se=>se.position.start.line===D);if(!_)return new C.Notice(E("Thino not found")),e;const k=M(D,N);if(k.length>0){const se=k.map(fe=>{const $=S.find(he=>he.position.start.line===fe);return $?$.position.end.line:-1});I=Math.max(...se,_.position.end.line)}else I=_.position.end.line;const B=y.slice(D,I+1);let L=B.join(`
`);const R=c?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm"):(parseInt(e.id.toString().slice(10,12))+24).toString()+":"+e.id.toString().slice(12,14);if(!L)return new C.Notice(E("Thino not found")),e;const V=a.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,Y=V?1:a.vault.getConfig("tabSize"),Z=(V?" ":" ").repeat(Y);let Q=R;if(o.DefaultTimePrefix!=="HH:mm"&&(Q=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(o.DefaultTimePrefix)),t.content){const se=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",fe=(e.pinned?" [pinned::true]":"")+(e.deletedAt?` [deleted::${e.deletedAt}]`:"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.webId?" [webId::"+e.webId+"]":""),$=t.content.trim().split(`
8 months ago
`)[t.content.trim().split(`
7 months ago
`).length-1].trim(),he=e.hasId&&t.content.trim().split(`
6 months ago
`).length>1&&new RegExp(/(-|\*|\d{1,2}\.)\s/g).test($)?" ^"+e.hasId:" ";L=`${se}${Q}${he}${t.content.trim().split(`
8 months ago
`).length>1||/^((-|\*|\d\.|>)\s|```)/g.test(t.content)?`
7 months ago
`+Z:""}${t.content.trim().split(`
8 months ago
`).join(`
7 months ago
`+Z)}${/((-|\*|\d\.|>)\s|```)/g.test(t.content.split(`
8 months ago
`)[t.content.split(`
`).length-1])?`
6 months ago
`+Z:" "}${fe.trim()}`}if(t.thinoType){const se=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";L=L.replace(/^((- \[.\] )|((-|\*) ))/,se)}if(t.rowStatus){const se=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";L=L.includes("[archived::")?L.replace(/\[archived::(true|false)\]/,se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.visibility){const se='[visibility::"'+t.visibility+'"]';L=L.includes("[visibility::")?L.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.pinned!==void 0){const se=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";L=L.includes("[pinned::")?L.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}if(t.webId!==void 0){const se="[webId::"+t.webId+"]";L=L.includes("[webId::")?L.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":se):L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}const G=C.moment();if(t.deleted!==void 0){const se="[deleted::"+G.format("YYYYMMDDHHmmss")+"]";t.deleted?(L=L.replace(/\[deleted::([^\]]+)\]/,""),L=L+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se):t.deleted===!1&&(L=L.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId&&((le=t.content)==null?void 0:le.split(`
`).length)===1){const se=" ^"+e.hasId;L=L.trim().replace(/\s\^([0-9a-zA-Z-]+)($|\n)/g,"")+`${/((-|\*|\d\.|>)\s|```)/g.test(L.split(`
8 months ago
`)[L.split(`
`).length-1])?`
6 months ago
`+Z:" "}`+se}return L!==B.join(`
`)?(y.splice(D,I-_.position.start.line+1,L.trim()),await n.modify(h,y.join(`
`)),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?G.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}async function m_(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=C2(i),c=[],f=r.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,h=f?1:r.getConfig("tabSize"),g=(f?" ":" ").repeat(h);function y(N,_){const k=[];for(const B in _)_[B]===N&&k.push(parseInt(B),...y(parseInt(B),_));return k}const w=C.moment(),S=t.map(N=>{const _=i.find(R=>R.position.start.line===parseInt(N.id.slice(14))),B=y(parseInt(N.id.slice(14)),l).map(R=>{const V=i.find(Y=>Y.position.start.line===R);return V?V.position.end.line:-1}),L=Math.max(...B,_.position.end.line);return{id:N.id,start:_.position.start.line,end:L}}),I=(await r.read(o)).split(`
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(`
6 months ago
`).length-1].trim();let R=k;if(n==="delete"){const V="[deleted::"+w.format("YYYYMMDDHHmmss")+"]";R=R.replace(/\[deleted::([^\]]+)\]/,""),R=k+`${k.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
6 months ago
`+g:" "}`+V}if(n==="restoreFromDelete"&&(R=R.replace(/ ?\[deleted::([^\]]+)\]/,"")),n==="archive"){const V="[archived::true]";R=R.includes("[archived::")?R.replace(/\[archived::(true|false)\]/,V):R+`${R.split(`
7 months ago
`).length>1&&/```/g.test(L)?`
6 months ago
`+g:" "}`+V}n==="restoreFromArchive"&&(R=R.replace(/ ?\[archived::(true|false)\]/,"")),n==="deleteForever"?I.splice(N.start,N.end-N.start+1):I.splice(N.start,N.end-N.start+1,R),c.push({...t.find(V=>V.id===N.id),deletedAt:n==="delete"?w.format("YYYY/MM/DD HH:mm:ss"):"",rowStatus:n==="archive"?"ARCHIVED":"NORMAL"})}),await r.modify(o,I.join(`
`)),dt.setChangedByMemos(!0),c}const g_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Rl(e,{id:e.id,pinned:!0});case"DAILY":return _l(e,{id:e.id,pinned:!0});case"MULTI":return js(e,{id:e.id,pinned:!0});case"FILE":return Ll(e,{id:e.id,pinned:!0})}},v_=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Rl(e,{id:e.id,pinned:!1});case"DAILY":return _l(e,{id:e.id,pinned:!1});case"MULTI":return js(e,{id:e.id,pinned:!1});case"FILE":return Ll(e,{id:e.id,pinned:!1})}};var dT;(e=>{async function t(D){return await Ox(D)}e.getMyMemos=t;async function n(D){return await Ox([D])}e.updateSpecificTypeMemo=n;function r(){return i_()}e.getMyDeletedMemos=r;function a(D){const I=we.getMemoById(D);if(I)switch(I==null?void 0:I.sourceType){case"DAILY":return _l(I,{id:I.id,deleted:!1});case"CANVAS":return Rl(I,{id:I.id,deleted:!1});case"MULTI":return js(I,{id:I.id,deleted:!1});case"FILE":return Ll(I,{id:I.id,deleted:!1})}}e.restoreMemo=a;function o(D){return r_(D)}e.deleteMemoInSingleFile=o;function i(D){return n_(D)}e.deleteMemoInMultiFiles=i;function l(D){return o_(D)}e.deleteMemoInDailyNote=l;function c(D){return a_(D)}e.deleteMemoInCanvas=c;function f(){return SR()}e.getMyQueries=f;async function h(D,I){return await TR(D,I)}e.createQuery=h;function g(D,I,M){return YR(D,I,M)}e.updateQuery=g;function y(D){return d_(D)}e.deleteQueryById=y;function w(D){return f_(D)}e.pinQuery=w;function S(D){return h_(D)}e.unpinQuery=S})(dT||(dT={}));const Ko=dT;var Gu={};Object.defineProperty(Gu,"__esModule",{value:!0});class Af extends Error{}class y_ extends Af{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class w_ extends Af{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class b_ extends Af{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Og extends Af{}class gA extends Af{constructor(t){super(`Invalid unit ${t}`)}}class Xi extends Af{}class Bc extends Af{constructor(){super("Zone is an abstract class")}}const gt="numeric",zs="short",Mi="long",Ew={year:gt,month:gt,day:gt},vA={year:gt,month:zs,day:gt},S_={year:gt,month:zs,day:gt,weekday:zs},yA={year:gt,month:Mi,day:gt},wA={year:gt,month:Mi,day:gt,weekday:Mi},bA={hour:gt,minute:gt},SA={hour:gt,minute:gt,second:gt},DA={hour:gt,minute:gt,second:gt,timeZoneName:zs},TA={hour:gt,minute:gt,second:gt,timeZoneName:Mi},IA={hour:gt,minute:gt,hourCycle:"h23"},EA={hour:gt,minute:gt,second:gt,hourCycle:"h23"},xA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:zs},CA={hour:gt,minute:gt,second:gt,hourCycle:"h23",timeZoneName:Mi},MA={year:gt,month:gt,day:gt,hour:gt,minute:gt},kA={year:gt,month:gt,day:gt,hour:gt,minute:gt,second:gt},NA={year:gt,month:zs,day:gt,hour:gt,minute:gt},AA={year:gt,month:zs,day:gt,hour:gt,minute:gt,second:gt},D_={year:gt,month:zs,day:gt,weekday:zs,hour:gt,minute:gt},FA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,timeZoneName:zs},OA={year:gt,month:Mi,day:gt,hour:gt,minute:gt,second:gt,timeZoneName:zs},PA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,timeZoneName:Mi},jA={year:gt,month:Mi,day:gt,weekday:Mi,hour:gt,minute:gt,second:gt,timeZoneName:Mi};class Av{get type(){throw new Bc}get name(){throw new Bc}get ianaName(){return this.name}get isUniversal(){throw new Bc}offsetName(t,n){throw new Bc}formatOffset(t,n){throw new Bc}offset(t){throw new Bc}equals(t){throw new Bc}get isValid(){throw new Bc}}let SS=null;class gb extends Av{static get instance(){return SS===null&&(SS=new gb),SS}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return RA(t,n,r)}formatOffset(t,n){return Yg(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}}let nw={};function T_(e){return nw[e]||(nw[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"})),nw[e]}const I_={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function E_(e,t){const n=e.format(t).rep
7 months ago
`||te.charAt(tt)==="\r"&&te.charAt(tt+1)!==`
6 months ago
`)&&(He++,Qe===0&&(Qe=tt+1)),tt--}var kt=Ye+He,Yt=me-Qe;return Ce[me]={line:kt,lineStart:Qe},{offset:me,line:kt+1,column:Yt+1}}function G(te){if(!k(te))throw new Error("not a parser: "+te)}function le(te,me){return typeof te=="string"?te.charAt(me):te[me]}function se(te){if(typeof te!="number")throw new Error("not a number: "+te)}function fe(te){if(typeof te!="function")throw new Error("not a function: "+te)}function $(te){if(typeof te!="string")throw new Error("not a string: "+te)}var he=2,ie=3,ce=8,X=5*ce,ae=4*ce,De=" ";function je(te,me){return new Array(me+1).join(te)}function Re(te,me,Ce){var Ye=me-te.length;return Ye<=0?te:je(Ce,Ye)+te}function Fe(te,me,Ce,Ye){return{from:te-me>0?te-me:0,to:te+Ce>Ye?Ye:te+Ce}}function Be(te,me){var Ce,Ye,He,Qe,tt,kt=me.index,Yt=kt.offset,On=1;if(Yt===te.length)return"Got the end of the input";if(L(te)){var yn=Yt-Yt%ce,xr=Yt-yn,Jn=Fe(yn,X,ae+ce,te.length),yr=f(function(Nn){return f(function(Aa){return Re(Aa.toString(16),2,"0")},Nn)},function(Nn,Aa){var Fa=Nn.length,Zr=[],fo=0;if(Fa<=Aa)return[Nn.slice()];for(var Oa=0;Oa<Fa;Oa++)Zr[fo]||Zr.push([]),Zr[fo].push(Nn[Oa]),(Oa+1)%Aa==0&&fo++;return Zr}(te.slice(Jn.from,Jn.to).toJSON().data,ce));Qe=function(Nn){return Nn.from===0&&Nn.to===1?{from:Nn.from,to:Nn.to}:{from:Nn.from/ce,to:Math.floor(Nn.to/ce)}}(Jn),Ye=yn/ce,Ce=3*xr,xr>=4&&(Ce+=1),On=2,He=f(function(Nn){return Nn.length<=4?Nn.join(" "):Nn.slice(0,4).join(" ")+" "+Nn.slice(4).join(" ")},yr),(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]/);Ce=kt.column-1,Ye=kt.line-1,Qe=Fe(Ye,he,ie,ta.length),He=ta.slice(Qe.from,Qe.to),tt=Qe.to.toString().length}var Pi=Ye-Qe.from;return L(te)&&(tt=(8*(Qe.to>0?Qe.to-1:Qe.to)).toString(16).length)<2&&(tt=2),c(function(Nn,Aa,Fa){var Zr,fo=Fa===Pi,Oa=fo?"> ":De;return Zr=L(te)?Re((8*(Qe.from+Fa)).toString(16),tt,"0"):Re((Qe.from+Fa+1).toString(),tt," "),[].concat(Nn,[Oa+Zr+" | "+Aa],fo?[De+je(" ",tt)+" | "+Re("",Ce," ")+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
6 months ago
`,(Ce=me.expected,Ce.length===1?`Expected:
8 months ago
6 months ago
`+Ce[0]:`Expected one of the following:
8 months ago
6 months ago
`+Ce.join(", ")),`
`].join("");var Ce}function Ze(te){return te.flags!==void 0?te.flags:[te.global?"g":"",te.ignoreCase?"i":"",te.multiline?"m":"",te.unicode?"u":"",te.sticky?"y":""].join("")}function st(){for(var te=[].slice.call(arguments),me=te.length,Ce=0;Ce<me;Ce+=1)G(te[Ce]);return o(function(Ye,He){for(var Qe,tt=new Array(me),kt=0;kt<me;kt+=1){if(!(Qe=Y(te[kt]._(Ye,He),Qe)).status)return Qe;tt[kt]=Qe.value,He=Qe.index}return Y(R(He,tt),Qe)})}function xt(){var te=[].slice.call(arguments);if(te.length===0)throw new Error("seqMap needs at least one argument");var me=te.pop();return fe(me),st.apply(null,te).map(function(Ce){return me.apply(null,Ce)})}function tn(){var te=[].slice.call(arguments),me=te.length;if(me===0)return Tt("zero alternates");for(var Ce=0;Ce<me;Ce+=1)G(te[Ce]);return o(function(Ye,He){for(var Qe,tt=0;tt<te.length;tt+=1)if((Qe=Y(te[tt]._(Ye,He),Qe)).status)return Qe;return Qe})}function _e(te,me){return et(te,me).or(St([]))}function et(te,me){return G(te),G(me),xt(te,me.then(te).many(),function(Ce,Ye){return[Ce].concat(Ye)})}function nt(te){$(te);var me="'"+te+"'";return o(function(Ce,Ye){var He=Ye+te.length,Qe=Ce.slice(Ye,He);return Qe===te?R(He,Qe):V(Ye,me)})}function ht(te,me){(function(He){if(!(He instanceof RegExp))throw new Error("not a regexp: "+He);for(var Qe=Ze(He),tt=0;tt<Qe.length;tt++){var kt=Qe.charAt(tt);if(kt!=="i"&&kt!=="m"&&kt!=="u"&&kt!=="s")throw new Error('unsupported regexp flag "'+kt+'": '+He)}})(te),arguments.length>=2?se(me):me=0;var Ce=function(He){return RegExp("^(?:"+He.source+")",Ze(He))}(te),Ye=""+te;return o(function(He,Qe){var tt=Ce.exec(He.slice(Qe));if(tt){if(0<=me&&me<=tt.length){var kt=tt[0],Yt=tt[me];return R(Qe+kt.length,Yt)}return V(Qe,"valid match group (0 to "+tt.length+") in "+Ye)}return V(Qe,Ye)})}function St(te){return o(function(me,Ce){return R(Ce,te)})}function Tt(te){return o(function(me,Ce){return V(Ce,te)})}function Gt(te){if(k(te))return o(function(me,Ce){var Ye=te._(me,Ce);return Ye.index=Ce,Ye.value="",Ye});if(typeof te=="string")return Gt(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,Ce){var Ye=te._(me,Ce),He=me.slice(Ce,Ye.index);return Ye.status?V(Ce,'not "'+He+'"'):R(Ce,null)})}function Vt(te){return fe(te),o(function(me,Ce){var Ye=le(me,Ce);return Ce<me.length&&te(Ye)?R(Ce+1,Ye):V(Ce,"a character/byte matching "+te)})}function Xt(te,me){arguments.length<2&&(me=te,te=void 0);var Ce=o(function(Ye,He){return Ce._=me()._,Ce._(Ye,He)});return te?Ce.desc(te):Ce}function dn(){return Tt("fantasy-land/empty")}i.parse=function(te){if(typeof te!="string"&&!L(te))throw new Error(".parse must be called with a string or Buffer as its argument");var me,Ce=this.skip(Er)._(te,0);return me=Ce.status?{status:!0,value:Ce.value}:{status:!1,index:Q(te,Ce.furthest),expected:Ce.expected},delete Z[te],me},i.tryParse=function(te){var me=this.parse(te);if(me.status)return me.value;var Ce=Xe(te,me),Ye=new Error(Ce);throw Ye.type="ParsimmonError",Ye.result=me,Ye},i.assert=function(te,me){return this.chain(function(Ce){return te(Ce)?St(Ce):Tt(me)})},i.or=function(te){return tn(this,te)},i.trim=function(te){return this.wrap(te,te)},i.wrap=function(te,me){return xt(te,this,me,function(Ce,Ye){return Ye})},i.thru=function(te){return te(this)},i.then=function(te){return G(te),st(this,te).map(function(me){return me[1]})},i.many=function(){var te=this;return o(function(me,Ce){for(var Ye=[],He=void 0;;){if(!(He=Y(te._(me,Ce),He)).status)return Y(R(Ce,Ye),He);if(Ce===He.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");Ce=He.index,Ye.push(He.value)}})},i.tieWith=function(te){return $(te),this.map(function(me){if(function(He){if(!B(He))throw new Error("not an array: "+He)}(me),me.length){$(me[0]);for(var Ce=me[0],Ye=1;Ye<me.length;Ye++)$(me[Ye]),Ce+=te+me[Ye];return Ce}return""})},i.tie=function(){return this.tieWith("")},i.times=function(te,me){var Ce=this;return arguments.length<2&&(me=te),se(te),
7 months ago
`),jr=nt(`\r
6 months ago
`),nr=tn(jr,ha,fr).desc("newline"),Lr=tn(nr,Er);o.all=kn,o.alt=tn,o.any=Zn,o.cr=fr,o.createLanguage=function(te){var me={};for(var Ce in te)({}).hasOwnProperty.call(te,Ce)&&function(Ye){me[Ye]=Xt(function(){return te[Ye](me)})}(Ce);return me},o.crlf=jr,o.custom=function(te){return o(te(R,V))},o.digit=pt,o.digits=Mt,o.empty=dn,o.end=Lr,o.eof=Er,o.fail=Tt,o.formatError=Xe,o.index=en,o.isParser=k,o.lazy=Xt,o.letter=Jt,o.letters=sn,o.lf=ha,o.lookahead=Gt,o.makeFailure=V,o.makeSuccess=R,o.newline=nr,o.noneOf=function(te){return Vt(function(me){return te.indexOf(me)<0}).desc("none of '"+te+"'")},o.notFollowedBy=_t,o.of=St,o.oneOf=function(te){for(var me=te.split(""),Ce=0;Ce<me.length;Ce++)me[Ce]="'"+me[Ce]+"'";return Vt(function(Ye){return te.indexOf(Ye)>=0}).desc(me)},o.optWhitespace=ln,o.Parser=o,o.range=function(te,me){return Vt(function(Ce){return te<=Ce&&Ce<=me}).desc(te+"-"+me)},o.regex=ht,o.regexp=ht,o.sepBy=_e,o.sepBy1=et,o.seq=st,o.seqMap=xt,o.seqObj=function(){for(var te,me={},Ce=0,Ye=(te=arguments,Array.prototype.slice.call(te)),He=Ye.length,Qe=0;Qe<He;Qe+=1){var tt=Ye[Qe];if(!k(tt)){if(B(tt)&&tt.length===2&&typeof tt[0]=="string"&&k(tt[1])){var kt=tt[0];if(Object.prototype.hasOwnProperty.call(me,kt))throw new Error("seqObj: duplicate key "+kt);me[kt]=!0,Ce++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(Ce===0)throw new Error("seqObj expects at least one named parser, found zero");return o(function(Yt,On){for(var yn,xr={},Jn=0;Jn<He;Jn+=1){var yr,ta;if(B(Ye[Jn])?(yr=Ye[Jn][0],ta=Ye[Jn][1]):(yr=null,ta=Ye[Jn]),!(yn=Y(ta._(Yt,On),yn)).status)return yn;yr&&(xr[yr]=yn.value),On=yn.index}return Y(R(On,xr),yn)})},o.string=nt,o.succeed=St,o.takeWhile=function(te){return fe(te),o(function(me,Ce){for(var Ye=Ce;Ye<me.length&&te(le(me,Ye));)Ye++;return R(Ye,me.slice(Ce,Ye))})},o.test=Vt,o.whitespace=vr,o["fantasy-land/empty"]=dn,o["fantasy-land/of"]=St,o.Binary={bitSeq:w,bitSeqObj:function(te){y();var me={},Ce=0,Ye=f(function(Qe){if(B(Qe)){var tt=Qe;if(tt.length!==2)throw new Error("["+tt.join(", ")+"] should be length 2, got length "+tt.length);if($(tt[0]),se(tt[1]),Object.prototype.hasOwnProperty.call(me,tt[0]))throw new Error("duplicate key in bitSeqObj: "+tt[0]);return me[tt[0]]=!0,Ce++,tt}return se(Qe),[null,Qe]},te);if(Ce<1)throw new Error("bitSeqObj expects at least one named pair, got ["+te.join(", ")+"]");var He=f(function(Qe){return Qe[0]},Ye);return w(f(function(Qe){return Qe[1]},Ye)).map(function(Qe){return c(function(tt,kt){return kt[0]!==null&&(tt[kt[0]]=kt[1]),tt},{},f(function(tt,kt){return[tt,Qe[kt]]},He))})},byte:function(te){if(y(),se(te),te>255)throw new Error("Value specified to byte constructor ("+te+"=0x"+te.toString(16)+") is larger in value than a single byte.");var me=(te>15?"0x":"0x0")+te.toString(16);return o(function(Ce,Ye){var He=le(Ce,Ye);return He===te?R(Ye+1,He):V(Ye,me)})},buffer:function(te){return S("buffer",te).map(function(me){return Buffer.from(me)})},encodedString:function(te,me){return S("string",me).map(function(Ce){return Ce.toString(te)})},uintBE:I,uint8BE:I(1),uint16BE:I(2),uint32BE:I(4),uintLE:M,uint8LE:M(1),uint16LE:M(2),uint32LE:M(4),intBE:N,int8BE:N(1),int16BE:N(2),int32BE:N(4),intLE:_,int8LE:_(1),int16LE:_(2),int32LE:_(4),floatBE: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 H2=()=>/(?:[#*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}
6 months ago
${o}`,posNum:n}}function LH(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 U2=async e=>{var o;const t=ft.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const i of n){const l=i.view;if(((o=l==null?void 0:l.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(i);return}}const r=t.metadataCache.getFirstLinkpathDest("",e);if(!r){new C.Notice(E("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},z2=async(e,t)=>{const{app:n}=ft.getState(),r=parseInt(e.slice(14));if(LH(t,n,r))return;const a=n.metadataCache.getFirstLinkpathDest("",t);if(!C.Platform.isMobile)await n.workspace.getLeaf(!0).openFile(a,{eState:{line:r}});else{let o=n.workspace.activeLeaf;o===null&&(o=n.workspace.getLeaf(!0)),await o.openFile(a,{eState:{line:r}})}},V2=async(e,t)=>{var f,h,g;const n=ft.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(E("File not found for the given thino path"));return}let a="";try{a=await n.vault.read(r)}catch(y){console.error(y),a=await n.vault.cachedRead(r)}const i=a.split(/\r?\n/).findIndex(y=>y.contains(e)),l=n.workspace.getLeavesOfType("markdown");for(const y of l){const w=y.view;if(((f=w==null?void 0:w.file)==null?void 0:f.path)===r.path){n.workspace.revealLeaf(y);try{(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)}},W2=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 C.Notice(E("File not found for the given thino path"));return}const i=n.workspace.getLeaf(!0);await i.openFile(o),setTimeout(()=>{var c;r((c=i.view)==null?void 0:c.canvas,e)},10)};class RH{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 bS(n.origin,n.isList,n.date,!0):await jx(r);await this.replaceOldThinoWithNewThino(n.id,a),Le.dispatch({type:"REMOVE_PARTICULAR_PREPARE_UPDATE_THINO",payload:{id:n.id}})}}async replaceOldThinoWithNew
`+ae+s}var je=!1;function Re(s,u){if(!s||je)return"";je=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Pe){var b=Pe}Reflect.construct(s,[],u)}else{try{u.call()}catch(Pe){b=Pe}s.call(u.prototype)}else{try{throw Error()}catch(Pe){b=Pe}s()}}catch(Pe){if(Pe&&b&&typeof Pe.stack=="string"){for(var x=Pe.stack.split(`
7 months ago
`),O=b.stack.split(`
6 months ago
`),W=x.length-1,ue=O.length-1;1<=W&&0<=ue&&x[W]!==O[ue];)ue--;for(;1<=W&&0<=ue;W--,ue--)if(x[W]!==O[ue]){if(W!==1||ue!==1)do if(W--,ue--,0>ue||x[W]!==O[ue]){var ge=`
`+x[W].replace(" at new "," at ");return s.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",s.displayName)),ge}while(1<=W&&0<=ue);break}}}finally{je=!1,Error.prepareStackTrace=m}return(s=s?s.displayName||s.name:"")?De(s):""}function Fe(s){switch(s.tag){case 5:return De(s.type);case 16:return De("Lazy");case 13:return De("Suspense");case 19:return De("SuspenseList");case 0:case 2:case 15:return s=Re(s.type,!1),s;case 11:return s=Re(s.type.render,!1),s;case 1:return s=Re(s.type,!0),s;default:return""}}function Be(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case R:return"Fragment";case L:return"Portal";case Y:return"Profiler";case V:return"StrictMode";case le:return"Suspense";case se:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case Q:return(s.displayName||"Context")+".Consumer";case Z:return(s._context.displayName||"Context")+".Provider";case G:var u=s.render;return s=s.displayName,s||(s=u.displayName||u.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case fe:return u=s.displayName||null,u!==null?u:Be(s.type)||"Memo";case $:u=s._payload,s=s._init;try{return Be(s(u))}catch{}}return null}function Xe(s){var u=s.type;switch(s.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=u.render,s=s.displayName||s.name||"",u.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Be(u);case 8:return u===V?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function Ze(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function st(s){var u=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function xt(s){var u=st(s)?"checked":"value",m=Object.getOwnPropertyDescriptor(s.constructor.prototype,u),b=""+s[u];if(!s.hasOwnProperty(u)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var x=m.get,O=m.set;return Object.defineProperty(s,u,{configurable:!0,get:function(){return x.call(this)},set:function(W){b=""+W,O.call(this,W)}}),Object.defineProperty(s,u,{enumerable:m.enumerable}),{getValue:function(){return b},setValue:function(W){b=""+W},stopTracking:function(){s._valueTracker=null,delete s[u]}}}}function tn(s){s._valueTracker||(s._valueTracker=xt(s))}function _e(s){if(!s)return!1;var u=s._valueTracker;if(!u)return!0;var m=u.getValue(),b="";return s&&(b=st(s)?s.checked?"true":"false":s.value),s=b,s!==m?(u.setValue(s),!0):!1}function et(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function nt(s,u){var m=u.checked;return X({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??s._wrapperState.initialChecked})}function ht(s,u){var m=u.defaultValue==null?"":u.defaultValue,b=u.checked!=null?u.checked:u.defaultChecked;m=Ze(u.value!=null?u.value:m),s._wrapperState={initialChecked:b,initialValue:m,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function St(s,u){u=u.checked,u!=null&&_(s,"checked",u,!1)}function Tt(s,u){St(s,u);var m=Ze(u.value),b=u.type;if(m!=null)b==="number"?(m===0&&s.value===""||s.value!=m)&&(s.value=""+m):s.value!==""+m&&(s.value=""+m);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}u.hasOwnProperty("value")?_t(s,u.type,m):u.hasOwnProperty("defaultValue")&&_t(s,u.type,Ze(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(s.defaultChecked=!!u.defaultChecked)}function Gt(s,u,m){if(u.hasOwnProperty("value")||
`).replace(B1,"")}function Td(s,u,m){if(u=Iy(u),Iy(s)!==u&&m)throw Error(n(425))}function Jf(){}var Id=null,gu=null;function Ed(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,mc=typeof Promise=="function"?Promise:void 0,Kf=typeof queueMicrotask=="function"?queueMicrotask:typeof mc<"u"?function(s){return mc.resolve(null).then(s).catch(gc)}:ul;function gc(s){setTimeout(function(){throw s})}function gm(s,u){var m=u,b=0;do{var x=m.nextSibling;if(s.removeChild(m),x&&x.nodeType===8)if(m=x.data,m==="/$"){if(b===0){s.removeChild(x),pn(u);return}b--}else m!=="$"&&m!=="$?"&&m!=="$!"||b++;m=x}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 Ey(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 vc=Math.random().toString(36).slice(2),Yi="__reactFiber$"+vc,dl="__reactProps$"+vc,wo="__reactContainer$"+vc,Qf="__reactEvents$"+vc,J="__reactListeners$"+vc,yc="__reactHandles$"+vc;function Ui(s){var u=s[Yi];if(u)return u;for(var m=s.parentNode;m;){if(u=m[wo]||m[Yi]){if(m=u.alternate,u.child!==null||m!==null&&m.child!==null)for(s=Ey(s);s!==null;){if(m=s[Yi])return m;s=Ey(s)}return u}s=m,m=s.parentNode}return null}function ga(s){return s=s[Yi]||s[wo],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function nn(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function Xf(s){return s[dl]||null}var vm=[],wc=-1;function Xa(s){return{current:s}}function Qn(s){0>wc||(s.current=vm[wc],vm[wc]=null,wc--)}function qn(s,u){wc++,vm[wc]=s.current,s.current=u}var fl={},va=Xa(fl),eo=Xa(!1),_a=fl;function bc(s,u){var m=s.type.contextTypes;if(!m)return fl;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===u)return b.__reactInternalMemoizedMaskedChildContext;var x={},O;for(O in m)x[O]=u[O];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=u,s.__reactInternalMemoizedMaskedChildContext=x),x}function to(s){return s=s.childContextTypes,s!=null}function eh(){Qn(eo),Qn(va)}function xy(s,u,m){if(va.current!==fl)throw Error(n(168));qn(va,u),qn(eo,m)}function Cy(s,u,m){var b=s.stateNode;if(u=u.childContextTypes,typeof b.getChildContext!="function")return m;b=b.getChildContext();for(var x in b)if(!(x in u))throw Error(n(108,Xe(s)||"Unknown",x));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 My(s,u,m){var b=s.stateNode;if(!b)throw Error(n(169));m?(s=Cy(s,u,_a),b.__reactInternalMemoizedMergedChildContext=s,Qn(eo),Qn(va),qn(va,s)):Qn(eo),qn(eo,m)}var Ds=null,th=!1,ym=!1;function ky(s){Ds===null?Ds=[s]:Ds.push(s)}function vu(s){th=!0,ky(s)}function hl(){if(!ym&&Ds!==null){ym=!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,th=!1}catch(x){throw Ds!==null&&(Ds=Ds.slice(s+1)),cs(qs,hl),x}finally{ct=u,ym=!1}}return null}var Sc=[],ya=0,nh=null,rh=0,Yo=[],Uo=0,yu=null,zi=1,Vi="";function wu(s,u){Sc[ya++]=rh,Sc[ya++]=nh,nh=s,rh=u}function Ny(s,u,m){Yo[Uo++]=zi,Yo[Uo++]=Vi,Yo[Uo++]=yu,yu=s;var b=zi;s=Vi;var x=32-Rr(b)-1;b&=~(1<<x),m+=1;var O=32-Rr(u)+x;if(30<O){var W=x-x%5;O=(b&(1<<W)-1).toString(32),b>>=W,x-=W,zi=1<<32-Rr(u)+x|m<<x|b,Vi=O+s}else zi=1<<O|m<<x|b,Vi=s}function Cd(s){s.return!==null&&(wu(s,1),Ny(s,1,0))}function bu(s){for(;s===nh;)nh=Sc[--ya],Sc[ya]=null,rh=Sc[--ya],Sc[ya]=null;for(;s===yu;)yu=Yo[--Uo],Yo[Uo]=null,Vi=Yo[--Uo],Yo[Uo]=null,zi=Yo[--Uo],Yo[Uo]=null}var wa=null,bo=null,Xn=!1,pi=null;function Wi(s,u){var m=Eo(5,null,null,0);m.elementType="DELETED",m.stateNode=u,m.return=s,u=s.deletions
7 months ago
Error generating stack: `+O.message+`
6 months ago
`+O.stack}return{value:s,source:u,stack:x,digest:null}}function Nc(s,u,m){return{value:s,source:null,stack:m??null,digest:u??null}}function Dh(s,u){try{console.error(u.value)}catch(m){setTimeout(function(){throw m})}}var Th=typeof WeakMap=="function"?WeakMap:Map;function Ih(s,u,m){m=vi(-1,m),m.tag=3,m.payload={element:null};var b=u.value;return m.callback=function(){Ph||(Ph=!0,Qm=b),Dh(s,u)},m}function Bd(s,u,m){m=vi(-1,m),m.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var x=u.value;m.payload=function(){return b(x)},m.callback=function(){Dh(s,u)}}var O=s.stateNode;return O!==null&&typeof O.componentDidCatch=="function"&&(m.callback=function(){Dh(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 Vy(s,u,m){var b=s.pingCache;if(b===null){b=s.pingCache=new Th;var x=new Set;b.set(u,x)}else x=b.get(u),x===void 0&&(x=new Set,b.set(u,x));x.has(m)||(x.add(m),s=J1.bind(null,s,u,m),u.then(s,s))}function _m(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 Hd(s,u,m,b,x){return s.mode&1?(s.flags|=65536,s.lanes=x,s):(s===u?s.flags|=65536:(s.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(u=vi(-1,1),u.tag=2,gl(m,u,1))),m.lanes|=1),s)}var Wy=k.ReactCurrentOwner,Da=!1;function Ya(s,u,m,b){u.child=s===null?Em(u,null,m,b):yl(u,s.child,m,b)}function Bm(s,u,m,b,x){m=m.render;var O=u.ref;return pl(u,x),b=ph(s,u,m,b,O,x),m=mh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~x,Ji(s,u,x)):(Xn&&m&&Cd(u),u.flags|=1,Ya(s,u,b,x),u.child)}function qi(s,u,m,b,x){if(s===null){var O=m.type;return typeof O=="function"&&!ig(O)&&O.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(u.tag=15,u.type=O,Hm(s,u,O,b,x)):(s=Hh(m.type,null,b,u,u.mode,x),s.ref=u.ref,s.return=u,u.child=s)}if(O=s.child,!(s.lanes&x)){var W=O.memoizedProps;if(m=m.compare,m=m!==null?m:vt,m(W,b)&&s.ref===u.ref)return Ji(s,u,x)}return u.flags|=1,s=kl(O,b),s.ref=u.ref,s.return=u,u.child=s}function Hm(s,u,m,b,x){if(s!==null){var O=s.memoizedProps;if(vt(O,b)&&s.ref===u.ref)if(Da=!1,u.pendingProps=b=O,(s.lanes&x)!==0)s.flags&131072&&(Da=!0);else return u.lanes=s.lanes,Ji(s,u,x)}return Eh(s,u,m,b,x)}function Ym(s,u,m){var b=u.pendingProps,x=b.children,O=s!==null?s.memoizedState:null;if(b.mode==="hidden")if(!(u.mode&1))u.memoizedState={baseLanes:0,cachePool:null,transitions:null},qn(jc,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(jc,Io),Io|=s,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=O!==null?O.baseLanes:m,qn(jc,Io),Io|=b}else O!==null?(b=O.baseLanes|m,u.memoizedState=null):b=m,qn(jc,Io),Io|=b;return Ya(s,u,x,m),u.child}function $y(s,u){var m=u.ref;(s===null&&m!==null||s!==null&&s.ref!==m)&&(u.flags|=512,u.flags|=2097152)}function Eh(s,u,m,b,x){var O=to(m)?_a:va.current;return O=bc(u,O),pl(u,x),m=ph(s,u,m,b,O,x),b=mh(),s!==null&&!Da?(u.updateQueue=s.updateQueue,u.flags&=-2053,s.lanes&=~x,Ji(s,u,x)):(Xn&&b&&Cd(u),u.flags|=1,Ya(s,u,m,x),u.child)}function Zy(s,u,m,b,x){if(to(m)){var O=!0;Ho(u)}else O=!1;if(pl(u,x),u.stateNode===null)Ac(s,u),Tm(u,m,b),Im(u,m,b,x),b=!0;else if(s===null){var W=u.stateNode,ue=u.memoizedProps;W.props=ue;var ge=W.context,Pe=m.contextType;typeof Pe=="object"&&Pe!==null?Pe=Ba(Pe):(Pe=to(m)?_a:va.current,Pe=bc(u,Pe));var Ge=m.getDerivedStateFromProps,rt=typeof Ge=="function"||typeof W.getSnapshotBeforeUpdate=="function";rt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(ue!==b||ge!==Pe)&&jy(u,W,b,Pe),ml=!1;var qe=u.memoizedState;W.state=qe,lh(u,b,W,x),ge=u.memoizedState,ue!==b||qe!==ge||eo.current||ml?(typeof Ge=="function"&&(Dm(u,m,Ge,b),ge=u.memoizedState),(ue=ml||ch(u,m,ue,b,qe,ge,Pe))?(rt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.component
`)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return e.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error(`Unsupported platform: ${process.platform}`)}}function cr(e=!1){return new Promise((t,n)=>{eY(rY[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=iY(a.toString());return t(e?o:oY(o))})})}const vC={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},sY=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&&(C.setIcon(l.current,vC[f||"list"]),dt.setMemoListView(f),C.requireApiVersion("1.4.4")&&C.setTooltip(l.current,E("Switch view")))},[f]);const w=async S=>{var k;const D=!C.Platform.isDesktop&&await((k=window.Capacitor)==null?void 0:k.Plugins.Device.getId()),I=C.Platform.isDesktop?await cr():D.identifier||D.uuid;if(!r||(r==null?void 0:r.appId)!==I){fn();return}const M=async B=>{dt.setMemoListView(B),g&&(g.settings.MemoListView=B,await g.saveSettings()),h(B)},N=[{view:"list",title:E("List")},{view:"chat",title:E("Chat")},{view:"moments",title:E("Moments")}];(!i||a!=null&&a.SupportSelectOtherView)&&N.push({view:"waterfall",title:E("Waterfall")},{view:"calendar",title:E("Calendar")},{view:"table",title:E("Table")});const _=new C.Menu;N.forEach(({view:B,title:L})=>{_.addItem(R=>{R.setChecked(f===B).setIcon(vC[B]).setTitle(L).onClick(()=>{f!==B&&M(B)})})}),_.showAtMouseEvent(S.nativeEvent)};return v.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:l,onClick:w})},lY=()=>{const e=P.useRef(null);return P.useEffect(()=>{e&&(C.setIcon(e.current,"calendar-check"),C.setTooltip&&C.setTooltip(e.current,E("Daily Memos")))},[e]),v.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{at.setPathname("/daily")}})},AS=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),yC={initialValue:"",interval:300};class uY{constructor(t,n=yC){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=[AS()],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
6 months ago
Check the documentation or create issue if you think it's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},CY=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],E0=function(t){return DY(t).map(function(n){return CY.includes(n)?"\\".concat(n):n}).join("")},MY=function(e){Tb(t,e);function t(){return Rv(this,t),Db(this,wp(t).apply(this,arguments))}return Sb(t,[{key:"componentDidMount",value:function(){var r=this.props.boundariesElement;if(typeof r=="string"){var a=document.querySelector(r);if(!a)throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");this.containerElem=a}else if(r instanceof HTMLElement)this.containerElem=r;else throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");if(!this.containerElem||!this.containerElem.contains(this.ref))throw new Error("RTA: Invalid prop boundariesElement: it has to be one of the parents of the RTA.")}},{key:"componentDidUpdate",value:function(){var r,a,o=this.props.top||0,i=this.props.left||0,l=[],c=[],f=0,h=0,g=this.containerElem.getBoundingClientRect(),y=this.ref.getBoundingClientRect(),w=this.props.textareaRef.getBoundingClientRect(),S=window.getComputedStyle(this.ref),D=parseInt(S.getPropertyValue("margin-top"),10),I=parseInt(S.getPropertyValue("margin-bottom"),10),M=parseInt(S.getPropertyValue("margin-left"),10),N=parseInt(S.getPropertyValue("margin-right"),10),_=D+I+w.top+o+y.height,k=M+N+w.left+i+y.width;k>g.right&&w.left+i>y.width?(h=i-y.width,l.push(Yc.X.LEFT),c.push(Yc.X.RIGHT)):(h=i,l.push(Yc.X.RIGHT),c.push(Yc.X.LEFT)),_>g.bottom&&w.top+o>y.height?(f=o-y.height,l.push(Yc.Y.TOP),c.push(Yc.Y.BOTTOM)):(f=o,l.push(Yc.Y.BOTTOM),c.push(Yc.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?q2.createPortal(g,h):g}}]),t}(ne.Component),T6=function(e){Tb(t,e);function t(n){var r;Rv(this,t),r=Db(this,wp(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=uf.add(Ci.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(uf.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 Ci.UP:case Ci.DOWN:r._isAutocompleteOpen()||f();break;case Ci.LEFT:case Ci.RIGHT:f();break}return}f()},r._onSelect=function(c){var f=r.state,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=E0(g),_=M.length-M.lastIndexOf(g),k=M.search(new RegExp("(?!".concat(N,")$")
7 months ago
Got "`.concat(String(y),'". Check the implementation for trigger "').concat(c,`"
8 months ago
See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information.
6 months ago
`));if(y===null)return null;if(typeof y=="string")return{text:y,caretPosition:bC};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
6 months ago
`);return{text:"".concat(c).concat(g).concat(c),caretPosition:bC}}},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 SC(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 E0(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 E0(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=vY({},r.props),f=["loadingComponent","boundariesElement","containerStyle","minChar","scrollToItem","ref","innerRef","onChange","onCaretPositionChange","className","value","trigger","listStyle","itemStyle","containerStyle","loaderStyle","className","containerClassName","listClassName","itemClassName","loaderClassName","dropdownStyle","dropdownClassName","movePopupAsYouType","textAreaComponent","renderToBody","onItemSelected","onItemHighlighted"];for(var h in c)f.includes(h)&&delete c[h];return c},r._changeHandler=function(c){var f=r.props,h=f.trigger,g=f.onChange,y=f.minChar,w=f.onCaretPositionChange,S=f.movePopupAsYouType,D=r.state,I=D.top,M=D.left,N=c;N||(N=new mY("change",{bubbles:!0}),r.textareaRef.dispatchEvent(N));var _=N.target||r.textareaRef,k=_.selectionEnd,B=_.value;if(r.lastValueBubbledEvent=B,g&&N&&(N.persist&&N.persist(),g(new Proxy(N,{get:function(X,ae,De){return ae==="target"?_:Reflect.get(X,ae,De)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:B});var R=function(){var X=fY(_,k),ae=X.top,De=X.left;r.setState({top:ae-r.textareaRef.scrollTop||0,left:De})},V=function(X){r.lastTrigger=k-X,r._closeAutocomplete(),R()};if(k<=r.lastTrigger){var Y=B.slice(0,k),Z=r.tokenRegExp.exec(Y);V(Z?Z[0].length:0)}var Q=B.slice(r.lastTrigger,k),G=r.tokenRegExp.exec(Q),le=G&&G[0],se=G&&G[1]||null,fe=se?se.length-1:0,$=r.tokenRegExpEnding.exec(Q);if($?V($[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!le||le.length<=y+fe)&&(r.state.currentTrigger&&!h[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(se&&h[se].afterWhitespace&&!/\s/.test(B[k-le.length-1])&&B[k-le.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&h[r.state.currentTrigger].allowWhitespace){if(G=new RegExp("".concat(E0(r.state.currentTrigger),".*$")).exec(B.slice(0,k)),le=G&&G[0],!le){r._closeAutocomplete();return}se=Object.keys(h).find(function(ce){return ce.slice(0,fe+1)===le.slice(0,fe+1)})||null}var he=le.slice(1);if(se){(S||I===null&&M===null||r.state.currentTrigger!==se)&&R(),r.escListenerInit();var ie=r._getTextToReplace(se);r.setState({selectionEnd:k,currentTrigger:se,textToReplace:ie,actualToken:he},function(){try{r._getValuesFromProvider()}catch(ce){SC(ce.message)}})}},r._selectHandler=function(c){var f=r.props,h=f.onCaretPositionChange,g=f.onSelect;if(h){var y=r.getCaretPosition();h(y)}g&&(c.persist(),g(c))},r._shouldStayOpen=function(c){var f=c.relatedTarget;return f===null&&(f=document.activeElement),!!(r.dropdownRef&&f instanceof Node&&r.dropd
7 months ago
`,et.id);else{const St=_e.toPNG(),Tt=new Blob([St],{type:"image/png"}),Gt=new File([Tt],"image.png",{type:"image/png",lastModified:Date.now()});if(!Gt)return;const _t=await ce(Gt);_t&&((ht=D.current)==null||ht.insertText(_t+`
6 months ago
`,et.id))}})))},[D,l,o]),P.useEffect(()=>{i&&h(i.DefaultPrefix==="List")},[i==null?void 0:i.DefaultPrefix]),P.useEffect(()=>{if(i){if(i.EnabledLocationList.length===1){G(i.EnabledLocationList[0].value);return}G(i.MemoSaveLocation||"DAILY")}},[i==null?void 0:i.MemoSaveLocation,i==null?void 0:i.EnabledLocationList]),P.useEffect(()=>{var nt;if(!i||!Z.current)return;const _e=(nt=Jg.find(ht=>ht.title===Q))==null?void 0:nt.icon;C.setIcon(Z.current,_e),C.requireApiVersion("1.4.4")&&C.setTooltip(Z.current,E("Thino Save To: ")+Q),le.current=Q;const et=a.manifest;if(et){const ht=o==null?void 0:o.plugins.getPlugin(et.id);if(ht){if(ht.settings.MemoSaveLocation===Q)return;ht.settings.MemoSaveLocation=Q,ht.saveSettings()}}},[Q,y]),P.useEffect(()=>{D.current&&i.MemoSaveLocation&&G(i.MemoSaveLocation)},[Z,i]),P.useEffect(()=>{if(!D.current||!i||C.Platform.isDesktop||a.globalEditorShown)return;const _e=i.UseButtonToShowEditor&&i.DefaultEditorLocation==="Bottom";if(C.Platform.isDesktop){w(!0);return}if(t&&t==="inline"){w(!0);return}if(w(C.Platform.isMobile&&!_e),!_e||a.memoListView==="chat")return;const 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();C.Platform.isMobile&&_e&&!nt&&w(!1)})},[a.globalEditorShown,t,D]);const se=()=>{k(!1)};P.useEffect(()=>{var _e,et,nt,ht,St,Tt,Gt,_t,Vt;if(o&&(a.markMemoId||(_e=a.editMemoId)!=null&&_e.trim()&&a.editMemoId!==I.current.editMemoId)){const Xt=o.workspace.getLeavesOfType("thino_view");Xt.length>0&&o.workspace.revealLeaf(Xt[0])}if(a.markMemoId){const Xt=`${E("MARK")}: [@THINO](${a.markMemoId})`;(et=D.current)==null||et.insertText(Xt),(nt=D.current)==null||nt.focus(),dt.setMarkMemoId("");return}if((ht=a.editMemoId)!=null&&ht.trim()&&a.editMemoId!==I.current.editMemoId){const Xt=we.getMemoById(a.editMemoId);if(Xt)switch(h(Xt.thinoType==="JOURNAL"),i.EditorType){case"memos":(St=D.current)==null||St.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Tt=D.current)==null||Tt.focus();break;case"obsidian":(Gt=D.current)==null||Gt.clear(),(_t=D.current)==null||_t.setContent(Xt.content.replace(/ \^\S{6}$/,"")||""),(Vt=D.current)==null||Vt.focus();break}}I.current=a},[a.markMemoId,a.editMemoId]),P.useEffect(()=>{var _e,et,nt;!D.current||M||i.EditorType==="memos"&&((_e=D.current)==null||_e.element.addEventListener("paste",fe),(et=D.current)==null||et.element.addEventListener("drop",$),(nt=D.current)==null||nt.element.addEventListener("click",he),N(!0))},[D.current]);const fe=async _e=>{var et;if(_e.clipboardData&&_e.clipboardData.files.length>0){_e.preventDefault();const nt=_e.clipboardData.files;for(const ht of nt){const St=await ce(ht);St&&((et=D.current)==null||et.insertText(St))}}},$=async _e=>{var et;if(_e.dataTransfer&&_e.dataTransfer.files.length>0){_e.preventDefault();const nt=_e.dataTransfer.files;for(const ht of nt){const St=await ce(ht);St&&((et=D.current)==null||et.insertText(St))}}},he=()=>{var _e;De(((_e=D.current)==null?void 0:_e.element.value)||"")},ie=async(_e,et)=>{var St,Tt,Gt;const nt=_e.ctrlKey||_e.metaKey,ht=_e.altKey;if(_e.key==="Escape"&&a.globalEditorShown&&(dt.setGlobalEditorShown(!1),_e.preventDefault()),nt&&_e.key==="Enter"){_e.preventDefault(),_e.stopPropagation(),et?(await X((Tt=D.current)==null?void 0:Tt.getContent()),(Gt=D.current)==null||Gt.clear()):await X((St=D.current)==null?void 0:St.element.value);return}if(ht)for(let _t=0;_t<i.EnabledLocationList.length;_t++)_e.key===(_t+1).toString()&&G(i.EnabledLocationList[_t].value);setTimeout(()=>{var _t;et||De(((_t=D.current)==null?void 0:_t.element.value)||"")})},ce=P.useCallback(async _e=>{const{type:et}=_e;if(et.startsWith("image"))try{return`${await $2.upload(_e)}`}catch(nt){new C.Notice(nt)}},[]),X=async _e=>{if(!_e||_e.trim()===""){new C.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=(ez()||[]).filter(dn=>!_e.include
7 months ago
`:""}${_e}`:`${_e} ${ht?`
6 months ago
`:""}${Gt.map(dn=>`#${dn}`).join(" ")}`:_e;await _t(Vt,Xt),C0("")},ae=P.useCallback(()=>{var _e;dt.setEditMemoId(""),(_e=D.current)==null||_e.setContent(""),C0("")},[]),De=P.useCallback(_e=>{if(C0(_e??""),!D.current)return;const et=D.current.getContent(),nt=D.current.element.selectionStart,ht=et.slice(0,nt),St=et.slice(nt);(ht.endsWith("@")||ht.endsWith("📆"))&&St.startsWith(" ")||(ht.endsWith("@")||ht.endsWith("📆"))&&St===""?(Ze(),k(!0)):k(!1),setTimeout(()=>{var Tt;(Tt=D.current)==null||Tt.focus()})},[i.EditorType]),je=_e=>{if(!D.current||!i)return;_e&&(se(),h(!1));const et=D.current.getContent(),nt=D.current.element.selectionStart,ht=et.slice(0,nt),St=et.slice(nt),Tt=C.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=!C.Platform.isDesktop&&await((nt=window.Capacitor)==null?void 0:nt.Plugins.Device.getId()),et=C.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 C.Menu;i.EnabledLocationList.forEach(Tt=>{et.addItem(Gt=>{var _t;Gt.setTitle(E(Tt.value)).setIcon(((_t=Jg.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}=tz(D.current.element);let _t,Vt;C.Platform.isMobile?(window.innerWidth-Tt>ht?_t=(Tt+ht+16>St,Tt+18):window.innerWidth-Tt<ht?_t=(Tt+ht+16>St,Tt+34):_t=D.current.element.clientWidth/2,i.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?Vt=Gt+4:i.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?Vt=Gt+19:i.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&(Vt=Gt+36)):(_t=(Tt+ht+16>St,Tt+18),Vt=Gt+34),B(Tt),L.current.style.left=`${_t}px`,L.current.style.top=`${Vt}px`},[i,o]),st=P.useCallback(()=>{const _e=document.createElement("input");document.body.appendChild(_e),_e.type="file",_e.multiple=!1,_e.accept="image/png, image/gif, image/jpeg",_e.onchange=async()=>{var ht;if(!_e.files||_e.files.length===0)return;const et=_e.files[0],nt=await ce(et);nt&&((ht=D.current)==null||ht.insertText(nt)),document.body.removeChild(_e)},_e.click()},[]),xt=!!a.editMemoId,tn=P.useMemo(()=>({className:"memo-editor",inputerType:i.EditorType||"obsidian",modal:r,initialContent:nz(),placeholder:E("What do you think now..."),showConfirmBtn:!0,showCancelBtn:xt,showTools:!0,onConfirmBtnClick:X,onCancelBtnClick:ae,onContentChange:De}),[xt,i.EditorType]);return v.jsxs(v.Fragment,{ch
7 months ago
`},"")),y+r+I.replace(/ \^\S{6}/g,"")+`
6 months ago
`+M},"");return e.reduce((g,y)=>{const w=t!=null&&t.ShowDate?`- [[${C.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,`
6 months ago
`)},iz=[{label:E("Today"),value:C.moment().format("YYYY-MM-DD")},{label:E("Yesterday"),value:C.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:E("Last 7 days"),value:C.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:E("Last 30 days"),value:C.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:E("Last 90 days"),value:C.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:E("Last 180 days"),value:C.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:E("Last 365 days"),value:C.moment().subtract(365,"days").format("YYYY-MM-DD")}],W6=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:iz.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(Ib,{className:"calendar-date-picker",datestamp:(e==null?void 0:e.defaultValue)||C.moment().startOf("day").valueOf(),handleDateStampChange:(r,a)=>{t(e.type==="icon"?C.moment(r).format("YYYY-MM-DD"):r.toString()),n&&n(!1)}})]})},Fw=e=>{const{handleValueChange:t}=e,[n,r]=ne.useState(!1),a=ne.useRef(null),o=ne.useRef(null),i=xb(o.current,a.current,{placement:"bottom-start"});return _v(a,()=>{r(!1)}),v.jsxs(v.Fragment,{children:[v.jsx("span",{ref:c=>{o.current=c,c&&e.type==="icon"&&C.setIcon(c,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!C.Platform.isMobile&&r(!n),!C.Platform.isMobile&&(i!=null&&i.update)&&(i==null||i.update()),C.Platform.isMobile&&new $6(ft.getState().app,e.type,t).open()},children:e.type==="text"&&e.defaultValue?e.defaultText?e.defaultText:C.moment(e.defaultValue,"x").subtract(e.startOrEnd==="end"?1:0,"days").format("YYYY/MM/DD"):""}),v.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:i.styles.popper,children:v.jsx(W6,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class $6 extends C.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=jv(n),this.root.render(v.jsx(W6,{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 lz{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 Z6{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 C.Scope,this.cb=n,this.suggestEl=createDiv("suggestion-container");const r=this.suggestEl.createDiv("suggestion");this.suggest=new lz(this,r,this.scope),this.scope.register([],"Escape",th
7 months ago
`:""}${V}`:`${V} ${B?`
6 months ago
`:""}${_.map(Y=>`#${Y}`).join(" ")}`),R&&R.content!==V){const Y=await we.updateMemo(R.id,V==null?void 0:V.trim());L.push(Y)}}L.length>0&&we.editMemoBulk(L),L.length>0&&at.clearQuery()};return v.jsxs("div",{className:"thino-tag-operation",children:[v.jsx("div",{className:"tag-operation-title",children:E("Tag Bulk Edit")}),v.jsxs("div",{className:"tag-operation-content",children:[r.length>0&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[v.jsx("div",{className:"name",children:E("Exist Tags")}),v.jsx("div",{className:"desc",children:E("Click to remove exist tag")})]}),v.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(N=>v.jsx("div",{className:ar("tag-operation-content-tag",l.includes(N)&&"tag-operation-content-tag-removed"),onClick:()=>{l.includes(N)||c([...l,N]),l.includes(N)&&c(l.filter(_=>_!==N)),o.includes(N)&&i(o.filter(_=>_!==N))},children:N},N))})]}),v.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[v.jsx("div",{className:"name",children:E("Selected Tags")}),v.jsx("div",{className:"desc",children:E("Click to remove selected tag")})]}),v.jsx("div",{className:"tag-operation-content-tags selected-tags",children:o.map(N=>v.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{i(o.filter(_=>_!==N))},children:N},N))}),v.jsx("div",{className:"tag-operation-content-inputer",children:v.jsx("input",{placeholder:E("Input to select exist tag"),ref:S,onKeyDown:N=>{N.key==="Enter"&&D(S.current.value)}})}),v.jsxs("div",{className:"tag-operation-settings",children:[v.jsx("div",{ref:h}),v.jsx("div",{ref:g})]}),v.jsxs("div",{className:"tag-operation-content-btn-group",children:[v.jsx("button",{className:"cancel-btn",onClick:n,children:E("Cancel")}),v.jsx("button",{className:"save-btn",onClick:I,children:E("Save")})]})]})]})},ET=new Map,wf=async(e,t=!0)=>{const{vault:n,metadataCache:r}=ft.getState().app;if(t&&ET.has(e))return Promise.resolve(ET.get(e));if(e.contains("data:image"))return e;let a;const o=await n.adapter.exists(C.normalizePath(e));let i="";try{if(!o&&!/(http|https)/g.test(e)&&!e.includes("data:image")){let l;if(e.startsWith("app://")){const c=C.normalizePath(decodeURIComponent(e).replace(C.Platform.resourcePathPrefix,"").replace(/\?(.*)$/,"").replace(C.normalizePath(app==null?void 0:app.vault.adapter.basePath),""));i=C.normalizePath(decodeURIComponent(c))}else{if(l=r.getFirstLinkpathDest(e,""),!l){new C.Notice(E("File not exist"));return}i=l.path}}else i=e}catch(l){console.error(l)}if(i){if(/(http|https)/g.test(i))if(i.startsWith("http://localhost")){let l=i;l=l.replace("http://localhost/_capacitor_file_",""),l=decodeURIComponent(l).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),l=C.normalizePath(decodeURIComponent(l));const c=await n.adapter.readBinary(l),f=new Uint8Array(c);a=new Blob([f],{type:"image/png"})}else try{const l=await C.requestUrl(e),c=new Uint8Array(l.arrayBuffer);a=new Blob([c],{type:"image/png"})}catch{}else if(i){const l=await n.adapter.readBinary(i),c=new Uint8Array(l);a=new Blob([c],{type:"image/png"})}return a?await pz(a,e):""}},pz=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;ET.set(t,a),n(a)},r.readAsDataURL(e)}),jg=async e=>{if(!e.style.backgroundImage.includes("url(")&&!e.style.backgroundImage.includes("http"))return;let t=e.style.backgroundImage.includes("url(")?e.style.backgroundImage.slice(5,-2):e.style.backgroundImage;return t?(t.startsWith("http://localhost")&&(t=t.replace("http://localhost/_capacitor_file_",""),t=decodeURIComponent(t).replace(/\?(.*)$/,"").replace(app==null?void 0:app.vault.adapter.basePath,""),t=C.normalizePath(decodeURIComponent(t))),await wf(t)):void 0},mz=async e=>{var n;return e.getAttribute("src")?(n=e==null?void 0:e.src)!=null&&n.startsWith("http://localhost")?await wf(e.getAttribute("path")||C.normalizePath(e==null?void 0:e.parentElement.getAttribute("src"))):await wf(e.getAttribute("src")):void 0},Zt=Ez(),Ow=xz(),q6=Cz(),G6=Mz(),Xd={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 Ow.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 Ow.inlineAll(o.cssText,l)},src:function(){return o.style.getPropertyValue("src")}}}}}function Mz(){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?Ow.inlineAll(c).then(function(h){a.style.setProperty(l,h,f)}):Promise.resolve()});return Promise.all(i).then(function(){return a})}}}function kz(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 Nz(e,t,n,r,a){const o=wn.impl.options.copyDefaultStyles?Fz(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);kz(i,l,c,g)}})}let M0=null,lw={};const Az=["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 Fz(e,t){const n=l(t),r=c(n);if(lw[r])return lw[r];const a=Oz(),o=f(a.document,n),i=h(a,o);return g(o),lw[r]=i,i;function l(y){const w=[];do{if(y.nodeType===aI){const S=y.tagName;if(w.push(S),Az.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 Oz(){if(xi)return xi.contentWindow;const e=document.characterSet||"UTF-8",t=document.doctype,n=t?`<!DOCTYPE ${r(t.name)} ${r(t.publicId)} ${r(t.systemId)}`.trim()+">":"";return xi=document.createElement("iframe"),xi.id="domtoimage-sandbox-"+Zt.uid(),xi.className="domtoimage-thino",xi.style.visibility="hidden",xi.style.position="fixed",document.body.appendChild(xi),a(xi,n,e,"domtoimage-sandbox");function r(o){if(o){const i=document.createElement("div");return i.innerText=o,i.innerHTML}else return""}function a(o,i,l,c){try{return o.contentWindow.document.write(`${i}<html><head><meta charset='${l}'><title>${c}</title></head><body></body></html>`),o.contentWindow}catch{}const f=document.createElement("meta");f.setAttribute("charset",l);try{const 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 Pz(){xi&&(document.body.removeChild(xi),xi=null),M0&&clearTi
7 months ago
Before: <div {...getCollapseProps({style: {padding: 10}})}>{children}</div>
After: <div {...getCollapseProps()}>
<div style={{padding: 10}}>
{children}
</div>
6 months ago
</div>`)},P.useEffect(()=>{t(e)},[e])}var Qz=typeof window>"u"?P.useEffect:P.useLayoutEffect;function Xz({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=X6(n),f=Zz(i?`${i}`:void 0),[h,g]=Bz(r,a),y=P.useRef(h),[w,S]=P.useState(!1),D=Yz(),I=o??D,M=P.useRef(),N=P.useRef(),_=P.useRef(null),[k,B]=P.useState(null);Kz(_);const L=`${l.collapsedHeight||0}px`;function R(V){if(!_.current)return;const Y=_.current;for(const Z in V){const Q=V[Z];Q?Y.style[Z]=Q:Y.style.removeProperty(Z)}}return Qz(()=>{if(!_.current||h===y.current)return;y.current=h;function Y(G){return I?0:e??Gz(G)}const Z=G=>`height ${Y(G)}ms ${t}`,Q=G=>{function le(){h?(R({height:"",overflow:"",transition:"",display:""}),c("expandEnd")):(R({transition:""}),c("collapseEnd")),S(!1)}N.current&&BC(N.current),N.current=qz(le,G)};return S(!0),h?M.current=requestAnimationFrame(()=>{c("expandStart"),R({display:"block",overflow:"hidden",height:L}),M.current=requestAnimationFrame(()=>{c("expanding");const G=HC(_);Q(Y(G)),_.current&&(_.current.style.transition=Z(G),_.current.style.height=`${G}px`)})}):M.current=requestAnimationFrame(()=>{c("collapseStart");const G=HC(_);Q(Y(G)),R({transition:Z(G),height:`${G}px`}),M.current=requestAnimationFrame(()=>{c("collapsing"),R({height:L,overflow:"hidden"})})}),()=>{M.current&&cancelAnimationFrame(M.current),N.current&&BC(N.current)}},[h,L,I,e,t,c]),{isExpanded:h,setExpanded:g,getToggleProps(V){const{disabled:Y,onClick:Z,refKey:Q,...G}={refKey:"ref",onClick(){},disabled:!1,...V},le=k?k.tagName==="BUTTON":void 0,se=V==null?void 0:V[Q||"ref"],fe={id:`react-collapsed-toggle-${f}`,"aria-controls":`react-collapsed-panel-${f}`,"aria-expanded":h,onClick(ie){Y||(Z==null||Z(ie),g(ce=>!ce))},[Q||"ref"]:YC(se,B)},$={type:"button",disabled:Y?!0:void 0},he={"aria-disabled":Y?!0:void 0,role:"button",tabIndex:Y?-1:0};return le===!1?{...fe,...he,...G}:le===!0?{...fe,...$,...G}:{...fe,...$,...he,...G}},getCollapseProps(V){const{style:Y,refKey:Z}={refKey:"ref",style:{},...V},Q=V==null?void 0:V[Z||"ref"];return{id:`react-collapsed-panel-${f}`,"aria-hidden":!h,"aria-labelledby":`react-collapsed-toggle-${f}`,role:"region",...V,[Z||"ref"]:YC(_,Q),style:{boxSizing:"border-box",...!w&&!h?{display:L==="0px"?"none":"block",height:L,overflow:"hidden"}:{},...Y}}}}}const eV=e=>{const{dailyNotesState:{app:t,view:n,settings:r},globalState:{memoListView:a}}=P.useContext(Lt),{getCollapseProps:o,getToggleProps:i,isExpanded:l,setExpanded:c}=Xz({defaultExpanded:!0,collapsedHeight:(r==null?void 0:r.ThinoCollapsedHeight)??100}),{memo:f,handleMemoContentClick:h,handleMemoDoubleClick:g}=e,y=ne.useRef(null),[w,S]=ne.useState(""),D=ne.useRef(w),I=ne.useRef(0),[M,N]=ne.useState(!1),[_,k]=ne.useState(!1),B=C.debounce((R,V,Y)=>{for(const Z of R){const{height:Q}=Z.contentRect,G=(V==null?void 0:V.ThinoMaxHeight)||340,le=Q>G;N(le),c(!le),Y.disconnect()}},500);P.useEffect(()=>{var R;if(f.content!==D.current){if(r!=null&&r.OptimizeForCallout&&f.content.split("> [!").length>3&&f.content.split(`
`).length>10&&!_){const V=y.current.createEl("button");V.setText(E("Render content")),V.onclick=async()=>{k(!0),await L()};const Y=y.current.createEl("textarea");Y.setText(f.content),Y.disabled=!0,(R=y.current)==null||R.toggleClass(["raw-content"],!0),c(!0),N(!1);return}L()}},[f.content]),P.useEffect(()=>{_&&I.current!==(r==null?void 0:r.ThinoMaxHeight)&&(y!=null&&y.current.hasChildNodes()&&k(!1),L())},[r==null?void 0:r.ThinoMaxHeight]),P.useEffect(()=>{if(!_)return;const R=y.current;if(!R)return;if(!(r!=null&&r.ThinoMaxHeight)){c(!0),N(!1);return}const V=new ResizeObserver(Y=>{B(Y,r,V)});return V.observe(R),()=>V.disconnect()},[_]);const L=async()=>{var R,V,Y;if(y.current&&n&&t&&f.content!==D.current){y.current.empty(),await C.MarkdownRenderer.render(t,f.content,y.current,f.path,n);const Z=(R=y.current)==null?void 0:R.querySelectorAll(".internal-link");Z==null||Z.forEach(Q=>{const G=Q,le=G.getAttribute("data-href");if(!le)return;t.metadataCache.getFirstLinkpathDest(le,f.path)||Q.classList.add("is-unresolved"),G.addEventListener("mouseover",fe=>{fe.stopPropagation(),t.workspace.trigger("hover-link",{event:fe,source:"thino",hoverParent:n.containerEl,targetEl:G,linktext:le,sourcePath:G.href})})})}D.current=f.content,(V=y.current)==null||V.toggleClass(["markdown-rendered"],!0),(Y=y.current)==null||Y.toggleClass(["raw-content"],!1),k&&k(!0),I.current=(r==null?void 0:r.ThinoMaxHeight)||340};return v.jsxs(v.Fragment,{children:[M&&a==="moments"&&v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"thino-collapse-button",...i({style:{display:"block",marginTop:2}}),children:E(l?"Collapse":"Expand")}),!l&&(r==null?void 0:r.ThinoCollapsedHeight)!==0&&v.jsx("div",{className:"thino-collapse-shadowOverlay",onDoubleClick:g})]}),v.jsx("div",{...o({style:{margin:0}}),ref:y,className:"memo-content-text",onClick:R=>h(R,f),onDoubleClick:g,onContextMenu:R=>{R.preventDefault()}}),M&&a!=="moments"&&v.jsxs(v.Fragment,{children:[!l&&(r==null?void 0:r.ThinoCollapsedHeight)!==0&&v.jsx("div",{className:"thino-collapse-shadowOverlay",onDoubleClick:g}),v.jsx("button",{className:"thino-collapse-button",...i({style:{display:"block",marginTop:2}}),children:E(l?"Collapse":"Expand")})]})]})},eF=P.memo(eV,(e,t)=>e.memo.content===t.memo.content),tV=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(rd)];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 C.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&&C.setIcon(h,"edit")},className:"btn edit-btn",onClick:f}),v.jsx("button",{ref:h=>{h&&C.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(eF,{memo:t,handleMemoContentClick:l,handleMemoDoubleClick:()=>{}})})}),v.jsx("div",{className:"layer-container"})]}),r.length>0?v.jsxs("div",{classN
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(h),children:[v.jsxs("span",{className:"time-text",children:[h.dateStr," "]}),g]},h.id)})]}):null,o.length>0?v.jsxs("div",{className:"linked-memos-wrapper",children:[v.jsxs("span",{className:"normal-text",children:[o.length," THINO ",E("LINK TO THE")," THINO"]}),o.map(h=>{const g=kx(uT(h.content)).replaceAll(`
`," ");return v.jsxs("div",{className:"linked-memo-container",onClick:()=>c(h),children:[v.jsxs("span",{className:"time-text",children:[h.dateStr," "]}),g]},h.id)})]}):null]})};function bf(e){bb({className:"memo-card-dialog"},tV,{memo:e})}function nV({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 rV=e=>{const{memo:t,handlePinMemoClick:n,handleFixMemoClick:r,handleSourceMemoClick:a,handleShowMemoStoryDialog:o,handleCopyMemoClick:i,handleEditMemoClick:l,handleGenMemoImageBtnClick:c,handleMarkMemoClick:f,handleArchiveMemo:h,handleDeleteMemoClick:g,handleSplitMemoClick:y}=e,w=Le.getState().dailyNotesState.settings,S=w.EnabledLocationList.find(Y=>Y.value==="MULTI"),[D,I]=Kl(!1),M=P.useRef(null),N={pinRef:P.useRef(null),fixRef:P.useRef(null),typeRef:P.useRef(null),moreRef:P.useRef(null)},[_,k]=nV({mouseEnterDelayMS:500}),B=P.useRef();P.useEffect(()=>{if(!N.typeRef)return;const Y=Jg.find(Z=>Z.title===t.sourceType);C.setIcon(N.typeRef.current,Y.icon),C.requireApiVersion("1.4.4")&&C.setTooltip(N.typeRef.current,t.path),N.fixRef&&(C.setIcon(N.fixRef.current,"shield-alert"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.fixRef.current,"Update Thino property"))},[N.typeRef]),P.useEffect(()=>{N.pinRef&&(t.pinned?(C.setIcon(N.pinRef.current,"pin-off"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.pinRef.current,E("UNPIN"))):(C.setIcon(N.pinRef.current,"pin"),C.requireApiVersion("1.4.4")&&C.setTooltip(N.pinRef.current,E("PIN"))))},[N.pinRef,t.pinned]);const L=C.debounce(()=>{var Y;if(_&&N.moreRef.current){if(B.current&&B.current._loaded||(Y=B.current)!=null&&Y.useNativeMenu||document.body.find(".more-action-btns-wrapper"))return;const Z=R(),Q=N.moreRef.current.getBoundingClientRect();Z.showAtPosition({x:Q.left,y:Q.bottom})}},200);P.useEffect(()=>{L()},[_]);const R=()=>{var Z;const Y=new C.Menu;return Y.dom.toggleClass(["more-action-btns-wrapper"],!0),Y.useNativeMenu?(Y.setNoIcon(),Y.addItem(Q=>{Q.setTitle(E("COPY")).onClick(i)}),Y.addItem(Q=>{Q.setTitle(E("EDIT")).onClick(l)}),Y.addItem(Q=>{Q.setTitle(E("SHARE")).onClick(c)})):Y.addItem(Q=>{const G=Q.dom;Q.dom.empty(),Q.dom.toggleClass(["more-action-btn-group","more-action-menu-item"],!0);const le=G.createEl("span");new C.ExtraButtonComponent(le).setIcon("copy"),le.toggleClass(["menu-item-icon","more-action-item-icon"],!0),le.onclick=$=>{$.stopPropagation(),$.preventDefault(),i(),Y.close()};const se=G.createEl("span");se.toggleClass(["menu-item-icon","more-action-item-icon"],!0),se.onclick=$=>{$.stopPropagation(),$.preventDefault(),l(),Y.close()},new C.ExtraButtonComponent(se).setIcon("pencil");const fe=G.createEl("span");fe.toggleClass(["menu-item-icon","more-action-item-icon"],!0),fe.onclick=$=>{$.stopPropagation(),$.preventDefault(),c(),Y.close()},new C.ExtraButtonComponent(fe).setIcon("share-2")}),Y.addSeparator(),Y.addItem(Q=>{Q.setIcon("book-open").setTitle(E("READ")).onClick(o)}),Y.addItem(Q=>{Q.setIcon("bookmark").setTitle(E("MARK")).onClick(f)}),((Z=/(^|\n)#{1,6}\s/g.exec(t.content))==null?void 0:Z.length)>1&&S&&Y.addItem(Q=>{Q.setIcon("separator-horizontal").setTitle(E("SPLIT")).onClick(y)}),Y.addItem(Q=>{Q.setIcon("home").setTitle(E("SOURCE")).onClick(()=>a(t))}),Y.addSeparator(),Y.addItem(Q=>{Q.setWarning(!0).setIcon("archive").setTitle(E("ARCHIVE").toUpperCase()).onClick(()=>h(t))}),Y.addItem(Q=>{Q.setWarning(!0).setIcon("trash").setTitle(w.DeleteThinoDirectly?E("DELETE"):E("TRASH BOX").toUpperCase().toUpperCase()).onClick(G=>{if(Y.useNativeMenu)g(G),Y.close();else if(G.stopPropagation(),G.preventDefault(),!D){I(!0),Q.setTitle(E("CONFIRM")).onClick(le=>{g(le),Y.close()});return}})}),Y.addSeparator(),Y.addItem(Q=>{Q.setDisabled(!0).setTitle(ut.getWordCount(t.content.replace(/```[^\S\r\n]*[a-z]*\n.*?\n```/g,""))+` ${E("words")}`)}),Y.onHide(()=>{I(!1)}),B.current=Y,Y},V=Y=>{R().showAtMouseEvent(Y.nativeEvent)};return v.jsx("div",{ref:M,className:"memo-top-right-wrapper",children:v.jsxs(
`),a=new Array(n).join("#")+" ",o=new Array(n+1).join("#")+" ",i=[];let l=[];return r.forEach((c,f)=>{c.startsWith(o)?(l.length>0&&(i.push(l),l=[]),l.push(c)):l.length>0&&!c.startsWith(a)?l.push(c):l.length>0&&(i.push(l),l=[]),f===r.length-1&&l.length>0&&i.push(l)}),i}onChooseSuggestion(t,n){this.selectSuggestion(t,n)}renderSuggestion(t,n){n.setText(t.title)}getSuggestions(){return[{id:"splitByHeading1",title:E("Split by Heading 1")},{id:"splitByHeading2",title:E("Split by Heading 2")},{id:"splitByHeading3",title:E("Split by Heading 3")}]}async selectSuggestion(t,n){let r=[];if(t.id==="splitByHeading1"?r=this.contentSplitByHeading(this.thino.content,1):t.id==="splitByHeading2"?r=this.contentSplitByHeading(this.thino.content,2):t.id==="splitByHeading3"&&(r=this.contentSplitByHeading(this.thino.content,3)),r.length===0){new C.Notice("No headings found"),this.close();return}const a=this.ensureUniqueFileNames(r);for(const l of r){const c=r.indexOf(l),f=await we.createThino({content:l.join(`
`),name:a[c],type:"MULTI",isList:!0});we.pushMemo(f)}let o=this.thino.content;r.forEach((l,c)=>{o=o.replace(l.join(`
`),`[[${a[c]}]]`)});const i=await we.updateMemo(this.thino.id,o);i&&we.editMemo(i),this.close()}}const iV=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?bf(i):await e.workspace.openLinkText(o,o,!C.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)},lV=(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);Mb({imgUrl:n,filepath:n.startsWith("app")?r:void 0,otherIMGEls:a,currentIndex:o})},uV=e=>{var r;const t=(r=e.dataset)==null?void 0:r.value,n=we.getMemoById(t??"");n?bf(n):(new C.Notice("Thino Not Found"),e.classList.remove("memo-link-text"))},cV=async(e,t,n,r)=>{var l;const a=e!=null&&e.AppendDateWhenTaskDone?" ✅ "+C.moment().format("YYYY-MM-DD"):"",o=((l=r.parentElement.dataset)==null?void 0:l.task)==="x"?"DONE":"TODO",i=[...(n==null?void 0:n.querySelectorAll("li.task-list-item"))||[]];for(const c of i)if(c===r||c===r.closest("li.task-list-item")){const f=i.indexOf(c),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)}}},dV=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=C.moment(l.createdAt,"YYYY/MM/DD HH:mm:ss");at.setFromAndToQuery(he.startOf("day").valueOf(),he.endOf("day").valueOf());return}bf(l)},S=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"){const $=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");$&&$.trigger("click")}dt.setMarkMemoId(l.id)},D=async()=>{var ie;const $=!C.Platform.isDesktop&&await((ie=window.Capacitor)==null?void 0:ie.Plugins.Device.getId()),he=C.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"&&C.Platform.isMobile){const $=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");$&&$.trigger("click")}(i==="/review"||i==="/daily")&&y(!0),i!=="/review"&&i!=="/daily"&&dt.setEditMemoId(l.id)},M=async $=>{$.sourceType==="MULTI"&&$.id.trim()===""&&await we.updateMemoProperty($)},N=async $=>{await we.openThinoByID($.id)},_=async $=>{try{const he=await we.archiveMemo($);he&&we.editMemo(he)}catch(he){console.error(he),new C.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 C.Notice($.message)}dt.getState().editMemoId===l.id&&dt.setEditMemoId("")},B=()=>{if(h.current&&!h.current.confirmStatus){h.current&&h.current.toggleConfirm(!1);return}},L=()=>{sf(l)},R=async()=>{const $=await we.updateMemo(l.id,l.content,l.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");$&&we.editMemo($)},V=async()=>{navigator.clipboard.writeText(l.content).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})},Y=async()=>{new oV(n,l).open()},Z=$=>{$&&$.target.tagName!=="INPUT"&&I()},Q=async($,he)=>{$.preventDefault(),$.stopPropagation();const ie=$.target;if($.ctrlKey||$.metaKey){await N(he);return}if(ie.tagName==="A"){await iV(n,r,ie);return}if(ie.tagName==="IMG"){lV(f.current,ie);return}if(ie.tagName==="A"&&ie.getAttribute("href")){const ce=ie.getAttribute("href");window.open(ce,"_blank");return}if(ie.className==="memo-link-text"){uV(ie);return}if(ie.tagName==="INPUT"&&ie.hasClass("task-list-item-checkbox")){await cV(a,he,f.current,ie);return}},G=$=>{const he=new C.Menu;he.dom.toggleClass("memo-context-menu",!0);const ie=window.getSelection();(ie==null?void 0:ie.toString().length)>0&&he.addItem(ce=>{ce.setIcon("copy").setTitle(E("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(ie.toString()).then(()=>{new C.Notice(E("COPY SUCCEED"))}).catch(()=>{new C.Notice(E("COPY FAILED"))})})}).addSeparator(),he.addItem(ce=>{ce.setIcon("copy").setTitle(E("Copy thino").toLocaleUpperCase()).onClick(async()=>{await V(),he.close()})}).addItem(ce=>{ce.setIcon("book-open").setTitle(E("READ")).onClick(w)}).addItem(ce=>{ce.setIcon(l.pinned?"pin-off":"pin").setTitle(l.pinned?E("UNPIN"):E("PIN")).onClick(D)}).addItem(ce=>{ce.setIcon("bookmark").setTitle(E("MARK")).onClick(S)}).addItem(ce=>{ce.setIcon("share-2").setTitle(E("SHARE")).onClick(L)}).addItem(ce=>{ce.setIcon("pencil").setTitle(E("EDIT")).onClick(I)}).addItem(ce=>{ce.setIcon("home").setTitle(E("SOURCE")).onClick(()=>N(l))}).addSeparator().addItem(ce=>{ce.setIcon("archive").setTitle(E("ARCHIVE").toLocaleUpperCase()).onClick(()=>_(l))}).addItem(ce=>{ce.setIcon("trash").setTitle(E("DELETE")).onClick(async()=>{await k()})}),he.showAtMouseEvent($.native
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lu(e,t){return iF(e)||LV(e,t)||oI(e,t)||sF()}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 RV=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}},_V=RV;const rv=qt(_V);var BV=function(){};function HV(e,t){var n={};return Object.keys(e).forEach(function(r){n[uw(r)]=BV}),n}function qC(e,t){return e[t]!==void 0}function uw(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function YV(e){return!!e&&(typeof e!="function"||e.prototype&&e.prototype.isReactComponent)}function UV(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_w(e,t)}function lF(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function uF(e){function t(n){var r=this.constructor.getDerivedStateFromProps(e,n);return r??null}this.setState(t.bind(this))}function cF(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}}lF.__suppressDeprecationWarning=!0;uF.__suppressDeprecationWarning=!0;cF.__suppressDeprecationWarning=!0;function zV(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:
6 months ago
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=lF,t.componentWillReceiveProps=uF),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=cF;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 VV="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function dF(e,t,n){n===void 0&&(n=[]);var r=e.displayName||e.name||"Component",a=YV(e),o=Object.keys(t),i=o.map(uw);a||!n.length||rv(!1);var l=function(f){UV(h,f);function h(){for(var y,w=arguments.length,S=new Array(w),D=0;D<w;D++)S[D]=arguments[D];y=f.call.apply(f,[this].concat(S))||this,y.handlers=Object.create(null),o.forEach(function(M){var N=t[M],_=function(B){if(y.props[N]){var L;y._notifying=!0;for(var R=arguments.length,V=new Array(R>1?R-1:0),Y=1;Y<R;Y++)V[Y-1]=arguments[Y];(L=y.props)[N].apply(L,[B].concat(V)),y._notifying=!1}y.unmounted||y.setState(function(Z){var Q,G=Z.values;return{values:Pr(Object.create(null),G,(Q={},Q[M]=B,Q))}})};y.handlers[N]=_}),n.length&&(y.attachRef=function(M){y.inner=M});var I=Object.create(null);return o.forEach(function(M){I[M]=y.props[uw(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],!qC(w,N)&&qC(I,N)&&(M.values[N]=w[uw(N)])}),M},g.componentWillUnmount=function(){this.unmounted=!0},g.render=function(){var w=this,S=this.props,D=S.innerRef,I=kb(S,["innerRef"]);i.forEach(function(N){delete I[N]});var M={};return o.forEach(function(N){var _=w.props[N];M[N]=_!==void 0?_:w.state.values[N]}),ne.createElement(e,Pr({},I,M,this.handlers,{ref:D||this.attachRef}))},h}(ne.Component);zV(l),l.displayName="Uncontrolled("+r+")",l.propTypes=Pr({innerRef:function(){}},HV(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:VV,lineNumber:128},__self:this}))}),c.propTypes=l.propTypes),c.ControlledComponent=e,c.deferControlTo=function(f,h,g){return h===void 0&&(h={}),dF(f,Pr({},t,h),g)},c}function fF(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=fF(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=fF(e))&&(r&&(r+=" "),r+=t);return r}var hF={exports:{}},RS,GC;function WV(){if(GC)return RS;GC=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return RS=e,RS}var _S,JC;function $V(){if(JC)return _S;JC=1;var e=WV();function t(){}function n(){}return n.resetWarningCache=t,_S=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},_S}hF.exports=$V()();var ZV=hF.exports;const ke=qt(ZV);var Bw="milliseconds",av="seconds",ov="minutes",iv="hours",Sf="day",Ip="week",sv="month",Df="year",Tf="decade",If="century",pF={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},qV={month:1,year:12,decade:10*12,century:100*12};function GV(e){return[
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cw(e){return rW(e)||SF(e)||oI(e)||aW()}function oW(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 DF=oW;function iW(e,t){return e===t||e!==e&&t!==t}var Vv=iW,sW=typeof dr=="object"&&dr&&dr.Object===Object&&dr,TF=sW,lW=TF,uW=typeof self=="object"&&self&&self.Object===Object&&self,cW=lW||uW||Function("return this")(),eu=cW,dW=eu,fW=dW.Symbol,Wp=fW,QC=Wp,IF=Object.prototype,hW=IF.hasOwnProperty,pW=IF.toString,Dg=QC?QC.toStringTag:void 0;function mW(e){var t=hW.call(e,Dg),n=e[Dg];try{e[Dg]=void 0;var r=!0}catch{}var a=pW.call(e);return r&&(t?e[Dg]=n:delete e[Dg]),a}var gW=mW,vW=Object.prototype,yW=vW.toString;function wW(e){return yW.call(e)}var bW=wW,XC=Wp,SW=gW,DW=bW,TW="[object Null]",IW="[object Undefined]",eM=XC?XC.toStringTag:void 0;function EW(e){return e==null?e===void 0?IW:TW:eM&&eM in Object(e)?SW(e):DW(e)}var $p=EW;function xW(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ju=xW,CW=$p,MW=Ju,kW="[object AsyncFunction]",NW="[object Function]",AW="[object GeneratorFunction]",FW="[object Proxy]";function OW(e){if(!MW(e))return!1;var t=CW(e);return t==NW||t==AW||t==kW||t==FW}var lI=OW,PW=9007199254740991;function jW(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=PW}var uI=jW,LW=lI,RW=uI;function _W(e){return e!=null&&RW(e.length)&&!LW(e)}var Wv=_W,BW=9007199254740991,HW=/^(?:0|[1-9]\d*)$/;function YW(e,t){var n=typeof e;return t=t??BW,!!t&&(n=="number"||n!="symbol"&&HW.test(e))&&e>-1&&e%1==0&&e<t}var cI=YW,UW=Vv,zW=Wv,VW=cI,WW=Ju;function $W(e,t,n){if(!WW(n))return!1;var r=typeof t;return(r=="number"?zW(n)&&VW(t,n.length):r=="string"&&t in n)?UW(n[t],e):!1}var Ab=$W,ZW=/\s/;function qW(e){for(var t=e.length;t--&&ZW.test(e.charAt(t)););return t}var GW=qW,JW=GW,KW=/^\s+/;function QW(e){return e&&e.slice(0,JW(e)+1).replace(KW,"")}var XW=QW;function e$(e){return e!=null&&typeof e=="object"}var id=e$,t$=$p,n$=id,r$="[object Symbol]";function a$(e){return typeof e=="symbol"||n$(e)&&t$(e)==r$}var $v=a$,o$=XW,tM=Ju,i$=$v,nM=NaN,s$=/^[-+]0x[0-9a-f]+$/i,l$=/^0b[01]+$/i,u$=/^0o[0-7]+$/i,c$=parseInt;function d$(e){if(typeof e=="number")return e;if(i$(e))return nM;if(tM(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=tM(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=o$(e);var n=l$.test(e);return n||u$.test(e)?c$(e.slice(2),n?2:8):s$.test(e)?nM:+e}var f$=d$,h$=f$,rM=1/0,p$=17976931348623157e292;function m$(e){if(!e)return e===0?e:0;if(e=h$(e),e===rM||e===-rM){var t=e<0?-1:1;return t*p$}return e===e?e:0}var EF=m$,g$=EF;function v$(e){var t=g$(e),n=t%1;return t===t?n?t-n:t:0}var xF=v$,y$=DF,w$=Ab,b$=xF,S$=Math.ceil,D$=Math.max;function T$(e,t,n){(n?w$(e,t,n):t===void 0)?t=1:t=D$(b$(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var a=0,o=0,i=Array(S$(r/t));a<r;)i[o++]=y$(e,a,a+=t);return i}var I$=T$;const E$=qt(I$);function Zv(e){return e&&e.ownerDocument||document}function x$(e){var t=Zv(e);return t&&t.defaultView||window}function C$(e,t){return x$(e).getComputedStyle(e,t)}var M$=/([A-Z])/g;function k$(e){return e.replace(M$,"-$1").toLowerCase()}var N$=/^ms-/;function k0(e){return k$(e).replace(N$,"-ms-")}var A$=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function F$(e){return!!(e&&A$.test(e))}function up(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(k0(t))||C$(e).getPropertyValue(k0(t));Object.keys(t).forEach(function(a){var o=t[a];!o&&o!==0?e.style.removeProperty(k0(a)):F$(a)?r+=a+"("+o+") ":n+=k0(a)+": "+o+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}function fv(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}function O$(e){return"nodeType"in e&&e.nodeType===document.DOCUMENT_NODE}function dI(e){return"window"in e&&e.window===e?e:O$(e)&&e.defaultView||!1}function CF(e){var t=e==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,a){var o=dI(r);if(a===void 0)retu
`)[0].slice(0,20),r=ne.useRef(null),a=ne.useRef(null),o=ne.useRef(null);P.useEffect(()=>{if(a.current)return C.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const i=P.useCallback(c=>{o.current&&(o.current.unmount(),o.current=null),o.current=c},[]),l=P.useCallback(c=>{if(!r.current||!C.Keymap.isModifier(c.nativeEvent,"Mod"))return;const f=new C.HoverPopover(ft.getState().view,r.current,100),h=Ile(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(xle,{event:e}),v.jsx("span",{children:n})]})}const xle=({event:e})=>{const t=ne.useRef(null),n=e.resource;P.useEffect(()=>{t.current&&C.setIcon(t.current,n.thinoType==="JOURNAL"?"calendar":n.thinoType==="TASK-TODO"?"square":"check-square")},[n==null?void 0:n.thinoType,t]);const r=P.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const i=await we.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");i&&we.editMemo(i)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return v.jsx(v.Fragment,{children:v.jsxs("span",{className:"rbc-event-icon-group",children:[v.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),v.jsx("span",{className:ar("rbc-event-time","hidden"),children:v.jsx("span",{className:"rbc-event-time-text",children:C.moment(e.start).format("HH:mm")})})]})})};function O8({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))}O8.propTypes={messages:ke.object,onView:ke.func,view:ke.string,views:ke.array};function P8({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:i}){const l={previous:P.useRef(null),today:P.useRef(null),next:P.useRef(null)};P.useEffect(()=>{l&&(C.setIcon(l.previous.current,"chevron-left"),C.setIcon(l.today.current,"dot"),C.setIcon(l.next.current,"chevron-right"))},[l]);const c=P.useMemo(()=>v.jsxs(v.Fragment,{children:[v.jsx("button",{ref:l.previous,type:"button",onClick:()=>r(fp.PREVIOUS),"aria-label":n.previous,children:"<"}),v.jsx("button",{ref:l.today,type:"button",onClick:()=>r(fp.TODAY),"aria-label":n.today,children:"•"}),v.jsx("button",{ref:l.next,type:"button",onClick:()=>r(fp.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(Fw,{type:"text",handleValueChange:f=>{r(fp.DATE,C.moment(f,"YYYY-MM-DD").format("YYYY-MM-DDTHH:mm:ssZ"))},defaultText:t+(o==="week"?C.moment(e.valueOf(),"x").format(" [W]WW"):""),defaultValue:C.moment(e.valueOf(),"x").valueOf()})}),v.jsx("span",{className:"rbc-btn-group",children:v.jsx(O8,{view:o,views:i,messages:n,onView:a})})]})}P8.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 Cle({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 Mle=Dle(C.moment),kle=({event:e})=>{const t=e.resource;return v.jsx(v.Fragment,{children:v.jsx(ai,{memo:t})})},Nle=e=>{var G;const{thinos:t}=e,[n,r]=ne.useState([]),[a,o]=ne.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[i,l]=ne.useState(null),c=ne.useRef(null),f=ne.useRef(null),[h,g]=ne.useState(!1),y=P.useRef(null),[w,S]=P.useState(new Date);P.useEffect(()=>()=>{c.current&&(c.
`,Lue="\uFEFF",$8=e=>Object.assign({},Pue,e);let Rue=class extends Error{constructor(t){super(t),this.name="CsvGenerationError"}},_ue=class extends Error{constructor(t){super(t),this.name="EmptyHeadersError"}};var Qv=e=>e,Us=e=>e,qb=Qv,xp=Qv,S3=Qv,D3=Qv,Bue=function(e,t){return t=='"'&&e.indexOf('"')>-1?e.replace(/"/g,'""'):e},Hue=e=>S3(typeof e=="object"?e.key:e),Yue=e=>D3(typeof e=="object"?e.displayLabel:e),Uue=(e,...t)=>t.reduce((n,r)=>r(n),e),zue=e=>t=>e.useBom?qb(Us(t)+Lue):t,Vue=e=>t=>e.showTitle?BI(qb(Us(t)+e.title))(xp("")):t,BI=e=>t=>qb(Us(e)+Us(t)+jue),Z8=e=>(t,n)=>Wue(e)(xp(t+n)),Wue=e=>t=>Qv(Us(t)+e.fieldSeparator),$ue=(e,t)=>n=>{if(!e.showColumnHeaders)return n;if(t.length<1)throw new _ue("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=xp("");for(let a=0;a<t.length;a++){const o=Yue(t[a]);r=Z8(e)(r,q8(e,o))}return r=xp(Us(r).slice(0,-1)),BI(n)(r)},Zue=(e,t,n)=>r=>{let a=r;for(var o=0;o<n.length;o++){let i=xp("");for(let l=0;l<t.length;l++){const c=Hue(t[l]),f=typeof n[o][Us(c)]>"u"?e.replaceUndefinedWith:n[o][Us(c)];i=Z8(e)(i,q8(e,f))}i=xp(Us(i).slice(0,-1)),a=BI(a)(i)}return a},que=Us,T3=e=>+e===e&&(!isFinite(e)||!!(e%1)),q8=(e,t)=>{if(e.decimalSeparator==="locale"&&T3(t))return t.toLocaleString();if(e.decimalSeparator!=="."&&T3(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+Bue(t,e.quoteCharacter)+e.quoteCharacter),n}if(typeof t=="boolean"&&e.boolDisplay){const n=t?"true":"false";return e.boolDisplay[n]}return t},Gue=e=>t=>{const n=$8(e),r=n.useKeysAsHeaders?Object.keys(t[0]):n.columnHeaders;let a=Uue(qb(""),zue(n),Vue(n),$ue(n,r),Zue(n,r,t));if(Us(a).length<1)throw new Rue("Output is empty. Is your data formatted correctly?");return a};const Jue=({thino:e})=>{const t=P.useRef(null);P.useEffect(()=>(t.current&&C.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})},Kue=({thino:e})=>{var r;const t=P.useRef(null);P.useEffect(()=>(t.current&&C.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"})})},Que=({id:e,path:t})=>{const n=P.useRef(null);P.useEffect(()=>(n.current&&C.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"})]})},Xue=({id:e,sourceType:t})=>{const n=P.useRef(null);P.useEffect(()=>{var a;return n.current&&C.setIcon(n.current,((a=Jg.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})},I3=(e,t,n,r)=>{const a=Cue(e.getValue(t),n);return r({itemRank:a}),a.passed},E3=(e,t,n)=>{var a,o;let r=0;return e.columnFiltersMeta[n]&&(r=Nue((a=e.columnFiltersMeta[n])==null?void 0:a.itemRank,(o=t.columnFiltersMeta[n])==null?void 0:o.itemRank)),r===0?cp.alphanumeric(e,t,n):r},ece=$8({fieldSeparator:",",decimalSeparator:".",useKeysAsHeaders:!0}),tce=e=>e+`
`;function nce({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:E3},{accessorFn:S=>S.thinoType,id:"thinoType",cell:S=>v.jsx(Kue,{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(Xue,{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(Jue,{thino:S.row.original}),footer:S=>S.column.id,filterFn:"fuzzy",sortingFn:E3},{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(Que,{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=Tue({data:l,columns:i,filterFns:{fuzzy:I3},initialState:{pagination:{pageSize:20}},state:{columnFilters:n,globalFilter:a},onColumnFiltersChange:r,onGlobalFilterChange:o,globalFilterFn:I3,getCoreRowModel:cue(),getFilteredRowModel:hue(),getSortedRowModel:vue(),getPaginationRowModel:wue(),getFacetedRowModel:pue(),getFacetedUniqueValues:mue(),getFacetedMinMaxValues:gue(),debugTable:!1,debugHeaders:!1,debugColumns:!1});ne.useEffect(()=>{var S,D;((S=h.getState().columnFilters[0])==null?void 0:S.id)==="createdAt"&&((D=h.getState().sorting[0])==null?void 0:D.id)!=="createdAt"&&h.setSorting([{id:"createdAt",desc:!1}])},[(w=h.getState().columnFilters[0])==null?void 0:w.id]);async function g(S,D){const I=E("Created At"),M=E("Updated At"),N=E("Content"),_=E("Path"),k=S.map(Y=>({[I]:Y.createdAt,[M]:Y.updatedAt,[N]:Y.content,Thino:`=hyperlink("obsidian://thino?openId=${Y.id}","${Y.id}")`,[_]:`=hyperlink("obsidian://open?path=${C.normalizePath(Y.path)},"${Y.path}")`})),B=Gue(ece)(k),L=ft.getState().app||window.app,R=tce(que(B));return{file:await L.vault.create(`${D}-${ut.randomId(6)}.csv`,R),app:L}}async function y(S){const{file:D,app:I}=await g(S.map(_=>_.original),"thino-export"),M=document.createDocumentFragment(),N=M.createEl("div",{cls:"export-file-btn-group"});M.createEl("div",{cls:"open-file-button"}),new C.Setting(N).setName(E("Exported CSV file")).addButton(_=>{_.setButtonText(E("Open File")).onClick(()=>{const k=C.normalizePath(D.path);I.openWithDefaultApp(k)})}),new C.Notice(M)}return v.jsxs("div",{className:"table-view",children:[v.jsxs("div",{children:[v.jsx(hw,{value:a||"",onChange:S=>o(String(S)),className:"table-search-bar",placeholder:E("Search all columns...")}),C.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:[v3(D.column.columnDef.header,D.getContext()),{asc:" 🔼",desc:" 🔽"}[D.column.getIsSorted()]??null]}),D.column.getCanFilter()?v.jsx(ace,{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 Hl(e,t){return bfe(e)||jye(e,t)||m5(e,t)||K0e()}var g5={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})()})(g5);var Q0e=g5.exports;const vE=qt(Q0e);var v5={exports:{}},AD,$k;function X0e(){if($k)return AD;$k=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return AD=e,AD}var FD,Zk;function ewe(){if(Zk)return FD;Zk=1;var e=X0e();function t(){}function n(){}return n.resetWarningCache=t,FD=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},FD}v5.exports=ewe()();var twe=v5.exports;const Mn=qt(twe);var yE=ne.createContext({scrollTo:function(){return 0},scrollToBottom:function(){return 0},scrollToEnd:function(){return 0},scrollToStart:function(){return 0},scrollToTop:function(){return 0}});yE.displayName="ScrollToBottomFunctionContext";function f1(){return P.useContext(yE)}function nwe(){var e=f1(),t=e.scrollToEnd;return t}var wE=ne.createContext({atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom"});wE.displayName="ScrollToBottomState1Context";var bE=ne.createContext({animating:!1,animatingToEnd:!1,sticky:!0});bE.displayName="ScrollToBottomState2Context";var SE=ne.createContext({animating:!1,animatingToEnd:!1,atBottom:!0,atEnd:!0,atStart:!1,atTop:!0,mode:"bottom",sticky:!0});SE.displayName="ScrollToBottomStateContext";var qk=[SE,wE,bE];function rwe(e){return P.useContext(qk[e]||qk[0])}function awe(){var e=rwe(2),t=e.sticky;return[t]}var h1=ne.createContext({offsetHeight:0,scrollHeight:0,setTarget:function(){return 0},styleToClassName:function(){return""}});h1.displayName="ScrollToBottomInternalContext";function owe(){return P.useContext(h1)}function DE(){var e=owe(),t=e.styleToClassName;return t}var iwe={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)"}},TE=function(t){var n=t.children,r=t.className,a=awe(),o=Hl(a,1),i=o[0],l=DE()(iwe),c=nwe();return!i&&ne.createElement("button",{className:vE(l,(r||"")+""),onClick:c,type:"button"},n)};TE.defaultProps={children:void 0,className:""};TE.propTypes={children:Mn.any,className:Mn.string};var y5={exports:{}},swe=Gn,lwe=ii,Gk=$s.f;swe({target:"Object",stat:!0,forced:Object.defineProperty!==Gk,sham:!lwe},{defineProperty:Gk});var uwe=qa,w5=uwe.Object,cwe=y5.exports=function(t,n,r){return w5.defineProperty(t,n,r)};w5.defineProperty.sham&&(cwe.sham=!0);var dwe=y5.exports,fwe=dwe,b5=fwe,hwe=b5,pwe=hwe,mwe=pwe,gwe=mwe,vwe=gwe;const ywe=qt(vwe);var wwe=iy,bwe=wwe.f("iterator"),Swe=bwe,Dwe=Swe,Twe=Dwe,Iwe=Twe,Ewe=Iwe,xwe=Ewe,Cwe=xwe;const Mwe=qt(Cwe);function gv(e){"@babel/helpers - typeof";return gv=typeof pp=="function"&&typeof Mwe=="symbol"?function(t){return typeof t}:function(t){return t&&typeof pp=="function"&&t.constructor===pp&&t!==pp.prototype?"symbol":typeof t},gv(e)}var kwe=iy,Nwe=kwe.f("toPrimitive"),Awe=Nwe,Fwe=Awe,Owe=Fwe,Pwe=Owe,jwe=Pwe,Lwe=jwe,Rwe=Lwe;const _we=qt(Rwe);function Bwe(e,t){if(gv(e)!="object"||!e)return e;var n=e[_we];if(n!==void 0){var r=n.call(e,t||"defa
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function En(e){return Uwe(e)||zwe(e)||m5(e)||Vwe()}var z0=function(e){return e&&e.Math==Math&&e},Oi=z0(typeof globalThis=="object"&&globalThis)||z0(typeof window=="object"&&window)||z0(typeof self=="object"&&self)||z0(typeof dr=="object"&&dr)||function(){return this}()||Function("return this")(),IE={},Zs=function(e){try{return!!e()}catch{return!0}},Wwe=Zs,jf=!Wwe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),S5={},D5={}.propertyIsEnumerable,T5=Object.getOwnPropertyDescriptor,$we=T5&&!D5.call({1:2},1);S5.f=$we?function(t){var n=T5(this,t);return!!n&&n.enumerable}:D5;var I5=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},Zwe={}.toString,EE=function(e){return Zwe.call(e).slice(8,-1)},qwe=Zs,Gwe=EE,Jwe="".split,Kwe=qwe(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return Gwe(e)=="String"?Jwe.call(e,""):Object(e)}:Object,p1=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},Qwe=Kwe,Xwe=p1,xE=function(e){return Qwe(Xwe(e))},ls=function(e){return typeof e=="function"},ebe=ls,cy=function(e){return typeof e=="object"?e!==null:ebe(e)},OD=Oi,tbe=ls,nbe=function(e){return tbe(e)?e:void 0},m1=function(e,t){return arguments.length<2?nbe(OD[e]):OD[e]&&OD[e][t]},rbe=m1,abe=rbe("navigator","userAgent")||"",E5=Oi,PD=abe,Jk=E5.process,Kk=E5.Deno,Qk=Jk&&Jk.versions||Kk&&Kk.version,Xk=Qk&&Qk.v8,Ol,Xw;Xk?(Ol=Xk.split("."),Xw=Ol[0]<4?1:Ol[0]+Ol[1]):PD&&(Ol=PD.match(/Edge\/(\d+)/),(!Ol||Ol[1]>=74)&&(Ol=PD.match(/Chrome\/(\d+)/),Ol&&(Xw=Ol[1])));var obe=Xw&&+Xw,e4=obe,ibe=Zs,x5=!!Object.getOwnPropertySymbols&&!ibe(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&e4&&e4<41}),sbe=x5,C5=sbe&&!Symbol.sham&&typeof Symbol.iterator=="symbol",lbe=ls,ube=m1,cbe=C5,M5=cbe?function(e){return typeof e=="symbol"}:function(e){var t=ube("Symbol");return lbe(t)&&Object(e)instanceof t},dbe=function(e){try{return String(e)}catch{return"Object"}},fbe=ls,hbe=dbe,pbe=function(e){if(fbe(e))return e;throw TypeError(hbe(e)+" is not a function")},mbe=pbe,k5=function(e,t){var n=e[t];return n==null?void 0:mbe(n)},jD=ls,LD=cy,gbe=function(e,t){var n,r;if(t==="string"&&jD(n=e.toString)&&!LD(r=n.call(e))||jD(n=e.valueOf)&&!LD(r=n.call(e))||t!=="string"&&jD(n=e.toString)&&!LD(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},N5={exports:{}},t4=Oi,CE=function(e,t){try{Object.defineProperty(t4,e,{value:t,configurable:!0,writable:!0})}catch{t4[e]=t}return t},vbe=Oi,ybe=CE,n4="__core-js_shared__",wbe=vbe[n4]||ybe(n4,{}),ME=wbe,r4=ME;(N5.exports=function(e,t){return r4[e]||(r4[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.18.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});var kE=N5.exports,bbe=p1,A5=function(e){return Object(bbe(e))},Sbe=A5,Dbe={}.hasOwnProperty,Lf=Object.hasOwn||function(t,n){return Dbe.call(Sbe(t),n)},Tbe=0,Ibe=Math.random(),F5=function(e){return"Symbol("+String(e===void 0?"":e)+")_"+(++Tbe+Ibe).toString(36)},Ebe=Oi,xbe=kE,a4=Lf,Cbe=F5,o4=x5,Mbe=C5,xg=xbe("wks"),Wg=Ebe.Symbol,kbe=Mbe?Wg:Wg&&Wg.withoutSetter||Cbe,dy=function(e){return(!a4(xg,e)||!(o4||typeof xg[e]=="string"))&&(o4&&a4(Wg,e)?xg[e]=Wg[e]:xg[e]=kbe("Symbol."+e)),xg[e]},i4=cy,s4=M5,Nbe=k5,Abe=gbe,Fbe=dy,Obe=Fbe("toPrimitive"),Pbe=function(e,t){if(!i4(e)||s4(e))return e;var n=Nbe(e,Obe),r;if(n){if(t===void 0&&(t="default"),r=n.call(e,t),!i4(r)||s4(r))return r;throw TypeError("Can't convert object to primitive value")}return t===void 0&&(t="number"),Abe(e,t)},jbe=Pbe,Lbe=M5,O5=function(e){var t=jbe(e,"string");return Lbe(t)?t:String(t)},Rbe=Oi,l4=cy,i2=Rbe.document,_be=l4(i2)&&l4(i2.createElement),P5=function(e){return _be?i2.createElement(e):{}},Bbe=jf,Hbe=Zs,Ybe=P5,j5=!Bbe&&!Hbe(function(){return Object.defineProperty(Ybe("div"),"a",{get:function(){return 7}}).a!=7}),Ube=jf,zbe=S5,Vbe=I5,Wbe=xE,$be=O5,Zbe=Lf,qbe=j5,u4=Object.getOwnPropertyDescriptor;IE.f=Ube?u4:function(t,n){if(t=Wbe(t),n=$be(n),qbe)
`)&&e.flags==="s")}),rDe=Zs,aDe=Oi,oDe=aDe.RegExp,iDe=rDe(function(){var e=oDe("(?<a>b)","g");return e.exec("b").groups.a!=="b"||"b".replace(e,"$<a>c")!=="bc"}),sDe=y1,lDe=q5,T4=jE,uDe=kE,cDe=QSe,dDe=B5.get,fDe=nDe,hDe=iDe,nb=RegExp.prototype.exec,pDe=uDe("native-string-replace",String.prototype.replace),d2=nb,f2=function(){var e=/a/,t=/b*/g;return nb.call(e,"a"),nb.call(t,"a"),e.lastIndex!==0||t.lastIndex!==0}(),X5=T4.UNSUPPORTED_Y||T4.BROKEN_CARET,h2=/()??/.exec("")[1]!==void 0,mDe=f2||h2||X5||fDe||hDe;mDe&&(d2=function(t){var n=this,r=dDe(n),a=sDe(t),o=r.raw,i,l,c,f,h,g,y;if(o)return o.lastIndex=n.lastIndex,i=d2.call(o,a),n.lastIndex=o.lastIndex,i;var w=r.groups,S=X5&&n.sticky,D=lDe.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)),h2&&(l=new RegExp("^"+I+"$(?!\\s)",D)),f2&&(c=n.lastIndex),f=nb.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:f2&&f&&(n.lastIndex=n.global?f.index+f[0].length:c),h2&&f&&f.length>1&&pDe.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=cDe(null),h=0;h<w.length;h++)y=w[h],g[y[0]]=f[y[1]];return f});var LE=d2,gDe=TSe,I4=LE;gDe({target:"RegExp",proto:!0,forced:/./.exec!==I4},{exec:I4});var E4=hy,vDe=LE,x4=Zs,eO=dy,yDe=g1,wDe=eO("species"),UD=RegExp.prototype,bDe=function(e,t,n,r){var a=eO(e),o=!x4(function(){var f={};return f[a]=function(){return 7},""[e](f)!=7}),i=o&&!x4(function(){var f=!1,h=/a/;return e==="split"&&(h={},h.constructor={},h.constructor[wDe]=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===vDe||S===UD.exec?o&&!w?{done:!0,value:l.call(h,g,y)}:{done:!0,value:f.call(g,h,y)}:{done:!1}});E4(String.prototype,e,c[0]),E4(UD,a,c[1])}r&&yDe(UD[a],"sham",!0)},SDe=v1,DDe=y1,TDe=p1,C4=function(e){return function(t,n){var r=DDe(TDe(t)),a=SDe(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)}},IDe={codeAt:C4(!1),charAt:C4(!0)},EDe=IDe.charAt,xDe=function(e,t,n){return t+(n?EDe(e,t).length:1)},CDe=A5,MDe=Math.floor,kDe="".replace,NDe=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ADe=/\$([$&'`]|\d{1,2})/g,FDe=function(e,t,n,r,a,o){var i=n+e.length,l=r.length,c=ADe;return a!==void 0&&(a=CDe(a),c=NDe),kDe.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=MDe(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})},ODe=ld,PDe=ls,jDe=EE,LDe=LE,RDe=function(e,t){var n=e.exec;if(PDe(n)){var r=n.call(e,t);return r!==null&&ODe(r),r}if(jDe(e)==="RegExp")return LDe.call(e,t);throw TypeError("RegExp#exec called on incompatible receiver")},_De=bDe,BDe=Zs,HDe=ld,YDe=ls,UDe=v1,zDe=z5,ip=y1,VDe=p1,WDe=xDe,$De=k5,ZDe=FDe,qDe=RDe,GDe=dy,p2=GDe("replace"),JDe=Math.max,KDe=Math.min,QDe=function(e){return e===void 0?e:String(e)},XDe=function(){return"a".replace(/./,"$0")==="$0"}(),M4=function(){return/./[p2]?/./[p2]("a","$0")==="":!1}(),eTe=!BDe(function(){var e=/./;return e.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(e,"$<a>")!=="7"});_De("replace",function(e,t,n){var r=M4?"$":"$0";return[function(o,i){var l=VDe(this),c=o==null?void 0:$De(o,p2);return c?c.call(o,l,i):t.call(ip(l),o,i)},function(a,o){var i=HDe(this),l=ip(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=YDe(o);f||(o=ip(o));var h=i.global;if(h){var g=i.unicode;i.lastIndex=0}for(var y=[];;){var w=qDe(i,l);if(w===null||(y.push(w),!h))break;var S=ip(w[0]);S===""&&(i.lastIndex=WDe(l,zDe(i.lastIndex),g))}for(var D="",I=0,M=0;M<y.length;M++){w=y[M];for(var N=ip(w[0]),_=JDe(KDe(UDe(w.index),l.length),0),k=[],B=1;B<w.length;B++)k.push(QDe(w[B]));var L=w.groups;if(f){var R=[N].concat(k,_,l);L!==void 0&&R.push(L);var V=ip(o.apply(void 0,R))}else V=ZDe(N,l,_,k,L,o);_>=I&&(D+=l.slice(I,_)+V,I=_+N.length)}return D+l.slice(I)}]},!eTe||!XDe||M4);var tTe=typeof Bun=="function"&&Bun&&typeof Bun.version=="string",nTe=TypeError,rTe=function(e,t){if(e<t)throw new nTe("Not enough arguments");return e},tO=Za,aTe=HI,oTe=co,iTe=tTe,sTe=n9,lTe=a1,uTe=rTe,cTe=tO.Function,dTe=/MSIE .\./.test(sTe)||iTe&&function(){var e=tO.Bun.version.split(".");return e.length<3||e[0]==="0"&&(e[1]<3||e[1]==="3"&&e[2]==="0")}(),nO=function(e,t){var n=t?2:1;return dTe?function(r,a){var o=uTe(arguments.length,1)>n,i=oTe(r)?r:cTe(r),l=o?lTe(arguments,n):[],c=o?function()
`,L.current,t.path,a||e.view)}he(),setTimeout(async()=>{await G()},oA)},[B,L,l,M]);const G=async()=>{B.current&&(await eCe(B.current),await $E(B.current),tCe(M).then(he=>{he&&setTimeout(()=>{Cb(B.current,{pixelRatio:window.devicePixelRatio*2}).then(ie=>{k(ie),f(!0)}).catch(()=>{})},600)}))},le=()=>{n()},se=P.useCallback(he=>{w(he)},[y]),fe=async()=>{const{vault:he}=Le.getState().dailyNotesState.app,ie=B.current.querySelector(".memo-shortcut-img");if(!ie)return;const ce=ie==null?void 0:ie.getAttribute("src").split("base64,")[1],X=nN(ce,"image/png");let ae;X.arrayBuffer().then(async De=>{const je="png",Re=qu();for(const Fe in Re)if(Re[Fe]instanceof C.TFile){ae=Re[Fe];break}if(ae!==void 0){const Fe=await he.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,je,ae);await he.createBinary(Fe,De),new C.Notice(E("Save image successfully"))}})},$=async()=>{se(!0);const he=B.current.querySelector(".memo-shortcut-img");if(!he)return;const ie=he==null?void 0:he.getAttribute("src").split("base64,")[1],ce=nN(ie,"image/png");if(!ce){new C.Notice(E("Copy to clipboard failed"));return}const X=new ClipboardItem({"image/png":ce});window.navigator.clipboard.write([X]).then(()=>{setTimeout(()=>{se(!1)},500)}),new C.Notice(E("Copy to clipboard successfully"))};return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:ar("dialog-header-container"),children:[v.jsxs("p",{className:"title-text",children:[v.jsx("span",{className:"icon-text",children:"🥰"}),E("Share Memo Image")]}),v.jsxs("div",{className:"btn-group",children:[C.Platform.isMobile&&v.jsx("button",{ref:I,className:"btn download-btn",onClick:fe}),v.jsx("button",{ref:S,className:"btn copy-btn",onClick:$}),v.jsx("button",{ref:D,className:"btn close-btn",onClick:le})]})]}),v.jsxs("div",{className:ar("dialog-content-container",M),children:[v.jsx("div",{className:`tip-words-container ${_?"finish":"loading"}`,children:v.jsx("p",{className:"tip-text",children:E(_?"↗Click the button to save":"Image is generating...")})}),v.jsxs("div",{className:"setting-item",children:[v.jsxs("div",{className:"setting-item-info",children:[v.jsx("div",{className:"setting-item-name",children:E("Default sharing style")}),v.jsx("div",{className:"setting-item-description",children:E("Set the default style for sharing thino, 'Modern' by default.")})]}),v.jsx("div",{className:"setting-item-control",children:v.jsxs("select",{className:"dropdown",defaultValue:M,onChange:async he=>{he.currentTarget.value!==M&&(f(!1),k(""),N(he.currentTarget.value),(o||window.app).saveLocalStorage("memoShareDialogStyle",he.currentTarget.value),await G())},children:[v.jsx("option",{value:"modern",children:E("Modern")}),v.jsx("option",{value:"clean",children:E("Clean")}),v.jsx("option",{value:"minimal",children:E("Minimal")}),v.jsx("option",{value:"gradient",children:E("Gradient")})]})})]}),v.jsxs("div",{className:ar("memo-container",M),ref:B,children:[v.jsx(ts,{when:_!=="",children:v.jsx("img",{className:"memo-shortcut-img",onClick:$,src:_})}),v.jsxs("div",{className:"memo-background",children:[v.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),v.jsx("span",{className:"background-container"}),v.jsxs("div",{className:"thino-user-header",children:[v.jsx("div",{className:"thino-user-icon",ref:he=>{if(i!=null&&i.MomentsIcon){he==null||he.empty();return}i!=null&&i.MomentsIcon||he&&C.setIcon(he,"Memos")},style:{backgroundImage:`url("${R}")`}}),v.jsxs("div",{className:"thino-user-info",children:[v.jsx("div",{className:"thino-user-name",children:i==null?void 0:i.UserName}),(i==null?void 0:i.MomentsQuote)&&v.jsx("div",{className:"thino-user-quote",children:i==null?void 0:i.MomentsQuote})]})]}),v.jsx("div",{ref:L,className:"memo-content-text",style:{minHeight:i.MinHeightForShare||"200px"}}),v.jsx("div",{className:"thino-time-footer",children:l.createdAt}),v.jsxs("div",{className:"watermark-container",children:[v.jsxs("span",{className:"normal-text footer-start",children:[v.jsx("div",{className:"property-social-icons"}),v.jsx("spa
`,i.current,a.path,r);const _=(B=i.current)==null?void 0:B.querySelectorAll(".internal-link");_==null||_.forEach(L=>{const R=L,V=R.getAttribute("data-href");if(!V)return;t.metadataCache.getFirstLinkpathDest(V,a.path)||L.classList.add("is-unresolved"),R.addEventListener("mouseover",Z=>{Z.stopPropagation(),t.workspace.trigger("hover-link",{event:Z,source:"thino",hoverParent:r.containerEl,targetEl:R,linktext:V,sourcePath:R.href})})})}N()},[a.content,l]);const S=async()=>{switch(h.sourceType){case"DAILY":await z2(h.id,h.path);break;case"CANVAS":await W2(h.id,h.path);break;case"MULTI":await U2(h.path);break;case"FILE":await V2(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 C.Notice(N.message)}else y()},I=async()=>{try{const N=await we.unarchiveMemo(h);N&&we.editMemo(N),o(h.id),new C.Notice(E("RESTORE SUCCEED"))}catch(N){new C.Notice(N.message)}},M=()=>{g&&y(!1)};return v.jsxs("div",{ref:l,className:`memo-wrapper ${"memos-"+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&&C.setIcon(N,"more-horizontal")},className:"btn more-action-btn"}),v.jsx("div",{className:"more-action-btns-wrapper",children:v.jsxs("div",{className:"more-action-btns-container",children:[v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:w.restore,className:"more-action-item-icon"}),v.jsx("span",{className:"btn restore-btn",onClick:I,children:E("RESTORE")})]}),v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:w.source,className:"more-action-item-icon"}),v.jsx("span",{className:"btn",onClick: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"})]})},Ru=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}))},aCe=({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=Up(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(kf)===null||o==="IMAGED"&&h.content.match(Nf)===null||o==="CONNECTED"&&h.content.match(rd)===null)&&(g=!1),i&&!h.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(h=>!h.content.contains("comment:"))},oCe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=im(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&C.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const S=aCe({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=
${se.content.split(`
7 months ago
`).map($=>$.trim()?`> ${$}
8 months ago
`:`>
`)}
7 months ago
`+(fe===t.length-1?`
8 months ago
`:`
8 months ago
------
6 months ago
`)});const le={createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.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:[]};sf(le,"clean")})}),Z.addSeparator(),a){case"/":Z.addItem(Q=>{Q.setTitle(E("Bulk tag operation")).setIcon("hash").onClick(async()=>{await L()})}).addItem(Q=>{Q.setTitle(E("Bulk archive")).setIcon("archive").onClick(async()=>{new _s(i,E("ARCHIVE"),async G=>{G==="confirm"&&await B()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await M()}).open()})});break;case"/archive":Z.addItem(Q=>{Q.setTitle(E("Bulk restore")).setIcon("archive").onClick(async()=>{new _s(i,E("RESTORE"),async G=>{G==="confirm"&&await _()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await M()}).open()})});break;case"/recycle":Z.addItem(Q=>{Q.setTitle(E("Bulk restore")).setIcon("archive-restore").onClick(async()=>{new _s(i,E("RESTORE"),async G=>{G==="confirm"&&await k()}).open()})}).addItem(Q=>{Q.setTitle(E("Bulk delete")).setIcon("trash").onClick(async()=>{new _s(i,E("DELETE"),async G=>{G==="confirm"&&await N()}).open()})});break}Z.showAtMouseEvent(Y.nativeEvent)};return v.jsxs("div",{className:`filter-query-container ${S?"":"hidden"}`,children:[v.jsxs("div",{className:"filter-query",children:[v.jsx("span",{className:"tip-text",children:E("FILTER")}),v.jsxs("div",{"data-filter-type":"query",className:"filter-item-container "+(w?"":"hidden"),onClick:()=>{at.setMemoFilter("")},children:[v.jsx("span",{className:"icon-text",children:"🔖"})," ",w==null?void 0:w.title]}),v.jsxs("div",{"data-filter-type":"tag",className:"filter-item-container "+(l?"":"hidden"),onClick:()=>{at.setTagQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🏷️"})," ",l]}),v.jsxs("div",{"data-filter-type":"type",className:"filter-item-container "+(f?"":"hidden"),onClick:()=>{at.setMemoTypeQuery("")},children:[v.jsx("span",{className:"icon-text",children:"📦"})," ",KH(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(Fw,{type:"text",startOrEnd:"start",defaultValue:C.moment(c.from,"x").valueOf(),handleValueChange:Y=>{const Z=C.moment(c.to,"x"),Q=C.moment(Y,"x"),G=Q.isAfter(Z)||Q.isSame(Z);at.setFromAndToQuery(G?Z.startOf("day").valueOf():C.moment(Y,"x").startOf("day").valueOf(),c.to)}}),v.jsx("span",{children:E("to")}),v.jsx(Fw,{type:"text",startOrEnd:"end",defaultValue:C.moment(c.to,"x").add(1,"days").valueOf(),handleValueChange:Y=>{const Z=C.moment(c.from,"x"),Q=C.moment(Y,"x"),G=Q.isBefore(Z)||Q.isSame(Z),le=C.moment(Y,"x").endOf("day").valueOf();at.setFromAndToQuery(c.from,G?Z.endOf("day").valueOf():le)}})]}),v.jsx("div",{ref:Y=>Y&&C.setIcon(Y,"x"),className:"btn close-btn",onClick:()=>{at.setFromAndToQuery(0,0)}})]}),v.jsxs("div",{className:"filter-item-container "+(h?"":"hidden"),onClick:()=>{at.setTextQuery("")},children:[v.jsx("span",{className:"icon-text",children:"🔍"})," ",h]}),v.jsxs("div",{className:"filter-item-container "+(y?"":"hidden"),onClick:()=>{at.setPathQuery("")},children:[v.jsx("span",{className:"icon-text"})," ",h]})]}),v.jsxs("div",{className:"thino-filter-items",children:[e&&v.jsx("div",{className:"thinos-count",children:`${e?`${e} Thinos `:""}`}),v.jsx("div",{ref:D,className:"btn memo-action-menu",onClick:V})]})]})},lf=async e=>{const{app:t,settings:n}=ft.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await qR(e);if(!r||r.length===0)return;r.sort((i,l)=>C.moment(i.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(C.moment(l.createdAt,"YYYY/MM/DD HH:mm:ss"))?1:-1);const a=r.filter(i=>!i.deleted),o=r.filter(i=>i.deleted);for(let i=0;i<a.length;i++){const l=a[i],c=await we.createOrPatchThinoFromWeb(l);c&&we.pushMemo(c)}for(let i=0;i<o.length;i++){cons
7 months ago
`&&A.push(`
6 months ago
`),Ie!==null&&A.push(S(""+Ie)),null;case"input":A.push(G("input")),ct=$t=it=Ie=null;for(Ue in K)if(n.call(K,Ue)&&(Ft=K[Ue],Ft!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":ct=Ft;break;case"defaultValue":it=Ft;break;case"checked":$t=Ft;break;case"value":Ie=Ft;break;default:L(A,oe,Ue,Ft)}return $t!==null?L(A,oe,"checked",$t):ct!==null&&L(A,oe,"checked",ct),Ie!==null?L(A,oe,"value",Ie):it!==null&&L(A,oe,"value",it),A.push("/>"),null;case"menuitem":A.push(G("menuitem"));for(var Ga in K)if(n.call(K,Ga)&&(Ie=K[Ga],Ie!=null))switch(Ga){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:L(A,oe,Ga,Ie)}return A.push(">"),null;case"title":A.push(G("title")),Ie=null;for(Pn in K)if(n.call(K,Pn)&&(Ue=K[Pn],Ue!=null))switch(Pn){case"children":Ie=Ue;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:L(A,oe,Pn,Ue)}return A.push(">"),Ie;case"listing":case"pre":A.push(G(U)),Ue=Ie=null;for(ct in K)if(n.call(K,ct)&&(it=K[ct],it!=null))switch(ct){case"children":Ie=it;break;case"dangerouslySetInnerHTML":Ue=it;break;default:L(A,oe,ct,it)}if(A.push(">"),Ue!=null){if(Ie!=null)throw Error(t(60));if(typeof Ue!="object"||!("__html"in Ue))throw Error(t(61));K=Ue.__html,K!=null&&(typeof K=="string"&&0<K.length&&K[0]===`
7 months ago
`?A.push(`
6 months ago
`,K):A.push(""+K))}return typeof Ie=="string"&&Ie[0]===`
7 months ago
`&&A.push(`
6 months ago
`),Ie;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":A.push(G(U));for(var ja in K)if(n.call(K,ja)&&(Ie=K[ja],Ie!=null))switch(ja){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,U));default:L(A,oe,ja,Ie)}return A.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return Y(A,K,U,oe);case"html":return Ne.insertionMode===0&&A.push("<!DOCTYPE html>"),Y(A,K,U,oe);default:if(U.indexOf("-")===-1&&typeof K.is!="string")return Y(A,K,U,oe);A.push(G(U)),Ue=Ie=null;for(Ft in K)if(n.call(K,Ft)&&(it=K[Ft],it!=null))switch(Ft){case"children":Ie=it;break;case"dangerouslySetInnerHTML":Ue=it;break;case"style":B(A,oe,it);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:i(Ft)&&typeof it!="function"&&typeof it!="symbol"&&A.push(" ",Ft,'="',S(it),'"')}return A.push(">"),R(A,Ue,Ie),Ie}}function se(A,U,K){if(A.push('<!--$?--><template id="'),K===null)throw Error(t(395));return A.push(K),A.push('"></template>')}function fe(A,U,K,oe){switch(K.insertionMode){case 0:case 1:return A.push('<div hidden id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 2:return A.push('<svg aria-hidden="true" style="display:none" id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 3:return A.push('<math aria-hidden="true" style="display:none" id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 4:return A.push('<table hidden id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 5:return A.push('<table hidden><tbody id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 6:return A.push('<table hidden><tr id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');case 7:return A.push('<table hidden><colgroup id="'),A.push(U.segmentPrefix),U=oe.toString(16),A.push(U),A.push('">');default:throw Error(t(397))}}function $(A,U){switch(U.insertionMode){case 0:case 1:return A.push("</div>");case 2:return A.push("</svg>");case 3:return A.push("</math>");case 4:return A.push("</table>");case 5:return A.push("</tbody></table>");case 6:return A.push("</tr></table>");case 7:return A.push("</colgroup></table>");default:throw Error(t(397))}}var he=/[<\u2028\u2029]/g;function ie(A){return JSON.stringify(A).replace(he,function(U){switch(U){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function ce(A,U){return U=U===void 0?"":U,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:U+"P:",segmentPrefix:U+"S:",boundaryPrefix:U+"B:",idPrefix:U,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:A}}function X(A,U,K,oe){return K.generateStaticMarkup?(A.push(S(U)),!1):(U===""?A=oe:(oe&&A.push("<!-- -->"),A.push(S(U)),A=!0),A)}var ae=Object.assign,De=Symbol.for("react.element"),je=Symbol.for("react.portal"),Re=Symbol.for("react.fragment"),Fe=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Xe=Symbol.for("react.provider"),Ze=Symbol.for("react.context"),st=Symbol.for("react.forward_ref"),xt=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 xt:return"Suspense";ca
7 months ago
`),Xt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,dn=new Map;function en(F){var H=dn.get(F);if(H===void 0){if(!Xt.test(F))throw Error(t(65,F));H=f("<"+F),dn.set(F,H)}return H}var Zn=f("<!DOCTYPE html>");function kn(F,H,q,re,Ae){switch(H){case"select":F.push(en("select"));var Ee=null,Ve=null;for(Rt in q)if(g.call(q,Rt)){var ot=q[Rt];if(ot!=null)switch(Rt){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;case"defaultValue":case"value":break;default:et(F,re,Rt,ot)}}return F.push(nt),St(F,Ve,Ee),Ee;case"option":Ve=Ae.selectedValue,F.push(en("option"));var It=ot=null,Kt=null,Rt=null;for(Ee in q)if(g.call(q,Ee)){var Hn=q[Ee];if(Hn!=null)switch(Ee){case"children":ot=Hn;break;case"selected":Kt=Hn;break;case"dangerouslySetInnerHTML":Rt=Hn;break;case"value":It=Hn;default:et(F,re,Ee,Hn)}}if(Ve!=null)if(q=It!==null?""+It:Tt(ot),Z(Ve)){for(re=0;re<Ve.length;re++)if(""+Ve[re]===q){F.push(Gt);break}}else""+Ve===q&&F.push(Gt);else Kt&&F.push(Gt);return F.push(nt),St(F,Rt,ot),ot;case"textarea":F.push(en("textarea")),Rt=Ve=Ee=null;for(ot in q)if(g.call(q,ot)&&(It=q[ot],It!=null))switch(ot){case"children":Rt=It;break;case"value":Ee=It;break;case"defaultValue":Ve=It;break;case"dangerouslySetInnerHTML":throw Error(t(91));default:et(F,re,ot,It)}if(Ee===null&&Ve!==null&&(Ee=Ve),F.push(nt),Rt!=null){if(Ee!=null)throw Error(t(92));if(Z(Rt)&&1<Rt.length)throw Error(t(93));Ee=""+Rt}return typeof Ee=="string"&&Ee[0]===`
6 months ago
`&&F.push(Vt),Ee!==null&&F.push(c(R(""+Ee))),null;case"input":F.push(en("input")),It=Rt=ot=Ee=null;for(Ve in q)if(g.call(q,Ve)&&(Kt=q[Ve],Kt!=null))switch(Ve){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":It=Kt;break;case"defaultValue":ot=Kt;break;case"checked":Rt=Kt;break;case"value":Ee=Kt;break;default:et(F,re,Ve,Kt)}return Rt!==null?et(F,re,"checked",Rt):It!==null&&et(F,re,"checked",It),Ee!==null?et(F,re,"value",Ee):ot!==null&&et(F,re,"value",ot),F.push(ht),null;case"menuitem":F.push(en("menuitem"));for(var oa in q)if(g.call(q,oa)&&(Ee=q[oa],Ee!=null))switch(oa){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:et(F,re,oa,Ee)}return F.push(nt),null;case"title":F.push(en("title")),Ee=null;for(Hn in q)if(g.call(q,Hn)&&(Ve=q[Hn],Ve!=null))switch(Hn){case"children":Ee=Ve;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:et(F,re,Hn,Ve)}return F.push(nt),Ee;case"listing":case"pre":F.push(en(H)),Ve=Ee=null;for(It in q)if(g.call(q,It)&&(ot=q[It],ot!=null))switch(It){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;default:et(F,re,It,ot)}if(F.push(nt),Ve!=null){if(Ee!=null)throw Error(t(60));if(typeof Ve!="object"||!("__html"in Ve))throw Error(t(61));q=Ve.__html,q!=null&&(typeof q=="string"&&0<q.length&&q[0]===`
7 months ago
`?F.push(Vt,c(q)):F.push(c(""+q)))}return typeof Ee=="string"&&Ee[0]===`
6 months ago
`&&F.push(Vt),Ee;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":F.push(en(H));for(var Ka in q)if(g.call(q,Ka)&&(Ee=q[Ka],Ee!=null))switch(Ka){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,H));default:et(F,re,Ka,Ee)}return F.push(ht),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return _t(F,q,H,re);case"html":return Ae.insertionMode===0&&F.push(Zn),_t(F,q,H,re);default:if(H.indexOf("-")===-1&&typeof q.is!="string")return _t(F,q,H,re);F.push(en(H)),Ve=Ee=null;for(Kt in q)if(g.call(q,Kt)&&(ot=q[Kt],ot!=null))switch(Kt){case"children":Ee=ot;break;case"dangerouslySetInnerHTML":Ve=ot;break;case"style":Ze(F,re,ot);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:D(Kt)&&typeof ot!="function"&&typeof ot!="symbol"&&F.push(st,c(Kt),xt,c(R(ot)),tn)}return F.push(nt),St(F,Ve,Ee),Ee}}var Er=f("</"),pt=f(">"),Mt=f('<template id="'),Jt=f('"></template>'),sn=f("<!--$-->"),ln=f('<!--$?--><template id="'),vr=f('"></template>'),fr=f("<!--$!-->"),ha=f("<!--/$-->"),jr=f("<template"),nr=f('"'),Lr=f(' data-dgst="');f(' data-msg="'),f(' data-stck="');var te=f("></template>");function me(F,H,q){if(a(F,ln),q===null)throw Error(t(395));return a(F,q),o(F,vr)}var Ce=f('<div hidden id="'),Ye=f('">'),He=f("</div>"),Qe=f('<svg aria-hidden="true" style="display:none" id="'),tt=f('">'),kt=f("</svg>"),Yt=f('<math aria-hidden="true" style="display:none" id="'),On=f('">'),yn=f("</math>"),xr=f('<table hidden id="'),Jn=f('">'),yr=f("</table>"),ta=f('<table hidden><tbody id="'),Pi=f('">'),Nn=f("</tbody></table>"),Aa=f('<table hidden><tr id="'),Fa=f('">'),Zr=f("</tr></table>"),fo=f('<table hidden><colgroup id="'),Oa=f('">'),au=f("</colgroup></table>");function si(F,H,q,re){switch(q.insertionMode){case 0:case 1:return a(F,Ce),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Ye);case 2:return a(F,Qe),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,tt);case 3:return a(F,Yt),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,On);case 4:return a(F,xr),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Jn);case 5:return a(F,ta),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Pi);case 6:return a(F,Aa),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Fa);case 7:return a(F,fo),a(F,H.segmentPrefix),a(F,c(re.toString(16))),o(F,Oa);default:throw Error(t(397))}}function li(F,H){switch(H.insertionMode){case 0:case 1:return o(F,He);case 2:return o(F,kt);case 3:return o(F,yn);case 4:return o(F,yr);case 5:return o(F,Nn);case 6:return o(F,Zr);case 7:return o(F,au);default:throw Error(t(397))}}var ec=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("'),ou=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("'),iu=f('$RC("'),ds=f('","'),tc=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(","),su=/[<\u2028\u2029]/g;function Fo(F){return JSON.stringify(F).replace(su,function(H){switch(H){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no
`,o.current,t.path,I);const N=(_=o.current)==null?void 0:_.querySelectorAll(".internal-link");N==null||N.forEach(k=>{const B=k,L=B.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||k.classList.add("is-unresolved"),B.addEventListener("mouseover",V=>{V.stopPropagation(),r.app.workspace.trigger("hover-link",{event:V,source:"thino",hoverParent:I.containerEl,targetEl:B,linktext:L,sourcePath:B.href})})})}M()},[t.content,i]);const y=async()=>{if(f)try{await we.deleteMemoById(a.id),n(a.id)}catch(I){new C.Notice(I.message)}else h()},w=async()=>{switch(a.sourceType){case"DAILY":await z2(a.id,a.path);break;case"CANVAS":await W2(a.id,a.path);break;case"MULTI":await U2(a.path);break;case"FILE":await V2(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 Kg(I.webId),I&&we.editMemo(I),n(a.id),new C.Notice(E("RESTORE SUCCEED"))}catch(I){new C.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&&C.setIcon(I,"more-horizontal")},className:"btn more-action-btn"}),v.jsx("div",{className:"more-action-btns-wrapper",children:v.jsxs("div",{className:"more-action-btns-container",children:[v.jsxs("div",{className:"more-action-menu-item",children:[v.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),v.jsx("span",{className:"btn restore-btn",onClick: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()}})]})},_Ce=({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=Up(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(kf)===null||o==="IMAGED"&&h.content.match(Nf)===null||o==="CONNECTED"&&h.content.match(rd)===null)&&(g=!1),i&&!h.content.toLowerCase().includes(i.toLowerCase())&&(g=!1),g}):e.filter(h=>!h.content.contains("comment:"))},BCe=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=P.useContext(Lt),r=im(),[a,o]=P.useState([]),i=ne.useRef(null),l=ne.useRef(null);P.useEffect(()=>{l.current&&C.setIcon(l.current,"more-horizontal")},[l]),P.useEffect(()=>{const w=_Ce({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
* **开源项目**
* 😋 精美且细节的视觉样式
5 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:uT(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?J0:K0})]}),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?J0:K0})]}),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?J0:K0})]})]}),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?J0:K0})]})]}),v.jsxs("div",{className:"section-container hidden",children:[v.jsx("p",{className:"title-text",children:"其他"}),v.jsx("div",{className:"btn-container",children:v.jsx("button",{className:"btn export-btn",onClick:h,children:"导出数据(JSON)"})})]})]})},YCe=()=>{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(HCe,{})})]})},UCe=()=>{const{dailyNotesState:{app:e},locationState:{query:t},globalState:{isMobileView:n,changedByMemos:r},memoState:{memos:a}}=P.useContext(Lt),o=im(),[i,l]=P.useState([]),[c,f]=P.useState([]),h=ne.useRef(null),g=ne.useRef(null),[y,w]=P.useState(!1),[S,D]=P.useState([]),I=ne.useRef([]),M=P.useCallback(({memos:k,query:B,HideDoneTasks:L})=>{const{tag:R,duration:V,type:Y,text:Z,filter:Q}=B,G=on.getQueryById(Q);return!!(R||V&&V.from<V.to||Y||Z||G)||G||L?k.filter(se=>{let fe=!0;if(se.thinoType!==void 0&&L&&se.thinoType==="TASK-DONE"&&(fe=!1),se.content.contains("comment:")&&(fe=!1),G){const $=JSON.parse(G.querystring);Array.isArray($)&&(fe=Up(se,$))}if(R){const $=new Set;for(const he of Array.from(se.content.match($r)||[])){const ce=he.replace($r,"$1").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}for(const he of Array.from(se.content.match(ua)||[])){const ce=he.replace(ua,"$1").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}for(const he of Array.from(se.content.match(Wa)||[])){const ce=he.replace(Wa,"$2").trim().split("/");let X="";for(const ae of ce)X+=ae,$.add(X),X+="/"}$.has(R)||(fe=!1)}return V&&V.from<V.to&&(ut.getTimeStampByDate(se.createdAt)<V.from||ut.getTimeStampByDate(se.createdAt)>V.to)&&(fe=!1),Y&&(Y==="NOT_TAGGED"&&(se.content.match($r)
6 months ago
${L}`}}}let M=h;M||(M=t.MemoSaveLocation),(_=e.settings)!=null&&_.AppendOrPrependTextViaServer&&(w=`${t==null?void 0:t.PrependViaServer}${(t==null?void 0:t.WithNewLineViaServer)==="prepend"||(t==null?void 0:t.WithNewLineViaServer)==="both"?`
7 months ago
`:""}${w}${(t==null?void 0:t.WithNewLineViaServer)==="append"||(t==null?void 0:t.WithNewLineViaServer)==="both"?`
6 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 C.Notice(E("Thino - Failed to start HTTP server, please check the port is available."))}new C.Notice(`${E("Thino - Started HTTP server on port")} ${a}`)},close(){n.close(),new C.Notice(E("Thino - Terminated HTTP server"))}}}const{clipboard:mr}=C.Platform.isDesktop?require("electron"):"";class S3e{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 lp=new S3e;let Fg=null,NN=mr==null?void 0:mr.readText(),AN=mr==null?void 0:mr.readImage();mr&&(mr.on=(e,t)=>(lp.on(e,t),mr),mr.once=(e,t)=>(lp.once(e,t),mr),mr.off=(e,t)=>(t?lp.removeListener(e,t):lp.removeAllListeners(e),mr),mr.startWatching=()=>(Fg||(Fg=setInterval(()=>{D3e(NN,NN=mr==null?void 0:mr.readText())&&lp.emit("text-changed"),T3e(AN,AN=mr==null?void 0:mr.readImage())&&lp.emit("image-changed")},500)),mr),mr.stopWatching=()=>(Fg&&clearInterval(Fg),Fg=null,mr));function D3e(e,t){return t&&e!==t}function T3e(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var _N;const nT=(_N=require("electron"))==null?void 0:_N.remote;var BN,HN;const FN=(HN=(BN=require("electron"))==null?void 0:BN.remote)==null?void 0:HN.screen;class I3e{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(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{nT.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&&(nT.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 yP(e,y,w=>{c==="prepend"?o=w.trim()+(w.trim()?g:""):i=(w.trim()?g:"")+w,f()}).open();break}case"selectTags":new dz(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 Q3e=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 ox(e){try{const t=e.app.internalPlugins.plugins["daily-notes"];let n;n={settings:{...e.settings,tokenForVerify:"***"},plugins:Object.keys(e.app.plugins.plugins),manifest:e.manifest,platform:C.Platform.resourcePathPrefix},t&&(n={...n,dailyNotePluginInfo:{options:t.instance.options}}),await navigator.clipboard.writeText(`\`\`\`json
7 months ago
${JSON.stringify(n,null,2)}
6 months ago
\`\`\``),new C.Notice(E("Debug info copied to clipboard"))}catch(t){console.error(t)}}class X3e extends C.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=Q3e(this.app),ft.setPlugin(this),await this.loadSettings(),nMe(),this.registerRibbon(),await this.verify();try{this.settings.ShowUpdateMessage&&await this.checkVersionAndShowChangeLog()}catch(n){console.error(n)}this.settingTab=new mMe(this.app,this),this.addSettingTab(this.settingTab),this.initApp(),this.initEditor(),this.initURIHandler(),this.registerMobileEvent(),this.registerCommands(),this.registerCanvasNodeMemos(),this.registerHoverEvent(),this.registerLinkOpen(),this.registerCodeBlocks(),C.Platform.isMobile&&this.registerMobileNavbar(),this.updateLayoutSettings(),this.registerEditorContextMenu(),this.registerEditorSuggest(new XCe(this.app,this)),this.registerEditorExtension([d3e]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(lo,n=>new vf(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(),C.Platform.isMobile){const o=this.app.mobileNavbar;o&&o.showThinoBtnEl&&((a=this.settings)!=null&&a.NavbarButton)&&(o.showThinoBtnEl.detach(),o.showThinoBtnEl=null)}new C.Notice(E("Close Memos Successfully"))}initEditor(){this.register(_g(C.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=_g(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){bf(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;p3e(h,this.app),m3e(C.moment().add(30,"days").valueOf(),this.app),dt.setRefresh(!0)}catch(h){console.error(h),new C.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 C.Notice(E("Saved sync token successfully"))}catch(h){console.error(h),new C.Notice(E("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const h=await aP();await navigator.clipboard.writeText(h),new C.Notice(E("Copied app id successfully"))}const r=(l=ft.getState())==null?void 0:l.verifyState,a=!C.Platform.isDesktop&&await((f=(c=window.Capacitor)==null?void 0:c.Plugins.Device)==null?void 0:f.getId()),o=C.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 RN(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(){tw.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),["Modern","Clean","Minimal","Gradient"].forEach(n=>{this.addCommand({id:`share-thino-via-${n.toLowerCase()}`,name:E("Share thino")+` [${E(n)}]`,editorCallback:(r,a)=>{const o=r.getSelection();if(o.length===0)return;const i={id:`temp-${Date.now()}`,content:o,createdAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),updatedAt:C.moment().format("YYYY-MM-DD HH:mm:ss"),deletedAt:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",thinoType:"JOURNAL",hasId:"",linkId:"",resourceList:[],creatorName:"thino",sourceType:"DAILY",path:a.file.path,fileInfo:{tags:[],frontmatter:{}}};sf(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 C.Notice(E("Please open thino first"));return}new xT(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:E("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(vf)&&this.settings.needVerify)return n||dt.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:E("Copy debug info"),callback:async()=>{await ox(this)}}),this.addCommand({id:"insert-editor",name:E("Insert editor"),checkCallback:n=>{const r=this.app.workspace.getActiveViewOfType(C.MarkdownView);if(r&&r.getViewType()==="markdown")return n||r.editor.replaceSelection("\n```thino\n{\n editor: false\n}\n```\n"),!0}}),this.addCommand({id:"toggle-minimal-thino",name:E("Toggle minimal mode"),callback:()=>{const n=document.body.hasClass("minimal-thino");document.body.toggleClass("minimal-thino",!n)}}),this.addCommand({id:"focus-on-thino-editor",name:E("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:E("ReSync web thinos to local"),callback:()=>{uCe(this.app)}}),this.addCommand({id:"init-thino-sync",name:E("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new C.Notice(E("Please input token first"));return}if(!this.settings.startSync){new C.Notice(E("Please enable sync first"));return}try{await we.initSync()}catch(a){console.error(a),new C.Notice(E("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:E("Show daily thino"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:E("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:E("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){a
8 months ago
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH
UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk
iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj
+PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy
cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46
3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+
swIDAQAB
6 months ago
-----END PUBLIC KEY-----`,"RS256");try{const{payload:f}=await Z3e(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 ix(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(lo).length>0||this.settings.MobileAndDesktop==="Mobile"&&C.Platform.isDesktop||this.settings.MobileAndDesktop==="Desktop"&&C.Platform.isMobile||this.settings.OpenMemosAutomatically&&this.openMemos()}async openDailyMemo(){if(this.app.workspace.getLeavesOfType(lo).length>0){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 C.Notice(E("Please Open Memos First"));return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var o,i,l;const n=this.app.workspace;if(n.detachLeavesOfType(lo),!this.app.plugins.getPlugin("obsidian-hover-editor")){new C.Notice(E("Please install obsidian-hover-editor plugin first"));return}const a=await((o=this.app.plugins.getPlugin("obsidian-hover-editor"))==null?void 0:o.spawnPopover());a&&(await a.setViewState({type:lo}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(i=this.settings)!=null&&i.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((l=a.view.containerEl.querySelector("textarea"))==null||l.focus()))}}class ix extends C.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 C.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new C.Component;const[c,f]=this.getLatestVersionContent(l.text);let 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 C.MarkdownRenderer.render(this.app,h,a,"",this.component),await C.MarkdownRenderer.render(this.app,g,o,"",this.component)}catch(a){console.error(a),n.createEl("p",{text:E("Failed to load changelog")}),n.createEl("a",{text:E("View online"),attr:{href:"https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md",target:"_blank"}})}}getLatestVersionContent(n){const r=/^# .+/gm,a=[...n.matchAll(r)];if(a.length===0)return[n,""];const o=a[0].index||0;let i=n.length;a.leng