"use strict";varYN=Object.defineProperty;varUN=(e,t,n)=>tine?YN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;varDe=(e,t,n)=>(UN(e,typeoft!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});constC=require("obsidian"),Lw=require("@codemirror/language"),Cm=require("@codemirror/state"),ul=require("@codemirror/view");functionzN(e,t){for(varn=0;n<t.length;n++){constr=t[n];if(typeofr!="string"&&!Array.isArray(r)){for(constoinr)if(o!=="default"&&!(oine)){consti=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}returnObject.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}varVr=typeofglobalThis<"u"?globalThis:typeofwindow<"u"?window:typeofglobal<"u"?global:typeofself<"u"?self:{};function$r(e){returne&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}varlx={exports:{}},tm={},ux={exports:{}},ln={},yD;functionVN(){if(yD)returnln;yD=1;vare=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;functionv(K){returnK===null||typeofK!="object"?null:(K=g&&K[g]||K["@@iterator"],typeofK=="function"?K:null)}varw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,T={};functionI(K,re,pe){this.props=K,this.context=re,this.refs=T,this.updater=pe||w}I.prototype.isReactComponent={},I.prototype.setState=function(K,re){if(typeofK!="object"&&typeofK!="function"&&K!=null)throwError("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,K,re,"setState")},I.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};functionk(){}k.prototype=I.prototype;functionA(K,re,pe){this.props=K,this.context=re,this.refs=T,this.updater=pe||w}varR=A.prototype=newk;R.constructor=A,D(R,I.prototype),R.isPureReactComponent=!0;varj=Array.isArray,B=Object.prototype.hasOwnProperty,L={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};functionU(K,re,pe){varIe,Oe={},Ne=null,Be=null;if(re!=null)for(Ieinre.ref!==void0&&(Be=re.ref),re.key!==void0&&(Ne=""+re.key),re)B.call(re,Ie)&&!Z.hasOwnProperty(Ie)&&(Oe[Ie]=re[Ie]);varJe=arguments.length-2;if(Je===1)Oe.children=pe;elseif(1<Je){for(varze=Array(Je),Qe=0;Qe<Je;Qe++)ze[Qe]=arguments[Qe+2];Oe.children=ze}if(K&&K.defaultProps)for(IeinJe=K.defaultProps,Je)Oe[Ie]===void0&&(Oe[Ie]=Je[Ie]);return{$$typeof:e,type:K,key:Ne,ref:Be,props:Oe,_owner:L.current}}functionz(K,re){return{$$typeof:e,type:K.type,key:re,ref:K.ref,props:K.props,_owner:K._owner}}function$(K){returntypeofK=="object"&&K!==null&&K.$$typeof===e}functionte(K){varre={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(pe){returnre[pe]})}varQ=/\/+/g;functionue(K,re){returntypeofK=="object"&&K!==null&&K.key!=null?te(""+K.key):re.toString(36)}functionee(K,re,pe,Ie,Oe){varNe=typeofK;(Ne==="undefined"||Ne==="boolean")&&(K=null);varBe=!1;if(K===null)Be=!0;elseswitch(Ne){case"string":case"number":Be=!0;break;case"object":switch(K.$$typeof){casee:caset:Be=!0}}if(Be)returnBe=K,Oe=Oe(Be),K=Ie===""?"."+ue(Be,0):Ie,j(Oe)?(pe="",K!=null&&(pe=K.replace(Q,"$&/")+"/"),ee(Oe,re,pe,"",function(Qe){returnQe})):Oe!=null&&($(Oe)&&(Oe=z(Oe,pe+(!Oe.key||Be&&Be.key===Oe.key?"":(""+Oe.key).replace(Q,"$&/")+"/")+K)),re.push(Oe)),1;if(Be=0,Ie=Ie===""?".":Ie+":",j(K))for(varJe=0;Je<K.length;Je++){Ne=K[Je];varze=Ie+ue(Ne,Je);Be+=ee(Ne,re,pe,ze,Oe)}elseif(ze=v(K),typeofze=="function")for(K=ze.call(K),Je=0;!(Ne=K.next()).done;)Ne=Ne.value,ze=Ie+ue(Ne,Je++),Be+=ee(Ne,re,pe,ze,Oe);elseif(Ne==="object")throwre=String(K),Error(
`)}}}),e.path.includes("2024-04-07");const m=Object.keys(f).map(v=>({line:f[v].content,index:parseInt(v)}));return e.path.includes("2024-04-07"),m}async function x6(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 E6(e,t){var o;let n;try{n=await t.vault.read(e)}catch(i){console.error(i),n=await t.vault.cachedRead(e)}const r=(o=t.metadataCache.getFileCache(e))==null?void 0:o.frontmatterPosition;return r?n.slice(r.end.offset+1):n}function C6(e){const t=e.split(/\r?\n/),n=[];let r="",o=[],i=0;for(let a=0;a<t.length;a++){const u=t[a];u.startsWith("#")?(r&&n.push({header:r,content:o.join(`
`);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function t8({content:e,isList:t,name:n}){const r=_e.getState().dailyNotesState.settings,o=C.moment(),i=ut.randomId(16),a=(r==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",u=n||`${o.format("YYYYMMDD")}-${i}`,d=`${a}/${u}.md`,f={id:i,content:e,deletedAt:"",path:d,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.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"},m=yt.getState().app,{vault:g,fileManager:v}=m,w=g.getAbstractFileByPath(a);(!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(a)),dt.setChangedByMemos(!0);let D;const T=m.vault.getFileByPath(d);return T?D=await g.create(`${a}/${o.format("YYYYMMDD")}-${i}.md`,e):D=await g.create(d,e),await v.processFrontMatter(D,I=>{I.id=i,I.createdAt=o.format("YYYY/MM/DD HH:mm:ss"),I.updatedAt=o.format("YYYY/MM/DD HH:mm:ss"),I.thinoType=t?"JOURNAL":"TASK-TODO"}),(!n||T)&&(r!=null&&r.SetFileNameAfterCreate)&&m.fileManager.promptForFileRename(D),f}async function n8({content:e,isList:t}){const n=_e.getState().dailyNotesState.settings,r=C.moment(),o=ut.randomId(16),i=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",a={id:o,content:e,deletedAt:"",path:i,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"},u=yt.getState().app,{vault:d}=u;let f=d.getAbstractFileByPath(i);(!f||!(f instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),f=await d.create(i,""));let m="";try{m=await d.read(f)||await d.cachedRead(f)}catch(k){console.error(k),new C.Notice(E("Failed to read current daily note, check if it exists."))}const g=m.indexOf(`#${r.format("YYYY-MM-DD")}`);let v=m.indexOf(`
${m.substring(v)}`}else I=`${m.substring(0,v)}${T}${m.substring(v)}`;return setTimeout(async()=>{dt.setChangedByMemos(!0),await d.modify(f,I)},200),a}async function ED(e){const t=_e.getState().dailyNotesState.settings,n=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),r=e.id,o=(t==null?void 0:t.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",i={id:r,content:e.content,deletedAt:e.deletedAt||"",path:o,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},a=yt.getState().app,{vault:u}=a;let d=u.getAbstractFileByPath(o);(!d||!(d instanceof C.TFile))&&(new C.Notice(E("File not found for the given thino path, is creating a new file")),d=await u.create(o,""));let f="";try{f=await u.read(d)||await u.cachedRead(d)}catch(I){console.error(I),new C.Notice(E("Failed to read current daily note, check if it exists."))}const m=f.indexOf(`#${n.format("YYYY-MM-DD")}`);let g=f.indexOf(`
${f.substring(g)}`}else T=`${f.substring(0,g)}${D}${f.substring(g)}`;return dt.setChangedByMemos(!0),await u.modify(d,T),i}async function r8({content:e,isList:t}){const n=_e.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",o=C.moment(),i=ut.randomId(16),a={id:i,content:e,deletedAt:"",path:r,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.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"},u=yt.getState().app,{vault:d}=u,f=await x6(r,u);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 m=await d.read(f),g=JSON.parse(m);if(g.nodes.find(I=>I.id===a.id))return;let w;g.nodes.length>0&&(w=[...g.nodes].reduce((I,k)=>{if(!I.createdAt)return k;const A=C.moment(I.createdAt,"YYYY/MM/DD HH:mm:ss"),R=C.moment(k.createdAt,"YYYY/MM/DD HH:mm:ss");return A.isAfter(R)?I:k}));const D=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({...D,type:"text",id:i,text:e,deletedAt:"",createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.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 T=JSON.stringify(g,null,2);return await d.modify(f,T),a}async function CD(e,t,n){var $;const{vault:r}=_e.getState().dailyNotesState.app||app,o=_e.getState().dailyNotesState.app||app,i=_e.getState().dailyNotesState.settings,a=o.vault.getConfig("useTab")===void 0||app.vault.getConfig("useTab")===!0,u=a?1:o.vault.getConfig("tabSize"),d=(a?" ":" ").repeat(u),f=e.split(`
`+d:" "}${I?`[webId::${I}]`:""}`,R=su(),j=e0(m,R);letB;if(j?B=j:B=awaitut.createDailyNoteCheck(m),!B){newC.Notice(E("Failed to create daily note, check if it exists."));return}j||awaityt.fechLocalDailyNotes();letL="";try{L=awaitr.read(B)||awaitr.cachedRead(B)}catch(te){console.error(te),newC.Notice(E("Failed to read current daily note, check if it exists."))}constZ=w==="end"?"":t?i.InsertAfter:g&&v||i.InsertAfter,U=awaitRx(Z,A,L);awaitr.modify(B,U.content);constz=U.posNum===-1?_x(U.content).length-(A.split(`
`+w:" "}${f}`,R=su(),j=e0(T,R);letB;if(j?B=j:B=awaitut.createDailyNoteCheck(T),!B){newC.Notice(E("Failed to create daily note, check if it exists.")),newC.Notice(E("Your content has been copied to clipboard, and inserted into the editor. Please try it again")),awaitnavigator.clipboard.writeText(e.content);const$=this.app.workspace.getLeavesOfType("thino_view").first();n.workspace.trigger("send-to-thino",e.content,$);return}j||awaityt.fechLocalDailyNotes();letL="";try{L=awaitt.read(B)||awaitt.cachedRead(B)}catch($){console.error($),newC.Notice(E("Failed to read current daily note, check if it exists."))}constZ=d==="end"?"":e.thinoType&&a&&u||o,U=awaitRx(Z,A,L);awaitt.modify(B,U.content);constz=U.posNum===-1?_x(U.content).length-1:U.posNum+1;returndt.setChangedByMemos(!0),{id:T.format("YYYYMMDDHHmm")+"00"+z,content:e.content,deletedAt:e.deletedAt??"",createdAt:T.format("YYYY/MM/DD HH:mm:ss"),updatedAt:T.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType??"JOURNAL",path:B.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}asyncfunctionRx(e,t,n){constr=newRegExp(`s*${awaitX6(e)}s*`),o=e8(n),i=o.findIndex(f=>r.test(f)),a=(e==null?void0:e.trim())===""?!0:i===-1;a&&console.error("unable to find insert after line in file.");constu=o.slice(i+1).findIndex(f=>/^#+|---/.test(f)),d=u!==-1;if(d){let f;for(let m=u+i;m>i;m--)if(!/^[\s\n]*$/.test(o[m])){f=m;break}returnf||(f=i),awaitMD(t,n,a?-1:f,d)}elsereturnawaitMD(t,n,o.length-1,d)}asyncfunctionMD(e,t,n,r){if(n<-1)thrownewError("Invalid position");if(n===-1)return{content:`${t}
`:"")+a}`,posNum:n}}const_x=e=>e.split(/\r?\n/);asyncfunctioni8(e){constt=_e.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(ninstanceofC.TFile)){newC.Notice(E("File not found for the given thino path"));return}awaitt.vault.delete(n)}asyncfunctiona8(e){constt=_e.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(ninstanceofC.TFile)){newC.Notice(E("File not found for the given thino path"));return}consto=(awaitt.vault.read(n)).split(`
`),i=o.findIndex(d=>d.includes(e.id));if(i===-1){new C.Notice(E("Thino not found"));return}const a=o.findIndex((d,f)=>f>i&&d.trim()==="");a===-1?o.splice(i,o.length-i):o.splice(i,a-i);const u=o.join(`
`);if(!u){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),await t.vault.modify(n,u)}async function s8(e){const t=_e.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),o=JSON.parse(r),i=o.nodes,a=i.findIndex(m=>m.id===e.id);if(a===-1){new C.Notice(E("Thino not found"));return}i.splice(a,1);const u=o.edges;u.filter(m=>m.fromNode===e.id||m.toNode===e.id).forEach(m=>{const g=u.findIndex(v=>v.id===m.id);g!==-1&&u.splice(g,1)}),dt.setChangedByMemos(!0);const f=JSON.stringify(o,null,2);await t.vault.modify(n,f)}async function l8(e){Fx()||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}=_e.getState().dailyNotesState.app,r=e.id.toString().slice(0,14),o=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(r,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(r,"YYYYMMDDHHmmss");C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(o,"day");const i=e.path,a=t.getAbstractFileByPath(i);if(!a){new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings"));return}const u=await t.read(a),d=u.split(`
`),f=n.getFileCache(a),m=(f==null?void 0:f.listItems)||[],g=parseInt(e.id.slice(14));let v=g;function w(k,A){let R=[];for(const j in A)A[j]===k&&R.push(parseInt(j),...w(parseInt(j),A));return R}const D=Ax(m),T=m.find(k=>k.position.start.line===g),I=w(g,D);if(I.length>0){const k=I.map(A=>{const R=m.find(j=>j.position.start.line===A);return R?R.position.end.line:-1});v=Math.max(...k,T.position.end.line)}else v=T.position.end.line;if(!u){new C.Notice(E("Thino not found"));return}dt.setChangedByMemos(!0),d.splice(g,v-g+1),await t.modify(a,d.join(`
`);return await n.modify(r,I),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:e.updatedAt,content:t.content||e.content,rowStatus:t.rowStatus||e.rowStatus,visibility:t.visibility||e.visibility,pinned:t.pinned!==void 0?t.pinned:e.pinned,webId:t.webId||e.webId,deletedAt:t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function il(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=_e.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const o=await n.read(r),i=JSON.parse(o),a=i.nodes.find(f=>f.id===e.id);if(!a)return e;t.content&&(a.text=t.content),t.thinoType&&(a.thinoType=t.thinoType),t.rowStatus&&(a.rowStatus=t.rowStatus),t.visibility&&(a.visibility=t.visibility),t.pinned!==void 0&&(a.pinned=t.pinned),t.webId&&(a.webId=t.webId);const u=C.moment();t.deleted!==void 0&&(a.deletedAt=t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):""),a.updatedAt=u.format("YYYY/MM/DD HH:mm:ss");const d=JSON.stringify(i,null,2);return await n.modify(r,d),dt.setChangedByMemos(!0),{...e,thinoType:t.thinoType||e.thinoType,createdAt:e.createdAt,updatedAt:e.updatedAt,content:t.content??e.content,rowStatus:t.rowStatus??e.rowStatus,visibility:t.visibility??e.visibility,pinned:t.pinned??e.pinned,webId:t.webId??e.webId,deletedAt:t.deleted?u.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function al(e,t){var ue;Fx()||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}=_e.getState().dailyNotesState.app,o=_e.getState().dailyNotesState.app,{settings:i}=_e.getState().dailyNotesState,a=e.id.toString().slice(0,14),u=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(a,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(a,"YYYYMMDDHHmmss"),d=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(u,"day"),f=e.path,m=n.getAbstractFileByPath(f)||n.getAbstractFileByPath(e.path);if(!m)return new C.Notice(E("Please check your daily note plugin OR periodic notes plugin settings")),e;const v=(await n.read(m)).split(`
`),w=r.getFileCache(m),D=(w==null?void 0:w.listItems)||[];if(D.length===0)return new C.Notice(E("Thino not found")),e;const T=parseInt(e.id.slice(14));let I=T;function k(ee,le){let W=[];for(const de in le)le[de]===ee&&W.push(parseInt(de),...k(parseInt(de),le));return W}const A=Ax(D),R=D.find(ee=>ee.position.start.line===T);if(!R)return new C.Notice(E("Thino not found")),e;const j=k(T,A);if(j.length>0){const ee=j.map(le=>{const W=D.find(de=>de.position.start.line===le);return W?W.position.end.line:-1});I=Math.max(...ee,R.position.end.line)}else I=R.position.end.line;const B=v.slice(T,I+1);let L=B.join(`
`].join("");var Ae}function ze(ne){return ne.flags!==void 0?ne.flags:[ne.global?"g":"",ne.ignoreCase?"i":"",ne.multiline?"m":"",ne.unicode?"u":"",ne.sticky?"y":""].join("")}function Qe(){for(var ne=[].slice.call(arguments),ge=ne.length,Ae=0;Ae<ge;Ae+=1)Q(ne[Ae]);return i(function(He,Ye){for(var et,nt=new Array(ge),kt=0;kt<ge;kt+=1){if(!(et=z(ne[kt]._(He,Ye),et)).status)return et;nt[kt]=et.value,Ye=et.index}return z(Z(Ye,nt),et)})}function It(){var ne=[].slice.call(arguments);if(ne.length===0)throw new Error("seqMap needs at least one argument");var ge=ne.pop();return le(ge),Qe.apply(null,ne).map(function(Ae){return ge.apply(null,Ae)})}function Zt(){var ne=[].slice.call(arguments),ge=ne.length;if(ge===0)return Tt("zero alternates");for(var Ae=0;Ae<ge;Ae+=1)Q(ne[Ae]);return i(function(He,Ye){for(var et,nt=0;nt<ne.length;nt+=1)if((et=z(ne[nt]._(He,Ye),et)).status)return et;return et})}function Re(ne,ge){return tt(ne,ge).or(Et([]))}function tt(ne,ge){return Q(ne),Q(ge),It(ne,ge.then(ne).many(),function(Ae,He){return[Ae].concat(He)})}function at(ne){W(ne);var ge="'"+ne+"'";return i(function(Ae,He){var Ye=He+ne.length,et=Ae.slice(He,Ye);return et===ne?Z(Ye,et):U(He,ge)})}function gt(ne,ge){(function(Ye){if(!(Ye instanceof RegExp))throw new Error("not a regexp: "+Ye);for(var et=ze(Ye),nt=0;nt<et.length;nt++){var kt=et.charAt(nt);if(kt!=="i"&&kt!=="m"&&kt!=="u"&&kt!=="s")throw new Error('unsupported regexp flag "'+kt+'": '+Ye)}})(ne),arguments.length>=2?ee(ge):ge=0;var Ae=function(Ye){return RegExp("^(?:"+Ye.source+")",ze(Ye))}(ne),He=""+ne;return i(function(Ye,et){var nt=Ae.exec(Ye.slice(et));if(nt){if(0<=ge&&ge<=nt.length){var kt=nt[0],en=nt[ge];return Z(et+kt.length,en)}return U(et,"valid match group (0 to "+nt.length+") in "+He)}return U(et,He)})}function Et(ne){return i(function(ge,Ae){return Z(Ae,ne)})}function Tt(ne){return i(function(ge,Ae){return U(Ae,ne)})}function qt(ne){if(j(ne))return i(function(ge,Ae){var He=ne._(ge,Ae);return He.index=Ae,He.value="",He});if(typeof ne=="string")return qt(at(ne));if(ne instanceof RegExp)return qt(gt(ne));throw new Error("not a string, regexp, or parser: "+ne)}function zt(ne){return Q(ne),i(function(ge,Ae){var He=ne._(ge,Ae),Ye=ge.slice(Ae,He.index);return He.status?U(Ae,'not "'+Ye+'"'):Z(Ae,null)})}function $t(ne){return le(ne),i(function(ge,Ae){var He=ue(ge,Ae);return Ae<ge.length&&ne(He)?Z(Ae+1,He):U(Ae,"a character/byte matching "+ne)})}function Gt(ne,ge){arguments.length<2&&(ge=ne,ne=void 0);var Ae=i(function(He,Ye){return Ae._=ge()._,Ae._(He,Ye)});return ne?Ae.desc(ne):Ae}function cn(){return Tt("fantasy-land/empty")}a.parse=function(ne){if(typeof ne!="string"&&!L(ne))throw new Error(".parse must be called with a string or Buffer as its argument");var ge,Ae=this.skip(Cr)._(ne,0);return ge=Ae.status?{status:!0,value:Ae.value}:{status:!1,index:te(ne,Ae.furthest),expected:Ae.expected},delete $[ne],ge},a.tryParse=function(ne){var ge=this.parse(ne);if(ge.status)return ge.value;var Ae=Je(ne,ge),He=new Error(Ae);throw He.type="ParsimmonError",He.result=ge,He},a.assert=function(ne,ge){return this.chain(function(Ae){return ne(Ae)?Et(Ae):Tt(ge)})},a.or=function(ne){return Zt(this,ne)},a.trim=function(ne){return this.wrap(ne,ne)},a.wrap=function(ne,ge){return It(ne,this,ge,function(Ae,He){return He})},a.thru=function(ne){return ne(this)},a.then=function(ne){return Q(ne),Qe(this,ne).map(function(ge){return ge[1]})},a.many=function(){var ne=this;return i(function(ge,Ae){for(var He=[],Ye=void 0;;){if(!(Ye=z(ne._(ge,Ae),Ye)).status)return z(Z(Ae,He),Ye);if(Ae===Ye.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");Ae=Ye.index,He.push(Ye.value)}})},a.tieWith=function(ne){return W(ne),this.map(function(ge){if(function(Ye){if(!B(Ye))throw new Error("not an array: "+Ye)}(ge),ge.length){W(ge[0]);for(var Ae=ge[0],He=1;He<ge.length;He++)W(ge[He]),Ae+=ne+ge[He];return Ae}return""})},a.tie=function(){return this.tieWith("")},a.times=function(ne,ge){var Ae=this;return arguments.length<2&&(ge=ne),ee(ne)
`),ua=at(`\r
`),ui=Zt(ua,Ri,Eo).desc("newline"),_i=Zt(ui,Cr);i.all=En,i.alt=Zt,i.any=Qn,i.cr=Eo,i.createLanguage=function(ne){var ge={};for(var Ae in ne)({}).hasOwnProperty.call(ne,Ae)&&function(He){ge[He]=Gt(function(){return ne[He](ge)})}(Ae);return ge},i.crlf=ua,i.custom=function(ne){return i(ne(Z,U))},i.digit=yr,i.digits=Rn,i.empty=cn,i.end=_i,i.eof=Cr,i.fail=Tt,i.formatError=Je,i.index=Xt,i.isParser=j,i.lazy=Gt,i.letter=ji,i.letters=xo,i.lf=Ri,i.lookahead=qt,i.makeFailure=U,i.makeSuccess=Z,i.newline=ui,i.noneOf=function(ne){return $t(function(ge){return ne.indexOf(ge)<0}).desc("none of '"+ne+"'")},i.notFollowedBy=zt,i.of=Et,i.oneOf=function(ne){for(var ge=ne.split(""),Ae=0;Ae<ge.length;Ae++)ge[Ae]="'"+ge[Ae]+"'";return $t(function(He){return ne.indexOf(He)>=0}).desc(ge)},i.optWhitespace=Uo,i.Parser=i,i.range=function(ne,ge){return $t(function(Ae){return ne<=Ae&&Ae<=ge}).desc(ne+"-"+ge)},i.regex=gt,i.regexp=gt,i.sepBy=Re,i.sepBy1=tt,i.seq=Qe,i.seqMap=It,i.seqObj=function(){for(var ne,ge={},Ae=0,He=(ne=arguments,Array.prototype.slice.call(ne)),Ye=He.length,et=0;et<Ye;et+=1){var nt=He[et];if(!j(nt)){if(B(nt)&&nt.length===2&&typeof nt[0]=="string"&&j(nt[1])){var kt=nt[0];if(Object.prototype.hasOwnProperty.call(ge,kt))throw new Error("seqObj: duplicate key "+kt);ge[kt]=!0,Ae++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(Ae===0)throw new Error("seqObj expects at least one named parser, found zero");return i(function(en,jn){for(var wn,Lr={},_n=0;_n<Ye;_n+=1){var rr,Rr;if(B(He[_n])?(rr=He[_n][0],Rr=He[_n][1]):(rr=null,Rr=He[_n]),!(wn=z(Rr._(en,jn),wn)).status)return wn;rr&&(Lr[rr]=wn.value),jn=wn.index}return z(Z(jn,Lr),wn)})},i.string=at,i.succeed=Et,i.takeWhile=function(ne){return le(ne),i(function(ge,Ae){for(var He=Ae;He<ge.length&&ne(ue(ge,He));)He++;return Z(He,ge.slice(Ae,He))})},i.test=$t,i.whitespace=Li,i["fantasy-land/empty"]=cn,i["fantasy-land/of"]=Et,i.Binary={bitSeq:w,bitSeqObj:function(ne){v();var ge={},Ae=0,He=f(function(et){if(B(et)){var nt=et;if(nt.length!==2)throw new Error("["+nt.join(", ")+"] should be length 2, got length "+nt.length);if(W(nt[0]),ee(nt[1]),Object.prototype.hasOwnProperty.call(ge,nt[0]))throw new Error("duplicate key in bitSeqObj: "+nt[0]);return ge[nt[0]]=!0,Ae++,nt}return ee(et),[null,et]},ne);if(Ae<1)throw new Error("bitSeqObj expects at least one named pair, got ["+ne.join(", ")+"]");var Ye=f(function(et){return et[0]},He);return w(f(function(et){return et[1]},He)).map(function(et){return d(function(nt,kt){return kt[0]!==null&&(nt[kt[0]]=kt[1]),nt},{},f(function(nt,kt){return[nt,et[kt]]},Ye))})},byte:function(ne){if(v(),ee(ne),ne>255)throw new Error("Value specified to byte constructor ("+ne+"=0x"+ne.toString(16)+") is larger in value than a single byte.");var ge=(ne>15?"0x":"0x0")+ne.toString(16);return i(function(Ae,He){var Ye=ue(Ae,He);return Ye===ne?Z(He+1,Ye):U(He,ge)})},buffer:function(ne){return D("buffer",ne).map(function(ge){return Buffer.from(ge)})},encodedString:function(ne,ge){return D("string",ge).map(function(Ae){return Ae.toString(ne)})},uintBE:I,uint8BE:I(1),uint16BE:I(2),uint32BE:I(4),uintLE:k,uint8LE:k(1),uint16LE:k(2),uint32LE:k(4),intBE:A,int8BE:A(1),int16BE:A(2),int32BE:A(4),intLE:R,int8LE:R(1),int16LE:R(2),int32LE:R(4),floatBE:D("floatBE",4).map(function(ne){return ne.readFloatBE(0)}),floatLE:D("floatLE",4).map(function(ne){return ne.readFloatLE(0)}),doubleBE:D("doubleBE",8).map(function(ne){return ne.readDoubleBE(0)}),doubleLE:D("doubleLE",8).map(function(ne){return ne.readDoubleLE(0)})},n.exports=i}])})})(me);var B1=()=>/(?:[#*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
${i}`,posNum:n}}function _F(e,t,n){var o;const r=t.workspace.getLeavesOfType("markdown");for(const i of r){const a=i.view;if(((o=a==null?void 0:a.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(i);try{return i.view.setEphemeralState({line:n}),!0}catch(u){return console.error(u),!1}}}return!1}const Y1=async e=>{var i;const t=yt.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const a of n){const u=a.view;if(((i=u==null?void 0:u.file)==null?void 0:i.path)===e){t.workspace.revealLeaf(a);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)},U1=async(e,t)=>{const{app:n}=yt.getState(),r=parseInt(e.slice(14));if(_F(t,n,r))return;const o=n.metadataCache.getFirstLinkpathDest("",t);if(!C.Platform.isMobile)await n.workspace.getLeaf(!0).openFile(o,{eState:{line:r}});else{let i=n.workspace.activeLeaf;i===null&&(i=n.workspace.getLeaf(!0)),await i.openFile(o,{eState:{line:r}})}},z1=async(e,t)=>{var f,m,g;const n=yt.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(E("File not found for the given thino path"));return}let o="";try{o=await n.vault.read(r)}catch(v){console.error(v),o=await n.vault.cachedRead(r)}const a=o.split(/\r?\n/).findIndex(v=>v.contains(e)),u=n.workspace.getLeavesOfType("markdown");for(const v of u){const w=v.view;if(((f=w==null?void 0:w.file)==null?void 0:f.path)===r.path){n.workspace.revealLeaf(v);try{(m=v.view.editor)==null||m.setCursor({line:a,ch:1});return}catch(D){console.error(D)}}}const d=n.workspace.getLeaf(!0);await d.openFile(r,{eState:{line:a}});try{(g=d.view.editor)==null||g.setCursor({line:a,ch:1})}catch(v){console.error(v)}},V1=async(e,t)=>{var u;const n=yt.getState().app,r=(d,f)=>{var g;const m=(g=Array.from(d.nodes.values()))==null?void 0:g.find(v=>v.id===f);return m?(d.selectOnly(m),d.zoomToSelection(),!0):!1},o=n.workspace.getLeavesOfType("canvas");for(const d of o){const f=d.view;if(((u=f==null?void 0:f.file)==null?void 0:u.path)===t&&(n.workspace.revealLeaf(d),r(f.canvas,e)))return}const i=n.metadataCache.getFirstLinkpathDest("",t);if(!i){new C.Notice(E("File not found for the given thino path"));return}const a=n.workspace.getLeaf(!0);await a.openFile(i),setTimeout(()=>{var d;r((d=a.view)==null?void 0:d.canvas,e)},10)};class BF{constructor(){De(this,"initialized",!1)}getState(){return _e.getState().memoState}async fetchAllMemos(){const t=yt.getState().settings;ut.checkDailyInMulti(t);const n=await ki.getMyMemos(t.EnabledLocationList.map(i=>i.value)),r=[...n.memos],o=[...n.commentMemos];return _e.dispatch({type:"SET_MEMOS",payload:{memos:r}}),_e.dispatch({type:"SET_COMMENT_MEMOS",payload:{commentMemos:o}}),this.initialized||(this.initialized=!0,dt.setLoaded(!0)),r}async updateTypeMemos(t){const n=await ki.updateSpecificTypeMemo(t),r=this.getState().memos.filter(o=>o.sourceType!==t);_e.dispatch({type:"SET_MEMOS",payload:{memos:[...r,...n.memos]}})}async removeTypeMemos(t){const n=this.getState().memos.filter(r=>r.sourceType!==t);_e.dispatch({type:"SET_MEMOS",payload:{memos:[...n]}})}async fetchDeletedMemos(){const t=await ki.getMyDeletedMemos();return t.sort((n,r)=>ut.getTimeStampByDate(r.deletedAt)-ut.getTimeStampByDate(n.deletedAt)),t}pushMemo(t){_e.dispatch({type:"INSERT_MEMO",payload:{memo:{...t}}})}pushCommentMemo(t){_e.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 updateMemoById(t,n,r){const o=this.getMemoByWebId(t);if(!o)return;let i=null;const a=r?{}:{content:n.content,rowStatus:n.rowStatus,pinned:n.pinned,deleted:!!n.deletedAt,thinoType:n.thinoType??""};switch(o.sourceType){case"DAILY":i=await al(o,{id:o.id,webId:n.id,...a});break;case"CANVAS":i=await il(o,{id:o.id,webId:n.id,...a});break;case"MULTI":i=await fs(o,{id:o.id
Checkthedocumentationorcreateissueifyouthinkit's bug. https://github.com/webscopeio/react-textarea-autocomplete/issues`))},k5=[".","^","$","*","+","-","?","(",")","[","]","{","}","\\","|"],Oy=function(t){return I5(t).map(function(n){return k5.includes(n)?"\\".concat(n):n}).join("")},N5=function(e){d0(t,e);function t(){return ug(this,t),c0(this,mh(t).apply(this,arguments))}return u0(t,[{key:"componentDidMount",value:function(){var r=this.props.boundariesElement;if(typeof r=="string"){var o=document.querySelector(r);if(!o)throw new Error("RTA: Invalid prop boundariesElement: it has to be string or HTMLElement.");this.containerElem=o}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,o,i=this.props.top||0,a=this.props.left||0,u=[],d=[],f=0,m=0,g=this.containerElem.getBoundingClientRect(),v=this.ref.getBoundingClientRect(),w=this.props.textareaRef.getBoundingClientRect(),D=window.getComputedStyle(this.ref),T=parseInt(D.getPropertyValue("margin-top"),10),I=parseInt(D.getPropertyValue("margin-bottom"),10),k=parseInt(D.getPropertyValue("margin-left"),10),A=parseInt(D.getPropertyValue("margin-right"),10),R=T+I+w.top+i+v.height,j=k+A+w.left+a+v.width;j>g.right&&w.left+a>v.width?(m=a-v.width,u.push(Ku.X.LEFT),d.push(Ku.X.RIGHT)):(m=a,u.push(Ku.X.RIGHT),d.push(Ku.X.LEFT)),R>g.bottom&&w.top+i>v.height?(f=i-v.height,u.push(Ku.Y.TOP),d.push(Ku.Y.BOTTOM)):(f=i,u.push(Ku.Y.BOTTOM),d.push(Ku.Y.TOP)),this.props.renderToBody&&(f+=w.top,m+=w.left),this.ref.style.top="".concat(f,"px"),this.ref.style.left="".concat(m,"px"),(r=this.ref.classList).remove.apply(r,d),(o=this.ref.classList).add.apply(o,u)}},{key:"render",value:function(){var r=this,o=this.props,i=o.style,a=o.className,u=o.innerRef,d=o.children,f=o.renderToBody,m=document.body,g=se.createElement("div",{ref:function(w){r.ref=w,u(w)},className:"rta__autocomplete ".concat(a||""),style:i},d);return f&&m!==null?Z1.createPortal(g,m):g}}]),t}(se.Component),ZE=function(e){d0(t,e);function t(n){var r;ug(this,t),r=c0(this,mh(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=yd.add(oa.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(yd.remove(r.escListener),r.escListener=null)},r.getSelectionPosition=function(){return r.textareaRef?{selectionStart:r.textareaRef.selectionStart,selectionEnd:r.textareaRef.selectionEnd}:null},r.getSelectedText=function(){if(!r.textareaRef)return null;var d=r.textareaRef,f=d.selectionStart,m=d.selectionEnd;return f===m?null:r.state.value.substr(f,m-f)},r.setCaretPosition=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;r.textareaRef&&(r.textareaRef.focus(),r.textareaRef.setSelectionRange(d,d))},r.getCaretPosition=function(){if(!r.textareaRef)return 0;var d=r.textareaRef.selectionEnd;return d},r._handleCaretChange=function(d){var f=function(){var v=r.getCaretPosition()-1;r.lastTrigger=r.lastTrigger?v:0};if(d.type==="keydown"){var m=d.keyCode||d.which;switch(m){case oa.UP:case oa.DOWN:r._isAutocompleteOpen()||f();break;case oa.LEFT:case oa.RIGHT:f();break}return}f()},r._onSelect=function(d){var f=r.state,m=f.selectionEnd,g=f.currentTrigger,v=f.value,w=r.props.onItemSelected;if(g){var D=r._getTextToReplace(g);if(!D){r._closeAutocomplete();return}var T=D(d);if(!T){r._closeAutocomplete();return}w&&w({currentTrigger:g,item:d});var I=function($,te,Q){switch($){case"start":return Q;case"next":case"end":return Q+te.length;default:if(!Number.isInteger($))throw new Error('RTA:caretPositionshouldbe"start","next","end"ornumber.');return$}},k=v.slice(0,m),A=Oy(g),R=k.length-k.lastIndexOf(g),j=k.search(newRegExp("(?!".concat(A,")$
`));if(v===null)return null;if(typeof v=="string")return{text:v,caretPosition:dT};if(!v.text&&typeof v.text!="string")throw new Error('Output "text" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
`));if(!v.caretPosition)throw new Error('Output "caretPosition" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger "'.concat(d,`"
`));return v}if(typeof g!="string")throw new Error(`Outputitemshouldbestring
`);return{text:"".concat(d).concat(g).concat(d),caretPosition:dT}}},r._getCurrentTriggerSettings=function(){var d=r.state.currentTrigger;return d?r.props.trigger[d]:null},r._getValuesFromProvider=function(){var d=r.state,f=d.currentTrigger,m=d.actualToken,g=r._getCurrentTriggerSettings();if(!(!f||!g)){var v=g.dataProvider,w=g.component;if(typeof v!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var D=v(m);D instanceof Promise||(D=Promise.resolve(D)),D.then(function(T){if(!Array.isArray(T))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(!T.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:T,component:w})}}).catch(function(T){return fT(T.message)})}},r._getSuggestions=function(){var d=r.state,f=d.currentTrigger,m=d.data;return!f||!m||m&&!m.length?null:m},r._createRegExp=function(){var d=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(d).sort(function(f,m){return f<m?1:f>m?-1:0}).map(function(f){return Oy(f)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(d).sort(function(f,m){return f<m?1:f>m?-1:0}).map(function(f){return Oy(f)}).join("|"),")$"))},r._closeAutocomplete=function(){var d=r.state.currentTrigger;r.escListenerDestroy(),r.setState({data:null,dataLoading:!1,currentTrigger:null},function(){d&&r._onItemHighlightedHandler(null)})},r._cleanUpProps=function(){var d=w5({},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 m in d)f.includes(m)&&delete d[m];return d},r._changeHandler=function(d){var f=r.props,m=f.trigger,g=f.onChange,v=f.minChar,w=f.onCaretPositionChange,D=f.movePopupAsYouType,T=r.state,I=T.top,k=T.left,A=d;A||(A=new y5("change",{bubbles:!0}),r.textareaRef.dispatchEvent(A));var R=A.target||r.textareaRef,j=R.selectionEnd,B=R.value;if(r.lastValueBubbledEvent=B,g&&A&&(A.persist&&A.persist(),g(new Proxy(A,{get:function(K,re,pe){return re==="target"?R:Reflect.get(K,re,pe)}}))),w){var L=r.getCaretPosition();w(L)}r.setState({value:B});var Z=function(){var K=p5(R,j),re=K.top,pe=K.left;r.setState({top:re-r.textareaRef.scrollTop||0,left:pe})},U=function(K){r.lastTrigger=j-K,r._closeAutocomplete(),Z()};if(j<=r.lastTrigger){var z=B.slice(0,j),$=r.tokenRegExp.exec(z);U($?$[0].length:0)}var te=B.slice(r.lastTrigger,j),Q=r.tokenRegExp.exec(te),ue=Q&&Q[0],ee=Q&&Q[1]||null,le=ee?ee.length-1:0,W=r.tokenRegExpEnding.exec(te);if(W?U(W[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!ue||ue.length<=v+le)&&(r.state.currentTrigger&&!m[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(ee&&m[ee].afterWhitespace&&!/\s/.test(B[j-ue.length-1])&&B[j-ue.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&m[r.state.currentTrigger].allowWhitespace){if(Q=new RegExp("".concat(Oy(r.state.currentTrigger),".*$")).exec(B.slice(0,j)),ue=Q&&Q[0],!ue){r._closeAutocomplete();return}ee=Object.keys(m).find(function(he){return he.slice(0,le+1)===ue.slice(0,le+1)})||null}var de=ue.slice(1);if(ee){(D||I===null&&k===null||r.state.currentTrigger!==ee)&&Z(),r.escListenerInit();var oe=r._getTextToReplace(ee);r.setState({selectionEnd:j,currentTrigger:ee,textToReplace:oe,actualToken:de},function(){try{r._getValuesFromProvider()}catch(he){fT(he.message)}})}},r._selectHandler=function(d){var f=r.props,m=f.onCaretPositionChange,g=f.onSelect;if(m){var v=r.getCaretPosition();m(v)}g&&(d.persist(),g(d))},r._shouldStayOpen=function(d){var f=d.relatedTarget;return f===null&&(f=document.activeElement),!!(r.dropdownRef&&f instanceof Node&&r.dr
`),Te!==null&&M.push(D(""+Te)),null;case"input":M.push(Q("input")),ct=Yt=ot=Te=null;for(Ue in J)if(n.call(J,Ue)&&(Nt=J[Ue],Nt!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":ct=Nt;break;case"defaultValue":ot=Nt;break;case"checked":Yt=Nt;break;case"value":Te=Nt;break;default:L(M,ae,Ue,Nt)}return Yt!==null?L(M,ae,"checked",Yt):ct!==null&&L(M,ae,"checked",ct),Te!==null?L(M,ae,"value",Te):ot!==null&&L(M,ae,"value",ot),M.push("/>"),null;case"menuitem":M.push(Q("menuitem"));for(var Co in J)if(n.call(J,Co)&&(Te=J[Co],Te!=null))switch(Co){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:L(M,ae,Co,Te)}return M.push(">"),null;case"title":M.push(Q("title")),Te=null;for(Tn in J)if(n.call(J,Tn)&&(Ue=J[Tn],Ue!=null))switch(Tn){case"children":Te=Ue;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:L(M,ae,Tn,Ue)}return M.push(">"),Te;case"listing":case"pre":M.push(Q(H)),Ue=Te=null;for(ct in J)if(n.call(J,ct)&&(ot=J[ct],ot!=null))switch(ct){case"children":Te=ot;break;case"dangerouslySetInnerHTML":Ue=ot;break;default:L(M,ae,ct,ot)}if(M.push(">"),Ue!=null){if(Te!=null)throw Error(t(60));if(typeof Ue!="object"||!("__html"in Ue))throw Error(t(61));J=Ue.__html,J!=null&&(typeof J=="string"&&0<J.length&&J[0]===`
`),Te;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":M.push(Q(H));for(var mo in J)if(n.call(J,mo)&&(Te=J[mo],Te!=null))switch(mo){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,H));default:L(M,ae,mo,Te)}return M.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return z(M,J,H,ae);case"html":return ke.insertionMode===0&&M.push("<!DOCTYPE html>"),z(M,J,H,ae);default:if(H.indexOf("-")===-1&&typeof J.is!="string")return z(M,J,H,ae);M.push(Q(H)),Ue=Te=null;for(Nt in J)if(n.call(J,Nt)&&(ot=J[Nt],ot!=null))switch(Nt){case"children":Te=ot;break;case"dangerouslySetInnerHTML":Ue=ot;break;case"style":B(M,ae,ot);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:a(Nt)&&typeof ot!="function"&&typeof ot!="symbol"&&M.push(" ",Nt,'="',D(ot),'"')}return M.push(">"),Z(M,Ue,Te),Te}}function ee(M,H,J){if(M.push('<!--$?--><template id="'),J===null)throw Error(t(395));return M.push(J),M.push('"></template>')}function le(M,H,J,ae){switch(J.insertionMode){case 0:case 1:return M.push('<div hidden id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 2:return M.push('<svg aria-hidden="true" style="display:none" id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 3:return M.push('<math aria-hidden="true" style="display:none" id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 4:return M.push('<table hidden id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 5:return M.push('<table hidden><tbody id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 6:return M.push('<table hidden><tr id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');case 7:return M.push('<table hidden><colgroup id="'),M.push(H.segmentPrefix),H=ae.toString(16),M.push(H),M.push('">');default:throw Error(t(397))}}function W(M,H){switch(H.insertionMode){case 0:case 1:return M.push("</div>");case 2:return M.push("</svg>");case 3:return M.push("</math>");case 4:return M.push("</table>");case 5:return M.push("</tbody></table>");case 6:return M.push("</tr></table>");case 7:return M.push("</colgroup></table>");default:throw Error(t(397))}}var de=/[<\u2028\u2029]/g;function oe(M){return JSON.stringify(M).replace(de,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 longer in sync. This is a bug in React")}})}function he(M,H){return H=H===void 0?"":H,{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:H+"P:",segmentPrefix:H+"S:",boundaryPrefix:H+"B:",idPrefix:H,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:M}}function K(M,H,J,ae){return J.generateStaticMarkup?(M.push(D(H)),!1):(H===""?M=ae:(ae&&M.push("<!-- -->"),M.push(D(H)),M=!0),M)}var re=Object.assign,pe=Symbol.for("react.element"),Ie=Symbol.for("react.portal"),Oe=Symbol.for("react.fragment"),Ne=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Je=Symbol.for("react.provider"),ze=Symbol.for("react.context"),Qe=Symbol.for("react.forward_ref"),It=Symbol.for("react.suspense"),Zt=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),tt=Symbol.for("react.lazy"),at=Symbol.for("react.scope"),gt=Symbol.for("react.debug_trace_mode"),Et=Symbol.for("react.legacy_hidden"),Tt=Symbol.for("react.default_value"),qt=Symbol.iterator;function zt(M){if(M==null)return null;if(typeof M=="function")return M.displayName||M.name||null;if(typeof M=="string")return M;switch(M){case Oe:return"Fragment";case Ie:return"Portal";case Be:return"Profiler";case Ne:return"StrictMode";case It:return"Suspense";ca
`),Gt=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,cn=new Map;function Xt(N){var _=cn.get(N);if(_===void 0){if(!Gt.test(N))throw Error(t(65,N));_=f("<"+N),cn.set(N,_)}return _}var Qn=f("<!DOCTYPE html>");function En(N,_,q,ie,Fe){switch(_){case"select":N.push(Xt("select"));var xe=null,We=null;for(jt in q)if(g.call(q,jt)){var rt=q[jt];if(rt!=null)switch(jt){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;case"defaultValue":case"value":break;default:tt(N,ie,jt,rt)}}return N.push(at),Et(N,We,xe),xe;case"option":We=Fe.selectedValue,N.push(Xt("option"));var St=rt=null,Vt=null,jt=null;for(xe in q)if(g.call(q,xe)){var Mn=q[xe];if(Mn!=null)switch(xe){case"children":rt=Mn;break;case"selected":Vt=Mn;break;case"dangerouslySetInnerHTML":jt=Mn;break;case"value":St=Mn;default:tt(N,ie,xe,Mn)}}if(We!=null)if(q=St!==null?""+St:Tt(rt),$(We)){for(ie=0;ie<We.length;ie++)if(""+We[ie]===q){N.push(qt);break}}else""+We===q&&N.push(qt);else Vt&&N.push(qt);return N.push(at),Et(N,jt,rt),rt;case"textarea":N.push(Xt("textarea")),jt=We=xe=null;for(rt in q)if(g.call(q,rt)&&(St=q[rt],St!=null))switch(rt){case"children":jt=St;break;case"value":xe=St;break;case"defaultValue":We=St;break;case"dangerouslySetInnerHTML":throw Error(t(91));default:tt(N,ie,rt,St)}if(xe===null&&We!==null&&(xe=We),N.push(at),jt!=null){if(xe!=null)throw Error(t(92));if($(jt)&&1<jt.length)throw Error(t(93));xe=""+jt}return typeof xe=="string"&&xe[0]===`
`&&N.push($t),xe!==null&&N.push(d(Z(""+xe))),null;case"input":N.push(Xt("input")),St=jt=rt=xe=null;for(We in q)if(g.call(q,We)&&(Vt=q[We],Vt!=null))switch(We){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,"input"));case"defaultChecked":St=Vt;break;case"defaultValue":rt=Vt;break;case"checked":jt=Vt;break;case"value":xe=Vt;break;default:tt(N,ie,We,Vt)}return jt!==null?tt(N,ie,"checked",jt):St!==null&&tt(N,ie,"checked",St),xe!==null?tt(N,ie,"value",xe):rt!==null&&tt(N,ie,"value",rt),N.push(gt),null;case"menuitem":N.push(Xt("menuitem"));for(var Yr in q)if(g.call(q,Yr)&&(xe=q[Yr],xe!=null))switch(Yr){case"children":case"dangerouslySetInnerHTML":throw Error(t(400));default:tt(N,ie,Yr,xe)}return N.push(at),null;case"title":N.push(Xt("title")),xe=null;for(Mn in q)if(g.call(q,Mn)&&(We=q[Mn],We!=null))switch(Mn){case"children":xe=We;break;case"dangerouslySetInnerHTML":throw Error(t(434));default:tt(N,ie,Mn,We)}return N.push(at),xe;case"listing":case"pre":N.push(Xt(_)),We=xe=null;for(St in q)if(g.call(q,St)&&(rt=q[St],rt!=null))switch(St){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;default:tt(N,ie,St,rt)}if(N.push(at),We!=null){if(xe!=null)throw Error(t(60));if(typeof We!="object"||!("__html"in We))throw Error(t(61));q=We.__html,q!=null&&(typeof q=="string"&&0<q.length&&q[0]===`
`&&N.push($t),xe;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":N.push(Xt(_));for(var ko in q)if(g.call(q,ko)&&(xe=q[ko],xe!=null))switch(ko){case"children":case"dangerouslySetInnerHTML":throw Error(t(399,_));default:tt(N,ie,ko,xe)}return N.push(gt),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 zt(N,q,_,ie);case"html":return Fe.insertionMode===0&&N.push(Qn),zt(N,q,_,ie);default:if(_.indexOf("-")===-1&&typeof q.is!="string")return zt(N,q,_,ie);N.push(Xt(_)),We=xe=null;for(Vt in q)if(g.call(q,Vt)&&(rt=q[Vt],rt!=null))switch(Vt){case"children":xe=rt;break;case"dangerouslySetInnerHTML":We=rt;break;case"style":ze(N,ie,rt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:T(Vt)&&typeof rt!="function"&&typeof rt!="symbol"&&N.push(Qe,d(Vt),It,d(Z(rt)),Zt)}return N.push(at),Et(N,We,xe),xe}}var Cr=f("</"),yr=f(">"),Rn=f('<template id="'),ji=f('"></template>'),xo=f("<!--$-->"),Uo=f('<!--$?--><template id="'),Li=f('"></template>'),Eo=f("<!--$!-->"),Ri=f("<!--/$-->"),ua=f("<template"),ui=f('"'),_i=f(' data-dgst="');f(' data-msg="'),f(' data-stck="');var ne=f("></template>");function ge(N,_,q){if(o(N,Uo),q===null)throw Error(t(395));return o(N,q),i(N,Li)}var Ae=f('<div hidden id="'),He=f('">'),Ye=f("</div>"),et=f('<svg aria-hidden="true" style="display:none" id="'),nt=f('">'),kt=f("</svg>"),en=f('<math aria-hidden="true" style="display:none" id="'),jn=f('">'),wn=f("</math>"),Lr=f('<table hidden id="'),_n=f('">'),rr=f("</table>"),Rr=f('<table hidden><tbody id="'),ca=f('">'),bn=f("</tbody></table>"),co=f('<table hidden><tr id="'),fo=f('">'),Mr=f("</tr></table>"),zo=f('<table hidden><colgroup id="'),ho=f('">'),bl=f("</colgroup></table>");function Bi(N,_,q,ie){switch(q.insertionMode){case 0:case 1:return o(N,Ae),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,He);case 2:return o(N,et),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,nt);case 3:return o(N,en),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,jn);case 4:return o(N,Lr),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,_n);case 5:return o(N,Rr),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,ca);case 6:return o(N,co),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,fo);case 7:return o(N,zo),o(N,_.segmentPrefix),o(N,d(ie.toString(16))),i(N,ho);default:throw Error(t(397))}}function Hi(N,_){switch(_.insertionMode){case 0:case 1:return i(N,Ye);case 2:return i(N,kt);case 3:return i(N,wn);case 4:return i(N,rr);case 5:return i(N,bn);case 6:return i(N,Mr);case 7:return i(N,bl);default:throw Error(t(397))}}var cu=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("'),Sl=f('$RS("'),Ba=f('","'),da=f('")<\/script>'),Ha=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("'),Dl=f('$RC("'),Ya=f('","'),du=f('")<\/script>'),Sn=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("'),_r=f('$RX("'),vs=f('"'),ws=f(")<\/script>"),Yi=f(","),Tl=/[<\u2028\u2029]/g;function ci(N){return JSON.stringify(N).replace(Tl,function(_){switch(_){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
`,i.current,t.path,I);const A=(R=i.current)==null?void 0:R.querySelectorAll(".internal-link");A==null||A.forEach(j=>{const B=j,L=B.getAttribute("data-href");if(!L)return;r.app.metadataCache.getFirstLinkpathDest(L,t.path)||j.classList.add("is-unresolved"),B.addEventListener("mouseover",U=>{U.stopPropagation(),r.app.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:I.containerEl,targetEl:B,linktext:L,sourcePath:B.href})})})}k()},[t.content,a]);const v=async()=>{if(f)try{await je.deleteMemoById(o.id),n(o.id)}catch(I){new C.Notice(I.message)}else m()},w=async()=>{switch(o.sourceType){case"DAILY":await U1(o.id,o.path);break;case"CANVAS":await V1(o.id,o.path);break;case"MULTI":await Y1(o.path);break;case"FILE":await z1(o.id,o.path);break}},D=async()=>{try{const I=await je.restoreMemoById(o.id),k=r.app,A=k==null?void 0:k.loadLocalStorage("tokenForSync");I&&I.webId&&A&&r.settings.startSync&&await Lx(I.webId),I&&je.editMemo(I),n(o.id),new C.Notice(E("RESTORE SUCCEED"))}catch(I){new C.Notice(I.message)}},T=()=>{f&&m(!1)};return y.jsxs("div",{ref:a,className:`memo-wrapper${"memos-"+o.id}`,onMouseLeave:T,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[E("DELETE AT")," ",o.deletedAtStr]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:I=>{I&&C.setIcon(I,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:D,children:E("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:g.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:w,children:E("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btndelete-btn${f?"final-confirm":""}`,onClick:v,children:E(f?"CONFIRM!":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:i,className:"memo-content-text",onContextMenu:I=>{I.preventDefault(),I.stopPropagation()}})]})},yte=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:o,type:i,text:a,filter:u}=t,d=tn.getQueryById(u);return!!(r||o&&o.from<o.to||i||a||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=jh(m,v))}if(r){const v=new Set;for(const w of Array.from(m.content.match(gr)||[])){const T=w.replace(gr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(jr)||[])){const T=w.replace(jr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(so)||[])){const T=w.replace(so,"$2").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}v.has(r)||(g=!1)}return o&&o.from<o.to&&(ut.getTimeStampByDate(m.createdAt)<o.from||ut.getTimeStampByDate(m.createdAt)>o.to)&&(g=!1),i&&(i==="NOT_TAGGED"&&(m.content.match(gr)!==null||m.content.match(so)!==null||m.content.match(jr)!==null)||i==="LINKED"&&m.content.match(Od)===null||i==="IMAGED"&&m.content.match(jd)===null||i==="CONNECTED"&&m.content.match(hc)===null)&&(g=!1),a&&!m.content.toLowerCase().includes(a.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},vte=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=F.useContext(Ot),r=$h(),[o,i]=F.useState([]),a=se.useRef(null);F.useEffect(()=>{const f=yte({memos:n.filter(m=>m.deletedAt!==""&&m.deletedAt),query:e,HideDoneTasks:!1});i(f),r.setFinish()},[n,a.current,e]);const u=F.useCallback(f=>{i(m=>m.filter(g=>g.id!==f))},[]),d=F.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:a,children:[y.jsxs("div",{clas
`,a.current,o.path,r);const R=(B=a.current)==null?void 0:B.querySelectorAll(".internal-link");R==null||R.forEach(L=>{const Z=L,U=Z.getAttribute("data-href");if(!U)return;t.metadataCache.getFirstLinkpathDest(U,o.path)||L.classList.add("is-unresolved"),Z.addEventListener("mouseover",$=>{$.stopPropagation(),t.workspace.trigger("hover-link",{event:$,source:"thino",hoverParent:r.containerEl,targetEl:Z,linktext:U,sourcePath:Z.href})})})}A()},[o.content,u]);const D=async()=>{switch(m.sourceType){case"DAILY":await U1(m.id,m.path);break;case"CANVAS":await V1(m.id,m.path);break;case"MULTI":await Y1(m.path);break;case"FILE":await z1(m.id,m.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await je.deleteMemoById(m.id);else{const A=await je.hideMemoById(m.id);A&&je.editMemo(A)}}catch(A){new C.Notice(A.message)}else v()},I=async()=>{try{const A=await je.unarchiveMemo(m);A&&je.editMemo(A),i(m.id),new C.Notice(E("RESTORE SUCCEED"))}catch(A){new C.Notice(A.message)}},k=()=>{g&&v(!1)};return y.jsxs("div",{ref:u,className:`memo-wrapper${"memos-"+m.id}`,onMouseLeave:k,children:[y.jsxs("div",{className:"memo-top-wrapper",children:[y.jsxs("span",{className:"time-text",children:[E("ARCHIVED AT")," ",m.updatedAt]}),y.jsxs("div",{className:"btns-container",children:[y.jsx("span",{ref:A=>{A&&C.setIcon(A,"more-horizontal")},className:"btn more-action-btn"}),y.jsx("div",{className:"more-action-btns-wrapper",children:y.jsxs("div",{className:"more-action-btns-container",children:[y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:w.restore,className:"more-action-item-icon"}),y.jsx("span",{className:"btn restore-btn",onClick:I,children:E("RESTORE")})]}),y.jsxs("div",{className:"more-action-menu-item",children:[y.jsx("span",{ref:w.source,className:"more-action-item-icon"}),y.jsx("span",{className:"btn",onClick:D,children:E("SOURCE")})]}),y.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[y.jsx("span",{ref:w.delete,className:"more-action-item-icon"}),y.jsx("span",{className:`btndelete-btn${g?"final-confirm":""}`,onClick:T,children:E(g?"CONFIRM!":"DELETE")})]})]})})]})]}),y.jsx("div",{ref:a,className:"memo-content-text"})]})},Dte=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:o,type:i,text:a,filter:u}=t,d=tn.getQueryById(u);return!!(r||o&&o.from<o.to||i||a||d)||d||n?e.filter(m=>{let g=!0;if(m.thinoType!==void 0&&n&&m.thinoType==="TASK-DONE"&&(g=!1),m.content.contains("comment:")&&(g=!1),d){const v=JSON.parse(d.querystring);Array.isArray(v)&&(g=jh(m,v))}if(r){const v=new Set;for(const w of Array.from(m.content.match(gr)||[])){const T=w.replace(gr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(jr)||[])){const T=w.replace(jr,"$1").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}for(const w of Array.from(m.content.match(so)||[])){const T=w.replace(so,"$2").trim().split("/");let I="";for(const k of T)I+=k,v.add(I),I+="/"}v.has(r)||(g=!1)}return o&&o.from<o.to&&(ut.getTimeStampByDate(m.createdAt)<o.from||ut.getTimeStampByDate(m.createdAt)>o.to)&&(g=!1),i&&(i==="NOT_TAGGED"&&(m.content.match(gr)!==null||m.content.match(so)!==null||m.content.match(jr)!==null)||i==="LINKED"&&m.content.match(Od)===null||i==="IMAGED"&&m.content.match(jd)===null||i==="CONNECTED"&&m.content.match(hc)===null)&&(g=!1),a&&!m.content.toLowerCase().includes(a.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},Tte=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=F.useContext(Ot),r=$h(),[o,i]=F.useState([]),a=se.useRef(null);F.useEffect(()=>{const m=Dte({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});i(m),r.setFinish()},[n,a.current,e]);const u=F.useCallback(m=>{i(g=>g.filter(v=>v.id!==m))},[]),d=F.useCallback(m=>{i(g=>g.filter(v=>v.id!==m))},[]),f=F.useCallback(()=>{dt.setShowSiderbarInMobileView(!0)},[]);return y.jsxs("div",{className:"memo-trash-wrapper",ref:a,children:[y.jsxs("div",{className:"section-header-container",children:[y
${A}`}}}const T=await je.createThino({content:g,isList:d,type:f});T&&(je.pushMemo(T),st.clearQuery()),r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:T,link:`obsidian://thino?openId=${T.id}`}))})}else if(o.pathname==="/search"&&n.method==="GET"){const i=o.query,{keyword:a}=i,u=je.getThinoViaKeyword(a);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:u});r.end(d)}else r.statusCode=404,r.end()}}catch(o){console.error(o),r.statusCode=500,r.end({status:"error",message:o.message})}});return{listen(n,r){try{t.listen({port:parseInt(r),host:n})}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")} ${r}`)},close(){t.close(),new C.Notice(E("Thino - Terminated HTTP server"))}}}const{clipboard:tr}=C.Platform.isDesktop?require("electron"):"";class nre{constructor(){De(this,"eventListeners");this.eventListeners={}}on(t,n){this.eventListeners[t]=this.eventListeners[t]||[],this.eventListeners[t].push(n)}once(t,n){n.$emitOnce=!0,this.on(t,n)}removeListener(t,n){if(this.eventListeners[t]){const r=this.eventListeners[t].findIndex(o=>o===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 ih=new nre;let hm=null,KI=tr==null?void 0:tr.readText(),QI=tr==null?void 0:tr.readImage();tr&&(tr.on=(e,t)=>(ih.on(e,t),tr),tr.once=(e,t)=>(ih.once(e,t),tr),tr.off=(e,t)=>(t?ih.removeListener(e,t):ih.removeAllListeners(e),tr),tr.startWatching=()=>(hm||(hm=setInterval(()=>{rre(KI,KI=tr==null?void 0:tr.readText())&&ih.emit("text-changed"),ore(QI,QI=tr==null?void 0:tr.readImage())&&ih.emit("image-changed")},500)),tr),tr.stopWatching=()=>(hm&&clearInterval(hm),hm=null,tr));function rre(e,t){return t&&e!==t}function ore(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var ix;const xb=(ix=require("electron"))==null?void 0:ix.remote;var ax,sx;const XI=(sx=(ax=require("electron"))==null?void 0:ax.remote)==null?void 0:sx.screen;class ire{constructor(t,n){De(this,"isRegisted");De(this,"leaf");De(this,"clipboard");De(this,"isScreenTop",!1);De(this,"currentSplitWindow");De(this,"intervalNum");De(this,"allowsCopy",!1);De(this,"plugin");De(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=tr}async onload(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{xb.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&&(xb.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally),this.clipboard.off("text-changed"),this.clipboard.off("image-changed"),this.clipboard.stopWatching(),this.leaf&&this.leaf.detach())}getCurrentLeaf(){var n;return this.leaf?this.app.workspace.getLeavesOfType("thino_view").length>0&&!!this.app.workspace.getLeafById(this.leaf.id)?!0:((n=this.leaf)==null||n.detach(),this.currentSplitWindow.close(),this.currentSplitWindow=null,this.leaf=null,this.isScreenTop=!1,!1):!1}async registerAllShortcuts(){xb.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,o,i,a;const t=XI.getCursorScreenPo
\`\`\``),newC.Notice(E("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"insert-editor",name:E("Insert editor"),checkCallback:n=>{constr=this.app.workspace.getActiveViewOfType(C.MarkdownView);if(r&&r.getViewType()==="markdown")returnn||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:()=>{constn=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:()=>{Uee(this.app)}}),this.addCommand({id:"init-thino-sync",name:E("Sync local thinos to web"),callback:async()=>{varr;if(!((r=this.app)==null?void0:r.loadLocalStorage("tokenForSync"))){newC.Notice(E("Please input token first"));return}if(!this.settings.startSync){newC.Notice(E("Please enable sync first"));return}try{awaitje.initSync()}catch(o){console.error(o),newC.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:[]})}asynconLayoutReady(){awaitthis.stopEnableList(),awaitthis.initServer(),this.initGlobalManifest(),awaitthis.initMemos(),this.autoOpenMemos(),this.registerThinoWidget(),awaitthis.registerToolbarCheck(),awaitthis.initCaptureService(),yt.setPlugin(this);constn=this.app.workspace.editorSuggest.suggests.findIndex(r=>r.type==="customTag");n!==-1?(this.app.workspace.editorSuggest.suggests.splice(n,1),this.app.workspace.editorSuggest.suggests.unshift(newex(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(newex(this.app,this))}asyncinitMemos(){try{awaitthis.initDailyNotes()}catch(n){console.error(n)}yt.getState(),je.getState(),awaitje.fetchAllMemos()}asyncinitDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&awaityt.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!C.requireApiVersion("1.2.0")||!this.settings.EnabledLocationList.find(i=>i.value==="CANVAS"))return;constn=i=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{consta=i.canvas.getData(),u=a.nodes.find(d=>d.id===i.id);if(u&&(r(u),i.canvas.setData(a),je.getMemoById(i.id))){constf=awaitje.updateMemo(i.id,u.text,u.thinoType);je.editMemo(f)}i.canvas.requestSave(!0)},0)},800)},r=i=>{i.createdAt||(i.createdAt=C.moment().format("YYYY-MM-DD HH:mm:ss")),i.updatedAt=C.moment().format("YYYY-MM-DD HH:mm:ss"),i.deletedAt=i.deletedAt?i.deletedAt:"",i.pinned=i.pinned?i.pinned:!1,i.visibility=i.visibility?i.visibility:"PUBLIC",i.rowStatus=i.rowStatus?i.rowStatus:"NORMAL",i.thinoType=i.thinoType?i.thinoType:"JOURNAL",i.hasId=i.hasId?i.hasId:"",i.linkId=i.linkId?i.linkId:"",i.resourceList=[]},o=()=>{varv,w;consti=(v=this.app.workspace.getLeavesOfType("canvas").first())==null?void0:v.view;if(!i||!(i==null?void0:i.canvas))return!1;constu=((w=this.app.workspace.getLeavesOfType("canvas").first())==null?void0:w.view).canvas.nodes.values(),f=Array.from(u).filter(D=>D.text!==void0);if(!f||f.length===0)return!1;constm=f[0].child;if(!m)return!1;constg=Sm(m.constructor.prototype,{save:D=>function(...T){D.call(this,...T),this.node.isEditing&&n(this.node)}});returnthis.register(g),!0};this.app.workspace.onLayoutReady(()=>{if(!o()){consti=this.app.workspace.on("layout-change",()=>{o()&&this.app.workspace.offref(i)});this.registerEvent(i)}})}registerLinkOpen(){Sm(C.Workspace.prototype,{openLinkText:n=>asyncfunction(...r){consto=je.getState().memos;if(o.find(i=>i.id===r[0]||i.id===r[1])){consti=o.find(a=>a.id===r[0]||a.id===r[1]);if(i){Lh(i);return}}awaitn.call(this,...r)}})}registerHoverEvent(){t