From 1808e35adf47b14541674799c001d4cf28a6df47 Mon Sep 17 00:00:00 2001 From: Marcin Czenko Date: Fri, 23 May 2025 15:13:59 +0200 Subject: [PATCH] Initial commit --- .gitignore | 4 + .obsidian/app.json | 7 + .obsidian/appearance.json | 3 + .obsidian/backlink.json | 3 + .obsidian/command-palette.json | 6 + .obsidian/community-plugins.json | 6 + .obsidian/core-plugins-migration.json | 30 + .obsidian/core-plugins.json | 31 + .obsidian/daily-notes.json | 5 + .obsidian/graph.json | 22 + .obsidian/hotkeys.json | 129 + .obsidian/plugins/calendar/data.json | 10 + .obsidian/plugins/calendar/main.js | 4459 ++++++++ .obsidian/plugins/calendar/manifest.json | 10 + .obsidian/plugins/nldates-obsidian/data.json | 12 + .obsidian/plugins/nldates-obsidian/main.js | 9562 +++++++++++++++++ .../plugins/nldates-obsidian/manifest.json | 10 + .obsidian/plugins/obsidian42-brat/data.json | 16 + .obsidian/plugins/obsidian42-brat/main.js | 2422 +++++ .../plugins/obsidian42-brat/manifest.json | 15 + .obsidian/plugins/obsidian42-brat/styles.css | 3 + .obsidian/plugins/query-control/data.json | 8 + .obsidian/plugins/query-control/main.js | 12 + .obsidian/plugins/query-control/manifest.json | 1 + .obsidian/plugins/query-control/styles.css | 68 + .obsidian/templates.json | 4 + .obsidian/types.json | 14 + 10 Notes/Short Introduction to Obsidian.md | 32 + 90 Extras/91 Templates/Book.md | 7 + 90 Extras/91 Templates/Tweet.md | 7 + .../92 Assets/Pasted image 20250513024925.png | Bin 0 -> 90687 bytes LICENSE.md | 23 + README.md | 12 + 33 files changed, 16953 insertions(+) create mode 100644 .gitignore create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/backlink.json create mode 100644 .obsidian/command-palette.json create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/core-plugins-migration.json create mode 100644 .obsidian/core-plugins.json create mode 100644 .obsidian/daily-notes.json create mode 100644 .obsidian/graph.json create mode 100644 .obsidian/hotkeys.json create mode 100644 .obsidian/plugins/calendar/data.json create mode 100644 .obsidian/plugins/calendar/main.js create mode 100644 .obsidian/plugins/calendar/manifest.json create mode 100644 .obsidian/plugins/nldates-obsidian/data.json create mode 100644 .obsidian/plugins/nldates-obsidian/main.js create mode 100644 .obsidian/plugins/nldates-obsidian/manifest.json create mode 100644 .obsidian/plugins/obsidian42-brat/data.json create mode 100644 .obsidian/plugins/obsidian42-brat/main.js create mode 100644 .obsidian/plugins/obsidian42-brat/manifest.json create mode 100644 .obsidian/plugins/obsidian42-brat/styles.css create mode 100644 .obsidian/plugins/query-control/data.json create mode 100644 .obsidian/plugins/query-control/main.js create mode 100644 .obsidian/plugins/query-control/manifest.json create mode 100644 .obsidian/plugins/query-control/styles.css create mode 100644 .obsidian/templates.json create mode 100644 .obsidian/types.json create mode 100644 10 Notes/Short Introduction to Obsidian.md create mode 100644 90 Extras/91 Templates/Book.md create mode 100644 90 Extras/91 Templates/Tweet.md create mode 100644 90 Extras/92 Assets/Pasted image 20250513024925.png create mode 100644 LICENSE.md create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecddadc --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +.obsidian/publish.json +.obsidian/workspace*.json +00 Planner diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..181304c --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1,7 @@ +{ + "newFileLocation": "folder", + "newFileFolderPath": "10 Notes", + "attachmentFolderPath": "90 Extras/92 Assets", + "alwaysUpdateLinks": true, + "readableLineLength": true +} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..990f337 --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1,3 @@ +{ + "baseFontSize": 16 +} \ No newline at end of file diff --git a/.obsidian/backlink.json b/.obsidian/backlink.json new file mode 100644 index 0000000..48ee913 --- /dev/null +++ b/.obsidian/backlink.json @@ -0,0 +1,3 @@ +{ + "backlinkInDocument": true +} \ No newline at end of file diff --git a/.obsidian/command-palette.json b/.obsidian/command-palette.json new file mode 100644 index 0000000..d66f43a --- /dev/null +++ b/.obsidian/command-palette.json @@ -0,0 +1,6 @@ +{ + "pinned": [ + "insert-template", + "workspace:toggle-pin" + ] +} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..bea9e0f --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,6 @@ +[ + "obsidian42-brat", + "query-control", + "calendar", + "nldates-obsidian" +] \ No newline at end of file diff --git a/.obsidian/core-plugins-migration.json b/.obsidian/core-plugins-migration.json new file mode 100644 index 0000000..9ee08f0 --- /dev/null +++ b/.obsidian/core-plugins-migration.json @@ -0,0 +1,30 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": false, + "outgoing-link": true, + "tag-pane": true, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": true, + "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 +} \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..498e513 --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,31 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": true, + "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": true, + "webviewer": false +} \ No newline at end of file diff --git a/.obsidian/daily-notes.json b/.obsidian/daily-notes.json new file mode 100644 index 0000000..1d10315 --- /dev/null +++ b/.obsidian/daily-notes.json @@ -0,0 +1,5 @@ +{ + "format": "YYYY-MM-DD, ddd", + "folder": "00 Planner/01 Days", + "autorun": false +} \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..e21a18d --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": false +} \ No newline at end of file diff --git a/.obsidian/hotkeys.json b/.obsidian/hotkeys.json new file mode 100644 index 0000000..3239095 --- /dev/null +++ b/.obsidian/hotkeys.json @@ -0,0 +1,129 @@ +{ + "app:go-back": [ + { + "modifiers": [ + "Mod", + "Alt" + ], + "key": "ArrowLeft" + }, + { + "modifiers": [ + "Mod" + ], + "key": "[" + } + ], + "app:go-forward": [ + { + "modifiers": [ + "Mod", + "Alt" + ], + "key": "ArrowRight" + }, + { + "modifiers": [ + "Mod" + ], + "key": "]" + } + ], + "daily-notes": [ + { + "modifiers": [ + "Mod" + ], + "key": "D" + } + ], + "editor:delete-paragraph": [], + "daily-notes:goto-prev": [ + { + "modifiers": [ + "Alt", + "Mod" + ], + "key": "[" + } + ], + "daily-notes:goto-next": [ + { + "modifiers": [ + "Alt", + "Mod" + ], + "key": "]" + } + ], + "editor:toggle-highlight": [ + { + "modifiers": [ + "Mod", + "Shift" + ], + "key": "H" + } + ], + "bookmarks:open": [ + { + "modifiers": [ + "Mod", + "Shift" + ], + "key": "B" + } + ], + "theme:use-dark": [ + { + "modifiers": [ + "Mod", + "Shift" + ], + "key": "-" + } + ], + "theme:use-light": [ + { + "modifiers": [ + "Mod", + "Shift" + ], + "key": "=" + } + ], + "app:toggle-left-sidebar": [ + { + "modifiers": [ + "Ctrl" + ], + "key": "1" + } + ], + "app:toggle-right-sidebar": [ + { + "modifiers": [ + "Ctrl" + ], + "key": "2" + } + ], + "publish:view-changes": [ + { + "modifiers": [ + "Alt", + "Mod" + ], + "key": "P" + } + ], + "insert-template": [ + { + "modifiers": [ + "Alt", + "Ctrl" + ], + "key": "T" + } + ] +} \ No newline at end of file diff --git a/.obsidian/plugins/calendar/data.json b/.obsidian/plugins/calendar/data.json new file mode 100644 index 0000000..68cf914 --- /dev/null +++ b/.obsidian/plugins/calendar/data.json @@ -0,0 +1,10 @@ +{ + "shouldConfirmBeforeCreate": true, + "weekStart": "locale", + "wordsPerDot": 250, + "showWeeklyNote": true, + "weeklyNoteFormat": "gggg, [week] ww", + "weeklyNoteTemplate": "", + "weeklyNoteFolder": "00 Planner/02 Weeks", + "localeOverride": "system-default" +} \ No newline at end of file diff --git a/.obsidian/plugins/calendar/main.js b/.obsidian/plugins/calendar/main.js new file mode 100644 index 0000000..ed6cea3 --- /dev/null +++ b/.obsidian/plugins/calendar/main.js @@ -0,0 +1,4459 @@ +'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) {#if metadata} +function create_catch_block(ctx) { + return { + c: noop, + m: noop, + p: noop, + i: noop, + o: noop, + d: noop + }; +} + +// (8:37) ; export let metadata; {#if metadata} +function create_pending_block(ctx) { + return { + c: noop, + m: noop, + p: noop, + i: noop, + o: noop, + d: noop + }; +} + +function create_fragment$5(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block$1, create_else_block]; + const if_blocks = []; + + function select_block_type(ctx, dirty) { + if (/*metadata*/ ctx[0]) return 0; + return 1; + } + + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx); + + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx, dirty); + } else { + group_outros(); + + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + + check_outros(); + if_block = if_blocks[current_block_type_index]; + + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + if_block.c(); + } else { + if_block.p(ctx, dirty); + } + + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if_blocks[current_block_type_index].d(detaching); + if (detaching) detach(if_block_anchor); + } + }; +} + +function instance$5($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + + let { metadata } = $$props; + + $$self.$$set = $$props => { + if ("metadata" in $$props) $$invalidate(0, metadata = $$props.metadata); + if ("$$scope" in $$props) $$invalidate(1, $$scope = $$props.$$scope); + }; + + return [metadata, $$scope, slots]; +} + +class MetadataResolver extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$5, create_fragment$5, not_equal, { metadata: 0 }); + } +} + +function isMacOS() { + return navigator.appVersion.indexOf("Mac") !== -1; +} +function isMetaPressed(e) { + return isMacOS() ? e.metaKey : e.ctrlKey; +} +function getDaysOfWeek(..._args) { + return window.moment.weekdaysShort(true); +} +function isWeekend(date) { + return date.isoWeekday() === 6 || date.isoWeekday() === 7; +} +function getStartOfWeek(days) { + return days[0].weekday(0); +} +/** + * Generate a 2D array of daily information to power + * the calendar view. + */ +function getMonth(displayedMonth, ..._args) { + const locale = window.moment().locale(); + const month = []; + let week; + const startOfMonth = displayedMonth.clone().locale(locale).date(1); + const startOffset = startOfMonth.weekday(); + let date = startOfMonth.clone().subtract(startOffset, "days"); + for (let _day = 0; _day < 42; _day++) { + if (_day % 7 === 0) { + week = { + days: [], + weekNum: date.week(), + }; + month.push(week); + } + week.days.push(date); + date = date.clone().add(1, "days"); + } + return month; +} + +/* src/components/Day.svelte generated by Svelte v3.35.0 */ + +function add_css$4() { + var style = element("style"); + style.id = "svelte-q3wqg9-style"; + style.textContent = ".day.svelte-q3wqg9{background-color:var(--color-background-day);border-radius:4px;color:var(--color-text-day);cursor:pointer;font-size:0.8em;height:100%;padding:4px;position:relative;text-align:center;transition:background-color 0.1s ease-in, color 0.1s ease-in;vertical-align:baseline}.day.svelte-q3wqg9:hover{background-color:var(--interactive-hover)}.day.active.svelte-q3wqg9:hover{background-color:var(--interactive-accent-hover)}.adjacent-month.svelte-q3wqg9{opacity:0.25}.today.svelte-q3wqg9{color:var(--color-text-today)}.day.svelte-q3wqg9:active,.active.svelte-q3wqg9,.active.today.svelte-q3wqg9{color:var(--text-on-accent);background-color:var(--interactive-accent)}.dot-container.svelte-q3wqg9{display:flex;flex-wrap:wrap;justify-content:center;line-height:6px;min-height:6px}"; + append(document.head, style); +} + +function get_each_context$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (36:8) {#each metadata.dots as dot} +function create_each_block$2(ctx) { + let dot; + let current; + const dot_spread_levels = [/*dot*/ ctx[11]]; + let dot_props = {}; + + for (let i = 0; i < dot_spread_levels.length; i += 1) { + dot_props = assign(dot_props, dot_spread_levels[i]); + } + + dot = new Dot({ props: dot_props }); + + return { + c() { + create_component(dot.$$.fragment); + }, + m(target, anchor) { + mount_component(dot, target, anchor); + current = true; + }, + p(ctx, dirty) { + const dot_changes = (dirty & /*metadata*/ 128) + ? get_spread_update(dot_spread_levels, [get_spread_object(/*dot*/ ctx[11])]) + : {}; + + dot.$set(dot_changes); + }, + i(local) { + if (current) return; + transition_in(dot.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dot.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dot, detaching); + } + }; +} + +// (22:2) +function create_default_slot$1(ctx) { + let div1; + let t0_value = /*date*/ ctx[0].format("D") + ""; + let t0; + let t1; + let div0; + let div1_class_value; + let current; + let mounted; + let dispose; + let each_value = /*metadata*/ ctx[7].dots; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); + } + + const out = i => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + + let div1_levels = [ + { + class: div1_class_value = `day ${/*metadata*/ ctx[7].classes.join(" ")}` + }, + /*metadata*/ ctx[7].dataAttributes || {} + ]; + + let div1_data = {}; + + for (let i = 0; i < div1_levels.length; i += 1) { + div1_data = assign(div1_data, div1_levels[i]); + } + + return { + c() { + div1 = element("div"); + t0 = text(t0_value); + t1 = space(); + div0 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(div0, "class", "dot-container svelte-q3wqg9"); + set_attributes(div1, div1_data); + toggle_class(div1, "active", /*selectedId*/ ctx[6] === getDateUID_1(/*date*/ ctx[0], "day")); + toggle_class(div1, "adjacent-month", !/*date*/ ctx[0].isSame(/*displayedMonth*/ ctx[5], "month")); + toggle_class(div1, "today", /*date*/ ctx[0].isSame(/*today*/ ctx[4], "day")); + toggle_class(div1, "svelte-q3wqg9", true); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, t0); + append(div1, t1); + append(div1, div0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen(div1, "click", function () { + if (is_function(/*onClick*/ ctx[2] && /*click_handler*/ ctx[8])) (/*onClick*/ ctx[2] && /*click_handler*/ ctx[8]).apply(this, arguments); + }), + listen(div1, "contextmenu", function () { + if (is_function(/*onContextMenu*/ ctx[3] && /*contextmenu_handler*/ ctx[9])) (/*onContextMenu*/ ctx[3] && /*contextmenu_handler*/ ctx[9]).apply(this, arguments); + }), + listen(div1, "pointerover", function () { + if (is_function(/*onHover*/ ctx[1] && /*pointerover_handler*/ ctx[10])) (/*onHover*/ ctx[1] && /*pointerover_handler*/ ctx[10]).apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if ((!current || dirty & /*date*/ 1) && t0_value !== (t0_value = /*date*/ ctx[0].format("D") + "")) set_data(t0, t0_value); + + if (dirty & /*metadata*/ 128) { + each_value = /*metadata*/ ctx[7].dots; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$2(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$2(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div0, null); + } + } + + group_outros(); + + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + + check_outros(); + } + + set_attributes(div1, div1_data = get_spread_update(div1_levels, [ + (!current || dirty & /*metadata*/ 128 && div1_class_value !== (div1_class_value = `day ${/*metadata*/ ctx[7].classes.join(" ")}`)) && { class: div1_class_value }, + dirty & /*metadata*/ 128 && (/*metadata*/ ctx[7].dataAttributes || {}) + ])); + + toggle_class(div1, "active", /*selectedId*/ ctx[6] === getDateUID_1(/*date*/ ctx[0], "day")); + toggle_class(div1, "adjacent-month", !/*date*/ ctx[0].isSame(/*displayedMonth*/ ctx[5], "month")); + toggle_class(div1, "today", /*date*/ ctx[0].isSame(/*today*/ ctx[4], "day")); + toggle_class(div1, "svelte-q3wqg9", true); + }, + i(local) { + if (current) return; + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div1); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} + +function create_fragment$4(ctx) { + let td; + let metadataresolver; + let current; + + metadataresolver = new MetadataResolver({ + props: { + metadata: /*metadata*/ ctx[7], + $$slots: { + default: [ + create_default_slot$1, + ({ metadata }) => ({ 7: metadata }), + ({ metadata }) => metadata ? 128 : 0 + ] + }, + $$scope: { ctx } + } + }); + + return { + c() { + td = element("td"); + create_component(metadataresolver.$$.fragment); + }, + m(target, anchor) { + insert(target, td, anchor); + mount_component(metadataresolver, td, null); + current = true; + }, + p(ctx, [dirty]) { + const metadataresolver_changes = {}; + if (dirty & /*metadata*/ 128) metadataresolver_changes.metadata = /*metadata*/ ctx[7]; + + if (dirty & /*$$scope, metadata, selectedId, date, displayedMonth, today, onClick, onContextMenu, onHover*/ 16639) { + metadataresolver_changes.$$scope = { dirty, ctx }; + } + + metadataresolver.$set(metadataresolver_changes); + }, + i(local) { + if (current) return; + transition_in(metadataresolver.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(metadataresolver.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(td); + destroy_component(metadataresolver); + } + }; +} + +function instance$4($$self, $$props, $$invalidate) { + + + let { date } = $$props; + let { metadata } = $$props; + let { onHover } = $$props; + let { onClick } = $$props; + let { onContextMenu } = $$props; + let { today } = $$props; + let { displayedMonth = null } = $$props; + let { selectedId = null } = $$props; + const click_handler = e => onClick(date, isMetaPressed(e)); + const contextmenu_handler = e => onContextMenu(date, e); + const pointerover_handler = e => onHover(date, e.target, isMetaPressed(e)); + + $$self.$$set = $$props => { + if ("date" in $$props) $$invalidate(0, date = $$props.date); + if ("metadata" in $$props) $$invalidate(7, metadata = $$props.metadata); + if ("onHover" in $$props) $$invalidate(1, onHover = $$props.onHover); + if ("onClick" in $$props) $$invalidate(2, onClick = $$props.onClick); + if ("onContextMenu" in $$props) $$invalidate(3, onContextMenu = $$props.onContextMenu); + if ("today" in $$props) $$invalidate(4, today = $$props.today); + if ("displayedMonth" in $$props) $$invalidate(5, displayedMonth = $$props.displayedMonth); + if ("selectedId" in $$props) $$invalidate(6, selectedId = $$props.selectedId); + }; + + return [ + date, + onHover, + onClick, + onContextMenu, + today, + displayedMonth, + selectedId, + metadata, + click_handler, + contextmenu_handler, + pointerover_handler + ]; +} + +class Day extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-q3wqg9-style")) add_css$4(); + + init(this, options, instance$4, create_fragment$4, not_equal, { + date: 0, + metadata: 7, + onHover: 1, + onClick: 2, + onContextMenu: 3, + today: 4, + displayedMonth: 5, + selectedId: 6 + }); + } +} + +/* src/components/Arrow.svelte generated by Svelte v3.35.0 */ + +function add_css$3() { + var style = element("style"); + style.id = "svelte-156w7na-style"; + style.textContent = ".arrow.svelte-156w7na.svelte-156w7na{align-items:center;cursor:pointer;display:flex;justify-content:center;width:24px}.arrow.is-mobile.svelte-156w7na.svelte-156w7na{width:32px}.right.svelte-156w7na.svelte-156w7na{transform:rotate(180deg)}.arrow.svelte-156w7na svg.svelte-156w7na{color:var(--color-arrow);height:16px;width:16px}"; + append(document.head, style); +} + +function create_fragment$3(ctx) { + let div; + let svg; + let path; + let mounted; + let dispose; + + return { + c() { + div = element("div"); + svg = svg_element("svg"); + path = svg_element("path"); + attr(path, "fill", "currentColor"); + attr(path, "d", "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"); + attr(svg, "focusable", "false"); + attr(svg, "role", "img"); + attr(svg, "xmlns", "http://www.w3.org/2000/svg"); + attr(svg, "viewBox", "0 0 320 512"); + attr(svg, "class", "svelte-156w7na"); + attr(div, "class", "arrow svelte-156w7na"); + attr(div, "aria-label", /*tooltip*/ ctx[1]); + toggle_class(div, "is-mobile", /*isMobile*/ ctx[3]); + toggle_class(div, "right", /*direction*/ ctx[2] === "right"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, svg); + append(svg, path); + + if (!mounted) { + dispose = listen(div, "click", function () { + if (is_function(/*onClick*/ ctx[0])) /*onClick*/ ctx[0].apply(this, arguments); + }); + + mounted = true; + } + }, + p(new_ctx, [dirty]) { + ctx = new_ctx; + + if (dirty & /*tooltip*/ 2) { + attr(div, "aria-label", /*tooltip*/ ctx[1]); + } + + if (dirty & /*direction*/ 4) { + toggle_class(div, "right", /*direction*/ ctx[2] === "right"); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(div); + mounted = false; + dispose(); + } + }; +} + +function instance$3($$self, $$props, $$invalidate) { + let { onClick } = $$props; + let { tooltip } = $$props; + let { direction } = $$props; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + $$self.$$set = $$props => { + if ("onClick" in $$props) $$invalidate(0, onClick = $$props.onClick); + if ("tooltip" in $$props) $$invalidate(1, tooltip = $$props.tooltip); + if ("direction" in $$props) $$invalidate(2, direction = $$props.direction); + }; + + return [onClick, tooltip, direction, isMobile]; +} + +class Arrow extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-156w7na-style")) add_css$3(); + init(this, options, instance$3, create_fragment$3, safe_not_equal, { onClick: 0, tooltip: 1, direction: 2 }); + } +} + +/* src/components/Nav.svelte generated by Svelte v3.35.0 */ + +function add_css$2() { + var style = element("style"); + style.id = "svelte-1vwr9dd-style"; + style.textContent = ".nav.svelte-1vwr9dd.svelte-1vwr9dd{align-items:center;display:flex;margin:0.6em 0 1em;padding:0 8px;width:100%}.nav.is-mobile.svelte-1vwr9dd.svelte-1vwr9dd{padding:0}.title.svelte-1vwr9dd.svelte-1vwr9dd{color:var(--color-text-title);font-size:1.5em;margin:0}.is-mobile.svelte-1vwr9dd .title.svelte-1vwr9dd{font-size:1.3em}.month.svelte-1vwr9dd.svelte-1vwr9dd{font-weight:500;text-transform:capitalize}.year.svelte-1vwr9dd.svelte-1vwr9dd{color:var(--interactive-accent)}.right-nav.svelte-1vwr9dd.svelte-1vwr9dd{display:flex;justify-content:center;margin-left:auto}.reset-button.svelte-1vwr9dd.svelte-1vwr9dd{cursor:pointer;border-radius:4px;color:var(--text-muted);font-size:0.7em;font-weight:600;letter-spacing:1px;margin:0 4px;padding:0px 4px;text-transform:uppercase}.is-mobile.svelte-1vwr9dd .reset-button.svelte-1vwr9dd{display:none}"; + append(document.head, style); +} + +function create_fragment$2(ctx) { + let div2; + let h3; + let span0; + let t0_value = /*displayedMonth*/ ctx[0].format("MMM") + ""; + let t0; + let t1; + let span1; + let t2_value = /*displayedMonth*/ ctx[0].format("YYYY") + ""; + let t2; + let t3; + let div1; + let arrow0; + let t4; + let div0; + let t6; + let arrow1; + let current; + let mounted; + let dispose; + + arrow0 = new Arrow({ + props: { + direction: "left", + onClick: /*decrementDisplayedMonth*/ ctx[3], + tooltip: "Previous Month" + } + }); + + arrow1 = new Arrow({ + props: { + direction: "right", + onClick: /*incrementDisplayedMonth*/ ctx[2], + tooltip: "Next Month" + } + }); + + return { + c() { + div2 = element("div"); + h3 = element("h3"); + span0 = element("span"); + t0 = text(t0_value); + t1 = space(); + span1 = element("span"); + t2 = text(t2_value); + t3 = space(); + div1 = element("div"); + create_component(arrow0.$$.fragment); + t4 = space(); + div0 = element("div"); + div0.textContent = `${/*todayDisplayStr*/ ctx[4]}`; + t6 = space(); + create_component(arrow1.$$.fragment); + attr(span0, "class", "month svelte-1vwr9dd"); + attr(span1, "class", "year svelte-1vwr9dd"); + attr(h3, "class", "title svelte-1vwr9dd"); + attr(div0, "class", "reset-button svelte-1vwr9dd"); + attr(div1, "class", "right-nav svelte-1vwr9dd"); + attr(div2, "class", "nav svelte-1vwr9dd"); + toggle_class(div2, "is-mobile", /*isMobile*/ ctx[5]); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, h3); + append(h3, span0); + append(span0, t0); + append(h3, t1); + append(h3, span1); + append(span1, t2); + append(div2, t3); + append(div2, div1); + mount_component(arrow0, div1, null); + append(div1, t4); + append(div1, div0); + append(div1, t6); + mount_component(arrow1, div1, null); + current = true; + + if (!mounted) { + dispose = [ + listen(h3, "click", function () { + if (is_function(/*resetDisplayedMonth*/ ctx[1])) /*resetDisplayedMonth*/ ctx[1].apply(this, arguments); + }), + listen(div0, "click", function () { + if (is_function(/*resetDisplayedMonth*/ ctx[1])) /*resetDisplayedMonth*/ ctx[1].apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, [dirty]) { + ctx = new_ctx; + if ((!current || dirty & /*displayedMonth*/ 1) && t0_value !== (t0_value = /*displayedMonth*/ ctx[0].format("MMM") + "")) set_data(t0, t0_value); + if ((!current || dirty & /*displayedMonth*/ 1) && t2_value !== (t2_value = /*displayedMonth*/ ctx[0].format("YYYY") + "")) set_data(t2, t2_value); + const arrow0_changes = {}; + if (dirty & /*decrementDisplayedMonth*/ 8) arrow0_changes.onClick = /*decrementDisplayedMonth*/ ctx[3]; + arrow0.$set(arrow0_changes); + const arrow1_changes = {}; + if (dirty & /*incrementDisplayedMonth*/ 4) arrow1_changes.onClick = /*incrementDisplayedMonth*/ ctx[2]; + arrow1.$set(arrow1_changes); + }, + i(local) { + if (current) return; + transition_in(arrow0.$$.fragment, local); + transition_in(arrow1.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(arrow0.$$.fragment, local); + transition_out(arrow1.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(div2); + destroy_component(arrow0); + destroy_component(arrow1); + mounted = false; + run_all(dispose); + } + }; +} + +function instance$2($$self, $$props, $$invalidate) { + + let { displayedMonth } = $$props; + let { today } = $$props; + let { resetDisplayedMonth } = $$props; + let { incrementDisplayedMonth } = $$props; + let { decrementDisplayedMonth } = $$props; + + // Get the word 'Today' but localized to the current language + const todayDisplayStr = today.calendar().split(/\d|\s/)[0]; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + $$self.$$set = $$props => { + if ("displayedMonth" in $$props) $$invalidate(0, displayedMonth = $$props.displayedMonth); + if ("today" in $$props) $$invalidate(6, today = $$props.today); + if ("resetDisplayedMonth" in $$props) $$invalidate(1, resetDisplayedMonth = $$props.resetDisplayedMonth); + if ("incrementDisplayedMonth" in $$props) $$invalidate(2, incrementDisplayedMonth = $$props.incrementDisplayedMonth); + if ("decrementDisplayedMonth" in $$props) $$invalidate(3, decrementDisplayedMonth = $$props.decrementDisplayedMonth); + }; + + return [ + displayedMonth, + resetDisplayedMonth, + incrementDisplayedMonth, + decrementDisplayedMonth, + todayDisplayStr, + isMobile, + today + ]; +} + +class Nav extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-1vwr9dd-style")) add_css$2(); + + init(this, options, instance$2, create_fragment$2, safe_not_equal, { + displayedMonth: 0, + today: 6, + resetDisplayedMonth: 1, + incrementDisplayedMonth: 2, + decrementDisplayedMonth: 3 + }); + } +} + +/* src/components/WeekNum.svelte generated by Svelte v3.35.0 */ + +function add_css$1() { + var style = element("style"); + style.id = "svelte-egt0yd-style"; + style.textContent = "td.svelte-egt0yd{border-right:1px solid var(--background-modifier-border)}.week-num.svelte-egt0yd{background-color:var(--color-background-weeknum);border-radius:4px;color:var(--color-text-weeknum);cursor:pointer;font-size:0.65em;height:100%;padding:4px;text-align:center;transition:background-color 0.1s ease-in, color 0.1s ease-in;vertical-align:baseline}.week-num.svelte-egt0yd:hover{background-color:var(--interactive-hover)}.week-num.active.svelte-egt0yd:hover{background-color:var(--interactive-accent-hover)}.active.svelte-egt0yd{color:var(--text-on-accent);background-color:var(--interactive-accent)}.dot-container.svelte-egt0yd{display:flex;flex-wrap:wrap;justify-content:center;line-height:6px;min-height:6px}"; + append(document.head, style); +} + +function get_each_context$1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (35:8) {#each metadata.dots as dot} +function create_each_block$1(ctx) { + let dot; + let current; + const dot_spread_levels = [/*dot*/ ctx[11]]; + let dot_props = {}; + + for (let i = 0; i < dot_spread_levels.length; i += 1) { + dot_props = assign(dot_props, dot_spread_levels[i]); + } + + dot = new Dot({ props: dot_props }); + + return { + c() { + create_component(dot.$$.fragment); + }, + m(target, anchor) { + mount_component(dot, target, anchor); + current = true; + }, + p(ctx, dirty) { + const dot_changes = (dirty & /*metadata*/ 64) + ? get_spread_update(dot_spread_levels, [get_spread_object(/*dot*/ ctx[11])]) + : {}; + + dot.$set(dot_changes); + }, + i(local) { + if (current) return; + transition_in(dot.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dot.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dot, detaching); + } + }; +} + +// (24:2) +function create_default_slot(ctx) { + let div1; + let t0; + let t1; + let div0; + let div1_class_value; + let current; + let mounted; + let dispose; + let each_value = /*metadata*/ ctx[6].dots; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); + } + + const out = i => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + + return { + c() { + div1 = element("div"); + t0 = text(/*weekNum*/ ctx[0]); + t1 = space(); + div0 = element("div"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(div0, "class", "dot-container svelte-egt0yd"); + attr(div1, "class", div1_class_value = "" + (null_to_empty(`week-num ${/*metadata*/ ctx[6].classes.join(" ")}`) + " svelte-egt0yd")); + toggle_class(div1, "active", /*selectedId*/ ctx[5] === getDateUID_1(/*days*/ ctx[1][0], "week")); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, t0); + append(div1, t1); + append(div1, div0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div0, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen(div1, "click", function () { + if (is_function(/*onClick*/ ctx[3] && /*click_handler*/ ctx[8])) (/*onClick*/ ctx[3] && /*click_handler*/ ctx[8]).apply(this, arguments); + }), + listen(div1, "contextmenu", function () { + if (is_function(/*onContextMenu*/ ctx[4] && /*contextmenu_handler*/ ctx[9])) (/*onContextMenu*/ ctx[4] && /*contextmenu_handler*/ ctx[9]).apply(this, arguments); + }), + listen(div1, "pointerover", function () { + if (is_function(/*onHover*/ ctx[2] && /*pointerover_handler*/ ctx[10])) (/*onHover*/ ctx[2] && /*pointerover_handler*/ ctx[10]).apply(this, arguments); + }) + ]; + + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (!current || dirty & /*weekNum*/ 1) set_data(t0, /*weekNum*/ ctx[0]); + + if (dirty & /*metadata*/ 64) { + each_value = /*metadata*/ ctx[6].dots; + let i; + + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$1(ctx, each_value, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$1(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div0, null); + } + } + + group_outros(); + + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + + check_outros(); + } + + if (!current || dirty & /*metadata*/ 64 && div1_class_value !== (div1_class_value = "" + (null_to_empty(`week-num ${/*metadata*/ ctx[6].classes.join(" ")}`) + " svelte-egt0yd"))) { + attr(div1, "class", div1_class_value); + } + + if (dirty & /*metadata, selectedId, getDateUID, days*/ 98) { + toggle_class(div1, "active", /*selectedId*/ ctx[5] === getDateUID_1(/*days*/ ctx[1][0], "week")); + } + }, + i(local) { + if (current) return; + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div1); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} + +function create_fragment$1(ctx) { + let td; + let metadataresolver; + let current; + + metadataresolver = new MetadataResolver({ + props: { + metadata: /*metadata*/ ctx[6], + $$slots: { + default: [ + create_default_slot, + ({ metadata }) => ({ 6: metadata }), + ({ metadata }) => metadata ? 64 : 0 + ] + }, + $$scope: { ctx } + } + }); + + return { + c() { + td = element("td"); + create_component(metadataresolver.$$.fragment); + attr(td, "class", "svelte-egt0yd"); + }, + m(target, anchor) { + insert(target, td, anchor); + mount_component(metadataresolver, td, null); + current = true; + }, + p(ctx, [dirty]) { + const metadataresolver_changes = {}; + if (dirty & /*metadata*/ 64) metadataresolver_changes.metadata = /*metadata*/ ctx[6]; + + if (dirty & /*$$scope, metadata, selectedId, days, onClick, startOfWeek, onContextMenu, onHover, weekNum*/ 16639) { + metadataresolver_changes.$$scope = { dirty, ctx }; + } + + metadataresolver.$set(metadataresolver_changes); + }, + i(local) { + if (current) return; + transition_in(metadataresolver.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(metadataresolver.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(td); + destroy_component(metadataresolver); + } + }; +} + +function instance$1($$self, $$props, $$invalidate) { + + + let { weekNum } = $$props; + let { days } = $$props; + let { metadata } = $$props; + let { onHover } = $$props; + let { onClick } = $$props; + let { onContextMenu } = $$props; + let { selectedId = null } = $$props; + let startOfWeek; + const click_handler = e => onClick(startOfWeek, isMetaPressed(e)); + const contextmenu_handler = e => onContextMenu(days[0], e); + const pointerover_handler = e => onHover(startOfWeek, e.target, isMetaPressed(e)); + + $$self.$$set = $$props => { + if ("weekNum" in $$props) $$invalidate(0, weekNum = $$props.weekNum); + if ("days" in $$props) $$invalidate(1, days = $$props.days); + if ("metadata" in $$props) $$invalidate(6, metadata = $$props.metadata); + if ("onHover" in $$props) $$invalidate(2, onHover = $$props.onHover); + if ("onClick" in $$props) $$invalidate(3, onClick = $$props.onClick); + if ("onContextMenu" in $$props) $$invalidate(4, onContextMenu = $$props.onContextMenu); + if ("selectedId" in $$props) $$invalidate(5, selectedId = $$props.selectedId); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*days*/ 2) { + $$invalidate(7, startOfWeek = getStartOfWeek(days)); + } + }; + + return [ + weekNum, + days, + onHover, + onClick, + onContextMenu, + selectedId, + metadata, + startOfWeek, + click_handler, + contextmenu_handler, + pointerover_handler + ]; +} + +class WeekNum extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-egt0yd-style")) add_css$1(); + + init(this, options, instance$1, create_fragment$1, not_equal, { + weekNum: 0, + days: 1, + metadata: 6, + onHover: 2, + onClick: 3, + onContextMenu: 4, + selectedId: 5 + }); + } +} + +async function metadataReducer(promisedMetadata) { + const meta = { + dots: [], + classes: [], + dataAttributes: {}, + }; + const metas = await Promise.all(promisedMetadata); + return metas.reduce((acc, meta) => ({ + classes: [...acc.classes, ...(meta.classes || [])], + dataAttributes: Object.assign(acc.dataAttributes, meta.dataAttributes), + dots: [...acc.dots, ...(meta.dots || [])], + }), meta); +} +function getDailyMetadata(sources, date, ..._args) { + return metadataReducer(sources.map((source) => source.getDailyMetadata(date))); +} +function getWeeklyMetadata(sources, date, ..._args) { + return metadataReducer(sources.map((source) => source.getWeeklyMetadata(date))); +} + +/* src/components/Calendar.svelte generated by Svelte v3.35.0 */ + +function add_css() { + var style = element("style"); + style.id = "svelte-pcimu8-style"; + style.textContent = ".container.svelte-pcimu8{--color-background-heading:transparent;--color-background-day:transparent;--color-background-weeknum:transparent;--color-background-weekend:transparent;--color-dot:var(--text-muted);--color-arrow:var(--text-muted);--color-button:var(--text-muted);--color-text-title:var(--text-normal);--color-text-heading:var(--text-muted);--color-text-day:var(--text-normal);--color-text-today:var(--interactive-accent);--color-text-weeknum:var(--text-muted)}.container.svelte-pcimu8{padding:0 8px}.container.is-mobile.svelte-pcimu8{padding:0}th.svelte-pcimu8{text-align:center}.weekend.svelte-pcimu8{background-color:var(--color-background-weekend)}.calendar.svelte-pcimu8{border-collapse:collapse;width:100%}th.svelte-pcimu8{background-color:var(--color-background-heading);color:var(--color-text-heading);font-size:0.6em;letter-spacing:1px;padding:4px;text-transform:uppercase}"; + append(document.head, style); +} + +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[18] = list[i]; + return child_ctx; +} + +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[21] = list[i]; + return child_ctx; +} + +function get_each_context_2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[24] = list[i]; + return child_ctx; +} + +function get_each_context_3(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[27] = list[i]; + return child_ctx; +} + +// (55:6) {#if showWeekNums} +function create_if_block_2(ctx) { + let col; + + return { + c() { + col = element("col"); + }, + m(target, anchor) { + insert(target, col, anchor); + }, + d(detaching) { + if (detaching) detach(col); + } + }; +} + +// (58:6) {#each month[1].days as date} +function create_each_block_3(ctx) { + let col; + + return { + c() { + col = element("col"); + attr(col, "class", "svelte-pcimu8"); + toggle_class(col, "weekend", isWeekend(/*date*/ ctx[27])); + }, + m(target, anchor) { + insert(target, col, anchor); + }, + p(ctx, dirty) { + if (dirty & /*isWeekend, month*/ 16384) { + toggle_class(col, "weekend", isWeekend(/*date*/ ctx[27])); + } + }, + d(detaching) { + if (detaching) detach(col); + } + }; +} + +// (64:8) {#if showWeekNums} +function create_if_block_1(ctx) { + let th; + + return { + c() { + th = element("th"); + th.textContent = "W"; + attr(th, "class", "svelte-pcimu8"); + }, + m(target, anchor) { + insert(target, th, anchor); + }, + d(detaching) { + if (detaching) detach(th); + } + }; +} + +// (67:8) {#each daysOfWeek as dayOfWeek} +function create_each_block_2(ctx) { + let th; + let t_value = /*dayOfWeek*/ ctx[24] + ""; + let t; + + return { + c() { + th = element("th"); + t = text(t_value); + attr(th, "class", "svelte-pcimu8"); + }, + m(target, anchor) { + insert(target, th, anchor); + append(th, t); + }, + p(ctx, dirty) { + if (dirty & /*daysOfWeek*/ 32768 && t_value !== (t_value = /*dayOfWeek*/ ctx[24] + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) detach(th); + } + }; +} + +// (75:10) {#if showWeekNums} +function create_if_block(ctx) { + let weeknum; + let current; + + const weeknum_spread_levels = [ + /*week*/ ctx[18], + { + metadata: getWeeklyMetadata(/*sources*/ ctx[8], /*week*/ ctx[18].days[0], /*today*/ ctx[10]) + }, + { onClick: /*onClickWeek*/ ctx[7] }, + { + onContextMenu: /*onContextMenuWeek*/ ctx[5] + }, + { onHover: /*onHoverWeek*/ ctx[3] }, + { selectedId: /*selectedId*/ ctx[9] } + ]; + + let weeknum_props = {}; + + for (let i = 0; i < weeknum_spread_levels.length; i += 1) { + weeknum_props = assign(weeknum_props, weeknum_spread_levels[i]); + } + + weeknum = new WeekNum({ props: weeknum_props }); + + return { + c() { + create_component(weeknum.$$.fragment); + }, + m(target, anchor) { + mount_component(weeknum, target, anchor); + current = true; + }, + p(ctx, dirty) { + const weeknum_changes = (dirty & /*month, getWeeklyMetadata, sources, today, onClickWeek, onContextMenuWeek, onHoverWeek, selectedId*/ 18344) + ? get_spread_update(weeknum_spread_levels, [ + dirty & /*month*/ 16384 && get_spread_object(/*week*/ ctx[18]), + dirty & /*getWeeklyMetadata, sources, month, today*/ 17664 && { + metadata: getWeeklyMetadata(/*sources*/ ctx[8], /*week*/ ctx[18].days[0], /*today*/ ctx[10]) + }, + dirty & /*onClickWeek*/ 128 && { onClick: /*onClickWeek*/ ctx[7] }, + dirty & /*onContextMenuWeek*/ 32 && { + onContextMenu: /*onContextMenuWeek*/ ctx[5] + }, + dirty & /*onHoverWeek*/ 8 && { onHover: /*onHoverWeek*/ ctx[3] }, + dirty & /*selectedId*/ 512 && { selectedId: /*selectedId*/ ctx[9] } + ]) + : {}; + + weeknum.$set(weeknum_changes); + }, + i(local) { + if (current) return; + transition_in(weeknum.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(weeknum.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(weeknum, detaching); + } + }; +} + +// (85:10) {#each week.days as day (day.format())} +function create_each_block_1(key_1, ctx) { + let first; + let day; + let current; + + day = new Day({ + props: { + date: /*day*/ ctx[21], + today: /*today*/ ctx[10], + displayedMonth: /*displayedMonth*/ ctx[0], + onClick: /*onClickDay*/ ctx[6], + onContextMenu: /*onContextMenuDay*/ ctx[4], + onHover: /*onHoverDay*/ ctx[2], + metadata: getDailyMetadata(/*sources*/ ctx[8], /*day*/ ctx[21], /*today*/ ctx[10]), + selectedId: /*selectedId*/ ctx[9] + } + }); + + return { + key: key_1, + first: null, + c() { + first = empty(); + create_component(day.$$.fragment); + this.first = first; + }, + m(target, anchor) { + insert(target, first, anchor); + mount_component(day, target, anchor); + current = true; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const day_changes = {}; + if (dirty & /*month*/ 16384) day_changes.date = /*day*/ ctx[21]; + if (dirty & /*today*/ 1024) day_changes.today = /*today*/ ctx[10]; + if (dirty & /*displayedMonth*/ 1) day_changes.displayedMonth = /*displayedMonth*/ ctx[0]; + if (dirty & /*onClickDay*/ 64) day_changes.onClick = /*onClickDay*/ ctx[6]; + if (dirty & /*onContextMenuDay*/ 16) day_changes.onContextMenu = /*onContextMenuDay*/ ctx[4]; + if (dirty & /*onHoverDay*/ 4) day_changes.onHover = /*onHoverDay*/ ctx[2]; + if (dirty & /*sources, month, today*/ 17664) day_changes.metadata = getDailyMetadata(/*sources*/ ctx[8], /*day*/ ctx[21], /*today*/ ctx[10]); + if (dirty & /*selectedId*/ 512) day_changes.selectedId = /*selectedId*/ ctx[9]; + day.$set(day_changes); + }, + i(local) { + if (current) return; + transition_in(day.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(day.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) detach(first); + destroy_component(day, detaching); + } + }; +} + +// (73:6) {#each month as week (week.weekNum)} +function create_each_block(key_1, ctx) { + let tr; + let t0; + let each_blocks = []; + let each_1_lookup = new Map(); + let t1; + let current; + let if_block = /*showWeekNums*/ ctx[1] && create_if_block(ctx); + let each_value_1 = /*week*/ ctx[18].days; + const get_key = ctx => /*day*/ ctx[21].format(); + + for (let i = 0; i < each_value_1.length; i += 1) { + let child_ctx = get_each_context_1(ctx, each_value_1, i); + let key = get_key(child_ctx); + each_1_lookup.set(key, each_blocks[i] = create_each_block_1(key, child_ctx)); + } + + return { + key: key_1, + first: null, + c() { + tr = element("tr"); + if (if_block) if_block.c(); + t0 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + t1 = space(); + this.first = tr; + }, + m(target, anchor) { + insert(target, tr, anchor); + if (if_block) if_block.m(tr, null); + append(tr, t0); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tr, null); + } + + append(tr, t1); + current = true; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + + if (/*showWeekNums*/ ctx[1]) { + if (if_block) { + if_block.p(ctx, dirty); + + if (dirty & /*showWeekNums*/ 2) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx); + if_block.c(); + transition_in(if_block, 1); + if_block.m(tr, t0); + } + } else if (if_block) { + group_outros(); + + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + + check_outros(); + } + + if (dirty & /*month, today, displayedMonth, onClickDay, onContextMenuDay, onHoverDay, getDailyMetadata, sources, selectedId*/ 18261) { + each_value_1 = /*week*/ ctx[18].days; + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value_1, each_1_lookup, tr, outro_and_destroy_block, create_each_block_1, t1, get_each_context_1); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + + for (let i = 0; i < each_value_1.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + transition_out(if_block); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(tr); + if (if_block) if_block.d(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + } + }; +} + +function create_fragment$7(ctx) { + let div; + let nav; + let t0; + let table; + let colgroup; + let t1; + let t2; + let thead; + let tr; + let t3; + let t4; + let tbody; + let each_blocks = []; + let each2_lookup = new Map(); + let current; + + nav = new Nav({ + props: { + today: /*today*/ ctx[10], + displayedMonth: /*displayedMonth*/ ctx[0], + incrementDisplayedMonth: /*incrementDisplayedMonth*/ ctx[11], + decrementDisplayedMonth: /*decrementDisplayedMonth*/ ctx[12], + resetDisplayedMonth: /*resetDisplayedMonth*/ ctx[13] + } + }); + + let if_block0 = /*showWeekNums*/ ctx[1] && create_if_block_2(); + let each_value_3 = /*month*/ ctx[14][1].days; + let each_blocks_2 = []; + + for (let i = 0; i < each_value_3.length; i += 1) { + each_blocks_2[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i)); + } + + let if_block1 = /*showWeekNums*/ ctx[1] && create_if_block_1(); + let each_value_2 = /*daysOfWeek*/ ctx[15]; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks_1[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); + } + + let each_value = /*month*/ ctx[14]; + const get_key = ctx => /*week*/ ctx[18].weekNum; + + for (let i = 0; i < each_value.length; i += 1) { + let child_ctx = get_each_context(ctx, each_value, i); + let key = get_key(child_ctx); + each2_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); + } + + return { + c() { + div = element("div"); + create_component(nav.$$.fragment); + t0 = space(); + table = element("table"); + colgroup = element("colgroup"); + if (if_block0) if_block0.c(); + t1 = space(); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].c(); + } + + t2 = space(); + thead = element("thead"); + tr = element("tr"); + if (if_block1) if_block1.c(); + t3 = space(); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + t4 = space(); + tbody = element("tbody"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(table, "class", "calendar svelte-pcimu8"); + attr(div, "id", "calendar-container"); + attr(div, "class", "container svelte-pcimu8"); + toggle_class(div, "is-mobile", /*isMobile*/ ctx[16]); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(nav, div, null); + append(div, t0); + append(div, table); + append(table, colgroup); + if (if_block0) if_block0.m(colgroup, null); + append(colgroup, t1); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].m(colgroup, null); + } + + append(table, t2); + append(table, thead); + append(thead, tr); + if (if_block1) if_block1.m(tr, null); + append(tr, t3); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(tr, null); + } + + append(table, t4); + append(table, tbody); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tbody, null); + } + + current = true; + }, + p(ctx, [dirty]) { + const nav_changes = {}; + if (dirty & /*today*/ 1024) nav_changes.today = /*today*/ ctx[10]; + if (dirty & /*displayedMonth*/ 1) nav_changes.displayedMonth = /*displayedMonth*/ ctx[0]; + nav.$set(nav_changes); + + if (/*showWeekNums*/ ctx[1]) { + if (if_block0) ; else { + if_block0 = create_if_block_2(); + if_block0.c(); + if_block0.m(colgroup, t1); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + + if (dirty & /*isWeekend, month*/ 16384) { + each_value_3 = /*month*/ ctx[14][1].days; + let i; + + for (i = 0; i < each_value_3.length; i += 1) { + const child_ctx = get_each_context_3(ctx, each_value_3, i); + + if (each_blocks_2[i]) { + each_blocks_2[i].p(child_ctx, dirty); + } else { + each_blocks_2[i] = create_each_block_3(child_ctx); + each_blocks_2[i].c(); + each_blocks_2[i].m(colgroup, null); + } + } + + for (; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].d(1); + } + + each_blocks_2.length = each_value_3.length; + } + + if (/*showWeekNums*/ ctx[1]) { + if (if_block1) ; else { + if_block1 = create_if_block_1(); + if_block1.c(); + if_block1.m(tr, t3); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if (dirty & /*daysOfWeek*/ 32768) { + each_value_2 = /*daysOfWeek*/ ctx[15]; + let i; + + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2(ctx, each_value_2, i); + + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_2(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(tr, null); + } + } + + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + + each_blocks_1.length = each_value_2.length; + } + + if (dirty & /*month, today, displayedMonth, onClickDay, onContextMenuDay, onHoverDay, getDailyMetadata, sources, selectedId, getWeeklyMetadata, onClickWeek, onContextMenuWeek, onHoverWeek, showWeekNums*/ 18431) { + each_value = /*month*/ ctx[14]; + group_outros(); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each2_lookup, tbody, outro_and_destroy_block, create_each_block, null, get_each_context); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(nav.$$.fragment, local); + + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + + current = true; + }, + o(local) { + transition_out(nav.$$.fragment, local); + + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + + current = false; + }, + d(detaching) { + if (detaching) detach(div); + destroy_component(nav); + if (if_block0) if_block0.d(); + destroy_each(each_blocks_2, detaching); + if (if_block1) if_block1.d(); + destroy_each(each_blocks_1, detaching); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + } + }; +} + +function instance$7($$self, $$props, $$invalidate) { + + + let { localeData } = $$props; + let { showWeekNums = false } = $$props; + let { onHoverDay } = $$props; + let { onHoverWeek } = $$props; + let { onContextMenuDay } = $$props; + let { onContextMenuWeek } = $$props; + let { onClickDay } = $$props; + let { onClickWeek } = $$props; + let { sources = [] } = $$props; + let { selectedId } = $$props; + let { today = window.moment() } = $$props; + let { displayedMonth = today } = $$props; + let month; + let daysOfWeek; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let isMobile = window.app.isMobile; + + function incrementDisplayedMonth() { + $$invalidate(0, displayedMonth = displayedMonth.clone().add(1, "month")); + } + + function decrementDisplayedMonth() { + $$invalidate(0, displayedMonth = displayedMonth.clone().subtract(1, "month")); + } + + function resetDisplayedMonth() { + $$invalidate(0, displayedMonth = today.clone()); + } + + $$self.$$set = $$props => { + if ("localeData" in $$props) $$invalidate(17, localeData = $$props.localeData); + if ("showWeekNums" in $$props) $$invalidate(1, showWeekNums = $$props.showWeekNums); + if ("onHoverDay" in $$props) $$invalidate(2, onHoverDay = $$props.onHoverDay); + if ("onHoverWeek" in $$props) $$invalidate(3, onHoverWeek = $$props.onHoverWeek); + if ("onContextMenuDay" in $$props) $$invalidate(4, onContextMenuDay = $$props.onContextMenuDay); + if ("onContextMenuWeek" in $$props) $$invalidate(5, onContextMenuWeek = $$props.onContextMenuWeek); + if ("onClickDay" in $$props) $$invalidate(6, onClickDay = $$props.onClickDay); + if ("onClickWeek" in $$props) $$invalidate(7, onClickWeek = $$props.onClickWeek); + if ("sources" in $$props) $$invalidate(8, sources = $$props.sources); + if ("selectedId" in $$props) $$invalidate(9, selectedId = $$props.selectedId); + if ("today" in $$props) $$invalidate(10, today = $$props.today); + if ("displayedMonth" in $$props) $$invalidate(0, displayedMonth = $$props.displayedMonth); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*displayedMonth, localeData*/ 131073) { + $$invalidate(14, month = getMonth(displayedMonth, localeData)); + } + + if ($$self.$$.dirty & /*today, localeData*/ 132096) { + $$invalidate(15, daysOfWeek = getDaysOfWeek(today, localeData)); + } + }; + + return [ + displayedMonth, + showWeekNums, + onHoverDay, + onHoverWeek, + onContextMenuDay, + onContextMenuWeek, + onClickDay, + onClickWeek, + sources, + selectedId, + today, + incrementDisplayedMonth, + decrementDisplayedMonth, + resetDisplayedMonth, + month, + daysOfWeek, + isMobile, + localeData + ]; +} + +class Calendar$1 extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-pcimu8-style")) add_css(); + + init(this, options, instance$7, create_fragment$7, not_equal, { + localeData: 17, + showWeekNums: 1, + onHoverDay: 2, + onHoverWeek: 3, + onContextMenuDay: 4, + onContextMenuWeek: 5, + onClickDay: 6, + onClickWeek: 7, + sources: 8, + selectedId: 9, + today: 10, + displayedMonth: 0, + incrementDisplayedMonth: 11, + decrementDisplayedMonth: 12, + resetDisplayedMonth: 13 + }); + } + + get incrementDisplayedMonth() { + return this.$$.ctx[11]; + } + + get decrementDisplayedMonth() { + return this.$$.ctx[12]; + } + + get resetDisplayedMonth() { + return this.$$.ctx[13]; + } +} + +const langToMomentLocale = { + en: "en-gb", + zh: "zh-cn", + "zh-TW": "zh-tw", + ru: "ru", + ko: "ko", + it: "it", + id: "id", + ro: "ro", + "pt-BR": "pt-br", + cz: "cs", + da: "da", + de: "de", + es: "es", + fr: "fr", + no: "nn", + pl: "pl", + pt: "pt", + tr: "tr", + hi: "hi", + nl: "nl", + ar: "ar", + ja: "ja", +}; +const weekdays = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", +]; +function overrideGlobalMomentWeekStart(weekStart) { + const { moment } = window; + const currentLocale = moment.locale(); + // Save the initial locale weekspec so that we can restore + // it when toggling between the different options in settings. + if (!window._bundledLocaleWeekSpec) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + window._bundledLocaleWeekSpec = moment.localeData()._week; + } + if (weekStart === "locale") { + moment.updateLocale(currentLocale, { + week: window._bundledLocaleWeekSpec, + }); + } + else { + moment.updateLocale(currentLocale, { + week: { + dow: weekdays.indexOf(weekStart) || 0, + }, + }); + } +} +/** + * Sets the locale used by the calendar. This allows the calendar to + * default to the user's locale (e.g. Start Week on Sunday/Monday/Friday) + * + * @param localeOverride locale string (e.g. "en-US") + */ +function configureGlobalMomentLocale(localeOverride = "system-default", weekStart = "locale") { + var _a; + const obsidianLang = localStorage.getItem("language") || "en"; + const systemLang = (_a = navigator.language) === null || _a === void 0 ? void 0 : _a.toLowerCase(); + let momentLocale = langToMomentLocale[obsidianLang]; + if (localeOverride !== "system-default") { + momentLocale = localeOverride; + } + else if (systemLang.startsWith(obsidianLang)) { + // If the system locale is more specific (en-gb vs en), use the system locale. + momentLocale = systemLang; + } + const currentLocale = window.moment.locale(momentLocale); + console.debug(`[Calendar] Trying to switch Moment.js global locale to ${momentLocale}, got ${currentLocale}`); + overrideGlobalMomentWeekStart(weekStart); + return currentLocale; +} + +/* src/ui/Calendar.svelte generated by Svelte v3.35.0 */ + +function create_fragment(ctx) { + let calendarbase; + let updating_displayedMonth; + let current; + + function calendarbase_displayedMonth_binding(value) { + /*calendarbase_displayedMonth_binding*/ ctx[12](value); + } + + let calendarbase_props = { + sources: /*sources*/ ctx[1], + today: /*today*/ ctx[9], + onHoverDay: /*onHoverDay*/ ctx[2], + onHoverWeek: /*onHoverWeek*/ ctx[3], + onContextMenuDay: /*onContextMenuDay*/ ctx[6], + onContextMenuWeek: /*onContextMenuWeek*/ ctx[7], + onClickDay: /*onClickDay*/ ctx[4], + onClickWeek: /*onClickWeek*/ ctx[5], + localeData: /*today*/ ctx[9].localeData(), + selectedId: /*$activeFile*/ ctx[10], + showWeekNums: /*$settings*/ ctx[8].showWeeklyNote + }; + + if (/*displayedMonth*/ ctx[0] !== void 0) { + calendarbase_props.displayedMonth = /*displayedMonth*/ ctx[0]; + } + + calendarbase = new Calendar$1({ props: calendarbase_props }); + binding_callbacks$1.push(() => bind(calendarbase, "displayedMonth", calendarbase_displayedMonth_binding)); + + return { + c() { + create_component$1(calendarbase.$$.fragment); + }, + m(target, anchor) { + mount_component$1(calendarbase, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const calendarbase_changes = {}; + if (dirty & /*sources*/ 2) calendarbase_changes.sources = /*sources*/ ctx[1]; + if (dirty & /*today*/ 512) calendarbase_changes.today = /*today*/ ctx[9]; + if (dirty & /*onHoverDay*/ 4) calendarbase_changes.onHoverDay = /*onHoverDay*/ ctx[2]; + if (dirty & /*onHoverWeek*/ 8) calendarbase_changes.onHoverWeek = /*onHoverWeek*/ ctx[3]; + if (dirty & /*onContextMenuDay*/ 64) calendarbase_changes.onContextMenuDay = /*onContextMenuDay*/ ctx[6]; + if (dirty & /*onContextMenuWeek*/ 128) calendarbase_changes.onContextMenuWeek = /*onContextMenuWeek*/ ctx[7]; + if (dirty & /*onClickDay*/ 16) calendarbase_changes.onClickDay = /*onClickDay*/ ctx[4]; + if (dirty & /*onClickWeek*/ 32) calendarbase_changes.onClickWeek = /*onClickWeek*/ ctx[5]; + if (dirty & /*today*/ 512) calendarbase_changes.localeData = /*today*/ ctx[9].localeData(); + if (dirty & /*$activeFile*/ 1024) calendarbase_changes.selectedId = /*$activeFile*/ ctx[10]; + if (dirty & /*$settings*/ 256) calendarbase_changes.showWeekNums = /*$settings*/ ctx[8].showWeeklyNote; + + if (!updating_displayedMonth && dirty & /*displayedMonth*/ 1) { + updating_displayedMonth = true; + calendarbase_changes.displayedMonth = /*displayedMonth*/ ctx[0]; + add_flush_callback(() => updating_displayedMonth = false); + } + + calendarbase.$set(calendarbase_changes); + }, + i(local) { + if (current) return; + transition_in$1(calendarbase.$$.fragment, local); + current = true; + }, + o(local) { + transition_out$1(calendarbase.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component$1(calendarbase, detaching); + } + }; +} + +function instance($$self, $$props, $$invalidate) { + let $settings; + let $activeFile; + component_subscribe($$self, settings, $$value => $$invalidate(8, $settings = $$value)); + component_subscribe($$self, activeFile, $$value => $$invalidate(10, $activeFile = $$value)); + + + let today; + let { displayedMonth = today } = $$props; + let { sources } = $$props; + let { onHoverDay } = $$props; + let { onHoverWeek } = $$props; + let { onClickDay } = $$props; + let { onClickWeek } = $$props; + let { onContextMenuDay } = $$props; + let { onContextMenuWeek } = $$props; + + function tick() { + $$invalidate(9, today = window.moment()); + } + + function getToday(settings) { + configureGlobalMomentLocale(settings.localeOverride, settings.weekStart); + dailyNotes.reindex(); + weeklyNotes.reindex(); + return window.moment(); + } + + // 1 minute heartbeat to keep `today` reflecting the current day + let heartbeat = setInterval( + () => { + tick(); + const isViewingCurrentMonth = displayedMonth.isSame(today, "day"); + + if (isViewingCurrentMonth) { + // if it's midnight on the last day of the month, this will + // update the display to show the new month. + $$invalidate(0, displayedMonth = today); + } + }, + 1000 * 60 + ); + + onDestroy(() => { + clearInterval(heartbeat); + }); + + function calendarbase_displayedMonth_binding(value) { + displayedMonth = value; + $$invalidate(0, displayedMonth); + } + + $$self.$$set = $$props => { + if ("displayedMonth" in $$props) $$invalidate(0, displayedMonth = $$props.displayedMonth); + if ("sources" in $$props) $$invalidate(1, sources = $$props.sources); + if ("onHoverDay" in $$props) $$invalidate(2, onHoverDay = $$props.onHoverDay); + if ("onHoverWeek" in $$props) $$invalidate(3, onHoverWeek = $$props.onHoverWeek); + if ("onClickDay" in $$props) $$invalidate(4, onClickDay = $$props.onClickDay); + if ("onClickWeek" in $$props) $$invalidate(5, onClickWeek = $$props.onClickWeek); + if ("onContextMenuDay" in $$props) $$invalidate(6, onContextMenuDay = $$props.onContextMenuDay); + if ("onContextMenuWeek" in $$props) $$invalidate(7, onContextMenuWeek = $$props.onContextMenuWeek); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$settings*/ 256) { + $$invalidate(9, today = getToday($settings)); + } + }; + + return [ + displayedMonth, + sources, + onHoverDay, + onHoverWeek, + onClickDay, + onClickWeek, + onContextMenuDay, + onContextMenuWeek, + $settings, + today, + $activeFile, + tick, + calendarbase_displayedMonth_binding + ]; +} + +class Calendar extends SvelteComponent$1 { + constructor(options) { + super(); + + init$1(this, options, instance, create_fragment, not_equal$1, { + displayedMonth: 0, + sources: 1, + onHoverDay: 2, + onHoverWeek: 3, + onClickDay: 4, + onClickWeek: 5, + onContextMenuDay: 6, + onContextMenuWeek: 7, + tick: 11 + }); + } + + get tick() { + return this.$$.ctx[11]; + } +} + +function showFileMenu(app, file, position) { + const fileMenu = new obsidian.Menu(app); + fileMenu.addItem((item) => item + .setTitle("Delete") + .setIcon("trash") + .onClick(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + app.fileManager.promptForFileDeletion(file); + })); + app.workspace.trigger("file-menu", fileMenu, file, "calendar-context-menu", null); + fileMenu.showAtPosition(position); +} + +const getStreakClasses = (file) => { + return classList({ + "has-note": !!file, + }); +}; +const streakSource = { + getDailyMetadata: async (date) => { + const file = getDailyNote_1(date, get_store_value(dailyNotes)); + return { + classes: getStreakClasses(file), + dots: [], + }; + }, + getWeeklyMetadata: async (date) => { + const file = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + return { + classes: getStreakClasses(file), + dots: [], + }; + }, +}; + +function getNoteTags(note) { + var _a; + if (!note) { + return []; + } + const { metadataCache } = window.app; + const frontmatter = (_a = metadataCache.getFileCache(note)) === null || _a === void 0 ? void 0 : _a.frontmatter; + const tags = []; + if (frontmatter) { + const frontmatterTags = obsidian.parseFrontMatterTags(frontmatter) || []; + tags.push(...frontmatterTags); + } + // strip the '#' at the beginning + return tags.map((tag) => tag.substring(1)); +} +function getFormattedTagAttributes(note) { + const attrs = {}; + const tags = getNoteTags(note); + const [emojiTags, nonEmojiTags] = partition(tags, (tag) => /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/.test(tag)); + if (nonEmojiTags) { + attrs["data-tags"] = nonEmojiTags.join(" "); + } + if (emojiTags) { + attrs["data-emoji-tag"] = emojiTags[0]; + } + return attrs; +} +const customTagsSource = { + getDailyMetadata: async (date) => { + const file = getDailyNote_1(date, get_store_value(dailyNotes)); + return { + dataAttributes: getFormattedTagAttributes(file), + dots: [], + }; + }, + getWeeklyMetadata: async (date) => { + const file = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + return { + dataAttributes: getFormattedTagAttributes(file), + dots: [], + }; + }, +}; + +async function getNumberOfRemainingTasks(note) { + if (!note) { + return 0; + } + const { vault } = window.app; + const fileContents = await vault.cachedRead(note); + return (fileContents.match(/(-|\*) \[ \]/g) || []).length; +} +async function getDotsForDailyNote$1(dailyNote) { + if (!dailyNote) { + return []; + } + const numTasks = await getNumberOfRemainingTasks(dailyNote); + const dots = []; + if (numTasks) { + dots.push({ + className: "task", + color: "default", + isFilled: false, + }); + } + return dots; +} +const tasksSource = { + getDailyMetadata: async (date) => { + const file = getDailyNote_1(date, get_store_value(dailyNotes)); + const dots = await getDotsForDailyNote$1(file); + return { + dots, + }; + }, + getWeeklyMetadata: async (date) => { + const file = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + const dots = await getDotsForDailyNote$1(file); + return { + dots, + }; + }, +}; + +const NUM_MAX_DOTS = 5; +async function getWordLengthAsDots(note) { + const { wordsPerDot = DEFAULT_WORDS_PER_DOT } = get_store_value(settings); + if (!note || wordsPerDot <= 0) { + return 0; + } + const fileContents = await window.app.vault.cachedRead(note); + const wordCount = getWordCount(fileContents); + const numDots = wordCount / wordsPerDot; + return clamp(Math.floor(numDots), 1, NUM_MAX_DOTS); +} +async function getDotsForDailyNote(dailyNote) { + if (!dailyNote) { + return []; + } + const numSolidDots = await getWordLengthAsDots(dailyNote); + const dots = []; + for (let i = 0; i < numSolidDots; i++) { + dots.push({ + color: "default", + isFilled: true, + }); + } + return dots; +} +const wordCountSource = { + getDailyMetadata: async (date) => { + const file = getDailyNote_1(date, get_store_value(dailyNotes)); + const dots = await getDotsForDailyNote(file); + return { + dots, + }; + }, + getWeeklyMetadata: async (date) => { + const file = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + const dots = await getDotsForDailyNote(file); + return { + dots, + }; + }, +}; + +class CalendarView extends obsidian.ItemView { + constructor(leaf) { + super(leaf); + this.openOrCreateDailyNote = this.openOrCreateDailyNote.bind(this); + this.openOrCreateWeeklyNote = this.openOrCreateWeeklyNote.bind(this); + this.onNoteSettingsUpdate = this.onNoteSettingsUpdate.bind(this); + this.onFileCreated = this.onFileCreated.bind(this); + this.onFileDeleted = this.onFileDeleted.bind(this); + this.onFileModified = this.onFileModified.bind(this); + this.onFileOpen = this.onFileOpen.bind(this); + this.onHoverDay = this.onHoverDay.bind(this); + this.onHoverWeek = this.onHoverWeek.bind(this); + this.onContextMenuDay = this.onContextMenuDay.bind(this); + this.onContextMenuWeek = this.onContextMenuWeek.bind(this); + this.registerEvent( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.app.workspace.on("periodic-notes:settings-updated", this.onNoteSettingsUpdate)); + 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", this.onFileModified)); + this.registerEvent(this.app.workspace.on("file-open", this.onFileOpen)); + this.settings = null; + settings.subscribe((val) => { + this.settings = val; + // Refresh the calendar if settings change + if (this.calendar) { + this.calendar.tick(); + } + }); + } + getViewType() { + return VIEW_TYPE_CALENDAR; + } + getDisplayText() { + return "Calendar"; + } + getIcon() { + return "calendar-with-checkmark"; + } + onClose() { + if (this.calendar) { + this.calendar.$destroy(); + } + return Promise.resolve(); + } + async onOpen() { + // Integration point: external plugins can listen for `calendar:open` + // to feed in additional sources. + const sources = [ + customTagsSource, + streakSource, + wordCountSource, + tasksSource, + ]; + this.app.workspace.trigger(TRIGGER_ON_OPEN, sources); + this.calendar = new Calendar({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + target: this.contentEl, + props: { + onClickDay: this.openOrCreateDailyNote, + onClickWeek: this.openOrCreateWeeklyNote, + onHoverDay: this.onHoverDay, + onHoverWeek: this.onHoverWeek, + onContextMenuDay: this.onContextMenuDay, + onContextMenuWeek: this.onContextMenuWeek, + sources, + }, + }); + } + onHoverDay(date, targetEl, isMetaPressed) { + if (!isMetaPressed) { + return; + } + const { format } = getDailyNoteSettings_1(); + const note = getDailyNote_1(date, get_store_value(dailyNotes)); + this.app.workspace.trigger("link-hover", this, targetEl, date.format(format), note === null || note === void 0 ? void 0 : note.path); + } + onHoverWeek(date, targetEl, isMetaPressed) { + if (!isMetaPressed) { + return; + } + const note = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + const { format } = getWeeklyNoteSettings_1(); + this.app.workspace.trigger("link-hover", this, targetEl, date.format(format), note === null || note === void 0 ? void 0 : note.path); + } + onContextMenuDay(date, event) { + const note = getDailyNote_1(date, get_store_value(dailyNotes)); + if (!note) { + // If no file exists for a given day, show nothing. + return; + } + showFileMenu(this.app, note, { + x: event.pageX, + y: event.pageY, + }); + } + onContextMenuWeek(date, event) { + const note = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + if (!note) { + // If no file exists for a given day, show nothing. + return; + } + showFileMenu(this.app, note, { + x: event.pageX, + y: event.pageY, + }); + } + onNoteSettingsUpdate() { + dailyNotes.reindex(); + weeklyNotes.reindex(); + this.updateActiveFile(); + } + async onFileDeleted(file) { + if (getDateFromFile_1(file, "day")) { + dailyNotes.reindex(); + this.updateActiveFile(); + } + if (getDateFromFile_1(file, "week")) { + weeklyNotes.reindex(); + this.updateActiveFile(); + } + } + async onFileModified(file) { + const date = getDateFromFile_1(file, "day") || getDateFromFile_1(file, "week"); + if (date && this.calendar) { + this.calendar.tick(); + } + } + onFileCreated(file) { + if (this.app.workspace.layoutReady && this.calendar) { + if (getDateFromFile_1(file, "day")) { + dailyNotes.reindex(); + this.calendar.tick(); + } + if (getDateFromFile_1(file, "week")) { + weeklyNotes.reindex(); + this.calendar.tick(); + } + } + } + onFileOpen(_file) { + if (this.app.workspace.layoutReady) { + this.updateActiveFile(); + } + } + updateActiveFile() { + const { view } = this.app.workspace.activeLeaf; + let file = null; + if (view instanceof obsidian.FileView) { + file = view.file; + } + activeFile.setFile(file); + if (this.calendar) { + this.calendar.tick(); + } + } + revealActiveNote() { + const { moment } = window; + const { activeLeaf } = this.app.workspace; + if (activeLeaf.view instanceof obsidian.FileView) { + // Check to see if the active note is a daily-note + let date = getDateFromFile_1(activeLeaf.view.file, "day"); + if (date) { + this.calendar.$set({ displayedMonth: date }); + return; + } + // Check to see if the active note is a weekly-note + const { format } = getWeeklyNoteSettings_1(); + date = moment(activeLeaf.view.file.basename, format, true); + if (date.isValid()) { + this.calendar.$set({ displayedMonth: date }); + return; + } + } + } + async openOrCreateWeeklyNote(date, inNewSplit) { + const { workspace } = this.app; + const startOfWeek = date.clone().startOf("week"); + const existingFile = getWeeklyNote_1(date, get_store_value(weeklyNotes)); + if (!existingFile) { + // File doesn't exist + tryToCreateWeeklyNote(startOfWeek, inNewSplit, this.settings, (file) => { + activeFile.setFile(file); + }); + return; + } + const leaf = inNewSplit + ? workspace.splitActiveLeaf() + : workspace.getUnpinnedLeaf(); + await leaf.openFile(existingFile); + activeFile.setFile(existingFile); + } + async openOrCreateDailyNote(date, inNewSplit) { + const { workspace } = this.app; + const existingFile = getDailyNote_1(date, get_store_value(dailyNotes)); + if (!existingFile) { + // File doesn't exist + tryToCreateDailyNote(date, inNewSplit, this.settings, (dailyNote) => { + activeFile.setFile(dailyNote); + }); + return; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const mode = this.app.vault.getConfig("defaultViewMode"); + const leaf = inNewSplit + ? workspace.splitActiveLeaf() + : workspace.getUnpinnedLeaf(); + await leaf.openFile(existingFile, { mode }); + activeFile.setFile(existingFile); + } +} + +class CalendarPlugin extends obsidian.Plugin { + onunload() { + this.app.workspace + .getLeavesOfType(VIEW_TYPE_CALENDAR) + .forEach((leaf) => leaf.detach()); + } + async onload() { + this.register(settings.subscribe((value) => { + this.options = value; + })); + this.registerView(VIEW_TYPE_CALENDAR, (leaf) => (this.view = new CalendarView(leaf))); + this.addCommand({ + id: "show-calendar-view", + name: "Open view", + checkCallback: (checking) => { + if (checking) { + return (this.app.workspace.getLeavesOfType(VIEW_TYPE_CALENDAR).length === 0); + } + this.initLeaf(); + }, + }); + this.addCommand({ + id: "open-weekly-note", + name: "Open Weekly Note", + checkCallback: (checking) => { + if (checking) { + return !appHasPeriodicNotesPluginLoaded(); + } + this.view.openOrCreateWeeklyNote(window.moment(), false); + }, + }); + this.addCommand({ + id: "reveal-active-note", + name: "Reveal active note", + callback: () => this.view.revealActiveNote(), + }); + await this.loadOptions(); + this.addSettingTab(new CalendarSettingsTab(this.app, this)); + if (this.app.workspace.layoutReady) { + this.initLeaf(); + } + else { + this.registerEvent(this.app.workspace.on("layout-ready", this.initLeaf.bind(this))); + } + } + initLeaf() { + if (this.app.workspace.getLeavesOfType(VIEW_TYPE_CALENDAR).length) { + return; + } + this.app.workspace.getRightLeaf(false).setViewState({ + type: VIEW_TYPE_CALENDAR, + }); + } + async loadOptions() { + const options = await this.loadData(); + settings.update((old) => { + return Object.assign(Object.assign({}, old), (options || {})); + }); + await this.saveData(this.options); + } + async writeOptions(changeOpts) { + settings.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old)))); + await this.saveData(this.options); + } +} + +module.exports = CalendarPlugin; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/calendar/manifest.json b/.obsidian/plugins/calendar/manifest.json new file mode 100644 index 0000000..028bfa5 --- /dev/null +++ b/.obsidian/plugins/calendar/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "calendar", + "name": "Calendar", + "description": "Calendar view of your daily notes", + "version": "1.5.10", + "author": "Liam Cain", + "authorUrl": "https://github.com/liamcain/", + "isDesktopOnly": false, + "minAppVersion": "0.9.11" +} diff --git a/.obsidian/plugins/nldates-obsidian/data.json b/.obsidian/plugins/nldates-obsidian/data.json new file mode 100644 index 0000000..92bafeb --- /dev/null +++ b/.obsidian/plugins/nldates-obsidian/data.json @@ -0,0 +1,12 @@ +{ + "autosuggestToggleLink": true, + "autocompleteTriggerPhrase": "@", + "isAutosuggestEnabled": true, + "format": "YYYY-MM-DD, ddd", + "timeFormat": "HH:mm", + "separator": " ", + "weekStart": "monday", + "modalToggleTime": false, + "modalToggleLink": false, + "modalMomentFormat": "YYYY-MM-DD HH:mm" +} \ No newline at end of file diff --git a/.obsidian/plugins/nldates-obsidian/main.js b/.obsidian/plugins/nldates-obsidian/main.js new file mode 100644 index 0000000..39b7558 --- /dev/null +++ b/.obsidian/plugins/nldates-obsidian/main.js @@ -0,0 +1,9562 @@ +'use strict'; + +var require$$0$1 = require('obsidian'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var a = Object.defineProperty({}, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; +} + +var main = {}; + +Object.defineProperty(main, '__esModule', { value: true }); + +var obsidian = require$$0__default["default"]; + +const DEFAULT_DAILY_NOTE_FORMAT = "YYYY-MM-DD"; +const DEFAULT_WEEKLY_NOTE_FORMAT = "gggg-[W]ww"; +const DEFAULT_MONTHLY_NOTE_FORMAT = "YYYY-MM"; +const DEFAULT_QUARTERLY_NOTE_FORMAT = "YYYY-[Q]Q"; +const DEFAULT_YEARLY_NOTE_FORMAT = "YYYY"; + +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); + } +} +/** + * Read the user settings for the `periodic-notes` plugin + * to keep behavior of creating a new note in-sync. + */ +function getQuarterlyNoteSettings() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const pluginManager = window.app.plugins; + try { + const settings = (shouldUsePeriodicNotesSettings("quarterly") && + pluginManager.getPlugin("periodic-notes")?.settings?.quarterly) || + {}; + return { + format: settings.format || DEFAULT_QUARTERLY_NOTE_FORMAT, + folder: settings.folder?.trim() || "", + template: settings.template?.trim() || "", + }; + } + catch (err) { + console.info("No custom quarterly note settings found!", err); + } +} +/** + * Read the user settings for the `periodic-notes` plugin + * to keep behavior of creating a new note in-sync. + */ +function getYearlyNoteSettings() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const pluginManager = window.app.plugins; + try { + const settings = (shouldUsePeriodicNotesSettings("yearly") && + pluginManager.getPlugin("periodic-notes")?.settings?.yearly) || + {}; + return { + format: settings.format || DEFAULT_YEARLY_NOTE_FORMAT, + folder: settings.folder?.trim() || "", + template: settings.template?.trim() || "", + }; + } + catch (err) { + console.info("No custom yearly note settings found!", err); + } +} + +// 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("/"); +} +function basename(fullPath) { + let base = fullPath.substring(fullPath.lastIndexOf("/") + 1); + if (base.lastIndexOf(".") != -1) + base = base.substring(0, base.lastIndexOf(".")); + return base; +} +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.normalizePath(join(directory, filename)); + await ensureFolderExists(path); + return path; +} +async function getTemplateInfo(template) { + const { metadataCache, vault } = window.app; + const templatePath = obsidian.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.Notice("Failed to read the daily note template"); + return ["", null]; + } +} + +/** + * 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}`; +} +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) { + return getDateFromFilename(file.basename, granularity); +} +function getDateFromPath(path, granularity) { + return getDateFromFilename(basename(path), granularity); +} +function getDateFromFilename(filename, granularity) { + const getSettings = { + day: getDailyNoteSettings, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings, + }; + const format = getSettings[granularity]().format.split("/").pop(); + const noteDate = window.moment(filename, 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(filename, + // If format contains week, remove day & month formatting + format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), false); + } + } + } + return noteDate; +} + +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.Notice("Unable to create new file."); + } +} +function getDailyNote(date, dailyNotes) { + return dailyNotes[getDateUID(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.normalizePath(folder)); + if (!dailyNotesFolder) { + throw new DailyNotesFolderMissingError("Failed to find daily notes folder"); + } + const dailyNotes = {}; + obsidian.Vault.recurseChildren(dailyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "day"); + if (date) { + const dateString = getDateUID(date, "day"); + dailyNotes[dateString] = note; + } + } + }); + return dailyNotes; +} + +class WeeklyNotesFolderMissingError extends Error { +} +function getDaysOfWeek() { + 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().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.Notice("Unable to create new file."); + } +} +function getWeeklyNote(date, weeklyNotes) { + return weeklyNotes[getDateUID(date, "week")] ?? null; +} +function getAllWeeklyNotes() { + const weeklyNotes = {}; + if (!appHasWeeklyNotesPluginLoaded()) { + return weeklyNotes; + } + const { vault } = window.app; + const { folder } = getWeeklyNoteSettings(); + const weeklyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!weeklyNotesFolder) { + throw new WeeklyNotesFolderMissingError("Failed to find weekly notes folder"); + } + obsidian.Vault.recurseChildren(weeklyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "week"); + if (date) { + const dateString = getDateUID(date, "week"); + weeklyNotes[dateString] = note; + } + } + }); + return weeklyNotes; +} + +class MonthlyNotesFolderMissingError 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 createMonthlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getMonthlyNoteSettings(); + 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*date\s*}}/gi, filename) + .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")) + .replace(/{{\s*title\s*}}/gi, filename)); + // 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.Notice("Unable to create new file."); + } +} +function getMonthlyNote(date, monthlyNotes) { + return monthlyNotes[getDateUID(date, "month")] ?? null; +} +function getAllMonthlyNotes() { + const monthlyNotes = {}; + if (!appHasMonthlyNotesPluginLoaded()) { + return monthlyNotes; + } + const { vault } = window.app; + const { folder } = getMonthlyNoteSettings(); + const monthlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!monthlyNotesFolder) { + throw new MonthlyNotesFolderMissingError("Failed to find monthly notes folder"); + } + obsidian.Vault.recurseChildren(monthlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "month"); + if (date) { + const dateString = getDateUID(date, "month"); + monthlyNotes[dateString] = note; + } + } + }); + return monthlyNotes; +} + +class QuarterlyNotesFolderMissingError 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 createQuarterlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getQuarterlyNoteSettings(); + 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*date\s*}}/gi, filename) + .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")) + .replace(/{{\s*title\s*}}/gi, filename)); + // 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.Notice("Unable to create new file."); + } +} +function getQuarterlyNote(date, quarterly) { + return quarterly[getDateUID(date, "quarter")] ?? null; +} +function getAllQuarterlyNotes() { + const quarterly = {}; + if (!appHasQuarterlyNotesPluginLoaded()) { + return quarterly; + } + const { vault } = window.app; + const { folder } = getQuarterlyNoteSettings(); + const quarterlyFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!quarterlyFolder) { + throw new QuarterlyNotesFolderMissingError("Failed to find quarterly notes folder"); + } + obsidian.Vault.recurseChildren(quarterlyFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "quarter"); + if (date) { + const dateString = getDateUID(date, "quarter"); + quarterly[dateString] = note; + } + } + }); + return quarterly; +} + +class YearlyNotesFolderMissingError 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 createYearlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getYearlyNoteSettings(); + 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*date\s*}}/gi, filename) + .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")) + .replace(/{{\s*title\s*}}/gi, filename)); + // 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.Notice("Unable to create new file."); + } +} +function getYearlyNote(date, yearlyNotes) { + return yearlyNotes[getDateUID(date, "year")] ?? null; +} +function getAllYearlyNotes() { + const yearlyNotes = {}; + if (!appHasYearlyNotesPluginLoaded()) { + return yearlyNotes; + } + const { vault } = window.app; + const { folder } = getYearlyNoteSettings(); + const yearlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!yearlyNotesFolder) { + throw new YearlyNotesFolderMissingError("Failed to find yearly notes folder"); + } + obsidian.Vault.recurseChildren(yearlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "year"); + if (date) { + const dateString = getDateUID(date, "year"); + yearlyNotes[dateString] = note; + } + } + }); + return yearlyNotes; +} + +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; +} +/** + * XXX: "Weekly Notes" live in either the Calendar plugin or the periodic-notes plugin. + * Check both until the weekly notes feature is removed from the Calendar plugin. + */ +function appHasWeeklyNotesPluginLoaded() { + const { app } = window; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (app.plugins.getPlugin("calendar")) { + return true; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && periodicNotes.settings?.weekly?.enabled; +} +function appHasMonthlyNotesPluginLoaded() { + const { app } = window; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && periodicNotes.settings?.monthly?.enabled; +} +function appHasQuarterlyNotesPluginLoaded() { + const { app } = window; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && periodicNotes.settings?.quarterly?.enabled; +} +function appHasYearlyNotesPluginLoaded() { + const { app } = window; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && periodicNotes.settings?.yearly?.enabled; +} +function getPeriodicNoteSettings(granularity) { + const getSettings = { + day: getDailyNoteSettings, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings, + }[granularity]; + return getSettings(); +} +function createPeriodicNote(granularity, date) { + const createFn = { + day: createDailyNote, + month: createMonthlyNote, + week: createWeeklyNote, + }; + return createFn[granularity](date); +} + +main.DEFAULT_DAILY_NOTE_FORMAT = DEFAULT_DAILY_NOTE_FORMAT; +main.DEFAULT_MONTHLY_NOTE_FORMAT = DEFAULT_MONTHLY_NOTE_FORMAT; +main.DEFAULT_QUARTERLY_NOTE_FORMAT = DEFAULT_QUARTERLY_NOTE_FORMAT; +main.DEFAULT_WEEKLY_NOTE_FORMAT = DEFAULT_WEEKLY_NOTE_FORMAT; +main.DEFAULT_YEARLY_NOTE_FORMAT = DEFAULT_YEARLY_NOTE_FORMAT; +main.appHasDailyNotesPluginLoaded = appHasDailyNotesPluginLoaded; +main.appHasMonthlyNotesPluginLoaded = appHasMonthlyNotesPluginLoaded; +main.appHasQuarterlyNotesPluginLoaded = appHasQuarterlyNotesPluginLoaded; +main.appHasWeeklyNotesPluginLoaded = appHasWeeklyNotesPluginLoaded; +main.appHasYearlyNotesPluginLoaded = appHasYearlyNotesPluginLoaded; +var createDailyNote_1 = main.createDailyNote = createDailyNote; +main.createMonthlyNote = createMonthlyNote; +main.createPeriodicNote = createPeriodicNote; +main.createQuarterlyNote = createQuarterlyNote; +main.createWeeklyNote = createWeeklyNote; +main.createYearlyNote = createYearlyNote; +var getAllDailyNotes_1 = main.getAllDailyNotes = getAllDailyNotes; +main.getAllMonthlyNotes = getAllMonthlyNotes; +main.getAllQuarterlyNotes = getAllQuarterlyNotes; +main.getAllWeeklyNotes = getAllWeeklyNotes; +main.getAllYearlyNotes = getAllYearlyNotes; +var getDailyNote_1 = main.getDailyNote = getDailyNote; +main.getDailyNoteSettings = getDailyNoteSettings; +main.getDateFromFile = getDateFromFile; +main.getDateFromPath = getDateFromPath; +main.getDateUID = getDateUID; +main.getMonthlyNote = getMonthlyNote; +main.getMonthlyNoteSettings = getMonthlyNoteSettings; +main.getPeriodicNoteSettings = getPeriodicNoteSettings; +main.getQuarterlyNote = getQuarterlyNote; +main.getQuarterlyNoteSettings = getQuarterlyNoteSettings; +main.getTemplateInfo = getTemplateInfo; +main.getWeeklyNote = getWeeklyNote; +main.getWeeklyNoteSettings = getWeeklyNoteSettings; +main.getYearlyNote = getYearlyNote; +main.getYearlyNoteSettings = getYearlyNoteSettings; + +const daysOfWeek = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", +]; +function getWordBoundaries(editor) { + const cursor = editor.getCursor(); + const pos = editor.posToOffset(cursor); + const word = editor.cm.state.wordAt(pos); + const wordStart = editor.offsetToPos(word.from); + const wordEnd = editor.offsetToPos(word.to); + return { + from: wordStart, + to: wordEnd, + }; +} +function getSelectedText(editor) { + if (editor.somethingSelected()) { + return editor.getSelection(); + } + else { + const wordBoundaries = getWordBoundaries(editor); + editor.setSelection(wordBoundaries.from, wordBoundaries.to); // TODO check if this needs to be updated/improved + return editor.getSelection(); + } +} +function adjustCursor(editor, cursor, newStr, oldStr) { + const cursorOffset = newStr.length - oldStr.length; + editor.setCursor({ + line: cursor.line, + ch: cursor.ch + cursorOffset, + }); +} +function getFormattedDate(date, format) { + return window.moment(date).format(format); +} +function getLastDayOfMonth(year, month) { + return new Date(year, month, 0).getDate(); +} +function parseTruthy(flag) { + return ["y", "yes", "1", "t", "true"].indexOf(flag.toLowerCase()) >= 0; +} +function getWeekNumber(dayOfWeek) { + return daysOfWeek.indexOf(dayOfWeek); +} +function getLocaleWeekStart() { + // @ts-ignore + const startOfWeek = window.moment.localeData()._week.dow; + return daysOfWeek[startOfWeek]; +} +function generateMarkdownLink(app, subpath, alias) { + const useMarkdownLinks = app.vault.getConfig("useMarkdownLinks"); + const path = require$$0$1.normalizePath(subpath); + if (useMarkdownLinks) { + if (alias) { + return `[${alias}](${path.replace(/ /g, "%20")})`; + } + else { + return `[${subpath}](${path})`; + } + } + else { + if (alias) { + return `[[${path}|${alias}]]`; + } + else { + return `[[${path}]]`; + } + } +} +function getOrCreateDailyNote(date) { + return __awaiter(this, void 0, void 0, function* () { + // Borrowed from the Slated plugin: + // https://github.com/tgrosinger/slated-obsidian/blob/main/src/vault.ts#L17 + const desiredNote = getDailyNote_1(date, getAllDailyNotes_1()); + if (desiredNote) { + return Promise.resolve(desiredNote); + } + return createDailyNote_1(date); + }); +} +function extractTerms$1(dictionary) { + let keys; + if (dictionary instanceof Array) { + keys = [...dictionary]; + } + else if (dictionary instanceof Map) { + keys = Array.from(dictionary.keys()); + } + else { + keys = Object.keys(dictionary); + } + return keys; +} +function matchAnyPattern$1(dictionary) { + const joinedTerms = extractTerms$1(dictionary) + .sort((a, b) => b.length - a.length) + .join("|") + .replace(/\./g, "\\."); + return `(?:${joinedTerms})`; +} +const ORDINAL_WORD_DICTIONARY = { + first: 1, + second: 2, + third: 3, + fourth: 4, + fifth: 5, + sixth: 6, + seventh: 7, + eighth: 8, + ninth: 9, + tenth: 10, + eleventh: 11, + twelfth: 12, + thirteenth: 13, + fourteenth: 14, + fifteenth: 15, + sixteenth: 16, + seventeenth: 17, + eighteenth: 18, + nineteenth: 19, + twentieth: 20, + "twenty first": 21, + "twenty-first": 21, + "twenty second": 22, + "twenty-second": 22, + "twenty third": 23, + "twenty-third": 23, + "twenty fourth": 24, + "twenty-fourth": 24, + "twenty fifth": 25, + "twenty-fifth": 25, + "twenty sixth": 26, + "twenty-sixth": 26, + "twenty seventh": 27, + "twenty-seventh": 27, + "twenty eighth": 28, + "twenty-eighth": 28, + "twenty ninth": 29, + "twenty-ninth": 29, + thirtieth: 30, + "thirty first": 31, + "thirty-first": 31, +}; +const ORDINAL_NUMBER_PATTERN = `(?:${matchAnyPattern$1(ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`; +function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (ORDINAL_WORD_DICTIONARY[num] !== undefined) { + return ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:st|nd|rd|th)$/i, ""); + return parseInt(num); +} + +class DatePickerModal extends require$$0$1.Modal { + constructor(app, plugin) { + super(app); + this.plugin = plugin; + } + onOpen() { + let previewEl; + let dateInput = ""; + let momentFormat = this.plugin.settings.modalMomentFormat; + let insertAsLink = this.plugin.settings.modalToggleLink; + const getDateStr = () => { + let cleanDateInput = dateInput; + let shouldIncludeAlias = false; + if (dateInput.endsWith("|")) { + shouldIncludeAlias = true; + cleanDateInput = dateInput.slice(0, -1); + } + const parsedDate = this.plugin.parseDate(cleanDateInput || "today"); + let parsedDateString = parsedDate.moment.isValid() + ? parsedDate.moment.format(momentFormat) + : ""; + if (insertAsLink) { + parsedDateString = generateMarkdownLink(this.app, parsedDateString, shouldIncludeAlias ? cleanDateInput : undefined); + } + return parsedDateString; + }; + this.contentEl.createEl("form", {}, (formEl) => { + const dateInputEl = new require$$0$1.Setting(formEl) + .setName("Date") + .setDesc(getDateStr()) + .addText((textEl) => { + textEl.setPlaceholder("Today"); + textEl.onChange((value) => { + dateInput = value; + previewEl.setText(getDateStr()); + }); + window.setTimeout(() => textEl.inputEl.focus(), 10); + }); + previewEl = dateInputEl.descEl; + new require$$0$1.Setting(formEl) + .setName("Date Format") + .setDesc("Moment format to be used") + .addMomentFormat((momentEl) => { + momentEl.setPlaceholder("YYYY-MM-DD HH:mm"); + momentEl.setValue(momentFormat); + momentEl.onChange((value) => { + momentFormat = value.trim() || "YYYY-MM-DD HH:mm"; + this.plugin.settings.modalMomentFormat = momentFormat; + this.plugin.saveSettings(); + previewEl.setText(getDateStr()); + }); + }); + new require$$0$1.Setting(formEl).setName("Add as link?").addToggle((toggleEl) => { + toggleEl.setValue(this.plugin.settings.modalToggleLink).onChange((value) => { + insertAsLink = value; + this.plugin.settings.modalToggleLink = insertAsLink; + this.plugin.saveSettings(); + previewEl.setText(getDateStr()); + }); + }); + formEl.createDiv("modal-button-container", (buttonContainerEl) => { + buttonContainerEl + .createEl("button", { attr: { type: "button" }, text: "Never mind" }) + .addEventListener("click", () => this.close()); + buttonContainerEl.createEl("button", { + attr: { type: "submit" }, + cls: "mod-cta", + text: "Insert Date", + }); + }); + const activeView = this.app.workspace.getActiveViewOfType(require$$0$1.MarkdownView); + const activeEditor = activeView.editor; + formEl.addEventListener("submit", (e) => { + e.preventDefault(); + this.close(); + activeEditor.replaceSelection(getDateStr()); + }); + }); + } +} + +var dist = {}; + +var en$1 = {}; + +var ENTimeUnitWithinFormatParser$1 = {}; + +var constants$7 = {}; + +var pattern = {}; + +Object.defineProperty(pattern, "__esModule", { value: true }); +pattern.matchAnyPattern = pattern.extractTerms = pattern.repeatedTimeunitPattern = void 0; +function repeatedTimeunitPattern(prefix, singleTimeunitPattern) { + const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:"); + return `${prefix}${singleTimeunitPatternNoCapture}\\s{0,5}(?:,?\\s{0,5}${singleTimeunitPatternNoCapture}){0,10}`; +} +pattern.repeatedTimeunitPattern = repeatedTimeunitPattern; +function extractTerms(dictionary) { + let keys; + if (dictionary instanceof Array) { + keys = [...dictionary]; + } + else if (dictionary instanceof Map) { + keys = Array.from(dictionary.keys()); + } + else { + keys = Object.keys(dictionary); + } + return keys; +} +pattern.extractTerms = extractTerms; +function matchAnyPattern(dictionary) { + const joinedTerms = extractTerms(dictionary) + .sort((a, b) => b.length - a.length) + .join("|") + .replace(/\./g, "\\."); + return `(?:${joinedTerms})`; +} +pattern.matchAnyPattern = matchAnyPattern; + +var years = {}; + +var SECONDS_A_MINUTE = 60; +var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60; +var SECONDS_A_DAY = SECONDS_A_HOUR * 24; +var SECONDS_A_WEEK = SECONDS_A_DAY * 7; +var MILLISECONDS_A_SECOND = 1e3; +var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND; +var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND; +var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND; +var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales + +var MS = 'millisecond'; +var S = 'second'; +var MIN = 'minute'; +var H = 'hour'; +var D = 'day'; +var W = 'week'; +var M = 'month'; +var Q = 'quarter'; +var Y = 'year'; +var DATE = 'date'; +var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ'; +var INVALID_DATE_STRING = 'Invalid Date'; // regex + +var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?\.?(\d+)?$/; +var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; + +// English [en] +// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale +var en = { + name: 'en', + weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_') +}; + +var padStart = function padStart(string, length, pad) { + var s = String(string); + if (!s || s.length >= length) return string; + return "" + Array(length + 1 - s.length).join(pad) + string; +}; + +var padZoneStr = function padZoneStr(instance) { + var negMinutes = -instance.utcOffset(); + var minutes = Math.abs(negMinutes); + var hourOffset = Math.floor(minutes / 60); + var minuteOffset = minutes % 60; + return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0'); +}; + +var monthDiff = function monthDiff(a, b) { + // function from moment.js in order to keep the same result + if (a.date() < b.date()) return -monthDiff(b, a); + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()); + var anchor = a.clone().add(wholeMonthDiff, M); + var c = b - anchor < 0; + var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M); + return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0); +}; + +var absFloor = function absFloor(n) { + return n < 0 ? Math.ceil(n) || 0 : Math.floor(n); +}; + +var prettyUnit = function prettyUnit(u) { + var special = { + M: M, + y: Y, + w: W, + d: D, + D: DATE, + h: H, + m: MIN, + s: S, + ms: MS, + Q: Q + }; + return special[u] || String(u || '').toLowerCase().replace(/s$/, ''); +}; + +var isUndefined = function isUndefined(s) { + return s === undefined; +}; + +var U = { + s: padStart, + z: padZoneStr, + m: monthDiff, + a: absFloor, + p: prettyUnit, + u: isUndefined +}; + +var L = 'en'; // global locale + +var Ls = {}; // global loaded locale + +Ls[L] = en; + +var isDayjs = function isDayjs(d) { + return d instanceof Dayjs; +}; // eslint-disable-line no-use-before-define + + +var parseLocale = function parseLocale(preset, object, isLocal) { + var l; + if (!preset) return L; + + if (typeof preset === 'string') { + if (Ls[preset]) { + l = preset; + } + + if (object) { + Ls[preset] = object; + l = preset; + } + } else { + var name = preset.name; + Ls[name] = preset; + l = name; + } + + if (!isLocal && l) L = l; + return l || !isLocal && L; +}; + +var dayjs$1 = function dayjs(date, c) { + if (isDayjs(date)) { + return date.clone(); + } // eslint-disable-next-line no-nested-ternary + + + var cfg = typeof c === 'object' ? c : {}; + cfg.date = date; + cfg.args = arguments; // eslint-disable-line prefer-rest-params + + return new Dayjs(cfg); // eslint-disable-line no-use-before-define +}; + +var wrapper = function wrapper(date, instance) { + return dayjs$1(date, { + locale: instance.$L, + utc: instance.$u, + x: instance.$x, + $offset: instance.$offset // todo: refactor; do not use this.$offset in you code + + }); +}; + +var Utils = U; // for plugin use + +Utils.l = parseLocale; +Utils.i = isDayjs; +Utils.w = wrapper; + +var parseDate = function parseDate(cfg) { + var date = cfg.date, + utc = cfg.utc; + if (date === null) return new Date(NaN); // null is invalid + + if (Utils.u(date)) return new Date(); // today + + if (date instanceof Date) return new Date(date); + + if (typeof date === 'string' && !/Z$/i.test(date)) { + var d = date.match(REGEX_PARSE); + + if (d) { + var m = d[2] - 1 || 0; + var ms = (d[7] || '0').substring(0, 3); + + if (utc) { + return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms)); + } + + return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms); + } + } + + return new Date(date); // everything else +}; + +var Dayjs = /*#__PURE__*/function () { + function Dayjs(cfg) { + this.$L = parseLocale(cfg.locale, null, true); + this.parse(cfg); // for plugin + } + + var _proto = Dayjs.prototype; + + _proto.parse = function parse(cfg) { + this.$d = parseDate(cfg); + this.$x = cfg.x || {}; + this.init(); + }; + + _proto.init = function init() { + var $d = this.$d; + this.$y = $d.getFullYear(); + this.$M = $d.getMonth(); + this.$D = $d.getDate(); + this.$W = $d.getDay(); + this.$H = $d.getHours(); + this.$m = $d.getMinutes(); + this.$s = $d.getSeconds(); + this.$ms = $d.getMilliseconds(); + } // eslint-disable-next-line class-methods-use-this + ; + + _proto.$utils = function $utils() { + return Utils; + }; + + _proto.isValid = function isValid() { + return !(this.$d.toString() === INVALID_DATE_STRING); + }; + + _proto.isSame = function isSame(that, units) { + var other = dayjs$1(that); + return this.startOf(units) <= other && other <= this.endOf(units); + }; + + _proto.isAfter = function isAfter(that, units) { + return dayjs$1(that) < this.startOf(units); + }; + + _proto.isBefore = function isBefore(that, units) { + return this.endOf(units) < dayjs$1(that); + }; + + _proto.$g = function $g(input, get, set) { + if (Utils.u(input)) return this[get]; + return this.set(set, input); + }; + + _proto.unix = function unix() { + return Math.floor(this.valueOf() / 1000); + }; + + _proto.valueOf = function valueOf() { + // timezone(hour) * 60 * 60 * 1000 => ms + return this.$d.getTime(); + }; + + _proto.startOf = function startOf(units, _startOf) { + var _this = this; + + // startOf -> endOf + var isStartOf = !Utils.u(_startOf) ? _startOf : true; + var unit = Utils.p(units); + + var instanceFactory = function instanceFactory(d, m) { + var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this); + return isStartOf ? ins : ins.endOf(D); + }; + + var instanceFactorySet = function instanceFactorySet(method, slice) { + var argumentStart = [0, 0, 0, 0]; + var argumentEnd = [23, 59, 59, 999]; + return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread + _this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this); + }; + + var $W = this.$W, + $M = this.$M, + $D = this.$D; + var utcPad = "set" + (this.$u ? 'UTC' : ''); + + switch (unit) { + case Y: + return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11); + + case M: + return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1); + + case W: + { + var weekStart = this.$locale().weekStart || 0; + var gap = ($W < weekStart ? $W + 7 : $W) - weekStart; + return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M); + } + + case D: + case DATE: + return instanceFactorySet(utcPad + "Hours", 0); + + case H: + return instanceFactorySet(utcPad + "Minutes", 1); + + case MIN: + return instanceFactorySet(utcPad + "Seconds", 2); + + case S: + return instanceFactorySet(utcPad + "Milliseconds", 3); + + default: + return this.clone(); + } + }; + + _proto.endOf = function endOf(arg) { + return this.startOf(arg, false); + }; + + _proto.$set = function $set(units, _int) { + var _C$D$C$DATE$C$M$C$Y$C; + + // private set + var unit = Utils.p(units); + var utcPad = "set" + (this.$u ? 'UTC' : ''); + var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit]; + var arg = unit === D ? this.$D + (_int - this.$W) : _int; + + if (unit === M || unit === Y) { + // clone is for badMutable plugin + var date = this.clone().set(DATE, 1); + date.$d[name](arg); + date.init(); + this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d; + } else if (name) this.$d[name](arg); + + this.init(); + return this; + }; + + _proto.set = function set(string, _int2) { + return this.clone().$set(string, _int2); + }; + + _proto.get = function get(unit) { + return this[Utils.p(unit)](); + }; + + _proto.add = function add(number, units) { + var _this2 = this, + _C$MIN$C$H$C$S$unit; + + number = Number(number); // eslint-disable-line no-param-reassign + + var unit = Utils.p(units); + + var instanceFactorySet = function instanceFactorySet(n) { + var d = dayjs$1(_this2); + return Utils.w(d.date(d.date() + Math.round(n * number)), _this2); + }; + + if (unit === M) { + return this.set(M, this.$M + number); + } + + if (unit === Y) { + return this.set(Y, this.$y + number); + } + + if (unit === D) { + return instanceFactorySet(1); + } + + if (unit === W) { + return instanceFactorySet(7); + } + + var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms + + var nextTimeStamp = this.$d.getTime() + number * step; + return Utils.w(nextTimeStamp, this); + }; + + _proto.subtract = function subtract(number, string) { + return this.add(number * -1, string); + }; + + _proto.format = function format(formatStr) { + var _this3 = this; + + if (!this.isValid()) return INVALID_DATE_STRING; + var str = formatStr || FORMAT_DEFAULT; + var zoneStr = Utils.z(this); + var locale = this.$locale(); + var $H = this.$H, + $m = this.$m, + $M = this.$M; + var weekdays = locale.weekdays, + months = locale.months, + meridiem = locale.meridiem; + + var getShort = function getShort(arr, index, full, length) { + return arr && (arr[index] || arr(_this3, str)) || full[index].substr(0, length); + }; + + var get$H = function get$H(num) { + return Utils.s($H % 12 || 12, num, '0'); + }; + + var meridiemFunc = meridiem || function (hour, minute, isLowercase) { + var m = hour < 12 ? 'AM' : 'PM'; + return isLowercase ? m.toLowerCase() : m; + }; + + var matches = { + YY: String(this.$y).slice(-2), + YYYY: this.$y, + M: $M + 1, + MM: Utils.s($M + 1, 2, '0'), + MMM: getShort(locale.monthsShort, $M, months, 3), + MMMM: getShort(months, $M), + D: this.$D, + DD: Utils.s(this.$D, 2, '0'), + d: String(this.$W), + dd: getShort(locale.weekdaysMin, this.$W, weekdays, 2), + ddd: getShort(locale.weekdaysShort, this.$W, weekdays, 3), + dddd: weekdays[this.$W], + H: String($H), + HH: Utils.s($H, 2, '0'), + h: get$H(1), + hh: get$H(2), + a: meridiemFunc($H, $m, true), + A: meridiemFunc($H, $m, false), + m: String($m), + mm: Utils.s($m, 2, '0'), + s: String(this.$s), + ss: Utils.s(this.$s, 2, '0'), + SSS: Utils.s(this.$ms, 3, '0'), + Z: zoneStr // 'ZZ' logic below + + }; + return str.replace(REGEX_FORMAT, function (match, $1) { + return $1 || matches[match] || zoneStr.replace(':', ''); + }); // 'ZZ' + }; + + _proto.utcOffset = function utcOffset() { + // Because a bug at FF24, we're rounding the timezone offset around 15 minutes + // https://github.com/moment/moment/pull/1871 + return -Math.round(this.$d.getTimezoneOffset() / 15) * 15; + }; + + _proto.diff = function diff(input, units, _float) { + var _C$Y$C$M$C$Q$C$W$C$D$; + + var unit = Utils.p(units); + var that = dayjs$1(input); + var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE; + var diff = this - that; + var result = Utils.m(this, that); + result = (_C$Y$C$M$C$Q$C$W$C$D$ = {}, _C$Y$C$M$C$Q$C$W$C$D$[Y] = result / 12, _C$Y$C$M$C$Q$C$W$C$D$[M] = result, _C$Y$C$M$C$Q$C$W$C$D$[Q] = result / 3, _C$Y$C$M$C$Q$C$W$C$D$[W] = (diff - zoneDelta) / MILLISECONDS_A_WEEK, _C$Y$C$M$C$Q$C$W$C$D$[D] = (diff - zoneDelta) / MILLISECONDS_A_DAY, _C$Y$C$M$C$Q$C$W$C$D$[H] = diff / MILLISECONDS_A_HOUR, _C$Y$C$M$C$Q$C$W$C$D$[MIN] = diff / MILLISECONDS_A_MINUTE, _C$Y$C$M$C$Q$C$W$C$D$[S] = diff / MILLISECONDS_A_SECOND, _C$Y$C$M$C$Q$C$W$C$D$)[unit] || diff; // milliseconds + + return _float ? result : Utils.a(result); + }; + + _proto.daysInMonth = function daysInMonth() { + return this.endOf(M).$D; + }; + + _proto.$locale = function $locale() { + // get locale object + return Ls[this.$L]; + }; + + _proto.locale = function locale(preset, object) { + if (!preset) return this.$L; + var that = this.clone(); + var nextLocaleName = parseLocale(preset, object, true); + if (nextLocaleName) that.$L = nextLocaleName; + return that; + }; + + _proto.clone = function clone() { + return Utils.w(this.$d, this); + }; + + _proto.toDate = function toDate() { + return new Date(this.valueOf()); + }; + + _proto.toJSON = function toJSON() { + return this.isValid() ? this.toISOString() : null; + }; + + _proto.toISOString = function toISOString() { + // ie 8 return + // new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000) + // .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]') + return this.$d.toISOString(); + }; + + _proto.toString = function toString() { + return this.$d.toUTCString(); + }; + + return Dayjs; +}(); + +var proto = Dayjs.prototype; +dayjs$1.prototype = proto; +[['$ms', MS], ['$s', S], ['$m', MIN], ['$H', H], ['$W', D], ['$M', M], ['$y', Y], ['$D', DATE]].forEach(function (g) { + proto[g[1]] = function (input) { + return this.$g(input, g[0], g[1]); + }; +}); + +dayjs$1.extend = function (plugin, option) { + if (!plugin.$i) { + // install plugin only once + plugin(option, Dayjs, dayjs$1); + plugin.$i = true; + } + + return dayjs$1; +}; + +dayjs$1.locale = parseLocale; +dayjs$1.isDayjs = isDayjs; + +dayjs$1.unix = function (timestamp) { + return dayjs$1(timestamp * 1e3); +}; + +dayjs$1.en = Ls[L]; +dayjs$1.Ls = Ls; +dayjs$1.p = {}; + +var esm = /*#__PURE__*/Object.freeze({ + __proto__: null, + 'default': dayjs$1 +}); + +var require$$0 = /*@__PURE__*/getAugmentedNamespace(esm); + +var __importDefault$I = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(years, "__esModule", { value: true }); +years.findYearClosestToRef = years.findMostLikelyADYear = void 0; +const dayjs_1$s = __importDefault$I(require$$0); +function findMostLikelyADYear(yearNumber) { + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } + else { + yearNumber = yearNumber + 2000; + } + } + return yearNumber; +} +years.findMostLikelyADYear = findMostLikelyADYear; +function findYearClosestToRef(refDate, day, month) { + const refMoment = (0, dayjs_1$s.default)(refDate); + let dateMoment = refMoment; + dateMoment = dateMoment.month(month - 1); + dateMoment = dateMoment.date(day); + dateMoment = dateMoment.year(refMoment.year()); + const nextYear = dateMoment.add(1, "y"); + const lastYear = dateMoment.add(-1, "y"); + if (Math.abs(nextYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) { + dateMoment = nextYear; + } + else if (Math.abs(lastYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) { + dateMoment = lastYear; + } + return dateMoment.year(); +} +years.findYearClosestToRef = findYearClosestToRef; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.FULL_MONTH_NAME_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; +const pattern_1 = pattern; +const years_1 = years; +exports.WEEKDAY_DICTIONARY = { + sunday: 0, + sun: 0, + "sun.": 0, + monday: 1, + mon: 1, + "mon.": 1, + tuesday: 2, + tue: 2, + "tue.": 2, + wednesday: 3, + wed: 3, + "wed.": 3, + thursday: 4, + thurs: 4, + "thurs.": 4, + thur: 4, + "thur.": 4, + thu: 4, + "thu.": 4, + friday: 5, + fri: 5, + "fri.": 5, + saturday: 6, + sat: 6, + "sat.": 6, +}; +exports.FULL_MONTH_NAME_DICTIONARY = { + january: 1, + february: 2, + march: 3, + april: 4, + may: 5, + june: 6, + july: 7, + august: 8, + september: 9, + october: 10, + november: 11, + december: 12, +}; +exports.MONTH_DICTIONARY = Object.assign(Object.assign({}, exports.FULL_MONTH_NAME_DICTIONARY), { jan: 1, "jan.": 1, feb: 2, "feb.": 2, mar: 3, "mar.": 3, apr: 4, "apr.": 4, jun: 6, "jun.": 6, jul: 7, "jul.": 7, aug: 8, "aug.": 8, sep: 9, "sep.": 9, sept: 9, "sept.": 9, oct: 10, "oct.": 10, nov: 11, "nov.": 11, dec: 12, "dec.": 12 }); +exports.INTEGER_WORD_DICTIONARY = { + one: 1, + two: 2, + three: 3, + four: 4, + five: 5, + six: 6, + seven: 7, + eight: 8, + nine: 9, + ten: 10, + eleven: 11, + twelve: 12, +}; +exports.ORDINAL_WORD_DICTIONARY = { + first: 1, + second: 2, + third: 3, + fourth: 4, + fifth: 5, + sixth: 6, + seventh: 7, + eighth: 8, + ninth: 9, + tenth: 10, + eleventh: 11, + twelfth: 12, + thirteenth: 13, + fourteenth: 14, + fifteenth: 15, + sixteenth: 16, + seventeenth: 17, + eighteenth: 18, + nineteenth: 19, + twentieth: 20, + "twenty first": 21, + "twenty-first": 21, + "twenty second": 22, + "twenty-second": 22, + "twenty third": 23, + "twenty-third": 23, + "twenty fourth": 24, + "twenty-fourth": 24, + "twenty fifth": 25, + "twenty-fifth": 25, + "twenty sixth": 26, + "twenty-sixth": 26, + "twenty seventh": 27, + "twenty-seventh": 27, + "twenty eighth": 28, + "twenty-eighth": 28, + "twenty ninth": 29, + "twenty-ninth": 29, + "thirtieth": 30, + "thirty first": 31, + "thirty-first": 31, +}; +exports.TIME_UNIT_DICTIONARY = { + sec: "second", + second: "second", + seconds: "second", + min: "minute", + mins: "minute", + minute: "minute", + minutes: "minute", + h: "hour", + hr: "hour", + hrs: "hour", + hour: "hour", + hours: "hour", + day: "d", + days: "d", + week: "week", + weeks: "week", + month: "month", + months: "month", + y: "year", + yr: "year", + year: "year", + years: "year", +}; +exports.NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|a?\\s{0,2}couple\\s{0,2}(?:of)?)`; +function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } + else if (num === "a" || num === "an") { + return 1; + } + else if (num.match(/few/)) { + return 3; + } + else if (num.match(/half/)) { + return 0.5; + } + else if (num.match(/couple/)) { + return 2; + } + else if (num.match(/several/)) { + return 7; + } + return parseFloat(num); +} +exports.parseNumberPattern = parseNumberPattern; +exports.ORDINAL_NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`; +function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (exports.ORDINAL_WORD_DICTIONARY[num] !== undefined) { + return exports.ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:st|nd|rd|th)$/i, ""); + return parseInt(num); +} +exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; +exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])`; +function parseYear(match) { + if (/BE/i.test(match)) { + match = match.replace(/BE/i, ""); + return parseInt(match) - 543; + } + if (/BCE?/i.test(match)) { + match = match.replace(/BCE?/i, ""); + return -parseInt(match); + } + if (/(AD|CE)/i.test(match)) { + match = match.replace(/(AD|CE)/i, ""); + return parseInt(match); + } + const rawYearNumber = parseInt(match); + return (0, years_1.findMostLikelyADYear)(rawYearNumber); +} +exports.parseYear = parseYear; +const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,3}(${(0, pattern_1.matchAnyPattern)(exports.TIME_UNIT_DICTIONARY)})`; +const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); +exports.TIME_UNITS_PATTERN = (0, pattern_1.repeatedTimeunitPattern)(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN); +function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length).trim(); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; +} +exports.parseTimeUnits = parseTimeUnits; +function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; +} +}(constants$7)); + +var results = {}; + +var quarterOfYear = {exports: {}}; + +(function (module, exports) { +!function(t,n){module.exports=n();}(commonjsGlobal,function(){var t="month",n="quarter";return function(r,i){var e=i.prototype;e.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var u=e.add;e.add=function(r,i){return r=Number(r),this.$utils().p(i)===n?this.add(3*r,t):u.bind(this)(r,i)};var s=e.startOf;e.startOf=function(r,i){var e=this.$utils(),u=!!e.u(i)||i;if(e.p(r)===n){var a=this.quarter()-1;return u?this.month(3*a).startOf(t).startOf("day"):this.month(3*a+2).endOf(t).endOf("day")}return s.bind(this)(r,i)};}}); +}(quarterOfYear)); + +var weekday = {exports: {}}; + +(function (module, exports) { +!function(e,t){module.exports=t();}(commonjsGlobal,function(){return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,i=(n 31) { + match.index = match.index + match[DATE_GROUP$7].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP$c]) { + const yearNumber = (0, constants_2$7.parseYear)(match[YEAR_GROUP$c]); + result.start.assign("year", yearNumber); + } + else { + const year = (0, years_1$9.findYearClosestToRef)(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP$5]) { + const endDate = (0, constants_3$3.parseOrdinalNumberPattern)(match[DATE_TO_GROUP$5]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } +} +ENMonthNameLittleEndianParser$1.default = ENMonthNameLittleEndianParser; + +var ENMonthNameMiddleEndianParser$1 = {}; + +Object.defineProperty(ENMonthNameMiddleEndianParser$1, "__esModule", { value: true }); +const years_1$8 = years; +const constants_1$A = constants$7; +const constants_2$6 = constants$7; +const constants_3$2 = constants$7; +const pattern_1$g = pattern; +const AbstractParserWithWordBoundary_1$P = AbstractParserWithWordBoundary; +const PATTERN$A = new RegExp(`(${(0, pattern_1$g.matchAnyPattern)(constants_1$A.MONTH_DICTIONARY)})` + + "(?:-|/|\\s*,?\\s*)" + + `(${constants_2$6.ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*` + + "(?:" + + "(?:to|\\-)\\s*" + + `(${constants_2$6.ORDINAL_NUMBER_PATTERN})\\s*` + + ")?" + + "(?:" + + "(?:-|/|\\s*,?\\s*)" + + `(${constants_3$2.YEAR_PATTERN})` + + ")?" + + "(?=\\W|$)(?!\\:\\d)", "i"); +const MONTH_NAME_GROUP$8 = 1; +const DATE_GROUP$6 = 2; +const DATE_TO_GROUP$4 = 3; +const YEAR_GROUP$b = 4; +class ENMonthNameMiddleEndianParser extends AbstractParserWithWordBoundary_1$P.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$A; + } + innerExtract(context, match) { + const month = constants_1$A.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$8].toLowerCase()]; + const day = (0, constants_2$6.parseOrdinalNumberPattern)(match[DATE_GROUP$6]); + if (day > 31) { + return null; + } + const components = context.createParsingComponents({ + day: day, + month: month, + }); + if (match[YEAR_GROUP$b]) { + const year = (0, constants_3$2.parseYear)(match[YEAR_GROUP$b]); + components.assign("year", year); + } + else { + const year = (0, years_1$8.findYearClosestToRef)(context.refDate, day, month); + components.imply("year", year); + } + if (!match[DATE_TO_GROUP$4]) { + return components; + } + const endDate = (0, constants_2$6.parseOrdinalNumberPattern)(match[DATE_TO_GROUP$4]); + const result = context.createParsingResult(match.index, match[0]); + result.start = components; + result.end = components.clone(); + result.end.assign("day", endDate); + return result; + } +} +ENMonthNameMiddleEndianParser$1.default = ENMonthNameMiddleEndianParser; + +var ENMonthNameParser$1 = {}; + +Object.defineProperty(ENMonthNameParser$1, "__esModule", { value: true }); +const constants_1$z = constants$7; +const years_1$7 = years; +const pattern_1$f = pattern; +const constants_2$5 = constants$7; +const AbstractParserWithWordBoundary_1$O = AbstractParserWithWordBoundary; +const PATTERN$z = new RegExp(`((?:in)\\s*)?` + + `(${(0, pattern_1$f.matchAnyPattern)(constants_1$z.MONTH_DICTIONARY)})` + + `\\s*` + + `(?:` + + `[,-]?\\s*(${constants_2$5.YEAR_PATTERN})?` + + ")?" + + "(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)", "i"); +const PREFIX_GROUP$4 = 1; +const MONTH_NAME_GROUP$7 = 2; +const YEAR_GROUP$a = 3; +class ENMonthNameParser extends AbstractParserWithWordBoundary_1$O.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$z; + } + innerExtract(context, match) { + const monthName = match[MONTH_NAME_GROUP$7].toLowerCase(); + if (match[0].length <= 3 && !constants_1$z.FULL_MONTH_NAME_DICTIONARY[monthName]) { + return null; + } + const result = context.createParsingResult(match.index + (match[PREFIX_GROUP$4] || "").length, match.index + match[0].length); + result.start.imply("day", 1); + const month = constants_1$z.MONTH_DICTIONARY[monthName]; + result.start.assign("month", month); + if (match[YEAR_GROUP$a]) { + const year = (0, constants_2$5.parseYear)(match[YEAR_GROUP$a]); + result.start.assign("year", year); + } + else { + const year = (0, years_1$7.findYearClosestToRef)(context.refDate, 1, month); + result.start.imply("year", year); + } + return result; + } +} +ENMonthNameParser$1.default = ENMonthNameParser; + +var ENCasualYearMonthDayParser$1 = {}; + +Object.defineProperty(ENCasualYearMonthDayParser$1, "__esModule", { value: true }); +const constants_1$y = constants$7; +const pattern_1$e = pattern; +const AbstractParserWithWordBoundary_1$N = AbstractParserWithWordBoundary; +const PATTERN$y = new RegExp(`([0-9]{4})[\\.\\/\\s]` + + `(?:(${(0, pattern_1$e.matchAnyPattern)(constants_1$y.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]` + + `([0-9]{1,2})` + + "(?=\\W|$)", "i"); +const YEAR_NUMBER_GROUP$3 = 1; +const MONTH_NAME_GROUP$6 = 2; +const MONTH_NUMBER_GROUP$2 = 3; +const DATE_NUMBER_GROUP$2 = 4; +class ENCasualYearMonthDayParser extends AbstractParserWithWordBoundary_1$N.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$y; + } + innerExtract(context, match) { + const month = match[MONTH_NUMBER_GROUP$2] + ? parseInt(match[MONTH_NUMBER_GROUP$2]) + : constants_1$y.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$6].toLowerCase()]; + if (month < 1 || month > 12) { + return null; + } + const year = parseInt(match[YEAR_NUMBER_GROUP$3]); + const day = parseInt(match[DATE_NUMBER_GROUP$2]); + return { + day: day, + month: month, + year: year, + }; + } +} +ENCasualYearMonthDayParser$1.default = ENCasualYearMonthDayParser; + +var ENSlashMonthFormatParser$1 = {}; + +Object.defineProperty(ENSlashMonthFormatParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$M = AbstractParserWithWordBoundary; +const PATTERN$x = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})" + "", "i"); +const MONTH_GROUP$4 = 1; +const YEAR_GROUP$9 = 2; +class ENSlashMonthFormatParser extends AbstractParserWithWordBoundary_1$M.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$x; + } + innerExtract(context, match) { + const year = parseInt(match[YEAR_GROUP$9]); + const month = parseInt(match[MONTH_GROUP$4]); + return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year); + } +} +ENSlashMonthFormatParser$1.default = ENSlashMonthFormatParser; + +var ENTimeExpressionParser$1 = {}; + +var AbstractTimeExpressionParser$1 = {}; + +Object.defineProperty(AbstractTimeExpressionParser$1, "__esModule", { value: true }); +AbstractTimeExpressionParser$1.AbstractTimeExpressionParser = void 0; +const index_1$d = dist; +function primaryTimePattern(primaryPrefix, primarySuffix) { + return new RegExp("(^|\\s|T|\\b)" + + `${primaryPrefix}` + + "(\\d{1,4})" + + "(?:" + + "(?:\\.|\\:|\\:)" + + "(\\d{1,2})" + + "(?:" + + "(?:\\:|\\:)" + + "(\\d{2})" + + "(?:\\.(\\d{1,6}))?" + + ")?" + + ")?" + + "(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?" + + `${primarySuffix}`, "i"); +} +function followingTimePatten(followingPhase, followingSuffix) { + return new RegExp(`^(${followingPhase})` + + "(\\d{1,4})" + + "(?:" + + "(?:\\.|\\:|\\:)" + + "(\\d{1,2})" + + "(?:" + + "(?:\\.|\\:|\\:)" + + "(\\d{1,2})(?:\\.(\\d{1,6}))?" + + ")?" + + ")?" + + "(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?" + + `${followingSuffix}`, "i"); +} +const HOUR_GROUP$3 = 2; +const MINUTE_GROUP$3 = 3; +const SECOND_GROUP$3 = 4; +const MILLI_SECOND_GROUP = 5; +const AM_PM_HOUR_GROUP$3 = 6; +class AbstractTimeExpressionParser { + constructor(strictMode = false) { + this.cachedPrimaryPrefix = null; + this.cachedPrimarySuffix = null; + this.cachedPrimaryTimePattern = null; + this.cachedFollowingPhase = null; + this.cachedFollowingSuffix = null; + this.cachedFollowingTimePatten = null; + this.strictMode = strictMode; + } + primarySuffix() { + return "(?=\\W|$)"; + } + followingSuffix() { + return "(?=\\W|$)"; + } + pattern(context) { + return this.getPrimaryTimePatternThroughCache(); + } + extract(context, match) { + const startComponents = this.extractPrimaryTimeComponents(context, match); + if (!startComponents) { + match.index += match[0].length; + return null; + } + const index = match.index + match[1].length; + const text = match[0].substring(match[1].length); + const result = context.createParsingResult(index, text, startComponents); + match.index += match[0].length; + const remainingText = context.text.substring(match.index); + const followingPattern = this.getFollowingTimePatternThroughCache(); + const followingMatch = followingPattern.exec(remainingText); + if (!followingMatch || + followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) { + return this.checkAndReturnWithoutFollowingPattern(result); + } + result.end = this.extractFollowingTimeComponents(context, followingMatch, result); + if (result.end) { + result.text += followingMatch[0]; + } + return this.checkAndReturnWithFollowingPattern(result); + } + extractPrimaryTimeComponents(context, match, strict = false) { + const components = context.createParsingComponents(); + let minute = 0; + let meridiem = null; + let hour = parseInt(match[HOUR_GROUP$3]); + if (hour > 100) { + if (this.strictMode || match[MINUTE_GROUP$3] != null) { + return null; + } + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (hour > 24) { + return null; + } + if (match[MINUTE_GROUP$3] != null) { + if (match[MINUTE_GROUP$3].length == 1 && !match[AM_PM_HOUR_GROUP$3]) { + return null; + } + minute = parseInt(match[MINUTE_GROUP$3]); + } + if (minute >= 60) { + return null; + } + if (hour > 12) { + meridiem = index_1$d.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP$3] != null) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP$3][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1$d.Meridiem.AM; + if (hour == 12) { + hour = 0; + } + } + if (ampm == "p") { + meridiem = index_1$d.Meridiem.PM; + if (hour != 12) { + hour += 12; + } + } + } + components.assign("hour", hour); + components.assign("minute", minute); + if (meridiem !== null) { + components.assign("meridiem", meridiem); + } + else { + if (hour < 12) { + components.imply("meridiem", index_1$d.Meridiem.AM); + } + else { + components.imply("meridiem", index_1$d.Meridiem.PM); + } + } + if (match[MILLI_SECOND_GROUP] != null) { + const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3)); + if (millisecond >= 1000) + return null; + components.assign("millisecond", millisecond); + } + if (match[SECOND_GROUP$3] != null) { + const second = parseInt(match[SECOND_GROUP$3]); + if (second >= 60) + return null; + components.assign("second", second); + } + return components; + } + extractFollowingTimeComponents(context, match, result) { + const components = context.createParsingComponents(); + if (match[MILLI_SECOND_GROUP] != null) { + const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3)); + if (millisecond >= 1000) + return null; + components.assign("millisecond", millisecond); + } + if (match[SECOND_GROUP$3] != null) { + const second = parseInt(match[SECOND_GROUP$3]); + if (second >= 60) + return null; + components.assign("second", second); + } + let hour = parseInt(match[HOUR_GROUP$3]); + let minute = 0; + let meridiem = -1; + if (match[MINUTE_GROUP$3] != null) { + minute = parseInt(match[MINUTE_GROUP$3]); + } + else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60 || hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = index_1$d.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP$3] != null) { + if (hour > 12) { + return null; + } + const ampm = match[AM_PM_HOUR_GROUP$3][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1$d.Meridiem.AM; + if (hour == 12) { + hour = 0; + if (!components.isCertain("day")) { + components.imply("day", components.get("day") + 1); + } + } + } + if (ampm == "p") { + meridiem = index_1$d.Meridiem.PM; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == index_1$d.Meridiem.AM) { + result.start.imply("meridiem", index_1$d.Meridiem.AM); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } + else { + result.start.imply("meridiem", index_1$d.Meridiem.PM); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } + components.assign("hour", hour); + components.assign("minute", minute); + if (meridiem >= 0) { + components.assign("meridiem", meridiem); + } + else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("hour") > 12; + if (startAtPM) { + if (result.start.get("hour") - 12 > hour) { + components.imply("meridiem", index_1$d.Meridiem.AM); + } + else if (hour <= 12) { + components.assign("hour", hour + 12); + components.assign("meridiem", index_1$d.Meridiem.PM); + } + } + else if (hour > 12) { + components.imply("meridiem", index_1$d.Meridiem.PM); + } + else if (hour <= 12) { + components.imply("meridiem", index_1$d.Meridiem.AM); + } + } + if (components.date().getTime() < result.start.date().getTime()) { + components.imply("day", components.get("day") + 1); + } + return components; + } + checkAndReturnWithoutFollowingPattern(result) { + if (result.text.match(/^\d$/)) { + return null; + } + if (result.text.match(/\d[apAP]$/)) { + return null; + } + const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)$/); + if (endingWithNumbers) { + const endingNumbers = endingWithNumbers[1]; + if (this.strictMode) { + return null; + } + if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) { + return null; + } + const endingNumberVal = parseInt(endingNumbers); + if (endingNumberVal > 24) { + return null; + } + } + return result; + } + checkAndReturnWithFollowingPattern(result) { + if (result.text.match(/^\d+-\d+$/)) { + return null; + } + const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/); + if (endingWithNumbers) { + if (this.strictMode) { + return null; + } + const startingNumbers = endingWithNumbers[1]; + const endingNumbers = endingWithNumbers[2]; + if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) { + return null; + } + const endingNumberVal = parseInt(endingNumbers); + const startingNumberVal = parseInt(startingNumbers); + if (endingNumberVal > 24 || startingNumberVal > 24) { + return null; + } + } + return result; + } + getPrimaryTimePatternThroughCache() { + const primaryPrefix = this.primaryPrefix(); + const primarySuffix = this.primarySuffix(); + if (this.cachedPrimaryPrefix === primaryPrefix && this.cachedPrimarySuffix === primarySuffix) { + return this.cachedPrimaryTimePattern; + } + this.cachedPrimaryTimePattern = primaryTimePattern(primaryPrefix, primarySuffix); + this.cachedPrimaryPrefix = primaryPrefix; + this.cachedPrimarySuffix = primarySuffix; + return this.cachedPrimaryTimePattern; + } + getFollowingTimePatternThroughCache() { + const followingPhase = this.followingPhase(); + const followingSuffix = this.followingSuffix(); + if (this.cachedFollowingPhase === followingPhase && this.cachedFollowingSuffix === followingSuffix) { + return this.cachedFollowingTimePatten; + } + this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix); + this.cachedFollowingPhase = followingPhase; + this.cachedFollowingSuffix = followingSuffix; + return this.cachedFollowingTimePatten; + } +} +AbstractTimeExpressionParser$1.AbstractTimeExpressionParser = AbstractTimeExpressionParser; + +Object.defineProperty(ENTimeExpressionParser$1, "__esModule", { value: true }); +const index_1$c = dist; +const AbstractTimeExpressionParser_1$4 = AbstractTimeExpressionParser$1; +class ENTimeExpressionParser extends AbstractTimeExpressionParser_1$4.AbstractTimeExpressionParser { + constructor(strictMode) { + super(strictMode); + } + followingPhase() { + return "\\s*(?:\\-|\\–|\\~|\\〜|to|\\?)\\s*"; + } + primaryPrefix() { + return "(?:(?:at|from)\\s*)??"; + } + primarySuffix() { + return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"; + } + extractPrimaryTimeComponents(context, match) { + const components = super.extractPrimaryTimeComponents(context, match); + if (components) { + if (match[0].endsWith("night")) { + const hour = components.get("hour"); + if (hour >= 6 && hour < 12) { + components.assign("hour", components.get("hour") + 12); + components.assign("meridiem", index_1$c.Meridiem.PM); + } + else if (hour < 6) { + components.assign("meridiem", index_1$c.Meridiem.AM); + } + } + if (match[0].endsWith("afternoon")) { + components.assign("meridiem", index_1$c.Meridiem.PM); + const hour = components.get("hour"); + if (hour >= 0 && hour <= 6) { + components.assign("hour", components.get("hour") + 12); + } + } + if (match[0].endsWith("morning")) { + components.assign("meridiem", index_1$c.Meridiem.AM); + const hour = components.get("hour"); + if (hour < 12) { + components.assign("hour", components.get("hour")); + } + } + } + return components; + } +} +ENTimeExpressionParser$1.default = ENTimeExpressionParser; + +var ENTimeUnitAgoFormatParser$1 = {}; + +var timeunits = {}; + +Object.defineProperty(timeunits, "__esModule", { value: true }); +timeunits.addImpliedTimeUnits = timeunits.reverseTimeUnits = void 0; +function reverseTimeUnits(timeUnits) { + const reversed = {}; + for (const key in timeUnits) { + reversed[key] = -timeUnits[key]; + } + return reversed; +} +timeunits.reverseTimeUnits = reverseTimeUnits; +function addImpliedTimeUnits(components, timeUnits) { + const output = components.clone(); + let date = components.dayjs(); + for (const key in timeUnits) { + date = date.add(timeUnits[key], key); + } + if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) { + output.imply("day", date.date()); + output.imply("month", date.month() + 1); + output.imply("year", date.year()); + } + if ("second" in timeUnits || "minute" in timeUnits || "hour" in timeUnits) { + output.imply("second", date.second()); + output.imply("minute", date.minute()); + output.imply("hour", date.hour()); + } + return output; +} +timeunits.addImpliedTimeUnits = addImpliedTimeUnits; + +Object.defineProperty(ENTimeUnitAgoFormatParser$1, "__esModule", { value: true }); +const constants_1$x = constants$7; +const results_1$d = results; +const AbstractParserWithWordBoundary_1$L = AbstractParserWithWordBoundary; +const timeunits_1$6 = timeunits; +const PATTERN$w = new RegExp(`(${constants_1$x.TIME_UNITS_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=(?:\\W|$))`, "i"); +const STRICT_PATTERN$3 = new RegExp(`(${constants_1$x.TIME_UNITS_PATTERN})\\s{0,5}ago(?=(?:\\W|$))`, "i"); +class ENTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1$L.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN$3 : PATTERN$w; + } + innerExtract(context, match) { + const timeUnits = (0, constants_1$x.parseTimeUnits)(match[1]); + const outputTimeUnits = (0, timeunits_1$6.reverseTimeUnits)(timeUnits); + return results_1$d.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } +} +ENTimeUnitAgoFormatParser$1.default = ENTimeUnitAgoFormatParser; + +var ENTimeUnitLaterFormatParser$1 = {}; + +Object.defineProperty(ENTimeUnitLaterFormatParser$1, "__esModule", { value: true }); +const constants_1$w = constants$7; +const results_1$c = results; +const AbstractParserWithWordBoundary_1$K = AbstractParserWithWordBoundary; +const PATTERN$v = new RegExp(`(${constants_1$w.TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)` + "(?=(?:\\W|$))", "i"); +const STRICT_PATTERN$2 = new RegExp("" + "(" + constants_1$w.TIME_UNITS_PATTERN + ")" + "(later|from now)" + "(?=(?:\\W|$))", "i"); +const GROUP_NUM_TIMEUNITS$1 = 1; +class ENTimeUnitLaterFormatParser extends AbstractParserWithWordBoundary_1$K.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN$2 : PATTERN$v; + } + innerExtract(context, match) { + const fragments = (0, constants_1$w.parseTimeUnits)(match[GROUP_NUM_TIMEUNITS$1]); + return results_1$c.ParsingComponents.createRelativeFromReference(context.reference, fragments); + } +} +ENTimeUnitLaterFormatParser$1.default = ENTimeUnitLaterFormatParser; + +var ENMergeDateRangeRefiner$1 = {}; + +var AbstractMergeDateRangeRefiner$1 = {}; + +var abstractRefiners = {}; + +Object.defineProperty(abstractRefiners, "__esModule", { value: true }); +abstractRefiners.MergingRefiner = abstractRefiners.Filter = void 0; +class Filter { + refine(context, results) { + return results.filter((r) => this.isValid(context, r)); + } +} +abstractRefiners.Filter = Filter; +class MergingRefiner { + refine(context, results) { + if (results.length < 2) { + return results; + } + const mergedResults = []; + let curResult = results[0]; + let nextResult = null; + for (let i = 1; i < results.length; i++) { + nextResult = results[i]; + const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index); + if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) { + mergedResults.push(curResult); + curResult = nextResult; + } + else { + const left = curResult; + const right = nextResult; + const mergedResult = this.mergeResults(textBetween, left, right, context); + context.debug(() => { + console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`); + }); + curResult = mergedResult; + } + } + if (curResult != null) { + mergedResults.push(curResult); + } + return mergedResults; + } +} +abstractRefiners.MergingRefiner = MergingRefiner; + +Object.defineProperty(AbstractMergeDateRangeRefiner$1, "__esModule", { value: true }); +const abstractRefiners_1$3 = abstractRefiners; +class AbstractMergeDateRangeRefiner extends abstractRefiners_1$3.MergingRefiner { + shouldMergeResults(textBetween, currentResult, nextResult) { + return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null; + } + mergeResults(textBetween, fromResult, toResult) { + if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) { + toResult.start.getCertainComponents().forEach((key) => { + if (!fromResult.start.isCertain(key)) { + fromResult.start.assign(key, toResult.start.get(key)); + } + }); + fromResult.start.getCertainComponents().forEach((key) => { + if (!toResult.start.isCertain(key)) { + toResult.start.assign(key, fromResult.start.get(key)); + } + }); + } + if (fromResult.start.date().getTime() > toResult.start.date().getTime()) { + let fromMoment = fromResult.start.dayjs(); + let toMoment = toResult.start.dayjs(); + if (fromResult.start.isOnlyWeekdayComponent() && fromMoment.add(-7, "days").isBefore(toMoment)) { + fromMoment = fromMoment.add(-7, "days"); + fromResult.start.imply("day", fromMoment.date()); + fromResult.start.imply("month", fromMoment.month() + 1); + fromResult.start.imply("year", fromMoment.year()); + } + else if (toResult.start.isOnlyWeekdayComponent() && toMoment.add(7, "days").isAfter(fromMoment)) { + toMoment = toMoment.add(7, "days"); + toResult.start.imply("day", toMoment.date()); + toResult.start.imply("month", toMoment.month() + 1); + toResult.start.imply("year", toMoment.year()); + } + else { + [toResult, fromResult] = [fromResult, toResult]; + } + } + const result = fromResult.clone(); + result.start = fromResult.start; + result.end = toResult.start; + result.index = Math.min(fromResult.index, toResult.index); + if (fromResult.index < toResult.index) { + result.text = fromResult.text + textBetween + toResult.text; + } + else { + result.text = toResult.text + textBetween + fromResult.text; + } + return result; + } +} +AbstractMergeDateRangeRefiner$1.default = AbstractMergeDateRangeRefiner; + +var __importDefault$G = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ENMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$7 = __importDefault$G(AbstractMergeDateRangeRefiner$1); +class ENMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$7.default { + patternBetween() { + return /^\s*(to|-)\s*$/i; + } +} +ENMergeDateRangeRefiner$1.default = ENMergeDateRangeRefiner; + +var ENMergeDateTimeRefiner$2 = {}; + +var AbstractMergeDateTimeRefiner = {}; + +var mergingCalculation = {}; + +Object.defineProperty(mergingCalculation, "__esModule", { value: true }); +mergingCalculation.mergeDateTimeComponent = mergingCalculation.mergeDateTimeResult = void 0; +const index_1$b = dist; +function mergeDateTimeResult(dateResult, timeResult) { + const result = dateResult.clone(); + const beginDate = dateResult.start; + const beginTime = timeResult.start; + result.start = mergeDateTimeComponent(beginDate, beginTime); + if (dateResult.end != null || timeResult.end != null) { + const endDate = dateResult.end == null ? dateResult.start : dateResult.end; + const endTime = timeResult.end == null ? timeResult.start : timeResult.end; + const endDateTime = mergeDateTimeComponent(endDate, endTime); + if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) { + if (endDateTime.isCertain("day")) { + endDateTime.assign("day", endDateTime.get("day") + 1); + } + else { + endDateTime.imply("day", endDateTime.get("day") + 1); + } + } + result.end = endDateTime; + } + return result; +} +mergingCalculation.mergeDateTimeResult = mergeDateTimeResult; +function mergeDateTimeComponent(dateComponent, timeComponent) { + const dateTimeComponent = dateComponent.clone(); + if (timeComponent.isCertain("hour")) { + dateTimeComponent.assign("hour", timeComponent.get("hour")); + dateTimeComponent.assign("minute", timeComponent.get("minute")); + if (timeComponent.isCertain("second")) { + dateTimeComponent.assign("second", timeComponent.get("second")); + if (timeComponent.isCertain("millisecond")) { + dateTimeComponent.assign("millisecond", timeComponent.get("millisecond")); + } + else { + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + } + else { + dateTimeComponent.imply("second", timeComponent.get("second")); + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + } + else { + dateTimeComponent.imply("hour", timeComponent.get("hour")); + dateTimeComponent.imply("minute", timeComponent.get("minute")); + dateTimeComponent.imply("second", timeComponent.get("second")); + dateTimeComponent.imply("millisecond", timeComponent.get("millisecond")); + } + if (timeComponent.isCertain("timezoneOffset")) { + dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset")); + } + if (timeComponent.isCertain("meridiem")) { + dateTimeComponent.assign("meridiem", timeComponent.get("meridiem")); + } + else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) { + dateTimeComponent.imply("meridiem", timeComponent.get("meridiem")); + } + if (dateTimeComponent.get("meridiem") == index_1$b.Meridiem.PM && dateTimeComponent.get("hour") < 12) { + if (timeComponent.isCertain("hour")) { + dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12); + } + else { + dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12); + } + } + return dateTimeComponent; +} +mergingCalculation.mergeDateTimeComponent = mergeDateTimeComponent; + +Object.defineProperty(AbstractMergeDateTimeRefiner, "__esModule", { value: true }); +const abstractRefiners_1$2 = abstractRefiners; +const mergingCalculation_1 = mergingCalculation; +class ENMergeDateTimeRefiner$1 extends abstractRefiners_1$2.MergingRefiner { + shouldMergeResults(textBetween, currentResult, nextResult) { + return (((currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime()) || + (nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime())) && + textBetween.match(this.patternBetween()) != null); + } + mergeResults(textBetween, currentResult, nextResult) { + const result = currentResult.start.isOnlyDate() + ? (0, mergingCalculation_1.mergeDateTimeResult)(currentResult, nextResult) + : (0, mergingCalculation_1.mergeDateTimeResult)(nextResult, currentResult); + result.index = currentResult.index; + result.text = currentResult.text + textBetween + nextResult.text; + return result; + } +} +AbstractMergeDateTimeRefiner.default = ENMergeDateTimeRefiner$1; + +var __importDefault$F = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ENMergeDateTimeRefiner$2, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$6 = __importDefault$F(AbstractMergeDateTimeRefiner); +class ENMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$6.default { + patternBetween() { + return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$"); + } +} +ENMergeDateTimeRefiner$2.default = ENMergeDateTimeRefiner; + +var configurations = {}; + +var ExtractTimezoneAbbrRefiner$1 = {}; + +Object.defineProperty(ExtractTimezoneAbbrRefiner$1, "__esModule", { value: true }); +const TIMEZONE_NAME_PATTERN = new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i"); +const DEFAULT_TIMEZONE_ABBR_MAP = { + ACDT: 630, + ACST: 570, + ADT: -180, + AEDT: 660, + AEST: 600, + AFT: 270, + AKDT: -480, + AKST: -540, + ALMT: 360, + AMST: -180, + AMT: -240, + ANAST: 720, + ANAT: 720, + AQTT: 300, + ART: -180, + AST: -240, + AWDT: 540, + AWST: 480, + AZOST: 0, + AZOT: -60, + AZST: 300, + AZT: 240, + BNT: 480, + BOT: -240, + BRST: -120, + BRT: -180, + BST: 60, + BTT: 360, + CAST: 480, + CAT: 120, + CCT: 390, + CDT: -300, + CEST: 120, + CET: 60, + CHADT: 825, + CHAST: 765, + CKT: -600, + CLST: -180, + CLT: -240, + COT: -300, + CST: -360, + CVT: -60, + CXT: 420, + ChST: 600, + DAVT: 420, + EASST: -300, + EAST: -360, + EAT: 180, + ECT: -300, + EDT: -240, + EEST: 180, + EET: 120, + EGST: 0, + EGT: -60, + EST: -300, + ET: -300, + FJST: 780, + FJT: 720, + FKST: -180, + FKT: -240, + FNT: -120, + GALT: -360, + GAMT: -540, + GET: 240, + GFT: -180, + GILT: 720, + GMT: 0, + GST: 240, + GYT: -240, + HAA: -180, + HAC: -300, + HADT: -540, + HAE: -240, + HAP: -420, + HAR: -360, + HAST: -600, + HAT: -90, + HAY: -480, + HKT: 480, + HLV: -210, + HNA: -240, + HNC: -360, + HNE: -300, + HNP: -480, + HNR: -420, + HNT: -150, + HNY: -540, + HOVT: 420, + ICT: 420, + IDT: 180, + IOT: 360, + IRDT: 270, + IRKST: 540, + IRKT: 540, + IRST: 210, + IST: 330, + JST: 540, + KGT: 360, + KRAST: 480, + KRAT: 480, + KST: 540, + KUYT: 240, + LHDT: 660, + LHST: 630, + LINT: 840, + MAGST: 720, + MAGT: 720, + MART: -510, + MAWT: 300, + MDT: -360, + MESZ: 120, + MEZ: 60, + MHT: 720, + MMT: 390, + MSD: 240, + MSK: 240, + MST: -420, + MUT: 240, + MVT: 300, + MYT: 480, + NCT: 660, + NDT: -90, + NFT: 690, + NOVST: 420, + NOVT: 360, + NPT: 345, + NST: -150, + NUT: -660, + NZDT: 780, + NZST: 720, + OMSST: 420, + OMST: 420, + PDT: -420, + PET: -300, + PETST: 720, + PETT: 720, + PGT: 600, + PHOT: 780, + PHT: 480, + PKT: 300, + PMDT: -120, + PMST: -180, + PONT: 660, + PST: -480, + PT: -480, + PWT: 540, + PYST: -180, + PYT: -240, + RET: 240, + SAMT: 240, + SAST: 120, + SBT: 660, + SCT: 240, + SGT: 480, + SRT: -180, + SST: -660, + TAHT: -600, + TFT: 300, + TJT: 300, + TKT: 780, + TLT: 540, + TMT: 300, + TVT: 720, + ULAT: 480, + UTC: 0, + UYST: -120, + UYT: -180, + UZT: 300, + VET: -210, + VLAST: 660, + VLAT: 660, + VUT: 660, + WAST: 120, + WAT: 60, + WEST: 60, + WESZ: 60, + WET: 0, + WEZ: 0, + WFT: 720, + WGST: -120, + WGT: -180, + WIB: 420, + WIT: 540, + WITA: 480, + WST: 780, + WT: 0, + YAKST: 600, + YAKT: 600, + YAPT: 600, + YEKST: 360, + YEKT: 360, +}; +class ExtractTimezoneAbbrRefiner { + constructor(timezoneOverrides) { + this.timezone = Object.assign(Object.assign({}, DEFAULT_TIMEZONE_ABBR_MAP), timezoneOverrides); + } + refine(context, results) { + var _a; + const timezoneOverrides = (_a = context.option.timezones) !== null && _a !== void 0 ? _a : {}; + results.forEach((result) => { + var _a, _b; + const suffix = context.text.substring(result.index + result.text.length); + const match = TIMEZONE_NAME_PATTERN.exec(suffix); + if (!match) { + return; + } + const timezoneAbbr = match[1].toUpperCase(); + const extractedTimezoneOffset = (_b = (_a = timezoneOverrides[timezoneAbbr]) !== null && _a !== void 0 ? _a : this.timezone[timezoneAbbr]) !== null && _b !== void 0 ? _b : null; + if (extractedTimezoneOffset === null) { + return; + } + context.debug(() => { + console.log(`Extracting timezone: '${timezoneAbbr}' into : ${extractedTimezoneOffset}`); + }); + const currentTimezoneOffset = result.start.get("timezoneOffset"); + if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) { + if (result.start.isCertain("timezoneOffset")) { + return; + } + if (timezoneAbbr != match[1]) { + return; + } + } + if (result.start.isOnlyDate()) { + if (timezoneAbbr != match[1]) { + return; + } + } + result.text += match[0]; + if (!result.start.isCertain("timezoneOffset")) { + result.start.assign("timezoneOffset", extractedTimezoneOffset); + } + if (result.end != null && !result.end.isCertain("timezoneOffset")) { + result.end.assign("timezoneOffset", extractedTimezoneOffset); + } + }); + return results; + } +} +ExtractTimezoneAbbrRefiner$1.default = ExtractTimezoneAbbrRefiner; + +var ExtractTimezoneOffsetRefiner$1 = {}; + +Object.defineProperty(ExtractTimezoneOffsetRefiner$1, "__esModule", { value: true }); +const TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?", "i"); +const TIMEZONE_OFFSET_SIGN_GROUP = 1; +const TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2; +const TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3; +class ExtractTimezoneOffsetRefiner { + refine(context, results) { + results.forEach(function (result) { + if (result.start.isCertain("timezoneOffset")) { + return; + } + const suffix = context.text.substring(result.index + result.text.length); + const match = TIMEZONE_OFFSET_PATTERN.exec(suffix); + if (!match) { + return; + } + context.debug(() => { + console.log(`Extracting timezone: '${match[0]}' into : ${result}`); + }); + const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]); + const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0"); + let timezoneOffset = hourOffset * 60 + minuteOffset; + if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") { + timezoneOffset = -timezoneOffset; + } + if (result.end != null) { + result.end.assign("timezoneOffset", timezoneOffset); + } + result.start.assign("timezoneOffset", timezoneOffset); + result.text += match[0]; + }); + return results; + } +} +ExtractTimezoneOffsetRefiner$1.default = ExtractTimezoneOffsetRefiner; + +var OverlapRemovalRefiner$1 = {}; + +Object.defineProperty(OverlapRemovalRefiner$1, "__esModule", { value: true }); +class OverlapRemovalRefiner { + refine(context, results) { + if (results.length < 2) { + return results; + } + const filteredResults = []; + let prevResult = results[0]; + for (let i = 1; i < results.length; i++) { + const result = results[i]; + if (result.index < prevResult.index + prevResult.text.length) { + if (result.text.length > prevResult.text.length) { + prevResult = result; + } + } + else { + filteredResults.push(prevResult); + prevResult = result; + } + } + if (prevResult != null) { + filteredResults.push(prevResult); + } + return filteredResults; + } +} +OverlapRemovalRefiner$1.default = OverlapRemovalRefiner; + +var ForwardDateRefiner$1 = {}; + +var __importDefault$E = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ForwardDateRefiner$1, "__esModule", { value: true }); +const dayjs_1$q = __importDefault$E(require$$0); +class ForwardDateRefiner { + refine(context, results) { + if (!context.option.forwardDate) { + return results; + } + results.forEach(function (result) { + let refMoment = (0, dayjs_1$q.default)(context.refDate); + if (result.start.isOnlyDayMonthComponent() && refMoment.isAfter(result.start.dayjs())) { + for (let i = 0; i < 3 && refMoment.isAfter(result.start.dayjs()); i++) { + result.start.imply("year", result.start.get("year") + 1); + context.debug(() => { + console.log(`Forward yearly adjusted for ${result} (${result.start})`); + }); + if (result.end && !result.end.isCertain("year")) { + result.end.imply("year", result.end.get("year") + 1); + context.debug(() => { + console.log(`Forward yearly adjusted for ${result} (${result.end})`); + }); + } + } + } + if (result.start.isOnlyWeekdayComponent() && refMoment.isAfter(result.start.dayjs())) { + if (refMoment.day() >= result.start.get("weekday")) { + refMoment = refMoment.day(result.start.get("weekday") + 7); + } + else { + refMoment = refMoment.day(result.start.get("weekday")); + } + result.start.imply("day", refMoment.date()); + result.start.imply("month", refMoment.month() + 1); + result.start.imply("year", refMoment.year()); + context.debug(() => { + console.log(`Forward weekly adjusted for ${result} (${result.start})`); + }); + if (result.end && result.end.isOnlyWeekdayComponent()) { + if (refMoment.day() > result.end.get("weekday")) { + refMoment = refMoment.day(result.end.get("weekday") + 7); + } + else { + refMoment = refMoment.day(result.end.get("weekday")); + } + result.end.imply("day", refMoment.date()); + result.end.imply("month", refMoment.month() + 1); + result.end.imply("year", refMoment.year()); + context.debug(() => { + console.log(`Forward weekly adjusted for ${result} (${result.end})`); + }); + } + } + }); + return results; + } +} +ForwardDateRefiner$1.default = ForwardDateRefiner; + +var UnlikelyFormatFilter$1 = {}; + +Object.defineProperty(UnlikelyFormatFilter$1, "__esModule", { value: true }); +const abstractRefiners_1$1 = abstractRefiners; +class UnlikelyFormatFilter extends abstractRefiners_1$1.Filter { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + isValid(context, result) { + if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) { + context.debug(() => { + console.log(`Removing unlikely result '${result.text}'`); + }); + return false; + } + if (!result.start.isValidDate()) { + context.debug(() => { + console.log(`Removing invalid result: ${result} (${result.start})`); + }); + return false; + } + if (result.end && !result.end.isValidDate()) { + context.debug(() => { + console.log(`Removing invalid result: ${result} (${result.end})`); + }); + return false; + } + if (this.strictMode) { + return this.isStrictModeValid(context, result); + } + return true; + } + isStrictModeValid(context, result) { + if (result.start.isOnlyWeekdayComponent()) { + context.debug(() => { + console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`); + }); + return false; + } + if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) { + context.debug(() => { + console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`); + }); + return false; + } + return true; + } +} +UnlikelyFormatFilter$1.default = UnlikelyFormatFilter; + +var ISOFormatParser$1 = {}; + +Object.defineProperty(ISOFormatParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$J = AbstractParserWithWordBoundary; +const PATTERN$u = new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})" + + "(?:T" + + "([0-9]{1,2}):([0-9]{1,2})" + + "(?:" + + ":([0-9]{1,2})(?:\\.(\\d{1,4}))?" + + ")?" + + "(?:" + + "Z|([+-]\\d{2}):?(\\d{2})?" + + ")?" + + ")?" + + "(?=\\W|$)", "i"); +const YEAR_NUMBER_GROUP$2 = 1; +const MONTH_NUMBER_GROUP$1 = 2; +const DATE_NUMBER_GROUP$1 = 3; +const HOUR_NUMBER_GROUP = 4; +const MINUTE_NUMBER_GROUP = 5; +const SECOND_NUMBER_GROUP = 6; +const MILLISECOND_NUMBER_GROUP = 7; +const TZD_HOUR_OFFSET_GROUP = 8; +const TZD_MINUTE_OFFSET_GROUP = 9; +class ISOFormatParser extends AbstractParserWithWordBoundary_1$J.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$u; + } + innerExtract(context, match) { + const components = {}; + components["year"] = parseInt(match[YEAR_NUMBER_GROUP$2]); + components["month"] = parseInt(match[MONTH_NUMBER_GROUP$1]); + components["day"] = parseInt(match[DATE_NUMBER_GROUP$1]); + if (match[HOUR_NUMBER_GROUP] != null) { + components["hour"] = parseInt(match[HOUR_NUMBER_GROUP]); + components["minute"] = parseInt(match[MINUTE_NUMBER_GROUP]); + if (match[SECOND_NUMBER_GROUP] != null) { + components["second"] = parseInt(match[SECOND_NUMBER_GROUP]); + } + if (match[MILLISECOND_NUMBER_GROUP] != null) { + components["millisecond"] = parseInt(match[MILLISECOND_NUMBER_GROUP]); + } + if (match[TZD_HOUR_OFFSET_GROUP] == null) { + components["timezoneOffset"] = 0; + } + else { + const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]); + let minuteOffset = 0; + if (match[TZD_MINUTE_OFFSET_GROUP] != null) { + minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]); + } + let offset = hourOffset * 60; + if (offset < 0) { + offset -= minuteOffset; + } + else { + offset += minuteOffset; + } + components["timezoneOffset"] = offset; + } + } + return components; + } +} +ISOFormatParser$1.default = ISOFormatParser; + +var MergeWeekdayComponentRefiner$1 = {}; + +Object.defineProperty(MergeWeekdayComponentRefiner$1, "__esModule", { value: true }); +const abstractRefiners_1 = abstractRefiners; +class MergeWeekdayComponentRefiner extends abstractRefiners_1.MergingRefiner { + mergeResults(textBetween, currentResult, nextResult) { + const newResult = nextResult.clone(); + newResult.index = currentResult.index; + newResult.text = currentResult.text + textBetween + newResult.text; + newResult.start.assign("weekday", currentResult.start.get("weekday")); + if (newResult.end) { + newResult.end.assign("weekday", currentResult.start.get("weekday")); + } + return newResult; + } + shouldMergeResults(textBetween, currentResult, nextResult) { + const weekdayThenNormalDate = currentResult.start.isOnlyWeekdayComponent() && + !currentResult.start.isCertain("hour") && + nextResult.start.isCertain("day"); + return weekdayThenNormalDate && textBetween.match(/^,?\s*$/) != null; + } +} +MergeWeekdayComponentRefiner$1.default = MergeWeekdayComponentRefiner; + +var __importDefault$D = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(configurations, "__esModule", { value: true }); +configurations.includeCommonConfiguration = void 0; +const ExtractTimezoneAbbrRefiner_1 = __importDefault$D(ExtractTimezoneAbbrRefiner$1); +const ExtractTimezoneOffsetRefiner_1 = __importDefault$D(ExtractTimezoneOffsetRefiner$1); +const OverlapRemovalRefiner_1 = __importDefault$D(OverlapRemovalRefiner$1); +const ForwardDateRefiner_1 = __importDefault$D(ForwardDateRefiner$1); +const UnlikelyFormatFilter_1 = __importDefault$D(UnlikelyFormatFilter$1); +const ISOFormatParser_1 = __importDefault$D(ISOFormatParser$1); +const MergeWeekdayComponentRefiner_1 = __importDefault$D(MergeWeekdayComponentRefiner$1); +function includeCommonConfiguration(configuration, strictMode = false) { + configuration.parsers.unshift(new ISOFormatParser_1.default()); + configuration.refiners.unshift(new MergeWeekdayComponentRefiner_1.default()); + configuration.refiners.unshift(new ExtractTimezoneAbbrRefiner_1.default()); + configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner_1.default()); + configuration.refiners.unshift(new OverlapRemovalRefiner_1.default()); + configuration.refiners.push(new OverlapRemovalRefiner_1.default()); + configuration.refiners.push(new ForwardDateRefiner_1.default()); + configuration.refiners.push(new UnlikelyFormatFilter_1.default(strictMode)); + return configuration; +} +configurations.includeCommonConfiguration = includeCommonConfiguration; + +var ENCasualDateParser$1 = {}; + +var casualReferences = {}; + +var __importDefault$C = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(casualReferences, "__esModule", { value: true }); +casualReferences.tonight = casualReferences.tomorrow = casualReferences.yesterday = casualReferences.today = casualReferences.now = void 0; +const results_1$b = results; +const dayjs_1$p = __importDefault$C(require$$0); +const dayjs_2$8 = dayjs; +const index_1$a = dist; +function now(reference) { + const targetDate = (0, dayjs_1$p.default)(reference.instant); + const component = new results_1$b.ParsingComponents(reference, {}); + (0, dayjs_2$8.assignSimilarDate)(component, targetDate); + (0, dayjs_2$8.assignSimilarTime)(component, targetDate); + if (reference.timezoneOffset !== null) { + component.assign("timezoneOffset", targetDate.utcOffset()); + } + return component; +} +casualReferences.now = now; +function today(reference) { + const targetDate = (0, dayjs_1$p.default)(reference.instant); + const component = new results_1$b.ParsingComponents(reference, {}); + (0, dayjs_2$8.assignSimilarDate)(component, targetDate); + (0, dayjs_2$8.implySimilarTime)(component, targetDate); + return component; +} +casualReferences.today = today; +function yesterday(reference) { + let targetDate = (0, dayjs_1$p.default)(reference.instant); + const component = new results_1$b.ParsingComponents(reference, {}); + targetDate = targetDate.add(-1, "day"); + (0, dayjs_2$8.assignSimilarDate)(component, targetDate); + (0, dayjs_2$8.implySimilarTime)(component, targetDate); + return component; +} +casualReferences.yesterday = yesterday; +function tomorrow(reference) { + const targetDate = (0, dayjs_1$p.default)(reference.instant); + const component = new results_1$b.ParsingComponents(reference, {}); + (0, dayjs_2$8.assignTheNextDay)(component, targetDate); + return component; +} +casualReferences.tomorrow = tomorrow; +function tonight(reference, implyHour = 22) { + const targetDate = (0, dayjs_1$p.default)(reference.instant); + const component = new results_1$b.ParsingComponents(reference, {}); + component.imply("hour", implyHour); + component.imply("meridiem", index_1$a.Meridiem.PM); + (0, dayjs_2$8.assignSimilarDate)(component, targetDate); + return component; +} +casualReferences.tonight = tonight; + +var __createBinding$5 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$5 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$5 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$5(result, mod, k); + __setModuleDefault$5(result, mod); + return result; +}; +var __importDefault$B = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ENCasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$o = __importDefault$B(require$$0); +const AbstractParserWithWordBoundary_1$I = AbstractParserWithWordBoundary; +const dayjs_2$7 = dayjs; +const references$5 = __importStar$5(casualReferences); +const PATTERN$t = /(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i; +class ENCasualDateParser extends AbstractParserWithWordBoundary_1$I.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return PATTERN$t; + } + innerExtract(context, match) { + let targetDate = (0, dayjs_1$o.default)(context.refDate); + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "now": + return references$5.now(context.reference); + case "today": + return references$5.today(context.reference); + case "yesterday": + return references$5.yesterday(context.reference); + case "tomorrow": + case "tmr": + case "tmrw": + return references$5.tomorrow(context.reference); + case "tonight": + return references$5.tonight(context.reference); + default: + if (lowerText.match(/last\s*night/)) { + if (targetDate.hour() > 6) { + targetDate = targetDate.add(-1, "day"); + } + (0, dayjs_2$7.assignSimilarDate)(component, targetDate); + component.imply("hour", 0); + } + break; + } + return component; + } +} +ENCasualDateParser$1.default = ENCasualDateParser; + +var ENCasualTimeParser$1 = {}; + +var __importDefault$A = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ENCasualTimeParser$1, "__esModule", { value: true }); +const index_1$9 = dist; +const AbstractParserWithWordBoundary_1$H = AbstractParserWithWordBoundary; +const dayjs_1$n = __importDefault$A(require$$0); +const dayjs_2$6 = dayjs; +const PATTERN$s = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|noon)(?=\W|$)/i; +class ENCasualTimeParser extends AbstractParserWithWordBoundary_1$H.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$s; + } + innerExtract(context, match) { + const targetDate = (0, dayjs_1$n.default)(context.refDate); + const component = context.createParsingComponents(); + switch (match[1].toLowerCase()) { + case "afternoon": + component.imply("meridiem", index_1$9.Meridiem.PM); + component.imply("hour", 15); + break; + case "evening": + case "night": + component.imply("meridiem", index_1$9.Meridiem.PM); + component.imply("hour", 20); + break; + case "midnight": + (0, dayjs_2$6.assignTheNextDay)(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "morning": + component.imply("meridiem", index_1$9.Meridiem.AM); + component.imply("hour", 6); + break; + case "noon": + component.imply("meridiem", index_1$9.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } +} +ENCasualTimeParser$1.default = ENCasualTimeParser; + +var ENWeekdayParser$1 = {}; + +var weeks = {}; + +var __importDefault$z = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(weeks, "__esModule", { value: true }); +weeks.toDayJSClosestWeekday = weeks.toDayJSWeekday = void 0; +const dayjs_1$m = __importDefault$z(require$$0); +function toDayJSWeekday(refDate, offset, modifier, locale) { + var _a; + if (!modifier) { + return toDayJSClosestWeekday(refDate, offset, locale); + } + let date = (0, dayjs_1$m.default)(refDate).locale("en", locale); + const weekStart = (_a = locale === null || locale === void 0 ? void 0 : locale.weekStart) !== null && _a !== void 0 ? _a : 0; + const weekdayOffset = (7 + offset - weekStart) % 7; + switch (modifier) { + case "this": + date = date.weekday(weekdayOffset); + break; + case "next": + date = date.weekday(weekdayOffset + 7); + break; + case "last": + date = date.weekday(weekdayOffset - 7); + break; + } + return date; +} +weeks.toDayJSWeekday = toDayJSWeekday; +function toDayJSClosestWeekday(refDate, offset, locale) { + var _a; + let date = (0, dayjs_1$m.default)(refDate).locale("en", locale); + const refOffset = date.weekday(); + const weekStart = (_a = locale === null || locale === void 0 ? void 0 : locale.weekStart) !== null && _a !== void 0 ? _a : 0; + const weekdayOffset = (7 + offset - weekStart) % 7; + if (Math.abs(weekdayOffset - 7 - refOffset) < Math.abs(weekdayOffset - refOffset)) { + date = date.weekday(weekdayOffset - 7); + } + else if (Math.abs(weekdayOffset + 7 - refOffset) < Math.abs(weekdayOffset - refOffset)) { + date = date.weekday(weekdayOffset + 7); + } + else { + date = date.weekday(weekdayOffset); + } + return date; +} +weeks.toDayJSClosestWeekday = toDayJSClosestWeekday; + +Object.defineProperty(ENWeekdayParser$1, "__esModule", { value: true }); +const constants_1$v = constants$7; +const pattern_1$d = pattern; +const AbstractParserWithWordBoundary_1$G = AbstractParserWithWordBoundary; +const weeks_1$4 = weeks; +const PATTERN$r = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + + "(?:on\\s*?)?" + + "(?:(this|last|past|next)\\s*)?" + + `(${(0, pattern_1$d.matchAnyPattern)(constants_1$v.WEEKDAY_DICTIONARY)})` + + "(?:\\s*(?:\\,|\\)|\\)))?" + + "(?:\\s*(this|last|past|next)\\s*week)?" + + "(?=\\W|$)", "i"); +const PREFIX_GROUP$3 = 1; +const WEEKDAY_GROUP$4 = 2; +const POSTFIX_GROUP$3 = 3; +class ENWeekdayParser extends AbstractParserWithWordBoundary_1$G.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$r; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP$4].toLowerCase(); + const offset = constants_1$v.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP$3]; + const postfix = match[POSTFIX_GROUP$3]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord == "last" || modifierWord == "past") { + modifier = "last"; + } + else if (modifierWord == "next") { + modifier = "next"; + } + else if (modifierWord == "this") { + modifier = "this"; + } + const date = (0, weeks_1$4.toDayJSWeekday)(context.refDate, offset, modifier, context.option.locale); + return context + .createParsingComponents() + .assign("weekday", offset) + .imply("day", date.date()) + .imply("month", date.month() + 1) + .imply("year", date.year()); + } +} +ENWeekdayParser$1.default = ENWeekdayParser; + +var ENRelativeDateFormatParser$1 = {}; + +var __importDefault$y = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ENRelativeDateFormatParser$1, "__esModule", { value: true }); +const constants_1$u = constants$7; +const results_1$a = results; +const dayjs_1$l = __importDefault$y(require$$0); +const AbstractParserWithWordBoundary_1$F = AbstractParserWithWordBoundary; +const pattern_1$c = pattern; +const PATTERN$q = new RegExp(`(this|next|last|past)\\s*(${(0, pattern_1$c.matchAnyPattern)(constants_1$u.TIME_UNIT_DICTIONARY)})(?=\\s*)` + "(?=\\W|$)", "i"); +const MODIFIER_WORD_GROUP$1 = 1; +const RELATIVE_WORD_GROUP$1 = 2; +class ENRelativeDateFormatParser extends AbstractParserWithWordBoundary_1$F.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$q; + } + innerExtract(context, match) { + const modifier = match[MODIFIER_WORD_GROUP$1].toLowerCase(); + const unitWord = match[RELATIVE_WORD_GROUP$1].toLowerCase(); + const timeunit = constants_1$u.TIME_UNIT_DICTIONARY[unitWord]; + if (modifier == "next") { + const timeUnits = {}; + timeUnits[timeunit] = 1; + return results_1$a.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + if (modifier == "last" || modifier == "past") { + const timeUnits = {}; + timeUnits[timeunit] = -1; + return results_1$a.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + const components = context.createParsingComponents(); + let date = (0, dayjs_1$l.default)(context.reference.instant); + if (unitWord.match(/week/i)) { + date = date.add(-date.get("d"), "d"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.imply("year", date.year()); + } + else if (unitWord.match(/month/i)) { + date = date.add(-date.date() + 1, "d"); + components.imply("day", date.date()); + components.assign("year", date.year()); + components.assign("month", date.month() + 1); + } + else if (unitWord.match(/year/i)) { + date = date.add(-date.date() + 1, "d"); + date = date.add(-date.month(), "month"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.assign("year", date.year()); + } + return components; + } +} +ENRelativeDateFormatParser$1.default = ENRelativeDateFormatParser; + +var chrono$1 = {}; + +Object.defineProperty(chrono$1, "__esModule", { value: true }); +chrono$1.ParsingContext = chrono$1.Chrono = void 0; +const results_1$9 = results; +const en_1 = en$1; +class Chrono { + constructor(configuration) { + configuration = configuration || (0, en_1.createCasualConfiguration)(); + this.parsers = [...configuration.parsers]; + this.refiners = [...configuration.refiners]; + } + clone() { + return new Chrono({ + parsers: [...this.parsers], + refiners: [...this.refiners], + }); + } + parseDate(text, referenceDate, option) { + const results = this.parse(text, referenceDate, option); + return results.length > 0 ? results[0].start.date() : null; + } + parse(text, referenceDate, option) { + const context = new ParsingContext(text, referenceDate, option); + let results = []; + this.parsers.forEach((parser) => { + const parsedResults = Chrono.executeParser(context, parser); + results = results.concat(parsedResults); + }); + results.sort((a, b) => { + return a.index - b.index; + }); + this.refiners.forEach(function (refiner) { + results = refiner.refine(context, results); + }); + return results; + } + static executeParser(context, parser) { + const results = []; + const pattern = parser.pattern(context); + const originalText = context.text; + let remainingText = context.text; + let match = pattern.exec(remainingText); + while (match) { + const index = match.index + originalText.length - remainingText.length; + match.index = index; + const result = parser.extract(context, match); + if (!result) { + remainingText = originalText.substring(match.index + 1); + match = pattern.exec(remainingText); + continue; + } + let parsedResult = null; + if (result instanceof results_1$9.ParsingResult) { + parsedResult = result; + } + else if (result instanceof results_1$9.ParsingComponents) { + parsedResult = context.createParsingResult(match.index, match[0]); + parsedResult.start = result; + } + else { + parsedResult = context.createParsingResult(match.index, match[0], result); + } + context.debug(() => console.log(`${parser.constructor.name} extracted result ${parsedResult}`)); + results.push(parsedResult); + remainingText = originalText.substring(index + parsedResult.text.length); + match = pattern.exec(remainingText); + } + return results; + } +} +chrono$1.Chrono = Chrono; +class ParsingContext { + constructor(text, refDate, option) { + this.text = text; + this.reference = new results_1$9.ReferenceWithTimezone(refDate); + this.option = option !== null && option !== void 0 ? option : {}; + this.refDate = this.reference.instant; + } + createParsingComponents(components) { + if (components instanceof results_1$9.ParsingComponents) { + return components; + } + return new results_1$9.ParsingComponents(this.reference, components); + } + createParsingResult(index, textOrEndIndex, startComponents, endComponents) { + const text = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex); + const start = startComponents ? this.createParsingComponents(startComponents) : null; + const end = endComponents ? this.createParsingComponents(endComponents) : null; + return new results_1$9.ParsingResult(this.reference, index, text, start, end); + } + debug(block) { + if (this.option.debug) { + if (this.option.debug instanceof Function) { + this.option.debug(block); + } + else { + const handler = this.option.debug; + handler.debug(block); + } + } + } +} +chrono$1.ParsingContext = ParsingContext; + +var SlashDateFormatParser$1 = {}; + +Object.defineProperty(SlashDateFormatParser$1, "__esModule", { value: true }); +const years_1$6 = years; +const PATTERN$p = new RegExp("([^\\d]|^)" + + "([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})" + + "(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?" + + "(\\W|$)", "i"); +const OPENING_GROUP = 1; +const ENDING_GROUP = 5; +const FIRST_NUMBERS_GROUP = 2; +const SECOND_NUMBERS_GROUP = 3; +const YEAR_GROUP$8 = 4; +class SlashDateFormatParser { + constructor(littleEndian) { + this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP; + this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP; + } + pattern() { + return PATTERN$p; + } + extract(context, match) { + if (match[OPENING_GROUP] == "/" || match[ENDING_GROUP] == "/") { + match.index += match[0].length; + return; + } + const index = match.index + match[OPENING_GROUP].length; + const text = match[0].substr(match[OPENING_GROUP].length, match[0].length - match[OPENING_GROUP].length - match[ENDING_GROUP].length); + if (text.match(/^\d\.\d$/) || text.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) { + return; + } + if (!match[YEAR_GROUP$8] && match[0].indexOf("/") < 0) { + return; + } + const result = context.createParsingResult(index, text); + let month = parseInt(match[this.groupNumberMonth]); + let day = parseInt(match[this.groupNumberDay]); + if (month < 1 || month > 12) { + if (month > 12) { + if (day >= 1 && day <= 12 && month <= 31) { + [day, month] = [month, day]; + } + else { + return null; + } + } + } + if (day < 1 || day > 31) { + return null; + } + result.start.assign("day", day); + result.start.assign("month", month); + if (match[YEAR_GROUP$8]) { + const rawYearNumber = parseInt(match[YEAR_GROUP$8]); + const year = (0, years_1$6.findMostLikelyADYear)(rawYearNumber); + result.start.assign("year", year); + } + else { + const year = (0, years_1$6.findYearClosestToRef)(context.refDate, day, month); + result.start.imply("year", year); + } + return result; + } +} +SlashDateFormatParser$1.default = SlashDateFormatParser; + +var ENTimeUnitCasualRelativeFormatParser$1 = {}; + +Object.defineProperty(ENTimeUnitCasualRelativeFormatParser$1, "__esModule", { value: true }); +const constants_1$t = constants$7; +const results_1$8 = results; +const AbstractParserWithWordBoundary_1$E = AbstractParserWithWordBoundary; +const timeunits_1$5 = timeunits; +const PATTERN$o = new RegExp(`(this|last|past|next|\\+|-)\\s*(${constants_1$t.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); +class ENTimeUnitCasualRelativeFormatParser extends AbstractParserWithWordBoundary_1$E.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$o; + } + innerExtract(context, match) { + const prefix = match[1].toLowerCase(); + let timeUnits = (0, constants_1$t.parseTimeUnits)(match[2]); + switch (prefix) { + case "last": + case "past": + case "-": + timeUnits = (0, timeunits_1$5.reverseTimeUnits)(timeUnits); + break; + } + return results_1$8.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } +} +ENTimeUnitCasualRelativeFormatParser$1.default = ENTimeUnitCasualRelativeFormatParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.GB = exports.strict = exports.casual = void 0; +const ENTimeUnitWithinFormatParser_1 = __importDefault(ENTimeUnitWithinFormatParser$1); +const ENMonthNameLittleEndianParser_1 = __importDefault(ENMonthNameLittleEndianParser$1); +const ENMonthNameMiddleEndianParser_1 = __importDefault(ENMonthNameMiddleEndianParser$1); +const ENMonthNameParser_1 = __importDefault(ENMonthNameParser$1); +const ENCasualYearMonthDayParser_1 = __importDefault(ENCasualYearMonthDayParser$1); +const ENSlashMonthFormatParser_1 = __importDefault(ENSlashMonthFormatParser$1); +const ENTimeExpressionParser_1 = __importDefault(ENTimeExpressionParser$1); +const ENTimeUnitAgoFormatParser_1 = __importDefault(ENTimeUnitAgoFormatParser$1); +const ENTimeUnitLaterFormatParser_1 = __importDefault(ENTimeUnitLaterFormatParser$1); +const ENMergeDateRangeRefiner_1 = __importDefault(ENMergeDateRangeRefiner$1); +const ENMergeDateTimeRefiner_1 = __importDefault(ENMergeDateTimeRefiner$2); +const configurations_1 = configurations; +const ENCasualDateParser_1 = __importDefault(ENCasualDateParser$1); +const ENCasualTimeParser_1 = __importDefault(ENCasualTimeParser$1); +const ENWeekdayParser_1 = __importDefault(ENWeekdayParser$1); +const ENRelativeDateFormatParser_1 = __importDefault(ENRelativeDateFormatParser$1); +const chrono_1 = chrono$1; +const SlashDateFormatParser_1 = __importDefault(SlashDateFormatParser$1); +const ENTimeUnitCasualRelativeFormatParser_1 = __importDefault(ENTimeUnitCasualRelativeFormatParser$1); +exports.casual = new chrono_1.Chrono(createCasualConfiguration(false)); +exports.strict = new chrono_1.Chrono(createConfiguration(true, false)); +exports.GB = new chrono_1.Chrono(createConfiguration(false, true)); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration(littleEndian = false) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new ENCasualDateParser_1.default()); + option.parsers.unshift(new ENCasualTimeParser_1.default()); + option.parsers.unshift(new ENMonthNameParser_1.default()); + option.parsers.unshift(new ENRelativeDateFormatParser_1.default()); + option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration(strictMode = true, littleEndian = false) { + return (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new ENTimeUnitWithinFormatParser_1.default(), + new ENMonthNameLittleEndianParser_1.default(), + new ENMonthNameMiddleEndianParser_1.default(), + new ENWeekdayParser_1.default(), + new ENCasualYearMonthDayParser_1.default(), + new ENSlashMonthFormatParser_1.default(), + new ENTimeExpressionParser_1.default(strictMode), + new ENTimeUnitAgoFormatParser_1.default(strictMode), + new ENTimeUnitLaterFormatParser_1.default(strictMode), + ], + refiners: [new ENMergeDateTimeRefiner_1.default(), new ENMergeDateRangeRefiner_1.default()], + }, strictMode); +} +exports.createConfiguration = createConfiguration; +}(en$1)); + +var de = {}; + +var DETimeExpressionParser$1 = {}; + +Object.defineProperty(DETimeExpressionParser$1, "__esModule", { value: true }); +const AbstractTimeExpressionParser_1$3 = AbstractTimeExpressionParser$1; +const index_1$8 = dist; +class DETimeExpressionParser extends AbstractTimeExpressionParser_1$3.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:um|von)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\–|\\~|\\〜|bis)\\s*"; + } + primarySuffix() { + return "(?:\\s*uhr)?(?:\\s*(?:morgens|vormittags|nachmittags|abends|nachts))?(?=\\W|$)"; + } + extractPrimaryTimeComponents(context, match) { + const components = super.extractPrimaryTimeComponents(context, match); + if (components) { + if (match[0].endsWith("morgens") || match[0].endsWith("vormittags")) { + components.assign("meridiem", index_1$8.Meridiem.AM); + const hour = components.get("hour"); + if (hour < 12) { + components.assign("hour", components.get("hour")); + } + } + if (match[0].endsWith("nachmittags") || match[0].endsWith("abends") || match[0].endsWith("nachts")) { + components.assign("meridiem", index_1$8.Meridiem.PM); + const hour = components.get("hour"); + if (hour < 12) { + components.assign("hour", components.get("hour") + 12); + } + } + } + return components; + } +} +DETimeExpressionParser$1.default = DETimeExpressionParser; + +var DEWeekdayParser$1 = {}; + +var constants$6 = {}; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; +const pattern_1 = pattern; +const years_1 = years; +exports.WEEKDAY_DICTIONARY = { + "sonntag": 0, + "so": 0, + "montag": 1, + "mo": 1, + "dienstag": 2, + "di": 2, + "mittwoch": 3, + "mi": 3, + "donnerstag": 4, + "do": 4, + "freitag": 5, + "fr": 5, + "samstag": 6, + "sa": 6, +}; +exports.MONTH_DICTIONARY = { + "januar": 1, + "jan": 1, + "jan.": 1, + "februar": 2, + "feb": 2, + "feb.": 2, + "märz": 3, + "maerz": 3, + "mär": 3, + "mär.": 3, + "mrz": 3, + "mrz.": 3, + "april": 4, + "apr": 4, + "apr.": 4, + "mai": 5, + "juni": 6, + "jun": 6, + "jun.": 6, + "juli": 7, + "jul": 7, + "jul.": 7, + "august": 8, + "aug": 8, + "aug.": 8, + "september": 9, + "sep": 9, + "sep.": 9, + "sept": 9, + "sept.": 9, + "oktober": 10, + "okt": 10, + "okt.": 10, + "november": 11, + "nov": 11, + "nov.": 11, + "dezember": 12, + "dez": 12, + "dez.": 12, +}; +exports.INTEGER_WORD_DICTIONARY = { + "eins": 1, + "zwei": 2, + "drei": 3, + "vier": 4, + "fünf": 5, + "fuenf": 5, + "sechs": 6, + "sieben": 7, + "acht": 8, + "neun": 9, + "zehn": 10, + "elf": 11, + "zwölf": 12, + "zwoelf": 12, +}; +exports.TIME_UNIT_DICTIONARY = { + sec: "second", + second: "second", + seconds: "second", + min: "minute", + mins: "minute", + minute: "minute", + minutes: "minute", + h: "hour", + hr: "hour", + hrs: "hour", + hour: "hour", + hours: "hour", + day: "d", + days: "d", + week: "week", + weeks: "week", + month: "month", + months: "month", + y: "year", + yr: "year", + year: "year", + years: "year", +}; +exports.NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?\\b(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`; +function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } + else if (num === "a" || num === "an") { + return 1; + } + else if (num.match(/few/)) { + return 3; + } + else if (num.match(/half/)) { + return 0.5; + } + else if (num.match(/couple/)) { + return 2; + } + else if (num.match(/several/)) { + return 7; + } + return parseFloat(num); +} +exports.parseNumberPattern = parseNumberPattern; +exports.YEAR_PATTERN = `(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*C(?:hr)?\\.?)?)`; +function parseYear(match) { + if (/v/i.test(match)) { + return -parseInt(match.replace(/[^0-9]+/gi, "")); + } + if (/n/i.test(match)) { + return parseInt(match.replace(/[^0-9]+/gi, "")); + } + const rawYearNumber = parseInt(match); + return (0, years_1.findMostLikelyADYear)(rawYearNumber); +} +exports.parseYear = parseYear; +const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${(0, pattern_1.matchAnyPattern)(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; +const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); +exports.TIME_UNITS_PATTERN = (0, pattern_1.repeatedTimeunitPattern)("", SINGLE_TIME_UNIT_PATTERN); +function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; +} +exports.parseTimeUnits = parseTimeUnits; +function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; +} +}(constants$6)); + +Object.defineProperty(DEWeekdayParser$1, "__esModule", { value: true }); +const constants_1$s = constants$6; +const pattern_1$b = pattern; +const AbstractParserWithWordBoundary_1$D = AbstractParserWithWordBoundary; +const weeks_1$3 = weeks; +const PATTERN$n = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + + "(?:a[mn]\\s*?)?" + + "(?:(diese[mn]|letzte[mn]|n(?:ä|ae)chste[mn])\\s*)?" + + `(${(0, pattern_1$b.matchAnyPattern)(constants_1$s.WEEKDAY_DICTIONARY)})` + + "(?:\\s*(?:\\,|\\)|\\)))?" + + "(?:\\s*(diese|letzte|n(?:ä|ae)chste)\\s*woche)?" + + "(?=\\W|$)", "i"); +const PREFIX_GROUP$2 = 1; +const SUFFIX_GROUP = 3; +const WEEKDAY_GROUP$3 = 2; +class DEWeekdayParser extends AbstractParserWithWordBoundary_1$D.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$n; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP$3].toLowerCase(); + const offset = constants_1$s.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP$2]; + const postfix = match[SUFFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord.match(/letzte/)) { + modifier = "last"; + } + else if (modifierWord.match(/chste/)) { + modifier = "next"; + } + else if (modifierWord.match(/diese/)) { + modifier = "this"; + } + const date = (0, weeks_1$3.toDayJSWeekday)(context.refDate, offset, modifier); + return context + .createParsingComponents() + .assign("weekday", offset) + .imply("day", date.date()) + .imply("month", date.month() + 1) + .imply("year", date.year()); + } +} +DEWeekdayParser$1.default = DEWeekdayParser; + +var DEMergeDateRangeRefiner$1 = {}; + +var __importDefault$x = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(DEMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$6 = __importDefault$x(AbstractMergeDateRangeRefiner$1); +class DEMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$6.default { + patternBetween() { + return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i; + } +} +DEMergeDateRangeRefiner$1.default = DEMergeDateRangeRefiner; + +var DEMergeDateTimeRefiner$1 = {}; + +var __importDefault$w = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(DEMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$5 = __importDefault$w(AbstractMergeDateTimeRefiner); +class DEMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$5.default { + patternBetween() { + return new RegExp("^\\s*(T|um|am|,|-)?\\s*$"); + } +} +DEMergeDateTimeRefiner$1.default = DEMergeDateTimeRefiner; + +var DECasualDateParser$1 = {}; + +var DECasualTimeParser$1 = {}; + +var __importDefault$v = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(DECasualTimeParser$1, "__esModule", { value: true }); +const dayjs_1$k = __importDefault$v(require$$0); +const index_1$7 = dist; +const AbstractParserWithWordBoundary_1$C = AbstractParserWithWordBoundary; +const dayjs_2$5 = dayjs; +const timeunits_1$4 = timeunits; +class DECasualTimeParser extends AbstractParserWithWordBoundary_1$C.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = (0, dayjs_1$k.default)(context.refDate); + const timeKeywordPattern = match[2].toLowerCase(); + const component = context.createParsingComponents(); + (0, dayjs_2$5.implySimilarTime)(component, targetDate); + return DECasualTimeParser.extractTimeComponents(component, timeKeywordPattern); + } + static extractTimeComponents(component, timeKeywordPattern) { + switch (timeKeywordPattern) { + case "morgen": + component.imply("hour", 6); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.AM); + break; + case "vormittag": + component.imply("hour", 9); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.AM); + break; + case "mittag": + case "mittags": + component.imply("hour", 12); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.AM); + break; + case "nachmittag": + component.imply("hour", 15); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.PM); + break; + case "abend": + component.imply("hour", 18); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.PM); + break; + case "nacht": + component.imply("hour", 22); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.PM); + break; + case "mitternacht": + if (component.get("hour") > 1) { + component = (0, timeunits_1$4.addImpliedTimeUnits)(component, { "day": 1 }); + } + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + component.imply("meridiem", index_1$7.Meridiem.AM); + break; + } + return component; + } +} +DECasualTimeParser$1.default = DECasualTimeParser; + +var __createBinding$4 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$4 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$4 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$4(result, mod, k); + __setModuleDefault$4(result, mod); + return result; +}; +var __importDefault$u = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(DECasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$j = __importDefault$u(require$$0); +const AbstractParserWithWordBoundary_1$B = AbstractParserWithWordBoundary; +const dayjs_2$4 = dayjs; +const DECasualTimeParser_1 = __importDefault$u(DECasualTimeParser$1); +const references$4 = __importStar$4(casualReferences); +const PATTERN$m = new RegExp(`(jetzt|heute|morgen|übermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)` + + `(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?` + + `(?=\\W|$)`, "i"); +const DATE_GROUP$5 = 1; +const TIME_GROUP = 2; +class DECasualDateParser extends AbstractParserWithWordBoundary_1$B.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return PATTERN$m; + } + innerExtract(context, match) { + let targetDate = (0, dayjs_1$j.default)(context.refDate); + const dateKeyword = (match[DATE_GROUP$5] || "").toLowerCase(); + const timeKeyword = (match[TIME_GROUP] || "").toLowerCase(); + let component = context.createParsingComponents(); + switch (dateKeyword) { + case "jetzt": + component = references$4.now(context.reference); + break; + case "heute": + component = references$4.today(context.reference); + break; + case "morgen": + (0, dayjs_2$4.assignTheNextDay)(component, targetDate); + break; + case "übermorgen": + case "uebermorgen": + targetDate = targetDate.add(1, "day"); + (0, dayjs_2$4.assignTheNextDay)(component, targetDate); + break; + case "gestern": + targetDate = targetDate.add(-1, "day"); + (0, dayjs_2$4.assignSimilarDate)(component, targetDate); + (0, dayjs_2$4.implySimilarTime)(component, targetDate); + break; + case "vorgestern": + targetDate = targetDate.add(-2, "day"); + (0, dayjs_2$4.assignSimilarDate)(component, targetDate); + (0, dayjs_2$4.implySimilarTime)(component, targetDate); + break; + default: + if (dateKeyword.match(/letzte\s*nacht/)) { + if (targetDate.hour() > 6) { + targetDate = targetDate.add(-1, "day"); + } + (0, dayjs_2$4.assignSimilarDate)(component, targetDate); + component.imply("hour", 0); + } + break; + } + if (timeKeyword) { + component = DECasualTimeParser_1.default.extractTimeComponents(component, timeKeyword); + } + return component; + } +} +DECasualDateParser$1.default = DECasualDateParser; + +var DEMonthNameLittleEndianParser$1 = {}; + +Object.defineProperty(DEMonthNameLittleEndianParser$1, "__esModule", { value: true }); +const years_1$5 = years; +const constants_1$r = constants$6; +const constants_2$4 = constants$6; +const pattern_1$a = pattern; +const AbstractParserWithWordBoundary_1$A = AbstractParserWithWordBoundary; +const PATTERN$l = new RegExp("(?:am\\s*?)?" + + "(?:den\\s*?)?" + + `([0-9]{1,2})\\.` + + `(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\–|\\s)\\s*([0-9]{1,2})\\.?)?\\s*` + + `(${(0, pattern_1$a.matchAnyPattern)(constants_1$r.MONTH_DICTIONARY)})` + + `(?:(?:-|/|,?\\s*)(${constants_2$4.YEAR_PATTERN}(?![^\\s]\\d)))?` + + `(?=\\W|$)`, "i"); +const DATE_GROUP$4 = 1; +const DATE_TO_GROUP$3 = 2; +const MONTH_NAME_GROUP$5 = 3; +const YEAR_GROUP$7 = 4; +class DEMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1$A.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$l; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1$r.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$5].toLowerCase()]; + const day = parseInt(match[DATE_GROUP$4]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP$4].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP$7]) { + const yearNumber = (0, constants_2$4.parseYear)(match[YEAR_GROUP$7]); + result.start.assign("year", yearNumber); + } + else { + const year = (0, years_1$5.findYearClosestToRef)(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP$3]) { + const endDate = parseInt(match[DATE_TO_GROUP$3]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } +} +DEMonthNameLittleEndianParser$1.default = DEMonthNameLittleEndianParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; +const configurations_1 = configurations; +const chrono_1 = chrono$1; +const SlashDateFormatParser_1 = __importDefault(SlashDateFormatParser$1); +const ISOFormatParser_1 = __importDefault(ISOFormatParser$1); +const DETimeExpressionParser_1 = __importDefault(DETimeExpressionParser$1); +const DEWeekdayParser_1 = __importDefault(DEWeekdayParser$1); +const DEMergeDateRangeRefiner_1 = __importDefault(DEMergeDateRangeRefiner$1); +const DEMergeDateTimeRefiner_1 = __importDefault(DEMergeDateTimeRefiner$1); +const DECasualDateParser_1 = __importDefault(DECasualDateParser$1); +const DECasualTimeParser_1 = __importDefault(DECasualTimeParser$1); +const DEMonthNameLittleEndianParser_1 = __importDefault(DEMonthNameLittleEndianParser$1); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration(true)); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new DECasualTimeParser_1.default()); + option.parsers.unshift(new DECasualDateParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration(strictMode = true, littleEndian = true) { + return (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new ISOFormatParser_1.default(), + new SlashDateFormatParser_1.default(littleEndian), + new DETimeExpressionParser_1.default(), + new DEMonthNameLittleEndianParser_1.default(), + new DEWeekdayParser_1.default(), + ], + refiners: [new DEMergeDateRangeRefiner_1.default(), new DEMergeDateTimeRefiner_1.default()], + }, strictMode); +} +exports.createConfiguration = createConfiguration; +}(de)); + +var fr = {}; + +var FRCasualDateParser$1 = {}; + +var __createBinding$3 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$3 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$3 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$3(result, mod, k); + __setModuleDefault$3(result, mod); + return result; +}; +var __importDefault$t = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(FRCasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$i = __importDefault$t(require$$0); +const index_1$6 = dist; +const AbstractParserWithWordBoundary_1$z = AbstractParserWithWordBoundary; +const dayjs_2$3 = dayjs; +const references$3 = __importStar$3(casualReferences); +class FRCasualDateParser extends AbstractParserWithWordBoundary_1$z.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i; + } + innerExtract(context, match) { + let targetDate = (0, dayjs_1$i.default)(context.refDate); + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "maintenant": + return references$3.now(context.reference); + case "aujourd'hui": + return references$3.today(context.reference); + case "hier": + return references$3.yesterday(context.reference); + case "demain": + return references$3.tomorrow(context.reference); + default: + if (lowerText.match(/cette\s*nuit/)) { + (0, dayjs_2$3.assignSimilarDate)(component, targetDate); + component.imply("hour", 22); + component.imply("meridiem", index_1$6.Meridiem.PM); + } + else if (lowerText.match(/la\s*veille/)) { + targetDate = targetDate.add(-1, "day"); + (0, dayjs_2$3.assignSimilarDate)(component, targetDate); + component.imply("hour", 0); + } + } + return component; + } +} +FRCasualDateParser$1.default = FRCasualDateParser; + +var FRCasualTimeParser$1 = {}; + +Object.defineProperty(FRCasualTimeParser$1, "__esModule", { value: true }); +const index_1$5 = dist; +const AbstractParserWithWordBoundary_1$y = AbstractParserWithWordBoundary; +class FRCasualTimeParser extends AbstractParserWithWordBoundary_1$y.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i; + } + innerExtract(context, match) { + const suffixLower = match[2].toLowerCase(); + const component = context.createParsingComponents(); + switch (suffixLower) { + case "après-midi": + case "aprem": + component.imply("hour", 14); + component.imply("minute", 0); + component.imply("meridiem", index_1$5.Meridiem.PM); + break; + case "soir": + component.imply("hour", 18); + component.imply("minute", 0); + component.imply("meridiem", index_1$5.Meridiem.PM); + break; + case "matin": + component.imply("hour", 8); + component.imply("minute", 0); + component.imply("meridiem", index_1$5.Meridiem.AM); + break; + case "a midi": + component.imply("hour", 12); + component.imply("minute", 0); + component.imply("meridiem", index_1$5.Meridiem.AM); + break; + case "à minuit": + component.imply("hour", 0); + component.imply("meridiem", index_1$5.Meridiem.AM); + break; + } + return component; + } +} +FRCasualTimeParser$1.default = FRCasualTimeParser; + +var FRTimeExpressionParser$1 = {}; + +Object.defineProperty(FRTimeExpressionParser$1, "__esModule", { value: true }); +const AbstractTimeExpressionParser_1$2 = AbstractTimeExpressionParser$1; +class FRTimeExpressionParser extends AbstractTimeExpressionParser_1$2.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:[àa])\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\–|\\~|\\〜|[àa]|\\?)\\s*"; + } + extractPrimaryTimeComponents(context, match) { + if (match[0].match(/^\s*\d{4}\s*$/)) { + return null; + } + return super.extractPrimaryTimeComponents(context, match); + } +} +FRTimeExpressionParser$1.default = FRTimeExpressionParser; + +var FRMergeDateTimeRefiner$1 = {}; + +var __importDefault$s = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(FRMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$4 = __importDefault$s(AbstractMergeDateTimeRefiner); +class FRMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$4.default { + patternBetween() { + return new RegExp("^\\s*(T|à|a|vers|de|,|-)?\\s*$"); + } +} +FRMergeDateTimeRefiner$1.default = FRMergeDateTimeRefiner; + +var FRMergeDateRangeRefiner$1 = {}; + +var __importDefault$r = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(FRMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$5 = __importDefault$r(AbstractMergeDateRangeRefiner$1); +class FRMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$5.default { + patternBetween() { + return /^\s*(à|a|-)\s*$/i; + } +} +FRMergeDateRangeRefiner$1.default = FRMergeDateRangeRefiner; + +var FRWeekdayParser$1 = {}; + +var constants$5 = {}; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; +const pattern_1 = pattern; +exports.WEEKDAY_DICTIONARY = { + "dimanche": 0, + "dim": 0, + "lundi": 1, + "lun": 1, + "mardi": 2, + "mar": 2, + "mercredi": 3, + "mer": 3, + "jeudi": 4, + "jeu": 4, + "vendredi": 5, + "ven": 5, + "samedi": 6, + "sam": 6, +}; +exports.MONTH_DICTIONARY = { + "janvier": 1, + "jan": 1, + "jan.": 1, + "février": 2, + "fév": 2, + "fév.": 2, + "fevrier": 2, + "fev": 2, + "fev.": 2, + "mars": 3, + "mar": 3, + "mar.": 3, + "avril": 4, + "avr": 4, + "avr.": 4, + "mai": 5, + "juin": 6, + "jun": 6, + "juillet": 7, + "juil": 7, + "jul": 7, + "jul.": 7, + "août": 8, + "aout": 8, + "septembre": 9, + "sep": 9, + "sep.": 9, + "sept": 9, + "sept.": 9, + "octobre": 10, + "oct": 10, + "oct.": 10, + "novembre": 11, + "nov": 11, + "nov.": 11, + "décembre": 12, + "decembre": 12, + "dec": 12, + "dec.": 12, +}; +exports.INTEGER_WORD_DICTIONARY = { + "un": 1, + "deux": 2, + "trois": 3, + "quatre": 4, + "cinq": 5, + "six": 6, + "sept": 7, + "huit": 8, + "neuf": 9, + "dix": 10, + "onze": 11, + "douze": 12, + "treize": 13, +}; +exports.TIME_UNIT_DICTIONARY = { + "sec": "second", + "seconde": "second", + "secondes": "second", + "min": "minute", + "mins": "minute", + "minute": "minute", + "minutes": "minute", + "h": "hour", + "hr": "hour", + "hrs": "hour", + "heure": "hour", + "heures": "hour", + "jour": "d", + "jours": "d", + "semaine": "week", + "semaines": "week", + "mois": "month", + "trimestre": "quarter", + "trimestres": "quarter", + "ans": "year", + "année": "year", + "années": "year", +}; +exports.NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`; +function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } + else if (num === "une" || num === "un") { + return 1; + } + else if (num.match(/quelques?/)) { + return 3; + } + else if (num.match(/demi-?/)) { + return 0.5; + } + return parseFloat(num); +} +exports.parseNumberPattern = parseNumberPattern; +exports.ORDINAL_NUMBER_PATTERN = `(?:[0-9]{1,2}(?:er)?)`; +function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + num = num.replace(/(?:er)$/i, ""); + return parseInt(num); +} +exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; +exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])`; +function parseYear(match) { + if (/AC/i.test(match)) { + match = match.replace(/BC/i, ""); + return -parseInt(match); + } + if (/AD/i.test(match) || /C/i.test(match)) { + match = match.replace(/[^\d]+/i, ""); + return parseInt(match); + } + let yearNumber = parseInt(match); + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } + else { + yearNumber = yearNumber + 2000; + } + } + return yearNumber; +} +exports.parseYear = parseYear; +const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${(0, pattern_1.matchAnyPattern)(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; +const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); +exports.TIME_UNITS_PATTERN = (0, pattern_1.repeatedTimeunitPattern)("", SINGLE_TIME_UNIT_PATTERN); +function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; +} +exports.parseTimeUnits = parseTimeUnits; +function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; +} +}(constants$5)); + +Object.defineProperty(FRWeekdayParser$1, "__esModule", { value: true }); +const constants_1$q = constants$5; +const pattern_1$9 = pattern; +const AbstractParserWithWordBoundary_1$x = AbstractParserWithWordBoundary; +const weeks_1$2 = weeks; +const PATTERN$k = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + + "(?:(?:ce)\\s*)?" + + `(${(0, pattern_1$9.matchAnyPattern)(constants_1$q.WEEKDAY_DICTIONARY)})` + + "(?:\\s*(?:\\,|\\)|\\)))?" + + "(?:\\s*(dernier|prochain)\\s*)?" + + "(?=\\W|\\d|$)", "i"); +const WEEKDAY_GROUP$2 = 1; +const POSTFIX_GROUP$2 = 2; +class FRWeekdayParser extends AbstractParserWithWordBoundary_1$x.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$k; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP$2].toLowerCase(); + const offset = constants_1$q.WEEKDAY_DICTIONARY[dayOfWeek]; + if (offset === undefined) { + return null; + } + let suffix = match[POSTFIX_GROUP$2]; + suffix = suffix || ""; + suffix = suffix.toLowerCase(); + let modifier = null; + if (suffix == "dernier") { + modifier = "last"; + } + else if (suffix == "prochain") { + modifier = "next"; + } + const date = (0, weeks_1$2.toDayJSWeekday)(context.refDate, offset, modifier); + return context + .createParsingComponents() + .assign("weekday", offset) + .imply("day", date.date()) + .imply("month", date.month() + 1) + .imply("year", date.year()); + } +} +FRWeekdayParser$1.default = FRWeekdayParser; + +var FRSpecificTimeExpressionParser$1 = {}; + +Object.defineProperty(FRSpecificTimeExpressionParser$1, "__esModule", { value: true }); +const index_1$4 = dist; +const FIRST_REG_PATTERN$2 = new RegExp("(^|\\s|T)" + + "(?:(?:[àa])\\s*)?" + + "(\\d{1,2})(?:h|:)?" + + "(?:(\\d{1,2})(?:m|:)?)?" + + "(?:(\\d{1,2})(?:s|:)?)?" + + "(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?" + + "(?=\\W|$)", "i"); +const SECOND_REG_PATTERN$2 = new RegExp("^\\s*(\\-|\\–|\\~|\\〜|[àa]|\\?)\\s*" + + "(\\d{1,2})(?:h|:)?" + + "(?:(\\d{1,2})(?:m|:)?)?" + + "(?:(\\d{1,2})(?:s|:)?)?" + + "(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?" + + "(?=\\W|$)", "i"); +const HOUR_GROUP$2 = 2; +const MINUTE_GROUP$2 = 3; +const SECOND_GROUP$2 = 4; +const AM_PM_HOUR_GROUP$2 = 5; +class FRSpecificTimeExpressionParser { + pattern(context) { + return FIRST_REG_PATTERN$2; + } + extract(context, match) { + const result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length)); + if (result.text.match(/^\d{4}$/)) { + match.index += match[0].length; + return null; + } + result.start = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match); + if (!result.start) { + match.index += match[0].length; + return null; + } + const remainingText = context.text.substring(match.index + match[0].length); + const secondMatch = SECOND_REG_PATTERN$2.exec(remainingText); + if (secondMatch) { + result.end = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch); + if (result.end) { + result.text += secondMatch[0]; + } + } + return result; + } + static extractTimeComponent(extractingComponents, match) { + let hour = 0; + let minute = 0; + let meridiem = null; + hour = parseInt(match[HOUR_GROUP$2]); + if (match[MINUTE_GROUP$2] != null) { + minute = parseInt(match[MINUTE_GROUP$2]); + } + if (minute >= 60 || hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = index_1$4.Meridiem.PM; + } + if (match[AM_PM_HOUR_GROUP$2] != null) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP$2][0].toLowerCase(); + if (ampm == "a") { + meridiem = index_1$4.Meridiem.AM; + if (hour == 12) { + hour = 0; + } + } + if (ampm == "p") { + meridiem = index_1$4.Meridiem.PM; + if (hour != 12) { + hour += 12; + } + } + } + extractingComponents.assign("hour", hour); + extractingComponents.assign("minute", minute); + if (meridiem !== null) { + extractingComponents.assign("meridiem", meridiem); + } + else { + if (hour < 12) { + extractingComponents.imply("meridiem", index_1$4.Meridiem.AM); + } + else { + extractingComponents.imply("meridiem", index_1$4.Meridiem.PM); + } + } + if (match[SECOND_GROUP$2] != null) { + const second = parseInt(match[SECOND_GROUP$2]); + if (second >= 60) + return null; + extractingComponents.assign("second", second); + } + return extractingComponents; + } +} +FRSpecificTimeExpressionParser$1.default = FRSpecificTimeExpressionParser; + +var FRMonthNameLittleEndianParser$1 = {}; + +Object.defineProperty(FRMonthNameLittleEndianParser$1, "__esModule", { value: true }); +const years_1$4 = years; +const constants_1$p = constants$5; +const constants_2$3 = constants$5; +const constants_3$1 = constants$5; +const pattern_1$8 = pattern; +const AbstractParserWithWordBoundary_1$w = AbstractParserWithWordBoundary; +const PATTERN$j = new RegExp("(?:on\\s*?)?" + + `(${constants_3$1.ORDINAL_NUMBER_PATTERN})` + + `(?:\\s*(?:au|\\-|\\–|jusqu'au?|\\s)\\s*(${constants_3$1.ORDINAL_NUMBER_PATTERN}))?` + + `(?:-|/|\\s*(?:de)?\\s*)` + + `(${(0, pattern_1$8.matchAnyPattern)(constants_1$p.MONTH_DICTIONARY)})` + + `(?:(?:-|/|,?\\s*)(${constants_2$3.YEAR_PATTERN}(?![^\\s]\\d)))?` + + `(?=\\W|$)`, "i"); +const DATE_GROUP$3 = 1; +const DATE_TO_GROUP$2 = 2; +const MONTH_NAME_GROUP$4 = 3; +const YEAR_GROUP$6 = 4; +class FRMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1$w.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$j; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1$p.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$4].toLowerCase()]; + const day = (0, constants_3$1.parseOrdinalNumberPattern)(match[DATE_GROUP$3]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP$3].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP$6]) { + const yearNumber = (0, constants_2$3.parseYear)(match[YEAR_GROUP$6]); + result.start.assign("year", yearNumber); + } + else { + const year = (0, years_1$4.findYearClosestToRef)(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP$2]) { + const endDate = (0, constants_3$1.parseOrdinalNumberPattern)(match[DATE_TO_GROUP$2]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } +} +FRMonthNameLittleEndianParser$1.default = FRMonthNameLittleEndianParser; + +var FRTimeUnitAgoFormatParser$2 = {}; + +Object.defineProperty(FRTimeUnitAgoFormatParser$2, "__esModule", { value: true }); +const constants_1$o = constants$5; +const results_1$7 = results; +const AbstractParserWithWordBoundary_1$v = AbstractParserWithWordBoundary; +const timeunits_1$3 = timeunits; +class FRTimeUnitAgoFormatParser$1 extends AbstractParserWithWordBoundary_1$v.AbstractParserWithWordBoundaryChecking { + constructor() { + super(); + } + innerPattern() { + return new RegExp(`il y a\\s*(${constants_1$o.TIME_UNITS_PATTERN})(?=(?:\\W|$))`, "i"); + } + innerExtract(context, match) { + const timeUnits = (0, constants_1$o.parseTimeUnits)(match[1]); + const outputTimeUnits = (0, timeunits_1$3.reverseTimeUnits)(timeUnits); + return results_1$7.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } +} +FRTimeUnitAgoFormatParser$2.default = FRTimeUnitAgoFormatParser$1; + +var FRTimeUnitWithinFormatParser$1 = {}; + +Object.defineProperty(FRTimeUnitWithinFormatParser$1, "__esModule", { value: true }); +const constants_1$n = constants$5; +const results_1$6 = results; +const AbstractParserWithWordBoundary_1$u = AbstractParserWithWordBoundary; +class FRTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1$u.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp(`(?:dans|en|pour|pendant)\\s*(${constants_1$n.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); + } + innerExtract(context, match) { + const timeUnits = (0, constants_1$n.parseTimeUnits)(match[1]); + return results_1$6.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } +} +FRTimeUnitWithinFormatParser$1.default = FRTimeUnitWithinFormatParser; + +var FRTimeUnitRelativeFormatParser = {}; + +Object.defineProperty(FRTimeUnitRelativeFormatParser, "__esModule", { value: true }); +const constants_1$m = constants$5; +const results_1$5 = results; +const AbstractParserWithWordBoundary_1$t = AbstractParserWithWordBoundary; +const timeunits_1$2 = timeunits; +const pattern_1$7 = pattern; +class FRTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1$t.AbstractParserWithWordBoundaryChecking { + constructor() { + super(); + } + innerPattern() { + return new RegExp(`(?:les?|la|l'|du|des?)\\s*` + + `(${constants_1$m.NUMBER_PATTERN})?` + + `(?:\\s*(prochaine?s?|derni[eè]re?s?|pass[ée]e?s?|pr[ée]c[ée]dents?|suivante?s?))?` + + `\\s*(${(0, pattern_1$7.matchAnyPattern)(constants_1$m.TIME_UNIT_DICTIONARY)})` + + `(?:\\s*(prochaine?s?|derni[eè]re?s?|pass[ée]e?s?|pr[ée]c[ée]dents?|suivante?s?))?`, "i"); + } + innerExtract(context, match) { + const num = match[1] ? (0, constants_1$m.parseNumberPattern)(match[1]) : 1; + const unit = constants_1$m.TIME_UNIT_DICTIONARY[match[3].toLowerCase()]; + let timeUnits = {}; + timeUnits[unit] = num; + let modifier = match[2] || match[4] || ""; + modifier = modifier.toLowerCase(); + if (!modifier) { + return; + } + if (/derni[eè]re?s?/.test(modifier) || /pass[ée]e?s?/.test(modifier) || /pr[ée]c[ée]dents?/.test(modifier)) { + timeUnits = (0, timeunits_1$2.reverseTimeUnits)(timeUnits); + } + return results_1$5.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } +} +FRTimeUnitRelativeFormatParser.default = FRTimeUnitAgoFormatParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; +const configurations_1 = configurations; +const chrono_1 = chrono$1; +const FRCasualDateParser_1 = __importDefault(FRCasualDateParser$1); +const FRCasualTimeParser_1 = __importDefault(FRCasualTimeParser$1); +const SlashDateFormatParser_1 = __importDefault(SlashDateFormatParser$1); +const FRTimeExpressionParser_1 = __importDefault(FRTimeExpressionParser$1); +const FRMergeDateTimeRefiner_1 = __importDefault(FRMergeDateTimeRefiner$1); +const FRMergeDateRangeRefiner_1 = __importDefault(FRMergeDateRangeRefiner$1); +const FRWeekdayParser_1 = __importDefault(FRWeekdayParser$1); +const FRSpecificTimeExpressionParser_1 = __importDefault(FRSpecificTimeExpressionParser$1); +const FRMonthNameLittleEndianParser_1 = __importDefault(FRMonthNameLittleEndianParser$1); +const FRTimeUnitAgoFormatParser_1 = __importDefault(FRTimeUnitAgoFormatParser$2); +const FRTimeUnitWithinFormatParser_1 = __importDefault(FRTimeUnitWithinFormatParser$1); +const FRTimeUnitRelativeFormatParser_1 = __importDefault(FRTimeUnitRelativeFormatParser); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration(true)); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new FRCasualDateParser_1.default()); + option.parsers.unshift(new FRCasualTimeParser_1.default()); + option.parsers.unshift(new FRTimeUnitRelativeFormatParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration(strictMode = true, littleEndian = true) { + return (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new FRMonthNameLittleEndianParser_1.default(), + new FRTimeExpressionParser_1.default(), + new FRSpecificTimeExpressionParser_1.default(), + new FRTimeUnitAgoFormatParser_1.default(), + new FRTimeUnitWithinFormatParser_1.default(), + new FRWeekdayParser_1.default(), + ], + refiners: [new FRMergeDateTimeRefiner_1.default(), new FRMergeDateRangeRefiner_1.default()], + }, strictMode); +} +exports.createConfiguration = createConfiguration; +}(fr)); + +var ja = {}; + +var JPStandardParser$1 = {}; + +var constants$4 = {}; + +Object.defineProperty(constants$4, "__esModule", { value: true }); +constants$4.toHankaku = void 0; +function toHankaku(text) { + return String(text) + .replace(/\u2019/g, "\u0027") + .replace(/\u201D/g, "\u0022") + .replace(/\u3000/g, "\u0020") + .replace(/\uFFE5/g, "\u00A5") + .replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g, alphaNum); +} +constants$4.toHankaku = toHankaku; +function alphaNum(token) { + return String.fromCharCode(token.charCodeAt(0) - 65248); +} + +var __importDefault$q = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(JPStandardParser$1, "__esModule", { value: true }); +const constants_1$l = constants$4; +const years_1$3 = years; +const dayjs_1$h = __importDefault$q(require$$0); +const PATTERN$i = /(?:(?:([同今本])|((昭和|平成|令和)?([0-90-9]{1,4}|元)))年\s*)?([0-90-9]{1,2})月\s*([0-90-9]{1,2})日/i; +const SPECIAL_YEAR_GROUP = 1; +const TYPICAL_YEAR_GROUP = 2; +const ERA_GROUP = 3; +const YEAR_NUMBER_GROUP$1 = 4; +const MONTH_GROUP$3 = 5; +const DAY_GROUP$3 = 6; +class JPStandardParser { + pattern() { + return PATTERN$i; + } + extract(context, match) { + const month = parseInt((0, constants_1$l.toHankaku)(match[MONTH_GROUP$3])); + const day = parseInt((0, constants_1$l.toHankaku)(match[DAY_GROUP$3])); + const components = context.createParsingComponents({ + day: day, + month: month, + }); + if (match[SPECIAL_YEAR_GROUP] && match[SPECIAL_YEAR_GROUP].match("同|今|本")) { + const moment = (0, dayjs_1$h.default)(context.refDate); + components.assign("year", moment.year()); + } + if (match[TYPICAL_YEAR_GROUP]) { + const yearNumText = match[YEAR_NUMBER_GROUP$1]; + let year = yearNumText == "元" ? 1 : parseInt((0, constants_1$l.toHankaku)(yearNumText)); + if (match[ERA_GROUP] == "令和") { + year += 2018; + } + else if (match[ERA_GROUP] == "平成") { + year += 1988; + } + else if (match[ERA_GROUP] == "昭和") { + year += 1925; + } + components.assign("year", year); + } + else { + const year = (0, years_1$3.findYearClosestToRef)(context.refDate, day, month); + components.imply("year", year); + } + return components; + } +} +JPStandardParser$1.default = JPStandardParser; + +var JPMergeDateRangeRefiner$1 = {}; + +var __importDefault$p = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(JPMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$4 = __importDefault$p(AbstractMergeDateRangeRefiner$1); +class JPMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$4.default { + patternBetween() { + return /^\s*(から|ー|-)\s*$/i; + } +} +JPMergeDateRangeRefiner$1.default = JPMergeDateRangeRefiner; + +var JPCasualDateParser$1 = {}; + +var __createBinding$2 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$2 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$2 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$2(result, mod, k); + __setModuleDefault$2(result, mod); + return result; +}; +var __importDefault$o = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(JPCasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$g = __importDefault$o(require$$0); +const index_1$3 = dist; +const references$2 = __importStar$2(casualReferences); +const PATTERN$h = /今日|当日|昨日|明日|今夜|今夕|今晩|今朝/i; +class JPCasualDateParser { + pattern() { + return PATTERN$h; + } + extract(context, match) { + const text = match[0]; + const date = (0, dayjs_1$g.default)(context.refDate); + const components = context.createParsingComponents(); + switch (text) { + case "昨日": + return references$2.yesterday(context.reference); + case "明日": + return references$2.tomorrow(context.reference); + case "今日": + case "当日": + return references$2.today(context.reference); + } + if (text == "今夜" || text == "今夕" || text == "今晩") { + components.imply("hour", 22); + components.assign("meridiem", index_1$3.Meridiem.PM); + } + else if (text.match("今朝")) { + components.imply("hour", 6); + components.assign("meridiem", index_1$3.Meridiem.AM); + } + components.assign("day", date.date()); + components.assign("month", date.month() + 1); + components.assign("year", date.year()); + return components; + } +} +JPCasualDateParser$1.default = JPCasualDateParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; +const JPStandardParser_1 = __importDefault(JPStandardParser$1); +const JPMergeDateRangeRefiner_1 = __importDefault(JPMergeDateRangeRefiner$1); +const JPCasualDateParser_1 = __importDefault(JPCasualDateParser$1); +const chrono_1 = chrono$1; +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration()); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new JPCasualDateParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration() { + return { + parsers: [new JPStandardParser_1.default()], + refiners: [new JPMergeDateRangeRefiner_1.default()], + }; +} +exports.createConfiguration = createConfiguration; +}(ja)); + +var pt = {}; + +var PTWeekdayParser$1 = {}; + +var constants$3 = {}; + +Object.defineProperty(constants$3, "__esModule", { value: true }); +constants$3.parseYear = constants$3.YEAR_PATTERN = constants$3.MONTH_DICTIONARY = constants$3.WEEKDAY_DICTIONARY = void 0; +constants$3.WEEKDAY_DICTIONARY = { + "domingo": 0, + "dom": 0, + "segunda": 1, + "segunda-feira": 1, + "seg": 1, + "terça": 2, + "terça-feira": 2, + "ter": 2, + "quarta": 3, + "quarta-feira": 3, + "qua": 3, + "quinta": 4, + "quinta-feira": 4, + "qui": 4, + "sexta": 5, + "sexta-feira": 5, + "sex": 5, + "sábado": 6, + "sabado": 6, + "sab": 6, +}; +constants$3.MONTH_DICTIONARY = { + "janeiro": 1, + "jan": 1, + "jan.": 1, + "fevereiro": 2, + "fev": 2, + "fev.": 2, + "março": 3, + "mar": 3, + "mar.": 3, + "abril": 4, + "abr": 4, + "abr.": 4, + "maio": 5, + "mai": 5, + "mai.": 5, + "junho": 6, + "jun": 6, + "jun.": 6, + "julho": 7, + "jul": 7, + "jul.": 7, + "agosto": 8, + "ago": 8, + "ago.": 8, + "setembro": 9, + "set": 9, + "set.": 9, + "outubro": 10, + "out": 10, + "out.": 10, + "novembro": 11, + "nov": 11, + "nov.": 11, + "dezembro": 12, + "dez": 12, + "dez.": 12, +}; +constants$3.YEAR_PATTERN = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?"; +function parseYear(match) { + if (match.match(/^[0-9]{1,4}$/)) { + let yearNumber = parseInt(match); + if (yearNumber < 100) { + if (yearNumber > 50) { + yearNumber = yearNumber + 1900; + } + else { + yearNumber = yearNumber + 2000; + } + } + return yearNumber; + } + if (match.match(/a\.?\s*c\.?/i)) { + match = match.replace(/a\.?\s*c\.?/i, ""); + return -parseInt(match); + } + return parseInt(match); +} +constants$3.parseYear = parseYear; + +Object.defineProperty(PTWeekdayParser$1, "__esModule", { value: true }); +const constants_1$k = constants$3; +const pattern_1$6 = pattern; +const AbstractParserWithWordBoundary_1$s = AbstractParserWithWordBoundary; +const weeks_1$1 = weeks; +const PATTERN$g = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + + "(?:(este|esta|passado|pr[oó]ximo)\\s*)?" + + `(${(0, pattern_1$6.matchAnyPattern)(constants_1$k.WEEKDAY_DICTIONARY)})` + + "(?:\\s*(?:\\,|\\)|\\)))?" + + "(?:\\s*(este|esta|passado|pr[óo]ximo)\\s*semana)?" + + "(?=\\W|\\d|$)", "i"); +const PREFIX_GROUP$1 = 1; +const WEEKDAY_GROUP$1 = 2; +const POSTFIX_GROUP$1 = 3; +class PTWeekdayParser extends AbstractParserWithWordBoundary_1$s.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$g; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP$1].toLowerCase(); + const offset = constants_1$k.WEEKDAY_DICTIONARY[dayOfWeek]; + if (offset === undefined) { + return null; + } + const prefix = match[PREFIX_GROUP$1]; + const postfix = match[POSTFIX_GROUP$1]; + let norm = prefix || postfix || ""; + norm = norm.toLowerCase(); + let modifier = null; + if (norm == "passado") { + modifier = "this"; + } + else if (norm == "próximo" || norm == "proximo") { + modifier = "next"; + } + else if (norm == "este") { + modifier = "this"; + } + const date = (0, weeks_1$1.toDayJSWeekday)(context.refDate, offset, modifier); + return context + .createParsingComponents() + .assign("weekday", offset) + .imply("day", date.date()) + .imply("month", date.month() + 1) + .imply("year", date.year()); + } +} +PTWeekdayParser$1.default = PTWeekdayParser; + +var PTTimeExpressionParser$1 = {}; + +Object.defineProperty(PTTimeExpressionParser$1, "__esModule", { value: true }); +const AbstractTimeExpressionParser_1$1 = AbstractTimeExpressionParser$1; +class PTTimeExpressionParser extends AbstractTimeExpressionParser_1$1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:ao?|às?|das|da|de|do)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\–|\\~|\\〜|a(?:o)?|\\?)\\s*"; + } +} +PTTimeExpressionParser$1.default = PTTimeExpressionParser; + +var PTMergeDateTimeRefiner$1 = {}; + +var __importDefault$n = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(PTMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$3 = __importDefault$n(AbstractMergeDateTimeRefiner); +class PTMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$3.default { + patternBetween() { + return new RegExp("^\\s*(?:,|à)?\\s*$"); + } +} +PTMergeDateTimeRefiner$1.default = PTMergeDateTimeRefiner; + +var PTMergeDateRangeRefiner$1 = {}; + +var __importDefault$m = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(PTMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$3 = __importDefault$m(AbstractMergeDateRangeRefiner$1); +class PTMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$3.default { + patternBetween() { + return /^\s*(?:-)\s*$/i; + } +} +PTMergeDateRangeRefiner$1.default = PTMergeDateRangeRefiner; + +var PTMonthNameLittleEndianParser$1 = {}; + +Object.defineProperty(PTMonthNameLittleEndianParser$1, "__esModule", { value: true }); +const years_1$2 = years; +const constants_1$j = constants$3; +const constants_2$2 = constants$3; +const pattern_1$5 = pattern; +const AbstractParserWithWordBoundary_1$r = AbstractParserWithWordBoundary; +const PATTERN$f = new RegExp(`([0-9]{1,2})(?:º|ª|°)?` + + "(?:\\s*(?:desde|de|\\-|\\–|ao?|\\s)\\s*([0-9]{1,2})(?:º|ª|°)?)?\\s*(?:de)?\\s*" + + `(?:-|/|\\s*(?:de|,)?\\s*)` + + `(${(0, pattern_1$5.matchAnyPattern)(constants_1$j.MONTH_DICTIONARY)})` + + `(?:\\s*(?:de|,)?\\s*(${constants_2$2.YEAR_PATTERN}))?` + + `(?=\\W|$)`, "i"); +const DATE_GROUP$2 = 1; +const DATE_TO_GROUP$1 = 2; +const MONTH_NAME_GROUP$3 = 3; +const YEAR_GROUP$5 = 4; +class PTMonthNameLittleEndianParser extends AbstractParserWithWordBoundary_1$r.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$f; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const month = constants_1$j.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$3].toLowerCase()]; + const day = parseInt(match[DATE_GROUP$2]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP$2].length; + return null; + } + result.start.assign("month", month); + result.start.assign("day", day); + if (match[YEAR_GROUP$5]) { + const yearNumber = (0, constants_2$2.parseYear)(match[YEAR_GROUP$5]); + result.start.assign("year", yearNumber); + } + else { + const year = (0, years_1$2.findYearClosestToRef)(context.refDate, day, month); + result.start.imply("year", year); + } + if (match[DATE_TO_GROUP$1]) { + const endDate = parseInt(match[DATE_TO_GROUP$1]); + result.end = result.start.clone(); + result.end.assign("day", endDate); + } + return result; + } +} +PTMonthNameLittleEndianParser$1.default = PTMonthNameLittleEndianParser; + +var PTCasualDateParser$1 = {}; + +var __createBinding$1 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault$1 = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar$1 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k); + __setModuleDefault$1(result, mod); + return result; +}; +Object.defineProperty(PTCasualDateParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$q = AbstractParserWithWordBoundary; +const references$1 = __importStar$1(casualReferences); +class PTCasualDateParser extends AbstractParserWithWordBoundary_1$q.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i; + } + innerExtract(context, match) { + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "agora": + return references$1.now(context.reference); + case "hoje": + return references$1.today(context.reference); + case "amanha": + case "amanhã": + return references$1.tomorrow(context.reference); + case "ontem": + return references$1.yesterday(context.reference); + } + return component; + } +} +PTCasualDateParser$1.default = PTCasualDateParser; + +var PTCasualTimeParser$1 = {}; + +var __importDefault$l = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(PTCasualTimeParser$1, "__esModule", { value: true }); +const index_1$2 = dist; +const AbstractParserWithWordBoundary_1$p = AbstractParserWithWordBoundary; +const dayjs_1$f = dayjs; +const dayjs_2$2 = __importDefault$l(require$$0); +class PTCasualTimeParser extends AbstractParserWithWordBoundary_1$p.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return /(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = (0, dayjs_2$2.default)(context.refDate); + const component = context.createParsingComponents(); + switch (match[1].toLowerCase()) { + case "tarde": + component.imply("meridiem", index_1$2.Meridiem.PM); + component.imply("hour", 15); + break; + case "noite": + component.imply("meridiem", index_1$2.Meridiem.PM); + component.imply("hour", 22); + break; + case "manha": + case "manhã": + component.imply("meridiem", index_1$2.Meridiem.AM); + component.imply("hour", 6); + break; + case "meia-noite": + (0, dayjs_1$f.assignTheNextDay)(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "meio-dia": + component.imply("meridiem", index_1$2.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } +} +PTCasualTimeParser$1.default = PTCasualTimeParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; +const configurations_1 = configurations; +const chrono_1 = chrono$1; +const SlashDateFormatParser_1 = __importDefault(SlashDateFormatParser$1); +const PTWeekdayParser_1 = __importDefault(PTWeekdayParser$1); +const PTTimeExpressionParser_1 = __importDefault(PTTimeExpressionParser$1); +const PTMergeDateTimeRefiner_1 = __importDefault(PTMergeDateTimeRefiner$1); +const PTMergeDateRangeRefiner_1 = __importDefault(PTMergeDateRangeRefiner$1); +const PTMonthNameLittleEndianParser_1 = __importDefault(PTMonthNameLittleEndianParser$1); +const PTCasualDateParser_1 = __importDefault(PTCasualDateParser$1); +const PTCasualTimeParser_1 = __importDefault(PTCasualTimeParser$1); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration(true)); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.push(new PTCasualDateParser_1.default()); + option.parsers.push(new PTCasualTimeParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration(strictMode = true, littleEndian = true) { + return (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new PTWeekdayParser_1.default(), + new PTTimeExpressionParser_1.default(), + new PTMonthNameLittleEndianParser_1.default(), + ], + refiners: [new PTMergeDateTimeRefiner_1.default(), new PTMergeDateRangeRefiner_1.default()], + }, strictMode); +} +exports.createConfiguration = createConfiguration; +}(pt)); + +var nl = {}; + +var NLMergeDateRangeRefiner$1 = {}; + +var __importDefault$k = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(NLMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$2 = __importDefault$k(AbstractMergeDateRangeRefiner$1); +class NLMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$2.default { + patternBetween() { + return /^\s*(tot|-)\s*$/i; + } +} +NLMergeDateRangeRefiner$1.default = NLMergeDateRangeRefiner; + +var NLMergeDateTimeRefiner$1 = {}; + +var __importDefault$j = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(NLMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$2 = __importDefault$j(AbstractMergeDateTimeRefiner); +class NLMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$2.default { + patternBetween() { + return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$"); + } +} +NLMergeDateTimeRefiner$1.default = NLMergeDateTimeRefiner; + +var NLCasualDateParser$1 = {}; + +var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(NLCasualDateParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$o = AbstractParserWithWordBoundary; +const references = __importStar(casualReferences); +class NLCasualDateParser extends AbstractParserWithWordBoundary_1$o.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i; + } + innerExtract(context, match) { + const lowerText = match[0].toLowerCase(); + const component = context.createParsingComponents(); + switch (lowerText) { + case "nu": + return references.now(context.reference); + case "vandaag": + return references.today(context.reference); + case "morgen": + case "morgend": + return references.tomorrow(context.reference); + case "gisteren": + return references.yesterday(context.reference); + } + return component; + } +} +NLCasualDateParser$1.default = NLCasualDateParser; + +var NLCasualTimeParser$1 = {}; + +var __importDefault$i = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(NLCasualTimeParser$1, "__esModule", { value: true }); +const index_1$1 = dist; +const AbstractParserWithWordBoundary_1$n = AbstractParserWithWordBoundary; +const dayjs_1$e = __importDefault$i(require$$0); +const dayjs_2$1 = dayjs; +const DAY_GROUP$2 = 1; +const MOMENT_GROUP = 2; +class NLCasualTimeParser extends AbstractParserWithWordBoundary_1$n.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return /(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i; + } + innerExtract(context, match) { + const targetDate = (0, dayjs_1$e.default)(context.refDate); + const component = context.createParsingComponents(); + if (match[DAY_GROUP$2] === "deze") { + component.assign("day", context.refDate.getDate()); + component.assign("month", context.refDate.getMonth() + 1); + component.assign("year", context.refDate.getFullYear()); + } + switch (match[MOMENT_GROUP].toLowerCase()) { + case "namiddag": + case "'s namiddags": + component.imply("meridiem", index_1$1.Meridiem.PM); + component.imply("hour", 15); + break; + case "avond": + case "'s avonds'": + component.imply("meridiem", index_1$1.Meridiem.PM); + component.imply("hour", 20); + break; + case "middernacht": + (0, dayjs_2$1.assignTheNextDay)(component, targetDate); + component.imply("hour", 0); + component.imply("minute", 0); + component.imply("second", 0); + break; + case "ochtend": + case "'s ochtends": + component.imply("meridiem", index_1$1.Meridiem.AM); + component.imply("hour", 6); + break; + case "middag": + case "'s middags": + component.imply("meridiem", index_1$1.Meridiem.AM); + component.imply("hour", 12); + break; + } + return component; + } +} +NLCasualTimeParser$1.default = NLCasualTimeParser; + +var NLTimeUnitWithinFormatParser$1 = {}; + +var constants$2 = {}; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0; +const pattern_1 = pattern; +const years_1 = years; +exports.WEEKDAY_DICTIONARY = { + zondag: 0, + zon: 0, + "zon.": 0, + zo: 0, + "zo.": 0, + maandag: 1, + ma: 1, + "ma.": 1, + dinsdag: 2, + din: 2, + "din.": 2, + di: 2, + "di.": 2, + woensdag: 3, + woe: 3, + "woe.": 3, + wo: 3, + "wo.": 3, + donderdag: 4, + dond: 4, + "dond.": 4, + do: 4, + "do.": 4, + vrijdag: 5, + vrij: 5, + "vrij.": 5, + vr: 5, + "vr.": 5, + zaterdag: 6, + zat: 6, + "zat.": 6, + "za": 6, + "za.": 6, +}; +exports.MONTH_DICTIONARY = { + januari: 1, + jan: 1, + "jan.": 1, + februari: 2, + feb: 2, + "feb.": 2, + maart: 3, + mar: 3, + "mar.": 3, + april: 4, + apr: 4, + "apr.": 4, + mei: 5, + juni: 6, + jun: 6, + "jun.": 6, + juli: 7, + jul: 7, + "jul.": 7, + augustus: 8, + aug: 8, + "aug.": 8, + september: 9, + sep: 9, + "sep.": 9, + sept: 9, + "sept.": 9, + oktober: 10, + okt: 10, + "okt.": 10, + november: 11, + nov: 11, + "nov.": 11, + december: 12, + dec: 12, + "dec.": 12, +}; +exports.INTEGER_WORD_DICTIONARY = { + een: 1, + twee: 2, + drie: 3, + vier: 4, + vijf: 5, + zes: 6, + zeven: 7, + acht: 8, + negen: 9, + tien: 10, + elf: 11, + twaalf: 12, +}; +exports.ORDINAL_WORD_DICTIONARY = { + eerste: 1, + tweede: 2, + derde: 3, + vierde: 4, + vijfde: 5, + zesde: 6, + zevende: 7, + achtste: 8, + negende: 9, + tiende: 10, + elfde: 11, + twaalfde: 12, + dertiende: 13, + veertiende: 14, + vijftiende: 15, + zestiende: 16, + zeventiende: 17, + achttiende: 18, + negentiende: 19, + twintigste: 20, + "eenentwintigste": 21, + "tweeëntwintigste": 22, + "drieentwintigste": 23, + "vierentwintigste": 24, + "vijfentwintigste": 25, + "zesentwintigste": 26, + "zevenentwintigste": 27, + "achtentwintig": 28, + "negenentwintig": 29, + "dertigste": 30, + "eenendertigste": 31, +}; +exports.TIME_UNIT_DICTIONARY = { + sec: "second", + second: "second", + seconden: "second", + min: "minute", + mins: "minute", + minute: "minute", + minuut: "minute", + minuten: "minute", + minuutje: "minute", + h: "hour", + hr: "hour", + hrs: "hour", + uur: "hour", + u: "hour", + uren: "hour", + dag: "d", + dagen: "d", + week: "week", + weken: "week", + maand: "month", + maanden: "month", + jaar: "year", + jr: "year", + jaren: "year", +}; +exports.NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+[\\.,][0-9]+|halve?|half|paar)`; +function parseNumberPattern(match) { + const num = match.toLowerCase(); + if (exports.INTEGER_WORD_DICTIONARY[num] !== undefined) { + return exports.INTEGER_WORD_DICTIONARY[num]; + } + else if (num === "paar") { + return 2; + } + else if (num === "half" || num.match(/halve?/)) { + return 0.5; + } + return parseFloat(num.replace(",", ".")); +} +exports.parseNumberPattern = parseNumberPattern; +exports.ORDINAL_NUMBER_PATTERN = `(?:${(0, pattern_1.matchAnyPattern)(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:ste|de)?)`; +function parseOrdinalNumberPattern(match) { + let num = match.toLowerCase(); + if (exports.ORDINAL_WORD_DICTIONARY[num] !== undefined) { + return exports.ORDINAL_WORD_DICTIONARY[num]; + } + num = num.replace(/(?:ste|de)$/i, ""); + return parseInt(num); +} +exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern; +exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])`; +function parseYear(match) { + if (/voor Christus/i.test(match)) { + match = match.replace(/voor Christus/i, ""); + return -parseInt(match); + } + if (/na Christus/i.test(match)) { + match = match.replace(/na Christus/i, ""); + return parseInt(match); + } + const rawYearNumber = parseInt(match); + return (0, years_1.findMostLikelyADYear)(rawYearNumber); +} +exports.parseYear = parseYear; +const SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${(0, pattern_1.matchAnyPattern)(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`; +const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i"); +exports.TIME_UNITS_PATTERN = (0, pattern_1.repeatedTimeunitPattern)(`(?:(?:binnen|in)\\s*)?`, SINGLE_TIME_UNIT_PATTERN); +function parseTimeUnits(timeunitText) { + const fragments = {}; + let remainingText = timeunitText; + let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + while (match) { + collectDateTimeFragment(fragments, match); + remainingText = remainingText.substring(match[0].length); + match = SINGLE_TIME_UNIT_REGEX.exec(remainingText); + } + return fragments; +} +exports.parseTimeUnits = parseTimeUnits; +function collectDateTimeFragment(fragments, match) { + const num = parseNumberPattern(match[1]); + const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()]; + fragments[unit] = num; +} +}(constants$2)); + +Object.defineProperty(NLTimeUnitWithinFormatParser$1, "__esModule", { value: true }); +const constants_1$i = constants$2; +const results_1$4 = results; +const AbstractParserWithWordBoundary_1$m = AbstractParserWithWordBoundary; +class NLTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1$m.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp(`(?:binnen|in|binnen de|voor)\\s*` + "(" + constants_1$i.TIME_UNITS_PATTERN + ")" + `(?=\\W|$)`, "i"); + } + innerExtract(context, match) { + const timeUnits = (0, constants_1$i.parseTimeUnits)(match[1]); + return results_1$4.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } +} +NLTimeUnitWithinFormatParser$1.default = NLTimeUnitWithinFormatParser; + +var NLWeekdayParser$1 = {}; + +Object.defineProperty(NLWeekdayParser$1, "__esModule", { value: true }); +const constants_1$h = constants$2; +const pattern_1$4 = pattern; +const AbstractParserWithWordBoundary_1$l = AbstractParserWithWordBoundary; +const weeks_1 = weeks; +const PATTERN$e = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + + "(?:op\\s*?)?" + + "(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?" + + `(${(0, pattern_1$4.matchAnyPattern)(constants_1$h.WEEKDAY_DICTIONARY)})` + + "(?=\\W|$)", "i"); +const PREFIX_GROUP = 1; +const WEEKDAY_GROUP = 2; +const POSTFIX_GROUP = 3; +class NLWeekdayParser extends AbstractParserWithWordBoundary_1$l.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$e; + } + innerExtract(context, match) { + const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase(); + const offset = constants_1$h.WEEKDAY_DICTIONARY[dayOfWeek]; + const prefix = match[PREFIX_GROUP]; + const postfix = match[POSTFIX_GROUP]; + let modifierWord = prefix || postfix; + modifierWord = modifierWord || ""; + modifierWord = modifierWord.toLowerCase(); + let modifier = null; + if (modifierWord == "vorige") { + modifier = "last"; + } + else if (modifierWord == "volgende") { + modifier = "next"; + } + else if (modifierWord == "deze") { + modifier = "this"; + } + const date = (0, weeks_1.toDayJSWeekday)(context.refDate, offset, modifier); + return context + .createParsingComponents() + .assign("weekday", offset) + .imply("day", date.date()) + .imply("month", date.month() + 1) + .imply("year", date.year()); + } +} +NLWeekdayParser$1.default = NLWeekdayParser; + +var NLMonthNameMiddleEndianParser$1 = {}; + +Object.defineProperty(NLMonthNameMiddleEndianParser$1, "__esModule", { value: true }); +const years_1$1 = years; +const constants_1$g = constants$2; +const constants_2$1 = constants$2; +const constants_3 = constants$2; +const pattern_1$3 = pattern; +const AbstractParserWithWordBoundary_1$k = AbstractParserWithWordBoundary; +const PATTERN$d = new RegExp("(?:on\\s*?)?" + + `(${constants_2$1.ORDINAL_NUMBER_PATTERN})` + + "(?:\\s*" + + "(?:tot|\\-|\\–|until|through|till|\\s)\\s*" + + `(${constants_2$1.ORDINAL_NUMBER_PATTERN})` + + ")?" + + "(?:-|/|\\s*(?:of)?\\s*)" + + "(" + + (0, pattern_1$3.matchAnyPattern)(constants_1$g.MONTH_DICTIONARY) + + ")" + + "(?:" + + "(?:-|/|,?\\s*)" + + `(${constants_3.YEAR_PATTERN}(?![^\\s]\\d))` + + ")?" + + "(?=\\W|$)", "i"); +const MONTH_NAME_GROUP$2 = 3; +const DATE_GROUP$1 = 1; +const DATE_TO_GROUP = 2; +const YEAR_GROUP$4 = 4; +class NLMonthNameMiddleEndianParser extends AbstractParserWithWordBoundary_1$k.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$d; + } + innerExtract(context, match) { + const month = constants_1$g.MONTH_DICTIONARY[match[MONTH_NAME_GROUP$2].toLowerCase()]; + const day = (0, constants_2$1.parseOrdinalNumberPattern)(match[DATE_GROUP$1]); + if (day > 31) { + match.index = match.index + match[DATE_GROUP$1].length; + return null; + } + const components = context.createParsingComponents({ + day: day, + month: month, + }); + if (match[YEAR_GROUP$4]) { + const year = (0, constants_3.parseYear)(match[YEAR_GROUP$4]); + components.assign("year", year); + } + else { + const year = (0, years_1$1.findYearClosestToRef)(context.refDate, day, month); + components.imply("year", year); + } + if (!match[DATE_TO_GROUP]) { + return components; + } + const endDate = (0, constants_2$1.parseOrdinalNumberPattern)(match[DATE_TO_GROUP]); + const result = context.createParsingResult(match.index, match[0]); + result.start = components; + result.end = components.clone(); + result.end.assign("day", endDate); + return result; + } +} +NLMonthNameMiddleEndianParser$1.default = NLMonthNameMiddleEndianParser; + +var NLMonthNameParser$1 = {}; + +Object.defineProperty(NLMonthNameParser$1, "__esModule", { value: true }); +const constants_1$f = constants$2; +const years_1 = years; +const pattern_1$2 = pattern; +const constants_2 = constants$2; +const AbstractParserWithWordBoundary_1$j = AbstractParserWithWordBoundary; +const PATTERN$c = new RegExp(`(${(0, pattern_1$2.matchAnyPattern)(constants_1$f.MONTH_DICTIONARY)})` + + `\\s*` + + `(?:` + + `[,-]?\\s*(${constants_2.YEAR_PATTERN})?` + + ")?" + + "(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)", "i"); +const MONTH_NAME_GROUP$1 = 1; +const YEAR_GROUP$3 = 2; +class NLMonthNameParser extends AbstractParserWithWordBoundary_1$j.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$c; + } + innerExtract(context, match) { + const components = context.createParsingComponents(); + components.imply("day", 1); + const monthName = match[MONTH_NAME_GROUP$1]; + const month = constants_1$f.MONTH_DICTIONARY[monthName.toLowerCase()]; + components.assign("month", month); + if (match[YEAR_GROUP$3]) { + const year = (0, constants_2.parseYear)(match[YEAR_GROUP$3]); + components.assign("year", year); + } + else { + const year = (0, years_1.findYearClosestToRef)(context.refDate, 1, month); + components.imply("year", year); + } + return components; + } +} +NLMonthNameParser$1.default = NLMonthNameParser; + +var NLSlashMonthFormatParser$1 = {}; + +Object.defineProperty(NLSlashMonthFormatParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$i = AbstractParserWithWordBoundary; +const PATTERN$b = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})" + "", "i"); +const MONTH_GROUP$2 = 1; +const YEAR_GROUP$2 = 2; +class NLSlashMonthFormatParser extends AbstractParserWithWordBoundary_1$i.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$b; + } + innerExtract(context, match) { + const year = parseInt(match[YEAR_GROUP$2]); + const month = parseInt(match[MONTH_GROUP$2]); + return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year); + } +} +NLSlashMonthFormatParser$1.default = NLSlashMonthFormatParser; + +var NLTimeExpressionParser$1 = {}; + +Object.defineProperty(NLTimeExpressionParser$1, "__esModule", { value: true }); +const AbstractTimeExpressionParser_1 = AbstractTimeExpressionParser$1; +class NLTimeExpressionParser extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser { + primaryPrefix() { + return "(?:(?:om)\\s*)?"; + } + followingPhase() { + return "\\s*(?:\\-|\\–|\\~|\\〜|om|\\?)\\s*"; + } + primarySuffix() { + return "(?:\\s*(?:uur))?(?!/)(?=\\W|$)"; + } + extractPrimaryTimeComponents(context, match) { + if (match[0].match(/^\s*\d{4}\s*$/)) { + return null; + } + return super.extractPrimaryTimeComponents(context, match); + } +} +NLTimeExpressionParser$1.default = NLTimeExpressionParser; + +var NLCasualYearMonthDayParser$1 = {}; + +Object.defineProperty(NLCasualYearMonthDayParser$1, "__esModule", { value: true }); +const constants_1$e = constants$2; +const pattern_1$1 = pattern; +const AbstractParserWithWordBoundary_1$h = AbstractParserWithWordBoundary; +const PATTERN$a = new RegExp(`([0-9]{4})[\\.\\/\\s]` + + `(?:(${(0, pattern_1$1.matchAnyPattern)(constants_1$e.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]` + + `([0-9]{1,2})` + + "(?=\\W|$)", "i"); +const YEAR_NUMBER_GROUP = 1; +const MONTH_NAME_GROUP = 2; +const MONTH_NUMBER_GROUP = 3; +const DATE_NUMBER_GROUP = 4; +class NLCasualYearMonthDayParser extends AbstractParserWithWordBoundary_1$h.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$a; + } + innerExtract(context, match) { + const month = match[MONTH_NUMBER_GROUP] + ? parseInt(match[MONTH_NUMBER_GROUP]) + : constants_1$e.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()]; + if (month < 1 || month > 12) { + return null; + } + const year = parseInt(match[YEAR_NUMBER_GROUP]); + const day = parseInt(match[DATE_NUMBER_GROUP]); + return { + day: day, + month: month, + year: year, + }; + } +} +NLCasualYearMonthDayParser$1.default = NLCasualYearMonthDayParser; + +var NLCasualDateTimeParser$1 = {}; + +var __importDefault$h = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(NLCasualDateTimeParser$1, "__esModule", { value: true }); +const AbstractParserWithWordBoundary_1$g = AbstractParserWithWordBoundary; +const index_1 = dist; +const dayjs_1$d = dayjs; +const dayjs_2 = __importDefault$h(require$$0); +const DATE_GROUP = 1; +const TIME_OF_DAY_GROUP = 2; +class NLCasualDateTimeParser extends AbstractParserWithWordBoundary_1$g.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return /(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i; + } + innerExtract(context, match) { + const dateText = match[DATE_GROUP].toLowerCase(); + const timeText = match[TIME_OF_DAY_GROUP].toLowerCase(); + const component = context.createParsingComponents(); + const targetDate = (0, dayjs_2.default)(context.refDate); + switch (dateText) { + case "gisteren": + (0, dayjs_1$d.assignSimilarDate)(component, targetDate.add(-1, "day")); + break; + case "van": + (0, dayjs_1$d.assignSimilarDate)(component, targetDate); + break; + case "morgen": + (0, dayjs_1$d.assignTheNextDay)(component, targetDate); + break; + } + switch (timeText) { + case "ochtend": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 6); + break; + case "middag": + component.imply("meridiem", index_1.Meridiem.AM); + component.imply("hour", 12); + break; + case "namiddag": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 15); + break; + case "avond": + component.imply("meridiem", index_1.Meridiem.PM); + component.imply("hour", 20); + break; + } + return component; + } +} +NLCasualDateTimeParser$1.default = NLCasualDateTimeParser; + +var NLTimeUnitCasualRelativeFormatParser$1 = {}; + +Object.defineProperty(NLTimeUnitCasualRelativeFormatParser$1, "__esModule", { value: true }); +const constants_1$d = constants$2; +const results_1$3 = results; +const AbstractParserWithWordBoundary_1$f = AbstractParserWithWordBoundary; +const timeunits_1$1 = timeunits; +const PATTERN$9 = new RegExp(`(deze|vorige|afgelopen|komende|over|\\+|-)\\s*(${constants_1$d.TIME_UNITS_PATTERN})(?=\\W|$)`, "i"); +class NLTimeUnitCasualRelativeFormatParser extends AbstractParserWithWordBoundary_1$f.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$9; + } + innerExtract(context, match) { + const prefix = match[1].toLowerCase(); + let timeUnits = (0, constants_1$d.parseTimeUnits)(match[2]); + switch (prefix) { + case "vorige": + case "afgelopen": + case "-": + timeUnits = (0, timeunits_1$1.reverseTimeUnits)(timeUnits); + break; + } + return results_1$3.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } +} +NLTimeUnitCasualRelativeFormatParser$1.default = NLTimeUnitCasualRelativeFormatParser; + +var NLRelativeDateFormatParser$1 = {}; + +var __importDefault$g = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(NLRelativeDateFormatParser$1, "__esModule", { value: true }); +const constants_1$c = constants$2; +const results_1$2 = results; +const dayjs_1$c = __importDefault$g(require$$0); +const AbstractParserWithWordBoundary_1$e = AbstractParserWithWordBoundary; +const pattern_1 = pattern; +const PATTERN$8 = new RegExp(`(dit|deze|komende|volgend|volgende|afgelopen|vorige)\\s*(${(0, pattern_1.matchAnyPattern)(constants_1$c.TIME_UNIT_DICTIONARY)})(?=\\s*)` + + "(?=\\W|$)", "i"); +const MODIFIER_WORD_GROUP = 1; +const RELATIVE_WORD_GROUP = 2; +class NLRelativeDateFormatParser extends AbstractParserWithWordBoundary_1$e.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$8; + } + innerExtract(context, match) { + const modifier = match[MODIFIER_WORD_GROUP].toLowerCase(); + const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase(); + const timeunit = constants_1$c.TIME_UNIT_DICTIONARY[unitWord]; + if (modifier == "volgend" || modifier == "volgende" || modifier == "komende") { + const timeUnits = {}; + timeUnits[timeunit] = 1; + return results_1$2.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + if (modifier == "afgelopen" || modifier == "vorige") { + const timeUnits = {}; + timeUnits[timeunit] = -1; + return results_1$2.ParsingComponents.createRelativeFromReference(context.reference, timeUnits); + } + const components = context.createParsingComponents(); + let date = (0, dayjs_1$c.default)(context.reference.instant); + if (unitWord.match(/week/i)) { + date = date.add(-date.get("d"), "d"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.imply("year", date.year()); + } + else if (unitWord.match(/maand/i)) { + date = date.add(-date.date() + 1, "d"); + components.imply("day", date.date()); + components.assign("year", date.year()); + components.assign("month", date.month() + 1); + } + else if (unitWord.match(/jaar/i)) { + date = date.add(-date.date() + 1, "d"); + date = date.add(-date.month(), "month"); + components.imply("day", date.date()); + components.imply("month", date.month() + 1); + components.assign("year", date.year()); + } + return components; + } +} +NLRelativeDateFormatParser$1.default = NLRelativeDateFormatParser; + +var NLTimeUnitAgoFormatParser$1 = {}; + +Object.defineProperty(NLTimeUnitAgoFormatParser$1, "__esModule", { value: true }); +const constants_1$b = constants$2; +const results_1$1 = results; +const AbstractParserWithWordBoundary_1$d = AbstractParserWithWordBoundary; +const timeunits_1 = timeunits; +const PATTERN$7 = new RegExp("" + "(" + constants_1$b.TIME_UNITS_PATTERN + ")" + "(?:geleden|voor|eerder)(?=(?:\\W|$))", "i"); +const STRICT_PATTERN$1 = new RegExp("" + "(" + constants_1$b.TIME_UNITS_PATTERN + ")" + "geleden(?=(?:\\W|$))", "i"); +class NLTimeUnitAgoFormatParser extends AbstractParserWithWordBoundary_1$d.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN$1 : PATTERN$7; + } + innerExtract(context, match) { + const timeUnits = (0, constants_1$b.parseTimeUnits)(match[1]); + const outputTimeUnits = (0, timeunits_1.reverseTimeUnits)(timeUnits); + return results_1$1.ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits); + } +} +NLTimeUnitAgoFormatParser$1.default = NLTimeUnitAgoFormatParser; + +var NLTimeUnitLaterFormatParser$1 = {}; + +Object.defineProperty(NLTimeUnitLaterFormatParser$1, "__esModule", { value: true }); +const constants_1$a = constants$2; +const results_1 = results; +const AbstractParserWithWordBoundary_1$c = AbstractParserWithWordBoundary; +const PATTERN$6 = new RegExp("" + "(" + constants_1$a.TIME_UNITS_PATTERN + ")" + "(later|na|vanaf nu|voortaan|vooruit|uit)" + "(?=(?:\\W|$))", "i"); +const STRICT_PATTERN = new RegExp("" + "(" + constants_1$a.TIME_UNITS_PATTERN + ")" + "(later|vanaf nu)" + "(?=(?:\\W|$))", "i"); +const GROUP_NUM_TIMEUNITS = 1; +class NLTimeUnitLaterFormatParser extends AbstractParserWithWordBoundary_1$c.AbstractParserWithWordBoundaryChecking { + constructor(strictMode) { + super(); + this.strictMode = strictMode; + } + innerPattern() { + return this.strictMode ? STRICT_PATTERN : PATTERN$6; + } + innerExtract(context, match) { + const fragments = (0, constants_1$a.parseTimeUnits)(match[GROUP_NUM_TIMEUNITS]); + return results_1.ParsingComponents.createRelativeFromReference(context.reference, fragments); + } +} +NLTimeUnitLaterFormatParser$1.default = NLTimeUnitLaterFormatParser; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0; +const configurations_1 = configurations; +const chrono_1 = chrono$1; +const NLMergeDateRangeRefiner_1 = __importDefault(NLMergeDateRangeRefiner$1); +const NLMergeDateTimeRefiner_1 = __importDefault(NLMergeDateTimeRefiner$1); +const NLCasualDateParser_1 = __importDefault(NLCasualDateParser$1); +const NLCasualTimeParser_1 = __importDefault(NLCasualTimeParser$1); +const SlashDateFormatParser_1 = __importDefault(SlashDateFormatParser$1); +const NLTimeUnitWithinFormatParser_1 = __importDefault(NLTimeUnitWithinFormatParser$1); +const NLWeekdayParser_1 = __importDefault(NLWeekdayParser$1); +const NLMonthNameMiddleEndianParser_1 = __importDefault(NLMonthNameMiddleEndianParser$1); +const NLMonthNameParser_1 = __importDefault(NLMonthNameParser$1); +const NLSlashMonthFormatParser_1 = __importDefault(NLSlashMonthFormatParser$1); +const NLTimeExpressionParser_1 = __importDefault(NLTimeExpressionParser$1); +const NLCasualYearMonthDayParser_1 = __importDefault(NLCasualYearMonthDayParser$1); +const NLCasualDateTimeParser_1 = __importDefault(NLCasualDateTimeParser$1); +const NLTimeUnitCasualRelativeFormatParser_1 = __importDefault(NLTimeUnitCasualRelativeFormatParser$1); +const NLRelativeDateFormatParser_1 = __importDefault(NLRelativeDateFormatParser$1); +const NLTimeUnitAgoFormatParser_1 = __importDefault(NLTimeUnitAgoFormatParser$1); +const NLTimeUnitLaterFormatParser_1 = __importDefault(NLTimeUnitLaterFormatParser$1); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration(true)); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration(littleEndian = true) { + const option = createConfiguration(false, littleEndian); + option.parsers.unshift(new NLCasualDateParser_1.default()); + option.parsers.unshift(new NLCasualTimeParser_1.default()); + option.parsers.unshift(new NLCasualDateTimeParser_1.default()); + option.parsers.unshift(new NLMonthNameParser_1.default()); + option.parsers.unshift(new NLRelativeDateFormatParser_1.default()); + option.parsers.unshift(new NLTimeUnitCasualRelativeFormatParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration(strictMode = true, littleEndian = true) { + return (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new SlashDateFormatParser_1.default(littleEndian), + new NLTimeUnitWithinFormatParser_1.default(), + new NLMonthNameMiddleEndianParser_1.default(), + new NLMonthNameParser_1.default(), + new NLWeekdayParser_1.default(), + new NLCasualYearMonthDayParser_1.default(), + new NLSlashMonthFormatParser_1.default(), + new NLTimeExpressionParser_1.default(strictMode), + new NLTimeUnitAgoFormatParser_1.default(strictMode), + new NLTimeUnitLaterFormatParser_1.default(strictMode), + ], + refiners: [new NLMergeDateTimeRefiner_1.default(), new NLMergeDateRangeRefiner_1.default()], + }, strictMode); +} +exports.createConfiguration = createConfiguration; +}(nl)); + +var zh = {}; + +var hant = {}; + +var ZHHantCasualDateParser$1 = {}; + +var __importDefault$f = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantCasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$b = __importDefault$f(require$$0); +const AbstractParserWithWordBoundary_1$b = AbstractParserWithWordBoundary; +const NOW_GROUP$1 = 1; +const DAY_GROUP_1$3 = 2; +const TIME_GROUP_1$1 = 3; +const TIME_GROUP_2$1 = 4; +const DAY_GROUP_3$3 = 5; +const TIME_GROUP_3$1 = 6; +class ZHHantCasualDateParser extends AbstractParserWithWordBoundary_1$b.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return new RegExp("(而家|立(?:刻|即)|即刻)|" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|" + + "(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)" + + "(?:[\\s|,|,]*)" + + "(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?", "i"); + } + innerExtract(context, match) { + const index = match.index; + const result = context.createParsingResult(index, match[0]); + const refMoment = (0, dayjs_1$b.default)(context.refDate); + let startMoment = refMoment; + if (match[NOW_GROUP$1]) { + result.start.imply("hour", refMoment.hour()); + result.start.imply("minute", refMoment.minute()); + result.start.imply("second", refMoment.second()); + result.start.imply("millisecond", refMoment.millisecond()); + } + else if (match[DAY_GROUP_1$3]) { + const day1 = match[DAY_GROUP_1$3]; + const time1 = match[TIME_GROUP_1$1]; + if (day1 == "明" || day1 == "聽") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } + else if (day1 == "昨" || day1 == "尋" || day1 == "琴") { + startMoment = startMoment.add(-1, "day"); + } + else if (day1 == "前") { + startMoment = startMoment.add(-2, "day"); + } + else if (day1 == "大前") { + startMoment = startMoment.add(-3, "day"); + } + else if (day1 == "後") { + startMoment = startMoment.add(2, "day"); + } + else if (day1 == "大後") { + startMoment = startMoment.add(3, "day"); + } + if (time1 == "早" || time1 == "朝") { + result.start.imply("hour", 6); + } + else if (time1 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + } + else if (match[TIME_GROUP_2$1]) { + const timeString2 = match[TIME_GROUP_2$1]; + const time2 = timeString2[0]; + if (time2 == "早" || time2 == "朝" || time2 == "上") { + result.start.imply("hour", 6); + } + else if (time2 == "下" || time2 == "晏") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } + else if (time2 == "中") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } + else if (time2 == "夜" || time2 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + else if (time2 == "凌") { + result.start.imply("hour", 0); + } + } + else if (match[DAY_GROUP_3$3]) { + const day3 = match[DAY_GROUP_3$3]; + if (day3 == "明" || day3 == "聽") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } + else if (day3 == "昨" || day3 == "尋" || day3 == "琴") { + startMoment = startMoment.add(-1, "day"); + } + else if (day3 == "前") { + startMoment = startMoment.add(-2, "day"); + } + else if (day3 == "大前") { + startMoment = startMoment.add(-3, "day"); + } + else if (day3 == "後") { + startMoment = startMoment.add(2, "day"); + } + else if (day3 == "大後") { + startMoment = startMoment.add(3, "day"); + } + const timeString3 = match[TIME_GROUP_3$1]; + if (timeString3) { + const time3 = timeString3[0]; + if (time3 == "早" || time3 == "朝" || time3 == "上") { + result.start.imply("hour", 6); + } + else if (time3 == "下" || time3 == "晏") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } + else if (time3 == "中") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } + else if (time3 == "夜" || time3 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + else if (time3 == "凌") { + result.start.imply("hour", 0); + } + } + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + return result; + } +} +ZHHantCasualDateParser$1.default = ZHHantCasualDateParser; + +var ZHHantDateParser$1 = {}; + +var constants$1 = {}; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.zhStringToYear = exports.zhStringToNumber = exports.WEEKDAY_OFFSET = exports.NUMBER = void 0; +exports.NUMBER = { + "零": 0, + "一": 1, + "二": 2, + "兩": 2, + "三": 3, + "四": 4, + "五": 5, + "六": 6, + "七": 7, + "八": 8, + "九": 9, + "十": 10, + "廿": 20, + "卅": 30, +}; +exports.WEEKDAY_OFFSET = { + "天": 0, + "日": 0, + "一": 1, + "二": 2, + "三": 3, + "四": 4, + "五": 5, + "六": 6, +}; +function zhStringToNumber(text) { + let number = 0; + for (let i = 0; i < text.length; i++) { + const char = text[i]; + if (char === "十") { + number = number === 0 ? exports.NUMBER[char] : number * exports.NUMBER[char]; + } + else { + number += exports.NUMBER[char]; + } + } + return number; +} +exports.zhStringToNumber = zhStringToNumber; +function zhStringToYear(text) { + let string = ""; + for (let i = 0; i < text.length; i++) { + const char = text[i]; + string = string + exports.NUMBER[char]; + } + return parseInt(string); +} +exports.zhStringToYear = zhStringToYear; +}(constants$1)); + +var __importDefault$e = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantDateParser$1, "__esModule", { value: true }); +const dayjs_1$a = __importDefault$e(require$$0); +const AbstractParserWithWordBoundary_1$a = AbstractParserWithWordBoundary; +const constants_1$9 = constants$1; +const YEAR_GROUP$1 = 1; +const MONTH_GROUP$1 = 2; +const DAY_GROUP$1 = 3; +class ZHHantDateParser extends AbstractParserWithWordBoundary_1$a.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp("(" + + "\\d{2,4}|" + + "[" + Object.keys(constants_1$9.NUMBER).join("") + "]{4}|" + + "[" + Object.keys(constants_1$9.NUMBER).join("") + "]{2}" + + ")?" + + "(?:\\s*)" + + "(?:年)?" + + "(?:[\\s|,|,]*)" + + "(" + + "\\d{1,2}|" + + "[" + Object.keys(constants_1$9.NUMBER).join("") + "]{1,2}" + + ")" + + "(?:\\s*)" + + "(?:月)" + + "(?:\\s*)" + + "(" + + "\\d{1,2}|" + + "[" + Object.keys(constants_1$9.NUMBER).join("") + "]{1,2}" + + ")?" + + "(?:\\s*)" + + "(?:日|號)?"); + } + innerExtract(context, match) { + const startMoment = (0, dayjs_1$a.default)(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + let month = parseInt(match[MONTH_GROUP$1]); + if (isNaN(month)) + month = (0, constants_1$9.zhStringToNumber)(match[MONTH_GROUP$1]); + result.start.assign("month", month); + if (match[DAY_GROUP$1]) { + let day = parseInt(match[DAY_GROUP$1]); + if (isNaN(day)) + day = (0, constants_1$9.zhStringToNumber)(match[DAY_GROUP$1]); + result.start.assign("day", day); + } + else { + result.start.imply("day", startMoment.date()); + } + if (match[YEAR_GROUP$1]) { + let year = parseInt(match[YEAR_GROUP$1]); + if (isNaN(year)) + year = (0, constants_1$9.zhStringToYear)(match[YEAR_GROUP$1]); + result.start.assign("year", year); + } + else { + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHantDateParser$1.default = ZHHantDateParser; + +var ZHHantDeadlineFormatParser$1 = {}; + +var __importDefault$d = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantDeadlineFormatParser$1, "__esModule", { value: true }); +const dayjs_1$9 = __importDefault$d(require$$0); +const AbstractParserWithWordBoundary_1$9 = AbstractParserWithWordBoundary; +const constants_1$8 = constants$1; +const PATTERN$5 = new RegExp("(\\d+|[" + + Object.keys(constants_1$8.NUMBER).join("") + + "]+|半|幾)(?:\\s*)" + + "(?:個)?" + + "(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)" + + "(?:(?:之|過)?後|(?:之)?內)", "i"); +const NUMBER_GROUP$1 = 1; +const UNIT_GROUP$1 = 2; +class ZHHantDeadlineFormatParser extends AbstractParserWithWordBoundary_1$9.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$5; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + let number = parseInt(match[NUMBER_GROUP$1]); + if (isNaN(number)) { + number = (0, constants_1$8.zhStringToNumber)(match[NUMBER_GROUP$1]); + } + if (isNaN(number)) { + const string = match[NUMBER_GROUP$1]; + if (string === "幾") { + number = 3; + } + else if (string === "半") { + number = 0.5; + } + else { + return null; + } + } + let date = (0, dayjs_1$9.default)(context.refDate); + const unit = match[UNIT_GROUP$1]; + const unitAbbr = unit[0]; + if (unitAbbr.match(/[日天星禮月年]/)) { + if (unitAbbr == "日" || unitAbbr == "天") { + date = date.add(number, "d"); + } + else if (unitAbbr == "星" || unitAbbr == "禮") { + date = date.add(number * 7, "d"); + } + else if (unitAbbr == "月") { + date = date.add(number, "month"); + } + else if (unitAbbr == "年") { + date = date.add(number, "year"); + } + result.start.assign("year", date.year()); + result.start.assign("month", date.month() + 1); + result.start.assign("day", date.date()); + return result; + } + if (unitAbbr == "秒") { + date = date.add(number, "second"); + } + else if (unitAbbr == "分") { + date = date.add(number, "minute"); + } + else if (unitAbbr == "小" || unitAbbr == "鐘") { + date = date.add(number, "hour"); + } + result.start.imply("year", date.year()); + result.start.imply("month", date.month() + 1); + result.start.imply("day", date.date()); + result.start.assign("hour", date.hour()); + result.start.assign("minute", date.minute()); + result.start.assign("second", date.second()); + return result; + } +} +ZHHantDeadlineFormatParser$1.default = ZHHantDeadlineFormatParser; + +var ZHHantRelationWeekdayParser$1 = {}; + +var __importDefault$c = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantRelationWeekdayParser$1, "__esModule", { value: true }); +const dayjs_1$8 = __importDefault$c(require$$0); +const AbstractParserWithWordBoundary_1$8 = AbstractParserWithWordBoundary; +const constants_1$7 = constants$1; +const PATTERN$4 = new RegExp("(?上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?" + Object.keys(constants_1$7.WEEKDAY_OFFSET).join("|") + ")"); +class ZHHantRelationWeekdayParser extends AbstractParserWithWordBoundary_1$8.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$4; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset = constants_1$7.WEEKDAY_OFFSET[dayOfWeek]; + if (offset === undefined) + return null; + let modifier = null; + const prefix = match.groups.prefix; + if (prefix == "上") { + modifier = "last"; + } + else if (prefix == "下") { + modifier = "next"; + } + else if (prefix == "今" || prefix == "這" || prefix == "呢") { + modifier = "this"; + } + let startMoment = (0, dayjs_1$8.default)(context.refDate); + let startMomentFixed = false; + const refOffset = startMoment.day(); + if (modifier == "last" || modifier == "past") { + startMoment = startMoment.day(offset - 7); + startMomentFixed = true; + } + else if (modifier == "next") { + startMoment = startMoment.day(offset + 7); + startMomentFixed = true; + } + else if (modifier == "this") { + startMoment = startMoment.day(offset); + } + else { + if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset - 7); + } + else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset + 7); + } + else { + startMoment = startMoment.day(offset); + } + } + result.start.assign("weekday", offset); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHantRelationWeekdayParser$1.default = ZHHantRelationWeekdayParser; + +var ZHHantTimeExpressionParser$1 = {}; + +var __importDefault$b = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantTimeExpressionParser$1, "__esModule", { value: true }); +const dayjs_1$7 = __importDefault$b(require$$0); +const AbstractParserWithWordBoundary_1$7 = AbstractParserWithWordBoundary; +const constants_1$6 = constants$1; +const FIRST_REG_PATTERN$1 = new RegExp("(?:由|從|自)?" + + "(?:" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|" + + "(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)" + + "(?:[\\s,,]*)" + + "(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?" + + ")?" + + "(?:[\\s,,]*)" + + "(?:(\\d+|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)(?:\\s*)(?:點|時|:|:)" + + "(?:\\s*)" + + "(\\d+|半|正|整|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)?(?:\\s*)(?:分|:|:)?" + + "(?:\\s*)" + + "(\\d+|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)?(?:\\s*)(?:秒)?)" + + "(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); +const SECOND_REG_PATTERN$1 = new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)" + + "(?:" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|" + + "(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)" + + "(?:[\\s,,]*)" + + "(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?" + + ")?" + + "(?:[\\s,,]*)" + + "(?:(\\d+|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)(?:\\s*)(?:點|時|:|:)" + + "(?:\\s*)" + + "(\\d+|半|正|整|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)?(?:\\s*)(?:分|:|:)?" + + "(?:\\s*)" + + "(\\d+|[" + + Object.keys(constants_1$6.NUMBER).join("") + + "]+)?(?:\\s*)(?:秒)?)" + + "(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); +const DAY_GROUP_1$2 = 1; +const ZH_AM_PM_HOUR_GROUP_1$1 = 2; +const ZH_AM_PM_HOUR_GROUP_2$1 = 3; +const DAY_GROUP_3$2 = 4; +const ZH_AM_PM_HOUR_GROUP_3$1 = 5; +const HOUR_GROUP$1 = 6; +const MINUTE_GROUP$1 = 7; +const SECOND_GROUP$1 = 8; +const AM_PM_HOUR_GROUP$1 = 9; +class ZHHantTimeExpressionParser extends AbstractParserWithWordBoundary_1$7.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return FIRST_REG_PATTERN$1; + } + innerExtract(context, match) { + if (match.index > 0 && context.text[match.index - 1].match(/\w/)) { + return null; + } + const refMoment = (0, dayjs_1$7.default)(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + const startMoment = refMoment.clone(); + if (match[DAY_GROUP_1$2]) { + var day1 = match[DAY_GROUP_1$2]; + if (day1 == "明" || day1 == "聽") { + if (refMoment.hour() > 1) { + startMoment.add(1, "day"); + } + } + else if (day1 == "昨" || day1 == "尋" || day1 == "琴") { + startMoment.add(-1, "day"); + } + else if (day1 == "前") { + startMoment.add(-2, "day"); + } + else if (day1 == "大前") { + startMoment.add(-3, "day"); + } + else if (day1 == "後") { + startMoment.add(2, "day"); + } + else if (day1 == "大後") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else if (match[DAY_GROUP_3$2]) { + var day3 = match[DAY_GROUP_3$2]; + if (day3 == "明" || day3 == "聽") { + startMoment.add(1, "day"); + } + else if (day3 == "昨" || day3 == "尋" || day3 == "琴") { + startMoment.add(-1, "day"); + } + else if (day3 == "前") { + startMoment.add(-2, "day"); + } + else if (day3 == "大前") { + startMoment.add(-3, "day"); + } + else if (day3 == "後") { + startMoment.add(2, "day"); + } + else if (day3 == "大後") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + let hour = 0; + let minute = 0; + let meridiem = -1; + if (match[SECOND_GROUP$1]) { + var second = parseInt(match[SECOND_GROUP$1]); + if (isNaN(second)) { + second = (0, constants_1$6.zhStringToNumber)(match[SECOND_GROUP$1]); + } + if (second >= 60) + return null; + result.start.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP$1]); + if (isNaN(hour)) { + hour = (0, constants_1$6.zhStringToNumber)(match[HOUR_GROUP$1]); + } + if (match[MINUTE_GROUP$1]) { + if (match[MINUTE_GROUP$1] == "半") { + minute = 30; + } + else if (match[MINUTE_GROUP$1] == "正" || match[MINUTE_GROUP$1] == "整") { + minute = 0; + } + else { + minute = parseInt(match[MINUTE_GROUP$1]); + if (isNaN(minute)) { + minute = (0, constants_1$6.zhStringToNumber)(match[MINUTE_GROUP$1]); + } + } + } + else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP$1]) { + if (hour > 12) + return null; + var ampm = match[AM_PM_HOUR_GROUP$1][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_1$1]) { + var zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1$1]; + var zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "朝" || zhAMPM1 == "早") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM1 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_2$1]) { + var zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2$1]; + var zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "上" || zhAMPM2 == "朝" || zhAMPM2 == "早" || zhAMPM2 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM2 == "下" || zhAMPM2 == "晏" || zhAMPM2 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_3$1]) { + var zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3$1]; + var zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "上" || zhAMPM3 == "朝" || zhAMPM3 == "早" || zhAMPM3 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM3 == "下" || zhAMPM3 == "晏" || zhAMPM3 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.start.assign("hour", hour); + result.start.assign("minute", minute); + if (meridiem >= 0) { + result.start.assign("meridiem", meridiem); + } + else { + if (hour < 12) { + result.start.imply("meridiem", 0); + } + else { + result.start.imply("meridiem", 1); + } + } + match = SECOND_REG_PATTERN$1.exec(context.text.substring(result.index + result.text.length)); + if (!match) { + if (result.text.match(/^\d+$/)) { + return null; + } + return result; + } + const endMoment = startMoment.clone(); + result.end = context.createParsingComponents(); + if (match[DAY_GROUP_1$2]) { + var day1 = match[DAY_GROUP_1$2]; + if (day1 == "明" || day1 == "聽") { + if (refMoment.hour() > 1) { + endMoment.add(1, "day"); + } + } + else if (day1 == "昨" || day1 == "尋" || day1 == "琴") { + endMoment.add(-1, "day"); + } + else if (day1 == "前") { + endMoment.add(-2, "day"); + } + else if (day1 == "大前") { + endMoment.add(-3, "day"); + } + else if (day1 == "後") { + endMoment.add(2, "day"); + } + else if (day1 == "大後") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } + else if (match[DAY_GROUP_3$2]) { + var day3 = match[DAY_GROUP_3$2]; + if (day3 == "明" || day3 == "聽") { + endMoment.add(1, "day"); + } + else if (day3 == "昨" || day3 == "尋" || day3 == "琴") { + endMoment.add(-1, "day"); + } + else if (day3 == "前") { + endMoment.add(-2, "day"); + } + else if (day3 == "大前") { + endMoment.add(-3, "day"); + } + else if (day3 == "後") { + endMoment.add(2, "day"); + } + else if (day3 == "大後") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } + else { + result.end.imply("day", endMoment.date()); + result.end.imply("month", endMoment.month() + 1); + result.end.imply("year", endMoment.year()); + } + hour = 0; + minute = 0; + meridiem = -1; + if (match[SECOND_GROUP$1]) { + var second = parseInt(match[SECOND_GROUP$1]); + if (isNaN(second)) { + second = (0, constants_1$6.zhStringToNumber)(match[SECOND_GROUP$1]); + } + if (second >= 60) + return null; + result.end.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP$1]); + if (isNaN(hour)) { + hour = (0, constants_1$6.zhStringToNumber)(match[HOUR_GROUP$1]); + } + if (match[MINUTE_GROUP$1]) { + if (match[MINUTE_GROUP$1] == "半") { + minute = 30; + } + else if (match[MINUTE_GROUP$1] == "正" || match[MINUTE_GROUP$1] == "整") { + minute = 0; + } + else { + minute = parseInt(match[MINUTE_GROUP$1]); + if (isNaN(minute)) { + minute = (0, constants_1$6.zhStringToNumber)(match[MINUTE_GROUP$1]); + } + } + } + else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP$1]) { + if (hour > 12) + return null; + var ampm = match[AM_PM_HOUR_GROUP$1][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == 0) { + result.start.imply("meridiem", 0); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } + else { + result.start.imply("meridiem", 1); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_1$1]) { + var zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1$1]; + var zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "朝" || zhAMPM1 == "早") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM1 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_2$1]) { + var zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2$1]; + var zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "上" || zhAMPM2 == "朝" || zhAMPM2 == "早" || zhAMPM2 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM2 == "下" || zhAMPM2 == "晏" || zhAMPM2 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_3$1]) { + var zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3$1]; + var zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "上" || zhAMPM3 == "朝" || zhAMPM3 == "早" || zhAMPM3 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM3 == "下" || zhAMPM3 == "晏" || zhAMPM3 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.text = result.text + match[0]; + result.end.assign("hour", hour); + result.end.assign("minute", minute); + if (meridiem >= 0) { + result.end.assign("meridiem", meridiem); + } + else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("meridiem") == 1; + if (startAtPM && result.start.get("hour") > hour) { + result.end.imply("meridiem", 0); + } + else if (hour > 12) { + result.end.imply("meridiem", 1); + } + } + if (result.end.date().getTime() < result.start.date().getTime()) { + result.end.imply("day", result.end.get("day") + 1); + } + return result; + } +} +ZHHantTimeExpressionParser$1.default = ZHHantTimeExpressionParser; + +var ZHHantWeekdayParser$1 = {}; + +var __importDefault$a = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantWeekdayParser$1, "__esModule", { value: true }); +const dayjs_1$6 = __importDefault$a(require$$0); +const AbstractParserWithWordBoundary_1$6 = AbstractParserWithWordBoundary; +const constants_1$5 = constants$1; +const PATTERN$3 = new RegExp("(?:星期|禮拜|週)(?" + Object.keys(constants_1$5.WEEKDAY_OFFSET).join("|") + ")"); +class ZHHantWeekdayParser extends AbstractParserWithWordBoundary_1$6.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$3; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset = constants_1$5.WEEKDAY_OFFSET[dayOfWeek]; + if (offset === undefined) + return null; + let startMoment = (0, dayjs_1$6.default)(context.refDate); + const refOffset = startMoment.day(); + if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset - 7); + } + else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset + 7); + } + else { + startMoment = startMoment.day(offset); + } + result.start.assign("weekday", offset); + { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHantWeekdayParser$1.default = ZHHantWeekdayParser; + +var ZHHantMergeDateRangeRefiner$1 = {}; + +var __importDefault$9 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1$1 = __importDefault$9(AbstractMergeDateRangeRefiner$1); +class ZHHantMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1$1.default { + patternBetween() { + return /^\s*(至|到|\-|\~|~|-|ー)\s*$/i; + } +} +ZHHantMergeDateRangeRefiner$1.default = ZHHantMergeDateRangeRefiner; + +var ZHHantMergeDateTimeRefiner$1 = {}; + +var __importDefault$8 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHantMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1$1 = __importDefault$8(AbstractMergeDateTimeRefiner); +class ZHHantMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1$1.default { + patternBetween() { + return /^\s*$/i; + } +} +ZHHantMergeDateTimeRefiner$1.default = ZHHantMergeDateTimeRefiner; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = exports.hant = void 0; +const chrono_1 = chrono$1; +const ExtractTimezoneOffsetRefiner_1 = __importDefault(ExtractTimezoneOffsetRefiner$1); +const configurations_1 = configurations; +const ZHHantCasualDateParser_1 = __importDefault(ZHHantCasualDateParser$1); +const ZHHantDateParser_1 = __importDefault(ZHHantDateParser$1); +const ZHHantDeadlineFormatParser_1 = __importDefault(ZHHantDeadlineFormatParser$1); +const ZHHantRelationWeekdayParser_1 = __importDefault(ZHHantRelationWeekdayParser$1); +const ZHHantTimeExpressionParser_1 = __importDefault(ZHHantTimeExpressionParser$1); +const ZHHantWeekdayParser_1 = __importDefault(ZHHantWeekdayParser$1); +const ZHHantMergeDateRangeRefiner_1 = __importDefault(ZHHantMergeDateRangeRefiner$1); +const ZHHantMergeDateTimeRefiner_1 = __importDefault(ZHHantMergeDateTimeRefiner$1); +exports.hant = new chrono_1.Chrono(createCasualConfiguration()); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration()); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new ZHHantCasualDateParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration() { + const configuration = (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new ZHHantDateParser_1.default(), + new ZHHantRelationWeekdayParser_1.default(), + new ZHHantWeekdayParser_1.default(), + new ZHHantTimeExpressionParser_1.default(), + new ZHHantDeadlineFormatParser_1.default(), + ], + refiners: [new ZHHantMergeDateRangeRefiner_1.default(), new ZHHantMergeDateTimeRefiner_1.default()], + }); + configuration.refiners = configuration.refiners.filter((refiner) => !(refiner instanceof ExtractTimezoneOffsetRefiner_1.default)); + return configuration; +} +exports.createConfiguration = createConfiguration; +}(hant)); + +var hans = {}; + +var ZHHansCasualDateParser$1 = {}; + +var __importDefault$7 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansCasualDateParser$1, "__esModule", { value: true }); +const dayjs_1$5 = __importDefault$7(require$$0); +const AbstractParserWithWordBoundary_1$5 = AbstractParserWithWordBoundary; +const NOW_GROUP = 1; +const DAY_GROUP_1$1 = 2; +const TIME_GROUP_1 = 3; +const TIME_GROUP_2 = 4; +const DAY_GROUP_3$1 = 5; +const TIME_GROUP_3 = 6; +class ZHHansCasualDateParser extends AbstractParserWithWordBoundary_1$5.AbstractParserWithWordBoundaryChecking { + innerPattern(context) { + return new RegExp("(现在|立(?:刻|即)|即刻)|" + + "(今|明|前|大前|后|大后|昨)(早|晚)|" + + "(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|后|大后|昨)(?:日|天)" + + "(?:[\\s|,|,]*)" + + "(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?", "i"); + } + innerExtract(context, match) { + const index = match.index; + const result = context.createParsingResult(index, match[0]); + const refMoment = (0, dayjs_1$5.default)(context.refDate); + let startMoment = refMoment; + if (match[NOW_GROUP]) { + result.start.imply("hour", refMoment.hour()); + result.start.imply("minute", refMoment.minute()); + result.start.imply("second", refMoment.second()); + result.start.imply("millisecond", refMoment.millisecond()); + } + else if (match[DAY_GROUP_1$1]) { + const day1 = match[DAY_GROUP_1$1]; + const time1 = match[TIME_GROUP_1]; + if (day1 == "明") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } + else if (day1 == "昨") { + startMoment = startMoment.add(-1, "day"); + } + else if (day1 == "前") { + startMoment = startMoment.add(-2, "day"); + } + else if (day1 == "大前") { + startMoment = startMoment.add(-3, "day"); + } + else if (day1 == "后") { + startMoment = startMoment.add(2, "day"); + } + else if (day1 == "大后") { + startMoment = startMoment.add(3, "day"); + } + if (time1 == "早") { + result.start.imply("hour", 6); + } + else if (time1 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + } + else if (match[TIME_GROUP_2]) { + const timeString2 = match[TIME_GROUP_2]; + const time2 = timeString2[0]; + if (time2 == "早" || time2 == "上") { + result.start.imply("hour", 6); + } + else if (time2 == "下") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } + else if (time2 == "中") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } + else if (time2 == "夜" || time2 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + else if (time2 == "凌") { + result.start.imply("hour", 0); + } + } + else if (match[DAY_GROUP_3$1]) { + const day3 = match[DAY_GROUP_3$1]; + if (day3 == "明") { + if (refMoment.hour() > 1) { + startMoment = startMoment.add(1, "day"); + } + } + else if (day3 == "昨") { + startMoment = startMoment.add(-1, "day"); + } + else if (day3 == "前") { + startMoment = startMoment.add(-2, "day"); + } + else if (day3 == "大前") { + startMoment = startMoment.add(-3, "day"); + } + else if (day3 == "后") { + startMoment = startMoment.add(2, "day"); + } + else if (day3 == "大后") { + startMoment = startMoment.add(3, "day"); + } + const timeString3 = match[TIME_GROUP_3]; + if (timeString3) { + const time3 = timeString3[0]; + if (time3 == "早" || time3 == "上") { + result.start.imply("hour", 6); + } + else if (time3 == "下") { + result.start.imply("hour", 15); + result.start.imply("meridiem", 1); + } + else if (time3 == "中") { + result.start.imply("hour", 12); + result.start.imply("meridiem", 1); + } + else if (time3 == "夜" || time3 == "晚") { + result.start.imply("hour", 22); + result.start.imply("meridiem", 1); + } + else if (time3 == "凌") { + result.start.imply("hour", 0); + } + } + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + return result; + } +} +ZHHansCasualDateParser$1.default = ZHHansCasualDateParser; + +var ZHHansDateParser$1 = {}; + +var constants = {}; + +(function (exports) { +Object.defineProperty(exports, "__esModule", { value: true }); +exports.zhStringToYear = exports.zhStringToNumber = exports.WEEKDAY_OFFSET = exports.NUMBER = void 0; +exports.NUMBER = { + "零": 0, + "〇": 0, + "一": 1, + "二": 2, + "两": 2, + "三": 3, + "四": 4, + "五": 5, + "六": 6, + "七": 7, + "八": 8, + "九": 9, + "十": 10, +}; +exports.WEEKDAY_OFFSET = { + "天": 0, + "日": 0, + "一": 1, + "二": 2, + "三": 3, + "四": 4, + "五": 5, + "六": 6, +}; +function zhStringToNumber(text) { + let number = 0; + for (let i = 0; i < text.length; i++) { + const char = text[i]; + if (char === "十") { + number = number === 0 ? exports.NUMBER[char] : number * exports.NUMBER[char]; + } + else { + number += exports.NUMBER[char]; + } + } + return number; +} +exports.zhStringToNumber = zhStringToNumber; +function zhStringToYear(text) { + let string = ""; + for (let i = 0; i < text.length; i++) { + const char = text[i]; + string = string + exports.NUMBER[char]; + } + return parseInt(string); +} +exports.zhStringToYear = zhStringToYear; +}(constants)); + +var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansDateParser$1, "__esModule", { value: true }); +const dayjs_1$4 = __importDefault$6(require$$0); +const AbstractParserWithWordBoundary_1$4 = AbstractParserWithWordBoundary; +const constants_1$4 = constants; +const YEAR_GROUP = 1; +const MONTH_GROUP = 2; +const DAY_GROUP = 3; +class ZHHansDateParser extends AbstractParserWithWordBoundary_1$4.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return new RegExp("(" + + "\\d{2,4}|" + + "[" + + Object.keys(constants_1$4.NUMBER).join("") + + "]{4}|" + + "[" + + Object.keys(constants_1$4.NUMBER).join("") + + "]{2}" + + ")?" + + "(?:\\s*)" + + "(?:年)?" + + "(?:[\\s|,|,]*)" + + "(" + + "\\d{1,2}|" + + "[" + + Object.keys(constants_1$4.NUMBER).join("") + + "]{1,3}" + + ")" + + "(?:\\s*)" + + "(?:月)" + + "(?:\\s*)" + + "(" + + "\\d{1,2}|" + + "[" + + Object.keys(constants_1$4.NUMBER).join("") + + "]{1,3}" + + ")?" + + "(?:\\s*)" + + "(?:日|号)?"); + } + innerExtract(context, match) { + const startMoment = (0, dayjs_1$4.default)(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + let month = parseInt(match[MONTH_GROUP]); + if (isNaN(month)) + month = (0, constants_1$4.zhStringToNumber)(match[MONTH_GROUP]); + result.start.assign("month", month); + if (match[DAY_GROUP]) { + let day = parseInt(match[DAY_GROUP]); + if (isNaN(day)) + day = (0, constants_1$4.zhStringToNumber)(match[DAY_GROUP]); + result.start.assign("day", day); + } + else { + result.start.imply("day", startMoment.date()); + } + if (match[YEAR_GROUP]) { + let year = parseInt(match[YEAR_GROUP]); + if (isNaN(year)) + year = (0, constants_1$4.zhStringToYear)(match[YEAR_GROUP]); + result.start.assign("year", year); + } + else { + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHansDateParser$1.default = ZHHansDateParser; + +var ZHHansDeadlineFormatParser$1 = {}; + +var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansDeadlineFormatParser$1, "__esModule", { value: true }); +const dayjs_1$3 = __importDefault$5(require$$0); +const AbstractParserWithWordBoundary_1$3 = AbstractParserWithWordBoundary; +const constants_1$3 = constants; +const PATTERN$2 = new RegExp("(\\d+|[" + + Object.keys(constants_1$3.NUMBER).join("") + + "]+|半|几)(?:\\s*)" + + "(?:个)?" + + "(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)" + + "(?:(?:之|过)?后|(?:之)?内)", "i"); +const NUMBER_GROUP = 1; +const UNIT_GROUP = 2; +class ZHHansDeadlineFormatParser extends AbstractParserWithWordBoundary_1$3.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$2; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + let number = parseInt(match[NUMBER_GROUP]); + if (isNaN(number)) { + number = (0, constants_1$3.zhStringToNumber)(match[NUMBER_GROUP]); + } + if (isNaN(number)) { + const string = match[NUMBER_GROUP]; + if (string === "几") { + number = 3; + } + else if (string === "半") { + number = 0.5; + } + else { + return null; + } + } + let date = (0, dayjs_1$3.default)(context.refDate); + const unit = match[UNIT_GROUP]; + const unitAbbr = unit[0]; + if (unitAbbr.match(/[日天星礼月年]/)) { + if (unitAbbr == "日" || unitAbbr == "天") { + date = date.add(number, "d"); + } + else if (unitAbbr == "星" || unitAbbr == "礼") { + date = date.add(number * 7, "d"); + } + else if (unitAbbr == "月") { + date = date.add(number, "month"); + } + else if (unitAbbr == "年") { + date = date.add(number, "year"); + } + result.start.assign("year", date.year()); + result.start.assign("month", date.month() + 1); + result.start.assign("day", date.date()); + return result; + } + if (unitAbbr == "秒") { + date = date.add(number, "second"); + } + else if (unitAbbr == "分") { + date = date.add(number, "minute"); + } + else if (unitAbbr == "小" || unitAbbr == "钟") { + date = date.add(number, "hour"); + } + result.start.imply("year", date.year()); + result.start.imply("month", date.month() + 1); + result.start.imply("day", date.date()); + result.start.assign("hour", date.hour()); + result.start.assign("minute", date.minute()); + result.start.assign("second", date.second()); + return result; + } +} +ZHHansDeadlineFormatParser$1.default = ZHHansDeadlineFormatParser; + +var ZHHansRelationWeekdayParser$1 = {}; + +var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansRelationWeekdayParser$1, "__esModule", { value: true }); +const dayjs_1$2 = __importDefault$4(require$$0); +const AbstractParserWithWordBoundary_1$2 = AbstractParserWithWordBoundary; +const constants_1$2 = constants; +const PATTERN$1 = new RegExp("(?上|下|这)(?:个)?(?:星期|礼拜|周)(?" + Object.keys(constants_1$2.WEEKDAY_OFFSET).join("|") + ")"); +class ZHHansRelationWeekdayParser extends AbstractParserWithWordBoundary_1$2.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN$1; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset = constants_1$2.WEEKDAY_OFFSET[dayOfWeek]; + if (offset === undefined) + return null; + let modifier = null; + const prefix = match.groups.prefix; + if (prefix == "上") { + modifier = "last"; + } + else if (prefix == "下") { + modifier = "next"; + } + else if (prefix == "这") { + modifier = "this"; + } + let startMoment = (0, dayjs_1$2.default)(context.refDate); + let startMomentFixed = false; + const refOffset = startMoment.day(); + if (modifier == "last" || modifier == "past") { + startMoment = startMoment.day(offset - 7); + startMomentFixed = true; + } + else if (modifier == "next") { + startMoment = startMoment.day(offset + 7); + startMomentFixed = true; + } + else if (modifier == "this") { + startMoment = startMoment.day(offset); + } + else { + if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset - 7); + } + else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset + 7); + } + else { + startMoment = startMoment.day(offset); + } + } + result.start.assign("weekday", offset); + if (startMomentFixed) { + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHansRelationWeekdayParser$1.default = ZHHansRelationWeekdayParser; + +var ZHHansTimeExpressionParser$1 = {}; + +var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansTimeExpressionParser$1, "__esModule", { value: true }); +const dayjs_1$1 = __importDefault$3(require$$0); +const AbstractParserWithWordBoundary_1$1 = AbstractParserWithWordBoundary; +const constants_1$1 = constants; +const FIRST_REG_PATTERN = new RegExp("(?:从|自)?" + + "(?:" + + "(今|明|前|大前|后|大后|昨)(早|朝|晚)|" + + "(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|后|大后|昨)(?:日|天)" + + "(?:[\\s,,]*)" + + "(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?" + + ")?" + + "(?:[\\s,,]*)" + + "(?:(\\d+|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)(?:\\s*)(?:点|时|:|:)" + + "(?:\\s*)" + + "(\\d+|半|正|整|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)?(?:\\s*)(?:分|:|:)?" + + "(?:\\s*)" + + "(\\d+|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)?(?:\\s*)(?:秒)?)" + + "(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); +const SECOND_REG_PATTERN = new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)" + + "(?:" + + "(今|明|前|大前|后|大后|昨)(早|朝|晚)|" + + "(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|" + + "(今|明|前|大前|后|大后|昨)(?:日|天)" + + "(?:[\\s,,]*)" + + "(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?" + + ")?" + + "(?:[\\s,,]*)" + + "(?:(\\d+|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)(?:\\s*)(?:点|时|:|:)" + + "(?:\\s*)" + + "(\\d+|半|正|整|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)?(?:\\s*)(?:分|:|:)?" + + "(?:\\s*)" + + "(\\d+|[" + + Object.keys(constants_1$1.NUMBER).join("") + + "]+)?(?:\\s*)(?:秒)?)" + + "(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"); +const DAY_GROUP_1 = 1; +const ZH_AM_PM_HOUR_GROUP_1 = 2; +const ZH_AM_PM_HOUR_GROUP_2 = 3; +const DAY_GROUP_3 = 4; +const ZH_AM_PM_HOUR_GROUP_3 = 5; +const HOUR_GROUP = 6; +const MINUTE_GROUP = 7; +const SECOND_GROUP = 8; +const AM_PM_HOUR_GROUP = 9; +class ZHHansTimeExpressionParser extends AbstractParserWithWordBoundary_1$1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return FIRST_REG_PATTERN; + } + innerExtract(context, match) { + if (match.index > 0 && context.text[match.index - 1].match(/\w/)) { + return null; + } + const refMoment = (0, dayjs_1$1.default)(context.refDate); + const result = context.createParsingResult(match.index, match[0]); + const startMoment = refMoment.clone(); + if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + if (day1 == "明") { + if (refMoment.hour() > 1) { + startMoment.add(1, "day"); + } + } + else if (day1 == "昨") { + startMoment.add(-1, "day"); + } + else if (day1 == "前") { + startMoment.add(-2, "day"); + } + else if (day1 == "大前") { + startMoment.add(-3, "day"); + } + else if (day1 == "后") { + startMoment.add(2, "day"); + } + else if (day1 == "大后") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "明") { + startMoment.add(1, "day"); + } + else if (day3 == "昨") { + startMoment.add(-1, "day"); + } + else if (day3 == "前") { + startMoment.add(-2, "day"); + } + else if (day3 == "大前") { + startMoment.add(-3, "day"); + } + else if (day3 == "后") { + startMoment.add(2, "day"); + } + else if (day3 == "大后") { + startMoment.add(3, "day"); + } + result.start.assign("day", startMoment.date()); + result.start.assign("month", startMoment.month() + 1); + result.start.assign("year", startMoment.year()); + } + else { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + let hour = 0; + let minute = 0; + let meridiem = -1; + if (match[SECOND_GROUP]) { + let second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = (0, constants_1$1.zhStringToNumber)(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.start.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = (0, constants_1$1.zhStringToNumber)(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "半") { + minute = 30; + } + else if (match[MINUTE_GROUP] == "正" || match[MINUTE_GROUP] == "整") { + minute = 0; + } + else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = (0, constants_1$1.zhStringToNumber)(match[MINUTE_GROUP]); + } + } + } + else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + const zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + const zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "早") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM1 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + const zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + const zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "上" || zhAMPM2 == "早" || zhAMPM2 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM2 == "下" || zhAMPM2 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + const zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + const zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "上" || zhAMPM3 == "早" || zhAMPM3 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM3 == "下" || zhAMPM3 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.start.assign("hour", hour); + result.start.assign("minute", minute); + if (meridiem >= 0) { + result.start.assign("meridiem", meridiem); + } + else { + if (hour < 12) { + result.start.imply("meridiem", 0); + } + else { + result.start.imply("meridiem", 1); + } + } + match = SECOND_REG_PATTERN.exec(context.text.substring(result.index + result.text.length)); + if (!match) { + if (result.text.match(/^\d+$/)) { + return null; + } + return result; + } + const endMoment = startMoment.clone(); + result.end = context.createParsingComponents(); + if (match[DAY_GROUP_1]) { + const day1 = match[DAY_GROUP_1]; + if (day1 == "明") { + if (refMoment.hour() > 1) { + endMoment.add(1, "day"); + } + } + else if (day1 == "昨") { + endMoment.add(-1, "day"); + } + else if (day1 == "前") { + endMoment.add(-2, "day"); + } + else if (day1 == "大前") { + endMoment.add(-3, "day"); + } + else if (day1 == "后") { + endMoment.add(2, "day"); + } + else if (day1 == "大后") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } + else if (match[DAY_GROUP_3]) { + const day3 = match[DAY_GROUP_3]; + if (day3 == "明") { + endMoment.add(1, "day"); + } + else if (day3 == "昨") { + endMoment.add(-1, "day"); + } + else if (day3 == "前") { + endMoment.add(-2, "day"); + } + else if (day3 == "大前") { + endMoment.add(-3, "day"); + } + else if (day3 == "后") { + endMoment.add(2, "day"); + } + else if (day3 == "大后") { + endMoment.add(3, "day"); + } + result.end.assign("day", endMoment.date()); + result.end.assign("month", endMoment.month() + 1); + result.end.assign("year", endMoment.year()); + } + else { + result.end.imply("day", endMoment.date()); + result.end.imply("month", endMoment.month() + 1); + result.end.imply("year", endMoment.year()); + } + hour = 0; + minute = 0; + meridiem = -1; + if (match[SECOND_GROUP]) { + let second = parseInt(match[SECOND_GROUP]); + if (isNaN(second)) { + second = (0, constants_1$1.zhStringToNumber)(match[SECOND_GROUP]); + } + if (second >= 60) + return null; + result.end.assign("second", second); + } + hour = parseInt(match[HOUR_GROUP]); + if (isNaN(hour)) { + hour = (0, constants_1$1.zhStringToNumber)(match[HOUR_GROUP]); + } + if (match[MINUTE_GROUP]) { + if (match[MINUTE_GROUP] == "半") { + minute = 30; + } + else if (match[MINUTE_GROUP] == "正" || match[MINUTE_GROUP] == "整") { + minute = 0; + } + else { + minute = parseInt(match[MINUTE_GROUP]); + if (isNaN(minute)) { + minute = (0, constants_1$1.zhStringToNumber)(match[MINUTE_GROUP]); + } + } + } + else if (hour > 100) { + minute = hour % 100; + hour = Math.floor(hour / 100); + } + if (minute >= 60) { + return null; + } + if (hour > 24) { + return null; + } + if (hour >= 12) { + meridiem = 1; + } + if (match[AM_PM_HOUR_GROUP]) { + if (hour > 12) + return null; + const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase(); + if (ampm == "a") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + if (ampm == "p") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + if (!result.start.isCertain("meridiem")) { + if (meridiem == 0) { + result.start.imply("meridiem", 0); + if (result.start.get("hour") == 12) { + result.start.assign("hour", 0); + } + } + else { + result.start.imply("meridiem", 1); + if (result.start.get("hour") != 12) { + result.start.assign("hour", result.start.get("hour") + 12); + } + } + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_1]) { + const zhAMPMString1 = match[ZH_AM_PM_HOUR_GROUP_1]; + const zhAMPM1 = zhAMPMString1[0]; + if (zhAMPM1 == "早") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM1 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_2]) { + const zhAMPMString2 = match[ZH_AM_PM_HOUR_GROUP_2]; + const zhAMPM2 = zhAMPMString2[0]; + if (zhAMPM2 == "上" || zhAMPM2 == "早" || zhAMPM2 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM2 == "下" || zhAMPM2 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + else if (match[ZH_AM_PM_HOUR_GROUP_3]) { + const zhAMPMString3 = match[ZH_AM_PM_HOUR_GROUP_3]; + const zhAMPM3 = zhAMPMString3[0]; + if (zhAMPM3 == "上" || zhAMPM3 == "早" || zhAMPM3 == "凌") { + meridiem = 0; + if (hour == 12) + hour = 0; + } + else if (zhAMPM3 == "下" || zhAMPM3 == "晚") { + meridiem = 1; + if (hour != 12) + hour += 12; + } + } + result.text = result.text + match[0]; + result.end.assign("hour", hour); + result.end.assign("minute", minute); + if (meridiem >= 0) { + result.end.assign("meridiem", meridiem); + } + else { + const startAtPM = result.start.isCertain("meridiem") && result.start.get("meridiem") == 1; + if (startAtPM && result.start.get("hour") > hour) { + result.end.imply("meridiem", 0); + } + else if (hour > 12) { + result.end.imply("meridiem", 1); + } + } + if (result.end.date().getTime() < result.start.date().getTime()) { + result.end.imply("day", result.end.get("day") + 1); + } + return result; + } +} +ZHHansTimeExpressionParser$1.default = ZHHansTimeExpressionParser; + +var ZHHansWeekdayParser$1 = {}; + +var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansWeekdayParser$1, "__esModule", { value: true }); +const dayjs_1 = __importDefault$2(require$$0); +const AbstractParserWithWordBoundary_1 = AbstractParserWithWordBoundary; +const constants_1 = constants; +const PATTERN = new RegExp("(?:星期|礼拜|周)(?" + Object.keys(constants_1.WEEKDAY_OFFSET).join("|") + ")"); +class ZHHansWeekdayParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking { + innerPattern() { + return PATTERN; + } + innerExtract(context, match) { + const result = context.createParsingResult(match.index, match[0]); + const dayOfWeek = match.groups.weekday; + const offset = constants_1.WEEKDAY_OFFSET[dayOfWeek]; + if (offset === undefined) + return null; + let startMoment = (0, dayjs_1.default)(context.refDate); + const refOffset = startMoment.day(); + if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset - 7); + } + else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) { + startMoment = startMoment.day(offset + 7); + } + else { + startMoment = startMoment.day(offset); + } + result.start.assign("weekday", offset); + { + result.start.imply("day", startMoment.date()); + result.start.imply("month", startMoment.month() + 1); + result.start.imply("year", startMoment.year()); + } + return result; + } +} +ZHHansWeekdayParser$1.default = ZHHansWeekdayParser; + +var ZHHansMergeDateRangeRefiner$1 = {}; + +var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansMergeDateRangeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateRangeRefiner_1 = __importDefault$1(AbstractMergeDateRangeRefiner$1); +class ZHHansMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner_1.default { + patternBetween() { + return /^\s*(至|到|-|~|~|-|ー)\s*$/i; + } +} +ZHHansMergeDateRangeRefiner$1.default = ZHHansMergeDateRangeRefiner; + +var ZHHansMergeDateTimeRefiner$1 = {}; + +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(ZHHansMergeDateTimeRefiner$1, "__esModule", { value: true }); +const AbstractMergeDateTimeRefiner_1 = __importDefault(AbstractMergeDateTimeRefiner); +class ZHHansMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner_1.default { + patternBetween() { + return /^\s*$/i; + } +} +ZHHansMergeDateTimeRefiner$1.default = ZHHansMergeDateTimeRefiner; + +(function (exports) { +var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = exports.hans = void 0; +const chrono_1 = chrono$1; +const ExtractTimezoneOffsetRefiner_1 = __importDefault(ExtractTimezoneOffsetRefiner$1); +const configurations_1 = configurations; +const ZHHansCasualDateParser_1 = __importDefault(ZHHansCasualDateParser$1); +const ZHHansDateParser_1 = __importDefault(ZHHansDateParser$1); +const ZHHansDeadlineFormatParser_1 = __importDefault(ZHHansDeadlineFormatParser$1); +const ZHHansRelationWeekdayParser_1 = __importDefault(ZHHansRelationWeekdayParser$1); +const ZHHansTimeExpressionParser_1 = __importDefault(ZHHansTimeExpressionParser$1); +const ZHHansWeekdayParser_1 = __importDefault(ZHHansWeekdayParser$1); +const ZHHansMergeDateRangeRefiner_1 = __importDefault(ZHHansMergeDateRangeRefiner$1); +const ZHHansMergeDateTimeRefiner_1 = __importDefault(ZHHansMergeDateTimeRefiner$1); +exports.hans = new chrono_1.Chrono(createCasualConfiguration()); +exports.casual = new chrono_1.Chrono(createCasualConfiguration()); +exports.strict = new chrono_1.Chrono(createConfiguration()); +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +function createCasualConfiguration() { + const option = createConfiguration(); + option.parsers.unshift(new ZHHansCasualDateParser_1.default()); + return option; +} +exports.createCasualConfiguration = createCasualConfiguration; +function createConfiguration() { + const configuration = (0, configurations_1.includeCommonConfiguration)({ + parsers: [ + new ZHHansDateParser_1.default(), + new ZHHansRelationWeekdayParser_1.default(), + new ZHHansWeekdayParser_1.default(), + new ZHHansTimeExpressionParser_1.default(), + new ZHHansDeadlineFormatParser_1.default(), + ], + refiners: [new ZHHansMergeDateRangeRefiner_1.default(), new ZHHansMergeDateTimeRefiner_1.default()], + }); + configuration.refiners = configuration.refiners.filter((refiner) => !(refiner instanceof ExtractTimezoneOffsetRefiner_1.default)); + return configuration; +} +exports.createConfiguration = createConfiguration; +}(hans)); + +(function (exports) { +var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hans = void 0; +__exportStar(hant, exports); +var hans_1 = hans; +Object.defineProperty(exports, "hans", { enumerable: true, get: function () { return hans_1.hans; } }); +}(zh)); + +(function (exports) { +var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseDate = exports.parse = exports.casual = exports.strict = exports.zh = exports.nl = exports.pt = exports.ja = exports.fr = exports.de = exports.Meridiem = exports.Chrono = exports.en = void 0; +const en = __importStar(en$1); +exports.en = en; +const chrono_1 = chrono$1; +Object.defineProperty(exports, "Chrono", { enumerable: true, get: function () { return chrono_1.Chrono; } }); +(function (Meridiem) { + Meridiem[Meridiem["AM"] = 0] = "AM"; + Meridiem[Meridiem["PM"] = 1] = "PM"; +})(exports.Meridiem || (exports.Meridiem = {})); +const de$1 = __importStar(de); +exports.de = de$1; +const fr$1 = __importStar(fr); +exports.fr = fr$1; +const ja$1 = __importStar(ja); +exports.ja = ja$1; +const pt$1 = __importStar(pt); +exports.pt = pt$1; +const nl$1 = __importStar(nl); +exports.nl = nl$1; +const zh$1 = __importStar(zh); +exports.zh = zh$1; +exports.strict = en.strict; +exports.casual = en.casual; +function parse(text, ref, option) { + return exports.casual.parse(text, ref, option); +} +exports.parse = parse; +function parseDate(text, ref, option) { + return exports.casual.parseDate(text, ref, option); +} +exports.parseDate = parseDate; +}(dist)); + +var chrono = /*@__PURE__*/getDefaultExportFromCjs(dist); + +function getLocalizedChrono() { + const locale = window.moment.locale(); + switch (locale) { + case "en-gb": + return new dist.Chrono(chrono.en.createCasualConfiguration(true)); + default: + return new dist.Chrono(chrono.en.createCasualConfiguration(false)); + } +} +function getConfiguredChrono() { + const localizedChrono = getLocalizedChrono(); + localizedChrono.parsers.push({ + pattern: () => { + return /\bChristmas\b/i; + }, + extract: () => { + return { + day: 25, + month: 12, + }; + }, + }); + localizedChrono.parsers.push({ + pattern: () => new RegExp(ORDINAL_NUMBER_PATTERN), + extract: (_context, match) => { + return { + day: parseOrdinalNumberPattern(match[0]), + month: window.moment().month(), + }; + }, + }); + return localizedChrono; +} +class NLDParser { + constructor() { + this.chrono = getConfiguredChrono(); + } + getParsedDate(selectedText, weekStartPreference) { + var _a; + const parser = this.chrono; + const initialParse = parser.parse(selectedText); + const weekdayIsCertain = (_a = initialParse[0]) === null || _a === void 0 ? void 0 : _a.start.isCertain("weekday"); + const weekStart = weekStartPreference === "locale-default" + ? getLocaleWeekStart() + : weekStartPreference; + const locale = { + weekStart: getWeekNumber(weekStart), + }; + const thisDateMatch = selectedText.match(/this\s([\w]+)/i); + const nextDateMatch = selectedText.match(/next\s([\w]+)/i); + const lastDayOfMatch = selectedText.match(/(last day of|end of)\s*([^\n\r]*)/i); + const midOf = selectedText.match(/mid\s([\w]+)/i); + const referenceDate = weekdayIsCertain + ? window.moment().weekday(0).toDate() + : new Date(); + if (thisDateMatch && thisDateMatch[1] === "week") { + return parser.parseDate(`this ${weekStart}`, referenceDate); + } + if (nextDateMatch && nextDateMatch[1] === "week") { + return parser.parseDate(`next ${weekStart}`, referenceDate, { + forwardDate: true, + }); + } + if (nextDateMatch && nextDateMatch[1] === "month") { + const thisMonth = parser.parseDate("this month", new Date(), { + forwardDate: true, + }); + return parser.parseDate(selectedText, thisMonth, { + forwardDate: true, + }); + } + if (nextDateMatch && nextDateMatch[1] === "year") { + const thisYear = parser.parseDate("this year", new Date(), { + forwardDate: true, + }); + return parser.parseDate(selectedText, thisYear, { + forwardDate: true, + }); + } + if (lastDayOfMatch) { + const tempDate = parser.parse(lastDayOfMatch[2]); + const year = tempDate[0].start.get("year"); + const month = tempDate[0].start.get("month"); + const lastDay = getLastDayOfMonth(year, month); + return parser.parseDate(`${year}-${month}-${lastDay}`, new Date(), { + forwardDate: true, + }); + } + if (midOf) { + return parser.parseDate(`${midOf[1]} 15th`, new Date(), { + forwardDate: true, + }); + } + return parser.parseDate(selectedText, referenceDate, { locale }); + } +} + +const DEFAULT_SETTINGS = { + autosuggestToggleLink: true, + autocompleteTriggerPhrase: "@", + isAutosuggestEnabled: true, + format: "YYYY-MM-DD", + timeFormat: "HH:mm", + separator: " ", + weekStart: "locale-default", + modalToggleTime: false, + modalToggleLink: false, + modalMomentFormat: "YYYY-MM-DD HH:mm", +}; +const weekdays = [ + "sunday", + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", +]; +class NLDSettingsTab extends require$$0$1.PluginSettingTab { + constructor(app, plugin) { + super(app, plugin); + this.plugin = plugin; + } + display() { + const { containerEl } = this; + const localizedWeekdays = window.moment.weekdays(); + const localeWeekStart = getLocaleWeekStart(); + containerEl.empty(); + containerEl.createEl("h2", { + text: "Natural Language Dates", + }); + containerEl.createEl("h3", { + text: "Parser settings", + }); + new require$$0$1.Setting(containerEl) + .setName("Date format") + .setDesc("Output format for parsed dates") + .addMomentFormat((text) => text + .setDefaultFormat("YYYY-MM-DD") + .setValue(this.plugin.settings.format) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.format = value || "YYYY-MM-DD"; + yield this.plugin.saveSettings(); + }))); + new require$$0$1.Setting(containerEl) + .setName("Week starts on") + .setDesc("Which day to consider as the start of the week") + .addDropdown((dropdown) => { + dropdown.addOption("locale-default", `Locale default (${localeWeekStart})`); + localizedWeekdays.forEach((day, i) => { + dropdown.addOption(weekdays[i], day); + }); + dropdown.setValue(this.plugin.settings.weekStart.toLowerCase()); + dropdown.onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.weekStart = value; + yield this.plugin.saveSettings(); + })); + }); + containerEl.createEl("h3", { + text: "Hotkey formatting settings", + }); + new require$$0$1.Setting(containerEl) + .setName("Time format") + .setDesc("Format for the hotkeys that include the current time") + .addMomentFormat((text) => text + .setDefaultFormat("HH:mm") + .setValue(this.plugin.settings.timeFormat) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.timeFormat = value || "HH:mm"; + yield this.plugin.saveSettings(); + }))); + new require$$0$1.Setting(containerEl) + .setName("Separator") + .setDesc("Separator between date and time for entries that have both") + .addText((text) => text + .setPlaceholder("Separator is empty") + .setValue(this.plugin.settings.separator) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.separator = value; + yield this.plugin.saveSettings(); + }))); + containerEl.createEl("h3", { + text: "Date Autosuggest", + }); + new require$$0$1.Setting(containerEl) + .setName("Enable date autosuggest") + .setDesc(`Input dates with natural language. Open the suggest menu with ${this.plugin.settings.autocompleteTriggerPhrase}`) + .addToggle((toggle) => toggle + .setValue(this.plugin.settings.isAutosuggestEnabled) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.isAutosuggestEnabled = value; + yield this.plugin.saveSettings(); + }))); + new require$$0$1.Setting(containerEl) + .setName("Add dates as link?") + .setDesc("If enabled, dates created via autosuggest will be wrapped in [[wikilinks]]") + .addToggle((toggle) => toggle + .setValue(this.plugin.settings.autosuggestToggleLink) + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.autosuggestToggleLink = value; + yield this.plugin.saveSettings(); + }))); + new require$$0$1.Setting(containerEl) + .setName("Trigger phrase") + .setDesc("Character(s) that will cause the date autosuggest to open") + .addMomentFormat((text) => text + .setPlaceholder(DEFAULT_SETTINGS.autocompleteTriggerPhrase) + .setValue(this.plugin.settings.autocompleteTriggerPhrase || "@") + .onChange((value) => __awaiter(this, void 0, void 0, function* () { + this.plugin.settings.autocompleteTriggerPhrase = value.trim(); + yield this.plugin.saveSettings(); + }))); + } +} + +class DateSuggest extends require$$0$1.EditorSuggest { + constructor(app, plugin) { + super(app); + this.app = app; + this.plugin = plugin; + // @ts-ignore + this.scope.register(["Shift"], "Enter", (evt) => { + // @ts-ignore + this.suggestions.useSelectedItem(evt); + return false; + }); + if (this.plugin.settings.autosuggestToggleLink) { + this.setInstructions([{ command: "Shift", purpose: "Keep text as alias" }]); + } + } + getSuggestions(context) { + const suggestions = this.getDateSuggestions(context); + if (suggestions.length) { + return suggestions; + } + // catch-all if there are no matches + return [{ label: context.query }]; + } + getDateSuggestions(context) { + if (context.query.match(/^time/)) { + return ["now", "+15 minutes", "+1 hour", "-15 minutes", "-1 hour"] + .map((val) => ({ label: `time:${val}` })) + .filter((item) => item.label.toLowerCase().startsWith(context.query)); + } + if (context.query.match(/(next|last|this)/i)) { + const reference = context.query.match(/(next|last|this)/i)[1]; + return [ + "week", + "month", + "year", + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ] + .map((val) => ({ label: `${reference} ${val}` })) + .filter((items) => items.label.toLowerCase().startsWith(context.query)); + } + const relativeDate = context.query.match(/^in ([+-]?\d+)/i) || context.query.match(/^([+-]?\d+)/i); + if (relativeDate) { + const timeDelta = relativeDate[1]; + return [ + { label: `in ${timeDelta} minutes` }, + { label: `in ${timeDelta} hours` }, + { label: `in ${timeDelta} days` }, + { label: `in ${timeDelta} weeks` }, + { label: `in ${timeDelta} months` }, + { label: `${timeDelta} days ago` }, + { label: `${timeDelta} weeks ago` }, + { label: `${timeDelta} months ago` }, + ].filter((items) => items.label.toLowerCase().startsWith(context.query)); + } + return [{ label: "Today" }, { label: "Yesterday" }, { label: "Tomorrow" }].filter((items) => items.label.toLowerCase().startsWith(context.query)); + } + renderSuggestion(suggestion, el) { + el.setText(suggestion.label); + } + selectSuggestion(suggestion, event) { + const { editor } = this.context; + const includeAlias = event.shiftKey; + let dateStr = ""; + let makeIntoLink = this.plugin.settings.autosuggestToggleLink; + if (suggestion.label.startsWith("time:")) { + const timePart = suggestion.label.substring(5); + dateStr = this.plugin.parseTime(timePart).formattedString; + makeIntoLink = false; + } + else { + dateStr = this.plugin.parseDate(suggestion.label).formattedString; + } + if (makeIntoLink) { + dateStr = generateMarkdownLink(this.app, dateStr, includeAlias ? suggestion.label : undefined); + } + editor.replaceRange(dateStr, this.context.start, this.context.end); + } + onTrigger(cursor, editor, file) { + var _a; + if (!this.plugin.settings.isAutosuggestEnabled) { + return null; + } + const triggerPhrase = this.plugin.settings.autocompleteTriggerPhrase; + const startPos = ((_a = this.context) === null || _a === void 0 ? void 0 : _a.start) || { + line: cursor.line, + ch: cursor.ch - triggerPhrase.length, + }; + if (!editor.getRange(startPos, cursor).startsWith(triggerPhrase)) { + return null; + } + const precedingChar = editor.getRange({ + line: startPos.line, + ch: startPos.ch - 1, + }, startPos); + // Short-circuit if `@` as a part of a word (e.g. part of an email address) + if (precedingChar && /[`a-zA-Z0-9]/.test(precedingChar)) { + return null; + } + return { + start: startPos, + end: cursor, + query: editor.getRange(startPos, cursor).substring(triggerPhrase.length), + }; + } +} + +function getParseCommand(plugin, mode) { + const { workspace } = plugin.app; + const activeView = workspace.getActiveViewOfType(require$$0$1.MarkdownView); + // The active view might not be a markdown view + if (!activeView) { + return; + } + const editor = activeView.editor; + const cursor = editor.getCursor(); + const selectedText = getSelectedText(editor); + const date = plugin.parseDate(selectedText); + if (!date.moment.isValid()) { + // Do nothing + editor.setCursor({ + line: cursor.line, + ch: cursor.ch, + }); + return; + } + //mode == "replace" + let newStr = `[[${date.formattedString}]]`; + if (mode == "link") { + newStr = `[${selectedText}](${date.formattedString})`; + } + else if (mode == "clean") { + newStr = `${date.formattedString}`; + } + else if (mode == "time") { + const time = plugin.parseTime(selectedText); + newStr = `${time.formattedString}`; + } + editor.replaceSelection(newStr); + adjustCursor(editor, cursor, newStr, selectedText); + editor.focus(); +} +function insertMomentCommand(plugin, date, format) { + const { workspace } = plugin.app; + const activeView = workspace.getActiveViewOfType(require$$0$1.MarkdownView); + if (activeView) { + // The active view might not be a markdown view + const editor = activeView.editor; + editor.replaceSelection(window.moment(date).format(format)); + } +} +function getNowCommand(plugin) { + const format = `${plugin.settings.format}${plugin.settings.separator}${plugin.settings.timeFormat}`; + const date = new Date(); + insertMomentCommand(plugin, date, format); +} +function getCurrentDateCommand(plugin) { + const format = plugin.settings.format; + const date = new Date(); + insertMomentCommand(plugin, date, format); +} +function getCurrentTimeCommand(plugin) { + const format = plugin.settings.timeFormat; + const date = new Date(); + insertMomentCommand(plugin, date, format); +} + +class NaturalLanguageDates extends require$$0$1.Plugin { + onload() { + return __awaiter(this, void 0, void 0, function* () { + yield this.loadSettings(); + this.addCommand({ + id: "nlp-dates", + name: "Parse natural language date", + callback: () => getParseCommand(this, "replace"), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-dates-link", + name: "Parse natural language date (as link)", + callback: () => getParseCommand(this, "link"), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-date-clean", + name: "Parse natural language date (as plain text)", + callback: () => getParseCommand(this, "clean"), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-parse-time", + name: "Parse natural language time", + callback: () => getParseCommand(this, "time"), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-now", + name: "Insert the current date and time", + callback: () => getNowCommand(this), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-today", + name: "Insert the current date", + callback: () => getCurrentDateCommand(this), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-time", + name: "Insert the current time", + callback: () => getCurrentTimeCommand(this), + hotkeys: [], + }); + this.addCommand({ + id: "nlp-picker", + name: "Date picker", + checkCallback: (checking) => { + if (checking) { + return !!this.app.workspace.getActiveViewOfType(require$$0$1.MarkdownView); + } + new DatePickerModal(this.app, this).open(); + }, + hotkeys: [], + }); + this.addSettingTab(new NLDSettingsTab(this.app, this)); + this.registerObsidianProtocolHandler("nldates", this.actionHandler.bind(this)); + this.registerEditorSuggest(new DateSuggest(this.app, this)); + this.app.workspace.onLayoutReady(() => { + // initialize the parser when layout is ready so that the correct locale is used + this.parser = new NLDParser(); + }); + }); + } + onunload() { + console.log("Unloading natural language date parser plugin"); + } + loadSettings() { + return __awaiter(this, void 0, void 0, function* () { + this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData()); + }); + } + saveSettings() { + return __awaiter(this, void 0, void 0, function* () { + yield this.saveData(this.settings); + }); + } + /* + @param dateString: A string that contains a date in natural language, e.g. today, tomorrow, next week + @param format: A string that contains the formatting string for a Moment + @returns NLDResult: An object containing the date, a cloned Moment and the formatted string. + */ + parse(dateString, format) { + const date = this.parser.getParsedDate(dateString, this.settings.weekStart); + const formattedString = getFormattedDate(date, format); + if (formattedString === "Invalid date") { + console.debug("Input date " + dateString + " can't be parsed by nldates"); + } + return { + formattedString, + date, + moment: window.moment(date), + }; + } + /* + @param dateString: A string that contains a date in natural language, e.g. today, tomorrow, next week + @returns NLDResult: An object containing the date, a cloned Moment and the formatted string. + */ + parseDate(dateString) { + return this.parse(dateString, this.settings.format); + } + parseTime(dateString) { + return this.parse(dateString, this.settings.timeFormat); + } + actionHandler(params) { + return __awaiter(this, void 0, void 0, function* () { + const { workspace } = this.app; + const date = this.parseDate(params.day); + const newPane = parseTruthy(params.newPane || "yes"); + if (date.moment.isValid()) { + const dailyNote = yield getOrCreateDailyNote(date.moment); + workspace.getLeaf(newPane).openFile(dailyNote); + } + }); + } +} + +module.exports = NaturalLanguageDates; + + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/nldates-obsidian/manifest.json b/.obsidian/plugins/nldates-obsidian/manifest.json new file mode 100644 index 0000000..ef47c07 --- /dev/null +++ b/.obsidian/plugins/nldates-obsidian/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "nldates-obsidian", + "name": "Natural Language Dates", + "description": "Create date-links based on natural language", + "version": "0.6.2", + "author": "Argentina Ortega Sainz", + "authorUrl": "https://argentinaos.com/", + "isDesktopOnly": false, + "minAppVersion": "1.0.0" +} diff --git a/.obsidian/plugins/obsidian42-brat/data.json b/.obsidian/plugins/obsidian42-brat/data.json new file mode 100644 index 0000000..cbcf2e4 --- /dev/null +++ b/.obsidian/plugins/obsidian42-brat/data.json @@ -0,0 +1,16 @@ +{ + "pluginList": [ + "reply2za/obsidian-query-control" + ], + "pluginSubListFrozenVersion": [], + "themesList": [], + "updateAtStartup": true, + "updateThemesAtStartup": true, + "enableAfterInstall": true, + "loggingEnabled": false, + "loggingPath": "BRAT-log", + "loggingVerboseEnabled": false, + "debuggingMode": false, + "notificationsEnabled": true, + "personalAccessToken": "" +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian42-brat/main.js b/.obsidian/plugins/obsidian42-brat/main.js new file mode 100644 index 0000000..9f4007f --- /dev/null +++ b/.obsidian/plugins/obsidian42-brat/main.js @@ -0,0 +1,2422 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// node_modules/obsidian-daily-notes-interface/dist/main.js +var require_main = __commonJS({ + "node_modules/obsidian-daily-notes-interface/dist/main.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + var obsidian = require("obsidian"); + var DEFAULT_DAILY_NOTE_FORMAT = "YYYY-MM-DD"; + var DEFAULT_WEEKLY_NOTE_FORMAT = "gggg-[W]ww"; + var DEFAULT_MONTHLY_NOTE_FORMAT = "YYYY-MM"; + var DEFAULT_QUARTERLY_NOTE_FORMAT = "YYYY-[Q]Q"; + var DEFAULT_YEARLY_NOTE_FORMAT = "YYYY"; + function shouldUsePeriodicNotesSettings(periodicity) { + var _a, _b; + const periodicNotes = window.app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a[periodicity]) == null ? void 0 : _b.enabled); + } + function getDailyNoteSettings2() { + var _a, _b, _c, _d; + try { + const { internalPlugins, plugins } = window.app; + if (shouldUsePeriodicNotesSettings("daily")) { + const { format: format2, folder: folder2, template: template2 } = ((_b = (_a = plugins.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.daily) || {}; + return { + format: format2 || DEFAULT_DAILY_NOTE_FORMAT, + folder: (folder2 == null ? void 0 : folder2.trim()) || "", + template: (template2 == null ? void 0 : template2.trim()) || "" + }; + } + const { folder, format, template } = ((_d = (_c = internalPlugins.getPluginById("daily-notes")) == null ? void 0 : _c.instance) == null ? void 0 : _d.options) || {}; + return { + format: format || DEFAULT_DAILY_NOTE_FORMAT, + folder: (folder == null ? void 0 : folder.trim()) || "", + template: (template == null ? void 0 : template.trim()) || "" + }; + } catch (err) { + console.info("No custom daily note settings found!", err); + } + } + function getWeeklyNoteSettings() { + var _a, _b, _c, _d, _e, _f, _g; + try { + const pluginManager = window.app.plugins; + const calendarSettings = (_a = pluginManager.getPlugin("calendar")) == null ? void 0 : _a.options; + const periodicNotesSettings = (_c = (_b = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _b.settings) == null ? void 0 : _c.weekly; + if (shouldUsePeriodicNotesSettings("weekly")) { + return { + format: periodicNotesSettings.format || DEFAULT_WEEKLY_NOTE_FORMAT, + folder: ((_d = periodicNotesSettings.folder) == null ? void 0 : _d.trim()) || "", + template: ((_e = periodicNotesSettings.template) == null ? void 0 : _e.trim()) || "" + }; + } + const settings = calendarSettings || {}; + return { + format: settings.weeklyNoteFormat || DEFAULT_WEEKLY_NOTE_FORMAT, + folder: ((_f = settings.weeklyNoteFolder) == null ? void 0 : _f.trim()) || "", + template: ((_g = settings.weeklyNoteTemplate) == null ? void 0 : _g.trim()) || "" + }; + } catch (err) { + console.info("No custom weekly note settings found!", err); + } + } + function getMonthlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("monthly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.monthly) || {}; + return { + format: settings.format || DEFAULT_MONTHLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom monthly note settings found!", err); + } + } + function getQuarterlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("quarterly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.quarterly) || {}; + return { + format: settings.format || DEFAULT_QUARTERLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom quarterly note settings found!", err); + } + } + function getYearlyNoteSettings() { + var _a, _b, _c, _d; + const pluginManager = window.app.plugins; + try { + const settings = shouldUsePeriodicNotesSettings("yearly") && ((_b = (_a = pluginManager.getPlugin("periodic-notes")) == null ? void 0 : _a.settings) == null ? void 0 : _b.yearly) || {}; + return { + format: settings.format || DEFAULT_YEARLY_NOTE_FORMAT, + folder: ((_c = settings.folder) == null ? void 0 : _c.trim()) || "", + template: ((_d = settings.template) == null ? void 0 : _d.trim()) || "" + }; + } catch (err) { + console.info("No custom yearly note settings found!", err); + } + } + function join(...partSegments) { + let parts = []; + for (let i = 0, l = partSegments.length; i < l; i++) { + parts = parts.concat(partSegments[i].split("/")); + } + const newParts = []; + for (let i = 0, l = parts.length; i < l; i++) { + const part = parts[i]; + if (!part || part === ".") + continue; + else + newParts.push(part); + } + if (parts[0] === "") + newParts.unshift(""); + return newParts.join("/"); + } + function basename(fullPath) { + let base = fullPath.substring(fullPath.lastIndexOf("/") + 1); + if (base.lastIndexOf(".") != -1) + base = base.substring(0, base.lastIndexOf(".")); + return base; + } + async function ensureFolderExists(path) { + const dirs = path.replace(/\\/g, "/").split("/"); + dirs.pop(); + 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.normalizePath(join(directory, filename)); + await ensureFolderExists(path); + return path; + } + async function getTemplateInfo(template) { + const { metadataCache, vault } = window.app; + const templatePath = obsidian.normalizePath(template); + if (templatePath === "/") { + return Promise.resolve(["", null]); + } + try { + const templateFile = metadataCache.getFirstLinkpathDest(templatePath, ""); + const contents = await vault.cachedRead(templateFile); + 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.Notice("Failed to read the daily note template"); + return ["", null]; + } + } + function getDateUID(date, granularity = "day") { + const ts = date.clone().startOf(granularity).format(); + return `${granularity}-${ts}`; + } + function removeEscapedCharacters(format) { + return format.replace(/\[[^\]]*\]/g, ""); + } + 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) { + return getDateFromFilename(file.basename, granularity); + } + function getDateFromPath(path, granularity) { + return getDateFromFilename(basename(path), granularity); + } + function getDateFromFilename(filename, granularity) { + const getSettings = { + day: getDailyNoteSettings2, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings + }; + const format = getSettings[granularity]().format.split("/").pop(); + const noteDate = window.moment(filename, 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( + filename, + // If format contains week, remove day & month formatting + format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), + false + ); + } + } + } + return noteDate; + } + var DailyNotesFolderMissingError = class extends Error { + }; + async function createDailyNote(date) { + const app = window.app; + const { vault } = app; + const moment2 = window.moment; + const { template, format, folder } = getDailyNoteSettings2(); + 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, moment2().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 = moment2(); + 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))); + app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } + } + function getDailyNote(date, dailyNotes) { + var _a; + return (_a = dailyNotes[getDateUID(date, "day")]) != null ? _a : null; + } + function getAllDailyNotes() { + const { vault } = window.app; + const { folder } = getDailyNoteSettings2(); + const dailyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!dailyNotesFolder) { + throw new DailyNotesFolderMissingError("Failed to find daily notes folder"); + } + const dailyNotes = {}; + obsidian.Vault.recurseChildren(dailyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "day"); + if (date) { + const dateString = getDateUID(date, "day"); + dailyNotes[dateString] = note; + } + } + }); + return dailyNotes; + } + var WeeklyNotesFolderMissingError = class extends Error { + }; + function getDaysOfWeek() { + const { moment: moment2 } = window; + let weekStart = moment2.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().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()); + })); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } + } + function getWeeklyNote(date, weeklyNotes) { + var _a; + return (_a = weeklyNotes[getDateUID(date, "week")]) != null ? _a : null; + } + function getAllWeeklyNotes() { + const weeklyNotes = {}; + if (!appHasWeeklyNotesPluginLoaded()) { + return weeklyNotes; + } + const { vault } = window.app; + const { folder } = getWeeklyNoteSettings(); + const weeklyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!weeklyNotesFolder) { + throw new WeeklyNotesFolderMissingError("Failed to find weekly notes folder"); + } + obsidian.Vault.recurseChildren(weeklyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "week"); + if (date) { + const dateString = getDateUID(date, "week"); + weeklyNotes[dateString] = note; + } + } + }); + return weeklyNotes; + } + var MonthlyNotesFolderMissingError = class extends Error { + }; + async function createMonthlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getMonthlyNoteSettings(); + 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*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } + } + function getMonthlyNote(date, monthlyNotes) { + var _a; + return (_a = monthlyNotes[getDateUID(date, "month")]) != null ? _a : null; + } + function getAllMonthlyNotes() { + const monthlyNotes = {}; + if (!appHasMonthlyNotesPluginLoaded()) { + return monthlyNotes; + } + const { vault } = window.app; + const { folder } = getMonthlyNoteSettings(); + const monthlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!monthlyNotesFolder) { + throw new MonthlyNotesFolderMissingError("Failed to find monthly notes folder"); + } + obsidian.Vault.recurseChildren(monthlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "month"); + if (date) { + const dateString = getDateUID(date, "month"); + monthlyNotes[dateString] = note; + } + } + }); + return monthlyNotes; + } + var QuarterlyNotesFolderMissingError = class extends Error { + }; + async function createQuarterlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getQuarterlyNoteSettings(); + 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*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } + } + function getQuarterlyNote(date, quarterly) { + var _a; + return (_a = quarterly[getDateUID(date, "quarter")]) != null ? _a : null; + } + function getAllQuarterlyNotes() { + const quarterly = {}; + if (!appHasQuarterlyNotesPluginLoaded()) { + return quarterly; + } + const { vault } = window.app; + const { folder } = getQuarterlyNoteSettings(); + const quarterlyFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!quarterlyFolder) { + throw new QuarterlyNotesFolderMissingError("Failed to find quarterly notes folder"); + } + obsidian.Vault.recurseChildren(quarterlyFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "quarter"); + if (date) { + const dateString = getDateUID(date, "quarter"); + quarterly[dateString] = note; + } + } + }); + return quarterly; + } + var YearlyNotesFolderMissingError = class extends Error { + }; + async function createYearlyNote(date) { + const { vault } = window.app; + const { template, format, folder } = getYearlyNoteSettings(); + 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*date\s*}}/gi, filename).replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")).replace(/{{\s*title\s*}}/gi, filename)); + window.app.foldManager.save(createdFile, IFoldInfo); + return createdFile; + } catch (err) { + console.error(`Failed to create file: '${normalizedPath}'`, err); + new obsidian.Notice("Unable to create new file."); + } + } + function getYearlyNote(date, yearlyNotes) { + var _a; + return (_a = yearlyNotes[getDateUID(date, "year")]) != null ? _a : null; + } + function getAllYearlyNotes() { + const yearlyNotes = {}; + if (!appHasYearlyNotesPluginLoaded()) { + return yearlyNotes; + } + const { vault } = window.app; + const { folder } = getYearlyNoteSettings(); + const yearlyNotesFolder = vault.getAbstractFileByPath(obsidian.normalizePath(folder)); + if (!yearlyNotesFolder) { + throw new YearlyNotesFolderMissingError("Failed to find yearly notes folder"); + } + obsidian.Vault.recurseChildren(yearlyNotesFolder, (note) => { + if (note instanceof obsidian.TFile) { + const date = getDateFromFile(note, "year"); + if (date) { + const dateString = getDateUID(date, "year"); + yearlyNotes[dateString] = note; + } + } + }); + return yearlyNotes; + } + function appHasDailyNotesPluginLoaded() { + var _a, _b; + const { app } = window; + const dailyNotesPlugin = app.internalPlugins.plugins["daily-notes"]; + if (dailyNotesPlugin && dailyNotesPlugin.enabled) { + return true; + } + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.daily) == null ? void 0 : _b.enabled); + } + function appHasWeeklyNotesPluginLoaded() { + var _a, _b; + const { app } = window; + if (app.plugins.getPlugin("calendar")) { + return true; + } + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.weekly) == null ? void 0 : _b.enabled); + } + function appHasMonthlyNotesPluginLoaded() { + var _a, _b; + const { app } = window; + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.monthly) == null ? void 0 : _b.enabled); + } + function appHasQuarterlyNotesPluginLoaded() { + var _a, _b; + const { app } = window; + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.quarterly) == null ? void 0 : _b.enabled); + } + function appHasYearlyNotesPluginLoaded() { + var _a, _b; + const { app } = window; + const periodicNotes = app.plugins.getPlugin("periodic-notes"); + return periodicNotes && ((_b = (_a = periodicNotes.settings) == null ? void 0 : _a.yearly) == null ? void 0 : _b.enabled); + } + function getPeriodicNoteSettings(granularity) { + const getSettings = { + day: getDailyNoteSettings2, + week: getWeeklyNoteSettings, + month: getMonthlyNoteSettings, + quarter: getQuarterlyNoteSettings, + year: getYearlyNoteSettings + }[granularity]; + return getSettings(); + } + function createPeriodicNote(granularity, date) { + const createFn = { + day: createDailyNote, + month: createMonthlyNote, + week: createWeeklyNote + }; + return createFn[granularity](date); + } + exports.DEFAULT_DAILY_NOTE_FORMAT = DEFAULT_DAILY_NOTE_FORMAT; + exports.DEFAULT_MONTHLY_NOTE_FORMAT = DEFAULT_MONTHLY_NOTE_FORMAT; + exports.DEFAULT_QUARTERLY_NOTE_FORMAT = DEFAULT_QUARTERLY_NOTE_FORMAT; + exports.DEFAULT_WEEKLY_NOTE_FORMAT = DEFAULT_WEEKLY_NOTE_FORMAT; + exports.DEFAULT_YEARLY_NOTE_FORMAT = DEFAULT_YEARLY_NOTE_FORMAT; + exports.appHasDailyNotesPluginLoaded = appHasDailyNotesPluginLoaded; + exports.appHasMonthlyNotesPluginLoaded = appHasMonthlyNotesPluginLoaded; + exports.appHasQuarterlyNotesPluginLoaded = appHasQuarterlyNotesPluginLoaded; + exports.appHasWeeklyNotesPluginLoaded = appHasWeeklyNotesPluginLoaded; + exports.appHasYearlyNotesPluginLoaded = appHasYearlyNotesPluginLoaded; + exports.createDailyNote = createDailyNote; + exports.createMonthlyNote = createMonthlyNote; + exports.createPeriodicNote = createPeriodicNote; + exports.createQuarterlyNote = createQuarterlyNote; + exports.createWeeklyNote = createWeeklyNote; + exports.createYearlyNote = createYearlyNote; + exports.getAllDailyNotes = getAllDailyNotes; + exports.getAllMonthlyNotes = getAllMonthlyNotes; + exports.getAllQuarterlyNotes = getAllQuarterlyNotes; + exports.getAllWeeklyNotes = getAllWeeklyNotes; + exports.getAllYearlyNotes = getAllYearlyNotes; + exports.getDailyNote = getDailyNote; + exports.getDailyNoteSettings = getDailyNoteSettings2; + exports.getDateFromFile = getDateFromFile; + exports.getDateFromPath = getDateFromPath; + exports.getDateUID = getDateUID; + exports.getMonthlyNote = getMonthlyNote; + exports.getMonthlyNoteSettings = getMonthlyNoteSettings; + exports.getPeriodicNoteSettings = getPeriodicNoteSettings; + exports.getQuarterlyNote = getQuarterlyNote; + exports.getQuarterlyNoteSettings = getQuarterlyNoteSettings; + exports.getTemplateInfo = getTemplateInfo; + exports.getWeeklyNote = getWeeklyNote; + exports.getWeeklyNoteSettings = getWeeklyNoteSettings; + exports.getYearlyNote = getYearlyNote; + exports.getYearlyNoteSettings = getYearlyNoteSettings; + } +}); + +// src/main.ts +var main_exports = {}; +__export(main_exports, { + default: () => ThePlugin +}); +module.exports = __toCommonJS(main_exports); +var import_obsidian11 = require("obsidian"); + +// src/ui/SettingsTab.ts +var import_obsidian5 = require("obsidian"); + +// src/features/themes.ts +var import_obsidian3 = require("obsidian"); + +// src/features/githubUtils.ts +var import_obsidian = require("obsidian"); +var GITHUB_RAW_USERCONTENT_PATH = "https://raw.githubusercontent.com/"; +var isPrivateRepo = async (repository, debugLogging = true, personalAccessToken = "") => { + const URL2 = `https://api.github.com/repos/${repository}`; + try { + const response = await (0, import_obsidian.request)({ + url: URL2, + headers: personalAccessToken ? { + Authorization: `Token ${personalAccessToken}` + } : {} + }); + const data = await JSON.parse(response); + return data.private; + } catch (e) { + if (debugLogging) console.log("error in isPrivateRepo", URL2, e); + return false; + } +}; +var grabReleaseFileFromRepository = async (repository, version, fileName, debugLogging = true, personalAccessToken = "") => { + try { + const isPrivate = await isPrivateRepo(repository, debugLogging, personalAccessToken); + if (isPrivate) { + const URL2 = `https://api.github.com/repos/${repository}/releases`; + const response = await (0, import_obsidian.request)({ + url: URL2, + headers: { + Authorization: `Token ${personalAccessToken}` + } + }); + const data = await JSON.parse(response); + const release = data.find((release2) => release2.tag_name === version); + if (!release) { + return null; + } + const asset = release.assets.find( + (asset2) => asset2.name === fileName + ); + if (!asset) { + return null; + } + const download = await (0, import_obsidian.request)({ + url: asset.url, + headers: { + Authorization: `Token ${personalAccessToken}`, + Accept: "application/octet-stream" + } + }); + return download === "Not Found" || download === `{"error":"Not Found"}` ? null : download; + } else { + const URL2 = `https://github.com/${repository}/releases/download/${version}/${fileName}`; + const download = await (0, import_obsidian.request)({ + url: URL2, + headers: personalAccessToken ? { + Authorization: `Token ${personalAccessToken}` + } : {} + }); + return download === "Not Found" || download === `{"error":"Not Found"}` ? null : download; + } + } catch (error) { + if (debugLogging) console.log("error in grabReleaseFileFromRepository", URL, error); + return null; + } +}; +var grabManifestJsonFromRepository = async (repositoryPath, rootManifest = true, debugLogging = true, personalAccessToken = "") => { + const manifestJsonPath = GITHUB_RAW_USERCONTENT_PATH + repositoryPath + (rootManifest ? "/HEAD/manifest.json" : "/HEAD/manifest-beta.json"); + if (debugLogging) + console.log("grabManifestJsonFromRepository manifestJsonPath", manifestJsonPath); + const isTokenValid = async (token) => { + try { + await (0, import_obsidian.request)({ + url: "https://api.github.com/user", + method: "GET", + headers: { + "Authorization": `token ${token}`, + "User-Agent": "request", + "accept": "application/vnd.github.v3+json" + } + }); + return true; + } catch (error) { + if (debugLogging) console.log("Token validation error:", error); + return false; + } + }; + let tokenValid = false; + if (personalAccessToken) { + tokenValid = await isTokenValid(personalAccessToken); + if (debugLogging) console.log("Token valid:", tokenValid); + } + try { + const response = await (0, import_obsidian.request)({ + url: manifestJsonPath, + headers: tokenValid ? { + Authorization: `Token ${personalAccessToken}` + } : {} + }); + if (debugLogging) console.log("grabManifestJsonFromRepository response", response); + return response === "404: Not Found" ? null : await JSON.parse(response); + } catch (error) { + if (error !== "Error: Request failed, status 404" && debugLogging) { + console.log( + `error in grabManifestJsonFromRepository for ${manifestJsonPath}`, + error + ); + } + return null; + } +}; +var grabCommmunityPluginList = async (debugLogging = true) => { + const pluginListUrl = `https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-plugins.json`; + try { + const response = await (0, import_obsidian.request)({ url: pluginListUrl }); + return response === "404: Not Found" ? null : await JSON.parse(response); + } catch (error) { + if (debugLogging) console.log("error in grabCommmunityPluginList", error); + return null; + } +}; +var grabCommmunityThemesList = async (debugLogging = true) => { + const themesUrl = `https://raw.githubusercontent.com/obsidianmd/obsidian-releases/HEAD/community-css-themes.json`; + try { + const response = await (0, import_obsidian.request)({ url: themesUrl }); + return response === "404: Not Found" ? null : await JSON.parse(response); + } catch (error) { + if (debugLogging) console.log("error in grabCommmunityThemesList", error); + return null; + } +}; +var grabCommmunityThemeCssFile = async (repositoryPath, betaVersion = false, debugLogging) => { + const themesUrl = `https://raw.githubusercontent.com/${repositoryPath}/HEAD/theme${betaVersion ? "-beta" : ""}.css`; + try { + const response = await (0, import_obsidian.request)({ url: themesUrl }); + return response === "404: Not Found" ? null : response; + } catch (error) { + if (debugLogging) console.log("error in grabCommmunityThemeCssFile", error); + return null; + } +}; +var grabCommmunityThemeManifestFile = async (repositoryPath, debugLogging = true) => { + const themesUrl = `https://raw.githubusercontent.com/${repositoryPath}/HEAD/manifest.json`; + try { + const response = await (0, import_obsidian.request)({ url: themesUrl }); + return response === "404: Not Found" ? null : response; + } catch (error) { + if (debugLogging) console.log("error in grabCommmunityThemeManifestFile", error); + return null; + } +}; +var checksum = (str) => { + let sum = 0; + for (let i = 0; i < str.length; i++) { + sum += str.charCodeAt(i); + } + return sum; +}; +var checksumForString = (str) => { + return checksum(str).toString(); +}; +var grabChecksumOfThemeCssFile = async (repositoryPath, betaVersion, debugLogging) => { + const themeCss = await grabCommmunityThemeCssFile( + repositoryPath, + betaVersion, + debugLogging + ); + return themeCss ? checksumForString(themeCss) : "0"; +}; +var grabLastCommitInfoForFile = async (repositoryPath, path, debugLogging = true) => { + const url = `https://api.github.com/repos/${repositoryPath}/commits?path=${path}&page=1&per_page=1`; + try { + const response = await (0, import_obsidian.request)({ url }); + return response === "404: Not Found" ? null : JSON.parse(response); + } catch (error) { + if (debugLogging) console.log("error in grabLastCommitInfoForAFile", error); + return null; + } +}; +var grabLastCommitDateForFile = async (repositoryPath, path) => { + var _a; + const test = await grabLastCommitInfoForFile(repositoryPath, path); + if (test && test.length > 0 && ((_a = test[0].commit.committer) == null ? void 0 : _a.date)) { + return test[0].commit.committer.date; + } else { + return ""; + } +}; + +// src/settings.ts +var DEFAULT_SETTINGS = { + pluginList: [], + pluginSubListFrozenVersion: [], + themesList: [], + updateAtStartup: true, + updateThemesAtStartup: true, + enableAfterInstall: true, + loggingEnabled: false, + loggingPath: "BRAT-log", + loggingVerboseEnabled: false, + debuggingMode: false, + notificationsEnabled: true, + personalAccessToken: "" +}; +function addBetaPluginToList(plugin, repositoryPath, specifyVersion = "") { + let save = false; + if (!plugin.settings.pluginList.contains(repositoryPath)) { + plugin.settings.pluginList.unshift(repositoryPath); + save = true; + } + if (specifyVersion !== "" && plugin.settings.pluginSubListFrozenVersion.filter((x) => x.repo === repositoryPath).length === 0) { + plugin.settings.pluginSubListFrozenVersion.unshift({ + repo: repositoryPath, + version: specifyVersion + }); + save = true; + } + if (save) { + void plugin.saveSettings(); + } +} +function existBetaPluginInList(plugin, repositoryPath) { + return plugin.settings.pluginList.contains(repositoryPath); +} +function addBetaThemeToList(plugin, repositoryPath, themeCss) { + const newTheme = { + repo: repositoryPath, + lastUpdate: checksumForString(themeCss) + }; + plugin.settings.themesList.unshift(newTheme); + void plugin.saveSettings(); +} +function existBetaThemeinInList(plugin, repositoryPath) { + const testIfThemExists = plugin.settings.themesList.find( + (t) => t.repo === repositoryPath + ); + return testIfThemExists ? true : false; +} +function updateBetaThemeLastUpdateChecksum(plugin, repositoryPath, checksum2) { + plugin.settings.themesList.forEach((t) => { + if (t.repo === repositoryPath) { + t.lastUpdate = checksum2; + void plugin.saveSettings(); + } + }); +} + +// src/utils/notifications.ts +var import_obsidian2 = require("obsidian"); +function toastMessage(plugin, msg, timeoutInSeconds = 10, contextMenuCallback) { + if (!plugin.settings.notificationsEnabled) return; + const additionalInfo = contextMenuCallback ? import_obsidian2.Platform.isDesktop ? "(click=dismiss, right-click=Info)" : "(click=dismiss)" : ""; + const newNotice = new import_obsidian2.Notice( + `BRAT +${msg} +${additionalInfo}`, + timeoutInSeconds * 1e3 + ); + if (contextMenuCallback) + newNotice.noticeEl.oncontextmenu = () => { + contextMenuCallback(); + }; +} + +// src/utils/internetconnection.ts +async function isConnectedToInternet() { + try { + const online = await fetch("https://obsidian.md/?" + Math.random()); + return online.status >= 200 && online.status < 300; + } catch (err) { + return false; + } +} + +// src/features/themes.ts +var themeSave = async (plugin, cssGithubRepository, newInstall) => { + let themeCss = await grabCommmunityThemeCssFile( + cssGithubRepository, + true, + plugin.settings.debuggingMode + ); + if (!themeCss) + themeCss = await grabCommmunityThemeCssFile( + cssGithubRepository, + false, + plugin.settings.debuggingMode + ); + if (!themeCss) { + toastMessage( + plugin, + "There is no theme.css or theme-beta.css file in the root path of this repository, so there is no theme to install." + ); + return false; + } + const themeManifest = await grabCommmunityThemeManifestFile( + cssGithubRepository, + plugin.settings.debuggingMode + ); + if (!themeManifest) { + toastMessage( + plugin, + "There is no manifest.json file in the root path of this repository, so theme cannot be installed." + ); + return false; + } + const manifestInfo = await JSON.parse(themeManifest); + const themeTargetFolderPath = (0, import_obsidian3.normalizePath)(themesRootPath(plugin) + manifestInfo.name); + const { adapter } = plugin.app.vault; + if (!await adapter.exists(themeTargetFolderPath)) + await adapter.mkdir(themeTargetFolderPath); + await adapter.write((0, import_obsidian3.normalizePath)(themeTargetFolderPath + "/theme.css"), themeCss); + await adapter.write( + (0, import_obsidian3.normalizePath)(themeTargetFolderPath + "/manifest.json"), + themeManifest + ); + updateBetaThemeLastUpdateChecksum( + plugin, + cssGithubRepository, + checksumForString(themeCss) + ); + let msg = ``; + if (newInstall) { + addBetaThemeToList(plugin, cssGithubRepository, themeCss); + msg = `${manifestInfo.name} theme installed from ${cssGithubRepository}. `; + setTimeout(() => { + plugin.app.customCss.setTheme(manifestInfo.name); + }, 500); + } else { + msg = `${manifestInfo.name} theme updated from ${cssGithubRepository}.`; + } + void plugin.log(msg + `[Theme Info](https://github.com/${cssGithubRepository})`, false); + toastMessage(plugin, msg, 20, () => { + window.open(`https://github.com/${cssGithubRepository}`); + }); + return true; +}; +var themesCheckAndUpdates = async (plugin, showInfo) => { + if (!await isConnectedToInternet()) { + console.log("BRAT: No internet detected."); + return; + } + let newNotice; + const msg1 = `Checking for beta theme updates STARTED`; + await plugin.log(msg1, true); + if (showInfo && plugin.settings.notificationsEnabled) + newNotice = new import_obsidian3.Notice(`BRAT +${msg1}`, 3e4); + for (const t of plugin.settings.themesList) { + let lastUpdateOnline = await grabChecksumOfThemeCssFile( + t.repo, + true, + plugin.settings.debuggingMode + ); + if (lastUpdateOnline === "0") + lastUpdateOnline = await grabChecksumOfThemeCssFile( + t.repo, + false, + plugin.settings.debuggingMode + ); + console.log("BRAT: lastUpdateOnline", lastUpdateOnline); + if (lastUpdateOnline !== t.lastUpdate) await themeSave(plugin, t.repo, false); + } + const msg2 = `Checking for beta theme updates COMPLETED`; + (async () => { + await plugin.log(msg2, true); + })(); + if (showInfo) { + if (plugin.settings.notificationsEnabled && newNotice) newNotice.hide(); + toastMessage(plugin, msg2); + } +}; +var themeDelete = (plugin, cssGithubRepository) => { + plugin.settings.themesList = plugin.settings.themesList.filter( + (t) => t.repo !== cssGithubRepository + ); + void plugin.saveSettings(); + const msg = `Removed ${cssGithubRepository} from BRAT themes list and will no longer be updated. However, the theme files still exist in the vault. To remove them, go into Settings > Appearance and remove the theme.`; + void plugin.log(msg, true); + toastMessage(plugin, msg); +}; +var themesRootPath = (plugin) => { + return (0, import_obsidian3.normalizePath)(plugin.app.vault.configDir + "/themes") + "/"; +}; + +// src/ui/AddNewTheme.ts +var import_obsidian4 = require("obsidian"); + +// src/ui/Promotional.ts +var promotionalLinks = (containerEl, settingsTab = true) => { + const linksDiv = containerEl.createEl("div"); + linksDiv.style.float = "right"; + if (!settingsTab) { + linksDiv.style.padding = "10px"; + linksDiv.style.paddingLeft = "15px"; + linksDiv.style.paddingRight = "15px"; + } else { + linksDiv.style.padding = "15px"; + linksDiv.style.paddingLeft = "15px"; + linksDiv.style.paddingRight = "15px"; + linksDiv.style.marginLeft = "15px"; + } + const twitterSpan = linksDiv.createDiv("coffee"); + twitterSpan.addClass("ex-twitter-span"); + twitterSpan.style.paddingLeft = "10px"; + const captionText = twitterSpan.createDiv(); + captionText.innerText = "Learn more about my work at:"; + twitterSpan.appendChild(captionText); + const twitterLink = twitterSpan.createEl("a", { href: "https://tfthacker.com" }); + twitterLink.innerText = "https://tfthacker.com"; + return linksDiv; +}; + +// src/ui/AddNewTheme.ts +var AddNewTheme = class extends import_obsidian4.Modal { + constructor(plugin, openSettingsTabAfterwards = false) { + super(plugin.app); + this.plugin = plugin; + this.address = ""; + this.openSettingsTabAfterwards = openSettingsTabAfterwards; + } + async submitForm() { + if (this.address === "") return; + const scrubbedAddress = this.address.replace("https://github.com/", ""); + if (existBetaThemeinInList(this.plugin, scrubbedAddress)) { + toastMessage(this.plugin, `This theme is already in the list for beta testing`, 10); + return; + } + if (await themeSave(this.plugin, scrubbedAddress, true)) { + this.close(); + } + } + onOpen() { + this.contentEl.createEl("h4", { text: "Github repository for beta theme:" }); + this.contentEl.createEl("form", {}, (formEl) => { + formEl.addClass("brat-modal"); + new import_obsidian4.Setting(formEl).addText((textEl) => { + textEl.setPlaceholder( + "Repository (example: https://github.com/GitubUserName/repository-name" + ); + textEl.setValue(this.address); + textEl.onChange((value) => { + this.address = value.trim(); + }); + textEl.inputEl.addEventListener("keydown", (e) => { + if (e.key === "Enter" && this.address !== " ") { + e.preventDefault(); + void this.submitForm(); + } + }); + textEl.inputEl.style.width = "100%"; + window.setTimeout(() => { + const title = document.querySelector(".setting-item-info"); + if (title) title.remove(); + textEl.inputEl.focus(); + }, 10); + }); + formEl.createDiv("modal-button-container", (buttonContainerEl) => { + buttonContainerEl.createEl("button", { attr: { type: "button" }, text: "Never mind" }).addEventListener("click", () => { + this.close(); + }); + buttonContainerEl.createEl("button", { + attr: { type: "submit" }, + cls: "mod-cta", + text: "Add Theme" + }); + }); + const newDiv = formEl.createDiv(); + newDiv.style.borderTop = "1px solid #ccc"; + newDiv.style.marginTop = "30px"; + const byTfThacker = newDiv.createSpan(); + byTfThacker.innerHTML = "BRAT by TFTHacker"; + byTfThacker.style.fontStyle = "italic"; + newDiv.appendChild(byTfThacker); + promotionalLinks(newDiv, false); + window.setTimeout(() => { + const title = formEl.querySelectorAll(".brat-modal .setting-item-info"); + title.forEach((titleEl) => { + titleEl.remove(); + }); + }, 50); + formEl.addEventListener("submit", (e) => { + e.preventDefault(); + if (this.address !== "") void this.submitForm(); + }); + }); + } + onClose() { + if (this.openSettingsTabAfterwards) { + this.plugin.app.setting.open(); + this.plugin.app.setting.openTabById(this.plugin.APP_ID); + } + } +}; + +// src/ui/SettingsTab.ts +var createLink = (githubResource, optionalText) => { + const newLink = new DocumentFragment(); + const linkElement = document.createElement("a"); + linkElement.textContent = githubResource; + linkElement.href = `https://github.com/${githubResource}`; + newLink.appendChild(linkElement); + if (optionalText) { + const textNode = document.createTextNode(optionalText); + newLink.appendChild(textNode); + } + return newLink; +}; +var BratSettingsTab = class extends import_obsidian5.PluginSettingTab { + constructor(app, plugin) { + super(app, plugin); + this.plugin = plugin; + } + display() { + const { containerEl } = this; + containerEl.empty(); + new import_obsidian5.Setting(containerEl).setName("Auto-enable plugins after installation").setDesc( + 'If enabled beta plugins will be automatically enabled after installtion by default. Note: you can toggle this on and off for each plugin in the "Add Plugin" form.' + ).addToggle((cb) => { + cb.setValue(this.plugin.settings.enableAfterInstall); + cb.onChange(async (value) => { + this.plugin.settings.enableAfterInstall = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Auto-update plugins at startup").setDesc( + "If enabled all beta plugins will be checked for updates each time Obsidian starts. Note: this does not update frozen version plugins." + ).addToggle((cb) => { + cb.setValue(this.plugin.settings.updateAtStartup); + cb.onChange(async (value) => { + this.plugin.settings.updateAtStartup = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Auto-update themes at startup").setDesc( + "If enabled all beta themes will be checked for updates each time Obsidian starts." + ).addToggle((cb) => { + cb.setValue(this.plugin.settings.updateThemesAtStartup); + cb.onChange(async (value) => { + this.plugin.settings.updateThemesAtStartup = value; + await this.plugin.saveSettings(); + }); + }); + promotionalLinks(containerEl, true); + containerEl.createEl("hr"); + containerEl.createEl("h2", { text: "Beta Plugin List" }); + containerEl.createEl("div", { + text: `The following is a list of beta plugins added via the command palette "Add a beta plugin for testing" or "Add a beta plugin with frozen version for testing". A frozen version is a specific release of a plugin based on its releease tag. ` + }); + containerEl.createEl("p"); + containerEl.createEl("div", { + text: `Click the x button next to a plugin to remove it from the list.` + }); + containerEl.createEl("p"); + containerEl.createEl("span").createEl("b", { text: "Note: " }); + containerEl.createSpan({ + text: "This does not delete the plugin, this should be done from the Community Plugins tab in Settings." + }); + new import_obsidian5.Setting(containerEl).addButton((cb) => { + cb.setButtonText("Add Beta plugin"); + cb.onClick(() => { + this.plugin.app.setting.close(); + this.plugin.betaPlugins.displayAddNewPluginModal(true, false); + }); + }); + const pluginSubListFrozenVersionNames = new Set( + this.plugin.settings.pluginSubListFrozenVersion.map((x) => x.repo) + ); + for (const bp of this.plugin.settings.pluginList) { + if (pluginSubListFrozenVersionNames.has(bp)) { + continue; + } + new import_obsidian5.Setting(containerEl).setName(createLink(bp)).addButton((btn) => { + btn.setIcon("cross"); + btn.setTooltip("Delete this beta plugin"); + btn.onClick(() => { + if (btn.buttonEl.textContent === "") + btn.setButtonText("Click once more to confirm removal"); + else { + const { buttonEl } = btn; + const { parentElement } = buttonEl; + if (parentElement == null ? void 0 : parentElement.parentElement) { + parentElement.parentElement.remove(); + this.plugin.betaPlugins.deletePlugin(bp); + } + } + }); + }); + } + new import_obsidian5.Setting(containerEl).addButton((cb) => { + cb.setButtonText("Add Beta plugin with frozen version"); + cb.onClick(() => { + this.plugin.app.setting.close(); + this.plugin.betaPlugins.displayAddNewPluginModal(true, true); + }); + }); + for (const bp of this.plugin.settings.pluginSubListFrozenVersion) { + new import_obsidian5.Setting(containerEl).setName(createLink(bp.repo, ` (version ${bp.version})`)).addButton((btn) => { + btn.setIcon("cross"); + btn.setTooltip("Delete this beta plugin"); + btn.onClick(() => { + if (btn.buttonEl.textContent === "") + btn.setButtonText("Click once more to confirm removal"); + else { + const { buttonEl } = btn; + const { parentElement } = buttonEl; + if (parentElement == null ? void 0 : parentElement.parentElement) { + parentElement.parentElement.remove(); + this.plugin.betaPlugins.deletePlugin(bp.repo); + } + } + }); + }); + } + containerEl.createEl("h2", { text: "Beta Themes List" }); + new import_obsidian5.Setting(containerEl).addButton((cb) => { + cb.setButtonText("Add Beta Theme"); + cb.onClick(() => { + this.plugin.app.setting.close(); + new AddNewTheme(this.plugin).open(); + }); + }); + for (const bp of this.plugin.settings.themesList) { + new import_obsidian5.Setting(containerEl).setName(createLink(bp.repo)).addButton((btn) => { + btn.setIcon("cross"); + btn.setTooltip("Delete this beta theme"); + btn.onClick(() => { + if (btn.buttonEl.textContent === "") + btn.setButtonText("Click once more to confirm removal"); + else { + const { buttonEl } = btn; + const { parentElement } = buttonEl; + if (parentElement == null ? void 0 : parentElement.parentElement) { + parentElement.parentElement.remove(); + themeDelete(this.plugin, bp.repo); + } + } + }); + }); + } + containerEl.createEl("h2", { text: "Monitoring" }); + new import_obsidian5.Setting(containerEl).setName("Enable Notifications").setDesc( + "BRAT will provide popup notifications for its various activities. Turn this off means no notifications from BRAT." + ).addToggle((cb) => { + cb.setValue(this.plugin.settings.notificationsEnabled); + cb.onChange(async (value) => { + this.plugin.settings.notificationsEnabled = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Enable Logging").setDesc("Plugin updates will be logged to a file in the log file.").addToggle((cb) => { + cb.setValue(this.plugin.settings.loggingEnabled); + cb.onChange(async (value) => { + this.plugin.settings.loggingEnabled = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(this.containerEl).setName("BRAT Log File Location").setDesc("Logs will be saved to this file. Don't add .md to the file name.").addSearch((cb) => { + cb.setPlaceholder("Example: BRAT-log").setValue(this.plugin.settings.loggingPath).onChange(async (newFolder) => { + this.plugin.settings.loggingPath = newFolder; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Enable Verbose Logging").setDesc("Get a lot more information in the log.").addToggle((cb) => { + cb.setValue(this.plugin.settings.loggingVerboseEnabled); + cb.onChange(async (value) => { + this.plugin.settings.loggingVerboseEnabled = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Debugging Mode").setDesc( + "Atomic Bomb level console logging. Can be used for troubleshoting and development." + ).addToggle((cb) => { + cb.setValue(this.plugin.settings.debuggingMode); + cb.onChange(async (value) => { + this.plugin.settings.debuggingMode = value; + await this.plugin.saveSettings(); + }); + }); + new import_obsidian5.Setting(containerEl).setName("Personal Access Token").setDesc( + "If you need to access private repositories, enter the personal access token here." + ).addText((text) => { + var _a; + text.setPlaceholder("Enter your personal access token").setValue((_a = this.plugin.settings.personalAccessToken) != null ? _a : "").onChange(async (value) => { + this.plugin.settings.personalAccessToken = value; + await this.plugin.saveSettings(); + }); + }); + } +}; + +// src/ui/AddNewPluginModal.ts +var import_obsidian6 = require("obsidian"); +var AddNewPluginModal = class extends import_obsidian6.Modal { + constructor(plugin, betaPlugins, openSettingsTabAfterwards = false, useFrozenVersion = false) { + super(plugin.app); + this.plugin = plugin; + this.betaPlugins = betaPlugins; + this.address = ""; + this.openSettingsTabAfterwards = openSettingsTabAfterwards; + this.useFrozenVersion = useFrozenVersion; + this.enableAfterInstall = plugin.settings.enableAfterInstall; + this.version = ""; + } + async submitForm() { + if (this.address === "") return; + let scrubbedAddress = this.address.replace("https://github.com/", ""); + if (scrubbedAddress.endsWith(".git")) scrubbedAddress = scrubbedAddress.slice(0, -4); + if (existBetaPluginInList(this.plugin, scrubbedAddress)) { + toastMessage( + this.plugin, + `This plugin is already in the list for beta testing`, + 10 + ); + return; + } + const result = await this.betaPlugins.addPlugin( + scrubbedAddress, + false, + false, + false, + this.version, + false, + this.enableAfterInstall + ); + if (result) { + this.close(); + } + } + onOpen() { + this.contentEl.createEl("h4", { text: "Github repository for beta plugin:" }); + this.contentEl.createEl("form", {}, (formEl) => { + formEl.addClass("brat-modal"); + new import_obsidian6.Setting(formEl).addText((textEl) => { + textEl.setPlaceholder( + "Repository (example: https://github.com/GitubUserName/repository-name)" + ); + textEl.setValue(this.address); + textEl.onChange((value) => { + this.address = value.trim(); + }); + textEl.inputEl.addEventListener("keydown", (e) => { + if (e.key === "Enter" && this.address !== " ") { + if (this.useFrozenVersion && this.version !== "" || !this.useFrozenVersion) { + e.preventDefault(); + void this.submitForm(); + } + } + }); + textEl.inputEl.style.width = "100%"; + }); + if (this.useFrozenVersion) { + new import_obsidian6.Setting(formEl).addText((textEl) => { + textEl.setPlaceholder("Specify the release version tag (example: 1.0.0)"); + textEl.onChange((value) => { + this.version = value.trim(); + }); + textEl.inputEl.style.width = "100%"; + }); + } + formEl.createDiv("modal-button-container", (buttonContainerEl) => { + buttonContainerEl.createEl( + "label", + { + cls: "mod-checkbox" + }, + (labelEl) => { + const checkboxEl = labelEl.createEl("input", { + attr: { tabindex: -1 }, + type: "checkbox" + }); + checkboxEl.checked = this.enableAfterInstall; + checkboxEl.addEventListener("click", () => { + this.enableAfterInstall = checkboxEl.checked; + }); + labelEl.appendText("Enable after installing the plugin"); + } + ); + buttonContainerEl.createEl("button", { attr: { type: "button" }, text: "Never mind" }).addEventListener("click", () => { + this.close(); + }); + buttonContainerEl.createEl("button", { + attr: { type: "submit" }, + cls: "mod-cta", + text: "Add Plugin" + }); + }); + const newDiv = formEl.createDiv(); + newDiv.style.borderTop = "1px solid #ccc"; + newDiv.style.marginTop = "30px"; + const byTfThacker = newDiv.createSpan(); + byTfThacker.innerHTML = "BRAT by TFTHacker"; + byTfThacker.style.fontStyle = "italic"; + newDiv.appendChild(byTfThacker); + promotionalLinks(newDiv, false); + window.setTimeout(() => { + const title = formEl.querySelectorAll(".brat-modal .setting-item-info"); + title.forEach((titleEl) => { + titleEl.remove(); + }); + }, 50); + formEl.addEventListener("submit", (e) => { + e.preventDefault(); + if (this.address !== "") { + if (this.useFrozenVersion && this.version !== "" || !this.useFrozenVersion) { + void this.submitForm(); + } + } + }); + }); + } + onClose() { + if (this.openSettingsTabAfterwards) { + this.plugin.app.setting.open(); + this.plugin.app.setting.openTabById(this.plugin.APP_ID); + } + } +}; + +// src/features/BetaPlugins.ts +var import_obsidian7 = require("obsidian"); +var BetaPlugins = class { + constructor(plugin) { + this.plugin = plugin; + } + /** + * opens the AddNewPluginModal to get info for a new beta plugin + * @param openSettingsTabAfterwards - will open settings screen afterwards. Used when this command is called from settings tab + * @param useFrozenVersion - install the plugin using frozen version. + */ + displayAddNewPluginModal(openSettingsTabAfterwards = false, useFrozenVersion = false) { + const newPlugin = new AddNewPluginModal( + this.plugin, + this, + openSettingsTabAfterwards, + useFrozenVersion + ); + newPlugin.open(); + } + /** + * Validates that a GitHub repository is plugin + * + * @param repositoryPath - GithubUser/RepositoryName (example: TfThacker/obsidian42-brat) + * @param getBetaManifest - test the beta version of the manifest, not at the root + * @param false - [false description] + * @param reportIssues - will display notices as it finds issues + * + * @returns the manifest file if found, or null if its incomplete + */ + async validateRepository(repositoryPath, getBetaManifest = false, reportIssues = false) { + const noticeTimeout = 15; + const manifestJson = await grabManifestJsonFromRepository( + repositoryPath, + !getBetaManifest, + this.plugin.settings.debuggingMode, + this.plugin.settings.personalAccessToken + ); + if (!manifestJson) { + if (reportIssues) { + toastMessage( + this.plugin, + `${repositoryPath} +This does not seem to be an obsidian plugin, as there is no manifest.json file.`, + noticeTimeout + ); + console.error( + "BRAT: validateRepository", + repositoryPath, + getBetaManifest, + reportIssues + ); + } + return null; + } + if (!("id" in manifestJson)) { + if (reportIssues) + toastMessage( + this.plugin, + `${repositoryPath} +The plugin id attribute for the release is missing from the manifest file`, + noticeTimeout + ); + return null; + } + if (!("version" in manifestJson)) { + if (reportIssues) + toastMessage( + this.plugin, + `${repositoryPath} +The version attribute for the release is missing from the manifest file`, + noticeTimeout + ); + return null; + } + return manifestJson; + } + /** + * Gets all the release files based on the version number in the manifest + * + * @param repositoryPath - path to the GitHub repository + * @param manifest - manifest file + * @param getManifest - grab the remote manifest file + * @param specifyVersion - grab the specified version if set + * + * @returns all relase files as strings based on the ReleaseFiles interaface + */ + async getAllReleaseFiles(repositoryPath, manifest, getManifest, specifyVersion = "") { + const version = specifyVersion === "" ? manifest.version : specifyVersion; + const reallyGetManifestOrNot = getManifest || specifyVersion !== ""; + console.log({ reallyGetManifestOrNot, version }); + return { + mainJs: await grabReleaseFileFromRepository( + repositoryPath, + version, + "main.js", + this.plugin.settings.debuggingMode, + this.plugin.settings.personalAccessToken + ), + manifest: reallyGetManifestOrNot ? await grabReleaseFileFromRepository( + repositoryPath, + version, + "manifest.json", + this.plugin.settings.debuggingMode, + this.plugin.settings.personalAccessToken + ) : "", + styles: await grabReleaseFileFromRepository( + repositoryPath, + version, + "styles.css", + this.plugin.settings.debuggingMode, + this.plugin.settings.personalAccessToken + ) + }; + } + /** + * Writes the plugin release files to the local obsidian .plugins folder + * + * @param betaPluginId - the id of the plugin (not the repository path) + * @param relFiles - release file as strings, based on the ReleaseFiles interface + * + */ + async writeReleaseFilesToPluginFolder(betaPluginId, relFiles) { + var _a, _b; + const pluginTargetFolderPath = (0, import_obsidian7.normalizePath)(this.plugin.app.vault.configDir + "/plugins/" + betaPluginId) + "/"; + const { adapter } = this.plugin.app.vault; + if (!await adapter.exists(pluginTargetFolderPath) || !await adapter.exists(pluginTargetFolderPath + "manifest.json")) { + await adapter.mkdir(pluginTargetFolderPath); + } + await adapter.write(pluginTargetFolderPath + "main.js", (_a = relFiles.mainJs) != null ? _a : ""); + await adapter.write( + pluginTargetFolderPath + "manifest.json", + (_b = relFiles.manifest) != null ? _b : "" + ); + if (relFiles.styles) + await adapter.write(pluginTargetFolderPath + "styles.css", relFiles.styles); + } + /** + * Primary function for adding a new beta plugin to Obsidian. + * Also this function is used for updating existing plugins. + * + * @param repositoryPath - path to GitHub repository formated as USERNAME/repository + * @param updatePluginFiles - true if this is just an update not an install + * @param seeIfUpdatedOnly - if true, and updatePluginFiles true, will just check for updates, but not do the update. will report to user that there is a new plugin + * @param reportIfNotUpdted - if true, report if an update has not succed + * @param specifyVersion - if not empty, need to install a specified version instead of the value in manifest-beta.json + * @param forceReinstall - if true, will force a reinstall of the plugin, even if it is already installed + * + * @returns true if succeeds + */ + async addPlugin(repositoryPath, updatePluginFiles = false, seeIfUpdatedOnly = false, reportIfNotUpdted = false, specifyVersion = "", forceReinstall = false, enableAfterInstall = this.plugin.settings.enableAfterInstall) { + if (this.plugin.settings.debuggingMode) + console.log( + "BRAT: addPlugin", + repositoryPath, + updatePluginFiles, + seeIfUpdatedOnly, + reportIfNotUpdted, + specifyVersion, + forceReinstall, + enableAfterInstall + ); + const noticeTimeout = 10; + let primaryManifest = await this.validateRepository(repositoryPath, true, false); + const usingBetaManifest = primaryManifest ? true : false; + if (!usingBetaManifest) + primaryManifest = await this.validateRepository(repositoryPath, false, true); + if (primaryManifest === null) { + const msg = `${repositoryPath} +A manifest.json or manifest-beta.json file does not exist in the root directory of the repository. This plugin cannot be installed.`; + await this.plugin.log(msg, true); + toastMessage(this.plugin, msg, noticeTimeout); + return false; + } + if (!Object.hasOwn(primaryManifest, "version")) { + const msg = `${repositoryPath} +The manifest${usingBetaManifest ? "-beta" : ""}.json file in the root directory of the repository does not have a version number in the file. This plugin cannot be installed.`; + await this.plugin.log(msg, true); + toastMessage(this.plugin, msg, noticeTimeout); + return false; + } + if (!Object.hasOwn(primaryManifest, "minAppVersion")) { + if (!(0, import_obsidian7.requireApiVersion)(primaryManifest.minAppVersion)) { + const msg = `Plugin: ${repositoryPath} + +The manifest${usingBetaManifest ? "-beta" : ""}.json for this plugin indicates that the Obsidian version of the app needs to be ${primaryManifest.minAppVersion}, but this installation of Obsidian is ${import_obsidian7.apiVersion}. + +You will need to update your Obsidian to use this plugin or contact the plugin developer for more information.`; + await this.plugin.log(msg, true); + toastMessage(this.plugin, msg, 30); + return false; + } + } + const getRelease = async () => { + const rFiles = await this.getAllReleaseFiles( + repositoryPath, + // @ts-expect-error typescript will complain that this can be null, but in this case it won't be + primaryManifest, + usingBetaManifest, + specifyVersion + ); + console.log("rFiles", rFiles); + if (usingBetaManifest || rFiles.manifest === "") + rFiles.manifest = JSON.stringify(primaryManifest); + if (this.plugin.settings.debuggingMode) + console.log("BRAT: rFiles.manifest", usingBetaManifest, rFiles); + if (rFiles.mainJs === null) { + const msg = `${repositoryPath} +The release is not complete and cannot be download. main.js is missing from the Release`; + await this.plugin.log(msg, true); + toastMessage(this.plugin, msg, noticeTimeout); + return null; + } + return rFiles; + }; + if (!updatePluginFiles || forceReinstall) { + const releaseFiles = await getRelease(); + if (releaseFiles === null) return false; + await this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles); + if (!forceReinstall) + addBetaPluginToList(this.plugin, repositoryPath, specifyVersion); + if (enableAfterInstall) { + const { plugins } = this.plugin.app; + const pluginTargetFolderPath = (0, import_obsidian7.normalizePath)( + plugins.getPluginFolder() + "/" + primaryManifest.id + ); + await plugins.loadManifest(pluginTargetFolderPath); + await plugins.enablePluginAndSave(primaryManifest.id); + } + await this.plugin.app.plugins.loadManifests(); + if (forceReinstall) { + await this.reloadPlugin(primaryManifest.id); + await this.plugin.log(`${repositoryPath} reinstalled`, true); + toastMessage( + this.plugin, + `${repositoryPath} +Plugin has been reinstalled and reloaded.`, + noticeTimeout + ); + } else { + const versionText = specifyVersion === "" ? "" : ` (version: ${specifyVersion})`; + let msg = `${repositoryPath}${versionText} +The plugin has been registered with BRAT.`; + if (!enableAfterInstall) { + msg += " You may still need to enable it the Community Plugin List."; + } + await this.plugin.log(msg, true); + toastMessage(this.plugin, msg, noticeTimeout); + } + } else { + const pluginTargetFolderPath = this.plugin.app.vault.configDir + "/plugins/" + primaryManifest.id + "/"; + let localManifestContents = ""; + try { + localManifestContents = await this.plugin.app.vault.adapter.read( + pluginTargetFolderPath + "manifest.json" + ); + } catch (e) { + if (e.errno === -4058 || e.errno === -2) { + await this.addPlugin( + repositoryPath, + false, + usingBetaManifest, + false, + specifyVersion + ); + return true; + } else + console.log( + "BRAT - Local Manifest Load", + primaryManifest.id, + JSON.stringify(e, null, 2) + ); + } + if (specifyVersion !== "" || this.plugin.settings.pluginSubListFrozenVersion.map((x) => x.repo).includes(repositoryPath)) { + toastMessage( + this.plugin, + `The version of ${repositoryPath} is frozen, not updating.`, + 3 + ); + return false; + } + const localManifestJson = await JSON.parse( + localManifestContents + ); + if (localManifestJson.version !== primaryManifest.version) { + const releaseFiles = await getRelease(); + if (releaseFiles === null) return false; + if (seeIfUpdatedOnly) { + const msg = `There is an update available for ${primaryManifest.id} from version ${localManifestJson.version} to ${primaryManifest.version}. `; + await this.plugin.log( + msg + `[Release Info](https://github.com/${repositoryPath}/releases/tag/${primaryManifest.version})`, + true + ); + toastMessage(this.plugin, msg, 30, () => { + if (primaryManifest) { + window.open( + `https://github.com/${repositoryPath}/releases/tag/${primaryManifest.version}` + ); + } + }); + } else { + await this.writeReleaseFilesToPluginFolder(primaryManifest.id, releaseFiles); + await this.plugin.app.plugins.loadManifests(); + await this.reloadPlugin(primaryManifest.id); + const msg = `${primaryManifest.id} +Plugin has been updated from version ${localManifestJson.version} to ${primaryManifest.version}. `; + await this.plugin.log( + msg + `[Release Info](https://github.com/${repositoryPath}/releases/tag/${primaryManifest.version})`, + true + ); + toastMessage(this.plugin, msg, 30, () => { + if (primaryManifest) { + window.open( + `https://github.com/${repositoryPath}/releases/tag/${primaryManifest.version}` + ); + } + }); + } + } else if (reportIfNotUpdted) + toastMessage(this.plugin, `No update available for ${repositoryPath}`, 3); + } + return true; + } + /** + * reloads a plugin (assuming it has been enabled by user) + * pjeby, Thanks Bro https://github.com/pjeby/hot-reload/blob/master/main.js + * + * @param pluginName - name of plugin + * + */ + async reloadPlugin(pluginName) { + const { plugins } = this.plugin.app; + try { + await plugins.disablePlugin(pluginName); + await plugins.enablePlugin(pluginName); + } catch (e) { + if (this.plugin.settings.debuggingMode) console.log("reload plugin", e); + } + } + /** + * updates a beta plugin + * + * @param repositoryPath - repository path on GitHub + * @param onlyCheckDontUpdate - only looks for update + * + */ + async updatePlugin(repositoryPath, onlyCheckDontUpdate = false, reportIfNotUpdted = false, forceReinstall = false) { + const result = await this.addPlugin( + repositoryPath, + true, + onlyCheckDontUpdate, + reportIfNotUpdted, + "", + forceReinstall + ); + if (!result && !onlyCheckDontUpdate) + toastMessage(this.plugin, `${repositoryPath} +Update of plugin failed.`); + return result; + } + /** + * walks through the list of plugins without frozen version and performs an update + * + * @param showInfo - should this with a started/completed message - useful when ran from CP + * + */ + async checkForPluginUpdatesAndInstallUpdates(showInfo = false, onlyCheckDontUpdate = false) { + if (!await isConnectedToInternet()) { + console.log("BRAT: No internet detected."); + return; + } + let newNotice; + const msg1 = `Checking for plugin updates STARTED`; + await this.plugin.log(msg1, true); + if (showInfo && this.plugin.settings.notificationsEnabled) + newNotice = new import_obsidian7.Notice(`BRAT +${msg1}`, 3e4); + const pluginSubListFrozenVersionNames = new Set( + this.plugin.settings.pluginSubListFrozenVersion.map((f) => f.repo) + ); + for (const bp of this.plugin.settings.pluginList) { + if (pluginSubListFrozenVersionNames.has(bp)) { + continue; + } + await this.updatePlugin(bp, onlyCheckDontUpdate); + } + const msg2 = `Checking for plugin updates COMPLETED`; + await this.plugin.log(msg2, true); + if (showInfo) { + if (newNotice) { + newNotice.hide(); + } + toastMessage(this.plugin, msg2, 10); + } + } + /** + * Removes the beta plugin from the list of beta plugins (does not delete them from disk) + * + * @param betaPluginID - repository path + * + */ + deletePlugin(repositoryPath) { + const msg = `Removed ${repositoryPath} from BRAT plugin list`; + void this.plugin.log(msg, true); + this.plugin.settings.pluginList = this.plugin.settings.pluginList.filter( + (b) => b !== repositoryPath + ); + this.plugin.settings.pluginSubListFrozenVersion = this.plugin.settings.pluginSubListFrozenVersion.filter( + (b) => b.repo !== repositoryPath + ); + void this.plugin.saveSettings(); + } + /** + * Returns a list of plugins that are currently enabled or currently disabled + * + * @param enabled - true for enabled plugins, false for disabled plutings + * + * @returns manifests of plugins + */ + getEnabledDisabledPlugins(enabled) { + const pl = this.plugin.app.plugins; + const manifests = Object.values(pl.manifests); + const enabledPlugins = Object.values(pl.plugins).map( + (p) => p.manifest + ); + return enabled ? manifests.filter( + (manifest) => enabledPlugins.find((pluginName) => manifest.id === pluginName.id) + ) : manifests.filter( + (manifest) => !enabledPlugins.find((pluginName) => manifest.id === pluginName.id) + ); + } +}; + +// src/ui/icons.ts +var import_obsidian8 = require("obsidian"); +function addIcons() { + (0, import_obsidian8.addIcon)( + "BratIcon", + `` + ); +} + +// src/utils/logging.ts +var import_obsidian9 = require("obsidian"); +var import_obsidian_daily_notes_interface = __toESM(require_main()); +async function logger(plugin, textToLog, verboseLoggingOn = false) { + if (plugin.settings.debuggingMode) console.log("BRAT: " + textToLog); + if (plugin.settings.loggingEnabled) { + if (!plugin.settings.loggingVerboseEnabled && verboseLoggingOn) { + return; + } else { + const fileName = plugin.settings.loggingPath + ".md"; + const dateOutput = "[[" + (0, import_obsidian9.moment)().format((0, import_obsidian_daily_notes_interface.getDailyNoteSettings)().format).toString() + "]] " + (0, import_obsidian9.moment)().format("HH:mm"); + const os = window.require("os"); + const machineName = import_obsidian9.Platform.isDesktop ? os.hostname() : "MOBILE"; + let output = dateOutput + " " + machineName + " " + textToLog.replace("\n", " ") + "\n\n"; + if (await plugin.app.vault.adapter.exists(fileName)) { + const fileContents = await plugin.app.vault.adapter.read(fileName); + output = output + fileContents; + const file = plugin.app.vault.getAbstractFileByPath(fileName); + await plugin.app.vault.modify(file, output); + } else await plugin.app.vault.create(fileName, output); + } + } +} + +// src/ui/GenericFuzzySuggester.ts +var import_obsidian10 = require("obsidian"); +var GenericFuzzySuggester = class extends import_obsidian10.FuzzySuggestModal { + constructor(plugin) { + super(plugin.app); + this.data = []; + this.scope.register(["Shift"], "Enter", (evt) => { + this.enterTrigger(evt); + }); + this.scope.register(["Ctrl"], "Enter", (evt) => { + this.enterTrigger(evt); + }); + } + setSuggesterData(suggesterData) { + this.data = suggesterData; + } + display(callBack) { + this.callbackFunction = callBack; + this.open(); + } + getItems() { + return this.data; + } + getItemText(item) { + return item.display; + } + onChooseItem() { + return; + } + renderSuggestion(item, el) { + el.createEl("div", { text: item.item.display }); + } + enterTrigger(evt) { + var _a; + const selectedText = (_a = document.querySelector(".suggestion-item.is-selected div")) == null ? void 0 : _a.textContent; + const item = this.data.find((i) => i.display === selectedText); + if (item) { + this.invokeCallback(item, evt); + this.close(); + } + } + onChooseSuggestion(item, evt) { + this.invokeCallback(item.item, evt); + } + invokeCallback(item, evt) { + if (typeof this.callbackFunction === "function") { + this.callbackFunction(item, evt); + } + } +}; + +// src/ui/PluginCommands.ts +var PluginCommands = class { + constructor(plugin) { + this.bratCommands = [ + { + id: "BRAT-AddBetaPlugin", + icon: "BratIcon", + name: "Plugins: Add a beta plugin for testing", + showInRibbon: true, + callback: () => { + this.plugin.betaPlugins.displayAddNewPluginModal(false, false); + } + }, + { + id: "BRAT-AddBetaPluginWithFrozenVersion", + icon: "BratIcon", + name: "Plugins: Add a beta plugin with frozen version based on a release tag", + showInRibbon: true, + callback: () => { + this.plugin.betaPlugins.displayAddNewPluginModal(false, true); + } + }, + { + id: "BRAT-checkForUpdatesAndUpdate", + icon: "BratIcon", + name: "Plugins: Check for updates to all beta plugins and UPDATE", + showInRibbon: true, + callback: async () => { + await this.plugin.betaPlugins.checkForPluginUpdatesAndInstallUpdates(true, false); + } + }, + { + id: "BRAT-checkForUpdatesAndDontUpdate", + icon: "BratIcon", + name: "Plugins: Only check for updates to beta plugins, but don't Update", + showInRibbon: true, + callback: async () => { + await this.plugin.betaPlugins.checkForPluginUpdatesAndInstallUpdates(true, true); + } + }, + { + id: "BRAT-updateOnePlugin", + icon: "BratIcon", + name: "Plugins: Choose a single plugin version to update", + showInRibbon: true, + callback: () => { + const pluginSubListFrozenVersionNames = new Set( + this.plugin.settings.pluginSubListFrozenVersion.map((f) => f.repo) + ); + const pluginList = Object.values(this.plugin.settings.pluginList).filter((f) => !pluginSubListFrozenVersionNames.has(f)).map((m) => { + return { display: m, info: m }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(pluginList); + gfs.display((results) => { + const msg = `Checking for updates for ${results.info}`; + void this.plugin.log(msg, true); + toastMessage(this.plugin, ` +${msg}`, 3); + void this.plugin.betaPlugins.updatePlugin(results.info, false, true); + }); + } + }, + { + id: "BRAT-reinstallOnePlugin", + icon: "BratIcon", + name: "Plugins: Choose a single plugin to reinstall", + showInRibbon: true, + callback: () => { + const pluginSubListFrozenVersionNames = new Set( + this.plugin.settings.pluginSubListFrozenVersion.map((f) => f.repo) + ); + const pluginList = Object.values(this.plugin.settings.pluginList).filter((f) => !pluginSubListFrozenVersionNames.has(f)).map((m) => { + return { display: m, info: m }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(pluginList); + gfs.display((results) => { + const msg = `Reinstalling ${results.info}`; + toastMessage(this.plugin, ` +${msg}`, 3); + void this.plugin.log(msg, true); + void this.plugin.betaPlugins.updatePlugin( + results.info, + false, + false, + true + ); + }); + } + }, + { + id: "BRAT-restartPlugin", + icon: "BratIcon", + name: "Plugins: Restart a plugin that is already installed", + showInRibbon: true, + callback: () => { + const pluginList = Object.values( + this.plugin.app.plugins.manifests + ).map((m) => { + return { display: m.id, info: m.id }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(pluginList); + gfs.display((results) => { + toastMessage( + this.plugin, + `${results.info} +Plugin reloading .....`, + 5 + ); + void this.plugin.betaPlugins.reloadPlugin(results.info); + }); + } + }, + { + id: "BRAT-disablePlugin", + icon: "BratIcon", + name: "Plugins: Disable a plugin - toggle it off", + showInRibbon: true, + callback: () => { + const pluginList = this.plugin.betaPlugins.getEnabledDisabledPlugins(true).map((manifest) => { + return { display: `${manifest.name} (${manifest.id})`, info: manifest.id }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(pluginList); + gfs.display((results) => { + void this.plugin.log(`${results.display} plugin disabled`, false); + if (this.plugin.settings.debuggingMode) console.log(results.info); + void this.plugin.app.plugins.disablePluginAndSave(results.info); + }); + } + }, + { + id: "BRAT-enablePlugin", + icon: "BratIcon", + name: "Plugins: Enable a plugin - toggle it on", + showInRibbon: true, + callback: () => { + const pluginList = this.plugin.betaPlugins.getEnabledDisabledPlugins(false).map((manifest) => { + return { display: `${manifest.name} (${manifest.id})`, info: manifest.id }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(pluginList); + gfs.display((results) => { + void this.plugin.log(`${results.display} plugin enabled`, false); + void this.plugin.app.plugins.enablePluginAndSave(results.info); + }); + } + }, + { + id: "BRAT-openGitHubZRepository", + icon: "BratIcon", + name: "Plugins: Open the GitHub repository for a plugin", + showInRibbon: true, + callback: async () => { + const communityPlugins = await grabCommmunityPluginList( + this.plugin.settings.debuggingMode + ); + if (communityPlugins) { + const communityPluginList = Object.values( + communityPlugins + ).map((p) => { + return { display: `Plugin: ${p.name} (${p.repo})`, info: p.repo }; + }); + const bratList = Object.values( + this.plugin.settings.pluginList + ).map((p) => { + return { display: "BRAT: " + p, info: p }; + }); + communityPluginList.forEach((si) => bratList.push(si)); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(bratList); + gfs.display((results) => { + if (results.info) window.open(`https://github.com/${results.info}`); + }); + } + } + }, + { + id: "BRAT-openGitHubRepoTheme", + icon: "BratIcon", + name: "Themes: Open the GitHub repository for a theme (appearance)", + showInRibbon: true, + callback: async () => { + const communityTheme = await grabCommmunityThemesList( + this.plugin.settings.debuggingMode + ); + if (communityTheme) { + const communityThemeList = Object.values(communityTheme).map( + (p) => { + return { display: `Theme: ${p.name} (${p.repo})`, info: p.repo }; + } + ); + const gfs = new GenericFuzzySuggester(this.plugin); + gfs.setSuggesterData(communityThemeList); + gfs.display((results) => { + if (results.info) window.open(`https://github.com/${results.info}`); + }); + } + } + }, + { + id: "BRAT-opentPluginSettings", + icon: "BratIcon", + name: "Plugins: Open Plugin Settings Tab", + showInRibbon: true, + callback: () => { + const settings = this.plugin.app.setting; + const listOfPluginSettingsTabs = Object.values( + settings.pluginTabs + ).map((t) => { + return { display: "Plugin: " + t.name, info: t.id }; + }); + const gfs = new GenericFuzzySuggester(this.plugin); + const listOfCoreSettingsTabs = Object.values( + settings.settingTabs + ).map((t) => { + return { display: "Core: " + t.name, info: t.id }; + }); + listOfPluginSettingsTabs.forEach((si) => listOfCoreSettingsTabs.push(si)); + gfs.setSuggesterData(listOfCoreSettingsTabs); + gfs.display((results) => { + settings.open(); + settings.openTabById(results.info); + }); + } + }, + { + id: "BRAT-GrabBetaTheme", + icon: "BratIcon", + name: "Themes: Grab a beta theme for testing from a Github repository", + showInRibbon: true, + callback: () => { + new AddNewTheme(this.plugin).open(); + } + }, + { + id: "BRAT-updateBetaThemes", + icon: "BratIcon", + name: "Themes: Update beta themes", + showInRibbon: true, + callback: async () => { + await themesCheckAndUpdates(this.plugin, true); + } + }, + { + id: "BRAT-allCommands", + icon: "BratIcon", + name: "All Commands list", + showInRibbon: false, + callback: () => { + this.ribbonDisplayCommands(); + } + } + ]; + this.plugin = plugin; + this.bratCommands.forEach((item) => { + this.plugin.addCommand({ + id: item.id, + name: item.name, + icon: item.icon, + callback: () => { + item.callback(); + } + }); + }); + } + ribbonDisplayCommands() { + const bratCommandList = []; + this.bratCommands.forEach((cmd) => { + if (cmd.showInRibbon) + bratCommandList.push({ display: cmd.name, info: cmd.callback }); + }); + const gfs = new GenericFuzzySuggester(this.plugin); + const settings = this.plugin.app.setting; + const listOfCoreSettingsTabs = Object.values( + settings.settingTabs + ).map((t) => { + return { + display: "Core: " + t.name, + info: () => { + settings.open(); + settings.openTabById(t.id); + } + }; + }); + const listOfPluginSettingsTabs = Object.values( + settings.pluginTabs + ).map((t) => { + return { + display: "Plugin: " + t.name, + info: () => { + settings.open(); + settings.openTabById(t.id); + } + }; + }); + bratCommandList.push({ + display: "---- Core Plugin Settings ----", + info: () => { + this.ribbonDisplayCommands(); + } + }); + listOfCoreSettingsTabs.forEach((si) => bratCommandList.push(si)); + bratCommandList.push({ + display: "---- Plugin Settings ----", + info: () => { + this.ribbonDisplayCommands(); + } + }); + listOfPluginSettingsTabs.forEach((si) => bratCommandList.push(si)); + gfs.setSuggesterData(bratCommandList); + gfs.display((results) => { + if (typeof results.info === "function") { + results.info(); + } + }); + } +}; + +// src/utils/BratAPI.ts +var BratAPI = class { + constructor(plugin) { + this.console = (logDescription, ...outputs) => { + console.log("BRAT: " + logDescription, ...outputs); + }; + this.themes = { + themeseCheckAndUpates: async (showInfo) => { + await themesCheckAndUpdates(this.plugin, showInfo); + }, + themeInstallTheme: async (cssGithubRepository) => { + const scrubbedAddress = cssGithubRepository.replace("https://github.com/", ""); + await themeSave(this.plugin, scrubbedAddress, true); + }, + themesDelete: (cssGithubRepository) => { + const scrubbedAddress = cssGithubRepository.replace("https://github.com/", ""); + themeDelete(this.plugin, scrubbedAddress); + }, + grabCommmunityThemeCssFile: async (repositoryPath, betaVersion = false) => { + return await grabCommmunityThemeCssFile( + repositoryPath, + betaVersion, + this.plugin.settings.debuggingMode + ); + }, + grabChecksumOfThemeCssFile: async (repositoryPath, betaVersion = false) => { + return await grabChecksumOfThemeCssFile( + repositoryPath, + betaVersion, + this.plugin.settings.debuggingMode + ); + }, + grabLastCommitDateForFile: async (repositoryPath, path) => { + return await grabLastCommitDateForFile(repositoryPath, path); + } + }; + this.plugin = plugin; + } +}; + +// src/main.ts +var ThePlugin = class extends import_obsidian11.Plugin { + constructor() { + super(...arguments); + this.APP_NAME = "BRAT"; + this.APP_ID = "obsidian42-brat"; + this.settings = DEFAULT_SETTINGS; + this.betaPlugins = new BetaPlugins(this); + this.commands = new PluginCommands(this); + this.bratApi = new BratAPI(this); + this.obsidianProtocolHandler = (params) => { + if (!params.plugin && !params.theme) { + toastMessage(this, `Could not locate the repository from the URL.`, 10); + return; + } + for (const which of ["plugin", "theme"]) { + if (params[which]) { + const modal = which === "plugin" ? new AddNewPluginModal(this, this.betaPlugins) : new AddNewTheme(this); + modal.address = params[which]; + modal.open(); + return; + } + } + }; + } + onload() { + console.log("loading " + this.APP_NAME); + this.loadSettings().then(() => { + this.addSettingTab(new BratSettingsTab(this.app, this)); + addIcons(); + this.showRibbonButton(); + this.registerObsidianProtocolHandler("brat", this.obsidianProtocolHandler); + this.app.workspace.onLayoutReady(() => { + if (this.settings.updateAtStartup) { + setTimeout(() => { + void this.betaPlugins.checkForPluginUpdatesAndInstallUpdates(false); + }, 6e4); + } + if (this.settings.updateThemesAtStartup) { + setTimeout(() => { + void themesCheckAndUpdates(this, false); + }, 12e4); + } + setTimeout(() => { + window.bratAPI = this.bratApi; + }, 500); + }); + }).catch((error) => { + console.error("Failed to load settings:", error); + }); + } + showRibbonButton() { + this.addRibbonIcon("BratIcon", "BRAT", () => { + this.commands.ribbonDisplayCommands(); + }); + } + async log(textToLog, verbose = false) { + await logger(this, textToLog, verbose); + } + onunload() { + console.log("unloading " + this.APP_NAME); + } + async loadSettings() { + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + } + async saveSettings() { + await this.saveData(this.settings); + } +}; + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian42-brat/manifest.json b/.obsidian/plugins/obsidian42-brat/manifest.json new file mode 100644 index 0000000..2701b29 --- /dev/null +++ b/.obsidian/plugins/obsidian42-brat/manifest.json @@ -0,0 +1,15 @@ +{ + "id": "obsidian42-brat", + "name": "BRAT", + "version": "1.0.3", + "minAppVersion": "1.4.16", + "description": "Easily install a beta version of a plugin for testing.", + "author": "TfTHacker", + "authorUrl": "https://github.com/TfTHacker/obsidian42-brat", + "helpUrl": "https://tfthacker.com/BRAT", + "isDesktopOnly": false, + "fundingUrl": { + "Buy Me a Coffee": "https://bit.ly/o42-kofi", + "Visit my site": "https://tfthacker.com" + } +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian42-brat/styles.css b/.obsidian/plugins/obsidian42-brat/styles.css new file mode 100644 index 0000000..596067a --- /dev/null +++ b/.obsidian/plugins/obsidian42-brat/styles.css @@ -0,0 +1,3 @@ +.brat-modal .modal-button-container { + margin-top: 5px !important; +} diff --git a/.obsidian/plugins/query-control/data.json b/.obsidian/plugins/query-control/data.json new file mode 100644 index 0000000..004bf2b --- /dev/null +++ b/.obsidian/plugins/query-control/data.json @@ -0,0 +1,8 @@ +{ + "defaultCollapse": true, + "defaultShowContext": false, + "defaultHideTitle": true, + "defaultHideResults": false, + "defaultRenderMarkdown": true, + "defaultSortOrder": "0" +} \ No newline at end of file diff --git a/.obsidian/plugins/query-control/main.js b/.obsidian/plugins/query-control/main.js new file mode 100644 index 0000000..55e54ad --- /dev/null +++ b/.obsidian/plugins/query-control/main.js @@ -0,0 +1,12 @@ +/* +THIS IS A GENERATED/BUNDLED FILE BY ESBUILD +if you want to view the source, please visit the github repository of this plugin +*/ + +var q=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Y=(l,h)=>{for(var e in h)q(l,e,{get:h[e],enumerable:!0})},J=(l,h,e,t)=>{if(h&&typeof h=="object"||typeof h=="function")for(let s of U(h))!X.call(l,s)&&s!==e&&q(l,s,{get:()=>h[s],enumerable:!(t=G(h,s))||t.enumerable});return l};var Z=l=>J(q({},"__esModule",{value:!0}),l);var b=(l,h,e)=>new Promise((t,s)=>{var n=i=>{try{a(e.next(i))}catch(o){s(o)}},r=i=>{try{a(e.throw(i))}catch(o){s(o)}},a=i=>i.done?t(i.value):Promise.resolve(i.value).then(n,r);a((e=e.apply(l,h)).next())});var se={};Y(se,{default:()=>A});module.exports=Z(se);function S(l,h){let e=Object.keys(h).map(t=>K(l,t,h[t]));return e.length===1?e[0]:function(){e.forEach(t=>t())}}function K(l,h,e){let t=l[h],s=l.hasOwnProperty(h),n=s?t:function(){return Object.getPrototypeOf(l)[h].apply(this,arguments)},r=e(n);return t&&Object.setPrototypeOf(r,t),Object.setPrototypeOf(a,r),l[h]=a,i;function a(...o){return r===n&&l[h]===a&&i(),r.apply(this,o)}function i(){l[h]===a&&(s?l[h]=n:delete l[h]),r!==n&&(r=n,Object.setPrototypeOf(a,t||Function))}}var g=require("obsidian");var I=require("obsidian");var H=class extends I.MarkdownRenderer{constructor(e,t,s){super(e,t);this.app=e,this.match=s,this.subpath="",this.indent="",this.filePath=this.match.parentDom.path,this.file=this.match.parentDom.file,this.renderer.previewEl.onNodeInserted(()=>(this.updateOptions(),this.renderer.onResize()))}updateOptions(){let e=this.app.vault.getConfig("readableLineLength");this.renderer.previewEl.toggleClass("is-readable-line-width",e);let t=this.app.vault.getConfig("foldHeading");this.renderer.previewEl.toggleClass("allow-fold-headings",t);let s=this.app.vault.getConfig("foldIndent");this.renderer.previewEl.toggleClass("allow-fold-lists",s),this.renderer.previewEl.toggleClass("rtl",this.app.vault.getConfig("rightToLeft")),t||this.renderer.unfoldAllHeadings(),s||this.renderer.unfoldAllLists(),this.renderer.previewEl.toggleClass("show-frontmatter",this.app.vault.getConfig("showFrontmatter"));let n=this.app.vault.getConfig("tabSize");this.renderer.previewEl.style.setProperty("--tab-size",`${n}px`),this.renderer.rerender()}onRenderComplete(){}getFile(){return this.match.parent.file}edit(e){return b(this,null,function*(){var o;this.renderer.set(e);let t=yield this.app.vault.cachedRead(this.file),n=(o=t.slice(this.match.start,this.match.end).match(/^\s+/g))==null?void 0:o.first();n&&(e=e.replace(/^/gm,n));let r=t.slice(0,this.match.start),a=t.slice(this.match.end,this.match.parent.content.length),i=r+e+a;yield this.app.vault.modify(this.file,i)})}};var R=require("obsidian");var M=i18next.t.bind(i18next);var $={defaultCollapse:!1,defaultShowContext:!1,defaultHideTitle:!1,defaultHideResults:!1,defaultRenderMarkdown:!1,defaultSortOrder:"alphabetical"},O=[{key:"alphabetical",label:M("plugins.file-explorer.label-sort-a-to-z")},{key:"alphabeticalReverse",label:M("plugins.file-explorer.label-sort-z-to-a")},{key:"byModifiedTime",label:M("plugins.file-explorer.label-sort-new-to-old")},{key:"byModifiedTimeReverse",label:M("plugins.file-explorer.label-sort-old-to-new")},{key:"byCreatedTime",label:M("plugins.file-explorer.label-sort-created-new-to-old")},{key:"byCreatedTimeReverse",label:M("plugins.file-explorer.label-sort-created-old-to-new")}],ee=l=>l.reduce((h,e)=>(h[e.key]=e.label,h),{}),L=class extends R.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}hide(){}display(){let{containerEl:e}=this;e.empty(),new R.Setting(e).setName("Collapse query results by default").addToggle(t=>t.setValue(this.plugin.settings.defaultCollapse).onChange(s=>{this.plugin.settings.defaultCollapse=s,this.plugin.saveSettings()})),new R.Setting(e).setName("Show additional query result context by default").addToggle(t=>t.setValue(this.plugin.settings.defaultShowContext).onChange(s=>{this.plugin.settings.defaultShowContext=s,this.plugin.saveSettings()})),new R.Setting(e).setName("Hide query title by default").addToggle(t=>t.setValue(this.plugin.settings.defaultHideTitle).onChange(s=>{this.plugin.settings.defaultHideTitle=s,this.plugin.saveSettings()})),new R.Setting(e).setName("Hide query results by default").addToggle(t=>t.setValue(this.plugin.settings.defaultHideResults).onChange(s=>{this.plugin.settings.defaultHideResults=s,this.plugin.saveSettings()})),new R.Setting(e).setName("Render results as Markdown by default").addToggle(t=>t.setValue(this.plugin.settings.defaultRenderMarkdown).onChange(s=>{this.plugin.settings.defaultRenderMarkdown=s,this.plugin.saveSettings()})),new R.Setting(e).setName("Default query result sort order").addDropdown(t=>{t.addOptions(ee(O)),t.setValue(this.plugin.settings.defaultSortOrder),t.onChange(s=>b(this,null,function*(){this.plugin.settings.defaultSortOrder=s,yield this.plugin.saveSettings()}))})}};var m,T;function F(l,h,e,t,s){if(m){T();return}m=document.createElement("div"),m.classList.add("query-control-sort-tooltip");let n=h.getBoundingClientRect(),r=n.bottom+window.scrollY+5,a=n.left+window.scrollX;m.style.setProperty("--tooltip-top",`${r}px`),m.style.setProperty("--tooltip-left",`${a}px`),l.forEach(p=>{let u=document.createElement("div");if(u.classList.add("query-control-sort-option"),u.textContent=p.label,p.key===t){u.setAttribute("aria-current","true");let y=document.createElement("span");y.textContent="\u2713",y.classList.add("query-control-sort-option-checkmark"),u.appendChild(y)}u.addEventListener("click",()=>{e(p.key),T()}),m.appendChild(u)}),document.body.appendChild(m),T=()=>{document.removeEventListener("mousedown",o,!0),document.removeEventListener("touchstart",o,!0),document.removeEventListener("click",o),document.removeEventListener("keydown",c,!0),s.workspace.off("active-leaf-change",i),m.remove(),m=void 0};let i=()=>{m.parentElement&&(m.remove(),T())},o=p=>{!m.contains(p.target)&&!h.contains(p.target)&&(m.remove(),T())},c=p=>{m.remove(),T()};document.addEventListener("mousedown",o,!0),document.addEventListener("touchstart",o,!0),document.addEventListener("click",o),document.addEventListener("keydown",c,!0),s.workspace.on("active-leaf-change",i)}var z=new WeakMap,A=class extends g.Plugin{onload(){return b(this,null,function*(){yield this.loadSettings();let e=this;this.registerSettingsTab(),this.register(S(this.app.viewRegistry.constructor.prototype,{registerView(s){return function(n,r,...a){return e.app.workspace.trigger("view-registered",n,r),s.call(this,n,r,...a)}}}));let t;if(!this.app.workspace.layoutReady){let s=this.app.workspace.on("view-registered",(r,a)=>{if(r!=="search")return;this.app.workspace.offref(s);let i=new g.WorkspaceLeaf(e.app),o=a(i);e.patchNativeSearch(o);let c=S(g.Modal.prototype,{open(p){return function(...u){e.SearchResultsExport=this.constructor}}});o.onCopyResultsClick(new MouseEvent(null)),c()}),n=this.app.workspace.on("view-registered",(r,a)=>{if(r!=="backlink")return;this.app.workspace.offref(n);let i=new g.WorkspaceLeaf(e.app),o=a(i);e.SearchHeaderDOM=o.backlink.headerDom.constructor})}this.register(t=S(g.Component.prototype,{addChild(s){return function(n,...r){try{if(!e.isSearchPatched&&n instanceof g.Component&&n.hasOwnProperty("searchQuery")&&n.hasOwnProperty("sourcePath")&&n.hasOwnProperty("dom")){let i=n;e.patchSearchView(i),e.isSearchPatched=!0}if(n instanceof g.Component&&n.hasOwnProperty("backlinkDom")){let i=n;z.set(i.backlinkDom.el.closest(".backlink-pane"),n),e.isBacklinksPatched||(e.patchBacklinksView(i),e.isBacklinksPatched=!0)}}catch(i){console.error("Error in Component.addChild around patch:",i)}return s.call(this,n,...r)}}}))})}loadSettings(){return b(this,null,function*(){this.settings=Object.assign({},$,yield this.loadData())})}saveSettings(){return b(this,null,function*(){yield this.saveData(this.settings)})}registerSettingsTab(){this.settingsTab=new L(this.app,this),this.addSettingTab(this.settingsTab)}getSearchHeader(){var s,n,r;let e=(s=this.app.workspace.getLeavesOfType("backlink"))==null?void 0:s.first();e==null||e.loadIfDeferred();let t=(r=(n=e==null?void 0:e.view)==null?void 0:n.backlink)==null?void 0:r.headerDom;return t==null?void 0:t.constructor}onunload(){let e="Query Control: Please restart Obsidian to complete plugin unload.";console.log(e),new g.Notice(e)}patchNativeSearch(e){let t=this;this.register(S(e.constructor.prototype,{onResize(s){return function(...n){var a;let r=(a=this.dom.vChildren)==null?void 0:a._children;return this.dom.el.clientWidth===0?(r.forEach(i=>{i.setCollapse(!0,!1)}),this.dom.hidden=!0):this.dom.hidden&&(this.dom.hidden=!1,setTimeout(()=>{r.forEach(i=>{i.setCollapse(this.dom.collapseAll,!1)})},100)),s.call(this,...n)}},stopSearch(s){return function(...n){let r=s.call(this,...n);return this.renderComponent&&(this.renderComponent.unload(),this.renderComponent=new g.Component),r}},addChild(s){return function(...n){var a;try{if(!this.patched){this.renderComponent||(this.renderComponent=new g.Component,this.renderComponent.load()),this.patched=!0,this.dom.parent=this,t.patchSearchResultDOM(this.dom.constructor),this.setRenderMarkdown=function(o){var p,u;let c=(p=this.dom.vChildren)==null?void 0:p._children;this.dom.renderMarkdown=o,c.forEach(y=>{y.renderContentMatches()}),this.dom.infinityScroll.invalidateAll(),this.dom.childrenEl.toggleClass("cm-preview-code-block",o),this.dom.childrenEl.toggleClass("is-rendered",o),(u=this.renderMarkdownButtonEl)==null||u.toggleClass("is-active",o)},this.renderMarkdownButtonEl=(a=this.headerDom)==null?void 0:a.addNavButton("reading-glasses","Render Markdown",()=>this.setRenderMarkdown(!this.dom.renderMarkdown));let i={renderMarkdown:t.settings.defaultRenderMarkdown};this.settings||(this.settings={}),Object.entries(i).forEach(([o,c])=>{this.settings.hasOwnProperty(o)?o==="sort"&&!O.hasOwnProperty(this.settings.sort)&&(this.settings[o]=c):this.settings[o]=c}),this.setRenderMarkdown(this.settings.renderMarkdown)}}catch(i){console.error("Error in searchView.addChild around patch:",i)}return s.call(this,...n)}}}))}patchSearchResultDOM(e){let t=this,s=S(e.prototype,{addResult(n){return function(...r){s();let a=n.call(this,...r),i=a.constructor;return t.isSearchResultItemPatched||t.patchSearchResultItem(i),a}}});this.register(s),this.register(S(e.prototype,{startLoader(n){return function(...r){var i,o,c,p,u,y;try{let x=this.el.closest(".backlink-pane");if(x){let k=z.get(x);k&&(k.patched||te(this,t,k))}if(!((o=(i=this.parent)==null?void 0:i.searchParamsContainerEl)!=null&&o.patched)&&((p=(c=this.el)==null?void 0:c.parentElement)==null?void 0:p.getAttribute("data-type"))==="search"){if(!this.parent)return;this.parent.searchParamsContainerEl.patched=!0,new g.Setting(this.parent.searchParamsContainerEl).setName("Render Markdown").setClass("mod-toggle").addToggle(k=>{k.setValue(t.settings.defaultRenderMarkdown),k.onChange(v=>{var P;this.renderMarkdown=v,((P=this.vChildren)==null?void 0:P._children).forEach(d=>{d.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",v),this.childrenEl.toggleClass("is-rendered",v)})})}if(!this.patched&&((u=this.el.parentElement)==null?void 0:u.hasClass("internal-query"))){let k=t.SearchHeaderDOM?t.SearchHeaderDOM:t.getSearchHeader();if(!k){console.error("Error: _SearchHeaderDOM is undefined. Cannot create headerDom.");return}if((y=this.el)!=null&&y.closest(".internal-query")){this.patched=!0;let v=this.el.parentElement.querySelector(".internal-query-header");this.setExtraContext=function(d){var C;let w=(C=this.vChildren)==null?void 0:C._children;this.extraContext=d,this.extraContextButtonEl.toggleClass("is-active",d),w.forEach(f=>{f.setExtraContext(d)}),this.infinityScroll.invalidateAll()},this.setTitleDisplay=function(d){this.showTitle=d,this.showTitleButtonEl.toggleClass("is-active",d),v.toggleClass("is-hidden",d)},this.setResultsDisplay=function(d){this.showResults=d,this.showResultsButtonEl.toggleClass("is-active",d),this.el.toggleClass("is-hidden",d)},this.setRenderMarkdown=function(d){var C;this.renderMarkdown=d,((C=this.vChildren)==null?void 0:C._children).forEach(f=>{f.renderContentMatches()}),this.infinityScroll.invalidateAll(),this.childrenEl.toggleClass("cm-preview-code-block",d),this.childrenEl.toggleClass("is-rendered",d),this.renderMarkdownButtonEl.toggleClass("is-active",d)},this.setCollapseAll=function(d){var C;let w=(C=this.vChildren)==null?void 0:C._children;this.collapseAllButtonEl.toggleClass("is-active",d),this.collapseAll=d,w.forEach(f=>{f.setCollapse(d,!1)}),this.infinityScroll.invalidateAll()},this.setSortOrder=d=>{this.sortOrder=d,this.changed(),this.infinityScroll.invalidateAll()},this.onCopyResultsClick=d=>b(this,null,function*(){var _,B;d.preventDefault();let w=[],C=(_=this.vChildren)==null?void 0:_._children;for(let D of C){let Q=D.file.path,V="",j=(B=D.vChildren)==null?void 0:B._children;for(let N of j){let W=N.parent.content.substring(N.start,N.end);V+=W+` +`}w.push(`## ${Q} +${V}`)}let f=w.join(` +`);try{yield navigator.clipboard.writeText(f),new g.Notice("Search results copied to clipboard.")}catch(D){console.error("Failed to copy search results:",D),new g.Notice("Failed to copy search results.")}});let E=this.headerDom=new k(this.app,this.el.parentElement);v.insertAdjacentElement("afterend",E.navHeaderEl),this.collapseAllButtonEl=E.addNavButton("bullet-list",M("plugins.search.label-collapse-results"),d=>(d.stopPropagation(),this.setCollapseAll(!this.collapseAll))),this.extraContextButtonEl=E.addNavButton("expand-vertically",M("plugins.search.label-more-context"),d=>(d.stopPropagation(),this.setExtraContext(!this.extraContext))),this.showSortButtonEl=E.addNavButton("arrow-up-narrow-wide","Sort",d=>{d.stopPropagation();let w=O.map(f=>f.key),C=f=>{if(w.includes(f)){this.sortOrder=f;let B=`Sort (${O.find(D=>D.key===f).label})`;this.showSortButtonEl.setAttribute("aria-label",B),this.setSortOrder(f)}else console.error(`Invalid sort option: ${f}`)};F(O,this.showSortButtonEl,C,this.sortOrder,this.app)}),this.showTitleButtonEl=E.addNavButton("strikethrough-glyph","Hide title",d=>(d.stopPropagation(),this.setTitleDisplay(!this.showTitle))),this.showResultsButtonEl=E.addNavButton("minus-with-circle","Hide results",d=>(d.stopPropagation(),this.setResultsDisplay(!this.showResults))),this.renderMarkdownButtonEl=E.addNavButton("reading-glasses","Render Markdown",d=>(d.stopPropagation(),this.setRenderMarkdown(!this.renderMarkdown))),E.addNavButton("documents","Copy results",this.onCopyResultsClick.bind(this));let P={title:t.settings.defaultHideResults,collapsed:t.settings.defaultCollapse,context:t.settings.defaultShowContext,hideTitle:t.settings.defaultHideTitle,hideResults:t.settings.defaultHideResults,renderMarkdown:t.settings.defaultRenderMarkdown,sort:t.settings.defaultSortOrder};this.settings||(this.settings={}),Object.entries(P).forEach(([d,w])=>{this.settings.hasOwnProperty(d)?d==="sort"&&!O.hasOwnProperty(this.settings.sort)&&(this.settings[d]=w):this.settings[d]=w}),this.setExtraContext(this.settings.context),this.sortOrder=this.settings.sort,this.setCollapseAll(this.settings.collapsed),this.setTitleDisplay(this.settings.hideTitle),this.setRenderMarkdown(this.settings.renderMarkdown),this.setResultsDisplay(this.settings.hideResults)}}}catch(x){console.error("Error in SearchResultDOM.startLoader around patch:",x)}return n.call(this,...r)}}}))}patchSearchResultItem(e){this.isSearchResultItemPatched=!0;let t=this,s=S(e.prototype,{onResultClick(n){return function(r,a,...i){if(!(r.target instanceof HTMLElement&&(r.target.hasClass("internal-link")||r.target.hasClass("task-list-item-checkbox")||r.target.hasClass("admonition-title-content"))))return n.call(this,r,a,...i)}},renderContentMatches(n){return function(...r){var o;let a=n.call(this,...r),i=(o=this.vChildren)==null?void 0:o._children;if(!t.isSearchResultItemMatchPatched&&i.length){let c=i.first().constructor;t.patchSearchResultItemMatch(c)}return a}}});t.register(s)}patchSearchResultItemMatch(e){this.isSearchResultItemMatchPatched=!0;let t=this;t.register(S(e.prototype,{render(s){return function(...n){var c;let r=this.parentDom,a=r.content.substring(this.start,this.end).replace("```query","\\`\\`\\`query"),i=(c=a.match(/^\s+/g))==null?void 0:c.first();i&&(a=a.replace(new RegExp(`^${i}`,"gm"),""));let o=r.parent.parent;if(o&&r.parent.renderMarkdown){let p=o==null?void 0:o.renderComponent;this.el.empty();let u=new H(t.app,this.el,this);u.onRenderComplete=()=>{var y;(y=r==null?void 0:r.parent)==null||y.infinityScroll.measure(r,this)},p.addChild(u),u.renderer.set(a)}else return s.call(this,...n)}}}))}patchSearchView(e){let t=e.constructor,s=e.dom.constructor;this.register(S(t.prototype,{onunload(n){return function(...r){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),n.call(this,...r)}},onload(n){return function(...r){try{this.renderComponent||(this.renderComponent=new g.Component,this.renderComponent.load()),this.dom.parent=this;let i=this.containerEl.parentElement.querySelector(".internal-query-header"),o=this.query.matchAll(new RegExp("^(?collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):\\s*(?.+?)$","gm")),c={};for(let p of o){let u=p.groups.value.toLowerCase();(u==="true"||u==="false")&&(p.groups.value=u==="true"),c[p.groups.key]=p.groups.value}this.query=this.query.replace(/^((collapsed|context|hideTitle|renderMarkdown|hideResults|sort|title):.+?)$/gm,"").trim(),i.setText(c.title||this.query),this.dom.settings=c}catch(i){console.error("Error in EmbeddedSearch.onload:",i)}return n.call(this,...r)}}})),this.patchSearchResultDOM(s)}patchBacklinksView(e){let t=e.constructor,s=e.backlinkDom.constructor;this.register(S(t.prototype,{onunload(n){return function(...r){return this.renderComponent&&(this.renderComponent.unload(),this.dom=null,this.queue=null,this.renderComponent=null,this._children=null,this.containerEl=null),n.call(this,...r)}},onload(n){return function(...r){try{this.renderComponent||(this.renderComponent=new g.Component,this.renderComponent.load()),this.dom||(console.warn("Backlink `dom` is undefined. Initializing default properties."),this.dom={}),this.backlinkDom.parent=this,this.unlinkedDom.parent=this,this.dom.settings=this.dom.settings||{}}catch(a){console.error("Error in Backlink.onload:",a)}return n.call(this,...r)}}})),this.patchSearchResultDOM(s)}};function te(l,h,e){if(e){e.patched=!0,l.setRenderMarkdown=function(s){[e.backlinkDom,e.unlinkedDom].forEach(r=>{var i;r.renderMarkdown=s,((i=r.vChildren)==null?void 0:i._children).forEach(o=>{o.renderContentMatches()}),r.infinityScroll.invalidateAll(),r.childrenEl.toggleClass("cm-preview-code-block",s),r.childrenEl.toggleClass("is-rendered",s)}),this.renderMarkdownButtonEl.toggleClass("is-active",s)},l.onCopyResultsClick=s=>b(this,null,function*(){var i,o;s.stopPropagation(),s.preventDefault();let n=[],r=[e.backlinkDom,e.unlinkedDom];for(let c of r){let p=(i=c.vChildren)==null?void 0:i._children;for(let u of p){let y=u.file.path,x="",k=(o=u.vChildren)==null?void 0:o._children;for(let v of k){let E=v.parent.content.substring(v.start,v.end);x+=E+` +`}n.push(`## ${y} +${x}`)}}let a=n.join(` +`);try{yield navigator.clipboard.writeText(a)}catch(c){console.error("Failed to copy backlinks:",c),new g.Notice("Failed to copy backlinks.")}}),l.renderMarkdownButtonEl=e.headerDom.addNavButton("reading-glasses","Render Markdown",s=>(s.stopPropagation(),l.setRenderMarkdown(!l.renderMarkdown))),e.headerDom.addNavButton("documents","Copy results",l.onCopyResultsClick.bind(l));let t={title:h.settings.defaultHideResults,collapsed:h.settings.defaultCollapse,context:h.settings.defaultShowContext,hideTitle:h.settings.defaultHideTitle,hideResults:h.settings.defaultHideResults,renderMarkdown:h.settings.defaultRenderMarkdown,sort:h.settings.defaultSortOrder};l.settings||(l.settings={}),Object.entries(t).forEach(([s,n])=>{l.settings.hasOwnProperty(s)?s==="sort"&&!O.hasOwnProperty(l.settings.sort)&&(l.settings[s]=n):l.settings[s]=n}),e.setExtraContext(l.settings.context),e.sortOrder=l.settings.sort,e.setCollapseAll(l.settings.collapsed),l.setRenderMarkdown(l.settings.renderMarkdown)}} diff --git a/.obsidian/plugins/query-control/manifest.json b/.obsidian/plugins/query-control/manifest.json new file mode 100644 index 0000000..f0e88bd --- /dev/null +++ b/.obsidian/plugins/query-control/manifest.json @@ -0,0 +1 @@ +{"id":"query-control","name":"Query Control","version":"0.7.13","minAppVersion":"1.7.2","description":"An experimental Obsidian plugin that adds additional control to queries","author":"NothingIsLost & reply2za","authorUrl":"https://github.com/reply2za","isDesktopOnly":false} \ No newline at end of file diff --git a/.obsidian/plugins/query-control/styles.css b/.obsidian/plugins/query-control/styles.css new file mode 100644 index 0000000..9fce74e --- /dev/null +++ b/.obsidian/plugins/query-control/styles.css @@ -0,0 +1,68 @@ +.workspace-leaf-content[data-type="markdown"] .internal-query .nav-header { + margin-top: 0; /* works around issues with minimal theme */ +} + +.workspace-leaf-content[data-type="markdown"] .internal-query .nav-header .nav-buttons-container { + position: unset; /* works around issues with minimal theme */ + justify-content: center; /* works around issues with minimal theme */ +} + +.workspace-leaf-content[data-type="markdown"] .internal-query .is-hidden { + display: none; +} + +.search-results-children.is-rendered .search-result-file-match { + white-space: normal; +} + +.search-results-children.is-rendered { + padding: 0; +} + +.search-results-children.is-rendered .search-result-file-matches .markdown-preview-view { + padding: 0; +} + +.search-results-children.is-rendered .search-result-file-matches .markdown-preview-section { + max-width: 100%; +} + +.search-results-children.is-rendered .task-list-item-checkbox { + vertical-align: unset; +} + +.search-results-children.is-rendered ul { + padding-inline-start: 40px; + margin-block-end: 0; + margin-block-start: 0; +} + +.cm-preview-code-block.is-rendered .markdown-preview-view { + height: inherit; +} + +.query-control-sort-tooltip { + position: absolute; + top: var(--tooltip-top); + left: var(--tooltip-left); + background: #333; + color: #fff; + border-radius: 4px; + padding: 5px; + z-index: 1000; +} + +.query-control-sort-option { + padding: 5px; + cursor: pointer; +} + +.query-control-sort-option:hover { + background: #555; +} + +.query-control-sort-option-checkmark { + color: #fff; + margin-left: 10px; + font-size: 1em; +} diff --git a/.obsidian/templates.json b/.obsidian/templates.json new file mode 100644 index 0000000..9d40ed7 --- /dev/null +++ b/.obsidian/templates.json @@ -0,0 +1,4 @@ +{ + "folder": "90 Extras/91 Templates", + "dateFormat": "YYYY-MM-DD, ddd" +} \ No newline at end of file diff --git a/.obsidian/types.json b/.obsidian/types.json new file mode 100644 index 0000000..41cf69a --- /dev/null +++ b/.obsidian/types.json @@ -0,0 +1,14 @@ +{ + "types": { + "aliases": "aliases", + "cssclasses": "multitext", + "tags": "tags", + "url": "multitext", + "author": "text", + "finished": "checkbox", + "finished-date": "text", + "related-to": "multitext", + "authors": "multitext", + "related": "multitext" + } +} \ No newline at end of file diff --git a/10 Notes/Short Introduction to Obsidian.md b/10 Notes/Short Introduction to Obsidian.md new file mode 100644 index 0000000..0d8f76e --- /dev/null +++ b/10 Notes/Short Introduction to Obsidian.md @@ -0,0 +1,32 @@ +Here a short intro to [Obsidian](https://obsidian.md) and *Personal Knowledge Management Systems*. + +I currently, document some of the Codex/BitTorrent stuff in the vault you already can use to see how does it feel for you. The vault is available on GitHub: [https://github.com/codex-storage/bittorrent-codex-docs](https://github.com/codex-storage/bittorrent-codex-docs). You can just clone the rero, and open the cloned folder in Obsidian. That's it. This is you local copy - anything you do is only visible to you. GitHub is used for a more controlled syncing. Normally, when you work on your own content, you will put your vault on some shared network drive (end-to-end encrypted of course! :yum: ), and then you can conveniently open it on any other device. Syncing is done by the network drive, Obsidian has nothing to do with it in this case. You content keeps the same structure (including folders) as you see it in your local (shared) folder - thus, everything is transparent and extremely portable. Myself, I have a paid subscription to Obsidian Sync service (not that I really need it, but I wanted to try it and to support the Obsidian team a bit). It costs me $96,00 per year: + +![[Pasted image 20250513024925.png]] + +Obsidian also provides publishing service, which I use for our Codex/BitTorrent documentation and which costs me around $10,- monthly: here you can see how it looks like: [https://publish.obsidian.md/bittorrent](https://publish.obsidian.md/bittorrent). You can also just as easily create an empty vault to play with the settings and plugin. The BitTorrent vault has some basic set of plugins included. For a more active collaborative vault, perhaps using Obsidian Sync and then try to [Collaborate on a shared vault](https://help.obsidian.md/sync/collaborate). It requires a paid subscription, but perhaps $96,- per user per year will not break the bank (limit is 20 users currently). Paid Sync service also includes versioning of the content. + +### Personal Knowledge Management Systems + +Now, maybe the most important part is that Obsidian (as well as Logseq, and mentioned above Roam Research) are called Personal Knowledge Management systems. Those system can be used for project documentation and any other inventory, but their true power is in knowledge management. Sounds like nothing, but it was and still is new for me. + +I spent years "reinventing" my documentation systems and only after I discovered Obsidian I started to learn more about how to effectively record information in a way, that it is findable when needed, and fulfills quite a different purpose than many people expect when they think about documenting: a knowledge management system should allow you to be more productive in ***creating new ideas*** based on what you have learned before. A good intro is to look into the concept of [zettelkasten](https://en.wikipedia.org/wiki/Zettelkasten). You will find a lot of good free and paid materials on how to use tools like Obsidian or Logseq effectively. Of course, Obsidian is also very good on creating a traditional documentation without taking full advantage of linking and indexing, and it is still very convenient to use it as such - not everything is suitable for zettelkasten, sometimes you just need to write longer manuals or tutorial or just keep your home inventory. Such more traditional documentation vaults often relay on folder structure, but soon after you start learning about knowledge management like zettelkasten, you will discover that folder are actually really bad idea. A proper knowledge management system relays on linking relevant content so that information is always preserved with some context and relation to other things. And this is where systems like Obsidian really excel, with the convenience of linking content and powerful graphs and search capabilities - if you embrace that, you will see why using folders is more an impediment than anything else in recording what you learn and what you need to find to built new great things. A knowledge management system is something quite personal I believe, but learning it will certainly help in how we record the knowledge about things we are working on. We can also have multiple vaults for some dedicated purposes. + +And again, we decided to give it a try, and if it does not work for us, we will review and adjust. + +To start, we have two options: + +1. Built on top of the Codex/BitTorrent vault (this vault), +2. Start with a fresh new vault. + +We can have multiple vaults, but there should be one central vault which will always be ultimate place to go to find out the stuff. I feel this should be a knowledge management vault, but I would not be too dogmatic about using the folders - I do not use them for this purpose, but if you need one for something, the system will not break because of it - everything in the end is connected, and indexed, and in which folder things are (as you will see) is really secondary. If we need more vaults later, we can add them, but we should always refer to them from the main vault so that we have single source of true. + +The last remark from me would be that we should be careful not to bloat the system with too many invasive plugins, so that the content remains as clean and as portable as possible. The setup I created in the Codex/BitTorrent try to follow that principle. + +I think this is already long intro. Please play with Obsidian shortly. I do not feel like an expert here, but if you need to discuss something I will be happy to help. + +### Some other links + +Some of you were wondering if commenting/reviewing can be done in obsidian. I did not try anything yet myself. What I found is [https://github.com/Fevol/obsidian-criticmarkup](https://github.com/Fevol/obsidian-criticmarkup). I may give it a spin in the coming days. + +There is also a blog post from HackMD, which is related: [HackMD & Obsidian: The ultimate markdown workflow](https://hackmd.io/@hackmd-blog/hackmd-obsidian-workflow). diff --git a/90 Extras/91 Templates/Book.md b/90 Extras/91 Templates/Book.md new file mode 100644 index 0000000..cc42eb7 --- /dev/null +++ b/90 Extras/91 Templates/Book.md @@ -0,0 +1,7 @@ +--- +tags: + - book +authors: +link: +related-to: +--- diff --git a/90 Extras/91 Templates/Tweet.md b/90 Extras/91 Templates/Tweet.md new file mode 100644 index 0000000..f79c48b --- /dev/null +++ b/90 Extras/91 Templates/Tweet.md @@ -0,0 +1,7 @@ +--- +tags: + - tweet +author: +link: +related-to: +--- diff --git a/90 Extras/92 Assets/Pasted image 20250513024925.png b/90 Extras/92 Assets/Pasted image 20250513024925.png new file mode 100644 index 0000000000000000000000000000000000000000..2176fb6a862e0d8317f19c356707006acba01d48 GIT binary patch literal 90687 zcmeFZgFGO2?~mYG$J7_NH+o^-5r~h?#>M&AfS>Pq`Nl_o05%!v~+jprW-c# zF7D?(=RDv0cz@sb2ONIC4U4tbTyxDi#~fo^*SH`|SyB2CHYqj=3d$pycao|oDChww zD5xP=7{HmMGSMa!lm{bL5)#TX5)#zP&JORbY|T+nw1anaER@xCh(z|>aK(5PY*p{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T License + +Copyright (c) [2025] [Codex Team] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` diff --git a/README.md b/README.md new file mode 100644 index 0000000..5a4cfe2 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +## Codex Documentation Vault + +This is our documentation. An [Obsidian](https://obsidian.md) vault containing +all Codex-related docs. + +### Obsidian + +This repository is a complete [Obsidian](https://obsidian.md) vault. You can open it on your computer in the [Obsidian App](https://obsidian.md/download) and have a searchable Codex documentation vault under your full control. Comparing to bloated [Notion](https://www.notion.so), which is a great tool for procrastination rather than a tool for capturing knowledge, Obsidian let's you capture the knowledge quickly and with excellent overview of how different topic connect to each other. And in the end - all are just Markdown files. + +The vault includes the `.obsidian` folder, but does not include publishing settings, and workspace configuration as those are personal and change every time you open the vault. If you want to have the full control over your Obsidian look and full, your own [[Hot-Keys|hot-keys]], [[Installed plugins|plugins]], etc, your can delete `.obsidian` or replace it with your own. + +To learn more about Obsidian and *Knowledge Management Systems*, please also check [[Short Introduction to Obsidian]].