diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
new file mode 100644
index 0000000..98a8e31
--- /dev/null
+++ b/.github/release-drafter.yml
@@ -0,0 +1,56 @@
+# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
+name-template: 'v$NEXT_PATCH_VERSION 🌈'
+tag-template: 'v$NEXT_PATCH_VERSION'
+version-template: $MAJOR.$MINOR.$PATCH
+# Emoji reference: https://gitmoji.carloscuesta.me/
+categories:
+ - title: '🚀 Features'
+ labels:
+ - 'feat'
+ - 'perf'
+ - 'kind/feature'
+ - title: '🐛 Bug Fixes'
+ labels:
+ - 'fix'
+ - 'bugfix'
+ - 'bug'
+ - 'regression'
+ - 'kind/bug'
+ - title: 📝 Documentation updates
+ labels:
+ - 'docs'
+ - 'doc'
+ - 'kind/doc'
+ - title: 👻 Maintenance
+ labels:
+ - chore
+ - dependencies
+ - 'kind/chore'
+ - 'kind/dep'
+ - 'refactor'
+ - 'style'
+ - title: 🚦 Tests
+ labels:
+ - test
+ - tests
+exclude-labels:
+ - reverted
+ - no-changelog
+ - skip-changelog
+ - invalid
+change-title-escapes: '\<*_&@' # You can add # and @ to disable mentions, and add ` to disable code blocks.
+version-resolver:
+ major:
+ labels:
+ - 'major'
+ minor:
+ labels:
+ - 'minor'
+ patch:
+ labels:
+ - 'patch'
+ default: patch
+change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
+template: |
+ ## What’s Changed
+ $CHANGES
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..c8cd7c4
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,42 @@
+# https://github.com/marketplace/actions/release-drafter
+name: Release Drafter
+
+on:
+ push:
+ # branches to consider in the event; optional, defaults to all
+ branches:
+ - master
+ # pull_request event is required only for autolabeler
+ pull_request:
+ # Only following types are handled by the action, but one can default to all as well
+ types: [opened, reopened, synchronize]
+ # pull_request_target event is required for autolabeler to support PRs from forks
+ # pull_request_target:
+ # types: [opened, reopened, synchronize]
+
+permissions:
+ contents: read
+
+jobs:
+ update_release_draft:
+ permissions:
+ # write permission is required to create a github release
+ contents: write
+ # write permission is required for autolabeler
+ # otherwise, read permission is required at least
+ pull-requests: write
+ runs-on: ubuntu-latest
+ steps:
+ # (Optional) GitHub Enterprise requires GHE_HOST variable set
+ #- name: Set GHE_HOST
+ # run: |
+ # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
+
+ # Drafts your next Release notes as Pull Requests are merged into "master"
+ - uses: release-drafter/release-drafter@v5
+ # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
+ # with:
+ # config-name: my-config.yml
+ # disable-autolabeler: true
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 904c885..77e9b0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -129,3 +129,6 @@ dmypy.json
.pyre/
.idea/
*.lock
+
+# Temporary files
+tmp
diff --git a/.obsidian/app.json b/.obsidian/app.json
deleted file mode 100644
index 0967ef4..0000000
--- a/.obsidian/app.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json
deleted file mode 100644
index 3d221c0..0000000
--- a/.obsidian/appearance.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "cssTheme": "Catppuccin"
-}
diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json
deleted file mode 100644
index 613a944..0000000
--- a/.obsidian/community-plugins.json
+++ /dev/null
@@ -1,6 +0,0 @@
-[
- "obsidian-memos",
- "obsidian-style-settings",
- "calendar",
- "cm-chs-patch"
-]
diff --git a/.obsidian/core-plugins-migration.json b/.obsidian/core-plugins-migration.json
deleted file mode 100644
index 26dca85..0000000
--- a/.obsidian/core-plugins-migration.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "file-explorer": true,
- "global-search": true,
- "switcher": true,
- "graph": true,
- "backlink": true,
- "canvas": true,
- "outgoing-link": true,
- "tag-pane": true,
- "properties": false,
- "page-preview": true,
- "daily-notes": true,
- "templates": true,
- "note-composer": true,
- "command-palette": true,
- "slash-command": false,
- "editor-status": true,
- "bookmarks": true,
- "markdown-importer": false,
- "zk-prefixer": false,
- "random-note": false,
- "outline": true,
- "word-count": true,
- "slides": false,
- "audio-recorder": false,
- "workspaces": false,
- "file-recovery": true,
- "publish": false,
- "sync": false
-}
diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json
deleted file mode 100644
index 90b8eac..0000000
--- a/.obsidian/core-plugins.json
+++ /dev/null
@@ -1,20 +0,0 @@
-[
- "file-explorer",
- "global-search",
- "switcher",
- "graph",
- "backlink",
- "canvas",
- "outgoing-link",
- "tag-pane",
- "page-preview",
- "daily-notes",
- "templates",
- "note-composer",
- "command-palette",
- "editor-status",
- "bookmarks",
- "outline",
- "word-count",
- "file-recovery"
-]
diff --git a/.obsidian/daily-notes.json b/.obsidian/daily-notes.json
deleted file mode 100644
index 325cd95..0000000
--- a/.obsidian/daily-notes.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "folder": "changelog.d",
- "template": "template/changelog_template"
-}
diff --git a/.obsidian/plugins/calendar/data.json b/.obsidian/plugins/calendar/data.json
deleted file mode 100644
index 7442165..0000000
--- a/.obsidian/plugins/calendar/data.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "shouldConfirmBeforeCreate": true,
- "weekStart": "locale",
- "wordsPerDot": 250,
- "showWeeklyNote": false,
- "weeklyNoteFormat": "",
- "weeklyNoteTemplate": "",
- "weeklyNoteFolder": "",
- "localeOverride": "system-default"
-}
diff --git a/.obsidian/plugins/calendar/main.js b/.obsidian/plugins/calendar/main.js
deleted file mode 100644
index 256a413..0000000
--- a/.obsidian/plugins/calendar/main.js
+++ /dev/null
@@ -1,4457 +0,0 @@
-'use strict';
-
-var obsidian = require('obsidian');
-
-function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
-
-var obsidian__default = /*#__PURE__*/_interopDefaultLegacy(obsidian);
-
-const DEFAULT_WEEK_FORMAT = "gggg-[W]ww";
-const DEFAULT_WORDS_PER_DOT = 250;
-const VIEW_TYPE_CALENDAR = "calendar";
-const TRIGGER_ON_OPEN = "calendar:open";
-
-const DEFAULT_DAILY_NOTE_FORMAT = "YYYY-MM-DD";
-const DEFAULT_WEEKLY_NOTE_FORMAT = "gggg-[W]ww";
-const DEFAULT_MONTHLY_NOTE_FORMAT = "YYYY-MM";
-
-function shouldUsePeriodicNotesSettings(periodicity) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const periodicNotes = window.app.plugins.getPlugin("periodic-notes");
- return periodicNotes && periodicNotes.settings?.[periodicity]?.enabled;
-}
-/**
- * Read the user settings for the `daily-notes` plugin
- * to keep behavior of creating a new note in-sync.
- */
-function getDailyNoteSettings() {
- try {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const { internalPlugins, plugins } = window.app;
- if (shouldUsePeriodicNotesSettings("daily")) {
- const { format, folder, template } = plugins.getPlugin("periodic-notes")?.settings?.daily || {};
- return {
- format: format || DEFAULT_DAILY_NOTE_FORMAT,
- folder: folder?.trim() || "",
- template: template?.trim() || "",
- };
- }
- const { folder, format, template } = internalPlugins.getPluginById("daily-notes")?.instance?.options || {};
- return {
- format: format || DEFAULT_DAILY_NOTE_FORMAT,
- folder: folder?.trim() || "",
- template: template?.trim() || "",
- };
- }
- catch (err) {
- console.info("No custom daily note settings found!", err);
- }
-}
-/**
- * Read the user settings for the `weekly-notes` plugin
- * to keep behavior of creating a new note in-sync.
- */
-function getWeeklyNoteSettings() {
- try {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const pluginManager = window.app.plugins;
- const calendarSettings = pluginManager.getPlugin("calendar")?.options;
- const periodicNotesSettings = pluginManager.getPlugin("periodic-notes")
- ?.settings?.weekly;
- if (shouldUsePeriodicNotesSettings("weekly")) {
- return {
- format: periodicNotesSettings.format || DEFAULT_WEEKLY_NOTE_FORMAT,
- folder: periodicNotesSettings.folder?.trim() || "",
- template: periodicNotesSettings.template?.trim() || "",
- };
- }
- const settings = calendarSettings || {};
- return {
- format: settings.weeklyNoteFormat || DEFAULT_WEEKLY_NOTE_FORMAT,
- folder: settings.weeklyNoteFolder?.trim() || "",
- template: settings.weeklyNoteTemplate?.trim() || "",
- };
- }
- catch (err) {
- console.info("No custom weekly note settings found!", err);
- }
-}
-/**
- * Read the user settings for the `periodic-notes` plugin
- * to keep behavior of creating a new note in-sync.
- */
-function getMonthlyNoteSettings() {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const pluginManager = window.app.plugins;
- try {
- const settings = (shouldUsePeriodicNotesSettings("monthly") &&
- pluginManager.getPlugin("periodic-notes")?.settings?.monthly) ||
- {};
- return {
- format: settings.format || DEFAULT_MONTHLY_NOTE_FORMAT,
- folder: settings.folder?.trim() || "",
- template: settings.template?.trim() || "",
- };
- }
- catch (err) {
- console.info("No custom monthly note settings found!", err);
- }
-}
-
-/**
- * dateUID is a way of weekly identifying daily/weekly/monthly notes.
- * They are prefixed with the granularity to avoid ambiguity.
- */
-function getDateUID$1(date, granularity = "day") {
- const ts = date.clone().startOf(granularity).format();
- return `${granularity}-${ts}`;
-}
-function removeEscapedCharacters(format) {
- return format.replace(/\[[^\]]*\]/g, ""); // remove everything within brackets
-}
-/**
- * XXX: When parsing dates that contain both week numbers and months,
- * Moment choses to ignore the week numbers. For the week dateUID, we
- * want the opposite behavior. Strip the MMM from the format to patch.
- */
-function isFormatAmbiguous(format, granularity) {
- if (granularity === "week") {
- const cleanFormat = removeEscapedCharacters(format);
- return (/w{1,2}/i.test(cleanFormat) &&
- (/M{1,4}/.test(cleanFormat) || /D{1,4}/.test(cleanFormat)));
- }
- return false;
-}
-function getDateFromFile(file, granularity) {
- const getSettings = {
- day: getDailyNoteSettings,
- week: getWeeklyNoteSettings,
- month: getMonthlyNoteSettings,
- };
- const format = getSettings[granularity]().format.split("/").pop();
- const noteDate = window.moment(file.basename, format, true);
- if (!noteDate.isValid()) {
- return null;
- }
- if (isFormatAmbiguous(format, granularity)) {
- if (granularity === "week") {
- const cleanFormat = removeEscapedCharacters(format);
- if (/w{1,2}/i.test(cleanFormat)) {
- return window.moment(file.basename,
- // If format contains week, remove day & month formatting
- format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), false);
- }
- }
- }
- return noteDate;
-}
-
-// Credit: @creationix/path.js
-function join(...partSegments) {
- // Split the inputs into a list of path commands.
- let parts = [];
- for (let i = 0, l = partSegments.length; i < l; i++) {
- parts = parts.concat(partSegments[i].split("/"));
- }
- // Interpret the path commands to get the new resolved path.
- const newParts = [];
- for (let i = 0, l = parts.length; i < l; i++) {
- const part = parts[i];
- // Remove leading and trailing slashes
- // Also remove "." segments
- if (!part || part === ".")
- continue;
- // Push new path segments.
- else
- newParts.push(part);
- }
- // Preserve the initial slash if there was one.
- if (parts[0] === "")
- newParts.unshift("");
- // Turn back into a single string path.
- return newParts.join("/");
-}
-async function ensureFolderExists(path) {
- const dirs = path.replace(/\\/g, "/").split("/");
- dirs.pop(); // remove basename
- if (dirs.length) {
- const dir = join(...dirs);
- if (!window.app.vault.getAbstractFileByPath(dir)) {
- await window.app.vault.createFolder(dir);
- }
- }
-}
-async function getNotePath(directory, filename) {
- if (!filename.endsWith(".md")) {
- filename += ".md";
- }
- const path = obsidian__default['default'].normalizePath(join(directory, filename));
- await ensureFolderExists(path);
- return path;
-}
-async function getTemplateInfo(template) {
- const { metadataCache, vault } = window.app;
- const templatePath = obsidian__default['default'].normalizePath(template);
- if (templatePath === "/") {
- return Promise.resolve(["", null]);
- }
- try {
- const templateFile = metadataCache.getFirstLinkpathDest(templatePath, "");
- const contents = await vault.cachedRead(templateFile);
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const IFoldInfo = window.app.foldManager.load(templateFile);
- return [contents, IFoldInfo];
- }
- catch (err) {
- console.error(`Failed to read the daily note template '${templatePath}'`, err);
- new obsidian__default['default'].Notice("Failed to read the daily note template");
- return ["", null];
- }
-}
-
-class DailyNotesFolderMissingError extends Error {
-}
-/**
- * This function mimics the behavior of the daily-notes plugin
- * so it will replace {{date}}, {{title}}, and {{time}} with the
- * formatted timestamp.
- *
- * Note: it has an added bonus that it's not 'today' specific.
- */
-async function createDailyNote(date) {
- const app = window.app;
- const { vault } = app;
- const moment = window.moment;
- const { template, format, folder } = getDailyNoteSettings();
- const [templateContents, IFoldInfo] = await getTemplateInfo(template);
- const filename = date.format(format);
- const normalizedPath = await getNotePath(folder, filename);
- try {
- const createdFile = await vault.create(normalizedPath, templateContents
- .replace(/{{\s*date\s*}}/gi, filename)
- .replace(/{{\s*time\s*}}/gi, moment().format("HH:mm"))
- .replace(/{{\s*title\s*}}/gi, filename)
- .replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
- const now = moment();
- const currentDate = date.clone().set({
- hour: now.get("hour"),
- minute: now.get("minute"),
- second: now.get("second"),
- });
- if (calc) {
- currentDate.add(parseInt(timeDelta, 10), unit);
- }
- if (momentFormat) {
- return currentDate.format(momentFormat.substring(1).trim());
- }
- return currentDate.format(format);
- })
- .replace(/{{\s*yesterday\s*}}/gi, date.clone().subtract(1, "day").format(format))
- .replace(/{{\s*tomorrow\s*}}/gi, date.clone().add(1, "d").format(format)));
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- app.foldManager.save(createdFile, IFoldInfo);
- return createdFile;
- }
- catch (err) {
- console.error(`Failed to create file: '${normalizedPath}'`, err);
- new obsidian__default['default'].Notice("Unable to create new file.");
- }
-}
-function getDailyNote(date, dailyNotes) {
- return dailyNotes[getDateUID$1(date, "day")] ?? null;
-}
-function getAllDailyNotes() {
- /**
- * Find all daily notes in the daily note folder
- */
- const { vault } = window.app;
- const { folder } = getDailyNoteSettings();
- const dailyNotesFolder = vault.getAbstractFileByPath(obsidian__default['default'].normalizePath(folder));
- if (!dailyNotesFolder) {
- throw new DailyNotesFolderMissingError("Failed to find daily notes folder");
- }
- const dailyNotes = {};
- obsidian__default['default'].Vault.recurseChildren(dailyNotesFolder, (note) => {
- if (note instanceof obsidian__default['default'].TFile) {
- const date = getDateFromFile(note, "day");
- if (date) {
- const dateString = getDateUID$1(date, "day");
- dailyNotes[dateString] = note;
- }
- }
- });
- return dailyNotes;
-}
-
-class WeeklyNotesFolderMissingError extends Error {
-}
-function getDaysOfWeek$1() {
- const { moment } = window;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- let weekStart = moment.localeData()._week.dow;
- const daysOfWeek = [
- "sunday",
- "monday",
- "tuesday",
- "wednesday",
- "thursday",
- "friday",
- "saturday",
- ];
- while (weekStart) {
- daysOfWeek.push(daysOfWeek.shift());
- weekStart--;
- }
- return daysOfWeek;
-}
-function getDayOfWeekNumericalValue(dayOfWeekName) {
- return getDaysOfWeek$1().indexOf(dayOfWeekName.toLowerCase());
-}
-async function createWeeklyNote(date) {
- const { vault } = window.app;
- const { template, format, folder } = getWeeklyNoteSettings();
- const [templateContents, IFoldInfo] = await getTemplateInfo(template);
- const filename = date.format(format);
- const normalizedPath = await getNotePath(folder, filename);
- try {
- const createdFile = await vault.create(normalizedPath, templateContents
- .replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
- const now = window.moment();
- const currentDate = date.clone().set({
- hour: now.get("hour"),
- minute: now.get("minute"),
- second: now.get("second"),
- });
- if (calc) {
- currentDate.add(parseInt(timeDelta, 10), unit);
- }
- if (momentFormat) {
- return currentDate.format(momentFormat.substring(1).trim());
- }
- return currentDate.format(format);
- })
- .replace(/{{\s*title\s*}}/gi, filename)
- .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm"))
- .replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi, (_, dayOfWeek, momentFormat) => {
- const day = getDayOfWeekNumericalValue(dayOfWeek);
- return date.weekday(day).format(momentFormat.trim());
- }));
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- window.app.foldManager.save(createdFile, IFoldInfo);
- return createdFile;
- }
- catch (err) {
- console.error(`Failed to create file: '${normalizedPath}'`, err);
- new obsidian__default['default'].Notice("Unable to create new file.");
- }
-}
-function getWeeklyNote(date, weeklyNotes) {
- return weeklyNotes[getDateUID$1(date, "week")] ?? null;
-}
-function getAllWeeklyNotes() {
- const { vault } = window.app;
- const { folder } = getWeeklyNoteSettings();
- const weeklyNotesFolder = vault.getAbstractFileByPath(obsidian__default['default'].normalizePath(folder));
- if (!weeklyNotesFolder) {
- throw new WeeklyNotesFolderMissingError("Failed to find weekly notes folder");
- }
- const weeklyNotes = {};
- obsidian__default['default'].Vault.recurseChildren(weeklyNotesFolder, (note) => {
- if (note instanceof obsidian__default['default'].TFile) {
- const date = getDateFromFile(note, "week");
- if (date) {
- const dateString = getDateUID$1(date, "week");
- weeklyNotes[dateString] = note;
- }
- }
- });
- return weeklyNotes;
-}
-
-function appHasDailyNotesPluginLoaded() {
- const { app } = window;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const dailyNotesPlugin = app.internalPlugins.plugins["daily-notes"];
- if (dailyNotesPlugin && dailyNotesPlugin.enabled) {
- return true;
- }
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const periodicNotes = app.plugins.getPlugin("periodic-notes");
- return periodicNotes && periodicNotes.settings?.daily?.enabled;
-}
-var appHasDailyNotesPluginLoaded_1 = appHasDailyNotesPluginLoaded;
-var createDailyNote_1 = createDailyNote;
-var createWeeklyNote_1 = createWeeklyNote;
-var getAllDailyNotes_1 = getAllDailyNotes;
-var getAllWeeklyNotes_1 = getAllWeeklyNotes;
-var getDailyNote_1 = getDailyNote;
-var getDailyNoteSettings_1 = getDailyNoteSettings;
-var getDateFromFile_1 = getDateFromFile;
-var getDateUID_1$1 = getDateUID$1;
-var getWeeklyNote_1 = getWeeklyNote;
-var getWeeklyNoteSettings_1 = getWeeklyNoteSettings;
-
-function noop$1() { }
-function run$1(fn) {
- return fn();
-}
-function blank_object$1() {
- return Object.create(null);
-}
-function run_all$1(fns) {
- fns.forEach(run$1);
-}
-function is_function$1(thing) {
- return typeof thing === 'function';
-}
-function safe_not_equal$1(a, b) {
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
-}
-function not_equal$1(a, b) {
- return a != a ? b == b : a !== b;
-}
-function is_empty$1(obj) {
- return Object.keys(obj).length === 0;
-}
-function subscribe(store, ...callbacks) {
- if (store == null) {
- return noop$1;
- }
- const unsub = store.subscribe(...callbacks);
- return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
-}
-function get_store_value(store) {
- let value;
- subscribe(store, _ => value = _)();
- return value;
-}
-function component_subscribe(component, store, callback) {
- component.$$.on_destroy.push(subscribe(store, callback));
-}
-function detach$1(node) {
- node.parentNode.removeChild(node);
-}
-function children$1(element) {
- return Array.from(element.childNodes);
-}
-
-let current_component$1;
-function set_current_component$1(component) {
- current_component$1 = component;
-}
-function get_current_component$1() {
- if (!current_component$1)
- throw new Error('Function called outside component initialization');
- return current_component$1;
-}
-function onDestroy(fn) {
- get_current_component$1().$$.on_destroy.push(fn);
-}
-
-const dirty_components$1 = [];
-const binding_callbacks$1 = [];
-const render_callbacks$1 = [];
-const flush_callbacks$1 = [];
-const resolved_promise$1 = Promise.resolve();
-let update_scheduled$1 = false;
-function schedule_update$1() {
- if (!update_scheduled$1) {
- update_scheduled$1 = true;
- resolved_promise$1.then(flush$1);
- }
-}
-function add_render_callback$1(fn) {
- render_callbacks$1.push(fn);
-}
-function add_flush_callback(fn) {
- flush_callbacks$1.push(fn);
-}
-let flushing$1 = false;
-const seen_callbacks$1 = new Set();
-function flush$1() {
- if (flushing$1)
- return;
- flushing$1 = true;
- do {
- // first, call beforeUpdate functions
- // and update components
- for (let i = 0; i < dirty_components$1.length; i += 1) {
- const component = dirty_components$1[i];
- set_current_component$1(component);
- update$1(component.$$);
- }
- set_current_component$1(null);
- dirty_components$1.length = 0;
- while (binding_callbacks$1.length)
- binding_callbacks$1.pop()();
- // then, once components are updated, call
- // afterUpdate functions. This may cause
- // subsequent updates...
- for (let i = 0; i < render_callbacks$1.length; i += 1) {
- const callback = render_callbacks$1[i];
- if (!seen_callbacks$1.has(callback)) {
- // ...so guard against infinite loops
- seen_callbacks$1.add(callback);
- callback();
- }
- }
- render_callbacks$1.length = 0;
- } while (dirty_components$1.length);
- while (flush_callbacks$1.length) {
- flush_callbacks$1.pop()();
- }
- update_scheduled$1 = false;
- flushing$1 = false;
- seen_callbacks$1.clear();
-}
-function update$1($$) {
- if ($$.fragment !== null) {
- $$.update();
- run_all$1($$.before_update);
- const dirty = $$.dirty;
- $$.dirty = [-1];
- $$.fragment && $$.fragment.p($$.ctx, dirty);
- $$.after_update.forEach(add_render_callback$1);
- }
-}
-const outroing$1 = new Set();
-let outros$1;
-function transition_in$1(block, local) {
- if (block && block.i) {
- outroing$1.delete(block);
- block.i(local);
- }
-}
-function transition_out$1(block, local, detach, callback) {
- if (block && block.o) {
- if (outroing$1.has(block))
- return;
- outroing$1.add(block);
- outros$1.c.push(() => {
- outroing$1.delete(block);
- if (callback) {
- if (detach)
- block.d(1);
- callback();
- }
- });
- block.o(local);
- }
-}
-
-function bind(component, name, callback) {
- const index = component.$$.props[name];
- if (index !== undefined) {
- component.$$.bound[index] = callback;
- callback(component.$$.ctx[index]);
- }
-}
-function create_component$1(block) {
- block && block.c();
-}
-function mount_component$1(component, target, anchor, customElement) {
- const { fragment, on_mount, on_destroy, after_update } = component.$$;
- fragment && fragment.m(target, anchor);
- if (!customElement) {
- // onMount happens before the initial afterUpdate
- add_render_callback$1(() => {
- const new_on_destroy = on_mount.map(run$1).filter(is_function$1);
- if (on_destroy) {
- on_destroy.push(...new_on_destroy);
- }
- else {
- // Edge case - component was destroyed immediately,
- // most likely as a result of a binding initialising
- run_all$1(new_on_destroy);
- }
- component.$$.on_mount = [];
- });
- }
- after_update.forEach(add_render_callback$1);
-}
-function destroy_component$1(component, detaching) {
- const $$ = component.$$;
- if ($$.fragment !== null) {
- run_all$1($$.on_destroy);
- $$.fragment && $$.fragment.d(detaching);
- // TODO null out other refs, including component.$$ (but need to
- // preserve final state?)
- $$.on_destroy = $$.fragment = null;
- $$.ctx = [];
- }
-}
-function make_dirty$1(component, i) {
- if (component.$$.dirty[0] === -1) {
- dirty_components$1.push(component);
- schedule_update$1();
- component.$$.dirty.fill(0);
- }
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
-}
-function init$1(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {
- const parent_component = current_component$1;
- set_current_component$1(component);
- const $$ = component.$$ = {
- fragment: null,
- ctx: null,
- // state
- props,
- update: noop$1,
- not_equal,
- bound: blank_object$1(),
- // lifecycle
- on_mount: [],
- on_destroy: [],
- on_disconnect: [],
- before_update: [],
- after_update: [],
- context: new Map(parent_component ? parent_component.$$.context : []),
- // everything else
- callbacks: blank_object$1(),
- dirty,
- skip_bound: false
- };
- let ready = false;
- $$.ctx = instance
- ? instance(component, options.props || {}, (i, ret, ...rest) => {
- const value = rest.length ? rest[0] : ret;
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
- if (!$$.skip_bound && $$.bound[i])
- $$.bound[i](value);
- if (ready)
- make_dirty$1(component, i);
- }
- return ret;
- })
- : [];
- $$.update();
- ready = true;
- run_all$1($$.before_update);
- // `false` as a special case of no DOM component
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
- if (options.target) {
- if (options.hydrate) {
- const nodes = children$1(options.target);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.l(nodes);
- nodes.forEach(detach$1);
- }
- else {
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.c();
- }
- if (options.intro)
- transition_in$1(component.$$.fragment);
- mount_component$1(component, options.target, options.anchor, options.customElement);
- flush$1();
- }
- set_current_component$1(parent_component);
-}
-/**
- * Base class for Svelte components. Used when dev=false.
- */
-class SvelteComponent$1 {
- $destroy() {
- destroy_component$1(this, 1);
- this.$destroy = noop$1;
- }
- $on(type, callback) {
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
- callbacks.push(callback);
- return () => {
- const index = callbacks.indexOf(callback);
- if (index !== -1)
- callbacks.splice(index, 1);
- };
- }
- $set($$props) {
- if (this.$$set && !is_empty$1($$props)) {
- this.$$.skip_bound = true;
- this.$$set($$props);
- this.$$.skip_bound = false;
- }
- }
-}
-
-const subscriber_queue = [];
-/**
- * Create a `Writable` store that allows both updating and reading by subscription.
- * @param {*=}value initial value
- * @param {StartStopNotifier=}start start and stop notifications for subscriptions
- */
-function writable(value, start = noop$1) {
- let stop;
- const subscribers = [];
- function set(new_value) {
- if (safe_not_equal$1(value, new_value)) {
- value = new_value;
- if (stop) { // store is ready
- const run_queue = !subscriber_queue.length;
- for (let i = 0; i < subscribers.length; i += 1) {
- const s = subscribers[i];
- s[1]();
- subscriber_queue.push(s, value);
- }
- if (run_queue) {
- for (let i = 0; i < subscriber_queue.length; i += 2) {
- subscriber_queue[i][0](subscriber_queue[i + 1]);
- }
- subscriber_queue.length = 0;
- }
- }
- }
- }
- function update(fn) {
- set(fn(value));
- }
- function subscribe(run, invalidate = noop$1) {
- const subscriber = [run, invalidate];
- subscribers.push(subscriber);
- if (subscribers.length === 1) {
- stop = start(set) || noop$1;
- }
- run(value);
- return () => {
- const index = subscribers.indexOf(subscriber);
- if (index !== -1) {
- subscribers.splice(index, 1);
- }
- if (subscribers.length === 0) {
- stop();
- stop = null;
- }
- };
- }
- return { set, update, subscribe };
-}
-
-const weekdays$1 = [
- "sunday",
- "monday",
- "tuesday",
- "wednesday",
- "thursday",
- "friday",
- "saturday",
-];
-const defaultSettings = Object.freeze({
- shouldConfirmBeforeCreate: true,
- weekStart: "locale",
- wordsPerDot: DEFAULT_WORDS_PER_DOT,
- showWeeklyNote: false,
- weeklyNoteFormat: "",
- weeklyNoteTemplate: "",
- weeklyNoteFolder: "",
- localeOverride: "system-default",
-});
-function appHasPeriodicNotesPluginLoaded() {
- var _a, _b;
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const periodicNotes = window.app.plugins.getPlugin("periodic-notes");
- return periodicNotes && ((_b = (_a = periodicNotes.settings) === null || _a === void 0 ? void 0 : _a.weekly) === null || _b === void 0 ? void 0 : _b.enabled);
-}
-class CalendarSettingsTab extends obsidian.PluginSettingTab {
- constructor(app, plugin) {
- super(app, plugin);
- this.plugin = plugin;
- }
- display() {
- this.containerEl.empty();
- if (!appHasDailyNotesPluginLoaded_1()) {
- this.containerEl.createDiv("settings-banner", (banner) => {
- banner.createEl("h3", {
- text: "⚠️ Daily Notes plugin not enabled",
- });
- banner.createEl("p", {
- cls: "setting-item-description",
- text: "The calendar is best used in conjunction with either the Daily Notes plugin or the Periodic Notes plugin (available in the Community Plugins catalog).",
- });
- });
- }
- this.containerEl.createEl("h3", {
- text: "General Settings",
- });
- this.addDotThresholdSetting();
- this.addWeekStartSetting();
- this.addConfirmCreateSetting();
- this.addShowWeeklyNoteSetting();
- if (this.plugin.options.showWeeklyNote &&
- !appHasPeriodicNotesPluginLoaded()) {
- this.containerEl.createEl("h3", {
- text: "Weekly Note Settings",
- });
- this.containerEl.createEl("p", {
- cls: "setting-item-description",
- text: "Note: Weekly Note settings are moving. You are encouraged to install the 'Periodic Notes' plugin to keep the functionality in the future.",
- });
- this.addWeeklyNoteFormatSetting();
- this.addWeeklyNoteTemplateSetting();
- this.addWeeklyNoteFolderSetting();
- }
- this.containerEl.createEl("h3", {
- text: "Advanced Settings",
- });
- this.addLocaleOverrideSetting();
- }
- addDotThresholdSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Words per dot")
- .setDesc("How many words should be represented by a single dot?")
- .addText((textfield) => {
- textfield.setPlaceholder(String(DEFAULT_WORDS_PER_DOT));
- textfield.inputEl.type = "number";
- textfield.setValue(String(this.plugin.options.wordsPerDot));
- textfield.onChange(async (value) => {
- this.plugin.writeOptions(() => ({
- wordsPerDot: value !== "" ? Number(value) : undefined,
- }));
- });
- });
- }
- addWeekStartSetting() {
- const { moment } = window;
- const localizedWeekdays = moment.weekdays();
- const localeWeekStartNum = window._bundledLocaleWeekSpec.dow;
- const localeWeekStart = moment.weekdays()[localeWeekStartNum];
- new obsidian.Setting(this.containerEl)
- .setName("Start week on:")
- .setDesc("Choose what day of the week to start. Select 'Locale default' to use the default specified by moment.js")
- .addDropdown((dropdown) => {
- dropdown.addOption("locale", `Locale default (${localeWeekStart})`);
- localizedWeekdays.forEach((day, i) => {
- dropdown.addOption(weekdays$1[i], day);
- });
- dropdown.setValue(this.plugin.options.weekStart);
- dropdown.onChange(async (value) => {
- this.plugin.writeOptions(() => ({
- weekStart: value,
- }));
- });
- });
- }
- addConfirmCreateSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Confirm before creating new note")
- .setDesc("Show a confirmation modal before creating a new note")
- .addToggle((toggle) => {
- toggle.setValue(this.plugin.options.shouldConfirmBeforeCreate);
- toggle.onChange(async (value) => {
- this.plugin.writeOptions(() => ({
- shouldConfirmBeforeCreate: value,
- }));
- });
- });
- }
- addShowWeeklyNoteSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Show week number")
- .setDesc("Enable this to add a column with the week number")
- .addToggle((toggle) => {
- toggle.setValue(this.plugin.options.showWeeklyNote);
- toggle.onChange(async (value) => {
- this.plugin.writeOptions(() => ({ showWeeklyNote: value }));
- this.display(); // show/hide weekly settings
- });
- });
- }
- addWeeklyNoteFormatSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Weekly note format")
- .setDesc("For more syntax help, refer to format reference")
- .addText((textfield) => {
- textfield.setValue(this.plugin.options.weeklyNoteFormat);
- textfield.setPlaceholder(DEFAULT_WEEK_FORMAT);
- textfield.onChange(async (value) => {
- this.plugin.writeOptions(() => ({ weeklyNoteFormat: value }));
- });
- });
- }
- addWeeklyNoteTemplateSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Weekly note template")
- .setDesc("Choose the file you want to use as the template for your weekly notes")
- .addText((textfield) => {
- textfield.setValue(this.plugin.options.weeklyNoteTemplate);
- textfield.onChange(async (value) => {
- this.plugin.writeOptions(() => ({ weeklyNoteTemplate: value }));
- });
- });
- }
- addWeeklyNoteFolderSetting() {
- new obsidian.Setting(this.containerEl)
- .setName("Weekly note folder")
- .setDesc("New weekly notes will be placed here")
- .addText((textfield) => {
- textfield.setValue(this.plugin.options.weeklyNoteFolder);
- textfield.onChange(async (value) => {
- this.plugin.writeOptions(() => ({ weeklyNoteFolder: value }));
- });
- });
- }
- addLocaleOverrideSetting() {
- var _a;
- const { moment } = window;
- const sysLocale = (_a = navigator.language) === null || _a === void 0 ? void 0 : _a.toLowerCase();
- new obsidian.Setting(this.containerEl)
- .setName("Override locale:")
- .setDesc("Set this if you want to use a locale different from the default")
- .addDropdown((dropdown) => {
- dropdown.addOption("system-default", `Same as system (${sysLocale})`);
- moment.locales().forEach((locale) => {
- dropdown.addOption(locale, locale);
- });
- dropdown.setValue(this.plugin.options.localeOverride);
- dropdown.onChange(async (value) => {
- this.plugin.writeOptions(() => ({
- localeOverride: value,
- }));
- });
- });
- }
-}
-
-const classList = (obj) => {
- return Object.entries(obj)
- .filter(([_k, v]) => !!v)
- .map(([k, _k]) => k);
-};
-function clamp(num, lowerBound, upperBound) {
- return Math.min(Math.max(lowerBound, num), upperBound);
-}
-function partition(arr, predicate) {
- const pass = [];
- const fail = [];
- arr.forEach((elem) => {
- if (predicate(elem)) {
- pass.push(elem);
- }
- else {
- fail.push(elem);
- }
- });
- return [pass, fail];
-}
-/**
- * Lookup the dateUID for a given file. It compares the filename
- * to the daily and weekly note formats to find a match.
- *
- * @param file
- */
-function getDateUIDFromFile(file) {
- if (!file) {
- return null;
- }
- // TODO: I'm not checking the path!
- let date = getDateFromFile_1(file, "day");
- if (date) {
- return getDateUID_1$1(date, "day");
- }
- date = getDateFromFile_1(file, "week");
- if (date) {
- return getDateUID_1$1(date, "week");
- }
- return null;
-}
-function getWordCount(text) {
- const spaceDelimitedChars = /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;
- const nonSpaceDelimitedWords = /\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/
- .source;
- const pattern = new RegExp([
- `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}])+`,
- nonSpaceDelimitedWords,
- ].join("|"), "g");
- return (text.match(pattern) || []).length;
-}
-
-function createDailyNotesStore() {
- let hasError = false;
- const store = writable(null);
- return Object.assign({ reindex: () => {
- try {
- const dailyNotes = getAllDailyNotes_1();
- store.set(dailyNotes);
- hasError = false;
- }
- catch (err) {
- if (!hasError) {
- // Avoid error being shown multiple times
- console.log("[Calendar] Failed to find daily notes folder", err);
- }
- store.set({});
- hasError = true;
- }
- } }, store);
-}
-function createWeeklyNotesStore() {
- let hasError = false;
- const store = writable(null);
- return Object.assign({ reindex: () => {
- try {
- const weeklyNotes = getAllWeeklyNotes_1();
- store.set(weeklyNotes);
- hasError = false;
- }
- catch (err) {
- if (!hasError) {
- // Avoid error being shown multiple times
- console.log("[Calendar] Failed to find weekly notes folder", err);
- }
- store.set({});
- hasError = true;
- }
- } }, store);
-}
-const settings = writable(defaultSettings);
-const dailyNotes = createDailyNotesStore();
-const weeklyNotes = createWeeklyNotesStore();
-function createSelectedFileStore() {
- const store = writable(null);
- return Object.assign({ setFile: (file) => {
- const id = getDateUIDFromFile(file);
- store.set(id);
- } }, store);
-}
-const activeFile = createSelectedFileStore();
-
-class ConfirmationModal extends obsidian.Modal {
- constructor(app, config) {
- super(app);
- const { cta, onAccept, text, title } = config;
- this.contentEl.createEl("h2", { text: title });
- this.contentEl.createEl("p", { text });
- this.contentEl.createDiv("modal-button-container", (buttonsEl) => {
- buttonsEl
- .createEl("button", { text: "Never mind" })
- .addEventListener("click", () => this.close());
- buttonsEl
- .createEl("button", {
- cls: "mod-cta",
- text: cta,
- })
- .addEventListener("click", async (e) => {
- await onAccept(e);
- this.close();
- });
- });
- }
-}
-function createConfirmationDialog({ cta, onAccept, text, title, }) {
- new ConfirmationModal(window.app, { cta, onAccept, text, title }).open();
-}
-
-/**
- * Create a Daily Note for a given date.
- */
-async function tryToCreateDailyNote(date, inNewSplit, settings, cb) {
- const { workspace } = window.app;
- const { format } = getDailyNoteSettings_1();
- const filename = date.format(format);
- const createFile = async () => {
- const dailyNote = await createDailyNote_1(date);
- const leaf = inNewSplit
- ? workspace.splitActiveLeaf()
- : workspace.getUnpinnedLeaf();
- await leaf.openFile(dailyNote);
- cb === null || cb === void 0 ? void 0 : cb(dailyNote);
- };
- if (settings.shouldConfirmBeforeCreate) {
- createConfirmationDialog({
- cta: "Create",
- onAccept: createFile,
- text: `File ${filename} does not exist. Would you like to create it?`,
- title: "New Daily Note",
- });
- }
- else {
- await createFile();
- }
-}
-
-/**
- * Create a Weekly Note for a given date.
- */
-async function tryToCreateWeeklyNote(date, inNewSplit, settings, cb) {
- const { workspace } = window.app;
- const { format } = getWeeklyNoteSettings_1();
- const filename = date.format(format);
- const createFile = async () => {
- const dailyNote = await createWeeklyNote_1(date);
- const leaf = inNewSplit
- ? workspace.splitActiveLeaf()
- : workspace.getUnpinnedLeaf();
- await leaf.openFile(dailyNote);
- cb === null || cb === void 0 ? void 0 : cb(dailyNote);
- };
- if (settings.shouldConfirmBeforeCreate) {
- createConfirmationDialog({
- cta: "Create",
- onAccept: createFile,
- text: `File ${filename} does not exist. Would you like to create it?`,
- title: "New Weekly Note",
- });
- }
- else {
- await createFile();
- }
-}
-
-function noop() { }
-function assign(tar, src) {
- // @ts-ignore
- for (const k in src)
- tar[k] = src[k];
- return tar;
-}
-function is_promise(value) {
- return value && typeof value === 'object' && typeof value.then === 'function';
-}
-function run(fn) {
- return fn();
-}
-function blank_object() {
- return Object.create(null);
-}
-function run_all(fns) {
- fns.forEach(run);
-}
-function is_function(thing) {
- return typeof thing === 'function';
-}
-function safe_not_equal(a, b) {
- return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
-}
-function not_equal(a, b) {
- return a != a ? b == b : a !== b;
-}
-function is_empty(obj) {
- return Object.keys(obj).length === 0;
-}
-function create_slot(definition, ctx, $$scope, fn) {
- if (definition) {
- const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
- return definition[0](slot_ctx);
- }
-}
-function get_slot_context(definition, ctx, $$scope, fn) {
- return definition[1] && fn
- ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
- : $$scope.ctx;
-}
-function get_slot_changes(definition, $$scope, dirty, fn) {
- if (definition[2] && fn) {
- const lets = definition[2](fn(dirty));
- if ($$scope.dirty === undefined) {
- return lets;
- }
- if (typeof lets === 'object') {
- const merged = [];
- const len = Math.max($$scope.dirty.length, lets.length);
- for (let i = 0; i < len; i += 1) {
- merged[i] = $$scope.dirty[i] | lets[i];
- }
- return merged;
- }
- return $$scope.dirty | lets;
- }
- return $$scope.dirty;
-}
-function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {
- const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);
- if (slot_changes) {
- const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
- slot.p(slot_context, slot_changes);
- }
-}
-function null_to_empty(value) {
- return value == null ? '' : value;
-}
-
-function append(target, node) {
- target.appendChild(node);
-}
-function insert(target, node, anchor) {
- target.insertBefore(node, anchor || null);
-}
-function detach(node) {
- node.parentNode.removeChild(node);
-}
-function destroy_each(iterations, detaching) {
- for (let i = 0; i < iterations.length; i += 1) {
- if (iterations[i])
- iterations[i].d(detaching);
- }
-}
-function element(name) {
- return document.createElement(name);
-}
-function svg_element(name) {
- return document.createElementNS('http://www.w3.org/2000/svg', name);
-}
-function text(data) {
- return document.createTextNode(data);
-}
-function space() {
- return text(' ');
-}
-function empty() {
- return text('');
-}
-function listen(node, event, handler, options) {
- node.addEventListener(event, handler, options);
- return () => node.removeEventListener(event, handler, options);
-}
-function attr(node, attribute, value) {
- if (value == null)
- node.removeAttribute(attribute);
- else if (node.getAttribute(attribute) !== value)
- node.setAttribute(attribute, value);
-}
-function set_attributes(node, attributes) {
- // @ts-ignore
- const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
- for (const key in attributes) {
- if (attributes[key] == null) {
- node.removeAttribute(key);
- }
- else if (key === 'style') {
- node.style.cssText = attributes[key];
- }
- else if (key === '__value') {
- node.value = node[key] = attributes[key];
- }
- else if (descriptors[key] && descriptors[key].set) {
- node[key] = attributes[key];
- }
- else {
- attr(node, key, attributes[key]);
- }
- }
-}
-function children(element) {
- return Array.from(element.childNodes);
-}
-function set_data(text, data) {
- data = '' + data;
- if (text.wholeText !== data)
- text.data = data;
-}
-function toggle_class(element, name, toggle) {
- element.classList[toggle ? 'add' : 'remove'](name);
-}
-
-let current_component;
-function set_current_component(component) {
- current_component = component;
-}
-function get_current_component() {
- if (!current_component)
- throw new Error('Function called outside component initialization');
- return current_component;
-}
-
-const dirty_components = [];
-const binding_callbacks = [];
-const render_callbacks = [];
-const flush_callbacks = [];
-const resolved_promise = Promise.resolve();
-let update_scheduled = false;
-function schedule_update() {
- if (!update_scheduled) {
- update_scheduled = true;
- resolved_promise.then(flush);
- }
-}
-function add_render_callback(fn) {
- render_callbacks.push(fn);
-}
-let flushing = false;
-const seen_callbacks = new Set();
-function flush() {
- if (flushing)
- return;
- flushing = true;
- do {
- // first, call beforeUpdate functions
- // and update components
- for (let i = 0; i < dirty_components.length; i += 1) {
- const component = dirty_components[i];
- set_current_component(component);
- update(component.$$);
- }
- set_current_component(null);
- dirty_components.length = 0;
- while (binding_callbacks.length)
- binding_callbacks.pop()();
- // then, once components are updated, call
- // afterUpdate functions. This may cause
- // subsequent updates...
- for (let i = 0; i < render_callbacks.length; i += 1) {
- const callback = render_callbacks[i];
- if (!seen_callbacks.has(callback)) {
- // ...so guard against infinite loops
- seen_callbacks.add(callback);
- callback();
- }
- }
- render_callbacks.length = 0;
- } while (dirty_components.length);
- while (flush_callbacks.length) {
- flush_callbacks.pop()();
- }
- update_scheduled = false;
- flushing = false;
- seen_callbacks.clear();
-}
-function update($$) {
- if ($$.fragment !== null) {
- $$.update();
- run_all($$.before_update);
- const dirty = $$.dirty;
- $$.dirty = [-1];
- $$.fragment && $$.fragment.p($$.ctx, dirty);
- $$.after_update.forEach(add_render_callback);
- }
-}
-const outroing = new Set();
-let outros;
-function group_outros() {
- outros = {
- r: 0,
- c: [],
- p: outros // parent group
- };
-}
-function check_outros() {
- if (!outros.r) {
- run_all(outros.c);
- }
- outros = outros.p;
-}
-function transition_in(block, local) {
- if (block && block.i) {
- outroing.delete(block);
- block.i(local);
- }
-}
-function transition_out(block, local, detach, callback) {
- if (block && block.o) {
- if (outroing.has(block))
- return;
- outroing.add(block);
- outros.c.push(() => {
- outroing.delete(block);
- if (callback) {
- if (detach)
- block.d(1);
- callback();
- }
- });
- block.o(local);
- }
-}
-
-function handle_promise(promise, info) {
- const token = info.token = {};
- function update(type, index, key, value) {
- if (info.token !== token)
- return;
- info.resolved = value;
- let child_ctx = info.ctx;
- if (key !== undefined) {
- child_ctx = child_ctx.slice();
- child_ctx[key] = value;
- }
- const block = type && (info.current = type)(child_ctx);
- let needs_flush = false;
- if (info.block) {
- if (info.blocks) {
- info.blocks.forEach((block, i) => {
- if (i !== index && block) {
- group_outros();
- transition_out(block, 1, 1, () => {
- if (info.blocks[i] === block) {
- info.blocks[i] = null;
- }
- });
- check_outros();
- }
- });
- }
- else {
- info.block.d(1);
- }
- block.c();
- transition_in(block, 1);
- block.m(info.mount(), info.anchor);
- needs_flush = true;
- }
- info.block = block;
- if (info.blocks)
- info.blocks[index] = block;
- if (needs_flush) {
- flush();
- }
- }
- if (is_promise(promise)) {
- const current_component = get_current_component();
- promise.then(value => {
- set_current_component(current_component);
- update(info.then, 1, info.value, value);
- set_current_component(null);
- }, error => {
- set_current_component(current_component);
- update(info.catch, 2, info.error, error);
- set_current_component(null);
- if (!info.hasCatch) {
- throw error;
- }
- });
- // if we previously had a then/catch block, destroy it
- if (info.current !== info.pending) {
- update(info.pending, 0);
- return true;
- }
- }
- else {
- if (info.current !== info.then) {
- update(info.then, 1, info.value, promise);
- return true;
- }
- info.resolved = promise;
- }
-}
-function outro_and_destroy_block(block, lookup) {
- transition_out(block, 1, 1, () => {
- lookup.delete(block.key);
- });
-}
-function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {
- let o = old_blocks.length;
- let n = list.length;
- let i = o;
- const old_indexes = {};
- while (i--)
- old_indexes[old_blocks[i].key] = i;
- const new_blocks = [];
- const new_lookup = new Map();
- const deltas = new Map();
- i = n;
- while (i--) {
- const child_ctx = get_context(ctx, list, i);
- const key = get_key(child_ctx);
- let block = lookup.get(key);
- if (!block) {
- block = create_each_block(key, child_ctx);
- block.c();
- }
- else if (dynamic) {
- block.p(child_ctx, dirty);
- }
- new_lookup.set(key, new_blocks[i] = block);
- if (key in old_indexes)
- deltas.set(key, Math.abs(i - old_indexes[key]));
- }
- const will_move = new Set();
- const did_move = new Set();
- function insert(block) {
- transition_in(block, 1);
- block.m(node, next);
- lookup.set(block.key, block);
- next = block.first;
- n--;
- }
- while (o && n) {
- const new_block = new_blocks[n - 1];
- const old_block = old_blocks[o - 1];
- const new_key = new_block.key;
- const old_key = old_block.key;
- if (new_block === old_block) {
- // do nothing
- next = new_block.first;
- o--;
- n--;
- }
- else if (!new_lookup.has(old_key)) {
- // remove old block
- destroy(old_block, lookup);
- o--;
- }
- else if (!lookup.has(new_key) || will_move.has(new_key)) {
- insert(new_block);
- }
- else if (did_move.has(old_key)) {
- o--;
- }
- else if (deltas.get(new_key) > deltas.get(old_key)) {
- did_move.add(new_key);
- insert(new_block);
- }
- else {
- will_move.add(old_key);
- o--;
- }
- }
- while (o--) {
- const old_block = old_blocks[o];
- if (!new_lookup.has(old_block.key))
- destroy(old_block, lookup);
- }
- while (n)
- insert(new_blocks[n - 1]);
- return new_blocks;
-}
-
-function get_spread_update(levels, updates) {
- const update = {};
- const to_null_out = {};
- const accounted_for = { $$scope: 1 };
- let i = levels.length;
- while (i--) {
- const o = levels[i];
- const n = updates[i];
- if (n) {
- for (const key in o) {
- if (!(key in n))
- to_null_out[key] = 1;
- }
- for (const key in n) {
- if (!accounted_for[key]) {
- update[key] = n[key];
- accounted_for[key] = 1;
- }
- }
- levels[i] = n;
- }
- else {
- for (const key in o) {
- accounted_for[key] = 1;
- }
- }
- }
- for (const key in to_null_out) {
- if (!(key in update))
- update[key] = undefined;
- }
- return update;
-}
-function get_spread_object(spread_props) {
- return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};
-}
-function create_component(block) {
- block && block.c();
-}
-function mount_component(component, target, anchor, customElement) {
- const { fragment, on_mount, on_destroy, after_update } = component.$$;
- fragment && fragment.m(target, anchor);
- if (!customElement) {
- // onMount happens before the initial afterUpdate
- add_render_callback(() => {
- const new_on_destroy = on_mount.map(run).filter(is_function);
- if (on_destroy) {
- on_destroy.push(...new_on_destroy);
- }
- else {
- // Edge case - component was destroyed immediately,
- // most likely as a result of a binding initialising
- run_all(new_on_destroy);
- }
- component.$$.on_mount = [];
- });
- }
- after_update.forEach(add_render_callback);
-}
-function destroy_component(component, detaching) {
- const $$ = component.$$;
- if ($$.fragment !== null) {
- run_all($$.on_destroy);
- $$.fragment && $$.fragment.d(detaching);
- // TODO null out other refs, including component.$$ (but need to
- // preserve final state?)
- $$.on_destroy = $$.fragment = null;
- $$.ctx = [];
- }
-}
-function make_dirty(component, i) {
- if (component.$$.dirty[0] === -1) {
- dirty_components.push(component);
- schedule_update();
- component.$$.dirty.fill(0);
- }
- component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
-}
-function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {
- const parent_component = current_component;
- set_current_component(component);
- const $$ = component.$$ = {
- fragment: null,
- ctx: null,
- // state
- props,
- update: noop,
- not_equal,
- bound: blank_object(),
- // lifecycle
- on_mount: [],
- on_destroy: [],
- on_disconnect: [],
- before_update: [],
- after_update: [],
- context: new Map(parent_component ? parent_component.$$.context : []),
- // everything else
- callbacks: blank_object(),
- dirty,
- skip_bound: false
- };
- let ready = false;
- $$.ctx = instance
- ? instance(component, options.props || {}, (i, ret, ...rest) => {
- const value = rest.length ? rest[0] : ret;
- if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
- if (!$$.skip_bound && $$.bound[i])
- $$.bound[i](value);
- if (ready)
- make_dirty(component, i);
- }
- return ret;
- })
- : [];
- $$.update();
- ready = true;
- run_all($$.before_update);
- // `false` as a special case of no DOM component
- $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
- if (options.target) {
- if (options.hydrate) {
- const nodes = children(options.target);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.l(nodes);
- nodes.forEach(detach);
- }
- else {
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- $$.fragment && $$.fragment.c();
- }
- if (options.intro)
- transition_in(component.$$.fragment);
- mount_component(component, options.target, options.anchor, options.customElement);
- flush();
- }
- set_current_component(parent_component);
-}
-/**
- * Base class for Svelte components. Used when dev=false.
- */
-class SvelteComponent {
- $destroy() {
- destroy_component(this, 1);
- this.$destroy = noop;
- }
- $on(type, callback) {
- const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
- callbacks.push(callback);
- return () => {
- const index = callbacks.indexOf(callback);
- if (index !== -1)
- callbacks.splice(index, 1);
- };
- }
- $set($$props) {
- if (this.$$set && !is_empty($$props)) {
- this.$$.skip_bound = true;
- this.$$set($$props);
- this.$$.skip_bound = false;
- }
- }
-}
-
-/**
- * dateUID is a way of weekly identifying daily/weekly/monthly notes.
- * They are prefixed with the granularity to avoid ambiguity.
- */
-function getDateUID(date, granularity = "day") {
- const ts = date.clone().startOf(granularity).format();
- return `${granularity}-${ts}`;
-}
-var getDateUID_1 = getDateUID;
-
-/* src/components/Dot.svelte generated by Svelte v3.35.0 */
-
-function add_css$5() {
- var style = element("style");
- style.id = "svelte-1widvzq-style";
- style.textContent = ".dot.svelte-1widvzq,.hollow.svelte-1widvzq{display:inline-block;height:6px;width:6px;margin:0 1px}.filled.svelte-1widvzq{fill:var(--color-dot)}.active.filled.svelte-1widvzq{fill:var(--text-on-accent)}.hollow.svelte-1widvzq{fill:none;stroke:var(--color-dot)}.active.hollow.svelte-1widvzq{fill:none;stroke:var(--text-on-accent)}";
- append(document.head, style);
-}
-
-// (14:0) {:else}
-function create_else_block$1(ctx) {
- let svg;
- let circle;
- let svg_class_value;
-
- return {
- c() {
- svg = svg_element("svg");
- circle = svg_element("circle");
- attr(circle, "cx", "3");
- attr(circle, "cy", "3");
- attr(circle, "r", "2");
- attr(svg, "class", svg_class_value = "" + (null_to_empty(`hollow ${/*className*/ ctx[0]}`) + " svelte-1widvzq"));
- attr(svg, "viewBox", "0 0 6 6");
- attr(svg, "xmlns", "http://www.w3.org/2000/svg");
- toggle_class(svg, "active", /*isActive*/ ctx[2]);
- },
- m(target, anchor) {
- insert(target, svg, anchor);
- append(svg, circle);
- },
- p(ctx, dirty) {
- if (dirty & /*className*/ 1 && svg_class_value !== (svg_class_value = "" + (null_to_empty(`hollow ${/*className*/ ctx[0]}`) + " svelte-1widvzq"))) {
- attr(svg, "class", svg_class_value);
- }
-
- if (dirty & /*className, isActive*/ 5) {
- toggle_class(svg, "active", /*isActive*/ ctx[2]);
- }
- },
- d(detaching) {
- if (detaching) detach(svg);
- }
- };
-}
-
-// (6:0) {#if isFilled}
-function create_if_block$2(ctx) {
- let svg;
- let circle;
- let svg_class_value;
-
- return {
- c() {
- svg = svg_element("svg");
- circle = svg_element("circle");
- attr(circle, "cx", "3");
- attr(circle, "cy", "3");
- attr(circle, "r", "2");
- attr(svg, "class", svg_class_value = "" + (null_to_empty(`dot filled ${/*className*/ ctx[0]}`) + " svelte-1widvzq"));
- attr(svg, "viewBox", "0 0 6 6");
- attr(svg, "xmlns", "http://www.w3.org/2000/svg");
- toggle_class(svg, "active", /*isActive*/ ctx[2]);
- },
- m(target, anchor) {
- insert(target, svg, anchor);
- append(svg, circle);
- },
- p(ctx, dirty) {
- if (dirty & /*className*/ 1 && svg_class_value !== (svg_class_value = "" + (null_to_empty(`dot filled ${/*className*/ ctx[0]}`) + " svelte-1widvzq"))) {
- attr(svg, "class", svg_class_value);
- }
-
- if (dirty & /*className, isActive*/ 5) {
- toggle_class(svg, "active", /*isActive*/ ctx[2]);
- }
- },
- d(detaching) {
- if (detaching) detach(svg);
- }
- };
-}
-
-function create_fragment$6(ctx) {
- let if_block_anchor;
-
- function select_block_type(ctx, dirty) {
- if (/*isFilled*/ ctx[1]) return create_if_block$2;
- return create_else_block$1;
- }
-
- let current_block_type = select_block_type(ctx);
- let if_block = current_block_type(ctx);
-
- return {
- c() {
- if_block.c();
- if_block_anchor = empty();
- },
- m(target, anchor) {
- if_block.m(target, anchor);
- insert(target, if_block_anchor, anchor);
- },
- p(ctx, [dirty]) {
- if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
- if_block.p(ctx, dirty);
- } else {
- if_block.d(1);
- if_block = current_block_type(ctx);
-
- if (if_block) {
- if_block.c();
- if_block.m(if_block_anchor.parentNode, if_block_anchor);
- }
- }
- },
- i: noop,
- o: noop,
- d(detaching) {
- if_block.d(detaching);
- if (detaching) detach(if_block_anchor);
- }
- };
-}
-
-function instance$6($$self, $$props, $$invalidate) {
- let { className = "" } = $$props;
- let { isFilled } = $$props;
- let { isActive } = $$props;
-
- $$self.$$set = $$props => {
- if ("className" in $$props) $$invalidate(0, className = $$props.className);
- if ("isFilled" in $$props) $$invalidate(1, isFilled = $$props.isFilled);
- if ("isActive" in $$props) $$invalidate(2, isActive = $$props.isActive);
- };
-
- return [className, isFilled, isActive];
-}
-
-class Dot extends SvelteComponent {
- constructor(options) {
- super();
- if (!document.getElementById("svelte-1widvzq-style")) add_css$5();
- init(this, options, instance$6, create_fragment$6, safe_not_equal, { className: 0, isFilled: 1, isActive: 2 });
- }
-}
-
-/* src/components/MetadataResolver.svelte generated by Svelte v3.35.0 */
-
-const get_default_slot_changes_1 = dirty => ({});
-const get_default_slot_context_1 = ctx => ({ metadata: null });
-const get_default_slot_changes = dirty => ({ metadata: dirty & /*metadata*/ 1 });
-const get_default_slot_context = ctx => ({ metadata: /*resolvedMeta*/ ctx[3] });
-
-// (11:0) {:else}
-function create_else_block(ctx) {
- let current;
- const default_slot_template = /*#slots*/ ctx[2].default;
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[1], get_default_slot_context_1);
-
- return {
- c() {
- if (default_slot) default_slot.c();
- },
- m(target, anchor) {
- if (default_slot) {
- default_slot.m(target, anchor);
- }
-
- current = true;
- },
- p(ctx, dirty) {
- if (default_slot) {
- if (default_slot.p && dirty & /*$$scope*/ 2) {
- update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[1], dirty, get_default_slot_changes_1, get_default_slot_context_1);
- }
- }
- },
- i(local) {
- if (current) return;
- transition_in(default_slot, local);
- current = true;
- },
- o(local) {
- transition_out(default_slot, local);
- current = false;
- },
- d(detaching) {
- if (default_slot) default_slot.d(detaching);
- }
- };
-}
-
-// (7:0) {#if metadata}
-function create_if_block$1(ctx) {
- let await_block_anchor;
- let promise;
- let current;
-
- let info = {
- ctx,
- current: null,
- token: null,
- hasCatch: false,
- pending: create_pending_block,
- then: create_then_block,
- catch: create_catch_block,
- value: 3,
- blocks: [,,,]
- };
-
- handle_promise(promise = /*metadata*/ ctx[0], info);
-
- return {
- c() {
- await_block_anchor = empty();
- info.block.c();
- },
- m(target, anchor) {
- insert(target, await_block_anchor, anchor);
- info.block.m(target, info.anchor = anchor);
- info.mount = () => await_block_anchor.parentNode;
- info.anchor = await_block_anchor;
- current = true;
- },
- p(new_ctx, dirty) {
- ctx = new_ctx;
- info.ctx = ctx;
-
- if (dirty & /*metadata*/ 1 && promise !== (promise = /*metadata*/ ctx[0]) && handle_promise(promise, info)) ; else {
- const child_ctx = ctx.slice();
- child_ctx[3] = info.resolved;
- info.block.p(child_ctx, dirty);
- }
- },
- i(local) {
- if (current) return;
- transition_in(info.block);
- current = true;
- },
- o(local) {
- for (let i = 0; i < 3; i += 1) {
- const block = info.blocks[i];
- transition_out(block);
- }
-
- current = false;
- },
- d(detaching) {
- if (detaching) detach(await_block_anchor);
- info.block.d(detaching);
- info.token = null;
- info = null;
- }
- };
-}
-
-// (1:0) 0;o--){let l=r[o-1];if(l.dom.parentNode==e)return l.domAtPos(l.length)}for(let o=t;os&&(s=a?d:c)});return s}let r=(l,s)=>n(l,a=>{let u=a,{state:c}=l,d=c.doc.lineAt(u),m=c.charCategorizer(u);for(let p=null;;){if(u==(s?d.to:d.from)){u==a&&d.number!=(s?c.doc.lines:1)&&(u+=s?1:-1);break}let x=(0,me.findClusterBreak)(d.text,u-d.from,s)+d.from,j=d.text.slice(Math.min(u,x)-d.from,Math.max(u,x)-d.from),L=m(j);if(p!=null&&L!=p)break;(j!=" "||u!=a)&&(p=L),u=x}return u=i.getSegDestFromGroup(a,u,c.sliceDoc.bind(c))??u,u}),t=l=>r(l,!1),o=l=>r(l,!0);return Y.keymap.of([{key:"Ctrl-Alt-h",run:t},{key:"Mod-Backspace",mac:"Alt-Backspace",run:t},{key:"Mod-Delete",mac:"Alt-Delete",run:o}])};var Tt=i=>[xt(i),At(i)];var on=i=>{i.registerEditorExtension(Tt(i)),i.register(Re(ge.EditorState.prototype,{wordAt:r=>function(t){let o=r.call(this,t);return le(i,t,r.call(this,t),this)??o}}));let n,e;(u=>(u.BeginAndForward="BeginAndForward",u.BeginAndBackward="BeginAndBackward",u.ForwardAndForward="ForwardAndForward",u.ForwardAndBackward="ForwardAndBackward",u.BackwardAndForward="BackwardAndForward",u.BackwardAndBackward="BackwardAndBackward"))(e||(e={})),i.register(Re(_t.EditorView.prototype,{moveByGroup:r=>function(t,o){let l=r.call(this,t,o);if(l.empty||t.empty){let s;l.empty&&t.empty?(s=o?"BeginAndForward":"BeginAndBackward",n=t.from):o?s=n!=t.to?"ForwardAndForward":"BackwardAndForward":s=n!=t.from?"BackwardAndBackward":"ForwardAndBackward";let a;switch(s){case"BeginAndForward":a=t.from;break;case"BeginAndBackward":case"ForwardAndBackward":a=t.to;break;case"ForwardAndForward":t.from<=l.to?a=t.to+1:a=t.from+1;break;case"BackwardAndForward":a=t.from+1;break;case"BackwardAndBackward":t.from>l.to?a=t.from-1:a=t.to;break;default:a=t.from;break}let u=i.getSegDestFromGroup(a,o?l.from:l.to,this.state.sliceDoc.bind(this.state));if(u)return ge.EditorSelection.range(u,u)}return l}}))},Mt=on;var pe=class extends Error{},Je=class extends pe{},qe=class extends pe{},ln=(i,n=",")=>i.join(n),sn={accept:"*",multiple:!1,strict:!1},St=i=>{let{accept:n,multiple:e,strict:r}={...sn,...i},t=cn({multiple:e,accept:Array.isArray(n)?ln(n):n});return new Promise(o=>{t.onchange=()=>{o(an(t.files,e,r)),t.remove()},t.click()})},an=(i,n,e)=>new Promise((r,t)=>{if(!i)return t(new Je);let o=un(i,n,e);if(!o)return t(new qe);r(o)}),un=(i,n,e)=>!n&&e?i.length===1?i[0]:null:i.length?i:null,cn=({accept:i,multiple:n})=>{let e=document.createElement("input");return e.type="file",e.multiple=n,e.accept=i,e};var Q=require("obsidian"),kt="var(--background-modifier-success)",Et="var(--background-modifier-cover)",Ke="https://unpkg.com/jieba-wasm@0.0.2/pkg/web/jieba_rs_wasm_bg.wasm",I=class extends Q.Modal{constructor(e){super(e.app);this.plugin=e;this.reloadButton=null;this.selectButton=null;this.downloadButton=null;this.modalEl.addClass("zt-install-guide")}get libName(){return this.plugin.libName}onOpen(){this.contentEl.createEl("h1",{text:"\u5B89\u88C5\u7ED3\u5DF4\u5206\u8BCD"}),this.contentEl.createDiv({},e=>{e.appendText("\u65B0\u7248\u5206\u8BCD\u63D2\u4EF6\u9700\u8981\u5B89\u88C5 jieba-wasm\uFF0C\u8BF7\u6309\u7167\u4E0B\u9762\u7684\u6B65\u9AA4\u5B89\u88C5\uFF1A"),e.createEl("ol",{},r=>{r.createEl("li",{},t=>{this.downloadButton=t.createEl("button",{text:"\u81EA\u52A8\u4E0B\u8F7D"},o=>o.onclick=this.onDownloadingFile.bind(this)),t.createEl("br"),t.appendText("\u6216"),t.createEl("ol",{},o=>{o.createEl("li",{},l=>{l.appendText("\u70B9\u51FB\u94FE\u63A5\u624B\u52A8\u4E0B\u8F7D"),l.createEl("code",{text:this.libName}),l.createEl("br"),l.createEl("a",{href:Ke,text:Ke})}),o.createEl("li",{},l=>{l.appendText("\u5728\u5F39\u51FA\u7684\u7A97\u53E3\u9009\u62E9\u4E0B\u8F7D\u597D\u7684 "),l.createEl("code",{text:this.libName}),l.appendText(" "),this.selectButton=l.createEl("button",{text:"\u9009\u62E9\u6587\u4EF6"},s=>s.onclick=this.onSelectingFile.bind(this))})})}),r.createEl("li",{},t=>{t.appendText("\u91CD\u65B0\u52A0\u8F7D\u5206\u8BCD\u63D2\u4EF6: "),this.reloadButton=t.createEl("button",{text:"\u91CD\u65B0\u52A0\u8F7D"},o=>{o.disabled=!0,o.style.backgroundColor=Et,o.onclick=this.onReloadPlugin.bind(this)})})})})}onClose(){this.contentEl.empty()}async onSelectingFile(){let e=await St({multiple:!1,accept:".wasm",strict:!0});!e||(await this.plugin.saveLib(await e.arrayBuffer()),this.selectButton&&(this.selectButton.setText("\u7ED3\u5DF4\u5206\u8BCD\u63D2\u4EF6\u5BFC\u5165\u6210\u529F"),this.selectButton.style.backgroundColor=kt),this.reloadButton&&(this.reloadButton.disabled=!1,this.reloadButton.style.backgroundColor=""))}async onDownloadingFile(){this.reloadButton&&(this.reloadButton.disabled=!0,this.reloadButton.style.backgroundColor=Et);let e=await fetch(Ke);await this.plugin.saveLib(await e.arrayBuffer()),this.selectButton&&(this.selectButton.setText("\u7ED3\u5DF4\u5206\u8BCD\u63D2\u4EF6\u5BFC\u5165\u6210\u529F"),this.selectButton.style.backgroundColor=kt),this.reloadButton&&(this.reloadButton.disabled=!1,this.reloadButton.style.backgroundColor="")}async onReloadPlugin(){if(await this.plugin.libExists()){let e=await app.vault.adapter.stat(this.plugin.libPath);e&&e.type=="file"&&e.size>0&&(await this.app.plugins.disablePlugin(this.plugin.manifest.id),this.close(),await this.app.plugins.enablePlugin(this.plugin.manifest.id),await this.app.setting.openTabById(this.plugin.manifest.id)),new Q.Notice("\u2714\uFE0F \u5B89\u88C5\u7ED3\u5DF4\u5206\u8BCD\u63D2\u4EF6\u6210\u529F")}else new Q.Notice("\u274C \u5B89\u88C5\u7ED3\u5DF4\u5206\u8BCD\u63D2\u4EF6\u5931\u8D25")}};var gn={},y,Rt=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Rt.decode();var be=null;function Ce(){return(be===null||be.buffer!==y.memory.buffer)&&(be=new Uint8Array(y.memory.buffer)),be}function Ue(i,n){return Rt.decode(Ce().subarray(i,i+n))}var F=new Array(32).fill(void 0);F.push(void 0,null,!0,!1);var te=F.length;function Z(i){te===F.length&&F.push(F.length+1);let n=te;return te=F[n],F[n]=i,n}function xe(i){return F[i]}function fn(i){i<36||(F[i]=te,te=i)}function ee(i){let n=xe(i);return fn(i),n}function Xe(i){let n=typeof i;if(n=="number"||n=="boolean"||i==null)return`${i}`;if(n=="string")return`"${i}"`;if(n=="symbol"){let t=i.description;return t==null?"Symbol":`Symbol(${t})`}if(n=="function"){let t=i.name;return typeof t=="string"&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(i)){let t=i.length,o="[";t>0&&(o+=Xe(i[0]));for(let l=1;l$1
").replace(Q7,"•").replace(X7,"$1.").replace(J7,"⬜").replace(K7,"✅").replace(q7,"$1").replace(G7,"$1").replace(/<br>/g,"
").replace(/&/g,"&");let r=n;if(t){if(Mx.test(n)){const a=n.match(Mx);for(let o=0;o | ${a!==""?a:" #$2").replace(kf,"$1$2").replace(iR,"$1").replace(rd,"$1").replace(/\^\S{6}/g,"");const n=document.createElement("div");n.innerHTML=e;for(let a=0;a =a){var We=p?null:Ya(d);if(We)return sl(We);de=!1,z=Rt,Te=new vu}else Te=p?[]:ve;e:for(;++j =ve)return Te;var We=T[j];return Te*(We=="desc"?-1:1)}}return d.index-p.index}function jm(d,p,T,j){for(var z=-1,ee=d.length,de=T.length,ve=-1,Te=p.length,We=kr(ee-de,0),$e=Oe(Te+We),Je=!j;++ve 0){if(++p>=G)return arguments[0]}else p=0;return d.apply(n,arguments)}}function To(d,p){var T=-1,j=d.length,z=j-1;for(p=p===n?j:p;++T 1?d[p-1]:n;return T=typeof T=="function"?(d.pop(),T):n,og(d,T)});function Eo(d){var p=J(d);return p.__chain__=!0,p}function ig(d,p){return p(d),d}function Bh(d,p){return p(d)}var kl=Gi(function(d){var p=d.length,T=p?d[0]:0,j=this.__wrapped__,z=function(ee){return ah(ee,d)};return p>1||this.__actions__.length||!(j instanceof nn)||!Vo(T)?this.thru(z):(j=j.slice(T,+T+(p?1:0)),j.__actions__.push({func:Bh,args:[z],thisArg:n}),new ga(j,this.__chain__).thru(function(ee){return p&&!ee.length&&ee.push(n),ee}))});function Hh(){return Eo(this)}function ku(){return new ga(this.value(),this.__chain__)}function Yh(){this.__values__===n&&(this.__values__=dx(this.value()));var d=this.__index__>=this.__values__.length,p=d?n:this.__values__[this.__index__++];return{done:d,value:p}}function sg(){return this}function lg(d){for(var p,T=this;T instanceof Ui;){var j=Gm(T);j.__index__=0,j.__values__=n,p?z.__wrapped__=j:p=j;var z=j;T=T.__wrapped__}return z.__wrapped__=d,p}function eS(){var d=this.__wrapped__;if(d instanceof nn){var p=d;return this.__actions__.length&&(p=new nn(this)),p=p.reverse(),p.__actions__.push({func:Bh,args:[Ea],thisArg:n}),new ga(p,this.__chain__)}return this.thru(Ea)}function ug(){return km(this.__wrapped__,this.__actions__)}var tS=Rd(function(d,p,T){Tn.call(d,T)?++d[T]:Wi(d,T,1)});function f0(d,p,T){var j=an(d)?oc:mi;return T&&Fn(d,p,T)&&(p=n),j(d,Ot(p,3))}function h0(d,p){var T=an(d)?fi:Du;return T(d,Ot(p,3))}var Uh=zy(Lc),zh=zy(Il);function p0(d,p){return _r(Zh(d,p),1)}function cg(d,p){return _r(Zh(d,p),he)}function nS(d,p,T){return T=T===n?1:un(T),_r(Zh(d,p),T)}function dg(d,p){var T=an(d)?wr:Zi;return T(d,Ot(p,3))}function Vh(d,p){var T=an(d)?uu:Fy;return T(d,Ot(p,3))}var Wh=Rd(function(d,p,T){Tn.call(d,T)?d[T].push(p):Wi(d,T,[p])});function fg(d,p,T,j){d=Zo(d)?d:Kh(d),T=T&&!j?un(T):0;var z=d.length;return T<0&&(T=kr(z+T,0)),v0(d)?T<=z&&d.indexOf(p,T)>-1:!!z&&ys(d,p,T)>-1}var $h=rn(function(d,p,T){var j=-1,z=typeof p=="function",ee=Zo(d)?Oe(d.length):[];return Zi(d,function(de){ee[++j]=z?Cr(p,de,T):vl(de,p,T)}),ee}),m0=Rd(function(d,p,T){Wi(d,T,p)});function Zh(d,p){var T=an(d)?jn:Em;return T(d,Ot(p,3))}function qh(d,p,T,j){return d==null?[]:(an(p)||(p=p==null?[]:[p]),T=j?n:T,an(T)||(T=T==null?[]:[T]),fh(d,p,T))}var rS=Rd(function(d,p,T){d[T?0:1].push(p)},function(){return[[],[]]});function Jd(d,p,T){var j=an(d)?hd:q,z=arguments.length<3;return j(d,Ot(p,4),T,z,Zi)}function aS(d,p,T){var j=an(d)?_f:q,z=arguments.length<3;return j(d,Ot(p,4),T,z,Fy)}function Gh(d,p){var T=an(d)?fi:Du;return T(d,Me(Ot(p,3)))}function s(d){var p=an(d)?Vi:Tu;return p(d)}function u(d,p,T){(T?Fn(d,p,T):p===n)?p=1:p=un(p);var j=an(d)?wu:or;return j(d,p)}function m(d){var p=an(d)?Ny:jd;return p(d)}function b(d){if(d==null)return 0;if(Zo(d))return v0(d)?hu(d):d.length;var p=Ta(d);return p==nt||p==Xt?d.size:dh(d).length}function x(d,p,T){var j=an(d)?il:H1;return T&&Fn(d,p,T)&&(p=n),j(d,Ot(p,3))}var O=rn(function(d,p){if(d==null)return[];var T=p.length;return T>1&&Fn(d,p[0],p[1])?p=[]:T>2&&Fn(p[0],p[1],p[2])&&(p=[p[0]]),fh(d,_r(p,1),[])}),W=Kn||function(){return zn.Date.now()};function ue(d,p){if(typeof p!="function")throw new Bo(i);return d=un(d),function(){if(--d<1)return p.apply(this,arguments)}}function ge(d,p,T){return p=T?n:p,p=d&&p==null?d.length:p,qi(d,R,n,n,n,n,p)}function Pe(d,p){var T;if(typeof p!="function")throw new Bo(i);return d=un(d),function(){return--d>0&&(T=p.apply(this,arguments)),d<=1&&(p=n),T}}var Ge=rn(function(d,p,T){var j=I;if(T.length){var z=_o(T,Sl(Ge));j|=B}return qi(d,j,p,T,z)}),rt=rn(function(d,p,T){var j=I|M;if(T.length){var z=_o(T,Sl(rt));j|=B}return qi(p,j,d,T,z)});function qe(d,p,T){p=T?n:p;var j=qi(d,_,n,n,n,n,n,p);return j.placeholder=qe.placeholder,j}function yt(d,p,T){p=T?n:p;var j=qi(d,k,n,n,n,n,n,p);return j.placeholder=yt.placeholder,j}function Dt(d,p,T){var j,z,ee,de,ve,Te,We=0,$e=!1,Je=!1,mt=!0;if(typeof d!="function")throw new Bo(i);p=Ki(p)||0,Sr(T)&&($e=!!T.leading,Je="maxWait"in T,ee=Je?kr(Ki(T.maxWait)||0,p):ee,mt="trailing"in T?!!T.trailing:mt);function Nt(Wr){var As=j,Fu=z;return j=z=n,We=Wr,de=d.apply(Fu,As),de}function Ut(Wr){return We=Wr,ve=Pc(mn,p),$e?Nt(Wr):de}function cn(Wr){var As=Wr-Te,Fu=Wr-We,Ix=p-As;return Je?ma(Ix,ee-Fu):Ix}function zt(Wr){var As=Wr-Te,Fu=Wr-We;return Te===n||As>=p||As<0||Je&&Fu>=ee}function mn(){var Wr=W();if(zt(Wr))return Sn(Wr);ve=Pc(mn,cn(Wr))}function Sn(Wr){return ve=n,mt&&j?Nt(Wr):(j=z=n,de)}function Ti(){ve!==n&&Cc(ve),We=0,j=Te=z=ve=n}function xo(){return ve===n?de:Sn(W())}function Ii(){var Wr=W(),As=zt(Wr);if(j=arguments,z=this,Te=Wr,As){if(ve===n)return Ut(Te);if(Je)return Cc(ve),ve=Pc(mn,p),Nt(Te)}return ve===n&&(ve=Pc(mn,p)),de}return Ii.cancel=Ti,Ii.flush=xo,Ii}var Et=rn(function(d,p){return wm(d,1,p)}),br=rn(function(d,p,T){return wm(d,Ki(p)||0,T)});function xe(d){return qi(d,Y)}function ye(d,p){if(typeof d!="function"||p!=null&&typeof p!="function")throw new Bo(i);var T=function(){var j=arguments,z=p?p.apply(this,j):j[0],ee=T.cache;if(ee.has(z))return ee.get(z);var de=d.apply(this,j);return T.cache=ee.set(z,de)||ee,de};return T.cache=new(ye.Cache||Ho),T}ye.Cache=Ho;function Me(d){if(typeof d!="function")throw new Bo(i);return function(){var p=arguments;switch(p.length){case 0:return!d.call(this);case 1:return!d.call(this,p[0]);case 2:return!d.call(this,p[0],p[1]);case 3:return!d.call(this,p[0],p[1],p[2])}return!d.apply(this,p)}}function lt(d){return Pe(2,d)}var Ct=Ry(function(d,p){p=p.length==1&&an(p[0])?jn(p[0],It(Ot())):jn(_r(p,1),It(Ot()));var T=p.length;return rn(function(j){for(var z=-1,ee=ma(j.length,T);++z >>0,T?(d=Un(d),d&&(typeof p=="string"||p!=null&&!sS(p))&&(p=hr(p),!p&&uc(d))?Es(yo(d),0,T):d.split(p,T)):[]}var Wj=xs(function(d,p,T){return d+(T?" ":"")+cS(p)});function $j(d,p,T){return d=Un(d),T=T==null?0:Ts(un(T),0,d.length),p=hr(p),d.slice(T,T+p.length)==p}function Zj(d,p,T){var j=J.templateSettings;T&&Fn(d,p,T)&&(p=n),d=Un(d),p=y0({},p,j,Hm);var z=y0({},p.imports,j.imports,Hm),ee=xa(z),de=Kt(z,ee),ve,Te,We=0,$e=p.interpolate||ds,Je="__p += '",mt=vd((p.escape||ds).source+"|"+$e.source+"|"+($e===On?si:ds).source+"|"+(p.evaluate||ds).source+"|$","g"),Nt="//# sourceURL="+(Tn.call(p,"sourceURL")?(p.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Bn+"]")+`
-`;d.replace(mt,function(zt,mn,Sn,Ti,xo,Ii){return Sn||(Sn=Ti),Je+=d.slice(We,Ii).replace(tc,gd),mn&&(ve=!0,Je+=`' +
-__e(`+mn+`) +
-'`),xo&&(Te=!0,Je+=`';
-`+xo+`;
-__p += '`),Sn&&(Je+=`' +
-((__t = (`+Sn+`)) == null ? '' : __t) +
-'`),We=Ii+zt.length,zt}),Je+=`';
-`;var Ut=Tn.call(p,"variable")&&p.variable;if(!Ut)Je=`with (obj) {
-`+Je+`
-}
-`;else if(Oa.test(Ut))throw new Qt(l);Je=(Te?Je.replace(te,""):Je).replace(me,"$1").replace(Ce,"$1;"),Je="function("+(Ut||"obj")+`) {
-`+(Ut?"":`obj || (obj = {});
-`)+"var __t, __p = ''"+(ve?", __e = _.escape":"")+(Te?`, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-`:`;
-`)+Je+`return __p
-}`;var cn=Dx(function(){return Dn(ee,Nt+"return "+Je).apply(n,de)});if(cn.source=Je,iS(cn))throw cn;return cn}function qj(d){return Un(d).toLowerCase()}function Gj(d){return Un(d).toUpperCase()}function Jj(d,p,T){if(d=Un(d),d&&(T||p===n))return ot(d);if(!d||!(p=hr(p)))return d;var j=yo(d),z=yo(p),ee=Hn(j,z),de=oa(j,z)+1;return Es(j,ee,de).join("")}function Kj(d,p,T){if(d=Un(d),d&&(T||p===n))return d.slice(0,Uf(d)+1);if(!d||!(p=hr(p)))return d;var j=yo(d),z=oa(j,yo(p))+1;return Es(j,0,z).join("")}function Qj(d,p,T){if(d=Un(d),d&&(T||p===n))return d.replace(Pi,"");if(!d||!(p=hr(p)))return d;var j=yo(d),z=Hn(j,yo(p));return Es(j,z).join("")}function Xj(d,p){var T=Z,j=Q;if(Sr(p)){var z="separator"in p?p.separator:z;T="length"in p?un(p.length):T,j="omission"in p?hr(p.omission):j}d=Un(d);var ee=d.length;if(uc(d)){var de=yo(d);ee=de.length}if(T>=ee)return d;var ve=T-hu(j);if(ve<1)return j;var Te=de?Es(de,0,ve).join(""):d.slice(0,ve);if(z===n)return Te+j;if(de&&(ve+=Te.length-ve),sS(z)){if(d.slice(ve).search(z)){var We,$e=Te;for(z.global||(z=vd(z.source,Un(li.exec(z))+"g")),z.lastIndex=0;We=z.exec($e);)var Je=We.index;Te=Te.slice(0,Je===n?ve:Je)}}else if(d.indexOf(hr(z),ve)!=ve){var mt=Te.lastIndexOf(z);mt>-1&&(Te=Te.slice(0,mt))}return Te+j}function eL(d){return d=Un(d),d&&Qe.test(d)?d.replace(Ye,vy):d}var tL=xs(function(d,p,T){return d+(T?" ":"")+p.toUpperCase()}),cS=Rm("toUpperCase");function Sx(d,p,T){return d=Un(d),p=T?n:p,p===n?F1(d)?L1(d):ic(d):d.match(p)||[]}var Dx=rn(function(d,p){try{return Cr(d,n,p)}catch(T){return iS(T)?T:new Qt(T)}}),nL=Gi(function(d,p){return wr(p,function(T){T=bi(T),Wi(d,T,Ge(d[T],d))}),d});function rL(d){var p=d==null?0:d.length,T=Ot();return d=p?jn(d,function(j){if(typeof j[1]!="function")throw new Bo(i);return[T(j[0]),j[1]]}):[],rn(function(j){for(var z=-1;++z ie)return[];var T=ae,j=ma(d,ae);p=Ot(p),d-=ae;for(var z=Ee(j,p);++T
"),oR=e=>{const t=document.createElement("div");return t.textContent=e,t.innerHTML},Nx="mobile-show-sidebar",oA=200,ei=3600*24*1e3,$r=/\s#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/g,Wa=/(
)#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/g,ua=/^#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]+)/gu,kf=/(\s|:|\(|>|^)((http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-]))/g,iR=/\[([\s\S]*?)\]\(([\s\S]*?)\)/gu,Nf=/([^\s<\\*>'(]+\.(jpeg|jpg|gif|png|svg))(\]\])?(\))?/g,rd=/\[@(.+?)\]\((.+?)\)/g,sR=/[#*"\/\\<>:|\[\]\?]/gim,lR=/^(-|\*|\d\.)\s(\[.\]\s)?(\d{1,2}:\d{2}(:\d{2})?)\s(.*)/g,Jg=[{title:"DAILY",icon:"list"},{title:"CANVAS",icon:"layout-dashboard"},{title:"MULTI",icon:"file-text"},{title:"FILE",icon:"edit"}];var lT;(e=>{function t(){return parseInt(C.moment().format("x"))}e.getNowTimeStamp=t;function n(V){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,Z=/\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5/.source,Q=/[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5]{1}/.source,G=new RegExp([`(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${Y}])+`,Z,Q].join("|"),"g");return(V.match(G)||[]).length}e.getWordCount=n;function r(V){Gg()&&(V!=null&&V.EnabledLocationList.some(Y=>Y.value==="DAILY"))&&(V!=null&&V.EnabledLocationList.some(Y=>Y.value==="MULTI"))&&hb().contains(V==null?void 0:V.MemoOtherSaveLocation.MemoDefaultMultiFilePath)&&new C.Notice(E("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 V=navigator.userAgent;let Y="Unknown";return V.indexOf("Win")!=-1?Y="Windows":V.indexOf("Mac")!=-1?Y="MacOS":V.indexOf("Linux")!=-1&&(Y="Linux"),Y}e.getOSVersion=a;function o(V){return typeof V=="string"&&(V=V.replaceAll("-","/")),new Date(V).getTime()}e.getTimeStampByDate=o;function i(V){const Y=new Date(o(V));return new Date(Y.getFullYear(),Y.getMonth(),Y.getDate()).getTime()}e.getDateStampByDate=i;function l(V){const Y=new Date(o(V)),Z=Y.getFullYear(),Q=Y.getMonth()+1,G=Y.getDate();return`${Z}/${Q}/${G}`}e.getDateString=l;function c(V){const Y=new Date(o(V)),Z=Y.getHours(),Q=Y.getMinutes(),G=Z<10?"0"+Z:Z,le=Q<10?"0"+Q:Q;return`${G}:${le}`}e.getTimeString=c;function f(V){const Y=new Date(o(V)),Z=Y.getFullYear(),Q=Y.getMonth()+1,G=Y.getDate(),le=Y.getHours(),se=Y.getMinutes(),fe=Y.getSeconds(),$=Q<10?"0"+Q:Q,he=G<10?"0"+G:G,ie=le<10?"0"+le:le,ce=se<10?"0"+se:se,X=fe<10?"0"+fe:fe;return`${Z}/${$}/${he} ${ie}:${ce}:${X}`}e.getDateTimeString=f;function h(V){return Array.from(new Set(V))}e.dedupe=h;function g(V){const Y=new Set,Z=[];for(const Q of V)Y.has(Q.id)||(Y.add(Q.id),Z.push(Q));return Z}e.dedupeObjectWithId=g;function y(V,Y){let Z=null;return()=>{Z&&clearTimeout(Z),Z=setTimeout(V,Y)}}e.debounce=y;function w(V,Y,Z=!1,Q){let G=null,le=!1;function se(...fe){if(G&&clearTimeout(G),Z&&!le){const $=V.apply(this,fe);Q&&typeof Q=="function"&&Q($),le=!0}else G=setTimeout(()=>{const $=V.apply(this,fe);Q&&typeof Q=="function"&&Q($),le=!1,G=null},Y)}return se.cancel=function(){G&&clearTimeout(G),G=null,le=!1},se}e.debouncePlus=w;function S(V,Y){let Z=!0;return()=>{if(!Z)return!1;Z=!1,setTimeout(()=>{V(),Z=!0},Y)}}e.throttle=S;function D(V){const Y=[],Z=Object.keys(V).sort();for(const Q of Z){const G=V[Q];G&&(typeof G=="object"?Y.push(...D(G).split("&")):Y.push(`${Q}=${G}`))}return Y.join("&")}e.transformObjectToParamsString=D;function I(V){const Y={},Z=V.split("&");for(const Q of Z){const[G,le]=Q.split("=");G&&le&&(Y[G]=le)}return Y}e.transformParamsStringToObject=I;function M(V){if(!V)return{};const Y={},Z=Object.keys(V).sort();for(const Q of Z){const G=V[Q];if(typeof G=="object"){const le=M(JSON.parse(JSON.stringify(G)));le&&Object.keys(le).length>0&&(Y[Q]=le)}else G&&(Y[Q]=G)}return Y}e.filterObjectNullKeys=M;async function N(V){if(navigator.clipboard&&navigator.clipboard.writeText)try{await navigator.clipboard.writeText(V)}catch(Y){console.warn("Copy to clipboard failed.",Y)}else console.warn("Copy to clipboard failed, methods not supports.")}e.copyTextToClipboard=N;function _(V){return new Promise(Y=>{const Z=new Image;Z.onload=()=>{const{width:Q,height:G}=Z;Q>0&&G>0?Y({width:Q,height:G}):Y({width:0,height:0})},Z.onerror=()=>{Y({width:0,height:0})},Z.className="hidden",Z.src=V,document.body.appendChild(Z),Z.remove()})}e.getImageSize=_;async function k(V){var G,le,se,fe;let Y;const Q=app.plugins.getPlugin("obsidian-memos").settings.UseDailyOrPeriodic==="Daily";try{return!Q&&((fe=(se=(le=(G=window.app.plugins)==null?void 0:G.getPlugin("periodic-notes"))==null?void 0:le.calendarSetManager)==null?void 0:se.getActiveConfig("day"))!=null&&fe.enabled)?(Y=await window.app.plugins.getPlugin("periodic-notes").createPeriodicNote("day",V),Y):(Y=await app.internalPlugins.getPluginById("daily-notes").instance.getDailyNote(V)||await rA(V),Y)}catch($){return console.error($),new C.Notice(E("Failed to create daily note. Please check if you created a folder for daily notes.")),null}}e.createDailyNoteCheck=k;function B(V){const Y=[];let Z=0;for(;Z
"}