"use strict";var n4=Object.defineProperty;var r4=(e,t,n)=>t in e?n4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var me=(e,t,n)=>(r4(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("obsidian"),b0=require("@codemirror/language"),ep=require("@codemirror/state"),Ci=require("@codemirror/view");var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function er(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cI={exports:{}},Nh={},dI={exports:{}},kt={},Hb;function a4(){if(Hb)return kt;Hb=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"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;function v(Z){return Z===null||typeof Z!="object"?null:(Z=g&&Z[g]||Z["@@iterator"],typeof Z=="function"?Z:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function E(Z,G,te){this.props=Z,this.context=G,this.refs=T,this.updater=te||D}E.prototype.isReactComponent={},E.prototype.setState=function(Z,G){if(typeof Z!="object"&&typeof Z!="function"&&Z!=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,Z,G,"setState")},E.prototype.forceUpdate=function(Z){this.updater.enqueueForceUpdate(this,Z,"forceUpdate")};function O(){}O.prototype=E.prototype;function k(Z,G,te){this.props=Z,this.context=G,this.refs=T,this.updater=te||D}var j=k.prototype=new O;j.constructor=k,S(j,E.prototype),j.isPureReactComponent=!0;var F=Array.isArray,B=Object.prototype.hasOwnProperty,R={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function H(Z,G,te){var ge,Ie={},De=null,ke=null;if(G!=null)for(ge in G.ref!==void 0&&(ke=G.ref),G.key!==void 0&&(De=""+G.key),G)B.call(G,ge)&&!z.hasOwnProperty(ge)&&(Ie[ge]=G[ge]);var Ye=arguments.length-2;if(Ye===1)Ie.children=te;else if(1{const{children:t,store:n,context:r}=e,[a,o]=A.useState(n.getState());return A.useEffect(()=>{const s=n.subscribe(c=>{o(c)});return()=>{s()}},[]),w.jsx(r.Provider,{value:a,children:t})};function i4(e){const t=Object.keys(e),n={};for(const r of t)typeof e[r]=="function"&&(n[r]=e[r]);return(r={},a)=>{let o=!1;const s={};for(const c of t){const d=r[c],p=n[c](d,a);s[c]=p,o=o||p!==d}return o?s:r}}function s4(e,t){const n=[];let r=e;return{dispatch:c=>{const d=t(r,c),p=r;r=d;for(const m of n)m(r,p)},getState:()=>r,subscribe:c=>{let d=!0;return n.push(c),()=>{if(!d)return;const p=n.indexOf(c);n.splice(p,1),d=!1}}}}function l4(e,t){switch(t.type){case"SET_MARK_MEMO_ID":return t.payload.markMemoId===e.markMemoId?e:{...e,markMemoId:t.payload.markMemoId};case"SET_EDIT_MEMO_ID":return t.payload.editMemoId===e.editMemoId?e:{...e,editMemoId:t.payload.editMemoId};case"SET_GLOBAL_EDITOR_SHOWN":return t.payload.globalEditorShown===e.globalEditorShown?e:{...e,globalEditorShown:t.payload.globalEditorShown};case"SET_COMMENT_MEMO_ID":return t.payload.commentMemoId===e.commentMemoId?e:{...e,commentMemoId:t.payload.commentMemoId};case"SET_MOBILE_VIEW":return t.payload.isMobileView===e.isMobileView?e:{...e,isMobileView:t.payload.isMobileView};case"SET_CHANGED_BY_MEMOS":return t.payload.changedByMemos===e.changedByMemos?e:{...e,changedByMemos:t.payload.changedByMemos};case"SET_REFRESH":return t.payload.refresh===e.refresh?e:{...e,refresh:t.payload.refresh};case"SET_INSTANCE":return{...e,instanceList:e.instanceList.set(t.payload.id,t.payload.instance)};case"SET_SHOW_SIDEBAR_IN_MOBILE_VIEW":return t.payload.showSiderbarInMobileView===e.showSiderbarInMobileView?e:{...e,showSiderbarInMobileView:t.payload.showSiderbarInMobileView};case"SET_MEMO_LIST_VIEW":return t.payload.memoListView===e.memoListView?e:{...e,memoListView:t.payload.memoListView};case"SET_MEMO_PLUGIN_MANIFEST":return{...e,manifest:t.payload.manifest};case"SET_LOADED":return{...e,loaded:t.payload.loaded};case"SET_LOCKED":return{...e,locked:t.payload.locked};case"SET_APP_SETTING":return{...e,...t.payload};default:return e}}const u4={markMemoId:"",editMemoId:"",commentMemoId:"",shouldSplitMemoWord:!0,shouldHideImageUrl:!0,shouldUseMarkdownParser:!0,useTinyUndoHistoryCache:!1,isMobileView:!1,showSiderbarInMobileView:!1,changedByMemos:!1,memoListView:null,manifest:null,refresh:!1,loaded:!1,globalEditorShown:!1,instanceList:new Map,locked:!1};function c4(e,t){switch(t.type){case"RELOAD":return fI;case"SET_LOCATION":return t.payload;case"SET_PATHNAME":return t.payload.pathname===e.pathname?e:{...e,pathname:t.payload.pathname};case"SET_HASH":return t.payload.hash===e.hash?e:{...e,hash:t.payload.hash};case"SET_QUERY":return{...e,query:{...t.payload}};case"SET_TAG_QUERY":return t.payload.tag===e.query.tag?e:{...e,query:{...e.query,tag:t.payload.tag}};case"SET_DURATION_QUERY":return t.payload.duration===e.query.duration?e:{...e,query:{...e.query,duration:{...e.query.duration,...t.payload.duration}}};case"SET_TYPE":return t.payload.type===e.query.type?e:{...e,query:{...e.query,type:t.payload.type}};case"SET_TEXT":return t.payload.text===e.query.text?e:{...e,query:{...e.query,text:t.payload.text}};case"SET_QUERY_FILTER":return t.payload===e.query.filter?e:{...e,query:{...e.query,filter:t.payload}};default:return e}}const fI={pathname:"/",hash:"",query:{tag:"",duration:null,type:"",text:"",filter:""}};var At={};Object.defineProperty(At,"__esModule",{value:!0});var In=C;const cw="YYYY-MM-DD",dw="gggg-[W]ww",hI="YYYY-MM",pI="YYYY-[Q]Q",mI="YYYY";function vp(e){var n,r;const t=window.app.plugins.getPlugin("periodic-notes");return t&&((r=(n=t.settings)==null?void 0:n[e])==null?void 0:r.enabled)}function wp(){var e,t,n,r;try{const{internalPlugins:a,plugins:o}=window.app;if(vp("daily")){const{format:p,folder:m,template:g}=((t=(e=o.getPlugin("periodic-notes"))==null?void 0:e.settings)==null?void 0:t.daily)||{};return{format:p||cw,folder:(m==null?void 0:m.trim())||"",template:(g==null?void 0:g.trim())||""}}const{folder:s,format:c,template:d}=((r=(n=a.getPluginById("daily-notes"))==null?void 0:n.instance)==null?void 0:r.options)||{};return{format:c||cw,folder:(s==null?void 0:s.trim())||"",template:(d==null?void 0:d.trim())||""}}catch{}}function bp(){var e,t,n,r,a,o,s;try{const c=window.app.plugins,d=(e=c.getPlugin("calendar"))==null?void 0:e.options,p=(n=(t=c.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:n.weekly;if(vp("weekly"))return{format:p.format||dw,folder:((r=p.folder)==null?void 0:r.trim())||"",template:((a=p.template)==null?void 0:a.trim())||""};const m=d||{};return{format:m.weeklyNoteFormat||dw,folder:((o=m.weeklyNoteFolder)==null?void 0:o.trim())||"",template:((s=m.weeklyNoteTemplate)==null?void 0:s.trim())||""}}catch{}}function Dp(){var t,n,r,a;const e=window.app.plugins;try{const o=vp("monthly")&&((n=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:n.monthly)||{};return{format:o.format||hI,folder:((r=o.folder)==null?void 0:r.trim())||"",template:((a=o.template)==null?void 0:a.trim())||""}}catch{}}function Sp(){var t,n,r,a;const e=window.app.plugins;try{const o=vp("quarterly")&&((n=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:n.quarterly)||{};return{format:o.format||pI,folder:((r=o.folder)==null?void 0:r.trim())||"",template:((a=o.template)==null?void 0:a.trim())||""}}catch{}}function Ip(){var t,n,r,a;const e=window.app.plugins;try{const o=vp("yearly")&&((n=(t=e.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:n.yearly)||{};return{format:o.format||mI,folder:((r=o.folder)==null?void 0:r.trim())||"",template:((a=o.template)==null?void 0:a.trim())||""}}catch{}}function gI(...e){let t=[];for(let r=0,a=e.length;r{const k=r(),j=e.clone().set({hour:k.get("hour"),minute:k.get("minute"),second:k.get("second")});return S&&j.add(parseInt(T,10),E),O?j.format(O.substring(1).trim()):j.format(o)}).replace(/{{\s*yesterday\s*}}/gi,e.clone().subtract(1,"day").format(o)).replace(/{{\s*tomorrow\s*}}/gi,e.clone().add(1,"d").format(o)));return t.foldManager.save(g,d),g}catch(g){console.error(`Failed to create file: '${m}'`,g),new In.Notice("Unable to create new file.")}}function g4(e,t){return t[_o(e,"day")]??null}function y4(){const{vault:e}=window.app,{folder:t}=wp(),n=e.getAbstractFileByPath(In.normalizePath(t));if(!n)throw new m4("Failed to find daily notes folder");const r={};return In.Vault.recurseChildren(n,a=>{if(a instanceof In.TFile){const o=Bd(a,"day");if(o){const s=_o(o,"day");r[s]=a}}}),r}class v4 extends Error{}function w4(){const{moment:e}=window;let t=e.localeData()._week.dow;const n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];for(;t;)n.push(n.shift()),t--;return n}function b4(e){return w4().indexOf(e.toLowerCase())}async function bI(e){const{vault:t}=window.app,{template:n,format:r,folder:a}=bp(),[o,s]=await Rd(n),c=e.format(r),d=await Tp(a,c);try{const p=await t.create(d,o.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(m,g,v,D,S,T)=>{const E=window.moment(),O=e.clone().set({hour:E.get("hour"),minute:E.get("minute"),second:E.get("second")});return v&&O.add(parseInt(D,10),S),T?O.format(T.substring(1).trim()):O.format(r)}).replace(/{{\s*title\s*}}/gi,c).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi,(m,g,v)=>{const D=b4(g);return e.weekday(D).format(v.trim())}));return window.app.foldManager.save(p,s),p}catch(p){console.error(`Failed to create file: '${d}'`,p),new In.Notice("Unable to create new file.")}}function D4(e,t){return t[_o(e,"week")]??null}function S4(){const e={};if(!SI())return e;const{vault:t}=window.app,{folder:n}=bp(),r=t.getAbstractFileByPath(In.normalizePath(n));if(!r)throw new v4("Failed to find weekly notes folder");return In.Vault.recurseChildren(r,a=>{if(a instanceof In.TFile){const o=Bd(a,"week");if(o){const s=_o(o,"week");e[s]=a}}}),e}class I4 extends Error{}async function DI(e){const{vault:t}=window.app,{template:n,format:r,folder:a}=Dp(),[o,s]=await Rd(n),c=e.format(r),d=await Tp(a,c);try{const p=await t.create(d,o.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(m,g,v,D,S,T)=>{const E=window.moment(),O=e.clone().set({hour:E.get("hour"),minute:E.get("minute"),second:E.get("second")});return v&&O.add(parseInt(D,10),S),T?O.format(T.substring(1).trim()):O.format(r)}).replace(/{{\s*date\s*}}/gi,c).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,c));return window.app.foldManager.save(p,s),p}catch(p){console.error(`Failed to create file: '${d}'`,p),new In.Notice("Unable to create new file.")}}function T4(e,t){return t[_o(e,"month")]??null}function E4(){const e={};if(!II())return e;const{vault:t}=window.app,{folder:n}=Dp(),r=t.getAbstractFileByPath(In.normalizePath(n));if(!r)throw new I4("Failed to find monthly notes folder");return In.Vault.recurseChildren(r,a=>{if(a instanceof In.TFile){const o=Bd(a,"month");if(o){const s=_o(o,"month");e[s]=a}}}),e}class C4 extends Error{}async function x4(e){const{vault:t}=window.app,{template:n,format:r,folder:a}=Sp(),[o,s]=await Rd(n),c=e.format(r),d=await Tp(a,c);try{const p=await t.create(d,o.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(m,g,v,D,S,T)=>{const E=window.moment(),O=e.clone().set({hour:E.get("hour"),minute:E.get("minute"),second:E.get("second")});return v&&O.add(parseInt(D,10),S),T?O.format(T.substring(1).trim()):O.format(r)}).replace(/{{\s*date\s*}}/gi,c).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,c));return window.app.foldManager.save(p,s),p}catch(p){console.error(`Failed to create file: '${d}'`,p),new In.Notice("Unable to create new file.")}}function M4(e,t){return t[_o(e,"quarter")]??null}function N4(){const e={};if(!TI())return e;const{vault:t}=window.app,{folder:n}=Sp(),r=t.getAbstractFileByPath(In.normalizePath(n));if(!r)throw new C4("Failed to find quarterly notes folder");return In.Vault.recurseChildren(r,a=>{if(a instanceof In.TFile){const o=Bd(a,"quarter");if(o){const s=_o(o,"quarter");e[s]=a}}}),e}class k4 extends Error{}async function A4(e){const{vault:t}=window.app,{template:n,format:r,folder:a}=Ip(),[o,s]=await Rd(n),c=e.format(r),d=await Tp(a,c);try{const p=await t.create(d,o.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi,(m,g,v,D,S,T)=>{const E=window.moment(),O=e.clone().set({hour:E.get("hour"),minute:E.get("minute"),second:E.get("second")});return v&&O.add(parseInt(D,10),S),T?O.format(T.substring(1).trim()):O.format(r)}).replace(/{{\s*date\s*}}/gi,c).replace(/{{\s*time\s*}}/gi,window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi,c));return window.app.foldManager.save(p,s),p}catch(p){console.error(`Failed to create file: '${d}'`,p),new In.Notice("Unable to create new file.")}}function F4(e,t){return t[_o(e,"year")]??null}function O4(){const e={};if(!EI())return e;const{vault:t}=window.app,{folder:n}=Ip(),r=t.getAbstractFileByPath(In.normalizePath(n));if(!r)throw new k4("Failed to find yearly notes folder");return In.Vault.recurseChildren(r,a=>{if(a instanceof In.TFile){const o=Bd(a,"year");if(o){const s=_o(o,"year");e[s]=a}}}),e}function P4(){var r,a;const{app:e}=window,t=e.internalPlugins.plugins["daily-notes"];if(t&&t.enabled)return!0;const n=e.plugins.getPlugin("periodic-notes");return n&&((a=(r=n.settings)==null?void 0:r.daily)==null?void 0:a.enabled)}function SI(){var n,r;const{app:e}=window;if(e.plugins.getPlugin("calendar"))return!0;const t=e.plugins.getPlugin("periodic-notes");return t&&((r=(n=t.settings)==null?void 0:n.weekly)==null?void 0:r.enabled)}function II(){var n,r;const{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((r=(n=t.settings)==null?void 0:n.monthly)==null?void 0:r.enabled)}function TI(){var n,r;const{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((r=(n=t.settings)==null?void 0:n.quarterly)==null?void 0:r.enabled)}function EI(){var n,r;const{app:e}=window,t=e.plugins.getPlugin("periodic-notes");return t&&((r=(n=t.settings)==null?void 0:n.yearly)==null?void 0:r.enabled)}function j4(e){const t={day:wp,week:bp,month:Dp,quarter:Sp,year:Ip}[e];return t()}function L4(e,t){return{day:wI,month:DI,week:bI}[e](t)}At.DEFAULT_DAILY_NOTE_FORMAT=cw;At.DEFAULT_MONTHLY_NOTE_FORMAT=hI;At.DEFAULT_QUARTERLY_NOTE_FORMAT=pI;At.DEFAULT_WEEKLY_NOTE_FORMAT=dw;At.DEFAULT_YEARLY_NOTE_FORMAT=mI;var a1=At.appHasDailyNotesPluginLoaded=P4;At.appHasMonthlyNotesPluginLoaded=II;At.appHasQuarterlyNotesPluginLoaded=TI;At.appHasWeeklyNotesPluginLoaded=SI;At.appHasYearlyNotesPluginLoaded=EI;var CI=At.createDailyNote=wI;At.createMonthlyNote=DI;At.createPeriodicNote=L4;At.createQuarterlyNote=x4;At.createWeeklyNote=bI;At.createYearlyNote=A4;var bs=At.getAllDailyNotes=y4;At.getAllMonthlyNotes=E4;At.getAllQuarterlyNotes=N4;At.getAllWeeklyNotes=S4;At.getAllYearlyNotes=O4;var Fy=At.getDailyNote=g4,oy=At.getDailyNoteSettings=wp,Wh=At.getDateFromFile=Bd;At.getDateFromPath=p4;At.getDateUID=_o;At.getMonthlyNote=T4;At.getMonthlyNoteSettings=Dp;At.getPeriodicNoteSettings=j4;At.getQuarterlyNote=M4;At.getQuarterlyNoteSettings=Sp;At.getTemplateInfo=Rd;At.getWeeklyNote=D4;At.getWeeklyNoteSettings=bp;At.getYearlyNote=F4;At.getYearlyNoteSettings=Ip;const R4={},B4={},_4={},H4={},xI={welcome:"Welcome to Thino",ribbonIconTitle:"Thino",to:"to",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."],weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekDaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],year:null,month:null,"Basic Options":"Basic options","User name":"User name","Set your user name here. 'Memos 😏' By default":"Set your user name here. 'Thino 😏' By default",'You can set target heading like "# Heading" to control data location':'You can set target heading like "# Heading" to control data location',"Insert after heading":"Insert after heading","If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"You should set the same heading below if you want to insert and process thino below the same heading.","Allows admonitions to be created using ":"Allows admonitions to be created using ","Process Memos below":"Process thino below","If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.":"If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.","Save Memo button label":"Save thino button label","The text shown on the save Memo button in the UI. 'NOTEIT' by default.":"The text shown on the save Thino button in the UI. 'NOTEIT' by default.","Focus on editor when open memos":"Focus on editor when open thino","Focus on editor when open memos. Focus by default.":"Focus on editor when open thino. Focus by default.","Open daily memos with open memos":"Open daily thino with open thino","Open daily memos with open memos. Open by default.":"Open daily thino with open thino. Open by default.","Open Memos when obsidian opens":"Open Thino when obsidian opens","When enable this, Memos will open when Obsidian opens. False by default.":"When enable this, Thino will open when Obsidian opens. False by default.","Hide done tasks in Memo list":"Hide done tasks in Thino list","Hide all done tasks in Memo list. Show done tasks by default.":"Hide all done tasks in Thino list. Show done tasks by default.","Advanced Options":"Advanced Options","UI language for date":"UI language for date","Translates the date UI language. Only 'en' and 'zh' are available.":"Translates the date UI language. Only 'en' and 'zh' are available.","Default prefix when save thino in daily notes":"Default prefix when save thino in daily notes","Set the default prefix when create memo, 'List' by default.":"Set the default prefix when create thino, 'List' by default.","Default insert date format":"Default insert date format","Set the default date format when insert date by @, 'Tasks' by default.":"Set the default date format when insert date by @, 'Tasks' by default.","Default editor position on mobile":"Default editor position on mobile","Set the default editor position on Mobile, 'Top' by default.":"Set the default editor position on Mobile, 'Top' by default.","Use button to show editor on mobile":"Use button to show editor on mobile","Set a float button to call editor on mobile. Only when editor located at the bottom works.":"Set a float button to call editor on mobile. Only when editor located at the bottom works.","Show Time When Copy Results":"Show Time When Copy Results","Show time when you copy results, like 12:00. Copy time by default.":"Show time when you copy results, like 12:00. Copy time by default.","Show Date When Copy Results":"Show Date When Copy Results","Show date when you copy results, like [[2022-01-01]]. Copy date by default.":"Show date when you copy results, like [[2022-01-01]]. Copy date by default.","Add Blank Line Between Different Date":"Add Blank Line Between Different Date","Add blank line when copy result with date. No blank line by default.":"Add blank line when copy result with date. No blank line by default.","Share Options":"Share Options","Share Memos Image Footer Start":"Share Thino Image Footer Start","Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default":"Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default","Share Memos Image Footer End":"Share Thino Image Footer End","Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default":"Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default","Save Shared Image To Folder For Mobile":"Save Shared Image To Folder For Mobile","Save image to folder for mobile. False by Default":"Save image to folder for mobile. False by Default","Say Thank You":"Say Thank You",Donate:"Donate","If you like this plugin, consider donating to support continued development:":"If you like this plugin, consider donating to support continued development:","File Name of Recycle Bin":"File Name of Recycle Bin","Set the filename for recycle bin. 'delete' By default":"Set the filename for recycle bin. 'delete' By default","File Name of Query File":"File Name of Query File","Set the filename for query file. 'query' By default":"Set the filename for query file. 'query' By default","Use Tags In Vault":"Use Tags In Vault","Use tags in vault rather than only in Memos. False by default.":"Use tags in vault rather than only in Thino. False by default.","Ready to convert image into background":"Ready to convert image into background",List:"List",Task:"Task",Top:"Top",Bottom:"Bottom",TAG:"TAG",DAY:"DAY",QUERY:"Query",EDIT:"EDIT",PIN:"PIN",UNPIN:"UNPIN",DELETE:"DELETE","CONFIRM!":"CONFIRM!","CREATE FILTER":"CREATE FILTER","Comment it...":"Comment it...",Settings:"Settings","Recycle bin":"Recycle bin","About Me":"About Me","Fetching data...":"Fetching data...","Here is No Memos.":"Here is No Thino.","Frequently Used Tags":"Frequently Used Tags","What do you think now...":"What do you think now...",READ:"READ",MARK:"MARK",SHARE:"SHARE",SOURCE:"SOURCE",RESTORE:"RESTORE",ARCHIVE:"Archive","DELETE AT":"DELETE AT","Noooop!":"Noooop!","All Data is Loaded 🎉":"All Data is Loaded 🎉","Quick filter":"Quick filter",TYPE:"TYPE",LINKED:"LINKED","NO TAGS":"NO TAGS","HAS LINKS":"HAS LINKS","HAS IMAGES":"HAS IMAGES",INCLUDE:"INCLUDE",EXCLUDE:"EXCLUDE",TEXT:"TEXT",IS:"IS",AND:"AND",OR:"OR",LIST:"LIST",ISNOT:"ISNOT",SELECT:"SELECT","ADD FILTER TERMS":"ADD FILTER TERMS",FILTER:"FILTER",Filter:"Filter",TITLE:"TITLE","CREATE QUERY":"CREATE QUERY","EDIT QUERY":"EDIT QUERY",MATCH:"MATCH",TIMES:"TIMES","Share Memo Image":"Share Thino Image","↗Click the button to save":"↗Click the button to save","Image is generating...":"Image is generating...","Image is loading...":"Image is loading...","Loading...":"Loading...","😟 Cannot load image, image link maybe broken":"😟 Cannot load image, image link maybe broken","Daily Memos":"Daily Thino","CANCEL EDIT":"CANCEL EDIT","LINK TO THE":"LINK TO THE","Mobile Options":"Mobile Options","Experimental Options":"Experimental Options","Don't support web image yet, please input image path in vault":"Don't support web image yet, please input image path in vault","Background Image in Dark Theme":"Background Image in Dark Theme","Background Image in Light Theme":"Background Image in Light Theme",'Set background image in dark theme. Set something like "Daily/one.png"':'Set background image in dark theme. Set something like "Daily/one.png"','Set background image in light theme. Set something like "Daily/one.png"':'Set background image in light theme. Set something like "Daily/one.png"','Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default':'Set default thino composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default',"Default Memo Composition":"[Deprecated] Default Thino Composition","Show Tasks Label":"Show Tasks Label","Show tasks label near the time text. False by default":"Show tasks label near the time text. False by default","Please Open Memos First":"Please Open Thino First",DATE:"DATE",OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED:"OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED",BEFORE:"BEFORE",AFTER:"AFTER","Allow Comments On Memos":"Allow Comments On Thino","You can comment on memos. False by default":"You can comment on thino. False by default",Import:"Import","TITLE CANNOT BE NULL!":"TITLE CANNOT BE NULL!","FILTER CANNOT BE NULL!":"FILTER CANNOT BE NULL!","Comments In Original DailyNotes/Notes":"Comments In Original DailyNotes/Notes","You should install Dataview Plugin ver 0.5.9 or later to use this feature.":"You should install Dataview Plugin ver 0.5.9 or later to use this feature.","Open Memos Successfully":"Open Thino Successfully","Fetch Memos Error":"😭 Fetch Error","Copied to clipboard Successfully":"Copied to clipboard Successfully","Check if you opened Daily Notes Plugin Or Periodic Notes Plugin":"Check if you opened Daily Notes Plugin Or Periodic Notes Plugin","Please finish the last filter setting first":"Please finish the last filter setting first","Close Memos Successfully":"Close Thino Successfully","Insert as Memo":"Insert as Thino","Insert file as memo content":"Insert file as thino content","Image load failed":"Image load failed","Content cannot be empty":"Content cannot be empty","Unable to create new file.":"Unable to create new file.","Failed to fetch deleted memos: ":"Failed to fetch deleted thino: ","RESTORE SUCCEED":"RESTORE SUCCEED","DELETE SUCCEED":"DELETE SUCCEED","Save Memo button icon":"Save Thino button icon","The icon shown on the save Memo button in the UI.":"The icon shown on the save Thino button in the UI.","Fetch Memos From Particular Notes":"Fetch Thino From Particular Notes",'You can set any Dataview Query for memos to fetch it. All memos in those notes will show on list. "#memo" by default':'You can set any Dataview Query for thino to fetch it. All thino in those notes will show on list. "#memo" by default',"Allow Memos to Fetch Memo from Notes":"Allow Thino to Fetch Thino from Notes","Use Memos to manage all memos in your notes, not only in daily notes. False by default":"Use Thino to manage all thino in your notes, not only in daily notes. False by default","Always Show Memo Comments":"Always Show Thino Comments","Always show memo comments on memos. False by default":"Always show thino comments on thino. False by default","You didn't set folder for daily notes in both periodic-notes and daily-notes plugins.":"You didn't set folder for daily notes in both periodic-notes and daily-notes plugins.","Please check your daily note plugin OR periodic notes plugin settings":"Please check your daily note plugin OR periodic notes plugin settings","Use which plugin's default configuration":"Use which plugin's default configuration","Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.":"Thino use the plugin's default configuration to fetch thino from daily, 'Daily' by default.",Daily:"Daily","Always Show Leaf Sidebar on PC":"Always Show Leaf Sidebar on PC","Show left sidebar on PC even when the leaf width is less than 875px. False by default.":"Show left sidebar on PC even when the leaf width is less than 875px. False by default.","You didn't set format for daily notes in both periodic-notes and daily-notes plugins.":"You didn't set format for daily notes in both periodic-notes and daily-notes plugins.","fetch more":"fetch more","Search all settings":"Search all settings",General:"General",Theme:"Theme",Share:"Share",Advanced:"Advanced",Thino:"Thino","Random Review":"Random Review","ARCHIVED AT":"ARCHIVED AT","Failed to get memos from daily notes":"Failed to get thino from daily notes","Failed to delete memo":"Failed to delete thino","CTRL + ENTER to save":"CTRL + ENTER to save","Started from":"Started from","Custom Background Image":"Custom Background Image","Set custom background image.":"Set custom background image.","Custom Memo Footer":"Custom Thino Footer","Set custom memo footer.":"Set custom thino footer.","Heatmap Color Scheme":"Heatmap Color Scheme","Set different color scheme for heatmap.":"Set different color scheme for heatmap.","Enable Local Http Server":"Enable Local Http Server","Memos Http Server Port":"Thino Http Server Port","Set memos http server port to listen. '43999' by default":"Set thino http server port to listen. '43999' by default","Default Editor Mode":"Default Editor Mode","Live-Preview Mode OR Source Mode.":"Live-Preview Mode/Source Mode.","Save type for Thino":"Save type for Thino",DAILY:"DAILY",MULTI:"MULTI",CANVAS:"CANVAS",ALL:"ALL",FILE:"FILE",TODO:"TODO",DONE:"DONE",JOURNAL:"JOURNAL",OTHER:"OTHER","Failed to create daily note, check if it exists.":"Failed to create daily note, check if it exists.","Failed to create daily note. Please check if you created a folder for daily notes.":"Failed to create daily note. Please check if you created a folder for daily notes.","After you verify your account, please refresh this page.":"After you verify your account, please refresh this page.",Verify:"Verify","Oops! You forget to verify insider account":"Oops! You forget to verify insider account","If you have any questions, please contact us.":"If you have any questions, please contact us.","Delete Thino Directly":"Delete Thino Directly","When delete thino directly, it will not be moved to trash. False by default.":"When delete thino directly, it will not be moved to trash. False by default.","Enable opening thino globally":"Enable opening thino globally","Enable opening thino globally. False by default.":"Enable opening thino globally. False by default.","Key for opening thino globally":"Key for opening thino globally","Set key for opening thino globally. CTRL + SHIFT + T by default.":"Set key for opening thino globally. CTRL + SHIFT + T by default.","Key for showing thino globally":"Key for showing thino globally","Set key for showing thino globally. CTRL + SHIFT + E by default.":"Set key for showing thino globally. CTRL + SHIFT + E by default.","Get activation code":"Get activation code","Input activation code here":"Input activation code here","Copy Thino id":"Copy Thino id","Activate Pro Version":"Activate Pro Version","Please copy Thino id first":"Please copy Thino id first",'You can set folder name with file name like "folder/file"':'You can set folder name with file name like "folder/file"','You can set folder name like "folder1/folder2/folder3" to create sub-folder':'You can set folder name like "folder1/folder2/folder3" to create sub-folder',"Default save type":"Default save location",'Set the default save type for thino. "DAILY" by default':'Set the default save type for thino. "DAILY" by default',"Sync Thino via PKMer":"Sync Thino via PKMer",Unlink:"Unlink",Link:"Link","Connect to PKMer Sync, you can check it in ":"Connect to PKMer Sync, you can check it in ","PKMer Sync":"PKMer Sync","Remove successfully":"Remove successfully",Deactivate:"Deactivate",Remove:"Remove","Confirm?":"Confirm?","Sync Status":"Sync Status","Start or stop sync":"Start or stop sync","Stop sync successfully":"Stop sync successfully","Start sync successfully":"Start sync successfully",Stop:"Stop",Start:"Start","Show thino near mouse":"Show thino near mouse","Query not found":"Query not found","Send to clipboard successfully":"Send to clipboard successfully","Thino - Failed to start HTTP server, please check the port is available.":"Thino - Failed to start HTTP server, please check the port is available.","Thino - Started HTTP server on port":"Thino - Started HTTP server on port","Thino - Terminated HTTP server":"Thino - Terminated HTTP server","File not exist":"File not exist","Thino not found":"Thino not found","File not found for the given thino path, is creating a new file":"File not found for the given thino path, is creating a new file","Saved sync token successfully":"Saved sync token successfully","Failed to find daily notes folder":"Failed to find daily notes folder","Please install obsidian-hover-editor plugin first":"Please install obsidian-hover-editor plugin first","Copied app id successfully":"Copied app id successfully","Please input token first":"Please input token first","Please enable sync first":"Please enable sync first","Init Failed":"Init Failed","Verify successfully":"Verify successfully","Failed to verify":"Failed to verify","Folder not found for the given thino path, is creating a new folder":"Folder not found for the given thino path, is creating a new folder","File not found for the given thino path":"File not found for the given thino path","Failed to read current daily note, check if it exists.":"Failed to read current daily note, check if it exists.","Failed to save":"Failed to save","Failed to login, please login again":"Failed to login, please login again","COPY FAILED":"COPY FAILED","COPY SUCCEED":"COPY SUCCEED","Copy selected text":"Copy selected text","Copy thino":"Copy thino",COPY:"COPY","This is a pro feature, please upgrade to pro version to use it.":"This is a pro feature, please upgrade to pro version to use it.","You can get pro version from: ":"You can get pro version from: ",Save:"Save",Cancel:"Cancel","Thino Daily Target":"Thino Daily Target",Input:"Input","#Tag":"#Tag","to create tag":"to create tag","You have verified your account. Congrats!":"You have verified your account. Congrats!","Pro features":"Pro features","Target Thino Count":"Target Thino Count",on:"on","Switch waterfall view":"Switch waterfall view","Switch view":"Switch view","Switch list view":"Switch list view","Set daily target":"Set daily target","Thino Save To: ":"Thino Save To: ","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",words:"words","Return To Home Page":"Return To Home Page","Open thino in center window":"Open thino in center window","Open thino in float window":"Open thino in float window","Open thino in right sidebar":"Open thino in right sidebar","Open thino in left sidebar":"Open thino in left sidebar","Show thino editor":"Show thino editor","Toggle minimal mode":"Toggle minimal mode","Focus on thino editor":"Focus on thino editor","ReSync web thinos to local":"ReSync web thinos to local","Sync local thinos to web":"Sync local thinos to web","Show daily thino":"Show daily thino","Focus on search bar":"Focus on search bar","Show-thino in popover(Hover editor)":"Show-thino in popover(Hover editor)","Center window":"Center window","Float window":"Float window","Right sidebar":"Right sidebar","Left sidebar":"Left sidebar","Save thino type when sync local":"Save thino type when sync local","Set the default save thino type when sync local, FILE by default.":"Set the default save thino type when sync local, FILE by default.","Sync service":"Sync service","Pro verification status":"Pro verification status","Live-preview":"Live-preview",Source:"Source","Global copy":"Global copy","Set the folder name":"Set the folder name","Set the filename":"Set the filename","Set the filename for current location file":"Set the filename for current location file","Switch calendar type":"Switch calendar type",alphabetical:"alphabetical",alphabeticalReverse:"alphabeticalReverse",byCount:"byCount",byCountReverse:"byCountReverse","Type here":"Type here",Today:"Today",Yesterday:"Yesterday","Last 7 days":"Last 7 days","Last 30 days":"Last 30 days","Last 90 days":"Last 90 days","Last 180 days":"Last 180 days","Last 365 days":"Last 365 days",Found:"Found","Copy filtered thinos":"Copy filtered thinos","Bulk delete":"Bulk delete","Bulk archive":"Bulk archive","Bulk tag operation":"Bulk tag operation","Bulk restore":"Bulk restore","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.":"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.",Preview:"Preview","Set and save":"Set and save","Show day mark in thino list":"Show day mark in thino list","Show day mark on the top of daily range thino. False by default.":"Show day mark on the top of daily range thino. False by default.","Click to expand or fold, Cmd+Click to show all thinos of the day":"Click to expand or fold, Cmd+Click to show all thinos of the day","You can buy a license from":"You can buy a license from","No thinos in range":"No thinos in range",Month:"Month",Week:"Week",Day:"Day",Agenda:"Agenda",Tomorrow:"Tomorrow",Previous:"Previous",Next:"Next","Search all columns...":"Search all columns...","Basic Info":"Basic Info","Additional Info":"Additional Info","Created At":"Created At",Content:"Content","Thino Type":"Thino Type","Source Type":"Source Type","Row status":"Row status",Path:"Path","Pinned Status":"Pinned Status",Table:"Table",Chat:"Chat",Moments:"Moments",Waterfall:"Waterfall",Calendar:"Calendar","Go to page":"Go to page",Page:"Page",Show:"Show",rows:"rows","Temp Filter":"Temp Filter","Open link directly in Thino view":"Open link directly in Thino view","Day mark range":"Day mark range","Set the range of day mark. Day by default.":"Set the range of day mark. Day by default.","Thino is locked":"Thino is locked","Please unlock Thino by input password":"Please unlock Thino by input password","Auto Download Image":"Auto Download Image","Auto download image when save to thino. 'false' by default":"Auto download image when save to thino. 'false' by default","Thino Http IP Type":"Thino Http IP Type","Set Thino http server ip to listen. 'localhost' by default":"Set Thino http server ip to listen. 'localhost' by default","Password to lock Thino":"Password to lock Thino",Unlock:"Unlock",Locked:"Locked","Password is incorrect":"Password is incorrect",Lock:"Lock","Need password to unlock Thino":"Need password to unlock Thino","You have not set a password or enable this feature yet":"You have not set a password or enable this feature yet",Password:"Password","Password for Thino":"Password for Thino","Please input your password to change password settings":"Please input your password to change password settings","Please input your password":"Please input your password","Lock thino":"Lock thino",date:"date",time:"time",event:"event","Add tag position":"Add tag position","Set the position of the tag when adding tag automatically":"Set the position of the tag when adding tag automatically","Add tag automatically":"Add tag automatically","Add tag to the end or beginning of the thino content when creating a thino and filtering tags":"Add tag to the end or beginning of the thino content when creating a thino and filtering tags","Add tag with new line":"Add tag with new line","Add tag with new line when adding tag automatically":"Add tag with new line when adding tag automatically","Input to select more tags":"Input to select more tags","Tag Bulk Edit":"Tag Bulk Edit","Exist Tags":"Exist Tags","Selected Tags":"Selected Tags","Click to remove exist tag":"Click to remove exist tag","Click to remove selected tag":"Click to remove selected tag","Select tags":"Select tags","Input to select exist tag":"Input to select exist tag",Beginning:"Beginning",End:"End","Set the heading for saving thino":"Set the heading for saving thino","# Heading":"# Heading","Chat view style":"Chat view style","Set the style of chat view":"Set the style of chat view","Background image for moments view":"Background image for moments view","Set the background image for moments view":"Set the background image for moments view","Icon for moments/chat view/share image":"Icon for moments/chat view/share image","Set the icon for moments/chat view/share image":"Set the icon for moments/chat view/share image","Quote for moments view/share image":"Quote for moments view/share image","Set the quote for moments view/share image":"Set the quote for moments view/share image","Theme for Thino":"Theme for Thino","Set the theme for Thino":"Set the theme for Thino","Interface Details":"Interface Details","Task amount":"Task amount","Thino status":"Thino status","Used tags":"Used tags","Used days":"Used days","Most active day":"Most active day","Most active hour":"Most active hour","Thino amount":"Thino amount","No content to generate.":"No content to generate.","Image generated successfully.":"Image generated successfully.","Failed to generate image.":"Failed to generate image.","Share filtered thinos as image":"Share filtered thinos as image","Latest version":"Latest version","Previous version":"Previous version","Thino update info":"Thino update info","Debug info copied to clipboard":"Debug info copied to clipboard","Copy debug info":"Copy debug info","Failed to load changelog":"Failed to load changelog","View online":"View online",ChangeLog:"ChangeLog","Please open thino first":"Please open thino first","Insert editor":"Insert editor","Please set different save locations for multi-file settings in Thino. The diary folder overlaps with the multi-file save location, or there is a risk of it being read repeatedly.":"Please set different save locations for multi-file settings in Thino. The diary folder overlaps with the multi-file save location, or there is a risk of it being read repeatedly.","Default time prefix for thino in daily notes":"Default time prefix for thino in daily notes","Set default time prefix for thino in daily notes.":"Set default time prefix for thino in daily notes.","Save image successfully":"Save image successfully","User quote":"User quote","Set user quote for thino":"Set user quote for thino","User icon":"User icon","Set user icon for thino":"Set user icon for thino","User info":"User info","Copy filtered results":"Copy filtered results","Share image":"Share image",Default:"Default",Gray:"Gray",Grass:"Grass",Flame:"Flame",Olive:"Olive",Ice:"Ice",Magenta:"Magenta","Daily notes":"Daily notes",Editor:"Editor","Append/prepend text when share to Thino":"Append/prepend text when share to Thino","Append text when share to Thino":"Append text when share to Thino","Prepend text when share to Thino":"Prepend text when share to Thino","Add newline when append/prepend text":"Add newline when append/prepend text","Input anything here":"Input anything here",Prepend:"Prepend",Append:"Append",Both:"Both",None:"None","Hide pinned group":"Hide pinned group","Hide pinned group in thino list. False by default.":"Hide pinned group in thino list. False by default.","Set the heading for the task type of thino, by default the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"Set the heading for the task type of thino, by default the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.","Different insert target for different type":"Different insert target for different type","Toggle this to set different insert target for different type of thino, like task or list type of thino":"Toggle this to set different insert target for different type of thino, like task or list type of thino","You can set whole diary or only part of it":"You can set whole diary or only part of it","Set process target":"Set process target",Custom:"Custom","Whole diary":"Whole Diary","Set thino insert place":"Set thino insert place","Set where to insert thino content":"Set where to insert thino content","End of the diary":"End of the diary","Custom location":"Custom location"},Y4={},z4={},U4={welcome:"Bienvenue dans Mémo !",ribbonIconTitle:"Mémos",months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Décembre"],monthsShort:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."],weekDays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekDaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],to:"à",year:null,month:null,"Basic Options":"Options basique","User name":"Username","Set your user name here. 'Memos 😏' By default":"Définissez votre username ici. Défaut : 'Memo 😏'","Insert after heading":"Insérer après le titre","If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"Vous devez définir le même titre en-dessous si vous voulez insérer et traiter des mémos sous le même titre.","Allows admonitions to be created using ":"Permet de créer des admonitions en utilisant","Process Memos below":"Insérer Mémo sous","If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.":"Seulement les entrée sous cette section/phrase dans vos notes seront considérés. S'il n'existe pas, aucune notes ne sera traité pour ce fichier.","Save Memo button label":"Titre du bouton de sauvegarde","The text shown on the save Memo button in the UI. 'NOTEIT' by default.":"Le texte affiché sur le bouton de sauvegarde dans l'UI. Défaut : 'NOTEIT'","Focus on editor when open memos":"Focus sur l'éditeur lors de l'ouverture du mémo.","Focus on editor when open memos. Focus by default.":"Focus sur l'éditeur lors de l'ouverture du mémo. Focus par défaut.","Open daily memos with open memos":"Ouvrir les mémos quotidiens quand mémo est ouvert.","Open daily memos with open memos. Open by default.":"Ouvrir les mémos quotidiens quand mémo est ouvert.","Open Memos when obsidian opens":"Ouvrir Mémo quand Obsidian est ouvert.","When enable this, Memos will open when Obsidian opens. False by default.":"Quand activé, Memo sera ouvert quand Obsidian à l'ouverture d'Obsidian. Désactivé par défaut.","Hide done tasks in Memo list":"Masquer les tâches accomplies dans la liste des mémos.","Hide all done tasks in Memo list. Show done tasks by default.":"Masquer les tâches accomplies dans les mémos. Affiche les tâches accomplies par défaut.","Advanced Options":"Options avancées","UI language for date":"Langue de l'UI pour la date","Translates the date UI language. Only 'en' and 'zh' are available.":"Traduit la langue des dates dans l'UI. Seuls 'en', 'fr' et 'zh' sont disponibles. ","Default prefix":"Préfix par défaut.","Set the default prefix when create memo, 'List' by default.":"Définit le préfix par défaut lors de la création d'un mémo. Défault : 'Liste'","Default insert date format":"Format de la date insérée par défaut.","Default editor position on mobile":"Position par défaut de l'éditeur sur mobile.","Set the default date format when insert date by @, 'Tasks' by default.":"Définit le format de la date par défaut lors de l'insertion de la date par @. Défaut : 'Tâches'.","Set the default editor position on Mobile, 'Top' by default.":"Position par défaut de l'éditeur sur le mobile. Défaut : 'Haut'.","Use button to show editor on mobile":"Utilisation du bouton pour afficher l'éditeur sur le mobile.","Show Time When Copy Results":"Aficher l'heure quand les résultats sont copiés","Set a float button to call editor on mobile. Only when editor located at the bottom works.":"Place un bouton flottant pour appeler l'éditeur sur mobile. Fonctionne uniquement quand l'éditeur est placé en bas.","Show time when you copy results, like 12:00. Copy time by default.":"Affiche l'heure quand les résultats sont copiés, comme '12:00'. Copie l'heure par défaut","Show Date When Copy Results":"Affiche la date quand les résultats sont copiés","Show date when you copy results, like [[2022-01-01]]. Copy date by default.":"Affiche la date quand les résultats sont copiés, comme [[2022-01-01]]. Par défaut, copie la date.","Add Blank Line Between Different Date":"Ajoute une ligne entre les différentes dates.","Add blank line when copy result with date. No blank line by default.":"Ajoute une ligne lors de la copie du résultat avec la date. Pas de ligne par défaut.","Share Options":"Options de partage","Share Memos Image Footer Start":"Début du pied de page — Partage de mémo de mémos","Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default":"Définissez ce que vous voulez ici, utilisez {ThinoNum} pour afficher le nombre de thino, {UsedDay} pour les jours. Par défaut : '{ThinoNum} Thino {UsedDay} Days.","Share Memos Image Footer End":"Fin du pied de page — Partage de mémo","Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default":"Définissez ce que vous voulez ici. Utilisez {UserName} comme username. Par défaut : '✍️ By {UserName}'","Save Shared Image To Folder For Mobile":"Sauvegarde des images partagés dans un dossier sur mobile.","Save image to folder for mobile. False by Default":"Sauvegarder les images dans un dossier sur mobile. Désactivé par défaut.","Say Thank You":"Dites Merci",Donate:"Faire un don","If you like this plugin, consider donating to support continued development:":"Si vous aimez ce plugin, envisagez de faire un don pour soutenir le développement continu :","File Name of Recycle Bin":"Nom de la corbeille","Set the filename for recycle bin. 'delete' By default":"Définition du nom de la poubelle. Défaut : 'Delete'","Set the filename for query file. 'query' By default":"Définit le nom de fichier pour les requête. Défaut : 'Query'","Use Tags In Vault":"Utiliser des tags dans le Coffre","Use tags in vault rather than only in Memos. False by default.":"Utiliser des tags du coffre plutôt que ceux que seulement dans Mémo. Désactivé par défaut.","Ready to convert image into background":"Prêt pour convertir des image en arrière-plan.",List:"Liste",Task:"Tâche",Top:"Haut",Bottom:"Bas",TAG:"TAG",DAY:"JOUR",QUERY:"RECHERCHE",EDIT:"EDITER",PIN:"PIN",UNPIN:"ÉPINGLER",DELETE:"DESÉPINGLER","CONFIRM!":"CONFIRMER !","CREATE FILTER":"CRÉER FILTRE",Settings:"Paramètres","Recycle bin":"Corbeille","About Me":"À propos de moi","Fetching data...":"Récupération des données...","Here is No Memos.":"Il n'y a pas de Memos.","Frequently Used Tags":"Tags fréquemment utilisés","What do you think now...":"Que pensez-vous maintenant...",READ:"LU",MARK:"MARQUER",SHARE:"PARTAGER",SOURCE:"SOURCE",RESTORE:"RESTAURER","DELETE AT":"SUPPRIMER","Noooop!":"Noooop!","All Data is Loaded 🎉":"Toutes les données sont chargées 🎉","Quick filter":"Filtre rapide",TYPE:"TYPE",LINKED:"LIEN","NO TAGS":"PAS DE TAGS","HAS LINKS":"A DES LIENS","HAS IMAGES":"A DES IMAGES",INCLUDE:"INCLUS",EXCLUDE:"EXCLUS",TEXT:"TEXTE",IS:"EST",ISNOT:"N'EST PAS",SELECT:"SELECTION","ADD FILTER TERMS":"AJOUTER DES TERMES FILTRÉ",FILTER:"FILTRE",TITLE:"TITRE","CREATE QUERY":"CRÉER UNE RECHERCHE","EDIT QUERY":"ÉDITER UNE RECHERCHE",MATCH:"MATCH",TIMES:"HEURE","Share Memo Image":"Partager un mémo image","↗Click the button to save":"↗Clique pour sauvegarder","Image is generating...":"Génération de l'image...","Image is loading...":"Image en chargement...","Loading...":"Chargement...","😟 Cannot load image, image link maybe broken":"😟 Impossible de charger l'image, le lien peut être brisé","Daily Memos":"Mémo quotidien","CANCEL EDIT":"ANNULER L'ÉDITION","LINK TO THE":"LIENS À","Mobile Options":"Options mobile","Don't support web image yet, please input image path in vault":"Ne supporte pas les images webs. Merci d'insérer le chemin de l'image depuis le coffre.","Background Image in Dark Theme":"Image de fond en thème sombre","Background Image in Light Theme":"Image de fond en thème clair",'Set background image in dark theme. Set something like "Daily/one.png"':"Définir l'image de fond en thème sombre. Définir 'Daily/one.png' par exemple.",'Set background image in light theme. Set something like "Daily/one.png"':"Définir l'image de fond en thème clair. Définir 'Daily/one.png' par exemple.",'Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default':'Définir la composition par défaut du mémo, vous devez utiliser {TIME} comme "HH:mm" et {CONTENT} comme contenu. "{TIME} {CONTENT}" par défaut',"Default Memo Composition":"Composition par défaut du mémo","Show Tasks Label":"Afficher les étiquettes des tâches","Show tasks label near the time text. False by default":"Afficher les étiquettes des tâches à côté du texte horaire. Désactivé par défaut.","Please Open Memos First":"Merci d'ouvrir les mémos en premier"},V4={},Z4={},W4={},$4={},G4={},q4={},J4={},K4={},Q4={welcome:"Bem-vindo ao Thino!",ribbonIconTitle:"Thino",months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan.","Fev.","Mar.","Abr.","Maio","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."],weekDays:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],weekDaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],to:"para",year:null,month:null,"Basic Options":"Opções Básicas","User name":"Nome de Usuário","Set your user name here. 'Memos 😏' By default":"Defina o nome de usuário. Padrão: 'Thino 😏'.","Insert after heading":"Inserir após o cabeçalho","If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"Deve definir o mesmo cabeçalho na configuração posterior se pretende inserir e processar memorandos abaixo do cabeçalho aqui definido.","Allows admonitions to be created using ":"Permitir que Admonitions sejam criadas usando ","Process Memos below":"Processar Memorandos abaixo do Cabeçalho","If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.":"Somente as entradas abaixo deste cabeçalho serão processadas nas suas notas. Se não configurar esta funcionalidade, nenhuma nota será processada para o ficheiro respetivo.","Save Memo button label":"Legenda do Botão de Guardar Memorandos","The text shown on the save Memo button in the UI. 'NOTEIT' by default.":'Define o texto apresentado na UI do botão guardar memorandos. Padrão: "NOTEIT".',"Focus on editor when open memos":"Focar no Editor ao iniciar o Thino","Focus on Editor when open memos. Focus by default.":'Focar no editor ao iniciar o Thino. Padrão: "Focar".',"Open daily memos with open memos":"Abrir memorandos diários ao iniciar o Thino","Open daily memos with open memos. Open by default.":'Abrir memorandos diários ao iniciar o Thino. Padrão: "Abrir".',"Open Memos when obsidian opens":"Abrir Thino quando o Obsidian inicia","When enable this, Memos will open when Obsidian opens. False by default.":'Quando esta opção está activa, o Memos abrirá quando o Obsidian inicia. Padrão: "Falso".',"Hide done tasks in Memo list":"Ocultar tarefas concluídas na lista de memorandos","Hide all done tasks in Memo list. Show done tasks by default.":'Ocultar todas as tarefas concluídas na lista de memorandos. Padrão: "Mostrar tarefas concluídas".',"Advanced Options":"Opções Avançadas","UI language for date":"Idioma na UI da Data ","Translates the date UI language. Only 'en' and 'zh' are available.":"Define o idioma na UI da Data. De momento, apenas 'en', 'fr', 'pt' e 'zh' estão disponíveis.","Default prefix when save thino in daily notes":"Prefixo Padrão","Set the default prefix when create memo, 'List' by default.":"Define o prefixo padrão quando um memorando é criado. Padrão: 'Lista'.","Default insert date format":"Formato Padrão para Inserção de Data","Set the default date format when insert date by @, 'Tasks' by default.":"Define o formato de Data padrão ao inserir a data usando '@'. Padrão: 'Tarefas'.","Default editor position on mobile":"Posição Padrão do Editor de Memorandos na Versão Móvel","Set the default editor position on Mobile, 'Top' by default.":"Define a posição padrão do editor de memorandos na versão móvel. Padrão: 'Topo'.","Use button to show editor on mobile":"Usar Botão para Mostrar o Editor na Versão Móvel","Set a float button to call editor on mobile. Only when editor located at the bottom works.":"Define um botão flutuante para abrir o editor na versão móvel. Opção disponível somente quando a posição do editor está definida para 'Fundo'.","Show Time When Copy Results":"Mostrar a Hora ao Copiar os Resultados","Show time when you copy results, like 12:00. Copy time by default.":"Mostrar a Hora, no formato '12:00', ao copiar os resultados. Padrão: 'Copiar a hora'.","Show Date When Copy Results":"Mostrar a Data ao Copiar os Resultados","Show date when you copy results, like [[2022-01-01]]. Copy date by default.":'Mostrar a Data, no formato [[2022-01-01]], ao copiar os resultados. Padrão: "Copiar a hora".',"Add Blank Line Between Different Date":"Adicionar Linha em Branco entre Datas Diferentes.","Add blank line when copy result with date. No blank line by default.":'Adicionar linha em branco ao copiar resultados com Data. Padrão: "Não adicionar linha."',"Share Options":"Opções de Partilha","Share Memos Image Footer Start":"Partilhar a Imagem de um memorando - Início do Rodapé","Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default":"Defina como preferir, use {ThinoNum} para mostrar o número de thinorandos e use {UsedDay} para dias. 'Padrão: {ThinoNum} Thinorandos {UsedDay} Dias'.","Share Memos Image Footer End":"Partilhar a Imagem de um memorando - Fim do Rodapé","Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default":"Defina como preferir, use {UserName} como o seu nome de usuário. Padrão: '✍️ Por {UserName}'.","Save Shared Image To Folder For Mobile":"Guardar a Imagem Partilhada para Pasta na Versão Móvel","Save image to folder for mobile. False by Default":'Guardar a imagem partilhada para pasta na versão móvel. Padrão: "Falso".',"Say Thank You":"Agradeça",Donate:"Doar","If you like this plugin, consider donating to support continued development:":"Se gosta deste plugin, considere doar para apoiar o seu desenvolvimento contínuo:","File Name of Recycle Bin":"Nome da Reciclagem","Set the filename for recycle bin. 'delete' By default":"Define o nome do ficheiro para a Reciclagem. Padrão: 'delete'.","File Name of Query File":"Nome do Ficheiro de Query","Set the filename for query file. 'query' By default":"Define o nome do ficheiro de Query. Padrão: 'Query'.","Use Tags In Vault":"Usar Tags no Vault","Use tags in vault rather than only in Memos. False by default.":'Usar as Tags do Vault e não somente dos memorandos. Padrão: "Falso".',"Ready to convert image into background":"Pronto para converter imagem em fundo",List:"Lista",Task:"Tarefa",Top:"Topo",Bottom:"Fundo",TAG:"TAG",DAY:"DIA",QUERY:"QUERY",EDIT:"EDITAR",PIN:"FIXAR",UNPIN:"DESAFIXAR",DELETE:"ELIMINAR","CONFIRM!":"CONFIRMAR!","CREATE FILTER":"CRIAR FILTRO",Settings:"Definições","Recycle bin":"Reciclagem","About Me":"Acerca de mim","Fetching data...":"A obter dados...","Here is No Memos.":"Não existem Thino.","Frequently Used Tags":"Tags Usadas Frequentemente","What do you think now...":"Em que está a pensar...",READ:"LER",MARK:"ASSINALAR",SHARE:"PARTILHAR",SOURCE:"ORIGEM",RESTORE:"RESTAURAR","DELETE AT":"ELIMINADO EM","Noooop!":"Noooop!","All Data is Loaded 🎉":"Todos os Dados foram Carregados 🎉","Quick filter":"Filtro rápido",TYPE:"TIPO",LINKED:"LINKED","NO TAGS":"SEM TAGS","HAS LINKS":"TEM LINKS","HAS IMAGES":"TEM IMAGENS",INCLUDE:"INCLUIR",EXCLUDE:"EXCLUIR",TEXT:"TEXTO",IS:"É",ISNOT:"NÃO É",SELECT:"SELECCIONAR","ADD FILTER TERMS":"ADICIONAR TERMOS DE FILTRAGEM",FILTER:"FILTRAR",TITLE:"TÍTULO","CREATE QUERY":"CRIAR QUERY","EDIT QUERY":"EDITAR QUERY",MATCH:"IGUALA",TIMES:"VEZES","Share Memo Image":"Partilhar Imagem de Memo","↗Click the button to save":"↗Clique no botão para guardar","Image is generating...":"A gerar Imagem..","Image is loading...":"A carregar Imagem...","Loading...":"Carregando...","😟 Cannot load image, image link maybe broken":"😟 Não é possível carregar a imagem, o link da imagem pode estar incorrecto","Daily Memos":"Thino Diários","CANCEL EDIT":"CANCELAR EDIÇÃO","LINK TO THE":"LINK PARA O","Mobile Options":"Opções Móveis","Don't support web image yet, please input image path in vault":"Ainda não existe suporte para imagens de web. Por favor, insira o link para uma imagem do vault","Experimental Options":"Opções Experimentais","Background Image in Dark Theme":"Imagem de Fundo no Tema Escuro","Background Image in Light Theme":"Imagem de Fundo no Tema Claro",'Set background image in dark theme. Set something like "Daily/one.png"':'Defina a imagem de fundo para o tema escuro. Defina da seguinte forma: "Daily/one.png".','Set background image in light theme. Set something like "Daily/one.png"':'Defina a imagem de fundo para o tema claro. Defina da seguinte forma: "Daily/one.png".','Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default':'Defina a composição padrão do memorando, deve usar {TIME} como "HH:mm" e {CONTENT} como conteúdo. Padrão: "{TIME} {CONTENT}".',"Default Memo Composition":"Composição Padrão de um Memorando","Show Tasks Label":"Mostrar Etiquetas de Tarefas","Show tasks label near the time text. False by default":'Mostrar etiquetas de tarefas próximas do texto de tempo. Padrão: "Falso".',"Please Open Memos First":"Por favor, abra o Thino primeiro",DATE:"DATA",OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED:"OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED",BEFORE:"ANTES",AFTER:"DEPOIS","Allow Comments On Memos":"Permitir Comentários nos Memorandos","You can comment on memos. False by default":'Permite que comente os memorandos. Padrão: "Falso".',Import:"Importar","TITLE CANNOT BE NULL!":"O TÍTULO NÃO PODE SER NULO!","FILTER CANNOT BE NULL!":"O FILTRO NÃO PODE SER NULO!","Comments In Original DailyNotes/Notes":"Comentários nas Notas/Notas Diárias Originais","You should install Dataview Plug-in ver 0.5.9 or later to use this feature.":"Deve instalar a versão 0.5.9 ou posterior do plugin Dataview para usar esta funcionalidade.","Open Memos Successfully":"Thino Iniciado com Sucesso","Fetch Memos Error":"😭 Erro de Fetch","Copied to clipboard Successfully":"Copiado para a área de transferência com sucesso","Check if you opened Daily Notes Plugin Or Periodic Notes Plugin":"Verifique se abriu o plugin de Notas Diárias ou de Notas Periódicas","Please finish the last filter setting first":"Por favor, termine primeiro a configuração do último filtro","Close Memos Successfully":"Thino Fechado com Sucesso","Insert as Memo":"Inserir como um Memorando","Insert file as memo content":"Inserir ficheiro como conteúdo de um memorando","Image load failed":"Falha no carregamento da imagem","Content cannot be empty":"O Conteúdo não pode estar vazio","Unable to create new file.":"Não foi possível criar um novo ficheiro.","Failed to fetch deleted memos: ":"Falha no fetch dos memorandos removidos: ","RESTORE SUCCEED":"RESTAURO BEM SUCEDIDO","Save Memo button icon":"Ícone do Botão para Guardar Memorandos","The icon shown on the save Memo button in the UI.":"O ícone exibido na UI do botão para guardar memorandos.","Fetch Memos From Particular Notes":"Obter Memorandos de Notas Específicas",'You can set any Dataview Query for memos to fetch it. All memos in those notes will show on list. "#memo" by default':'Pode definir qualquer Query de Dataview para o Memos procurar. Todos os memorandos nessas notas serão mostrados na lista. Padrão: "#memo".',"Allow Memos to Fetch Memo from Notes":"Permitir que o Thino Obtenha memorandos das Notas","Use Memos to manage all memos in your notes, not only in daily notes. False by default":'Use o Memos para gerir todos os memorandos nas suas notas e não apenas nas notas diárias. Padrão: "Falso".',"Always Show Memo Comments":"Mostrar Comentários dos Memorandos","Always show memo comments on memos. False by default":'Mostrar sempre os comentários dos memorandos. Padrão: "Falso".',"You didn't set folder for daily notes in both periodic-notes and daily-notes plugins.":"Não definiu a pasta para as notas diárias, quer no plugin the Notas Periódicas ou de Notas Diárias.","Please check your daily note plugin OR periodic notes plugin settings":"Por favor, verifique as configurações dos plugins de Notas Diárias OU de Notas Periódicas","Use Which Plugin's Default Configuration":"Usar a Configuração Padrão do Plugin","Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.":"O Memos usa a configuração padrão do plugin seleccionado para obter memorandos diariamente. Padrão: 'Notas Diárias'.",Daily:"Diário"},X4={welcome:"Bem-vindo ao Memos!",ribbonIconTitle:"Thino",months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan.","Fev.","Mar.","Abr.","Maio","Jun.","Jul.","Ago.","Set.","Out.","Nov.","Dez."],weekDays:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],weekDaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],to:"para",year:null,month:null,"Basic Options":"Opções Básicas","User name":"Nome de Usuário","Set your user name here. 'Memos 😏' By default":"Defina o nome de usuário. Padrão: 'Thino 😏'.","Insert after heading":"Inserir após o cabeçalho","If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"Deve definir o mesmo cabeçalho na configuração posterior se pretende inserir e processar memorandos abaixo do cabeçalho aqui definido.","Allows admonitions to be created using ":"Permitir que Admonitions sejam criadas usando ","Process Memos below":"Processar Memorandos abaixo do Cabeçalho","If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.":"Somente as entradas abaixo deste cabeçalho serão processadas nas suas notas. Se não configurar esta funcionalidade, nenhuma nota será processada para o ficheiro respetivo.","Save Memo button label":"Legenda do Botão de Guardar Memorandos","The text shown on the save Memo button in the UI. 'NOTEIT' by default.":'Define o texto apresentado na UI do botão guardar memorandos. Padrão: "NOTEIT".',"Focus on editor when open memos":"Focar no Editor ao iniciar o Thino","Focus on Editor when open memos. Focus by default.":'Focar no editor ao iniciar o Thino. Padrão: "Focar".',"Open daily memos with open memos":"Abrir memorandos diários ao iniciar o Thino","Open daily memos with open memos. Open by default.":'Abrir memorandos diários ao iniciar o Thino. Padrão: "Abrir".',"Open Memos when obsidian opens":"Abrir Thino quando o Obsidian inicia","When enable this, Memos will open when Obsidian opens. False by default.":'Quando esta opção está activa, o Memos abrirá quando o Obsidian inicia. Padrão: "Falso".',"Hide done tasks in Memo list":"Ocultar tarefas concluídas na lista de memorandos","Hide all done tasks in Memo list. Show done tasks by default.":'Ocultar todas as tarefas concluídas na lista de memorandos. Padrão: "Mostrar tarefas concluídas".',"Advanced Options":"Opções Avançadas","UI language for date":"Idioma na UI da Data ","Translates the date UI language. Only 'en' and 'zh' are available.":"Define o idioma na UI da Data. De momento, apenas 'en', 'fr', 'pt' e 'zh' estão disponíveis.","Default prefix when save thino in daily notes":"Prefixo Padrão","Set the default prefix when create memo, 'List' by default.":"Define o prefixo padrão quando um memorando é criado. Padrão: 'Lista'.","Default insert date format":"Formato Padrão para Inserção de Data","Set the default date format when insert date by @, 'Tasks' by default.":"Define o formato de Data padrão ao inserir a data usando '@'. Padrão: 'Tarefas'.","Default editor position on mobile":"Posição Padrão do Editor de Memorandos na Versão Móvel","Set the default editor position on Mobile, 'Top' by default.":"Define a posição padrão do editor de memorandos na versão móvel. Padrão: 'Topo'.","Use button to show editor on mobile":"Usar Botão para Mostrar o Editor na Versão Móvel","Set a float button to call editor on mobile. Only when editor located at the bottom works.":"Define um botão flutuante para abrir o editor na versão móvel. Opção disponível somente quando a posição do editor está definida para 'Fundo'.","Show Time When Copy Results":"Mostrar a Hora ao Copiar os Resultados","Show time when you copy results, like 12:00. Copy time by default.":"Mostrar a Hora, no formato '12:00', ao copiar os resultados. Padrão: 'Copiar a hora'.","Show Date When Copy Results":"Mostrar a Data ao Copiar os Resultados","Show date when you copy results, like [[2022-01-01]]. Copy date by default.":'Mostrar a Data, no formato [[2022-01-01]], ao copiar os resultados. Padrão: "Copiar a hora".',"Add Blank Line Between Different Date":"Adicionar Linha em Branco entre Datas Diferentes.","Add blank line when copy result with date. No blank line by default.":'Adicionar linha em branco ao copiar resultados com Data. Padrão: "Não adicionar linha."',"Share Options":"Opções de Partilha","Share Memos Image Footer Start":"Partilhar a Imagem de um memorando - Início do Rodapé","Set anything you want here, use {ThinoNum} to display Number of memos, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default":"Defina como preferir, use {ThinoNum} para mostrar o número de thinorandos e use {UsedDay} para dias. 'Padrão: {ThinoNum} Thinorandos {UsedDay} Dias'.","Share Memos Image Footer End":"Partilhar a Imagem de um memorando - Fim do Rodapé","Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default":"Defina como preferir, use {UserName} como o seu nome de usuário. Padrão: '✍️ Por {UserName}'.","Save Shared Image To Folder For Mobile":"Guardar a Imagem Partilhada para Pasta na Versão Móvel","Save image to folder for mobile. False by Default":'Guardar a imagem partilhada para pasta na versão móvel. Padrão: "Falso".',"Say Thank You":"Agradeça",Donate:"Doar","If you like this plugin, consider donating to support continued development:":"Se gosta deste plugin, considere doar para apoiar o seu desenvolvimento contínuo:","File Name of Recycle Bin":"Nome da Reciclagem","Set the filename for recycle bin. 'delete' By default":"Define o nome do ficheiro para a Reciclagem. Padrão: 'delete'.","File Name of Query File":"Nome do Ficheiro de Query","Set the filename for query file. 'query' By default":"Define o nome do ficheiro de Query. Padrão: 'Query'.","Use Tags In Vault":"Usar Tags no Vault","Use tags in vault rather than only in Memos. False by default.":'Usar as Tags do Vault e não somente dos memorandos. Padrão: "Falso".',"Ready to convert image into background":"Pronto para converter imagem em fundo",List:"Lista",Task:"Tarefa",Top:"Topo",Bottom:"Fundo",TAG:"TAG",DAY:"DIA",QUERY:"QUERY",EDIT:"EDITAR",PIN:"FIXAR",UNPIN:"DESAFIXAR",DELETE:"ELIMINAR","CONFIRM!":"CONFIRMAR!","CREATE FILTER":"CRIAR FILTRO",Settings:"Definições","Recycle bin":"Reciclagem","About Me":"Acerca de mim","Fetching data...":"A obter dados...","Here is No Memos.":"Não existem Thino.","Frequently Used Tags":"Tags Usadas Frequentemente","What do you think now...":"Em que está a pensar...",READ:"LER",MARK:"ASSINALAR",SHARE:"PARTILHAR",SOURCE:"ORIGEM",RESTORE:"RESTAURAR","DELETE AT":"ELIMINADO EM","Noooop!":"Noooop!","All Data is Loaded 🎉":"Todos os Dados foram Carregados 🎉","Quick filter":"Filtro rápido",TYPE:"TIPO",LINKED:"LINKED","NO TAGS":"SEM TAGS","HAS LINKS":"TEM LINKS","HAS IMAGES":"TEM IMAGENS",INCLUDE:"INCLUIR",EXCLUDE:"EXCLUIR",TEXT:"TEXTO",IS:"É",ISNOT:"NÃO É",SELECT:"SELECCIONAR","ADD FILTER TERMS":"ADICIONAR TERMOS DE FILTRAGEM",FILTER:"FILTRAR",TITLE:"TÍTULO","CREATE QUERY":"CRIAR QUERY","EDIT QUERY":"EDITAR QUERY",MATCH:"IGUALA",TIMES:"VEZES","Share Memo Image":"Partilhar Imagem de Memo","↗Click the button to save":"↗Clique no botão para guardar","Image is generating...":"A gerar Imagem..","Image is loading...":"A carregar Imagem...","Loading...":"Carregando...","😟 Cannot load image, image link maybe broken":"😟 Não é possível carregar a imagem, o link da imagem pode estar incorrecto","Daily Memos":"Thino Diários","CANCEL EDIT":"CANCELAR EDIÇÃO","LINK TO THE":"LINK PARA O","Mobile Options":"Opções Móveis","Don't support web image yet, please input image path in vault":"Ainda não existe suporte para imagens de web. Por favor, insira o link para uma imagem do vault","Experimental Options":"Opções Experimentais","Background Image in Dark Theme":"Imagem de Fundo no Tema Escuro","Background Image in Light Theme":"Imagem de Fundo no Tema Claro",'Set background image in dark theme. Set something like "Daily/one.png"':'Defina a imagem de fundo para o tema escuro. Defina da seguinte forma: "Daily/one.png".','Set background image in light theme. Set something like "Daily/one.png"':'Defina a imagem de fundo para o tema claro. Defina da seguinte forma: "Daily/one.png".','Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default':'Defina a composição padrão do memorando, deve usar {TIME} como "HH:mm" e {CONTENT} como conteúdo. Padrão: "{TIME} {CONTENT}".',"Default Memo Composition":"Composição Padrão de um Memorando","Show Tasks Label":"Mostrar Etiquetas de Tarefas","Show tasks label near the time text. False by default":'Mostrar etiquetas de tarefas próximas do texto de tempo. Padrão: "Falso".',"Please Open Memos First":"Por favor, abra o Thino primeiro",DATE:"DATA",OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED:"OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED",BEFORE:"ANTES",AFTER:"DEPOIS","Allow Comments On Memos":"Permitir Comentários nos Memorandos","You can comment on memos. False by default":'Permite que comente os memorandos. Padrão: "Falso".',Import:"Importar","TITLE CANNOT BE NULL!":"O TÍTULO NÃO PODE SER NULO!","FILTER CANNOT BE NULL!":"O FILTRO NÃO PODE SER NULO!","Comments In Original DailyNotes/Notes":"Comentários nas Notas/Notas Diárias Originais","You should install Dataview Plug-in ver 0.5.9 or later to use this feature.":"Deve instalar a versão 0.5.9 ou posterior do plugin Dataview para usar esta funcionalidade.","Open Memos Successfully":"Thino Iniciado com Sucesso","Fetch Memos Error":"😭 Erro de Fetch","Copied to clipboard Successfully":"Copiado para a área de transferência com sucesso","Check if you opened Daily Notes Plugin Or Periodic Notes Plugin":"Verifique se abriu o plugin de Notas Diárias ou de Notas Periódicas","Please finish the last filter setting first":"Por favor, termine primeiro a configuração do último filtro","Close Memos Successfully":"Thino Fechado com Sucesso","Insert as Memo":"Inserir como um Memorando","Insert file as memo content":"Inserir ficheiro como conteúdo de um memorando","Image load failed":"Falha no carregamento da imagem","Content cannot be empty":"O Conteúdo não pode estar vazio","Unable to create new file.":"Não foi possível criar um novo ficheiro.","Failed to fetch deleted memos: ":"Falha no fetch dos memorandos removidos: ","RESTORE SUCCEED":"RESTAURO BEM SUCEDIDO","Save Memo button icon":"Ícone do Botão para Guardar Memorandos","The icon shown on the save Memo button in the UI.":"O ícone exibido na UI do botão para guardar memorandos.","Fetch Memos From Particular Notes":"Obter Memorandos de Notas Específicas",'You can set any Dataview Query for memos to fetch it. All memos in those notes will show on list. "#memo" by default':'Pode definir qualquer Query de Dataview para o Memos procurar. Todos os memorandos nessas notas serão mostrados na lista. Padrão: "#memo".',"Allow Memos to Fetch Memo from Notes":"Permitir que o Thino Obtenha memorandos das Notas","Use Memos to manage all memos in your notes, not only in daily notes. False by default":'Use o Memos para gerir todos os memorandos nas suas notas e não apenas nas notas diárias. Padrão: "Falso".',"Always Show Memo Comments":"Mostrar Comentários dos Memorandos","Always show memo comments on memos. False by default":'Mostrar sempre os comentários dos memorandos. Padrão: "Falso".',"You didn't set folder for daily notes in both periodic-notes and daily-notes plugins.":"Não definiu a pasta para as notas diárias, quer no plugin the Notas Periódicas ou de Notas Diárias.","Please check your daily note plugin OR periodic notes plugin settings":"Por favor, verifique as configurações dos plugins de Notas Diárias OU de Notas Periódicas","Use Which Plugin's Default Configuration":"Usar a Configuração Padrão do Plugin","Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.":"O Memos usa a configuração padrão do plugin seleccionado para obter memorandos diariamente. Padrão: 'Notas Diárias'.",Daily:"Diário"},eN={},tN={},nN={},rN={welcome:"欢迎使用 Thino ",ribbonIconTitle:"Thino",months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:[null,null,null,null,null,null,null,null,null,null,null,null],weekDays:["周日","周一","周二","周三","周四","周五","周六"],weekDaysShort:["周日","周一","周二","周三","周四","周五","周六"],to:"至",year:"年",month:"月","Basic Options":"基础选项","User name":"用户名","Set your user name here. 'Memos 😏' By default":"在这里设置你喜欢的用户名。 默认为 'Thino 😏'",'You can set target heading like "# Heading" to control data location':'你可以设置目标标题,例如 "# Heading" 来控制数据的位置',"Insert after heading":"在指定标题后插入 Thino","If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"若留空,则记录的 thino 内容在日记末尾插入,若填写标题,则记录的 thino 内容统一都记录在该标题下","Process Memos below":"解析指定标题后的 Thino","If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.":"若留空,则在Thino界面会显示所有thino记录内容,若填写标题,则Thino界面只显示该标题下的内容,写入其他位置的内容不显示","Save Memo button label":"保存按钮上的文本","The text shown on the save Memo button in the UI. 'NOTEIT' by default.":"在保存按钮上展示的文本。默认为 'NOTEIT'","Focus on editor when open memos":"自动聚焦到 Thino 输入框","Focus on editor when open memos. Focus by default.":"当打开 Thino 的时候自动聚焦到 Thino 输入框。默认开启","Open daily memos with open memos":"打开每日 Thino 的时候打开 Thino 界面","Open daily memos with open memos. Open by default.":"打开每日 Thino 的时候打开 Thino 界面。默认开启","Open Memos when obsidian opens":"当开启 Obsidian 的时候自动打开 Thino","When enable this, Memos will open when Obsidian opens. False by default.":"当开启该选项, Thino 会在 Obsidian 打开时自动打开。默认不开启。","Hide done tasks in Memo list":"在 Thino 列表中隐藏已完成 Thino","Hide all done tasks in Memo list. Show done tasks by default.":"在 Thino 列表中隐藏已完成 Thino。默认不开启","Advanced Options":"进阶选项","UI language for date":"针对日期展示的语言界面","Translates the date UI language. Only 'en' and 'zh' are available.":"对日期的不同翻译。目前只能选择 'en' 和 'zh'(未来会废置)","Default prefix when save thino in daily notes":"在日记中保存 Thino 时的默认前缀","Set the default prefix when create memo, 'List' by default.":"设置默认的前缀样式。默认为列表","Default insert date format":"插入日期附带的样式","Set the default date format when insert date by @, 'Tasks' by default.":"当使用 @ 来快速插入日期时,插入日期附带的样式,默认为 'Tasks' 样式","Default editor position on mobile":"在移动端上的默认编辑器位置","Set the default editor position on Mobile, 'Top' by default.":"设置在移动端上的默认编辑器位置,默认在顶部。","Use button to show editor on mobile":"当编辑器位置在底部时,用按钮来唤出编辑器","Set a float button to call editor on mobile. Only when editor located at the bottom works.":"设置一个浮动按钮来唤出编辑器。当在移动端上启用该选项才会生效","Show Time When Copy Results":"当复制检索结果时附带时间","Show time when you copy results, like 12:00. Copy time by default.":"在复制检索结果时附带其时间,例如 12:00 。默认开启","Show Date When Copy Results":"当复制检索结果时附带日期","Show date when you copy results, like [[2022-01-01]]. Copy date by default.":"在复制检索结果时附带其日期,例如 [[2022-01-01]]。默认开启","Add Blank Line Between Different Date":"在复制日期的时候加上空行","Add blank line when copy result with date. No blank line by default.":"在复制日期的时候在相邻的日期之间加上空行。默认无空行","Share Options":"分享选项","Share Memos Image Footer Start":"分享 Thino 图片的左边页脚","Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default":"你可以在这里设置你想要的任意文本,用 {ThinoNum} 来展示你记录的 thino 数量,{UsedDay} 来展示使用日期。默认为'{ThinoNum} Thino {UsedDay} Days'","Share Memos Image Footer End":"分享 Thino 图片的右边页脚","Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default":"你可以在这里设置你想要的任意文本,用 {UserName} 来展示你的用户名。默认为 '✍️ By {UserName}'","Save Shared Image To Folder For Mobile":"当在移动端上时保存图片到文件夹","Save image to folder for mobile. False by Default":"当在移动端上时,保存生成的图片到文件夹","Say Thank You":"感谢开发",Donate:"捐赠","If you like this plugin, consider donating to support continued development:":"如果你喜欢这个插件,而且也希望给我买鸡腿,那么可以考虑 Github 页面右边的 Sponsor~","File Name of Recycle Bin":"回收站的文件名","Set the filename for recycle bin. 'delete' By default":"给回收站设置一个文件名。默认为'delete'","File Name of Query File":"检索文件的文件名","Set the filename for query file. 'query' By default":"设置存放检索式的文件的文件名。默认为'query'","Use Tags In Vault":"使用在库内的所有标签","Use tags in vault rather than only in Memos. False by default.":"使用在库内的而不是 Thino 内的标签。默认关闭","Don't support web image yet, please input image path in vault":"暂不支持网络图片,请使用本地图片","Ready to convert image into background":"正在将图片转换为背景图",List:"列表",Task:"任务",Top:"顶部",Bottom:"底部",TAG:"标签",DAY:"天",QUERY:"检索式",EDIT:"编辑",PIN:"置顶",UNPIN:"取消置顶",DELETE:"删除","CONFIRM!":"确定删除","CREATE FILTER":"创建检索式",Filter:"筛选",Settings:"设置","Recycle bin":"回收站","About Me":"关于","Fetching data...":"获取数据中...","Here is No Memos.":"没有找到 Thino","Frequently Used Tags":"常用标签","What do you think now...":"你现在在想什么?",READ:"阅读",MARK:"引用",SHARE:"分享",SOURCE:"来源",RESTORE:"恢复",ARCHIVE:"归档","DELETE AT":"删除于","Noooop!":"啥都没有!","All Data is Loaded 🎉":"所有数据都加载好啦 🎉","Quick filter":"快速筛选",TYPE:"类型",LINKED:"有链接","NO TAGS":"无标签","HAS LINKS":"有超链接","HAS IMAGES":"有图片",INCLUDE:"包括",EXCLUDE:"排除",TEXT:"文本",IS:"是",AND:"和",OR:"或",LIST:"状态",ISNOT:"不是",SELECT:"选择","ADD FILTER TERMS":"添加检索条件",FILTER:"筛选器",TITLE:"标题","CREATE QUERY":"创建检索式","EDIT QUERY":"编辑检索式",MATCH:"匹配",TIMES:"次","Share Memo Image":"分享 Thino 图片","↗Click the button to save":"↗点击右上角的按钮来保存","Image is generating...":"图片正在生成中...","Image is loading...":"图片正在加载中...","😟 Cannot load image, image link maybe broken":"😟 无法加载图片,图片链接也许不存在","Loading...":"努力加载中...","Daily Memos":"每日 Thino","CANCEL EDIT":"取消编辑","LINK TO THE":"链接到","Mobile Options":"移动端选项","Experimental Options":"实验性选项","Background Image in Dark Theme":"深色主题的背景图","Background Image in Light Theme":"浅色主题的背景图",'Set background image in dark theme. Set something like "Daily/one.png"':'设置深色主题的背景图。请设置类似"Daily/one.png"的路径','Set background image in light theme. Set something like "Daily/one.png"':'设置浅色主题的背景图。请设置类似"Daily/one.png"的路径','Set default memo composition, you should use {TIME} as "HH:mm" and {CONTENT} as content. "{TIME} {CONTENT}" by default':'设置默认 Thino 组成,你必须要使用 {TIME} 作为 "HH:mm" 而且要设置 {CONTENT} 作为内容识别。默认情况下, Thino 基于 "{TIME} {CONTENT}" 识别',"Default Memo Composition":"【已弃置】默认 Thino 组成","Show Tasks Label":"展示任务标签","Show tasks label near the time text. False by default":"在 Thino 的时间旁展示任务标签。默认情况下不展示","Please Open Memos First":"请先打开 Thino","Comment it...":"评论...",DATE:"日期",OBSIDIAN_NLDATES_PLUGIN_NOT_ENABLED:"Obsidian Natrual DATES language 插件没启动",BEFORE:"在之前",AFTER:"在之后","Allow Comments On Memos":"允许在 Thino 上评论","You can comment on memos. False by default":"你可以在 Thino 点击图标进行评论了。默认不开启",Import:"导入","TITLE CANNOT BE NULL!":"标题不可以为空!","FILTER CANNOT BE NULL!":"筛选器不可以为空!","Comments In Original DailyNotes/Notes":"在原文件中进行评论","You should install Dataview Plugin ver 0.5.9 or later to use this feature.":"你需要安装 0.5.9 版本以上的 Dataview 插件来使用该功能","Open Memos Successfully":"成功打开 Thino ","Fetch Memos Error":"😭 Thino 获取失败","Copied to clipboard Successfully":"复制成功","Check if you opened Daily Notes Plugin Or Periodic Notes Plugin":"请检查你有没有开启日记插件或者 Periodic Notes 插件且启用了日记模式","Please finish the last filter setting first":"先完善上一个过滤器吧","Close Memos Successfully":"成功关闭 Thino ","Insert as Memo":"插入内容为 Thino","Insert file as memo content":"插入文件为 Thino","Image load failed":"有个图片加载失败了😟","Content cannot be empty":"内容不能为空呀","Unable to create new file.":"无法新建文件","Failed to fetch deleted memos: ":"无法获取已删除的 Thino :","RESTORE SUCCEED":"成功恢复 Thino","DELETE SUCCEED":"删除成功","Save Memo button icon":"保存按钮上的图标","The icon shown on the save Memo button in the UI.":"你可以设置保存按钮上的图标","Fetch Memos From Particular Notes":"从指定的文件中获取 Thino",'You can set any Dataview Query for memos to fetch it. All memos in those notes will show on list. "#memo" by default':'你可以给笔记设置指定检索式来让 Memos 可以索引到它。默认为 "#memo" ',"Allow Memos to Fetch Memo from Notes":"允许 Thino 从笔记中获取 Thino","Use Memos to manage all memos in your notes, not only in daily notes. False by default":"使用 Memos 来管理你笔记中的 Memos,不单只 DailyNotes 中的内容。默认为关闭","Always Show Memo Comments":"评论将总是可见","Always show memo comments on memos. False by default":"当开启后评论总是会在 Thino 的下方展示。默认为关闭","You didn't set folder for daily notes in both periodic-notes and daily-notes plugins.":"你在 Periodic Notes 插件和日记插件都没设置日记的所在文件夹","Please check your daily note plugin OR periodic notes plugin settings":"请检查你的日记插件和/或 Periodic Notes 插件的设置","Use which plugin's default configuration":"使用哪个插件的默认日记配置","Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.":"Thino 采用指定插件的默认配置来获取 Thino。默认为日记插件。",Daily:"日记插件","Always Show Leaf Sidebar on PC":"在 PC 上总是展示左侧栏","Show left sidebar on PC even when the leaf width is less than 875px. False by default.":"在 PC 上即使页面宽度小于 875px 时都展示左侧栏。默认为关闭","You didn't set format for daily notes in both periodic-notes and daily-notes plugins.":"你在 Periodic Notes 插件和日记插件都没设置日记的格式","fetch more":"加载更多","Search all settings":"搜索所有设置","Random Review":"随机回顾","ARCHIVED AT":"归档于","Failed to get memos from daily notes":"无法从日记中获取 Thino","Failed to delete memo":"无法删除 Thino","CTRL + ENTER to save":"CTRL + ENTER 保存","Started from":"开始于","Custom Background Image":"自定义背景图","Set custom background image.":"设置自定义背景图","Custom Memo Footer":"自定义 Thino 页脚","Set custom memo footer.":"设置自定义 Thino 页脚","Heatmap Color Scheme":"热力图颜色","Set different color scheme for heatmap.":"设置热力图的颜色","Enable Local Http Server":"启用本地 HTTP 服务器","Memos Http Server Port":"Thino HTTP 服务器端口","Set memos http server port to listen. '43999' by default":"设置 Thino HTTP 服务器端口。默认为 '43999'","Live-Preview Mode OR Source Mode.":"基于 Thino 的所见即所得模式(默认) 或者 源码模式,你可以自己选择适合自己的输入体验。","Default Editor Mode":"默认编辑器模式","Save type for Thino":"Thino 保存类型",DAILY:"日记",MULTI:"多文件",CANVAS:"画布",FILE:"单文件",ALL:"所有","Failed to create daily note, check if it exists.":"无法创建日记,请检查是否存在文件夹","Failed to create daily note. Please check if you created a folder for daily notes.":"无法创建日记,请检查是否存在日记文件夹","After you verify your account, please refresh this page.":"验证成功后,请刷新页面。",Verify:"去验证","Oops! You forget to verify insider account":"内测账户验证失败","If you have any questions, please contact us.":"如果你有任何问题,请联系我们。","Delete Thino Directly":"直接删除 Thino","When delete thino directly, it will not be moved to trash. False by default.":"当直接删除 Thino 时,不会移动到回收站。默认为关闭","Get activation code":"获取激活码","Input activation code here":"在这里输入激活码","Copy Thino id":"获取 Thino id","Activate Pro Version":"激活专业版","Please copy Thino id first":"请先获取 Thino id",'You can set folder name with file name like "folder/file"':'你可以设置例如 "folder/file" 的文件夹名+文件名的搭配来存放在指定文件夹','You can set folder name like "folder1/folder2/folder3" to create sub-folder':'你可以设置例如 "folder1/folder2/folder3" 的文件夹名来创建子文件夹',"Default save type":"默认保存类型",'Set the default save type for thino. "DAILY" by default':'设置 Thino 的默认保存类型。默认为 "日记"',"Enable opening thino globally":"全局唤醒 Thino","Enable opening thino globally. False by default.":"全局唤醒 Thino。默认为关闭","Key for opening thino globally":"全局唤醒 Thino 的快捷键","Set key for opening thino globally. CTRL + SHIFT + T by default.":"设置全局唤醒 Thino 的快捷键。默认为 CTRL + SHIFT + T","Sync Thino via PKMer":"通过 PKMer 同步 Thino",Unlink:"取消链接",Link:"链接","Connect to PKMer Sync, you can check it in ":"连接到 PKMer 同步,你可以在该链接中查看:","PKMer Sync":"PKMer 同步","Remove successfully":"移除成功",Deactivate:"取消激活",Remove:"移除","Confirm?":"确认?","Sync Status":"同步状态","Start or stop sync":"开始或停止同步","Stop sync successfully":"停止同步成功","Start sync successfully":"开始同步成功",Stop:"停止",Start:"开始","Show thino near mouse":"在鼠标附近展示 Thino","Query not found":"检索式未找到","Send to clipboard successfully":"发送到剪贴板成功","Thino - Failed to start HTTP server, please check the port is available.":"Thino - 启动 HTTP 服务器失败,请检查端口是否可用。","Thino - Started HTTP server on port":"Thino - 启动 HTTP 服务器成功,端口为","Thino - Terminated HTTP server":"Thino - 终止 HTTP 服务器","File not exist":"文件不存在","Thino not found":"Thino 未找到","File not found for the given thino path, is creating a new file":"未找到承载指定 Thino 的文件,正在创建新文件","Saved sync token successfully":"保存同步令牌成功","Failed to find daily notes folder":"未找到日记文件夹","Please install obsidian-hover-editor plugin first":"请先安装 obsidian-hover-editor 插件","Copied app id successfully":"复制 app id 成功","Please input token first":"请先输入 token","Please enable sync first":"请先启用同步","Init Failed":"初始化失败","Folder not found for the given thino path, is creating a new folder":"未找到承载指定 Thino 的文件夹,正在创建新文件夹","File not found for the given thino path":"未找到承载指定 Thino 的文件","Failed to read current daily note, check if it exists.":"无法读取日记文件,请检查是否存在","Verify successfully":"验证成功","Failed to verify":"验证失败","Failed to save":"保存失败","Failed to login, please login again":"登录已过期,请重新登录","COPY FAILED":"复制失败","COPY SUCCEED":"复制成功","Copy selected text":"复制选中文本","Copy thino":"复制",COPY:"复制","This is a pro feature, please upgrade to pro version to use it.":"这是专业版功能,请升级到专业版来使用它。","You can get pro version from: ":"你可以从这里获取专业版:",Save:"保存",Cancel:"取消","Thino Daily Target":"Thino 每日目标",Input:"输入","#Tag":"#标签","to create tag":"来创建标签","You have verified your account. Congrats!":"你已经验证了你的账户。恭喜!","Pro features":"专业版功能","Target Thino Count":"目标 Thino 数量",on:"在","Switch waterfall view":"切换瀑布流视图","Switch view":"切换视图","Switch list view":"切换列表视图","Set daily target":"设置每日目标","Thino Save To: ":"Thino 保存到:","Enter fullscreen mode":"进入全屏模式","Exit fullscreen mode":"退出全屏模式",words:"字词","Return To Home Page":"返回首页","Open thino in center window":"在中心窗口打开 thino","Open thino in float window":"在浮动窗口打开 thino","Open thino in right sidebar":"在右侧边栏打开 thino","Open thino in left sidebar":"在左侧边栏打开 thino","Show thino editor":"显示 thino 编辑器","Toggle minimal mode":"切换 Minimal 模式","Focus on thino editor":"聚焦到 thino 编辑器","ReSync web thinos to local":"重新同步 web 上的 thino 到本地","Sync local thinos to web":"同步本地的 thino 到 web","Show daily thino":"显示每日 thino 视图","Focus on search bar":"聚焦到搜索栏","Show-thino in popover(Hover editor)":"在弹出框中显示 thino","Center window":"中心窗口","Float window":"浮动窗口","Right sidebar":"右侧边栏","Left sidebar":"左侧边栏","Save thino type when sync local":"同步本地时保存的 thino 类型","Set the default save thino type when sync local, FILE by default.":"设置同步本地时保存的 thino 类型,默认为单文件。","Sync service":"同步服务","Pro verification status":"专业版激活状态","Live-preview":"所见即所得",Source:"源码",General:"通用",Thino:"Thino",Theme:"主题",Share:"分享",Interface:"界面",Advanced:"进阶","Global copy":"全局复制","Set the folder name":"设置文件夹名","Set the filename":"设置文件名","Set the filename for current location file":"设置当前位置文件的文件名","Switch calendar type":"切换日历类型",alphabetical:"标签名称(A-Z)",alphabeticalReverse:"标签名称(Z-A)",byCount:"按使用次数(从高到低)",byCountReverse:"按使用次数(从低到高)","Type here":"在这里输入",Today:"今天",Yesterday:"昨天","Last 7 days":"最近 7 天","Last 30 days":"最近 30 天","Last 90 days":"最近 90 天","Last 180 days":"最近 180 天","Last 365 days":"最近 365 天",Found:"被找到","Copy filtered thinos":"复制筛选的 thino","Bulk delete":"批量删除","Bulk archive":"批量归档","Bulk tag operation":"标签编辑","Bulk restore":"批量恢复","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.":"如果你禁用了日记插件,可能会导致 thino 无法被正确删除。请启用插件后再试一次。",Preview:"预览","Set and save":"设置并保存","Show day mark in thino list":"在 Thino 列中展示日期标记","Show day mark on the top of daily range thino. False by default.":"在 Thino 列中展示日期标记。默认为关闭","Click to expand or fold, Cmd+Click to show all thinos of the day":"点击展开或折叠,Cmd+点击展示当天所有 thino","You can buy a license from":"你可以从这里购买许可证","No thinos in range":"该范围内没有 thino",Month:"月视图",Week:"周视图",Day:"日视图",Agenda:"日程视图",Tomorrow:"明天",Previous:"往前",Next:"往后","Search all columns...":"搜索所有的列...","Basic Info":"基础信息","Additional Info":"附加信息","Created At":"创建于",Content:"内容","Thino Type":"Thino 类型","Source Type":"来源类型","Row status":"归档状态",Path:"路径","Pinned Status":"置顶状态",Table:"表格",Chat:"聊天",Moments:"动态",Waterfall:"瀑布流",Calendar:"日历","Go to page":"跳转到页",Page:"页",Show:"展示",rows:"行","Temp Filter":"临时筛选器","Set the heading for saving thino":"设置保存 Thino 的标题","# Heading":"# 标题","Open link directly in Thino view":"Thino 视图内直接打开双链","Day mark range":"日期标记范围","Set the range of day mark. Day by default.":"设置日期标记的范围,默认为天","Thino is locked":"Thino 已锁定","Please unlock Thino by input password":"请输入密码来解锁 Thino","Auto Download Image":"自动下载图片","Auto download image when save to thino. 'false' by default":"当保存到 Thino 时自动下载图片。默认为 'false'","Thino Http IP Type":"Thino HTTP 服务器 IP 类型","Set Thino http server ip to listen. 'localhost' by default":"设置 Thino HTTP 服务器 IP。默认为 'localhost'","Password to lock Thino":"锁定 Thino 的密码",Unlock:"解锁",Locked:"已锁定","Password is incorrect":"密码错误",Lock:"锁定","Need password to unlock Thino":"需要密码来解锁 Thino","You have not set a password or enable this feature yet":"你还没有设置密码或者启用该功能",Password:"密码","Password for Thino":"Thino 的密码","Please input your password to change password settings":"请输入原来的密码来修改密码设置","Please input your password":"请输入密码","Lock thino":"锁定 Thino",date:"日期",time:"时间",event:"事件","Add tag position":"添加标签位置","Set the position of the tag when adding tag automatically":"设置自动添加标签的位置","Add tag automatically":"自动添加标签","Add tag to the end or beginning of the thino content when creating a thino and filtering tags":"在创建 Thino 和筛选标签时,将标签添加到 Thino 内容的末尾或开头","Add tag with new line":"添加标签时换行","Add tag with new line when adding tag automatically":"自动添加标签时换行","Input to select more tags":"输入来选择更多标签","Tag Bulk Edit":"标签批量编辑","Exist Tags":"已有标签","Selected Tags":"已选标签","Click to remove exist tag":"点击移除已有标签","Click to remove selected tag":"点击移除已选标签","Select tags":"选择标签","Input to select exist tag":"输入来选择已有标签",Beginning:"开头",End:"末尾","Chat view style":"聊天视图样式","Set the style of chat view":"设置聊天视图的样式","Background image for moments view":"动态视图的背景图","Set the background image for moments view":"设置动态视图的背景图","Icon for moments/chat view/share image":"动态/聊天视图/分享图的头像","Set the icon for moments/chat view/share image":"设置动态/聊天视图/分享图的头像","Quote for moments view/share image":"动态视图/分享图的个性签名","Set the quote for moments view/share image":"设置动态视图/分享图的个性签名","Theme for Thino":"Thino 主题","Set the theme for Thino":"设置 Thino 的主题","Interface Details":"界面详情","Task amount":"任务数量","Thino status":"Thino 状态","Used tags":"使用的标签","Used days":"使用的天数","Most active day":"最活跃的一天","Most active hour":"最活跃的一小时","Thino amount":"Thino 数量","No content to generate.":"没有内容可以生成。","Image generated successfully.":"图片生成成功。","Failed to generate image.":"图片生成失败。","Share filtered thinos as image":"分享筛选的 Thino 为图片","Latest version":"最新版本","Previous version":"之前版本","Thino update info":"Thino 更新信息","Debug info copied to clipboard":"调试信息已复制到剪贴板","Copy debug info":"复制调试信息","Failed to load changelog":"无法加载更新日志","View online":"在线查看",ChangeLog:"更新日志","Please open thino first":"请先打开 Thino","Insert editor":"插入编辑器","Please set different save locations for multi-file settings in Thino. The diary folder overlaps with the multi-file save location, or there is a risk of it being read repeatedly.":"请在 Thino 设置中为多文件设置不同的路径,日记文件夹与多文件保存路径重复,或者存在被重复读取可能","Default time prefix for thino in daily notes":"日记中 Thino 的默认时间前缀","Set default time prefix for thino in daily notes.":"设置日记中 Thino 的默认时间前缀","Save image successfully":"保存图片成功","User quote":"用户签名","Set user quote for thino":"设置用户签名","User icon":"用户头像","Set user icon for thino":"设置用户头像","User info":"用户信息","Copy filtered results":"复制筛选结果","Share image":"分享图片",Default:"默认",Gray:"灰色",Grass:"草绿",Flame:"火焰",Olive:"橄榄",Ice:"冰",Magenta:"品红","Daily notes":"日记相关",Editor:"编辑器","Append/prepend text when share to Thino":"分享到 Thino 时添加/前置文本","Append text when share to Thino":"分享到 Thino 时添加文本","Prepend text when share to Thino":"分享到 Thino 时前置文本","Add newline when append/prepend text":"添加换行符",Prepend:"前置",Append:"后置",Both:"两者",None:"无","Hide pinned group":"隐藏置顶分组","Hide pinned group in thino list. False by default.":"隐藏置顶的 Thino 分组。默认为关闭","Set the heading for the task type of thino, by default the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.":"设置 Thino 任务类型的标题,如果提供了标题,所有记录的 Thino 内容将统一归类到该标题下。","Different insert target for different type":"不同类型的 Thino 有不同的插入目标","Toggle this to set different insert target for different type of thino, like task or list type of thino":"切换此选项以为不同类型的 Thino 设置不同的插入目标,例如任务或列表类型的 Thino","Set process target":"设置处理目标","You can set whole diary or only part of it":"你可以设置整个日记或者其中的一部分",Custom:"自定义","Whole diary":"整个日记","Set thino insert place":"设置 Thino 插入位置","Set where to insert thino content":"设置 Thino 内容插入位置","End of the diary":"日记的末尾","Custom location":"自定义位置"},aN={},oN={ar:R4,cs:B4,da:_4,de:H4,en:xI,"en-gb":Y4,es:z4,fr:U4,hi:V4,id:Z4,it:W4,ja:$4,ko:G4,nl:q4,nn:J4,pl:K4,pt:Q4,"pt-br":X4,ro:eN,ru:tN,tr:nN,"zh-cn":rN,"zh-tw":aN},zb=oN[C.moment.locale()];function N(e){const t=zb&&zb[e]||xI[e];return t===null?t:t||e}const iN=/```([\s\S]*?)```/g,sN=/\*\*(.+?)\*\*/g,lN=/\*(.+?)\*/g,uN=/\[ \] /g,cN=/\[.{1}\] /g,dN=/^[*-]/g,fN=/(\d+)\. /g,Ub=/\[\[([^\]]+)\]\]/g,fw=/\[([^\]]+)\]\((([^\]]+).md)\)/g,hN=(e,t)=>{const n=e.replace(iN,"
$1
").replace(dN,"").replace(fN,"$1.").replace(uN,"").replace(cN,"").replace(sN,"$1").replace(lN,"$1").replace(/<br>/g,"

").replace(/&/g,"&");let r=n;if(t){if(Ub.test(n)){const a=n.match(Ub);for(let o=0;o{const{metadataCache:n}=Ee.getState().dailyNotesState.app;return n.getFirstLinkpathDest(decodeURIComponent(e),"")instanceof C.TFile?t?`${t}`:`${e}`:t?`${t}`:`${e}`},pN=e=>{var t;return(t=/\[\[([^\]]+)\]\]/g.exec(e))==null?void 0:t[1]},mN=e=>{var t;return(t=fw.exec(e))==null?void 0:t[1]},gN=e=>{var t;return(t=/\[([^\]]+)\]\((([^\]]+).md)\)/g.exec(e))==null?void 0:t[3]},Vb=e=>{const t=document.createElement("div");return t.className="memo-content-text",t.innerHTML=e,t.innerText},yN=e=>e.replace(/\n/g,"
"),vN=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},Zb="mobile-show-sidebar",MI=200,Mi=3600*24*1e3,Fn=/\s#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/g,mr=/(

|
)#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/g,$n=/^#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/gu,Bu=/(\s|:|\(|>|^)((http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))/g,wN=/\[([\s\S]*?)\]\(([\s\S]*?)\)/gu,_u=/([^\s<\\*>'(]+\.(jpeg|jpg|gif|png|svg))(\]\])?(\))?/g,Il=/\[@(.+?)\]\((.+?)\)/g,bN=/^(-|\*|\d\.)\s(\[.\]\s)?(\d{1,2}:\d{2}(:\d{2})?)\s(.*)$/g,tp=[{title:"DAILY",icon:"list"},{title:"CANVAS",icon:"layout-dashboard"},{title:"MULTI",icon:"file-text"},{title:"FILE",icon:"edit"}];var hw;(e=>{function t(){return parseInt(C.moment().format("x"))}e.getNowTimeStamp=t;function n(H){const Y=/'’A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,U=/\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source,J=/[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source,Q=new RegExp([`(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${Y}])+`,U,J].join("|"),"g");return(H.match(Q)||[]).length}e.getWordCount=n;function r(H){a1()&&(H!=null&&H.EnabledLocationList.some(Y=>Y.value==="DAILY"))&&(H!=null&&H.EnabledLocationList.some(Y=>Y.value==="MULTI"))&&o1().contains(H==null?void 0:H.MemoOtherSaveLocation.MemoDefaultMultiFilePath)&&new C.Notice(N("Please set different save locations for multi-file settings in Thino. The diary folder overlaps with the multi-file save location, or there is a risk of it being read repeatedly."),5e3)}e.checkDailyInMulti=r;function a(){const H=navigator.userAgent;let Y="Unknown";return H.indexOf("Win")!=-1?Y="Windows":H.indexOf("Mac")!=-1?Y="MacOS":H.indexOf("Linux")!=-1&&(Y="Linux"),Y}e.getOSVersion=a;function o(H){return typeof H=="string"&&(H=H.replaceAll("-","/")),new Date(H).getTime()}e.getTimeStampByDate=o;function s(H){const Y=new Date(o(H));return new Date(Y.getFullYear(),Y.getMonth(),Y.getDate()).getTime()}e.getDateStampByDate=s;function c(H){const Y=new Date(o(H)),U=Y.getFullYear(),J=Y.getMonth()+1,Q=Y.getDate();return`${U}/${J}/${Q}`}e.getDateString=c;function d(H){const Y=new Date(o(H)),U=Y.getHours(),J=Y.getMinutes(),Q=U<10?"0"+U:U,le=J<10?"0"+J:J;return`${Q}:${le}`}e.getTimeString=d;function p(H){const Y=new Date(o(H)),U=Y.getFullYear(),J=Y.getMonth()+1,Q=Y.getDate(),le=Y.getHours(),pe=Y.getMinutes(),ie=Y.getSeconds(),se=J<10?"0"+J:J,fe=Q<10?"0"+Q:Q,oe=le<10?"0"+le:le,we=pe<10?"0"+pe:pe,Z=ie<10?"0"+ie:ie;return`${U}/${se}/${fe} ${oe}:${we}:${Z}`}e.getDateTimeString=p;function m(H){return Array.from(new Set(H))}e.dedupe=m;function g(H){const Y=new Set,U=[];for(const J of H)Y.has(J.id)||(Y.add(J.id),U.push(J));return U}e.dedupeObjectWithId=g;function v(H,Y){let U=null;return()=>{U&&clearTimeout(U),U=setTimeout(H,Y)}}e.debounce=v;function D(H,Y,U=!1,J){let Q=null,le=!1;function pe(...ie){if(Q&&clearTimeout(Q),U&&!le){const se=H.apply(this,ie);J&&typeof J=="function"&&J(se),le=!0}else Q=setTimeout(()=>{const se=H.apply(this,ie);J&&typeof J=="function"&&J(se),le=!1,Q=null},Y)}return pe.cancel=function(){Q&&clearTimeout(Q),Q=null,le=!1},pe}e.debouncePlus=D;function S(H,Y){let U=!0;return()=>{if(!U)return!1;U=!1,setTimeout(()=>{H(),U=!0},Y)}}e.throttle=S;function T(H){const Y=[],U=Object.keys(H).sort();for(const J of U){const Q=H[J];Q&&(typeof Q=="object"?Y.push(...T(Q).split("&")):Y.push(`${J}=${Q}`))}return Y.join("&")}e.transformObjectToParamsString=T;function E(H){const Y={},U=H.split("&");for(const J of U){const[Q,le]=J.split("=");Q&&le&&(Y[Q]=le)}return Y}e.transformParamsStringToObject=E;function O(H){if(!H)return{};const Y={},U=Object.keys(H).sort();for(const J of U){const Q=H[J];if(typeof Q=="object"){const le=O(JSON.parse(JSON.stringify(Q)));le&&Object.keys(le).length>0&&(Y[J]=le)}else Q&&(Y[J]=Q)}return Y}e.filterObjectNullKeys=O;async function k(H){if(navigator.clipboard&&navigator.clipboard.writeText)try{await navigator.clipboard.writeText(H)}catch(Y){console.warn("Copy to clipboard failed.",Y)}else console.warn("Copy to clipboard failed, methods not supports.")}e.copyTextToClipboard=k;function j(H){return new Promise(Y=>{const U=new Image;U.onload=()=>{const{width:J,height:Q}=U;J>0&&Q>0?Y({width:J,height:Q}):Y({width:0,height:0})},U.onerror=()=>{Y({width:0,height:0})},U.className="hidden",U.src=H,document.body.appendChild(U),U.remove()})}e.getImageSize=j;async function F(H){var Q,le,pe,ie;let Y;const J=app.plugins.getPlugin("obsidian-memos").settings.UseDailyOrPeriodic==="Daily";try{return!J&&((ie=(pe=(le=(Q=window.app.plugins)==null?void 0:Q.getPlugin("periodic-notes"))==null?void 0:le.calendarSetManager)==null?void 0:pe.getActiveConfig("day"))!=null&&ie.enabled)?(Y=await window.app.plugins.getPlugin("periodic-notes").createPeriodicNote("day",H),Y):(Y=await CI(H),Y)}catch(se){return console.error(se),new C.Notice(N("Failed to create daily note. Please check if you created a folder for daily notes.")),null}}e.createDailyNoteCheck=F;function B(H){const Y=[];let U=0;for(;U").map(a=>`

${a!==""?a:"
"}

`).join(""),e=hN(e,t),e=e.replace(Fn,"#$1").replace(mr,"

#$2").replace(Bu,"$1$2").replace(wN,"$1").replace(Il,"$1").replace(/\^\S{6}/g,"");const n=document.createElement("div");n.innerHTML=e;for(let a=0;a{const n=window.atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r);for(let o=0;o{const s=Ue.getTimeStampByDate(a.createdAt),c=Ue.getTimeStampByDate(o.createdAt);return s===c?o.id.localeCompare(a.id):Ue.getTimeStampByDate(o.createdAt)-Ue.getTimeStampByDate(a.createdAt)}),r=Ue.dedupeObjectWithId(n);return{...e,memos:[...r]}}case"SET_COMMENT_MEMOS":{const n=Ue.dedupeObjectWithId(t.payload.commentMemos.sort((r,a)=>Ue.getTimeStampByDate(a.createdAt)-Ue.getTimeStampByDate(r.createdAt)));return{...e,commentMemos:[...n]}}case"SET_TAGS":return{...e,tags:t.payload.tags,tagsNum:t.payload.tagsNum};case"INSERT_MEMO":{const n=Ue.dedupeObjectWithId([t.payload.memo,...e.memos].sort((r,a)=>Ue.getTimeStampByDate(a.createdAt)-Ue.getTimeStampByDate(r.createdAt)));return{...e,memos:n}}case"INSERT_COMMENT_MEMO":{const n=Ue.dedupeObjectWithId([t.payload.memo,...e.commentMemos].sort((r,a)=>Ue.getTimeStampByDate(a.createdAt)-Ue.getTimeStampByDate(r.createdAt)));return{...e,commentMemos:[...n]}}case"DELETE_MEMO_BY_ID":return{...e,memos:[...e.memos].filter(n=>n.id!==t.payload.id)};case"DELETE_MEMO_BY_ID_BATCH":{const n=[...e.memos];return t.payload.ids.forEach(r=>{n.splice(n.findIndex(a=>a.id===r),1)}),{...e,memos:[...n]}}case"CLEAR_MEMOS":return{...NI};case"EDIT_MEMO":{const n=e.memos.map(r=>r.id===t.payload.id?{...r,...t.payload}:r);return{...e,memos:[...n]}}case"EDIT_MEMO_PATH":{const n=e.memos.map(r=>r.path===t.payload.path?{...r,...t.payload}:r);return{...e,memos:[...n]}}case"UPDATE_MEMO_BATCH":{const n=e.memos.filter(a=>a.path!==t.payload.path),r=Ue.dedupeObjectWithId([...t.payload.memos,...n].sort((a,o)=>Ue.getTimeStampByDate(o.createdAt)-Ue.getTimeStampByDate(a.createdAt)));return{...e,memos:[...r]}}case"ARCHIVE_MEMO_BY_ID":{const n=e.memos.map(r=>r.id===t.payload.id?{...r,...t.payload}:r);return{...e,memos:[...n]}}case"ARCHIVE_MEMO_BY_ID_BULK":{const n=e.memos.map(r=>t.payload.some(a=>a.id===r.id)?{...r,...t.payload.filter(a=>a.id===r.id)[0]}:r);return{...e,memos:[...n]}}case"UNARCHIVE_MEMO_BY_ID":{const n=e.memos.map(r=>r.id===t.payload.id?{...r,...t.payload}:r);return{...e,memos:[...n]}}case"PIN_MEMO":{const n=e.memos.map(r=>r.id===t.payload.id?{...r,pinned:t.payload.pinned}:r);return{...e,memos:[...n]}}case"EDIT_COMMENT_MEMO":{const n=e.commentMemos.map(r=>r.id===t.payload.id?{...r,...t.payload}:r);return{...e,commentMemos:[...n]}}default:return e}}const NI={memos:[],commentMemos:[],tags:[],tagsNum:{}};function IN(e,t){switch(t.type){case"SIGN_IN":return{user:t.payload.user};case"SIGN_OUT":return{user:null};default:return e}}const TN={user:null};function EN(e,t){switch(t.type){case"SET_QUERIES":{const n=Ue.dedupeObjectWithId(t.payload.queries.sort((r,a)=>Ue.getTimeStampByDate(a.createdAt)-Ue.getTimeStampByDate(r.createdAt)).sort((r,a)=>Ue.getTimeStampByDate(a.pinnedAt??0)-Ue.getTimeStampByDate(r.pinnedAt??0)));return{...e,queries:n}}case"INSERT_QUERY":{const n=Ue.dedupeObjectWithId([t.payload.query,...e.queries].sort((r,a)=>Ue.getTimeStampByDate(a.createdAt)-Ue.getTimeStampByDate(r.createdAt)));return{...e,queries:n}}case"DELETE_QUERY_BY_ID":return{...e,queries:[...e.queries].filter(n=>n.id!==t.payload.id)};case"UPDATE_QUERY":{const n=e.queries.map(r=>r.id===t.payload.id?{...r,...t.payload}:r);return{...e,queries:n}}default:return e}}const CN={queries:[]};function xN(e,t){var n,r,a,o;switch(t.type){case"SET_DAILY_NOTES":return{...e,dailyNotes:t.payload.dailyNotes};case"SET_APP":return e.app?{...e}:{...e,app:t.payload.app};case"SET_PLUGIN":return e.plugin?{...e}:{...e,plugin:t.payload.plugin};case"SET_EDITOR":return e.editor?{...e}:{...e,editor:t.payload.editor};case"SET_SETTINGS":return e.settings&&e.settings===t.payload.settings?{...e}:{...e,settings:t.payload.settings};case"SET_VIEW":return e.view&&((r=(n=e.view)==null?void 0:n.leaf)==null?void 0:r.id)===((o=(a=t.payload.view)==null?void 0:a.leaf)==null?void 0:o.id)?{...e}:{...e,view:t.payload.view};case"CLEAR_VIEW":return e.view&&e.view.unload(),{...e,view:null};case"CLEAR_FILES":return{...e,dailyNotes:null};case"SET_VERIFY_STATE":return{...e,verifyState:t.payload.verifyState};default:return e}}const MN={dailyNotes:null,app:null,view:null,settings:null,editor:null,plugin:null,verifyState:null},Ee=s4({globalState:u4,locationState:fI,memoState:NI,userState:TN,queryState:CN,dailyNotesState:MN},i4({globalState:l4,locationState:c4,memoState:SN,userState:IN,queryState:EN,dailyNotesState:xN})),mt=A.createContext(Ee.getState());String.prototype.replaceAll||(String.prototype.replaceAll=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object regexp]"?this.replace(e,t):this.replace(new RegExp(e,"g"),t)});class NN{constructor(){me(this,"initialized",!1)}getState(){return Ee.getState().dailyNotesState}setApp(t){return Ee.dispatch({type:"SET_APP",payload:{app:t}}),t}setPlugin(t){return Ee.dispatch({type:"SET_PLUGIN",payload:{plugin:t}}),t}setSettings(t){return Ee.dispatch({type:"SET_SETTINGS",payload:{settings:t}}),this.initialized||(this.initialized=!0),t}setView(t){return Ee.dispatch({type:"SET_VIEW",payload:{view:t}}),t}setEditor(t){return Ee.dispatch({type:"SET_EDITOR",payload:{editor:t}}),t}async updateDailyNotes(t,n){const r=this.getState().dailyNotes,a=Wh(t,"day");return n?delete r[`day-${a.format("YYYY-MM-DD")}T00:00:00+08:00}`]:r[`day-${a.format("YYYY-MM-DD")}T00:00:00+08:00}`]=t,Ee.dispatch({type:"SET_DAILY_NOTES",payload:{dailyNotes:r}}),r}setVerifyState(t){return Ee.dispatch({type:"SET_VERIFY_STATE",payload:{verifyState:t}}),t}async fechLocalDailyNotes(){try{const t=bs();return Ee.dispatch({type:"SET_DAILY_NOTES",payload:{dailyNotes:t}}),t}catch(t){console.error(t)}}}const Xe=new NN;var Kn;(e=>{function t(o){const s={};for(const c of o)try{const d=localStorage.getItem(c);if(d!==null){const p=JSON.parse(d);s[c]=p}}catch(d){console.error("Get storage failed in ",c,d)}return s}e.get=t;function n(o){for(const s in o)try{const c=JSON.stringify(o[s]);localStorage.setItem(s,c)}catch(c){console.error("Save storage failed in ",s,c)}}e.set=n;function r(o){for(const s of o)try{localStorage.removeItem(s)}catch(c){console.error("Remove storage failed in ",s,c)}}e.remove=r;function a(){var s;const o=document.createElement("iframe");o.style.display="none",document.body.appendChild(o),(s=o.contentWindow)==null||s.localStorage.setItem("t",Date.now().toString()),o.remove()}e.emitStorageChangedEvent=a})(Kn||(Kn={}));class kN{constructor(){me(this,"getState",()=>Ee.getState().globalState);me(this,"setEditMemoId",t=>{Ee.dispatch({type:"SET_EDIT_MEMO_ID",payload:{editMemoId:t}})});me(this,"setRefresh",t=>{Ee.dispatch({type:"SET_REFRESH",payload:{refresh:t}})});me(this,"setCommentMemoId",t=>{Ee.dispatch({type:"SET_COMMENT_MEMO_ID",payload:{commentMemoId:t}})});me(this,"setMarkMemoId",t=>{Ee.dispatch({type:"SET_MARK_MEMO_ID",payload:{markMemoId:t}})});me(this,"setLoaded",t=>{Ee.dispatch({type:"SET_LOADED",payload:{loaded:t}})});me(this,"setGlobalEditorShown",t=>{Ee.dispatch({type:"SET_GLOBAL_EDITOR_SHOWN",payload:{globalEditorShown:t}})});me(this,"setIsMobileView",t=>{Ee.dispatch({type:"SET_MOBILE_VIEW",payload:{isMobileView:t}})});me(this,"setChangedByMemos",t=>{Ee.dispatch({type:"SET_CHANGED_BY_MEMOS",payload:{changedByMemos:t}})});me(this,"setShowSiderbarInMobileView",t=>{Ee.dispatch({type:"SET_SHOW_SIDEBAR_IN_MOBILE_VIEW",payload:{showSiderbarInMobileView:t}})});me(this,"setAppSetting",t=>{Ee.dispatch({type:"SET_APP_SETTING",payload:t}),Kn.set(t)});me(this,"setMemoListView",t=>{Ee.dispatch({type:"SET_MEMO_LIST_VIEW",payload:{memoListView:t}})});me(this,"setInstance",(t,n)=>{Ee.dispatch({type:"SET_INSTANCE",payload:{id:t,instance:n}})});me(this,"setLocked",t=>{Ee.dispatch({type:"SET_LOCKED",payload:{locked:t}})});me(this,"setPluginManifest",t=>{Ee.dispatch({type:"SET_MEMO_PLUGIN_MANIFEST",payload:{manifest:t}})});const t=Kn.get(["shouldSplitMemoWord","shouldHideImageUrl","shouldUseMarkdownParser","useTinyUndoHistoryCache"]),n={shouldSplitMemoWord:t.shouldSplitMemoWord||!0,shouldHideImageUrl:t.shouldHideImageUrl||!0,shouldUseMarkdownParser:t.shouldUseMarkdownParser||!0,useTinyUndoHistoryCache:t.useTinyUndoHistoryCache||!1};this.setAppSetting(n)}}const Qe=new kN;class AN{constructor(){me(this,"updateStateWithLocation",()=>{const{pathname:t,search:n,hash:r}=window.location,a=new URLSearchParams(n),o={pathname:"/",hash:"",query:{tag:"",duration:null,text:"",type:"",filter:""}};o.query.tag=a.get("tag")||"",o.query.type=a.get("type")??"",o.query.text=a.get("text")??"",o.query.filter=a.get("filter")??"";const s=parseInt(a.get("from")??"0"),c=parseInt(a.get("to")??"0");c>s&&c!==0&&(o.query.duration={from:s,to:c}),o.hash=r,o.pathname=this.getValidPathname(t),Ee.dispatch({type:"SET_LOCATION",payload:o})});me(this,"getState",()=>Ee.getState().locationState);me(this,"clearQuery",()=>{Ee.dispatch({type:"SET_QUERY",payload:{tag:"",duration:null,text:"",type:"",filter:""}})});me(this,"setQuery",t=>{Ee.dispatch({type:"SET_QUERY",payload:t})});me(this,"reloadApp",()=>{Ee.dispatch({type:"RELOAD"})});me(this,"setHash",t=>{Ee.dispatch({type:"SET_HASH",payload:{hash:t}})});me(this,"setPathname",t=>{Ee.dispatch({type:"SET_PATHNAME",payload:{pathname:t}})});me(this,"pushHistory",t=>{Ee.dispatch({type:"SET_PATHNAME",payload:{pathname:t}})});me(this,"replaceHistory",t=>{Ee.dispatch({type:"SET_PATHNAME",payload:{pathname:t}})});me(this,"setMemoTypeQuery",(t="")=>{Ee.dispatch({type:"SET_TYPE",payload:{type:t}})});me(this,"setMemoFilter",t=>{Ee.dispatch({type:"SET_QUERY_FILTER",payload:t})});me(this,"setTextQuery",t=>{Ee.dispatch({type:"SET_TEXT",payload:{text:t}})});me(this,"setTimeQuery",t=>{Ee.dispatch({type:"SET_DURATION_QUERY",payload:{duration:t}})});me(this,"setTagQuery",t=>{Ee.dispatch({type:"SET_TAG_QUERY",payload:{tag:t}})});me(this,"setFromAndToQuery",(t,n)=>{Ee.dispatch({type:"SET_DURATION_QUERY",payload:{duration:{from:t,to:n}}})});me(this,"getValidPathname",t=>["/","/homeboard","/recycle","/setting"].includes(t)?t:"/");this.updateStateWithLocation(),window.onpopstate=()=>{this.updateStateWithLocation()}}}const He=new AN,Cu=e=>`${e.vault.configDir}/query.json`,kI=async(e,t)=>{try{return await e.vault.adapter.read(t),!0}catch(n){return console.error(n),!1}},_d=async e=>(await kI(e,Cu(e))||await AI(e),JSON.parse(await e.vault.adapter.read(Cu(e))).queries||[]),Ep=async(e,t)=>{await e.vault.adapter.write(Cu(e),JSON.stringify({queries:t},null,2))},AI=async e=>{const t=Qe.getState().manifest,n=e.plugins.getPlugin(t.id||"obsidian-memos").settings,r=e.metadataCache.getFirstLinkpathDest(n.QueryFileName,"");if(!r)await e.vault.adapter.write(Cu(e),JSON.stringify({queries:[]},null,2));else{const o=(await e.vault.read(r)).split(` `);o.length===0&&await e.vault.adapter.write(Cu(e),JSON.stringify({queries:[]},null,2));const s=[];for(let c=0;c{const{app:e}=Ee.getState().dailyNotesState;return await kI(e,Cu(e))||await AI(e),await _d(e)||[]},ON=(e,t)=>({createdAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),id:e,pinnedAt:"",querystring:t,title:N("Temp Filter"),updatedAt:C.moment().format("YYYY/MM/DD HH:mm:ss"),userId:"Thino"}),PN=async(e,t)=>{const n=await _d(Ee.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 Ep(Ee.getState().dailyNotesState.app,n),r};var iy={exports:{}};iy.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.",s="Expected a function",c="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",p=500,m="__lodash_placeholder__",g=1,v=2,D=4,S=1,T=2,E=1,O=2,k=4,j=8,F=16,B=32,R=64,z=128,H=256,Y=512,U=30,J="...",Q=800,le=16,pe=1,ie=2,se=3,fe=1/0,oe=9007199254740991,we=17976931348623157e292,Z=NaN,G=4294967295,te=G-1,ge=G>>>1,Ie=[["ary",z],["bind",E],["bindKey",O],["curry",j],["curryRight",F],["flip",Y],["partial",B],["partialRight",R],["rearg",H]],De="[object Arguments]",ke="[object Array]",Ye="[object AsyncFunction]",Re="[object Boolean]",rt="[object Date]",Ht="[object DOMException]",Se="[object Error]",Ze="[object Function]",Ke="[object GeneratorFunction]",Je="[object Map]",lt="[object Number]",ft="[object Null]",Dt="[object Object]",Ct="[object Promise]",un="[object Proxy]",Ft="[object RegExp]",Ot="[object Set]",an="[object String]",wn="[object Symbol]",Tn="[object Undefined]",vr="[object WeakMap]",Ia="[object WeakSet]",tr="[object ArrayBuffer]",Nr="[object DataView]",Is="[object Float32Array]",ho="[object Float64Array]",po="[object Int8Array]",Nl="[object Int16Array]",Pi="[object Int32Array]",ji="[object Uint8Array]",Ts="[object Uint8ClampedArray]",Ho="[object Uint16Array]",Li="[object Uint32Array]",W=/\b__p \+= '';/g,re=/\b(__p \+=) '' \+/g,ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,je=/[&<>"']/g,_e=RegExp(xe.source),ze=RegExp(je.source),gt=/<%-([\s\S]+?)%>/g,Vt=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,bn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,na=/^\w*$/,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wr=/[\\^$.*+?()[\]{}|]/g,ra=RegExp(wr.source),kl=/^\s+/,Qt=/\s/,Ta=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ea=/\{\n\/\* \[wrapped with (.+)\] \*/,Ca=/,? & /,Yo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zo=/[()=,{}\[\]\/\s]/,wv=/\\(\\)?/g,Ri=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,of=/\w*$/,Gp=/^[-+]0x[0-9a-f]+$/i,bv=/^0b[01]+$/i,qp=/^\[object .+?Constructor\]$/,Jp=/^0o[0-7]+$/i,Kp=/^(?:0|[1-9]\d*)$/,Qp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,zu=/($^)/,Dv=/['\n\r\u2028\u2029\\]/g,on="\\ud800-\\udfff",Sv="\\u0300-\\u036f",sf="\\ufe20-\\ufe2f",Xp="\\u20d0-\\u20ff",Al=Sv+sf+Xp,em="\\u2700-\\u27bf",lf="a-z\\xdf-\\xf6\\xf8-\\xff",Uu="\\xac\\xb1\\xd7\\xf7",Va="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Iv="\\u2000-\\u206f",xa=" \\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",tm="A-Z\\xc0-\\xd6\\xd8-\\xde",nm="\\ufe0e\\ufe0f",rm=Uu+Va+Iv+xa,Es="['’]",Vu="["+on+"]",Cs="["+rm+"]",Bi="["+Al+"]",am="\\d+",Tv="["+em+"]",Zu="["+lf+"]",uf="[^"+on+rm+am+em+lf+tm+"]",Fl="\\ud83c[\\udffb-\\udfff]",Ol="(?:"+Bi+"|"+Fl+")",om="[^"+on+"]",Pl="(?:\\ud83c[\\udde6-\\uddff]){2}",Yt="[\\ud800-\\udbff][\\udc00-\\udfff]",_i="["+tm+"]",cf="\\u200d",Wu="(?:"+Zu+"|"+uf+")",im="(?:"+_i+"|"+uf+")",df="(?:"+Es+"(?:d|ll|m|re|s|t|ve))?",ff="(?:"+Es+"(?:D|LL|M|RE|S|T|VE))?",$u=Ol+"?",jl="["+nm+"]?",Uo="(?:"+cf+"(?:"+[om,Pl,Yt].join("|")+")"+jl+$u+")*",Vo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Zo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",xs=jl+$u+Uo,Ll="(?:"+[Tv,Pl,Yt].join("|")+")"+xs,Wo="(?:"+[om+Bi+"?",Bi,Pl,Yt,Vu].join("|")+")",Ev=RegExp(Es,"g"),sm=RegExp(Bi,"g"),Hi=RegExp(Fl+"(?="+Fl+")|"+Wo+xs,"g"),Cv=RegExp([_i+"?"+Zu+"+"+df+"(?="+[Cs,_i,"$"].join("|")+")",im+"+"+ff+"(?="+[Cs,_i+Wu,"$"].join("|")+")",_i+"?"+Wu+"+"+df,_i+"+"+ff,Zo,Vo,am,Ll].join("|"),"g"),lm=RegExp("["+cf+on+Al+nm+"]"),Gu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,um=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xv=-1,Zt={};Zt[Is]=Zt[ho]=Zt[po]=Zt[Nl]=Zt[Pi]=Zt[ji]=Zt[Ts]=Zt[Ho]=Zt[Li]=!0,Zt[De]=Zt[ke]=Zt[tr]=Zt[Re]=Zt[Nr]=Zt[rt]=Zt[Se]=Zt[Ze]=Zt[Je]=Zt[lt]=Zt[Dt]=Zt[Ft]=Zt[Ot]=Zt[an]=Zt[vr]=!1;var zt={};zt[De]=zt[ke]=zt[tr]=zt[Nr]=zt[Re]=zt[rt]=zt[Is]=zt[ho]=zt[po]=zt[Nl]=zt[Pi]=zt[Je]=zt[lt]=zt[Dt]=zt[Ft]=zt[Ot]=zt[an]=zt[wn]=zt[ji]=zt[Ts]=zt[Ho]=zt[Li]=!0,zt[Se]=zt[Ze]=zt[vr]=!1;var Ms={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},qu={"&":"&","<":"<",">":">",'"':""","'":"'"},Mv={"&":"&","<":"<",">":">",""":'"',"'":"'"},Nv={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},hf=parseFloat,Ju=parseInt,Ku=typeof Jn=="object"&&Jn&&Jn.Object===Object&&Jn,cm=typeof self=="object"&&self&&self.Object===Object&&self,sn=Ku||cm||Function("return this")(),Rl=t&&!t.nodeType&&t,Za=Rl&&!0&&e&&!e.nodeType&&e,pf=Za&&Za.exports===Rl,Ns=pf&&Ku.process,br=function(){try{var ue=Za&&Za.require&&Za.require("util").types;return ue||Ns&&Ns.binding&&Ns.binding("util")}catch{}}(),mf=br&&br.isArrayBuffer,kr=br&&br.isDate,Yi=br&&br.isMap,Qu=br&&br.isRegExp,ks=br&&br.isSet,dm=br&&br.isTypedArray;function Dr(ue,Ce,ve){switch(ve.length){case 0:return ue.call(Ce);case 1:return ue.call(Ce,ve[0]);case 2:return ue.call(Ce,ve[0],ve[1]);case 3:return ue.call(Ce,ve[0],ve[1],ve[2])}return ue.apply(Ce,ve)}function gf(ue,Ce,ve,Ge){for(var bt=-1,Lt=ue==null?0:ue.length;++bt-1}function vf(ue,Ce,ve){for(var Ge=-1,bt=ue==null?0:ue.length;++Ge-1;);return ve}function Ef(ue,Ce){for(var ve=ue.length;ve--&&As(Ce,ue[ve],0)>-1;);return ve}function wm(ue,Ce){for(var ve=ue.length,Ge=0;ve--;)ue[ve]===Ce&&++Ge;return Ge}var bm=nc(Ms),Dm=nc(qu);function Sm(ue){return"\\"+Nv[ue]}function Fs(ue,Ce){return ue==null?n:ue[Ce]}function Os(ue){return lm.test(ue)}function jv(ue){return Gu.test(ue)}function Lv(ue){for(var Ce,ve=[];!(Ce=ue.next()).done;)ve.push(Ce.value);return ve}function rc(ue){var Ce=-1,ve=Array(ue.size);return ue.forEach(function(Ge,bt){ve[++Ce]=[bt,Ge]}),ve}function Cf(ue,Ce){return function(ve){return ue(Ce(ve))}}function aa(ue,Ce){for(var ve=-1,Ge=ue.length,bt=0,Lt=[];++ve-1}function Om(u,f){var b=this.__data__,M=sr(b,u);return M<0?(++this.size,b.push([u,f])):b[M][1]=f,this}Sr.prototype.clear=Vs,Sr.prototype.delete=Or,Sr.prototype.get=yc,Sr.prototype.has=Fm,Sr.prototype.set=Om;function ia(u){var f=-1,b=u==null?0:u.length;for(this.clear();++f=f?u:f)),u}function Pr(u,f,b,M,P,V){var K,ne=f&g,ce=f&v,Me=f&D;if(b&&(K=P?b(u,M,P,V):b(u)),K!==n)return K;if(!Sn(u))return u;var Ne=Tt(u);if(Ne){if(K=ng(u),!ne)return Tr(u,K)}else{var Pe=dr(u),We=Pe==Ze||Pe==Ke;if(ll(u))return Wf(u,ne);if(Pe==Dt||Pe==De||We&&!P){if(K=ce||We?{}:nl(u),!ne)return ce?Vv(u,Na(K,u)):Wm(u,tn(K,u))}else{if(!zt[Pe])return P?u:{};K=fr(u,Pe,ne)}}V||(V=new ir);var it=V.get(u);if(it)return it;V.set(u,K),Eb(u)?u.forEach(function(vt){K.add(Pr(vt,f,b,vt,u,V))}):Ib(u)&&u.forEach(function(vt,Nt){K.set(Nt,Pr(vt,f,b,Nt,u,V))});var yt=Me?ce?uu:Uc:ce?pa:pr,Mt=Ne?n:yt(u);return nr(Mt||u,function(vt,Nt){Mt&&(Nt=vt,vt=u[Nt]),qi(K,Nt,Pr(vt,f,b,Nt,u,V))}),K}function Rm(u){var f=pr(u);return function(b){return Jl(b,u,f)}}function Jl(u,f,b){var M=b.length;if(u==null)return!M;for(u=$t(u);M--;){var P=b[M],V=f[P],K=u[P];if(K===n&&!(P in u)||!V(K))return!1}return!0}function Pf(u,f,b){if(typeof u!="function")throw new oa(s);return al(function(){u.apply(n,b)},f)}function Qa(u,f,b,M){var P=-1,V=ec,K=!0,ne=u.length,ce=[],Me=f.length;if(!ne)return ce;b&&(f=Jt(f,Yr(b))),M?(V=vf,K=!1):f.length>=a&&(V=mo,K=!1,f=new Wi(f));e:for(;++PP?0:P+b),M=M===n||M>P?P:xt(M),M<0&&(M+=P),M=b>M?0:xb(M);b0&&b(ne)?f>1?jn(ne,f-1,b,M,P):Go(P,ne):M||(P[P.length]=ne)}return P}var Kl=Kf(),Ic=Kf(!0);function ua(u,f){return u&&Kl(u,f,pr)}function ni(u,f){return u&&Ic(u,f,pr)}function Ir(u,f){return $o(f,function(b){return os(u[b])})}function Zr(u,f){f=Do(f,u);for(var b=0,M=f.length;u!=null&&bf}function ri(u,f){return u!=null&&Rt.call(u,f)}function jf(u,f){return u!=null&&f in $t(u)}function _m(u,f,b){return u>=rr(f,b)&&u=120&&Ne.length>=120)?new Wi(K&&Ne):n}Ne=u[0];var Pe=-1,We=ne[0];e:for(;++Pe-1;)ne!==u&&cc.call(ne,ce,1),cc.call(u,ce,1);return u}function tu(u,f){for(var b=u?f.length:0,M=b-1;b--;){var P=f[b];if(b==M||P!==V){var V=P;ca(P)?cc.call(u,P,1):Xi(u,P)}}return u}function nu(u,f){return u+Jo(Zl()*(f-u+1))}function Uf(u,f,b,M){for(var P=-1,V=Cn(Vi((f-u)/(b||1)),0),K=ve(V);V--;)K[M?V:++P]=u,u+=b;return K}function qs(u,f){var b="";if(!u||f<1||f>oe)return b;do f%2&&(b+=u),f=Jo(f/2),f&&(u+=u);while(f);return b}function It(u,f){return Gc(Wc(u,f,ma),u+"")}function Qi(u){return Ja(pd(u))}function cn(u,f){var b=pd(u);return $r(b,bo(f,0,b.length))}function dn(u,f,b,M){if(!Sn(u))return u;f=Do(f,u);for(var P=-1,V=f.length,K=V-1,ne=u;ne!=null&&++PP?0:P+f),b=b>P?P:b,b<0&&(b+=P),P=f>b?0:b-f>>>0,f>>>=0;for(var V=ve(P);++M>>1,K=u[V];K!==null&&!Ra(K)&&(b?K<=f:K=a){var Me=f?null:Er(u);if(Me)return qo(Me);K=!1,P=mo,ce=new Wi}else ce=f?[]:ne;e:for(;++M=M?u:ur(u,f,b)}var Ks=Nm||function(u){return sn.clearTimeout(u)};function Wf(u,f){if(f)return u.slice();var b=u.length,M=Mf?Mf(b):new u.constructor(b);return u.copy(M),M}function Qs(u){var f=new u.constructor(u.byteLength);return new Ul(f).set(new Ul(u)),f}function Rc(u,f){var b=f?Qs(u.buffer):u.buffer;return new u.constructor(b,u.byteOffset,u.byteLength)}function Vm(u){var f=new u.constructor(u.source,of.exec(u));return f.lastIndex=u.lastIndex,f}function $f(u){return Ur?$t(Ur.call(u)):{}}function Gf(u,f){var b=f?Qs(u.buffer):u.buffer;return new u.constructor(b,u.byteOffset,u.length)}function qf(u,f){if(u!==f){var b=u!==n,M=u===null,P=u===u,V=Ra(u),K=f!==n,ne=f===null,ce=f===f,Me=Ra(f);if(!ne&&!Me&&!V&&u>f||V&&K&&ce&&!ne&&!Me||M&&K&&ce||!b&&ce||!P)return 1;if(!M&&!V&&!Me&&u=ne)return ce;var Me=b[M];return ce*(Me=="desc"?-1:1)}}return u.index-f.index}function Jf(u,f,b,M){for(var P=-1,V=u.length,K=b.length,ne=-1,ce=f.length,Me=Cn(V-K,0),Ne=ve(ce+Me),Pe=!M;++ne1?b[P-1]:n,K=P>2?b[2]:n;for(V=u.length>3&&typeof V=="function"?(P--,V):n,K&&Ut(b[0],b[1],K)&&(V=P<3?n:V,P=1),f=$t(f);++M-1?P[V?f[K]:K]:n}}function es(u){return to(function(f){var b=f.length,M=b,P=ar.prototype.thru;for(u&&f.reverse();M--;){var V=f[M];if(typeof V!="function")throw new oa(s);if(P&&!K&&du(V)=="wrapper")var K=new ar([],!0)}for(M=K?M:b;++M1&&jt.reverse(),Ne&&cene))return!1;var Me=V.get(u),Ne=V.get(f);if(Me&&Ne)return Me==f&&Ne==u;var Pe=-1,We=!0,it=b&T?new Wi:n;for(V.set(u,f),V.set(f,u);++Pe1?"& ":"")+f[M],f=f.join(b>2?", ":" "),u.replace(Ta,`{ /* [wrapped with `+f+`] */ `)}function $v(u){return Tt(u)||wu(u)||!!(Mm&&u&&u[Mm])}function ca(u,f){var b=typeof u;return f=f??oe,!!f&&(b=="number"||b!="symbol"&&Kp.test(u))&&u>-1&&u%1==0&&u0){if(++f>=Q)return arguments[0]}else f=0;return u.apply(n,arguments)}}function $r(u,f){var b=-1,M=u.length,P=M-1;for(f=f===n?M:f;++b1?u[f-1]:n;return b=typeof b=="function"?(u.pop(),b):n,bh(u,b)});function qr(u){var f=_(u);return f.__chain__=!0,f}function Dh(u,f){return f(u),u}function nd(u,f){return f(u)}var yi=to(function(u){var f=u.length,b=f?u[0]:0,M=this.__wrapped__,P=function(V){return Dc(V,u)};return f>1||this.__actions__.length||!(M instanceof St)||!ca(b)?this.thru(P):(M=M.slice(b,+b+(f?1:0)),M.__actions__.push({func:nd,args:[P],thisArg:n}),new ar(M,this.__chain__).thru(function(V){return f&&!V.length&&V.push(n),V}))});function rd(){return qr(this)}function as(){return new ar(this.value(),this.__chain__)}function ad(){this.__values__===n&&(this.__values__=Cb(this.value()));var u=this.__index__>=this.__values__.length,f=u?n:this.__values__[this.__index__++];return{done:u,value:f}}function Sh(){return this}function Ih(u){for(var f,b=this;b instanceof Ga;){var M=ch(b);M.__index__=0,M.__values__=n,f?P.__wrapped__=M:f=M;var P=M;b=b.__wrapped__}return P.__wrapped__=u,f}function r0(){var u=this.__wrapped__;if(u instanceof St){var f=u;return this.__actions__.length&&(f=new St(this)),f=f.reverse(),f.__actions__.push({func:nd,args:[hr],thisArg:n}),new ar(f,this.__chain__)}return this.thru(hr)}function Th(){return Vf(this.__wrapped__,this.__actions__)}var a0=ou(function(u,f,b){Rt.call(u,b)?++u[b]:Ka(u,b,1)});function vg(u,f,b){var M=Tt(u)?yf:ka;return b&&Ut(u,f,b)&&(f=n),M(u,ut(f,3))}function wg(u,f){var b=Tt(u)?$o:Ki;return b(u,ut(f,3))}var od=qm(il),id=qm(fi);function bg(u,f){return jn(cd(u,f),1)}function Eh(u,f){return jn(cd(u,f),fe)}function o0(u,f,b){return b=b===n?1:xt(b),jn(cd(u,f),b)}function Ch(u,f){var b=Tt(u)?nr:Xa;return b(u,ut(f,3))}function sd(u,f){var b=Tt(u)?Xu:Bm;return b(u,ut(f,3))}var ld=ou(function(u,f,b){Rt.call(u,b)?u[b].push(f):Ka(u,b,[f])});function xh(u,f,b,M){u=ha(u)?u:pd(u),b=b&&!M?xt(b):0;var P=u.length;return b<0&&(b=Cn(P+b,0)),Ig(u)?b<=P&&u.indexOf(f,b)>-1:!!P&&As(u,f,b)>-1}var ud=It(function(u,f,b){var M=-1,P=typeof f=="function",V=ha(u)?ve(u.length):[];return Xa(u,function(K){V[++M]=P?Dr(f,K,b):oi(K,f,b)}),V}),Dg=ou(function(u,f,b){Ka(u,b,f)});function cd(u,f){var b=Tt(u)?Jt:Hf;return b(u,ut(f,3))}function dd(u,f,b,M){return u==null?[]:(Tt(f)||(f=f==null?[]:[f]),b=M?n:b,Tt(b)||(b=b==null?[]:[b]),Nc(u,f,b))}var i0=ou(function(u,f,b){u[b?0:1].push(f)},function(){return[[],[]]});function vu(u,f,b){var M=Tt(u)?wf:gm,P=arguments.length<3;return M(u,ut(f,4),b,P,Xa)}function s0(u,f,b){var M=Tt(u)?kv:gm,P=arguments.length<3;return M(u,ut(f,4),b,P,Bm)}function fd(u,f){var b=Tt(u)?$o:Ki;return b(u,he(ut(f,3)))}function i(u){var f=Tt(u)?Ja:Qi;return f(u)}function l(u,f,b){(b?Ut(u,f,b):f===n)?f=1:f=xt(f);var M=Tt(u)?Gi:cn;return M(u,f)}function h(u){var f=Tt(u)?Lm:ru;return f(u)}function y(u){if(u==null)return 0;if(ha(u))return Ig(u)?zi(u):u.length;var f=dr(u);return f==Je||f==Ot?u.size:Mc(u).length}function I(u,f,b){var M=Tt(u)?bf:Uv;return b&&Ut(u,f,b)&&(f=n),M(u,ut(f,3))}var x=It(function(u,f){if(u==null)return[];var b=f.length;return b>1&&Ut(u,f[0],f[1])?f=[]:b>2&&Ut(f[0],f[1],f[2])&&(f=[f[0]]),Nc(u,jn(f,1),[])}),L=Xt||function(){return sn.Date.now()};function q(u,f){if(typeof f!="function")throw new oa(s);return u=xt(u),function(){if(--u<1)return f.apply(this,arguments)}}function ee(u,f,b){return f=b?n:f,f=u&&f==null?u.length:f,eo(u,z,n,n,n,n,f)}function be(u,f){var b;if(typeof f!="function")throw new oa(s);return u=xt(u),function(){return--u>0&&(b=f.apply(this,arguments)),u<=1&&(f=n),b}}var Oe=It(function(u,f,b){var M=E;if(b.length){var P=aa(b,ui(Oe));M|=B}return eo(u,M,f,b,P)}),Le=It(function(u,f,b){var M=E|O;if(b.length){var P=aa(b,ui(Le));M|=B}return eo(f,M,u,b,P)});function Fe(u,f,b){f=b?n:f;var M=eo(u,j,n,n,n,n,n,f);return M.placeholder=Fe.placeholder,M}function qe(u,f,b){f=b?n:f;var M=eo(u,F,n,n,n,n,n,f);return M.placeholder=qe.placeholder,M}function nt(u,f,b){var M,P,V,K,ne,ce,Me=0,Ne=!1,Pe=!1,We=!0;if(typeof u!="function")throw new oa(s);f=ro(f)||0,Sn(b)&&(Ne=!!b.leading,Pe="maxWait"in b,V=Pe?Cn(ro(b.maxWait)||0,f):V,We="trailing"in b?!!b.trailing:We);function it(zn){var Mo=M,ss=P;return M=P=n,Me=zn,K=u.apply(ss,Mo),K}function yt(zn){return Me=zn,ne=al(Nt,f),Ne?it(zn):K}function Mt(zn){var Mo=zn-ce,ss=zn-Me,_b=f-Mo;return Pe?rr(_b,V-ss):_b}function vt(zn){var Mo=zn-ce,ss=zn-Me;return ce===n||Mo>=f||Mo<0||Pe&&ss>=V}function Nt(){var zn=L();if(vt(zn))return jt(zn);ne=al(Nt,Mt(zn))}function jt(zn){return ne=n,We&&M?it(zn):(M=P=n,K)}function Ba(){ne!==n&&Ks(ne),Me=0,M=ce=P=ne=n}function Jr(){return ne===n?K:jt(L())}function _a(){var zn=L(),Mo=vt(zn);if(M=arguments,P=this,ce=zn,Mo){if(ne===n)return yt(ce);if(Pe)return Ks(ne),ne=al(Nt,f),it(ce)}return ne===n&&(ne=al(Nt,f)),K}return _a.cancel=Ba,_a.flush=Jr,_a}var at=It(function(u,f){return Pf(u,1,f)}),Dn=It(function(u,f,b){return Pf(u,ro(f)||0,b)});function de(u){return eo(u,Y)}function ae(u,f){if(typeof u!="function"||f!=null&&typeof f!="function")throw new oa(s);var b=function(){var M=arguments,P=f?f.apply(this,M):M[0],V=b.cache;if(V.has(P))return V.get(P);var K=u.apply(this,M);return b.cache=V.set(P,K)||V,K};return b.cache=new(ae.Cache||ia),b}ae.Cache=ia;function he(u){if(typeof u!="function")throw new oa(s);return function(){var f=arguments;switch(f.length){case 0:return!u.call(this);case 1:return!u.call(this,f[0]);case 2:return!u.call(this,f[0],f[1]);case 3:return!u.call(this,f[0],f[1],f[2])}return!u.apply(this,f)}}function Be(u){return be(2,u)}var ot=Um(function(u,f){f=f.length==1&&Tt(f[0])?Jt(f[0],Yr(ut())):Jt(jn(f,1),Yr(ut()));var b=f.length;return It(function(M){for(var P=-1,V=rr(M.length,b);++P=f}),wu=Lf(function(){return arguments}())?Lf:function(u){return Mn(u)&&Rt.call(u,"callee")&&!uc.call(u,"callee")},Tt=ve.isArray,Ux=mf?Yr(mf):Ec;function ha(u){return u!=null&&Sg(u.length)&&!os(u)}function Yn(u){return Mn(u)&&ha(u)}function Vx(u){return u===!0||u===!1||Mn(u)&&lr(u)==Re}var ll=kf||w0,Zx=kr?Yr(kr):Hm;function Wx(u){return Mn(u)&&u.nodeType===1&&!Mh(u)}function $x(u){if(u==null)return!0;if(ha(u)&&(Tt(u)||typeof u=="string"||typeof u.splice=="function"||ll(u)||hd(u)||wu(u)))return!u.length;var f=dr(u);if(f==Je||f==Ot)return!u.size;if(fu(u))return!Mc(u).length;for(var b in u)if(Rt.call(u,b))return!1;return!0}function Gx(u,f){return Ws(u,f)}function qx(u,f,b){b=typeof b=="function"?b:n;var M=b?b(u,f):n;return M===n?Ws(u,f,n,b):!!M}function u0(u){if(!Mn(u))return!1;var f=lr(u);return f==Se||f==Ht||typeof u.message=="string"&&typeof u.name=="string"&&!Mh(u)}function Jx(u){return typeof u=="number"&&Rs(u)}function os(u){if(!Sn(u))return!1;var f=lr(u);return f==Ze||f==Ke||f==Ye||f==un}function Sb(u){return typeof u=="number"&&u==xt(u)}function Sg(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=oe}function Sn(u){var f=typeof u;return u!=null&&(f=="object"||f=="function")}function Mn(u){return u!=null&&typeof u=="object"}var Ib=Yi?Yr(Yi):Cc;function Kx(u,f){return u===f||xc(u,f,Zc(f))}function Qx(u,f,b){return b=typeof b=="function"?b:n,xc(u,f,Zc(f),b)}function Xx(u){return Tb(u)&&u!=+u}function eM(u){if(rg(u))throw new bt(o);return Bf(u)}function tM(u){return u===null}function nM(u){return u==null}function Tb(u){return typeof u=="number"||Mn(u)&&lr(u)==lt}function Mh(u){if(!Mn(u)||lr(u)!=Dt)return!1;var f=Ma(u);if(f===null)return!0;var b=Rt.call(f,"constructor")&&f.constructor;return typeof b=="function"&&b instanceof b&&Hl.call(b)==sc}var c0=Qu?Yr(Qu):Ym;function rM(u){return Sb(u)&&u>=-oe&&u<=oe}var Eb=ks?Yr(ks):_f;function Ig(u){return typeof u=="string"||!Tt(u)&&Mn(u)&&lr(u)==an}function Ra(u){return typeof u=="symbol"||Mn(u)&&lr(u)==wn}var hd=dm?Yr(dm):Ql;function aM(u){return u===n}function oM(u){return Mn(u)&&dr(u)==vr}function iM(u){return Mn(u)&&lr(u)==Ia}var sM=lu(ii),lM=lu(function(u,f){return u<=f});function Cb(u){if(!u)return[];if(ha(u))return Ig(u)?zr(u):Tr(u);if(vo&&u[vo])return Lv(u[vo]());var f=dr(u),b=f==Je?rc:f==Ot?qo:pd;return b(u)}function is(u){if(!u)return u===0?u:0;if(u=ro(u),u===fe||u===-fe){var f=u<0?-1:1;return f*we}return u===u?u:0}function xt(u){var f=is(u),b=f%1;return f===f?b?f-b:f:0}function xb(u){return u?bo(xt(u),0,G):0}function ro(u){if(typeof u=="number")return u;if(Ra(u))return Z;if(Sn(u)){var f=typeof u.valueOf=="function"?u.valueOf():u;u=Sn(f)?f+"":f}if(typeof u!="string")return u===0?u:+u;u=ym(u);var b=bv.test(u);return b||Jp.test(u)?Ju(u.slice(2),b?2:8):Gp.test(u)?Z:+u}function Mb(u){return Pa(u,pa(u))}function uM(u){return u?bo(xt(u),-oe,oe):u===0?u:0}function Gt(u){return u==null?"":pn(u)}var cM=Xs(function(u,f){if(fu(f)||ha(f)){Pa(f,pr(f),u);return}for(var b in f)Rt.call(f,b)&&qi(u,b,f[b])}),Nb=Xs(function(u,f){Pa(f,pa(f),u)}),Tg=Xs(function(u,f,b,M){Pa(f,pa(f),u,M)}),dM=Xs(function(u,f,b,M){Pa(f,pr(f),u,M)}),fM=to(Dc);function hM(u,f){var b=zs(u);return f==null?b:tn(b,f)}var pM=It(function(u,f){u=$t(u);var b=-1,M=f.length,P=M>2?f[2]:n;for(P&&Ut(f[0],f[1],P)&&(M=1);++b1),V}),Pa(u,uu(u),b),M&&(b=Pr(b,g|v|D,Qm));for(var P=f.length;P--;)Xi(b,f[P]);return b});function FM(u,f){return Ab(u,he(ut(f)))}var OM=to(function(u,f){return u==null?{}:Gs(u,f)});function Ab(u,f){if(u==null)return{};var b=Jt(uu(u),function(M){return[M]});return f=ut(f),Yf(u,b,function(M,P){return f(M,P[0])})}function PM(u,f,b){f=Do(f,u);var M=-1,P=f.length;for(P||(P=1,u=n);++Mf){var M=u;u=f,f=M}if(b||u%1||f%1){var P=Zl();return rr(u+P*(f-u+hf("1e-"+((P+"").length-1))),f)}return nu(u,f)}var ZM=Io(function(u,f,b){return f=f.toLowerCase(),u+(b?Pb(f):f)});function Pb(u){return h0(Gt(u).toLowerCase())}function jb(u){return u=Gt(u),u&&u.replace(Qp,bm).replace(sm,"")}function WM(u,f,b){u=Gt(u),f=pn(f);var M=u.length;b=b===n?M:bo(xt(b),0,M);var P=b;return b-=f.length,b>=0&&u.slice(b,P)==f}function $M(u){return u=Gt(u),u&&ze.test(u)?u.replace(je,Dm):u}function GM(u){return u=Gt(u),u&&ra.test(u)?u.replace(wr,"\\$&"):u}var qM=Io(function(u,f,b){return u+(b?"-":"")+f.toLowerCase()}),JM=Io(function(u,f,b){return u+(b?" ":"")+f.toLowerCase()}),KM=Qf("toLowerCase");function QM(u,f,b){u=Gt(u),f=xt(f);var M=f?zi(u):0;if(!f||M>=f)return u;var P=(f-M)/2;return su(Jo(P),b)+u+su(Vi(P),b)}function XM(u,f,b){u=Gt(u),f=xt(f);var M=f?zi(u):0;return f&&M>>0,b?(u=Gt(u),u&&(typeof f=="string"||f!=null&&!c0(f))&&(f=pn(f),!f&&Os(u))?So(zr(u),0,b):u.split(f,b)):[]}var i3=Io(function(u,f,b){return u+(b?" ":"")+h0(f)});function s3(u,f,b){return u=Gt(u),b=b==null?0:bo(xt(b),0,u.length),f=pn(f),u.slice(b,b+f.length)==f}function l3(u,f,b){var M=_.templateSettings;b&&Ut(u,f,b)&&(f=n),u=Gt(u),f=Tg({},f,M,th);var P=Tg({},f.imports,M.imports,th),V=pr(P),K=Bl(P,V),ne,ce,Me=0,Ne=f.interpolate||zu,Pe="__p += '",We=_l((f.escape||zu).source+"|"+Ne.source+"|"+(Ne===On?Ri:zu).source+"|"+(f.evaluate||zu).source+"|$","g"),it="//# sourceURL="+(Rt.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xv+"]")+` `;u.replace(We,function(vt,Nt,jt,Ba,Jr,_a){return jt||(jt=Ba),Pe+=u.slice(Me,_a).replace(Dv,Sm),Nt&&(ne=!0,Pe+=`' + __e(`+Nt+`) + '`),Jr&&(ce=!0,Pe+=`'; `+Jr+`; __p += '`),jt&&(Pe+=`' + ((__t = (`+jt+`)) == null ? '' : __t) + '`),Me=_a+vt.length,vt}),Pe+=`'; `;var yt=Rt.call(f,"variable")&&f.variable;if(!yt)Pe=`with (obj) { `+Pe+` } `;else if(zo.test(yt))throw new bt(c);Pe=(ce?Pe.replace(W,""):Pe).replace(re,"$1").replace(ye,"$1;"),Pe="function("+(yt||"obj")+`) { `+(yt?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(ne?", __e = _.escape":"")+(ce?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+Pe+`return __p }`;var Mt=Rb(function(){return Lt(V,it+"return "+Pe).apply(n,K)});if(Mt.source=Pe,u0(Mt))throw Mt;return Mt}function u3(u){return Gt(u).toLowerCase()}function c3(u){return Gt(u).toUpperCase()}function d3(u,f,b){if(u=Gt(u),u&&(b||f===n))return ym(u);if(!u||!(f=pn(f)))return u;var M=zr(u),P=zr(f),V=vm(M,P),K=Ef(M,P)+1;return So(M,V,K).join("")}function f3(u,f,b){if(u=Gt(u),u&&(b||f===n))return u.slice(0,oc(u)+1);if(!u||!(f=pn(f)))return u;var M=zr(u),P=Ef(M,zr(f))+1;return So(M,0,P).join("")}function h3(u,f,b){if(u=Gt(u),u&&(b||f===n))return u.replace(kl,"");if(!u||!(f=pn(f)))return u;var M=zr(u),P=vm(M,zr(f));return So(M,P).join("")}function p3(u,f){var b=U,M=J;if(Sn(f)){var P="separator"in f?f.separator:P;b="length"in f?xt(f.length):b,M="omission"in f?pn(f.omission):M}u=Gt(u);var V=u.length;if(Os(u)){var K=zr(u);V=K.length}if(b>=V)return u;var ne=b-zi(M);if(ne<1)return M;var ce=K?So(K,0,ne).join(""):u.slice(0,ne);if(P===n)return ce+M;if(K&&(ne+=ce.length-ne),c0(P)){if(u.slice(ne).search(P)){var Me,Ne=ce;for(P.global||(P=_l(P.source,Gt(of.exec(P))+"g")),P.lastIndex=0;Me=P.exec(Ne);)var Pe=Me.index;ce=ce.slice(0,Pe===n?ne:Pe)}}else if(u.indexOf(pn(P),ne)!=ne){var We=ce.lastIndexOf(P);We>-1&&(ce=ce.slice(0,We))}return ce+M}function m3(u){return u=Gt(u),u&&_e.test(u)?u.replace(xe,Im):u}var g3=Io(function(u,f,b){return u+(b?" ":"")+f.toUpperCase()}),h0=Qf("toUpperCase");function Lb(u,f,b){return u=Gt(u),f=b?n:f,f===n?jv(u)?_v(u):Fv(u):u.match(f)||[]}var Rb=It(function(u,f){try{return Dr(u,n,f)}catch(b){return u0(b)?b:new bt(b)}}),y3=to(function(u,f){return nr(f,function(b){b=ja(b),Ka(u,b,Oe(u[b],u))}),u});function v3(u){var f=u==null?0:u.length,b=ut();return u=f?Jt(u,function(M){if(typeof M[1]!="function")throw new oa(s);return[b(M[0]),M[1]]}):[],It(function(M){for(var P=-1;++Poe)return[];var b=G,M=rr(u,G);f=ut(f),u-=G;for(var P=Tf(M,f);++b0||f<0)?new St(b):(u<0?b=b.takeRight(-u):u&&(b=b.drop(u)),f!==n&&(f=xt(f),b=f<0?b.dropRight(-f):b.take(f-u)),b)},St.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},St.prototype.toArray=function(){return this.take(G)},ua(St.prototype,function(u,f){var b=/^(?:filter|find|map|reject)|While$/.test(f),M=/^(?:head|last)$/.test(f),P=_[M?"take"+(f=="last"?"Right":""):f],V=M||/^find/.test(f);P&&(_.prototype[f]=function(){var K=this.__wrapped__,ne=M?[1]:arguments,ce=K instanceof St,Me=ne[0],Ne=ce||Tt(K),Pe=function(Nt){var jt=P.apply(_,Go([Nt],ne));return M&&We?jt[0]:jt};Ne&&b&&typeof Me=="function"&&Me.length!=1&&(ce=Ne=!1);var We=this.__chain__,it=!!this.__actions__.length,yt=V&&!We,Mt=ce&&!it;if(!V&&Ne){K=Mt?K:new St(this);var vt=u.apply(K,ne);return vt.__actions__.push({func:nd,args:[Pe],thisArg:n}),new ar(vt,We)}return yt&&Mt?u.apply(this,ne):(vt=this.thru(Pe),yt?M?vt.value()[0]:vt.value():vt)})}),nr(["pop","push","shift","sort","splice","unshift"],function(u){var f=go[u],b=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",M=/^(?:pop|shift)$/.test(u);_.prototype[u]=function(){var P=arguments;if(M&&!this.__chain__){var V=this.value();return f.apply(Tt(V)?V:[],P)}return this[b](function(K){return f.apply(Tt(K)?K:[],P)})}}),ua(St.prototype,function(u,f){var b=_[f];if(b){var M=b.name+"";Rt.call(Hs,M)||(Hs[M]=[]),Hs[M].push({name:f,func:b})}}),Hs[el(n,O).name]=[{name:"wrapper",func:n}],St.prototype.clone=gc,St.prototype.reverse=Ff,St.prototype.value=Us,_.prototype.at=yi,_.prototype.chain=rd,_.prototype.commit=as,_.prototype.next=ad,_.prototype.plant=Ih,_.prototype.reverse=r0,_.prototype.toJSON=_.prototype.valueOf=_.prototype.value=Th,_.prototype.first=_.prototype.head,vo&&(_.prototype[vo]=Sh),_},Ps=Hv();Za?((Za.exports=Ps)._=Ps,Rl._=Ps):sn._=Ps}).call(Jn)})(iy,iy.exports);var FI=iy.exports;function Eg(e){const t=e.match(/^#+/);return t?t[0].length:0}function Wb(e,t){const n=e.split(` `);let r="",a=[],o=!1,s=1;for(let c=0;cEg(t)?a.push(d):(o=!1,a=[])}else o&&a.push(d)}return t?FI.isEmpty(a)?{content:"",startLine:-1}:{content:a.join(` `),startLine:s}:{content:e,startLine:0}}function jN(e){const t=e.split(/\r?\n/),n=[];for(let r=0;r [!thino]")?(r&&(n.push({metadata:o,content:a.join(` `).trim()}),a=[]),r=!0,o=c.replace("> [!thino]","").trim()):r&&c.startsWith(">")?a.push(c.replace(/^> /,"")):r&&!c.startsWith(">")&&(r=!1,n.push({metadata:o,content:a.join(` `).trim()}),a=[],o="")}return r&&n.push({metadata:o,content:a.join(` `).trim()}),n}const HN=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 YN(e,t){if(!t)return 0;const{vault:n}=Ee.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 s;try{s=await n.read(t)}catch(S){console.error(S),s=await n.cachedRead(t)}let c;r!=""&&/{TIME}/g.test(r)&&/{CONTENT}/g.test(r)?c="(-|\\*) (\\[(.{1})\\]\\s)?"+r.replace(/{TIME}/g,"((\\)?\\d{1,2}:\\d{2}(\\:\\d{2})?)?").replace(/ {CONTENT}/g,""):c="(-|\\*) (\\[(.{1})\\]\\s)?((\\)?\\d{1,2}\\:\\d{2}(\\:\\d{2})?)?";const d=new RegExp(c,"g"),p=(s.match(d)||[]).length,m=new RegExp(a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),g=new RegExp(o.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g"),v=(s.match(m)||[]).length,D=(s.match(g)||[]).length;return s=null,v||D?p:0}function $b(e,t,n,r,a){var d,p,m;const o=Wh(a,"day");let s;const c=jN(t);for(const g of c){const v=ZN(e.DefaultMemoComposition,g.line),D=WN(e.DefaultMemoComposition,g.line),S=$N(g.line);let T=zN(g.line);if(o.hours(parseInt(v)),o.minutes(parseInt(D)),S&&o.seconds(parseInt(S)),!S&&o.seconds(0),/^\s*[-*]\s(\[(.)\])\s/g.test(g.line)){const H=GN(g.line);T=UN(e.DefaultMemoComposition,g.line),s=HN(H)}else s="JOURNAL";let E=T.replaceAll(/
/g,` `);const O=new RegExp(/\[(pinned|PINNED)::true\]/,"g").test(T),k=new RegExp(/\[(archived|ARCHIVED)::true\]/,"g").test(T),j=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").test(T),F=(d=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(T))==null?void 0:d[2],B=(p=new RegExp(/\[(webId|WEBID)::([^\]]*)\]/,"g").exec(T))==null?void 0:p[2],R=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(T)?"PUBLIC":"PRIVATE",z=(m=new RegExp(/\s\^([0-9a-zA-Z-]+)$/).exec(T))==null?void 0:m[1];E=E.replace(/\s\[pinned::[^\]]+\]/g,"").replace(/\s\[visibility::[^\]]+\]/g,"").replace(/\s\[archived::[^\]]+\]/g,"").replace(/\s\[deleted::[^\]]+\]/g,"").replace(/\s\[webId::[^\]]+\]/g,"").replace(/\s\^([0-9a-zA-Z-]+)$/g,""),r.push({id:o.format("YYYYMMDDHHmmss")+`${g.index+n-1}`,content:E,createdAt:o.format("YYYY/MM/DD HH:mm:ss"),updatedAt:o.format("YYYY/MM/DD HH:mm:ss"),thinoType:s,hasId:z||"",linkId:"",path:a.path,deletedAt:j?C.moment(F,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",rowStatus:k?"ARCHIVED":"NORMAL",visibility:R,pinned:O,creatorName:"Memo",resourceList:[],sourceType:"DAILY",webId:B})}}function zN(e){return e.replace(/^(-|\*|\d\.) (\d{1,2}:\d{2}(:\d{2})?)\s(.*)$/g,"$4")}function UN(e,t){return VN(e,t)}const VN=(e,t)=>{var a;let n;return e!=""&&/{TIME}/g.test(e)&&/{CONTENT}/g.test(e)?n="^\\s*[\\-\\*]\\s(\\[(.{1})\\]\\s?)?"+e.replace(/{TIME}/g,"((\\d{1,2})\\:(\\d{2}))?(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*[\\-\\*]\\s(\\[(.{1})\\]\\s?)?((\\d{1,2})\\:(\\d{2}))?(\\:\\d{2})?\\s?(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[7]},ZN=(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,"(\\)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\)?(\\d{1,2})\\:(\\d{2})(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[6]},WN=(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,"(\\)?(\\d{1,2})\\:(\\d{2})(\\:\\d{2})?").replace(/{CONTENT}/g,"(.*)$"):n="^\\s*(\\-|\\*|(\\d{1,}\\.))\\s(\\[(.{1})\\]\\s?)?(\\)?(\\d{1,2})\\:(\\d{2})(.*)$",(a=new RegExp(n,"").exec(t))==null?void 0:a[7]},$N=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]},GN=e=>{var t;return(t=/^\s*[\-\*]\s(\[(.{1})\])\s(.*)$/.exec(e))==null?void 0:t[2]},OI=()=>a1()?!0:(new C.Notice(N("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),!1);async function PI(e,t){if(!e)return t;const n=Ee.getState().dailyNotesState.app,r=await RN(e,n);if(!r.trim())return t;let a=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss");await n.fileManager.processFrontMatter(e,o=>{if(!o)return t;const s=!!o.pinned,c=o.rowStatus&&o.rowStatus==="ARCHIVED",d=!!o.deletedAt;o.createdAt&&(a=C.moment(o.createdAt,"YYYY/MM/DD HH:mm:ss").isValid()?o.createdAt:a);const p=o.deletedAt?o.deletedAt:"",m=o.visibility?o.visibility:"PRIVATE",g=o.thinoType?o.thinoType:"JOURNAL",v=o.webId?o.webId:"";o.id||(o.id=Ue.randomId(16));const D=o.id?o.id:"",S=o.hasId?o.hasId:"",T=o.linkId?o.linkId:"",E=e.path,O="Memo",k="MULTI",j=[];return t.push({id:D,content:r,createdAt:a,updatedAt:a,deletedAt:d?C.moment(p,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:s,rowStatus:c?"ARCHIVED":"NORMAL",visibility:m,thinoType:g,hasId:S,linkId:T,path:E,creatorName:O,sourceType:k,resourceList:j,webId:v}),t})}async function mw(e,t){var D,S,T,E,O,k;if(!e)return t;const{vault:n}=Ee.getState().dailyNotesState.app;let r;try{r=await n.read(e)}catch(j){console.error(j),r=await n.cachedRead(e)}if(!r)return;const a=C.moment(e.stat.ctime).format("YYYY/MM/DD HH:mm:ss"),o=C.moment(e.stat.mtime).format("YYYY/MM/DD HH:mm:ss"),s=e.path,c="Thino",d="FILE",p="",m="",g=[],v=await BN(r);for(const j of v){const F=_N(j.content);for(const B of F){const R=B.metadata.match(/\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}/g);if(!R)continue;const z=(S=(D=B.metadata.match(/id::([^\]]*)/g))==null?void 0:D[0])==null?void 0:S.replace("id::","");if(!z)continue;const H=R?R[0]:a,Y=R?R[0]:o,U=B.metadata.match(/webId::([^\]]*)/g)?(E=(T=B.metadata.match(/webId::([^\]]*)/g))==null?void 0:T[0])==null?void 0:E.replace("webId::",""):"",J=B.metadata.contains("[pinned::true]"),Q=B.metadata.contains("[archived::true]"),le=B.metadata.contains("[deleted::"),pe=(O=new RegExp(/\[(deleted|DELETED)::([^\]]*)\]/,"g").exec(B.metadata))==null?void 0:O[2],ie=new RegExp(/\[(visibility|VISIBILITY)::("PROTECT"|"PUBLIC")\]/,"g").test(B.metadata)?"PUBLIC":"PRIVATE",se=(k=new RegExp(/\[(thinoType|THINOTYPE)::([^\]]*)\]/,"g").exec(B.metadata))==null?void 0:k[2];t.push({id:z,content:B.content,createdAt:H,updatedAt:Y,deletedAt:le?C.moment(pe,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",pinned:J,rowStatus:Q?"ARCHIVED":"NORMAL",visibility:ie,thinoType:se||"JOURNAL",hasId:p,linkId:m,path:s,creatorName:c,sourceType:d,resourceList:g,webId:U})}}return t}async function gw(e,t){if(!e)return[];const n=Ee.getState().dailyNotesState.settings,{vault:r}=Ee.getState().dailyNotesState.app;if(await YN(n,e)===0)return;let o;try{o=await r.read(e)}catch(g){console.error(g),o=await r.cachedRead(e)}const{content:s,startLine:c}=Wb(o,(n==null?void 0:n.ProcessContentTarget)==="whole"?"":n.ProcessEntriesBelow);let d="",p=0;if(n.DifferentInsertTarget&&(n==null?void 0:n.ProcessContentTarget)!=="whole"&&n.InsertAfterForTask&&!s.includes(n.InsertAfterForTask)){const{content:g,startLine:v}=Wb(o,n.InsertAfterForTask);d=g,p=v}const m=[];$b(n,s,c,m,e),n.DifferentInsertTarget&&d&&$b(n,d,p,m,e),t.push(...m.sort((g,v)=>g.createdAt>v.createdAt?-1:1))}async function yw(e,t){const{app:n}=Ee.getState().dailyNotesState;if(!(e instanceof C.TFile))return;let r;try{r=await n.vault.read(e)}catch(s){console.error(s),r=await n.vault.cachedRead(e)}if(!r)return;const a=JSON.parse(r),o=a==null?void 0:a.nodes;for(const s of o){if(s.type==="group"||s.createdAt===void 0||s.text.trim()==="")continue;const c=C.moment(s==null?void 0:s.createdAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"),d=C.moment(s==null?void 0:s.updatedAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"),p=s!=null&&s.deletedAt?C.moment(s==null?void 0:s.deletedAt,"YYYYMMDDHHmmss").format("YYYY/MM/DD HH:mm:SS"):"",m=!!(s!=null&&s.pinned),g=s!=null&&s.archived?"ARCHIVED":"NORMAL",v=s!=null&&s.visibility?s==null?void 0:s.visibility:"PRIVATE",D=s!=null&&s.thinoType?s==null?void 0:s.thinoType:"JOURNAL",S=s!=null&&s.text?s==null?void 0:s.text:"",T=s!=null&&s.id?s==null?void 0:s.id:"",E=s!=null&&s.hasId?s==null?void 0:s.hasId:"",O=s!=null&&s.linkId?s==null?void 0:s.linkId:"",k=e.path,j="Memo",F="CANVAS",B=[],R=s!=null&&s.webId?s==null?void 0:s.webId:void 0;t.push({id:T,content:S,createdAt:c,updatedAt:d,deletedAt:p,pinned:m,rowStatus:g,visibility:v,thinoType:D,hasId:E,linkId:O,path:k,creatorName:j,sourceType:F,resourceList:B,webId:R})}}async function Gb(e=[]){const t=[],n=[],r=Ee.getState().dailyNotesState.app,{vault:a}=r,{settings:o}=Ee.getState().dailyNotesState,s=r.loadLocalStorage("tokenForSync"),c=async(d,p)=>{for(const m of d)try{await p(m,t)}catch(g){console.error(g),new C.Notice(g)}};if(e.includes("CANVAS")){const d=qN(a);await c(d,yw)}if(e.includes("MULTI")){const d=JN(a,o);await c(d,PI)}if(e.includes("DAILY")){const d=await KN(a);await c(d,gw)}if(e.includes("FILE")||s){const d=QN(a);await c(d,mw)}return{memos:t,commentMemos:n}}function qN(e){return e.getAllLoadedFiles().filter(t=>t instanceof C.TFile&&t.extension==="canvas"&&t.name.includes(".thino"))}function JN(e,t){return e.getMarkdownFiles().filter(n=>{var r,a;return n instanceof C.TFile&&((r=n.parent)==null?void 0:r.path.includes(t.MemoOtherSaveLocation.MemoDefaultMultiFilePath.trim()))&&!((a=n.path)!=null&&a.endsWith("thino.md"))})}async function KN(e){const t=o1();t===void 0&&new C.Notice(N("Please check your daily note plugin OR periodic notes plugin settings")+"folder path is empty or undefined"),e.getAbstractFileByPath(C.normalizePath(t))||new C.Notice(N("Failed to find daily notes folder"));const r=bs();return Object.values(r).filter(a=>a instanceof C.TFile&&a.extension==="md")}function QN(e){return e.getMarkdownFiles().filter(t=>t instanceof C.TFile&&t.name.trim().includes("thino"))}const XN=async(e,t,n)=>{const r=await _d(Ee.getState().dailyNotesState.app)||[],a=r.find(c=>c.id===e),o={...a,title:t,querystring:n},s=r.findIndex(c=>c.id===e);return r[s]=o,await Ep(Ee.getState().dailyNotesState.app,r),[a]};function ek(e){return(e==null?void 0:e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))||e}function tk(e){const t=[];let n=e;for(;n.contains(` `);){const r=n.indexOf(` `);t.push(n.slice(0,r)),n=n.slice(r+1)}return t.push(n),t}async function nk({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=C.moment(),a=Ue.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",s=`${o}/${r.format("YYYYMMDD")}-${a}.md`,c={id:a,content:e,deletedAt:"",path:s,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:"MULTI"},d=Xe.getState().app,{vault:p,fileManager:m}=d,g=p.getAbstractFileByPath(o);(!g||!(g instanceof C.TFolder))&&(new C.Notice(N("Folder not found for the given thino path, is creating a new folder")),await p.createFolder(o)),Qe.setChangedByMemos(!0);const v=await p.create(s,e);return await m.processFrontMatter(v,D=>{D.id=a,D.createdAt=r.format("YYYY/MM/DD HH:mm:ss"),D.updatedAt=r.format("YYYY/MM/DD HH:mm:ss"),D.thinoType=t?"JOURNAL":"TASK-TODO",D.pinned=!1,D.visibility="PUBLIC",D.rowStatus="NORMAL"}),c}async function rk({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=C.moment(),a=Ue.randomId(16),o=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultSingleFilePath)||"basic.thino.md",s={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"},c=Xe.getState().app,{vault:d}=c;let p=d.getAbstractFileByPath(o);(!p||!(p instanceof C.TFile))&&(new C.Notice(N("File not found for the given thino path, is creating a new file")),p=await d.create(o,""));let m="";try{m=await d.read(p)||await d.cachedRead(p)}catch(O){console.error(O),new C.Notice(N("Failed to read current daily note, check if it exists."))}const g=m.indexOf(`# ${r.format("YYYY-MM-DD")}`);let v=m.indexOf(` #`,g+1);v===-1&&(v=m.length);const D=`> [!thino] ${r.format("YYYY/MM/DD HH:mm:ss")} %% [id::${a}] [thinoType::${t?"JOURNAL":"TASK-TODO"}] %%`,S=e.replace(/\n/g,` > `),T=` ${D} > ${S} `;let E;if(g===-1){const O=`# ${r.format("YYYY-MM-DD")}`;E=`${m.substring(0,v)} ${O}${T} ${m.substring(v)}`}else E=`${m.substring(0,v)}${T}${m.substring(v)}`;return setTimeout(async()=>{Qe.setChangedByMemos(!0),await d.modify(p,E)},200),s}async function qb(e){const t=Ee.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},s=Xe.getState().app,{vault:c}=s;let d=c.getAbstractFileByPath(a);(!d||!(d instanceof C.TFile))&&(new C.Notice(N("File not found for the given thino path, is creating a new file")),d=await c.create(a,""));let p="";try{p=await c.read(d)||await c.cachedRead(d)}catch(E){console.error(E),new C.Notice(N("Failed to read current daily note, check if it exists."))}const m=p.indexOf(`# ${n.format("YYYY-MM-DD")}`);let g=p.indexOf(` #`,m+1);g===-1&&(g=p.length);const v=`> [!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,` > `),S=` ${v} > ${D} `;let T;if(m===-1){const E=`# ${n.format("YYYY-MM-DD")}`;T=`${p.substring(0,g)} ${E}${S} ${p.substring(g)}`}else T=`${p.substring(0,g)}${S}${p.substring(g)}`;return Qe.setChangedByMemos(!0),await c.modify(d,T),o}async function ak({content:e,isList:t}){const n=Ee.getState().dailyNotesState.settings,r=(n==null?void 0:n.MemoOtherSaveLocation.MemoDefaultCanvasPath)||"basic.thino.canvas",a=C.moment(),o=Ue.randomId(16),s={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"},c=Xe.getState().app,{vault:d}=c,p=await LN(r,c);if(!p||!(p instanceof C.TFile)){new C.Notice(N("File not found for the given thino path, is creating a new file"));return}const m=await d.read(p),g=JSON.parse(m);if(g.nodes.find(E=>E.id===s.id))return;let D;g.nodes.length>0&&(D=[...g.nodes].reduce((E,O)=>{if(!E.createdAt)return O;const k=C.moment(E.createdAt,"YYYY/MM/DD HH:mm:ss"),j=C.moment(O.createdAt,"YYYY/MM/DD HH:mm:ss");return k.isAfter(j)?E:O}));const S=D?{x:D.x,y:D.y+100,width:D.width,height:D.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:[]}),Qe.setChangedByMemos(!0);const T=JSON.stringify(g,null,2);return await d.modify(p,T),s}async function Jb(e,t,n){var F;const{vault:r}=Ee.getState().dailyNotesState.app||app,a=Ee.getState().dailyNotesState.settings,o=e.replace(/\n/g,"
"),s=n||C.moment(),{DifferentInsertTarget:c,InsertAfterForTask:d,InsertType:p}=a,m=s.format(a.DefaultTimePrefix||"HH:mm"),g=t?"- ":"- [ ] ",v=a!=null&&a.DefaultMemoComposition?`${g}${(F=a==null?void 0:a.DefaultMemoComposition)==null?void 0:F.replace(/{TIME}/g,m).replace(/{CONTENT}/g,o)}`:`${g}${m} ${o}`,D=bs(),S=Fy(s,D);let T;if(S?T=S:T=await Ue.createDailyNoteCheck(s),!T){new C.Notice(N("Failed to create daily note, check if it exists."));return}S||await Xe.fechLocalDailyNotes();let E="";try{E=await r.read(T)||await r.cachedRead(T)}catch(B){console.error(B),new C.Notice(N("Failed to read current daily note, check if it exists."))}const O=p==="end"?"":t?a.InsertAfter:c&&d||a.InsertAfter,k=await jI(O,v,E);n?await r.modify(T,k.content):setTimeout(async()=>{await r.modify(T,k.content)},200);const j=k.posNum===-1?LI(k.content).length-1:k.posNum+1;return Qe.setChangedByMemos(!0),{id:s.format("YYYYMMDDHHmm")+"00"+j,content:e,deletedAt:"",createdAt:s.format("YYYY/MM/DD HH:mm:ss"),updatedAt:s.format("YYYY/MM/DD HH:mm:ss"),thinoType:t?"JOURNAL":"TASK-TODO",path:T.path,hasId:"",linkId:"",pinned:!1,visibility:"PUBLIC",rowStatus:"NORMAL",creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function ok(e){const{vault:t}=Ee.getState().dailyNotesState.app??app,{DefaultMemoComposition:n,InsertAfter:r,DefaultTimePrefix:a,DifferentInsertTarget:o,InsertAfterForTask:s,InsertType:c}=Ee.getState().dailyNotesState.settings;let d=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PRIVATE"?' [visibility::"PRIVATE"]':"");if(e.id){const R=" [webId::"+e.id+"]";d+=R}const p=C.moment();if(e.deletedAt){const R=" [deleted::"+p.format("YYYYMMDDHHmmss")+"]";d+=R}const m=e.content.replace(/\n/g,"
")+d,g=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),v=g.format(a||"HH:mm"),D=e.thinoType?"- [ ] ":"- ",S=n?`${D}${n==null?void 0:n.replace(/{TIME}/g,v).replace(/{CONTENT}/g,m)}`:`${D}${v} ${m}`,T=bs(),E=Fy(g,T);let O;if(E?O=E:O=await Ue.createDailyNoteCheck(g),!O){new C.Notice(N("Failed to create daily note, check if it exists."));return}E||await Xe.fechLocalDailyNotes();let k="";try{k=await t.read(O)||await t.cachedRead(O)}catch(R){console.error(R),new C.Notice(N("Failed to read current daily note, check if it exists."))}const j=c==="end"?"":e.thinoType&&o&&s||r,F=await jI(j,S,k);await t.modify(O,F.content);const B=F.posNum===-1?LI(F.content).length-1:F.posNum+1;return Qe.setChangedByMemos(!0),{id:g.format("YYYYMMDDHHmm")+"00"+B,content:e.content,deletedAt:e.deletedAt??"",createdAt:g.format("YYYY/MM/DD HH:mm:ss"),updatedAt:g.format("YYYY/MM/DD HH:mm:ss"),thinoType:e.thinoType??"JOURNAL",path:O.path,hasId:"",linkId:"",pinned:e.pinned??!1,visibility:"PUBLIC",rowStatus:e.rowStatus??"NORMAL",webId:e.id,creatorName:"Thino",resourceList:[],sourceType:"DAILY"}}async function jI(e,t,n){const r=new RegExp(`s*${await ek(e)}s*`),a=tk(n),o=a.findIndex(p=>r.test(p)),s=(e==null?void 0:e.trim())===""?!0:o===-1;s&&console.error("unable to find insert after line in file.");const c=a.slice(o+1).findIndex(p=>/^#+ |---/.test(p)),d=c!==-1;if(d){let p;for(let m=c+o;m>o;m--)if(!/^[\s\n ]*$/.test(a[m])){p=m;break}return p||(p=o),await Kb(t,n,s?-1:p,d)}else return await Kb(t,n,a.length-1,d)}async function Kb(e,t,n,r){if(n<-1)throw new Error("Invalid position");if(n===-1)return{content:`${t} ${e}`,posNum:-1};const a=t.split(` `),o=a.slice(0,n+1).join(` `),s=a.slice(n+1).join(` `),c=s.trim().length>0;return{content:`${o}${!c&&!r||!o.endsWith(` `)?` `:""}${e}${(c||r?` `:"")+s}`,posNum:n}}const LI=e=>e.split(/\r?\n/);async function ik(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(N("File not found for the given thino path"));return}await t.vault.delete(n)}async function sk(e){const t=Ee.getState().dailyNotesState.app,n=t.vault.getAbstractFileByPath(e.path);if(!(n instanceof C.TFile)){new C.Notice(N("File not found for the given thino path"));return}const a=(await t.vault.read(n)).split(` `),o=a.findIndex(d=>d.includes(e.id));if(o===-1){new C.Notice(N("Thino not found"));return}const s=a.findIndex((d,p)=>p>o&&d.trim()==="");s===-1?a.splice(o,a.length-o):a.splice(o,s-o);const c=a.join(` `);if(!c){new C.Notice(N("Thino not found"));return}Qe.setChangedByMemos(!0),await t.vault.modify(n,c)}async function lk(e){const t=Ee.getState().dailyNotesState.app,n=t.metadataCache.getFirstLinkpathDest("",e.path);if(!n){new C.Notice(N("File not found for the given thino path"));return}const r=await t.vault.read(n),a=JSON.parse(r),o=a.nodes,s=o.findIndex(m=>m.id===e.id);if(s===-1){new C.Notice(N("Thino not found"));return}o.splice(s,1);const c=a.edges;c.filter(m=>m.fromNode===e.id||m.toNode===e.id).forEach(m=>{const g=c.findIndex(v=>v.id===m.id);g!==-1&&c.splice(g,1)}),Qe.setChangedByMemos(!0);const p=JSON.stringify(a,null,2);await t.vault.modify(n,p)}async function uk(e){OI()||new C.Notice(N("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}=Ee.getState().dailyNotesState.app,n=e.id.toString().slice(0,14),r=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(n,"YYYYMMDDHHmmss"))?C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"):C.moment(n,"YYYYMMDDHHmmss"),a=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(r,"day"),o=e.path,s=t.getAbstractFileByPath(o);if(!s){new C.Notice(N("Please check your daily note plugin OR periodic notes plugin settings"));return}const c=await t.read(s),d=c.split(` `),p=a?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),m=d.findIndex(S=>S.includes(e.content.replace(/\n/g,"
").trim())&&S.includes(p)),g=parseInt(e.id.slice(14));let v=m;m===-1&&(v=g-1);const D=d[m]||d[g-1];if(!c){new C.Notice(N("Thino not found"));return}if(D===d[v]){Qe.setChangedByMemos(!0),d.splice(v,1),await t.modify(s,d.join(` `));return}}async function ck(){const{vault:e,metadataCache:t}=Ee.getState().dailyNotesState.app,n=Ee.getState().dailyNotesState.settings,a=o1()+"/"+n.DeleteFileName+".md",o=[],s=t.getFirstLinkpathDest("",a);if(s instanceof C.TFile){let c=await e.read(s),d=dk(c);if(d.length===0)return o;for(let p=0;pe.split(/\r?\n/),fk=e=>{var t;return(t=/^- (\d{14})(\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[1]},hk=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[2]},pk=e=>{var t;return(t=/^- (\d+)\s(.+)\s(deletedAt: )(.+)$/.exec(e))==null?void 0:t[4]};async function mk(e){const t=await _d(Ee.getState().dailyNotesState.app)||[],n=t.findIndex(r=>r.id===e);t.splice(n,1),await Ep(Ee.getState().dailyNotesState.app,t)}const gk=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await _d(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 Ep(t,n),a}else{new C.Notice(N("Query not found"));return}},yk=async e=>{const{app:t}=Ee.getState().dailyNotesState,n=await _d(t)||[],r=n.find(a=>a.id===e);if(r){r.pinnedAt="",await Ep(t,n);return}else{new C.Notice(N("Query not found"));return}};function vk(e,t){const n=/%%(.*?)%%/,r=e.match(n);if(!r)return e;const a=r[1].trim(),o={};a.split(" ").forEach(c=>{const[d,p]=c.slice(1,-1).split("::");o[d]=p});for(const c of Object.keys(t))if(c!=="id"&&c!=="content"){if(c==="rowStatus"&&t.rowStatus==="ARCHIVED"){o.archived="true";continue}else if(c==="rowStatus"&&t.rowStatus==="NORMAL"){delete o.archived;continue}if(c==="deleted"&&t.deleted){const d=C.moment().format("YYYYMMDDHHmmss");o.deleted=d}else typeof t[c]=="boolean"?t[c]?o[c]="true":delete o[c]:t[c]&&(o[c]=t[c])}const s=Object.entries(o).map(([c,d])=>`[${c}::${d}]`).join(" ");return e.replace(n,`%% ${s} %%`)}async function Fo(e,t){if(!e.sourceType||e.sourceType!=="MULTI")return e;const{vault:n,fileManager:r}=Ee.getState().dailyNotesState.app,a=n.getAbstractFileByPath(e.path);if(!a)return e;const o=C.moment();if(await r.processFrontMatter(a,s=>{(t.pinned!==void 0||t.thinoType||t.rowStatus||t.visibility||t.deleted)&&Qe.setChangedByMemos(!0),t.id&&(s.id=t.id),t.thinoType&&(s.thinoType=t.thinoType),t.rowStatus&&(s.rowStatus=t.rowStatus),t.visibility&&(s.visibility=t.visibility),t.webId&&(s.webId=t.webId),t.pinned!==void 0&&(s.pinned=t.pinned),t.deleted!==void 0&&(s.deletedAt=t.deleted?o.format("YYYY/MM/DD HH:mm:ss"):""),s.createdAt||(s.createdAt=o.format("YYYY/MM/DD HH:mm:ss")),s.updatedAt=o.format("YYYY/MM/DD HH:mm:ss")}),t.content){const s=await n.read(a);let c=s;const d=t.content.replace(/\$/g,"$$$$");c=s.replace(e.content,d),await n.modify(a,c)}return Qe.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 Di(e,t){if(!e.sourceType||e.sourceType!=="FILE")return e;const{vault:n}=Ee.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(O){console.error(O),o=await n.cachedRead(r)}const s=o.split(/\r?\n/),c=s.findIndex(O=>O.includes(e.id)||e.webId&&O.includes(e.webId)),d=s[c];if(!d)return e;const p=vk(d,t);if(!d)return e;const m=p+` `,g=s.findIndex((O,k)=>k>c&&O.trim()==="");let v="";g===-1&&(v=s.slice(c+1).join(` `)),g!==-1&&(v=s.slice(c+1,g).join(` `));let D=v;t!=null&&t.content&&(D=t.content.split(/\r?\n/).map(F=>"> "+F).join(` `));const T=(m+D).split(/\r?\n/);s.splice(c,g?g-c:s.length-c,...T);const E=s.join(` `);return await n.modify(r,E),Qe.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: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?a.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Si(e,t){if(!e.sourceType||e.sourceType!=="CANVAS")return e;const{vault:n}=Ee.getState().dailyNotesState.app,r=n.getAbstractFileByPath(e.path);if(!r)return e;const a=await n.read(r),o=JSON.parse(a),s=o.nodes.find(p=>p.id===e.id);if(!s)return e;t.content&&(s.text=t.content),t.thinoType&&(s.thinoType=t.thinoType),t.rowStatus&&(s.rowStatus=t.rowStatus),t.visibility&&(s.visibility=t.visibility),t.pinned!==void 0&&(s.pinned=t.pinned),t.webId&&(s.webId=t.webId);const c=C.moment();t.deleted!==void 0&&(s.deletedAt=t.deleted?c.format("YYYY/MM/DD HH:mm:ss"):""),s.updatedAt=c.format("YYYY/MM/DD HH:mm:ss");const d=JSON.stringify(o,null,2);return await n.modify(r,d),Qe.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?c.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}}async function Ii(e,t){OI()||new C.Notice(N("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}=Ee.getState().dailyNotesState.app,{settings:r}=Ee.getState().dailyNotesState,a=e.id.toString().slice(0,14),o=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"),s=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(o,"day"),c=e.path,d=n.getAbstractFileByPath(c)||n.getAbstractFileByPath(e.path);if(!d)return new C.Notice(N("Please check your daily note plugin OR periodic notes plugin settings")),e;const m=(await n.read(d)).split(` `),g=s?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);let v,D,S;try{v=m.findIndex(j=>{const F=j.replace(/^(-|\*|\d\.|-\s\[.?\])\s\d{2}:\d{2}(:\d{2})?/,"").trim(),B=e.content.replace(/\n/g,"
").trim(),R=j.includes(g),z=F.includes(B);return R&&(z||F===B)}),S=!1,D=parseInt(e.id.slice(14))}catch(j){console.error(j)}let T=v!==-1&&v===D?v:D;v===-1&&(T=D,m[D-1]&&(S=!0));let E=m[D]||m[v];if(E=E.replace(/\s\^([0-9a-zA-Z-]+)$/g,""),!E)return new C.Notice(N("Thino not found")),e;let O=g;if(r.DefaultTimePrefix!=="HH:mm"&&(O=C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format(r.DefaultTimePrefix)),t.content)if(S){const j=e.thinoType==="TASK-TODO"?"- [ ] ":e.thinoType==="TASK-DONE"?"- [x] ":e.thinoType.startsWith("TASK")?`- [${e.thinoType.slice(5)}] `:"- ",F=(e.pinned?" [pinned::true]":"")+(e.rowStatus==="ARCHIVED"?" [archived::true]":"")+(e.visibility==="PUBLIC"?' [visibility::"PUBLIC"]':"");E=`${j}${O} ${t.content.trim()} ${F}`}else{const j=/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2}(:\d{2})?)/.exec(E)[1];E=E.replace(/^(((-|\*)|(\d\.)|(-\s\[.?\]))\s\d{2}:\d{2}(:\d{2})?)/,"").replace(e.content.trim().replace(/\n/g,"
"),t.content.trim().replace(/\n/g,"
")).trim(),E=j+" "+E}if(t.thinoType){const j=t.thinoType==="TASK-TODO"?"- [ ] ":t.thinoType==="TASK-DONE"?"- [x] ":t.thinoType.startsWith("TASK")?`- [${t.thinoType.slice(5)}] `:"- ";E=E.replace(/^((- \[.\] )|((-|\*) ))/,j)}if(t.rowStatus){const j=t.rowStatus==="ARCHIVED"?"[archived::"+(t.rowStatus==="ARCHIVED"?"true":"false")+"]":"";E=E.includes("[archived::")?E.replace(/\[archived::(true|false)\]/,j):E+" "+j}if(t.visibility){const j='[visibility::"'+t.visibility+'"]';E=E.includes("[visibility::")?E.replace(/\[visibility::"(PUBLIC|PROTECTED)"\]/g,j):E+" "+j}if(t.pinned!==void 0){const j=t.pinned?"[pinned::"+(t.pinned?"true":"false")+"]":"";E=E.includes("[pinned::")?E.replace(/\[pinned::(true|false)\]/,t.pinned===!1?"":j):E+" "+j}if(t.webId!==void 0){const j="[webId::"+t.webId+"]";E=E.includes("[webId::")?E.replace(/\[webId::([^\]]+)\]/,t.webId===""?"":j):E+" "+j}const k=C.moment();if(t.deleted!==void 0){const j="[deleted::"+k.format("YYYYMMDDHHmmss")+"]";t.deleted?(E=E.replace(/\[deleted::([^\]]+)\]/,""),E=E+" "+j):t.deleted===!1&&(E=E.replace(/\[deleted::([^\]]+)\]/,""))}if(e.hasId){const j=" ^"+e.hasId;E=E.replace(/\s\^([0-9a-zA-Z-]+)$/g,"")+j}return E!==m[T]?(m.splice(T,1,E),await n.modify(d,m.join(` `)),Qe.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?k.format("YYYY/MM/DD HH:mm:ss"):t.deleted===!1?"":e.deletedAt?e.deletedAt:""}):e}const wk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Si(e,{id:e.id,pinned:!0});case"DAILY":return Ii(e,{id:e.id,pinned:!0});case"MULTI":return Fo(e,{id:e.id,pinned:!0});case"FILE":return Di(e,{id:e.id,pinned:!0})}},bk=e=>{switch(e==null?void 0:e.sourceType){case"CANVAS":return Si(e,{id:e.id,pinned:!1});case"DAILY":return Ii(e,{id:e.id,pinned:!1});case"MULTI":return Fo(e,{id:e.id,pinned:!1});case"FILE":return Di(e,{id:e.id,pinned:!1})}};var vw;(e=>{async function t(T){return await Gb(T)}e.getMyMemos=t;async function n(T){return await Gb([T])}e.updateSpecificTypeMemo=n;function r(){return ck()}e.getMyDeletedMemos=r;function a(T){const E=Te.getMemoById(T);if(E)switch(E==null?void 0:E.sourceType){case"DAILY":return Ii(E,{id:E.id,deleted:!1});case"CANVAS":return Si(E,{id:E.id,deleted:!1});case"MULTI":return Fo(E,{id:E.id,deleted:!1});case"FILE":return Di(E,{id:E.id,deleted:!1})}}e.restoreMemo=a;function o(T){return sk(T)}e.deleteMemoInSingleFile=o;function s(T){return ik(T)}e.deleteMemoInMultiFiles=s;function c(T){return uk(T)}e.deleteMemoInDailyNote=c;function d(T){return lk(T)}e.deleteMemoInCanvas=d;function p(){return FN()}e.getMyQueries=p;async function m(T,E){return await PN(T,E)}e.createQuery=m;function g(T,E,O){return XN(T,E,O)}e.updateQuery=g;function v(T){return mk(T)}e.deleteQueryById=v;function D(T){return gk(T)}e.pinQuery=D;function S(T){return yk(T)}e.unpinQuery=S})(vw||(vw={}));const ya=vw;var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});class Hu extends Error{}class Dk extends Hu{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Sk extends Hu{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class Ik extends Hu{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class Yh extends Hu{}class RI extends Hu{constructor(t){super(`Invalid unit ${t}`)}}class oo extends Hu{}class ul extends Hu{constructor(){super("Zone is an abstract class")}}const $e="numeric",jo="short",Ya="long",sy={year:$e,month:$e,day:$e},BI={year:$e,month:jo,day:$e},Tk={year:$e,month:jo,day:$e,weekday:jo},_I={year:$e,month:Ya,day:$e},HI={year:$e,month:Ya,day:$e,weekday:Ya},YI={hour:$e,minute:$e},zI={hour:$e,minute:$e,second:$e},UI={hour:$e,minute:$e,second:$e,timeZoneName:jo},VI={hour:$e,minute:$e,second:$e,timeZoneName:Ya},ZI={hour:$e,minute:$e,hourCycle:"h23"},WI={hour:$e,minute:$e,second:$e,hourCycle:"h23"},$I={hour:$e,minute:$e,second:$e,hourCycle:"h23",timeZoneName:jo},GI={hour:$e,minute:$e,second:$e,hourCycle:"h23",timeZoneName:Ya},qI={year:$e,month:$e,day:$e,hour:$e,minute:$e},JI={year:$e,month:$e,day:$e,hour:$e,minute:$e,second:$e},KI={year:$e,month:jo,day:$e,hour:$e,minute:$e},QI={year:$e,month:jo,day:$e,hour:$e,minute:$e,second:$e},Ek={year:$e,month:jo,day:$e,weekday:jo,hour:$e,minute:$e},XI={year:$e,month:Ya,day:$e,hour:$e,minute:$e,timeZoneName:jo},eT={year:$e,month:Ya,day:$e,hour:$e,minute:$e,second:$e,timeZoneName:jo},tT={year:$e,month:Ya,day:$e,weekday:Ya,hour:$e,minute:$e,timeZoneName:Ya},nT={year:$e,month:Ya,day:$e,weekday:Ya,hour:$e,minute:$e,second:$e,timeZoneName:Ya};class Cp{get type(){throw new ul}get name(){throw new ul}get ianaName(){return this.name}get isUniversal(){throw new ul}offsetName(t,n){throw new ul}formatOffset(t,n){throw new ul}offset(t){throw new ul}equals(t){throw new ul}get isValid(){throw new ul}}let S0=null;class Py extends Cp{static get instance(){return S0===null&&(S0=new Py),S0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:n,locale:r}){return aT(t,n,r)}formatOffset(t,n){return Gh(this.offset(t),n)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}}let Gg={};function Ck(e){return Gg[e]||(Gg[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"})),Gg[e]}const xk={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Mk(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,a,o,s,c,d,p,m]=r;return[s,a,o,c,d,p,m]}function Nk(e,t){const n=e.formatToParts(t),r=[];for(let a=0;a=0?S:1e3+S,(v-D)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}}let Qb={};function kk(e,t={}){const n=JSON.stringify([e,t]);let r=Qb[n];return r||(r=new Intl.ListFormat(e,t),Qb[n]=r),r}let ww={};function bw(e,t={}){const n=JSON.stringify([e,t]);let r=ww[n];return r||(r=new Intl.DateTimeFormat(e,t),ww[n]=r),r}let Dw={};function Ak(e,t={}){const n=JSON.stringify([e,t]);let r=Dw[n];return r||(r=new Intl.NumberFormat(e,t),Dw[n]=r),r}let Sw={};function Fk(e,t={}){const{base:n,...r}=t,a=JSON.stringify([e,r]);let o=Sw[a];return o||(o=new Intl.RelativeTimeFormat(e,t),Sw[a]=o),o}let zh=null;function Ok(){return zh||(zh=new Intl.DateTimeFormat().resolvedOptions().locale,zh)}function Pk(e){const t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));const n=e.indexOf("-u-");if(n===-1)return[e];{let r,a;try{r=bw(e).resolvedOptions(),a=e}catch{const d=e.substring(0,n);r=bw(d).resolvedOptions(),a=d}const{numberingSystem:o,calendar:s}=r;return[a,o,s]}}function jk(e,t,n){return(n||t)&&(e.includes("-u-")||(e+="-u"),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`)),e}function Lk(e){const t=[];for(let n=1;n<=12;n++){const r=st.utc(2016,n,1);t.push(e(r))}return t}function Rk(e){const t=[];for(let n=1;n<=7;n++){const r=st.utc(2016,11,13+n);t.push(e(r))}return t}function xg(e,t,n,r,a){const o=e.listingMode(n);return o==="error"?null:o==="en"?r(t):a(t)}function Bk(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||new Intl.DateTimeFormat(e.intl).resolvedOptions().numberingSystem==="latn"}class _k{constructor(t,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:a,floor:o,...s}=r;if(!n||Object.keys(s).length>0){const c={useGrouping:!1,...r};r.padTo>0&&(c.minimumIntegerDigits=r.padTo),this.inf=Ak(t,c)}}format(t){if(this.inf){const n=this.floor?Math.floor(t):t;return this.inf.format(n)}else{const n=this.floor?Math.floor(t):s1(t,3);return Wn(n,this.padTo)}}}class Hk{constructor(t,n,r){this.opts=r;let a;if(t.zone.isUniversal){const s=-1*(t.offset/60),c=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;t.offset!==0&&ps.create(c).valid?(a=c,this.dt=t):(a="UTC",r.timeZoneName?this.dt=t:this.dt=t.offset===0?t:st.fromMillis(t.ts+t.offset*60*1e3))}else t.zone.type==="system"?this.dt=t:(this.dt=t,a=t.zone.name);const o={...this.opts};o.timeZone=o.timeZone||a,this.dtf=bw(n,o)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class Yk{constructor(t,n,r){this.opts={style:"long",...r},!n&&rT()&&(this.rtf=Fk(t,r))}format(t,n){return this.rtf?this.rtf.format(t,n):aA(n,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,n){return this.rtf?this.rtf.formatToParts(t,n):[]}}class hn{static fromOpts(t){return hn.create(t.locale,t.numberingSystem,t.outputCalendar,t.defaultToEN)}static create(t,n,r,a=!1){const o=t||Zn.defaultLocale,s=o||(a?"en-US":Ok()),c=n||Zn.defaultNumberingSystem,d=r||Zn.defaultOutputCalendar;return new hn(s,c,d,o)}static resetCache(){zh=null,ww={},Dw={},Sw={}}static fromObject({locale:t,numberingSystem:n,outputCalendar:r}={}){return hn.create(t,n,r)}constructor(t,n,r,a){const[o,s,c]=Pk(t);this.locale=o,this.numberingSystem=n||s||null,this.outputCalendar=r||c||null,this.intl=jk(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Bk(this)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&n?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:hn.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,n=!1,r=!0){return xg(this,t,r,sT,()=>{const a=n?{month:t,day:"numeric"}:{month:t},o=n?"format":"standalone";return this.monthsCache[o][t]||(this.monthsCache[o][t]=Lk(s=>this.extract(s,a,"month"))),this.monthsCache[o][t]})}weekdays(t,n=!1,r=!0){return xg(this,t,r,cT,()=>{const a=n?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},o=n?"format":"standalone";return this.weekdaysCache[o][t]||(this.weekdaysCache[o][t]=Rk(s=>this.extract(s,a,"weekday"))),this.weekdaysCache[o][t]})}meridiems(t=!0){return xg(this,void 0,t,()=>dT,()=>{if(!this.meridiemCache){const n={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[st.utc(2016,11,13,9),st.utc(2016,11,13,19)].map(r=>this.extract(r,n,"dayperiod"))}return this.meridiemCache})}eras(t,n=!0){return xg(this,t,n,fT,()=>{const r={era:t};return this.eraCache[t]||(this.eraCache[t]=[st.utc(-40,1,1),st.utc(2017,1,1)].map(a=>this.extract(a,r,"era"))),this.eraCache[t]})}extract(t,n,r){const a=this.dtFormatter(t,n),o=a.formatToParts(),s=o.find(c=>c.type.toLowerCase()===r);return s?s.value:null}numberFormatter(t={}){return new _k(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,n={}){return new Hk(t,this.intl,n)}relFormatter(t={}){return new Yk(this.intl,this.isEnglish(),t)}listFormatter(t={}){return kk(this.intl,t)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}}let I0=null;class Xr extends Cp{static get utcInstance(){return I0===null&&(I0=new Xr(0)),I0}static instance(t){return t===0?Xr.utcInstance:new Xr(t)}static parseSpecifier(t){if(t){const n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new Xr(Ly(n[1],n[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Gh(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Gh(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,n){return Gh(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}}class zk extends Cp{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function yl(e,t){if(_t(e)||e===null)return t;if(e instanceof Cp)return e;if(Uk(e)){const n=e.toLowerCase();return n==="default"?t:n==="local"||n==="system"?Py.instance:n==="utc"||n==="gmt"?Xr.utcInstance:Xr.parseSpecifier(n)||ps.create(e)}else return xu(e)?Xr.instance(e):typeof e=="object"&&e.offset&&typeof e.offset=="number"?e:new zk(e)}let Xb=()=>Date.now(),eD="system",tD=null,nD=null,rD=null,aD=60,oD;class Zn{static get now(){return Xb}static set now(t){Xb=t}static set defaultZone(t){eD=t}static get defaultZone(){return yl(eD,Py.instance)}static get defaultLocale(){return tD}static set defaultLocale(t){tD=t}static get defaultNumberingSystem(){return nD}static set defaultNumberingSystem(t){nD=t}static get defaultOutputCalendar(){return rD}static set defaultOutputCalendar(t){rD=t}static get twoDigitCutoffYear(){return aD}static set twoDigitCutoffYear(t){aD=t%100}static get throwOnInvalid(){return oD}static set throwOnInvalid(t){oD=t}static resetCaches(){hn.resetCache(),ps.resetCache()}}function _t(e){return typeof e>"u"}function xu(e){return typeof e=="number"}function jy(e){return typeof e=="number"&&e%1===0}function Uk(e){return typeof e=="string"}function Vk(e){return Object.prototype.toString.call(e)==="[object Date]"}function rT(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Zk(e){return Array.isArray(e)?e:[e]}function iD(e,t,n){if(e.length!==0)return e.reduce((r,a)=>{const o=[t(a),a];return r&&n(r[0],o[0])===r[0]?r:o},null)[1]}function Wk(e,t){return t.reduce((n,r)=>(n[r]=e[r],n),{})}function Md(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function hs(e,t,n){return jy(e)&&e>=t&&e<=n}function $k(e,t){return e-t*Math.floor(e/t)}function Wn(e,t=2){const n=e<0;let r;return n?r="-"+(""+-e).padStart(t,"0"):r=(""+e).padStart(t,"0"),r}function gl(e){if(!(_t(e)||e===null||e===""))return parseInt(e,10)}function bu(e){if(!(_t(e)||e===null||e===""))return parseFloat(e)}function i1(e){if(!(_t(e)||e===null||e==="")){const t=parseFloat("0."+e)*1e3;return Math.floor(t)}}function s1(e,t,n=!1){const r=10**t;return(n?Math.trunc:Math.round)(e*r)/r}function xp(e){return e%4===0&&(e%100!==0||e%400===0)}function $h(e){return xp(e)?366:365}function ly(e,t){const n=$k(t-1,12)+1,r=e+(t-n)/12;return n===2?xp(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function l1(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(t.getUTCFullYear()-1900)),+t}function uy(e){const t=(e+Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400))%7,n=e-1,r=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7;return t===4||r===3?53:52}function Iw(e){return e>99?e:e>Zn.twoDigitCutoffYear?1900+e:2e3+e}function aT(e,t,n,r=null){const a=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:t,...o},c=new Intl.DateTimeFormat(n,s).formatToParts(a).find(d=>d.type.toLowerCase()==="timezonename");return c?c.value:null}function Ly(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0,a=n<0||Object.is(n,-0)?-r:r;return n*60+a}function oT(e){const t=Number(e);if(typeof e=="boolean"||e===""||Number.isNaN(t))throw new oo(`Invalid unit value ${e}`);return t}function cy(e,t){const n={};for(const r in e)if(Md(e,r)){const a=e[r];if(a==null)continue;n[t(r)]=oT(a)}return n}function Gh(e,t){const n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),a=e>=0?"+":"-";switch(t){case"short":return`${a}${Wn(n,2)}:${Wn(r,2)}`;case"narrow":return`${a}${n}${r>0?`:${r}`:""}`;case"techie":return`${a}${Wn(n,2)}${Wn(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Ry(e){return Wk(e,["hour","minute","second","millisecond"])}const Gk=["January","February","March","April","May","June","July","August","September","October","November","December"],iT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],qk=["J","F","M","A","M","J","J","A","S","O","N","D"];function sT(e){switch(e){case"narrow":return[...qk];case"short":return[...iT];case"long":return[...Gk];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const lT=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],uT=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Jk=["M","T","W","T","F","S","S"];function cT(e){switch(e){case"narrow":return[...Jk];case"short":return[...uT];case"long":return[...lT];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const dT=["AM","PM"],Kk=["Before Christ","Anno Domini"],Qk=["BC","AD"],Xk=["B","A"];function fT(e){switch(e){case"narrow":return[...Xk];case"short":return[...Qk];case"long":return[...Kk];default:return null}}function eA(e){return dT[e.hour<12?0:1]}function tA(e,t){return cT(t)[e.weekday-1]}function nA(e,t){return sT(t)[e.month-1]}function rA(e,t){return fT(t)[e.year<0?0:1]}function aA(e,t,n="always",r=!1){const a={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(e)===-1;if(n==="auto"&&o){const g=e==="days";switch(t){case 1:return g?"tomorrow":`next ${a[e][0]}`;case-1:return g?"yesterday":`last ${a[e][0]}`;case 0:return g?"today":`this ${a[e][0]}`}}const s=Object.is(t,-0)||t<0,c=Math.abs(t),d=c===1,p=a[e],m=r?d?p[1]:p[2]||p[1]:d?a[e][0]:e;return s?`${c} ${m} ago`:`in ${c} ${m}`}function sD(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const oA={D:sy,DD:BI,DDD:_I,DDDD:HI,t:YI,tt:zI,ttt:UI,tttt:VI,T:ZI,TT:WI,TTT:$I,TTTT:GI,f:qI,ff:KI,fff:XI,ffff:tT,F:JI,FF:QI,FFF:eT,FFFF:nT};class Hr{static create(t,n={}){return new Hr(t,n)}static parseFormat(t){let n=null,r="",a=!1;const o=[];for(let s=0;s0&&o.push({literal:a,val:r}),n=null,r="",a=!a):a||c===n?r+=c:(r.length>0&&o.push({literal:!1,val:r}),r=c,n=c)}return r.length>0&&o.push({literal:a,val:r}),o}static macroTokenToFormatOpts(t){return oA[t]}constructor(t,n){this.opts=n,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...n}).format()}formatDateTime(t,n={}){return this.loc.dtFormatter(t,{...this.opts,...n}).format()}formatDateTimeParts(t,n={}){return this.loc.dtFormatter(t,{...this.opts,...n}).formatToParts()}formatInterval(t,n={}){return this.loc.dtFormatter(t.start,{...this.opts,...n}).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,n={}){return this.loc.dtFormatter(t,{...this.opts,...n}).resolvedOptions()}num(t,n=0){if(this.opts.forceSimple)return Wn(t,n);const r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,n){const r=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(D,S)=>this.loc.extract(t,D,S),s=D=>t.isOffsetFixed&&t.offset===0&&D.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,D.format):"",c=()=>r?eA(t):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),d=(D,S)=>r?nA(t,D):o(S?{month:D}:{month:D,day:"numeric"},"month"),p=(D,S)=>r?tA(t,D):o(S?{weekday:D}:{weekday:D,month:"long",day:"numeric"},"weekday"),m=D=>{const S=Hr.macroTokenToFormatOpts(D);return S?this.formatWithSystemDefault(t,S):D},g=D=>r?rA(t,D):o({era:D},"era"),v=D=>{switch(D){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return c();case"d":return a?o({day:"numeric"},"day"):this.num(t.day);case"dd":return a?o({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return p("short",!0);case"cccc":return p("long",!0);case"ccccc":return p("narrow",!0);case"E":return this.num(t.weekday);case"EEE":return p("short",!1);case"EEEE":return p("long",!1);case"EEEEE":return p("narrow",!1);case"L":return a?o({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return a?o({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return d("short",!0);case"LLLL":return d("long",!0);case"LLLLL":return d("narrow",!0);case"M":return a?o({month:"numeric"},"month"):this.num(t.month);case"MM":return a?o({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return d("short",!1);case"MMMM":return d("long",!1);case"MMMMM":return d("narrow",!1);case"y":return a?o({year:"numeric"},"year"):this.num(t.year);case"yy":return a?o({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return a?o({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return a?o({year:"numeric"},"year"):this.num(t.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return m(D)}};return sD(Hr.parseFormat(n),v)}formatDurationFromString(t,n){const r=d=>{switch(d[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},a=d=>p=>{const m=r(p);return m?this.num(d.get(m),p.length):p},o=Hr.parseFormat(n),s=o.reduce((d,{literal:p,val:m})=>p?d:d.concat(m),[]),c=t.shiftTo(...s.map(r).filter(d=>d));return sD(o,a(c))}}class Oo{constructor(t,n){this.reason=t,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const hT=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Hd(...e){const t=e.reduce((n,r)=>n+r.source,"");return RegExp(`^${t}$`)}function Yd(...e){return t=>e.reduce(([n,r,a],o)=>{const[s,c,d]=o(t,a);return[{...n,...s},c||r,d]},[{},null,1]).slice(0,2)}function zd(e,...t){if(e==null)return[null,null];for(const[n,r]of t){const a=n.exec(e);if(a)return r(a)}return[null,null]}function pT(...e){return(t,n)=>{const r={};let a;for(a=0;aD!==void 0&&(S||D&&m)?-D:D;return[{years:v(bu(n)),months:v(bu(r)),weeks:v(bu(a)),days:v(bu(o)),hours:v(bu(s)),minutes:v(bu(c)),seconds:v(bu(d),d==="-0"),milliseconds:v(i1(p),g)}]}const vA={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function d1(e,t,n,r,a,o,s){const c={year:t.length===2?Iw(gl(t)):gl(t),month:iT.indexOf(n)+1,day:gl(r),hour:gl(a),minute:gl(o)};return s&&(c.second=gl(s)),e&&(c.weekday=e.length>3?lT.indexOf(e)+1:uT.indexOf(e)+1),c}const wA=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function bA(e){const[,t,n,r,a,o,s,c,d,p,m,g]=e,v=d1(t,a,r,n,o,s,c);let D;return d?D=vA[d]:p?D=0:D=Ly(m,g),[v,new Xr(D)]}function DA(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const SA=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,IA=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,TA=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function lD(e){const[,t,n,r,a,o,s,c]=e;return[d1(t,a,r,n,o,s,c),Xr.utcInstance]}function EA(e){const[,t,n,r,a,o,s,c]=e;return[d1(t,c,n,r,a,o,s),Xr.utcInstance]}const CA=Hd(sA,c1),xA=Hd(lA,c1),MA=Hd(uA,c1),NA=Hd(gT),vT=Yd(pA,Ud,Mp,Np),kA=Yd(cA,Ud,Mp,Np),AA=Yd(dA,Ud,Mp,Np),FA=Yd(Ud,Mp,Np);function OA(e){return zd(e,[CA,vT],[xA,kA],[MA,AA],[NA,FA])}function PA(e){return zd(DA(e),[wA,bA])}function jA(e){return zd(e,[SA,lD],[IA,lD],[TA,EA])}function LA(e){return zd(e,[gA,yA])}const RA=Yd(Ud);function BA(e){return zd(e,[mA,RA])}const _A=Hd(fA,hA),HA=Hd(yT),YA=Yd(Ud,Mp,Np);function zA(e){return zd(e,[_A,vT],[HA,YA])}const UA="Invalid Duration",wT={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},VA={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...wT},ao=146097/400,md=146097/4800,ZA={years:{quarters:4,months:12,weeks:ao/7,days:ao,hours:ao*24,minutes:ao*24*60,seconds:ao*24*60*60,milliseconds:ao*24*60*60*1e3},quarters:{months:3,weeks:ao/28,days:ao/4,hours:ao*24/4,minutes:ao*24*60/4,seconds:ao*24*60*60/4,milliseconds:ao*24*60*60*1e3/4},months:{weeks:md/7,days:md,hours:md*24,minutes:md*24*60,seconds:md*24*60*60,milliseconds:md*24*60*60*1e3},...wT},Du=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],WA=Du.slice(0).reverse();function cl(e,t,n=!1){const r={values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new tt(r)}function $A(e){return e<0?Math.floor(e):Math.ceil(e)}function bT(e,t,n,r,a){const o=e[a][n],s=t[n]/o,c=Math.sign(s)===Math.sign(r[a]),d=!c&&r[a]!==0&&Math.abs(s)<=1?$A(s):Math.trunc(s);r[a]+=d,t[n]-=d*o}function GA(e,t){WA.reduce((n,r)=>_t(t[r])?n:(n&&bT(e,t,n,t,r),r),null)}function qA(e){const t={};for(const[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}class tt{constructor(t){const n=t.conversionAccuracy==="longterm"||!1;let r=n?ZA:VA;t.matrix&&(r=t.matrix),this.values=t.values,this.loc=t.loc||hn.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(t,n){return tt.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(t==null||typeof t!="object")throw new oo(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new tt({values:cy(t,tt.normalizeUnit),loc:hn.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(xu(t))return tt.fromMillis(t);if(tt.isDuration(t))return t;if(typeof t=="object")return tt.fromObject(t);throw new oo(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){const[r]=LA(t);return r?tt.fromObject(r,n):tt.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){const[r]=BA(t);return r?tt.fromObject(r,n):tt.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new oo("need to specify a reason the Duration is invalid");const r=t instanceof Oo?t:new Oo(t,n);if(Zn.throwOnInvalid)throw new Ik(r);return new tt({invalid:r})}static normalizeUnit(t){const n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t&&t.toLowerCase()];if(!n)throw new RI(t);return n}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,n={}){const r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Hr.create(this.loc,r).formatDurationFromString(this,t):UA}toHuman(t={}){const n=Du.map(r=>{const a=this.values[r];return _t(a)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:r.slice(0,-1)}).format(a)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=s1(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const n=this.toMillis();if(n<0||n>=864e5)return null;t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t};const r=this.shiftTo("hours","minutes","seconds","milliseconds");let a=t.format==="basic"?"hhmm":"hh:mm";(!t.suppressSeconds||r.seconds!==0||r.milliseconds!==0)&&(a+=t.format==="basic"?"ss":":ss",(!t.suppressMilliseconds||r.milliseconds!==0)&&(a+=".SSS"));let o=r.toFormat(a);return t.includePrefix&&(o="T"+o),o}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const n=tt.fromDurationLike(t),r={};for(const a of Du)(Md(n.values,a)||Md(this.values,a))&&(r[a]=n.get(a)+this.get(a));return cl(this,{values:r},!0)}minus(t){if(!this.isValid)return this;const n=tt.fromDurationLike(t);return this.plus(n.negate())}mapUnits(t){if(!this.isValid)return this;const n={};for(const r of Object.keys(this.values))n[r]=oT(t(this.values[r],r));return cl(this,{values:n},!0)}get(t){return this[tt.normalizeUnit(t)]}set(t){if(!this.isValid)return this;const n={...this.values,...cy(t,tt.normalizeUnit)};return cl(this,{values:n})}reconfigure({locale:t,numberingSystem:n,conversionAccuracy:r,matrix:a}={}){const s={loc:this.loc.clone({locale:t,numberingSystem:n}),matrix:a,conversionAccuracy:r};return cl(this,s)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return GA(this.matrix,t),cl(this,{values:t},!0)}rescale(){if(!this.isValid)return this;const t=qA(this.normalize().shiftToAll().toObject());return cl(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(s=>tt.normalizeUnit(s));const n={},r={},a=this.toObject();let o;for(const s of Du)if(t.indexOf(s)>=0){o=s;let c=0;for(const p in r)c+=this.matrix[p][s]*r[p],r[p]=0;xu(a[s])&&(c+=a[s]);const d=Math.trunc(c);n[s]=d,r[s]=(c*1e3-d*1e3)/1e3;for(const p in a)Du.indexOf(p)>Du.indexOf(s)&&bT(this.matrix,a,p,n,s)}else xu(a[s])&&(r[s]=a[s]);for(const s in r)r[s]!==0&&(n[o]+=s===o?r[s]:r[s]/this.matrix[o][s]);return cl(this,{values:n},!0).normalize()}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=this.values[n]===0?0:-this.values[n];return cl(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function n(r,a){return r===void 0||r===0?a===void 0||a===0:r===a}for(const r of Du)if(!n(this.values[r],t.values[r]))return!1;return!0}}const gd="Invalid Interval";function JA(e,t){return!e||!e.isValid?kn.invalid("missing or invalid start"):!t||!t.isValid?kn.invalid("missing or invalid end"):tt:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:n}={}){return this.isValid?kn.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];const n=t.map(Fh).filter(s=>this.contains(s)).sort(),r=[];let{s:a}=this,o=0;for(;a+this.e?this.e:s;r.push(kn.fromDateTimes(a,c)),a=c,o+=1}return r}splitBy(t){const n=tt.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,a=1,o;const s=[];for(;rd*a));o=+c>+this.e?this.e:c,s.push(kn.fromDateTimes(r,o)),r=o,a+=1}return s}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const n=this.s>t.s?this.s:t.s,r=this.e=r?null:kn.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;const n=this.st.e?this.e:t.e;return kn.fromDateTimes(n,r)}static merge(t){const[n,r]=t.sort((a,o)=>a.s-o.s).reduce(([a,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[a,o.union(s)]:[a.concat([o]),s]:[a,s],[[],null]);return r&&n.push(r),n}static xor(t){let n=null,r=0;const a=[],o=t.map(d=>[{time:d.s,type:"s"},{time:d.e,type:"e"}]),s=Array.prototype.concat(...o),c=s.sort((d,p)=>d.time-p.time);for(const d of c)r+=d.type==="s"?1:-1,r===1?n=d.time:(n&&+n!=+d.time&&a.push(kn.fromDateTimes(n,d.time)),n=null);return kn.merge(a)}difference(...t){return kn.xor([this].concat(t)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:gd}toLocaleString(t=sy,n={}){return this.isValid?Hr.create(this.s.loc.clone(n),t).formatInterval(this):gd}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:gd}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:gd}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:gd}toFormat(t,{separator:n=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${n}${this.e.toFormat(t)}`:gd}toDuration(t,n){return this.isValid?this.e.diff(this.s,t,n):tt.invalid(this.invalidReason)}mapEndpoints(t){return kn.fromDateTimes(t(this.s),t(this.e))}}class Mg{static hasDST(t=Zn.defaultZone){const n=st.now().setZone(t).set({month:12});return!t.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(t){return ps.isValidZone(t)}static normalizeZone(t){return yl(t,Zn.defaultZone)}static months(t="long",{locale:n=null,numberingSystem:r=null,locObj:a=null,outputCalendar:o="gregory"}={}){return(a||hn.create(n,r,o)).months(t)}static monthsFormat(t="long",{locale:n=null,numberingSystem:r=null,locObj:a=null,outputCalendar:o="gregory"}={}){return(a||hn.create(n,r,o)).months(t,!0)}static weekdays(t="long",{locale:n=null,numberingSystem:r=null,locObj:a=null}={}){return(a||hn.create(n,r,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:n=null,numberingSystem:r=null,locObj:a=null}={}){return(a||hn.create(n,r,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return hn.create(t).meridiems()}static eras(t="short",{locale:n=null}={}){return hn.create(n,null,"gregory").eras(t)}static features(){return{relative:rT()}}}function uD(e,t){const n=a=>a.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(tt.fromMillis(r).as("days"))}function KA(e,t,n){const r=[["years",(d,p)=>p.year-d.year],["quarters",(d,p)=>p.quarter-d.quarter+(p.year-d.year)*4],["months",(d,p)=>p.month-d.month+(p.year-d.year)*12],["weeks",(d,p)=>{const m=uD(d,p);return(m-m%7)/7}],["days",uD]],a={},o=e;let s,c;for(const[d,p]of r)n.indexOf(d)>=0&&(s=d,a[d]=p(e,t),c=o.plus(a),c>t?(a[d]--,e=o.plus(a)):e=c);return[e,a,c,s]}function QA(e,t,n,r){let[a,o,s,c]=KA(e,t,n);const d=t-a,p=n.filter(g=>["hours","minutes","seconds","milliseconds"].indexOf(g)>=0);p.length===0&&(s0?tt.fromMillis(d,r).shiftTo(...p).plus(m):m}const f1={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},cD={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},XA=f1.hanidec.replace(/[\[|\]]/g,"").split("");function e6(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let n=0;n=o&&r<=s&&(t+=r-o)}}return parseInt(t,10)}else return t}function No({numberingSystem:e},t=""){return new RegExp(`${f1[e||"latn"]}${t}`)}const t6="missing Intl.DateTimeFormat.formatToParts support";function Wt(e,t=n=>n){return{regex:e,deser:([n])=>t(e6(n))}}const n6=" ",DT=`[ ${n6}]`,ST=new RegExp(DT,"g");function r6(e){return e.replace(/\./g,"\\.?").replace(ST,DT)}function dD(e){return e.replace(/\./g,"").replace(ST," ").toLowerCase()}function ko(e,t){return e===null?null:{regex:RegExp(e.map(r6).join("|")),deser:([n])=>e.findIndex(r=>dD(n)===dD(r))+t}}function fD(e,t){return{regex:e,deser:([,n,r])=>Ly(n,r),groups:t}}function T0(e){return{regex:e,deser:([t])=>t}}function a6(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function o6(e,t){const n=No(t),r=No(t,"{2}"),a=No(t,"{3}"),o=No(t,"{4}"),s=No(t,"{6}"),c=No(t,"{1,2}"),d=No(t,"{1,3}"),p=No(t,"{1,6}"),m=No(t,"{1,9}"),g=No(t,"{2,4}"),v=No(t,"{4,6}"),D=E=>({regex:RegExp(a6(E.val)),deser:([O])=>O,literal:!0}),T=(E=>{if(e.literal)return D(E);switch(E.val){case"G":return ko(t.eras("short",!1),0);case"GG":return ko(t.eras("long",!1),0);case"y":return Wt(p);case"yy":return Wt(g,Iw);case"yyyy":return Wt(o);case"yyyyy":return Wt(v);case"yyyyyy":return Wt(s);case"M":return Wt(c);case"MM":return Wt(r);case"MMM":return ko(t.months("short",!0,!1),1);case"MMMM":return ko(t.months("long",!0,!1),1);case"L":return Wt(c);case"LL":return Wt(r);case"LLL":return ko(t.months("short",!1,!1),1);case"LLLL":return ko(t.months("long",!1,!1),1);case"d":return Wt(c);case"dd":return Wt(r);case"o":return Wt(d);case"ooo":return Wt(a);case"HH":return Wt(r);case"H":return Wt(c);case"hh":return Wt(r);case"h":return Wt(c);case"mm":return Wt(r);case"m":return Wt(c);case"q":return Wt(c);case"qq":return Wt(r);case"s":return Wt(c);case"ss":return Wt(r);case"S":return Wt(d);case"SSS":return Wt(a);case"u":return T0(m);case"uu":return T0(c);case"uuu":return Wt(n);case"a":return ko(t.meridiems(),0);case"kkkk":return Wt(o);case"kk":return Wt(g,Iw);case"W":return Wt(c);case"WW":return Wt(r);case"E":case"c":return Wt(n);case"EEE":return ko(t.weekdays("short",!1,!1),1);case"EEEE":return ko(t.weekdays("long",!1,!1),1);case"ccc":return ko(t.weekdays("short",!0,!1),1);case"cccc":return ko(t.weekdays("long",!0,!1),1);case"Z":case"ZZ":return fD(new RegExp(`([+-]${c.source})(?::(${r.source}))?`),2);case"ZZZ":return fD(new RegExp(`([+-]${c.source})(${r.source})?`),2);case"z":return T0(/[a-z_+-/]{1,256}?/i);default:return D(E)}})(e)||{invalidReason:t6};return T.token=e,T}const i6={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function s6(e,t){const{type:n,value:r}=e;if(n==="literal")return{literal:!0,val:r};const a=t[n];let o=i6[n];if(typeof o=="object"&&(o=o[a]),o)return{literal:!1,val:o}}function l6(e){return[`^${e.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,e]}function u6(e,t,n){const r=e.match(t);if(r){const a={};let o=1;for(const s in n)if(Md(n,s)){const c=n[s],d=c.groups?c.groups+1:1;!c.literal&&c.token&&(a[c.token.val[0]]=c.deser(r.slice(o,o+d))),o+=d}return[r,a]}else return[r,{}]}function c6(e){const t=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let n=null,r;return _t(e.z)||(n=ps.create(e.z)),_t(e.Z)||(n||(n=new Xr(e.Z)),r=e.Z),_t(e.q)||(e.M=(e.q-1)*3+1),_t(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),_t(e.u)||(e.S=i1(e.u)),[Object.keys(e).reduce((o,s)=>{const c=t(s);return c&&(o[c]=e[s]),o},{}),n,r]}let E0=null;function d6(){return E0||(E0=st.fromMillis(1555555555555)),E0}function f6(e,t){if(e.literal)return e;const n=Hr.macroTokenToFormatOpts(e.val),r=ET(n,t);return r==null||r.includes(void 0)?e:r}function IT(e,t){return Array.prototype.concat(...e.map(n=>f6(n,t)))}function TT(e,t,n){const r=IT(Hr.parseFormat(n),e),a=r.map(s=>o6(s,e)),o=a.find(s=>s.invalidReason);if(o)return{input:t,tokens:r,invalidReason:o.invalidReason};{const[s,c]=l6(a),d=RegExp(s,"i"),[p,m]=u6(t,d,c),[g,v,D]=m?c6(m):[null,null,void 0];if(Md(m,"a")&&Md(m,"H"))throw new Yh("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:r,regex:d,rawMatches:p,matches:m,result:g,zone:v,specificOffset:D}}}function h6(e,t,n){const{result:r,zone:a,specificOffset:o,invalidReason:s}=TT(e,t,n);return[r,a,o,s]}function ET(e,t){return e?Hr.create(t,e).formatDateTimeParts(d6()).map(a=>s6(a,e)):null}const CT=[0,31,59,90,120,151,181,212,243,273,304,334],xT=[0,31,60,91,121,152,182,213,244,274,305,335];function io(e,t){return new Oo("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function MT(e,t,n){const r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const a=r.getUTCDay();return a===0?7:a}function NT(e,t,n){return n+(xp(e)?xT:CT)[t-1]}function kT(e,t){const n=xp(e)?xT:CT,r=n.findIndex(o=>ouy(t)?(c=t+1,s=1):c=t,{weekYear:c,weekNumber:s,weekday:o,...Ry(e)}}function hD(e){const{weekYear:t,weekNumber:n,weekday:r}=e,a=MT(t,1,4),o=$h(t);let s=n*7+r-a-3,c;s<1?(c=t-1,s+=$h(c)):s>o?(c=t+1,s-=$h(t)):c=t;const{month:d,day:p}=kT(c,s);return{year:c,month:d,day:p,...Ry(e)}}function C0(e){const{year:t,month:n,day:r}=e,a=NT(t,n,r);return{year:t,ordinal:a,...Ry(e)}}function pD(e){const{year:t,ordinal:n}=e,{month:r,day:a}=kT(t,n);return{year:t,month:r,day:a,...Ry(e)}}function p6(e){const t=jy(e.weekYear),n=hs(e.weekNumber,1,uy(e.weekYear)),r=hs(e.weekday,1,7);return t?n?r?!1:io("weekday",e.weekday):io("week",e.week):io("weekYear",e.weekYear)}function m6(e){const t=jy(e.year),n=hs(e.ordinal,1,$h(e.year));return t?n?!1:io("ordinal",e.ordinal):io("year",e.year)}function AT(e){const t=jy(e.year),n=hs(e.month,1,12),r=hs(e.day,1,ly(e.year,e.month));return t?n?r?!1:io("day",e.day):io("month",e.month):io("year",e.year)}function FT(e){const{hour:t,minute:n,second:r,millisecond:a}=e,o=hs(t,0,23)||t===24&&n===0&&r===0&&a===0,s=hs(n,0,59),c=hs(r,0,59),d=hs(a,0,999);return o?s?c?d?!1:io("millisecond",a):io("second",r):io("minute",n):io("hour",t)}const x0="Invalid DateTime",mD=864e13;function Ng(e){return new Oo("unsupported zone",`the zone "${e.name}" is not supported`)}function M0(e){return e.weekData===null&&(e.weekData=Tw(e.c)),e.weekData}function kh(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new st({...n,...t,old:n})}function OT(e,t,n){let r=e-t*60*1e3;const a=n.offset(r);if(t===a)return[r,t];r-=(a-t)*60*1e3;const o=n.offset(r);return a===o?[r,a]:[e-Math.min(a,o)*60*1e3,Math.max(a,o)]}function gD(e,t){e+=t*60*1e3;const n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function qg(e,t,n){return OT(l1(e),t,n)}function yD(e,t){const n=e.o,r=e.c.year+Math.trunc(t.years),a=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,o={...e.c,year:r,month:a,day:Math.min(e.c.day,ly(r,a))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},s=tt.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),c=l1(o);let[d,p]=OT(c,n,e.zone);return s!==0&&(d+=s,p=e.zone.offset(d)),{ts:d,o:p}}function Ah(e,t,n,r,a,o){const{setZone:s,zone:c}=n;if(e&&Object.keys(e).length!==0){const d=t||c,p=st.fromObject(e,{...n,zone:d,specificOffset:o});return s?p:p.setZone(c)}else return st.invalid(new Oo("unparsable",`the input "${a}" can't be parsed as ${r}`))}function kg(e,t,n=!0){return e.isValid?Hr.create(hn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function N0(e,t){const n=e.c.year>9999||e.c.year<0;let r="";return n&&e.c.year>=0&&(r+="+"),r+=Wn(e.c.year,n?6:4),t?(r+="-",r+=Wn(e.c.month),r+="-",r+=Wn(e.c.day)):(r+=Wn(e.c.month),r+=Wn(e.c.day)),r}function vD(e,t,n,r,a,o){let s=Wn(e.c.hour);return t?(s+=":",s+=Wn(e.c.minute),(e.c.second!==0||!n)&&(s+=":")):s+=Wn(e.c.minute),(e.c.second!==0||!n)&&(s+=Wn(e.c.second),(e.c.millisecond!==0||!r)&&(s+=".",s+=Wn(e.c.millisecond,3))),a&&(e.isOffsetFixed&&e.offset===0&&!o?s+="Z":e.o<0?(s+="-",s+=Wn(Math.trunc(-e.o/60)),s+=":",s+=Wn(Math.trunc(-e.o%60))):(s+="+",s+=Wn(Math.trunc(e.o/60)),s+=":",s+=Wn(Math.trunc(e.o%60)))),o&&(s+="["+e.zone.ianaName+"]"),s}const PT={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},g6={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},y6={ordinal:1,hour:0,minute:0,second:0,millisecond:0},jT=["year","month","day","hour","minute","second","millisecond"],v6=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],w6=["year","ordinal","hour","minute","second","millisecond"];function wD(e){const t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new RI(e);return t}function bD(e,t){const n=yl(t.zone,Zn.defaultZone),r=hn.fromObject(t),a=Zn.now();let o,s;if(_t(e.year))o=a;else{for(const p of jT)_t(e[p])&&(e[p]=PT[p]);const c=AT(e)||FT(e);if(c)return st.invalid(c);const d=n.offset(a);[o,s]=qg(e,d,n)}return new st({ts:o,zone:n,loc:r,o:s})}function DD(e,t,n){const r=_t(n.round)?!0:n.round,a=(s,c)=>(s=s1(s,r||n.calendary?0:2,!0),t.loc.clone(n).relFormatter(n).format(s,c)),o=s=>n.calendary?t.hasSame(e,s)?0:t.startOf(s).diff(e.startOf(s),s).get(s):t.diff(e,s).get(s);if(n.unit)return a(o(n.unit),n.unit);for(const s of n.units){const c=o(s);if(Math.abs(c)>=1)return a(c,s)}return a(e>t?-0:0,n.units[n.units.length-1])}function SD(e){let t={},n;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}class st{constructor(t){const n=t.zone||Zn.defaultZone;let r=t.invalid||(Number.isNaN(t.ts)?new Oo("invalid input"):null)||(n.isValid?null:Ng(n));this.ts=_t(t.ts)?Zn.now():t.ts;let a=null,o=null;if(!r)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(n))[a,o]=[t.old.c,t.old.o];else{const c=n.offset(this.ts);a=gD(this.ts,c),r=Number.isNaN(a.year)?new Oo("invalid input"):null,a=r?null:a,o=r?null:c}this._zone=n,this.loc=t.loc||hn.create(),this.invalid=r,this.weekData=null,this.c=a,this.o=o,this.isLuxonDateTime=!0}static now(){return new st({})}static local(){const[t,n]=SD(arguments),[r,a,o,s,c,d,p]=n;return bD({year:r,month:a,day:o,hour:s,minute:c,second:d,millisecond:p},t)}static utc(){const[t,n]=SD(arguments),[r,a,o,s,c,d,p]=n;return t.zone=Xr.utcInstance,bD({year:r,month:a,day:o,hour:s,minute:c,second:d,millisecond:p},t)}static fromJSDate(t,n={}){const r=Vk(t)?t.valueOf():NaN;if(Number.isNaN(r))return st.invalid("invalid input");const a=yl(n.zone,Zn.defaultZone);return a.isValid?new st({ts:r,zone:a,loc:hn.fromObject(n)}):st.invalid(Ng(a))}static fromMillis(t,n={}){if(xu(t))return t<-mD||t>mD?st.invalid("Timestamp out of range"):new st({ts:t,zone:yl(n.zone,Zn.defaultZone),loc:hn.fromObject(n)});throw new oo(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,n={}){if(xu(t))return new st({ts:t*1e3,zone:yl(n.zone,Zn.defaultZone),loc:hn.fromObject(n)});throw new oo("fromSeconds requires a numerical input")}static fromObject(t,n={}){t=t||{};const r=yl(n.zone,Zn.defaultZone);if(!r.isValid)return st.invalid(Ng(r));const a=Zn.now(),o=_t(n.specificOffset)?r.offset(a):n.specificOffset,s=cy(t,wD),c=!_t(s.ordinal),d=!_t(s.year),p=!_t(s.month)||!_t(s.day),m=d||p,g=s.weekYear||s.weekNumber,v=hn.fromObject(n);if((m||c)&&g)throw new Yh("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&c)throw new Yh("Can't mix ordinal dates with month/day");const D=g||s.weekday&&!m;let S,T,E=gD(a,o);D?(S=v6,T=g6,E=Tw(E)):c?(S=w6,T=y6,E=C0(E)):(S=jT,T=PT);let O=!1;for(const H of S){const Y=s[H];_t(Y)?O?s[H]=T[H]:s[H]=E[H]:O=!0}const k=D?p6(s):c?m6(s):AT(s),j=k||FT(s);if(j)return st.invalid(j);const F=D?hD(s):c?pD(s):s,[B,R]=qg(F,o,r),z=new st({ts:B,zone:r,o:R,loc:v});return s.weekday&&m&&t.weekday!==z.weekday?st.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${z.toISO()}`):z}static fromISO(t,n={}){const[r,a]=OA(t);return Ah(r,a,n,"ISO 8601",t)}static fromRFC2822(t,n={}){const[r,a]=PA(t);return Ah(r,a,n,"RFC 2822",t)}static fromHTTP(t,n={}){const[r,a]=jA(t);return Ah(r,a,n,"HTTP",n)}static fromFormat(t,n,r={}){if(_t(t)||_t(n))throw new oo("fromFormat requires an input string and a format");const{locale:a=null,numberingSystem:o=null}=r,s=hn.fromOpts({locale:a,numberingSystem:o,defaultToEN:!0}),[c,d,p,m]=h6(s,t,n);return m?st.invalid(m):Ah(c,d,r,`format ${n}`,t,p)}static fromString(t,n,r={}){return st.fromFormat(t,n,r)}static fromSQL(t,n={}){const[r,a]=zA(t);return Ah(r,a,n,"SQL",t)}static invalid(t,n=null){if(!t)throw new oo("need to specify a reason the DateTime is invalid");const r=t instanceof Oo?t:new Oo(t,n);if(Zn.throwOnInvalid)throw new Dk(r);return new st({invalid:r})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,n={}){const r=ET(t,hn.fromObject(n));return r?r.map(a=>a?a.val:null).join(""):null}static expandFormat(t,n={}){return IT(Hr.parseFormat(t),hn.fromObject(n)).map(a=>a.val).join("")}get(t){return this[t]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?M0(this).weekYear:NaN}get weekNumber(){return this.isValid?M0(this).weekNumber:NaN}get weekday(){return this.isValid?M0(this).weekday:NaN}get ordinal(){return this.isValid?C0(this.c).ordinal:NaN}get monthShort(){return this.isValid?Mg.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Mg.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Mg.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Mg.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return xp(this.year)}get daysInMonth(){return ly(this.year,this.month)}get daysInYear(){return this.isValid?$h(this.year):NaN}get weeksInWeekYear(){return this.isValid?uy(this.weekYear):NaN}resolvedLocaleOptions(t={}){const{locale:n,numberingSystem:r,calendar:a}=Hr.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:a}}toUTC(t=0,n={}){return this.setZone(Xr.instance(t),n)}toLocal(){return this.setZone(Zn.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=yl(t,Zn.defaultZone),t.equals(this.zone))return this;if(t.isValid){let a=this.ts;if(n||r){const o=t.offset(this.ts),s=this.toObject();[a]=qg(s,o,t)}return kh(this,{ts:a,zone:t})}else return st.invalid(Ng(t))}reconfigure({locale:t,numberingSystem:n,outputCalendar:r}={}){const a=this.loc.clone({locale:t,numberingSystem:n,outputCalendar:r});return kh(this,{loc:a})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const n=cy(t,wD),r=!_t(n.weekYear)||!_t(n.weekNumber)||!_t(n.weekday),a=!_t(n.ordinal),o=!_t(n.year),s=!_t(n.month)||!_t(n.day),c=o||s,d=n.weekYear||n.weekNumber;if((c||a)&&d)throw new Yh("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&a)throw new Yh("Can't mix ordinal dates with month/day");let p;r?p=hD({...Tw(this.c),...n}):_t(n.ordinal)?(p={...this.toObject(),...n},_t(n.day)&&(p.day=Math.min(ly(p.year,p.month),p.day))):p=pD({...C0(this.c),...n});const[m,g]=qg(p,this.o,this.zone);return kh(this,{ts:m,o:g})}plus(t){if(!this.isValid)return this;const n=tt.fromDurationLike(t);return kh(this,yD(this,n))}minus(t){if(!this.isValid)return this;const n=tt.fromDurationLike(t).negate();return kh(this,yD(this,n))}startOf(t){if(!this.isValid)return this;const n={},r=tt.normalizeUnit(t);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(r==="weeks"&&(n.weekday=1),r==="quarters"){const a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(t){return this.isValid?this.plus({[t]:1}).startOf(t).minus(1):this}toFormat(t,n={}){return this.isValid?Hr.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,t):x0}toLocaleString(t=sy,n={}){return this.isValid?Hr.create(this.loc.clone(n),t).formatDateTime(this):x0}toLocaleParts(t={}){return this.isValid?Hr.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:n=!1,suppressMilliseconds:r=!1,includeOffset:a=!0,extendedZone:o=!1}={}){if(!this.isValid)return null;const s=t==="extended";let c=N0(this,s);return c+="T",c+=vD(this,s,n,r,a,o),c}toISODate({format:t="extended"}={}){return this.isValid?N0(this,t==="extended"):null}toISOWeekDate(){return kg(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:n=!1,includeOffset:r=!0,includePrefix:a=!1,extendedZone:o=!1,format:s="extended"}={}){return this.isValid?(a?"T":"")+vD(this,s==="extended",n,t,r,o):null}toRFC2822(){return kg(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return kg(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?N0(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:n=!1,includeOffsetSpace:r=!0}={}){let a="HH:mm:ss.SSS";return(n||t)&&(r&&(a+=" "),n?a+="z":t&&(a+="ZZ")),kg(this,a,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():x0}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const n={...this.c};return t.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,n="milliseconds",r={}){if(!this.isValid||!t.isValid)return tt.invalid("created by diffing an invalid DateTime");const a={locale:this.locale,numberingSystem:this.numberingSystem,...r},o=Zk(n).map(tt.normalizeUnit),s=t.valueOf()>this.valueOf(),c=s?this:t,d=s?t:this,p=QA(c,d,o,a);return s?p.negate():p}diffNow(t="milliseconds",n={}){return this.diff(st.now(),t,n)}until(t){return this.isValid?kn.fromDateTimes(this,t):this}hasSame(t,n){if(!this.isValid)return!1;const r=t.valueOf(),a=this.setZone(t.zone,{keepLocalTime:!0});return a.startOf(n)<=r&&r<=a.endOf(n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const n=t.base||st.fromObject({},{zone:this.zone}),r=t.padding?thisn.valueOf(),Math.min)}static max(...t){if(!t.every(st.isDateTime))throw new oo("max requires all arguments be DateTimes");return iD(t,n=>n.valueOf(),Math.max)}static fromFormatExplain(t,n,r={}){const{locale:a=null,numberingSystem:o=null}=r,s=hn.fromOpts({locale:a,numberingSystem:o,defaultToEN:!0});return TT(s,t,n)}static fromStringExplain(t,n,r={}){return st.fromFormatExplain(t,n,r)}static get DATE_SHORT(){return sy}static get DATE_MED(){return BI}static get DATE_MED_WITH_WEEKDAY(){return Tk}static get DATE_FULL(){return _I}static get DATE_HUGE(){return HI}static get TIME_SIMPLE(){return YI}static get TIME_WITH_SECONDS(){return zI}static get TIME_WITH_SHORT_OFFSET(){return UI}static get TIME_WITH_LONG_OFFSET(){return VI}static get TIME_24_SIMPLE(){return ZI}static get TIME_24_WITH_SECONDS(){return WI}static get TIME_24_WITH_SHORT_OFFSET(){return $I}static get TIME_24_WITH_LONG_OFFSET(){return GI}static get DATETIME_SHORT(){return qI}static get DATETIME_SHORT_WITH_SECONDS(){return JI}static get DATETIME_MED(){return KI}static get DATETIME_MED_WITH_SECONDS(){return QI}static get DATETIME_MED_WITH_WEEKDAY(){return Ek}static get DATETIME_FULL(){return XI}static get DATETIME_FULL_WITH_SECONDS(){return eT}static get DATETIME_HUGE(){return tT}static get DATETIME_HUGE_WITH_SECONDS(){return nT}}function Fh(e){if(st.isDateTime(e))return e;if(e&&e.valueOf&&xu(e.valueOf()))return st.fromJSDate(e);if(e&&typeof e=="object")return st.fromObject(e);throw new oo(`Unknown datetime argument: ${e}, of type ${typeof e}`)}const h1={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},b6={allowHtml:!0};({...h1,...b6});class p1{constructor(t){this.value=t,this.successful=!0}map(t){return new p1(t(this.value))}flatMap(t){return t(this.value)}mapErr(t){return this}bimap(t,n){return this.map(t)}orElse(t){return this.value}cast(){return this}orElseThrow(t){return this.value}}class m1{constructor(t){this.error=t,this.successful=!1}map(t){return this}flatMap(t){return this}mapErr(t){return new m1(t(this.error))}bimap(t,n){return this.mapErr(n)}orElse(t){return t}cast(){return this}orElseThrow(t){throw t?new Error(t(this.error)):new Error(""+this.error)}}var dy;(function(e){function t(o){return new p1(o)}e.success=t;function n(o){return new m1(o)}e.failure=n;function r(o,s,c){return o.successful?s.successful?c(o.value,s.value):n(s.error):n(o.error)}e.flatMap2=r;function a(o,s,c){return r(o,s,(d,p)=>t(c(d,p)))}e.map2=a})(dy||(dy={}));var D6=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Jn<"u"?Jn:typeof self<"u"?self:{},X={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:D6,function(){return function(n){var r={};function a(o){if(r[o])return r[o].exports;var s=r[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=n,a.c=r,a.d=function(o,s,c){a.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:c})},a.r=function(o){Object.defineProperty(o,"__esModule",{value:!0})},a.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(s,"a",s),s},a.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},a.p="",a(a.s=0)}([function(n,r,a){function o(W){if(!(this instanceof o))return new o(W);this._=W}var s=o.prototype;function c(W,re){for(var ye=0;ye>7),buf:function(je){var _e=d(function(ze,gt,Vt,On){return ze.concat(Vt===On.length-1?Buffer.from([gt,0]).readUInt16BE(0):On.readUInt16BE(Vt))},[],je);return Buffer.from(p(function(ze){return(ze<<1&65535)>>8},_e))}(ye.buf)}}),ye}function g(){return typeof Buffer<"u"}function v(){if(!g())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function D(W){v();var re=d(function(_e,ze){return _e+ze},0,W);if(re%8!=0)throw new Error("The bits ["+W.join(", ")+"] add up to "+re+" which is not an even number of bytes; the total should be divisible by 8");var ye,xe=re/8,je=(ye=function(_e){return _e>48},d(function(_e,ze){return _e||(ye(ze)?ze:_e)},null,W));if(je)throw new Error(je+" bit range requested exceeds 48 bit (6 byte) Number max.");return new o(function(_e,ze){var gt=xe+ze;return gt>_e.length?H(ze,xe.toString()+" bytes"):z(gt,d(function(Vt,On){var bn=m(On,Vt.buf);return{coll:Vt.coll.concat(bn.v),buf:bn.buf}},{coll:[],buf:_e.slice(ze,gt)},W).coll)})}function S(W,re){return new o(function(ye,xe){return v(),xe+re>ye.length?H(xe,re+" bytes for "+W):z(xe+re,ye.slice(xe,xe+re))})}function T(W,re){if(typeof(ye=re)!="number"||Math.floor(ye)!==ye||re<0||re>6)throw new Error(W+" requires integer length in range [0, 6].");var ye}function E(W){return T("uintBE",W),S("uintBE("+W+")",W).map(function(re){return re.readUIntBE(0,W)})}function O(W){return T("uintLE",W),S("uintLE("+W+")",W).map(function(re){return re.readUIntLE(0,W)})}function k(W){return T("intBE",W),S("intBE("+W+")",W).map(function(re){return re.readIntBE(0,W)})}function j(W){return T("intLE",W),S("intLE("+W+")",W).map(function(re){return re.readIntLE(0,W)})}function F(W){return W instanceof o}function B(W){return{}.toString.call(W)==="[object Array]"}function R(W){return g()&&Buffer.isBuffer(W)}function z(W,re){return{status:!0,index:W,value:re,furthest:-1,expected:[]}}function H(W,re){return B(re)||(re=[re]),{status:!1,index:-1,value:null,furthest:W,expected:re}}function Y(W,re){if(!re||W.furthest>re.furthest)return W;var ye=W.furthest===re.furthest?function(xe,je){if(function(){if(o._supportsSet!==void 0)return o._supportsSet;var wr=typeof Set<"u";return o._supportsSet=wr,wr}()&&Array.from){for(var _e=new Set(xe),ze=0;ze=0;){if(ze in ye){xe=ye[ze].line,_e===0&&(_e=ye[ze].lineStart);break}(W.charAt(ze)===` `||W.charAt(ze)==="\r"&&W.charAt(ze+1)!==` `)&&(je++,_e===0&&(_e=ze+1)),ze--}var gt=xe+je,Vt=re-_e;return ye[re]={line:gt,lineStart:_e},{offset:re,line:gt+1,column:Vt+1}}function Q(W){if(!F(W))throw new Error("not a parser: "+W)}function le(W,re){return typeof W=="string"?W.charAt(re):W[re]}function pe(W){if(typeof W!="number")throw new Error("not a number: "+W)}function ie(W){if(typeof W!="function")throw new Error("not a function: "+W)}function se(W){if(typeof W!="string")throw new Error("not a string: "+W)}var fe=2,oe=3,we=8,Z=5*we,G=4*we,te=" ";function ge(W,re){return new Array(re+1).join(W)}function Ie(W,re,ye){var xe=re-W.length;return xe<=0?W:ge(ye,xe)+W}function De(W,re,ye,xe){return{from:W-re>0?W-re:0,to:W+ye>xe?xe:W+ye}}function ke(W,re){var ye,xe,je,_e,ze,gt=re.index,Vt=gt.offset,On=1;if(Vt===W.length)return"Got the end of the input";if(R(W)){var bn=Vt-Vt%we,na=Vt-bn,Pn=De(bn,Z,G+we,W.length),wr=p(function(Qt){return p(function(Ta){return Ie(Ta.toString(16),2,"0")},Qt)},function(Qt,Ta){var Ea=Qt.length,Ca=[],Yo=0;if(Ea<=Ta)return[Qt.slice()];for(var zo=0;zo=4&&(ye+=1),On=2,je=p(function(Qt){return Qt.length<=4?Qt.join(" "):Qt.slice(0,4).join(" ")+" "+Qt.slice(4).join(" ")},wr),(ze=(8*(_e.to>0?_e.to-1:_e.to)).toString(16).length)<2&&(ze=2)}else{var ra=W.split(/\r\n|[\n\r\u2028\u2029]/);ye=gt.column-1,xe=gt.line-1,_e=De(xe,fe,oe,ra.length),je=ra.slice(_e.from,_e.to),ze=_e.to.toString().length}var kl=xe-_e.from;return R(W)&&(ze=(8*(_e.to>0?_e.to-1:_e.to)).toString(16).length)<2&&(ze=2),d(function(Qt,Ta,Ea){var Ca,Yo=Ea===kl,zo=Yo?"> ":te;return Ca=R(W)?Ie((8*(_e.from+Ea)).toString(16),ze,"0"):Ie((_e.from+Ea+1).toString(),ze," "),[].concat(Qt,[zo+Ca+" | "+Ta],Yo?[te+ge(" ",ze)+" | "+Ie("",ye," ")+ge("^",On)]:[])},[],je).join(` `)}function Ye(W,re){return[` `,"-- PARSING FAILED "+ge("-",50),` `,ke(W,re),` `,(ye=re.expected,ye.length===1?`Expected: `+ye[0]:`Expected one of the following: `+ye.join(", ")),` `].join("");var ye}function Re(W){return W.flags!==void 0?W.flags:[W.global?"g":"",W.ignoreCase?"i":"",W.multiline?"m":"",W.unicode?"u":"",W.sticky?"y":""].join("")}function rt(){for(var W=[].slice.call(arguments),re=W.length,ye=0;ye=2?pe(re):re=0;var ye=function(je){return RegExp("^(?:"+je.source+")",Re(je))}(W),xe=""+W;return o(function(je,_e){var ze=ye.exec(je.slice(_e));if(ze){if(0<=re&&re<=ze.length){var gt=ze[0],Vt=ze[re];return z(_e+gt.length,Vt)}return H(_e,"valid match group (0 to "+ze.length+") in "+xe)}return H(_e,xe)})}function ft(W){return o(function(re,ye){return z(ye,W)})}function Dt(W){return o(function(re,ye){return H(ye,W)})}function Ct(W){if(F(W))return o(function(re,ye){var xe=W._(re,ye);return xe.index=ye,xe.value="",xe});if(typeof W=="string")return Ct(Je(W));if(W instanceof RegExp)return Ct(lt(W));throw new Error("not a string, regexp, or parser: "+W)}function un(W){return Q(W),o(function(re,ye){var xe=W._(re,ye),je=re.slice(ye,xe.index);return xe.status?H(ye,'not "'+je+'"'):z(ye,null)})}function Ft(W){return ie(W),o(function(re,ye){var xe=le(re,ye);return ye=W.length?H(re,"any character/byte"):z(re+1,le(W,re))}),vr=o(function(W,re){return z(W.length,W.slice(re))}),Ia=o(function(W,re){return re=0}).desc(re)},o.optWhitespace=po,o.Parser=o,o.range=function(W,re){return Ft(function(ye){return W<=ye&&ye<=re}).desc(W+"-"+re)},o.regex=lt,o.regexp=lt,o.sepBy=Ze,o.sepBy1=Ke,o.seq=rt,o.seqMap=Ht,o.seqObj=function(){for(var W,re={},ye=0,xe=(W=arguments,Array.prototype.slice.call(W)),je=xe.length,_e=0;_e255)throw new Error("Value specified to byte constructor ("+W+"=0x"+W.toString(16)+") is larger in value than a single byte.");var re=(W>15?"0x":"0x0")+W.toString(16);return o(function(ye,xe){var je=le(ye,xe);return je===W?z(xe+1,je):H(xe,re)})},buffer:function(W){return S("buffer",W).map(function(re){return Buffer.from(re)})},encodedString:function(W,re){return S("string",re).map(function(ye){return ye.toString(W)})},uintBE:E,uint8BE:E(1),uint16BE:E(2),uint32BE:E(4),uintLE:O,uint8LE:O(1),uint16LE:O(2),uint32LE:O(4),intBE:k,int8BE:k(1),int16BE:k(2),int32BE:k(4),intLE:j,int8LE:j(1),int16LE:j(2),int32LE:j(4),floatBE:S("floatBE",4).map(function(W){return W.readFloatBE(0)}),floatLE:S("floatLE",4).map(function(W){return W.readFloatLE(0)}),doubleBE:S("doubleBE",8).map(function(W){return W.readDoubleBE(0)}),doubleLE:S("doubleLE",8).map(function(W){return W.readDoubleLE(0)})},n.exports=o}])})})(X);var g1=()=>/(?:[#*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\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?))/g;function LT(e){return e==null?e:e.shiftToAll().normalize()}function ID(e){return e.includes("/")&&(e=e.substring(e.lastIndexOf("/")+1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e}X.exports.alt(X.exports.regex(new RegExp(g1(),"")),X.exports.regex(/[0-9\p{Letter}_-]+/u).map(e=>e.toLocaleLowerCase()),X.exports.whitespace.map(e=>"-"),X.exports.any.map(e=>"")).many().map(e=>e.join(""));const S6=X.exports.alt(X.exports.regex(new RegExp(g1(),"")),X.exports.regex(/[0-9\p{Letter}_-]+/u),X.exports.whitespace.map(e=>" "),X.exports.any.map(e=>" ")).many().map(e=>e.join("").split(/\s+/).join(" ").trim());function I6(e){return S6.tryParse(e)}function T6(e){return e=LT(e),e=tt.fromObject(Object.fromEntries(Object.entries(e.toObject()).filter(([,t])=>t>0))),e.toHuman()}var np;(function(e){function t(F,B=h1,R=!1){let z=n(F);if(!z)return B.renderNullAs;switch(z.type){case"null":return B.renderNullAs;case"string":return z.value;case"number":case"boolean":return""+z.value;case"html":return z.value.outerHTML;case"widget":return z.value.markdown();case"link":return z.value.markdown();case"function":return"";case"array":let H="";return R&&(H+="["),H+=z.value.map(Y=>t(Y,B,!0)).join(", "),R&&(H+="]"),H;case"object":return"{ "+Object.entries(z.value).map(Y=>Y[0]+": "+t(Y[1],B,!0)).join(", ")+" }";case"date":return z.value.second==0&&z.value.hour==0&&z.value.minute==0?z.value.toFormat(B.defaultDateFormat):z.value.toFormat(B.defaultDateTimeFormat);case"duration":return T6(z.value)}}e.toString=t;function n(F){return v(F)?{type:"null",value:F}:p(F)?{type:"number",value:F}:d(F)?{type:"string",value:F}:S(F)?{type:"boolean",value:F}:g(F)?{type:"duration",value:F}:m(F)?{type:"date",value:F}:E(F)?{type:"widget",value:F}:D(F)?{type:"array",value:F}:T(F)?{type:"link",value:F}:j(F)?{type:"function",value:F}:O(F)?{type:"html",value:F}:k(F)?{type:"object",value:F}:void 0}e.wrapValue=n;function r(F,B){if(k(F)){let R={};for(let[z,H]of Object.entries(F))R[z]=r(H,B);return R}else if(D(F)){let R=[];for(let z of F)R.push(r(z,B));return R}else return B(F)}e.mapLeaves=r;function a(F,B,R){var z,H;if(F===void 0&&(F=null),B===void 0&&(B=null),F===null&&B===null)return 0;if(F===null)return-1;if(B===null)return 1;let Y=n(F),U=n(B);if(Y===void 0&&U===void 0)return 0;if(Y===void 0)return-1;if(U===void 0)return 1;if(Y.type!=U.type)return Y.type.localeCompare(U.type);if(Y.value===U.value)return 0;switch(Y.type){case"string":return Y.value.localeCompare(U.value);case"number":return Y.valuege),pe=le(J.path).localeCompare(le(Q.path));if(pe!=0)return pe;let ie=J.type.localeCompare(Q.type);return ie!=0?ie:J.subpath&&!Q.subpath?1:!J.subpath&&Q.subpath?-1:!J.subpath&&!Q.subpath?0:((z=J.subpath)!==null&&z!==void 0?z:"").localeCompare((H=Q.subpath)!==null&&H!==void 0?H:"");case"date":return Y.value0;case"boolean":return B.value;case"link":return!!B.value.path;case"date":return B.value.toMillis()!=0;case"duration":return B.value.as("seconds")!=0;case"object":return Object.keys(B.value).length>0;case"array":return B.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}e.isTruthy=s;function c(F){if(F==null)return F;if(e.isArray(F))return[].concat(F.map(B=>c(B)));if(e.isObject(F)){let B={};for(let[R,z]of Object.entries(F))B[R]=c(z);return B}else return F}e.deepCopy=c;function d(F){return typeof F=="string"}e.isString=d;function p(F){return typeof F=="number"}e.isNumber=p;function m(F){return F instanceof st}e.isDate=m;function g(F){return F instanceof tt}e.isDuration=g;function v(F){return F==null}e.isNull=v;function D(F){return Array.isArray(F)}e.isArray=D;function S(F){return typeof F=="boolean"}e.isBoolean=S;function T(F){return F instanceof Br}e.isLink=T;function E(F){return F instanceof y1}e.isWidget=E;function O(F){return typeof HTMLElement<"u"?F instanceof HTMLElement:!1}e.isHtml=O;function k(F){return typeof F=="object"&&!O(F)&&!E(F)&&!D(F)&&!g(F)&&!m(F)&&!T(F)&&F!==void 0&&!v(F)}e.isObject=k;function j(F){return typeof F=="function"}e.isFunction=j})(np||(np={}));var TD;(function(e){function t(a){return np.isObject(a)&&Object.keys(a).length==2&&"key"in a&&"rows"in a}e.isElementGroup=t;function n(a){for(let o of a)if(!t(o))return!1;return!0}e.isGrouping=n;function r(a){if(n(a)){let o=0;for(let s of a)o+=r(s.rows);return o}else return a.length}e.count=r})(TD||(TD={}));class Br{constructor(t){Object.assign(this,t)}static file(t,n=!1,r){return new Br({path:t,embed:n,display:r,subpath:void 0,type:"file"})}static infer(t,n=!1,r){if(t.includes("#^")){let a=t.split("#^");return Br.block(a[0],a[1],n,r)}else if(t.includes("#")){let a=t.split("#");return Br.header(a[0],a[1],n,r)}else return Br.file(t,n,r)}static header(t,n,r,a){return new Br({path:t,embed:r,display:a,subpath:I6(n),type:"header"})}static block(t,n,r,a){return new Br({path:t,embed:r,display:a,subpath:n,type:"block"})}static fromObject(t){return new Br(t)}equals(t){return t==null||t==null?!1:this.path==t.path&&this.type==t.type&&this.subpath==t.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(t){return new Br(Object.assign({},this,{path:t}))}withDisplay(t){return new Br(Object.assign({},this,{display:t}))}withHeader(t){return Br.header(this.path,t,this.embed,this.display)}toFile(){return Br.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let t=new Br(this);return t.embed=!0,t}}fromEmbed(){if(this.embed){let t=new Br(this);return t.embed=!1,t}else return this}markdown(){let t=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?t+="|"+this.display:(t+="|"+ID(this.path),(this.type=="header"||this.type=="block")&&(t+=" > "+this.subpath)),t+="]]",t}obsidianLink(){var t,n;const r=this.path.replace("|","\\|");return this.type=="header"?r+"#"+((t=this.subpath)===null||t===void 0?void 0:t.replace("|","\\|")):this.type=="block"?r+"#^"+((n=this.subpath)===null||n===void 0?void 0:n.replace("|","\\|")):r}fileName(){return ID(this.path).replace(".md","")}}class y1{constructor(t){this.$widget=t}}class E6 extends y1{constructor(t,n){super("dataview:list-pair"),this.key=t,this.value=n}markdown(){return`${np.toString(this.key)}: ${np.toString(this.value)}`}}class C6 extends y1{constructor(t,n){super("dataview:external-link"),this.url=t,this.display=n}markdown(){var t;return`[${(t=this.display)!==null&&t!==void 0?t:this.url}](${this.url})`}}var ED;(function(e){function t(s,c){return new E6(s,c)}e.listPair=t;function n(s,c){return new C6(s,c)}e.externalLink=n;function r(s){return s.$widget==="dataview:list-pair"}e.isListPair=r;function a(s){return s.$widget==="dataview:external-link"}e.isExternalLink=a;function o(s){return r(s)||a(s)}e.isBuiltin=o})(ED||(ED={}));var Nn;(function(e){function t(v){return{type:"variable",name:v}}e.variable=t;function n(v){return{type:"literal",value:v}}e.literal=n;function r(v,D,S){return{type:"binaryop",left:v,op:D,right:S}}e.binaryOp=r;function a(v,D){return{type:"index",object:v,index:D}}e.index=a;function o(v){let D=v.split("."),S=e.variable(D[0]);for(let T=1;T"||v==">="||v=="!="||v=="="}e.isCompareOp=g,e.NULL=e.literal(null)})(Nn||(Nn={}));var Ti;(function(e){function t(m){return{type:"tag",tag:m}}e.tag=t;function n(m){return{type:"csv",path:m}}e.csv=n;function r(m){return{type:"folder",folder:m}}e.folder=r;function a(m,g){return{type:"link",file:m,direction:g?"incoming":"outgoing"}}e.link=a;function o(m,g,v){return{type:"binaryop",left:m,op:g,right:v}}e.binaryOp=o;function s(m,g){return{type:"binaryop",left:m,op:"&",right:g}}e.and=s;function c(m,g){return{type:"binaryop",left:m,op:"|",right:g}}e.or=c;function d(m){return{type:"negate",child:m}}e.negate=d;function p(){return{type:"empty"}}e.empty=p})(Ti||(Ti={}));const CD=new RegExp(g1(),""),Ew={year:tt.fromObject({years:1}),years:tt.fromObject({years:1}),yr:tt.fromObject({years:1}),yrs:tt.fromObject({years:1}),month:tt.fromObject({months:1}),months:tt.fromObject({months:1}),mo:tt.fromObject({months:1}),mos:tt.fromObject({months:1}),week:tt.fromObject({weeks:1}),weeks:tt.fromObject({weeks:1}),wk:tt.fromObject({weeks:1}),wks:tt.fromObject({weeks:1}),w:tt.fromObject({weeks:1}),day:tt.fromObject({days:1}),days:tt.fromObject({days:1}),d:tt.fromObject({days:1}),hour:tt.fromObject({hours:1}),hours:tt.fromObject({hours:1}),hr:tt.fromObject({hours:1}),hrs:tt.fromObject({hours:1}),h:tt.fromObject({hours:1}),minute:tt.fromObject({minutes:1}),minutes:tt.fromObject({minutes:1}),min:tt.fromObject({minutes:1}),mins:tt.fromObject({minutes:1}),m:tt.fromObject({minutes:1}),second:tt.fromObject({seconds:1}),seconds:tt.fromObject({seconds:1}),sec:tt.fromObject({seconds:1}),secs:tt.fromObject({seconds:1}),s:tt.fromObject({seconds:1})},Cw={now:()=>st.local(),today:()=>st.local().startOf("day"),yesterday:()=>st.local().startOf("day").minus(tt.fromObject({days:1})),tomorrow:()=>st.local().startOf("day").plus(tt.fromObject({days:1})),sow:()=>st.local().startOf("week"),"start-of-week":()=>st.local().startOf("week"),eow:()=>st.local().endOf("week"),"end-of-week":()=>st.local().endOf("week"),soy:()=>st.local().startOf("year"),"start-of-year":()=>st.local().startOf("year"),eoy:()=>st.local().endOf("year"),"end-of-year":()=>st.local().endOf("year"),som:()=>st.local().startOf("month"),"start-of-month":()=>st.local().startOf("month"),eom:()=>st.local().endOf("month"),"end-of-month":()=>st.local().endOf("month")},xw=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function x6(e){let t=-1;for(;(t=e.indexOf("|",t+1))>=0;)if(!(t>0&&e[t-1]=="\\"))return[e.substring(0,t).replace(/\\\|/g,"|"),e.substring(t+1)];return[e.replace(/\\\|/g,"|"),void 0]}function M6(e){let[t,n]=x6(e);return Br.infer(t,!1,n)}function Oh(e,t,n){return X.exports.seqMap(e,X.exports.seq(X.exports.optWhitespace,t,X.exports.optWhitespace,e).many(),(r,a)=>{if(a.length==0)return r;let o=n(r,a[0][1],a[0][3]);for(let s=1;s(a,o)=>{let s=e._(a,o);if(!s.status)return s;for(let c of t){let d=c(s.value)._(a,s.index);if(!d.status)return s;s=d}return s})}const Ao=X.exports.createLanguage({number:e=>X.exports.regexp(/-?[0-9]+(\.[0-9]+)?/).map(t=>Number.parseFloat(t)).desc("number"),string:e=>X.exports.string('"').then(X.exports.alt(e.escapeCharacter,X.exports.noneOf('"\\')).atLeast(0).map(t=>t.join(""))).skip(X.exports.string('"')).desc("string"),escapeCharacter:e=>X.exports.string("\\").then(X.exports.any).map(t=>t==='"'?'"':t==="\\"?"\\":"\\"+t),bool:e=>X.exports.regexp(/true|false|True|False/).map(t=>t.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:e=>X.exports.seqMap(X.exports.string("#"),X.exports.alt(X.exports.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(t,n)=>t+n.join("")).desc("tag ('#hello/stuff')"),identifier:e=>X.exports.seqMap(X.exports.alt(X.exports.regexp(new RegExp("\\p{Letter}","u")),X.exports.regexp(CD).desc("text")),X.exports.alt(X.exports.regexp(/[0-9\p{Letter}_-]/u),X.exports.regexp(CD).desc("text")).many(),(t,n)=>t+n.join("")).desc("variable identifier"),link:e=>X.exports.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(t=>M6(t)).desc("file link"),embedLink:e=>X.exports.seqMap(X.exports.string("!").atMost(1),e.link,(t,n)=>(t.length>0&&(n.embed=!0),n)).desc("file link"),binaryPlusMinus:e=>X.exports.regexp(/\+|-/).map(t=>t).desc("'+' or '-'"),binaryMulDiv:e=>X.exports.regexp(/\*|\/|%/).map(t=>t).desc("'*' or '/' or '%'"),binaryCompareOp:e=>X.exports.regexp(/>=|<=|!=|>|<|=/).map(t=>t).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:e=>X.exports.regexp(/and|or|&|\|/i).map(t=>t.toLowerCase()=="and"?"&":t.toLowerCase()=="or"?"|":t).desc("'and' or 'or'"),rootDate:e=>X.exports.seqMap(X.exports.regexp(/\d{4}/),X.exports.string("-"),X.exports.regexp(/\d{2}/),(t,n,r)=>st.fromObject({year:Number.parseInt(t),month:Number.parseInt(r)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:e=>X.exports.alt(...Object.keys(Cw).sort((t,n)=>n.length-t.length).map(X.exports.string)),date:e=>N6(e.rootDate,t=>X.exports.seqMap(X.exports.string("-"),X.exports.regexp(/\d{2}/),(n,r)=>t.set({day:Number.parseInt(r)})),t=>X.exports.seqMap(X.exports.string("T"),X.exports.regexp(/\d{2}/),(n,r)=>t.set({hour:Number.parseInt(r)})),t=>X.exports.seqMap(X.exports.string(":"),X.exports.regexp(/\d{2}/),(n,r)=>t.set({minute:Number.parseInt(r)})),t=>X.exports.seqMap(X.exports.string(":"),X.exports.regexp(/\d{2}/),(n,r)=>t.set({second:Number.parseInt(r)})),t=>X.exports.alt(X.exports.seqMap(X.exports.string("."),X.exports.regexp(/\d{3}/),(n,r)=>t.set({millisecond:Number.parseInt(r)})),X.exports.succeed(t)),t=>X.exports.alt(X.exports.seqMap(X.exports.string("+").or(X.exports.string("-")),X.exports.regexp(/\d{1,2}(:\d{2})?/),(n,r)=>t.setZone("UTC"+n+r,{keepLocalTime:!0})),X.exports.seqMap(X.exports.string("Z"),()=>t.setZone("utc",{keepLocalTime:!0})),X.exports.seqMap(X.exports.string("["),X.exports.regexp(/[0-9A-Za-z+-\/]+/u),X.exports.string("]"),(n,r,a)=>t.setZone(r,{keepLocalTime:!0})))).assert(t=>t.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:e=>X.exports.alt(e.dateShorthand.map(t=>Cw[t]()),e.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:e=>X.exports.alt(...Object.keys(Ew).sort((t,n)=>n.length-t.length).map(X.exports.string)),duration:e=>X.exports.seqMap(e.number,X.exports.optWhitespace,e.durationType,(t,n,r)=>Ew[r].mapUnits(a=>a*t)).sepBy1(X.exports.string(",").trim(X.exports.optWhitespace).or(X.exports.optWhitespace)).map(t=>t.reduce((n,r)=>n.plus(r))).desc("duration like 4hr2min"),rawNull:e=>X.exports.string("null"),tagSource:e=>e.tag.map(t=>Ti.tag(t)),csvSource:e=>X.exports.seqMap(X.exports.string("csv(").skip(X.exports.optWhitespace),e.string,X.exports.string(")"),(t,n,r)=>Ti.csv(n)),linkIncomingSource:e=>e.link.map(t=>Ti.link(t.path,!0)),linkOutgoingSource:e=>X.exports.seqMap(X.exports.string("outgoing(").skip(X.exports.optWhitespace),e.link,X.exports.string(")"),(t,n,r)=>Ti.link(n.path,!1)),folderSource:e=>e.string.map(t=>Ti.folder(t)),parensSource:e=>X.exports.seqMap(X.exports.string("("),X.exports.optWhitespace,e.source,X.exports.optWhitespace,X.exports.string(")"),(t,n,r,a,o)=>r),negateSource:e=>X.exports.seqMap(X.exports.alt(X.exports.string("-"),X.exports.string("!")),e.atomSource,(t,n)=>Ti.negate(n)),atomSource:e=>X.exports.alt(e.parensSource,e.negateSource,e.linkOutgoingSource,e.linkIncomingSource,e.folderSource,e.tagSource,e.csvSource),binaryOpSource:e=>Oh(e.atomSource,e.binaryBooleanOp.map(t=>t),Ti.binaryOp),source:e=>e.binaryOpSource,variableField:e=>e.identifier.chain(t=>xw.includes(t.toUpperCase())?X.exports.fail("Variable fields cannot be a keyword ("+xw.join(" or ")+")"):X.exports.succeed(Nn.variable(t))).desc("variable"),numberField:e=>e.number.map(t=>Nn.literal(t)).desc("number"),stringField:e=>e.string.map(t=>Nn.literal(t)).desc("string"),boolField:e=>e.bool.map(t=>Nn.literal(t)).desc("boolean"),dateField:e=>X.exports.seqMap(X.exports.string("date("),X.exports.optWhitespace,e.datePlus,X.exports.optWhitespace,X.exports.string(")"),(t,n,r,a,o)=>Nn.literal(r)).desc("date"),durationField:e=>X.exports.seqMap(X.exports.string("dur("),X.exports.optWhitespace,e.duration,X.exports.optWhitespace,X.exports.string(")"),(t,n,r,a,o)=>Nn.literal(r)).desc("duration"),nullField:e=>e.rawNull.map(t=>Nn.NULL),linkField:e=>e.link.map(t=>Nn.literal(t)),listField:e=>e.field.sepBy(X.exports.string(",").trim(X.exports.optWhitespace)).wrap(X.exports.string("[").skip(X.exports.optWhitespace),X.exports.optWhitespace.then(X.exports.string("]"))).map(t=>Nn.list(t)).desc("list ('[1, 2, 3]')"),objectField:e=>X.exports.seqMap(e.identifier.or(e.string),X.exports.string(":").trim(X.exports.optWhitespace),e.field,(t,n,r)=>({name:t,value:r})).sepBy(X.exports.string(",").trim(X.exports.optWhitespace)).wrap(X.exports.string("{").skip(X.exports.optWhitespace),X.exports.optWhitespace.then(X.exports.string("}"))).map(t=>{let n={};for(let r of t)n[r.name]=r.value;return Nn.object(n)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:e=>X.exports.alt(e.date,e.duration.map(t=>LT(t)),e.string,e.tag,e.embedLink,e.bool,e.number,e.rawNull),inlineFieldList:e=>e.atomInlineField.sepBy(X.exports.string(",").trim(X.exports.optWhitespace).lookahead(e.atomInlineField)),inlineField:e=>X.exports.alt(X.exports.seqMap(e.atomInlineField,X.exports.string(",").trim(X.exports.optWhitespace),e.inlineFieldList,(t,n,r)=>[t].concat(r)),e.atomInlineField),atomField:e=>X.exports.alt(e.embedLink.map(t=>Nn.literal(t)),e.negatedField,e.linkField,e.listField,e.objectField,e.lambdaField,e.parensField,e.boolField,e.numberField,e.stringField,e.dateField,e.durationField,e.nullField,e.variableField),indexField:e=>X.exports.seqMap(e.atomField,X.exports.alt(e.dotPostfix,e.indexPostfix,e.functionPostfix).many(),(t,n)=>{let r=t;for(let a of n)switch(a.type){case"dot":r=Nn.index(r,Nn.literal(a.field));break;case"index":r=Nn.index(r,a.field);break;case"function":r=Nn.func(r,a.fields);break}return r}),negatedField:e=>X.exports.seqMap(X.exports.string("!"),e.indexField,(t,n)=>Nn.negate(n)).desc("negated field"),parensField:e=>X.exports.seqMap(X.exports.string("("),X.exports.optWhitespace,e.field,X.exports.optWhitespace,X.exports.string(")"),(t,n,r,a,o)=>r),lambdaField:e=>X.exports.seqMap(e.identifier.sepBy(X.exports.string(",").trim(X.exports.optWhitespace)).wrap(X.exports.string("(").trim(X.exports.optWhitespace),X.exports.string(")").trim(X.exports.optWhitespace)),X.exports.string("=>").trim(X.exports.optWhitespace),e.field,(t,n,r)=>({type:"lambda",arguments:t,value:r})),dotPostfix:e=>X.exports.seqMap(X.exports.string("."),e.identifier,(t,n)=>({type:"dot",field:n})),indexPostfix:e=>X.exports.seqMap(X.exports.string("["),X.exports.optWhitespace,e.field,X.exports.optWhitespace,X.exports.string("]"),(t,n,r,a,o)=>({type:"index",field:r})),functionPostfix:e=>X.exports.seqMap(X.exports.string("("),X.exports.optWhitespace,e.field.sepBy(X.exports.string(",").trim(X.exports.optWhitespace)),X.exports.optWhitespace,X.exports.string(")"),(t,n,r,a,o)=>({type:"function",fields:r})),binaryMulDivField:e=>Oh(e.indexField,e.binaryMulDiv,Nn.binaryOp),binaryPlusMinusField:e=>Oh(e.binaryMulDivField,e.binaryPlusMinus,Nn.binaryOp),binaryCompareField:e=>Oh(e.binaryPlusMinusField,e.binaryCompareOp,Nn.binaryOp),binaryBooleanField:e=>Oh(e.binaryCompareField,e.binaryBooleanOp,Nn.binaryOp),binaryOpField:e=>e.binaryBooleanField,field:e=>e.binaryOpField});function k6(e){try{return dy.success(Ao.field.tryParse(e))}catch(t){return dy.failure(""+t)}}var fy;(function(e){function t(r,a){return{name:r,field:a}}e.named=t;function n(r,a){return{field:r,direction:a}}e.sortBy=n})(fy||(fy={}));function A6(e){return X.exports.custom((t,n)=>(r,a)=>{let o=e._(r,a);return o.status?Object.assign({},o,{value:[o.value,r.substring(a,o.index)]}):o})}function F6(e){return e.split(/[\r\n]+/).map(t=>t.trim()).join("")}const O6=X.exports.createLanguage({queryType:e=>X.exports.alt(X.exports.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(t=>t.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:e=>X.exports.seqMap(Ao.field.skip(X.exports.whitespace),X.exports.regexp(/AS/i).skip(X.exports.whitespace),Ao.identifier.or(Ao.string),(t,n,r)=>fy.named(r,t)),namedField:e=>X.exports.alt(e.explicitNamedField,A6(Ao.field).map(([t,n])=>fy.named(F6(n),t))),sortField:e=>X.exports.seqMap(Ao.field.skip(X.exports.optWhitespace),X.exports.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(t,n)=>{let r=n.length==0?"ascending":n[0].toLowerCase();return r=="desc"&&(r="descending"),r=="asc"&&(r="ascending"),{field:t,direction:r}}),headerClause:e=>e.queryType.skip(X.exports.whitespace).chain(t=>{switch(t){case"table":return X.exports.seqMap(X.exports.regexp(/WITHOUT\s+ID/i).skip(X.exports.optWhitespace).atMost(1),X.exports.sepBy(e.namedField,X.exports.string(",").trim(X.exports.optWhitespace)),(n,r)=>({type:"table",fields:r,showId:n.length==0}));case"list":return X.exports.seqMap(X.exports.regexp(/WITHOUT\s+ID/i).skip(X.exports.optWhitespace).atMost(1),Ao.field.atMost(1),(n,r)=>({type:"list",format:r.length==1?r[0]:void 0,showId:n.length==0}));case"task":return X.exports.succeed({type:"task"});case"calendar":return X.exports.seqMap(e.namedField,n=>({type:"calendar",showId:!0,field:n}));default:return X.exports.fail(`Unrecognized query type '${t}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:e=>X.exports.seqMap(X.exports.regexp(/FROM/i),X.exports.whitespace,Ao.source,(t,n,r)=>r),whereClause:e=>X.exports.seqMap(X.exports.regexp(/WHERE/i),X.exports.whitespace,Ao.field,(t,n,r)=>({type:"where",clause:r})).desc("WHERE "),sortByClause:e=>X.exports.seqMap(X.exports.regexp(/SORT/i),X.exports.whitespace,e.sortField.sepBy1(X.exports.string(",").trim(X.exports.optWhitespace)),(t,n,r)=>({type:"sort",fields:r})).desc("SORT field [ASC/DESC]"),limitClause:e=>X.exports.seqMap(X.exports.regexp(/LIMIT/i),X.exports.whitespace,Ao.field,(t,n,r)=>({type:"limit",amount:r})).desc("LIMIT "),flattenClause:e=>X.exports.seqMap(X.exports.regexp(/FLATTEN/i).skip(X.exports.whitespace),e.namedField,(t,n)=>({type:"flatten",field:n})).desc("FLATTEN [AS ]"),groupByClause:e=>X.exports.seqMap(X.exports.regexp(/GROUP BY/i).skip(X.exports.whitespace),e.namedField,(t,n)=>({type:"group",field:n})).desc("GROUP BY [AS ]"),clause:e=>X.exports.alt(e.fromClause,e.whereClause,e.sortByClause,e.limitClause,e.groupByClause,e.flattenClause),query:e=>X.exports.seqMap(e.headerClause.trim(X.exports.optWhitespace),e.fromClause.trim(X.exports.optWhitespace).atMost(1),e.clause.trim(X.exports.optWhitespace).many(),(t,n,r)=>({header:t,source:n.length==0?Ti.folder(""):n[0],operations:r,settings:h1}))}),P6=e=>{var t;return e?(t=e.plugins.plugins.dataview)===null||t===void 0?void 0:t.api:window.DataviewAPI},j6=e=>e.plugins.enabledPlugins.has("dataview");Ds.DATE_SHORTHANDS=Cw;Ds.DURATION_TYPES=Ew;Ds.EXPRESSION=Ao;Ds.KEYWORDS=xw;Ds.QUERY_LANGUAGE=O6;var L6=Ds.getAPI=P6;Ds.isPluginEnabled=j6;Ds.parseField=k6;async function R6(e,t,n,r,a){var E,O;const{vault:o,metadataCache:s}=Ee.getState().dailyNotesState.app===void 0?app:Ee.getState().dailyNotesState.app,c=Ee.getState().dailyNotesState.settings,d=e.replace(/\n/g,"
");if(n===void 0)return;const p=s.getFirstLinkpathDest("",n),m=C.moment(),g=m.format("YYYYMMDDHHmmss"),v=r.slice(14),D=" ",S=g+" "+d.trim(),T=D+"- "+g+" "+d.trim();if(p){let k;if(c!=null&&c.CommentOnMemos&&(c!=null&&c.CommentsInOriginalNotes)){const R=L6();if(R!==void 0)try{k=(O=(E=R.page(p.path))==null?void 0:E.file.lists.values)==null?void 0:O.filter(z=>z.line===parseInt(v))}catch(z){console.error(z)}}const j=await o.read(p);let F=0;k[0].children.values.length>0?F=k[0].children.values[k[0].children.values.length-1].line:F=k[0].line;const B=await B6(T,j,F);if(await o.modify(p,B.content),t)return{id:g+(F+1),content:S,deletedAt:"",createdAt:m.format("YYYY/MM/DD HH:mm:ss"),updatedAt:m.format("YYYY/MM/DD HH:mm:ss"),thinoType:"JOURNAL",path:p.path,hasId:"",linkId:a}}}async function B6(e,t,n){if(n===-1)return{content:`${t} ${e}`,posNum:-1};const r=t.split(` `),a=r.slice(0,n+1).join(` `),o=r.slice(n+1).join(` `);return/^\s*$/g.test(r[n+1])?{content:`${a} ${e} ${o}`,posNum:n}:{content:`${a} ${e} ${o}`,posNum:n}}function _6(e,t,n){var a;const r=t.workspace.getLeavesOfType("markdown");for(const o of r){const s=o.view;if(((a=s==null?void 0:s.file)==null?void 0:a.path)===e){t.workspace.revealLeaf(o);try{return o.view.setEphemeralState({line:n}),!0}catch(c){return console.error(c),!1}}}return!1}const v1=async e=>{var o;const t=Xe.getState().app,n=t.workspace.getLeavesOfType("markdown");for(const s of n){const c=s.view;if(((o=c==null?void 0:c.file)==null?void 0:o.path)===e){t.workspace.revealLeaf(s);return}}const r=t.metadataCache.getFirstLinkpathDest("",e);if(!r){new C.Notice(N("File not found for the given thino path"));return}await t.workspace.getLeaf(!0).openFile(r)},w1=async(e,t)=>{const{app:n}=Xe.getState(),r=parseInt(e.slice(14));if(_6(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}})}},b1=async(e,t)=>{var p,m,g;const n=Xe.getState().app,r=n.metadataCache.getFirstLinkpathDest("",t);if(!r){new C.Notice(N("File not found for the given thino path"));return}let a="";try{a=await n.vault.read(r)}catch(v){console.error(v),a=await n.vault.cachedRead(r)}const s=a.split(/\r?\n/).findIndex(v=>v.contains(e)),c=n.workspace.getLeavesOfType("markdown");for(const v of c){const D=v.view;if(((p=D==null?void 0:D.file)==null?void 0:p.path)===r.path){n.workspace.revealLeaf(v);try{(m=v.view.editor)==null||m.setCursor({line:s,ch:1});return}catch(S){console.error(S)}}}const d=n.workspace.getLeaf(!0);await d.openFile(r,{eState:{line:s}});try{(g=d.view.editor)==null||g.setCursor({line:s,ch:1})}catch(v){console.error(v)}},D1=async(e,t)=>{var c;const n=Xe.getState().app,r=(d,p)=>{var g;const m=(g=Array.from(d.nodes.values()))==null?void 0:g.find(v=>v.id===p);return m?(d.selectOnly(m),d.zoomToSelection(),!0):!1},a=n.workspace.getLeavesOfType("canvas");for(const d of a){const p=d.view;if(((c=p==null?void 0:p.file)==null?void 0:c.path)===t&&(n.workspace.revealLeaf(d),r(p.canvas,e)))return}const o=n.metadataCache.getFirstLinkpathDest("",t);if(!o){new C.Notice(N("File not found for the given thino path"));return}const s=n.workspace.getLeaf(!0);await s.openFile(o),setTimeout(()=>{var d;r((d=s.view)==null?void 0:d.canvas,e)},10)},H6="https://api.thino.pkmer.cn/test",Vd=H6,Y6="unknown",z6=/!\[(?[^\]]+)\]\((?[^)]+)\)/g;function U6(e){return e.substring(e.lastIndexOf(".")+1)}function V6(e){return{id:e.id,createdAt:Date.now().toString(),filename:e.id,type:`${U6(e.id)}`,size:e.size.toString()}}function Z6(e){const t=e==null?void 0:e.matchAll(z6);return t?Array.from(t).map(n=>{var r;return V6({url:(r=n.groups)==null?void 0:r.link,id:Y6,size:0,mtime:""})}).filter(n=>n.type!="html"):[]}function kp(e){var t;return{id:e.id,createdAt:C.moment(e.ctime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),updatedAt:C.moment(e.mtime.toString(),"x").format("YYYY/MM/DD HH:mm:ss"),deletedAt:(t=e.ttime)!=null&&t.toString()?C.moment(e.ttime.toString(),"x").format("YYYY-MM-DD HH:mm:ss"):"",rowStatus:e.rowStatus,content:e.content,pinned:e.pinned,resourceList:Z6(e.content),creatorName:"thino",sourceType:(e==null?void 0:e.thinoType)||"FILE",visibility:"PUBLIC",localId:e.originalId,deleted:!!e.dtime}}async function W6(e){const n={url:`${Vd}/thino/getThinos${e?`?since=${e}&includeDeleted=true`:""}`,method:"GET",headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to fetch memos: ${r.status}`);try{return r.json.payload.map(o=>kp(o))}catch(a){console.error(`Error processing memo response: ${a}`)}}).catch(r=>(console.error(r),[]))}function Zd(){const e=Ee.getState().dailyNotesState.app||app;return(e==null?void 0:e.loadLocalStorage("tokenForSync"))||""}async function RT(e){const t=`${Vd}/thino/createThino`,n={content:e.content,thinoType:(e==null?void 0:e.thinoType)||"FILE",pinned:!1,rowStatus:"NORMAL",encrypted:!1},r={url:t,method:"POST",contentType:"application/json",body:JSON.stringify(n),headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(r).then(a=>{a.status>=400&&console.error(`Failed to create memo: ${a.status}`);try{const o=a.json;return kp(o.payload)}catch(o){console.error(`Error processing memo creation response: ${o}`)}}).catch(a=>(console.error(a),null))}function $6(e){return{id:e.id,ctime:C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").valueOf(),mtime:C.moment(e.updatedAt,"YYYY/MM/DD HH:mm:ss").valueOf(),ttime:e.deletedAt?C.moment(e.deletedAt,"YYYY/MM/DD HH:mm:ss").valueOf():void 0,rowStatus:e.rowStatus,content:e.content,pinned:e.pinned,encrypted:!1,thinoType:e.sourceType==="DAILY"?"DAILY":"FILE",tags:[]}}async function G6(e){const t=`${Vd}/thino/createThinosByData`,n=e.map(a=>$6(a)),r={url:t,method:"POST",contentType:"application/json",body:JSON.stringify(n),headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(r).then(a=>{a.status>=400&&console.error(`Failed to create thinos: ${a.status}`);try{return a.json.payload.map(c=>kp(c))}catch(o){console.error(`Error processing thinos creation response: ${o}`)}}).catch(a=>(console.error(a),[]))}async function k0(e){const n={url:`${Vd}/thino/updateThinoById/${e.id}`,method:"POST",contentType:"application/json",body:JSON.stringify(e),headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to update memo: ${r.status}`);try{const a=r.json;return kp(a.payload)}catch(a){console.error(`Error processing memo update response: ${a}`)}}).catch(r=>(console.error(r),null))}async function BT(e){const n={url:`${Vd}/thino/recoverThinoFromTrash/${e}`,method:"POST",headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to recover memo: ${r.status}`);try{const a=r.json;return kp(a.payload)}catch(a){console.error(`Error processing memo recovery response: ${a}`)}}).catch(r=>(console.error(r),null))}async function q6(e){const n={url:`${Vd}/thino/deleteThinoById/${e}`,method:"DELETE",headers:{Authorization:`Bearer ${Zd()}`}};return C.requestUrl(n).then(r=>{r.status>=400&&console.error(`Failed to delete memo: ${r.status}`)}).catch(r=>(console.error(r),null))}class J6{constructor(){me(this,"initialized",!1)}getState(){return Ee.getState().memoState}async fetchAllMemos(){const t=Xe.getState().settings;Ue.checkDailyInMulti(t);const n=await ya.getMyMemos(t.EnabledLocationList.map(o=>o.value)),r=[...n.memos],a=[...n.commentMemos];return Ee.dispatch({type:"SET_MEMOS",payload:{memos:r}}),Ee.dispatch({type:"SET_COMMENT_MEMOS",payload:{commentMemos:a}}),this.initialized||(this.initialized=!0,Qe.setLoaded(!0)),r}async updateTypeMemos(t){const n=await ya.updateSpecificTypeMemo(t),r=this.getState().memos.filter(a=>a.sourceType!==t);Ee.dispatch({type:"SET_MEMOS",payload:{memos:[...r,...n.memos]}})}async removeTypeMemos(t){const n=this.getState().memos.filter(r=>r.sourceType!==t);Ee.dispatch({type:"SET_MEMOS",payload:{memos:[...n]}})}async fetchDeletedMemos(){const t=await ya.getMyDeletedMemos();return t.sort((n,r)=>Ue.getTimeStampByDate(r.deletedAt)-Ue.getTimeStampByDate(n.deletedAt)),t}pushMemo(t){Ee.dispatch({type:"INSERT_MEMO",payload:{memo:{...t}}})}pushCommentMemo(t){Ee.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 a=this.getMemoByWebId(t);if(!a)return;let o=null;const s=r?{}:{content:n.content,rowStatus:n.rowStatus,pinned:n.pinned,deleted:!!n.deletedAt,thinoType:n.thinoType??""};switch(a.sourceType){case"DAILY":o=await Ii(a,{id:a.id,webId:n.id,...s});break;case"CANVAS":o=await Si(a,{id:a.id,webId:n.id,...s});break;case"MULTI":o=await Fo(a,{id:a.id,webId:n.id,...s});break;case"FILE":o=await Di(a,{id:a.id,webId:n.id,...s});break}if(!o)return a;Ee.dispatch({type:"EDIT_MEMO",payload:o})}async archiveThinoBulk(t){const n=[];for(const r of t){let a;switch(r.sourceType){case"DAILY":a=await Ii(r,{id:r.id,rowStatus:"ARCHIVED"}),n.push(a);break;case"CANVAS":a=await Si(r,{id:r.id,rowStatus:"ARCHIVED"}),n.push(a);break;case"MULTI":a=await Fo(r,{id:r.id,rowStatus:"ARCHIVED"}),n.push(a);break;case"FILE":a=await Di(r,{id:r.id,rowStatus:"ARCHIVED"}),n.push(a);break}}return n.length>0?(Ee.dispatch({type:"ARCHIVE_MEMO_BY_ID_BULK",payload:n}),n):t}async archiveMemo(t){let n=null;switch(t.sourceType){case"DAILY":n=await Ii(t,{id:t.id,rowStatus:"ARCHIVED"});break;case"CANVAS":n=await Si(t,{id:t.id,rowStatus:"ARCHIVED"});break;case"MULTI":n=await Fo(t,{id:t.id,rowStatus:"ARCHIVED"});break;case"FILE":n=await Di(t,{id:t.id,rowStatus:"ARCHIVED"});break}return n?(Ee.dispatch({type:"ARCHIVE_MEMO_BY_ID",payload:n}),n):t}async unarchiveThinoBulk(t){const n=[];for(const r of t){let a;switch(r.sourceType){case"DAILY":a=await Ii(r,{id:r.id,rowStatus:"NORMAL"}),n.push(a);break;case"CANVAS":a=await Si(r,{id:r.id,rowStatus:"NORMAL"}),n.push(a);break;case"MULTI":a=await Fo(r,{id:r.id,rowStatus:"NORMAL"}),n.push(a);break;case"FILE":a=await Di(r,{id:r.id,rowStatus:"NORMAL"}),n.push(a);break}}return n.length>0?(Ee.dispatch({type:"ARCHIVE_MEMO_BY_ID_BULK",payload:n}),n):t}async unarchiveMemo(t){let n=null;switch(t.sourceType){case"DAILY":n=await Ii(t,{id:t.id,rowStatus:"NORMAL"});break;case"CANVAS":n=await Si(t,{id:t.id,rowStatus:"NORMAL"});break;case"MULTI":n=await Fo(t,{id:t.id,rowStatus:"NORMAL"});break;case"FILE":n=await Di(t,{id:t.id,rowStatus:"NORMAL"});break}return Ee.dispatch({type:"UNARCHIVE_MEMO_BY_ID",payload:n}),n}async hideMemoById(t){const n=this.getMemoById(t);if(!n)return n;let r=null;switch(n.sourceType){case"DAILY":r=await Ii(n,{id:n.id,deleted:!0});break;case"CANVAS":r=await Si(n,{id:n.id,deleted:!0});break;case"MULTI":r=await Fo(n,{id:n.id,deleted:!0});break;case"FILE":r=await Di(n,{id:n.id,deleted:!0});break}if(!r)return n;if(r)return r}async restoreMemoById(t){return await ya.restoreMemo(t)}async deleteMemoById(t,n){const r=this.getMemoById(t);try{switch(r.sourceType){case"DAILY":await ya.deleteMemoInDailyNote(r);break;case"CANVAS":await ya.deleteMemoInCanvas(r);break;case"MULTI":await ya.deleteMemoInMultiFiles(r);break;case"FILE":await ya.deleteMemoInSingleFile(r);break}Ee.dispatch({type:"DELETE_MEMO_BY_ID",payload:{id:t}})}catch(c){console.error(c),new C.Notice(N("Failed to delete memo"))}if(n&&n==="local")return;const a=Xe.getState().settings,o=Xe.getState().app;!(o!=null&&o.loadLocalStorage("tokenForSync"))||!a.startSync||r.webId&&await q6(r.webId)}async removeMemosInFile(t,n){var a,o;const r=[];try{if(t.path.endsWith(".md")&&!t.path.contains(".thino")&&!n)await gw(t,r);else if(t.path.contains("thino.canvas"))await yw(t,r);else if((a=t==null?void 0:t.parent)!=null&&a.path.contains(n)||!(t!=null&&t.parent)&&!((o=t==null?void 0:t.parent)!=null&&o.path)){const c=this.getState().memos.filter(d=>d.path.trim()===t.path.trim());c.length>0&&r.push(...c)}else t.path.endsWith(".md")&&t.path.contains(".thino")&&await mw(t,r);const s=r.map(c=>c.id);Ee.dispatch({type:"DELETE_MEMO_BY_ID_BATCH",payload:{ids:s}})}catch(s){console.error(s)}}async updateMemosInFile(t,n){const r=[],a=async()=>{if(t.path.endsWith(".md")&&!t.path.contains(".thino")&&!n){await gw(t,r);return}else if(t.path.contains("thino.canvas")){await yw(t,r);return}else if(t!=null&&t.parent.path.contains(n)&&!t.path.endsWith(".thino.md")){await PI(t,r);return}else if(t.path.endsWith(".md")&&t.path.contains(".thino")){await mw(t,r);return}};try{await a(),Ee.dispatch({type:"UPDATE_MEMO_BATCH",payload:{memos:r,path:t.path}})}catch(o){console.error(o)}}async updateMemoProperty(t){const n=Ue.randomId(16),r=await Fo(t,{id:n});Ee.dispatch({type:"EDIT_MEMO_PATH",payload:r})}editMemo(t){const n=t.webId;Ee.dispatch({type:"EDIT_MEMO",payload:t});const r=Xe.getState().settings,a=Xe.getState().app;if(!(!(a!=null&&a.loadLocalStorage("tokenForSync"))||!r.startSync))try{t&&n&&k0({id:n,content:t.content,rowStatus:t.rowStatus,pinned:t.pinned,ttime:t.deletedAt?C.moment(t.deletedAt,"YYYY/MM/DD HH:mm:ss").valueOf():0,thinoType:t.sourceType==="DAILY"?"DAILY":"FILE"})}catch(s){console.error(s)}}editMemoBulk(t){for(const n of t)this.editMemo(n);this.updateTagsState()}editCommentMemo(t){Ee.dispatch({type:"EDIT_COMMENT_MEMO",payload:t})}getThinoViaKeyword(t){const{memos:n}=this.getState();return n.filter(a=>a.content.toLowerCase().includes(t==null?void 0:t.toLowerCase()))}updateTagsState(){const{memos:t}=this.getState(),n=new Set,r={};for(const a of t){const o=a.content.replace(/<[^>]*>/g,"").replace(/\`\`\`[a-z]*\n[\s\S]*?\n\`\`\`/g,"").replace(/\`([^\`].*?)\`/g,"");if(a.deletedAt!==""&&a.deletedAt)continue;[...Array.from(o.match(Fn)||[]),...Array.from(o.match($n)||[]),...Array.from(o.match(mr)||[])].forEach(c=>{const d=c.replace(Fn,"$1").replace($n,"$1").replace(mr,"$2").trim();/^\d+$/.test(d)||(n.add(d),r[d]=(r[d]||0)+1)})}Ee.dispatch({type:"SET_TAGS",payload:{tags:Array.from(n),tagsNum:r}})}clearMemos(){Ee.dispatch({type:"SET_MEMOS",payload:{memos:[]}})}async getLinkedMemos(t){const{memos:n}=this.getState();return n.filter(r=>r.content.includes(t))}async getCommentMemos(t){const{memos:n}=this.getState();return n.filter(r=>r.content.includes("comment: "+t))}async createMemoMultiFile({content:t,isList:n}){return await nk({content:t,isList:n})}async createMemoSingleFile({content:t,isList:n}){return await rk({content:t,isList:n})}async createOrPatchThinoFromWeb(t){const n=this.getState().memos;if(t.localId&&(n!=null&&n.some(o=>o.id===t.localId)))return await this.updateMemoById(t.localId,t,!0),null;if(n!=null&&n.some(o=>o.id===t.id)||n!=null&&n.some(o=>o.webId===t.id))return await this.updateMemoById(t.id,t,!1),null;let r=t.sourceType;const a=Xe.getState().settings;switch(a&&(a!=null&&a.saveThinoType)&&(r=a.saveThinoType!=="FILE"?a.saveThinoType:t.sourceType),r){case"FILE":case"MULTI":case"CANVAS":return await qb(t);case"DAILY":return await ok(t);default:return await qb(t)}}async initSync(){const n=this.getState().memos.filter(a=>!a.webId),r=await G6(n);for(const a of r)await this.createOrPatchThinoFromWeb(a)}async createMemoCanvas({text:t,isList:n}){return await ak({content:t,isList:n})}async createMemoDaily(t,n){return await Jb(t,n)}async pinMemoById(t){const n=this.getMemoById(t),r=await wk(n);Ee.dispatch({type:"PIN_MEMO",payload:r});try{const a=Xe.getState().settings,o=Xe.getState().app;if((o==null?void 0:o.loadLocalStorage("tokenForSync"))&&a.startSync){const c=await k0({id:r.webId,pinned:!0});this.editMemo(c)}}catch(a){console.error(a)}}async unpinMemoById(t){const n=this.getMemoById(t),r=await bk(n);Ee.dispatch({type:"PIN_MEMO",payload:r});try{const a=Xe.getState().settings,o=Xe.getState().app;if((o==null?void 0:o.loadLocalStorage("tokenForSync"))&&a.startSync){const c=await k0({id:r.webId,pinned:!1});this.editMemo(c)}}catch(a){console.error(a)}}async createCommentMemo(t,n,r,a,o){return await R6(t,n,r,a,o)}async importMemos(t,n,r){return await Jb(t,n,r)}async createThino({content:t,isList:n,type:r}){let a=null;switch(r.toLowerCase()){case"canvas":a=await Te.createMemoCanvas({text:t,isList:n});break;case"multi":a=await Te.createMemoMultiFile({content:t,isList:n});break;case"daily":a=await Te.createMemoDaily(t,n);break;case"file":a=await Te.createMemoSingleFile({content:t,isList:n});break;default:a=await Te.createMemoDaily(t,n);break}const o=Xe.getState().settings,s=Xe.getState().app,c=s==null?void 0:s.loadLocalStorage("tokenForSync");if(a&&c&&o.startSync){const d=await RT({content:t,thinoType:r==="DAILY"?"DAILY":"FILE"});await this.updateMemoById(a.id,d,!0)}return a}async openThinoByID(t){const n=this.getMemoById(t);if(n)switch(n.sourceType){case"DAILY":await w1(n.id,n.path);break;case"CANVAS":await D1(n.id,n.path);break;case"MULTI":await v1(n.path);break;case"FILE":await b1(n.id,n.path);break}}async updateMemo(t,n,r){const a=this.getMemoById(t);if(a){let o=null;switch(a.sourceType){case"DAILY":o=await Ii(a,{id:a.id,content:n,thinoType:r||a.thinoType});break;case"CANVAS":o=await Si(a,{id:a.id,content:n,thinoType:r||a.thinoType});break;case"MULTI":o=await Fo(a,{id:a.id,content:n,thinoType:r||a.thinoType});break;case"FILE":o=await Di(a,{id:a.id,content:n,thinoType:r||a.thinoType})}if(o)return o}return a}}const Te=new J6;class K6{getState(){return Ee.getState().queryState}async getMyAllQueries(){const t=He.getState().query.filter,n=this.getQueryById(t),r=await ya.getMyQueries();return Ee.dispatch({type:"SET_QUERIES",payload:{queries:[...r,...n?[n]:[]]}}),r}getQueryById(t){return this.getState().queries.find(n=>n.id===t)}pushQuery(t){Ee.dispatch({type:"INSERT_QUERY",payload:{query:{...t}}})}editQuery(t){Ee.dispatch({type:"UPDATE_QUERY",payload:t})}async deleteQuery(t){await ya.deleteQueryById(t),Ee.dispatch({type:"DELETE_QUERY_BY_ID",payload:{id:t}})}async createQuery(t,n){return await ya.createQuery(t,n)}createTempQuery(t,n){return ON(t,n)}async updateQuery(t,n,r){return await ya.updateQuery(t,n,r)}async pinQuery(t){await ya.pinQuery(t)}async unpinQuery(t){await ya.unpinQuery(t)}}const Et=new K6;class Q6{async upload(t){const{vault:n,fileManager:r}=Ee.getState().dailyNotesState.app,a=await t.arrayBuffer(),o=X6(t.type),s=bs(),c=C.moment(),d=Fy(c,s);let p;if(d)d instanceof C.TFile&&(p=await n.createBinary(await n.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,o,d),a));else{const m=await CI(c);p=await n.createBinary(await n.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,o,m),a)}return r.generateMarkdownLink(p,p.path,"","")}async parseHtml(t){const n=await t.text(),r=document.createElement("html");r.innerHTML=n;const a=Array.from(r.getElementsByClassName("memo"));for(const o of a){const s=o.getElementsByClassName("content")[0],c=C.htmlToMarkdown(s.innerHTML),d=await Te.importMemos(c,!0,C.moment(o.getElementsByClassName("time")[0].innerHTML));Te.pushMemo(d)}}}const X6=e=>{var t;return(t=/^image\/(.+)$/.exec(e))==null?void 0:t[1]},S1=new Q6;var Lo={},_T={exports:{}},ga={},A0={exports:{}},F0={},xD;function e8(){return xD||(xD=1,function(e){function t(oe,we){var Z=oe.length;oe.push(we);e:for(;0>>1,te=oe[G];if(0>>1;Ga(De,Z))kea(Ye,De)?(oe[G]=Ye,oe[ke]=Z,G=ke):(oe[G]=De,oe[Ie]=Z,G=Ie);else if(kea(Ye,Z))oe[G]=Ye,oe[ke]=Z,G=ke;else break e}}return we}function a(oe,we){var Z=oe.sortIndex-we.sortIndex;return Z!==0?Z:oe.id-we.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();e.unstable_now=function(){return s.now()-c}}var d=[],p=[],m=1,g=null,v=3,D=!1,S=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(oe){for(var we=n(p);we!==null;){if(we.callback===null)r(p);else if(we.startTime<=oe)r(p),we.sortIndex=we.expirationTime,t(d,we);else break;we=n(p)}}function F(oe){if(T=!1,j(oe),!S)if(n(d)!==null)S=!0,se(B);else{var we=n(p);we!==null&&fe(F,we.startTime-oe)}}function B(oe,we){S=!1,T&&(T=!1,O(H),H=-1),D=!0;var Z=v;try{for(j(we),g=n(d);g!==null&&(!(g.expirationTime>we)||oe&&!J());){var G=g.callback;if(typeof G=="function"){g.callback=null,v=g.priorityLevel;var te=G(g.expirationTime<=we);we=e.unstable_now(),typeof te=="function"?g.callback=te:g===n(d)&&r(d),j(we)}else r(d);g=n(d)}if(g!==null)var ge=!0;else{var Ie=n(p);Ie!==null&&fe(F,Ie.startTime-we),ge=!1}return ge}finally{g=null,v=Z,D=!1}}var R=!1,z=null,H=-1,Y=5,U=-1;function J(){return!(e.unstable_now()-Uoe||125G?(oe.sortIndex=Z,t(p,oe),n(d)===null&&oe===n(p)&&(T?(O(H),H=-1):T=!0,fe(F,Z-G))):(oe.sortIndex=te,t(d,oe),S||D||(S=!0,se(B))),oe},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(oe){var we=v;return function(){var Z=v;v=we;try{return oe.apply(this,arguments)}finally{v=Z}}}}(F0)),F0}var MD;function t8(){return MD||(MD=1,A0.exports=e8()),A0.exports}var ND;function n8(){if(ND)return ga;ND=1;var e=A,t=t8();function n(i){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+i,h=1;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},g={};function v(i){return d.call(g,i)?!0:d.call(m,i)?!1:p.test(i)?g[i]=!0:(m[i]=!0,!1)}function D(i,l,h,y){if(h!==null&&h.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return y?!1:h!==null?!h.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function S(i,l,h,y){if(l===null||typeof l>"u"||D(i,l,h,y))return!0;if(y)return!1;if(h!==null)switch(h.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function T(i,l,h,y,I,x,L){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=y,this.attributeNamespace=I,this.mustUseProperty=h,this.propertyName=i,this.type=l,this.sanitizeURL=x,this.removeEmptyString=L}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){E[i]=new T(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var l=i[0];E[l]=new T(l,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){E[i]=new T(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){E[i]=new T(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){E[i]=new T(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){E[i]=new T(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){E[i]=new T(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){E[i]=new T(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){E[i]=new T(i,5,!1,i.toLowerCase(),null,!1,!1)});var O=/[\-:]([a-z])/g;function k(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var l=i.replace(O,k);E[l]=new T(l,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var l=i.replace(O,k);E[l]=new T(l,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var l=i.replace(O,k);E[l]=new T(l,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){E[i]=new T(i,1,!1,i.toLowerCase(),null,!1,!1)}),E.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){E[i]=new T(i,1,!1,i.toLowerCase(),null,!0,!0)});function j(i,l,h,y){var I=E.hasOwnProperty(l)?E[l]:null;(I!==null?I.type!==0:y||!(2q||I[L]!==x[q]){var ee=` `+I[L].replace(" at new "," at ");return i.displayName&&ee.includes("")&&(ee=ee.replace("",i.displayName)),ee}while(1<=L&&0<=q);break}}}finally{ge=!1,Error.prepareStackTrace=h}return(i=i?i.displayName||i.name:"")?te(i):""}function De(i){switch(i.tag){case 5:return te(i.type);case 16:return te("Lazy");case 13:return te("Suspense");case 19:return te("SuspenseList");case 0:case 2:case 15:return i=Ie(i.type,!1),i;case 11:return i=Ie(i.type.render,!1),i;case 1:return i=Ie(i.type,!0),i;default:return""}}function ke(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case z:return"Fragment";case R:return"Portal";case Y:return"Profiler";case H:return"StrictMode";case le:return"Suspense";case pe:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case J:return(i.displayName||"Context")+".Consumer";case U:return(i._context.displayName||"Context")+".Provider";case Q:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ie:return l=i.displayName||null,l!==null?l:ke(i.type)||"Memo";case se:l=i._payload,i=i._init;try{return ke(i(l))}catch{}}return null}function Ye(i){var l=i.type;switch(i.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=l.render,i=i.displayName||i.name||"",l.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ke(l);case 8:return l===H?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Re(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function rt(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Ht(i){var l=rt(i)?"checked":"value",h=Object.getOwnPropertyDescriptor(i.constructor.prototype,l),y=""+i[l];if(!i.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var I=h.get,x=h.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return I.call(this)},set:function(L){y=""+L,x.call(this,L)}}),Object.defineProperty(i,l,{enumerable:h.enumerable}),{getValue:function(){return y},setValue:function(L){y=""+L},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Se(i){i._valueTracker||(i._valueTracker=Ht(i))}function Ze(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var h=l.getValue(),y="";return i&&(y=rt(i)?i.checked?"true":"false":i.value),i=y,i!==h?(l.setValue(i),!0):!1}function Ke(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Je(i,l){var h=l.checked;return Z({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??i._wrapperState.initialChecked})}function lt(i,l){var h=l.defaultValue==null?"":l.defaultValue,y=l.checked!=null?l.checked:l.defaultChecked;h=Re(l.value!=null?l.value:h),i._wrapperState={initialChecked:y,initialValue:h,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function ft(i,l){l=l.checked,l!=null&&j(i,"checked",l,!1)}function Dt(i,l){ft(i,l);var h=Re(l.value),y=l.type;if(h!=null)y==="number"?(h===0&&i.value===""||i.value!=h)&&(i.value=""+h):i.value!==""+h&&(i.value=""+h);else if(y==="submit"||y==="reset"){i.removeAttribute("value");return}l.hasOwnProperty("value")?un(i,l.type,h):l.hasOwnProperty("defaultValue")&&un(i,l.type,Re(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(i.defaultChecked=!!l.defaultChecked)}function Ct(i,l,h){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var y=l.type;if(!(y!=="submit"&&y!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+i._wrapperState.initialValue,h||l===i.value||(i.value=l),i.defaultValue=l}h=i.name,h!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,h!==""&&(i.name=h)}function un(i,l,h){(l!=="number"||Ke(i.ownerDocument)!==i)&&(h==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+h&&(i.defaultValue=""+h))}var Ft=Array.isArray;function Ot(i,l,h,y){if(i=i.options,l){l={};for(var I=0;I"+l.valueOf().toString()+"",l=Nr.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;l.firstChild;)i.appendChild(l.firstChild)}});function ho(i,l){if(l){var h=i.firstChild;if(h&&h===i.lastChild&&h.nodeType===3){h.nodeValue=l;return}}i.textContent=l}var po={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Nl=["Webkit","ms","Moz","O"];Object.keys(po).forEach(function(i){Nl.forEach(function(l){l=l+i.charAt(0).toUpperCase()+i.substring(1),po[l]=po[i]})});function Pi(i,l,h){return l==null||typeof l=="boolean"||l===""?"":h||typeof l!="number"||l===0||po.hasOwnProperty(i)&&po[i]?(""+l).trim():l+"px"}function ji(i,l){i=i.style;for(var h in l)if(l.hasOwnProperty(h)){var y=h.indexOf("--")===0,I=Pi(h,l[h],y);h==="float"&&(h="cssFloat"),y?i.setProperty(h,I):i[h]=I}}var Ts=Z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ho(i,l){if(l){if(Ts[i]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function Li(i,l){if(i.indexOf("-")===-1)return typeof l.is=="string";switch(i){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!1;default:return!0}}var W=null;function re(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ye=null,xe=null,je=null;function _e(i){if(i=ar(i)){if(typeof ye!="function")throw Error(n(280));var l=i.stateNode;l&&(l=gc(l),ye(i.stateNode,i.type,l))}}function ze(i){xe?je?je.push(i):je=[i]:xe=i}function gt(){if(xe){var i=xe,l=je;if(je=xe=null,_e(i),l)for(i=0;i>>=0,i===0?32:31-(tm(i)/nm|0)|0}var Es=64,Vu=4194304;function Cs(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Bi(i,l){var h=i.pendingLanes;if(h===0)return 0;var y=0,I=i.suspendedLanes,x=i.pingedLanes,L=h&268435455;if(L!==0){var q=L&~I;q!==0?y=Cs(q):(x&=L,x!==0&&(y=Cs(x)))}else L=h&~I,L!==0?y=Cs(L):x!==0&&(y=Cs(x));if(y===0)return 0;if(l!==0&&l!==y&&!(l&I)&&(I=y&-y,x=l&-l,I>=x||I===16&&(x&4194240)!==0))return l;if(y&4&&(y|=h&16),l=i.entangledLanes,l!==0)for(i=i.entanglements,l&=y;0h;h++)l.push(i);return l}function Ol(i,l,h){i.pendingLanes|=l,l!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,l=31-xa(l),i[l]=h}function om(i,l){var h=i.pendingLanes&~l;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=l,i.mutableReadLanes&=l,i.entangledLanes&=l,l=i.entanglements;var y=i.eventTimes;for(i=i.expirationTimes;0=mo),wm=" ",bm=!1;function Dm(i,l){switch(i){case"keyup":return Yr.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Fs=!1;function Os(i,l){switch(i){case"compositionend":return Sm(l);case"keypress":return l.which!==32?null:(bm=!0,wm);case"textInput":return i=l.data,i===wm&&bm?null:i;default:return null}}function jv(i,l){if(Fs)return i==="compositionend"||!Bl&&Dm(i,l)?(i=pf(),Za=Rl=sn=null,Fs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:h,offset:l-i};i=y}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=bt(h)}}function En(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?En(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function $t(){for(var i=window,l=Ke();l instanceof i.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)i=l.contentWindow;else break;l=Ke(i.document)}return l}function _l(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}function Yv(i){var l=$t(),h=i.focusedElem,y=i.selectionRange;if(l!==h&&h&&h.ownerDocument&&En(h.ownerDocument.documentElement,h)){if(y!==null&&_l(h)){if(l=y.start,i=y.end,i===void 0&&(i=l),"selectionStart"in h)h.selectionStart=l,h.selectionEnd=Math.min(i,h.value.length);else if(i=(l=h.ownerDocument||document)&&l.defaultView||window,i.getSelection){i=i.getSelection();var I=h.textContent.length,x=Math.min(y.start,I);y=y.end===void 0?x:Math.min(y.end,I),!i.extend&&x>y&&(I=y,y=x,x=I),I=Lt(h,x);var L=Lt(h,y);I&&L&&(i.rangeCount!==1||i.anchorNode!==I.node||i.anchorOffset!==I.offset||i.focusNode!==L.node||i.focusOffset!==L.offset)&&(l=l.createRange(),l.setStart(I.node,I.offset),i.removeAllRanges(),x>y?(i.addRange(l),i.extend(L.node,L.offset)):(l.setEnd(L.node,L.offset),i.addRange(l)))}}for(l=[],i=h;i=i.parentNode;)i.nodeType===1&&l.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h=document.documentMode,go=null,xf=null,Wa=null,js=!1;function Hl(i,l,h){var y=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;js||go==null||go!==Ke(y)||(y=go,"selectionStart"in y&&_l(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Wa&&Ge(Wa,y)||(Wa=y,y=fc(xf,"onSelect"),0Us||(i.current=Ff[Us],Ff[Us]=null,Us--)}function Kt(i,l){Us++,Ff[Us]=i.current,i.current=l}var ei={},or=Ar(ei),Fr=Ar(!1),Sr=ei;function Vs(i,l){var h=i.type.contextTypes;if(!h)return ei;var y=i.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===l)return y.__reactInternalMemoizedMaskedChildContext;var I={},x;for(x in h)I[x]=l[x];return y&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=l,i.__reactInternalMemoizedMaskedChildContext=I),I}function Or(i){return i=i.childContextTypes,i!=null}function yc(){en(Fr),en(or)}function Fm(i,l,h){if(or.current!==ei)throw Error(n(168));Kt(or,l),Kt(Fr,h)}function Om(i,l,h){var y=i.stateNode;if(l=l.childContextTypes,typeof y.getChildContext!="function")return h;y=y.getChildContext();for(var I in y)if(!(I in l))throw Error(n(108,Ye(i)||"Unknown",I));return Z({},h,y)}function ia(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ei,Sr=or.current,Kt(or,i),Kt(Fr,Fr.current),!0}function Pm(i,l,h){var y=i.stateNode;if(!y)throw Error(n(169));h?(i=Om(i,l,Sr),y.__reactInternalMemoizedMergedChildContext=i,en(Fr),en(or),Kt(or,i)):en(Fr),Kt(Fr,h)}var wo=null,vc=!1,Of=!1;function jm(i){wo===null?wo=[i]:wo.push(i)}function Wi(i){vc=!0,jm(i)}function ti(){if(!Of&&wo!==null){Of=!0;var i=0,l=Yt;try{var h=wo;for(Yt=1;i>=L,I-=L,qa=1<<32-xa(l)+I|h<wt?(Vn=dt,dt=null):Vn=dt.sibling;var Bt=Fe(de,dt,he[wt],Be);if(Bt===null){dt===null&&(dt=Vn);break}i&&dt&&Bt.alternate===null&&l(de,dt),ae=x(Bt,ae,wt),ct===null?ot=Bt:ct.sibling=Bt,ct=Bt,dt=Vn}if(wt===he.length)return h(de,dt),tn&&Gi(de,wt),ot;if(dt===null){for(;wtwt?(Vn=dt,dt=null):Vn=dt.sibling;var vi=Fe(de,dt,Bt.value,Be);if(vi===null){dt===null&&(dt=Vn);break}i&&dt&&vi.alternate===null&&l(de,dt),ae=x(vi,ae,wt),ct===null?ot=vi:ct.sibling=vi,ct=vi,dt=Vn}if(Bt.done)return h(de,dt),tn&&Gi(de,wt),ot;if(dt===null){for(;!Bt.done;wt++,Bt=he.next())Bt=Le(de,Bt.value,Be),Bt!==null&&(ae=x(Bt,ae,wt),ct===null?ot=Bt:ct.sibling=Bt,ct=Bt);return tn&&Gi(de,wt),ot}for(dt=y(de,dt);!Bt.done;wt++,Bt=he.next())Bt=qe(dt,de,wt,Bt.value,Be),Bt!==null&&(i&&Bt.alternate!==null&&dt.delete(Bt.key===null?wt:Bt.key),ae=x(Bt,ae,wt),ct===null?ot=Bt:ct.sibling=Bt,ct=Bt);return i&&dt.forEach(function(l0){return l(de,l0)}),tn&&Gi(de,wt),ot}function Dn(de,ae,he,Be){if(typeof he=="object"&&he!==null&&he.type===z&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case B:e:{for(var ot=he.key,ct=ae;ct!==null;){if(ct.key===ot){if(ot=he.type,ot===z){if(ct.tag===7){h(de,ct.sibling),ae=I(ct,he.props.children),ae.return=de,de=ae;break e}}else if(ct.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===se&&Mc(ot)===ct.type){h(de,ct.sibling),ae=I(ct,he.props),ae.ref=Ql(de,ct,he),ae.return=de,de=ae;break e}h(de,ct);break}else l(de,ct);ct=ct.sibling}he.type===z?(ae=as(he.props.children,de.mode,Be,he.key),ae.return=de,de=ae):(Be=rd(he.type,he.key,he.props,null,de.mode,Be),Be.ref=Ql(de,ae,he),Be.return=de,de=Be)}return L(de);case R:e:{for(ct=he.key;ae!==null;){if(ae.key===ct)if(ae.tag===4&&ae.stateNode.containerInfo===he.containerInfo&&ae.stateNode.implementation===he.implementation){h(de,ae.sibling),ae=I(ae,he.children||[]),ae.return=de,de=ae;break e}else{h(de,ae);break}else l(de,ae);ae=ae.sibling}ae=Ih(he,de.mode,Be),ae.return=de,de=ae}return L(de);case se:return ct=he._init,Dn(de,ae,ct(he._payload),Be)}if(Ft(he))return nt(de,ae,he,Be);if(we(he))return at(de,ae,he,Be);Xl(de,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,ae!==null&&ae.tag===6?(h(de,ae.sibling),ae=I(ae,he),ae.return=de,de=ae):(h(de,ae),ae=Sh(he,de.mode,Be),ae.return=de,de=ae),L(de)):h(de,ae)}return Dn}var ii=zm(!0),Hf=zm(!1),$s={},Oa=Ar($s),si=Ar($s),eu=Ar($s);function li(i){if(i===$s)throw Error(n(174));return i}function Nc(i,l){switch(Kt(eu,l),Kt(si,i),Kt(Oa,$s),i=l.nodeType,i){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:tr(null,"");break;default:i=i===8?l.parentNode:l,l=i.namespaceURI||null,i=i.tagName,l=tr(l,i)}en(Oa),Kt(Oa,l)}function Gs(){en(Oa),en(si),en(eu)}function Yf(i){li(eu.current);var l=li(Oa.current),h=tr(l,i.type);l!==h&&(Kt(si,i),Kt(Oa,h))}function zf(i){si.current===i&&(en(Oa),en(si))}var nn=Ar(0);function tu(i){for(var l=i;l!==null;){if(l.tag===13){var h=l.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var nu=[];function Uf(){for(var i=0;ih?h:4,i(!0);var y=It.transition;It.transition={};try{i(!1),l()}finally{Yt=h,It.transition=y}}function ou(){return Bn().memoizedState}function Xs(i,l,h){var y=pi(i);if(h={lane:y,action:h,hasEagerState:!1,eagerState:null,next:null},Kf(i))Gm(l,h);else if(h=lr(i,l,h,y),h!==null){var I=Cr();La(h,i,y,I),Qf(h,l,y)}}function $m(i,l,h){var y=pi(i),I={lane:y,action:h,hasEagerState:!1,eagerState:null,next:null};if(Kf(i))Gm(l,I);else{var x=i.alternate;if(i.lanes===0&&(x===null||x.lanes===0)&&(x=l.lastRenderedReducer,x!==null))try{var L=l.lastRenderedState,q=x(L,h);if(I.hasEagerState=!0,I.eagerState=q,ve(q,L)){var ee=l.interleaved;ee===null?(I.next=I,Tc(l)):(I.next=ee.next,ee.next=I),l.interleaved=I;return}}catch{}h=lr(i,l,I,y),h!==null&&(I=Cr(),La(h,i,y,I),Qf(h,l,y))}}function Kf(i){var l=i.alternate;return i===cn||l!==null&&l===cn}function Gm(i,l){ru=kc=!0;var h=i.pending;h===null?l.next=l:(l.next=h.next,h.next=l),i.pending=l}function Qf(i,l,h){if(h&4194240){var y=l.lanes;y&=i.pendingLanes,h|=y,l.lanes=h,Pl(i,h)}}var Io={readContext:Ir,useCallback:Rn,useContext:Rn,useEffect:Rn,useImperativeHandle:Rn,useInsertionEffect:Rn,useLayoutEffect:Rn,useMemo:Rn,useReducer:Rn,useRef:Rn,useState:Rn,useDebugValue:Rn,useDeferredValue:Rn,useTransition:Rn,useMutableSource:Rn,useSyncExternalStore:Rn,useId:Rn,unstable_isNewReconciler:!1},iu={readContext:Ir,useCallback:function(i,l){return pn().memoizedState=[i,l===void 0?null:l],i},useContext:Ir,useEffect:Vm,useImperativeHandle:function(i,l,h){return h=h!=null?h.concat([i]):null,Qs(4194308,4,Zm.bind(null,l,i),h)},useLayoutEffect:function(i,l){return Qs(4194308,4,i,l)},useInsertionEffect:function(i,l){return Qs(4,2,i,l)},useMemo:function(i,l){var h=pn();return l=l===void 0?null:l,i=i(),h.memoizedState=[i,l],i},useReducer:function(i,l,h){var y=pn();return l=h!==void 0?h(l):l,y.memoizedState=y.baseState=l,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:l},y.queue=i,i=i.dispatch=Xs.bind(null,cn,i),[y.memoizedState,i]},useRef:function(i){var l=pn();return i={current:i},l.memoizedState=i},useState:So,useDebugValue:Bc,useDeferredValue:function(i){return pn().memoizedState=i},useTransition:function(){var i=So(!1),l=i[0];return i=Vv.bind(null,i[1]),pn().memoizedState=i,[l,i]},useMutableSource:function(){},useSyncExternalStore:function(i,l,h){var y=cn,I=pn();if(tn){if(h===void 0)throw Error(n(407));h=h()}else{if(h=l(),Un===null)throw Error(n(349));Qi&30||Zf(y,l,h)}I.memoizedState=h;var x={value:h,getSnapshot:l};return I.queue=x,Vm(Lc.bind(null,y,x,i),[i]),y.flags|=2048,Ks(9,jc.bind(null,y,x,h,l),void 0,null),h},useId:function(){var i=pn(),l=Un.identifierPrefix;if(tn){var h=Ja,y=qa;h=(y&~(1<<32-xa(y)-1)).toString(32)+h,l=":"+l+"R"+h,h=ur++,0<\/script>",i=i.removeChild(i.firstChild)):typeof y.is=="string"?i=L.createElement(h,{is:y.is}):(i=L.createElement(h),h==="select"&&(L=i,y.multiple?L.multiple=!0:y.size&&(L.size=y.size))):i=L.createElementNS(i,h),i[$a]=l,i[Xo]=y,tg(i,l,!1,!1),l.stateNode=i;e:{switch(L=Li(h,y),h){case"dialog":Xt("cancel",i),Xt("close",i),I=y;break;case"iframe":case"object":case"embed":Xt("load",i),I=y;break;case"video":case"audio":for(I=0;Isl&&(l.flags|=128,y=!0,nl(x,!1),l.lanes=4194304)}else{if(!y)if(i=tu(L),i!==null){if(l.flags|=128,y=!0,h=i.updateQueue,h!==null&&(l.updateQueue=h,l.flags|=4),nl(x,!0),x.tail===null&&x.tailMode==="hidden"&&!L.alternate&&!tn)return fr(l),null}else 2*on()-x.renderingStartTime>sl&&h!==1073741824&&(l.flags|=128,y=!0,nl(x,!1),l.lanes=4194304);x.isBackwards?(L.sibling=l.child,l.child=L):(h=x.last,h!==null?h.sibling=L:l.child=L,x.last=L)}return x.tail!==null?(l=x.tail,x.rendering=l,x.tail=l.sibling,x.renderingStartTime=on(),l.sibling=null,h=nn.current,Kt(nn,y?h&1|2:h&1),l):(fr(l),null);case 22:case 23:return vh(),y=l.memoizedState!==null,i!==null&&i.memoizedState!==null!==y&&(l.flags|=8192),y&&l.mode&1?Gr&1073741824&&(fr(l),l.subtreeFlags&6&&(l.flags|=8192)):fr(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function $v(i,l){switch(qi(l),l.tag){case 1:return Or(l.type)&&yc(),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return Gs(),en(Fr),en(or),Uf(),i=l.flags,i&65536&&!(i&128)?(l.flags=i&-65537|128,l):null;case 5:return zf(l),null;case 13:if(en(nn),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Qa()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return en(nn),null;case 4:return Gs(),null;case 10:return Ic(l.type._context),null;case 22:case 23:return vh(),null;case 24:return null;default:return null}}var ca=!1,Ut=!1,ih=typeof WeakSet=="function"?WeakSet:Set,et=null;function ci(i,l){var h=i.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(y){mn(i,l,y)}else h.current=null}function sh(i,l,h){try{h()}catch(y){mn(i,l,y)}}var rg=!1;function fu(i,l){if(Wl=qu,i=$t(),_l(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var y=h.getSelection&&h.getSelection();if(y&&y.rangeCount!==0){h=y.anchorNode;var I=y.anchorOffset,x=y.focusNode;y=y.focusOffset;try{h.nodeType,x.nodeType}catch{h=null;break e}var L=0,q=-1,ee=-1,be=0,Oe=0,Le=i,Fe=null;t:for(;;){for(var qe;Le!==h||I!==0&&Le.nodeType!==3||(q=L+I),Le!==x||y!==0&&Le.nodeType!==3||(ee=L+y),Le.nodeType===3&&(L+=Le.nodeValue.length),(qe=Le.firstChild)!==null;)Fe=Le,Le=qe;for(;;){if(Le===i)break t;if(Fe===h&&++be===I&&(q=L),Fe===x&&++Oe===y&&(ee=L),(qe=Le.nextSibling)!==null)break;Le=Fe,Fe=Le.parentNode}Le=qe}h=q===-1||ee===-1?null:{start:q,end:ee}}else h=null}h=h||{start:0,end:0}}else h=null;for(Zi={focusedElem:i,selectionRange:h},qu=!1,et=l;et!==null;)if(l=et,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,et=i;else for(;et!==null;){l=et;try{var nt=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(nt!==null){var at=nt.memoizedProps,Dn=nt.memoizedState,de=l.stateNode,ae=de.getSnapshotBeforeUpdate(l.elementType===l.type?at:ka(l.type,at),Dn);de.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var he=l.stateNode.containerInfo;he.nodeType===1?he.textContent="":he.nodeType===9&&he.documentElement&&he.removeChild(he.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Be){mn(l,l.return,Be)}if(i=l.sibling,i!==null){i.return=l.return,et=i;break}et=l.return}return nt=rg,rg=!1,nt}function rl(i,l,h){var y=l.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var I=y=y.next;do{if((I.tag&i)===i){var x=I.destroy;I.destroy=void 0,x!==void 0&&sh(l,h,x)}I=I.next}while(I!==y)}}function hu(i,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var h=l=l.next;do{if((h.tag&i)===i){var y=h.create;h.destroy=y()}h=h.next}while(h!==l)}}function lh(i){var l=i.ref;if(l!==null){var h=i.stateNode;switch(i.tag){case 5:i=h;break;default:i=h}typeof l=="function"?l(i):l.current=i}}function ag(i){var l=i.alternate;l!==null&&(i.alternate=null,ag(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&(delete l[$a],delete l[Xo],delete l[mc],delete l[_],delete l[zs])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function og(i){return i.tag===5||i.tag===3||i.tag===4}function ig(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||og(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Wc(i,l,h){var y=i.tag;if(y===5||y===6)i=i.stateNode,l?h.nodeType===8?h.parentNode.insertBefore(i,l):h.insertBefore(i,l):(h.nodeType===8?(l=h.parentNode,l.insertBefore(i,h)):(l=h,l.appendChild(i)),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=hc));else if(y!==4&&(i=i.child,i!==null))for(Wc(i,l,h),i=i.sibling;i!==null;)Wc(i,l,h),i=i.sibling}function $c(i,l,h){var y=i.tag;if(y===5||y===6)i=i.stateNode,l?h.insertBefore(i,l):h.appendChild(i);else if(y!==4&&(i=i.child,i!==null))for($c(i,l,h),i=i.sibling;i!==null;)$c(i,l,h),i=i.sibling}var Gn=null,Wr=!1;function Eo(i,l,h){for(h=h.child;h!==null;)al(i,l,h),h=h.sibling}function al(i,l,h){if(Va&&typeof Va.onCommitFiberUnmount=="function")try{Va.onCommitFiberUnmount(Uu,h)}catch{}switch(h.tag){case 5:Ut||ci(h,l);case 6:var y=Gn,I=Wr;Gn=null,Eo(i,l,h),Gn=y,Wr=I,Gn!==null&&(Wr?(i=Gn,h=h.stateNode,i.nodeType===8?i.parentNode.removeChild(h):i.removeChild(h)):Gn.removeChild(h.stateNode));break;case 18:Gn!==null&&(Wr?(i=Gn,h=h.stateNode,i.nodeType===8?Af(i.parentNode,h):i.nodeType===1&&Af(i,h),zt(i)):Af(Gn,h.stateNode));break;case 4:y=Gn,I=Wr,Gn=h.stateNode.containerInfo,Wr=!0,Eo(i,l,h),Gn=y,Wr=I;break;case 0:case 11:case 14:case 15:if(!Ut&&(y=h.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){I=y=y.next;do{var x=I,L=x.destroy;x=x.tag,L!==void 0&&(x&2||x&4)&&sh(h,l,L),I=I.next}while(I!==y)}Eo(i,l,h);break;case 1:if(!Ut&&(ci(h,l),y=h.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=h.memoizedProps,y.state=h.memoizedState,y.componentWillUnmount()}catch(q){mn(h,l,q)}Eo(i,l,h);break;case 21:Eo(i,l,h);break;case 22:h.mode&1?(Ut=(y=Ut)||h.memoizedState!==null,Eo(i,l,h),Ut=y):Eo(i,l,h);break;default:Eo(i,l,h)}}function Gc(i){var l=i.updateQueue;if(l!==null){i.updateQueue=null;var h=i.stateNode;h===null&&(h=i.stateNode=new ih),l.forEach(function(y){var I=t0.bind(null,i,y);h.has(y)||(h.add(y),y.then(I,I))})}}function da(i,l){var h=l.deletions;if(h!==null)for(var y=0;yI&&(I=L),y&=~x}if(y=I,y=on()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*Gv(y/1960))-y,10i?16:i,Hn===null)var y=!1;else{if(i=Hn,Hn=null,Xc=0,Pt&6)throw Error(n(331));var I=Pt;for(Pt|=4,et=i.current;et!==null;){var x=et,L=x.child;if(et.flags&16){var q=x.deletions;if(q!==null){for(var ee=0;eeon()-Jc?ns(i,0):fh|=h),hr(i,l)}function mg(i,l){l===0&&(i.mode&1?(l=Vu,Vu<<=1,!(Vu&130023424)&&(Vu=4194304)):l=1);var h=Cr();i=Aa(i,l),i!==null&&(Ol(i,l,h),hr(i,h))}function e0(i){var l=i.memoizedState,h=0;l!==null&&(h=l.retryLane),mg(i,h)}function t0(i,l){var h=0;switch(i.tag){case 13:var y=i.stateNode,I=i.memoizedState;I!==null&&(h=I.retryLane);break;case 19:y=i.stateNode;break;default:throw Error(n(314))}y!==null&&y.delete(l),mg(i,h)}var gg;gg=function(i,l,h){if(i!==null)if(i.memoizedProps!==l.pendingProps||Fr.current)cr=!0;else{if(!(i.lanes&h)&&!(l.flags&128))return cr=!1,dr(i,l,h);cr=!!(i.flags&131072)}else cr=!1,tn&&l.flags&1048576&&Lm(l,bc,l.index);switch(l.lanes=0,l.tag){case 2:var y=l.type;tl(i,l),i=l.pendingProps;var I=Vs(l,or.current);ni(l,h),I=Ac(null,l,y,i,I,h);var x=Fc();return l.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Or(y)?(x=!0,ia(l)):x=!1,l.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,jf(l),I.updater=Cc,l.stateNode=I,I._reactInternals=l,_f(l,y,i,h),l=rh(null,l,y,!0,x,h)):(l.tag=0,tn&&x&&ql(l),Er(null,l,I,h),l=l.child),l;case 16:y=l.elementType;e:{switch(tl(i,l),i=l.pendingProps,I=y._init,y=I(y._payload),l.type=y,I=l.tag=nd(y),i=ka(y,i),I){case 0:l=zc(null,l,y,i,h);break e;case 1:l=Xm(null,l,y,i,h);break e;case 11:l=eh(null,l,y,i,h);break e;case 14:l=eo(null,l,y,ka(y.type,i),h);break e}throw Error(n(306,y,""))}return l;case 0:return y=l.type,I=l.pendingProps,I=l.elementType===y?I:ka(y,I),zc(i,l,y,I,h);case 1:return y=l.type,I=l.pendingProps,I=l.elementType===y?I:ka(y,I),Xm(i,l,y,I,h);case 3:e:{if(to(l),i===null)throw Error(n(387));y=l.pendingProps,x=l.memoizedState,I=x.element,_m(i,l),Ec(l,y,null,h);var L=l.memoizedState;if(y=L.element,x.isDehydrated)if(x={element:y,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},l.updateQueue.baseState=x,l.memoizedState=x,l.flags&256){I=es(Error(n(423)),l),l=Uc(i,l,y,h,I);break e}else if(y!==I){I=es(Error(n(424)),l),l=Uc(i,l,y,h,I);break e}else for(Vr=Qo(l.stateNode.containerInfo.firstChild),sr=l,tn=!0,Na=null,h=Hf(l,null,y,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Qa(),y===I){l=no(i,l,h);break e}Er(i,l,y,h)}l=l.child}return l;case 5:return Yf(l),i===null&&Pr(l),y=l.type,I=l.pendingProps,x=i!==null?i.memoizedProps:null,L=I.children,$l(y,I)?L=null:x!==null&&$l(y,x)&&(l.flags|=32),Qm(i,l),Er(i,l,L,h),l.child;case 6:return i===null&&Pr(l),null;case 13:return du(i,l,h);case 4:return Nc(l,l.stateNode.containerInfo),y=l.pendingProps,i===null?l.child=ii(l,null,y,h):Er(i,l,y,h),l.child;case 11:return y=l.type,I=l.pendingProps,I=l.elementType===y?I:ka(y,I),eh(i,l,y,I,h);case 7:return Er(i,l,l.pendingProps,h),l.child;case 8:return Er(i,l,l.pendingProps.children,h),l.child;case 12:return Er(i,l,l.pendingProps.children,h),l.child;case 10:e:{if(y=l.type._context,I=l.pendingProps,x=l.memoizedProps,L=I.value,Kt(Ji,y._currentValue),y._currentValue=L,x!==null)if(ve(x.value,L)){if(x.children===I.children&&!Fr.current){l=no(i,l,h);break e}}else for(x=l.child,x!==null&&(x.return=l);x!==null;){var q=x.dependencies;if(q!==null){L=x.child;for(var ee=q.firstContext;ee!==null;){if(ee.context===y){if(x.tag===1){ee=Fa(-1,h&-h),ee.tag=2;var be=x.updateQueue;if(be!==null){be=be.shared;var Oe=be.pending;Oe===null?ee.next=ee:(ee.next=Oe.next,Oe.next=ee),be.pending=ee}}x.lanes|=h,ee=x.alternate,ee!==null&&(ee.lanes|=h),ua(x.return,h,l),q.lanes|=h;break}ee=ee.next}}else if(x.tag===10)L=x.type===l.type?null:x.child;else if(x.tag===18){if(L=x.return,L===null)throw Error(n(341));L.lanes|=h,q=L.alternate,q!==null&&(q.lanes|=h),ua(L,h,l),L=x.sibling}else L=x.child;if(L!==null)L.return=x;else for(L=x;L!==null;){if(L===l){L=null;break}if(x=L.sibling,x!==null){x.return=L.return,L=x;break}L=L.return}x=L}Er(i,l,I.children,h),l=l.child}return l;case 9:return I=l.type,y=l.pendingProps.children,ni(l,h),I=Ir(I),y=y(I),l.flags|=1,Er(i,l,y,h),l.child;case 14:return y=l.type,I=ka(y,l.pendingProps),I=ka(y.type,I),eo(i,l,y,I,h);case 15:return th(i,l,l.type,l.pendingProps,h);case 17:return y=l.type,I=l.pendingProps,I=l.elementType===y?I:ka(y,I),tl(i,l),l.tag=1,Or(y)?(i=!0,ia(l)):i=!1,ni(l,h),Bf(l,y,I),_f(l,y,I,h),rh(null,l,y,!0,i,h);case 19:return eg(i,l,h);case 22:return nh(i,l,h)}throw Error(n(156,l.tag))};function yg(i,l){return Kp(i,l)}function n0(i,l,h,y){this.tag=i,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(i,l,h,y){return new n0(i,l,h,y)}function Dh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function nd(i){if(typeof i=="function")return Dh(i)?1:0;if(i!=null){if(i=i.$$typeof,i===Q)return 11;if(i===ie)return 14}return 2}function yi(i,l){var h=i.alternate;return h===null?(h=qr(i.tag,l,i.key,i.mode),h.elementType=i.elementType,h.type=i.type,h.stateNode=i.stateNode,h.alternate=i,i.alternate=h):(h.pendingProps=l,h.type=i.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=i.flags&14680064,h.childLanes=i.childLanes,h.lanes=i.lanes,h.child=i.child,h.memoizedProps=i.memoizedProps,h.memoizedState=i.memoizedState,h.updateQueue=i.updateQueue,l=i.dependencies,h.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},h.sibling=i.sibling,h.index=i.index,h.ref=i.ref,h}function rd(i,l,h,y,I,x){var L=2;if(y=i,typeof i=="function")Dh(i)&&(L=1);else if(typeof i=="string")L=5;else e:switch(i){case z:return as(h.children,I,x,l);case H:L=8,I|=8;break;case Y:return i=qr(12,h,l,I|2),i.elementType=Y,i.lanes=x,i;case le:return i=qr(13,h,l,I),i.elementType=le,i.lanes=x,i;case pe:return i=qr(19,h,l,I),i.elementType=pe,i.lanes=x,i;case fe:return ad(h,I,x,l);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case U:L=10;break e;case J:L=9;break e;case Q:L=11;break e;case ie:L=14;break e;case se:L=16,y=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return l=qr(L,h,l,I),l.elementType=i,l.type=y,l.lanes=x,l}function as(i,l,h,y){return i=qr(7,i,y,l),i.lanes=h,i}function ad(i,l,h,y){return i=qr(22,i,y,l),i.elementType=fe,i.lanes=h,i.stateNode={isHidden:!1},i}function Sh(i,l,h){return i=qr(6,i,null,l),i.lanes=h,i}function Ih(i,l,h){return l=qr(4,i.children!==null?i.children:[],i.key,l),l.lanes=h,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}function r0(i,l,h,y,I){this.tag=l,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fl(0),this.expirationTimes=Fl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fl(0),this.identifierPrefix=y,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function Th(i,l,h,y,I,x,L,q,ee){return i=new r0(i,l,h,q,ee),l===1?(l=1,x===!0&&(l|=8)):l=0,x=qr(3,null,null,l),i.current=x,x.stateNode=i,x.memoizedState={element:y,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},jf(x),i}function a0(i,l,h){var y=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HT)}catch(e){console.error(e)}}HT();_T.exports=n8();var I1=_T.exports;const T1=er(I1);var Ap,YT=I1;Ap=Lo.createRoot=YT.createRoot;Lo.hydrateRoot=YT.hydrateRoot;const r8=e=>{const{children:t,className:n,clickSpaceDestroy:r,destroy:a}=e,o=()=>{r&&a()},s=c=>{(c.key==="Escape"||(c.ctrlKey||c.metaKey)&&c.key.toLowerCase()==="w")&&a()};return w.jsx("div",{className:`dialog-wrapper ${n}`,onClick:o,onKeyDown:c=>s(c),children:w.jsx("div",{className:"dialog-container",onClick:c=>c.stopPropagation(),children:t})})};function By(e,t,n){const r=document.createElement("div");document.body.append(r),setTimeout(()=>{var d;(d=r.firstElementChild)==null||d.classList.add("showup")},0);const a={destroy:()=>{var d,p;(d=r.firstElementChild)==null||d.classList.remove("showup"),(p=r.firstElementChild)==null||p.classList.add("showoff"),setTimeout(()=>{r.detach(),c.unmount()},MI)}},o={...n,destroy:a.destroy};let s=w.jsx(r8,{destroy:a.destroy,clickSpaceDestroy:!0,...e,children:w.jsx(t,{...o})});s=w.jsx(Bo,{store:Ee,context:mt,children:s});const c=Lo.createRoot(r);return c.render(s),a}const a8=e=>{const{shownStatus:t,setShownStatus:n}=e,{dailyNotesState:{app:r,settings:a},globalState:{manifest:o}}=A.useContext(mt),s=A.useRef(null);A.useEffect(()=>{if(t){const v=D=>{var S;(S=s.current)!=null&&S.contains(D.target)||D.stopPropagation(),n(!1)};window.addEventListener("click",v,{capture:!0,once:!0})}},[t]);const c=A.useCallback(async v=>{const{type:D}=v;if(D.startsWith("text"))try{return`${await S1.parseHtml(v)}`}catch(S){new C.Notice(S)}},[]),d=A.useCallback(()=>{const v=document.createElement("input");document.body.appendChild(v),v.type="file",v.multiple=!1,v.accept="text/html",v.onchange=async()=>{if(!v.files||v.files.length===0)return;const D=v.files[0];await c(D),document.body.removeChild(v)},v.click()},[]),p=()=>{r.setting.open(),r.setting.openTabById(o.id||"obsidian-memos")},m=()=>{if(a!=null&&a.needVerify){Qe.setLocked(!0);return}else new C.Notice(N("You have not set a password or enable this feature yet")),r.setting.open(),r.setting.openTabById(o.id||"obsidian-memos")},g=()=>{new Db(r,o.version).open()};return w.jsxs("div",{className:`menu-btns-popup ${t?"":"hidden"}`,ref:s,children:[w.jsxs("div",{className:"btn action-btn",onClick:p,children:[w.jsx("span",{ref:v=>{v&&C.setIcon(v,"user")},className:"icon"}),N("Settings")]}),(a==null?void 0:a.needVerify)&&w.jsxs("div",{className:"btn action-btn",onClick:m,children:[w.jsx("span",{ref:v=>{v&&C.setIcon(v,"lock")},className:"icon"}),N("Lock")]}),w.jsxs("div",{className:"btn action-btn",onClick:d,children:[w.jsx("span",{ref:v=>{v&&C.setIcon(v,"import")},className:"icon"}),N("Import")]}),w.jsxs("div",{className:"btn action-btn",onClick:g,children:[w.jsx("span",{ref:v=>{v&&C.setIcon(v,"file-text")},className:"icon"}),N("ChangeLog")]})]})};function zT(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const t={};return e.forEach(n=>{const r=Ue.getDateString(n.createdAt);t[r]?t[r]++:t[r]=1}),Object.keys(t).sort((n,r)=>t[r]-t[n])[0]},i8=e=>{const t={};return e.forEach(n=>{const r=Ue.getTimeString(n.createdAt).split(":")[0];t[r]?t[r]++:t[r]=1}),Object.keys(t).sort((n,r)=>t[r]-t[n])[0]},E1=({statusType:e})=>{const{memoState:{memos:t,tags:n},locationState:{pathname:r},dailyNotesState:{settings:a,app:o}}=A.useContext(mt),[s,c]=A.useState(0),[d,p]=A.useState(0),[m,g]=A.useState(0),[v,D]=A.useState(null),[S,T]=A.useState(!1),E=$.useRef(null),[O,k]=A.useState(0),[j,F]=A.useState(0),[B,R]=A.useState(0),[z,H]=A.useState(""),[Y,U]=A.useState(""),[J,Q]=A.useState(!1),[le,pe]=A.useState(null);A.useEffect(()=>{const oe=t.filter(we=>!we.deletedAt&&we.rowStatus!=="ARCHIVED");R(oe.filter(we=>{var Z;return(Z=we.thinoType)==null?void 0:Z.startsWith("TASK")}).length),H(o8(t)),U(i8(t))},[t]),A.useLayoutEffect(()=>{if(!o)return;const{tags:oe,memos:we,days:Z}=s8(o);g(oe),c(we),p(Z)},[o]),A.useEffect(()=>{let oe=0;const we=s-O,Z=1e3,G=te=>{oe||(oe=te);const ge=te-oe;if(ge{let oe=0;const we=d-j,Z=1e3,G=te=>{oe||(oe=te);const ge=te-oe;if(ge{!a||!o||(T(s>9999||m>999||d>999),l8({tags:m,memos:s,days:d},o))},[s,m,d]),A.useEffect(()=>{Te.initialized&&t&&r==="/"&&(g(n.length),c(t.filter(oe=>!(oe.deletedAt!==""&&oe.deletedAt)).length),D(t.length>0?t[t.length-1]:null))},[n,t,r]),A.useEffect(()=>{if(!Te.initialized)return;if(!v){p(0);return}if(!E.current||!(v!=null&&v.createdAt))return;C.requireApiVersion("1.4.4")&&C.setTooltip(E.current,N("Started from")+" "+Ue.getDateTimeString((v==null?void 0:v.createdAt)??""));const oe=Math.ceil((Date.now()-Ue.getTimeStampByDate(v==null?void 0:v.createdAt))/1e3/3600/24);p(t?oe:0)},[v]);const ie=(oe,we)=>{if(J&&we===le){He.setMemoFilter(""),Q(!1);return}const Z=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify([oe]));Et.pushQuery(Z),He.setMemoFilter(Z.id),Q(!0),pe(we)},se=()=>{ie({type:"LIST",value:{operator:"IS_NOT",value:"LIST"},relation:"AND"},"LIST")},fe=()=>{ie({type:"TYPE",value:{operator:"IS_NOT",value:"NOT_TAGGED"},relation:"AND"},"TYPE")};return w.jsx("div",{className:Xn("status-text-container",S?"text-overflow":"",e),children:e==="banner"?w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"status-text memos-text",children:[w.jsx("span",{className:"amount-text",children:Math.round(O)}),w.jsx("span",{className:"type-text",children:"THINO"})]}),w.jsxs("div",{className:"status-text tags-text",children:[w.jsx("span",{className:"amount-text",children:m}),w.jsx("span",{className:"type-text",children:N("TAG")})]}),w.jsxs("div",{ref:E,className:"status-text duration-text",onClick:()=>{Qe.setShowSiderbarInMobileView(!1),He.setPathname("/daily")},children:[w.jsx("span",{className:"amount-text",children:Math.round(j)??0}),w.jsx("span",{className:"type-text",children:N("DAY")})]})]}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"status-sidebar-header title-text",children:w.jsx("span",{className:"normal-text",children:N("Thino status")})}),w.jsxs("div",{className:"status-sidebar-wrapper",children:[w.jsxs("div",{className:"status-text memos-text",children:[w.jsx("span",{className:"type-text",children:N("Thino amount")}),w.jsx("span",{className:"amount-text",children:Math.round(O)})]}),w.jsxs("div",{className:"status-text memos-text",onClick:se,children:[w.jsx("span",{className:"type-text",children:N("Task amount")}),w.jsx("span",{className:"amount-text",children:Math.round(B)??0})]}),w.jsxs("div",{className:"status-text tags-text",onClick:fe,children:[w.jsx("span",{className:"type-text",children:N("Used tags")}),w.jsx("span",{className:"amount-text",children:m})]}),w.jsxs("div",{ref:E,className:"status-text duration-text",onClick:()=>{Qe.setShowSiderbarInMobileView(!1),He.setPathname("/daily")},children:[w.jsx("span",{className:"type-text",children:N("Used days")}),w.jsx("span",{className:"amount-text",children:Math.round(j)??0})]}),w.jsxs("div",{className:"status-text most-active-day-text",onClick:()=>{const oe=C.moment(z,"YYYY/MM/DD").startOf("day").valueOf(),we=C.moment(z,"YYYY/MM/DD").endOf("day").valueOf();He.setFromAndToQuery(oe,we)},children:[w.jsx("span",{className:"type-text",children:N("Most active day")}),w.jsx("span",{className:"amount-text",children:z})]}),w.jsxs("div",{className:"status-text most-active-hour-text",children:[w.jsx("span",{className:"type-text",children:N("Most active hour")}),w.jsx("span",{className:"amount-text",children:Y})]})]})]})})};function UT(e){return`userBannerCache:${e}`}function s8(e){try{const t=UT(e==null?void 0:e.appId),n=Kn.get([t])[t];return n?JSON.parse(n):{tags:0,memos:0,days:0}}catch(t){return console.error(t),{tags:0,memos:0,days:0}}}function l8({tags:e,memos:t,days:n},r){try{const a={tags:e,memos:t,days:n},o=UT(r==null?void 0:r.appId);Kn.set({[o]:JSON.stringify(a)})}catch(a){console.error(a)}}const u8=[{text:N("AND"),value:"AND"},{text:N("OR"),value:"OR"}],pl={TAG:{value:"TAG",text:N("TAG"),operators:[{text:N("INCLUDE"),value:"CONTAIN"},{text:N("EXCLUDE"),value:"NOT_CONTAIN"}]},TYPE:{value:"TYPE",text:N("TYPE"),operators:[{value:"IS",text:N("IS")},{value:"IS_NOT",text:N("ISNOT")}],values:[{value:"CONNECTED",text:N("LINKED")},{value:"NOT_TAGGED",text:N("NO TAGS")},{value:"LINKED",text:N("HAS LINKS")},{value:"IMAGED",text:N("HAS IMAGES")}]},TEXT:{value:"TEXT",text:N("TEXT"),operators:[{value:"CONTAIN",text:N("INCLUDE")},{value:"NOT_CONTAIN",text:N("EXCLUDE")}]},DATE:{value:"DATE",text:N("DATE"),operators:[{value:"NOT_CONTAIN",text:N("BEFORE")},{value:"CONTAIN",text:N("AFTER")}]},LIST:{value:"LIST",text:N("LIST"),operators:[{value:"IS",text:N("IS")},{value:"IS_NOT",text:N("ISNOT")}],values:[{value:"TODO",text:N("TODO")},{value:"DONE",text:N("DONE")},{value:"LIST",text:N("JOURNAL")},{value:"OTHER",text:N("OTHER")}]},SOURCE:{value:"SOURCE",text:N("SOURCE"),operators:[{value:"IS",text:N("IS")},{value:"IS_NOT",text:N("ISNOT")}],values:[{value:"DAILY",text:N("DAILY")},{value:"MULTI",text:N("MULTI")},{value:"FILE",text:N("FILE")},{value:"CANVAS",text:N("CANVAS")}]}},Mw=pl.TYPE.values,c8=e=>{for(const t of Mw)if(t.value===e)return t.text;return""},kD=()=>({type:"TAG",value:{operator:"CONTAIN",value:""},relation:"AND"}),Wd=(e,t)=>{let n=!0;for(const r of t){const{relation:a}=r,o=d8(e,r);a==="OR"?n=n||o:n=n&&o}return n},d8=(e,t)=>{const{type:n,value:{operator:r,value:a}}=t;if(a==="")return!0;let o=!0;if(n==="TAG"){let s=!0;const c=new Set;for(const d of Array.from(e.content.match(Fn)||[])){const m=d.replace(Fn,"$1").trim().split("/");let g="";for(const v of m)g+=v,c.add(g),g+="/"}for(const d of Array.from(e.content.match($n)||[])){const m=d.replace($n,"$1").trim().split("/");let g="";for(const v of m)g+=v,c.add(g),g+="/"}c.has(a)||(s=!1),r==="NOT_CONTAIN"&&(s=!s),o=s}else if(n==="TYPE"){let s=!1;(a==="NOT_TAGGED"&&e.content.match(Fn)===null&&e.content.match(mr)===null||a==="LINKED"&&e.content.match(Bu)!==null||a==="IMAGED"&&e.content.match(_u)!==null||a==="CONNECTED"&&e.content.match(Il)!==null)&&(s=!0),r==="IS_NOT"&&(s=!s),o=s}else if(n==="TEXT"){let s=e.content.toLowerCase().includes(a.toLowerCase());r==="NOT_CONTAIN"&&(s=!s),o=s}else if(n==="LIST"){let c=(e.thinoType==="JOURNAL"?"LIST":e.thinoType==="TASK-TODO"?"TODO":e.thinoType==="TASK-DONE"?"DONE":"OTHER").contains(a);r==="IS_NOT"&&(c=!c),o=c}else if(n==="SOURCE"){let s=e.sourceType===a;r==="IS_NOT"&&(s=!s),o=s}else if(n==="DATE"){const s=C.moment(a,"YYYY-MM-DD").isValid();let c,d;if(s)c=C.moment(a,"YYYY-MM-DD"),d=c.isBefore(C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss"),"day");else{const m=(app.plugins.enabledPlugins.has("nldates-obsidian")&&app.plugins.getPlugin("nldates-obsidian")).parseDate(a);m.date!==null&&(d=m.moment.isBefore(C.moment(e.createdAt),"day"))}r==="NOT_CONTAIN"&&(d=!d),o=d}return o=e.linkId===""?o:!1,o};function ki(e){const[t,n]=A.useState(()=>!!e),r=A.useCallback(a=>{n(typeof a=="boolean"?a:o=>!o)},[]);return[t,r]}const Fp=()=>{const{dailyNotesState:{app:e,view:t},locationState:{query:{type:n}}}=A.useContext(mt),r=$.useRef(null),a=$.useRef(null),[o,s]=ki(!1);A.useEffect(()=>{!r||!t||!e||(t.registerEvent(e.workspace.on("blur-on-memos",()=>{var g;(g=r.current)==null||g.blur()})),t.registerEvent(e.workspace.on("focus-on-searchBar",()=>{var g;(g=r.current)==null||g.focus()})))},[r,e,t]),A.useEffect(()=>{a&&C.setIcon(a.current,"search")},[a]);const c=g=>{const{type:v}=He.getState().query;g===v&&(g=""),He.setMemoTypeQuery(g)},d=g=>{const v=g.currentTarget.value;if(!v.contains(" -time: ")){He.setTextQuery(v);return}const D=v.split(" -time: ")[1],S=D.length>10?D.match(/\d{4}-\d{2}-\d{2}/g):null;if(S==null){He.setTextQuery(v.split(" -time: ")[0]);return}if(S.length===1){const T=C.moment(S[0]);He.setTimeQuery({from:T.startOf("day").valueOf(),to:T.endOf("day").valueOf()})}else if(S.length===2){const T=C.moment(S[0]),E=C.moment(S[1]);He.setTimeQuery({from:T.startOf("day").valueOf(),to:E.endOf("day").valueOf()})}He.setTextQuery(v.split(" -time: ")[0])},p=()=>{s(!0)},m=()=>{s(!1)};return w.jsxs("div",{className:"search-bar-container",children:[w.jsxs("div",{className:"search-bar-inputer",children:[w.jsx("span",{ref:a,className:"btn icon-img"}),w.jsx("input",{ref:r,className:"text-input",type:"text",onMouseOver:p,onMouseOut:m,placeholder:o?N("Type here"):"",onChange:d})]}),w.jsx("div",{className:"quickly-action-wrapper",children:w.jsxs("div",{className:"quickly-action-container",children:[w.jsx("span",{className:"title-text",children:N("Quick filter")}),w.jsxs("div",{className:"section-container types-container",children:[w.jsxs("span",{className:"section-text",children:[N("TYPE"),":"]}),w.jsx("div",{className:"values-container",children:Mw.map((g,v)=>w.jsxs("div",{children:[w.jsx("span",{className:`type-item ${n===g.value?"selected":""}`,onClick:()=>{c(g.value)},children:g.text}),v+1{const{children:t,when:n}=e;return n?w.jsx(w.Fragment,{children:t}):null},so=f8;function qt(){const e=document.createDocumentFragment();e.createEl("div",{cls:"thino-info"}).createEl("div",{text:N("This is a pro feature, please upgrade to pro version to use it.")});const r=e.createEl("div",{cls:"thino-link"}).createEl("div",{text:N("You can get pro version from: ")}),a=localStorage.getItem("language");let o="https://pkmer.cn/products/UserProfile/";a&&a==="zh"?o="https://pkmer.cn/products/thino/":o="https://thino.pkmer.net/en/",r.createEl("a",{text:"PKMer",attr:{href:o}}),new C.Notice(e,5e3)}const{exec:h8,execSync:yX}=C.Platform.isDesktop&&require("child_process"),{createHash:p8}=C.Platform.isDesktop&&require("crypto"),m8={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},g8=C.Platform.isDesktop&&{darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:`${m8[y8()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"};function y8(){return process.platform!=="win32"?"":process.arch==="ia32"&&Object.hasOwnProperty.call(process.env,"PROCESSOR_ARCHITEW6432")?"mixed":"native"}function v8(e){return p8("sha256").update(e).digest("hex")}function w8(e){switch(process.platform){case"darwin":return e.split("IOPlatformUUID")[1].split(` `)[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 vn(e=!1){return new Promise((t,n)=>{h8(g8[process.platform],{},(r,a)=>{if(r)return n(new Error(`Error while obtaining machine id: ${r.stack}`));const o=w8(a.toString());return t(e?o:v8(o))})})}const AD={list:"align-left",waterfall:"layout-grid",calendar:"calendar",minimal:"list",table:"table",chat:"message-square",moments:"chrome"},b8=e=>{const{dailyNotesState:{app:t,view:n,verifyState:r,settings:a},globalState:{manifest:o,isMobileView:s}}=A.useContext(mt),c=A.useRef(null),d=A.useRef(null),[p,m]=A.useState((window.app||t).loadLocalStorage("thinoListView")),[g,v]=A.useState(null);A.useEffect(()=>{if(!o||!t)return;const S=t==null?void 0:t.plugins.getPlugin(o.id);v(S),m(S==null?void 0:S.settings.MemoListView),Qe.setMemoListView(S==null?void 0:S.settings.MemoListView)},[o,t]),A.useEffect(()=>{if(!t||!n||!g||!g.settings)return;const S=()=>{var E;if(n.leaf.height===0)return;const T=(E=g==null?void 0:g.settings)==null?void 0:E.MemoListView;T==="chat"||T==="moments"||(n.leaf.width>950?(m(T),Qe.setMemoListView(T)):n.leaf.width<=950&&(Qe.setMemoListView("list"),m("list")))};S(),d.current||(d.current=t.workspace.on("resize",S),n.registerEvent(d.current))},[t,n,g]),A.useEffect(()=>{c&&(C.setIcon(c.current,AD[p||"list"]),Qe.setMemoListView(p),C.requireApiVersion("1.4.4")&&C.setTooltip(c.current,N("Switch view")))},[p]);const D=async S=>{var F;const T=!C.Platform.isDesktop&&await((F=window.Capacitor)==null?void 0:F.Plugins.Device.getId()),E=C.Platform.isDesktop?await vn():T.identifier||T.uuid;if(!r||(r==null?void 0:r.appId)!==E){qt();return}const O=async B=>{Qe.setMemoListView(B),g&&(g.settings.MemoListView=B,await g.saveSettings()),m(B)},k=[{view:"list",title:N("List")},{view:"chat",title:N("Chat")},{view:"moments",title:N("Moments")}];s||k.push({view:"waterfall",title:N("Waterfall")},{view:"calendar",title:N("Calendar")},{view:"table",title:N("Table")});const j=new C.Menu;k.forEach(({view:B,title:R})=>{j.addItem(z=>{z.setChecked(p===B).setIcon(AD[B]).setTitle(R).onClick(()=>{p!==B&&O(B)})})}),j.showAtMouseEvent(S.nativeEvent)};return w.jsx("div",{className:`memos-view-switcher-wrapper ${e.className?e.className:""} pro`,ref:c,onClick:D})},D8=()=>{const e=A.useRef(null);return A.useEffect(()=>{e&&(C.setIcon(e.current,"calendar-check"),C.setTooltip&&C.setTooltip(e.current,N("Daily Memos")))},[e]),w.jsx("div",{className:"memos-review-entry-wrapper",ref:e,onClick:()=>{He.setPathname("/daily")}})},O0=()=>({type:"initialText",value:"",timestamp:Date.now(),selectionStart:0,selectionEnd:0}),FD={initialValue:"",interval:300};class S8{constructor(t,n=FD){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.currentIndexthis.actions,this.setState=(r,a)=>{this.actions=[...r],this.currentIndex=a{this.actions=[O0()],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.preventDefault(),this.runRedo())},this.handleElementInput=r=>{const a=r,o=this.actions[this.currentIndex];this.pushNewAction({type:a.inputType,value:this.element.value,timestamp:Date.now(),selectionStart:this.element.selectionEnd-(this.element.value.length-o.value.length),selectionEnd:this.element.selectionEnd})},this.addEventListeners=()=>{this.element.addEventListener("keydown",this.handleElementKeydown),this.element.addEventListener("input",this.handleElementInput)},this.rmEventListeners=()=>{this.element.removeEventListener("keydown",this.handleElementKeydown),this.element.removeEventListener("input",this.handleElementInput)},this.pushNewAction=r=>{const a=this.actions[this.currentIndex];a&&a.type===r.type&&r.timestamp-a.timestamp=this.config.maxSize?(this.actions.shift(),this.actions[0]=O0()):this.currentIndex++,this.actions[this.currentIndex]=r,this.actions=this.actions.slice(0,this.currentIndex+1)),this.dispatchChange()},this.dispatchChange=()=>{for(const r of this.listeners)r([...this.actions],this.currentIndex)},this.element=t,this.config=Object.assign(Object.assign({},FD),n),this.config.initialActions&&this.config.initialActions.length>0?(this.actions=this.config.initialActions,this.config.initialIndex!==void 0&&this.config.initialIndex{e(n=>!n)},[])}var VT={exports:{}};(function(e){(function(){var t=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],n=typeof window<"u",r=n&&window.mozInnerScreenX!=null;function a(o,s,c){if(!n)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var d=c&&c.debug||!1;if(d){var p=document.querySelector("#input-textarea-caret-position-mirror-div");p&&p.parentNode.removeChild(p)}var m=document.createElement("div");m.id="input-textarea-caret-position-mirror-div",document.body.appendChild(m);var g=m.style,v=window.getComputedStyle?getComputedStyle(o):o.currentStyle;g.whiteSpace="pre-wrap",o.nodeName!=="INPUT"&&(g.wordWrap="break-word"),g.position="absolute",d||(g.visibility="hidden"),t.forEach(function(T){g[T]=v[T]}),r?o.scrollHeight>parseInt(v.height)&&(g.overflowY="scroll"):g.overflow="hidden",m.textContent=o.value.substring(0,s),o.nodeName==="INPUT"&&(m.textContent=m.textContent.replace(/\s/g," "));var D=document.createElement("span");D.textContent=o.value.substring(s)||".",m.appendChild(D);var S={top:D.offsetTop+parseInt(v.borderTopWidth),left:D.offsetLeft+parseInt(v.borderLeftWidth)};return d?D.style.backgroundColor="#aaa":document.body.removeChild(m),S}e.exports=a})()})(VT);var T8=VT.exports;const E8=er(T8);var ZT=Jn.CustomEvent;function C8(){try{var e=new ZT("cat",{detail:{foo:"bar"}});return e.type==="cat"&&e.detail.foo==="bar"}catch{}return!1}var x8=C8()?ZT:typeof document<"u"&&typeof document.createEvent=="function"?function(t,n){var r=document.createEvent("CustomEvent");return n?r.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,n){var r=document.createEventObject();return r.type=t,n?(r.bubbles=!!n.bubbles,r.cancelable=!!n.cancelable,r.detail=n.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r};const M8=er(x8);function N8(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k8(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:!1,p=r.props.onItemHighlighted;r.state.selectedItem!==c&&r.setState({selectedItem:c},function(){p(c),d&&r.props.dropdownScroll(r.itemsRef[r.getId(c)])})},r.scroll=function(c){c.preventDefault();var d=r.props.values,p=c.keyCode||c.which,m=r.getPositionInList(),g;switch(p){case Ha.DOWN:g=m+1;break;case Ha.UP:g=m-1;break;default:g=m;break}g=(g%d.length+d.length)%d.length,r.selectItem(d[g],[Ha.DOWN,Ha.UP].includes(p))},r.isSelected=function(c){var d=r.state.selectedItem;return d?r.getId(d)===r.getId(c):!1},r}return _y(t,[{key:"componentDidMount",value:function(){this.listeners.push(Eu.add([Ha.DOWN,Ha.UP],this.scroll),Eu.add([Ha.ENTER,Ha.TAB],this.onPressEnter));var r=this.props.values;r&&r[0]&&this.selectItem(r[0])}},{key:"componentDidUpdate",value:function(r){var a=this,o=r.values,s=this.props.values,c=o.map(function(p){return a.getId(p)}).join(""),d=s.map(function(p){return a.getId(p)}).join("");c!==d&&s&&s[0]&&this.selectItem(s[0])}},{key:"componentWillUnmount",value:function(){for(var r;this.listeners.length;)r=this.listeners.pop(),Eu.remove(r)}},{key:"render",value:function(){var r=this,a=this.props,o=a.values,s=a.component,c=a.style,d=a.itemClassName,p=a.className,m=a.itemStyle;return $.createElement("ul",{className:"rta__list ".concat(p||""),style:c},o.map(function(g){return $.createElement(R8,{key:r.getId(g),innerRef:function(D){r.itemsRef[r.getId(g)]=D},selected:r.isSelected(g),item:g,className:d,style:m,onClickHandler:r.onPressEnter,onSelectHandler:r.selectItem,component:s})}))}}]),t}($.Component);function _8(e,t){var n=parseInt(getComputedStyle(t).getPropertyValue("height"),10),r=parseInt(getComputedStyle(e).getPropertyValue("height"),10)-n,a=t.offsetTop,o=e.scrollTop;ag.right&&D.left+s>v.width?(m=s-v.width,c.push(dl.X.LEFT),d.push(dl.X.RIGHT)):(m=s,c.push(dl.X.RIGHT),d.push(dl.X.LEFT)),j>g.bottom&&D.top+o>v.height?(p=o-v.height,c.push(dl.Y.TOP),d.push(dl.Y.BOTTOM)):(p=o,c.push(dl.Y.BOTTOM),d.push(dl.Y.TOP)),this.props.renderToBody&&(p+=D.top,m+=D.left),this.ref.style.top="".concat(p,"px"),this.ref.style.left="".concat(m,"px"),(r=this.ref.classList).remove.apply(r,d),(a=this.ref.classList).add.apply(a,c)}},{key:"render",value:function(){var r=this,a=this.props,o=a.style,s=a.className,c=a.innerRef,d=a.children,p=a.renderToBody,m=document.body,g=$.createElement("div",{ref:function(D){r.ref=D,c(D)},className:"rta__autocomplete ".concat(s||""),style:o},d);return p&&m!==null?T1.createPortal(g,m):g}}]),t}($.Component),WT=function(e){Yy(t,e);function t(n){var r;Op(this,t),r=Hy(this,Nd(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=Eu.add(Ha.ESC,r._closeAutocomplete))},r.escListenerDestroy=function(){r.escListener&&(Eu.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,p=d.selectionStart,m=d.selectionEnd;return p===m?null:r.state.value.substr(p,m-p)},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 p=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 Ha.UP:case Ha.DOWN:r._isAutocompleteOpen()||p();break;case Ha.LEFT:case Ha.RIGHT:p();break}return}p()},r._onSelect=function(d){var p=r.state,m=p.selectionEnd,g=p.currentTrigger,v=p.value,D=r.props.onItemSelected;if(g){var S=r._getTextToReplace(g);if(!S){r._closeAutocomplete();return}var T=S(d);if(!T){r._closeAutocomplete();return}D&&D({currentTrigger:g,item:d});var E=function(U,J,Q){switch(U){case"start":return Q;case"next":case"end":return Q+J.length;default:if(!Number.isInteger(U))throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');return U}},O=v.slice(0,m),k=Ag(g),j=O.length-O.lastIndexOf(g),F=O.search(new RegExp("(?!".concat(k,")$")))-j,B=T.caretPosition==="next"?"".concat(T.text," "):T.text,R=E(T.caretPosition,B,F),z=O.substring(0,F)+B,H=v.replace(O,z);r.setState({value:H,dataLoading:!1},function(){var Y=r.tokenRegExpEnding.exec(B),U=Y?Y[0].length:1;r.lastTrigger=R&&R-U,r.textareaRef.value=H,r.textareaRef.selectionEnd=R,r._changeHandler();var J=r.textareaRef.scrollTop;r.setCaretPosition(R),window.chrome&&(r.textareaRef.scrollTop=J)})}},r._getTextToReplace=function(d){var p=r.props.trigger[d];if(!d||!p)return null;var m=p.output;return function(g){if(typeof g=="object"&&(!m||typeof m!="function"))throw new Error('Output functor is not defined! If you are using items as object you have to define "output" function. https://github.com/webscopeio/react-textarea-autocomplete#trigger-type');if(m){var v=m(g,d);if(v===void 0||typeof v=="number")throw new Error(`Output functor should return string or object in shape {text: string, caretPosition: string | number}. Got "`.concat(String(v),'". Check the implementation for trigger "').concat(d,`" See https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more information. `));if(v===null)return null;if(typeof v=="string")return{text:v,caretPosition:PD};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(`Output item should be string `);return{text:"".concat(d).concat(g).concat(d),caretPosition:PD}}},r._getCurrentTriggerSettings=function(){var d=r.state.currentTrigger;return d?r.props.trigger[d]:null},r._getValuesFromProvider=function(){var d=r.state,p=d.currentTrigger,m=d.actualToken,g=r._getCurrentTriggerSettings();if(!(!p||!g)){var v=g.dataProvider,D=g.component;if(typeof v!="function")throw new Error("Trigger provider has to be a function!");r.setState({dataLoading:!0});var S=v(m);S instanceof Promise||(S=Promise.resolve(S)),S.then(function(T){if(!Array.isArray(T))throw new Error("Trigger provider has to provide an array!");if(typeof D!="function")throw new Error("Component should be defined!");if(p===r.state.currentTrigger){if(!T.length){r._closeAutocomplete();return}r.setState({dataLoading:!1,data:T,component:D})}}).catch(function(T){return jD(T.message)})}},r._getSuggestions=function(){var d=r.state,p=d.currentTrigger,m=d.data;return!p||!m||m&&!m.length?null:m},r._createRegExp=function(){var d=r.props.trigger;r.tokenRegExp=new RegExp("(".concat(Object.keys(d).sort(function(p,m){return pm?-1:0}).map(function(p){return Ag(p)}).join("|"),")((?:(?!\\1)[^\\s])*$)")),r.tokenRegExpEnding=new RegExp("(".concat(Object.keys(d).sort(function(p,m){return pm?-1:0}).map(function(p){return Ag(p)}).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=k8({},r.props),p=["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)p.includes(m)&&delete d[m];return d},r._changeHandler=function(d){var p=r.props,m=p.trigger,g=p.onChange,v=p.minChar,D=p.onCaretPositionChange,S=p.movePopupAsYouType,T=r.state,E=T.top,O=T.left,k=d;k||(k=new M8("change",{bubbles:!0}),r.textareaRef.dispatchEvent(k));var j=k.target||r.textareaRef,F=j.selectionEnd,B=j.value;if(r.lastValueBubbledEvent=B,g&&k&&(k.persist&&k.persist(),g(new Proxy(k,{get:function(Z,G,te){return G==="target"?j:Reflect.get(Z,G,te)}}))),D){var R=r.getCaretPosition();D(R)}r.setState({value:B});var z=function(){var Z=E8(j,F),G=Z.top,te=Z.left;r.setState({top:G-r.textareaRef.scrollTop||0,left:te})},H=function(Z){r.lastTrigger=F-Z,r._closeAutocomplete(),z()};if(F<=r.lastTrigger){var Y=B.slice(0,F),U=r.tokenRegExp.exec(Y);H(U?U[0].length:0)}var J=B.slice(r.lastTrigger,F),Q=r.tokenRegExp.exec(J),le=Q&&Q[0],pe=Q&&Q[1]||null,ie=pe?pe.length-1:0,se=r.tokenRegExpEnding.exec(J);if(se?H(se[0].length):r._isAutocompleteOpen()||r._closeAutocomplete(),(!le||le.length<=v+ie)&&(r.state.currentTrigger&&!m[r.state.currentTrigger].allowWhitespace||!r.state.currentTrigger)){r._closeAutocomplete();return}if(pe&&m[pe].afterWhitespace&&!/\s/.test(B[F-le.length-1])&&B[F-le.length-1]!==void 0){r._closeAutocomplete();return}if(r.state.currentTrigger&&m[r.state.currentTrigger].allowWhitespace){if(Q=new RegExp("".concat(Ag(r.state.currentTrigger),".*$")).exec(B.slice(0,F)),le=Q&&Q[0],!le){r._closeAutocomplete();return}pe=Object.keys(m).find(function(we){return we.slice(0,ie+1)===le.slice(0,ie+1)})||null}var fe=le.slice(1);if(pe){(S||E===null&&O===null||r.state.currentTrigger!==pe)&&z(),r.escListenerInit();var oe=r._getTextToReplace(pe);r.setState({selectionEnd:F,currentTrigger:pe,textToReplace:oe,actualToken:fe},function(){try{r._getValuesFromProvider()}catch(we){jD(we.message)}})}},r._selectHandler=function(d){var p=r.props,m=p.onCaretPositionChange,g=p.onSelect;if(m){var v=r.getCaretPosition();m(v)}g&&(d.persist(),g(d))},r._shouldStayOpen=function(d){var p=d.relatedTarget;return p===null&&(p=document.activeElement),!!(r.dropdownRef&&p instanceof Node&&r.dropdownRef.contains(p))},r._onClick=function(d){var p=r.props.onClick;p&&(d.persist(),p(d)),!r._shouldStayOpen(d)&&r._closeAutocomplete()},r._onBlur=function(d){var p=r.props.onBlur;p&&(d.persist(),p(d)),!r._shouldStayOpen(d)&&r._closeAutocomplete()},r._onScrollHandler=function(){r._closeAutocomplete()},r._onItemHighlightedHandler=function(d){var p=r.props.onItemHighlighted,m=r.state.currentTrigger;if(p)if(typeof p=="function")p({currentTrigger:m,item:d});else throw new Error("`onItemHighlighted` has to be a function")},r._dropdownScroll=function(d){var p=r.props.scrollToItem;if(p){if(p===!0){_8(r.dropdownRef,d);return}if(typeof p!="function"||p.length!==2)throw new Error("`scrollToItem` has to be boolean (true for default implementation) or function with two parameters: container, item.");p(r.dropdownRef,d)}},r._isAutocompleteOpen=function(){var d=r.state,p=d.dataLoading,m=d.currentTrigger,g=r._getSuggestions();return!!((p||g)&&m)},r._textareaRef=function(d){r.props.innerRef&&r.props.innerRef(d),r.textareaRef=d},r.lastTrigger=0,r.escListener=null;var a=r.props,o=a.loadingComponent,s=a.trigger,c=a.value;if(c&&(r.state.value=c),r._createRegExp(),!o)throw new Error("RTA: loadingComponent is not defined");if(!s)throw new Error("RTA: trigger is not defined");return r}return _y(t,[{key:"componentDidMount",value:function(){Eu.startListen(this.textareaRef),this.textareaRef&&this.textareaRef.addEventListener("focus",this._handleCaretChange),this.textareaRef&&this.textareaRef.addEventListener("click",this._handleCaretChange),this.textareaRef&&this.textareaRef.addEventListener("keydown",this._handleCaretChange)}},{key:"componentDidUpdate",value:function(r){var a=r.trigger,o=r.value,s=this.props,c=s.trigger,d=s.value;Object.keys(c).join("")!==Object.keys(a).join("")&&this._createRegExp(),o!==d&&this.lastValueBubbledEvent!==d&&(this.lastTrigger=0,this._changeHandler())}},{key:"componentWillUnmount",value:function(){this.escListenerDestroy(),Eu.stopListen(this.textareaRef),this.textareaRef&&this.textareaRef.removeEventListener("focus",this._handleCaretChange),this.textareaRef&&this.textareaRef.removeEventListener("click",this._handleCaretChange),this.textareaRef&&this.textareaRef.removeEventListener("keydown",this._handleCaretChange)}},{key:"render",value:function(){var r=this,a=this.props,o=a.loadingComponent,s=a.style,c=a.className,d=a.listStyle,p=a.itemStyle,m=a.boundariesElement,g=a.movePopupAsYouType,v=a.listClassName,D=a.itemClassName,S=a.dropdownClassName,T=a.dropdownStyle,E=a.containerStyle,O=a.containerClassName,k=a.loaderStyle,j=a.loaderClassName,F=a.textAreaComponent,B=a.renderToBody,R=this.state,z=R.left,H=R.top,Y=R.dataLoading,U=R.component,J=R.value,Q=R.textToReplace,le=this._isAutocompleteOpen(),pe=this._getSuggestions(),ie={},se;return F.component?(se=F.component,ie[F.ref]=this._textareaRef):(se=F,ie.ref=this._textareaRef),$.createElement("div",{className:"rta ".concat(Y===!0?"rta--loading":""," ").concat(O||""),style:E},$.createElement(se,Object.assign({},this._cleanUpProps(),{className:"rta__textarea ".concat(c||""),onChange:this._changeHandler,onSelect:this._selectHandler,onScroll:this._onScrollHandler,onClick:this._onClick,onBlur:this._onBlur,value:J,style:s},ie)),le&&$.createElement(Y8,{innerRef:function(oe){r.dropdownRef=oe},top:H,left:z,style:T,className:S,movePopupAsYouType:g,boundariesElement:m,textareaRef:this.textareaRef,renderToBody:B},pe&&U&&Q&&$.createElement(B8,{values:pe,component:U,style:d,className:v,itemClassName:D,itemStyle:p,getTextToReplace:Q,onItemHighlighted:this._onItemHighlightedHandler,onSelect:this._onSelect,dropdownScroll:this._dropdownScroll}),Y&&$.createElement("div",{className:"rta__loader ".concat(pe!==null?"rta__loader--suggestion-data":"rta__loader--empty-suggestion-data"," ").concat(j||""),style:k},$.createElement(o,{data:pe}))))}}],[{key:"getDerivedStateFromProps",value:function(r){var a=r.value;return a==null?null:{value:a}}}]),t}($.Component);WT.defaultProps={movePopupAsYouType:!1,value:null,minChar:1,boundariesElement:"body",scrollToItem:!0,textAreaComponent:"textarea",renderToBody:!1};const z8=()=>{const{app:e}=Xe.getState(),t=e.metadataCache.getTags();return[...Object.keys(t)].map(n=>n.split("#").pop())},U8=e=>{let t=[];const n=Xe.getState().settings;if(n&&(n!=null&&n.UseVaultTags))t=z8();else{const{tags:o}=Te.getState();t=o}const r=e.toLowerCase(),a=[];return t.forEach(o=>{o&&o.toLowerCase().contains(r)&&a.push({name:o,char:o})}),a},V8=e=>{const{app:t}=Xe.getState(),n=t.vault.getAllLoadedFiles(),r=[];let a;return n.forEach(o=>{e==="["?a="":e.contains("[")&&(a=e.slice(1));const s=a.toLowerCase();o instanceof C.TFile&&["md","png","jpg","canvas","jpeg","gif"].contains(o.extension)&&o.path.toLowerCase().contains(s)&&r.push({name:o.basename,char:o.name,file:o})}),r};var P0=A,Z8=function(e){return typeof e=="function"},W8=function(e){var t=P0.useState(e),n=t[0],r=t[1],a=P0.useRef(n),o=P0.useCallback(function(s){a.current=Z8(s)?s(a.current):s,r(a.current)},[]);return[n,o,a]},$8=W8;const Kr=er($8);function qh(e,t){const n=Object.keys(t).map(r=>G8(e,r,t[r]));return n.length===1?n[0]:function(){n.forEach(r=>r())}}function G8(e,t,n){const r=e[t],a=e.hasOwnProperty(t);let o=n(r);return r&&Object.setPrototypeOf(o,r),Object.setPrototypeOf(s,o),e[t]=s,c;function s(...d){return o===r&&e[t]===s&&c(),o.apply(this,d)}function c(){e[t]===s&&(a?e[t]=r:delete e[t]),o!==r&&(o=r,Object.setPrototypeOf(s,r||Function))}}function q8(e){return e.containerEl.matches(".memos-list-view")}const J8=e=>{const{dailyNotesState:{app:t,plugin:n,editor:r,view:a,dailyNotes:o}}=A.useContext(mt),[s,c]=A.useState(null),[d,p]=A.useState(!1),[m,g]=A.useState(""),[v,D]=A.useState(null),S=A.useRef(C.debounce((z,H)=>{Q8(z,H)},100));A.useEffect(()=>{var z;if(!v){if(!o){const H=(z=t||window.app)==null?void 0:z.vault.getMarkdownFiles();D(H[0]);return}for(const H in o)if(o[H]instanceof C.TFile){D(o[H]);break}}},[o]),A.useEffect(()=>{if(!(!e||!r)&&!d)return k(e),()=>{p(!1),s==null||s.destroy()}},[r,e]),A.useEffect(()=>{if(!s||!t)return;const z=K8(t);g(z),(s==null?void 0:s.editor).replaceSelection(z)},[s,t]),A.useEffect(()=>{!s||!t||S.current(m,t)},[m,t]);const T=()=>{s&&s.toggleSource()},E=C.debounce((z,H)=>O(z,H),500,!0),O=(z,H)=>{z&&g(H)},k=z=>{if(!a){new C.Notice(N("Please open thino first"));return}if(r&&a){a.register(qh(r.constructor.prototype,{onUpdate:Y=>function(...U){if(Y.call(this,U),this.owner.getViewType()==="thino_view"||this.owner instanceof wl){const J=this.get();E(this.owner,J)}},getMode:()=>function(){return"source"}})),a.register(qh(C.Workspace.prototype,{getActiveViewOfType:Y=>function(U){const J=Y.call(this,U);if(!J&&(U==null?void 0:U.VIEW_TYPE)==="markdown"){const Q=this.activeLeaf;if(Q.view instanceof wl)return Q.view}return J},setActiveLeaf:Y=>function(U,J){if(q8(U)&&(Y.call(this,U,J),U.activeTime=17e11),Y.call(this,U,J),U.view instanceof wl){const Q=Qe.getState().instanceList.get(U.id);if(!Q)return;self.app.workspace.activeEditor=Q.owner,U.view.editor=Q.editor}},getActiveFile:Y=>function(){var J;const U=Y.call(this);return((J=this.activeLeaf)==null?void 0:J.view)instanceof wl&&v||U}}));const H=new r.constructor(a.app,z,a);H.owner.editor=H.editor,H.set&&H.set("",!0),H.owner.onMarkdownScroll=()=>{},t.workspace.trigger("thino-editor-created",z,H.editor),p(!0),c(H),Qe.setInstance(`${a.leaf.id}`,H)}};return{instance:s,value:m,set:z=>{try{s&&((s==null?void 0:s.editor).replaceSelection(z),g(z))}catch(H){console.error(H)}},get:()=>s?s.get():"",append:(z,H)=>{if(!s||H&&H!==s.owner.leaf.id)return;const U=(s.get()||"")+z;(s==null?void 0:s.editor).replaceSelection(z),g(U)},clear:()=>{s&&(s.clear(),g(""))},toggleSource:T}};function $T(e){return`thinoEditorContentCache:${e}`}function K8(e){try{const t=$T(e==null?void 0:e.appId);return Kn.get([t])[t]||""}catch(t){return console.error(t),""}}function Q8(e,t){try{const n=$T(t==null?void 0:t.appId);Kn.set({[n]:e})}catch(n){console.error(n)}}function X8(e,t){return{line:e.line,ch:e.ch+t}}const LD=({entity:{name:e,char:t,file:n}})=>w.jsx("div",{children:`${t}`}),e9=({data:e})=>w.jsx("div",{children:"Loading"});let wi;const t9=A.forwardRef((e,t)=>{var Ie;const{globalState:{useTinyUndoHistoryCache:n,globalEditorShown:r,memoListView:a},dailyNotesState:{settings:o,app:s}}=A.useContext(mt),{SaveMemoButtonLabel:c,SaveMemoButtonIcon:d}=o,{className:p,inputerType:m,initialContent:g,placeholder:v,showConfirmBtn:D,showCancelBtn:S,onConfirmBtnClick:T,onCancelBtnClick:E,onContentChange:O}=e,k=A.useRef(null),j=A.useRef(null),F=A.useRef(null),B=I8(),{instance:R,value:z,set:H,get:Y,append:U,clear:J,toggleSource:Q}=J8(j.current),[,le,pe]=Kr(0),[ie,se]=Kr(!1);A.useEffect(()=>{var De,ke;if(o&&o.FocusOnEditor)switch(m){case"minimal":case"memos":(De=k.current)==null||De.focus();break;case"obsidian":R&&((ke=R.editor)==null||ke.focus())}},[o,R]),A.useEffect(()=>{if(!s)return;const De=s.workspace.getLeavesOfType(_r);let ke,Ye;De.length>0?(Ye=De[0].view.containerEl,ke=Ye.offsetHeight):(Ye=document,ke=window.outerHeight),le(ke)},[s]),A.useEffect(()=>{!k.current||m==="obsidian"||g&&(k.current.value=g,B())},[]),A.useEffect(()=>{var De;if(m!=="obsidian")if(n){if(!k.current)return;const{tinyUndoActionsCache:ke,tinyUndoIndexCache:Ye}=Kn.get(["tinyUndoActionsCache","tinyUndoIndexCache"]);return F.current=new S8(k.current,{interval:5e3,initialActions:ke,initialIndex:Ye}),F.current.subscribe((Re,rt)=>{Kn.set({tinyUndoActionsCache:Re,tinyUndoIndexCache:rt})}),()=>{var Re;(Re=F.current)==null||Re.destroy()}}else(De=F.current)==null||De.destroy(),F.current=null,Kn.remove(["tinyUndoActionsCache","tinyUndoIndexCache"])},[n]),A.useEffect(()=>{k.current&&(k.current.style.height="auto",k.current.style.height=(k.current.scrollHeight??0)+"px")},[(Ie=k.current)==null?void 0:Ie.value]),A.useImperativeHandle(t,()=>({element:k.current,blur:()=>{var De,ke;switch(m){case"minimal":case"memos":(De=k.current)==null||De.blur();break;case"obsidian":R&&((ke=R.editor)==null||ke.blur())}},focus:De=>{var ke,Ye,Re,rt,Ht;switch(m){case"minimal":case"memos":(ke=k.current)==null||ke.focus();break;case"obsidian":if(R){if(De&&De!==((rt=(Re=(Ye=R==null?void 0:R.owner)==null?void 0:Ye.view)==null?void 0:Re.leaf)==null?void 0:rt.id))return;(Ht=R.editor)==null||Ht.focus()}}},insertTag:De=>{var ke,Ye,Re;switch(m){case"minimal":case"memos":{if(!k.current)return;const rt=k.current.value;k.current.value=rt.slice(0,k.current.selectionStart)+"# "+rt.slice(k.current.selectionStart),O(k.current.value),B();break}case"obsidian":if(De&&De!==((Re=(Ye=(ke=R==null?void 0:R.owner)==null?void 0:ke.view)==null?void 0:Ye.leaf)==null?void 0:Re.id))return;if(R){const rt=R.editor,Ht=rt.getCursor("from");rt.replaceRange("#",Ht),rt.setSelection(X8(Ht,1))}break}},insertText:(De,ke)=>{switch(m){case"minimal":case"memos":{if(!k.current)return;const Ye=k.current.value;k.current.value=Ye.slice(0,k.current.selectionStart)+De+Ye.slice(k.current.selectionStart),O(k.current.value),B()}break;case"obsidian":R&&U(De,ke);break}},setContent:De=>{switch(m){case"minimal":case"memos":k.current&&(k.current.value=De,O(k.current.value),B());break;case"obsidian":R&&H(De);break}},getContent:()=>{switch(m){case"minimal":case"memos":return k.current?k.current.value:"";case"obsidian":return Y()}},toggleSource:()=>{switch(m){case"minimal":case"memos":break;case"obsidian":Q();break}},clear:()=>{switch(m){case"minimal":case"memos":k.current&&(k.current.value="",O(k.current.value),B());break;case"obsidian":J();break}}}),[R,m]);const fe=De=>{if(!k.current)return;const{fileManager:ke}=Ee.getState().dailyNotesState.app;if(De.currentTrigger==="#"){const Ye=k.current.value;let Re;wi!=null?Re=wi.length:Re=0;let rt=k.current.selectionStart;for(let Ht=0;Ht{var De;O(((De=k.current)==null?void 0:De.value)||""),B()},[]),we=()=>{var De;switch(m){case"minimal":case"memos":if(!k.current)return;k.current.value=G(),T(k.current.value),k.current.value="",B(),(De=F.current)==null||De.resetState();break;case"obsidian":T(Y()),J(),B();break}},Z=A.useCallback(()=>{switch(m){case"minimal":case"memos":k.current&&(k.current.value="",O(k.current.value),B());break;case"obsidian":J();break}E()},[m,R,k]),G=()=>Kn.get(["thinoEditorContentCache"]).thinoEditorContentCache||"",te=()=>{if(k.current)return k.current.value=G(),k.current.value},ge=De=>{switch(De){case"memos":return w.jsx(WT,{className:`common-editor-inputer scroll ${ie?" editing":""}`,loadingComponent:e9,placeholder:v,movePopupAsYouType:!0,value:te(),innerRef:ke=>{k.current=ke},onFocus:()=>{se(!0)},onBlur:()=>{se(!1)},onInput:oe,style:{maxHeight:`${pe.current>400?pe.current-400:100}px`},dropdownStyle:{minWidth:180,maxHeight:250,overflowY:"auto"},minChar:0,onItemSelected:fe,scrollToItem:!0,trigger:{"#":{dataProvider:ke=>(wi=ke,U8(ke).map(({name:Ye,char:Re})=>({name:Ye,char:Re}))),component:LD,afterWhitespace:!0,output:ke=>ke.char},"[[":{dataProvider:ke=>(wi=ke,V8(ke).slice(0,10).map(({name:Ye,char:Re,file:rt})=>({name:Ye,char:Re,file:rt}))),component:LD,afterWhitespace:!0,output:ke=>ke.char}}});case"minimal":return w.jsx("textarea",{style:{minHeight:48},className:"common-editor-inputer scroll",rows:1,placeholder:v,ref:k,onInput:oe});case"obsidian":return w.jsx("div",{className:"common-editor-inputer common-editor-mod-cm6",ref:j});default:return w.jsx("div",{className:"common-editor-inputer common-editor-mod-cm6",ref:j})}};return w.jsxs("div",{className:"common-editor-wrapper "+p,children:[ge(m),w.jsxs("div",{className:"common-tools-wrapper",children:[w.jsx("div",{className:"common-tools-container",children:w.jsx(so,{when:e.tools!==void 0,children:e.tools})}),w.jsxs("div",{className:"btns-container",children:[w.jsx(so,{when:S,children:w.jsx("button",{className:"action-btn cancel-btn",onClick:()=>{o&&o.DefaultEditorLocation==="Top"&&!r&&Z()},onPointerDown:()=>{(o&&o.DefaultEditorLocation==="Bottom"||r)&&Z()},children:He.getState().pathname==="/"&&a==="chat"&&((o==null?void 0:o.chatViewStyle)==="fluent"||(o==null?void 0:o.chatViewStyle)==="inline")?"":N("CANCEL EDIT")})}),w.jsx(so,{when:D,children:w.jsxs("button",{title:"Ctrl/Cmd + Enter to save thino",className:"action-btn confirm-btn",onClick:()=>{o&&o.DefaultEditorLocation==="Top"&&!r&&we()},onPointerDown:()=>{(o&&o.DefaultEditorLocation==="Bottom"||r)&&we()},children:[a==="chat"&&((o==null?void 0:o.chatViewStyle)==="fluent"||(o==null?void 0:o.chatViewStyle)==="inline")?"":c,w.jsx("span",{className:"icon-text",children:a==="chat"&&((o==null?void 0:o.chatViewStyle)==="fluent"||(o==null?void 0:o.chatViewStyle)==="inline")?null:d})]})})]})]})]})}),n9=typeof window<"u"?A.useLayoutEffect:A.useEffect;function r9(e,t,n,r){const a=A.useRef(t);n9(()=>{a.current=t},[t]),A.useEffect(()=>{const o=(n==null?void 0:n.current)||window;if(!(o&&o.addEventListener))return;const s=c=>{a.current(c)};return o.addEventListener(e,s,r),()=>{o.removeEventListener(e,s,r)}},[e,n,r])}function Pp(e,t,n="mousedown"){r9(n,r=>{const a=r.target;if(!a||!a.isConnected||a.closest(".suggestion-container")||a.closest(".menu"))return;(Array.isArray(e)?e.every(s=>s.current&&!s.current.contains(a)):e.current&&!e.current.contains(a))&&t(r)})}const GT=e=>{const{year:t,handleYearChange:n}=e,[r,a]=A.useState([]),[o,s]=A.useState(t),c=A.useRef(null),d=A.useRef(null),[p,m]=$.useState(!1),g=$.useRef(null);Pp(g,()=>{m(!1)}),A.useEffect(()=>{c.current&&C.setIcon(c.current,"chevron-left"),d.current&&C.setIcon(d.current,"chevron-right")},[c,d,p]),A.useEffect(()=>{D(o)},[t]);const D=S=>{const T=parseInt(S),E=T-T%10,O=[];for(let k=0;k<10;k++)O.push(`${E+k}`);a(O)};return w.jsxs(w.Fragment,{children:[w.jsxs("span",{className:"btn year-btn",onClick:()=>{m(!p)},children:[w.jsx("span",{children:t}),w.jsx("span",{children:N("year")})]}),p&&w.jsxs("div",{ref:g,className:"year-picker-wrapper",children:[w.jsxs("div",{className:"year-picker-header",children:[w.jsxs("div",{className:"year-picker-header-title",children:[o," "+(N("year")||"")]}),w.jsxs("div",{className:"year-picker-header-btns",children:[w.jsx("span",{className:"btn",ref:c,onClick:()=>{const S=parseInt(o)-10;s(S.toString()),D(S.toString())}}),w.jsx("span",{className:"btn",ref:d,onClick:()=>{const S=parseInt(o)+10;s(S.toString()),D(S.toString())}})]})]}),w.jsx("div",{className:"year-picker-body",children:w.jsx("div",{className:"year-picker-body-list",children:r.map(S=>w.jsx("div",{className:`year-picker-body-item ${S===o?"selected":""}`,onClick:()=>{s(S),n(S),m(!1)},children:S},S))})})]})]})},qT=e=>{const{month:t,handleMonthChange:n}=e,[r,a]=A.useState([]),[o,s]=A.useState((parseInt(t)+1).toString()),[c,d]=$.useState(!1),p=$.useRef(null);Pp(p,()=>{d(!1)}),A.useEffect(()=>{g()},[t]);const g=()=>{const v=[];for(let D=1;D<=12;D++)v.push(`${D}`);a(v)};return w.jsxs(w.Fragment,{children:[w.jsxs("span",{className:"btn month-btn",onClick:()=>{d(!c)},children:[w.jsxs("span",{children:[N("monthsShort")[parseInt(t)]||parseInt(t)+1," "]}),w.jsx("span",{children:N("month")||""})]}),c&&w.jsxs("div",{ref:p,className:"month-picker-wrapper",children:[w.jsxs("div",{className:"month-picker-header",children:[w.jsxs("div",{className:"month-picker-header-title",children:[o," "+(N("month")||"")]}),w.jsx("div",{className:"month-picker-header-btns"})]}),w.jsx("div",{className:"month-picker-body",children:w.jsx("div",{className:"month-picker-body-list",children:r.map(v=>w.jsx("div",{className:`month-picker-body-item ${v===o?"selected":""}`,onClick:()=>{s(v),n(v),d(!1)},children:v},v))})})]})]})},zy=e=>{const{className:t,datestamp:n,handleDateStampChange:r}=e,[a,o]=A.useState(Ph(n)),[s,c]=A.useState(n);A.useEffect(()=>{o(Ph(n))},[n]);const d=new Date(a),p=d.getDay(),m=[];for(let S=0;S{r(T,S.nativeEvent),c(T)},D=S=>{const T=d.getFullYear(),E=d.getMonth()+1;let O=0;E===1&&S===-1?O=new Date(`${T-1}/12/1`).getTime():E===12&&S===1?O=new Date(`${T+1}/1/1`).getTime():O=new Date(`${T}/${E+S}/1`).getTime(),o(Ph(O))};return w.jsxs("div",{className:`date-picker-wrapper ${t}`,children:[w.jsxs("div",{className:"date-picker-header",children:[w.jsx("span",{ref:S=>{S&&C.setIcon(S,"chevron-left")},className:"btn btn-text",onClick:()=>D(-1)}),w.jsxs("span",{className:"normal-text",children:[w.jsx(GT,{year:d.getFullYear().toString(),handleYearChange:S=>{o(Ph(new Date(`${S}/${d.getMonth()+1}/1`).getTime()))}}),w.jsx(qT,{month:d.getMonth().toString(),handleMonthChange:S=>{o(Ph(new Date(`${d.getFullYear()}/${parseInt(S)}/1`).getTime()))}})]}),w.jsx("span",{ref:S=>{S&&C.setIcon(S,"chevron-right")},className:"btn btn-text",onClick:()=>D(1)})]}),w.jsxs("div",{className:"date-picker-day-container",children:[w.jsx("div",{className:"date-picker-day-header",children:N("weekDaysShort").map(S=>w.jsx("span",{className:"day-item",children:S},S))}),w.jsx("div",{className:"date-picker-day-content",children:m.map(S=>S.date===0?w.jsx("span",{className:"day-item null",children:""},S.datestamp):w.jsx("span",{className:`day-item ${S.datestamp===n?"current":""} ${S.datestamp===s?"selected":""}`,onClick:T=>v(T,S.datestamp),children:w.jsx("span",{className:"day-item-text",children:S.date})},S.datestamp))})]})]})};function a9(e){const t=new Date(e),n=new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`);return((n.getMonth()===11?new Date(`${n.getFullYear()+1}/1/1`):new Date(`${n.getFullYear()}/${n.getMonth()+2}/1`)).getTime()-n.getTime())/Mi}function Ph(e){const t=new Date(e);return new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`).getTime()}var RD=function(t){return t.reduce(function(n,r){var a=r[0],o=r[1];return n[a]=o,n},{})},BD=typeof window<"u"&&window.document&&window.document.createElement?A.useLayoutEffect:A.useEffect,wa="top",uo="bottom",co="right",ba="left",C1="auto",jp=[wa,uo,co,ba],kd="start",rp="end",o9="clippingParents",JT="viewport",jh="popper",i9="reference",_D=jp.reduce(function(e,t){return e.concat([t+"-"+kd,t+"-"+rp])},[]),x1=[].concat(jp,[C1]).reduce(function(e,t){return e.concat([t,t+"-"+kd,t+"-"+rp])},[]),s9="beforeRead",l9="read",u9="afterRead",c9="beforeMain",d9="main",f9="afterMain",h9="beforeWrite",p9="write",m9="afterWrite",g9=[s9,l9,u9,c9,d9,f9,h9,p9,m9];function Ai(e){return e?(e.nodeName||"").toLowerCase():null}function za(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Au(e){var t=za(e).Element;return e instanceof t||e instanceof Element}function lo(e){var t=za(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function M1(e){if(typeof ShadowRoot>"u")return!1;var t=za(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function y9(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},a=t.attributes[n]||{},o=t.elements[n];!lo(o)||!Ai(o)||(Object.assign(o.style,r),Object.keys(a).forEach(function(s){var c=a[s];c===!1?o.removeAttribute(s):o.setAttribute(s,c===!0?"":c)}))})}function v9(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var a=t.elements[r],o=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),c=s.reduce(function(d,p){return d[p]="",d},{});!lo(a)||!Ai(a)||(Object.assign(a.style,c),Object.keys(o).forEach(function(d){a.removeAttribute(d)}))})}}const w9={name:"applyStyles",enabled:!0,phase:"write",fn:y9,effect:v9,requires:["computeStyles"]};function Ni(e){return e.split("-")[0]}var Mu=Math.max,hy=Math.min,Ad=Math.round;function kw(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function KT(){return!/^((?!chrome|android).)*safari/i.test(kw())}function Fd(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),a=1,o=1;t&&lo(e)&&(a=e.offsetWidth>0&&Ad(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Ad(r.height)/e.offsetHeight||1);var s=Au(e)?za(e):window,c=s.visualViewport,d=!KT()&&n,p=(r.left+(d&&c?c.offsetLeft:0))/a,m=(r.top+(d&&c?c.offsetTop:0))/o,g=r.width/a,v=r.height/o;return{width:g,height:v,top:m,right:p+g,bottom:m+v,left:p,x:p,y:m}}function N1(e){var t=Fd(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function QT(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&M1(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ms(e){return za(e).getComputedStyle(e)}function b9(e){return["table","td","th"].indexOf(Ai(e))>=0}function Tl(e){return((Au(e)?e.ownerDocument:e.document)||window.document).documentElement}function Uy(e){return Ai(e)==="html"?e:e.assignedSlot||e.parentNode||(M1(e)?e.host:null)||Tl(e)}function HD(e){return!lo(e)||ms(e).position==="fixed"?null:e.offsetParent}function D9(e){var t=/firefox/i.test(kw()),n=/Trident/i.test(kw());if(n&&lo(e)){var r=ms(e);if(r.position==="fixed")return null}var a=Uy(e);for(M1(a)&&(a=a.host);lo(a)&&["html","body"].indexOf(Ai(a))<0;){var o=ms(a);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return a;a=a.parentNode}return null}function Lp(e){for(var t=za(e),n=HD(e);n&&b9(n)&&ms(n).position==="static";)n=HD(n);return n&&(Ai(n)==="html"||Ai(n)==="body"&&ms(n).position==="static")?t:n||D9(e)||t}function k1(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Jh(e,t,n){return Mu(e,hy(t,n))}function S9(e,t,n){var r=Jh(e,t,n);return r>n?n:r}function XT(){return{top:0,right:0,bottom:0,left:0}}function eE(e){return Object.assign({},XT(),e)}function tE(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var I9=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,eE(typeof t!="number"?t:tE(t,jp))};function T9(e){var t,n=e.state,r=e.name,a=e.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,c=Ni(n.placement),d=k1(c),p=[ba,co].indexOf(c)>=0,m=p?"height":"width";if(!(!o||!s)){var g=I9(a.padding,n),v=N1(o),D=d==="y"?wa:ba,S=d==="y"?uo:co,T=n.rects.reference[m]+n.rects.reference[d]-s[d]-n.rects.popper[m],E=s[d]-n.rects.reference[d],O=Lp(o),k=O?d==="y"?O.clientHeight||0:O.clientWidth||0:0,j=T/2-E/2,F=g[D],B=k-v[m]-g[S],R=k/2-v[m]/2+j,z=Jh(F,R,B),H=d;n.modifiersData[r]=(t={},t[H]=z,t.centerOffset=z-R,t)}}function E9(e){var t=e.state,n=e.options,r=n.element,a=r===void 0?"[data-popper-arrow]":r;a!=null&&(typeof a=="string"&&(a=t.elements.popper.querySelector(a),!a)||QT(t.elements.popper,a)&&(t.elements.arrow=a))}const nE={name:"arrow",enabled:!0,phase:"main",fn:T9,effect:E9,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Od(e){return e.split("-")[1]}var C9={top:"auto",right:"auto",bottom:"auto",left:"auto"};function x9(e,t){var n=e.x,r=e.y,a=t.devicePixelRatio||1;return{x:Ad(n*a)/a||0,y:Ad(r*a)/a||0}}function YD(e){var t,n=e.popper,r=e.popperRect,a=e.placement,o=e.variation,s=e.offsets,c=e.position,d=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,g=e.isFixed,v=s.x,D=v===void 0?0:v,S=s.y,T=S===void 0?0:S,E=typeof m=="function"?m({x:D,y:T}):{x:D,y:T};D=E.x,T=E.y;var O=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),j=ba,F=wa,B=window;if(p){var R=Lp(n),z="clientHeight",H="clientWidth";if(R===za(n)&&(R=Tl(n),ms(R).position!=="static"&&c==="absolute"&&(z="scrollHeight",H="scrollWidth")),a===wa||(a===ba||a===co)&&o===rp){F=uo;var Y=g&&R===B&&B.visualViewport?B.visualViewport.height:R[z];T-=Y-r.height,T*=d?1:-1}if(a===ba||(a===wa||a===uo)&&o===rp){j=co;var U=g&&R===B&&B.visualViewport?B.visualViewport.width:R[H];D-=U-r.width,D*=d?1:-1}}var J=Object.assign({position:c},p&&C9),Q=m===!0?x9({x:D,y:T},za(n)):{x:D,y:T};if(D=Q.x,T=Q.y,d){var le;return Object.assign({},J,(le={},le[F]=k?"0":"",le[j]=O?"0":"",le.transform=(B.devicePixelRatio||1)<=1?"translate("+D+"px, "+T+"px)":"translate3d("+D+"px, "+T+"px, 0)",le))}return Object.assign({},J,(t={},t[F]=k?T+"px":"",t[j]=O?D+"px":"",t.transform="",t))}function M9(e){var t=e.state,n=e.options,r=n.gpuAcceleration,a=r===void 0?!0:r,o=n.adaptive,s=o===void 0?!0:o,c=n.roundOffsets,d=c===void 0?!0:c,p={placement:Ni(t.placement),variation:Od(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:a,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,YD(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:d})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,YD(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const rE={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:M9,data:{}};var Fg={passive:!0};function N9(e){var t=e.state,n=e.instance,r=e.options,a=r.scroll,o=a===void 0?!0:a,s=r.resize,c=s===void 0?!0:s,d=za(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&p.forEach(function(m){m.addEventListener("scroll",n.update,Fg)}),c&&d.addEventListener("resize",n.update,Fg),function(){o&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Fg)}),c&&d.removeEventListener("resize",n.update,Fg)}}const aE={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:N9,data:{}};var k9={left:"right",right:"left",bottom:"top",top:"bottom"};function Kg(e){return e.replace(/left|right|bottom|top/g,function(t){return k9[t]})}var A9={start:"end",end:"start"};function zD(e){return e.replace(/start|end/g,function(t){return A9[t]})}function A1(e){var t=za(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function F1(e){return Fd(Tl(e)).left+A1(e).scrollLeft}function F9(e,t){var n=za(e),r=Tl(e),a=n.visualViewport,o=r.clientWidth,s=r.clientHeight,c=0,d=0;if(a){o=a.width,s=a.height;var p=KT();(p||!p&&t==="fixed")&&(c=a.offsetLeft,d=a.offsetTop)}return{width:o,height:s,x:c+F1(e),y:d}}function O9(e){var t,n=Tl(e),r=A1(e),a=(t=e.ownerDocument)==null?void 0:t.body,o=Mu(n.scrollWidth,n.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),s=Mu(n.scrollHeight,n.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),c=-r.scrollLeft+F1(e),d=-r.scrollTop;return ms(a||n).direction==="rtl"&&(c+=Mu(n.clientWidth,a?a.clientWidth:0)-o),{width:o,height:s,x:c,y:d}}function O1(e){var t=ms(e),n=t.overflow,r=t.overflowX,a=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+a+r)}function oE(e){return["html","body","#document"].indexOf(Ai(e))>=0?e.ownerDocument.body:lo(e)&&O1(e)?e:oE(Uy(e))}function Kh(e,t){var n;t===void 0&&(t=[]);var r=oE(e),a=r===((n=e.ownerDocument)==null?void 0:n.body),o=za(r),s=a?[o].concat(o.visualViewport||[],O1(r)?r:[]):r,c=t.concat(s);return a?c:c.concat(Kh(Uy(s)))}function Aw(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function P9(e,t){var n=Fd(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function UD(e,t,n){return t===JT?Aw(F9(e,n)):Au(t)?P9(t,n):Aw(O9(Tl(e)))}function j9(e){var t=Kh(Uy(e)),n=["absolute","fixed"].indexOf(ms(e).position)>=0,r=n&&lo(e)?Lp(e):e;return Au(r)?t.filter(function(a){return Au(a)&&QT(a,r)&&Ai(a)!=="body"}):[]}function L9(e,t,n,r){var a=t==="clippingParents"?j9(e):[].concat(t),o=[].concat(a,[n]),s=o[0],c=o.reduce(function(d,p){var m=UD(e,p,r);return d.top=Mu(m.top,d.top),d.right=hy(m.right,d.right),d.bottom=hy(m.bottom,d.bottom),d.left=Mu(m.left,d.left),d},UD(e,s,r));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function iE(e){var t=e.reference,n=e.element,r=e.placement,a=r?Ni(r):null,o=r?Od(r):null,s=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,d;switch(a){case wa:d={x:s,y:t.y-n.height};break;case uo:d={x:s,y:t.y+t.height};break;case co:d={x:t.x+t.width,y:c};break;case ba:d={x:t.x-n.width,y:c};break;default:d={x:t.x,y:t.y}}var p=a?k1(a):null;if(p!=null){var m=p==="y"?"height":"width";switch(o){case kd:d[p]=d[p]-(t[m]/2-n[m]/2);break;case rp:d[p]=d[p]+(t[m]/2-n[m]/2);break}}return d}function ap(e,t){t===void 0&&(t={});var n=t,r=n.placement,a=r===void 0?e.placement:r,o=n.strategy,s=o===void 0?e.strategy:o,c=n.boundary,d=c===void 0?o9:c,p=n.rootBoundary,m=p===void 0?JT:p,g=n.elementContext,v=g===void 0?jh:g,D=n.altBoundary,S=D===void 0?!1:D,T=n.padding,E=T===void 0?0:T,O=eE(typeof E!="number"?E:tE(E,jp)),k=v===jh?i9:jh,j=e.rects.popper,F=e.elements[S?k:v],B=L9(Au(F)?F:F.contextElement||Tl(e.elements.popper),d,m,s),R=Fd(e.elements.reference),z=iE({reference:R,element:j,strategy:"absolute",placement:a}),H=Aw(Object.assign({},j,z)),Y=v===jh?H:R,U={top:B.top-Y.top+O.top,bottom:Y.bottom-B.bottom+O.bottom,left:B.left-Y.left+O.left,right:Y.right-B.right+O.right},J=e.modifiersData.offset;if(v===jh&&J){var Q=J[a];Object.keys(U).forEach(function(le){var pe=[co,uo].indexOf(le)>=0?1:-1,ie=[wa,uo].indexOf(le)>=0?"y":"x";U[le]+=Q[ie]*pe})}return U}function R9(e,t){t===void 0&&(t={});var n=t,r=n.placement,a=n.boundary,o=n.rootBoundary,s=n.padding,c=n.flipVariations,d=n.allowedAutoPlacements,p=d===void 0?x1:d,m=Od(r),g=m?c?_D:_D.filter(function(S){return Od(S)===m}):jp,v=g.filter(function(S){return p.indexOf(S)>=0});v.length===0&&(v=g);var D=v.reduce(function(S,T){return S[T]=ap(e,{placement:T,boundary:a,rootBoundary:o,padding:s})[Ni(T)],S},{});return Object.keys(D).sort(function(S,T){return D[S]-D[T]})}function B9(e){if(Ni(e)===C1)return[];var t=Kg(e);return[zD(e),t,zD(t)]}function _9(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var a=n.mainAxis,o=a===void 0?!0:a,s=n.altAxis,c=s===void 0?!0:s,d=n.fallbackPlacements,p=n.padding,m=n.boundary,g=n.rootBoundary,v=n.altBoundary,D=n.flipVariations,S=D===void 0?!0:D,T=n.allowedAutoPlacements,E=t.options.placement,O=Ni(E),k=O===E,j=d||(k||!S?[Kg(E)]:B9(E)),F=[E].concat(j).reduce(function(Ie,De){return Ie.concat(Ni(De)===C1?R9(t,{placement:De,boundary:m,rootBoundary:g,padding:p,flipVariations:S,allowedAutoPlacements:T}):De)},[]),B=t.rects.reference,R=t.rects.popper,z=new Map,H=!0,Y=F[0],U=0;U=0,ie=pe?"width":"height",se=ap(t,{placement:J,boundary:m,rootBoundary:g,altBoundary:v,padding:p}),fe=pe?le?co:ba:le?uo:wa;B[ie]>R[ie]&&(fe=Kg(fe));var oe=Kg(fe),we=[];if(o&&we.push(se[Q]<=0),c&&we.push(se[fe]<=0,se[oe]<=0),we.every(function(Ie){return Ie})){Y=J,H=!1;break}z.set(J,we)}if(H)for(var Z=S?3:1,G=function(De){var ke=F.find(function(Ye){var Re=z.get(Ye);if(Re)return Re.slice(0,De).every(function(rt){return rt})});if(ke)return Y=ke,"break"},te=Z;te>0;te--){var ge=G(te);if(ge==="break")break}t.placement!==Y&&(t.modifiersData[r]._skip=!0,t.placement=Y,t.reset=!0)}}const sE={name:"flip",enabled:!0,phase:"main",fn:_9,requiresIfExists:["offset"],data:{_skip:!1}};function VD(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function ZD(e){return[wa,co,uo,ba].some(function(t){return e[t]>=0})}function H9(e){var t=e.state,n=e.name,r=t.rects.reference,a=t.rects.popper,o=t.modifiersData.preventOverflow,s=ap(t,{elementContext:"reference"}),c=ap(t,{altBoundary:!0}),d=VD(s,r),p=VD(c,a,o),m=ZD(d),g=ZD(p);t.modifiersData[n]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:g},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":g})}const lE={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:H9};function Y9(e,t,n){var r=Ni(e),a=[ba,wa].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=o[0],c=o[1];return s=s||0,c=(c||0)*a,[ba,co].indexOf(r)>=0?{x:c,y:s}:{x:s,y:c}}function z9(e){var t=e.state,n=e.options,r=e.name,a=n.offset,o=a===void 0?[0,0]:a,s=x1.reduce(function(m,g){return m[g]=Y9(g,t.rects,o),m},{}),c=s[t.placement],d=c.x,p=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=d,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=s}const uE={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:z9};function U9(e){var t=e.state,n=e.name;t.modifiersData[n]=iE({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const cE={name:"popperOffsets",enabled:!0,phase:"read",fn:U9,data:{}};function V9(e){return e==="x"?"y":"x"}function Z9(e){var t=e.state,n=e.options,r=e.name,a=n.mainAxis,o=a===void 0?!0:a,s=n.altAxis,c=s===void 0?!1:s,d=n.boundary,p=n.rootBoundary,m=n.altBoundary,g=n.padding,v=n.tether,D=v===void 0?!0:v,S=n.tetherOffset,T=S===void 0?0:S,E=ap(t,{boundary:d,rootBoundary:p,padding:g,altBoundary:m}),O=Ni(t.placement),k=Od(t.placement),j=!k,F=k1(O),B=V9(F),R=t.modifiersData.popperOffsets,z=t.rects.reference,H=t.rects.popper,Y=typeof T=="function"?T(Object.assign({},t.rects,{placement:t.placement})):T,U=typeof Y=="number"?{mainAxis:Y,altAxis:Y}:Object.assign({mainAxis:0,altAxis:0},Y),J=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(R){if(o){var le,pe=F==="y"?wa:ba,ie=F==="y"?uo:co,se=F==="y"?"height":"width",fe=R[F],oe=fe+E[pe],we=fe-E[ie],Z=D?-H[se]/2:0,G=k===kd?z[se]:H[se],te=k===kd?-H[se]:-z[se],ge=t.elements.arrow,Ie=D&&ge?N1(ge):{width:0,height:0},De=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:XT(),ke=De[pe],Ye=De[ie],Re=Jh(0,z[se],Ie[se]),rt=j?z[se]/2-Z-Re-ke-U.mainAxis:G-Re-ke-U.mainAxis,Ht=j?-z[se]/2+Z+Re+Ye+U.mainAxis:te+Re+Ye+U.mainAxis,Se=t.elements.arrow&&Lp(t.elements.arrow),Ze=Se?F==="y"?Se.clientTop||0:Se.clientLeft||0:0,Ke=(le=J==null?void 0:J[F])!=null?le:0,Je=fe+rt-Ke-Ze,lt=fe+Ht-Ke,ft=Jh(D?hy(oe,Je):oe,fe,D?Mu(we,lt):we);R[F]=ft,Q[F]=ft-fe}if(c){var Dt,Ct=F==="x"?wa:ba,un=F==="x"?uo:co,Ft=R[B],Ot=B==="y"?"height":"width",an=Ft+E[Ct],wn=Ft-E[un],Tn=[wa,ba].indexOf(O)!==-1,vr=(Dt=J==null?void 0:J[B])!=null?Dt:0,Ia=Tn?an:Ft-z[Ot]-H[Ot]-vr+U.altAxis,tr=Tn?Ft+z[Ot]+H[Ot]-vr-U.altAxis:wn,Nr=D&&Tn?S9(Ia,Ft,tr):Jh(D?Ia:an,Ft,D?tr:wn);R[B]=Nr,Q[B]=Nr-Ft}t.modifiersData[r]=Q}}const dE={name:"preventOverflow",enabled:!0,phase:"main",fn:Z9,requiresIfExists:["offset"]};function W9(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $9(e){return e===za(e)||!lo(e)?A1(e):W9(e)}function G9(e){var t=e.getBoundingClientRect(),n=Ad(t.width)/e.offsetWidth||1,r=Ad(t.height)/e.offsetHeight||1;return n!==1||r!==1}function q9(e,t,n){n===void 0&&(n=!1);var r=lo(t),a=lo(t)&&G9(t),o=Tl(t),s=Fd(e,a,n),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!n)&&((Ai(t)!=="body"||O1(o))&&(c=$9(t)),lo(t)?(d=Fd(t,!0),d.x+=t.clientLeft,d.y+=t.clientTop):o&&(d.x=F1(o))),{x:s.left+c.scrollLeft-d.x,y:s.top+c.scrollTop-d.y,width:s.width,height:s.height}}function J9(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function a(o){n.add(o.name);var s=[].concat(o.requires||[],o.requiresIfExists||[]);s.forEach(function(c){if(!n.has(c)){var d=t.get(c);d&&a(d)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||a(o)}),r}function K9(e){var t=J9(e);return g9.reduce(function(n,r){return n.concat(t.filter(function(a){return a.phase===r}))},[])}function Q9(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function X9(e){var t=e.reduce(function(n,r){var a=n[r.name];return n[r.name]=a?Object.assign({},a,r,{options:Object.assign({},a.options,r.options),data:Object.assign({},a.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var WD={placement:"bottom",modifiers:[],strategy:"absolute"};function $D(){for(var e=arguments.length,t=new Array(e),n=0;n({placement:e,modifiers:[{name:"flip",options:{allowedAutoPlacements:t,rootBoundary:"document"}},{name:"preventOverflow",options:{rootBoundary:"document"}}]}),f5=e=>{const n=A.useRef(null),[r,a]=A.useState(null),[o,s]=A.useState(0);let c,d;const p=()=>{if(C.Platform.isMobile){c="right-end",d=["bottom"];return}const g=window.innerWidth-o>280*1.2,v=window.innerWidth-o<280,D=window.innerWidth>280*1.5;if(e.DefaultEditorLocation!=="Bottom"){g?(c="right-end",d=["left-end"]):v&&D?(c="left-end",d=["right-end"]):(c="bottom",d=["bottom"]);return}g?(c="top-end",d=["top-start"]):v&&o>280?(c="top-start",d=["top-end"]):(c="top",d=["top"])};A.useEffect(()=>{e&&p()},[o,e==null?void 0:e.DefaultEditorLocation]);const m=Vy(n.current,r,d5(c,d));return{setPosX:s,popperRef:n,setPopperElement:a,popper:m}},h5=()=>{const e=new Set,t=He.getState().query.filter,n=He.getState().query.tag,r=Et.getQueryById(t||"");if(r&&r.querystring){const a=JSON.parse(r.querystring);if(Array.isArray(a))for(const o of a)o.type==="TAG"&&o.value&&o.value.operator==="CONTAIN"&&e.add(o.value.value)}return n&&e.add(n),Array.from(e)},p5=e=>{const{offsetLeft:t,offsetTop:n,offsetHeight:r,offsetWidth:a,selectionEnd:o}=e,s=document.createElement("div"),c=window.getComputedStyle(e);for(const T of c)s.style.setProperty(T,c.getPropertyValue(T));s.style.position="fixed",s.style.visibility="hidden",s.style.whiteSpace="pre-wrap";const p=e.tagName==="INPUT"?e.value.replace(/ /g,"."):e.value;s.textContent=p.substring(0,o||0),e.tagName==="TEXTAREA"&&(s.style.height="auto");const m=document.createElement("span");m.textContent=p.substring(o||0)||".",s.appendChild(m),document.body.appendChild(s);const{offsetLeft:g,offsetTop:v,offsetHeight:D,offsetWidth:S}=m;return document.body.removeChild(s),{x:t+g,y:n+v,h:r+D,w:a+S}},Nu=({className:e,editorType:t,destroy:n})=>{const{globalState:r,dailyNotesState:{app:a,settings:o,view:s,verifyState:c}}=A.useContext(mt),[d,p]=ki(!0),m=A.useRef(d),[g,v]=Kr(!0),D=A.useRef(null),S=A.useRef(null),T=A.useRef(r),[E,O]=Kr(!1),[k,j]=Kr(!1),{setPosX:F,popperRef:B,setPopperElement:R,popper:z}=f5(o),[H]=Kr(parseInt(C.moment().format("x"))),Y=A.useRef(null),[U,J]=Kr((o==null?void 0:o.EnabledLocationList.length)===1?o==null?void 0:o.EnabledLocationList[0].value:(o==null?void 0:o.MemoSaveLocation)||"DAILY"),Q=A.useRef(o.MemoSaveLocation||"DAILY");A.useEffect(()=>{m.current=d},[d]),A.useEffect(()=>{!S.current||!a||!s||(s.registerEvent(a.workspace.on("focus-on-textarea",Se=>{var Ze;(Ze=S.current)==null||Ze.focus(Se==null?void 0:Se.id)})),s.registerEvent(a.workspace.on("blur-on-memos",()=>{var Se;(Se=S.current)==null||Se.blur()})),s.registerEvent(a.workspace.on("send-to-thino",async(Se,Ze)=>{var Ke,Je;if(typeof Se=="string")(Ke=S.current)==null||Ke.insertText(Se+` `,Ze.id);else{const lt=Se.toPNG(),ft=new Blob([lt],{type:"image/png"}),Dt=new File([ft],"image.png",{type:"image/png",lastModified:Date.now()});if(!Dt)return;const Ct=await oe(Dt);Ct&&((Je=S.current)==null||Je.insertText(Ct+` `,Ze.id))}})))},[S,s,a]),A.useEffect(()=>{o&&p(o.DefaultPrefix==="List")},[o==null?void 0:o.DefaultPrefix]),A.useEffect(()=>{if(o){if(o.EnabledLocationList.length===1){J(o.EnabledLocationList[0].value);return}J(o.MemoSaveLocation||"DAILY")}},[o==null?void 0:o.MemoSaveLocation,o==null?void 0:o.EnabledLocationList]),A.useEffect(()=>{var Ke;if(!o||!Y.current)return;const Se=(Ke=tp.find(Je=>Je.title===U))==null?void 0:Ke.icon;C.setIcon(Y.current,Se),C.requireApiVersion("1.4.4")&&C.setTooltip(Y.current,N("Thino Save To: ")+U),Q.current=U;const Ze=r.manifest;if(Ze){const Je=a==null?void 0:a.plugins.getPlugin(Ze.id);if(Je){if(Je.settings.MemoSaveLocation===U)return;Je.settings.MemoSaveLocation=U,Je.saveSettings()}}},[U,g]),A.useEffect(()=>{S.current&&o.MemoSaveLocation&&J(o.MemoSaveLocation)},[Y,o]),A.useEffect(()=>{if(!S.current||!o||C.Platform.isDesktop||r.globalEditorShown)return;const Se=o.UseButtonToShowEditor&&o.DefaultEditorLocation==="Bottom";if(C.Platform.isDesktop){v(!0);return}if(t&&t==="inline"){v(!0);return}if(v(C.Platform.isMobile&&!Se),!Se||r.memoListView==="chat")return;const Ze=document.body.find(".memolist-wrapper");Ze&&(Ze.onscroll=()=>{if(r.globalEditorShown)return;if(!r.memoListView&&Qe.getState().memoListView==="chat"){Ze.onscroll=null;return}const Ke=S.current.getContent();C.Platform.isMobile&&Se&&!Ke&&v(!1)})},[r.globalEditorShown,t,S]);const le=()=>{j(!1)};A.useEffect(()=>{var Se,Ze,Ke,Je,lt,ft,Dt,Ct,un;if(a&&(r.markMemoId||(Se=r.editMemoId)!=null&&Se.trim()&&r.editMemoId!==T.current.editMemoId)){const Ft=a.workspace.getLeavesOfType("thino_view");Ft.length>0&&a.workspace.revealLeaf(Ft[0])}if(r.markMemoId){const Ft=`${N("MARK")}: [@THINO](${r.markMemoId})`;(Ze=S.current)==null||Ze.insertText(Ft),(Ke=S.current)==null||Ke.focus(),Qe.setMarkMemoId("");return}if((Je=r.editMemoId)!=null&&Je.trim()&&r.editMemoId!==T.current.editMemoId){const Ft=Te.getMemoById(r.editMemoId);if(Ft)switch(p(Ft.thinoType==="JOURNAL"),o.EditorType){case"memos":(lt=S.current)==null||lt.setContent(Ft.content.replace(/ \^\S{6}$/,"")||""),(ft=S.current)==null||ft.focus();break;case"obsidian":(Dt=S.current)==null||Dt.clear(),(Ct=S.current)==null||Ct.setContent(Ft.content.replace(/ \^\S{6}$/,"")||""),(un=S.current)==null||un.focus();break}}T.current=r},[r.markMemoId,r.editMemoId]),A.useEffect(()=>{var Se,Ze,Ke;!S.current||E||o.EditorType==="memos"&&((Se=S.current)==null||Se.element.addEventListener("paste",pe),(Ze=S.current)==null||Ze.element.addEventListener("drop",ie),(Ke=S.current)==null||Ke.element.addEventListener("click",se),O(!0))},[S.current]);const pe=async Se=>{var Ze;if(Se.clipboardData&&Se.clipboardData.files.length>0){Se.preventDefault();const Ke=Se.clipboardData.files;for(const Je of Ke){const lt=await oe(Je);lt&&((Ze=S.current)==null||Ze.insertText(lt))}}},ie=async Se=>{var Ze;if(Se.dataTransfer&&Se.dataTransfer.files.length>0){Se.preventDefault();const Ke=Se.dataTransfer.files;for(const Je of Ke){const lt=await oe(Je);lt&&((Ze=S.current)==null||Ze.insertText(lt))}}},se=()=>{var Se;G(((Se=S.current)==null?void 0:Se.element.value)||"")},fe=async(Se,Ze)=>{var lt,ft,Dt;const Ke=Se.ctrlKey||Se.metaKey,Je=Se.altKey;if(Se.key==="Escape"&&r.globalEditorShown&&(Qe.setGlobalEditorShown(!1),Se.preventDefault()),Ke&&Se.key==="Enter"){Se.preventDefault(),Se.stopPropagation(),Ze?(await we((ft=S.current)==null?void 0:ft.getContent()),(Dt=S.current)==null||Dt.clear()):await we((lt=S.current)==null?void 0:lt.element.value);return}if(Je)for(let Ct=0;Ct{var Ct;Ze||G(((Ct=S.current)==null?void 0:Ct.element.value)||"")})},oe=A.useCallback(async Se=>{const{type:Ze}=Se;if(Ze.startsWith("image"))try{return`${await S1.upload(Se)}`}catch(Ke){new C.Notice(Ke)}},[]),we=async Se=>{if(!Se||Se.trim()===""){new C.Notice(N("Content cannot be empty"));return}const Ze=Xe.getState().settings,Ke=Ze==null?void 0:Ze.addTagAutomatically,Je=Ze==null?void 0:Ze.addTagWithNewline,lt=Ze==null?void 0:Ze.addTagPosition,Dt=(h5()||[]).filter(Ot=>!Se.includes(`#${Ot}`)),Ct=async(Ot,an)=>{an=an.replaceAll(" "," "),Og("");try{if(!Ot){let Tn;switch(Q.current){case"CANVAS":Tn=await Te.createMemoCanvas({text:an,isList:m.current});break;case"MULTI":Tn=await Te.createMemoMultiFile({content:an,isList:m.current});break;case"DAILY":Tn=await Te.createMemoDaily(an,m.current);break;case"FILE":Tn=await Te.createMemoSingleFile({content:an,isList:m.current});break}if(!Tn)return;Te.pushMemo(Tn),(!Ke||Dt.length===0)&&He.clearQuery();const vr=a||Xe.getState().app,Ia=vr==null?void 0:vr.loadLocalStorage("tokenForSync");Tn&&Ia&&o.startSync&&setTimeout(async()=>{try{const tr=await RT({content:an,thinoType:Q.current==="DAILY"?"DAILY":"FILE"});await Te.updateMemoById(Tn.id,tr,!0)}catch(tr){console.error(tr)}},200);return}const wn=Te.getMemoById(Ot);if(wn&&(wn.content!==an||wn.thinoType!==(m.current?"JOURNAL":"TASK-TODO"))){const Tn=await Te.updateMemo(wn.id,an,m.current?"JOURNAL":"TASK-TODO");Tn.updatedAt=Ue.getDateTimeString(Date.now()),Te.editMemo(Tn)}Qe.setEditMemoId("")}catch(wn){new C.Notice(wn.message)}},{editMemoId:un}=Qe.getState(),Ft=Dt&&Dt.length>0&&Ke?lt==="Beginning"?`${Dt.map(Ot=>`#${Ot}`).join(" ")} ${Je?` `:""}${Se}`:`${Se} ${Je?` `:""}${Dt.map(Ot=>`#${Ot}`).join(" ")}`:Se;await Ct(un,Ft),n&&n(),Og("")},Z=A.useCallback(()=>{var Se;Qe.setEditMemoId(""),(Se=S.current)==null||Se.setContent(""),Og("")},[]),G=A.useCallback(Se=>{if(Og(Se??""),!S.current)return;const Ze=S.current.getContent(),Ke=S.current.element.selectionStart,Je=Ze.slice(0,Ke),lt=Ze.slice(Ke);(Je.endsWith("@")||Je.endsWith("📆"))&<.startsWith(" ")||(Je.endsWith("@")||Je.endsWith("📆"))&<===""?(Ye(),j(!0)):j(!1),setTimeout(()=>{var ft;(ft=S.current)==null||ft.focus()})},[o.EditorType]),te=Se=>{if(!S.current||!o)return;Se&&(le(),p(!1));const Ze=S.current.getContent(),Ke=S.current.element.selectionStart,Je=Ze.slice(0,Ke),lt=Ze.slice(Ke),ft=C.moment(Se);if(Je.endsWith("@"))switch(o.InsertDateFormat){case"Dataview":S.current.element.value=Ze.slice(0,S.current.element.selectionStart-1)+"[due::"+ft.format("YYYY-MM-DD")+"]"+lt,S.current.element.setSelectionRange(Ke+17,Ke+17),S.current.focus(),G(S.current.element.value);break;case"Tasks":S.current.element.value=Ze.slice(0,S.current.element.selectionStart-1)+"📆"+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Ke+11,Ke+11),S.current.focus(),G(S.current.element.value)}else{S.current.element.value=Je+ft.format("YYYY-MM-DD")+lt,S.current.element.setSelectionRange(Ke+10,Ke+10),S.current.focus(),G(S.current.element.value);return}},ge=()=>{S.current&&p()},Ie=async()=>{var Ke;const Se=!C.Platform.isDesktop&&await((Ke=window.Capacitor)==null?void 0:Ke.Plugins.Device.getId()),Ze=C.Platform.isDesktop?await vn():Se.identifier||Se.uuid;return!c||(c==null?void 0:c.appId)!==Ze?(qt(),!1):!0},De=async Se=>{if(!await Ie())return;const Ze=new C.Menu;o.EnabledLocationList.forEach(ft=>{Ze.addItem(Dt=>{var Ct;Dt.setTitle(N(ft.value)).setIcon(((Ct=tp.find(un=>un.title===ft.value))==null?void 0:Ct.icon)??"file").setChecked(U===ft.value).onClick(()=>{J(ft.value)})})});let Ke=Se.target,Je=null;for(;!Ke.hasClass("location-wrapper")&&(Je=Ke.parentElement,Je);)Ke=Je;const lt=Ke.getBoundingClientRect();setTimeout(()=>{Ze.showAtPosition({x:lt.x,y:lt.bottom,width:lt.width,left:!1,overlap:!0})},200)},ke=A.useCallback(()=>{var Se,Ze;if(!(!S.current&&o.EditorType==="memos"))switch(o.EditorType){case"obsidian":(Se=S.current)==null||Se.focus(),(Ze=S.current)==null||Ze.insertTag();break;case"memos":{const Ke=S.current.getContent(),Je=S.current.element.selectionStart,lt=Ke.slice(0,Je),ft=Ke.slice(Je);let Dt=lt+"# "+ft,Ct=lt.length+1;lt.endsWith("#")&&ft.startsWith(" ")&&(Dt=lt.slice(0,lt.length-1)+ft.slice(1),Ct=lt.length-1),S.current.element.value=Dt,S.current.element.setSelectionRange(Ct,Ct),S.current.focus();const un=new Event("input",{bubbles:!0,cancelable:!0});S.current.element.dispatchEvent(un),G(S.current.element.value)}}},[a]),Ye=A.useCallback(()=>{if(!S.current||!B.current||!o||!a)return;const Ke=a.workspace.getLeavesOfType(_r)[0].view.containerEl,Je=280,lt=Ke.clientWidth,{x:ft,y:Dt}=p5(S.current.element);let Ct,un;C.Platform.isMobile?(window.innerWidth-ft>Je?Ct=(ft+Je+16>lt,ft+18):window.innerWidth-ftlt,ft+34):Ct=S.current.element.clientWidth/2,o.DefaultEditorLocation==="Bottom"&&window.innerWidth>875?un=Dt+4:o.DefaultEditorLocation==="Bottom"&&window.innerWidth<=875?un=Dt+19:o.DefaultEditorLocation==="Top"&&window.innerWidth<=875&&(un=Dt+36)):(Ct=(ft+Je+16>lt,ft+18),un=Dt+34),F(ft),B.current.style.left=`${Ct}px`,B.current.style.top=`${un}px`},[o,a]),Re=A.useCallback(()=>{const Se=document.createElement("input");document.body.appendChild(Se),Se.type="file",Se.multiple=!1,Se.accept="image/png, image/gif, image/jpeg",Se.onchange=async()=>{var Je;if(!Se.files||Se.files.length===0)return;const Ze=Se.files[0],Ke=await oe(Ze);Ke&&((Je=S.current)==null||Je.insertText(Ke)),document.body.removeChild(Se)},Se.click()},[]),rt=!!r.editMemoId,Ht=A.useMemo(()=>({className:"memo-editor",inputerType:o.EditorType||"obsidian",initialContent:m5(),placeholder:N("What do you think now..."),showConfirmBtn:!0,showCancelBtn:rt,showTools:!0,onConfirmBtnClick:we,onCancelBtnClick:Z,onContentChange:G}),[rt,o.EditorType]);return w.jsxs(w.Fragment,{children:[!r.globalEditorShown&&t==="block"&&w.jsx("div",{ref:Se=>{D.current=Se,Se&&C.setIcon&&C.setIcon(Se,"plus-circle")},className:`memo-show-editor-button ${g?"hidden":""}`,onClick:()=>{var Se;(Se=D.current.firstElementChild)==null||Se.toggleClass("rotate-hidden",!0),setTimeout(()=>{v(!0),D.current.firstElementChild.toggleClass("rotate-hidden",!1)},500),setTimeout(()=>{var Ze;(Ze=S.current)==null||Ze.focus()},600)}}),w.jsxs("div",{className:`memo-editor-wrapper ${e||""} ${rt?"edit-ing":""} ${r.globalEditorShown?"fullscreen-editor":""} ${g?"":"hidden"}`,onKeyDownCapture:Se=>fe(Se,!0),children:[w.jsx("span",{className:`tip-text ${rt?"":"hidden"}`,children:"Modifying..."}),w.jsx(t9,{ref:S,...Ht,tools:w.jsxs(w.Fragment,{children:[w.jsx("span",{ref:Se=>{Se&&C.setIcon(Se,"hash")},className:"btn action-btn add-tag",onClick:()=>{o&&o.DefaultEditorLocation==="Top"&&!r.globalEditorShown&&ke()},onPointerDown:()=>{(o&&o.DefaultEditorLocation==="Bottom"||r.globalEditorShown)&&ke()}}),w.jsx("span",{ref:Se=>{Se&&C.setIcon(Se,"paperclip")},className:"btn action-btn file-upload",onClick:()=>{o&&o.DefaultEditorLocation==="Top"&&!r.globalEditorShown&&Re()},onPointerDown:()=>{(o&&o.DefaultEditorLocation==="Bottom"||r.globalEditorShown)&&Re()}}),w.jsx("span",{ref:Se=>{Se&&C.setIcon(Se,d?"layout-list":"check-square")},className:Xn("btn action-btn list-or-task",d?"list":"task"),onClick:()=>{o&&o.DefaultEditorLocation==="Top"&&!r.globalEditorShown&&ge()},onPointerDown:()=>{(o&&o.DefaultEditorLocation==="Bottom"||r.globalEditorShown)&&ge()}}),w.jsx("div",{ref:Se=>{Se&&(C.setIcon&&C.setIcon(Se,r.globalEditorShown?"shrink":"expand"),C.setTooltip&&C.setTooltip(Se,r.globalEditorShown?N("Exit fullscreen mode"):N("Enter fullscreen mode")))},className:"action-btn show-editor pro",onPointerDown:async()=>{await Ie()&&(v(!0),Qe.setGlobalEditorShown(!r.globalEditorShown))}}),w.jsx("div",{className:"action-btn split-line pro"}),w.jsx("div",{className:"action-btn location-wrapper pro",onClick:async Se=>{o&&o.DefaultEditorLocation==="Top"&&!r.globalEditorShown&&await De(Se)},onPointerDown:async Se=>{(o&&o.DefaultEditorLocation==="Bottom"||r.globalEditorShown)&&await De(Se)},children:w.jsx("div",{ref:Y,className:"action-btn file-location-btn"})})]})}),w.jsx("div",{ref:B,className:"date-picker",children:k&&w.jsx("div",{tabIndex:-1,style:z.styles.popper,...z.attributes.popper,ref:R,role:"dialog",children:w.jsx(zy,{className:`editor-date-picker ${k?"":"hidden"}`,datestamp:H,handleDateStampChange:te})})})]})]})};function m5(){return Kn.get(["thinoEditorContentCache"]).thinoEditorContentCache??""}function Og(e){Kn.set({thinoEditorContentCache:e})}const g5=e=>{const t=[];return e.map(n=>{t.length==0?t.push({date:C.moment(n.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),have:[n]}):t.some(a=>{if(a.date==C.moment(n.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"))return a.have.push(n),!0})||t.push({date:C.moment(n.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),have:[n]})}),t},y5=e=>Te.getState().commentMemos.filter(t=>t.linkId===e.hasId).sort((t,n)=>Ue.getTimeStampByDate(t.createdAt)-Ue.getTimeStampByDate(n.createdAt)).map(t=>({...t,createdAtStr:Ue.getDateTimeString(t.createdAt),dateStr:Ue.getDateString(t.createdAt)})),v5=e=>{const t=Xe.getState().settings,n=DN(),r=t!=null&&t.ShowDate?" ":"",a="YYYY/MM/DD HH:mm:ss",o=/comment:(.*)$/g,s=/^\d{14}/g,c=(g,v,D)=>{const S=C.moment(g.createdAt,a).format("HH:mm");return D?D.replace(/{TIME}/g,S).replace(/{CONTENT}/g,v):`${S} ${v}`},d=g=>{const v=g.match(/TASK-(.*)?/g);return v?v[1]:""},p=g=>g==="TASK-TODO"?"- [ ] ":g==="TASK-DONE"?"- [x] ":g.match(/TASK-(.*)?/g)?`- [${d(g)}] `:"- ",m=g=>g.reduce((v,D)=>{const S=D.sourceType!=="MULTI"?`${D.content}`:`[[${D.path}]]`,T=t!=null&&t.ShowTime?c(D,S,t==null?void 0:t.DefaultMemoComposition):S,E=`${p(D.thinoType)}${T}`;let O="";return t.CommentOnMemos&&D.hasId!==void 0&&D.hasId!==""&&(O=y5(D).reduce((j,F)=>{const B=p(F.thinoType),R=F.content.replace(o,"").replace(s,""),z=t!=null&&t.ShowDate?`${B}[[${C.moment(F.createdAt).format(n)}]] ${C.moment(F.createdAt).format("HH:mm")} ${R}`:`${B}${R}`;return j+r+" "+z+` `},"")),v+r+E.replace(/ \^\S{6}/g,"")+` `+O},"");return e.reduce((g,v)=>{const D=t!=null&&t.ShowDate?`- [[${C.moment(v.date,"YYYY-MM-DD").format(n)}]] `:"",S=m(v.have),T=t!=null&&t.ShowDate&&(t!=null&&t.AddBlankLineWhenDate)&&!(t!=null&&t.CommentOnMemos)?` `:"";return g+D+S+T},"").replace(/
/g,` `)},w5=[{label:N("Today"),value:C.moment().format("YYYY-MM-DD")},{label:N("Yesterday"),value:C.moment().subtract(1,"days").format("YYYY-MM-DD")},{label:N("Last 7 days"),value:C.moment().subtract(7,"days").format("YYYY-MM-DD")},{label:N("Last 30 days"),value:C.moment().subtract(30,"days").format("YYYY-MM-DD")},{label:N("Last 90 days"),value:C.moment().subtract(90,"days").format("YYYY-MM-DD")},{label:N("Last 180 days"),value:C.moment().subtract(180,"days").format("YYYY-MM-DD")},{label:N("Last 365 days"),value:C.moment().subtract(365,"days").format("YYYY-MM-DD")}],pE=e=>{const{handleValueChange:t,setShownStatus:n}=e;return w.jsxs(w.Fragment,{children:[e.type==="icon"&&w.jsx("div",{className:"quick-date-btn-group",children:w5.map((r,a)=>w.jsx("div",{className:"btn action-btn quick-date-btn",onClick:()=>{t(r.value),n&&n(!1)},children:r.label},a))}),w.jsx(zy,{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)}})]})},py=e=>{const{handleValueChange:t}=e,[n,r]=$.useState(!1),a=$.useRef(null),o=$.useRef(null),s=Vy(o.current,a.current,{placement:"bottom-start"});return Pp(a,()=>{r(!1)}),w.jsxs(w.Fragment,{children:[w.jsx("span",{ref:d=>{o.current=d,d&&e.type==="icon"&&C.setIcon(d,"calendar")},className:`btn calendar-btn ${e.type==="icon"?"icon-btn":"text-btn"}`,onClick:()=>{!C.Platform.isMobile&&r(!n),!C.Platform.isMobile&&(s!=null&&s.update)&&(s==null||s.update()),C.Platform.isMobile&&new mE(Xe.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"):""}),w.jsx("div",{className:`menu-btns-popup ${n?"":"hidden"}`,ref:a,style:s.styles.popper,children:w.jsx(pE,{type:e.defaultText?"icon":e.type,handleValueChange:t,setShownStatus:r})})]})};class mE extends C.Modal{constructor(n,r,a){super(n);me(this,"root");me(this,"type");me(this,"handleValueChange");this.type=r,this.handleValueChange=a}onOpen(){const{contentEl:n}=this;this.root=Ap(n),this.root.render(w.jsx(pE,{type:this.type,handleValueChange:this.handleValueChange.bind(this),setShownStatus:r=>{!r&&this.close()}}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const b5=(e,t)=>(e%t+t)%t;class D5{constructor(t,n,r){me(this,"owner");me(this,"values");me(this,"suggestions");me(this,"selectedItem");me(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=b5(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 gE{constructor(t,n){me(this,"inputEl");me(this,"popper");me(this,"scope");me(this,"suggestEl");me(this,"suggest");me(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 D5(this,r,this.scope),this.scope.register([],"Escape",this.close.bind(this)),this.inputEl.addEventListener("input",this.onInputChanged.bind(this)),this.inputEl.addEventListener("focus",this.onInputChanged.bind(this)),this.inputEl.addEventListener("click",this.onInputChanged.bind(this)),this.inputEl.addEventListener("blur",this.close.bind(this)),this.suggestEl.on("mousedown",".suggestion-container",a=>{a.preventDefault()})}clearInput(){this.inputEl.value="",this.inputEl.trigger("blur"),this.inputEl.trigger("focus"),this.inputEl.trigger("input"),this.onInputChanged()}onInputChanged(){const t=this.inputEl.value,n=this.getSuggestions(t);if(!n){this.close();return}n.length>0?(this.suggest.setSuggestions(n),this.open(app.dom.appContainerEl,this.inputEl)):this.close()}open(t,n){app.keymap.pushScope(this.scope),t.appendChild(this.suggestEl),this.popper=hE(n,this.suggestEl,{placement:"bottom-start",modifiers:[{name:"sameWidth",enabled:!0,fn:({state:r,instance:a})=>{const o=`${r.rects.reference.width}px`;r.styles.popper.width!==o&&(r.styles.popper.width=o,a.update())},phase:"beforeWrite",requires:["computeStyles"]}]})}close(){app.keymap.popScope(this.scope),this.suggest.setSuggestions([]),this.popper&&this.popper.destroy(),this.suggestEl.detach()}destroy(){this.inputEl.removeEventListener("input",this.onInputChanged.bind(this)),this.inputEl.removeEventListener("focus",this.onInputChanged.bind(this)),this.inputEl.removeEventListener("blur",this.close.bind(this)),this.close()}updateCb(t){this.cb=t}}const S5=e=>{const t=e.metadataCache.getTags();return[...Object.keys(t)].map(n=>n.split("#").pop())};let yE=class extends gE{fuzzySearchItemsOptimized(t,n){const r=C.prepareFuzzySearch(t);return n.map(a=>{const o=r(a);return o?{item:a,match:o,score:o.score}:null}).sort((a,o)=>(o==null?void 0:o.score)-(a==null?void 0:a.score)).filter(Boolean)}getSuggestions(t){const{settings:n,app:r}=Xe.getState(),a=t.toLocaleLowerCase(),o=n.UseVaultTags?S5(r):Te.getState().tags;return this.fuzzySearchItemsOptimized(a,o).map(s=>s.item)}renderSuggestion(t,n){n.toggleClass("thino-image-suggest-item",!0),n.createSpan({cls:"suggestion-name",text:t})}selectSuggestion(t){this.inputEl.value=t,this.inputEl.dispatchEvent(new Event("change")),this.cb&&this.cb(t),this.close()}};const I5=e=>{const t=new Set;return e.forEach(n=>{const r=new RegExp(Fn).exec(n.content),a=new RegExp($n).exec(n.content);if(r)for(let o=1;o{const[r,a]=$.useState([]),[o,s]=$.useState([]),[c,d]=$.useState([]),p=$.useRef(null),m=$.useRef(null),g=$.useRef(null),v=$.useRef("End"),D=$.useRef(!1),S=$.useRef(null);A.useEffect(()=>{t&&t.length&&a(I5(t))},[t]),A.useEffect(()=>{!g.current||!m.current||(new C.Setting(m.current).setName(N("Add tag position")).addDropdown(k=>{k.addOption("End",N("End")),k.addOption("Beginning",N("Beginning")),k.setValue("End").onChange(async j=>{v.current=j})}),new C.Setting(g.current).setName(N("Add tag with new line")).addToggle(k=>{k.setValue(!1).onChange(async j=>{D.current=j})}))},[]);const T=k=>{if(!k)return;const j=new Set(o);j.add(k),s(Array.from(j)),p.current.clearInput()};A.useEffect(()=>{if(S.current){if(p.current){p.current.updateCb(T);return}p.current=new yE(S.current,T)}},[S.current,o]);const E=()=>{n(),O({remove:c,add:o,targetThinos:t})},O=async({remove:k,add:j,targetThinos:F})=>{const B=D.current||!1,R=[];for(const z of F){let H=z.content;for(const Y of k)H=H.replace(new RegExp(`#${Y}`,"g"),"");if(H=H.trim(),j.length>0&&(H=v.current==="Beginning"?`${j.map(Y=>`#${Y}`).join(" ")} ${B?` `:""}${H}`:`${H} ${B?` `:""}${j.map(Y=>`#${Y}`).join(" ")}`),z&&z.content!==H){const Y=await Te.updateMemo(z.id,H==null?void 0:H.trim());R.push(Y)}}R.length>0&&Te.editMemoBulk(R),R.length>0&&He.clearQuery()};return w.jsxs("div",{className:"thino-tag-operation",children:[w.jsx("div",{className:"tag-operation-title",children:N("Tag Bulk Edit")}),w.jsxs("div",{className:"tag-operation-content",children:[w.jsxs("div",{className:"tag-operation-content-title exist-tags",children:[w.jsx("div",{className:"name",children:N("Exist Tags")}),w.jsx("div",{className:"desc",children:N("Click to remove exist tag")})]}),w.jsx("div",{className:"tag-operation-content-tags exist-tags",children:r.map(k=>w.jsx("div",{className:Xn("tag-operation-content-tag",c.includes(k)&&"tag-operation-content-tag-removed"),onClick:()=>{c.includes(k)||d([...c,k]),c.includes(k)&&d(c.filter(j=>j!==k)),o.includes(k)&&s(o.filter(j=>j!==k))},children:k},k))}),w.jsxs("div",{className:"tag-operation-content-title selected-tags",children:[w.jsx("div",{className:"name",children:N("Selected Tags")}),w.jsx("div",{className:"desc",children:N("Click to remove selected tag")})]}),w.jsx("div",{className:"tag-operation-content-tags selected-tags",children:o.map(k=>w.jsx("div",{className:"tag-operation-content-tag",onClick:()=>{s(o.filter(j=>j!==k))},children:k},k))}),w.jsx("div",{className:"tag-operation-content-inputer",children:w.jsx("input",{placeholder:N("Input to select exist tag"),ref:S,onKeyDown:k=>{k.key==="Enter"&&T(S.current.value)}})}),w.jsxs("div",{className:"tag-operation-settings",children:[w.jsx("div",{ref:m}),w.jsx("div",{ref:g})]}),w.jsxs("div",{className:"tag-operation-content-btn-group",children:[w.jsx("button",{className:"cancel-btn",onClick:n,children:N("Cancel")}),w.jsx("button",{className:"save-btn",onClick:E,children:N("Save")})]})]})]})},Fw=new Map,xd=async(e,t=!0)=>{const{vault:n,metadataCache:r}=Xe.getState().app;if(t&&Fw.has(e))return Promise.resolve(Fw.get(e));if(e.contains("data:image"))return e;let a;const o=await n.adapter.exists(e);let s="";try{if(!o&&!/(http|https)/g.test(e)&&!e.includes("data:image")){const c=r.getFirstLinkpathDest(e,"");if(!c){new C.Notice(N("File not exist"));return}s=c.path}else s=e}catch(c){console.error(c)}if(s){if(/(http|https)/g.test(s))try{const c=await C.requestUrl(e),d=new Uint8Array(c.arrayBuffer);a=new Blob([d],{type:"image/png"})}catch{}else if(s){const c=await n.adapter.readBinary(s),d=new Uint8Array(c);a=new Blob([d],{type:"image/png"})}return a?await E5(a,e):""}},E5=(e,t)=>new Promise(n=>{const r=new FileReader;r.onloadend=()=>{const a=r.result;Fw.set(t,a),n(a)},r.readAsDataURL(e)}),Uh=async e=>{if(!e.style.backgroundImage.includes("url(")&&!e.style.backgroundImage.includes("http"))return;const t=e.style.backgroundImage.includes("url(")?e.style.backgroundImage.slice(5,-2):e.style.backgroundImage;return await xd(t)},C5=async e=>{const t=document.createElement(e.tagName);t.innerHTML=e.innerHTML;const n=async(r,a)=>{if(!r||!a)return;const o=window.getComputedStyle(r);if(r.tagName==="IMG")try{let s="";const c=r.getAttribute("src");c!=null&&c.startsWith("http")&&!c.startsWith("http://localhost")?s=await xd(r==null?void 0:r.getAttribute("src")):s=await xd(r.getAttribute("path")||C.normalizePath(r==null?void 0:r.parentElement.getAttribute("src"))),a.src=s}catch(s){console.error(s)}else if(r.hasClass("property-image")||r.hasClass("moments-view-background"))try{const s=r.style.backgroundImage.includes("url(")?r.style.backgroundImage.slice(5,-2):r.style.backgroundImage,c=await xd(s);a.style.backgroundImage=`url(${c})`}catch(s){console.error(s)}for(const s of o)a.style.setProperty(s,o.getPropertyValue(s),o.getPropertyPriority(s));for(let s=0;s{const t=e.ownerDocument.styleSheets,n=[];for(const a of t)for(const o of a.cssRules)o.constructor.name==="CSSFontFaceRule"&&n.push(o.style);return document.createElement("style")},vE=e=>{const{width:t,height:n}=window.getComputedStyle(e);return{width:parseInt(t.replace("px","")),height:parseInt(n.replace("px",""))}},M5=e=>{const t=new XMLSerializer().serializeToString(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`},N5=(e,t,n)=>{const r="http://www.w3.org/2000/svg",a=document.createElementNS(r,"svg");a.setAttribute("width",`${e}`),a.setAttribute("height",`${t}`),a.setAttribute("viewBox",`0 0 ${e} ${t}`);const o=document.createElementNS(r,"foreignObject");return o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),o.appendChild(n),a.appendChild(o),a},k5=async(e,t)=>{const{width:n,height:r}=vE(e),a=await C5(e);t!=null&&t.backgroundColor&&(a.style.backgroundColor=t.backgroundColor);const o=N5(n,r,a);return o.prepend(await x5(e)),M5(o)},A5=async(e,t)=>{const n=await k5(e,t),r=new Image;r.src=n;const a=(t==null?void 0:t.pixelRatio)||1,{width:o,height:s}=vE(e),c=document.createElement("canvas"),d=c.getContext("2d");return d?(c.width=o*a,c.height=s*a,c.style.width=`${o}`,c.style.height=`${s}`,(t!=null&&t.backgroundColor||document.body.className.contains("theme-dark"))&&(d.fillStyle=t.backgroundColor||"#1f1f1f",d.fillRect(0,0,c.width,c.height)),new Promise(p=>{r.onload=()=>{d.drawImage(r,0,0,c.width,c.height),p(c)}})):Promise.reject("Canvas error")},Zy=async(e,t)=>(await A5(e,t)).toDataURL(),GD=async e=>{e.startsWith("http")&&(e=await xd(e));const t=e.split("base64,")[1],n=Oy(t,"image/png");await wE(n),new C.Notice(N("Send to clipboard successfully"))},F5=async(e,t)=>{const n=await e.vault.adapter.exists(t);let r="";if(n)r=t;else{const c=e.metadataCache.getFirstLinkpathDest(t,"");if(!c){new C.Notice(N("File not exist"));return}r=c.path}const a=await e.vault.adapter.readBinary(r),o=new Uint8Array(a),s=new Blob([o],{type:"image/png"});await wE(s)},wE=async e=>{const t=new ClipboardItem({"image/png":e});await window.navigator.clipboard.write([t])},qD=1.1,JD=300,KD=20,O5=({destroy:e,imgUrl:t,filepath:n,otherIMGEls:r,currentIndex:a})=>{const o=A.useRef(null),[s,c]=A.useState(-1),d=Ee.getState().dailyNotesState.app,[p,m]=A.useState(a),[g,v]=A.useState(t),D={close:A.useRef(null),previous:A.useRef(null),next:A.useRef(null),decrease:A.useRef(null),increase:A.useRef(null),zoom:A.useRef(null),copy:A.useRef(null)};A.useEffect(()=>{!n&&!t||(C.setIcon(D.close.current,"x"),D.previous.current&&C.setIcon(D.previous.current,"arrow-left"),D.next.current&&C.setIcon(D.next.current,"arrow-right"),C.setIcon(D.decrease.current,"zoom-out"),C.setIcon(D.increase.current,"zoom-in"),C.setIcon(D.zoom.current,"circle"),C.setIcon(D.copy.current,"clipboard"))},[D]),A.useEffect(()=>{Ue.getImageSize(g).then(({width:R})=>{c(R!==0?40:0)})},[g]);const S=()=>{let R=p-1;R<0&&(R=r.length-1),m(R),v(r[R].src)},T=()=>{let R=p+1;R>=r.length&&(R=0),m(R),v(r[R].src)},E=()=>{e()},O=()=>{s>30&&c(s-10)},k=()=>{c(s+10)},j=R=>{R.target!==o.current&&R.target===o.current.parentElement&&E()},F=R=>{if(R.ctrlKey){R.preventDefault();const z=o.current,H=R.nativeEvent.offsetX,Y=R.nativeEvent.offsetY,U=H/z.clientWidth,J=Y/z.clientHeight;let Q;R.deltaY>0?Q=s/qD:Q=s*qD,Q>JD?Q=JD:Q{if(g&&!n)await GD(t);else if(n){const z=r[p].parentElement.getAttribute("src");if(!z){await GD(g);return}await F5(d,z)}};return w.jsxs(w.Fragment,{children:[w.jsx("button",{ref:D.close,className:"btn close-btn",onClick:E}),w.jsxs("div",{className:"img-container internal-embed image-embed is-loaded",onClick:j,onWheel:F,children:[w.jsx("img",{className:s<=0?"hidden":"",ref:o,height:s+"%",src:g}),w.jsx("span",{className:"loading-text "+(s===-1?"":"hidden"),children:N("Image is loading...")}),w.jsx("span",{className:"loading-text "+(s===0?"":"hidden"),children:N("😟 Cannot load image, image link maybe broken")})]}),w.jsxs("div",{className:"action-btns-container",children:[r&&(r==null?void 0:r.length)>1&&w.jsxs(w.Fragment,{children:[w.jsx("button",{ref:D.previous,className:"btn",onClick:S}),w.jsx("button",{ref:D.next,className:"btn",onClick:T})]}),w.jsx("button",{ref:D.decrease,className:"btn",onClick:O}),w.jsx("button",{ref:D.increase,className:"btn",onClick:k}),w.jsx("button",{ref:D.zoom,className:"btn",onClick:()=>c(80)}),w.jsx("button",{ref:D.copy,className:"btn",onClick:B})]})]})};function Wy({imgUrl:e,filepath:t,otherIMGEls:n,currentIndex:r}){By({className:"preview-image-dialog"},O5,{...{imgUrl:e,otherIMGEls:n,currentIndex:r},filepath:t})}const yd=async()=>{var r;const{verifyState:e}=Xe.getState(),t=!C.Platform.isDesktop&&await((r=window.Capacitor)==null?void 0:r.Plugins.Device.getId()),n=C.Platform.isDesktop?await vn():t.identifier||t.uuid;return e&&(e==null?void 0:e.appId)===n},P5=async(e,t)=>{if(!(t!=="chat"&&t!=="moments")){if(t==="moments"){const n=e.querySelectorAll(".thino-moment-icon"),r=e.find(".moments-view-user-icon"),a=e.find(".moments-view-background");for(const o of n){const s=await Uh(o);o.style.backgroundImage=`url(${s})`}if(r){const o=await Uh(r);r.style.backgroundImage=`url(${o})`}if(a){const o=await Uh(a);a.style.backgroundImage=`url(${o})`}}else if(t==="chat"){const n=e.querySelectorAll(".icon-img");for(const r of n){const a=await Uh(r);r.style.backgroundImage=`url(${a})`}}}};class vd extends C.Modal{constructor(t,n,r){super(t),this.title=n,this.cb=r}onOpen(){super.onOpen(),this.containerEl.toggleClass("thino-bulk-action-dialog",!0),this.titleEl.setText(this.title+N("Confirm?")),this.contentEl.createEl("button",{text:N("Confirm?").replace(/\?|?/,"")}).onclick=()=>{this.cb("confirm"),this.close()},this.contentEl.createEl("button",{text:N("Cancel")}).onclick=()=>{this.cb("cancel"),this.close()}}onClose(){super.onClose()}}class j5 extends C.Modal{constructor(n,r){super(n);me(this,"root");this.thinos=r}onOpen(){super.onOpen(),this.containerEl.toggleClass(["thino-bulk-action-dialog","tag-actions"],!0),this.root=Lo.createRoot(this.contentEl),this.root.render(w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(T5,{app:this.app,closeDialog:this.close.bind(this),thinos:this.thinos})}))}onClose(){var n;super.onClose(),(n=this.root)==null||n.unmount()}}const Rp=({thinosCount:e,thinos:t})=>{const{globalState:{memoListView:n},locationState:{query:r,pathname:a},dailyNotesState:{settings:o,app:s}}=A.useContext(mt),{tag:c,duration:d,type:p,text:m,filter:g}=r,v=Et.getQueryById(g),D=!!(c||d&&d.from{S&&C.setIcon(S.current,"more-horizontal")},[S]);const T=async()=>{if(!((t==null?void 0:t.length)>0))return;const H=g5(t),Y=v5(H);await Ue.copyTextToClipboard(Y),new C.Notice(N("Copied to clipboard Successfully"))},E=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await yd()){qt();return}const H=[...t],Y=o.DeleteThinoDirectly;try{for(const U of H)if(Y)await Te.deleteMemoById(U.id);else{const J=await Te.hideMemoById(U.id);J&&Te.editMemo(J)}He.clearQuery()}catch(U){console.error("error",U),new C.Notice(U.message)}},O=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await yd()){qt();return}const H=[...t];try{for(const Y of H)await Te.deleteMemoById(Y.id);He.clearQuery(),new C.Notice(N("DELETE SUCCEED"))}catch(Y){console.error("error",Y),new C.Notice(Y.message)}},k=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await yd()){qt();return}const H=[...t];try{const Y=await Te.unarchiveThinoBulk(H);for(const U of Y)U&&Te.editMemo(U);new C.Notice(N("RESTORE SUCCEED")),He.clearQuery()}catch(Y){console.error("error",Y),new C.Notice(Y.message)}},j=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await yd()){qt();return}const H=[...t],Y=Xe.getState().settings.startSync;try{for(const U of H){const J=await Te.restoreMemoById(U.id),Q=Xe.getState().app,le=Q==null?void 0:Q.loadLocalStorage("tokenForSync");J&&J.webId&&le&&Y&&await BT(J.webId),J&&Te.editMemo(J)}He.clearQuery(),new C.Notice(N("RESTORE SUCCEED"))}catch(U){new C.Notice(U.message)}},F=async()=>{if(!((t==null?void 0:t.length)>0))return;if(!await yd()){qt();return}const H=[...t];try{const Y=await Te.archiveThinoBulk(H);for(const U of Y)U&&Te.editMemo(U);He.clearQuery()}catch(Y){console.error("error",Y),new C.Notice(Y.message)}},B=async()=>{if((t==null?void 0:t.length)>0){if(!await yd()){qt();return}new j5(s,t).open()}},R=async H=>{setTimeout(async()=>{if(new C.Notice(N("Image is generating...")),!H){new C.Notice(N("No content to generate."));return}await P5(H,n);let Y;document.body.hasClass("theme-dark")?Y="#232323":Y="#eaeaea",Zy(H,{backgroundColor:Y,pixelRatio:window.devicePixelRatio*2}).then(U=>{if(o!=null&&o.AutoSaveWhenOnMobile&&C.Platform.isMobile){const J=U.split("base64,")[1];Oy(J,"image/png").arrayBuffer().then(async le=>{let pe;const ie="png",se=bs();for(const fe in se)if(se[fe]instanceof C.TFile){pe=se[fe];break}pe!==void 0&&await s.vault.createBinary(await vault.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,ie,pe),le)})}Wy({imgUrl:U}),new C.Notice(N("Image generated successfully.")),H.hasClass("share-image")?H.toggleClass("share-image",!1):H.closest(".share-image").toggleClass("share-image",!1)}).catch(U=>{console.error(U)})},0)},z=H=>{const Y=new C.Menu;switch(Y.addItem(U=>{U.setTitle(N("Copy filtered thinos")).setIcon("copy").onClick(async()=>{await T()})}),Y.addItem(U=>{U.setTitle(N("Share filtered thinos as image")).setIcon("image").onClick(async()=>{const J=document.querySelector(".memolist-container");J.toggleClass("share-image",!0);try{if(n==="calendar"){if(J.find(".rbc-agenda-table")){const Q=J.find(".rbc-agenda-table");await R(Q)}}else if(n==="table"){if(J.find(".thino-table")){const Q=J.find(".thino-table");await R(Q)}}else await R(J)}catch(Q){console.error(Q),new C.Notice(N("Failed to generate image.")),J.toggleClass("share-image",!1)}})}),Y.addSeparator(),a){case"/":Y.addItem(U=>{U.setTitle(N("Bulk tag operation")).setIcon("hash").onClick(async()=>{await B()})}).addItem(U=>{U.setTitle(N("Bulk archive")).setIcon("archive").onClick(async()=>{new vd(s,N("ARCHIVE"),async J=>{J==="confirm"&&await F()}).open()})}).addItem(U=>{U.setTitle(N("Bulk delete")).setIcon("trash").onClick(async()=>{new vd(s,N("DELETE"),async J=>{J==="confirm"&&await E()}).open()})});break;case"/archive":Y.addItem(U=>{U.setTitle(N("Bulk restore")).setIcon("archive").onClick(async()=>{new vd(s,N("RESTORE"),async J=>{J==="confirm"&&await k()}).open()})}).addItem(U=>{U.setTitle(N("Bulk delete")).setIcon("trash").onClick(async()=>{new vd(s,N("DELETE"),async J=>{J==="confirm"&&await E()}).open()})});break;case"/recycle":Y.addItem(U=>{U.setTitle(N("Bulk restore")).setIcon("archive-restore").onClick(async()=>{new vd(s,N("RESTORE"),async J=>{J==="confirm"&&await j()}).open()})}).addItem(U=>{U.setTitle(N("Bulk delete")).setIcon("trash").onClick(async()=>{new vd(s,N("DELETE"),async J=>{J==="confirm"&&await O()}).open()})});break}Y.showAtMouseEvent(H.nativeEvent)};return w.jsxs("div",{className:`filter-query-container ${D?"":"hidden"}`,children:[w.jsxs("div",{className:"filter-query",children:[w.jsx("span",{className:"tip-text",children:N("FILTER")}),w.jsxs("div",{"data-filter-type":"query",className:"filter-item-container "+(v?"":"hidden"),onClick:()=>{He.setMemoFilter("")},children:[w.jsx("span",{className:"icon-text",children:"🔖"})," ",v==null?void 0:v.title]}),w.jsxs("div",{"data-filter-type":"tag",className:"filter-item-container "+(c?"":"hidden"),onClick:()=>{He.setTagQuery("")},children:[w.jsx("span",{className:"icon-text",children:"🏷️"})," ",c]}),w.jsxs("div",{"data-filter-type":"type",className:"filter-item-container "+(p?"":"hidden"),onClick:()=>{He.setMemoTypeQuery("")},children:[w.jsx("span",{className:"icon-text",children:"📦"})," ",c8(p)]}),d&&d.from{const Y=C.moment(d.to,"x"),U=C.moment(H,"x"),J=U.isAfter(Y)||U.isSame(Y);He.setFromAndToQuery(J?Y.startOf("day").valueOf():C.moment(H,"x").startOf("day").valueOf(),d.to)}}),w.jsx("span",{children:N("to")}),w.jsx(py,{type:"text",startOrEnd:"end",defaultValue:C.moment(d.to,"x").add(1,"days").valueOf(),handleValueChange:H=>{const Y=C.moment(d.from,"x"),U=C.moment(H,"x"),J=U.isBefore(Y)||U.isSame(Y),Q=C.moment(H,"x").endOf("day").valueOf();He.setFromAndToQuery(d.from,J?Y.endOf("day").valueOf():Q)}})]}),w.jsx("div",{ref:H=>H&&C.setIcon(H,"x"),className:"btn close-btn",onClick:()=>{He.setFromAndToQuery(0,0)}})]}),w.jsxs("div",{className:"filter-item-container "+(m?"":"hidden"),onClick:()=>{He.setTextQuery("")},children:[w.jsx("span",{className:"icon-text",children:"🔍"})," ",m]})]}),w.jsxs("div",{className:"thino-filter-items",children:[e&&w.jsx("div",{className:"thinos-count",children:`${e?`${e} Thinos `:""}`}),w.jsx("div",{ref:S,className:"btn memo-action-menu",onClick:z})]})]})},L5=e=>{const{dailyNotesState:{app:t,view:n}}=A.useContext(mt),{memo:r,handleMemoContentClick:a,handleMemoDoubleClick:o}=e,s=$.useRef(null),[c,d]=$.useState("");return A.useEffect(()=>{if(!s.current||s.current.hasChildNodes()&&r.content===c||!n||!t)return;d(r.content),s.current.hasChildNodes()&&s.current.empty(),(async()=>{var g,v;await C.MarkdownRenderer.render(t,r.content+` `,s.current,r.path,n),(g=s.current)==null||g.toggleClass(["markdown-rendered"],!0);const m=(v=s.current)==null?void 0:v.querySelectorAll(".internal-link");m==null||m.forEach(D=>{const S=D,T=S.getAttribute("data-href");if(!T)return;t.metadataCache.getFirstLinkpathDest(T,r.path)||D.classList.add("is-unresolved"),S.addEventListener("mouseover",O=>{O.stopPropagation(),t.workspace.trigger("hover-link",{event:O,source:"thino",hoverParent:n.containerEl,targetEl:S,linktext:T,sourcePath:S.href})})})})()},[r.content,n,t]),w.jsx("div",{ref:s,className:"memo-content-text",onClick:p=>a(p,r),onDoubleClick:o,onContextMenu:p=>{p.preventDefault()}})},bE=A.memo(L5),R5=e=>{const[t,n]=A.useState({...e.memo,createdAtStr:Ue.getDateTimeString(e.memo.createdAt)}),[r,a]=A.useState([]),[o,s]=A.useState([]);A.useEffect(()=>{(async()=>{try{const g=[],v=[...t.content.matchAll(Il)];for(const S of v)if(S&&S.length===3){const T=S[2],E=Te.getMemoById(T);E&&g.push({...E,createdAtStr:Ue.getDateTimeString(E.createdAt),dateStr:Ue.getDateString(E.createdAt)})}a([...g]);const D=await Te.getLinkedMemos(t.id);s(D.sort((S,T)=>Ue.getTimeStampByDate(T.createdAt)-Ue.getTimeStampByDate(S.createdAt)).map(S=>({...S,createdAtStr:Ue.getDateTimeString(S.createdAt),dateStr:Ue.getDateString(S.createdAt)})))}catch(g){console.error(g)}})()},[t.id]);const c=A.useCallback(async m=>{var v;const g=m.target;if(g.className==="memo-link-text"){const D=(v=g.dataset)==null?void 0:v.value,S=Te.getMemoById(D??"");if(S){const T={...S,createdAtStr:Ue.getDateTimeString(S.createdAt)};a([]),s([]),n(T)}else new C.Notice(N("Thino not found")),g.classList.remove("memo-link-text")}},[]),d=A.useCallback(m=>{a([]),s([]),n({...m,createdAtStr:Ue.getDateTimeString(m.createdAt)})},[t.id]),p=A.useCallback(()=>{e.destroy(),Qe.setEditMemoId(t.id)},[t.id]);return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"memo-card-container",children:[w.jsxs("div",{className:"header-container",children:[w.jsx("span",{className:"time-text",children:t.createdAtStr}),w.jsxs("div",{className:"btns-container",children:[w.jsx("button",{ref:m=>{m&&C.setIcon(m,"edit")},className:"btn edit-btn",onClick:p}),w.jsx("button",{ref:m=>{m&&C.setIcon(m,"x")},className:"btn close-btn",onClick:e.destroy})]})]}),w.jsx("div",{className:"memo-container",children:w.jsx("div",{className:"memo-content-text",children:w.jsx(bE,{memo:t,handleMemoContentClick:c,handleMemoDoubleClick:()=>{}})})}),w.jsx("div",{className:"layer-container"})]}),r.length>0?w.jsxs("div",{className:"linked-memos-wrapper",children:[w.jsxs("span",{className:"normal-text",children:[N("LINKED")," ",r.length," THINO"," "]}),r.map(m=>{const g=Vb(pw(m.content)).replaceAll(` `," ");return w.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[w.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null,o.length>0?w.jsxs("div",{className:"linked-memos-wrapper",children:[w.jsxs("span",{className:"normal-text",children:[o.length," THINO ",N("LINK TO THE")," THINO"]}),o.map(m=>{const g=Vb(pw(m.content)).replaceAll(` `," ");return w.jsxs("div",{className:"linked-memo-container",onClick:()=>d(m),children:[w.jsxs("span",{className:"time-text",children:[m.dateStr," "]}),g]},m.id)})]}):null]})};function $d(e){By({className:"memo-card-dialog"},R5,{memo:e})}const B5='',_5='',QD=(e,t)=>{const n=window.atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r);for(let o=0;o{const{vault:t}=Xe.getState().app,n=await t.adapter.readBinary(e),r=new Uint8Array(n),a=new Blob([r],{type:"image/png"});return new Promise(o=>{const s=new FileReader;s.onloadend=()=>{const c=s.result;o(c)},s.readAsDataURL(a)})},Y5=async e=>{const t=e.find(".thino-user-icon");if(t){const n=await Uh(t);t.style.backgroundImage=`url(${n})`}},z5=async()=>{const{app:e,settings:t}=Xe.getState();let n,r;const a=document.body.hasClass("theme-light"),o=a?t==null?void 0:t.DefaultLightBackgroundImage:t==null?void 0:t.DefaultDarkBackgroundImage,s=await e.vault.adapter.exists(t==null?void 0:t.DefaultLightBackgroundImage)&&/\.(png|svg|jpg|jpeg)/g.test(t==null?void 0:t.DefaultLightBackgroundImage),c=o==null?void 0:o.startsWith("http");s||c?(r=o,n=c?await xd(o):await H5(r)):n="data:image/svg+xml;base64,"+btoa(a?B5:_5);const d=document.querySelector(".dialog-wrapper .memo-background .property-image");d.style.backgroundImage="url('"+n+"')",document.body.className.contains("theme-dark")&&(d.style.backgroundColor="#1f1f1f")},U5=e=>{const{memo:t,destroy:n}=e,{memos:r}=Ee.getState().memoState,{view:a,app:o,settings:s}=Ee.getState().dailyNotesState,c={...t,createdAtStr:Ue.getDateTimeString(t.createdAt)},[d,p]=A.useState(!1),[m,g]=A.useState(c.content),[v,D]=A.useState(!1),S=A.useRef(null),T=A.useRef(null),E=A.useRef(null),[O,k]=A.useState(""),j=A.useRef(null),F=A.useRef(null);let B,R;r.length&&(B=r.length>0?r[r.length-1]:null,B?R=r?Math.ceil((Date.now()-Ue.getTimeStampByDate(B==null?void 0:B.createdAt))/1e3/3600/24)+1:0:R=0),s==null||s.ShareFooterEnd.replace("{UserName}",s==null?void 0:s.UserName);const z=s==null?void 0:s.ShareFooterStart.replace("{ThinoNum}",r.length.toString()).replace("{UsedDay}",R.toString());A.useEffect(()=>{!S.current||!T.current||(C.setIcon(S.current,"copy"),C.setIcon(T.current,"x"))},[S,T]),A.useEffect(()=>{E.current&&C.setIcon(E.current,"file-down")},[E]),A.useEffect(()=>{C.setIcon(S.current,v?"loader":"copy"),S.current.disabled=v,S.current.toggleClass("copying",v)},[v]),A.useEffect(()=>{if(!F.current||!a||d)return;g(t.content),F.current.hasChildNodes()&&F.current.empty();async function Q(){var le;(le=F.current)==null||le.toggleClass(["markdown-rendered"],!0),await C.MarkdownRenderer.render(o,t.content+` `,F.current,t.path,a)}Q(),setTimeout(async()=>{if(await z5(),await Y5(j.current),!j.current)return;let le;document.body.hasClass("theme-dark")?le="#727171":le="#eaeaea",Zy(j.current,{backgroundColor:le,pixelRatio:window.devicePixelRatio*2}).then(pe=>{k(pe),p(!0)}).catch(()=>{})},MI)},[j,F,c]);const H=()=>{n()},Y=A.useCallback(Q=>{D(Q)},[v]),U=async()=>{const{vault:Q}=Ee.getState().dailyNotesState.app,le=j.current.querySelector(".memo-shortcut-img");if(!le)return;const pe=le==null?void 0:le.getAttribute("src").split("base64,")[1],ie=QD(pe,"image/png");let se;ie.arrayBuffer().then(async fe=>{const oe="png",we=bs();for(const Z in we)if(we[Z]instanceof C.TFile){se=we[Z];break}if(se!==void 0){const Z=await Q.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,oe,se);await Q.createBinary(Z,fe),new C.Notice(N("Save image successfully"))}})},J=async()=>{Y(!0);const Q=j.current.querySelector(".memo-shortcut-img");if(!Q)return;const le=Q==null?void 0:Q.getAttribute("src").split("base64,")[1],pe=QD(le,"image/png");if(!pe){new C.Notice("Copy to clipboard failed");return}const ie=new ClipboardItem({"image/png":pe});window.navigator.clipboard.write([ie]).then(()=>{setTimeout(()=>{Y(!1)},500)}),new C.Notice("Copy to clipboard successfully")};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"dialog-header-container",children:[w.jsxs("p",{className:"title-text",children:[w.jsx("span",{className:"icon-text",children:"🥰"}),N("Share Memo Image")]}),w.jsxs("div",{className:"btn-group",children:[C.Platform.isMobile&&w.jsx("button",{ref:E,className:"btn download-btn",onClick:U}),w.jsx("button",{ref:S,className:"btn copy-btn",onClick:J}),w.jsx("button",{ref:T,className:"btn close-btn",onClick:H})]})]}),w.jsxs("div",{className:"dialog-content-container",children:[w.jsx("div",{className:`tip-words-container ${O?"finish":"loading"}`,children:w.jsx("p",{className:"tip-text",children:N(O?"↗Click the button to save":"Image is generating...")})}),w.jsxs("div",{className:"memo-container",ref:j,children:[w.jsx(so,{when:O!=="",children:w.jsx("img",{className:"memo-shortcut-img",onClick:J,src:O})}),w.jsxs("div",{className:"memo-background",children:[w.jsx("div",{className:"property-image",style:{backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),w.jsx("span",{className:"background-container"}),w.jsxs("div",{className:"thino-user-header",children:[w.jsx("div",{className:"thino-user-icon",ref:Q=>{if(s!=null&&s.MomentsIcon){Q==null||Q.empty();return}s!=null&&s.MomentsIcon||Q&&C.setIcon(Q,"Memos")},style:{backgroundImage:`url(${s==null?void 0:s.MomentsIcon})`}}),w.jsxs("div",{className:"thino-user-info",children:[w.jsx("div",{className:"thino-user-name",children:s==null?void 0:s.UserName}),(s==null?void 0:s.MomentsQuote)&&w.jsx("div",{className:"thino-user-quote",children:s==null?void 0:s.MomentsQuote})]})]}),w.jsx("div",{ref:F,className:"memo-content-text"}),w.jsx("div",{className:"thino-time-footer",children:c.createdAt}),w.jsxs("div",{className:"watermark-container",children:[w.jsxs("span",{className:"normal-text footer-start",children:[w.jsx("div",{className:"property-social-icons"}),w.jsx("span",{className:"name-text",children:z})]}),w.jsx("span",{className:"normal-text footer-end",children:w.jsx("span",{className:"name-text",children:"THINO"})})]})]})]})]})]})};function V5(e){By({className:"share-memo-image-dialog"},U5,{memo:e})}const Z5=A.forwardRef((e,t)=>{const{memo:n,handlePinMemoClick:r,handleFixMemoClick:a,handleSourceMemoClick:o,handleShowMemoStoryDialog:s,handleCopyMemoClick:c,handleEditMemoClick:d,handleGenMemoImageBtnClick:p,handleMarkMemoClick:m,handleArchiveMemo:g,handleDeleteMemoClick:v}=e,D=A.useRef(null),S=Ee.getState().dailyNotesState.settings,[T,E]=ki(!1),O=A.useRef(null),k={pinRef:A.useRef(null),fixRef:A.useRef(null),typeRef:A.useRef(null),moreRef:A.useRef(null)},j={copy:A.useRef(null),read:A.useRef(null),mark:A.useRef(null),share:A.useRef(null),edit:A.useRef(null),source:A.useRef(null),archive:A.useRef(null),delete:A.useRef(null)};return A.useEffect(()=>{O.current&&(C.setIcon(j.copy.current,"copy"),C.setIcon(j.read.current,"book-open"),C.setIcon(j.mark.current,"bookmark"),C.setIcon(j.share.current,"share-2"),C.setIcon(j.edit.current,"pencil"),C.setIcon(j.source.current,"home"),C.setIcon(j.archive.current,"archive"),C.setIcon(j.delete.current,"trash"))},[O]),A.useEffect(()=>{if(!k.typeRef)return;const F=tp.find(B=>B.title===n.sourceType);C.setIcon(k.typeRef.current,F.icon),C.requireApiVersion("1.4.4")&&C.setTooltip(k.typeRef.current,n.path),k.fixRef&&(C.setIcon(k.fixRef.current,"shield-alert"),C.requireApiVersion("1.4.4")&&C.setTooltip(k.fixRef.current,"Update Thino property"))},[k.typeRef]),A.useEffect(()=>{k.pinRef&&(n.pinned?(C.setIcon(k.pinRef.current,"pin-off"),C.requireApiVersion("1.4.4")&&C.setTooltip(k.pinRef.current,N("UNPIN"))):(C.setIcon(k.pinRef.current,"pin"),C.requireApiVersion("1.4.4")&&C.setTooltip(k.pinRef.current,N("PIN"))))},[k.pinRef,n.pinned]),A.useImperativeHandle(t,()=>({toggleConfirm:F=>E(F),confirmStatus:T})),w.jsx("div",{ref:O,className:"memo-top-right-wrapper",children:w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:k.fixRef,className:`btn ${n.sourceType!=="MULTI"||n.id!==""?"hidden":""} fix-memo-btn`,onClick:()=>a(n)}),w.jsx("span",{ref:k.typeRef,className:`btn ${n.sourceType==="DAILY"?"hidden":""} source-type-btn`,onClick:()=>o(n)}),w.jsx("span",{ref:k.pinRef,className:`btn ${e.memo.pinned?"pinned-btn":"unpinned-btn"} pro`,onClick:r}),w.jsx("span",{ref:F=>{k.moreRef.current=F,F&&C.setIcon(F,"more-horizontal")},className:"btn more-action-btn"}),w.jsx("div",{ref:D,className:"more-action-btns-wrapper",children:w.jsxs("div",{className:"more-action-btns-container",children:[w.jsxs("div",{className:"more-action-btn-group more-action-menu-item",children:[w.jsx("span",{ref:j.copy,className:"more-action-item-icon",onClick:c}),w.jsx("span",{ref:j.edit,className:"more-action-item-icon",onClick:d}),w.jsx("span",{ref:j.share,className:"more-action-item-icon",onClick:p})]}),w.jsx("hr",{className:"menu-hr"}),w.jsxs("div",{className:"more-action-menu-item",onClick:s,children:[w.jsx("span",{ref:j.read,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",children:N("READ")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:j.mark,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:m,children:N("MARK")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:j.source,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:()=>o(n),children:N("SOURCE")})]}),w.jsx("hr",{className:"menu-hr"}),w.jsxs("div",{className:"more-action-menu-item archive-menu-item",children:[w.jsx("span",{ref:j.archive,className:"more-action-item-icon"}),w.jsx("span",{className:"btn delete-btn",onClick:()=>g(n),children:N("ARCHIVE").toUpperCase()})]}),w.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[w.jsx("span",{ref:j.delete,className:"more-action-item-icon"}),w.jsx("span",{className:`btn delete-btn ${T?"final-confirm":""}`,onClick:async F=>{F.stopPropagation(),F.preventDefault(),await v(F)},children:T?N("CONFIRM!"):S.DeleteThinoDirectly?N("DELETE"):N("Recycle bin").toUpperCase()})]}),w.jsx("hr",{className:"menu-hr"}),w.jsx("div",{className:"text-count-item more-action-menu-item",children:w.jsx("span",{className:"btn text-count-btn",children:Ue.getWordCount(n.content.replace(/```[^\S\r\n]*[a-z]*\n.*?\n```/g,""))+` ${N("words")}`})})]})})]})})}),W5=e=>{const{memo:t,handleMemoTypeToggle:n,handleShowMemoStoryDialog:r,settings:a}=e;return w.jsxs("div",{className:"memo-top-left-wrapper",children:[e.children,w.jsx("span",{title:t.createdAt,className:"time-text",onClick:r,children:t.createdAt}),w.jsx("div",{className:`btn memo-type-img ${a!=null&&a.ShowTaskLabel?"":"hidden"}`,onClick:n,children:t.thinoType!=="JOURNAL"&&w.jsx("input",{className:"task-list-item-checkbox",type:"checkbox",checked:t.thinoType!=="TASK-TODO","data-task":t.thinoType==="TASK-TODO"?"":t.thinoType==="TASK-DONE"?"x":t.thinoType.slice(5)})})]})},$5=async(e,t,n)=>{const r=n.getAttribute("href"),a=n.className;if(a.contains("tag"))G5(n.innerText.slice(1));else if(a.contains("internal-link")){const o=n.getAttribute("data-href"),s=Te.getMemoById(o??"");s?$d(s):await e.workspace.openLinkText(o,o,!C.Platform.isMobile&&t.navigation!==!0)}else r&&window.open(r,"_blank")},G5=e=>{const t=He.getState().query.tag;He.setTagQuery(t.contains(",")?t.split(",").includes(e)?t.split(",").filter(n=>n!==e).join(","):t+","+e:t===e?"":e)},q5=(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);Wy({imgUrl:n,filepath:n.startsWith("app")?r:void 0,otherIMGEls:a,currentIndex:o})},J5=e=>{var r;const t=(r=e.dataset)==null?void 0:r.value,n=Te.getMemoById(t??"");n?$d(n):(new C.Notice("Thino Not Found"),e.classList.remove("memo-link-text"))},K5=async(e,t,n)=>{var o;const r=((o=n.parentElement.dataset)==null?void 0:o.task)==="x"?"DONE":"TODO",a=[...(t==null?void 0:t.querySelectorAll("li.task-list-item"))||[]];for(const s of a)if(s===n||s===n.closest("li.task-list-item")){const c=a.indexOf(s),d=e.content.split(/\n/),p=[];for(let S=0;S{const{globalState:{editMemoId:t},dailyNotesState:{app:n,view:r,settings:a,verifyState:o},locationState:{pathname:s}}=A.useContext(mt),{memo:c,type:d="inline"}=e,p=A.useRef(null),m=A.useRef(null),[g,v]=A.useState(!1);A.useEffect(()=>{g&&setTimeout(()=>{Qe.setEditMemoId(c.id)},100)},[g]),A.useEffect(()=>{(s==="/review"||s==="/daily")&&t!==c.id&&g&&v(!1)},[t]);const D=()=>{$d(c)},S=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"){const ie=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");ie&&ie.trigger("click")}Qe.setMarkMemoId(c.id)},T=async()=>{var fe;const ie=!C.Platform.isDesktop&&await((fe=window.Capacitor)==null?void 0:fe.Plugins.Device.getId()),se=C.Platform.isDesktop?await vn():ie.identifier||ie.uuid;if(!o||(o==null?void 0:o.appId)!==se){qt();return}c.pinned?await Te.unpinMemoById(c.id):await Te.pinMemoById(c.id)},E=()=>{if(a!=null&&a.UseButtonToShowEditor&&(a==null?void 0:a.DefaultEditorLocation)==="Bottom"&&C.Platform.isMobile){const ie=document.querySelector("div[data-type='thino_view'] .view-content .memo-show-editor-button:not(.hidden)");ie&&ie.trigger("click")}(s==="/review"||s==="/daily")&&v(!0),s!=="/review"&&s!=="/daily"&&Qe.setEditMemoId(c.id)},O=async ie=>{ie.sourceType==="MULTI"&&ie.id.trim()===""&&await Te.updateMemoProperty(ie)},k=async ie=>{await Te.openThinoByID(ie.id)},j=async ie=>{try{const se=await Te.archiveMemo(ie);se&&Te.editMemo(se)}catch(se){console.error(se),new C.Notice(se.message)}},F=async(ie,se)=>{if(!se&&m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm();return}try{if(a.DeleteThinoDirectly)await Te.deleteMemoById(c.id);else{const fe=await Te.hideMemoById(c.id);fe&&Te.editMemo(fe)}}catch(fe){new C.Notice(fe.message)}Qe.getState().editMemoId===c.id&&Qe.setEditMemoId("")},B=()=>{if(m.current&&!m.current.confirmStatus){m.current&&m.current.toggleConfirm(!1);return}},R=()=>{V5(c)},z=async()=>{const ie=await Te.updateMemo(c.id,c.content,c.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");ie&&Te.editMemo(ie)},H=async ie=>{ie.stopPropagation(),navigator.clipboard.writeText(c.content).then(()=>{new C.Notice(N("COPY SUCCEED"))}).catch(()=>{new C.Notice(N("COPY FAILED"))})},Y=ie=>{ie&&ie.target.tagName!=="INPUT"&&E()},U=async(ie,se)=>{ie.preventDefault(),ie.stopPropagation();const fe=ie.target;if(ie.ctrlKey||ie.metaKey){await k(se);return}if(fe.tagName==="A"){await $5(n,r,fe);return}if(fe.tagName==="IMG"){q5(p.current,fe);return}if(fe.tagName==="A"&&fe.getAttribute("href")){const oe=fe.getAttribute("href");window.open(oe,"_blank");return}if(fe.className==="memo-link-text"){J5(fe);return}if(fe.tagName==="INPUT"&&fe.hasClass("task-list-item-checkbox")){await K5(se,p.current,fe);return}},J=ie=>{const se=new C.Menu;se.dom.toggleClass("memo-context-menu",!0);const fe=window.getSelection();(fe==null?void 0:fe.toString().length)>0&&se.addItem(oe=>{oe.setIcon("copy").setTitle(N("Copy selected text")).onClick(()=>{navigator.clipboard.writeText(fe.toString()).then(()=>{new C.Notice(N("COPY SUCCEED"))}).catch(()=>{new C.Notice(N("COPY FAILED"))})})}).addSeparator(),se.addItem(oe=>{oe.setIcon("copy").setTitle(N("Copy thino").toLocaleUpperCase()).onClick(async we=>{await H(we),se.close()})}).addItem(oe=>{oe.setIcon("book-open").setTitle(N("READ")).onClick(D)}).addItem(oe=>{oe.setIcon(c.pinned?"pin-off":"pin").setTitle(c.pinned?N("UNPIN"):N("PIN")).onClick(T)}).addItem(oe=>{oe.setIcon("bookmark").setTitle(N("MARK")).onClick(S)}).addItem(oe=>{oe.setIcon("share-2").setTitle(N("SHARE")).onClick(R)}).addItem(oe=>{oe.setIcon("pencil").setTitle(N("EDIT")).onClick(E)}).addItem(oe=>{oe.setIcon("home").setTitle(N("SOURCE")).onClick(()=>k(c))}).addSeparator().addItem(oe=>{oe.setIcon("archive").setTitle(N("ARCHIVE").toLocaleUpperCase()).onClick(()=>j(c))}).addItem(oe=>{oe.setIcon("trash").setTitle(N("DELETE")).onClick(async we=>{await F(we,!0)})}),se.showAtMouseEvent(ie.nativeEvent)},Q=A.useMemo(()=>({memo:c,handlePinMemoClick:T,handleFixMemoClick:O,handleSourceMemoClick:k,handleArchiveMemo:j,handleDeleteMemoClick:F,handleGenMemoImageBtnClick:R,handleMarkMemoClick:S,handleEditMemoClick:E,handleCopyMemoClick:H,handleShowMemoStoryDialog:D}),[c]),le=A.useMemo(()=>({memo:c,handleMemoTypeToggle:z,handleShowMemoStoryDialog:D,settings:a}),[c,a]),pe=A.useMemo(()=>w.jsxs("div",{ref:p,className:`memo-wrapper ${c.pinned?"pinned":""}`,"data-source-type":c.sourceType,"data-thino-type":c.thinoType,"data-thino-id":c.id,onMouseLeave:B,onMouseOver:ie=>{ie.shiftKey&&(ie.stopPropagation(),n.workspace.trigger("hover-link",{event:ie,source:"thino",hoverParent:r.containerEl,targetEl:p.current,linktext:c.path,sourcePath:c.path,state:{scroll:c.sourceType==="DAILY"?parseInt(c.id.slice(14)):0}}))},onContextMenu:J,children:[g&&w.jsx(Nu,{editorType:"inline"}),!g&&w.jsxs(w.Fragment,{children:[d==="inline"&&w.jsxs("div",{className:"memo-top-wrapper",draggable:!0,onDragStart:ie=>{ie.target.classList.add("dragging"),ie.dataTransfer.setDragImage(p.current,0,0),ie.dataTransfer.setData("text/plain",c.content)},onDragEnd:ie=>{ie.target.classList.remove("dragging")},children:[w.jsx(W5,{...le}),w.jsx(Z5,{ref:m,...Q})]}),w.jsx(bE,{memo:c,handleMemoContentClick:U,handleMemoDoubleClick:Y})]})]}),[c,g]);return w.jsx(w.Fragment,{children:pe})},Sa=A.memo(Q5);function X5(e,t){if(e==null)return{};var n=eF(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eF(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,o;for(o=0;o=0)&&(n[a]=e[a]);return n}function my(){return my=Object.assign||function(e){for(var t=1;t{this.reCalculateColumnCount()})}reCalculateColumnCount(){const t=window&&window.innerWidth||1/0;let n=this.props.breakpointCols;typeof n!="object"&&(n={default:parseInt(n)||j0});let r=1/0,a=n.default||j0;for(let o in n){const s=parseInt(o);s>0&&t<=s&&s"u"&&(s="my-masonry-grid_column"));const c=Lh(Lh(Lh({},t),n),{},{style:Lh(Lh({},n.style),{},{width:o}),className:s});return a.map((d,p)=>$.createElement("div",my({},c,{key:p}),d))}logDeprecated(t){console.error("[Masonry]",t)}render(){const t=this.props,{children:n,breakpointCols:r,columnClassName:a,columnAttrs:o,column:s,className:c}=t,d=X5(t,["children","breakpointCols","columnClassName","columnAttrs","column","className"]);let p=c;return typeof c!="string"&&(this.logDeprecated('The property "className" requires a string'),typeof c>"u"&&(p="my-masonry-grid")),$.createElement("div",my({},d,{className:p}),this.renderColumns())}}gy.defaultProps=nF;const Ow=e=>{const t=Ee.getState().dailyNotesState.settings,{thinos:n,dayMark:r,dayMarkRange:a="day",thinoWrapper:o}=e,[s,c]=$.useState(!(t!=null&&t.hidePinnedGroup&&r==="PINNED")),d=$.useRef(null);A.useEffect(()=>{d&&C.setTooltip&&C.setTooltip(d.current,N("Click to expand or fold, Cmd+Click to show all thinos of the day"))},[d]);const p=g=>{if(C.Keymap.isModifier(g.nativeEvent,"Mod")){const v={day:"YYYY-MM-DD",week:"YYYY-[W]WW",month:"YYYY-MM",quarter:"YYYY-[Q]Q",year:"YYYY"},D=C.moment(r,v[a]);He.setFromAndToQuery(D.startOf(a).valueOf(),D.endOf(a).valueOf());return}c(!s)},m=A.useMemo(()=>w.jsx(w.Fragment,{children:e.type==="list"?w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:d,className:`day-mark ${s?"":"folded"} PINNED`,onClick:p,children:w.jsxs("span",{className:"day-mark-text",children:[s?"▼ ":"▶ ",r==="PINNED"?r+" 📌":r]})},r),s&&n.map((g,v)=>o?o({thino:g}):w.jsx(Sa,{memo:g},`${g.id}-${C.moment(g.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${v}`))]}):w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:d,className:`day-mark ${s?"":"folded"}`,onClick:p,children:w.jsxs("span",{className:"day-mark-text",children:[s?"▼ ":"▶ ",r==="PINNED"?r+" 📌":r]})},r),w.jsx(gy,{breakpointCols:e.type==="waterfall"?3:1,className:`${e.type}-view masonry-memolist`,columnClassName:"masonry-memolist-grid_column",children:s&&n.map((g,v)=>o?o({thino:g}):w.jsx(Sa,{memo:g},`${g.id}-${C.moment(g.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${v}`))})]})}),[n,s]);return w.jsx(w.Fragment,{children:m})};function gs(e){"@babel/helpers - typeof";return gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gs(e)}function rF(e,t){if(gs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function DE(e){var t=rF(e,"string");return gs(t)=="symbol"?t:String(t)}function Iu(e,t,n){return t=DE(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rn(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function Fi(e,t){if(e==null)return{};var n=$y(e,t),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tS(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?z-1:0),Y=1;Yt}),_p=qd(function(e,t){return e>=t}),L1=qd(function(e,t){return e=t&&a.getHours()-n.getHours()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-1&&e%1==0&&e<=rO}var B1=aO,oO=R1,iO=B1;function sO(e){return e!=null&&iO(e.length)&&!oO(e)}var Yp=sO,lO=9007199254740991,uO=/^(?:0|[1-9]\d*)$/;function cO(e,t){var n=typeof e;return t=t??lO,!!t&&(n=="number"||n!="symbol"&&uO.test(e))&&e>-1&&e%1==0&&e{t.current=e},[e]),t}function mS(e){const t=f7(e);return A.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function gS(){return A.useState(null)}function h7(){const e=A.useRef(!0),t=A.useRef(()=>e.current);return A.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function p7(e){const t=h7();return[e[0],A.useCallback(n=>{if(t())return e[1](n)},[t,e[1]])]}var m7=fE({defaultModifiers:[lE,cE,rE,aE,uE,sE,dE,nE]}),yS=function(t){return{position:t,top:"0",left:"0",opacity:"0",pointerEvents:"none"}},g7={name:"applyStyles",enabled:!1},y7={name:"ariaDescribedBy",enabled:!0,phase:"afterWrite",effect:function(t){var n=t.state;return function(){var r=n.elements,a=r.reference,o=r.popper;if("removeAttribute"in a){var s=(a.getAttribute("aria-describedby")||"").split(",").filter(function(c){return c.trim()!==o.id});s.length?a.setAttribute("aria-describedby",s.join(",")):a.removeAttribute("aria-describedby")}}},fn:function(t){var n,r=t.state,a=r.elements,o=a.popper,s=a.reference,c=(n=o.getAttribute("role"))==null?void 0:n.toLowerCase();if(o.id&&c==="tooltip"&&"setAttribute"in s){var d=s.getAttribute("aria-describedby");if(d&&d.split(",").indexOf(o.id)!==-1)return;s.setAttribute("aria-describedby",d?d+","+o.id:o.id)}}},v7=[];function w7(e,t,n){var r=n===void 0?{}:n,a=r.enabled,o=a===void 0?!0:a,s=r.placement,c=s===void 0?"bottom":s,d=r.strategy,p=d===void 0?"absolute":d,m=r.modifiers,g=m===void 0?v7:m,v=$y(r,["enabled","placement","strategy","modifiers"]),D=A.useRef(),S=A.useCallback(function(){var F;(F=D.current)==null||F.update()},[]),T=A.useCallback(function(){var F;(F=D.current)==null||F.forceUpdate()},[]),E=p7(A.useState({placement:c,update:S,forceUpdate:T,attributes:{},styles:{popper:yS(p),arrow:{}}})),O=E[0],k=E[1],j=A.useMemo(function(){return{name:"updateStateModifier",enabled:!0,phase:"write",requires:["computeStyles"],fn:function(B){var R=B.state,z={},H={};Object.keys(R.elements).forEach(function(Y){z[Y]=R.styles[Y],H[Y]=R.attributes[Y]}),k({state:R,styles:z,attributes:H,update:S,forceUpdate:T,placement:R.placement})}}},[S,T,k]);return A.useEffect(function(){!D.current||!o||D.current.setOptions({placement:c,strategy:p,modifiers:[].concat(g,[j,g7])})},[p,c,j,o]),A.useEffect(function(){if(!(!o||e==null||t==null))return D.current=m7(e,t,An({},v,{placement:c,strategy:p,modifiers:[].concat(g,[y7,j])})),function(){D.current!=null&&(D.current.destroy(),D.current=void 0,k(function(F){return An({},F,{attributes:{},styles:{popper:yS(p)}})}))}},[o,e,t]),O}function b7(e,t,n,r){var a=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,a),n.__once&&e.removeEventListener(t,n.__once,a)}function Vh(e,t,n,r){return d7(e,t,n,r),function(){b7(e,t,n,r)}}function D7(e){return e&&"setState"in e?T1.findDOMNode(e):e??null}const S7=function(e){return Up(D7(e))};var I7=27,vS=function(){};function T7(e){return e.button===0}function E7(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var wS=function(t){return t&&("current"in t?t.current:t)};function C7(e,t,n){var r=n===void 0?{}:n,a=r.disabled,o=r.clickTrigger,s=o===void 0?"click":o,c=A.useRef(!1),d=t||vS,p=A.useCallback(function(v){var D,S=wS(e);c5(!!S,"RootClose captured a close event but does not have a ref to compare it to. useRootClose(), should be passed a ref that resolves to a DOM node"),c.current=!S||E7(v)||!T7(v)||!!pp(S,(D=v.composedPath==null?void 0:v.composedPath()[0])!=null?D:v.target)},[e]),m=mS(function(v){c.current||d(v)}),g=mS(function(v){v.keyCode===I7&&d(v)});A.useEffect(function(){if(!(a||e==null)){var v=window.event,D=S7(wS(e)),S=Vh(D,s,p,!0),T=Vh(D,s,function(k){if(k===v){v=void 0;return}m(k)}),E=Vh(D,"keyup",function(k){if(k===v){v=void 0;return}g(k)}),O=[];return"ontouchstart"in D.documentElement&&(O=[].slice.call(D.body.children).map(function(k){return Vh(k,"mousemove",vS)})),function(){S(),T(),E(),O.forEach(function(k){return k()})}}},[e,a,s,p,m,g])}function x7(e){var t={};return Array.isArray(e)?(e==null||e.forEach(function(n){t[n.name]=n}),t):e||t}function M7(e){return e===void 0&&(e={}),Array.isArray(e)?e:Object.keys(e).map(function(t){return e[t].name=t,e[t]})}function N7(e){var t,n,r,a,o=e.enabled,s=e.enableEvents,c=e.placement,d=e.flip,p=e.offset,m=e.fixed,g=e.containerPadding,v=e.arrowElement,D=e.popperConfig,S=D===void 0?{}:D,T=x7(S.modifiers);return An({},S,{placement:c,enabled:o,strategy:m?"fixed":S.strategy,modifiers:M7(An({},T,{eventListeners:{enabled:s},preventOverflow:An({},T.preventOverflow,{options:g?An({padding:g},(t=T.preventOverflow)==null?void 0:t.options):(n=T.preventOverflow)==null?void 0:n.options}),offset:{options:An({offset:p},(r=T.offset)==null?void 0:r.options)},arrow:An({},T.arrow,{enabled:!!v,options:An({},(a=T.arrow)==null?void 0:a.options,{element:v})}),flip:An({enabled:!!d},T.flip)}))})}function k7(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function A7(e,t){e.classList?e.classList.add(t):k7(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function bS(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function F7(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=bS(e.className,t):e.setAttribute("class",bS(e.className&&e.className.baseVal||"",t))}var jg;function JE(e){if((!jg&&jg!==0||e)&&Y1){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),jg=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return jg}var H0=function(t){var n;return typeof document>"u"?null:t==null?Up().body:(typeof t=="function"&&(t=t()),t&&"current"in t&&(t=t.current),(n=t)!=null&&n.nodeType&&t||null)};function DS(e,t){var n=A.useState(function(){return H0(e)}),r=n[0],a=n[1];if(!r){var o=H0(e);o&&a(o)}return A.useEffect(function(){t&&r&&t(r)},[t,r]),A.useEffect(function(){var s=H0(e);s!==r&&a(s)},[e,r]),r}const SS=e=>!e||typeof e=="function"?e:t=>{e.current=t};function O7(e,t){const n=SS(e),r=SS(t);return a=>{n&&n(a),r&&r(a)}}function P7(e,t){return A.useMemo(()=>O7(e,t),[e,t])}var z1=$.forwardRef(function(e,t){var n=e.flip,r=e.offset,a=e.placement,o=e.containerPadding,s=o===void 0?5:o,c=e.popperConfig,d=c===void 0?{}:c,p=e.transition,m=gS(),g=m[0],v=m[1],D=gS(),S=D[0],T=D[1],E=P7(v,t),O=DS(e.container),k=DS(e.target),j=A.useState(!e.show),F=j[0],B=j[1],R=w7(k,g,N7({placement:a,enableEvents:!!e.show,containerPadding:s||5,flip:n,offset:r,arrowElement:S,popperConfig:d})),z=R.styles,H=R.attributes,Y=$y(R,["styles","attributes"]);e.show?F&&B(!1):!e.transition&&!F&&B(!0);var U=function(){B(!0),e.onExited&&e.onExited.apply(e,arguments)},J=e.show||p&&!F;if(C7(g,e.onHide,{disabled:!e.rootClose||e.rootCloseDisabled,clickTrigger:e.rootCloseEvent}),!J)return null;var Q=e.children(An({},Y,{show:!!e.show,props:An({},H.popper,{style:z.popper,ref:E}),arrowProps:An({},H.arrow,{style:z.arrow,ref:T})}));if(p){var le=e.onExit,pe=e.onExiting,ie=e.onEnter,se=e.onEntering,fe=e.onEntered;Q=$.createElement(p,{in:e.show,appear:!0,onExit:le,onExiting:pe,onExited:U,onEnter:ie,onEntering:se,onEntered:fe},Q)}return O?T1.createPortal(Q,O):null});z1.displayName="Overlay";z1.propTypes={show:Ae.bool,placement:Ae.oneOf(x1),target:Ae.any,container:Ae.any,flip:Ae.bool,children:Ae.func.isRequired,containerPadding:Ae.number,popperConfig:Ae.object,rootClose:Ae.bool,rootCloseEvent:Ae.oneOf(["click","mousedown"]),rootCloseDisabled:Ae.bool,onHide:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a-1}var J7=q7,K7=Jy;function Q7(e,t){var n=this.__data__,r=K7(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var X7=Q7,eP=R7,tP=V7,nP=$7,rP=J7,aP=X7;function Qd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++tc))return!1;var p=o.get(e),m=o.get(t);if(p&&m)return p==t&&m==e;var g=-1,v=!0,D=n&gL?new fL:void 0;for(o.set(e,t),o.set(t,e);++g0&&n(c)?t>1?pC(c,t-1,n,r,a):MY(a,c):r||(a[a.length]=c)}return a}var mC=pC;function kY(e){return function(t,n,r){for(var a=-1,o=Object(t),s=r(t),c=s.length;c--;){var d=s[e?c:++a];if(n(o[d],d,o)===!1)break}return t}}var AY=kY,FY=AY,OY=FY(),PY=OY,jY=PY,LY=Vp;function RY(e,t){return e&&jY(e,t,LY)}var nb=RY,BY=Yp;function _Y(e,t){return function(n,r){if(n==null)return n;if(!BY(n))return e(n,r);for(var a=n.length,o=t?a:-1,s=Object(n);(t?o--:++ot||o&&s&&d&&!c&&!p||r&&s&&d||!n&&d||!a)return 1;if(!r&&!o&&!p&&e=c)return d;var p=n[r];return d*(p=="desc"?-1:1)}}return e.index-t.index}var tz=ez,W0=tb,nz=av,rz=iv,az=GY,oz=JY,iz=tv,sz=tz,lz=ov,uz=fo;function cz(e,t,n){t.length?t=W0(t,function(o){return uz(o)?function(s){return nz(s,o.length===1?o[0]:o)}:o}):t=[lz];var r=-1;t=W0(t,iz(rz));var a=az(e,function(o,s,c){var d=W0(t,function(p){return p(o)});return{criteria:d,index:++r,value:o}});return oz(a,function(o,s){return sz(o,s,n)})}var dz=cz;function fz(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hz=fz,pz=hz,XS=Math.max;function mz(e,t,n){return t=XS(t===void 0?e.length-1:t,0),function(){for(var r=arguments,a=-1,o=XS(r.length-t,0),s=Array(o);++a0){if(++t>=Tz)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Mz=xz,Nz=Iz,kz=Mz,Az=kz(Nz),vC=Az,Fz=ov,Oz=gC,Pz=vC;function jz(e,t){return Pz(Oz(e,t,Fz),e+"")}var wC=jz,Lz=mC,Rz=dz,Bz=wC,t2=qy,_z=Bz(function(e,t){if(e==null)return[];var n=t.length;return n>1&&t2(e,t[0],t[1])?t=[]:n>2&&t2(t[0],t[1],t[2])&&(t=[t[0]]),Rz(e,Lz(t,1),[])}),Hz=_z;const Yz=er(Hz);function Vw(e,t){var n=H1(e);return n?n.innerWidth:t?e.clientWidth:ku(e).width}function bC(e){return TE(e)||_E(e)||P1(e)||EE()}function zz(e,t){for(var n=-1,r=e==null?0:e.length;++n1),o}),OW(e,LW(e),n),r&&(n=kW(n,RW|BW|_W,PW));for(var a=t.length;a--;)AW(n,t[a]);return n}),YW=HW;const zW=er(YW);var UW=wC,VW=Hp,ZW=qy,WW=sv,kC=Object.prototype,$W=kC.hasOwnProperty,GW=UW(function(e,t){e=Object(e);var n=-1,r=t.length,a=r>2?t[2]:void 0;for(a&&ZW(t[0],t[1],a)&&(r=1);++n0&&(c=c[0]),d=(c=c.filter(function(m){return m}))[0];for(var p=1;p2?r-2:0),o=2;o2&&arguments[2]!==void 0?arguments[2]:"day",r=e,a=[];Gd(r,t,n);)a.push(r),r=Ro(r,1,n);return a}function C$(e,t){return t==null&&e==null?null:(t==null&&(t=new Date),e==null&&(e=new Date),e=Mr(e,"day"),e=hp(e,hp(t)),e=jd(e,jd(t)),e=fp(e,fp(t)),dp(e,dp(t)))}function p2(e){return hp(e)===0&&jd(e)===0&&fp(e)===0&&dp(e)===0}function x$(e,t,n,r){return n==="day"&&(n="date"),Math.abs(oS[n](e,void 0,r)-oS[n](t,void 0,r))}function ob(e,t,n){return!n||n==="milliseconds"?Math.abs(+e-+t):Math.round(Math.abs(+Mr(e,n)/h2[n]-+Mr(t,n)/h2[n]))}var M$=Ae.oneOfType([Ae.string,Ae.func]);function N$(e,t,n,r,a){var o=typeof r=="function"?r(n,a,e):t.call(e,n,r,a);return op(o==null||typeof o=="string","`localizer format(..)` must return a string, null, or undefined"),o}function k$(e,t,n){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,t+n,0,0)}function ib(e,t){return e.getTimezoneOffset()-t.getTimezoneOffset()}function A$(e,t){return ob(e,t,"minutes")+ib(e,t)}function F$(e){var t=Mr(e,"day");return ob(t,e,"minutes")+ib(t,e)}function O$(e,t){return L1(e,t,"day")}function P$(e,t,n){var r=Bp(e,t,"minutes");return r?_p(t,n,"minutes"):Gy(t,n,"minutes")}function Zw(e,t){return x$(e,t,"day")}function j$(e){var t=e.evtA,n=t.start,r=t.end,a=t.allDay,o=e.evtB,s=o.start,c=o.end,d=o.allDay,p=+Mr(n,"day")-+Mr(s,"day"),m=Zw(n,r),g=Zw(s,c);return p||g-m||!!d-!!a||+n-+s||+r-+c}function L$(e){var t=e.event,n=t.start,r=t.end,a=e.range,o=a.start,s=a.end,c=Mr(n,"day"),d=Gd(c,s,"day"),p=j1(c,r,"minutes"),m=p?Gy(r,o,"minutes"):_p(r,o,"minutes");return d&&m}function R$(e,t){return Bp(e,t,"day")}function B$(e,t){return p2(e)&&p2(t)}var _$=yr(function e(t){var n=this;gr(this,e),op(typeof t.format=="function","date localizer `format(..)` must be a function"),op(typeof t.firstOfWeek=="function","date localizer `firstOfWeek(..)` must be a function"),this.propType=t.propType||M$,this.formats=t.formats,this.format=function(){for(var r=arguments.length,a=new Array(r),o=0;o1,pe=E.eventProp(s,J,U,c),ie=$.createElement("div",{className:"rbc-event-content",title:Y||void 0},j?$.createElement(j,{event:s,continuesPrior:D,continuesAfter:S,title:H,isAllDay:Q,localizer:v,slotStart:B,slotEnd:R}):H);return $.createElement(F,Object.assign({},this.props,{type:"date"}),$.createElement("div",Object.assign({},z,{style:rn(rn({},pe.style),a),className:Qn("rbc-event",o,pe.className,{"rbc-selected":c,"rbc-event-allday":le,"rbc-event-continues-prior":D,"rbc-event-continues-after":S}),onClick:function(fe){return p&&p(s,fe)},onDoubleClick:function(fe){return m&&m(s,fe)},onKeyDown:function(fe){return g&&g(s,fe)}}),typeof O=="function"?O(ie):ie))}}]),t}($.Component);function uv(e,t){return!e||t==null?!1:l_(e,t)}function PC(e,t){var n=e.right-e.left,r=n/t;return r}function jC(e,t,n,r){var a=PC(e,r);return n?r-1-Math.floor((t-e.left)/a):Math.floor((t-e.left)/a)}function Z$(e,t){var n=t.x,r=t.y;return r>=e.top&&r<=e.bottom&&n>=e.left&&n<=e.right}function W$(e,t,n,r,a){var o=-1,s=-1,c=r-1,d=PC(t,r),p=jC(t,n.x,a,r),m=t.topn.y,g=t.tope.y,v=e.y>t.bottom,D=t.top>e.y,S=n.topt.bottom;return S&&(o=0,s=c),m&&(D?(o=0,s=p):v&&(o=p,s=c)),g&&(o=s=a?c-Math.floor((e.x-t.left)/d):Math.floor((e.x-t.left)/d),m?pk?s-O-z:s+z+p,Y=B>j?c+R-E+d:c+R;return{topOffset:H,leftOffset:Y}}function G$(e){var t=e.containerRef,n=e.accessors,r=e.getters,a=e.selected,o=e.components,s=e.localizer,c=e.position,d=e.show,p=e.events,m=e.slotStart,g=e.slotEnd,v=e.onSelect,D=e.onDoubleClick,S=e.onKeyPress,T=e.handleDragStart,E=e.popperRef,O=e.target,k=e.offset;U$({ref:E,callback:d}),A.useLayoutEffect(function(){var B=$$({target:O,offset:k,container:t.current,box:E.current}),R=B.topOffset,z=B.leftOffset;E.current.style.top="".concat(R,"px"),E.current.style.left="".concat(z,"px")},[k.x,k.y,O]);var j=c.width,F={minWidth:j+j/2};return $.createElement("div",{style:F,className:"rbc-overlay",ref:E},$.createElement("div",{className:"rbc-overlay-header"},s.format(m,"dayHeaderFormat")),p.map(function(B,R){return $.createElement(OC,{key:R,type:"popup",localizer:s,event:B,getters:r,onSelect:v,accessors:n,components:o,onDoubleClick:D,onKeyPress:S,continuesPrior:s.lt(n.end(B),m,"day"),continuesAfter:s.gte(n.start(B),g,"day"),slotStart:m,slotEnd:g,selected:uv(B,a),draggable:!0,onDragStart:function(){return T(B)},onDragEnd:function(){return d()}})}))}var LC=$.forwardRef(function(e,t){return $.createElement(G$,Object.assign({},e,{popperRef:t}))});LC.propTypes={accessors:Ae.object.isRequired,getters:Ae.object.isRequired,selected:Ae.object,components:Ae.object.isRequired,localizer:Ae.object.isRequired,position:Ae.object.isRequired,show:Ae.func.isRequired,events:Ae.array.isRequired,slotStart:Ae.instanceOf(Date).isRequired,slotEnd:Ae.instanceOf(Date),onSelect:Ae.func,onDoubleClick:Ae.func,onKeyPress:Ae.func,handleDragStart:Ae.func,style:Ae.object,offset:Ae.shape({x:Ae.number,y:Ae.number})};function q$(e){var t=e.containerRef,n=e.popupOffset,r=n===void 0?5:n,a=e.overlay,o=e.accessors,s=e.localizer,c=e.components,d=e.getters,p=e.selected,m=e.handleSelectEvent,g=e.handleDoubleClickEvent,v=e.handleKeyPressEvent,D=e.handleDragStart,S=e.onHide,T=e.overlayDisplay,E=A.useRef(null);if(!a.position)return null;var O=r;isNaN(r)||(O={x:r,y:r});var k=a.position,j=a.events,F=a.date,B=a.end;return $.createElement(j7,{rootClose:!0,flip:!0,show:!0,placement:"bottom",onHide:S,target:a.target},function(R){var z=R.props;return $.createElement(LC,Object.assign({},z,{containerRef:t,ref:E,target:a.target,offset:O,accessors:o,getters:d,selected:p,components:c,localizer:s,position:k,show:T,events:j,slotStart:F,slotEnd:B,onSelect:m,onDoubleClick:g,onKeyPress:v,handleDragStart:D}))})}var sb=$.forwardRef(function(e,t){return $.createElement(q$,Object.assign({},e,{containerRef:t}))});sb.propTypes={popupOffset:Ae.oneOfType([Ae.number,Ae.shape({x:Ae.number,y:Ae.number})]),overlay:Ae.shape({position:Ae.object,events:Ae.array,date:Ae.instanceOf(Date),end:Ae.instanceOf(Date)}),accessors:Ae.object.isRequired,localizer:Ae.object.isRequired,components:Ae.object.isRequired,getters:Ae.object.isRequired,selected:Ae.object,handleSelectEvent:Ae.func,handleDoubleClickEvent:Ae.func,handleKeyPressEvent:Ae.func,handleDragStart:Ae.func,onHide:Ae.func,overlayDisplay:Ae.func};function Lr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document;return Vh(n,e,t,{passive:!1})}function J$(e,t,n){return!e||pp(e,document.elementFromPoint(t,n))}function K$(e,t){var n=t.clientX,r=t.clientY,a=document.elementFromPoint(n,r);return lC(a,".rbc-event",e)}function Q$(e,t){var n=t.clientX,r=t.clientY,a=document.elementFromPoint(n,r);return lC(a,".rbc-show-more",e)}function Cy(e,t){return!!K$(e,t)}function X$(e,t){return!!Q$(e,t)}function wd(e){var t=e;return e.touches&&e.touches.length&&(t=e.touches[0]),{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}}var m2=5,eG=250,RC=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.global,a=r===void 0?!1:r,o=n.longPressThreshold,s=o===void 0?250:o,c=n.validContainers,d=c===void 0?[]:c;gr(this,e),this.isDetached=!1,this.container=t,this.globalMouse=!t||a,this.longPressThreshold=s,this.validContainers=d,this._listeners=Object.create(null),this._handleInitialEvent=this._handleInitialEvent.bind(this),this._handleMoveEvent=this._handleMoveEvent.bind(this),this._handleTerminatingEvent=this._handleTerminatingEvent.bind(this),this._keyListener=this._keyListener.bind(this),this._dropFromOutsideListener=this._dropFromOutsideListener.bind(this),this._dragOverFromOutsideListener=this._dragOverFromOutsideListener.bind(this),this._removeTouchMoveWindowListener=Lr("touchmove",function(){},window),this._removeKeyDownListener=Lr("keydown",this._keyListener),this._removeKeyUpListener=Lr("keyup",this._keyListener),this._removeDropFromOutsideListener=Lr("drop",this._dropFromOutsideListener),this._removeDragOverFromOutsideListener=Lr("dragover",this._dragOverFromOutsideListener),this._addInitialEventListener()}return yr(e,[{key:"on",value:function(n,r){var a=this._listeners[n]||(this._listeners[n]=[]);return a.push(r),{remove:function(){var s=a.indexOf(r);s!==-1&&a.splice(s,1)}}}},{key:"emit",value:function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o0&&arguments[0]!==void 0?arguments[0]:0;return gs(e)!=="object"&&(e={top:e,left:e,right:e,bottom:e}),e}function g2(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=Ru(e),a=r.top,o=r.left,s=r.right,c=s===void 0?o:s,d=r.bottom,p=d===void 0?a:d,m=Ru(t),g=m.top,v=m.left,D=m.right,S=D===void 0?v:D,T=m.bottom,E=T===void 0?g:T;return!(p-nE||c-nS)}function Ru(e){if(!e.getBoundingClientRect)return e;var t=e.getBoundingClientRect(),n=t.left+y2("left"),r=t.top+y2("top");return{top:r,left:n,right:(e.offsetWidth||0)+n,bottom:(e.offsetHeight||0)+r}}function y2(e){if(e==="left")return window.pageXOffset||document.body.scrollLeft||0;if(e==="top")return window.pageYOffset||document.body.scrollTop||0}var nG=function(e){ta(t,e);function t(n,r){var a;return gr(this,t),a=ea(this,t,[n,r]),a.state={selecting:!1},a.containerRef=A.createRef(),a}return yr(t,[{key:"componentDidMount",value:function(){this.props.selectable&&this._selectable()}},{key:"componentWillUnmount",value:function(){this._teardownSelectable()}},{key:"componentDidUpdate",value:function(r){!r.selectable&&this.props.selectable&&this._selectable(),r.selectable&&!this.props.selectable&&this._teardownSelectable()}},{key:"render",value:function(){var r=this.props,a=r.range,o=r.getNow,s=r.getters,c=r.date,d=r.components.dateCellWrapper,p=r.localizer,m=this.state,g=m.selecting,v=m.startIdx,D=m.endIdx,S=o();return $.createElement("div",{className:"rbc-row-bg",ref:this.containerRef},a.map(function(T,E){var O=g&&E>=v&&E<=D,k=s.dayProp(T),j=k.className,F=k.style;return $.createElement(d,{key:E,value:T,range:a},$.createElement("div",{style:F,className:Qn("rbc-day-bg",j,O&&"rbc-selected-cell",p.isSameDate(T,S)&&"rbc-today",c&&p.neq(c,T,"month")&&"rbc-off-range-bg")}))}))}},{key:"_selectable",value:function(){var r=this,a=this.containerRef.current,o=this._selector=new RC(this.props.container,{longPressThreshold:this.props.longPressThreshold}),s=function(d,p){if(!Cy(a,d)&&!X$(a,d)){var m=Ru(a),g=r.props,v=g.range,D=g.rtl;if(Z$(m,d)){var S=jC(m,d.x,D,v.length);r._selectSlot({startIdx:S,endIdx:S,action:p,box:d})}}r._initial={},r.setState({selecting:!1})};o.on("selecting",function(c){var d=r.props,p=d.range,m=d.rtl,g=-1,v=-1;if(r.state.selecting||(yn(r.props.onSelectStart,[c]),r._initial={x:c.x,y:c.y}),o.isSelected(a)){var D=Ru(a),S=W$(r._initial,D,c,p.length,m);g=S.startIdx,v=S.endIdx}r.setState({selecting:!0,startIdx:g,endIdx:v})}),o.on("beforeSelect",function(c){if(r.props.selectable==="ignoreEvents")return!Cy(r.containerRef.current,c)}),o.on("click",function(c){return s(c,"click")}),o.on("doubleClick",function(c){return s(c,"doubleClick")}),o.on("select",function(c){r._selectSlot(rn(rn({},r.state),{},{action:"select",bounds:c})),r._initial={},r.setState({selecting:!1}),yn(r.props.onSelectEnd,[r.state])})}},{key:"_teardownSelectable",value:function(){this._selector&&(this._selector.teardown(),this._selector=null)}},{key:"_selectSlot",value:function(r){var a=r.endIdx,o=r.startIdx,s=r.action,c=r.bounds,d=r.box;a!==-1&&o!==-1&&this.props.onSelectSlot&&this.props.onSelectSlot({start:o,end:a,action:s,bounds:c,box:d,resourceId:this.props.resourceId})}}]),t}($.Component),xi={propTypes:{slotMetrics:Ae.object.isRequired,selected:Ae.object,isAllDay:Ae.bool,accessors:Ae.object.isRequired,localizer:Ae.object.isRequired,components:Ae.object.isRequired,getters:Ae.object.isRequired,onSelect:Ae.func,onDoubleClick:Ae.func,onKeyPress:Ae.func},defaultProps:{segments:[],selected:{}},renderEvent:function(t,n){var r=t.selected;t.isAllDay;var a=t.accessors,o=t.getters,s=t.onSelect,c=t.onDoubleClick,d=t.onKeyPress,p=t.localizer,m=t.slotMetrics,g=t.components,v=t.resizable,D=m.continuesPrior(n),S=m.continuesAfter(n);return $.createElement(OC,{event:n,getters:o,localizer:p,accessors:a,components:g,onSelect:s,onDoubleClick:c,onKeyPress:d,continuesPrior:D,continuesAfter:S,slotStart:m.first,slotEnd:m.last,selected:uv(n,r),resizable:v})},renderSpan:function(t,n,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:" ",o=Math.abs(n)/t*100+"%";return $.createElement("div",{key:r,className:"rbc-row-segment",style:{WebkitFlexBasis:o,flexBasis:o,maxWidth:o}},a)}},BC=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){var r=this,a=this.props,o=a.segments,s=a.slotMetrics.slots,c=a.className,d=1;return $.createElement("div",{className:Qn(c,"rbc-row")},o.reduce(function(p,m,g){var v=m.event,D=m.left,S=m.right,T=m.span,E="_lvl_"+g,O=D-d,k=xi.renderEvent(r.props,v);return O&&p.push(xi.renderSpan(s,O,"".concat(E,"_gap"))),p.push(xi.renderSpan(s,T,E,k)),d=S+1,p},[]))}}]),t}($.Component);BC.defaultProps=rn({},xi.defaultProps);function _C(e){var t=e.dateRange,n=e.unit,r=n===void 0?"day":n,a=e.localizer;return{first:t[0],last:a.add(t[t.length-1],1,r)}}function rG(e,t,n,r){var a=_C({dateRange:t,localizer:r}),o=a.first,s=a.last,c=r.diff(o,s,"day"),d=r.max(r.startOf(n.start(e),"day"),o),p=r.min(r.ceil(n.end(e),"day"),s),m=uY(t,function(v){return r.isSameDate(v,d)}),g=r.diff(d,p,"day");return g=Math.min(g,c),g=Math.max(g-r.segmentOffset,1),{event:e,span:g,left:m+1,right:Math.max(m+g,1)}}function HC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1/0,n,r,a,o=[],s=[];for(n=0;n=t?s.push(a):(o[r]||(o[r]=[])).push(a)}for(n=0;n=e.left})}function oG(e,t,n){var r=ey(e),a=[],o=[];r.forEach(function(d){var p=t.start(d),m=t.end(d);n.daySpan(p,m)>1?a.push(d):o.push(d)});var s=a.sort(function(d,p){return Ww(d,p,t,n)}),c=o.sort(function(d,p){return Ww(d,p,t,n)});return[].concat(ey(s),ey(c))}function Ww(e,t,n,r){var a={start:n.start(e),end:n.end(e),allDay:n.allDay(e)},o={start:n.start(t),end:n.end(t),allDay:n.allDay(t)};return r.sortEvents({evtA:a,evtB:o})}var YC=function(t,n){return t.left<=n&&t.right>=n},v2=function(t,n){return t.filter(function(r){return YC(r,n)}).map(function(r){return r.event})},zC=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){for(var r=this.props,a=r.segments,o=r.slotMetrics.slots,s=HC(a).levels[0],c=1,d=1,p=[];c<=o;){var m="_lvl_"+c,g=s.filter(function(k){return YC(k,c)})[0]||{},v=g.event,D=g.left,S=g.right,T=g.span;if(!v){c++;continue}var E=Math.max(0,D-d);if(this.canRenderSlotEvent(D,T)){var O=xi.renderEvent(this.props,v);E&&p.push(xi.renderSpan(o,E,m+"_gap")),p.push(xi.renderSpan(o,T,m,O)),d=c=S+1}else E&&p.push(xi.renderSpan(o,E,m+"_gap")),p.push(xi.renderSpan(o,1,m,this.renderShowMore(a,c))),d=c+=1}return $.createElement("div",{className:"rbc-row"},p)}},{key:"canRenderSlotEvent",value:function(r,a){var o=this.props.segments;return DY(r,r+a).every(function(s){var c=v2(o,s).length;return c===1})}},{key:"renderShowMore",value:function(r,a){var o=this,s=this.props,c=s.localizer,d=s.slotMetrics,p=d.getEventsForSlot(a),m=v2(r,a),g=m.length;return g?$.createElement("button",{type:"button",key:"sm_"+a,className:Qn("rbc-button-link","rbc-show-more"),onClick:function(D){return o.showMore(a,D)}},c.messages.showMore(g,m,p)):!1}},{key:"showMore",value:function(r,a){a.preventDefault(),a.stopPropagation(),this.props.onShowMore(r,a.target)}}]),t}($.Component);zC.defaultProps=rn({},xi.defaultProps);var iG=function(t){var n=t.children;return $.createElement("div",{className:"rbc-row-content-scroll-container"},n)},sG=function(t,n){return t.left<=n&&t.right>=n},lG=function(t,n){return t[0].range===n[0].range&&t[0].events===n[0].events};function UC(){return hC(function(e){for(var t=e.range,n=e.events,r=e.maxRows,a=e.minRows,o=e.accessors,s=e.localizer,c=_C({dateRange:t,localizer:s}),d=c.first,p=c.last,m=n.map(function(T){return rG(T,t,o,s)}),g=HC(m,Math.max(r-1,1)),v=g.levels,D=g.extra,S=D.length>0?a-1:a;v.length1&&arguments[1]!==void 0?arguments[1]:0;if(o.lt(F,t,"minutes"))return v[0];if(o.gt(F,n,"minutes"))return v[v.length-1];var R=o.diff(t,F,"minutes");return v[(R-R%r)/r+B]},startsBeforeDay:function(F){return o.lt(F,t,"day")},startsAfterDay:function(F){return o.gt(F,n,"day")},startsBefore:function(F){return o.lt(o.merge(t,F),t,"minutes")},startsAfter:function(F){return o.gt(o.merge(n,F),n,"minutes")},getRange:function(F,B,R,z){R||(F=o.min(n,o.max(t,F))),z||(B=o.min(n,o.max(t,B)));var H=k(F),Y=k(B),U=Y>r*m&&!o.eq(n,B)?(H-r)/(r*m)*100:H/(r*m)*100;return{top:U,height:Y/(r*m)*100-U,start:k(F),startDate:F,end:k(B),endDate:B}},getCurrentTimePosition:function(F){var B=k(F),R=B/(r*m)*100;return R}}}var fG=function(){function e(t,n){var r=n.accessors,a=n.slotMetrics;gr(this,e);var o=a.getRange(r.start(t),r.end(t)),s=o.start,c=o.startDate,d=o.end,p=o.endDate,m=o.top,g=o.height;this.start=s,this.end=d,this.startMs=+c,this.endMs=+p,this.top=m,this.height=g,this.data=t}return yr(e,[{key:"_width",get:function(){if(this.rows){var n=this.rows.reduce(function(a,o){return Math.max(a,o.leaves.length+1)},0)+1;return 100/n}if(this.leaves){var r=100-this.container._width;return r/(this.leaves.length+1)}return this.row._width}},{key:"width",get:function(){var n=this._width,r=Math.min(100,this._width*1.7);if(this.rows)return r;if(this.leaves)return this.leaves.length>0?r:n;var a=this.row.leaves,o=a.indexOf(this);return o===a.length-1?n:r}},{key:"xOffset",get:function(){if(this.rows)return 0;if(this.leaves)return this.container._width;var n=this.row,r=n.leaves,a=n.xOffset,o=n._width,s=r.indexOf(this)+1;return a+s*o}}]),e}();function hG(e,t,n){return Math.abs(t.start-e.start)e.start&&t.start0;){var r=t.shift();n.push(r);for(var a=0;ao.startMs)){if(a>0){var s=t.splice(a,1)[0];n.push(s)}break}}}return n}function ZC(e){for(var t=e.events,n=e.minimumStartDifference,r=e.slotMetrics,a=e.accessors,o=t.map(function(m){return new fG(m,{slotMetrics:r,accessors:a})}),s=pG(o),c=[],d=function(){var g=s[p],v=c.find(function(T){return T.end>g.start||Math.abs(g.start-T.start)=0;S--)hG(v.rows[S],g,n)&&(D=v.rows[S]);D?(D.leaves.push(g),g.row=D):(g.leaves=[],v.rows.push(g))},p=0;p-1)){t=t>e.friends[r].idx?t:e.friends[r].idx,n.push(e.friends[r]);var a=WC(e.friends[r],t,n);t=t>a?t:a}return t}function mG(e){var t=e.events,n=e.minimumStartDifference,r=e.slotMetrics,a=e.accessors,o=ZC({events:t,minimumStartDifference:n,slotMetrics:r,accessors:a});o.sort(function(ie,se){return ie=ie.style,se=se.style,ie.top!==se.top?ie.top>se.top?1:-1:ie.height!==se.height?ie.top+ie.height=p&&S<=m||S>p&&S<=m||D>=p&&Dle?J:le}J<=U.idx&&(U.size=100-U.idx*U.size);var pe=U.idx===0?0:3;U.style.width="calc(".concat(U.size,"% - ").concat(pe,"px)"),U.style.height="calc(".concat(U.style.height,"% - 2px)"),U.style.xOffset="calc(".concat(U.style.left,"% + ").concat(pe,"px)")}return o}var b2={overlap:ZC,"no-overlap":mG};function gG(e){return!!(e&&e.constructor&&e.call&&e.apply)}function yG(e){e.events,e.minimumStartDifference,e.slotMetrics,e.accessors;var t=e.dayLayoutAlgorithm,n=t;return t in b2&&(n=b2[t]),gG(n)?n.apply(this,arguments):[]}var $C=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){var r=this.props,a=r.renderSlot,o=r.resource,s=r.group,c=r.getters,d=r.components,p=d===void 0?{}:d,m=p.timeSlotWrapper,g=m===void 0?ds:m,v=c?c.slotGroupProp(s):{};return $.createElement("div",Object.assign({className:"rbc-timeslot-group"},v),s.map(function(D,S){var T=c?c.slotProp(D,o):{};return $.createElement(g,{key:S,value:D,resource:o},$.createElement("div",Object.assign({},T,{className:Qn("rbc-time-slot",T.className)}),a&&a(D,S)))}))}}]),t}(A.Component);function Rg(e){return typeof e=="string"?e:e+"%"}function vG(e){var t=e.style,n=e.className,r=e.event,a=e.accessors,o=e.rtl,s=e.selected,c=e.label,d=e.continuesPrior,p=e.continuesAfter,m=e.getters,g=e.onClick,v=e.onDoubleClick,D=e.isBackgroundEvent,S=e.onKeyPress,T=e.components,E=T.event,O=T.eventWrapper,k=a.title(r),j=a.tooltip(r),F=a.end(r),B=a.start(r),R=m.eventProp(r,B,F,s),z=[$.createElement("div",{key:"1",className:"rbc-event-label"},c),$.createElement("div",{key:"2",className:"rbc-event-content"},E?$.createElement(E,{event:r,title:k}):k)],H=t.height,Y=t.top,U=t.width,J=t.xOffset,Q=rn(rn({},R.style),{},Iu({top:Rg(Y),height:Rg(H),width:Rg(U)},o?"right":"left",Rg(J)));return $.createElement(O,Object.assign({type:"time"},e),$.createElement("div",{role:"button",tabIndex:0,onClick:g,onDoubleClick:v,style:Q,onKeyDown:S,title:j?(typeof c=="string"?c+": ":"")+j:void 0,className:Qn(D?"rbc-background-event":"rbc-event",n,R.className,{"rbc-selected":s,"rbc-event-continues-earlier":d,"rbc-event-continues-later":p})},z))}var wG=function(t){var n=t.children,r=t.className,a=t.style,o=t.innerRef;return $.createElement("div",{className:r,style:a,ref:o},n)},bG=$.forwardRef(function(e,t){return $.createElement(wG,Object.assign({},e,{innerRef:t}))}),DG=["dayProp"],SG=["eventContainerWrapper"],GC=function(e){ta(t,e);function t(){var n;gr(this,t);for(var r=arguments.length,a=new Array(r),o=0;o0&&arguments[0]!==void 0?arguments[0]:!1;!this.intervalTriggered&&!a&&this.positionTimeIndicator(),this._timeIndicatorTimeout=window.setTimeout(function(){r.intervalTriggered=!0,r.positionTimeIndicator(),r.setTimeIndicatorPositionUpdateInterval()},6e4)}},{key:"clearTimeIndicatorInterval",value:function(){this.intervalTriggered=!1,window.clearTimeout(this._timeIndicatorTimeout)}},{key:"positionTimeIndicator",value:function(){var r=this.props,a=r.min,o=r.max,s=r.getNow,c=s();if(c>=a&&c<=o){var d=this.slotMetrics.getCurrentTimePosition(c);this.intervalTriggered=!0,this.setState({timeIndicatorPosition:d})}else this.clearTimeIndicatorInterval()}},{key:"render",value:function(){var r=this.props,a=r.date,o=r.max,s=r.rtl,c=r.isNow,d=r.resource,p=r.accessors,m=r.localizer,g=r.getters,v=g.dayProp,D=Fi(g,DG),S=r.components,T=S.eventContainerWrapper,E=Fi(S,SG),O=this.slotMetrics,k=this.state,j=k.selecting,F=k.top,B=k.height,R=k.startDate,z=k.endDate,H={start:R,end:z},Y=v(o),U=Y.className,J=Y.style,Q=E.dayColumnWrapper||bG;return $.createElement(Q,{ref:this.containerRef,date:a,style:J,className:Qn(U,"rbc-day-slot","rbc-time-column",c&&"rbc-now",c&&"rbc-today",j&&"rbc-slot-selecting"),slotMetrics:O},O.groups.map(function(le,pe){return $.createElement($C,{key:pe,group:le,resource:d,getters:D,components:E})}),$.createElement(T,{localizer:m,resource:d,accessors:p,getters:D,components:E,slotMetrics:O},$.createElement("div",{className:Qn("rbc-events-container",s&&"rtl")},this.renderEvents({events:this.props.backgroundEvents,isBackgroundEvent:!0}),this.renderEvents({events:this.props.events}))),j&&$.createElement("div",{className:"rbc-slot-selection",style:{top:F,height:B}},$.createElement("span",null,m.format(H,"selectRangeFormat"))),c&&this.intervalTriggered&&$.createElement("div",{className:"rbc-current-time-indicator",style:{top:"".concat(this.state.timeIndicatorPosition,"%")}}))}}]),t}($.Component);GC.defaultProps={dragThroughEvents:!0,timeslots:2};function IG(e){var t=e.min,n=e.max,r=e.localizer;return r.getTimezoneOffset(t)!==r.getTimezoneOffset(n)?{start:r.add(t,-1,"day"),end:r.add(n,-1,"day")}:{start:t,end:n}}var TG=function(t){var n=t.min,r=t.max,a=t.timeslots,o=t.step,s=t.localizer,c=t.getNow,d=t.resource,p=t.components,m=t.getters,g=t.gutterRef,v=p.timeGutterWrapper,D=A.useMemo(function(){return IG({min:n,max:r,localizer:s})},[n==null?void 0:n.toISOString(),r==null?void 0:r.toISOString(),s]),S=D.start,T=D.end,E=A.useState(lb({min:S,max:T,timeslots:a,step:o,localizer:s})),O=fs(E,2),k=O[0],j=O[1];A.useEffect(function(){k&&j(k.update({min:S,max:T,timeslots:a,step:o,localizer:s}))},[S==null?void 0:S.toISOString(),T==null?void 0:T.toISOString(),a,o]);var F=A.useCallback(function(B,R){if(R)return null;var z=k.dateIsInGroup(c(),R);return $.createElement("span",{className:Qn("rbc-label",z&&"rbc-now")},s.format(B,"timeGutterFormat"))},[k,s,c]);return $.createElement(v,{slotMetrics:k},$.createElement("div",{className:"rbc-time-gutter rbc-time-column",ref:g},k.groups.map(function(B,R){return $.createElement($C,{key:R,group:B,resource:d,components:p,renderSlot:F,getters:m})})))},EG=$.forwardRef(function(e,t){return $.createElement(TG,Object.assign({gutterRef:t},e))}),CG=function(t){var n=t.label;return $.createElement($.Fragment,null,n)},xG=function(e){ta(t,e);function t(){var n;gr(this,t);for(var r=arguments.length,a=new Array(r),o=0;oa.clientHeight;r.state.isOverflowing!==o&&(r._updatingOverflow=!0,r.setState({isOverflowing:o},function(){r._updatingOverflow=!1}))}}},r.memoizedResources=hC(function(a,o){return MG(a,o)}),r.state={gutterWidth:void 0,isOverflowing:null},r.scrollRef=$.createRef(),r.contentRef=$.createRef(),r.containerRef=$.createRef(),r._scrollRatio=null,r.gutterRef=A.createRef(),r}return yr(t,[{key:"getSnapshotBeforeUpdate",value:function(){return this.checkOverflow(),null}},{key:"componentDidMount",value:function(){this.props.width==null&&this.measureGutter(),this.calculateScroll(),this.applyScroll(),window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),pS(this.rafHandle),this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest)}},{key:"componentDidUpdate",value:function(){this.applyScroll()}},{key:"renderEvents",value:function(r,a,o,s){var c=this,d=this.props,p=d.min,m=d.max,g=d.components,v=d.accessors,D=d.localizer,S=d.dayLayoutAlgorithm,T=this.memoizedResources(this.props.resources,v),E=T.groupEvents(a),O=T.groupEvents(o);return T.map(function(k,j){var F=fs(k,2),B=F[0],R=F[1];return r.map(function(z,H){var Y=(E.get(B)||[]).filter(function(J){return D.inRange(z,v.start(J),v.end(J),"day")}),U=(O.get(B)||[]).filter(function(J){return D.inRange(z,v.start(J),v.end(J),"day")});return $.createElement(GC,Object.assign({},c.props,{localizer:D,min:D.merge(z,p),max:D.merge(z,m),resource:R&&B,components:g,isNow:D.isSameDate(z,s),key:j+"-"+H,date:z,events:Y,backgroundEvents:U,dayLayoutAlgorithm:S}))})})}},{key:"render",value:function(){var r,a=this.props,o=a.events,s=a.backgroundEvents,c=a.range,d=a.width,p=a.rtl,m=a.selected,g=a.getNow,v=a.resources,D=a.components,S=a.accessors,T=a.getters,E=a.localizer,O=a.min,k=a.max,j=a.showMultiDayTimes,F=a.longPressThreshold,B=a.resizable;d=d||this.state.gutterWidth;var R=c[0],z=c[c.length-1];this.slots=c.length;var H=[],Y=[],U=[];return o.forEach(function(J){if(mp(J,R,z,S,E)){var Q=S.start(J),le=S.end(J);S.allDay(J)||E.startAndEndAreDateOnly(Q,le)||!j&&!E.isSameDate(Q,le)?H.push(J):Y.push(J)}}),s.forEach(function(J){mp(J,R,z,S,E)&&U.push(J)}),H.sort(function(J,Q){return Ww(J,Q,S,E)}),$.createElement("div",{className:Qn("rbc-time-view",v&&"rbc-time-view-resources"),ref:this.containerRef},$.createElement(xG,{range:c,events:H,width:d,rtl:p,getNow:g,localizer:E,selected:m,allDayMaxRows:this.props.showAllEvents?1/0:(r=this.props.allDayMaxRows)!==null&&r!==void 0?r:1/0,resources:this.memoizedResources(v,S),selectable:this.props.selectable,accessors:S,getters:T,components:D,scrollRef:this.scrollRef,isOverflowing:this.state.isOverflowing,longPressThreshold:F,onSelectSlot:this.handleSelectAllDaySlot,onSelectEvent:this.handleSelectEvent,onShowMore:this.handleShowMore,onDoubleClickEvent:this.props.onDoubleClickEvent,onKeyPressEvent:this.props.onKeyPressEvent,onDrillDown:this.props.onDrillDown,getDrilldownView:this.props.getDrilldownView,resizable:B}),this.props.popup&&this.renderOverlay(),$.createElement("div",{ref:this.contentRef,className:"rbc-time-content",onScroll:this.handleScroll},$.createElement(EG,{date:R,ref:this.gutterRef,localizer:E,min:E.merge(R,O),max:E.merge(R,k),step:this.props.step,getNow:this.props.getNow,timeslots:this.props.timeslots,components:D,className:"rbc-time-gutter",getters:T}),this.renderEvents(c,Y,U,g())))}},{key:"renderOverlay",value:function(){var r,a,o=this,s=(r=(a=this.state)===null||a===void 0?void 0:a.overlay)!==null&&r!==void 0?r:{},c=this.props,d=c.accessors,p=c.localizer,m=c.components,g=c.getters,v=c.selected,D=c.popupOffset,S=c.handleDragStart,T=function(){return o.setState({overlay:null})};return $.createElement(sb,{overlay:s,accessors:d,localizer:p,components:m,getters:g,selected:v,popupOffset:D,ref:this.containerRef,handleKeyPressEvent:this.handleKeyPressEvent,handleSelectEvent:this.handleSelectEvent,handleDoubleClickEvent:this.handleDoubleClickEvent,handleDragStart:S,show:!!s.position,overlayDisplay:this.overlayDisplay,onHide:T})}},{key:"clearSelection",value:function(){clearTimeout(this._selectTimer),this._pendingSelection=[]}},{key:"measureGutter",value:function(){var r=this;this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest),this.measureGutterAnimationFrameRequest=window.requestAnimationFrame(function(){var a,o=(a=r.gutterRef)!==null&&a!==void 0&&a.current?Vw(r.gutterRef.current):void 0;o&&r.state.gutterWidth!==o&&r.setState({gutterWidth:o})})}},{key:"applyScroll",value:function(){if(this._scrollRatio!=null&&this.props.enableAutoScroll===!0){var r=this.contentRef.current;r.scrollTop=r.scrollHeight*this._scrollRatio,this._scrollRatio=null}}},{key:"calculateScroll",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props,a=r.min,o=r.max,s=r.scrollToTime,c=r.localizer,d=c.diff(c.merge(s,a),s,"milliseconds"),p=c.diff(a,o,"milliseconds");this._scrollRatio=d/p}}]),t}(A.Component);rf.defaultProps={step:30,timeslots:2};var NG=["date","localizer","min","max","scrollToTime","enableAutoScroll"],dv=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,c=s===void 0?o.startOf(new Date,"day"):s,d=r.max,p=d===void 0?o.endOf(new Date,"day"):d,m=r.scrollToTime,g=m===void 0?o.startOf(new Date,"day"):m,v=r.enableAutoScroll,D=v===void 0?!0:v,S=Fi(r,NG),T=t.range(a,{localizer:o});return $.createElement(rf,Object.assign({},S,{range:T,eventOffset:10,localizer:o,min:c,max:p,scrollToTime:g,enableAutoScroll:D}))}}]),t}($.Component);dv.range=function(e,t){var n=t.localizer;return[n.startOf(e,"day")]};dv.navigate=function(e,t,n){var r=n.localizer;switch(t){case Da.PREVIOUS:return r.add(e,-1,"day");case Da.NEXT:return r.add(e,1,"day");default:return e}};dv.title=function(e,t){var n=t.localizer;return n.format(e,"dayHeaderFormat")};var kG=["date","localizer","min","max","scrollToTime","enableAutoScroll"],bl=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,c=s===void 0?o.startOf(new Date,"day"):s,d=r.max,p=d===void 0?o.endOf(new Date,"day"):d,m=r.scrollToTime,g=m===void 0?o.startOf(new Date,"day"):m,v=r.enableAutoScroll,D=v===void 0?!0:v,S=Fi(r,kG),T=t.range(a,this.props);return $.createElement(rf,Object.assign({},S,{range:T,eventOffset:15,localizer:o,min:c,max:p,scrollToTime:g,enableAutoScroll:D}))}}]),t}($.Component);bl.defaultProps=rf.defaultProps;bl.navigate=function(e,t,n){var r=n.localizer;switch(t){case Da.PREVIOUS:return r.add(e,-1,"week");case Da.NEXT:return r.add(e,1,"week");default:return e}};bl.range=function(e,t){var n=t.localizer,r=n.startOfWeek(),a=n.startOf(e,"week",r),o=n.endOf(e,"week",r);return n.range(a,o)};bl.title=function(e,t){var n=t.localizer,r=bl.range(e,{localizer:n}),a=bC(r),o=a[0],s=a.slice(1);return n.format({start:o,end:s.pop()},"dayRangeHeaderFormat")};var AG=["date","localizer","min","max","scrollToTime","enableAutoScroll"];function ub(e,t){return bl.range(e,t).filter(function(n){return[6,0].indexOf(n.getDay())===-1})}var $p=function(e){ta(t,e);function t(){return gr(this,t),ea(this,t,arguments)}return yr(t,[{key:"render",value:function(){var r=this.props,a=r.date,o=r.localizer,s=r.min,c=s===void 0?o.startOf(new Date,"day"):s,d=r.max,p=d===void 0?o.endOf(new Date,"day"):d,m=r.scrollToTime,g=m===void 0?o.startOf(new Date,"day"):m,v=r.enableAutoScroll,D=v===void 0?!0:v,S=Fi(r,AG),T=ub(a,this.props);return $.createElement(rf,Object.assign({},S,{range:T,eventOffset:15,localizer:o,min:c,max:p,scrollToTime:g,enableAutoScroll:D}))}}]),t}($.Component);$p.defaultProps=rf.defaultProps;$p.range=ub;$p.navigate=bl.navigate;$p.title=function(e,t){var n=t.localizer,r=ub(e,{localizer:n}),a=bC(r),o=a[0],s=a.slice(1);return n.format({start:o,end:s.pop()},"dayRangeHeaderFormat")};function Dl(e){var t=e.accessors,n=e.components,r=e.date,a=e.events,o=e.getters,s=e.length,c=e.localizer,d=e.onDoubleClickEvent,p=e.onSelectEvent,m=e.selected,g=A.useRef(null),v=A.useRef(null),D=A.useRef(null),S=A.useRef(null),T=A.useRef(null);A.useEffect(function(){k()});var E=function(z,H,Y){var U=n.event,J=n.date;return H=H.filter(function(Q){return mp(Q,c.startOf(z,"day"),c.endOf(z,"day"),t,c)}),H.map(function(Q,le){var pe=t.title(Q),ie=t.end(Q),se=t.start(Q),fe=o.eventProp(Q,se,ie,uv(Q,m)),oe=le===0&&c.format(z,"agendaDateFormat"),we=le===0?$.createElement("td",{rowSpan:H.length,className:"rbc-agenda-date-cell"},J?$.createElement(J,{day:z,label:oe}):oe):!1;return $.createElement("tr",{key:Y+"_"+le,className:fe.className,style:fe.style},we,$.createElement("td",{className:"rbc-agenda-time-cell"},O(z,Q)),$.createElement("td",{className:"rbc-agenda-event-cell",onClick:function(G){return p&&p(Q,G)},onDoubleClick:function(G){return d&&d(Q,G)}},U?$.createElement(U,{event:Q,title:pe}):pe))},[])},O=function(z,H){var Y="",U=n.time,J=c.messages.allDay,Q=t.end(H),le=t.start(H);return t.allDay(H)||(c.eq(le,Q)?J=c.format(le,"agendaTimeFormat"):c.isSameDate(le,Q)?J=c.format({start:le,end:Q},"agendaTimeRangeFormat"):c.isSameDate(z,le)?J=c.format(le,"agendaTimeFormat"):c.isSameDate(z,Q)&&(J=c.format(Q,"agendaTimeFormat"))),c.gt(z,le,"day")&&(Y="rbc-continues-prior"),c.lt(z,Q,"day")&&(Y+=" rbc-continues-after"),$.createElement("span",{className:Y.trim()},U?$.createElement(U,{event:H,day:z,label:J}):J)},k=function(){if(T.current){var z=g.current,H=T.current.firstChild;if(H){var Y=S.current.scrollHeight>S.current.clientHeight,U=[],J=U;U=[Vw(H.children[0]),Vw(H.children[1])],(J[0]!==U[0]||J[1]!==U[1])&&(v.current.style.width=U[0]+"px",D.current.style.width=U[1]+"px"),Y?(A7(z,"rbc-header-overflowing"),z.style.marginRight=JE()+"px"):F7(z,"rbc-header-overflowing")}}},j=c.messages,F=c.add(r,s,"day"),B=c.range(r,F,"day");return a=a.filter(function(R){return mp(R,c.startOf(r,"day"),c.endOf(F,"day"),t,c)}),a.sort(function(R,z){return+t.start(R)-+t.start(z)}),$.createElement("div",{className:"rbc-agenda-view"},a.length!==0?$.createElement($.Fragment,null,$.createElement("table",{ref:g,className:"rbc-agenda-table"},$.createElement("thead",null,$.createElement("tr",null,$.createElement("th",{className:"rbc-header",ref:v},j.date),$.createElement("th",{className:"rbc-header",ref:D},j.time),$.createElement("th",{className:"rbc-header"},j.event)))),$.createElement("div",{className:"rbc-agenda-content",ref:S},$.createElement("table",{className:"rbc-agenda-table"},$.createElement("tbody",{ref:T},B.map(function(R,z){return E(R,a,z)}))))):$.createElement("span",{className:"rbc-agenda-empty"},j.noEventsInRange))}Dl.defaultProps={length:30};Dl.range=function(e,t){var n=t.length,r=n===void 0?Dl.defaultProps.length:n,a=t.localizer,o=a.add(e,r,"day");return{start:e,end:o}};Dl.navigate=function(e,t,n){var r=n.length,a=r===void 0?Dl.defaultProps.length:r,o=n.localizer;switch(t){case Da.PREVIOUS:return o.add(e,-a,"day");case Da.NEXT:return o.add(e,a,"day");default:return e}};Dl.title=function(e,t){var n=t.length,r=n===void 0?Dl.defaultProps.length:n,a=t.localizer,o=a.add(e,r,"day");return a.format({start:e,end:o},"agendaHeaderFormat")};var ny=Iu(Iu(Iu(Iu(Iu({},Qr.MONTH,cv),Qr.WEEK,bl),Qr.WORK_WEEK,$p),Qr.DAY,dv),Qr.AGENDA,Dl),FG=["action","date","today"];function OG(e,t){var n=t.action,r=t.date,a=t.today,o=Fi(t,FG);switch(e=typeof e=="string"?ny[e]:e,n){case Da.TODAY:r=a||new Date;break;case Da.DATE:break;default:op(e&&typeof e.navigate=="function","Calendar View components must implement a static `.navigate(date, action)` method.s"),r=e.navigate(r,n,o)}return r}var PG=function(e){ta(t,e);function t(){var n;gr(this,t);for(var r=arguments.length,a=new Array(r),o=0;o1)return o.map(function(c){return $.createElement("button",{type:"button",key:c,className:Qn({"rbc-active":s===c}),onClick:a.view.bind(null,c)},r[c])})}}]),t}($.Component);function jG(e,t){var n=null;return typeof t=="function"?n=t(e):typeof t=="string"&&gs(e)==="object"&&e!=null&&t in e&&(n=e[t]),n}var fl=function(t){return function(n){return jG(n,t)}},LG=["view","date","getNow","onNavigate"],RG=["view","toolbar","events","backgroundEvents","style","className","elementProps","date","getNow","length","showMultiDayTimes","onShowMore","doShowMoreDrillDown","components","formats","messages","culture"];function qC(e){if(Array.isArray(e))return e;for(var t=[],n=0,r=Object.entries(e);n0&&arguments[0]!==void 0?arguments[0]:null,te=arguments.length>1?arguments[1]:void 0,ge=hl(te);return ge?e(G).startOf(ge).toDate():e(G).toDate()}function c(){var G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,te=arguments.length>1?arguments[1]:void 0,ge=hl(te);return ge?e(G).endOf(ge).toDate():e(G).toDate()}function d(G,te,ge){var Ie=o(G,te,ge),De=fs(Ie,3),ke=De[0],Ye=De[1],Re=De[2];return ke.isSame(Ye,Re)}function p(G,te,ge){return!d(G,te,ge)}function m(G,te,ge){var Ie=o(G,te,ge),De=fs(Ie,3),ke=De[0],Ye=De[1],Re=De[2];return ke.isAfter(Ye,Re)}function g(G,te,ge){var Ie=o(G,te,ge),De=fs(Ie,3),ke=De[0],Ye=De[1],Re=De[2];return ke.isBefore(Ye,Re)}function v(G,te,ge){var Ie=o(G,te,ge),De=fs(Ie,3),ke=De[0],Ye=De[1],Re=De[2];return ke.isSameOrBefore(Ye,Re)}function D(G,te,ge){var Ie=o(G,te,ge),De=fs(Ie,3),ke=De[0],Ye=De[1],Re=De[2];return ke.isSameOrBefore(Ye,Re)}function S(G,te,ge){var Ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"day",De=hl(Ie),ke=e(G),Ye=e(te),Re=e(ge);return ke.isBetween(Ye,Re,De,"[]")}function T(G,te){var ge=e(G),Ie=e(te),De=e.min(ge,Ie);return De.toDate()}function E(G,te){var ge=e(G),Ie=e(te),De=e.max(ge,Ie);return De.toDate()}function O(G,te){if(!G&&!te)return null;var ge=e(te).format("HH:mm:ss"),Ie=e(G).startOf("day").format("MM/DD/YYYY");return e("".concat(Ie," ").concat(ge),"MM/DD/YYYY HH:mm:ss").toDate()}function k(G,te,ge){var Ie=hl(ge);return e(G).add(te,Ie).toDate()}function j(G,te){for(var ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"day",Ie=hl(ge),De=e(G).toDate(),ke=[];D(De,te);)ke.push(De),De=k(De,1,Ie);return ke}function F(G,te){var ge=hl(te),Ie=s(G,ge);return d(Ie,G)?Ie:k(Ie,1,ge)}function B(G,te){var ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"day",Ie=hl(ge),De=e(G),ke=e(te);return ke.diff(De,Ie)}function R(G){var te=e(G);return te.minutes()}function z(G){var te=G?e.localeData(G):e.localeData();return te?te.firstDayOfWeek():0}function H(G){return e(G).startOf("month").startOf("week").toDate()}function Y(G){return e(G).endOf("month").endOf("week").toDate()}function U(G){for(var te=H(G),ge=Y(G),Ie=[];D(te,ge);)Ie.push(te),te=k(te,1,"d");return Ie}function J(G,te,ge){return e(G).startOf("day").minute(te+ge).toDate()}function Q(G,te){return B(G,te,"minutes")}function le(G){var te=e(G).startOf("day"),ge=e(G);return ge.diff(te,"minutes")+a(G)}function pe(G,te){var ge=e(G),Ie=e(te);return ge.isBefore(Ie,"day")}function ie(G,te,ge){var Ie=e(te),De=e(ge);return Ie.isSameOrAfter(De,"minutes")}function se(G,te){var ge=e(G),Ie=e(te),De=e.duration(Ie.diff(ge));return De.days()}function fe(G){var te=G.evtA,ge=te.start,Ie=te.end,De=te.allDay,ke=G.evtB,Ye=ke.start,Re=ke.end,rt=ke.allDay,Ht=+s(ge,"day")-+s(Ye,"day"),Se=se(ge,Ie),Ze=se(Ye,Re);return Ht||Ze-Se||!!rt-!!De||+ge-+Ye||+Ie-+Re}function oe(G){var te=G.event,ge=te.start,Ie=te.end,De=G.range,ke=De.start,Ye=De.end,Re=e(ge).startOf("day"),rt=e(Ie),Ht=e(ke),Se=e(Ye),Ze=Re.isSameOrBefore(Se,"day"),Ke=!Re.isSame(rt,"minutes"),Je=Ke?rt.isAfter(Ht,"minutes"):rt.isSameOrAfter(Ht,"minutes");return Ze&&Je}function we(G,te){var ge=e(G),Ie=e(te);return ge.isSame(Ie,"day")}function Z(){var G=new Date,te=/-/.test(G.toString())?"-":"",ge=G.getTimezoneOffset(),Ie=Number("".concat(te).concat(Math.abs(ge))),De=e().utcOffset();return De>Ie?1:0}return new _$({formats:VG,firstOfWeek:z,firstVisibleDay:H,lastVisibleDay:Y,visibleDays:U,format:function(te,ge,Ie){return t(e(te),Ie).format(ge)},lt:g,lte:D,gt:m,gte:v,eq:d,neq:p,merge:O,inRange:S,startOf:s,endOf:c,range:j,add:k,diff:B,ceil:F,min:T,max:E,minutes:R,getSlotDate:J,getTimezoneOffset:n,getDstOffset:r,getTotalMin:Q,getMinutesFromMidnight:le,continuesPrior:pe,continuesAfter:ie,sortEvents:fe,inEventRange:oe,isSameDate:we,daySpan:se,browserTZOffset:Z})}function D2(e,t,n,r,a){const o={start:r.start(e),end:r.end(e)},s={start:t,end:n};return a.inEventRange({event:o,range:s})}function WG(e,t){return!e||t==null?!1:FI.isEqual(e,t)}const Td={PREVIOUS:"PREV",NEXT:"NEXT",TODAY:"TODAY",DATE:"DATE"};function ys({accessors:e,components:t,date:n,events:r,getters:a,length:o,localizer:s,onDoubleClickEvent:c,onSelectEvent:d,selected:p}){A.useRef(null);const m=A.useRef(null),g=A.useRef(null),v=A.useRef(null),D=A.useRef(null),[S,T]=A.useState(!1),[E,O]=A.useState(!1),k=(U,J,Q)=>{const{event:le,date:pe}=t;return J=J.filter(ie=>D2(ie,s.startOf(U,"day"),s.endOf(U,"day"),e,s)),J.map((ie,se)=>{const fe=e.title(ie),oe=e.end(ie),we=e.start(ie),Z=a.eventProp(ie,we,oe,WG(ie,p)),G=se===0&&s.format(U,"agendaDateFormat"),te=se===0?w.jsx("td",{rowSpan:J.length,className:"rbc-agenda-date-cell",children:pe?w.jsx(pe,{day:U,label:G}):G}):!1;return w.jsxs("tr",{className:Z.className,style:Z.style,children:[te,w.jsx("td",{className:"rbc-agenda-time-cell",children:j(U,ie)}),w.jsx("td",{className:"rbc-agenda-event-cell",onClick:ge=>d&&d(ie,ge),onDoubleClick:ge=>c&&c(ie,ge),children:le?w.jsx(le,{event:ie,title:fe}):fe})]},Q+"_"+se)},[])},j=(U,J)=>{const Q=t.time;let le="",pe=s.messages.allDay;const ie=e.end(J),se=e.start(J);return e.allDay(J)||(s.eq(se,ie)?pe=s.format(se,"agendaTimeFormat"):s.isSameDate(se,ie)?pe=s.format({start:se,end:ie},"agendaTimeRangeFormat"):s.isSameDate(U,se)?pe=s.format(se,"agendaTimeFormat"):s.isSameDate(U,ie)&&(pe=s.format(ie,"agendaTimeFormat"))),s.gt(U,se,"day")&&(le="rbc-continues-prior"),s.lt(U,ie,"day")&&(le+=" rbc-continues-after"),w.jsx("span",{className:le.trim(),children:Q?w.jsx(Q,{event:J,day:U,label:pe}):pe})},{messages:F}=s,B=s.add(n,-o/2,"day"),R=s.add(n,o/2,"day"),z=s.range(B,R,"day");S&&z.reverse(),r=r.filter(U=>D2(U,s.startOf(B,"day"),s.endOf(R,"day"),e,s)),r.sort((U,J)=>+e.start(U)-+e.start(J)),E&&r.reverse();const H=A.useCallback(()=>setTimeout(()=>{D.current&&Zy(D.current,{backgroundColor:"#ffffff",pixelRatio:window.devicePixelRatio*2}).then(U=>{new C.Notice(N("Image is generating..."));const J=Xe.getState().settings.AutoSaveWhenOnMobile,Q=Xe.getState().app.vault;if(J&&C.Platform.isMobile){const le=U.split("base64,")[1];Oy(le,"image/png").arrayBuffer().then(async ie=>{let se;const fe="png",oe=bs();for(const we in oe)if(oe[we]instanceof C.TFile){se=oe[we];break}se!==void 0&&await Q.createBinary(await Q.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,fe,se),ie)})}Wy({imgUrl:U})}).catch(U=>{console.error(U)})},0),[D.current,z]),Y=A.useCallback(U=>{const J=new C.Menu;J.addItem(Q=>{Q.setIcon("share-2").setTitle(N("Share")).onClick(()=>{H()})}),J.showAtMouseEvent(U.nativeEvent)},[D.current,z,H]);return w.jsx("div",{className:"rbc-agenda-view",children:r.length!==0?w.jsx($.Fragment,{children:w.jsxs("table",{ref:D,className:"rbc-agenda-table",children:[w.jsx("thead",{onContextMenu:Y,children:w.jsxs("tr",{children:[w.jsx("th",{className:"rbc-header",ref:m,onClick:()=>{T(!S)},children:F.date+(S?" 🔼":" 🔽")}),w.jsx("th",{className:"rbc-header",ref:g,onClick:()=>{O(!E)},children:F.time+(E?" 🔼":" 🔽")}),w.jsx("th",{className:"rbc-header",children:F.event})]})}),w.jsx("tbody",{ref:v,children:z.map((U,J)=>k(U,r,J))})]})}):w.jsx("span",{className:"rbc-agenda-empty",children:F.noEventsInRange})})}ys.propTypes={accessors:Ae.object.isRequired,components:Ae.object.isRequired,date:Ae.instanceOf(Date),events:Ae.array,getters:Ae.object.isRequired,length:Ae.number.isRequired,localizer:Ae.object.isRequired,onSelectEvent:Ae.func,onDoubleClickEvent:Ae.func,selected:Ae.object};ys.defaultProps={length:30};ys.range=(e,{length:t=ys.defaultProps.length,localizer:n})=>{const r=n.add(e,-t/2,"day"),a=n.add(e,t/2,"day");return{customStart:r,customEnd:a}};ys.navigate=(e,t,{length:n=ys.defaultProps.length,localizer:r})=>{switch(t){case Td.PREVIOUS:return r.add(e,-n,"day");case Td.NEXT:return r.add(e,n,"day");default:return e}};ys.title=(e,{length:t=ys.defaultProps.length,localizer:n})=>{const r=n.add(e,-t/2,"day"),a=n.add(e,t/2,"day");return n.format({start:r,end:a},"agendaHeaderFormat")};function $G(e,t){e.hoverEl.toggleClass("thino-hover-popover",!0);const n=Ap(e.hoverEl);return n.render(w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(Sa,{memo:t})})),n}function GG({event:e}){const t=e.resource,n=t.content.split(` `)[0].slice(0,20),r=$.useRef(null),a=$.useRef(null),o=$.useRef(null);A.useEffect(()=>{if(a.current)return C.setIcon(a.current,"calendar"),()=>{r.current&&(r.current=null)}},[r]);const s=A.useCallback(d=>{o.current&&(o.current.unmount(),o.current=null),o.current=d},[]),c=A.useCallback(d=>{if(!r.current||!C.Keymap.isModifier(d.nativeEvent,"Mod"))return;const p=new C.HoverPopover(Xe.getState().view,r.current,100),m=$G(p,t);s(m)},[r.current]);return w.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:c,children:[w.jsx(qG,{event:e}),w.jsx("strong",{children:n})]})}const qG=({event:e})=>{const t=$.useRef(null),n=e.resource;A.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=A.useCallback(async a=>{a.stopPropagation(),a.preventDefault(),await(async()=>{const s=await Te.updateMemo(n.id,n.content,n.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");s&&Te.editMemo(s)})()},[n==null?void 0:n.thinoType,n==null?void 0:n.id,n==null?void 0:n.content]);return w.jsx(w.Fragment,{children:w.jsxs("span",{className:"rbc-event-icon-group",children:[w.jsx("span",{className:"rbc-event-icon",ref:t,onClick:r}),w.jsx("span",{className:Xn("rbc-event-time","hidden"),children:w.jsx("span",{className:"rbc-event-time-text",children:C.moment(e.start).format("HH:mm")})})]})})};function KC({views:e,view:t,messages:n,onView:r}){return e.map(a=>w.jsx("button",{type:"button",className:Xn({"rbc-active":t===a}),onClick:()=>r(a),children:n[a]},a))}KC.propTypes={messages:Ae.object,onView:Ae.func,view:Ae.string,views:Ae.array};function QC({date:e,label:t,localizer:{messages:n},onNavigate:r,onView:a,view:o,views:s}){const c={previous:A.useRef(null),today:A.useRef(null),next:A.useRef(null)};A.useEffect(()=>{c&&(C.setIcon(c.previous.current,"chevron-left"),C.setIcon(c.today.current,"dot"),C.setIcon(c.next.current,"chevron-right"))},[c]);const d=A.useMemo(()=>w.jsxs(w.Fragment,{children:[w.jsx("button",{ref:c.previous,type:"button",onClick:()=>r(Td.PREVIOUS),"aria-label":n.previous,children:"<"}),w.jsx("button",{ref:c.today,type:"button",onClick:()=>r(Td.TODAY),"aria-label":n.today,children:"•"}),w.jsx("button",{ref:c.next,type:"button",onClick:()=>r(Td.NEXT),"aria-label":n.next,children:">"})]}),[n]);return w.jsxs("div",{className:"rbc-toolbar",children:[w.jsx("span",{className:Xn("rbc-btn-group","thino-view-custom-toolbar"),children:d}),w.jsx("span",{className:"rbc-toolbar-label",children:w.jsx(py,{type:"text",handleValueChange:p=>{r(Td.DATE,C.moment(p,"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()})}),w.jsx("span",{className:"rbc-btn-group",children:w.jsx(KC,{view:o,views:s,messages:n,onView:a})})]})}QC.propTypes={date:Ae.instanceOf(Date),label:Ae.string,localizer:Ae.object,messages:Ae.object,onNavigate:Ae.func,onView:Ae.func,view:Ae.string,views:Ae.array};function JG({event:e,children:t,showPopup:n,callRender:r,...a}){const o=A.useRef(null),s=A.useRef(null),c=A.useCallback(d=>{if(!d.isTrusted){r();return}s.current=d.nativeEvent.target,s.current&&(s.current.hasClass("rbc-event")||(s.current=s.current.closest(".rbc-event")),o.current!==null?(window.clearTimeout(o.current),o.current=null):o.current=window.setTimeout(()=>{n(e,s.current),o.current=null},250))},[e,n]);return w.jsx(w.Fragment,{children:w.jsx("div",{className:"rbc-event-wrapper","aria-describedby":"thino",onClick:c,children:t})})}const KG=ZG(C.moment),QG=({event:e})=>{const t=e.resource;return w.jsx(w.Fragment,{children:w.jsx(Sa,{memo:t})})},XG=e=>{var Q;const{thinos:t}=e,[n,r]=$.useState([]),[a,o]=$.useState((app==null?void 0:app.loadLocalStorage("thino-calendar-view"))||"month"),[s,c]=$.useState(null),d=$.useRef(null),p=$.useRef(null),[m,g]=$.useState(!1),v=A.useRef(null),[D,S]=A.useState(new Date);A.useEffect(()=>()=>{d.current&&(d.current=null),p.current&&(p.current=null),v.current&&(v.current=null)},[]),A.useEffect(()=>{const le=t.map(pe=>{const ie=C.moment(pe.createdAt,"YYYY/MM/DD HH:mm:ss"),se=ie.clone().add(1,"minute");return{title:pe.content,start:new Date(ie.format("YYYY-MM-DDTHH:mm:ss")),end:new Date(se.format("YYYY-MM-DDTHH:mm:ss")),resource:pe}});r(le)},[t]),A.useEffect(()=>{app==null||app.saveLocalStorage("thino-calendar-view",a)},[a]),A.useEffect(()=>{m&&c(t.find(le=>le.id===s.id))},[t]),A.useEffect(()=>{s&&v.current.update()},[s]),v.current=Vy(d.current,p.current,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,4]}}]});const T=A.useCallback(()=>{v.current.update(),v.current.update()},[]),E=A.useCallback((le,pe)=>{c(null),F(),v.current.state.elements.reference=pe,c(le.resource),B()},[]),O=A.useCallback(()=>{F(),c(null)},[]),k=A.useCallback((le,pe,ie)=>{var se;if(j(le),pe==="week"||pe==="day"){const fe=d.current.find(".rbc-event-wrapper");if(d.current.closest(".memolist-wrapper"),fe){(se=fe.children[0])==null||se.click();return}else{setTimeout(()=>{var we,Z;const oe=d.current.find(".rbc-event-wrapper");(Z=(we=oe==null?void 0:oe.children)==null?void 0:we[0])==null||Z.click()},0);return}}},[]),j=A.useCallback(le=>{S(le)},[S]);Pp(p,O);const F=A.useCallback(()=>{g(!1)},[g]),B=A.useCallback(()=>{v.current.update(),g(!0)},[g]),R=A.useCallback(le=>{const pe=le.resource;Qe.setEditMemoId(pe.id)},[]),z=A.useCallback(le=>{o(le)},[o]),{components:H,views:Y,messages:U}=A.useMemo(()=>({components:{toolbar:QC,eventWrapper:le=>w.jsx(JG,{...le,callRender:T,showPopup:E}),agenda:{event:QG},event:GG},views:{month:!0,agenda:ys,week:!0,day:!0},messages:{month:N("Month"),day:N("Day"),next:N("Next"),previous:N("Previous"),today:N("Today"),agenda:N("Agenda"),week:N("Week"),yesterday:N("Yesterday"),tomorrow:N("Tomorrow"),noEventsInRange:N("No thinos in range"),date:N("date"),time:N("time"),event:N("event")}}),[]),J=A.useMemo(()=>({timeGutterFormat:(le,pe,ie)=>ie.format(le,"HH:mm",pe),agendaTimeRangeFormat:({start:le,end:pe},ie,se)=>se.format(le,"HH:mm",ie)+" — "+se.format(pe,"HH:mm",ie),agendaHeaderFormat:({start:le,end:pe},ie,se)=>se.format(le,"YYYY-MM-DD")+" — "+se.format(pe,"YYYY-MM-DD")}),[]);return w.jsxs("div",{ref:d,className:"calendar-view",children:[w.jsx(_G,{date:D,messages:U,components:H,localizer:KG,events:n,views:Y,onView:z,onDoubleClickEvent:R,onNavigate:k,formats:J,defaultView:a,tooltipAccessor:null,startAccessor:"start",endAccessor:"end"}),w.jsx("div",{ref:p,style:(Q=v.current)==null?void 0:Q.styles.popper,className:Xn("thino-popup-container",m?"":"hidden"),children:s&&w.jsx(Sa,{memo:s})})]})};function vl(e,t){return typeof e=="function"?e(t):e}function Ua(e,t){return n=>{t.setState(r=>({...r,[e]:vl(n,r[e])}))}}function My(e){return e instanceof Function}function eq(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function tq(e,t){const n=[],r=a=>{a.forEach(o=>{n.push(o);const s=t(o);s!=null&&s.length&&r(s)})};return r(e),n}function ht(e,t,n){let r=[],a;return o=>{let s;n.key&&n.debug&&(s=Date.now());const c=e(o);if(!(c.length!==r.length||c.some((m,g)=>r[g]!==m)))return a;r=c;let p;if(n.key&&n.debug&&(p=Date.now()),a=t(...c),n==null||n.onChange==null||n.onChange(a),n.key&&n.debug&&n!=null&&n.debug()){const m=Math.round((Date.now()-s)*100)/100,v=Math.round((Date.now()-p)*100)/100/16,D=(S,T)=>{for(S=String(S);S.length{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[t]},key:!1,onChange:r}}function nq(e,t,n,r){var a,o;const c={...e._getDefaultColumnDef(),...t},d=c.accessorKey;let p=(a=(o=c.id)!=null?o:d?d.replace(".","_"):void 0)!=null?a:typeof c.header=="string"?c.header:void 0,m;if(c.accessorFn?m=c.accessorFn:d&&(d.includes(".")?m=v=>{let D=v;for(const T of d.split(".")){var S;D=(S=D)==null?void 0:S[T]}return D}:m=v=>v[c.accessorKey]),!p)throw new Error;let g={id:`${String(p)}`,accessorFn:m,parent:r,depth:n,columnDef:c,columns:[],getFlatColumns:ht(()=>[!0],()=>{var v;return[g,...(v=g.columns)==null?void 0:v.flatMap(D=>D.getFlatColumns())]},pt(e.options,"debugColumns")),getLeafColumns:ht(()=>[e._getOrderColumnsFn()],v=>{var D;if((D=g.columns)!=null&&D.length){let S=g.columns.flatMap(T=>T.getLeafColumns());return v(S)}return[g]},pt(e.options,"debugColumns"))};for(const v of e._features)v.createColumn==null||v.createColumn(g,e);return g}const Rr="debugHeaders";function S2(e,t,n){var r;let o={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],c=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(c),s.push(d)};return c(o),s},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(o,e)}),o}const rq={createTable:e=>{e.getHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>{var o,s;const c=(o=r==null?void 0:r.map(g=>n.find(v=>v.id===g)).filter(Boolean))!=null?o:[],d=(s=a==null?void 0:a.map(g=>n.find(v=>v.id===g)).filter(Boolean))!=null?s:[],p=n.filter(g=>!(r!=null&&r.includes(g.id))&&!(a!=null&&a.includes(g.id)));return Bg(t,[...c,...p,...d],e)},pt(e.options,Rr)),e.getCenterHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,a)=>(n=n.filter(o=>!(r!=null&&r.includes(o.id))&&!(a!=null&&a.includes(o.id))),Bg(t,n,e,"center")),pt(e.options,Rr)),e.getLeftHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var a;const o=(a=r==null?void 0:r.map(s=>n.find(c=>c.id===s)).filter(Boolean))!=null?a:[];return Bg(t,o,e,"left")},pt(e.options,Rr)),e.getRightHeaderGroups=ht(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var a;const o=(a=r==null?void 0:r.map(s=>n.find(c=>c.id===s)).filter(Boolean))!=null?a:[];return Bg(t,o,e,"right")},pt(e.options,Rr)),e.getFooterGroups=ht(()=>[e.getHeaderGroups()],t=>[...t].reverse(),pt(e.options,Rr)),e.getLeftFooterGroups=ht(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),pt(e.options,Rr)),e.getCenterFooterGroups=ht(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),pt(e.options,Rr)),e.getRightFooterGroups=ht(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),pt(e.options,Rr)),e.getFlatHeaders=ht(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,Rr)),e.getLeftFlatHeaders=ht(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,Rr)),e.getCenterFlatHeaders=ht(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,Rr)),e.getRightFlatHeaders=ht(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),pt(e.options,Rr)),e.getCenterLeafHeaders=ht(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,Rr)),e.getLeftLeafHeaders=ht(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,Rr)),e.getRightLeafHeaders=ht(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),pt(e.options,Rr)),e.getLeafHeaders=ht(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var a,o,s,c,d,p;return[...(a=(o=t[0])==null?void 0:o.headers)!=null?a:[],...(s=(c=n[0])==null?void 0:c.headers)!=null?s:[],...(d=(p=r[0])==null?void 0:p.headers)!=null?d:[]].map(m=>m.getLeafHeaders()).flat()},pt(e.options,Rr))}};function Bg(e,t,n,r){var a,o;let s=0;const c=function(v,D){D===void 0&&(D=1),s=Math.max(s,D),v.filter(S=>S.getIsVisible()).forEach(S=>{var T;(T=S.columns)!=null&&T.length&&c(S.columns,D+1)},0)};c(e);let d=[];const p=(v,D)=>{const S={depth:D,id:[r,`${D}`].filter(Boolean).join("_"),headers:[]},T=[];v.forEach(E=>{const O=[...T].reverse()[0],k=E.column.depth===S.depth;let j,F=!1;if(k&&E.column.parent?j=E.column.parent:(j=E.column,F=!0),O&&(O==null?void 0:O.column)===j)O.subHeaders.push(E);else{const B=S2(n,j,{id:[r,D,j.id,E==null?void 0:E.id].filter(Boolean).join("_"),isPlaceholder:F,placeholderId:F?`${T.filter(R=>R.column===j).length}`:void 0,depth:D,index:T.length});B.subHeaders.push(E),T.push(B)}S.headers.push(E),E.headerGroup=S}),d.push(S),D>0&&p(T,D-1)},m=t.map((v,D)=>S2(n,v,{depth:s,index:D}));p(m,s-1),d.reverse();const g=v=>v.filter(S=>S.column.getIsVisible()).map(S=>{let T=0,E=0,O=[0];S.subHeaders&&S.subHeaders.length?(O=[],g(S.subHeaders).forEach(j=>{let{colSpan:F,rowSpan:B}=j;T+=F,O.push(B)})):T=1;const k=Math.min(...O);return E+=k,S.colSpan=T,S.rowSpan=E,{colSpan:T,rowSpan:E}});return g((a=(o=d[0])==null?void 0:o.headers)!=null?a:[]),d}const _g={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},q0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),aq={getDefaultColumnDef:()=>_g,getInitialState:e=>({columnSizing:{},columnSizingInfo:q0(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Ua("columnSizing",e),onColumnSizingInfoChange:Ua("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,a;const o=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:_g.minSize,(r=o??e.columnDef.size)!=null?r:_g.size),(a=e.columnDef.maxSize)!=null?a:_g.maxSize)},e.getStart=ht(n=>[n,Qh(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((a,o)=>a+o.getSize(),0),pt(t.options,"debugColumns")),e.getAfter=ht(n=>[n,Qh(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((a,o)=>a+o.getSize(),0),pt(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...a}=n;return a})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=a=>{if(a.subHeaders.length)a.subHeaders.forEach(r);else{var o;n+=(o=a.column.getSize())!=null?o:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),a=r==null?void 0:r.getCanResize();return o=>{if(!r||!a||(o.persist==null||o.persist(),J0(o)&&o.touches&&o.touches.length>1))return;const s=e.getSize(),c=e?e.getLeafHeaders().map(O=>[O.column.id,O.column.getSize()]):[[r.id,r.getSize()]],d=J0(o)?Math.round(o.touches[0].clientX):o.clientX,p={},m=(O,k)=>{typeof k=="number"&&(t.setColumnSizingInfo(j=>{var F,B;const R=t.options.columnResizeDirection==="rtl"?-1:1,z=(k-((F=j==null?void 0:j.startOffset)!=null?F:0))*R,H=Math.max(z/((B=j==null?void 0:j.startSize)!=null?B:0),-.999999);return j.columnSizingStart.forEach(Y=>{let[U,J]=Y;p[U]=Math.round(Math.max(J+J*H,0)*100)/100}),{...j,deltaOffset:z,deltaPercentage:H}}),(t.options.columnResizeMode==="onChange"||O==="end")&&t.setColumnSizing(j=>({...j,...p})))},g=O=>m("move",O),v=O=>{m("end",O),t.setColumnSizingInfo(k=>({...k,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},D=n||typeof document<"u"?document:null,S={moveHandler:O=>g(O.clientX),upHandler:O=>{D==null||D.removeEventListener("mousemove",S.moveHandler),D==null||D.removeEventListener("mouseup",S.upHandler),v(O.clientX)}},T={moveHandler:O=>(O.cancelable&&(O.preventDefault(),O.stopPropagation()),g(O.touches[0].clientX),!1),upHandler:O=>{var k;D==null||D.removeEventListener("touchmove",T.moveHandler),D==null||D.removeEventListener("touchend",T.upHandler),O.cancelable&&(O.preventDefault(),O.stopPropagation()),v((k=O.touches[0])==null?void 0:k.clientX)}},E=oq()?{passive:!1}:!1;J0(o)?(D==null||D.addEventListener("touchmove",T.moveHandler,E),D==null||D.addEventListener("touchend",T.upHandler,E)):(D==null||D.addEventListener("mousemove",S.moveHandler,E),D==null||D.addEventListener("mouseup",S.upHandler,E)),t.setColumnSizingInfo(O=>({...O,startOffset:d,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?q0():(n=e.initialState.columnSizingInfo)!=null?n:q0())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,a)=>r+a.getSize(),0))!=null?t:0}}};let Hg=null;function oq(){if(typeof Hg=="boolean")return Hg;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Hg=e,Hg}function J0(e){return e.type==="touchstart"}const iq={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Ua("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,a;if(!t){e._queue(()=>{t=!0});return}if((r=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var a,o;e.setExpanded(r?{}:(a=(o=e.initialState)==null?void 0:o.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(o=>{const s=o.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var a;const o=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(c=>{s[c]=!0}):s=r,n=(a=n)!=null?a:!o,!o&&n)return{...s,[e.id]:!0};if(o&&!n){const{[e.id]:c,...d}=s;return d}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,a;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},XC=(e,t,n)=>{var r;const a=n.toLowerCase();return!!(!((r=e.getValue(t))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(a))};XC.autoRemove=e=>Po(e);const ex=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};ex.autoRemove=e=>Po(e);const tx=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};tx.autoRemove=e=>Po(e);const nx=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};nx.autoRemove=e=>Po(e)||!(e!=null&&e.length);const rx=(e,t,n)=>!n.some(r=>{var a;return!((a=e.getValue(t))!=null&&a.includes(r))});rx.autoRemove=e=>Po(e)||!(e!=null&&e.length);const ax=(e,t,n)=>n.some(r=>{var a;return(a=e.getValue(t))==null?void 0:a.includes(r)});ax.autoRemove=e=>Po(e)||!(e!=null&&e.length);const ox=(e,t,n)=>e.getValue(t)===n;ox.autoRemove=e=>Po(e);const ix=(e,t,n)=>e.getValue(t)==n;ix.autoRemove=e=>Po(e);const cb=(e,t,n)=>{let[r,a]=n;const o=e.getValue(t);return o>=r&&o<=a};cb.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,a=typeof n!="number"?parseFloat(n):n,o=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(a)?1/0:a;if(o>s){const c=o;o=s,s=c}return[o,s]};cb.autoRemove=e=>Po(e)||Po(e[0])&&Po(e[1]);const ls={includesString:XC,includesStringSensitive:ex,equalsString:tx,arrIncludes:nx,arrIncludesAll:rx,arrIncludesSome:ax,equals:ox,weakEquals:ix,inNumberRange:cb};function Po(e){return e==null||e===""}const sq={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Ua("columnFilters",e),onGlobalFilterChange:Ua("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?ls.includesString:typeof r=="number"?ls.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?ls.equals:Array.isArray(r)?ls.arrIncludes:ls.weakEquals},e.getFilterFn=()=>{var n,r;return My(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:ls[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,a;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var n,r,a,o;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((a=t.options.enableFilters)!=null?a:!0)&&((o=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(a=>a.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const a=e.getFilterFn(),o=r==null?void 0:r.find(m=>m.id===e.id),s=vl(n,o?o.value:void 0);if(I2(a,s,e)){var c;return(c=r==null?void 0:r.filter(m=>m.id!==e.id))!=null?c:[]}const d={id:e.id,value:s};if(o){var p;return(p=r==null?void 0:r.map(m=>m.id===e.id?d:m))!=null?p:[]}return r!=null&&r.length?[...r,d]:[d]})},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>ls.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return My(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:ls[r]},e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=a=>{var o;return(o=vl(t,a))==null?void 0:o.filter(s=>{const c=n.find(d=>d.id===s.id);if(c){const d=c.getFilterFn();if(I2(d,s.value,c))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function I2(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const lq=(e,t,n)=>n.reduce((r,a)=>{const o=a.getValue(e);return r+(typeof o=="number"?o:0)},0),uq=(e,t,n)=>{let r;return n.forEach(a=>{const o=a.getValue(e);o!=null&&(r>o||r===void 0&&o>=o)&&(r=o)}),r},cq=(e,t,n)=>{let r;return n.forEach(a=>{const o=a.getValue(e);o!=null&&(r=o)&&(r=o)}),r},dq=(e,t,n)=>{let r,a;return n.forEach(o=>{const s=o.getValue(e);s!=null&&(r===void 0?s>=s&&(r=a=s):(r>s&&(r=s),a{let n=0,r=0;if(t.forEach(a=>{let o=a.getValue(e);o!=null&&(o=+o)>=o&&(++n,r+=o)}),n)return r/n},hq=(e,t)=>{if(!t.length)return;const n=t.map(o=>o.getValue(e));if(!eq(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),a=n.sort((o,s)=>o-s);return n.length%2!==0?a[r]:(a[r-1]+a[r])/2},pq=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),mq=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,gq=(e,t)=>t.length,K0={sum:lq,min:uq,max:cq,extent:dq,mean:fq,median:hq,unique:pq,uniqueCount:mq,count:gq},yq={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Ua("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r,a,o;return(n=(r=(a=(o=e.columnDef.enableGrouping)!=null?o:!0)!=null?a:t.options.enableGrouping)!=null?r:!0)!=null?n:!!e.accessorFn},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return K0.sum;if(Object.prototype.toString.call(r)==="[object Date]")return K0.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return My(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:K0[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=n.subRows)!=null&&a.length)}}};function vq(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(o=>!t.includes(o.id));return n==="remove"?r:[...t.map(o=>e.find(s=>s.id===o)).filter(Boolean),...r]}const wq={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Ua("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ht(n=>[Qh(t,n)],n=>n.findIndex(r=>r.id===e.id),pt(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Qh(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const a=Qh(t,n);return((r=a[a.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=ht(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>a=>{let o=[];if(!(t!=null&&t.length))o=a;else{const s=[...t],c=[...a];for(;c.length&&s.length;){const d=s.shift(),p=c.findIndex(m=>m.id===d);p>-1&&o.push(c.splice(p,1)[0])}o=[...o,...c]}return vq(o,n,r)},pt(e.options,"debugTable"))}},$w=0,Gw=10,Q0=()=>({pageIndex:$w,pageSize:Gw}),bq={getInitialState:e=>({...e,pagination:{...Q0(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Ua("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,a;if(!t){e._queue(()=>{t=!0});return}if((r=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const a=o=>vl(r,o);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=r=>{var a;e.setPagination(r?Q0():(a=e.initialState.pagination)!=null?a:Q0())},e.setPageIndex=r=>{e.setPagination(a=>{let o=vl(r,a.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,s)),{...a,pageIndex:o}})},e.resetPageIndex=r=>{var a,o;e.setPageIndex(r?$w:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageIndex)!=null?a:$w)},e.resetPageSize=r=>{var a,o;e.setPageSize(r?Gw:(a=(o=e.initialState)==null||(o=o.pagination)==null?void 0:o.pageSize)!=null?a:Gw)},e.setPageSize=r=>{e.setPagination(a=>{const o=Math.max(1,vl(r,a.pageSize)),s=a.pageSize*a.pageIndex,c=Math.floor(s/o);return{...a,pageIndex:c,pageSize:o}})},e.setPageCount=r=>e.setPagination(a=>{var o;let s=vl(r,(o=e.options.pageCount)!=null?o:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...a,pageCount:s}}),e.getPageOptions=ht(()=>[e.getPageCount()],r=>{let a=[];return r&&r>0&&(a=[...new Array(r)].fill(null).map((o,s)=>s)),a},pt(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},X0=()=>({left:[],right:[]}),ew=()=>({top:[],bottom:[]}),Dq={getInitialState:e=>({columnPinning:X0(),rowPinning:ew(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Ua("columnPinning",e),onRowPinningChange:Ua("rowPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(a=>a.id).filter(Boolean);t.setColumnPinning(a=>{var o,s;if(n==="right"){var c,d;return{left:((c=a==null?void 0:a.left)!=null?c:[]).filter(g=>!(r!=null&&r.includes(g))),right:[...((d=a==null?void 0:a.right)!=null?d:[]).filter(g=>!(r!=null&&r.includes(g))),...r]}}if(n==="left"){var p,m;return{left:[...((p=a==null?void 0:a.left)!=null?p:[]).filter(g=>!(r!=null&&r.includes(g))),...r],right:((m=a==null?void 0:a.right)!=null?m:[]).filter(g=>!(r!=null&&r.includes(g)))}}return{left:((o=a==null?void 0:a.left)!=null?o:[]).filter(g=>!(r!=null&&r.includes(g))),right:((s=a==null?void 0:a.right)!=null?s:[]).filter(g=>!(r!=null&&r.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var a,o,s;return((a=r.columnDef.enablePinning)!=null?a:!0)&&((o=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?o:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(c=>c.id),{left:r,right:a}=t.getState().columnPinning,o=n.some(c=>r==null?void 0:r.includes(c)),s=n.some(c=>a==null?void 0:a.includes(c));return o?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const a=e.getIsPinned();return a?(n=(r=t.getState().columnPinning)==null||(r=r[a])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.pin=(n,r,a)=>{const o=r?e.getLeafRows().map(d=>{let{id:p}=d;return p}):[],s=a?e.getParentRows().map(d=>{let{id:p}=d;return p}):[],c=new Set([...s,e.id,...o]);t.setRowPinning(d=>{var p,m;if(n==="bottom"){var g,v;return{top:((g=d==null?void 0:d.top)!=null?g:[]).filter(T=>!(c!=null&&c.has(T))),bottom:[...((v=d==null?void 0:d.bottom)!=null?v:[]).filter(T=>!(c!=null&&c.has(T))),...Array.from(c)]}}if(n==="top"){var D,S;return{top:[...((D=d==null?void 0:d.top)!=null?D:[]).filter(T=>!(c!=null&&c.has(T))),...Array.from(c)],bottom:((S=d==null?void 0:d.bottom)!=null?S:[]).filter(T=>!(c!=null&&c.has(T)))}}return{top:((p=d==null?void 0:d.top)!=null?p:[]).filter(T=>!(c!=null&&c.has(T))),bottom:((m=d==null?void 0:d.bottom)!=null?m:[]).filter(T=>!(c!=null&&c.has(T)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:a}=t.options;return typeof r=="function"?r(e):(n=r??a)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:a}=t.getState().rowPinning,o=n.some(c=>r==null?void 0:r.includes(c)),s=n.some(c=>a==null?void 0:a.includes(c));return o?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const a=e.getIsPinned();if(!a)return-1;const o=(n=t._getPinnedRows(a))==null?void 0:n.map(s=>{let{id:c}=s;return c});return(r=o==null?void 0:o.indexOf(e.id))!=null?r:-1},e.getCenterVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,a)=>{const o=[...r??[],...a??[]];return n.filter(s=>!o.includes(s.column.id))},pt(t.options,"debugRows")),e.getLeftVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"left"})),pt(t.options,"debugRows")),e.getRightVisibleCells=ht(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(o=>n.find(s=>s.column.id===o)).filter(Boolean).map(o=>({...o,position:"right"})),pt(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?X0():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:X0())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var a,o;return!!((a=r.left)!=null&&a.length||(o=r.right)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(a=>a.id===r)).filter(Boolean),pt(e.options,"debugColumns")),e.getRightLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(a=>a.id===r)).filter(Boolean),pt(e.options,"debugColumns")),e.getCenterLeafColumns=ht(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const a=[...n??[],...r??[]];return t.filter(o=>!a.includes(o.id))},pt(e.options,"debugColumns")),e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?ew():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:ew())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var a,o;return!!((a=r.top)!=null&&a.length||(o=r.bottom)!=null&&o.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=ht(t=>[e.getRowModel().rows,e.getState().rowPinning[t],t],(t,n,r)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(n??[]).map(s=>{const c=e.getRow(s,!0);return c.getIsAllParentsExpanded()?c:null}):(n??[]).map(s=>t.find(c=>c.id===s))).filter(Boolean).map(s=>({...s,position:r}))},pt(e.options,"debugRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=ht(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const a=new Set([...n??[],...r??[]]);return t.filter(o=>!a.has(o.id))},pt(e.options,"debugRows"))}},Sq={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Ua("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(o=>{o.getCanSelect()&&(r[o.id]=!0)}):a.forEach(o=>{delete r[o.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),a={...n};return e.getRowModel().rows.forEach(o=>{qw(a,o.id,r,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?tw(e,n):{rows:[],flatRows:[],rowsById:{}},pt(e.options,"debugTable")),e.getFilteredSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?tw(e,n):{rows:[],flatRows:[],rowsById:{}},pt(e.options,"debugTable")),e.getGroupedSelectedRowModel=ht(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?tw(e,n):{rows:[],flatRows:[],rowsById:{}},pt(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(a=>a.getCanSelect()&&!n[a.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(a=>!n[a.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const a=e.getIsSelected();t.setRowSelection(o=>{var s;if(n=typeof n<"u"?n:!a,e.getCanSelect()&&a===n)return o;const c={...o};return qw(c,e.id,n,(s=r==null?void 0:r.selectChildren)!=null?s:!0,t),c})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return db(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Jw(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Jw(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var a;n&&e.toggleSelected((a=r.target)==null?void 0:a.checked)}}}},qw=(e,t,n,r,a)=>{var o;const s=a.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(c=>delete e[c]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(o=s.subRows)!=null&&o.length&&s.getCanSelectSubRows()&&s.subRows.forEach(c=>qw(e,c.id,n,r,a))};function tw(e,t){const n=e.getState().rowSelection,r=[],a={},o=function(s,c){return s.map(d=>{var p;const m=db(d,n);if(m&&(r.push(d),a[d.id]=d),(p=d.subRows)!=null&&p.length&&(d={...d,subRows:o(d.subRows)}),m)return d}).filter(Boolean)};return{rows:o(t.rows),flatRows:r,rowsById:a}}function db(e,t){var n;return(n=t[e.id])!=null?n:!1}function Jw(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let a=!0,o=!1;return e.subRows.forEach(s=>{if(!(o&&!a)&&(s.getCanSelect()&&(db(s,t)?o=!0:a=!1),s.subRows&&s.subRows.length)){const c=Jw(s,t);c==="all"?o=!0:(c==="some"&&(o=!0),a=!1)}}),a?"all":o?"some":!1}const Kw=/([0-9]+)/gm,Iq=(e,t,n)=>sx(Sl(e.getValue(n)).toLowerCase(),Sl(t.getValue(n)).toLowerCase()),Tq=(e,t,n)=>sx(Sl(e.getValue(n)),Sl(t.getValue(n))),Eq=(e,t,n)=>fb(Sl(e.getValue(n)).toLowerCase(),Sl(t.getValue(n)).toLowerCase()),Cq=(e,t,n)=>fb(Sl(e.getValue(n)),Sl(t.getValue(n))),xq=(e,t,n)=>{const r=e.getValue(n),a=t.getValue(n);return r>a?1:rfb(e.getValue(n),t.getValue(n));function fb(e,t){return e===t?0:e>t?1:-1}function Sl(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function sx(e,t){const n=e.split(Kw).filter(Boolean),r=t.split(Kw).filter(Boolean);for(;n.length&&r.length;){const a=n.shift(),o=r.shift(),s=parseInt(a,10),c=parseInt(o,10),d=[s,c].sort();if(isNaN(d[0])){if(a>o)return 1;if(o>a)return-1;continue}if(isNaN(d[1]))return isNaN(s)?-1:1;if(s>c)return 1;if(c>s)return-1}return n.length-r.length}const Id={alphanumeric:Iq,alphanumericCaseSensitive:Tq,text:Eq,textCaseSensitive:Cq,datetime:xq,basic:Mq},Nq={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Ua("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const a of n){const o=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(o)==="[object Date]")return Id.datetime;if(typeof o=="string"&&(r=!0,o.split(Kw).length>1))return Id.alphanumeric}return r?Id.text:Id.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return My(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:Id[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const a=e.getNextSortingOrder(),o=typeof n<"u"&&n!==null;t.setSorting(s=>{const c=s==null?void 0:s.find(D=>D.id===e.id),d=s==null?void 0:s.findIndex(D=>D.id===e.id);let p=[],m,g=o?n:a==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?c?m="toggle":m="add":s!=null&&s.length&&d!==s.length-1?m="replace":c?m="toggle":m="replace",m==="toggle"&&(o||a||(m="remove")),m==="add"){var v;p=[...s,{id:e.id,desc:g}],p.splice(0,p.length-((v=t.options.maxMultiSortColCount)!=null?v:Number.MAX_SAFE_INTEGER))}else m==="toggle"?p=s.map(D=>D.id===e.id?{...D,desc:g}:D):m==="remove"?p=s.filter(D=>D.id!==e.id):p=[{id:e.id,desc:g}];return p})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,a;const o=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==o&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(a=t.options.enableMultiRemove)!=null)||a)?!1:s==="desc"?"asc":"desc":o},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(a=>a.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(a=>a.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},kq={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Ua("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const a=e.columns;return(n=a.length?a.some(o=>o.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=ht(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),pt(t.options,"debugRows")),e.getVisibleCells=ht(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,a)=>[...n,...r,...a],pt(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>ht(()=>[r(),r().filter(a=>a.getIsVisible()).map(a=>a.id).join("_")],a=>a.filter(o=>o.getIsVisible==null?void 0:o.getIsVisible()),pt(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,o)=>({...a,[o.id]:n||!(o.getCanHide!=null&&o.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Qh(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const T2=[rq,kq,wq,Dq,sq,Nq,yq,iq,bq,Sq,aq];function Aq(e){var t;e.debugAll||e.debugTable;let n={_features:T2};const r=n._features.reduce((m,g)=>Object.assign(m,g.getDefaultOptions==null?void 0:g.getDefaultOptions(n)),{}),a=m=>n.options.mergeOptions?n.options.mergeOptions(r,m):{...r,...m};let s={...{},...(t=e.initialState)!=null?t:{}};n._features.forEach(m=>{var g;s=(g=m.getInitialState==null?void 0:m.getInitialState(s))!=null?g:s});const c=[];let d=!1;const p={_features:T2,options:{...r,...e},initialState:s,_queue:m=>{c.push(m),d||(d=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();d=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{n.setState(n.initialState)},setOptions:m=>{const g=vl(m,n.options);n.options=a(g)},getState:()=>n.options.state,setState:m=>{n.options.onStateChange==null||n.options.onStateChange(m)},_getRowId:(m,g,v)=>{var D;return(D=n.options.getRowId==null?void 0:n.options.getRowId(m,g,v))!=null?D:`${v?[v.id,g].join("."):g}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(m,g)=>{let v=(g?n.getPrePaginationRowModel():n.getRowModel()).rowsById[m];if(!v&&(v=n.getCoreRowModel().rowsById[m],!v))throw new Error;return v},_getDefaultColumnDef:ht(()=>[n.options.defaultColumn],m=>{var g;return m=(g=m)!=null?g:{},{header:v=>{const D=v.header.column.columnDef;return D.accessorKey?D.accessorKey:D.accessorFn?D.id:null},cell:v=>{var D,S;return(D=(S=v.renderValue())==null||S.toString==null?void 0:S.toString())!=null?D:null},...n._features.reduce((v,D)=>Object.assign(v,D.getDefaultColumnDef==null?void 0:D.getDefaultColumnDef()),{}),...m}},pt(e,"debugColumns")),_getColumnDefs:()=>n.options.columns,getAllColumns:ht(()=>[n._getColumnDefs()],m=>{const g=function(v,D,S){return S===void 0&&(S=0),v.map(T=>{const E=nq(n,T,S,D),O=T;return E.columns=O.columns?g(O.columns,E,S+1):[],E})};return g(m)},pt(e,"debugColumns")),getAllFlatColumns:ht(()=>[n.getAllColumns()],m=>m.flatMap(g=>g.getFlatColumns()),pt(e,"debugColumns")),_getAllFlatColumnsById:ht(()=>[n.getAllFlatColumns()],m=>m.reduce((g,v)=>(g[v.id]=v,g),{}),pt(e,"debugColumns")),getAllLeafColumns:ht(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(m,g)=>{let v=m.flatMap(D=>D.getLeafColumns());return g(v)},pt(e,"debugColumns")),getColumn:m=>n._getAllFlatColumnsById()[m]};Object.assign(n,p);for(let m=0;m{var s;return(s=o.getValue())!=null?s:e.options.renderFallbackValue},o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:a,getContext:ht(()=>[e,n,t,o],(s,c,d,p)=>({table:s,column:c,row:d,cell:p,getValue:p.getValue,renderValue:p.renderValue}),pt(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(o,n,t,e)},{}),o}const hb=(e,t,n,r,a,o,s)=>{let c={id:t,index:r,original:n,depth:a,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(c._valuesCache.hasOwnProperty(d))return c._valuesCache[d];const p=e.getColumn(d);if(p!=null&&p.accessorFn)return c._valuesCache[d]=p.accessorFn(c.original,r),c._valuesCache[d]},getUniqueValues:d=>{if(c._uniqueValuesCache.hasOwnProperty(d))return c._uniqueValuesCache[d];const p=e.getColumn(d);if(p!=null&&p.accessorFn)return p.columnDef.getUniqueValues?(c._uniqueValuesCache[d]=p.columnDef.getUniqueValues(c.original,r),c._uniqueValuesCache[d]):(c._uniqueValuesCache[d]=[c.getValue(d)],c._uniqueValuesCache[d])},renderValue:d=>{var p;return(p=c.getValue(d))!=null?p:e.options.renderFallbackValue},subRows:o??[],getLeafRows:()=>tq(c.subRows,d=>d.subRows),getParentRow:()=>c.parentId?e.getRow(c.parentId,!0):void 0,getParentRows:()=>{let d=[],p=c;for(;;){const m=p.getParentRow();if(!m)break;d.push(m),p=m}return d.reverse()},getAllCells:ht(()=>[e.getAllLeafColumns()],d=>d.map(p=>Fq(e,c,p,p.id)),pt(e.options,"debugRows")),_getAllCellsByColumnId:ht(()=>[c.getAllCells()],d=>d.reduce((p,m)=>(p[m.column.id]=m,p),{}),pt(e.options,"debugRows"))};for(let d=0;dht(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(a,o,s){o===void 0&&(o=0);const c=[];for(let p=0;pe._autoResetPageIndex()))}function lx(e,t,n){return n.options.filterFromLeafRows?Pq(e,t,n):jq(e,t,n)}function Pq(e,t,n){var r;const a=[],o={},s=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,c=function(d,p){p===void 0&&(p=0);const m=[];for(let v=0;vht(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{if(!t.rows.length||!(n!=null&&n.length)&&!r){for(let v=0;v{var D;const S=e.getColumn(v.id);if(!S)return;const T=S.getFilterFn();T&&a.push({id:v.id,filterFn:T,resolvedValue:(D=T.resolveFilterValue==null?void 0:T.resolveFilterValue(v.value))!=null?D:v.value})});const s=n.map(v=>v.id),c=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(v=>v.getCanGlobalFilter());r&&c&&d.length&&(s.push("__global__"),d.forEach(v=>{var D;o.push({id:v.id,filterFn:c,resolvedValue:(D=c.resolveFilterValue==null?void 0:c.resolveFilterValue(r))!=null?D:r})}));let p,m;for(let v=0;v{D.columnFiltersMeta[T]=E})}if(o.length){for(let S=0;S{D.columnFiltersMeta[T]=E})){D.columnFilters.__global__=!0;break}}D.columnFilters.__global__!==!0&&(D.columnFilters.__global__=!1)}}const g=v=>{for(let D=0;De._autoResetPageIndex()))}function Rq(){return(e,t)=>ht(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(n,r,a)=>{if(!n.rows.length||!(r!=null&&r.length)&&!a)return n;const o=[...r.map(c=>c.id).filter(c=>c!==t),a?"__global__":void 0].filter(Boolean),s=c=>{for(let d=0;dht(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{if(!n)return new Map;let r=new Map;for(let o=0;oht(()=>{var n;return[(n=e.getColumn(t))==null?void 0:n.getFacetedRowModel()]},n=>{var r;if(!n)return;const a=(r=n.flatRows[0])==null?void 0:r.getUniqueValues(t);if(typeof a>"u")return;let o=[a,a];for(let s=0;so[1]&&(o[1]=p)}}return o},pt(e.options,"debugTable"))}function Hq(){return e=>ht(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const r=e.getState().sorting,a=[],o=r.filter(d=>{var p;return(p=e.getColumn(d.id))==null?void 0:p.getCanSort()}),s={};o.forEach(d=>{const p=e.getColumn(d.id);p&&(s[d.id]={sortUndefined:p.columnDef.sortUndefined,invertSorting:p.columnDef.invertSorting,sortingFn:p.getSortingFn()})});const c=d=>{const p=d.map(m=>({...m}));return p.sort((m,g)=>{for(let D=0;D{var g;a.push(m),(g=m.subRows)!=null&&g.length&&(m.subRows=c(m.subRows))}),p};return{rows:c(n.rows),flatRows:a,rowsById:n.rowsById}},pt(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Yq(e){const t=[],n=r=>{var a;t.push(r),(a=r.subRows)!=null&&a.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function zq(e){return t=>ht(()=>[t.getState().pagination,t.getPrePaginationRowModel(),t.options.paginateExpandedRows?void 0:t.getState().expanded],(n,r)=>{if(!r.rows.length)return r;const{pageSize:a,pageIndex:o}=n;let{rows:s,flatRows:c,rowsById:d}=r;const p=a*o,m=p+a;s=s.slice(p,m);let g;t.options.paginateExpandedRows?g={rows:s,flatRows:c,rowsById:d}:g=Yq({rows:s,flatRows:c,rowsById:d}),g.flatRows=[];const v=D=>{g.flatRows.push(D),D.subRows.length&&D.subRows.forEach(v)};return g.rows.forEach(v),g},pt(t.options,"debugTable"))}function E2(e,t){return e?Uq(e)?A.createElement(e,t):e:null}function Uq(e){return Vq(e)||typeof e=="function"||Zq(e)}function Vq(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Zq(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Wq(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=A.useState(()=>({current:Aq(t)})),[r,a]=A.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{a(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const ux={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ù:"u",ú:"u",û:"u",ü:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z"},$q=Object.keys(ux).join("|"),Gq=new RegExp($q,"g");function qq(e){return e.replace(Gq,t=>ux[t])}const va={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function Jq(e,t,n){var r;if(n=n||{},n.threshold=(r=n.threshold)!=null?r:va.MATCHES,!n.accessors){const s=C2(e,t,n);return{rankedValue:e,rank:s,accessorIndex:-1,accessorThreshold:n.threshold,passed:s>=n.threshold}}const a=tJ(e,n.accessors),o={rankedValue:e,rank:va.NO_MATCH,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let s=0;s=va.MATCHES?d=p:d>m&&(d=m),d=Math.min(d,m),d>=g&&d>o.rank&&(o.rank=d,o.passed=!0,o.accessorIndex=s,o.accessorThreshold=g,o.rankedValue=c.itemValue)}return o}function C2(e,t,n){return e=x2(e,n),t=x2(t,n),t.length>e.length?va.NO_MATCH:e===t?va.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?va.EQUAL:e.startsWith(t)?va.STARTS_WITH:e.includes(` ${t}`)?va.WORD_STARTS_WITH:e.includes(t)?va.CONTAINS:t.length===1?va.NO_MATCH:Kq(e).includes(t)?va.ACRONYM:Qq(e,t))}function Kq(e){let t="";return e.split(" ").forEach(r=>{r.split("-").forEach(o=>{t+=o.substr(0,1)})}),t}function Qq(e,t){let n=0,r=0;function a(d,p,m){for(let g=m,v=p.length;g-1))return va.NO_MATCH}const c=r-s;return o(c)}function Xq(e,t){return e.rank===t.rank?0:e.rank>t.rank?-1:1}function x2(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=qq(e)),e}function eJ(e,t){let n=t;typeof t=="object"&&(n=t.accessor);const r=n(e);return r==null?[]:Array.isArray(r)?r:[String(r)]}function tJ(e,t){const n=[];for(let r=0,a=t.length;r{const t=A.useRef(null);A.useEffect(()=>(t.current&&C.setIcon(t.current,"pin"),()=>{t.current&&(t.current=null)}),[t]);const n=A.useCallback(async()=>{e.pinned?await Te.unpinMemoById(e.id):await Te.pinMemoById(e.id)},[e]);return w.jsx("span",{ref:t,className:Xn("pinned-status",e.pinned?"pinned":"not-pinned"),onClick:n})},aJ=({thino:e})=>{const t=A.useRef(null);A.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=A.useCallback(async()=>{if(e.thinoType==="JOURNAL")return;const r=await Te.updateMemo(e.id,e.content,e.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");r&&Te.editMemo(r)},[e]);return w.jsx(w.Fragment,{children:e.thinoType!=="JOURNAL"?w.jsx("input",{className:Xn("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":e.thinoType.slice(5),onClick:n}):w.jsx("span",{ref:t,className:"thino-type-status"})})},oJ=({id:e,path:t})=>{const n=A.useRef(null);A.useEffect(()=>(n.current&&C.setIcon(n.current,"link"),()=>{n.current&&(n.current=null)}),[]);const r=A.useCallback(()=>{!e||!t||Te.openThinoByID(e)},[e,t]);return w.jsxs("span",{className:"source-thino",onClick:r,children:[w.jsx("span",{children:t}),w.jsx("span",{ref:n,className:"source-thino-icon"})]})},iJ=({id:e,sourceType:t})=>{const n=A.useRef(null);A.useEffect(()=>{var a;return n.current&&C.setIcon(n.current,((a=tp.find(o=>o.title===t))==null?void 0:a.icon)||"list"),()=>{n.current&&(n.current=null)}},[]);const r=A.useCallback(async()=>{e&&await Te.openThinoByID(e)},[e]);return w.jsx("span",{ref:n,className:"source-type-icon",onClick:r})},N2=(e,t,n,r)=>{const a=Jq(e.getValue(t),n);return r({itemRank:a}),a.passed},k2=(e,t,n)=>{var a,o;let r=0;return e.columnFiltersMeta[n]&&(r=Xq((a=e.columnFiltersMeta[n])==null?void 0:a.itemRank,(o=t.columnFiltersMeta[n])==null?void 0:o.itemRank)),r===0?Id.alphanumeric(e,t,n):r};function sJ({thinos:e}){var m;$.useReducer(()=>({}),{})[1];const[t,n]=$.useState([]),[r,a]=$.useState(""),o=$.useMemo(()=>[{header:N("Basic Info"),footer:g=>g.column.id,columns:[{accessorKey:"createdAt",header:()=>w.jsx("span",{className:"create-at-header-cell",children:N("Created At")}),cell:g=>g.getValue(),footer:g=>g.column.id,enableColumnFilter:!1},{accessorFn:g=>g.content,id:"content",header:()=>w.jsx("span",{className:"thino-header-cell",children:N("Thino")}),cell:g=>w.jsx(Sa,{memo:g.row.original,type:"table"}),footer:g=>g.column.id,filterFn:"fuzzy",sortingFn:k2},{accessorFn:g=>g.thinoType,id:"thinoType",cell:g=>w.jsx(aJ,{thino:g.row.original}),header:()=>w.jsx("span",{children:N("Thino Type")}),footer:g=>g.column.id},{accessorFn:g=>g.sourceType,id:"sourceType",cell:g=>w.jsx(iJ,{id:g.row.original.id,sourceType:g.getValue()}),header:()=>w.jsx("span",{children:N("Source Type")}),footer:g=>g.column.id}]},{header:N("Additional Info"),footer:g=>g.column.id,columns:[{accessorKey:"pinned",header:()=>w.jsx("span",{children:N("Pinned Status")}),cell:g=>w.jsx(rJ,{thino:g.row.original}),footer:g=>g.column.id,filterFn:"fuzzy",sortingFn:k2},{accessorKey:"rowStatus",header:()=>w.jsx("span",{children:N("Row status")}),cell:g=>w.jsx("span",{children:g.getValue()==="NORMAL"?"":g.getValue()}),footer:g=>g.column.id},{accessorKey:"path",header:()=>N("Path"),cell:g=>w.jsx(oJ,{id:g.row.original.id,path:g.getValue()}),footer:g=>g.column.id}]}],[]),[s,c]=$.useState(()=>e),d=()=>c(g=>e);A.useEffect(()=>{d()},[e]);const p=Wq({data:s,columns:o,filterFns:{fuzzy:N2},initialState:{pagination:{pageSize:20}},state:{columnFilters:t,globalFilter:r},onColumnFiltersChange:n,onGlobalFilterChange:a,globalFilterFn:N2,getCoreRowModel:Oq(),getFilteredRowModel:Lq(),getSortedRowModel:Hq(),getPaginationRowModel:zq(),getFacetedRowModel:Rq(),getFacetedUniqueValues:Bq(),getFacetedMinMaxValues:_q(),debugTable:!1,debugHeaders:!1,debugColumns:!1});return $.useEffect(()=>{var g,v;((g=p.getState().columnFilters[0])==null?void 0:g.id)==="createdAt"&&((v=p.getState().sorting[0])==null?void 0:v.id)!=="createdAt"&&p.setSorting([{id:"createdAt",desc:!1}])},[(m=p.getState().columnFilters[0])==null?void 0:m.id]),w.jsxs("div",{className:"table-view",children:[w.jsx("div",{children:w.jsx(ry,{value:r||"",onChange:g=>a(String(g)),className:"table-search-bar",placeholder:N("Search all columns...")})}),w.jsxs("table",{className:"thino-table",children:[w.jsx("thead",{children:p.getHeaderGroups().map(g=>w.jsx("tr",{children:g.headers.map(v=>w.jsx("th",{colSpan:v.colSpan,children:v.isPlaceholder?null:w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:Xn(v.column.getCanSort()?"filter-header":"","table-header",v.column.id==="content"?"content-header":""),onClick:v.column.getToggleSortingHandler(),children:[E2(v.column.columnDef.header,v.getContext()),{asc:" 🔼",desc:" 🔽"}[v.column.getIsSorted()]??null]}),v.column.getCanFilter()?w.jsx(uJ,{column:v.column,table:p}):null]})},v.id))},g.id))}),w.jsx("tbody",{children:p.getRowModel().rows.map(g=>w.jsx("tr",{className:Xn(g.getValue("pinned")?"pinned":""),children:g.getVisibleCells().map(v=>w.jsx("td",{children:E2(v.column.columnDef.cell,v.getContext())},v.id))},g.id))})]}),w.jsxs("div",{className:"table-nav-bar",children:[w.jsx("button",{className:"prev-start-btn",onClick:()=>p.setPageIndex(0),disabled:!p.getCanPreviousPage(),children:"<<"}),w.jsx("button",{className:"prev-btn",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"<"}),w.jsx("button",{className:"next-btn",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:">"}),w.jsx("button",{className:"next-end-btn",onClick:()=>p.setPageIndex(p.getPageCount()-1),disabled:!p.getCanNextPage(),children:">>"}),w.jsxs("span",{className:"table-page-info",children:[w.jsx("div",{children:N("Page")}),w.jsxs("strong",{children:[p.getState().pagination.pageIndex+1," of ",p.getPageCount()]})]}),w.jsxs("span",{className:"table-page-jump",children:["| ",N("Go to page"),":",w.jsx("input",{type:"number",defaultValue:p.getState().pagination.pageIndex+1,onChange:g=>{const v=g.target.value?Number(g.target.value)-1:0;p.setPageIndex(v)},className:"jump-inputer"})]}),w.jsx("select",{value:p.getState().pagination.pageSize,onChange:g=>{p.setPageSize(Number(g.target.value))},children:[10,20,30,40,50].map(g=>w.jsxs("option",{value:g,children:[N("Show")," ",g," ",N("rows")]},g))})]})]})}const lJ=e=>e==="sourceType"?["ALL"]:["ALL","ALL-TASK"];function uJ({column:e,table:t}){var o,s,c,d,p,m,g,v,D;const n=(o=t.getPreFilteredRowModel().flatRows[0])==null?void 0:o.getValue(e.id),r=e.getFilterValue(),a=$.useMemo(()=>typeof n=="number"?[]:Array.from(e.getFacetedUniqueValues().keys()).sort(),[e.getFacetedUniqueValues()]);return typeof n=="number"?w.jsx("div",{children:w.jsxs("div",{className:"filter-input-group",children:[w.jsx(ry,{type:"number",min:Number(((s=e.getFacetedMinMaxValues())==null?void 0:s[0])??""),max:Number(((c=e.getFacetedMinMaxValues())==null?void 0:c[1])??""),value:(r==null?void 0:r[0])??"",onChange:S=>e.setFilterValue(T=>[S,T==null?void 0:T[1]]),placeholder:`Min ${(d=e.getFacetedMinMaxValues())!=null&&d[0]?`(${(p=e.getFacetedMinMaxValues())==null?void 0:p[0]})`:""}`,className:"filter-input-short"}),w.jsx(ry,{type:"number",min:Number(((m=e.getFacetedMinMaxValues())==null?void 0:m[0])??""),max:Number(((g=e.getFacetedMinMaxValues())==null?void 0:g[1])??""),value:(r==null?void 0:r[1])??"",onChange:S=>e.setFilterValue(T=>[T==null?void 0:T[0],S]),placeholder:`Max ${(v=e.getFacetedMinMaxValues())!=null&&v[1]?`(${(D=e.getFacetedMinMaxValues())==null?void 0:D[1]})`:""}`,className:"filter-input-short"})]})}):w.jsx(w.Fragment,{children:a.length>1?w.jsxs(w.Fragment,{children:[e.id!=="path"&&e.id!=="content"&&e.id!=="thinoType"&&e.id!=="sourceType"&&w.jsx("datalist",{id:e.id+"list",children:a.slice(0,5e3).map(S=>w.jsx("option",{value:S},S))}),e.id==="thinoType"||e.id==="sourceType"?w.jsx("select",{id:e.id,onChange:S=>e.setFilterValue(S.target.value==="ALL"?"":S.target.value==="ALL-TASK"?"TASK":S.target.value),children:[...lJ(e.id),...a].map(S=>w.jsx("option",{value:S,children:N(S)||S},S))}):"",e.id!=="thinoType"&&e.id!=="sourceType"?w.jsx(ry,{type:"text",value:r??"",onChange:S=>e.setFilterValue(S),placeholder:`Search... (${e.getFacetedUniqueValues().size})`,className:"filter-input-long",list:e.id+"list"}):""]}):""})}function ry({value:e,onChange:t,debounce:n=500,...r}){const[a,o]=$.useState(e);return $.useEffect(()=>{o(e)},[e]),$.useEffect(()=>{const s=setTimeout(()=>{t(a)},n);return()=>clearTimeout(s)},[a]),w.jsx("input",{...r,value:a,onChange:s=>o(s.target.value)})}const cJ=e=>{const{locationState:{query:t},globalState:{memoListView:n,manifest:r},dailyNotesState:{app:a,settings:o}}=A.useContext(mt),{thinos:s}=e,[c,d]=$.useState(yp(s,"day")),p=$.useRef(null),m=A.useRef([]),g=A.useRef(0);A.useEffect(()=>{d(yp(s,"day"))},[s]),A.useEffect(()=>{var k,j;const S=s.filter(F=>F.pinned),T=s.filter(F=>!F.pinned),E=m.current.filter(F=>F.pinned)[0],O=m.current.filter(F=>!F.pinned)[0];if(E&&E.id!==((k=S[0])==null?void 0:k.id)||O&&O.id!==((j=T[0])==null?void 0:j.id)){const F=p.current.closest(".memolist-wrapper");F.scrollTop=F.scrollHeight}else{const F=p.current.closest(".memolist-wrapper");F.scrollTop=F.scrollHeight-g.current,m.current=s}},[s]),A.useEffect(()=>{if(!p.current)return;const S=p.current.closest(".memolist-wrapper");S.scrollTop=S.scrollHeight},[t]),A.useEffect(()=>{if(n==="chat"&&p.current){const S=p.current.closest(".memolist-wrapper");S.scrollTop=S.scrollHeight,g.current=S.scrollHeight-S.scrollTop,m.current=s,S.onscrollend=()=>{g.current=S.scrollHeight-S.scrollTop}}},[p.current]);const v=A.useCallback(()=>{a.setting.open(),a.setting.openTabById(r.id||"obsidian-memos")},[a]),D=A.useMemo(()=>w.jsx(w.Fragment,{children:Object.keys(c).map((S,T)=>w.jsx(w.Fragment,{children:w.jsx(dJ,{thinos:c[S],dayMark:S,handleOpenSettings:v},S+T)}))}),[c]);return w.jsx("div",{ref:p,className:Xn("chat-view",`${o==null?void 0:o.chatViewStyle}-style`),children:D})},dJ=({thinos:e,dayMark:t,handleOpenSettings:n})=>{const{dailyNotesState:{settings:r}}=A.useContext(mt),[a,o]=$.useState(!0),s=$.useRef(null),c=m=>{if(C.Keymap.isModifier(m.nativeEvent,"Mod")){const g=C.moment(t,"YYYY-MM-DD");He.setFromAndToQuery(g.startOf("day").valueOf(),g.endOf("day").valueOf());return}o(!a),s.current.scrollIntoView(!0)},d=m=>{$d(m)},p=A.useMemo(()=>e.map((m,g)=>w.jsxs("div",{className:"thino-bubble right",children:[w.jsx(fJ,{icon:r==null?void 0:r.MomentsIcon,handleOpenSettings:n}),w.jsx("div",{className:"wrap",children:w.jsx(hJ,{thino:m,handleClickTimeStamp:d},`${m.id}-${C.moment(m.createdAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${g}`)})]},m.id+g)),[e,r==null?void 0:r.MomentsIcon]);return w.jsxs(w.Fragment,{children:[a&&p,w.jsx("div",{className:`thino-chat-day-mark day-mark ${a?"":"folded"}`,onClick:c,children:w.jsx("div",{className:"day-mark-bubble",children:(t==="PINNED"?t+" 📌":t)+(a?"":"...")})})]})},fJ=({icon:e,handleOpenSettings:t})=>w.jsx("div",{ref:n=>{if(e){n==null||n.empty();return}e||n&&C.setIcon(n,"Memos")},className:"icon-img",style:{backgroundImage:`url(${e})`}}),hJ=({thino:e,handleClickTimeStamp:t})=>{const n=A.useCallback(async()=>{if(e.thinoType==="JOURNAL")return;const o=await Te.updateMemo(e.id,e.content,e.thinoType==="TASK-TODO"?"TASK-DONE":"TASK-TODO");o&&Te.editMemo(o)},[e]),r=A.useMemo(()=>w.jsxs("div",{className:"content",children:[w.jsx("div",{className:"time-stamp","data-date":C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),"data-time":C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss"),onClick:()=>{t(e)},children:C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss")}),w.jsx(Sa,{memo:e})]}),[e.content]),a=A.useMemo(()=>w.jsxs("div",{className:"content task",children:[w.jsx("div",{className:"task-inputer",children:w.jsx("input",{className:Xn("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":e.thinoType.slice(5),onClick:n})}),w.jsx("div",{className:"time-stamp","data-date":C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("YYYY-MM-DD"),"data-time":C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss"),onClick:()=>{t(e)},children:C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm:ss")}),w.jsx(Sa,{memo:e})]}),[e.content,e.thinoType]);return e.thinoType==="JOURNAL"?r:a};class Ve extends C.Setting{constructor(n,r){super(n);me(this,"settingTab");me(this,"name","");me(this,"desc","");this.settingTab=r}setName(n){return super.setName(n),this.name=n,this}setDesc(n){return super.setDesc(n),this.desc=n,this}setTab(n){const r=typeof this.name=="string"?this.name:this.name.textContent||"",a=typeof this.desc=="string"?this.desc:this.desc.textContent||"";return this.settingTab.addSettingToMasterSettingsList(n,this.settingEl,r,a),this}}class pJ extends C.Modal{constructor(n,r,a,o,s){super(n);me(this,"plugin");me(this,"settingTab");me(this,"target",5);me(this,"cb");this.app=n,this.settingTab=r,this.plugin=a,this.target=o,this.cb=s}onOpen(){var c;const{contentEl:n}=this;(c=n.parentElement)==null||c.classList.add("memo-save-location-modal"),n.createEl("h3",{text:N("Thino Daily Target")});const r=n.createDiv("modal-setting");new Ve(r,this.settingTab).setName(N("Target Thino Count")).addSlider(d=>{d.setDynamicTooltip().setValue(this.target).setLimits(1,30,1).onChange(async p=>{this.target=p})});const a=n.createDiv("button-group"),o=a.createEl("button",{text:N("Cancel")}),s=a.createEl("button",{text:N("Save")});s.onclick=async()=>{this.plugin.settings.MemoDailyTarget=this.target,this.settingTab.applySettingsUpdate(),this.cb(this.target),this.close()},o.onclick=async()=>{this.close()}}onClose(){const{contentEl:n}=this;n.empty()}}const mJ=({allStat:e,todayTimeStamp:t,calendarType:n,handleCalendarTypeChange:r})=>{const{dailyNotesState:{app:a,settings:o},globalState:{manifest:s}}=A.useContext(mt),[c,d]=A.useState(),[p,m]=A.useState(5),[g,v]=A.useState(0),[D,S]=A.useState(0),[T,E]=A.useState(o.HeatmapColorScheme||"default"),O=A.useRef(null),k=A.useRef(null);A.useEffect(()=>{o.HeatmapColorScheme&&E(o.HeatmapColorScheme)},[o.HeatmapColorScheme]),A.useEffect(()=>{let F,B=5;s&&a&&(F=a==null?void 0:a.plugins.getPlugin(s.id),B=F==null?void 0:F.settings.MemoDailyTarget,d(F)),m(B)},[s,a]),A.useEffect(()=>{const F=e.find(z=>z.timestamp===t),B=F?F.count:0;S(B);const R=Math.min(100,B/p*100);v(R)},[e,p]),A.useEffect(()=>{C.requireApiVersion("1.4.4")&&(C.setTooltip(k.current,g.toFixed(2)+"%"),C.setTooltip(O.current,N("Set daily target")+` (${D}/${p})`))},[g,D]),A.useEffect(()=>{O.current&&(O.current.hasChildNodes()||C.setIcon(O.current,"crosshair"),C.requireApiVersion("1.4.4")&&C.setTooltip(k.current,g+"%"))},[O,p]);const j=A.useCallback(()=>{if(!c)return;new pJ(a,c==null?void 0:c.settingTab,c,p,B=>{m(B)}).open()},[c,p]);return w.jsx(w.Fragment,{children:w.jsxs("div",{className:`usage-daily-progress-wrapper heatmap-${T}`,children:[w.jsx("div",{ref:k,className:"daily-progress-bar",children:w.jsx("div",{className:"daily-progress-bar-inner",style:{width:`${g}%`}})}),w.jsx("div",{ref:O,className:"daily-progress-target",onClick:j}),w.jsx("div",{ref:F=>{F&&C.setIcon(F,n==="basic"?"layout-grid":"calendar"),F&&C.setTooltip&&C.setTooltip(F,N("Switch calendar type"))},className:"switch-calendar-type-btn",onClick:()=>r&&r(n==="basic"?"heatmap":"basic")})]})})},gJ=e=>{const{className:t,view:n,datestamp:r,handleDateStampChange:a,handleDateItemClick:o,handleMonthChange:s,dailyStat:c}=e,d=C.moment().startOf("day").valueOf(),[p,m]=A.useState(Bh(r)),[g,v]=A.useState(null);A.useEffect(()=>{m(Bh(r))},[r]);const D=new Date(p),S=D.getDay(),T=[];for(let k=0;k{const j=D.getFullYear(),F=D.getMonth()+1;let B=0;F===1&&k===-1?B=new Date(`${j-1}/12/1`).getTime():F===12&&k===1?B=new Date(`${j+1}/1/1`).getTime():B=new Date(`${j}/${F+k}/1`).getTime(),m(Bh(B)),s&&s(B)};return w.jsxs("div",{className:`heatmap-date-picker-wrapper ${t}`,children:[w.jsxs("div",{className:"date-picker-header",children:[w.jsx("span",{ref:k=>{k&&C.setIcon(k,"chevron-left")},className:"btn btn-text",onClick:()=>O(-1)}),w.jsxs("span",{className:"normal-text",children:[w.jsx(GT,{year:D.getFullYear().toString(),handleYearChange:k=>{m(Bh(new Date(`${k}/${D.getMonth()+1}/1`).getTime()))}}),w.jsx(qT,{month:D.getMonth().toString(),handleMonthChange:k=>{m(Bh(new Date(`${D.getFullYear()}/${parseInt(k)}/1`).getTime()))}})]}),w.jsx("span",{ref:k=>{k&&C.setIcon(k,"chevron-right")},className:"btn btn-text",onClick:()=>O(1)})]}),w.jsxs("div",{className:"date-picker-day-container",children:[w.jsx("div",{className:"date-picker-day-header",children:N("weekDaysShort").map(k=>w.jsx("span",{className:"day-item",children:k},k))}),w.jsx("div",{className:"date-picker-day-content",children:T.map(k=>{if(k.date===0)return w.jsx("span",{className:"day-item null",children:""},k.datestamp);const j=c.find(R=>R.timestamp===k.datestamp)||{count:0,timestamp:k.datestamp,list:0},F=j.count-j.list,B=j.list;return w.jsxs("span",{className:`day-item ${k.datestamp===d?"current":""} ${k.datestamp===g?"selected":""} ${nw(j.count)}`,onClick:R=>{a(r,R.nativeEvent),v(k.datestamp===g?null:k.datestamp),o&&o(R,j)},onMouseOver:R=>{if(!j||!j.count)return;const z=new C.HoverPopover(n,R.currentTarget,100);cx(z,{d:k,list:B,task:F})},children:[w.jsx("span",{className:"day-item-text",children:k.date}),w.jsx(w.Fragment,{children:j&&j.count!==0&&w.jsxs("span",{className:"day-item-dots",children:[F>0&&w.jsx("div",{className:`day-item-dot thino-task-dot ${nw(F)}`}),B>0&&w.jsx("div",{className:`day-item-dot thino-list-dot ${nw(B)}`})]})})]},k.datestamp)})})]})]})};function cx(e,{d:t,list:n,task:r}){e.hoverEl.toggleClass("thino-hover-popover",!0);const a=e.hoverEl.createDiv({cls:"thino-hover-popover-content"});a.createDiv({cls:"thino-date-item",text:`${C.moment(t.datestamp).format("YYYY-MM-DD")}`});const o=a.createDiv({cls:"thino-task-item"});o.createSpan({cls:"thino-task-item-title-text",text:`${N("Task")}: `}),o.createSpan({cls:"thino-task-item-title-count",text:`${r}`});const s=a.createDiv({cls:"thino-list-item"});s.createSpan({cls:"thino-list-item-title-text",text:`${N("List")}: `}),s.createSpan({cls:"thino-list-item-title-count",text:`${n}`})}function yJ(e){const t=new Date(e),n=new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`);return((n.getMonth()===11?new Date(`${n.getFullYear()+1}/1/1`):new Date(`${n.getFullYear()}/${n.getMonth()+2}/1`)).getTime()-n.getTime())/Mi}function Bh(e){const t=new Date(e);return new Date(`${t.getFullYear()}/${t.getMonth()+1}/1`).getTime()}function nw(e){return e<=0?"":e<=1?"stat-day-L1-bg":e<=2?"stat-day-L2-bg":e<=4?"stat-day-L3-bg":"stat-day-L4-bg"}const A2={width:12,height:7},F2=(e,t)=>{const n=[];for(let r=0;r<=e;r++)n.push({timestamp:parseInt(C.moment(t).add(r,"days").format("x")),count:0,list:0});return n},gp=({initThinos:e,basicType:t})=>{const n=parseInt(C.moment().endOf("day").format("x")),r=new Date(n).getDay()||7,a=parseInt(C.moment().startOf("day").format("x")),o=new Array(7-(r===7?1:r)).fill(0),s=(A2.width-1)*A2.height+r,c=parseInt(C.moment().startOf("day").subtract(s,"days").format("x")),d=C.moment().startOf("day").subtract(s,"days"),{memoState:{memos:p},dailyNotesState:{view:m,app:g,settings:v,verifyState:D}}=A.useContext(mt),[S,T]=Kr(t||wJ(g||window.app)||"heatmap"),[E,O]=Kr(C.moment().startOf("day").valueOf()),[k,j]=Kr(v.HeatmapColorScheme||"default"),[F,B]=Kr(F2(s,c)),[R,z]=Kr(null),[H,Y,U]=Kr(""),J=A.useRef(null);A.useEffect(()=>{const se=F2(s,c),fe=(e||p).filter(oe=>!oe.deletedAt&&oe.rowStatus!=="ARCHIVED");for(const oe of fe){const Z=C.moment(oe.createdAt.replaceAll("/","-"),"YYYY-MM-DD HH:mm:ss").startOf("day").diff(d,"days");Z>=0&&Z{v.HeatmapColorScheme&&j(v.HeatmapColorScheme)},[v.HeatmapColorScheme]);const Q=A.useCallback((se,fe)=>{if(!fe||!fe.count)return;const oe=fe.count-fe.list,we=fe.list,Z={date:fe.timestamp,datestamp:fe.timestamp},G=new C.HoverPopover(m,se.currentTarget,100);cx(G,{d:Z,list:we,task:oe})},[]),le=()=>{T(S==="heatmap"?"basic":"heatmap"),vJ(g,S==="heatmap"?"basic":"heatmap"),O(C.moment().startOf("day").valueOf())},pe=A.useCallback(async(se,fe)=>{if(fe.count===0)return;const oe=He.getState().query.duration,we=oe==null?void 0:oe.from,Z=oe==null?void 0:oe.to,G=C.moment(we).diff(Z,"day")==0;if(we===fe.timestamp&&G)He.setFromAndToQuery(0,0),z(null),Y(null);else if(we!==fe.timestamp&&we>0&&se.shiftKey){const te=C.moment(fe.timestamp).endOf("day").diff(Z,"day");we===0&&se.shiftKey?Y("from"):te<0&&G&&Y("to"),C.moment(we).isBefore(fe.timestamp)?U.current==="to"?te<0?He.setFromAndToQuery(fe.timestamp,Z):(He.setFromAndToQuery(parseInt(C.moment(Z).startOf("day").format("x")),parseInt(C.moment(fe.timestamp).endOf("day").format("x"))),Y("from")):U.current==="from"&&(te<0,He.setFromAndToQuery(we,parseInt(C.moment(fe.timestamp).endOf("day").format("x")))):U.current==="to"?He.setFromAndToQuery(fe.timestamp,Z):U.current==="from"&&(He.setFromAndToQuery(fe.timestamp,parseInt(C.moment(we).endOf("day").format("x"))),Y("to"))}else if(we===0&&se.shiftKey)He.setFromAndToQuery(fe.timestamp,parseInt(C.moment().endOf("day").format("x")));else if(fe.count>0&&(se.ctrlKey||se.metaKey)){const{app:te,dailyNotes:ge}=Xe.getState(),Ie=Fy(C.moment(fe.timestamp),ge);if(!C.Platform.isMobile)await te.workspace.getLeaf(!0).openFile(Ie);else{let De=te.workspace.activeLeaf;De===null&&(De=te.workspace.getLeaf(!0)),De.openFile(Ie)}}else fe.count>0&&!se.shiftKey&&!se.ctrlKey&&!se.metaKey&&(["/","/recycle"].includes(He.getState().pathname)||He.setPathname("/"),He.setFromAndToQuery(fe.timestamp,Ue.getTimeStampByDate(C.moment(fe.timestamp+Mi).subtract(1,"days").endOf("day").format("YYYY-MM-DD HH:mm:ss"))),z(fe))},[]),ie=A.useMemo(()=>w.jsx(gJ,{className:`heatmap-${k}`,view:m,datestamp:E,dailyStat:F,handleMonthChange:se=>{O(se)},handleDateStampChange:se=>{},handleDateItemClick:(se,fe)=>pe(se,fe)}),[JSON.stringify(F),m,E,k]);return w.jsxs(w.Fragment,{children:[S==="basic"&&ie,S==="heatmap"&&w.jsxs("div",{className:`usage-heat-map-wrapper heatmap-${k}`,ref:J,children:[w.jsxs("div",{className:"day-tip-text-container",children:[w.jsx("span",{className:"tip-text",children:N("weekDaysShort")[0]}),w.jsx("span",{className:"tip-text"}),w.jsx("span",{className:"tip-text",children:N("weekDaysShort")[2]}),w.jsx("span",{className:"tip-text"}),w.jsx("span",{className:"tip-text",children:N("weekDaysShort")[4]}),w.jsx("span",{className:"tip-text"}),w.jsx("span",{className:"tip-text",children:N("weekDaysShort")[6]})]}),w.jsxs("div",{className:"usage-heat-map",children:[F.map((se,fe)=>{const oe=se.count,we=oe<=0?"":oe<=1?"stat-day-L1-bg":oe<=2?"stat-day-L2-bg":oe<=4?"stat-day-L3-bg":"stat-day-L4-bg";return w.jsx("span",{className:`stat-container ${we} ${R===se?"current":""} ${a===se.timestamp?"today":""}`,onMouseOver:Z=>Q(Z,se),onClick:Z=>pe(Z,se)},fe)}),o.map((se,fe)=>w.jsx("span",{className:"stat-container null"},fe))]})]}),!t&&D&&w.jsx(mJ,{allStat:F,todayTimeStamp:a,calendarType:S,handleCalendarTypeChange:le})]})};function vJ(e,t){try{e==null||e.saveLocalStorage("calendarType",t)}catch(n){console.error(n)}}function wJ(e){try{return(e==null?void 0:e.loadLocalStorage("calendarType"))||"heatmap"}catch(t){return console.error(t),"heatmap"}}const dx=({type:e,timestamp:t})=>{const{memoState:{memos:n}}=A.useContext(mt),[r,a]=A.useState([]),o=$.useRef(null);return A.useEffect(()=>{if(e==="daily"){if(t){const c=n.filter(d=>C.moment(d.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(t,"YYYY/MM/DD HH:mm:ss"),"day"));a(c);return}const s=n.filter(c=>C.moment(c.createdAt,"YYYY/MM/DD HH:mm:ss").isSame(C.moment(),"day"));a(s)}else if(e==="latest"){const s=n.filter(p=>!p.deletedAt&&p.rowStatus!=="ARCHIVED"),c=s.filter(p=>p.pinned),d=s.filter(p=>!p.pinned).slice(0,5);a([...c,...d])}},[n]),A.useEffect(()=>{o.current&&(o.current.scrollTop=0)},[n]),r.length>0?w.jsx("div",{ref:o,className:"thino-list-container",children:r.map(s=>w.jsx(Sa,{memo:s}))}):w.jsx("div",{className:"tip-text-container",children:w.jsx("span",{className:"tip-text",children:N("Here is No Memos.")})})},bJ=(e,t)=>{Lo.createRoot(e).render(w.jsx($.StrictMode,{children:w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(DJ,{plugin:t})})}))},DJ=({plugin:e})=>w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"thino-error-code-block",children:N("Please open thino first")}),w.jsx("button",{className:"thino-open-view",onClick:()=>e.openMemos("center"),children:N("Open thino in center window")})]}),SJ=(e,t)=>{Lo.createRoot(e).render(w.jsx($.StrictMode,{children:w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(IJ,{yaml:t})})}))},IJ=({yaml:e})=>{const t=Object.keys(e).filter(a=>e[a]),n=e.daily?e.daily:"",r=a=>{switch(a){case"editor":return O2;case"heatmap":return EJ;case"calendar":return CJ;case"daily":return MJ;case"list":return NJ;case"status":return xJ;default:return O2}};return w.jsx(w.Fragment,{children:t.map(a=>w.jsx("div",{"data-embed-type":a,className:Xn("thino-embed-container",a==="editor"?"thino-editor-modal":""),children:a==="daily"?r(a)(n):r(a)()}))})};function O2(){return w.jsx(Nu,{editorType:"inline"})}function TJ(e,t){try{const n=Lo.createRoot(e);return n.render(w.jsx($.StrictMode,{children:w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(Nu,{editorType:"inline",destroy:t})})})),n}catch(n){console.error(n)}}function EJ(){return w.jsx(gp,{basicType:"heatmap"})}function CJ(){return w.jsx(gp,{basicType:"basic"})}function xJ(){return w.jsx(E1,{statusType:"banner"})}function MJ(e){return w.jsx(dx,{type:"daily",timestamp:e})}function NJ(){return w.jsx(dx,{type:"latest"})}class fx extends C.Modal{constructor(n){super(n);me(this,"root")}onOpen(){const{contentEl:n,modalEl:r}=this;try{this.root=TJ(n,this.close.bind(this)),r.toggleClass("thino-editor-modal",!0),setTimeout(()=>{var a;(a=n.querySelector("textarea"))==null||a.focus(),this.app.workspace.trigger("focus-on-textarea")},10)}catch(a){console.error(a)}}onClose(){this.root.unmount(),this.containerEl&&this.containerEl.empty()}}const kJ=({userIcon:e})=>w.jsx("div",{className:"moments-view-user-icon",ref:t=>{if(e){t==null||t.empty();return}e||t&&C.setIcon(t,"Memos")},style:{backgroundImage:`url(${e})`}}),P2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuZGV2L3N2Z2pzIiB3aWR0aD0iMTQ0MCIgaGVpZ2h0PSI1NjAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDQwIDU2MCI+PGcgbWFzaz0idXJsKCZxdW90OyNTdmdqc01hc2sxMDgwJnF1b3Q7KSIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjE0NDAiIGhlaWdodD0iNTYwIiB4PSIwIiB5PSIwIiBmaWxsPSIjMGUyYTQ3Ij48L3JlY3Q+PHVzZSB4bGluazpocmVmPSIjU3ZnanNTeW1ib2wxMDg3IiB4PSIwIiB5PSIwIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1N5bWJvbDEwODciIHg9IjcyMCIgeT0iMCI+PC91c2U+PC9nPjxkZWZzPjxtYXNrIGlkPSJTdmdqc01hc2sxMDgwIj48cmVjdCB3aWR0aD0iMTQ0MCIgaGVpZ2h0PSI1NjAiIGZpbGw9IiNmZmZmZmYiPjwvcmVjdD48L21hc2s+PHBhdGggZD0iTS0xIDAgYTEgMSAwIDEgMCAyIDAgYTEgMSAwIDEgMCAtMiAweiIgaWQ9IlN2Z2pzUGF0aDEwODIiPjwvcGF0aD48cGF0aCBkPSJNLTMgMCBhMyAzIDAgMSAwIDYgMCBhMyAzIDAgMSAwIC02IDB6IiBpZD0iU3ZnanNQYXRoMTA4NiI+PC9wYXRoPjxwYXRoIGQ9Ik0tNSAwIGE1IDUgMCAxIDAgMTAgMCBhNSA1IDAgMSAwIC0xMCAweiIgaWQ9IlN2Z2pzUGF0aDEwODMiPjwvcGF0aD48cGF0aCBkPSJNMiAtMiBMLTIgMnoiIGlkPSJTdmdqc1BhdGgxMDg0Ij48L3BhdGg+PHBhdGggZD0iTTYgLTYgTC02IDZ6IiBpZD0iU3ZnanNQYXRoMTA4MSI+PC9wYXRoPjxwYXRoIGQ9Ik0zMCAtMzAgTC0zMCAzMHoiIGlkPSJTdmdqc1BhdGgxMDg1Ij48L3BhdGg+PC9kZWZzPjxzeW1ib2wgaWQ9IlN2Z2pzU3ltYm9sMTA4NyI+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIzMCIgeT0iOTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIzMCIgeT0iMTUwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIzMCIgeT0iMjEwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIzMCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIzMCIgeT0iMzMwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIzMCIgeT0iMzkwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIzMCIgeT0iNDUwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iMzAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjMwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjkwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjkwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjkwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjkwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSI5MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI5MCIgeT0iMzMwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iOTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iOTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjkwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI5MCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIxNTAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIxNTAiIHk9IjkwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIxNTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMTUwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjE1MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMTUwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjE1MCIgeT0iMzkwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMTUwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIxNTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMTUwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjIxMCIgeT0iMzAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjIxMCIgeT0iOTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIyMTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjIxMCIgeT0iMjEwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIyMTAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iMjEwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIyMTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjIxMCIgeT0iNDUwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMjEwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIyMTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMjcwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMjcwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iMjcwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIyNzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMjcwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjI3MCIgeT0iMzMwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMjcwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSIyNzAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMjcwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIyNzAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzMwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjMzMCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjMzMCIgeT0iMTUwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzMwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIzMzAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzMwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjMzMCIgeT0iMzkwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjMzMCIgeT0iNDUwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMzMwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjMzMCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjM5MCIgeT0iMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjM5MCIgeT0iOTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIzOTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iMzkwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjM5MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIzOTAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjM5MCIgeT0iMzkwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSIzOTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIzOTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjM5MCIgeT0iNTcwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iNDUwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NSIgeD0iNDUwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI0NTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iNDUwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjQ1MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NSIgeD0iNDUwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iNDUwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjQ1MCIgeT0iNDUwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI0NTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iNDUwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjUxMCIgeT0iMzAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI1MTAiIHk9IjkwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI1MTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjUxMCIgeT0iMjEwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI1MTAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTEwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI1MTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjUxMCIgeT0iNDUwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTEwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjUxMCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI1NzAiIHk9IjMwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTcwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjU3MCIgeT0iMTUwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSI1NzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iNTcwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjU3MCIgeT0iMzMwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI1NzAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNTcwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjU3MCIgeT0iNTEwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNTcwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjYzMCIgeT0iMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjYzMCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjYzMCIgeT0iMTUwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI2MzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNjMwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjYzMCIgeT0iMzMwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI2MzAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDE5NywgOTAsIDk5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iNjMwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjYzMCIgeT0iNTEwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2MzAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNjkwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjY5MCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjY5MCIgeT0iMTUwIiBzdHJva2U9InJnYmEoMTk3LCA5MCwgOTksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSI2OTAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjY5MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNjkwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgxOTcsIDkwLCA5OSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjY5MCIgeT0iMzkwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iNjkwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSg0NywgMTE0LCAxMzEsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI2OTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDQ3LCAxMTQsIDEzMSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjY5MCIgeT0iNTcwIiBzdHJva2U9InJnYmEoNDcsIDExNCwgMTMxLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48L3N5bWJvbD48L3N2Zz4=",rw="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuZGV2L3N2Z2pzIiB3aWR0aD0iMTQ0MCIgaGVpZ2h0PSI1NjAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDQwIDU2MCI+PGcgbWFzaz0idXJsKCZxdW90OyNTdmdqc01hc2sxMDgwJnF1b3Q7KSIgZmlsbD0ibm9uZSI+PHJlY3Qgd2lkdGg9IjE0NDAiIGhlaWdodD0iNTYwIiB4PSIwIiB5PSIwIiBmaWxsPSJyZ2JhKDIzMSwgMjM4LCAyNDUsIDEpIj48L3JlY3Q+PHVzZSB4bGluazpocmVmPSIjU3ZnanNTeW1ib2wxMDg3IiB4PSIwIiB5PSIwIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1N5bWJvbDEwODciIHg9IjcyMCIgeT0iMCI+PC91c2U+PC9nPjxkZWZzPjxtYXNrIGlkPSJTdmdqc01hc2sxMDgwIj48cmVjdCB3aWR0aD0iMTQ0MCIgaGVpZ2h0PSI1NjAiIGZpbGw9IiNmZmZmZmYiPjwvcmVjdD48L21hc2s+PHBhdGggZD0iTS0xIDAgYTEgMSAwIDEgMCAyIDAgYTEgMSAwIDEgMCAtMiAweiIgaWQ9IlN2Z2pzUGF0aDEwODUiPjwvcGF0aD48cGF0aCBkPSJNLTMgMCBhMyAzIDAgMSAwIDYgMCBhMyAzIDAgMSAwIC02IDB6IiBpZD0iU3ZnanNQYXRoMTA4MyI+PC9wYXRoPjxwYXRoIGQ9Ik0tNSAwIGE1IDUgMCAxIDAgMTAgMCBhNSA1IDAgMSAwIC0xMCAweiIgaWQ9IlN2Z2pzUGF0aDEwODYiPjwvcGF0aD48cGF0aCBkPSJNMiAtMiBMLTIgMnoiIGlkPSJTdmdqc1BhdGgxMDg0Ij48L3BhdGg+PHBhdGggZD0iTTYgLTYgTC02IDZ6IiBpZD0iU3ZnanNQYXRoMTA4MSI+PC9wYXRoPjxwYXRoIGQ9Ik0zMCAtMzAgTC0zMCAzMHoiIGlkPSJTdmdqc1BhdGgxMDgyIj48L3BhdGg+PC9kZWZzPjxzeW1ib2wgaWQ9IlN2Z2pzU3ltYm9sMTA4NyI+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjMwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjMwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIzMCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMjA4LCAyMTcsIDIwOSwgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMzAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIzMCIgeT0iMzkwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjMwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iMzAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIzMCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMjA4LCAyMTcsIDIwOSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjkwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI5MCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iOTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI5MCIgeT0iMjEwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjkwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iOTAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSI5MCIgeT0iMzkwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjkwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iOTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI5MCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjE1MCIgeT0iMzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMTUwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIxNTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIxNTAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIxNTAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIxNTAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIxNTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIxNTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODMiIHg9IjE1MCIgeT0iNTEwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjE1MCIgeT0iNTcwIiBzdHJva2U9InJnYmEoMjA4LCAyMTcsIDIwOSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjIxMCIgeT0iMzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMjEwIiB5PSI5MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSIyMTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIiBzdHJva2Utd2lkdGg9IjMiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjIxMCIgeT0iMjEwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjIxMCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NSIgeD0iMjEwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iMjEwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIyMTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIyMTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSIyMTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIyNzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjI3MCIgeT0iOTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iMjcwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSIyNzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIyNzAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSIyNzAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIyNzAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIyNzAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIyNzAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg0IiB4PSIyNzAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSIzMzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjMzMCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMzMwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMzMwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMzMwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iMzMwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMzMwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MyIgeD0iMzMwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NSIgeD0iMzMwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzMwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NSIgeD0iMzkwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSIzOTAiIHk9IjkwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjM5MCIgeT0iMTUwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODEiIHg9IjM5MCIgeT0iMjEwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjM5MCIgeT0iMjcwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODUiIHg9IjM5MCIgeT0iMzMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjM5MCIgeT0iMzkwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzkwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iMzkwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iMzkwIiB5PSI1NzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNDUwIiB5PSIzMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgyIiB4PSI0NTAiIHk9IjkwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiIHN0cm9rZS13aWR0aD0iMyI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iNDUwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNDUwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI0NTAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI0NTAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI0NTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI0NTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI0NTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI0NTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI1MTAiIHk9IjMwIiBzdHJva2U9InJnYmEoMjA4LCAyMTcsIDIwOSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODQiIHg9IjUxMCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iNTEwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iNTEwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iNTEwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTEwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iNTEwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTEwIiB5PSI0NTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNTEwIiB5PSI1MTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI1MTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI1NzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODYiIHg9IjU3MCIgeT0iOTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTcwIiB5PSIxNTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NiIgeD0iNTcwIiB5PSIyMTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MSIgeD0iNTcwIiB5PSIyNzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4NCIgeD0iNTcwIiB5PSIzMzAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSI+PC91c2U+PHVzZSB4bGluazpocmVmPSIjU3ZnanNQYXRoMTA4MiIgeD0iNTcwIiB5PSIzOTAiIHN0cm9rZT0icmdiYSgyMDgsIDIxNywgMjA5LCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI1NzAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI1NzAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI1NzAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjMwIiBzdHJva2U9InJnYmEoMTYsIDUwLCA4MywgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjYzMCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI2MzAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI2MzAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2MzAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjMwIiBzdHJva2U9InJnYmEoMjA4LCAyMTcsIDIwOSwgMSkiPjwvdXNlPjx1c2UgeGxpbms6aHJlZj0iI1N2Z2pzUGF0aDEwODIiIHg9IjY5MCIgeT0iOTAiIHN0cm9rZT0icmdiYSgxNiwgNTAsIDgzLCAxKSIgc3Ryb2tlLXdpZHRoPSIzIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjE1MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjIxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2OTAiIHk9IjI3MCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjMzMCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgzIiB4PSI2OTAiIHk9IjM5MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg1IiB4PSI2OTAiIHk9IjQ1MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDgxIiB4PSI2OTAiIHk9IjUxMCIgc3Ryb2tlPSJyZ2JhKDIwOCwgMjE3LCAyMDksIDEpIj48L3VzZT48dXNlIHhsaW5rOmhyZWY9IiNTdmdqc1BhdGgxMDg2IiB4PSI2OTAiIHk9IjU3MCIgc3Ryb2tlPSJyZ2JhKDE2LCA1MCwgODMsIDEpIj48L3VzZT48L3N5bWJvbD48L3N2Zz4=",AJ=e=>{const{globalState:{memoListView:t,markMemoId:n,manifest:r,editMemoId:a},dailyNotesState:{app:o,settings:s}}=A.useContext(mt),{thinos:c}=e,d=$.useRef(null),p=$.useRef(null),[m,g]=$.useState(!1),[v,D]=A.useState({}),[S,T]=A.useState((o==null?void 0:o.loadLocalStorage("dayMarkRange"))||"day");A.useEffect(()=>{s!=null&&s.showDayMark&&D(yp(c,(o==null?void 0:o.loadLocalStorage("dayMarkRange"))||"day"))},[c]),A.useEffect(()=>{d.current.closest(".workspace-window")&&g(!0)},[d.current]),A.useEffect(()=>{n&&g(!0)},[n]),A.useEffect(()=>{a?(g(!0),setTimeout(()=>{o.workspace.trigger("focus-on-textarea")},200)):g(!1)},[a]),A.useEffect(()=>{p.current&&(!m&&C.setIcon(p.current,"camera"),m&&C.setIcon(p.current,"camera-off"))},[p.current,m]);const E=A.useCallback(()=>{o.setting.open(),o.setting.openTabById(r.id||"obsidian-memos")},[o]);return w.jsxs("div",{ref:d,className:Xn("moments-view",m?"show-editor":""),children:[w.jsxs("div",{className:"moments-view-background-wrapper",children:[w.jsx(FJ,{}),w.jsx("div",{ref:p,className:"moments-show-editor-btn",onClick:()=>{(m||a)&&g(!m),!m&&!a&&new fx(o).open()}}),w.jsxs("div",{className:"moments-view-background-overlay",children:[w.jsxs("div",{className:"moments-view-user-info",children:[w.jsx("div",{className:"moments-view-user-name",children:s==null?void 0:s.UserName}),w.jsx(kJ,{userIcon:s==null?void 0:s.MomentsIcon})]}),w.jsx("div",{className:"moments-view-user-idea",children:s.MomentsQuote||" "})]})]}),s!=null&&s.showDayMark?v&&Object.keys(v).length>0&&Object.keys(v).map((O,k)=>w.jsx(Ow,{type:"list",thinos:v[O],dayMark:O,dayMarkRange:S,thinoWrapper:j=>w.jsx(j2,{thino:j.thino,handleOpenSettings:E},j.thino.createdAt+k)},O)):c.map((O,k)=>w.jsx(j2,{thino:O,handleOpenSettings:E},O.createdAt+k))]})},FJ=()=>{const{dailyNotesState:{view:e,settings:t}}=A.useContext(mt),[n,r]=A.useState((t==null?void 0:t.MomentsBackgroundImage)||rw);return A.useEffect(()=>{if(!(t!=null&&t.MomentsBackgroundImage)){r(document.body.hasClass("theme-dark")?P2:rw);return}r(t==null?void 0:t.MomentsBackgroundImage)},[t==null?void 0:t.MomentsBackgroundImage]),A.useEffect(()=>{e&&e.registerEvent(e.app.workspace.on("css-change",()=>{r(document.body.hasClass("theme-dark")&&!(t!=null&&t.MomentsBackgroundImage)?P2:!document.body.hasClass("theme-dark")&&!(t!=null&&t.MomentsBackgroundImage)?rw:t==null?void 0:t.MomentsBackgroundImage)}))},[e]),w.jsx("div",{className:"moments-view-background",style:{backgroundImage:`url(${n})`}})},OJ=e=>{const{icon:t}=e,n=A.useCallback(()=>{app.setting.open(),app.setting.openTabById(manifest.id||"obsidian-memos")},[]);return w.jsx("div",{className:"thino-moment-icon",ref:r=>{if(t){r==null||r.empty();return}t||r&&C.setIcon(r,"Memos")},style:{backgroundImage:`url(${t})`},onClick:n})},j2=e=>{const{dailyNotesState:{settings:t}}=A.useContext(mt),n=A.useRef(null),r=A.useRef(null),{thino:a}=e;return A.useEffect(()=>{n.current&&C.setIcon(n.current,"more-horizontal")},[n.current]),w.jsxs("div",{className:"thino-moment-wrapper",children:[w.jsx(OJ,{icon:t==null?void 0:t.MomentsIcon}),w.jsxs("div",{ref:r,className:"thino-moment-container",children:[w.jsx("div",{className:"thino-moment-user-name",children:t==null?void 0:t.UserName}),w.jsx("div",{className:"thino-moment-user-content",children:w.jsx(Sa,{memo:a})})]})]})};function PJ(e){const t=e.filter(r=>r.pinned),n=e.filter(r=>!r.pinned);return[...t,...n]}function yp(e,t){const n={},r={day:"YYYY-MM-DD ddd",week:"YYYY-[W]WW",month:"YYYY-MM",quarter:"YYYY-[Q]1",year:"YYYY"};for(const a of e){const o=C.moment(a.createdAt,"YYYY/MM/DD HH:mm:ss").format(r[t]);if(a.pinned){n.PINNED||(n.PINNED=[]),n.PINNED.push(a);continue}n[o]||(n[o]=[]),n[o].push(a)}return n}function Yg(e){const{tag:t,duration:n,type:r,text:a,filter:o}=e,s=Et.getQueryById(o);return!(!!(t||n&&n.from{const r=e.filter(g=>g.rowStatus!=="ARCHIVED"&&!(g.deletedAt!==""&&g.deletedAt)),{tag:a,duration:o,type:s,text:c,filter:d}=t,p=Et.getQueryById(d);return!!(a||o&&o.from{let v=!0;if(g.thinoType!==void 0&&n&&g.thinoType==="TASK-DONE"&&(v=!1),g.content.contains("comment:")&&(v=!1),p){const D=JSON.parse(p.querystring);Array.isArray(D)&&(v=Wd(g,D))}if(a){const D=new Set;for(const S of Array.from(g.content.match(Fn)||[])){const E=S.replace(Fn,"$1").trim().split("/");let O="";for(const k of E)O+=k,D.add(O),O+="/"}for(const S of Array.from(g.content.match($n)||[])){const E=S.replace($n,"$1").trim().split("/");let O="";for(const k of E)O+=k,D.add(O),O+="/"}for(const S of Array.from(g.content.match(mr)||[])){const E=S.replace(mr,"$2").trim().split("/");let O="";for(const k of E)O+=k,D.add(O),O+="/"}D.has(a)||(v=!1)}return o&&o.fromo.to)&&(v=!1),s&&(s==="NOT_TAGGED"&&(g.content.match(Fn)!==null||g.content.match(mr)!==null||g.content.match($n)!==null)||s==="LINKED"&&g.content.match(Bu)===null||s==="IMAGED"&&g.content.match(_u)===null||s==="CONNECTED"&&g.content.match(Il)===null)&&(v=!1),c&&!g.content.toLowerCase().includes(c.toLowerCase())&&(v=!1),v}):r.filter(g=>!g.content.contains("comment:"))},LJ=({updateThinos:e})=>{var G;const{locationState:{query:t},memoState:{memos:n},globalState:{memoListView:r},dailyNotesState:{app:a,settings:o,verifyState:s,plugin:c}}=A.useContext(mt),[d,p]=A.useState(!1),[m,g]=A.useState(!1),[v,D,S]=Kr([]),[T,E]=A.useState([]),[O,k]=A.useState({}),[j,F]=A.useState((G=window.app||a)==null?void 0:G.loadLocalStorage("thinoListView")),[B,R]=A.useState((a==null?void 0:a.loadLocalStorage("showDayMark"))||!1),[z,H]=A.useState((a==null?void 0:a.loadLocalStorage("dayMarkRange"))||"day"),[Y,U,J]=Kr([]),Q=A.useRef(0),le=A.useRef(!1),pe=A.useRef(null),ie=A.useRef(null),se=A.useRef(null),fe=A.useRef(null),oe=A.useRef(!1);A.useEffect(()=>{F(r),a&&a.saveLocalStorage("thinoListView",r),D(Y.slice(0,v.length>20?Math.min(v.length,40):40))},[r]),A.useEffect(()=>()=>{ie.current&&(ie.current=null),se.current&&(se.current=null),fe.current&&(fe.current=null)},[]),A.useLayoutEffect(()=>{if((n.length!==0||!a)&&oe.current===!0)return;const te=RJ(a);!te||te.length===0||(U(te),E(te),R((a==null?void 0:a.loadLocalStorage("showDayMark"))||!1),a!=null&&a.loadLocalStorage("showDayMark")&&k(yp(te,(a==null?void 0:a.loadLocalStorage("dayMarkRange"))||"day")))},[a]),A.useEffect(()=>{if(n.length===0&&!Te.initialized)return;p(!1);const te=PJ(n),ge=jJ({tempMemos:te,query:t,HideDoneTasks:(o==null?void 0:o.HideDoneTasks)||!1});return oe.current=!0,e&&e(ge),U(ge),()=>{oe.current=!1}},[n,t,o==null?void 0:o.HideDoneTasks]),A.useEffect(()=>{D(Y.slice(0,v.length>20?Math.min(v.length,40):40))},[Y]),A.useEffect(()=>{var te;v.length<40&&((te=se.current)==null||te.click())},[Y]),A.useEffect(()=>{(Yg(t)&&v.length0||!Yg(t)&&v.length===Y.length&&Y.length>0)&&g(!0),BJ(v||[],a),E(v),a==null||a.saveLocalStorage("showDayMark",o==null?void 0:o.showDayMark),a==null||a.saveLocalStorage("dayMarkRange",o==null?void 0:o.dayMarkRange),R((o==null?void 0:o.showDayMark)||!1),H((o==null?void 0:o.dayMarkRange)||"day"),o!=null&&o.showDayMark&&k(yp(v,o==null?void 0:o.dayMarkRange))},[v,o==null?void 0:o.showDayMark,o==null?void 0:o.dayMarkRange]),A.useEffect(()=>{if(!ie.current)return;const te=async()=>{le.current||(Q.current++,await we(),Q.current>=1&&(le.current=!0,setTimeout(()=>{Q.current=0,le.current=!1},3e3)))};v.length<40&&te();const ge=new IntersectionObserver(([Ie])=>{if(Ie.isIntersecting){if(m)return;te()}else Q.current=0,le.current=!1});return ie!=null&&ie.current&&ge.observe(ie.current),()=>{ie!=null&&ie.current&&ge.unobserve(ie.current)}},[d,m,ie.current]),A.useEffect(()=>{var te;(te=fe.current)==null||te.scrollTo({top:0})},[t]);const we=async()=>{try{if(J.current.length>S.current.length){p(!0);const te=Math.min(S.current.length+40,J.current.length)-S.current.length,ge=J.current.slice(S.current.length,S.current.length+te);D(Ie=>[...Ie,...ge]),p(!1),g(ge.length<40)}}catch(te){console.error(te),new C.Notice(te.response.data.message)}},Z=A.useMemo(()=>w.jsx("div",{ref:ie,className:Xn("status-text-container",j==="calendar"||j==="table"?"hidden":""),children:w.jsx("p",{className:"status-text",children:d?N("Fetching data..."):m?Y.length===0?N("Noooop!"):N("All Data is Loaded 🎉"):w.jsx(w.Fragment,{children:w.jsx("span",{ref:se,className:"cursor-pointer hover:text-green-600",onClick:we,children:N("fetch more")})})})}),[j,we,Y,d,m,ie]);return w.jsxs("div",{className:`memolist-wrapper ${m?"completed":""}`,ref:fe,children:[j==="chat"&&Z,w.jsxs("div",{ref:pe,className:"memolist-container",children:[j==="chat"&&w.jsx(cJ,{thinos:T}),j==="calendar"&&w.jsx(XG,{thinos:Y}),j==="table"&&w.jsx(sJ,{thinos:Y}),j==="moments"&&w.jsx(AJ,{thinos:T}),j==="list"&&w.jsx(gy,{breakpointCols:1,className:`${j}-view masonry-memolist`,columnClassName:"masonry-memolist-grid_column",children:B?w.jsx(w.Fragment,{children:Object.keys(O).map(te=>w.jsx(Ow,{type:"list",thinos:O[te],dayMark:te,dayMarkRange:z},te))}):T.map((te,ge)=>w.jsx(Sa,{memo:te},`${te.id}-${C.moment(te.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${ge}`))}),j==="waterfall"&&w.jsx(w.Fragment,{children:B&&Object.keys(O).length>0?Object.keys(O).map(te=>w.jsx(Ow,{type:"waterfall",thinos:O[te],dayMark:te,dayMarkRange:z},te)):w.jsx(gy,{breakpointCols:3,className:`${j}-view masonry-memolist`,columnClassName:"masonry-memolist-grid_column",children:T.map((te,ge)=>w.jsx(Sa,{memo:te},`${te.id}-${C.moment(te.updatedAt,"YYYY/MM/DD HH:mm:ss").format("x")}-${ge}`))})})]}),j!=="chat"&&Z]})};function hx(e){return`memosListCache:${e}`}function RJ(e){var t;try{const n=hx(e==null?void 0:e.appId),r=Kn.get([n])[n];return r?((t=JSON.parse(r))==null?void 0:t.memos)||[]:[]}catch(n){return console.error(n),[]}}function BJ(e,t){try{if(!e)return;const n=e==null?void 0:e.slice(0,100),r=hx(t==null?void 0:t.appId);Kn.set({[r]:JSON.stringify({memos:n})})}catch(n){console.error(n)}}const Tu=async e=>{const{app:t,settings:n}=Xe.getState();if(!n.startSync||!(t!=null&&t.loadLocalStorage("tokenForSync")))return;const r=await W6(e);if(!r||r.length===0)return;r.sort((s,c)=>C.moment(s.createdAt,"YYYY/MM/DD HH:mm:ss").isAfter(C.moment(c.createdAt,"YYYY/MM/DD HH:mm:ss"))?1:-1);const a=r.filter(s=>!s.deleted),o=r.filter(s=>s.deleted);for(let s=0;s{if(!t||!r||!n||!(t==null?void 0:t.loadLocalStorage("tokenForSync"))||!e.startSync)return;s.current=window.setInterval(async()=>{const v=Qw(t);await Tu(v)},3e4),n.registerInterval(s.current);const g=Qw(t);return Tu(g),()=>{s.current&&window.clearInterval(s.current)}},[n,t,r,e.startSync]);const p=[w.jsx(Rp,{thinosCount:c.length,thinos:c},"filter"),w.jsx(LJ,{updateThinos:m=>{d(m)}},"list")];return w.jsx(w.Fragment,{children:a==="chat"?w.jsx(w.Fragment,{children:[w.jsx(ay,{syncThino:Tu},"header"),...p.reverse(),w.jsx(Nu,{className:"mod-editor-bottom",editorType:"inline"},"editor")]}):w.jsx(w.Fragment,{children:o?[w.jsx(ay,{syncThino:Tu},"header"),...p,w.jsx(Nu,{className:"mod-editor-bottom",editorType:"block"},"editor")]:[w.jsx(ay,{syncThino:Tu},"header"),w.jsx(Nu,{editorType:"block"},"editor"),...p]})})}function HJ(e){try{e!=null&&e.saveLocalStorage&&(e==null||e.saveLocalStorage("thinoLastUpdated",C.moment("2000-01-01 00:01:00","YYYY-MM-DD HH:mm:ss").format("x")))}catch(t){console.error(t)}}function Qw(e){try{const t=(e==null?void 0:e.loadLocalStorage)&&(e==null?void 0:e.loadLocalStorage("thinoLastUpdated"));return t||C.moment("2000-01-01 00:01:00","YYYY-MM-DD HH:mm:ss").format("x")}catch(t){return console.error(t),C.moment().format("x")}}function YJ(e){try{e!=null&&e.saveLocalStorage&&(e==null||e.saveLocalStorage("thinoLastUpdated",C.moment().format("x")))}catch(t){console.error(t)}}function af(e=!0){const[t,n]=A.useState({isLoading:e,isFailed:!1,isSucceed:!1,isPending:!1});return{...t,setLoading:()=>{n({...t,isLoading:!0,isFailed:!1,isPending:!1,isSucceed:!1})},setFinish:()=>{n({...t,isLoading:!1,isFailed:!1,isPending:!1,isSucceed:!0})},setError:()=>{n({...t,isLoading:!1,isFailed:!0,isPending:!1,isSucceed:!1})},setPending:()=>{n({...t,isLoading:!1,isFailed:!1,isPending:!0,isSucceed:!1})}}}const zJ={text:N("SELECT"),value:""},UJ=e=>{const{className:t,dataSource:n,handleValueChanged:r,value:a}=e,[o,s]=ki(!1),c=A.useRef(null);let d=zJ;for(const g of n)if(g.value===a){d=g;break}A.useEffect(()=>{if(o){const g=v=>{var D;(D=c.current)!=null&&D.contains(v.target)||s(!1)};window.addEventListener("click",g,{capture:!0,once:!0})}},[o]);const p=g=>{r&&r(g.value),s(!1)},m=g=>{g.stopPropagation(),s()};return w.jsxs("div",{className:`selector-wrapper ${t||""}`,ref:c,children:[w.jsxs("div",{className:`current-value-container ${o?"active":""}`,onClick:m,children:[w.jsx("span",{className:"value-text",children:d.text}),w.jsx("span",{ref:g=>{g&&C.setIcon(g,"chevron-right")},className:"btn arrow-text"})]}),w.jsx("div",{className:`items-wrapper ${o?"":"hidden"}`,children:n.map(g=>w.jsx("div",{className:`item-container ${g.value===a?"selected":""}`,onClick:()=>{p(g)},children:g.text},g.value))})]})},bd=A.memo(UJ),pb=e=>{const{destroy:t,queryId:n,type:r="dialog"}=e,[a,o]=A.useState(""),[s,c]=A.useState(r!=="dialog"?[kD()]:[]),d=af(!1),[p,m]=A.useState(!1),[g,v]=ki(!1),D=Te.getState().memos.filter(R=>!(R.deletedAt!==""&&R.deletedAt)).filter(R=>Wd(R,s)).length;A.useEffect(()=>{S()},[n]);const S=()=>{const R=Et.getQueryById(n??"");if(R){o(R.title);const z=JSON.parse(R.querystring);return Array.isArray(z)&&c(z),R}},T=R=>{const z=R.target.value;o(z)},E=async()=>{if(!a)return new C.Notice(N("TITLE CANNOT BE NULL!")),null;if(s.length===0)return new C.Notice(N("FILTER CANNOT BE NULL!")),null;if(s.length===1&&s[s.length-1].value.value==="")return new C.Notice(N("Please finish the last filter setting first")),null;let R;try{n&&!n.startsWith("Filter [Temp] ")?(R=await Et.updateQuery(n,a,JSON.stringify(s)),Et.editQuery(R),await Et.getMyAllQueries()):(R=await Et.createQuery(a,JSON.stringify(s)),Et.pushQuery(R),await Et.getMyAllQueries())}catch(z){new C.Notice(z.message)}return R},O=async()=>{switch(r){case"modal":case"inline":if(s.length===0){new C.Notice(N("FILTER CANNOT BE NULL!"));return}if(s.length===1&&s[s.length-1].value.value===""){new C.Notice(N("Please finish the last filter setting first"));return}try{const R=Et.getQueryById(n??"");if(R&&JSON.stringify(s)===R.querystring){He.setMemoFilter(R.id),t();return}const z=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify(s));Et.pushQuery(z),He.setMemoFilter(z.id)}catch(R){new C.Notice(R.message)}t();break;case"dialog":try{if(!await E())return}catch(R){console.error(R),new C.Notice(R.message)}t();break}},k=()=>{if(s.length===0){new C.Notice(N("FILTER CANNOT BE NULL!"));return}if(p){He.setMemoFilter(""),m(!1);return}const R=Et.getQueryById(n??"");if(R&&JSON.stringify(s)===R.querystring){He.setMemoFilter(R.id);return}const z=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify(s));Et.pushQuery(z),He.setMemoFilter(z.id),e.setPreview&&e.setPreview(z.id),m(!0)},j=()=>{if(s.length>0&&s[s.length-1].value.value===""){new C.Notice(N("Please finish the last filter setting first"));return}c([...s,kD()])},F=A.useCallback((R,z)=>{c(H=>{const Y=[...H];return Y[R]=z,Y})},[]),B=A.useCallback(R=>{c(z=>z.filter((Y,U)=>U!==R))},[]);return w.jsxs(w.Fragment,{children:[r==="dialog"&&w.jsxs("div",{className:"dialog-header-container",children:[w.jsxs("span",{className:"title-text",children:[w.jsx("span",{className:"icon-text",children:"🔖"}),N(n?"EDIT QUERY":"CREATE QUERY")]}),w.jsx("button",{ref:R=>{R&&C.setIcon(R,"x")},className:"btn close-btn",onClick:t})]}),w.jsxs("div",{className:"dialog-content-container",children:[(r==="dialog"||g)&&w.jsxs("div",{className:"form-item-container input-form-container",children:[w.jsx("span",{className:"normal-text",children:N("TITLE")}),w.jsx("input",{className:"title-input",type:"text",value:a,onChange:T})]}),w.jsxs("div",{className:"form-item-container filter-form-container",children:[w.jsx("span",{className:"normal-text",children:N("FILTER")}),w.jsxs("div",{className:"filters-wrapper",children:[s.map((R,z)=>w.jsx(ZJ,{index:z,filter:R,handleFilterChange:F,handleFilterRemove:B},z)),w.jsx("div",{className:"create-filter-btn",onClick:j,children:N("ADD FILTER TERMS")})]})]})]}),w.jsx("div",{className:"dialog-footer-container",children:w.jsxs("div",{className:"btns-container",children:[(r==="inline"||r==="modal")&&w.jsx("button",{className:`btn ${g?"mod-cta":"save-btn"}`,onClick:async()=>{if(!g)v();else{const R=await E();v(!1),t(),R&&He.setMemoFilter(R.id)}},children:N(g?"Set and save":"Save")}),w.jsxs("div",{className:"btns-group-container",children:[w.jsxs("span",{className:`tip-text ${s.length===0&&"hidden"}`,children:[N("MATCH")," Thino ",w.jsx("strong",{children:D})," ",N("TIMES")]}),w.jsx(w.Fragment,{children:r==="inline"&&w.jsx("button",{className:"btn mod-cta",onClick:k,children:N("Preview")})}),w.jsx("button",{className:`btn save-btn ${d.isLoading?"requesting":""}`,onClick:O,children:N(r==="inline"||r==="modal"?"Filter":n?"EDIT":"Save")})]})]})})]})},VJ=e=>{const{index:t,filter:n,handleFilterChange:r,handleFilterRemove:a}=e,{type:o}=n,s=A.useRef(null),c=A.useRef(null),d=A.useRef(n),p=A.useRef(o);A.useEffect(()=>{d.current=e.filter},[n]),A.useEffect(()=>{if(s.current)return o==="TAG"&&!c.current&&(p.current=o,c.current=new yE(s.current,D)),()=>{c.current&&(c.current.destroy(),c.current=null)}},[s,o]);const m=A.useCallback(E=>{["AND","OR"].includes(E)&&r(t,{...n,relation:E})},[n]),g=A.useCallback(async E=>{var O;if(n.type!==E){const{verifyState:k}=Xe.getState(),j=!C.Platform.isDesktop&&await((O=window.Capacitor)==null?void 0:O.Plugins.Device.getId()),F=C.Platform.isDesktop?await vn():j.identifier||j.uuid,B=k&&(k==null?void 0:k.appId)===F;if(E==="SOURCE"&&!B){qt();return}const R=Object.values(pl[E].operators);r(t,{...n,type:E,value:{operator:R[0].value,value:""}})}},[n]),v=A.useCallback(E=>{r(t,{...n,value:{...n.value,operator:E}})},[n]),D=A.useCallback(E=>{r(t,{...d.current,value:{...d.current.value,value:E}})},[n]),S=()=>{a(t)},T={TYPE:w.jsx(bd,{className:"value-selector",dataSource:pl.TYPE.values,value:n.value.value,handleValueChanged:D}),LIST:w.jsx(bd,{className:"value-selector",dataSource:pl.LIST.values,value:n.value.value,handleValueChanged:D}),SOURCE:w.jsx(bd,{className:"value-selector",dataSource:pl.SOURCE.values,value:n.value.value,handleValueChanged:D}),TAG:w.jsx("input",{type:"text",id:Math.random().toString(36).substring(7),className:"value-inputer",ref:s,value:n.value.value,onChange:E=>{D(E.target.value)}}),TEXT:w.jsx("input",{type:"text",className:"value-inputer",value:n.value.value,onChange:E=>{D(E.target.value)}}),DATE:w.jsxs("div",{className:"date-inputer",children:[w.jsx(py,{type:"icon",handleValueChange:D}),w.jsx("input",{type:"text",className:"value-inputer",value:n.value.value,onChange:E=>{D(E.target.value)}})]})};return w.jsxs("div",{className:"memo-filter-input-wrapper",children:[t>0&&w.jsx(bd,{className:"relation-selector",dataSource:u8,value:n.relation,handleValueChanged:m}),w.jsx(bd,{className:"type-selector",dataSource:Object.values(pl),value:n.type,handleValueChanged:g}),w.jsxs(w.Fragment,{children:[Object.keys(pl).includes(o)&&w.jsx(bd,{className:"operator-selector",dataSource:Object.values(pl[o].operators),value:n.value.operator,handleValueChanged:v}),T[o]]}),w.jsx("div",{ref:E=>{E&&C.setIcon(E,"x")},className:"btn remove-btn",onClick:S})]})},ZJ=A.memo(VJ);function Xw(e){By({className:"create-query-dialog"},pb,{queryId:e})}const mb=e=>{var D,S;const{dailyNotesState:{app:t,verifyState:n},locationState:{query:r}}=A.useContext(mt),a=$.useRef(null),[o,s]=$.useState(!1),c=$.useRef(null),[d,p]=$.useState(""),m=Vy(a.current,c.current,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,10]}}]});A.useEffect(()=>{o&&m.update&&(m==null||m.update())},[o]),A.useEffect(()=>{a&&C.setIcon(a.current,"filter")},[a]);const g=async()=>{var O;const T=!C.Platform.isDesktop&&await((O=window.Capacitor)==null?void 0:O.Plugins.Device.getId()),E=C.Platform.isDesktop?await vn():T.identifier||T.uuid;return!n||(n==null?void 0:n.appId)!==E?(qt(),!1):!0};return Pp(c,()=>{s(!1),d&&He.getState().query.filter===d&&He.setMemoFilter("")}),w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"thino-inline-filter-wrapper pro",ref:a,onClick:async()=>{await g()&&(C.Platform.isDesktop?(s(!o),await(m==null?void 0:m.update())):new WJ(Xe.getState().app,r.filter,E=>{p(E)}).open())}}),w.jsx("div",{ref:c,className:`thino-inline-filter-container ${o?"":"hidden"}`,style:m.styles.popper,children:o&&w.jsx(pb,{type:"inline",queryId:(D=r.filter)!=null&&D.startsWith("Filter [Temp] ")&&!((S=r.filter)!=null&&S.includes("Filter [Temp]"))?"":r.filter,destroy:()=>{s(!1)},setPreview:T=>{p(T)}})})]})};class WJ extends C.Modal{constructor(n,r,a){super(n);me(this,"root");me(this,"setPreview");this.filter=r,this.setPreview=a}onOpen(){var r,a;const{contentEl:n}=this;this.root=Ap(n),this.root.render(w.jsx(Bo,{store:Ee,context:mt,children:w.jsx("div",{className:"thino-inline-filter-container",children:w.jsx(pb,{type:"modal",queryId:(r=this.filter)!=null&&r.startsWith("Filter [Temp] ")&&!((a=this.filter)!=null&&a.includes("Filter [Temp]"))?"":this.filter,destroy:()=>{this.close()},setPreview:o=>{this.setPreview(o)}})})}))}onClose(){var n;(n=this.root)==null||n.unmount()}}const px=()=>{const{dailyNotesState:{app:e},globalState:{isMobileView:t,showSiderbarInMobileView:n}}=A.useContext(mt),[r]=A.useState($.createRef());A.useEffect(()=>{if(!r.current)return;const o=r.current;C.setIcon(o,"refresh-cw")},[r.current]);const a=A.useCallback(async()=>{if(!(t&&n)){if(Tu){const o=Qw(e);await Tu(o)}await Te.fetchAllMemos()}},[]);return w.jsx("span",{className:"refresh-icon",ref:r,onClick:()=>{a(),r&&r.current.firstElementChild.toggleClass("rotate-hidden",!0),setTimeout(()=>{r&&r.current.firstElementChild.toggleClass("rotate-hidden",!1)},1e3)}})},ay=()=>{const{locationState:{query:{filter:e}},globalState:{isMobileView:t},queryState:{queries:n}}=A.useContext(mt),[r,a]=A.useState("THINO");A.useEffect(()=>{const s=Et.getQueryById(e);a(s?s.title:"THINO")},[e,n]);const o=A.useCallback(s=>{s.stopPropagation(),Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"section-header-container memos-header-container",children:[w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:t,children:w.jsx("button",{ref:s=>{s&&C.setIcon(s,"menu")},className:"btn action-btn clickable-icon",onClick:o})}),w.jsx("span",{className:"normal-text",children:r}),w.jsx(px,{})]}),w.jsxs("div",{className:"memos-header-search-section",children:[w.jsx(D8,{}),w.jsx(b8,{}),w.jsx(mb,{}),w.jsx(Fp,{})]})]})},$J=()=>{const{dailyNotesState:{settings:e,app:t,verifyState:n},globalState:{manifest:r,showSiderbarInMobileView:a,isMobileView:o}}=A.useContext(mt),[s,c]=A.useState("Memos"),[d,p]=A.useState(!1);A.useEffect(()=>{e&&c(e.UserName)},[e]);const m=A.useCallback(()=>{He.pushHistory("/"),He.clearQuery()},[]),g=()=>{const v=document.querySelector(".memos-sidebar-wrapper"),D=document.querySelector(".menu-btns-popup");D.style.top=70-v.scrollTop+"px",p(!0)};return w.jsxs("div",{className:"user-banner-container",children:[w.jsxs("div",{className:"userinfo-header-container",children:[w.jsxs("div",{className:"userinfo-container",onClick:()=>{t.setting.open(),t.setting.openTabById(r.id||"obsidian-memos")},children:[w.jsx("div",{ref:v=>{if(e!=null&&e.MomentsIcon){v==null||v.empty();return}e!=null&&e.MomentsIcon||v&&C.setIcon(v,"Memos")},className:"thino-user-icon",style:{backgroundImage:`url(${e==null?void 0:e.MomentsIcon})`}}),w.jsxs("div",{className:"thino-user-info",children:[w.jsxs("span",{className:"username-container",children:[w.jsx("span",{"aria-label":s==="MEMO 😉"?"THINO 😉":s||"THINO",className:"username-text",onClick:m,children:s==="MEMO 😉"?"THINO 😉":s||"THINO"}),w.jsx("span",{className:`user-pro-badge ${n?"activated":""}`,onClick:()=>{t.setting.open(),t.setting.openTabById(r.id||"obsidian-memos")},children:"PRO"})]}),(e==null?void 0:e.MomentsQuote)&&w.jsx("span",{className:"thino-user-quote",children:e==null?void 0:e.MomentsQuote})]})]}),w.jsxs("span",{className:"btn-group",children:[(e==null?void 0:e.DefaultThemeForThino)==="modern"&&!o&&w.jsx(px,{}),w.jsx("span",{ref:v=>{v&&v.hasChildNodes()||v&&C.setIcon(v,"more-horizontal")},className:"btn action-btn menu-popup-btn",onClick:g}),a&&w.jsx("span",{ref:v=>{v&&v.hasChildNodes()||v&&C.setIcon(v,"x")},className:"btn action-btn",onClick:()=>{Qe.setShowSiderbarInMobileView(!1)}})]}),w.jsx(a8,{shownStatus:d,setShownStatus:p})]}),w.jsx(E1,{statusType:"banner"})]})},L2=()=>{const{queryState:{queries:e},dailyNotesState:{app:t},locationState:{query:{filter:n}}}=A.useContext(mt),r=af(),[a,o]=A.useState([]);return A.useEffect(()=>{const s=e.filter(c=>{var d,p;return!((d=c.id)!=null&&d.toString().startsWith("Filter [Temp]"))&&!((p=c.id)!=null&&p.toString().includes("Filter [Temp]"))}).sort((c,d)=>{if(d.pinnedAt&&!c.pinnedAt)return 1;if(c.pinnedAt&&!d.pinnedAt)return-1;const p=Ue.getTimeStampByDate(c.pinnedAt||c.createdAt);return Ue.getTimeStampByDate(d.pinnedAt||d.createdAt)-p});o(s)},[e]),A.useEffect(()=>{Et.getMyAllQueries().catch(()=>{}).finally(()=>{r.setFinish()})},[t]),w.jsxs("div",{className:"queries-wrapper",children:[w.jsxs("span",{className:"title-text",children:[w.jsx("span",{className:"normal-text",children:N("QUERY")}),w.jsx("span",{ref:s=>{s&&C.setIcon(s,"plus")},className:"btn create-query-btn",onClick:()=>Xw()})]}),w.jsx(so,{when:r.isSucceed&&a.length===0,children:w.jsx("div",{className:"create-query-btn-container",children:w.jsx("span",{className:"btn",onClick:()=>Xw(),children:N("CREATE FILTER")})})}),w.jsx("div",{className:"queries-container",children:a.map(s=>w.jsx(GJ,{query:s,isActive:s.id===n},`${s.id}-${C.moment(s.createdAt,"YYYY/MM/DD HH:mm:ss").format("x")}`))})]})},GJ=e=>{const{query:t,isActive:n}=e,[r,a]=ki(!1),[o,s]=ki(!1),c=()=>{He.setMemoFilter(n?"":t.id)},d=T=>{T.stopPropagation(),a()},p=()=>{a(!1)},m=async T=>{if(T.stopPropagation(),o)try{await Et.deleteQuery(t.id)}catch(E){new C.Notice(E.message)}else s()},g=T=>{T.stopPropagation(),Xw(t.id)},v=async T=>{T.stopPropagation();try{t.pinnedAt?await Et.unpinQuery(t.id):await Et.pinQuery(t.id),Et.editQuery({...t,pinnedAt:t.pinnedAt?"":Ue.getDateTimeString(Date.now())})}catch(E){console.error(E)}},D=()=>{s(!1)},S=A.useMemo(()=>w.jsxs("div",{className:"action-btns-container",children:[w.jsxs("span",{className:"btn",onClick:v,children:[w.jsx("span",{ref:T=>{T&&C.setIcon(T,t.pinnedAt?"pin-off":"pin")},className:"icon-text"}),w.jsx("span",{className:"normal-text",children:t.pinnedAt?N("UNPIN"):N("PIN")})]}),w.jsxs("span",{className:"btn",onClick:g,children:[w.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&C.setIcon(T,"edit")},className:"icon-text"}),w.jsx("span",{className:"normal-text",children:N("EDIT")})]}),w.jsxs("span",{className:`btn delete-btn ${o?"final-confirm":""}`,onClick:m,onMouseLeave:D,children:[w.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&C.setIcon(T,"trash-2")},className:"icon-text"}),w.jsx("span",{className:"normal-text",children:N(o?"CONFIRM!":"DELETE")})]})]}),[t.pinnedAt,o]);return w.jsx(w.Fragment,{children:w.jsxs("div",{className:`query-item-container ${n?"active":""}`,onClick:c,children:[w.jsxs("div",{className:"query-text-container",children:[w.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&C.setIcon(T,"filter")},className:"icon-text"}),w.jsxs("span",{className:"query-text",children:[t.title,t.pinnedAt&&" 📌"]})]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:T=>{T&&!T.hasChildNodes()&&C.setIcon(T,"more-horizontal")},className:"btn action-btn toggle-btn",onClick:d}),w.jsx("div",{className:`action-btns-wrapper ${r?"":"hidden"}`,onMouseLeave:p,children:S})]})]})})},R2=()=>{var v,D;const{locationState:{query:{tag:e,filter:t}},dailyNotesState:{app:n},memoState:{tags:r,tagsNum:a,memos:o}}=A.useContext(mt),s=t&&((v=t==null?void 0:t.toString())==null?void 0:v.startsWith("Filter [Temp] "))&&Et.getQueryById(t),[c,d]=A.useState([]),[p,m]=A.useState(((D=n||app)==null?void 0:D.loadLocalStorage("thino-tag-sort-order"))||"alphabetical");A.useEffect(()=>{var T;const S=(T=n||app)==null?void 0:T.loadLocalStorage("thino-temp-tags");d(S||[])},[]),A.useEffect(()=>{Te.updateTagsState()},[o]),A.useEffect(()=>{const S=Array.from(r).sort(),T={subTags:[]};for(const E of S){const O=E.split("/");let k=T,j="";for(let F=0;Fz.text===j);if(R||(R={key:B,text:j,count:a[j]||0,subTags:[],parent:k},k.subTags.push(R)),F===O.length-1){let z=R.parent;for(;z;)z.count||(z.count=0),z.count+=a[j]||0,z=z.parent}k=R}}d(T.subTags)},[r]),A.useEffect(()=>{var S;Te.initialized&&((S=n||app)==null||S.saveLocalStorage("thino-temp-tags",c))},[c]);const g=S=>{S.stopPropagation();const T=new C.Menu;for(const E of["alphabetical","alphabeticalReverse","byCount","byCountReverse"])T.addItem(O=>{O.setTitle(N(E)).onClick(()=>{m(E),n==null||n.saveLocalStorage("thino-tag-sort-order",E)}).setChecked(p===E)}),E==="alphabeticalReverse"&&T.addSeparator();T.showAtMouseEvent(S.nativeEvent)};return w.jsxs("div",{className:"tags-wrapper",children:[w.jsxs("div",{className:"tags-header title-text",children:[w.jsx("span",{className:"normal-text",children:N("Frequently Used Tags")}),w.jsx("span",{ref:S=>{S&&C.setIcon(S,"arrow-down-narrow-wide")},className:"tags-sort-btn",onClick:g})]}),w.jsxs("div",{className:"tags-container",children:[c.sort(qJ(p)).map((S,T)=>w.jsx(mx,{tag:S,tagQuery:e,filterQuery:s},S.text+"-"+T)),w.jsx(so,{when:c.length<5&&Te.initialized,children:w.jsxs("span",{className:"tag-tip-container",children:[N("Input")," ",w.jsxs("span",{className:"code-text",children:[N("#Tag")," "]}),N("to create tag"),"..."]})})]})]})},mx=e=>{const{tag:t,tagQuery:n,filterQuery:r}=e,a=n===t.text||r&&JSON.parse(r.querystring).find(m=>m.type==="TAG"&&m.value.value===t.text),o=t.subTags.length>0,[s,c]=ki(!1),d=async m=>{var g;if(m.ctrlKey||m.metaKey){const{verifyState:v}=Xe.getState(),D=!C.Platform.isDesktop&&await((g=window.Capacitor)==null?void 0:g.Plugins.Device.getId()),S=C.Platform.isDesktop?await vn():D.identifier||D.uuid;if(!(v&&(v==null?void 0:v.appId)===S)){qt();return}const E=He.getState().query.filter;if(E&&(E!=null&&E.startsWith("Filter [Temp] "))){const k=Et.getQueryById(E).querystring,j=JSON.parse(k);let F;if(j.some(B=>B.type==="TAG"&&B.value.value===t.text)){if(F=j.filter(R=>R.value.value!==t.text),F.length===0){He.setMemoFilter("");return}const B=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify([{...F[0],relation:"AND"},...F.slice(1)]));Et.pushQuery(B),He.setMemoFilter(B.id)}else{F=[...j,{type:"TAG",value:{value:t.text,operator:"CONTAIN"},relation:"OR"}];const B=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify(F));Et.pushQuery(B),He.setMemoFilter(B.id)}}else if(n){He.setTagQuery("");const O=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify([{type:"TAG",value:{value:n,operator:"CONTAIN"},relation:"AND"},{type:"TAG",value:{value:t.text,operator:"CONTAIN"},relation:"OR"}]));Et.pushQuery(O),He.setMemoFilter(O.id)}else if(!n){const O=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify([{type:"TAG",value:{value:t.text,operator:"CONTAIN"},relation:"AND"}]));Et.pushQuery(O),He.setMemoFilter(O.id)}Ue.copyTextToClipboard(`#${t.text} `),["/","/recycle","/archive","/daily"].includes(He.getState().pathname)||He.setPathname("/");return}if(a){if(He.setTagQuery(""),r){const D=JSON.parse(r.querystring).filter(T=>T.value.value!==t.text);if(D.length===0){He.setMemoFilter("");return}const S=Et.createTempQuery(`Filter [Temp] ${Math.random().toString(36).substring(7)}`,JSON.stringify([{...D[0],relation:"AND"},...D.slice(1)]));Et.pushQuery(S),He.setMemoFilter(S.id)}}else await Ue.copyTextToClipboard(`#${t.text} `),["/","/recycle","/archive","/daily"].includes(He.getState().pathname)||He.setPathname("/"),He.setTagQuery(t.text)},p=m=>{m.stopPropagation(),c()};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:`tag-item-container ${a?"active":""}`,onClick:d,children:[w.jsxs("div",{className:"tag-text-container",children:[w.jsx("span",{ref:m=>{m&&C.setIcon(m,"hash")},className:"btn tag-btn"}),w.jsx("span",{className:"tag-text",children:t.key})]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{className:"tag-count",children:t.count}),o?w.jsx("span",{ref:m=>{m&&C.setIcon(m,"chevron-right")},className:`btn action-btn toggle-btn ${s?"shown":""}`,onClick:p}):null]})]}),o?w.jsx("div",{className:`subtags-container ${s?"":"hidden"}`,children:t.subTags.map((m,g)=>w.jsx(mx,{tag:m,tagQuery:n},m.text+"-"+g))}):null]})},B2=new Intl.Collator(void 0,{usage:"sort",sensitivity:"base",numeric:!0}).compare,aw={alphabetical:(e,t)=>B2(e.text,t.text),alphabeticalReverse:(e,t)=>-B2(e.text,t.text),byCount:(e,t)=>t.count-e.count,byCountReverse:(e,t)=>e.count-t.count},qJ=(e="byCount")=>aw.hasOwnProperty(e)?aw[e]:aw.alphabetical,_2=()=>{const{dailyNotesState:{app:e,settings:t,verifyState:n}}=A.useContext(mt),r=[{name:N("Random Review"),path:"/review",iconID:"star"},{name:N("ARCHIVE"),path:"/archive",iconID:"archive"},{name:N("Recycle bin"),path:"/recycle",iconID:"recycle"}],a=A.useRef([]);return A.useEffect(()=>{a.current.forEach((o,s)=>{o&&C.setIcon(o,r[s].iconID)})},[t,a]),w.jsx(w.Fragment,{children:w.jsx("div",{className:"path-entry-wrapper",children:r.map((o,s)=>w.jsx(w.Fragment,{children:w.jsxs("div",{className:`path-entry-container ${He.getState().pathname===o.path?"active":""} ${t.DeleteThinoDirectly&&o.path==="/recycle"?"hidden":""} ${o.path==="/review"&&"pro"}`,onClick:async()=>{var p;const c=!C.Platform.isDesktop&&await((p=window.Capacitor)==null?void 0:p.Plugins.Device.getId()),d=C.Platform.isDesktop?await vn():c.identifier||c.uuid;if(!n&&(n==null?void 0:n.appId)!==d&&o.path==="/review"){qt();return}if(He.setPathname(o.path),o.path==="/review"&&He.getState().pathname==="/review"){e.workspace.trigger("refresh-review-memos");return}He.clearQuery()},children:[w.jsx("span",{ref:c=>a.current[s]=c,className:"path-entry-icon"}),w.jsx("span",{className:"path-entry-text",children:o.name})]},s)}))})})},H2=e=>{const{dailyNotesState:{settings:t},locationState:n,globalState:{isMobileView:r,showSiderbarInMobileView:a}}=A.useContext(mt),o=A.useRef(null),s=A.useMemo(()=>c=>{var p,m,g;const d=Qe.getState().showSiderbarInMobileView;if(!d){window.removeEventListener("click",s,{capture:!0});return}(p=o.current)!=null&&p.contains(c.target)||(g=(m=o.current)==null?void 0:m.parentNode)!=null&&g.contains(c.target)&&(d&&c.stopPropagation(),Qe.setShowSiderbarInMobileView(!1),window.removeEventListener("click",s,{capture:!0}))},[]);return A.useEffect(()=>{Qe.setShowSiderbarInMobileView(!1)},[n]),A.useEffect(()=>{a?document.body.classList.add(Zb):document.body.classList.remove(Zb)},[a]),A.useEffect(()=>{r&&a&&window.addEventListener("click",s,{capture:!0})},[r,a]),w.jsxs("aside",{className:Xn("memos-sidebar-wrapper",e.className),ref:o,children:[e.children,w.jsx($J,{}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="right"?w.jsx(gp,{}):null:w.jsx(gp,{}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="left"?w.jsxs(w.Fragment,{children:[w.jsx(_2,{}),w.jsx(L2,{}),w.jsx(E1,{statusType:"sidebar"})]}):null:w.jsxs(w.Fragment,{children:[w.jsx(_2,{}),w.jsx(L2,{})]}),(t==null?void 0:t.DefaultThemeForThino)==="modern"&&!r?(e==null?void 0:e.sidebarPosition)==="right"?w.jsx(w.Fragment,{children:w.jsx(R2,{})}):null:w.jsx(w.Fragment,{children:w.jsx(R2,{})})]})},JJ=()=>{const{dailyNotesState:{settings:e}}=A.useContext(mt),[t,n]=$.useState(""),r=a=>{n(a.target.value)};return w.jsx("div",{className:"locked-screen-wrapper",children:w.jsxs("div",{className:"locked-screen-content",children:[w.jsx("div",{className:"locked-screen-header",children:w.jsx("div",{className:"locked-screen-header-title",children:N("Locked")})}),w.jsx("div",{className:"locked-screen-body",children:w.jsxs("div",{className:"locked-screen-body-content",children:[w.jsxs("div",{className:"locked-screen-body-content-text",children:[w.jsx("div",{className:"locked-screen-body-content-text-title",children:N("Thino is locked")}),w.jsx("div",{className:"locked-screen-body-content-text-desc",children:N("Please unlock Thino by input password")})]}),w.jsxs("div",{className:"locked-screen-body-content-inputer",children:[w.jsx("input",{onKeyDown:a=>{a.key==="Enter"&&((e==null?void 0:e.password)===t?Qe.setLocked(!1):new C.Notice(N("Password is incorrect")))},onChange:r,value:t,type:"password",className:"locked-screen-body-content-input"}),w.jsx("button",{className:"locked-screen-body-content-btn",onClick:()=>{(e==null?void 0:e.password)===t?Qe.setLocked(!1):new C.Notice(N("Password is incorrect"))},children:N("Unlock")})]})]})})]})})};function KJ(){const{dailyNotesState:{settings:e,verifyState:t},locationState:{pathname:n},globalState:{isMobileView:r,memoListView:a,globalEditorShown:o,locked:s}}=A.useContext(mt),c=A.useRef(null);return A.useEffect(()=>{if(!e.needVerify){Qe.setLocked(!1);return}Qe.setLocked(!0)},[e==null?void 0:e.needVerify]),A.useEffect(()=>{if(!c.current)return;(async()=>{var g;const p=!C.Platform.isDesktop&&await((g=window.Capacitor)==null?void 0:g.Plugins.Device.getId()),m=C.Platform.isDesktop?await vn():p.identifier||p.uuid;!t||(t==null?void 0:t.appId)!==m?c.current.toggleClass("hide-pro",!0):c.current.toggleClass("hide-pro",!1)})()},[t,c.current]),w.jsxs(w.Fragment,{children:[s&&w.jsx(JJ,{}),!s&&o&&w.jsx(Nu,{editorType:"block"}),!s&&!o&&w.jsx("section",{ref:c,id:"page-wrapper","data-path":n,className:Xn(`memos-${n==="/"?a:"list"}-view`,(e==null?void 0:e.DefaultThemeForThino)==="modern"?"modern":"classic"),children:w.jsxs(w.Fragment,{children:[w.jsx(H2,{sidebarPosition:"left",className:"left-sidebar"}),w.jsx("main",{className:"content-wrapper",children:hK(n)}),(e==null?void 0:e.DefaultThemeForThino)==="modern"&&!r?w.jsx(H2,{sidebarPosition:"right",className:"right-sidebar"}):null]})})]})}const QJ={"*":w.jsx(KJ,{})},XJ=e=>{const{memo:t,handleDeletedMemoAction:n}=e,{dailyNotesState:r}=A.useContext(mt),a={...t,createdAtStr:Ue.getDateTimeString(t.createdAt),deletedAtStr:Ue.getDateTimeString(t.deletedAt||t.createdAt)},o=$.useRef(null),s=$.useRef(null),[c,d]=$.useState(""),[p,m]=ki(!1),g={restore:A.useRef(null),delete:A.useRef(null),source:A.useRef(null)};A.useEffect(()=>{s&&(C.setIcon(g.restore.current,"archive-restore"),C.setIcon(g.delete.current,"trash"),C.setIcon(g.source.current,"home"))},[s]),A.useEffect(()=>{if(!o.current||!s.current||o.current.hasChildNodes()&&t.content===c||!r.view)return;const E=r.view;d(t.content),o.current.hasChildNodes()&&o.current.empty();async function O(){var j;await C.MarkdownRenderer.render(r.app,t.content+` `,o.current,t.path,E);const k=(j=o.current)==null?void 0:j.querySelectorAll(".internal-link");k==null||k.forEach(F=>{const B=F,R=B.getAttribute("data-href");if(!R)return;r.app.metadataCache.getFirstLinkpathDest(R,t.path)||F.classList.add("is-unresolved"),B.addEventListener("mouseover",H=>{H.stopPropagation(),r.app.workspace.trigger("hover-link",{event:H,source:"thino",hoverParent:E.containerEl,targetEl:B,linktext:R,sourcePath:B.href})})})}O()},[t.content,s]);const v=async()=>{if(p)try{await Te.deleteMemoById(a.id),n(a.id)}catch(E){new C.Notice(E.message)}else m()},D=async()=>{switch(a.sourceType){case"DAILY":await w1(a.id,a.path);break;case"CANVAS":await D1(a.id,a.path);break;case"MULTI":await v1(a.path);break;case"FILE":await b1(a.id,a.path);break}},S=async()=>{try{const E=await Te.restoreMemoById(a.id),O=r.app,k=O==null?void 0:O.loadLocalStorage("tokenForSync");E&&E.webId&&k&&r.settings.startSync&&await BT(E.webId),E&&Te.editMemo(E),n(a.id),new C.Notice(N("RESTORE SUCCEED"))}catch(E){new C.Notice(E.message)}},T=()=>{p&&m(!1)};return w.jsxs("div",{ref:s,className:`memo-wrapper ${"memos-"+a.id}`,onMouseLeave:T,children:[w.jsxs("div",{className:"memo-top-wrapper",children:[w.jsxs("span",{className:"time-text",children:[N("DELETE AT")," ",a.deletedAtStr]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:E=>{E&&C.setIcon(E,"more-horizontal")},className:"btn more-action-btn"}),w.jsx("div",{className:"more-action-btns-wrapper",children:w.jsxs("div",{className:"more-action-btns-container",children:[w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:g.restore,className:"more-action-item-icon"}),w.jsx("span",{className:"btn restore-btn",onClick:S,children:N("RESTORE")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:g.source,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:D,children:N("SOURCE")})]}),w.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[w.jsx("span",{ref:g.delete,className:"more-action-item-icon"}),w.jsx("span",{className:`btn delete-btn ${p?"final-confirm":""}`,onClick:v,children:N(p?"CONFIRM!":"DELETE")})]})]})})]})]}),w.jsx("div",{ref:o,className:"memo-content-text",onContextMenu:E=>{E.preventDefault(),E.stopPropagation()}})]})},eK=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:c}=t,d=Et.getQueryById(c);return!!(r||a&&a.from{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=Wd(m,v))}if(r){const v=new Set;for(const D of Array.from(m.content.match(Fn)||[])){const T=D.replace(Fn,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match(mr)||[])){const T=D.replace(mr,"$2").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}v.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(m.content.match(Fn)!==null||m.content.match(mr)!==null||m.content.match($n)!==null)||o==="LINKED"&&m.content.match(Bu)===null||o==="IMAGED"&&m.content.match(_u)===null||o==="CONNECTED"&&m.content.match(Il)===null)&&(g=!1),s&&!m.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},tK=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=A.useContext(mt),r=af(),[a,o]=A.useState([]),s=$.useRef(null);A.useEffect(()=>{const p=eK({memos:n.filter(m=>m.deletedAt!==""&&m.deletedAt),query:e,HideDoneTasks:!1});o(p),r.setFinish()},[n,s.current,e]);const c=A.useCallback(p=>{o(m=>m.filter(g=>g.id!==p))},[]),d=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[w.jsxs("div",{className:"section-header-container",children:[w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:t,children:w.jsx("button",{ref:p=>{p&&C.setIcon(p,"menu")},className:"btn action-btn clickable-icon",onClick:d})}),w.jsxs("span",{className:"go-home-btn",onClick:()=>{He.clearQuery(),He.setPathname("/")},children:["🏠 ",N("Return To Home Page")]})]}),w.jsx(Fp,{})]}),w.jsx(Rp,{thinosCount:a.length,thinos:a}),r.isLoading?w.jsx("div",{className:"tip-text-container",children:w.jsx("span",{className:"tip-text",children:N("Fetching data...")})}):a.length===0?w.jsx("div",{className:"tip-text-container",children:w.jsx("span",{className:"tip-text",children:N("Here is No Memos.")})}):w.jsx("div",{className:"deleted-memos-container",children:a.map(p=>w.jsx(XJ,{memo:p,handleDeletedMemoAction:c},`${p.id}-${p.updatedAt}`))})]})},zg="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%200%2024%2024'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M0%200h24v24H0V0z'%20fill='none'/%3e%3cpath%20d='M19%203H5c-1.1%200-2%20.9-2%202v14c0%201.1.9%202%202%202h14c1.1%200%202-.9%202-2V5c0-1.1-.9-2-2-2zm0%2016H5V5h14v14zM17.99%209l-1.41-1.42-6.59%206.59-2.58-2.57-1.42%201.41%204%203.99z'/%3e%3c/svg%3e",Ug="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='currentColor'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='none'%20d='M0%200h24v24H0V0z'/%3e%3cpath%20d='M19%205v14H5V5h14m0-2H5c-1.1%200-2%20.9-2%202v14c0%201.1.9%202%202%202h14c1.1%200%202-.9%202-2V5c0-1.1-.9-2-2-2z'/%3e%3c/svg%3e",nK=()=>{const{globalState:e}=A.useContext(mt),{useTinyUndoHistoryCache:t,shouldHideImageUrl:n,shouldSplitMemoWord:r,shouldUseMarkdownParser:a}=e,o=`👋 你好呀~欢迎使用memos! * ✨ **开源项目**; * 😋 精美且细节的视觉样式; * 📑 体验优良的交互逻辑;`,s=()=>{Qe.setAppSetting({useTinyUndoHistoryCache:!t})},c=()=>{Qe.setAppSetting({shouldSplitMemoWord:!r})},d=()=>{Qe.setAppSetting({shouldHideImageUrl:!n})},p=()=>{Qe.setAppSetting({shouldUseMarkdownParser:!a})},m=async()=>{const g=Te.getState().memos.map(S=>({...S})),v=JSON.stringify(g),D=document.createElement("a");D.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(v)),D.setAttribute("download","data.json"),D.style.display="none",document.body.appendChild(D),D.click(),document.body.removeChild(D)};return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"section-container preferences-section-container",children:[w.jsx("p",{className:"title-text",children:"Memo 显示相关"}),w.jsx("div",{className:"demo-content-container memo-content-text",dangerouslySetInnerHTML:{__html:pw(o)}}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:c,children:[w.jsx("span",{className:"normal-text",children:"中英文内容自动间隔"}),w.jsx("img",{className:"icon-img",src:r?zg:Ug})]}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:p,children:[w.jsx("span",{className:"normal-text",children:"部分 markdown 格式解析"}),w.jsx("img",{className:"icon-img",src:a?zg:Ug})]}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:d,children:[w.jsx("span",{className:"normal-text",children:"隐藏图片链接地址"}),w.jsx("img",{className:"icon-img",src:n?zg:Ug})]})]}),w.jsxs("div",{className:"section-container preferences-section-container",children:[w.jsx("p",{className:"title-text",children:"编辑器"}),w.jsxs("label",{className:"form-label checkbox-form-label",onClick:s,children:[w.jsxs("span",{className:"normal-text",children:["启用"," ",w.jsx("a",{target:"_blank",href:"https://github.com/boojack/tiny-undo",onClick:g=>g.stopPropagation(),rel:"noreferrer",children:"tiny-undo"})]}),w.jsx("img",{className:"icon-img",src:t?zg:Ug})]})]}),w.jsxs("div",{className:"section-container hidden",children:[w.jsx("p",{className:"title-text",children:"其他"}),w.jsx("div",{className:"btn-container",children:w.jsx("button",{className:"btn export-btn",onClick:m,children:"导出数据(JSON)"})})]})]})},rK=()=>{const{globalState:{isMobileView:e}}=A.useContext(mt);A.useEffect(()=>{Te.fetchAllMemos()},[]);const t=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"preference-wrapper",children:[w.jsx("div",{className:"section-header-container",children:w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:e,children:w.jsx("button",{className:"action-btn",onClick:t})}),w.jsx("span",{className:"normal-text",children:"账号与设置"})]})}),w.jsx("div",{className:"sections-wrapper",children:w.jsx(nK,{})})]})},aK=e=>{const{dailyNotesState:{app:t,settings:n,view:r}}=A.useContext(mt),{memo:a,handleUnarchivedMemoAction:o}=e,s=$.useRef(null),c=$.useRef(null),[d,p]=$.useState(""),m={...a,createdAtStr:Ue.getDateTimeString(a.createdAt),deletedAtStr:Ue.getDateTimeString(a.deletedAt||a.createdAt)},[g,v]=ki(!1),D={restore:A.useRef(null),delete:A.useRef(null),source:A.useRef(null)};A.useEffect(()=>{c&&(C.setIcon(D.restore.current,"archive-restore"),C.setIcon(D.delete.current,"trash"),C.setIcon(D.source.current,"home"))},[c]),A.useEffect(()=>{if(!s.current||!c.current||s.current.hasChildNodes()&&a.content===d||!r)return;p(a.content),s.current.hasChildNodes()&&s.current.empty();async function k(){var F,B;(F=s.current)==null||F.toggleClass(["markdown-rendered"],!0),await C.MarkdownRenderer.render(t,a.content+` `,s.current,a.path,r);const j=(B=s.current)==null?void 0:B.querySelectorAll(".internal-link");j==null||j.forEach(R=>{const z=R,H=z.getAttribute("data-href");if(!H)return;t.metadataCache.getFirstLinkpathDest(H,a.path)||R.classList.add("is-unresolved"),z.addEventListener("mouseover",U=>{U.stopPropagation(),t.workspace.trigger("hover-link",{event:U,source:"thino",hoverParent:r.containerEl,targetEl:z,linktext:H,sourcePath:z.href})})})}k()},[a.content,c]);const S=async()=>{switch(m.sourceType){case"DAILY":await w1(m.id,m.path);break;case"CANVAS":await D1(m.id,m.path);break;case"MULTI":await v1(m.path);break;case"FILE":await b1(m.id,m.path);break}},T=async()=>{if(g)try{if(n.DeleteThinoDirectly)await Te.deleteMemoById(m.id);else{const k=await Te.hideMemoById(m.id);k&&Te.editMemo(k)}}catch(k){new C.Notice(k.message)}else v()},E=async()=>{try{const k=await Te.unarchiveMemo(m);k&&Te.editMemo(k),o(m.id),new C.Notice(N("RESTORE SUCCEED"))}catch(k){new C.Notice(k.message)}},O=()=>{g&&v(!1)};return w.jsxs("div",{ref:c,className:`memo-wrapper ${"memos-"+m.id}`,onMouseLeave:O,children:[w.jsxs("div",{className:"memo-top-wrapper",children:[w.jsxs("span",{className:"time-text",children:[N("ARCHIVED AT")," ",m.updatedAt]}),w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:k=>{k&&C.setIcon(k,"more-horizontal")},className:"btn more-action-btn"}),w.jsx("div",{className:"more-action-btns-wrapper",children:w.jsxs("div",{className:"more-action-btns-container",children:[w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:D.restore,className:"more-action-item-icon"}),w.jsx("span",{className:"btn restore-btn",onClick:E,children:N("RESTORE")})]}),w.jsxs("div",{className:"more-action-menu-item",children:[w.jsx("span",{ref:D.source,className:"more-action-item-icon"}),w.jsx("span",{className:"btn",onClick:S,children:N("SOURCE")})]}),w.jsxs("div",{className:"more-action-menu-item delete-menu-item",children:[w.jsx("span",{ref:D.delete,className:"more-action-item-icon"}),w.jsx("span",{className:`btn delete-btn ${g?"final-confirm":""}`,onClick:T,children:N(g?"CONFIRM!":"DELETE")})]})]})})]})]}),w.jsx("div",{ref:s,className:"memo-content-text"})]})},oK=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:c}=t,d=Et.getQueryById(c);return!!(r||a&&a.from{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=Wd(m,v))}if(r){const v=new Set;for(const D of Array.from(m.content.match(Fn)||[])){const T=D.replace(Fn,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match(mr)||[])){const T=D.replace(mr,"$2").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}v.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(m.content.match(Fn)!==null||m.content.match(mr)!==null||m.content.match($n)!==null)||o==="LINKED"&&m.content.match(Bu)===null||o==="IMAGED"&&m.content.match(_u)===null||o==="CONNECTED"&&m.content.match(Il)===null)&&(g=!1),s&&!m.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},iK=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n}}=A.useContext(mt),r=af(),[a,o]=A.useState([]),s=$.useRef(null);A.useEffect(()=>{const m=oK({memos:n.filter(g=>g.rowStatus==="ARCHIVED"&&g.deletedAt===""),query:e,HideDoneTasks:!1});o(m),r.setFinish()},[n,s.current,e]);const c=A.useCallback(m=>{o(g=>g.filter(v=>v.id!==m))},[]),d=A.useCallback(m=>{o(g=>g.filter(v=>v.id!==m))},[]),p=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]);return w.jsxs("div",{className:"memo-trash-wrapper",ref:s,children:[w.jsxs("div",{className:"section-header-container",children:[w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:t,children:w.jsx("button",{ref:m=>{m&&C.setIcon(m,"menu")},className:"btn action-btn clickable-icon",onClick:p})}),w.jsxs("span",{className:"go-home-btn",onClick:()=>{He.clearQuery(),He.setPathname("/")},children:["🏠 ",N("Return To Home Page")]})]}),w.jsx(Fp,{})]}),w.jsx(Rp,{thinosCount:a.length,thinos:a}),r.isLoading?w.jsx("div",{className:"tip-text-container",children:w.jsx("p",{className:"tip-text",children:N("Fetching data...")})}):a.length===0?w.jsx("div",{className:"tip-text-container",children:w.jsx("p",{className:"tip-text",children:N("Here is No Memos.")})}):w.jsx("div",{className:"deleted-memos-container",children:a.map(m=>w.jsx(aK,{memo:m,handleUnarchivedMemoAction:d,handleDeletedMemoAction:c},`${m.id}-${m.updatedAt}`))})]})},sK=()=>{const{dailyNotesState:{app:e},locationState:{query:t},globalState:{isMobileView:n,changedByMemos:r},memoState:{memos:a}}=A.useContext(mt),o=af(),[s,c]=A.useState([]),[d,p]=A.useState([]),m=$.useRef(null),g=$.useRef(null),[v,D]=A.useState(!1),[S,T]=A.useState([]),E=$.useRef([]),O=A.useCallback(({memos:F,query:B,HideDoneTasks:R})=>{const{tag:z,duration:H,type:Y,text:U,filter:J}=B,Q=Et.getQueryById(J);return!!(z||H&&H.from{let ie=!0;if(pe.thinoType!==void 0&&R&&pe.thinoType==="TASK-DONE"&&(ie=!1),pe.content.contains("comment:")&&(ie=!1),Q){const se=JSON.parse(Q.querystring);Array.isArray(se)&&(ie=Wd(pe,se))}if(z){const se=new Set;for(const fe of Array.from(pe.content.match(Fn)||[])){const we=fe.replace(Fn,"$1").trim().split("/");let Z="";for(const G of we)Z+=G,se.add(Z),Z+="/"}for(const fe of Array.from(pe.content.match($n)||[])){const we=fe.replace($n,"$1").trim().split("/");let Z="";for(const G of we)Z+=G,se.add(Z),Z+="/"}for(const fe of Array.from(pe.content.match(mr)||[])){const we=fe.replace(mr,"$2").trim().split("/");let Z="";for(const G of we)Z+=G,se.add(Z),Z+="/"}se.has(z)||(ie=!1)}return H&&H.fromH.to)&&(ie=!1),Y&&(Y==="NOT_TAGGED"&&(pe.content.match(Fn)!==null||pe.content.match($n)!==null)||Y==="LINKED"&&pe.content.match(Bu)===null||Y==="IMAGED"&&pe.content.match(_u)===null||Y==="CONNECTED"&&pe.content.match(Il)===null)&&(ie=!1),U&&!pe.content.toLowerCase().includes(U.toLowerCase())&&(ie=!1),ie}):F},[]);A.useEffect(()=>{g.current&&(C.setIcon(g.current,"refresh-cw"),e.workspace.on("refresh-review-memos",j))},[g]),A.useEffect(()=>{if(!v)return;if(t){const R=[...O({memos:a,query:t,HideDoneTasks:!1})].sort(()=>Math.random()-Math.random()).slice(0,10);c(R),D(!1);return}const F=[...S].sort(()=>Math.random()-Math.random()).slice(0,10);c(F),D(!1)},[v]),A.useEffect(()=>{if(!(S.length>0))return;const F=[...S].sort(()=>Math.random()-Math.random()).slice(0,10);c(F),D(!1)},[S]),A.useEffect(()=>{m.current&&(T(O({memos:a,query:t,HideDoneTasks:!1}).filter(F=>F.rowStatus!=="ARCHIVED"&&!(F.deletedAt!==""&&F.deletedAt))),o.setFinish(),He.clearQuery())},[a,m.current]),A.useEffect(()=>{if(r&&E.current.length>0){const F=S.filter(R=>E.current.includes(R.id)),B=E.current.map(R=>F.find(z=>z.id===R)).filter(R=>R!==void 0);p(B);return}E.current=s.map(F=>F.id),p(s)},[s]),A.useEffect(()=>{if(s.length===0)return;const F=O({memos:s,query:t,HideDoneTasks:!1});p(F)},[t]);const k=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]),j=()=>{D(!0)};return w.jsxs("div",{className:"memo-review-wrapper",ref:m,children:[w.jsx("div",{className:"section-header-container",children:w.jsxs("div",{className:"title-wrapper",children:[w.jsxs("div",{className:"title-btns-left-wrapper",children:[w.jsx(so,{when:n,children:w.jsx("button",{ref:F=>{F&&C.setIcon(F,"menu")},className:"btn action-btn clickable-icon",onClick:k})}),w.jsx("span",{ref:g,onClick:j,className:"refresh-icon"})]}),w.jsx("div",{className:"title-btns-right-wrapper",children:w.jsxs("span",{className:"go-home-btn",onClick:()=>{He.setPathname("/")},children:["🏠 ",N("Return To Home Page")]})})]})}),w.jsx(Rp,{}),o.isLoading?w.jsx("div",{className:"tip-text-container",children:w.jsx("span",{className:"tip-text",children:N("Fetching data...")})}):a.length===0?w.jsx("div",{className:"tip-text-container",children:w.jsx("span",{className:"tip-text",children:N("Here is No Memos.")})}):w.jsx("div",{className:"review-memos-container",children:d.map(F=>w.jsx(Sa,{memo:F},`${F==null?void 0:F.id}-${F.createdAt}`))})]})},gx=({memos:e,query:t,HideDoneTasks:n})=>{const{tag:r,duration:a,type:o,text:s,filter:c}=t,d=Et.getQueryById(c);return!!(r||a&&a.from{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=Wd(m,v))}if(r){const v=new Set;for(const D of Array.from(m.content.match(Fn)||[])){const T=D.replace(Fn,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match($n)||[])){const T=D.replace($n,"$1").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}for(const D of Array.from(m.content.match(mr)||[])){const T=D.replace(mr,"$2").trim().split("/");let E="";for(const O of T)E+=O,v.add(E),E+="/"}v.has(r)||(g=!1)}return a&&a.froma.to)&&(g=!1),o&&(o==="NOT_TAGGED"&&(m.content.match(Fn)!==null||m.content.match(mr)!==null||m.content.match($n)!==null)||o==="LINKED"&&m.content.match(Bu)===null||o==="IMAGED"&&m.content.match(_u)===null||o==="CONNECTED"&&m.content.match(Il)===null)&&(g=!1),s&&!m.content.toLowerCase().includes(s.toLowerCase())&&(g=!1),g}):e.filter(m=>!m.content.contains("comment:"))},lK=A.forwardRef((e,t)=>{const{currentDate:n,setCurrentDateStamp:r}=e,[a,o]=A.useState(!1),s=Ue.getDateStampByDate(Ue.getDateString(n)),c=A.useRef(null);A.useEffect(()=>{c.current&&(!a&&C.setIcon(c.current,"more-horizontal"),a&&C.setIcon(c.current,"x"))},[c.current,a]);const d=p=>{r(p)};return A.useImperativeHandle(t,()=>({closeDatePicker:()=>{o(!1)}})),w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"date-card-container",children:[w.jsxs("div",{className:"date-container-details",children:[w.jsxs("div",{className:"details-text",children:[C.moment(s,"x").format("dddd")+" ",w.jsx("div",{className:"date-text",children:C.moment(s,"x").format("MMM")+" "+C.moment(s,"x").format("DD")})]}),w.jsx("div",{className:"details-logo-text",children:N("Daily Memos")})]}),w.jsxs("div",{className:"date-container-info",children:[w.jsxs("div",{className:"date-container-info-text",children:["Week ",w.jsx("div",{className:"week-text",children:C.moment(s,"x").format("ww")}),"of ",w.jsx("div",{className:"year-text",children:C.moment(s,"x").format("YYYY")})]}),w.jsx("div",{ref:c,onClick:()=>o(!a)})]})]}),w.jsx(zy,{className:`date-picker ${a?"":"hidden"}`,datestamp:s,handleDateStampChange:d})]})}),uK=({thino:e})=>{const t=A.useCallback(()=>{$d(e)},[]);return w.jsxs("div",{className:"daily-thino-wrapper",children:[w.jsx("div",{className:"time-wrapper",onClick:t,children:w.jsx("span",{className:"normal-text",children:C.moment(e.createdAt,"YYYY/MM/DD HH:mm:ss").format("HH:mm")})}),w.jsx("div",{className:"daily-thino-container",children:w.jsx(Sa,{memo:e})})]})},cK=()=>{const{locationState:{query:e},globalState:{isMobileView:t},memoState:{memos:n},dailyNotesState:{settings:r,app:a}}=A.useContext(mt),o=af(),[s,c]=A.useState([]),[d,p]=A.useState(Ue.getDateStampByDate(Ue.getDateString(C.moment().format("YYYY-MM-DD HH:mm:ss")))),m=A.useRef(),g=A.useRef(null),v=$.useRef(null),D=A.useRef(null),[S,T]=A.useState(!1);A.useEffect(()=>{e.duration&&e.duration.from&&e.duration.to&&p(e.duration.from)},[e.duration]),A.useEffect(()=>{D.current&&(C.setIcon&&D&&!S&&C.setIcon(D.current,"share"),C.setIcon&&D&&S&&C.setIcon(D.current,"chrome"))},[D.current,S]),A.useEffect(()=>{const j=gx({memos:n,query:e,HideDoneTasks:!1}).filter(F=>Ue.getTimeStampByDate(F.createdAt)>=d&&Ue.getTimeStampByDate(F.createdAt)F.deletedAt==="").sort((F,B)=>Ue.getTimeStampByDate(F.createdAt)-Ue.getTimeStampByDate(B.createdAt));c(j),o.setFinish()},[n,d,v.current,e]);const E=A.useCallback(()=>{Qe.setShowSiderbarInMobileView(!0)},[]),O=async()=>{var k;m.current&&((k=m==null?void 0:m.current)==null||k.closeDatePicker()),T(!0),setTimeout(()=>{if(!g.current){T(!1);return}let j;document.body.hasClass("theme-dark")?j="#232323":j="#eaeaea",Zy(g.current,{backgroundColor:j,pixelRatio:window.devicePixelRatio*2}).then(F=>{if(r!=null&&r.AutoSaveWhenOnMobile&&C.Platform.isMobile){const B=F.split("base64,")[1];Oy(B,"image/png").arrayBuffer().then(async z=>{let H;const Y="png",U=bs();for(const J in U)if(U[J]instanceof C.TFile){H=U[J];break}H!==void 0&&await a.vault.createBinary(await vault.getAvailablePathForAttachments(`Pasted Image ${C.moment().format("YYYYMMDDHHmmss")}`,Y,H),z)})}Wy({imgUrl:F}),T(!1)}).catch(()=>{T(!1)})},0)};return w.jsxs("div",{className:"daily-thinos-list-wrapper",ref:v,children:[w.jsxs("div",{className:"section-header-container",children:[w.jsxs("div",{className:"title-text",children:[w.jsx(so,{when:t,children:w.jsx("button",{ref:k=>{k&&C.setIcon(k,"menu")},className:"btn action-btn clickable-icon",onClick:E})}),w.jsxs("span",{className:"go-home-btn",onClick:()=>{He.clearQuery(),He.setPathname("/")},children:["🏠 ",N("Return To Home Page")]})]}),w.jsxs("div",{className:"header-right-section",children:[w.jsxs("div",{className:"btns-container",children:[w.jsx("span",{ref:k=>{C.setIcon&&k&&C.setIcon(k,"chevron-left")},className:"btn btn-text",onClick:()=>p(k=>k-Mi)}),w.jsx("span",{ref:k=>{C.setIcon&&k&&C.setIcon(k,"chevron-right")},className:"btn btn-text",onClick:()=>p(k=>k+Mi)}),w.jsx("span",{ref:D,className:Xn("btn btn-text share-btn",S?"generating":""),onClick:O})]}),w.jsx(mb,{}),w.jsx(Fp,{})]})]}),w.jsx(Rp,{thinosCount:s.length,thinos:s}),w.jsx("div",{className:"daily-thinos-view-wrapper",children:w.jsxs("div",{ref:g,className:"daily-thinos-view-container",children:[w.jsx(lK,{ref:m,currentDate:new Date(d),setCurrentDateStamp:p}),o.isLoading?w.jsx("div",{className:"tip-text-container",children:w.jsx("p",{className:"tip-text",children:N("Fetching data...")})}):s.length===0?w.jsx("div",{className:"tip-container",children:w.jsx("p",{className:"tip-text",children:N("Noooop!")})}):w.jsx("div",{className:"daily-thinos-list-container",children:s.map(k=>w.jsx(uK,{thino:k},`${k.id}-${k.updatedAt}`))})]})})]})},dK={"/recycle":w.jsx(tK,{}),"/setting":w.jsx(rK,{}),"/archive":w.jsx(iK,{}),"/review":w.jsx(sK,{}),"/daily":w.jsx(cK,{}),"*":w.jsx(_J,{})},yx=e=>t=>{for(const n of Object.keys(e))if(n===t)return e[n];return e["*"]},fK=yx(QJ),hK=yx(dK);function pK({app:e}){const{locationState:{pathname:t},dailyNotesState:{settings:n}}=A.useContext(mt);return A.useEffect(()=>{Te.fetchAllMemos()},[]),!a1()&&!e.plugins.getPlugin("periodic-notes")&&(n!=null&&n.EnabledLocationList.find(r=>r.value==="DAILY"))&&new C.Notice(N("Check if you opened Daily Notes Plugin Or Periodic Notes Plugin")),w.jsx(Bo,{store:Ee,context:mt,children:fK(t)})}function mK(e){const t=e.view.canvas;if(!t||!e.view.file.path.endsWith(".thino.canvas")||t.thinoBtn)return;const n=t.wrapperEl.createDiv({cls:"thino-canvas-menu-btn"}),r=Ap(n);r.render(w.jsx($.StrictMode,{children:w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(gK,{leaf:e})})})),t.thinoBtn=r,Xe.getState().view.appendRoot({root:r,canvas:t})}function gK({leaf:e}){const{memoState:{memos:t},locationState:{query:n}}=A.useContext(mt),r=$.useRef(null),a=$.useRef(null),[o,s]=$.useState(!1),[c,d]=$.useState([]),[p,m]=$.useState([]),{tag:g,duration:v,type:D,text:S,filter:T}=n,E=Et.getQueryById(T),O=!!(g||v&&v.from{a.current&&C.setIcon(a.current,"eraser")},[a.current]),A.useEffect(()=>{r.current&&C.setIcon(r.current,"Memos")},[r.current]),A.useEffect(()=>{const k=e.view.file.path;d(t.filter(j=>j.sourceType==="CANVAS"&&j.path===k))},[t]),A.useEffect(()=>{if(c.length===0||!n)return;const k=gx({memos:c,query:n,HideDoneTasks:!1});m(k)},[n,c]),A.useEffect(()=>{if(!n)return;const k=new Set(p.map(F=>F.id)),j=Array.from(e.view.canvas.nodes.values());j.forEach(F=>{F.nodeEl.toggleVisibility(!0),e.view.canvas.getEdgesForNode(F).forEach(B=>{var R,z,H;(R=B.lineGroupEl)==null||R.toggleClass("hidden",!1),(z=B.lineStartGroupEl)==null||z.toggleClass("hidden",!1),(H=B.lineEndGroupEl)==null||H.toggleClass("hidden",!1)})}),j.filter(F=>!k.has(F.id)).forEach(F=>{F.nodeEl.toggleVisibility(!1),e.view.canvas.getEdgesForNode(F).forEach(B=>{var R,z,H;(R=B.lineGroupEl)==null||R.toggleClass("hidden",!0),(z=B.lineStartGroupEl)==null||z.toggleClass("hidden",!0),(H=B.lineEndGroupEl)==null||H.toggleClass("hidden",!0)})})},[p]),w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:r,className:"btn-container",onClick:()=>s(!o)}),o&&w.jsxs("div",{className:"thino-canvas-menu",children:[w.jsxs("div",{className:"thino-canvas-filter-group",children:[w.jsx(mb,{}),w.jsx(Fp,{}),O&&w.jsx("div",{ref:a,className:"clear-query",onClick:()=>{He.clearQuery()}})]}),w.jsx(gp,{initThinos:p})]})]})}const _r="thino_view";class yK extends C.EditorSuggest{constructor(n,r){super(n);me(this,"root");me(this,"editor");me(this,"cursor");me(this,"plugin");this.plugin=r,this.suggestEl.toggleClass("thino-date-selector",!0)}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}onTrigger(n,r){const o=r.getLine(n.line)[n.ch-1];return this.checkInMemosView(r)&&o==="@"?(this.cursor=n,this.editor=r,C.Platform.isMobile?(new mE(this.app,"text",s=>{this.selectSuggestion(parseInt(s),new MouseEvent("click"))}).open(),null):{start:{line:n.line,ch:n.ch-1},end:n,query:""}):null}getSuggestions(){return[parseInt(C.moment().startOf("day").format("x"))]}renderSuggestion(n,r){r.empty(),this.root=Lo.createRoot(r),this.root.render(w.jsx($.StrictMode,{children:w.jsx(zy,{className:"editor-date-picker",datestamp:n,handleDateStampChange:this.selectSuggestion.bind(this)})}))}selectSuggestion(n,r){var c,d,p;if(r instanceof KeyboardEvent||r instanceof PointerEvent&&!r.target.closest(".day-item"))return;const a=(c=this.app.workspace.getLeavesOfType("thino_view")[0])==null?void 0:c.view;(d=a==null?void 0:a.contentEl.find(".action-btn.list-or-task.list"))==null||d.click();let o="",s="";switch(this.plugin.settings.InsertDateFormat){case"Dataview":o="[due::",s="]";break;case"Tasks":o="📆";break}this.editor.replaceRange(o+C.moment(n).format("YYYY-MM-DD")+s,{line:this.cursor.line,ch:this.cursor.ch-1},this.cursor),(p=this.root)==null||p.unmount(),this.close()}}class vK extends C.EditorSuggest{constructor(n,r){super(n);me(this,"root");me(this,"editor");me(this,"cursor");me(this,"plugin");me(this,"memos",[]);this.plugin=r,this.memos=Te.getState().memos.filter(a=>!a.deletedAt&&a.rowStatus!=="ARCHIVED")}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}fuzzySearchItemsOptimized(n,r){const a=C.prepareFuzzySearch(n);return r.map(o=>{const s=a(o.content);return s?{item:o,match:s}:null}).filter(Boolean)}onTrigger(n,r){if(!this.checkInMemosView(r))return null;const o=r.getLine(n.line).slice(0,n.ch);if(o.lastIndexOf("~")===-1)return null;const s=o.slice(o.lastIndexOf("~")+1,n.ch);if(o[o.lastIndexOf("~")-1]!==" "&&o.lastIndexOf("~")!==0)return null;const c=s.trim();return this.memos=Te.getState().memos.filter(d=>!d.deletedAt&&d.rowStatus!=="ARCHIVED"),{start:{line:n.line,ch:n.ch-c.length},end:n,query:c}}getSuggestions(n){return n.query?this.fuzzySearchItemsOptimized(n.query,this.memos).sort((a,o)=>o.match.score-a.match.score).map(a=>a.item).map(a=>({time:a.createdAt,id:a.id,content:a.content})):this.memos.map(a=>({time:a.createdAt,id:a.id,content:a.content}))}renderSuggestion(n,r){r.toggleClass("thino-suggestion",!0),r.createEl("div",{cls:"thino-suggestion-time",text:n.time}),r.createEl("div",{cls:"thino-suggestion-container"}).createEl("div",{cls:"thino-suggestion-content",text:n.content})}selectSuggestion(n){const r=n.id;this.context.editor.replaceRange("MARK: [@THINO]("+r+")",{line:this.context.end.line,ch:this.context.start.ch-1},this.context.end)}}class wK{constructor(){me(this,"path","/fake-file-that-generated-for-thino.png");me(this,"basename","fake-file-that-generated-for-thino");me(this,"extension","png");me(this,"deleted",!1);me(this,"name","fake-file-that-generated-for-thino.png");me(this,"parent",null);me(this,"stat");me(this,"vault",null)}static[Symbol.hasInstance](t){return t instanceof C.TFile}setPath(t){}getNewPathAfterRename(t){}getShortName(){}cache(t){}updateCacheLimit(){}}class wl extends C.ItemView{constructor(n,r){super(n);me(this,"scope",new C.Scope(this.app.scope));me(this,"root");me(this,"mobileHeaderRoot");me(this,"plugin");me(this,"hoverPopover");me(this,"memosComponent");me(this,"rootList",[]);me(this,"editor",null);me(this,"navigation",!1);me(this,"file",this.app.vault.getMarkdownFiles()[0]||new wK);me(this,"handleUpdateInstance",n=>{this.editor=n.editor});this.plugin=r,this.registerScope()}getDisplayText(){return"Thino"}getIcon(){return"Memos"}getViewType(){return _r}getMode(){return"source"}canToggleBacklinks(){return!1}registerScope(){const{scope:n}=this;n.register(["Mod"],"Enter",()=>{}),n.register([],"i",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-textarea"))}),n.register(["Mod"],"f",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-searchBar"))}),n.register([],"o",r=>{const a=r.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.hasClass("cm-line")||a.hasClass("cm-content")||(r.preventDefault(),this.plugin.app.workspace.trigger("focus-on-searchBar"))}),n.register([],"Escape",()=>{setTimeout(()=>{this.plugin.app.workspace.trigger("blur-on-memos")},20)})}async onFileDeleted(n){var d,p,m;const r=Wh(n,"day"),a=n.path.contains(".thino")&&n.path.contains(".canvas"),o=n.path.contains(".thino")&&n.path.contains(".md"),s=((d=this.plugin.settings)==null?void 0:d.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",c=(m=((p=n.parent)==null?void 0:p.path)||n.path)==null?void 0:m.contains(s==null?void 0:s.trim());(r||a&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="CANVAS"))&&(await Te.removeMemosInFile(n),Te.updateTagsState()),c&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="MULTI")&&(await Te.removeMemosInFile(n,s),Te.updateTagsState()),o&&this.plugin.settings.EnabledLocationList.find(g=>g.value==="FILE")&&(await Te.removeMemosInFile(n),Te.updateTagsState())}async onFileModified(n){var d;if(Qe.getState().changedByMemos){Qe.setChangedByMemos(!1);return}const r=Wh(n,"day"),a=n.path.contains(".thino")&&n.path.contains(".canvas"),o=n.path.contains(".thino")&&n.path.contains(".md"),s=((d=this.plugin.settings)==null?void 0:d.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",c=n.parent.path.contains(s==null?void 0:s.trim());if(r||a&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="CANVAS")){await Te.updateMemosInFile(n),Te.updateTagsState();return}c&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="MULTI")&&(await Te.updateMemosInFile(n,s),Te.updateTagsState()),o&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="FILE")&&(await Te.updateMemosInFile(n),Te.updateTagsState())}async onFileCreated(n){var r;if(this.app.workspace.layoutReady&&this.memosComponent){const a=Wh(n,"day"),o=n.path.contains(".thino")&&n.path.contains(".canvas"),s=n.path.contains(".thino")&&n.path.contains(".md"),c=((r=this.plugin.settings)==null?void 0:r.MemoOtherSaveLocation.MemoDefaultMultiFilePath)||"Thino",d=n.parent.path.contains(c==null?void 0:c.trim());if(a){await Xe.updateDailyNotes(n,!1),await Te.updateMemosInFile(n),Te.updateTagsState();return}if(o&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="CANVAS")){await Te.updateMemosInFile(n),Te.updateTagsState();return}d&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="MULTI")&&(await Te.updateMemosInFile(n,c),Te.updateTagsState()),s&&this.plugin.settings.EnabledLocationList.find(p=>p.value==="FILE")&&(await Te.updateMemosInFile(n),Te.updateTagsState())}}async onResize(){var r;super.onResize();const n=this.leaf;if(n&&n.height!==0){if(n.view.containerEl.toggleClass("tiny-view",n.width<600),n.view.containerEl.toggleClass("waterfall-small-group",n.width<1300),n.width>950){n.view.containerEl.classList.toggle("mobile-view",!1),Qe.setIsMobileView(n.width<=950);return}if((r=this.plugin.settings)!=null&&r.ShowLeftSideBar&&!C.Platform.isMobile)return;n.view.containerEl.classList.toggle("mobile-view",!0),Qe.setIsMobileView(n.width<=950)}}appendToHeader(){const n=this.leaf.view.titleContainerEl;n&&(this.mobileHeaderRoot=Lo.createRoot(n),this.mobileHeaderRoot.render(w.jsx($.StrictMode,{children:w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(ay,{})})})))}appendRoot({root:n,canvas:r}){this.rootList.push({root:n,canvas:r})}async onOpen(){this.navigation=this.plugin.settings.navigation,await this.onResize(),this.onFileCreated=this.onFileCreated.bind(this),this.onFileDeleted=this.onFileDeleted.bind(this),this.onFileModified=this.onFileModified.bind(this),C.Platform.isTablet&&document.body.toggleClass("is-tablet",!0),C.Platform.isMobile&&!C.Platform.isTablet&&this.appendToHeader(),this.registerEvent(this.app.vault.on("create",this.onFileCreated)),this.registerEvent(this.app.vault.on("delete",this.onFileDeleted)),this.registerEvent(this.app.vault.on("modify",C.debounce(this.onFileModified,2e3,!0))),this.registerEvent(this.app.workspace.on("active-leaf-change",n=>{n.view.getViewType()==="canvas"&&mK(n)}));try{this.root=Lo.createRoot(this.contentEl),Xe.setView(this),this.root.render(w.jsx($.StrictMode,{children:w.jsx(pK,{app:this.plugin.app})}))}catch(n){console.error(n)}}onunload(){var n;super.onunload(),this.root.unmount(),(n=this.mobileHeaderRoot)==null||n.unmount(),this.rootList.forEach(r=>{var a,o,s;(a=r==null?void 0:r.root)==null||a.unmount(),(o=r==null?void 0:r.canvas)!=null&&o.thinoBtn&&(r.canvas.thinoBtn=void 0),(s=r==null?void 0:r.canvas)!=null&&s.wrapperEl.find(".thino-canvas-menu-btn")&&r.canvas.wrapperEl.find(".thino-canvas-menu-btn").detach()})}}const Y2={Memos:''};function bK(){Object.keys(Y2).forEach(e=>{C.addIcon(e,Y2[e])})}class z2 extends gE{fuzzySearchItemsOptimized(t,n){const r=C.prepareFuzzySearch(t);return n.map(a=>{const o=r(a.path);return o?{item:a,match:o,score:o.score}:null}).sort((a,o)=>(o==null?void 0:o.score)-(a==null?void 0:a.score)).filter(Boolean)}getSuggestions(t){const r=app.vault.getFiles().filter(o=>["png","jpg","jpeg","gif"].includes(o.extension)),a=t.toLowerCase();return this.fuzzySearchItemsOptimized(a,r).map(o=>o.item)}renderSuggestion(t,n){var o;const r=t.basename,a=((o=t.parent)==null?void 0:o.path)||"";n.toggleClass("thino-image-suggest-item",!0),n.createSpan({cls:"suggestion-name",text:r}),n.createSpan({cls:"suggestion-path",text:a})}selectSuggestion(t){this.inputEl.value=t.path,this.inputEl.trigger("input"),this.close()}}const gb=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder;const U2=typeof TextEncoder=="function"?new TextEncoder:void 0,DK="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Zh=Array.prototype.slice.call(DK);(e=>{let t={};return e.forEach((n,r)=>t[n]=r),t})(Zh);const bi=String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);const SK=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),IK=e=>{let t,n,r,a,o="";const s=e.length%3;for(let c=0;c255||(r=e.charCodeAt(c++))>255||(a=e.charCodeAt(c++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|a,o+=Zh[t>>18&63]+Zh[t>>12&63]+Zh[t>>6&63]+Zh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},vx=typeof btoa=="function"?e=>btoa(e):gb?e=>Buffer.from(e,"binary").toString("base64"):IK,TK=gb?e=>Buffer.from(e).toString("base64"):e=>{let n=[];for(let r=0,a=e.length;r{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?bi(192|t>>>6)+bi(128|t&63):bi(224|t>>>12&15)+bi(128|t>>>6&63)+bi(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return bi(240|t>>>18&7)+bi(128|t>>>12&63)+bi(128|t>>>6&63)+bi(128|t&63)}},CK=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,xK=e=>e.replace(CK,EK),V2=gb?e=>Buffer.from(e,"utf8").toString("base64"):U2?e=>TK(U2.encode(e)):e=>vx(xK(e)),MK=(e,t=!1)=>t?SK(V2(e)):V2(e),ow=C.Platform.isDesktop&&require("os"),wx=async()=>{var r,a;let e="";if(C.Platform.isDesktop)e=await vn();else{const o=await((r=window.Capacitor)==null?void 0:r.Plugins.Device.getId());e=o.identifier||o.uuid}let t;if(ow)t=JSON.stringify({hostname:ow.hostname(),platform:ow.platform(),machineid:e});else{const o=await((a=window.Capacitor)==null?void 0:a.Plugins.Device.getInfo()),s=o==null?void 0:o.model,c=o==null?void 0:o.platform;t=JSON.stringify({hostname:s||("mobile"+C.Platform.isMobile?Math.random().toString(36).substring(7):""),platform:c||"mobile",machineid:e})}return MK(t)},NK=async()=>{var t;let e="";if(C.Platform.isDesktop)e=await vn();else{const n=await((t=window.Capacitor)==null?void 0:t.Plugins.Device.getId());e=n.identifier||n.uuid}return e},kK={General:"chef-hat",Thino:"Memos",Interface:"brush",Share:"share-2",Advanced:"cog"},bx=[{value:"DAILY",target:"ProcessEntriesBelow",insert:"InsertAfter"},{value:"CANVAS",target:"MemoDefaultCanvasPath"},{value:"MULTI",target:"MemoDefaultMultiFilePath"},{value:"FILE",target:"MemoDefaultSingleFilePath"}],cs={FirstLoaded:!1,StartDate:"Sunday",InsertAfter:"",UserName:"THINO 😉",ProcessEntriesBelow:"",Language:"en",SaveMemoButtonLabel:"NOTE",SaveMemoButtonIcon:"✍️",ShareFooterStart:"{ThinoNum} Thino {UsedDay} Day",ShareFooterEnd:"✍️ by {UserName}",DefaultPrefix:"List",DefaultTimePrefix:"HH:mm",UseDailyOrPeriodic:"Daily",InsertDateFormat:"Tasks",DefaultEditorLocation:"Top",UseButtonToShowEditor:!1,FocusOnEditor:!0,OpenDailyMemosWithMemos:!0,HideDoneTasks:!1,ShowTaskLabel:!1,MobileAndDesktop:"All",OpenMemosAutomatically:!1,ShowTime:!0,ShowDate:!0,AddBlankLineWhenDate:!1,AutoSaveWhenOnMobile:!1,DeleteFileName:"delete",QueryFileName:"query",UseVaultTags:!1,SetCustomBackgroundImage:!1,SetCustomMemoFooter:!1,DefaultLightBackgroundImage:"",DefaultDarkBackgroundImage:"",DefaultMemoComposition:"{TIME} {CONTENT}",CommentOnMemos:!1,CommentsInOriginalNotes:!1,FetchMemosMark:"#memo",FetchMemosFromNote:!1,ShowCommentOnMemos:!1,ShowLeftSideBar:!1,MemoListView:"list",MemoSaveLocation:"DAILY",MemoOtherSaveLocation:{MemoDefaultCanvasPath:"basic.thino.canvas",MemoDefaultMultiFilePath:"Thino",MemoDefaultSingleFilePath:"basic.thino.md"},MemoDailyTarget:5,HeatmapColorScheme:"default",EnabledHttpApi:!1,HttpApiIpType:"localhost",HttpApiPort:"43999",AutoDownloadImage:!1,EditorType:"obsidian",EnabledLocationList:bx,DeleteThinoDirectly:!1,CaptureKey:{EnableCaptureKey:!1,OpenThinoGlobally:"CommandOrControl+Shift+T",ShowNearMouse:!1},startSync:!1,tokenForVerify:{},saveThinoType:"FILE",showDayMark:!1,dayMarkRange:"day",navigation:!1,password:"",needVerify:!1,addTagAutomatically:!1,addTagPosition:"End",addTagWithNewline:!1,chatViewStyle:"default",MomentsBackgroundImage:"https://images.pexels.com/photos/531767/pexels-photo-531767.jpeg",MomentsIcon:"https://images.pexels.com/photos/256514/pexels-photo-256514.jpeg",MomentsQuote:"Share your thino with the world",DefaultThemeForThino:"modern",LastUpdatedVersion:"0.0.0",ShareToThinoWithText:!1,ShareToThinoWithTextAppend:"",ShareToThinoWithTextPrepend:"",ShareToThinoWithTextNewline:"none",hidePinnedGroup:!1,DifferentInsertTarget:!1,InsertAfterForTask:"",ProcessContentTarget:"custom",InsertType:"custom"};function AK({plugin:e}){const{dailyNotesState:{verifyState:t}}=A.useContext(mt),[n,r]=A.useState(!1),[a,o]=A.useState(!1),[s,c]=A.useState(""),[d,p]=A.useState("");A.useEffect(()=>{NK().then(v=>{p(v)})},[]);const m=async()=>{var T;const v=s,D=!C.Platform.isDesktop&&await((T=window.Capacitor)==null?void 0:T.Plugins.Device.getId()),S=C.Platform.isDesktop?await vn():D.identifier||D.uuid;v&&(e.settingTab.updateSettings("tokenForVerify",{...e.settings.tokenForVerify,[S]:v}),e.verify().then(E=>{E&&(r(!0),Qe.setRefresh(!0),setTimeout(()=>{e.settingTab.display()},200),e.registerToolbarCheck()),new C.Notice(N(E?"Verify successfully":"Failed to verify"))}).catch(E=>{new C.Notice(N("Failed to verify"))}))},g=async v=>{c(v)};return w.jsx("div",{className:"thino-verify-component",children:t?w.jsxs("div",{className:"thino-verify-content verified",children:[w.jsx("div",{className:"thino-verified-text",children:N("You have verified your account. Congrats!")}),w.jsx("div",{className:"thino-description-link",children:w.jsxs("p",{children:[N("If you have any questions, please contact us."),w.jsx("span",{className:"thino-url",onClick:()=>{const v=localStorage.getItem("language");v&&(v==="zh"||v==="zh-TW")?window.open("https://pkmer.cn"):window.open("https://thino.pkmer.net/en/")},children:"@ PKMer"})]})})]}):w.jsxs("div",{className:"thino-verify-content",children:[w.jsxs("div",{className:"thino-description-link",children:[N("You can buy a license from")+"->",w.jsxs("span",{className:"thino-url",onClick:()=>{const v=localStorage.getItem("language");v&&(v==="zh"||v==="zh-TW")?window.open("https://pkmer.cn/products/thino"):window.open("https://thino.pkmer.net/en/#price")},children:[" ","PKMer"]})]}),w.jsx("textarea",{className:"thino-verify-textarea",value:s,onChange:v=>g(v.target.value),placeholder:N("Input activation code here")}),w.jsxs("div",{className:"thino-button-container",children:[w.jsxs("div",{className:"thino-button-group",children:[w.jsx("button",{onClick:async()=>{try{const v=await wx();await navigator.clipboard.writeText(v),o(!0)}catch(v){console.error(v),new C.Notice("Failed to copy id");return}new C.Notice(N("Copied to clipboard Successfully"))},children:N("Copy Thino id")}),w.jsx("button",{onClick:()=>{if(!a){new C.Notice(N("Please copy Thino id first"));return}const v=localStorage.getItem("language");v&&(v==="zh"||v==="zh-TW")?window.open("https://pkmer.cn/products/UserProfile/#tab-21&getCode"):window.open("https://pkmer.net/en/userprofile/#tab-21&getCode"),r(!0)},children:N("Get activation code")}),s&&w.jsx(w.Fragment,{children:w.jsx("button",{onClick:async()=>{await m()},children:N("Verify")})})]}),n?w.jsx("p",{children:N("After you verify your account, please refresh this page.")}):""]}),w.jsxs("div",{className:"thino-description-link",children:[N("If you have any questions, please contact us."),w.jsx("span",{className:"thino-url",onClick:()=>{const v=localStorage.getItem("language");v&&(v==="zh"||v==="zh-TW")?window.open("https://pkmer.cn"):window.open("https://thino.pkmer.net/en/")},children:"@ PKMer"})]})]})})}class FK extends C.PluginSettingTab{constructor(n,r){super(n,r);me(this,"plugin");me(this,"applyDebounceTimer",0);me(this,"tabContent",new Map);me(this,"selectedTab","General");me(this,"search");me(this,"searchSettingInfo",new Map);me(this,"searchZeroState");me(this,"navigateEl");me(this,"passwordMatched",!1);me(this,"root");me(this,"debounceApplySettingsUpdate",C.debounce(async()=>{await this.plugin.saveSettings()},100,!0));me(this,"debounceDisplay",C.debounce(async()=>{await this.display()},300,!0));this.plugin=r}updateSettings(n,r){this.plugin.settings={...this.plugin.settings,[n]:r},this.applySettingsUpdate()}applySettingsUpdate(){this.debounceApplySettingsUpdate(),Te.updateTagsState()}async hide(){var n;(n=this.root)==null||n.unmount(),this.passwordMatched=!1}async display(){var n;await this.plugin.loadSettings(),this.root&&((n=this.root)==null||n.unmount()),this.containerEl.empty(),this.containerEl.toggleClass("memos-settings",!0),C.Platform.isMobile&&this.containerEl.toggleClass("memos-mobile",!0),this.generateSettingsTitle(),this.addTabHeader()}generateSettingsTitle(){const n=this.containerEl.createDiv("memos-setting-title");n.createEl("h2",{text:"Thino"}),this.generateSearchBar(n)}addTabHeader(){const n=this.containerEl.createEl("nav",{cls:"memos-setting-header"});this.navigateEl=n.createDiv("memos-setting-tab-group");const r=this.containerEl.createDiv("memos-setting-content");this.updateOldData(),this.createTabAndContent("General",this.navigateEl,r,(a,o)=>this.generateGeneralSettings(o,a)),this.createTabAndContent("Thino",this.navigateEl,r,(a,o)=>this.generateMemosSettings(o,a)),this.createTabAndContent("Interface",this.navigateEl,r,(a,o)=>this.generateThemeSettings(o,a)),this.createTabAndContent("Share",this.navigateEl,r,(a,o)=>this.generateShareSettings(o,a)),this.createTabAndContent("Advanced",this.navigateEl,r,(a,o)=>this.generateAdvancedSettings(o,a)),this.createSearchZeroState(r)}updateOldData(){this.plugin.settings.UserName.startsWith("MEMO ")&&(this.plugin.settings.UserName="THINO 😉"),this.plugin.settings.ShareFooterStart.contains("{Memo")&&(this.plugin.settings.ShareFooterStart=this.plugin.settings.ShareFooterStart.replace("{MemosNum}","{ThinoNum}").replace("memos","thino")),this.applySettingsUpdate()}generateSearchBar(n){const r=new C.Setting(n);r.settingEl.style.border="none",r.addSearch(a=>{this.search=a}),this.search.setPlaceholder(N("Search all settings")),this.search.inputEl.oninput=()=>{for(const a of this.tabContent){const o=a[1];o.navButton.removeClass("memos-navigation-item-selected"),o.content.show(),o.heading.show();const s=this.search.getValue();this.selectedTab==""&&s.trim()!=""&&this.searchSettings(s.toLowerCase()),this.selectedTab=""}this.navigateEl.addClass("memos-setting-searching")},this.search.inputEl.onblur=()=>{this.navigateEl.removeClass("memos-setting-searching")},this.search.onChange(a=>{var o;if(a===""){this.triggerTabChange((o=this.tabContent.get("General"))==null?void 0:o.navButton,"General");return}this.searchSettings(a.toLowerCase())})}triggerTabChange(n,r){if(this.selectedTab==r)return;n.toggleClass("memos-navigation-item-selected",!0);const a=this.tabContent.get(r);if((a==null?void 0:a.content).show(),this.selectedTab!=""){const o=this.tabContent.get(this.selectedTab);o==null||o.navButton.removeClass("memos-navigation-item-selected"),(o==null?void 0:o.content).hide()}else{this.searchZeroState.hide();for(const o of this.searchSettingInfo)for(const s of o[1])s.containerEl.show();for(const o of this.tabContent){const s=o[1];s.heading.hide(),r!==o[0]&&s.content.hide()}}this.selectedTab=r}createTabAndContent(n,r,a,o){const s=this.selectedTab===n,c=r.createDiv("memos-navigation-item");c.toggleClass("memos-desktop",!0),C.setIcon(c.createEl("div",{cls:"memos-navigation-item-icon"}),kK[n]),c.createSpan({text:N(n)}),c.onclick=()=>{this.triggerTabChange(c,n)};const d=a.createDiv("memos-tab-settings"),p=d.createEl("h2",{cls:"memos-setting-heading",text:n+" Settings"});p.hide(),d.id=n.toLowerCase().replace(" ","-"),s?c.addClass("memos-navigation-item-selected"):d.hide(),o&&o(d,n),this.tabContent.set(n,{content:d,heading:p,navButton:c})}searchSettings(n){var o;const r=new Set,a=(s,c)=>{s.show(),r.has(c)||r.add(c)};for(const s of this.searchSettingInfo){const c=s[0],d=s[1];for(const p of d)if(n.trim()===""||(o=p.alias)!=null&&o.includes(n)||p.description.includes(n)||p.name.includes(n))a(p.containerEl,c);else if(p.options&&p.options.length>0)for(const m of p.options){if(m.description.toLowerCase().includes(n)||m.name.toLowerCase().includes(n)){a(p.containerEl,c);break}else if(m.options){for(const g of m.options)if(g.description.toLowerCase().includes(n)||g.value.toLowerCase().includes(n)){a(p.containerEl,c);break}}p.containerEl.hide()}else p.containerEl.hide()}for(const s of this.tabContent)r.has(s[0])?s[1].heading.show():s[1].heading.hide();r.size===0?this.searchZeroState.show():this.searchZeroState.hide()}addSettingToMasterSettingsList(n,r,a="",o="",s=[],c=""){var p;const d={containerEl:r,name:a.toLowerCase(),description:o.toLowerCase(),options:s,alias:c};this.searchSettingInfo.has(n)?(p=this.searchSettingInfo.get(n))==null||p.push(d):this.searchSettingInfo.set(n,[d])}createSearchZeroState(n){this.searchZeroState=n.createDiv(),this.searchZeroState.hide(),this.searchZeroState.createEl(C.Platform.isMobile?"h3":"h2",{text:"No settings match search"}).style.textAlign="center"}generateGeneralSettings(n,r){this.customHeading(n,r)}async generateThemeSettings(n,r){var d;const a=Xe.getState().verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=C.Platform.isDesktop?await vn():o.identifier||o.uuid,c=a&&(a==null?void 0:a.appId)===s;await this.customNameAndTheme(n,r,c)}async generateMemosSettings(n,r){var d;const a=Xe.getState().verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=C.Platform.isDesktop?await vn():o.identifier||o.uuid,c=a&&(a==null?void 0:a.appId)===s;this.setPasswordSettings(n,r),this.addMemoSettings(n,r),this.customFileNameSettings(n,r,c),this.addThinoProSettings(n,r,c)}async generateShareSettings(n,r){var d;const a=Xe.getState().verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=C.Platform.isDesktop?await vn():o.identifier||o.uuid,c=a&&(a==null?void 0:a.appId)===s;new Ve(r,this).setHeading().setTab(n).setName(N("Copy filtered results")),this.copyMemosSettings(n,r),new Ve(r,this).setHeading().setTab(n).setName(N("Share image")),this.shareMemosSettings(n,r),C.Platform.isMobile&&this.shareToThinosSettings(n,r,c)}async generateAdvancedSettings(n,r){var d;this.saveDataSettings(n,r),this.fetchDataSettings(n,r),this.navigationSettings(n,r);const a=Xe.getState().verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=C.Platform.isDesktop?await vn():o.identifier||o.uuid,c=a&&(a==null?void 0:a.appId)===s;this.setGlobalSettings(n,r,c)}async customNameAndTheme(n,r,a){new Ve(r,this).setName(N("Theme for Thino")).setDesc(N("Set the theme for Thino")).setTab(n).addDropdown(async s=>{s.addOption("modern","Modern"),s.addOption("classic","Classic"),s.setValue(this.plugin.settings.DefaultThemeForThino).onChange(async c=>{this.plugin.settings.DefaultThemeForThino=c,this.applySettingsUpdate()})}),new Ve(r,this).setTab(n).setHeading().setName(N("Interface Details"));let o;new Ve(r,this).setName(N("Heatmap Color Scheme")).setDesc(N("Set different color scheme for heatmap.")).setTab(n).addDropdown(async s=>{o=s,o.addOption("default",N("Default")),o.addOption("gray",N("Gray")),o.addOption("grass",N("Grass")),o.addOption("flame",N("Flame")),o.addOption("olive",N("Olive")),o.addOption("ice",N("Ice")),o.addOption("magenta",N("Magenta")),o.setValue(this.plugin.settings.HeatmapColorScheme).onChange(async c=>{this.plugin.settings.HeatmapColorScheme=c,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Show Tasks Label")).setDesc(N("Show tasks label near the time text. False by default")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.ShowTaskLabel).onChange(async c=>{this.plugin.settings.ShowTaskLabel=c,this.applySettingsUpdate()})),new Ve(r,this).setName(N("Save Memo button label")).setDesc(N("The text shown on the save Memo button in the UI. 'NOTEIT' by default.")).setTab(n).addText(s=>s.setPlaceholder(cs.SaveMemoButtonLabel).setValue(this.plugin.settings.SaveMemoButtonLabel).onChange(async c=>{this.plugin.settings.SaveMemoButtonLabel=c,this.applySettingsUpdate()})),C.Platform.isDesktop&&new Ve(r,this).setName(N("Always Show Leaf Sidebar on PC")).setDesc(N("Show left sidebar on PC even when the leaf width is less than 875px. False by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.ShowLeftSideBar).onChange(async c=>{this.plugin.settings.ShowLeftSideBar=c,this.applySettingsUpdate()})),await this.getEditorLocation(r,n),new Ve(r,this).setHeading().setTab(n).setName("💎 "+N("Pro features")),this.addThinoDailyMarkSettings(n,r,a),new Ve(r,this).setName(N("Chat view style")).setDesc(N("Set the style of chat view")).setTab(n).addDropdown(async s=>{o=s,o.addOption("default","Default"),o.addOption("fluent","Fluent"),o.addOption("inline","Inline"),o.setValue(this.plugin.settings.chatViewStyle).onChange(async c=>{if(!a){qt();return}this.plugin.settings.chatViewStyle=c,this.applySettingsUpdate()})}),this.addThinoMomentsSettings(n,r,a)}addThinoDailyMarkSettings(n,r,a){let o;new Ve(r,this).setName(N("Show day mark in thino list")).setDesc(N("Show day mark on the top of daily range thino. False by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.showDayMark).onChange(async c=>{if(!a){qt();return}this.plugin.settings.showDayMark=c,this.applySettingsUpdate(),this.debounceDisplay()})),this.plugin.settings.showDayMark&&(new Ve(r,this).setName(N("Day mark range")).setDesc(N("Set the range of day mark. Day by default.")).setTab(n).addDropdown(async s=>{o=s,o.addOption("day","day"),o.addOption("week","week"),o.addOption("month","month"),o.addOption("quarter","quarter"),o.addOption("year","year"),o.setValue(this.plugin.settings.dayMarkRange).onChange(async c=>{this.plugin.settings.dayMarkRange=c,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Hide pinned group")).setDesc(N("Hide pinned group in thino list. False by default.")).setTab(n).addToggle(s=>s.setValue(this.plugin.settings.hidePinnedGroup).onChange(async c=>{if(!a){qt();return}this.plugin.settings.hidePinnedGroup=c,this.applySettingsUpdate()})))}addThinoMomentsSettings(n,r,a){new Ve(r,this).setTab(n).setName(N("Background image for moments view")).setDesc(N("Set the background image for moments view")).addText(o=>o.setPlaceholder("URL").setValue(this.plugin.settings.MomentsBackgroundImage).onChange(async s=>{a&&(this.plugin.settings.MomentsBackgroundImage=s,this.applySettingsUpdate())}))}async getEditorLocation(n,r){let a;C.Platform.isMobile&&(new Ve(n,this).setName(N("Default editor position on mobile")).setDesc(N("Set the default editor position on Mobile, 'Top' by default.")).setTab(r).addDropdown(async o=>{a=o,a.addOption("Top",N("Top")),a.addOption("Bottom",N("Bottom")),a.setValue(this.plugin.settings.DefaultEditorLocation).onChange(async s=>{this.plugin.settings.DefaultEditorLocation=s,this.applySettingsUpdate(),setTimeout(()=>{this.display()},200)})}),this.plugin.settings.DefaultEditorLocation!=="Top"&&new Ve(n,this).setName(N("Use button to show editor on mobile")).setDesc(N("Set a float button to call editor on mobile. Only when editor located at the bottom works.")).setTab(r).addToggle(o=>o.setValue(this.plugin.settings.UseButtonToShowEditor).onChange(async s=>{this.plugin.settings.UseButtonToShowEditor=s,this.applySettingsUpdate()})))}customHeading(n,r){new Ve(r,this).setHeading().setName(N("User info")).setTab(n),new Ve(r,this).setName(N("User name")).setDesc(N("Set your user name here. 'Memos 😏' By default")).setTab(n).addText(v=>v.setPlaceholder(cs.UserName).setValue(this.plugin.settings.UserName).onChange(async D=>{this.plugin.settings.UserName=D,this.applySettingsUpdate()})),new Ve(r,this).setTab(n).setName(N("User icon")).setDesc(N("Set user icon for thino")).addText(v=>v.setPlaceholder("URL").setValue(this.plugin.settings.MomentsIcon).onChange(async D=>{this.plugin.settings.MomentsIcon=D,this.applySettingsUpdate()})),new Ve(r,this).setTab(n).setName(N("User quote")).setDesc(N("Set user quote for thino")).addText(v=>v.setPlaceholder("Input anything here").setValue(this.plugin.settings.MomentsQuote).onChange(async D=>{this.plugin.settings.MomentsQuote=D,this.applySettingsUpdate()}));let a=!1;const o=document.createDocumentFragment();o.createEl("span",{text:N("Connect to PKMer Sync, you can check it in ")});const s=localStorage.getItem("language");let c;s&&s==="zh"?c="https://pkmer.cn/products/UserProfile/#tab-21&activateSync":c="https://thino.pkmer.net/en/",o.createEl("a",{text:N("PKMer Sync"),attr:{href:c}}),new Ve(r,this).setHeading().setName(N("Pro verification status")).setTab(n);const d=document.createDocumentFragment(),p=d.createEl("div",{cls:"thino-activation"}),m=new Ve(r,this).setName(N("Activate Pro Version")).setDesc(d).setTab(n);m.settingEl.toggleClass("thino-activation-setting",!0),m.nameEl.toggleClass("thino-activation-title",!0),this.root=Lo.createRoot(p),this.root.render(w.jsx(Bo,{store:Ee,context:mt,children:w.jsx(AK,{plugin:this.plugin})}));let g=!1;new Ve(r,this).setName(N("Deactivate")).setTab(n).addButton(v=>{v.setWarning().setButtonText(N("Remove")).onClick(async()=>{var T;if(!g){v.setButtonText(N("Confirm?")),g=!0;return}g=!1;const D=!C.Platform.isDesktop&&await((T=window.Capacitor)==null?void 0:T.Plugins.Device.getId()),S=C.Platform.isDesktop?await vn():D.identifier||D.uuid;this.plugin.settings.tokenForVerify[S]&&(delete this.plugin.settings.tokenForVerify[S],await this.plugin.saveSettings(),new C.Notice(N("Remove successfully"))),await this.plugin.verify(),Qe.setRefresh(!0),setTimeout(()=>{this.display()},20)})}),(s==="zh"||s==="zh-TW")&&new Ve(r,this).setHeading().setName(N("Sync service")).setTab(n),(s==="zh"||s==="zh-TW")&&new Ve(r,this).setName(N("Sync Thino via PKMer")).setDesc(o).setTab(n).addButton(v=>{var S;const D=(S=this.plugin.app)==null?void 0:S.loadLocalStorage("tokenForSync");v.setButtonText(N(D?"Unlink":"Link")).onClick(async()=>{var T;if(!D){const E=localStorage.getItem("language");E&&(E==="zh"||E==="zh-TW")?window.open("https://pkmer.cn/products/UserProfile/#tab-21&activateSync"):window.open("https://thino.pkmer.net/en/");return}if(!a){v.setButtonText(N("Confirm?")),a=!0;return}a=!1,D&&((T=this.plugin.app)==null||T.saveLocalStorage("tokenForSync",""),new C.Notice(N("Remove successfully"))),Qe.setRefresh(!0),setTimeout(()=>{this.display()},20)})}),(s==="zh"||s==="zh-TW")&&this.showSyncStatus(r,n)}showSyncStatus(n,r){var o;(o=this.plugin.app)!=null&&o.loadLocalStorage("tokenForSync")&&(new Ve(n,this).setName(N("Save thino type when sync local")).setDesc(N("Set the default save thino type when sync local, FILE by default.")).setTab(r).addDropdown(async s=>{s.addOption("DAILY",N("DAILY")),s.addOption("FILE",N("FILE")),s.setValue(this.plugin.settings.saveThinoType).onChange(async c=>{this.plugin.settings.saveThinoType=c,this.applySettingsUpdate()})}),new Ve(n,this).setName(N("Sync Status")).setDesc(N("Start or stop sync")).setTab(r).addButton(s=>{s.setButtonText(this.plugin.settings.startSync?N("Stop"):N("Start")).onClick(async()=>{this.plugin.settings.startSync=!this.plugin.settings.startSync,await this.plugin.saveSettings(),Qe.setRefresh(!0),new C.Notice(this.plugin.settings.startSync?N("Start sync successfully"):N("Stop sync successfully")),setTimeout(()=>{this.display()},200)})}))}addMemoSettings(n,r){new Ve(r,this).setName(N("Open Memos when obsidian opens")).setDesc(N("When enable this, Memos will open when Obsidian opens. False by default.")).setTab(n).addDropdown(o=>{o.addOption("Desktop","Desktop"),o.addOption("Mobile","Mobile"),o.addOption("All","All"),o.setValue(this.plugin.settings.MobileAndDesktop).onChange(async s=>{this.plugin.settings.MobileAndDesktop=s,this.applySettingsUpdate()})}).addToggle(o=>o.setValue(this.plugin.settings.OpenMemosAutomatically).onChange(async s=>{this.plugin.settings.OpenMemosAutomatically=s,this.applySettingsUpdate()})),new Ve(r,this).setHeading().setTab(n).setName(N("Editor")),new Ve(r,this).setName(N("Use Tags In Vault")).setDesc(N("Use tags in vault rather than only in Memos. False by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.UseVaultTags).onChange(async s=>{this.plugin.settings.UseVaultTags=s,this.applySettingsUpdate()}));let a;new Ve(r,this).setName(N("Default insert date format")).setDesc(N("Set the default date format when insert date by @, 'Tasks' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("Tasks","Tasks"),a.addOption("Dataview","Dataview"),a.setValue(this.plugin.settings.InsertDateFormat).onChange(async s=>{this.plugin.settings.InsertDateFormat=s,this.applySettingsUpdate()})}),new Ve(r,this).setHeading().setTab(n).setName(N("Daily notes")),new Ve(r,this).setName(N("Default prefix when save thino in daily notes")).setDesc(N("Set the default prefix when create memo, 'List' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("List",N("List")),a.addOption("Task",N("Task")),a.setValue(this.plugin.settings.DefaultPrefix).onChange(async s=>{this.plugin.settings.DefaultPrefix=s,this.applySettingsUpdate()})}),this.plugin.settings.EnabledLocationList.some(o=>o.value==="DAILY")&&new Ve(r,this).setName(N("Default time prefix for thino in daily notes")).setDesc(N("Set default time prefix for thino in daily notes.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("HH:mm","HH:mm"),a.addOption("HH:mm:ss","HH:mm:ss"),a.setValue(this.plugin.settings.DefaultTimePrefix).onChange(async s=>{this.plugin.settings.DefaultTimePrefix=s,this.applySettingsUpdate()})})}addThinoProSettings(n,r,a){new Ve(r,this).setHeading().setTab(n).setName("💎 "+N("Pro features")),new Ve(r,this).setName(N("Default save type")).setDesc(N('Set the default save type for thino. "DAILY" by default')).setTab(n).addDropdown(async o=>{for(const s of this.plugin.settings.EnabledLocationList)o.addOption(s.value,N(s.value));o.setValue(this.plugin.settings.MemoSaveLocation||this.plugin.settings.EnabledLocationList[0].value).onChange(async s=>{if(!a){qt();return}this.plugin.settings.MemoSaveLocation=s,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Add tag automatically")).setDesc(N("Add tag to the end or beginning of the thino content when creating a thino and filtering tags")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.addTagAutomatically).onChange(async s=>{if(!a){qt();return}this.plugin.settings.addTagAutomatically=s,this.applySettingsUpdate(),this.debounceDisplay()})),this.plugin.settings.addTagAutomatically&&(new Ve(r,this).setName(N("Add tag position")).setDesc(N("Set the position of the tag when adding tag automatically")).setTab(n).addDropdown(async o=>{o.addOption("End",N("End")),o.addOption("Beginning",N("Beginning")),o.setValue(this.plugin.settings.addTagPosition).onChange(async s=>{this.plugin.settings.addTagPosition=s,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Add tag with new line")).setDesc(N("Add tag with new line when adding tag automatically")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.addTagWithNewline).onChange(async s=>{this.plugin.settings.addTagWithNewline=s,this.applySettingsUpdate()})))}memosCommentSettings(n,r){new Ve(r,this).setName(N("Allow Comments On Memos")).setDesc(N("You can comment on memos. False by default")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.CommentOnMemos).onChange(async o=>{this.plugin.settings.CommentOnMemos=o,this.applySettingsUpdate(),this.display()})),this.plugin.settings.CommentOnMemos&&(new Ve(r,this).setName(N("Always Show Memo Comments")).setDesc(N("Always show memo comments on memos. False by default")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowCommentOnMemos).onChange(async o=>{this.plugin.settings.ShowCommentOnMemos=o,this.applySettingsUpdate()})),new Ve(r,this).setName(N("Comments In Original DailyNotes/Notes")).setDesc(N("You should install Dataview Plugin ver 0.5.9 or later to use this feature.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.CommentsInOriginalNotes).onChange(async o=>{this.plugin.settings.CommentsInOriginalNotes=o,this.applySettingsUpdate()})))}shareToThinosSettings(n,r,a){new Ve(r,this).setHeading().setTab(n).setName("💎 "+N("Pro features")),new Ve(r,this).setTab(n).setName(N("Append/prepend text when share to Thino")).addToggle(o=>{o.setValue(this.plugin.settings.ShareToThinoWithText).onChange(async s=>{if(!a){qt();return}this.plugin.settings.ShareToThinoWithText=s,this.applySettingsUpdate(),this.debounceDisplay()})}),this.plugin.settings.ShareToThinoWithText&&(new Ve(r,this).setTab(n).setName(N("Append text when share to Thino")).addText(o=>{o.setPlaceholder(N("Input anything here")).setValue(this.plugin.settings.ShareToThinoWithTextAppend).onChange(async s=>{this.plugin.settings.ShareToThinoWithTextAppend=s,this.applySettingsUpdate()})}),new Ve(r,this).setTab(n).setName(N("Prepend text when share to Thino")).addText(o=>{o.setPlaceholder(N("Input anything here")).setValue(this.plugin.settings.ShareToThinoWithTextPrepend).onChange(async s=>{this.plugin.settings.ShareToThinoWithTextPrepend=s,this.applySettingsUpdate()})}),new Ve(r,this).setTab(n).setName(N("Add newline when append/prepend text")).addDropdown(async o=>{o.addOption("prepend",N("Prepend")),o.addOption("append",N("Append")),o.addOption("both",N("Both")),o.addOption("none",N("None")),o.setValue(this.plugin.settings.ShareToThinoWithTextNewline).onChange(async s=>{this.plugin.settings.ShareToThinoWithTextNewline=s,this.applySettingsUpdate()})}))}copyMemosSettings(n,r){new Ve(r,this).setName(N("Show Time When Copy Results")).setDesc(N("Show time when you copy results, like 12:00. Copy time by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowTime).onChange(async o=>{this.plugin.settings.ShowTime=o,this.applySettingsUpdate()})),new Ve(r,this).setName(N("Show Date When Copy Results")).setDesc(N("Show date when you copy results, like [[2022-01-01]]. Copy date by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.ShowDate).onChange(async o=>{this.plugin.settings.ShowDate=o,this.applySettingsUpdate(),this.debounceDisplay()})),this.plugin.settings.ShowDate&&new Ve(r,this).setName(N("Add Blank Line Between Different Date")).setDesc(N("Add blank line when copy result with date. No blank line by default.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.AddBlankLineWhenDate).onChange(async o=>{this.plugin.settings.AddBlankLineWhenDate=o,this.applySettingsUpdate()}))}shareMemosSettings(n,r){this.customMemoFooter(n,r),new Ve(r,this).setName(N("Custom Background Image")).setDesc(N("Set custom background image.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.SetCustomBackgroundImage).onChange(async o=>{this.plugin.settings.SetCustomBackgroundImage=o,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.SetCustomBackgroundImage&&(new Ve(r,this).setName(N("Background Image in Light Theme")).setDesc(N('Set background image in light theme. Set something like "Daily/one.png"')).setTab(n).addText(a=>{new z2(a.inputEl),a.setPlaceholder(cs.DefaultLightBackgroundImage).setValue(this.plugin.settings.DefaultLightBackgroundImage).onChange(async o=>{this.plugin.settings.DefaultLightBackgroundImage=o,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Background Image in Dark Theme")).setDesc(N('Set background image in dark theme. Set something like "Daily/one.png"')).setTab(n).addText(a=>{new z2(a.inputEl),a.setPlaceholder(cs.DefaultDarkBackgroundImage).setValue(this.plugin.settings.DefaultDarkBackgroundImage).onChange(async o=>{this.plugin.settings.DefaultDarkBackgroundImage=o,this.applySettingsUpdate()})}))}customMemoFooter(n,r){new Ve(r,this).setName(N("Custom Memo Footer")).setDesc(N("Set custom memo footer.")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.SetCustomMemoFooter).onChange(async o=>{this.plugin.settings.SetCustomMemoFooter=o,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.SetCustomMemoFooter&&(new Ve(r,this).setName(N("Share Memos Image Footer Start")).setDesc(N("Set anything you want here, use {ThinoNum} to display Number of thino, {UsedDay} for days. '{ThinoNum} Thino {UsedDay} Days' By default")).setTab(n).addText(a=>a.setPlaceholder(cs.ShareFooterStart).setValue(this.plugin.settings.ShareFooterStart).onChange(async o=>{this.plugin.settings.ShareFooterStart=o,this.applySettingsUpdate()})),new Ve(r,this).setName(N("Share Memos Image Footer End")).setDesc(N("Set anything you want here, use {UserName} as your username. '✍️ By {UserName}' By default")).setTab(n).addText(a=>a.setPlaceholder(cs.ShareFooterEnd).setValue(this.plugin.settings.ShareFooterEnd).onChange(async o=>{this.plugin.settings.ShareFooterEnd=o,this.applySettingsUpdate()})))}saveDataSettings(n,r){let a;new Ve(r,this).setName(N("Default Editor Mode")).setDesc(N("Live-Preview Mode OR Source Mode.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("obsidian",N("Live-preview")),a.addOption("memos",N("Source")),a.setValue(this.plugin.settings.EditorType).onChange(async s=>{this.plugin.settings.EditorType=s,this.applySettingsUpdate()})}),new Ve(r,this).setName(N("Delete Thino Directly")).setDesc(N("When delete thino directly, it will not be moved to trash. False by default.")).setTab(n).addToggle(o=>{o.setValue(this.plugin.settings.DeleteThinoDirectly).onChange(async s=>{this.plugin.settings.DeleteThinoDirectly=s,this.applySettingsUpdate()})})}async initHttpServer(n,r){var d;const a=Xe.getState().verifyState,o=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),s=C.Platform.isDesktop?await vn():o.identifier||o.uuid,c=a&&(a==null?void 0:a.appId)===s;new Ve(n,this).setName(N("Enable Local Http Server")).setTab(r).setDisabled(!c).addToggle(p=>p.setValue(this.plugin.settings.EnabledHttpApi).onChange(async m=>{if(!c){qt();return}this.plugin.settings.EnabledHttpApi=m,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.settings.EnabledHttpApi?this.plugin.initServer():this.plugin.stopServer(),this.display()},100)})),this.plugin.settings.EnabledHttpApi&&(new Ve(n,this).setName(N("Memos Http Server Port")).setDesc(N("Set memos http server port to listen. '43999' by default")).setTab(r).addText(p=>p.setPlaceholder(cs.HttpApiPort).setValue(this.plugin.settings.HttpApiPort).onChange(async m=>{if(!c){qt();return}this.plugin.settings.HttpApiPort=m,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})),new Ve(n,this).setName(N("Auto Download Image")).setDesc(N("Auto download image when save to thino. 'false' by default")).setTab(r).setDisabled(!c).addToggle(p=>{p.setValue(this.plugin.settings.AutoDownloadImage).onChange(async m=>{if(!c){qt();return}this.plugin.settings.AutoDownloadImage=m,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})}),new Ve(n,this).setName(N("Thino Http IP Type")).setDesc(N("Set Thino http server ip to listen. 'localhost' by default")).setTab(r).addDropdown(p=>{p.addOption("localhost","localhost"),p.addOption("127.0.0.1","127.0.0.1"),p.setValue(this.plugin.settings.HttpApiIpType).onChange(async m=>{if(!a||(a==null?void 0:a.appId)!==s){qt();return}this.plugin.settings.HttpApiIpType=m,this.applySettingsUpdate(),setTimeout(()=>{this.plugin.stopServer(),this.plugin.initServer()},1e3)})}))}fetchDataSettings(n,r){let a;new Ve(r,this).setName(N("Use which plugin's default configuration")).setDesc(N("Memos use the plugin's default configuration to fetch memos from daily, 'Daily' by default.")).setTab(n).addDropdown(async o=>{a=o,a.addOption("Daily",N("Daily")),a.addOption("Periodic","Periodic"),a.setValue(this.plugin.settings.UseDailyOrPeriodic).onChange(async s=>{this.plugin.settings.UseDailyOrPeriodic=s,this.applySettingsUpdate()})})}navigationSettings(n,r){new Ve(r,this).setName(N("Open link directly in Thino view")).setTab(n).addToggle(a=>a.setValue(this.plugin.settings.navigation).onChange(async o=>{this.plugin.settings.navigation=o,this.applySettingsUpdate()}))}setPasswordSettings(n,r){new Ve(r,this).setName(N("Need password to unlock Thino")).setTab(n).addToggle(a=>{this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched&&(a.toggleEl.onclick=o=>{this.passwordMatched||(o.preventDefault(),new Z2(this.app,this,this.plugin,s=>{a.setDisabled(!s),this.passwordMatched=s,this.debounceDisplay()}).open(),new C.Notice(N("Please input your password to change password settings")))}),a.setDisabled(this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched).setValue(this.plugin.settings.needVerify).onChange(async o=>{this.plugin.settings.needVerify=o,o&&(this.passwordMatched=!1),this.applySettingsUpdate(),this.debounceDisplay()})}),this.plugin.settings.needVerify&&new Ve(r,this).setName(N("Password to lock Thino")).setTab(n).addText(a=>{this.plugin.settings.needVerify&&this.plugin.settings.password&&!this.passwordMatched&&(a.inputEl.onclick=o=>{this.passwordMatched||(o.preventDefault(),new Z2(this.app,this,this.plugin,s=>{a.inputEl.readOnly=!s,this.passwordMatched=s,this.debounceDisplay()}).open(),new C.Notice(N("Please input your password to change password settings")))}),a.inputEl.readOnly=this.plugin.settings.password&&this.plugin.settings.needVerify&&!this.passwordMatched,a.inputEl.oncopy=()=>!1,a.inputEl.type="password",a.setValue(this.plugin.settings.password).onChange(async o=>{this.plugin.settings.password=o,this.applySettingsUpdate()})})}setGlobalSettings(n,r,a){new Ve(r,this).setHeading().setTab(n).setName("💎 "+N("Pro features")),this.initHttpServer(r,n),new Ve(r,this).setName(N("Enable opening thino globally")).setDesc(N("Enable opening thino globally. False by default.")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.CaptureKey.EnableCaptureKey).onChange(async s=>{if(!a){qt();return}this.plugin.settings.CaptureKey.EnableCaptureKey=s,this.applySettingsUpdate(),setTimeout(()=>{this.display()},100)})),this.plugin.settings.CaptureKey.EnableCaptureKey&&(new Ve(r,this).setName(N("Key for opening thino globally")).setDesc(N("Set key for opening thino globally. CTRL + SHIFT + T by default.")).setTab(n).addText(o=>o.setPlaceholder(cs.CaptureKey.OpenThinoGlobally).setValue(this.plugin.settings.CaptureKey.OpenThinoGlobally).onChange(async s=>{if(!a){qt();return}this.plugin.settings.CaptureKey.OpenThinoGlobally=s,this.applySettingsUpdate()})),new Ve(r,this).setName(N("Show thino near mouse")).setTab(n).addToggle(o=>o.setValue(this.plugin.settings.CaptureKey.ShowNearMouse).onChange(async s=>{if(!a){qt();return}this.plugin.settings.CaptureKey.ShowNearMouse=s,this.applySettingsUpdate()})))}checkInList(n){return this.plugin.settings.EnabledLocationList.find(r=>r.value===n)!==void 0}customFileNameSettings(n,r,a){var d;const o=document.createDocumentFragment(),s=o.createEl("div",{cls:"memo-save-location-desc"});for(const p of bx){const m=s.createEl("div",{cls:`memo-save-location-desc-item ${p.value}`}),g=m.createEl("span",{cls:"memo-save-location-desc-item-icon"});C.setIcon(g,((d=tp.find(E=>E.title===p.value))==null?void 0:d.icon)||""),m.createEl("span",{cls:"memo-save-location-desc-item-desc",text:`${N(p.value)}`});const v=m.createEl("span",{cls:"memo-save-location-desc-item-toggle"}),D=m.createEl("span",{cls:"memo-save-location-desc-item-setting"});p.value!=="DAILY"&&m.createEl("span",{cls:["memo-save-location-desc-item-pro","user-pro-badge"],text:"PRO"}),new C.ToggleComponent(v).setValue(this.checkInList(p.value)).onChange(async E=>{if(!a){qt();return}E?(await Te.updateTypeMemos(p.value),this.plugin.settings.EnabledLocationList=[...this.plugin.settings.EnabledLocationList,p]):(await Te.removeTypeMemos(p.value),this.plugin.settings.EnabledLocationList=this.plugin.settings.EnabledLocationList.filter(O=>O.value!==p.value)),this.plugin.settings.EnabledLocationList.length===1&&(this.plugin.settings.MemoSaveLocation=p.value),this.applySettingsUpdate(),setTimeout(()=>{this.display()},500)}).setDisabled(this.plugin.settings.EnabledLocationList.length===1&&this.checkInList(p.value)),new C.ExtraButtonComponent(D).setIcon("settings").onClick(()=>{new OK(this.app,this,this.plugin,p,a).open()})}const c=new Ve(r,this).setName(N("Save type for Thino")).setDesc(o).setTab(n);c.settingEl.toggleClass("memo-save-location-setting",!0),c.nameEl.toggleClass("memo-save-location-title",!0)}}class OK extends C.Modal{constructor(n,r,a,o,s){super(n);me(this,"plugin");me(this,"settingTab");me(this,"LocationList");me(this,"target","");me(this,"insertTarget","");me(this,"verified");me(this,"updateValue",C.debounce(n=>{this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"?this.target=n.trim()===""?"basic":n.trim():this.target=n.trim()===""&&this.LocationList.value==="MULTI"?"Memos":n.trim()},400,!0));me(this,"debounceDisplay",C.debounce(()=>this.display(),400,!0));this.verified=s,this.app=n,this.settingTab=r,this.plugin=a,this.LocationList=o,this.target=o.target!=="ProcessEntriesBelow"?a.settings.MemoOtherSaveLocation[o.target]:a.settings[o.target],this.insertTarget=a.settings.InsertAfter}onOpen(){this.display()}async display(){var d;const{contentEl:n}=this;this.contentEl.empty(),(d=n.parentElement)==null||d.classList.add("memo-save-location-modal"),this.titleEl.toggleClass("modal-title",!0),this.titleEl.setText(N("Save type for Thino")+` [${N(this.LocationList.value)}]`),(this.LocationList.value==="FILE"||this.LocationList.value==="CANVAS")&&n.createDiv("modal-desc",p=>{p.setText(N('You can set folder name with file name like "folder/file"'))}),this.LocationList.value==="MULTI"&&n.createDiv("modal-desc",p=>{p.setText(N('You can set folder name like "folder1/folder2/folder3" to create sub-folder'))}),this.LocationList.value==="DAILY"&&n.createDiv("modal-desc",p=>{p.setText(N('You can set target heading like "# Heading" to control data location'))});const r=n.createDiv("modal-setting"),a=this.LocationList.value==="DAILY"?N("Process Memos below"):this.LocationList.value==="MULTI"?N("Set the folder name"):N("Set the filename");if(this.LocationList.value==="DAILY"&&(new Ve(r,this.settingTab).setName(N("Set thino insert place")).setDesc(N("Set where to insert thino content")).addDropdown(async p=>{p.addOption("end",N("End of the diary")),p.addOption("custom",N("Custom location")),p.setValue(this.plugin.settings.InsertType).onChange(async m=>{this.plugin.settings.InsertType=m,this.settingTab.applySettingsUpdate(),this.debounceDisplay()})}),this.plugin.settings.InsertType==="custom"&&await this.addDailySettings(r),new Ve(r,this.settingTab).setName(N("Set process target")).setDesc(N("You can set whole diary or only part of it")).addDropdown(async p=>{p.addOption("custom",N("Custom")),p.addOption("whole",N("Whole diary")),p.setValue(this.plugin.settings.ProcessContentTarget).onChange(async m=>{this.plugin.settings.ProcessContentTarget=m,this.settingTab.applySettingsUpdate(),this.debounceDisplay()})})),this.LocationList.value!=="DAILY"||this.plugin.settings.ProcessContentTarget!=="whole"){const p=new Ve(r,this.settingTab).setName(a).addText(m=>m.setPlaceholder(this.LocationList.value==="DAILY"?N("# Heading"):N("Set the filename for current location file")).setValue(this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"?this.target.replace(/\.thino\.(canvas|md)/g,""):this.target).onChange(async g=>{const v=this.LocationList.value==="CANVAS"?".thino.canvas":this.LocationList.value==="FILE"?".thino.md":"";this.updateValue(g.replace(/\.thino\.(canvas|md)/g,"")+v)}));this.LocationList.value==="DAILY"&&p.setDesc(N("If left blank, the Thino interface will display all thino record contents; if a title is provided, the Thino interface will only display the contents under that title, and contents written elsewhere will not be shown.")),this.LocationList.value!=="DAILY"&&this.LocationList.value!=="MULTI"&&p.controlEl.createEl("span",{text:`${this.LocationList.value==="FILE"?".thino.md":".thino.canvas"}`})}const o=n.createDiv("button-group"),s=o.createEl("button",{text:N("Cancel")}),c=o.createEl("button",{text:N("Save")});c.onclick=async()=>{if(!this.verified&&this.LocationList.value!=="DAILY"){this.close(),qt();return}this.LocationList.target!=="ProcessEntriesBelow"?this.plugin.settings.MemoOtherSaveLocation[this.LocationList.target]=this.target:this.plugin.settings[this.LocationList.target]=this.target,this.LocationList.value==="MULTI"&&Ue.checkDailyInMulti(this.plugin.settings),this.LocationList.target==="ProcessEntriesBelow"&&(this.plugin.settings.InsertAfter=this.insertTarget),this.settingTab.applySettingsUpdate(),setTimeout(()=>{Te.updateTypeMemos(this.LocationList.value)},1e3),this.close()},s.onclick=async()=>{this.close()}}async addDailySettings(n){var d,p,m,g;const r=Xe.getState().verifyState,a=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),o=C.Platform.isDesktop?await vn():a.identifier||a.uuid,s=r&&(r==null?void 0:r.appId)===o,c=((p=this.plugin.settings)!=null&&p.DifferentInsertTarget?`[${N("List")}] `:"")+N("Insert after heading");new Ve(n,this.settingTab).setName(c).setDesc(N("If left blank, the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.")).addText(v=>v.setPlaceholder(N("# Heading")).setValue(this.insertTarget).onChange(async D=>{this.insertTarget=D})),(m=this.plugin.settings)!=null&&m.DifferentInsertTarget&&new Ve(n,this.settingTab).setName(((g=this.plugin.settings)!=null&&g.DifferentInsertTarget?`[${N("Task")}] `:"")+N("Insert after heading")).setDesc(N("Set the heading for the task type of thino, by default the recorded thino content will be inserted at the end of the diary; if a title is provided, all recorded thino content will be uniformly categorized under that title.")).addText(v=>{v.setPlaceholder(N("# Heading")).setValue(this.plugin.settings.InsertAfterForTask).onChange(async D=>{this.plugin.settings.InsertAfterForTask=D,this.settingTab.applySettingsUpdate()})}),new Ve(n,this.settingTab).setName(N("Different insert target for different type")).setDesc(N("Toggle this to set different insert target for different type of thino, like task or list type of thino")).addToggle(v=>v.setValue(this.plugin.settings.DifferentInsertTarget).onChange(async D=>{if(!s){qt();return}this.plugin.settings.DifferentInsertTarget=D,this.settingTab.applySettingsUpdate(),this.debounceDisplay()}))}onClose(){const{contentEl:n}=this;n.empty()}}class Z2 extends C.Modal{constructor(n,r,a,o){super(n);me(this,"plugin");me(this,"settingTab");this.cb=o,this.app=n,this.settingTab=r,this.plugin=a}onOpen(){var d;const{contentEl:n}=this;(d=n.parentElement)==null||d.classList.add("memo-save-location-modal"),this.titleEl.toggleClass("modal-title",!0),this.titleEl.setText(N("Password for Thino")),n.createDiv("modal-desc",p=>{p.setText(N("Please input your password to change password settings"))});const r=n.createDiv("modal-setting"),a=new Ve(r,this.settingTab).setName(N("Password")).addText(p=>{p.setPlaceholder(N("Please input your password")).inputEl.type="password"}),o=n.createDiv("button-group"),s=o.createEl("button",{text:N("Cancel")}),c=o.createEl("button",{cls:"thino-password-confirm-btn",text:N("Confirm?").replace(/(\?|?)/g,"")});c.onclick=async()=>{var p;a.controlEl.querySelector("input").value===this.plugin.settings.password?((p=this.cb)==null||p.call(this,!0),this.close()):new C.Notice(N("Password is incorrect"))},s.onclick=async()=>{this.close()}}onClose(){const{contentEl:n}=this;n.empty()}}function fv(e){return e.split("-")[0]}function Dx(e){return e.split("-")[1]}function yb(e){return["top","bottom"].includes(fv(e))?"x":"y"}function Sx(e){return e==="y"?"height":"width"}function W2(e){let{reference:t,floating:n,placement:r}=e;const a=t.x+t.width/2-n.width/2,o=t.y+t.height/2-n.height/2;let s;switch(fv(r)){case"top":s={x:a,y:t.y-n.height};break;case"bottom":s={x:a,y:t.y+t.height};break;case"right":s={x:t.x+t.width,y:o};break;case"left":s={x:t.x-n.width,y:o};break;default:s={x:t.x,y:t.y}}const c=yb(r),d=Sx(c);switch(Dx(r)){case"start":s[c]=s[c]-(t[d]/2-n[d]/2);break;case"end":s[c]=s[c]+(t[d]/2-n[d]/2);break}return s}const PK=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:s}=n;let c=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:p}=W2({...c,placement:r}),m=r,g={};for(let v=0;vRK[t])}function BK(e,t){const n=Dx(e)==="start",r=yb(e),a=Sx(r);let o=r==="x"?n?"right":"left":n?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=Ny(o)),{main:o,cross:Ny(o)}}const _K={start:"end",end:"start"};function $2(e){return e.replace(/start|end/g,t=>_K[t])}function HK(e){const t=Ny(e);return[$2(e),t,$2(t)]}const YK=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:o,rects:s,initialPlacement:c}=t;if((n=o.flip)!=null&&n.skip)return{};const{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",flipAlignment:v=!0,...D}=e,S=fv(a),E=m||(S===c||!v?[Ny(c)]:HK(c)),O=[c,...E],k=await t1(t,D),j=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&j.push(k[S]),p){const{main:H,cross:Y}=BK(a,s);j.push(k[H],k[Y])}if(F=[...F,{placement:a,overflows:j}],!j.every(H=>H<=0)){var B,R;const H=((B=(R=o.flip)==null?void 0:R.index)!=null?B:0)+1,Y=O[H];if(Y)return{data:{index:H,overflows:F},reset:{placement:Y}};let U="bottom";switch(g){case"bestFit":{var z;const J=(z=F.slice().sort((Q,le)=>Q.overflows.filter(pe=>pe>0).reduce((pe,ie)=>pe+ie,0)-le.overflows.filter(pe=>pe>0).reduce((pe,ie)=>pe+ie,0))[0])==null?void 0:z.placement;J&&(U=J);break}case"initialPlacement":U=c;break}return{data:{skip:!0},reset:{placement:U}}}return{}}}};function zK(e){let{placement:t,rects:n,value:r}=e;const a=fv(t),o=["left","top"].includes(a)?-1:1,s=typeof r=="function"?r({...n,placement:t}):r,{mainAxis:c,crossAxis:d}=typeof s=="number"?{mainAxis:s,crossAxis:0}:{mainAxis:0,crossAxis:0,...s};return yb(a)==="x"?{x:d,y:c*o}:{x:c*o,y:d}}const UK=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(t){const{x:n,y:r,placement:a,rects:o}=t,s=zK({placement:a,rects:o,value:e});return{x:n+s.x,y:r+s.y,data:s}}}};function vb(e){return(e==null?void 0:e.toString())==="[object Window]"}function xl(e){if(e==null)return window;if(!vb(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function hv(e){return xl(e).getComputedStyle(e)}function vs(e){return vb(e)?"":e?(e.nodeName||"").toLowerCase():""}function ws(e){return e instanceof xl(e).HTMLElement}function ky(e){return e instanceof xl(e).Element}function VK(e){return e instanceof xl(e).Node}function Ix(e){const t=xl(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function pv(e){const{overflow:t,overflowX:n,overflowY:r}=hv(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function ZK(e){return["table","td","th"].includes(vs(e))}function Tx(e){const t=navigator.userAgent.toLowerCase().includes("firefox"),n=hv(e);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||t&&n.willChange==="filter"||t&&(n.filter?n.filter!=="none":!1)}const G2=Math.min,Xh=Math.max,Ay=Math.round;function Ld(e,t){t===void 0&&(t=!1);const n=e.getBoundingClientRect();let r=1,a=1;return t&&ws(e)&&(r=e.offsetWidth>0&&Ay(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&Ay(n.height)/e.offsetHeight||1),{width:n.width/r,height:n.height/a,top:n.top/a,right:n.right/r,bottom:n.bottom/a,left:n.left/r,x:n.left/r,y:n.top/a}}function Ml(e){return((VK(e)?e.ownerDocument:e.document)||window.document).documentElement}function mv(e){return vb(e)?{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ex(e){return Ld(Ml(e)).left+mv(e).scrollLeft}function WK(e){const t=Ld(e);return Ay(t.width)!==e.offsetWidth||Ay(t.height)!==e.offsetHeight}function $K(e,t,n){const r=ws(t),a=Ml(t),o=Ld(e,r&&WK(t));let s={scrollLeft:0,scrollTop:0};const c={x:0,y:0};if(r||!r&&n!=="fixed")if((vs(t)!=="body"||pv(a))&&(s=mv(t)),ws(t)){const d=Ld(t,!0);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else a&&(c.x=Ex(a));return{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function gv(e){return vs(e)==="html"?e:e.assignedSlot||e.parentNode||(Ix(e)?e.host:null)||Ml(e)}function q2(e){return!ws(e)||getComputedStyle(e).position==="fixed"?null:e.offsetParent}function GK(e){let t=gv(e);for(;ws(t)&&!["html","body"].includes(vs(t));){if(Tx(t))return t;t=t.parentNode}return null}function n1(e){const t=xl(e);let n=q2(e);for(;n&&ZK(n)&&getComputedStyle(n).position==="static";)n=q2(n);return n&&(vs(n)==="html"||vs(n)==="body"&&getComputedStyle(n).position==="static"&&!Tx(n))?t:n||GK(e)||t}function J2(e){return{width:e.offsetWidth,height:e.offsetHeight}}function qK(e){let{rect:t,offsetParent:n,strategy:r}=e;const a=ws(n),o=Ml(n);if(n===o)return t;let s={scrollLeft:0,scrollTop:0};const c={x:0,y:0};if((a||!a&&r!=="fixed")&&((vs(n)!=="body"||pv(o))&&(s=mv(n)),ws(n))){const d=Ld(n,!0);c.x=d.x+n.clientLeft,c.y=d.y+n.clientTop}return{...t,x:t.x-s.scrollLeft+c.x,y:t.y-s.scrollTop+c.y}}function JK(e){const t=xl(e),n=Ml(e),r=t.visualViewport;let a=n.clientWidth,o=n.clientHeight,s=0,c=0;return r&&(a=r.width,o=r.height,Math.abs(t.innerWidth/r.scale-r.width)<.01&&(s=r.offsetLeft,c=r.offsetTop)),{width:a,height:o,x:s,y:c}}function KK(e){var t;const n=Ml(e),r=mv(e),a=(t=e.ownerDocument)==null?void 0:t.body,o=Xh(n.scrollWidth,n.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),s=Xh(n.scrollHeight,n.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0);let c=-r.scrollLeft+Ex(e);const d=-r.scrollTop;return hv(a||n).direction==="rtl"&&(c+=Xh(n.clientWidth,a?a.clientWidth:0)-o),{width:o,height:s,x:c,y:d}}function Cx(e){return["html","body","#document"].includes(vs(e))?e.ownerDocument.body:ws(e)&&pv(e)?e:Cx(gv(e))}function xx(e,t){var n;t===void 0&&(t=[]);const r=Cx(e),a=r===((n=e.ownerDocument)==null?void 0:n.body),o=xl(r),s=a?[o].concat(o.visualViewport||[],pv(r)?r:[]):r,c=t.concat(s);return a?c:c.concat(xx(gv(s)))}function QK(e,t){const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ix(n)){let r=t;do{if(r&&e===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function XK(e){const t=Ld(e),n=t.top+e.clientTop,r=t.left+e.clientLeft;return{top:n,left:r,x:r,y:n,right:r+e.clientWidth,bottom:n+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}function K2(e,t){return t==="viewport"?e1(JK(e)):ky(t)?XK(t):e1(KK(Ml(e)))}function eQ(e){const t=xx(gv(e)),r=["absolute","fixed"].includes(hv(e).position)&&ws(e)?n1(e):e;return ky(r)?t.filter(a=>ky(a)&&QK(a,r)&&vs(a)!=="body"):[]}function tQ(e){let{element:t,boundary:n,rootBoundary:r}=e;const o=[...n==="clippingParents"?eQ(t):[].concat(n),r],s=o[0],c=o.reduce((d,p)=>{const m=K2(t,p);return d.top=Xh(m.top,d.top),d.right=G2(m.right,d.right),d.bottom=G2(m.bottom,d.bottom),d.left=Xh(m.left,d.left),d},K2(t,s));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}const nQ={getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:$K(t,n1(n),r),floating:{...J2(n),x:0,y:0}}},convertOffsetParentRelativeRectToViewportRelativeRect:e=>qK(e),getOffsetParent:e=>{let{element:t}=e;return n1(t)},isElement:e=>ky(e),getDocumentElement:e=>{let{element:t}=e;return Ml(t)},getClippingClientRect:e=>tQ(e),getDimensions:e=>{let{element:t}=e;return J2(t)},getClientRects:e=>{let{element:t}=e;return t.getClientRects()}},rQ=(e,t,n)=>PK(e,t,{platform:nQ,...n});var aQ=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,a,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(a=r;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(a=r;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=r;a--!==0;){var s=o[a];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const oQ=er(aQ),iw=ep.Facet.define({combine:e=>{var t,n;return{defaultPlacement:((t=e.find(r=>r.defaultPlacement))==null?void 0:t.defaultPlacement)||"top",padding:((n=e.find(r=>r.padding))==null?void 0:n.padding)||8}}}),Mx=e=>e.split("-")[0],iQ=e=>e==="x"?"y":"x",sQ=e=>["top","bottom"].includes(Mx(e))?"x":"y",_h=(e,t,n)=>Math.max(e,Math.min(t,n)),lQ=(e,t)=>Object.fromEntries(Object.entries(e).map(([n,r],a)=>[n,t(r,n,a)])),uQ=e=>e===void 0?e:typeof e=="number"?-e:lQ(e,t=>t!==void 0?-t:t),cQ=(e={})=>({name:"shift",fn:async t=>{const{x:n,y:r,placement:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c=({x:E,y:O})=>({x:E,y:O}),editorMenu:d,...p}=e,m={x:n,y:r},g=await t1(t,p),v=sQ(Mx(a)),D=iQ(v);let S=m[v],T=m[D];if(o){const E=v==="y"?"top":"left",O=v==="y"?"bottom":"right",k=S+g[E],j=S-g[O];if(d){const F=await t1(t,{...p,boundary:d.dom,padding:uQ(p.padding)});if((D==="y"?["top","bottom"]:["left","right"]).every(R=>F[R]<=0)){const R=t.rects.floating.width,z=S+F[E]-R,H=S-F[O]+R,Y=Math.abs(g[E]-F[E]),U=Math.abs(g[O]-F[O]);Y>=R||U({width:0,height:0,top:t,left:e,bottom:t,right:e,x:e,y:t}),hQ=(e,t)=>{if(!e)return null;const n=Math.min(e.left,(t==null?void 0:t.left)??e.left),r=Math.max(e.right,(t==null?void 0:t.right)??e.right),a=Math.max(e.bottom,(t==null?void 0:t.bottom)??e.bottom)-Math.min(e.top,(t==null?void 0:t.top)??e.top),o=Math.min(e.top,(t==null?void 0:t.top)??e.top),s=o+a,c={left:n,right:r,top:o,bottom:s,width:0,height:a,x:o,y:n};return t&&(c.width=Math.abs(r-n)),c},pQ=fQ();class mQ{constructor(t){me(this,"containerEl");me(this,"virtualEl");me(this,"toolbar",null);me(this,"isThinoView");me(this,"tooltipInfo");me(this,"inView",!0);me(this,"defaultPlacement");me(this,"editorMenu");me(this,"cachedRefRect",null);me(this,"readFromDOM",()=>{if(this.tooltipInfo){const{start:t}=this.tooltipInfo;let{end:n}=this.tooltipInfo;n&&t===n&&(n=void 0);const r=this.view.coordsAtPos(t);let a=n?this.view.coordsAtPos(n):null;if(r&&a&&r.top!==a.top){const s=this.view.contentDOM.getBoundingClientRect();a={left:s.right,right:s.right,top:r.top,bottom:r.bottom}}const o=hQ(r,a);o&&(this.cachedRefRect=o,this.computePosition(o))}});this.view=t,this.containerEl=this.view.dom.parentElement,this.defaultPlacement=this.view.state.facet(iw).defaultPlacement,this.tooltipInfo=t.state.facet(r1),this.virtualEl={rect:pQ,getBoundingClientRect(){return this.rect}},this.maybeMeasure(),this.editorMenu={currMenu:null,evtRef:t.state.field(C.editorInfoField)},this.isThinoView=this.checkThinoView()}get workspace(){return this.view.state.field(C.editorInfoField).app.workspace}checkThinoView(){return this.view.state.field(C.editorInfoField)&&this.view.state.field(C.editorInfoField)instanceof wl}shouldRemoveToolbar(t){const n=t??this.tooltipInfo;return!(n!=null&&n.end||this.editorMenu.currMenu)}onEditorMenuOpen(t){this.editorMenu.currMenu||(this.editorMenu.currMenu=t,this.cachedRefRect?this.computePosition(this.cachedRefRect):this.maybeMeasure(),!C.Platform.isMacOS&&this.tooltipInfo&&(this.createToolbar(),this.maybeMeasure()))}onEditorMenuClose(t){this.editorMenu.currMenu===t&&(this.editorMenu.currMenu=null),!C.Platform.isMacOS&&this.toolbar&&this.shouldRemoveToolbar()&&this.removeToolbar()}createToolbar(t){const n=t??this.tooltipInfo;if(!n)return;this.removeToolbar();const r=n.create(this.containerEl),a=this.view.state.field(C.editorInfoField);if(!a||!(a!=null&&a.editor))return;const o=a.editor.offsetToPos(n.start),s=n.end?a.editor.offsetToPos(n.end):o;this.workspace.trigger(dQ,r,{from:o,to:s},a.editor,a),this.toolbar=r}removeToolbar(){this.toolbar&&(this.toolbar.hide(),this.toolbar=null)}update(t){if(!this.isThinoView)return;const n=t.state.facet(r1),r=n!==this.tooltipInfo&&!oQ(n,this.tooltipInfo);r&&(this.tooltipInfo=n,this.shouldRemoveToolbar()?this.removeToolbar():n&&!this.toolbar&&this.createToolbar(n));const a=r||t.geometryChanged,o=t.state.facet(iw);o.defaultPlacement!=this.defaultPlacement&&(o.defaultPlacement=this.defaultPlacement),a&&this.maybeMeasure()}destroy(){this.editorMenu.currMenu=null,this.removeToolbar(),this.toolbar=null,this.view.state.field(C.editorInfoField).app.workspace.offref(this.editorMenu.evtRef)}async computePosition(t){if(!this.toolbar)return;this.virtualEl.rect=t;const{padding:n}=this.view.state.facet(iw),{x:r,y:a}=await rQ(this.virtualEl,this.toolbar.dom,{placement:this.defaultPlacement,middleware:[UK({mainAxis:5}),YK({padding:n,boundary:this.view.scrollDOM}),cQ({padding:n,boundary:this.view.scrollDOM,editorMenu:this.editorMenu.currMenu})]});Object.assign(this.toolbar.dom.style,{top:"0",left:"0",transform:`translate(${Math.round(r)}px,${Math.round(a)}px)`})}maybeMeasure(){this.view.inView&&this.toolbar&&this.view.requestMeasure({read:this.readFromDOM}),this.inView!=this.view.inView&&(this.inView=this.view.inView,this.inView||this.removeToolbar())}}const gQ=Ci.ViewPlugin.fromClass(mQ,{eventHandlers:{scroll(){this.maybeMeasure()}}}),r1=ep.Facet.define({enables:[gQ],combine:e=>e.filter(t=>t!=null).first()??null}),yQ=e=>{const t=SQ(e);t&&window.navigator.clipboard.writeText(t==null?void 0:t.getSelection())},vQ=e=>{e.commands.executeCommandById("editor:toggle-bold",e)},wQ=e=>{e.commands.executeCommandById("editor:toggle-strikethrough",e)},bQ=e=>{e.commands.executeCommandById("editor:toggle-highlight",e)},DQ=e=>{e.commands.executeCommandById("editor:toggle-italics",e)},SQ=e=>{const{editor:t}=e.field(C.editorInfoField);return t},Q2=(e,t)=>{const n=e.selection.ranges[0];if(!n)return null;const{anchor:r,head:a,empty:o}=n,[s,c]=[r,a].sort();return{start:s,end:o?void 0:c,create:p=>new CQ(p).addSmallButton(g=>g.setClass("clickable-icon").setIcon("copy").onClick(()=>yQ(e))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("bold").onClick(()=>vQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("italic").onClick(()=>DQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("strikethrough").onClick(()=>wQ(t))).addSmallButton(g=>g.setClass("clickable-icon").setIcon("highlighter").onClick(()=>bQ(t)))}},IQ=e=>ep.StateField.define({create:t=>Q2(t,e),update:(t,n)=>!n.docChanged&&!n.selection?t:Q2(n.state,e),provide:t=>r1.from(t)}),TQ=e=>[IQ(e)];class EQ extends C.BaseComponent{constructor(n){super();me(this,"button");me(this,"disabled",!1);me(this,"dropdownOptions",[]);me(this,"menu");me(this,"menuOpened",!1);this.button=new C.ButtonComponent(n)}setDisabled(n){return this.button.setDisabled(n),this.disabled=n,this}setIcon(n){return this.button.setIcon(n),this}setClass(n){return this.button.setClass(n),this}setDropdownText(n){var d;const r=this.button.buttonEl.createDiv("mini-toolbar-text"),a=this.button.buttonEl.createDiv("mini-toolbar-icon-with-text");C.setIcon(a,"chevron-down");const o=(d=n.doc.lineAt(n.selection.ranges[0].from))==null?void 0:d.from,s=b0.syntaxTree(n).resolveInner(o+1),c=s.type.prop(b0.tokenClassNodeProp);return r.setText(this.detectFormat(c,s)||"Text"),this}setDropdownIcon(){const n=this.button.buttonEl.createDiv("mini-toolbar-highlight-icon"),r=this.button.buttonEl.createDiv("mini-toolbar-icon-with-icon");return C.setIcon(n,"highlighter"),C.setIcon(r,"chevron-down"),this}detectFormat(n,r){var a;if(!n)return"Text";if(n.includes("strong"))return"Bold";if(n.includes("em"))return"Italic";if(n.includes("strikethrough"))return"Strike";if(n.contains("hmd-codeblock"))return"CodeBlock";if(n.contains("hmd-inline-code"))return"Code";if(n.contains("formatting-header")){const o=n.match(/header-\d{1,}/);if(o)return"Heading "+o[0].slice(-1)}if(n.contains("formatting-list")||n.contains("hmd-list-indent")){if(r!=null&&r.parent){const o=(a=r.parent)==null?void 0:a.type.prop(b0.lineClassNodeProp);if(o!=null&&o.contains("HyperMD-task-line"))return"To-do list"}if(n.contains("formatting-list-ol"))return"Numbered list";if(n.contains("formatting-list-ul"))return"Bulleted list"}}setTooltip(n){return this.button.setTooltip(n),this}setOptionsList(n){return this.dropdownOptions=n,this}onClick(n){return this.dropdownOptions.length>0?(this.button.onClick(r=>this.showEditMenu(r)),this):(this.button.onClick(n),this)}showEditMenu(n){var s,c;if(this.menuOpened=!this.menuOpened,!this.menuOpened)return;this.menu=new C.Menu,this.menu.onHide(()=>{this.menuOpened=!1});const r=n.currentTarget,a=(s=n.currentTarget)==null?void 0:s.getBoundingClientRect(),o={x:a.left-6,y:a.bottom+6};for(let d=0;d<((c=this.dropdownOptions)==null?void 0:c.length);d++)this.menu.addItem(p=>{p.setIcon("zap").setTitle(this.dropdownOptions[d]).onClick(()=>{})});this.menu.setParentElement(r).showAtPosition(o)}then(n){return n(this),this}}class CQ extends C.Component{constructor(n){super();me(this,"dom");me(this,"smallBtnContainer");me(this,"unloading",!1);this.dom=n==null?void 0:n.createDiv({cls:"cm-mini-toolbar"},r=>r.style.position="absolute"),this.smallBtnContainer=this.dom}addSmallButton(n){return n(new EQ(this.smallBtnContainer)),this}hide(){return this.unload(),this.unloading?this:(this.unloading=!0,this.dom.detach(),this.unloading=!1,this)}}const xQ=Ci.Decoration.line({attributes:{"data-ph":N("What do you think now...")},class:"thino-editor-placeholder"}),MQ=ep.StateField.define({create(){return Ci.Decoration.none},update(e,t){const n=t.state.field(C.editorInfoField);if(!(n!=null&&n.view)&&!((n==null?void 0:n.view)instanceof wl))return e;const r=new ep.RangeSetBuilder,a=t.state.doc.toString(),o=t.state.doc.lineAt(0);return(a==null?void 0:a.length)==0&&r.add(o.from,o.from,xQ),r.finish()},provide:e=>Ci.EditorView.decorations.from(e)});function Nx(e){return`userId:${e}`}function NQ(e,t){return`expiryDate:${t}:${e}`}function kQ(e){try{const t=Nx(e==null?void 0:e.appId);return Kn.get([t])[t]||""}catch(t){return console.error(t),""}}function AQ(e,t){try{const n=Nx(t==null?void 0:t.appId);return Kn.set({[n]:e}),{userId:e,key:n}}catch(n){console.error(n)}}function FQ(e,t){try{const n=NQ(kQ(t),t==null?void 0:t.appId);Kn.set({[n]:e})}catch(n){console.error(n)}}const OQ=Ue.grabImageFromUrl,PQ=require("http"),jQ=require("url");function LQ(e){const t=e.indexOf(";base64,"),n=e.substring(5,t),r=e.substr(t+8),a=atob(r),o=new ArrayBuffer(a.length),s=new Uint8Array(o);for(let d=0;d{const{type:t}=e;if(t.startsWith("image"))try{return`${await S1.upload(e)}`}catch(n){new C.Notice(n)}};function RQ(e){const t=PQ.createServer(async function(n,r){r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Allow-Methods","GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE"),r.setHeader("Access-Control-Allow-Headers","Access-Control-Allow-Headers, Origin, Authorization,Accept,x-client-id, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, hypothesis-client-version"),r.setHeader("Access-Control-Allow-Credentials","true");try{if(n.url){const a=jQ.parse(n.url,!0);if(a.pathname==="/create"&&n.method==="POST"){let o="";n.on("data",s=>{o+=s}),n.on("end",async()=>{const s=JSON.parse(o),{text:c,isList:d,type:p,imageList:m}=s;let g=c;if(!g){r.statusCode=200,r.setHeader("Content-Type","application/json"),r.end(JSON.stringify({status:"success",thino:null,link:null}));return}new RegExp(/(<([^>]+)>)/g).test(c)&&(g=C.htmlToMarkdown(c));let D=[];const S=[];if(e.AutoDownloadImage){const E=g.match(_u)||[];if(E.length>0){for(const O of E)try{const k=await OQ(O);if(k.size===0)continue;const j=new File([k],"image.png",{type:"image/png"}),F=await X2(j);S.push({oldUrl:O,newUrl:F})}catch(k){console.error(k)}S.forEach(O=>{g=g.replace(O.oldUrl,O.newUrl)}),m&&m.length>0&&(D=await Promise.all(m.map(async O=>{const k=LQ(O);return new File([k],"image.png",{type:"image/png"})})));for(const O of D){const k=await X2(O);g+=` ${k}`}}}const T=await Te.createThino({content:g,isList:d,type:p});T&&(Te.pushMemo(T),He.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(a.pathname==="/search"&&n.method==="GET"){const o=a.query,{keyword:s}=o,c=Te.getThinoViaKeyword(s);r.statusCode=200,r.setHeader("Content-Type","application/json");const d=JSON.stringify({status:"success",thinos:c});r.end(d)}else r.statusCode=404,r.end()}}catch(a){console.error(a),r.statusCode=500,r.end({status:"error",message:a.message})}});return{listen(n,r){try{t.listen({port:parseInt(r),host:n})}catch(a){console.error(a),new C.Notice(N("Thino - Failed to start HTTP server, please check the port is available."))}new C.Notice(`${N("Thino - Started HTTP server on port")} ${r}`)},close(){t.close(),new C.Notice(N("Thino - Terminated HTTP server"))}}}const{clipboard:gn}=C.Platform.isDesktop?require("electron"):"";class BQ{constructor(){me(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 Dd=new BQ;let Hh=null,eI=gn==null?void 0:gn.readText(),tI=gn==null?void 0:gn.readImage();gn&&(gn.on=(e,t)=>(Dd.on(e,t),gn),gn.once=(e,t)=>(Dd.once(e,t),gn),gn.off=(e,t)=>(t?Dd.removeListener(e,t):Dd.removeAllListeners(e),gn),gn.startWatching=()=>(Hh||(Hh=setInterval(()=>{_Q(eI,eI=gn==null?void 0:gn.readText())&&Dd.emit("text-changed"),HQ(tI,tI=gn==null?void 0:gn.readImage())&&Dd.emit("image-changed")},500)),gn),gn.stopWatching=()=>(Hh&&clearInterval(Hh),Hh=null,gn));function _Q(e,t){return t&&e!==t}function HQ(e,t){return!t.isEmpty()&&e.toDataURL()!==t.toDataURL()}var sI;const sw=(sI=require("electron"))==null?void 0:sI.remote;var lI,uI;const nI=(uI=(lI=require("electron"))==null?void 0:lI.remote)==null?void 0:uI.screen;class YQ{constructor(t,n){me(this,"isRegisted");me(this,"leaf");me(this,"clipboard");me(this,"isScreenTop",!1);me(this,"currentSplitWindow");me(this,"intervalNum");me(this,"allowsCopy",!1);me(this,"plugin");me(this,"actionEl",null);this.app=t,this.plugin=n,this.isRegisted=!1,this.leaf=null,this.clipboard=gn}async onload(){C.Platform.isDesktop&&(this.initGlobalCopyEvents(),await this.registerAllShortcuts(),this.registerEvents())}registerEvents(){this.plugin.registerEvent(this.app.workspace.on("quit",()=>{sw.globalShortcut.unregister(this.plugin.settings.CaptureKey.OpenThinoGlobally)}))}initGlobalCopyEvents(){this.plugin.addCommand({id:"init-global-copy-events",name:N("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&&(sw.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(){sw.globalShortcut.register(this.plugin.settings.CaptureKey.OpenThinoGlobally,()=>{this.getCurrentLeaf()?this.showThinoView():this.openThinoView()}),this.isRegisted=!0}showThinoView(){var r,a,o,s;const t=nI.getCursorScreenPoint(),n=(s=(o=(a=(r=this.leaf)==null?void 0:r.parent)==null?void 0:a.parent)==null?void 0:o.win)==null?void 0:s.electronWindow;if(n){if(n.setAlwaysOnTop(!this.isScreenTop,"screen"),this.leaf.setPinned(!this.isScreenTop),this.leaf.view.containerEl.toggleClass("thino-float-window",!0),n.isMinimized()&&n.restore(),n.focus(),this.plugin.settings.CaptureKey.ShowNearMouse){const{width:c,height:d}=n.getBounds();n.setBounds({x:t.x,y:t.y,width:c,height:d})}if(this.app.workspace.trigger("focus-on-textarea"),this.isScreenTop){this.isScreenTop=!1,setTimeout(()=>{n.setAlwaysOnTop(!1,"screen")},200);return}this.isScreenTop=!0}}openThinoView(){var o,s,c,d,p;this.leaf=this.app.workspace.openPopoutLeaf({size:{width:400,height:400}});const t=this.leaf;this.leaf.view.containerEl.toggleClass("thino-float-window",!0),this.leaf.setViewState({type:"thino_view"}),setTimeout(()=>{t.view.containerEl.classList.toggle("mobile-view",!0)},0),this.currentSplitWindow=(s=(o=this.leaf)==null?void 0:o.parent)==null?void 0:s.parent;const n=(p=(d=(c=this.leaf)==null?void 0:c.parent)==null?void 0:d.parent)==null?void 0:p.win.electronWindow;if(!n)return;n.setAlwaysOnTop(!this.isScreenTop,"screen"),this.leaf.setPinned(!this.isScreenTop),this.isScreenTop=!0;const r=this.app,a=m=>{var D,S,T;const g=nI.getCursorScreenPoint(),v=(T=(S=(D=t==null?void 0:t.parent)==null?void 0:D.parent)==null?void 0:S.win)==null?void 0:T.electronWindow;if(v){if(v.isMinimized()&&v.restore(),!this.isScreenTop&&this.plugin.settings.CaptureKey.ShowNearMouse){const{width:E,height:O}=v.getBounds();v.setBounds({x:g.x,y:g.y-200,width:E,height:O})}v.setAlwaysOnTop(!0,"screen"),r.workspace.trigger("focus-on-textarea"),r.workspace.trigger("send-to-thino",m,t)}};this.clipboard.on("text-changed",()=>{const m=this.clipboard.readText();a(m)}).on("image-changed",()=>{const m=this.clipboard.readImage();a(m)})}}class rI extends C.EditorSuggest{constructor(n,r){super(n);me(this,"root");me(this,"editor");me(this,"cursor");me(this,"plugin");me(this,"tags");me(this,"type","customTag");me(this,"HASHTAG_REGEX",/(^|\s)#[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]*$/g);this.plugin=r}checkSettings(){return this.plugin.settings.UseVaultTags}checkInMemosView(n){var o;const r=n.containerEl;if(!r)return!1;const a=(o=r.parentElement)==null?void 0:o.parentElement;return(a==null?void 0:a.classList.contains("common-editor-inputer"))||!1}fuzzySearchItemsOptimized(n,r){const a=C.prepareFuzzySearch(n);return r.map(s=>{const c=a(s);return c?{item:s,match:c}:null}).filter(Boolean)}onTrigger(n,r){if(!this.checkInMemosView(r)||this.checkSettings())return null;this.tags=Te.getState().tags,this.cursor=n,this.editor=r;const a=n.line,o=r.getLine(a),s=o.substr(0,n.ch);if(s.match(this.HASHTAG_REGEX)&&o.substr(n.ch,1)!=="#"){const c=s.lastIndexOf("#"),d=s.substr(c+1);return{start:{line:a,ch:c},end:{line:a,ch:n.ch},query:d}}return null}getSuggestions(n){return this.fuzzySearchItemsOptimized(n.query,this.tags).map(r=>r.item).sort((r,a)=>r.localeCompare(a))||[]}renderSuggestion(n,r){r.setText(n)}selectSuggestion(n){if(this.context){const r=this.context.editor,a=this.context.start,o=this.context.end;r.transaction({changes:[{from:a,to:o,text:"#"+n+" "}]}),setTimeout(function(){return r.focus()})}this.close()}}const wb=crypto,kx=e=>e instanceof CryptoKey,Vg=new TextEncoder,bb=new TextDecoder;function zQ(...e){const t=e.reduce((a,{length:o})=>a+o,0),n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}const UQ=e=>{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{let t=e;t instanceof Uint8Array&&(t=bb.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return UQ(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class yv extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(t){var n;super(t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}}class VQ extends yv{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}class vv extends yv{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}class xr extends yv{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}class ZQ extends yv{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}function us(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function Zg(e,t){return e.name===t}function uw(e){return parseInt(e.name.slice(4),10)}function WQ(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function $Q(e,t){if(t.length&&!t.some(n=>e.usages.includes(n))){let n="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();n+=`one of ${t.join(", ")}, or ${r}.`}else t.length===2?n+=`one of ${t[0]} or ${t[1]}.`:n+=`${t[0]}.`;throw new TypeError(n)}}function GQ(e,t,...n){switch(t){case"HS256":case"HS384":case"HS512":{if(!Zg(e.algorithm,"HMAC"))throw us("HMAC");const r=parseInt(t.slice(2),10);if(uw(e.algorithm.hash)!==r)throw us(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!Zg(e.algorithm,"RSASSA-PKCS1-v1_5"))throw us("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(uw(e.algorithm.hash)!==r)throw us(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!Zg(e.algorithm,"RSA-PSS"))throw us("RSA-PSS");const r=parseInt(t.slice(2),10);if(uw(e.algorithm.hash)!==r)throw us(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448")throw us("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!Zg(e.algorithm,"ECDSA"))throw us("ECDSA");const r=WQ(t);if(e.algorithm.namedCurve!==r)throw us(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}$Q(e,n)}function Ax(e,t,...n){var r;if(n.length>2){const a=n.pop();e+=`one of type ${n.join(", ")}, or ${a}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&(r=t.constructor)!=null&&r.name&&(e+=` Received an instance of ${t.constructor.name}`),e}const aI=(e,...t)=>Ax("Key must be ",e,...t);function Fx(e,t,...n){return Ax(`Key for the ${e} algorithm must be `,t,...n)}const Ox=e=>kx(e),Ei=["CryptoKey"],qQ=(...e)=>{const t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(const r of t){const a=Object.keys(r);if(!n||n.size===0){n=new Set(a);continue}for(const o of a){if(n.has(o))return!1;n.add(o)}}return!0};function JQ(e){return typeof e=="object"&&e!==null}function oI(e){if(!JQ(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}const KQ=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if(typeof n!="number"||n<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}},ml=(e,t,n=0)=>{n===0&&(t.unshift(t.length),t.unshift(6));const r=e.indexOf(t[0],n);if(r===-1)return!1;const a=e.subarray(r,r+t.length);return a.length!==t.length?!1:a.every((o,s)=>o===t[s])||ml(e,t,r+1)},iI=e=>{switch(!0){case ml(e,[42,134,72,206,61,3,1,7]):return"P-256";case ml(e,[43,129,4,0,34]):return"P-384";case ml(e,[43,129,4,0,35]):return"P-521";case ml(e,[43,101,110]):return"X25519";case ml(e,[43,101,111]):return"X448";case ml(e,[43,101,112]):return"Ed25519";case ml(e,[43,101,113]):return"Ed448";default:throw new vv("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},QQ=async(e,t,n,r,a)=>{let o,s;const c=new Uint8Array(atob(n.replace(e,"")).split("").map(p=>p.charCodeAt(0))),d=t==="spki";switch(r){case"PS256":case"PS384":case"PS512":o={name:"RSA-PSS",hash:`SHA-${r.slice(-3)}`},s=d?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":o={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${r.slice(-3)}`},s=d?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":o={name:"RSA-OAEP",hash:`SHA-${parseInt(r.slice(-3),10)||1}`},s=d?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":o={name:"ECDSA",namedCurve:"P-256"},s=d?["verify"]:["sign"];break;case"ES384":o={name:"ECDSA",namedCurve:"P-384"},s=d?["verify"]:["sign"];break;case"ES512":o={name:"ECDSA",namedCurve:"P-521"},s=d?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const p=iI(c);o=p.startsWith("P-")?{name:"ECDH",namedCurve:p}:{name:p},s=d?[]:["deriveBits"];break}case"EdDSA":o={name:iI(c)},s=d?["verify"]:["sign"];break;default:throw new vv('Invalid or unsupported "alg" (Algorithm) value')}return wb.subtle.importKey(t,c,o,(a==null?void 0:a.extractable)??!1,s)},XQ=(e,t,n)=>QQ(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",e,t,n);async function eX(e,t,n){if(typeof e!="string"||e.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw new TypeError('"spki" must be SPKI formatted string');return XQ(e,t,n)}const tX=(e,t)=>{if(!(t instanceof Uint8Array)){if(!Ox(t))throw new TypeError(Fx(e,t,...Ei,"Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Ei.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},nX=(e,t,n)=>{if(!Ox(t))throw new TypeError(Fx(e,t,...Ei));if(t.type==="secret")throw new TypeError(`${Ei.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if(n==="sign"&&t.type==="public")throw new TypeError(`${Ei.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if(n==="decrypt"&&t.type==="public")throw new TypeError(`${Ei.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n==="verify"&&t.type==="private")throw new TypeError(`${Ei.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n==="encrypt"&&t.type==="private")throw new TypeError(`${Ei.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},rX=(e,t,n)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?tX(e,t):nX(e,t,n)};function aX(e,t,n,r,a){if(a.crit!==void 0&&r.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;n!==void 0?o=new Map([...Object.entries(n),...t.entries()]):o=t;for(const s of r.crit){if(!o.has(s))throw new vv(`Extension Header Parameter "${s}" is not recognized`);if(a[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(o.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)}const oX=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(n=>typeof n!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)};function iX(e,t){const n=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new vv(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}function sX(e,t,n){if(kx(t))return GQ(t,e,n),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(aI(t,...Ei));return wb.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(aI(t,...Ei,"Uint8Array"))}const lX=async(e,t,n,r)=>{const a=await sX(e,t,"verify");KQ(e,a);const o=iX(e,a.algorithm);try{return await wb.subtle.verify(o,a,n,r)}catch{return!1}};async function uX(e,t,n){if(!oI(e))throw new xr("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new xr('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new xr("JWS Protected Header incorrect type");if(e.payload===void 0)throw new xr("JWS Payload missing");if(typeof e.signature!="string")throw new xr("JWS Signature missing or incorrect type");if(e.header!==void 0&&!oI(e.header))throw new xr("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const T=lw(e.protected);r=JSON.parse(bb.decode(T))}catch{throw new xr("JWS Protected Header is invalid")}if(!qQ(r,e.header))throw new xr("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const a={...r,...e.header},o=aX(xr,new Map([["b64",!0]]),n==null?void 0:n.crit,r,a);let s=!0;if(o.has("b64")&&(s=r.b64,typeof s!="boolean"))throw new xr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:c}=a;if(typeof c!="string"||!c)throw new xr('JWS "alg" (Algorithm) Header Parameter missing or invalid');const d=n&&oX("algorithms",n.algorithms);if(d&&!d.has(c))throw new VQ('"alg" (Algorithm) Header Parameter value not allowed');if(s){if(typeof e.payload!="string")throw new xr("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new xr("JWS Payload must be a string or an Uint8Array instance");let p=!1;typeof t=="function"&&(t=await t(r,e),p=!0),rX(c,t,"verify");const m=zQ(Vg.encode(e.protected??""),Vg.encode("."),typeof e.payload=="string"?Vg.encode(e.payload):e.payload);let g;try{g=lw(e.signature)}catch{throw new xr("Failed to base64url decode the signature")}if(!await lX(c,t,g,m))throw new ZQ;let D;if(s)try{D=lw(e.payload)}catch{throw new xr("Failed to base64url decode the payload")}else typeof e.payload=="string"?D=Vg.encode(e.payload):D=e.payload;const S={payload:D};return e.protected!==void 0&&(S.protectedHeader=r),e.header!==void 0&&(S.unprotectedHeader=e.header),p?{...S,key:t}:S}async function cX(e,t,n){if(e instanceof Uint8Array&&(e=bb.decode(e)),typeof e!="string")throw new xr("Compact JWS must be a string or Uint8Array");const{0:r,1:a,2:o,length:s}=e.split(".");if(s!==3)throw new xr("Invalid Compact JWS");const c=await uX({payload:a,protected:r,signature:o},t,n),d={payload:c.payload,protectedHeader:c.protectedHeader};return typeof t=="function"?{...d,key:c.key}:d}const dX={webId:"globe-2",pinned:"pin",archived:"archive",visibility:"eye",deleted:"trash"};class fX extends Ci.WidgetType{constructor(n,r,a,o,s){super();me(this,"error",!1);this.view=n,this.plugin=r,this.target=a,this.type=o,this.to=s}eq(n){return this.target===n.target}toDOM(){const n=createSpan();return n.toggleClass("thino-inline-widget",!0),C.setIcon(n,dX[this.type]||"help-circle"),C.setTooltip&&C.setTooltip(n,this.target),n}}function hX(e){class t{constructor(a){me(this,"view");me(this,"match",new Ci.MatchDecorator({regexp:/\[(webId|pinned|archived|visibility|deleted)::([^\]]+)\]/g,decorate:(a,o,s,c,d)=>{this.shouldRender(d,o,s)&&a(o,s,Ci.Decoration.replace({widget:new fX(d,e,c[0],c[1],s)}))}}));me(this,"decorations",Ci.Decoration.none);this.view=a,this.updateDecorations(a)}update(a){this.updateDecorations(a.view,a)}destroy(){this.decorations=Ci.Decoration.none}updateDecorations(a,o){!o||this.decorations.size===0?this.decorations=this.match.createDeco(a):this.decorations=this.match.updateDeco(o,this.decorations)}isLivePreview(a){return a.field(C.editorLivePreviewField)}shouldRender(a,o,s){return!a.state.selection.ranges.some(d=>d.from<=o?d.to>=o:d.from<=s)&&this.isLivePreview(a.state)}}const n={decorations:r=>r.decorations.update({filter:(a,o,s)=>{const c=s.spec.widget;return c&&c.error?!1:a===o||!r.view.state.selection.ranges.filter(d=>{const p=d.from,m=d.to;return p<=a?m>=a:p<=o}).length}})};return Ci.ViewPlugin.fromClass(t,n)}const pX=e=>e.ctrlKey!==void 0||e.metaKey!==void 0||e.shiftKey!==void 0||e.altKey!==void 0,Wg=()=>{new C.Notice(N("Open Memos Successfully"))},$g=[{id:"open-thino-in-left-sidebar",shortName:N("Left sidebar"),name:N("Open thino in left sidebar"),icon:"arrow-left",location:"left",cb:Wg,modKeys:"shift"},{id:"open-thino-in-right-sidebar",shortName:N("Right sidebar"),name:N("Open thino in right sidebar"),icon:"arrow-right",location:"right",cb:Wg,modKeys:["ctrl","meta"]},{id:"open-thino-in-float",shortName:N("Float window"),name:N("Open thino in float window"),icon:"layout",location:"float",cb:Wg,modKeys:"alt"},{id:"open-thino-in-center",shortName:N("Center window"),name:N("Open thino in center window"),icon:"tv-2",location:"center",cb:Wg,modKeys:void 0}];class mX extends C.Plugin{constructor(){super(...arguments);me(this,"settings");me(this,"settingTab");me(this,"triggerBySelf",!1);me(this,"updatedID","");me(this,"debounceTimer",0);me(this,"apiHttpServer",null);me(this,"captureService",null);me(this,"loaded",!1)}async onload(){await this.loadSettings(),bK(),this.registerRibbon(),await this.verify(),this.checkVersionAndShowChangeLog(),this.settingTab=new FK(this.app,this),this.addSettingTab(this.settingTab),this.initEditor(),this.initURIHandler(),this.registerMobileEvent(),this.registerCommands(),this.registerCanvasNodeMemos(),this.registerHoverEvent(),this.registerLinkOpen(),this.registerCodeBlocks(),this.registerEditorSuggest(new yK(this.app,this)),this.registerEditorExtension([MQ]),this.app.workspace.onLayoutReady(this.onLayoutReady.bind(this)),this.registerView(_r,n=>new wl(n,this))}async loadSettings(){this.settings=Object.assign({},cs,await this.loadData()),Xe.setSettings(this.settings)}async saveSettings(){await this.saveData(this.settings),Xe.setSettings(this.settings)}onunload(){var r;this.app.workspace.detachLeavesOfType(_r),Te.clearMemos(),Ee.dispatch({type:"CLEAR_MEMOS",payload:null}),Ee.dispatch({type:"CLEAR_FILES",payload:null}),Ee.dispatch({type:"CLEAR_VIEW",payload:null});const n=document.body.find(".dialog-wrapper");n&&((r=n.parentElement)==null||r.detach()),this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null),this.captureService&&this.captureService.onunload(),new C.Notice(N("Close Memos Successfully"))}initEditor(){const n=()=>{const r=this.app.embedRegistry;if(!r)return!1;const a=r.embedByExtension.md,o=createEl("div"),s=a({app:this.app,containerEl:o},null,null);if(s.editable=!0,s.set(""),s.showEditor(),!s.editMode)return!1;const c=Object.getPrototypeOf(Object.getPrototypeOf(s.editMode));return Xe.setEditor(c),o.detach(),!0};this.app.workspace.onLayoutReady(()=>{n()||this.app.workspace.onLayoutReady(()=>{setTimeout(()=>{n()},100)})}),this.register(qh(C.MetadataCache.prototype,{getFileCache:r=>function(a){return!(a!=null&&a.path)&&!a?null:r.call(this,a)}}))}initApp(){Xe.setApp(this.app)}initURIHandler(){this.registerObsidianProtocolHandler("thino",async n=>{var s,c,d;if(!n)return;if(n.userid)try{const p=n.userid;AQ(p,this.app),FQ(C.moment().add(30,"days").valueOf(),this.app),Qe.setRefresh(!0)}catch(p){console.error(p),new C.Notice(N("Failed to verify"))}if(n.token)try{const p=n.token;(s=this.app)==null||s.saveLocalStorage("tokenForSync",p),setTimeout(()=>{this.app.setting.open(),this.app.setting.openTabById(this.manifest.id||"obsidian-memos"),this.settingTab.display()},200),new C.Notice(N("Saved sync token successfully"))}catch(p){console.error(p),new C.Notice(N("Failed to save"))}if(n.copyToken){this.app.setting.open(),this.app.setting.openTabById(this.manifest.id??"obsidian-memos");const p=await wx();await navigator.clipboard.writeText(p),new C.Notice(N("Copied app id successfully"))}const r=(c=Xe.getState())==null?void 0:c.verifyState,a=!C.Platform.isDesktop&&await((d=window.Capacitor)==null?void 0:d.Plugins.Device.getId()),o=C.Platform.isDesktop?await vn():a.identifier||a.uuid;if(!(!r||(r==null?void 0:r.appId)!==o)){if(n.content){const p=n.type,m=decodeURI(n.content)!==n.content?decodeURI(n.content):n.content,g=n.task,v=await Te.createThino({content:m,type:p,isList:!!g});if(!v)return;Te.pushMemo(v),He.clearQuery()}n.openId&&await Te.openThinoByID(n.openId)}})}initGlobalManifest(){Qe.setPluginManifest(this.manifest)}stopServer(){this.apiHttpServer&&(this.apiHttpServer.close(),this.apiHttpServer=null)}async initServer(){var o,s;if(C.Platform.isMobile||!this.settings.EnabledHttpApi)return;const n=(o=Xe.getState())==null?void 0:o.verifyState,r=!C.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=C.Platform.isDesktop?await vn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.apiHttpServer=RQ(this.settings),this.initServerPort())}initServerPort(){this.apiHttpServer&&this.settings.EnabledHttpApi&&this.apiHttpServer.listen(this.settings.HttpApiIpType,this.settings.HttpApiPort)}async initCaptureService(){var o,s;if(C.Platform.isMobile||!this.settings.CaptureKey.EnableCaptureKey)return;const n=(o=Xe.getState())==null?void 0:o.verifyState,r=!C.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=C.Platform.isDesktop?await vn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.captureService=new YQ(this.app,this),await this.captureService.onload())}registerMobileEvent(){C.Platform.isMobile&&(this.registerEvent(this.app.workspace.on("receive-text-menu",(n,r)=>{n.addItem(a=>{a.setSection("options").setIcon("popup-open").setTitle(N("Insert as Memo")).onClick(async()=>{let o=r;if(this.settings.ShareToThinoWithText){const c=this.settings.ShareToThinoWithTextPrepend+(this.settings.ShareToThinoWithTextNewline==="prepend"||this.settings.ShareToThinoWithTextNewline==="both"?` `:" "),d=(this.settings.ShareToThinoWithTextNewline==="append"||this.settings.ShareToThinoWithTextNewline==="both"?` `:" ")+this.settings.ShareToThinoWithTextAppend;o=c+o+d}const s=await Te.createThino({content:o,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});Te.pushMemo(s)})})})),this.registerEvent(this.app.workspace.on("receive-files-menu",(n,r)=>{n.addItem(a=>{a.setIcon("popup-open").setTitle(N("Insert file as memo content")).onClick(async()=>{let s=r.map(d=>this.app.fileManager.generateMarkdownLink(d,d.path)).join(` `);if(this.settings.ShareToThinoWithText){const d=this.settings.ShareToThinoWithTextPrepend+(this.settings.ShareToThinoWithTextNewline==="prepend"||this.settings.ShareToThinoWithTextNewline==="both"?` `:" "),p=(this.settings.ShareToThinoWithTextNewline==="append"||this.settings.ShareToThinoWithTextNewline==="both"?` `:" ")+this.settings.ShareToThinoWithTextAppend;s=d+s+p}const c=await Te.createThino({content:s,type:this.settings.MemoSaveLocation||"DAILY",isList:!0});Te.pushMemo(c)})})})))}registerCommands(){$g.forEach(n=>{this.addCommand({id:n.id,name:n.name,callback:()=>this.openMemos(n.location,n.cb),hotkeys:[]})}),this.addCommand({id:"show-thino-editor",name:N("Show thino editor"),checkCallback:n=>{if(Te.initialized&&Xe.initialized){if(!n){if(!Xe.getState().view){new C.Notice(N("Please open thino first"));return}new fx(this.app).open()}return!0}}}),this.addCommand({id:"lock-thino",name:N("Lock thino"),checkCallback:n=>{if(this.app.workspace.getActiveViewOfType(wl)&&this.settings.needVerify)return n||Qe.setLocked(!0),!0}}),this.addCommand({id:"copy-debug-info",name:N("Copy debug info"),callback:()=>{try{const n=this.app.internalPlugins.plugins["daily-notes"];let r;r={settings:{...this.settings,tokenForVerify:"***"},manifest:this.manifest,platform:C.Platform.resourcePathPrefix},n&&(r={...r,dailyNotePluginInfo:{options:n.instance.options}}),navigator.clipboard.writeText(`\`\`\`json ${JSON.stringify(r,null,2)} \`\`\``),new C.Notice(N("Debug info copied to clipboard"))}catch(n){console.error(n)}}}),this.addCommand({id:"insert-editor",name:N("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:N("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:N("Focus on thino editor"),callback:()=>this.focusOnEditor(),hotkeys:[]}),this.addCommand({id:"reinit-thino-sync",name:N("ReSync web thinos to local"),callback:()=>{HJ(this.app)}}),this.addCommand({id:"init-thino-sync",name:N("Sync local thinos to web"),callback:async()=>{var r;if(!((r=this.app)==null?void 0:r.loadLocalStorage("tokenForSync"))){new C.Notice(N("Please input token first"));return}if(!this.settings.startSync){new C.Notice(N("Please enable sync first"));return}try{await Te.initSync()}catch(a){console.error(a),new C.Notice(N("Init Failed"))}}}),this.addCommand({id:"show-daily-thino",name:N("Show daily thino"),callback:()=>this.openDailyMemo(),hotkeys:[]}),this.addCommand({id:"focus-on-search-bar",name:N("Focus on search bar"),callback:()=>this.searchIt(),hotkeys:[]}),this.addCommand({id:"show-thino-in-popover",name:N("Show-thino in popover(Hover editor)"),callback:()=>this.showInPopover(),hotkeys:[]})}async onLayoutReady(){this.initApp(),await this.initServer(),this.initGlobalManifest(),await this.initMemos(),this.autoOpenMemos(),this.registerThinoWidget(),await this.registerToolbarCheck(),await this.initCaptureService(),Xe.setPlugin(this);const n=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(new rI(this.app,this))):this.app.workspace.editorSuggest.suggests.unshift(new rI(this.app,this))}async initMemos(){try{await this.initDailyNotes()}catch(n){console.error(n)}Xe.getState(),Te.getState(),await Te.fetchAllMemos()}async initDailyNotes(){this.settings.EnabledLocationList.find(n=>n.value==="DAILY")&&await Xe.fechLocalDailyNotes()}registerCanvasNodeMemos(){if(!C.requireApiVersion("1.2.0")||!this.settings.EnabledLocationList.find(o=>o.value==="CANVAS"))return;const n=o=>{clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{setTimeout(async()=>{const s=o.canvas.getData(),c=s.nodes.find(d=>d.id===o.id);if(c&&(r(c),o.canvas.setData(s),Te.getMemoById(o.id))){const p=await Te.updateMemo(o.id,c.text,c.thinoType);Te.editMemo(p)}o.canvas.requestSave(!0)},0)},800)},r=o=>{o.createdAt||(o.createdAt=C.moment().format("YYYY-MM-DD HH:mm:ss")),o.updatedAt=C.moment().format("YYYY-MM-DD HH:mm:ss"),o.deletedAt=o.deletedAt?o.deletedAt:"",o.pinned=o.pinned?o.pinned:!1,o.visibility=o.visibility?o.visibility:"PUBLIC",o.rowStatus=o.rowStatus?o.rowStatus:"NORMAL",o.thinoType=o.thinoType?o.thinoType:"JOURNAL",o.hasId=o.hasId?o.hasId:"",o.linkId=o.linkId?o.linkId:"",o.resourceList=[]},a=()=>{var v,D;const o=(v=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:v.view;if(!o||!(o==null?void 0:o.canvas))return!1;const c=((D=this.app.workspace.getLeavesOfType("canvas").first())==null?void 0:D.view).canvas.nodes.values(),p=Array.from(c).filter(S=>S.text!==void 0);if(!p||p.length===0)return!1;const m=p[0].child;if(!m)return!1;const g=qh(m.constructor.prototype,{save:S=>function(...T){S.call(this,...T),this.node.isEditing&&n(this.node)}});return this.register(g),!0};this.app.workspace.onLayoutReady(()=>{if(!a()){const o=this.app.workspace.on("layout-change",()=>{a()&&this.app.workspace.offref(o)});this.registerEvent(o)}})}registerLinkOpen(){qh(C.Workspace.prototype,{openLinkText:n=>async function(r,a,o,s,...c){const d=Te.getState().memos;if(d.find(p=>p.id===r||p.id===a)){const p=d.find(m=>m.id===r||m.id===a);$d(p);return}n.call(this,r,a,o,s,...c)}})}registerHoverEvent(){this.registerHoverLinkSource("thino",{defaultMod:!0,display:"Thino"})}registerCodeBlocks(){this.registerMarkdownCodeBlockProcessor("thino",async(n,r)=>{var a;if(n){if(!((a=this.app.workspace.getLeavesOfType("thino_view"))!=null&&a.length)){r.toggleClass(["thino-editor-codeblock","view-error"],!0),bJ(r,this);return}if(n){const o=C.parseYaml(n);SJ(r,o)}}})}registerRibbon(){this.addRibbonIcon("Memos",N("ribbonIconTitle"),async n=>{if(n.button===2){n.preventDefault();const r=new C.Menu;$g.forEach(a=>{r.addItem(o=>{o.setTitle(a.shortName).setIcon(a.icon).onClick(async()=>{await this.openMemos(a.location,a.cb)})})}),r.showAtMouseEvent(n);return}for(let r=0;r<$g.length;r++){const a=$g[r];if(!a.modKeys){await this.openMemos(a.location,a.cb);break}if(!pX(n))continue;const o=s=>n[`${s}Key`];if(typeof a.modKeys=="string"&&o(a.modKeys)||Array.isArray(a.modKeys)&&a.modKeys.some(o)){await this.openMemos(a.location,a.cb);break}}})}registerThinoWidget(){this.registerEditorExtension([hX(this)])}async registerToolbarCheck(){var o,s;if(this.loaded)return;const n=(o=Xe.getState())==null?void 0:o.verifyState,r=!C.Platform.isDesktop&&await((s=window.Capacitor)==null?void 0:s.Plugins.Device.getId()),a=C.Platform.isDesktop?await vn():r.identifier||r.uuid;!n||(n==null?void 0:n.appId)!==a||(this.registerEditorExtension([TQ(this.app)]),this.registerEditorSuggest(new vK(this.app,this)),this.loaded=!0)}async verify(){var a;let n="";if(C.Platform.isDesktop)n=await vn();else{const o=await((a=window.Capacitor.Plugins.Device)==null?void 0:a.getId());if(!o)return;n=o.identifier||o.uuid}async function r(o){if(!o)return Xe.setVerifyState(null),!1;const d=await eX(`-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr+i4MLzI40gGFHl7gdRH UL1mH0NcWEs1/IBYDDbc9ALbvUGwDaUcVIKke+b+F4T7qISexyGd5qV0s1vNYeCk iCTq4w3+CFDurIFYAgQYTcV6K5pL8Bpb79FEclsTnAcKgiuzKBxPZ1djKxbgnmFj +PE+EcmX+JJK9hG1O8X+YFJoPJWl225eCoysONickiI7Ndwu9YLR8pIUb1VMyJSy cMR87z466Nc5Hx2QhwyuiiQYL3Ru4WkNF3AVWgqeOlhBDybFFwDaV7OOMTiYtH46 3iKx6azEVS8W/gYfrW+hKp2VziPPw3oxouP/wCes/4qRlXkwyjSwtfLtpE4Rsa4+ swIDAQAB -----END PUBLIC KEY-----`,"RS256");try{const{payload:p}=await cX(o,d),m=JSON.parse(new TextDecoder().decode(p));return!m||m.iss!=="pkmer"||m.type!=="thino"||m.appId!==n?!1:(Xe.setVerifyState(m),!0)}catch(p){console.error(p)}}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 Db(this.app,this.manifest.version).open()}autoOpenMemos(){this.app.workspace.getLeavesOfType(_r).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(_r).length>0){He.setPathname("/daily");return}await this.openMemos(),He.setPathname("/daily")}async openMemos(n="center",r){const a=this.app.workspace;if(a.getLeavesOfType(_r).length>0){const c=a.getLeavesOfType(_r)[0];a.setActiveLeaf(c),a.revealLeaf(c);return}a.detachLeavesOfType(_r);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:_r}),a.revealLeaf(o));const s=o.view.containerEl.querySelector("textarea");s&&s.focus(),r==null||r()}async searchIt(){const n=this.app.workspace,r=n.getLeavesOfType(_r);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(_r).length>0)){await this.openMemos();return}this.app.workspace.trigger("focus-on-textarea")}changeStatus(){const n=this.app.workspace,r=n.getLeavesOfType(_r);if(!(r.length>0)){new C.Notice(N("Please Open Memos First"));return}const a=r[0];n.setActiveLeaf(a),a.view.containerEl.querySelector(".list-or-task").click()}async showInPopover(){var o,s,c;const n=this.app.workspace;if(n.detachLeavesOfType(_r),!this.app.plugins.getPlugin("obsidian-hover-editor")){new C.Notice(N("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:_r}),n.revealLeaf(a),a.view.containerEl.classList.add("mobile-view"),(s=this.settings)!=null&&s.FocusOnEditor&&a.view.containerEl.querySelector("textarea")!==void 0&&((c=a.view.containerEl.querySelector("textarea"))==null||c.focus()))}}class Db extends C.Modal{constructor(n,r){super(n);me(this,"component");this.version=r}async onOpen(){const{contentEl:n}=this;this.containerEl.toggleClass("thino-changelog-modal",!0),n.createEl("h2",{text:N("Thino update info")+` version ${this.version}`});try{n.createEl("h3",{text:N("Latest version")});const r=n.createDiv("current-change-log");n.createEl("hr"),n.createEl("h3",{text:N("Previous version")});const a=n.createDiv("prev-change-log"),s=await C.requestUrl("https://raw.githubusercontent.com/Quorafind/Obsidian-Thino/main/CHANGELOG.md");this.component=new C.Component;const[c,d]=this.getLatestVersionContent(s.text);await C.MarkdownRenderer.render(this.app,c,r,"",this.component),await C.MarkdownRenderer.render(this.app,d,a,"",this.component)}catch(r){console.error(r),n.createEl("p",{text:N("Failed to load changelog")}),n.createEl("a",{text:N("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 s=n.length;a.length>1&&(s=a[1].index||n.length);const c=n.substring(o,s).trim(),d=n.substring(s).trim();return[c,d]}onClose(){var r;const{contentEl:n}=this;n.empty(),(r=this.component)==null||r.unload()}}exports.ChangeLogModal=Db;exports.default=mX;