diff --git a/obsidian/app.json b/obsidian/app.json
new file mode 100644
index 0000000..8ac40aa
--- /dev/null
+++ b/obsidian/app.json
@@ -0,0 +1,5 @@
+{
+ "alwaysUpdateLinks": true,
+ "vimMode": true,
+ "showLineNumber": true
+}
\ No newline at end of file
diff --git a/obsidian/appearance.json b/obsidian/appearance.json
new file mode 100644
index 0000000..006baa2
--- /dev/null
+++ b/obsidian/appearance.json
@@ -0,0 +1,4 @@
+{
+ "cssTheme": "Catppuccin",
+ "interfaceFontFamily": "Ubuntu Nerd Font"
+}
\ No newline at end of file
diff --git a/obsidian/community-plugins.json b/obsidian/community-plugins.json
new file mode 100644
index 0000000..e0ae9f7
--- /dev/null
+++ b/obsidian/community-plugins.json
@@ -0,0 +1,6 @@
+[
+ "remotely-save",
+ "calendar",
+ "code-styler",
+ "file-explorer-note-count"
+]
\ No newline at end of file
diff --git a/obsidian/core-plugins.json b/obsidian/core-plugins.json
new file mode 100644
index 0000000..c89a841
--- /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": false,
+ "page-preview": true,
+ "daily-notes": true,
+ "templates": true,
+ "note-composer": true,
+ "command-palette": true,
+ "slash-command": false,
+ "editor-status": true,
+ "bookmarks": true,
+ "markdown-importer": false,
+ "zk-prefixer": false,
+ "random-note": false,
+ "outline": true,
+ "word-count": true,
+ "slides": false,
+ "audio-recorder": false,
+ "workspaces": false,
+ "file-recovery": true,
+ "publish": false,
+ "sync": false,
+ "webviewer": false
+}
\ No newline at end of file
diff --git a/obsidian/hotkeys.json b/obsidian/hotkeys.json
new file mode 100644
index 0000000..c45b91f
--- /dev/null
+++ b/obsidian/hotkeys.json
@@ -0,0 +1,45 @@
+{
+ "editor:swap-line-down": [
+ {
+ "modifiers": [
+ "Alt"
+ ],
+ "key": "ArrowDown"
+ }
+ ],
+ "editor:swap-line-up": [
+ {
+ "modifiers": [
+ "Alt"
+ ],
+ "key": "ArrowUp"
+ }
+ ],
+ "editor:add-cursor-above": [
+ {
+ "modifiers": [
+ "Alt",
+ "Shift"
+ ],
+ "key": "ArrowUp"
+ }
+ ],
+ "editor:add-cursor-below": [
+ {
+ "modifiers": [
+ "Alt",
+ "Shift"
+ ],
+ "key": "ArrowDown"
+ }
+ ],
+ "remotely-save:start-sync": [
+ {
+ "modifiers": [
+ "Mod",
+ "Shift"
+ ],
+ "key": "S"
+ }
+ ]
+}
\ 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..b03e21d
--- /dev/null
+++ b/obsidian/plugins/calendar/data.json
@@ -0,0 +1,10 @@
+{
+ "shouldConfirmBeforeCreate": true,
+ "weekStart": "locale",
+ "wordsPerDot": 250,
+ "showWeeklyNote": false,
+ "weeklyNoteFormat": "",
+ "weeklyNoteTemplate": "",
+ "weeklyNoteFolder": "",
+ "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/code-styler/main.js b/obsidian/plugins/code-styler/main.js
new file mode 100644
index 0000000..bfdf0a8
--- /dev/null
+++ b/obsidian/plugins/code-styler/main.js
@@ -0,0 +1,20047 @@
+/*
+THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
+if you want to view the source, please visit the github repository of this plugin
+*/
+
+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 __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
+var __commonJS = (cb, mod) => function __require() {
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __export = (target, all3) => {
+ for (var name in all3)
+ __defProp(target, name, { get: all3[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key2 of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key2) && key2 !== except)
+ __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || 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);
+var __publicField = (obj, key2, value) => {
+ __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
+ return value;
+};
+
+// node_modules/@simonwep/pickr/dist/pickr.min.js
+var require_pickr_min = __commonJS({
+ "node_modules/@simonwep/pickr/dist/pickr.min.js"(exports, module2) {
+ !function(t2, e2) {
+ "object" == typeof exports && "object" == typeof module2 ? module2.exports = e2() : "function" == typeof define && define.amd ? define([], e2) : "object" == typeof exports ? exports.Pickr = e2() : t2.Pickr = e2();
+ }(self, () => (() => {
+ "use strict";
+ var t2 = { d: (e3, o3) => {
+ for (var n3 in o3)
+ t2.o(o3, n3) && !t2.o(e3, n3) && Object.defineProperty(e3, n3, { enumerable: true, get: o3[n3] });
+ }, o: (t3, e3) => Object.prototype.hasOwnProperty.call(t3, e3), r: (t3) => {
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t3, "__esModule", { value: true });
+ } }, e2 = {};
+ t2.d(e2, { default: () => E2 });
+ var o2 = {};
+ function n2(t3, e3, o3, n3, i3 = {}) {
+ e3 instanceof HTMLCollection || e3 instanceof NodeList ? e3 = Array.from(e3) : Array.isArray(e3) || (e3 = [e3]), Array.isArray(o3) || (o3 = [o3]);
+ for (const s4 of e3)
+ for (const e4 of o3)
+ s4[t3](e4, n3, { capture: false, ...i3 });
+ return Array.prototype.slice.call(arguments, 1);
+ }
+ t2.r(o2), t2.d(o2, { adjustableInputNumbers: () => p3, createElementFromString: () => r2, createFromTemplate: () => a2, eventPath: () => l2, off: () => s3, on: () => i2, resolveElement: () => c2 });
+ const i2 = n2.bind(null, "addEventListener"), s3 = n2.bind(null, "removeEventListener");
+ function r2(t3) {
+ const e3 = document.createElement("div");
+ return e3.innerHTML = t3.trim(), e3.firstElementChild;
+ }
+ function a2(t3) {
+ const e3 = (t4, e4) => {
+ const o4 = t4.getAttribute(e4);
+ return t4.removeAttribute(e4), o4;
+ }, o3 = (t4, n3 = {}) => {
+ const i3 = e3(t4, ":obj"), s4 = e3(t4, ":ref"), r3 = i3 ? n3[i3] = {} : n3;
+ s4 && (n3[s4] = t4);
+ for (const n4 of Array.from(t4.children)) {
+ const t5 = e3(n4, ":arr"), i4 = o3(n4, t5 ? {} : r3);
+ t5 && (r3[t5] || (r3[t5] = [])).push(Object.keys(i4).length ? i4 : n4);
+ }
+ return n3;
+ };
+ return o3(r2(t3));
+ }
+ function l2(t3) {
+ let e3 = t3.path || t3.composedPath && t3.composedPath();
+ if (e3)
+ return e3;
+ let o3 = t3.target.parentElement;
+ for (e3 = [t3.target, o3]; o3 = o3.parentElement; )
+ e3.push(o3);
+ return e3.push(document, window), e3;
+ }
+ function c2(t3) {
+ return t3 instanceof Element ? t3 : "string" == typeof t3 ? t3.split(/>>/g).reduce((t4, e3, o3, n3) => (t4 = t4.querySelector(e3), o3 < n3.length - 1 ? t4.shadowRoot : t4), document) : null;
+ }
+ function p3(t3, e3 = (t4) => t4) {
+ function o3(o4) {
+ const n3 = [1e-3, 0.01, 0.1][Number(o4.shiftKey || 2 * o4.ctrlKey)] * (o4.deltaY < 0 ? 1 : -1);
+ let i3 = 0, s4 = t3.selectionStart;
+ t3.value = t3.value.replace(/[\d.]+/g, (t4, o5) => o5 <= s4 && o5 + t4.length >= s4 ? (s4 = o5, e3(Number(t4), n3, i3)) : (i3++, t4)), t3.focus(), t3.setSelectionRange(s4, s4), o4.preventDefault(), t3.dispatchEvent(new Event("input"));
+ }
+ i2(t3, "focus", () => i2(window, "wheel", o3, { passive: false })), i2(t3, "blur", () => s3(window, "wheel", o3));
+ }
+ const { min: u2, max: h3, floor: d2, round: m2 } = Math;
+ function f2(t3, e3, o3) {
+ e3 /= 100, o3 /= 100;
+ const n3 = d2(t3 = t3 / 360 * 6), i3 = t3 - n3, s4 = o3 * (1 - e3), r3 = o3 * (1 - i3 * e3), a3 = o3 * (1 - (1 - i3) * e3), l3 = n3 % 6;
+ return [255 * [o3, r3, s4, s4, a3, o3][l3], 255 * [a3, o3, o3, r3, s4, s4][l3], 255 * [s4, s4, a3, o3, o3, r3][l3]];
+ }
+ function v2(t3, e3, o3) {
+ const n3 = (2 - (e3 /= 100)) * (o3 /= 100) / 2;
+ return 0 !== n3 && (e3 = 1 === n3 ? 0 : n3 < 0.5 ? e3 * o3 / (2 * n3) : e3 * o3 / (2 - 2 * n3)), [t3, 100 * e3, 100 * n3];
+ }
+ function b2(t3, e3, o3) {
+ const n3 = u2(t3 /= 255, e3 /= 255, o3 /= 255), i3 = h3(t3, e3, o3), s4 = i3 - n3;
+ let r3, a3;
+ if (0 === s4)
+ r3 = a3 = 0;
+ else {
+ a3 = s4 / i3;
+ const n4 = ((i3 - t3) / 6 + s4 / 2) / s4, l3 = ((i3 - e3) / 6 + s4 / 2) / s4, c3 = ((i3 - o3) / 6 + s4 / 2) / s4;
+ t3 === i3 ? r3 = c3 - l3 : e3 === i3 ? r3 = 1 / 3 + n4 - c3 : o3 === i3 && (r3 = 2 / 3 + l3 - n4), r3 < 0 ? r3 += 1 : r3 > 1 && (r3 -= 1);
+ }
+ return [360 * r3, 100 * a3, 100 * i3];
+ }
+ function y2(t3, e3, o3, n3) {
+ e3 /= 100, o3 /= 100;
+ return [...b2(255 * (1 - u2(1, (t3 /= 100) * (1 - (n3 /= 100)) + n3)), 255 * (1 - u2(1, e3 * (1 - n3) + n3)), 255 * (1 - u2(1, o3 * (1 - n3) + n3)))];
+ }
+ function g2(t3, e3, o3) {
+ e3 /= 100;
+ const n3 = 2 * (e3 *= (o3 /= 100) < 0.5 ? o3 : 1 - o3) / (o3 + e3) * 100, i3 = 100 * (o3 + e3);
+ return [t3, isNaN(n3) ? 0 : n3, i3];
+ }
+ function _2(t3) {
+ return b2(...t3.match(/.{2}/g).map((t4) => parseInt(t4, 16)));
+ }
+ function w2(t3) {
+ t3 = t3.match(/^[a-zA-Z]+$/) ? function(t4) {
+ if ("black" === t4.toLowerCase())
+ return "#000";
+ const e4 = document.createElement("canvas").getContext("2d");
+ return e4.fillStyle = t4, "#000" === e4.fillStyle ? null : e4.fillStyle;
+ }(t3) : t3;
+ const e3 = { cmyk: /^cmyk\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)/i, rgba: /^rgba?\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D*?(([\d.]+)(%?)|$)/i, hsla: /^hsla?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i, hsva: /^hsva?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i, hexa: /^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i }, o3 = (t4) => t4.map((t5) => /^(|\d+)\.\d+|\d+$/.test(t5) ? Number(t5) : void 0);
+ let n3;
+ t:
+ for (const i3 in e3)
+ if (n3 = e3[i3].exec(t3))
+ switch (i3) {
+ case "cmyk": {
+ const [, t4, e4, s4, r3] = o3(n3);
+ if (t4 > 100 || e4 > 100 || s4 > 100 || r3 > 100)
+ break t;
+ return { values: y2(t4, e4, s4, r3), type: i3 };
+ }
+ case "rgba": {
+ let [, t4, , e4, , s4, , , r3] = o3(n3);
+ if (t4 = "%" === n3[2] ? t4 / 100 * 255 : t4, e4 = "%" === n3[4] ? e4 / 100 * 255 : e4, s4 = "%" === n3[6] ? s4 / 100 * 255 : s4, r3 = "%" === n3[9] ? r3 / 100 : r3, t4 > 255 || e4 > 255 || s4 > 255 || r3 < 0 || r3 > 1)
+ break t;
+ return { values: [...b2(t4, e4, s4), r3], a: r3, type: i3 };
+ }
+ case "hexa": {
+ let [, t4] = n3;
+ 4 !== t4.length && 3 !== t4.length || (t4 = t4.split("").map((t5) => t5 + t5).join(""));
+ const e4 = t4.substring(0, 6);
+ let o4 = t4.substring(6);
+ return o4 = o4 ? parseInt(o4, 16) / 255 : void 0, { values: [..._2(e4), o4], a: o4, type: i3 };
+ }
+ case "hsla": {
+ let [, t4, e4, s4, , r3] = o3(n3);
+ if (r3 = "%" === n3[6] ? r3 / 100 : r3, t4 > 360 || e4 > 100 || s4 > 100 || r3 < 0 || r3 > 1)
+ break t;
+ return { values: [...g2(t4, e4, s4), r3], a: r3, type: i3 };
+ }
+ case "hsva": {
+ let [, t4, e4, s4, , r3] = o3(n3);
+ if (r3 = "%" === n3[6] ? r3 / 100 : r3, t4 > 360 || e4 > 100 || s4 > 100 || r3 < 0 || r3 > 1)
+ break t;
+ return { values: [t4, e4, s4, r3], a: r3, type: i3 };
+ }
+ }
+ return { values: null, type: null };
+ }
+ function A2(t3 = 0, e3 = 0, o3 = 0, n3 = 1) {
+ const i3 = (t4, e4) => (o4 = -1) => e4(~o4 ? t4.map((t5) => Number(t5.toFixed(o4))) : t4), s4 = { h: t3, s: e3, v: o3, a: n3, toHSVA() {
+ const t4 = [s4.h, s4.s, s4.v, s4.a];
+ return t4.toString = i3(t4, (t5) => `hsva(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s4.a})`), t4;
+ }, toHSLA() {
+ const t4 = [...v2(s4.h, s4.s, s4.v), s4.a];
+ return t4.toString = i3(t4, (t5) => `hsla(${t5[0]}, ${t5[1]}%, ${t5[2]}%, ${s4.a})`), t4;
+ }, toRGBA() {
+ const t4 = [...f2(s4.h, s4.s, s4.v), s4.a];
+ return t4.toString = i3(t4, (t5) => `rgba(${t5[0]}, ${t5[1]}, ${t5[2]}, ${s4.a})`), t4;
+ }, toCMYK() {
+ const t4 = function(t5, e4, o4) {
+ const n4 = f2(t5, e4, o4), i4 = n4[0] / 255, s5 = n4[1] / 255, r3 = n4[2] / 255, a3 = u2(1 - i4, 1 - s5, 1 - r3);
+ return [100 * (1 === a3 ? 0 : (1 - i4 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - s5 - a3) / (1 - a3)), 100 * (1 === a3 ? 0 : (1 - r3 - a3) / (1 - a3)), 100 * a3];
+ }(s4.h, s4.s, s4.v);
+ return t4.toString = i3(t4, (t5) => `cmyk(${t5[0]}%, ${t5[1]}%, ${t5[2]}%, ${t5[3]}%)`), t4;
+ }, toHEXA() {
+ const t4 = function(t5, e5, o4) {
+ return f2(t5, e5, o4).map((t6) => m2(t6).toString(16).padStart(2, "0"));
+ }(s4.h, s4.s, s4.v), e4 = s4.a >= 1 ? "" : Number((255 * s4.a).toFixed(0)).toString(16).toUpperCase().padStart(2, "0");
+ return e4 && t4.push(e4), t4.toString = () => `#${t4.join("").toUpperCase()}`, t4;
+ }, clone: () => A2(s4.h, s4.s, s4.v, s4.a) };
+ return s4;
+ }
+ const $3 = (t3) => Math.max(Math.min(t3, 1), 0);
+ function C2(t3) {
+ const e3 = { options: Object.assign({ lock: null, onchange: () => 0, onstop: () => 0 }, t3), _keyboard(t4) {
+ const { options: o4 } = e3, { type: n4, key: i3 } = t4;
+ if (document.activeElement === o4.wrapper) {
+ const { lock: o5 } = e3.options, s4 = "ArrowUp" === i3, r4 = "ArrowRight" === i3, a3 = "ArrowDown" === i3, l3 = "ArrowLeft" === i3;
+ if ("keydown" === n4 && (s4 || r4 || a3 || l3)) {
+ let n5 = 0, i4 = 0;
+ "v" === o5 ? n5 = s4 || r4 ? 1 : -1 : "h" === o5 ? n5 = s4 || r4 ? -1 : 1 : (i4 = s4 ? -1 : a3 ? 1 : 0, n5 = l3 ? -1 : r4 ? 1 : 0), e3.update($3(e3.cache.x + 0.01 * n5), $3(e3.cache.y + 0.01 * i4)), t4.preventDefault();
+ } else
+ i3.startsWith("Arrow") && (e3.options.onstop(), t4.preventDefault());
+ }
+ }, _tapstart(t4) {
+ i2(document, ["mouseup", "touchend", "touchcancel"], e3._tapstop), i2(document, ["mousemove", "touchmove"], e3._tapmove), t4.cancelable && t4.preventDefault(), e3._tapmove(t4);
+ }, _tapmove(t4) {
+ const { options: o4, cache: n4 } = e3, { lock: i3, element: s4, wrapper: r4 } = o4, a3 = r4.getBoundingClientRect();
+ let l3 = 0, c3 = 0;
+ if (t4) {
+ const e4 = t4 && t4.touches && t4.touches[0];
+ l3 = t4 ? (e4 || t4).clientX : 0, c3 = t4 ? (e4 || t4).clientY : 0, l3 < a3.left ? l3 = a3.left : l3 > a3.left + a3.width && (l3 = a3.left + a3.width), c3 < a3.top ? c3 = a3.top : c3 > a3.top + a3.height && (c3 = a3.top + a3.height), l3 -= a3.left, c3 -= a3.top;
+ } else
+ n4 && (l3 = n4.x * a3.width, c3 = n4.y * a3.height);
+ "h" !== i3 && (s4.style.left = `calc(${l3 / a3.width * 100}% - ${s4.offsetWidth / 2}px)`), "v" !== i3 && (s4.style.top = `calc(${c3 / a3.height * 100}% - ${s4.offsetHeight / 2}px)`), e3.cache = { x: l3 / a3.width, y: c3 / a3.height };
+ const p4 = $3(l3 / a3.width), u3 = $3(c3 / a3.height);
+ switch (i3) {
+ case "v":
+ return o4.onchange(p4);
+ case "h":
+ return o4.onchange(u3);
+ default:
+ return o4.onchange(p4, u3);
+ }
+ }, _tapstop() {
+ e3.options.onstop(), s3(document, ["mouseup", "touchend", "touchcancel"], e3._tapstop), s3(document, ["mousemove", "touchmove"], e3._tapmove);
+ }, trigger() {
+ e3._tapmove();
+ }, update(t4 = 0, o4 = 0) {
+ const { left: n4, top: i3, width: s4, height: r4 } = e3.options.wrapper.getBoundingClientRect();
+ "h" === e3.options.lock && (o4 = t4), e3._tapmove({ clientX: n4 + s4 * t4, clientY: i3 + r4 * o4 });
+ }, destroy() {
+ const { options: t4, _tapstart: o4, _keyboard: n4 } = e3;
+ s3(document, ["keydown", "keyup"], n4), s3([t4.wrapper, t4.element], "mousedown", o4), s3([t4.wrapper, t4.element], "touchstart", o4, { passive: false });
+ } }, { options: o3, _tapstart: n3, _keyboard: r3 } = e3;
+ return i2([o3.wrapper, o3.element], "mousedown", n3), i2([o3.wrapper, o3.element], "touchstart", n3, { passive: false }), i2(document, ["keydown", "keyup"], r3), e3;
+ }
+ function k2(t3 = {}) {
+ t3 = Object.assign({ onchange: () => 0, className: "", elements: [] }, t3);
+ const e3 = i2(t3.elements, "click", (e4) => {
+ t3.elements.forEach((o3) => o3.classList[e4.target === o3 ? "add" : "remove"](t3.className)), t3.onchange(e4), e4.stopPropagation();
+ });
+ return { destroy: () => s3(...e3) };
+ }
+ const S2 = { variantFlipOrder: { start: "sme", middle: "mse", end: "ems" }, positionFlipOrder: { top: "tbrl", right: "rltb", bottom: "btrl", left: "lrbt" }, position: "bottom", margin: 8, padding: 0 }, O2 = (t3, e3, o3) => {
+ const n3 = "object" != typeof t3 || t3 instanceof HTMLElement ? { reference: t3, popper: e3, ...o3 } : t3;
+ return { update(t4 = n3) {
+ const { reference: e4, popper: o4 } = Object.assign(n3, t4);
+ if (!o4 || !e4)
+ throw new Error("Popper- or reference-element missing.");
+ return ((t5, e5, o5) => {
+ const { container: n4, arrow: i3, margin: s4, padding: r3, position: a3, variantFlipOrder: l3, positionFlipOrder: c3 } = { container: document.documentElement.getBoundingClientRect(), ...S2, ...o5 }, { left: p4, top: u3 } = e5.style;
+ e5.style.left = "0", e5.style.top = "0";
+ const h4 = t5.getBoundingClientRect(), d3 = e5.getBoundingClientRect(), m3 = { t: h4.top - d3.height - s4, b: h4.bottom + s4, r: h4.right + s4, l: h4.left - d3.width - s4 }, f3 = { vs: h4.left, vm: h4.left + h4.width / 2 - d3.width / 2, ve: h4.left + h4.width - d3.width, hs: h4.top, hm: h4.bottom - h4.height / 2 - d3.height / 2, he: h4.bottom - d3.height }, [v3, b3 = "middle"] = a3.split("-"), y3 = c3[v3], g3 = l3[b3], { top: _3, left: w3, bottom: A3, right: $4 } = n4;
+ for (const t6 of y3) {
+ const o6 = "t" === t6 || "b" === t6;
+ let n5 = m3[t6];
+ const [s5, a4] = o6 ? ["top", "left"] : ["left", "top"], [l4, c4] = o6 ? [d3.height, d3.width] : [d3.width, d3.height], [p5, u4] = o6 ? [A3, $4] : [$4, A3], [v4, b4] = o6 ? [_3, w3] : [w3, _3];
+ if (!(n5 < v4 || n5 + l4 + r3 > p5))
+ for (const p6 of g3) {
+ let m4 = f3[(o6 ? "v" : "h") + p6];
+ if (!(m4 < b4 || m4 + c4 + r3 > u4)) {
+ if (m4 -= d3[a4], n5 -= d3[s5], e5.style[a4] = `${m4}px`, e5.style[s5] = `${n5}px`, i3) {
+ const t7 = o6 ? h4.width / 2 : h4.height / 2, e6 = 2 * t7 < c4 ? h4[a4] + t7 : m4 + c4 / 2;
+ n5 < h4[s5] && (n5 += l4), i3.style[a4] = `${e6}px`, i3.style[s5] = `${n5}px`;
+ }
+ return t6 + p6;
+ }
+ }
+ }
+ return e5.style.left = p4, e5.style.top = u3, null;
+ })(e4, o4, n3);
+ } };
+ };
+ const _E = class _E {
+ constructor(t3) {
+ __publicField(this, "_initializingActive", true);
+ __publicField(this, "_recalc", true);
+ __publicField(this, "_nanopop", null);
+ __publicField(this, "_root", null);
+ __publicField(this, "_color", A2());
+ __publicField(this, "_lastColor", A2());
+ __publicField(this, "_swatchColors", []);
+ __publicField(this, "_setupAnimationFrame", null);
+ __publicField(this, "_eventListener", { init: [], save: [], hide: [], show: [], clear: [], change: [], changestop: [], cancel: [], swatchselect: [] });
+ this.options = t3 = Object.assign({ ..._E.DEFAULT_OPTIONS }, t3);
+ const { swatches: e3, components: o3, theme: n3, sliders: i3, lockOpacity: s4, padding: r3 } = t3;
+ ["nano", "monolith"].includes(n3) && !i3 && (t3.sliders = "h"), o3.interaction || (o3.interaction = {});
+ const { preview: a3, opacity: l3, hue: c3, palette: p4 } = o3;
+ o3.opacity = !s4 && l3, o3.palette = p4 || a3 || l3 || c3, this._preBuild(), this._buildComponents(), this._bindEvents(), this._finalBuild(), e3 && e3.length && e3.forEach((t4) => this.addSwatch(t4));
+ const { button: u3, app: h4 } = this._root;
+ this._nanopop = O2(u3, h4, { margin: r3 }), u3.setAttribute("role", "button"), u3.setAttribute("aria-label", this._t("btn:toggle"));
+ const d3 = this;
+ this._setupAnimationFrame = requestAnimationFrame(function e4() {
+ if (!h4.offsetWidth)
+ return requestAnimationFrame(e4);
+ d3.setColor(t3.default), d3._rePositioningPicker(), t3.defaultRepresentation && (d3._representation = t3.defaultRepresentation, d3.setColorRepresentation(d3._representation)), t3.showAlways && d3.show(), d3._initializingActive = false, d3._emit("init");
+ });
+ }
+ _preBuild() {
+ const { options: t3 } = this;
+ for (const e3 of ["el", "container"])
+ t3[e3] = c2(t3[e3]);
+ this._root = ((t4) => {
+ const { components: e3, useAsButton: o3, inline: n3, appClass: i3, theme: s4, lockOpacity: r3 } = t4.options, l3 = (t5) => t5 ? "" : 'style="display:none" hidden', c3 = (e4) => t4._t(e4), p4 = a2(`
+
+
+ ${o3 ? "" : '
'}
+
+
+
+ `), u3 = p4.interaction;
+ return u3.options.find((t5) => !t5.hidden && !t5.classList.add("active")), u3.type = () => u3.options.find((t5) => t5.classList.contains("active")), p4;
+ })(this), t3.useAsButton && (this._root.button = t3.el), t3.container.appendChild(this._root.root);
+ }
+ _finalBuild() {
+ const t3 = this.options, e3 = this._root;
+ if (t3.container.removeChild(e3.root), t3.inline) {
+ const o3 = t3.el.parentElement;
+ t3.el.nextSibling ? o3.insertBefore(e3.app, t3.el.nextSibling) : o3.appendChild(e3.app);
+ } else
+ t3.container.appendChild(e3.app);
+ t3.useAsButton ? t3.inline && t3.el.remove() : t3.el.parentNode.replaceChild(e3.root, t3.el), t3.disabled && this.disable(), t3.comparison || (e3.button.style.transition = "none", t3.useAsButton || (e3.preview.lastColor.style.transition = "none")), this.hide();
+ }
+ _buildComponents() {
+ const t3 = this, e3 = this.options.components, o3 = (t3.options.sliders || "v").repeat(2), [n3, i3] = o3.match(/^[vh]+$/g) ? o3 : [], s4 = () => this._color || (this._color = this._lastColor.clone()), r3 = { palette: C2({ element: t3._root.palette.picker, wrapper: t3._root.palette.palette, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4, n4) {
+ if (!e3.palette)
+ return;
+ const i4 = s4(), { _root: r4, options: a3 } = t3, { lastColor: l3, currentColor: c3 } = r4.preview;
+ t3._recalc && (i4.s = 100 * o4, i4.v = 100 - 100 * n4, i4.v < 0 && (i4.v = 0), t3._updateOutput("slider"));
+ const p4 = i4.toRGBA().toString(0);
+ this.element.style.background = p4, this.wrapper.style.background = `
+ linear-gradient(to top, rgba(0, 0, 0, ${i4.a}), transparent),
+ linear-gradient(to left, hsla(${i4.h}, 100%, 50%, ${i4.a}), rgba(255, 255, 255, ${i4.a}))
+ `, a3.comparison ? a3.useAsButton || t3._lastColor || l3.style.setProperty("--pcr-color", p4) : (r4.button.style.setProperty("--pcr-color", p4), r4.button.classList.remove("clear"));
+ const u3 = i4.toHEXA().toString();
+ for (const { el: e4, color: o5 } of t3._swatchColors)
+ e4.classList[u3 === o5.toHEXA().toString() ? "add" : "remove"]("pcr-active");
+ c3.style.setProperty("--pcr-color", p4);
+ } }), hue: C2({ lock: "v" === i3 ? "h" : "v", element: t3._root.hue.picker, wrapper: t3._root.hue.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) {
+ if (!e3.hue || !e3.palette)
+ return;
+ const n4 = s4();
+ t3._recalc && (n4.h = 360 * o4), this.element.style.backgroundColor = `hsl(${n4.h}, 100%, 50%)`, r3.palette.trigger();
+ } }), opacity: C2({ lock: "v" === n3 ? "h" : "v", element: t3._root.opacity.picker, wrapper: t3._root.opacity.slider, onstop: () => t3._emit("changestop", "slider", t3), onchange(o4) {
+ if (!e3.opacity || !e3.palette)
+ return;
+ const n4 = s4();
+ t3._recalc && (n4.a = Math.round(100 * o4) / 100), this.element.style.background = `rgba(0, 0, 0, ${n4.a})`, r3.palette.trigger();
+ } }), selectable: k2({ elements: t3._root.interaction.options, className: "active", onchange(e4) {
+ t3._representation = e4.target.getAttribute("data-type").toUpperCase(), t3._recalc && t3._updateOutput("swatch");
+ } }) };
+ this._components = r3;
+ }
+ _bindEvents() {
+ const { _root: t3, options: e3 } = this, o3 = [i2(t3.interaction.clear, "click", () => this._clearColor()), i2([t3.interaction.cancel, t3.preview.lastColor], "click", () => {
+ this.setHSVA(...(this._lastColor || this._color).toHSVA(), true), this._emit("cancel");
+ }), i2(t3.interaction.save, "click", () => {
+ !this.applyColor() && !e3.showAlways && this.hide();
+ }), i2(t3.interaction.result, ["keyup", "input"], (t4) => {
+ this.setColor(t4.target.value, true) && !this._initializingActive && (this._emit("change", this._color, "input", this), this._emit("changestop", "input", this)), t4.stopImmediatePropagation();
+ }), i2(t3.interaction.result, ["focus", "blur"], (t4) => {
+ this._recalc = "blur" === t4.type, this._recalc && this._updateOutput(null);
+ }), i2([t3.palette.palette, t3.palette.picker, t3.hue.slider, t3.hue.picker, t3.opacity.slider, t3.opacity.picker], ["mousedown", "touchstart"], () => this._recalc = true, { passive: true })];
+ if (!e3.showAlways) {
+ const n3 = e3.closeWithKey;
+ o3.push(i2(t3.button, "click", () => this.isOpen() ? this.hide() : this.show()), i2(document, "keyup", (t4) => this.isOpen() && (t4.key === n3 || t4.code === n3) && this.hide()), i2(document, ["touchstart", "mousedown"], (e4) => {
+ this.isOpen() && !l2(e4).some((e5) => e5 === t3.app || e5 === t3.button) && this.hide();
+ }, { capture: true }));
+ }
+ if (e3.adjustableNumbers) {
+ const e4 = { rgba: [255, 255, 255, 1], hsva: [360, 100, 100, 1], hsla: [360, 100, 100, 1], cmyk: [100, 100, 100, 100] };
+ p3(t3.interaction.result, (t4, o4, n3) => {
+ const i3 = e4[this.getColorRepresentation().toLowerCase()];
+ if (i3) {
+ const e5 = i3[n3], s4 = t4 + (e5 >= 100 ? 1e3 * o4 : o4);
+ return s4 <= 0 ? 0 : Number((s4 < e5 ? s4 : e5).toPrecision(3));
+ }
+ return t4;
+ });
+ }
+ if (e3.autoReposition && !e3.inline) {
+ let t4 = null;
+ const n3 = this;
+ o3.push(i2(window, ["scroll", "resize"], () => {
+ n3.isOpen() && (e3.closeOnScroll && n3.hide(), null === t4 ? (t4 = setTimeout(() => t4 = null, 100), requestAnimationFrame(function e4() {
+ n3._rePositioningPicker(), null !== t4 && requestAnimationFrame(e4);
+ })) : (clearTimeout(t4), t4 = setTimeout(() => t4 = null, 100)));
+ }, { capture: true }));
+ }
+ this._eventBindings = o3;
+ }
+ _rePositioningPicker() {
+ const { options: t3 } = this;
+ if (!t3.inline) {
+ if (!this._nanopop.update({ container: document.body.getBoundingClientRect(), position: t3.position })) {
+ const t4 = this._root.app, e3 = t4.getBoundingClientRect();
+ t4.style.top = (window.innerHeight - e3.height) / 2 + "px", t4.style.left = (window.innerWidth - e3.width) / 2 + "px";
+ }
+ }
+ }
+ _updateOutput(t3) {
+ const { _root: e3, _color: o3, options: n3 } = this;
+ if (e3.interaction.type()) {
+ const t4 = `to${e3.interaction.type().getAttribute("data-type")}`;
+ e3.interaction.result.value = "function" == typeof o3[t4] ? o3[t4]().toString(n3.outputPrecision) : "";
+ }
+ !this._initializingActive && this._recalc && this._emit("change", o3, t3, this);
+ }
+ _clearColor(t3 = false) {
+ const { _root: e3, options: o3 } = this;
+ o3.useAsButton || e3.button.style.setProperty("--pcr-color", "rgba(0, 0, 0, 0.15)"), e3.button.classList.add("clear"), o3.showAlways || this.hide(), this._lastColor = null, this._initializingActive || t3 || (this._emit("save", null), this._emit("clear"));
+ }
+ _parseLocalColor(t3) {
+ const { values: e3, type: o3, a: n3 } = w2(t3), { lockOpacity: i3 } = this.options, s4 = void 0 !== n3 && 1 !== n3;
+ return e3 && 3 === e3.length && (e3[3] = void 0), { values: !e3 || i3 && s4 ? null : e3, type: o3 };
+ }
+ _t(t3) {
+ return this.options.i18n[t3] || _E.I18N_DEFAULTS[t3];
+ }
+ _emit(t3, ...e3) {
+ this._eventListener[t3].forEach((t4) => t4(...e3, this));
+ }
+ on(t3, e3) {
+ return this._eventListener[t3].push(e3), this;
+ }
+ off(t3, e3) {
+ const o3 = this._eventListener[t3] || [], n3 = o3.indexOf(e3);
+ return ~n3 && o3.splice(n3, 1), this;
+ }
+ addSwatch(t3) {
+ const { values: e3 } = this._parseLocalColor(t3);
+ if (e3) {
+ const { _swatchColors: t4, _root: o3 } = this, n3 = A2(...e3), s4 = r2(``);
+ return o3.swatches.appendChild(s4), t4.push({ el: s4, color: n3 }), this._eventBindings.push(i2(s4, "click", () => {
+ this.setHSVA(...n3.toHSVA(), true), this._emit("swatchselect", n3), this._emit("change", n3, "swatch", this);
+ })), true;
+ }
+ return false;
+ }
+ removeSwatch(t3) {
+ const e3 = this._swatchColors[t3];
+ if (e3) {
+ const { el: o3 } = e3;
+ return this._root.swatches.removeChild(o3), this._swatchColors.splice(t3, 1), true;
+ }
+ return false;
+ }
+ applyColor(t3 = false) {
+ const { preview: e3, button: o3 } = this._root, n3 = this._color.toRGBA().toString(0);
+ return e3.lastColor.style.setProperty("--pcr-color", n3), this.options.useAsButton || o3.style.setProperty("--pcr-color", n3), o3.classList.remove("clear"), this._lastColor = this._color.clone(), this._initializingActive || t3 || this._emit("save", this._color), this;
+ }
+ destroy() {
+ cancelAnimationFrame(this._setupAnimationFrame), this._eventBindings.forEach((t3) => s3(...t3)), Object.keys(this._components).forEach((t3) => this._components[t3].destroy());
+ }
+ destroyAndRemove() {
+ this.destroy();
+ const { root: t3, app: e3 } = this._root;
+ t3.parentElement && t3.parentElement.removeChild(t3), e3.parentElement.removeChild(e3), Object.keys(this).forEach((t4) => this[t4] = null);
+ }
+ hide() {
+ return !!this.isOpen() && (this._root.app.classList.remove("visible"), this._emit("hide"), true);
+ }
+ show() {
+ return !this.options.disabled && !this.isOpen() && (this._root.app.classList.add("visible"), this._rePositioningPicker(), this._emit("show", this._color), this);
+ }
+ isOpen() {
+ return this._root.app.classList.contains("visible");
+ }
+ setHSVA(t3 = 360, e3 = 0, o3 = 0, n3 = 1, i3 = false) {
+ const s4 = this._recalc;
+ if (this._recalc = false, t3 < 0 || t3 > 360 || e3 < 0 || e3 > 100 || o3 < 0 || o3 > 100 || n3 < 0 || n3 > 1)
+ return false;
+ this._color = A2(t3, e3, o3, n3);
+ const { hue: r3, opacity: a3, palette: l3 } = this._components;
+ return r3.update(t3 / 360), a3.update(n3), l3.update(e3 / 100, 1 - o3 / 100), i3 || this.applyColor(), s4 && this._updateOutput(), this._recalc = s4, true;
+ }
+ setColor(t3, e3 = false) {
+ if (null === t3)
+ return this._clearColor(e3), true;
+ const { values: o3, type: n3 } = this._parseLocalColor(t3);
+ if (o3) {
+ const t4 = n3.toUpperCase(), { options: i3 } = this._root.interaction, s4 = i3.find((e4) => e4.getAttribute("data-type") === t4);
+ if (s4 && !s4.hidden)
+ for (const t5 of i3)
+ t5.classList[t5 === s4 ? "add" : "remove"]("active");
+ return !!this.setHSVA(...o3, e3) && this.setColorRepresentation(t4);
+ }
+ return false;
+ }
+ setColorRepresentation(t3) {
+ return t3 = t3.toUpperCase(), !!this._root.interaction.options.find((e3) => e3.getAttribute("data-type").startsWith(t3) && !e3.click());
+ }
+ getColorRepresentation() {
+ return this._representation;
+ }
+ getColor() {
+ return this._color;
+ }
+ getSelectedColor() {
+ return this._lastColor;
+ }
+ getRoot() {
+ return this._root;
+ }
+ disable() {
+ return this.hide(), this.options.disabled = true, this._root.button.classList.add("disabled"), this;
+ }
+ enable() {
+ return this.options.disabled = false, this._root.button.classList.remove("disabled"), this;
+ }
+ };
+ __publicField(_E, "utils", o2);
+ __publicField(_E, "version", "1.9.0");
+ __publicField(_E, "I18N_DEFAULTS", { "ui:dialog": "color picker dialog", "btn:toggle": "toggle color picker dialog", "btn:swatch": "color swatch", "btn:last-color": "use previous color", "btn:save": "Save", "btn:cancel": "Cancel", "btn:clear": "Clear", "aria:btn:save": "save and close", "aria:btn:cancel": "cancel and close", "aria:btn:clear": "clear and close", "aria:input": "color input field", "aria:palette": "color selection area", "aria:hue": "hue selection slider", "aria:opacity": "selection slider" });
+ __publicField(_E, "DEFAULT_OPTIONS", { appClass: null, theme: "classic", useAsButton: false, padding: 8, disabled: false, comparison: true, closeOnScroll: false, outputPrecision: 0, lockOpacity: false, autoReposition: true, container: "body", components: { interaction: {} }, i18n: {}, swatches: null, inline: false, sliders: null, default: "#42445a", defaultRepresentation: null, position: "bottom-middle", adjustableNumbers: true, showAlways: false, closeWithKey: "Escape" });
+ __publicField(_E, "create", (t3) => new _E(t3));
+ let E2 = _E;
+ return e2 = e2.default;
+ })());
+ }
+});
+
+// node_modules/json5/dist/index.js
+var require_dist = __commonJS({
+ "node_modules/json5/dist/index.js"(exports, module2) {
+ (function(global, factory) {
+ typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.JSON5 = factory();
+ })(exports, function() {
+ "use strict";
+ function createCommonjsModule(fn, module3) {
+ return module3 = { exports: {} }, fn(module3, module3.exports), module3.exports;
+ }
+ var _global = createCommonjsModule(function(module3) {
+ var global = module3.exports = typeof window != "undefined" && window.Math == Math ? window : typeof self != "undefined" && self.Math == Math ? self : Function("return this")();
+ if (typeof __g == "number") {
+ __g = global;
+ }
+ });
+ var _core = createCommonjsModule(function(module3) {
+ var core2 = module3.exports = { version: "2.6.5" };
+ if (typeof __e == "number") {
+ __e = core2;
+ }
+ });
+ var _core_1 = _core.version;
+ var _isObject = function(it2) {
+ return typeof it2 === "object" ? it2 !== null : typeof it2 === "function";
+ };
+ var _anObject = function(it2) {
+ if (!_isObject(it2)) {
+ throw TypeError(it2 + " is not an object!");
+ }
+ return it2;
+ };
+ var _fails = function(exec) {
+ try {
+ return !!exec();
+ } catch (e2) {
+ return true;
+ }
+ };
+ var _descriptors = !_fails(function() {
+ return Object.defineProperty({}, "a", { get: function() {
+ return 7;
+ } }).a != 7;
+ });
+ var document2 = _global.document;
+ var is2 = _isObject(document2) && _isObject(document2.createElement);
+ var _domCreate = function(it2) {
+ return is2 ? document2.createElement(it2) : {};
+ };
+ var _ie8DomDefine = !_descriptors && !_fails(function() {
+ return Object.defineProperty(_domCreate("div"), "a", { get: function() {
+ return 7;
+ } }).a != 7;
+ });
+ var _toPrimitive = function(it2, S2) {
+ if (!_isObject(it2)) {
+ return it2;
+ }
+ var fn, val;
+ if (S2 && typeof (fn = it2.toString) == "function" && !_isObject(val = fn.call(it2))) {
+ return val;
+ }
+ if (typeof (fn = it2.valueOf) == "function" && !_isObject(val = fn.call(it2))) {
+ return val;
+ }
+ if (!S2 && typeof (fn = it2.toString) == "function" && !_isObject(val = fn.call(it2))) {
+ return val;
+ }
+ throw TypeError("Can't convert object to primitive value");
+ };
+ var dP = Object.defineProperty;
+ var f2 = _descriptors ? Object.defineProperty : function defineProperty(O2, P2, Attributes) {
+ _anObject(O2);
+ P2 = _toPrimitive(P2, true);
+ _anObject(Attributes);
+ if (_ie8DomDefine) {
+ try {
+ return dP(O2, P2, Attributes);
+ } catch (e2) {
+ }
+ }
+ if ("get" in Attributes || "set" in Attributes) {
+ throw TypeError("Accessors not supported!");
+ }
+ if ("value" in Attributes) {
+ O2[P2] = Attributes.value;
+ }
+ return O2;
+ };
+ var _objectDp = {
+ f: f2
+ };
+ var _propertyDesc = function(bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value
+ };
+ };
+ var _hide = _descriptors ? function(object, key3, value) {
+ return _objectDp.f(object, key3, _propertyDesc(1, value));
+ } : function(object, key3, value) {
+ object[key3] = value;
+ return object;
+ };
+ var hasOwnProperty = {}.hasOwnProperty;
+ var _has = function(it2, key3) {
+ return hasOwnProperty.call(it2, key3);
+ };
+ var id = 0;
+ var px = Math.random();
+ var _uid = function(key3) {
+ return "Symbol(".concat(key3 === void 0 ? "" : key3, ")_", (++id + px).toString(36));
+ };
+ var _library = false;
+ var _shared = createCommonjsModule(function(module3) {
+ var SHARED = "__core-js_shared__";
+ var store = _global[SHARED] || (_global[SHARED] = {});
+ (module3.exports = function(key3, value) {
+ return store[key3] || (store[key3] = value !== void 0 ? value : {});
+ })("versions", []).push({
+ version: _core.version,
+ mode: _library ? "pure" : "global",
+ copyright: "\xA9 2019 Denis Pushkarev (zloirock.ru)"
+ });
+ });
+ var _functionToString = _shared("native-function-to-string", Function.toString);
+ var _redefine = createCommonjsModule(function(module3) {
+ var SRC = _uid("src");
+ var TO_STRING = "toString";
+ var TPL = ("" + _functionToString).split(TO_STRING);
+ _core.inspectSource = function(it2) {
+ return _functionToString.call(it2);
+ };
+ (module3.exports = function(O2, key3, val, safe) {
+ var isFunction = typeof val == "function";
+ if (isFunction) {
+ _has(val, "name") || _hide(val, "name", key3);
+ }
+ if (O2[key3] === val) {
+ return;
+ }
+ if (isFunction) {
+ _has(val, SRC) || _hide(val, SRC, O2[key3] ? "" + O2[key3] : TPL.join(String(key3)));
+ }
+ if (O2 === _global) {
+ O2[key3] = val;
+ } else if (!safe) {
+ delete O2[key3];
+ _hide(O2, key3, val);
+ } else if (O2[key3]) {
+ O2[key3] = val;
+ } else {
+ _hide(O2, key3, val);
+ }
+ })(Function.prototype, TO_STRING, function toString() {
+ return typeof this == "function" && this[SRC] || _functionToString.call(this);
+ });
+ });
+ var _aFunction = function(it2) {
+ if (typeof it2 != "function") {
+ throw TypeError(it2 + " is not a function!");
+ }
+ return it2;
+ };
+ var _ctx = function(fn, that, length) {
+ _aFunction(fn);
+ if (that === void 0) {
+ return fn;
+ }
+ switch (length) {
+ case 1:
+ return function(a2) {
+ return fn.call(that, a2);
+ };
+ case 2:
+ return function(a2, b2) {
+ return fn.call(that, a2, b2);
+ };
+ case 3:
+ return function(a2, b2, c3) {
+ return fn.call(that, a2, b2, c3);
+ };
+ }
+ return function() {
+ return fn.apply(that, arguments);
+ };
+ };
+ var PROTOTYPE = "prototype";
+ var $export = function(type, name, source2) {
+ var IS_FORCED = type & $export.F;
+ var IS_GLOBAL = type & $export.G;
+ var IS_STATIC = type & $export.S;
+ var IS_PROTO = type & $export.P;
+ var IS_BIND = type & $export.B;
+ var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
+ var exports2 = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
+ var expProto = exports2[PROTOTYPE] || (exports2[PROTOTYPE] = {});
+ var key3, own7, out, exp;
+ if (IS_GLOBAL) {
+ source2 = name;
+ }
+ for (key3 in source2) {
+ own7 = !IS_FORCED && target && target[key3] !== void 0;
+ out = (own7 ? target : source2)[key3];
+ exp = IS_BIND && own7 ? _ctx(out, _global) : IS_PROTO && typeof out == "function" ? _ctx(Function.call, out) : out;
+ if (target) {
+ _redefine(target, key3, out, type & $export.U);
+ }
+ if (exports2[key3] != out) {
+ _hide(exports2, key3, exp);
+ }
+ if (IS_PROTO && expProto[key3] != out) {
+ expProto[key3] = out;
+ }
+ }
+ };
+ _global.core = _core;
+ $export.F = 1;
+ $export.G = 2;
+ $export.S = 4;
+ $export.P = 8;
+ $export.B = 16;
+ $export.W = 32;
+ $export.U = 64;
+ $export.R = 128;
+ var _export = $export;
+ var ceil = Math.ceil;
+ var floor = Math.floor;
+ var _toInteger = function(it2) {
+ return isNaN(it2 = +it2) ? 0 : (it2 > 0 ? floor : ceil)(it2);
+ };
+ var _defined = function(it2) {
+ if (it2 == void 0) {
+ throw TypeError("Can't call method on " + it2);
+ }
+ return it2;
+ };
+ var _stringAt = function(TO_STRING) {
+ return function(that, pos2) {
+ var s3 = String(_defined(that));
+ var i2 = _toInteger(pos2);
+ var l2 = s3.length;
+ var a2, b2;
+ if (i2 < 0 || i2 >= l2) {
+ return TO_STRING ? "" : void 0;
+ }
+ a2 = s3.charCodeAt(i2);
+ return a2 < 55296 || a2 > 56319 || i2 + 1 === l2 || (b2 = s3.charCodeAt(i2 + 1)) < 56320 || b2 > 57343 ? TO_STRING ? s3.charAt(i2) : a2 : TO_STRING ? s3.slice(i2, i2 + 2) : (a2 - 55296 << 10) + (b2 - 56320) + 65536;
+ };
+ };
+ var $at = _stringAt(false);
+ _export(_export.P, "String", {
+ // 21.1.3.3 String.prototype.codePointAt(pos)
+ codePointAt: function codePointAt2(pos2) {
+ return $at(this, pos2);
+ }
+ });
+ var codePointAt = _core.String.codePointAt;
+ var max = Math.max;
+ var min = Math.min;
+ var _toAbsoluteIndex = function(index2, length) {
+ index2 = _toInteger(index2);
+ return index2 < 0 ? max(index2 + length, 0) : min(index2, length);
+ };
+ var fromCharCode = String.fromCharCode;
+ var $fromCodePoint = String.fromCodePoint;
+ _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), "String", {
+ // 21.1.2.2 String.fromCodePoint(...codePoints)
+ fromCodePoint: function fromCodePoint3(x2) {
+ var arguments$1 = arguments;
+ var res = [];
+ var aLen = arguments.length;
+ var i2 = 0;
+ var code;
+ while (aLen > i2) {
+ code = +arguments$1[i2++];
+ if (_toAbsoluteIndex(code, 1114111) !== code) {
+ throw RangeError(code + " is not a valid code point");
+ }
+ res.push(
+ code < 65536 ? fromCharCode(code) : fromCharCode(((code -= 65536) >> 10) + 55296, code % 1024 + 56320)
+ );
+ }
+ return res.join("");
+ }
+ });
+ var fromCodePoint2 = _core.String.fromCodePoint;
+ var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
+ var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\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\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\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\u09FC\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\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\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\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\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\u1C80-\u1C88\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\u2160-\u2188\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\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]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
+ var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\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\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
+ var unicode = {
+ Space_Separator,
+ ID_Start,
+ ID_Continue
+ };
+ var util = {
+ isSpaceSeparator: function isSpaceSeparator(c3) {
+ return typeof c3 === "string" && unicode.Space_Separator.test(c3);
+ },
+ isIdStartChar: function isIdStartChar(c3) {
+ return typeof c3 === "string" && (c3 >= "a" && c3 <= "z" || c3 >= "A" && c3 <= "Z" || c3 === "$" || c3 === "_" || unicode.ID_Start.test(c3));
+ },
+ isIdContinueChar: function isIdContinueChar(c3) {
+ return typeof c3 === "string" && (c3 >= "a" && c3 <= "z" || c3 >= "A" && c3 <= "Z" || c3 >= "0" && c3 <= "9" || c3 === "$" || c3 === "_" || c3 === "\u200C" || c3 === "\u200D" || unicode.ID_Continue.test(c3));
+ },
+ isDigit: function isDigit(c3) {
+ return typeof c3 === "string" && /[0-9]/.test(c3);
+ },
+ isHexDigit: function isHexDigit(c3) {
+ return typeof c3 === "string" && /[0-9A-Fa-f]/.test(c3);
+ }
+ };
+ var source;
+ var parseState;
+ var stack;
+ var pos;
+ var line;
+ var column;
+ var token;
+ var key2;
+ var root2;
+ var parse5 = function parse6(text2, reviver) {
+ source = String(text2);
+ parseState = "start";
+ stack = [];
+ pos = 0;
+ line = 1;
+ column = 0;
+ token = void 0;
+ key2 = void 0;
+ root2 = void 0;
+ do {
+ token = lex();
+ parseStates[parseState]();
+ } while (token.type !== "eof");
+ if (typeof reviver === "function") {
+ return internalize({ "": root2 }, "", reviver);
+ }
+ return root2;
+ };
+ function internalize(holder, name, reviver) {
+ var value = holder[name];
+ if (value != null && typeof value === "object") {
+ if (Array.isArray(value)) {
+ for (var i2 = 0; i2 < value.length; i2++) {
+ var key3 = String(i2);
+ var replacement = internalize(value, key3, reviver);
+ if (replacement === void 0) {
+ delete value[key3];
+ } else {
+ Object.defineProperty(value, key3, {
+ value: replacement,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ }
+ } else {
+ for (var key$1 in value) {
+ var replacement$1 = internalize(value, key$1, reviver);
+ if (replacement$1 === void 0) {
+ delete value[key$1];
+ } else {
+ Object.defineProperty(value, key$1, {
+ value: replacement$1,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ }
+ }
+ }
+ return reviver.call(holder, name, value);
+ }
+ var lexState;
+ var buffer;
+ var doubleQuote;
+ var sign;
+ var c2;
+ function lex() {
+ lexState = "default";
+ buffer = "";
+ doubleQuote = false;
+ sign = 1;
+ for (; ; ) {
+ c2 = peek();
+ var token2 = lexStates[lexState]();
+ if (token2) {
+ return token2;
+ }
+ }
+ }
+ function peek() {
+ if (source[pos]) {
+ return String.fromCodePoint(source.codePointAt(pos));
+ }
+ }
+ function read() {
+ var c3 = peek();
+ if (c3 === "\n") {
+ line++;
+ column = 0;
+ } else if (c3) {
+ column += c3.length;
+ } else {
+ column++;
+ }
+ if (c3) {
+ pos += c3.length;
+ }
+ return c3;
+ }
+ var lexStates = {
+ default: function default$1() {
+ switch (c2) {
+ case " ":
+ case "\v":
+ case "\f":
+ case " ":
+ case "\xA0":
+ case "\uFEFF":
+ case "\n":
+ case "\r":
+ case "\u2028":
+ case "\u2029":
+ read();
+ return;
+ case "/":
+ read();
+ lexState = "comment";
+ return;
+ case void 0:
+ read();
+ return newToken("eof");
+ }
+ if (util.isSpaceSeparator(c2)) {
+ read();
+ return;
+ }
+ return lexStates[parseState]();
+ },
+ comment: function comment2() {
+ switch (c2) {
+ case "*":
+ read();
+ lexState = "multiLineComment";
+ return;
+ case "/":
+ read();
+ lexState = "singleLineComment";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ multiLineComment: function multiLineComment() {
+ switch (c2) {
+ case "*":
+ read();
+ lexState = "multiLineCommentAsterisk";
+ return;
+ case void 0:
+ throw invalidChar(read());
+ }
+ read();
+ },
+ multiLineCommentAsterisk: function multiLineCommentAsterisk() {
+ switch (c2) {
+ case "*":
+ read();
+ return;
+ case "/":
+ read();
+ lexState = "default";
+ return;
+ case void 0:
+ throw invalidChar(read());
+ }
+ read();
+ lexState = "multiLineComment";
+ },
+ singleLineComment: function singleLineComment() {
+ switch (c2) {
+ case "\n":
+ case "\r":
+ case "\u2028":
+ case "\u2029":
+ read();
+ lexState = "default";
+ return;
+ case void 0:
+ read();
+ return newToken("eof");
+ }
+ read();
+ },
+ value: function value() {
+ switch (c2) {
+ case "{":
+ case "[":
+ return newToken("punctuator", read());
+ case "n":
+ read();
+ literal("ull");
+ return newToken("null", null);
+ case "t":
+ read();
+ literal("rue");
+ return newToken("boolean", true);
+ case "f":
+ read();
+ literal("alse");
+ return newToken("boolean", false);
+ case "-":
+ case "+":
+ if (read() === "-") {
+ sign = -1;
+ }
+ lexState = "sign";
+ return;
+ case ".":
+ buffer = read();
+ lexState = "decimalPointLeading";
+ return;
+ case "0":
+ buffer = read();
+ lexState = "zero";
+ return;
+ case "1":
+ case "2":
+ case "3":
+ case "4":
+ case "5":
+ case "6":
+ case "7":
+ case "8":
+ case "9":
+ buffer = read();
+ lexState = "decimalInteger";
+ return;
+ case "I":
+ read();
+ literal("nfinity");
+ return newToken("numeric", Infinity);
+ case "N":
+ read();
+ literal("aN");
+ return newToken("numeric", NaN);
+ case '"':
+ case "'":
+ doubleQuote = read() === '"';
+ buffer = "";
+ lexState = "string";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ identifierNameStartEscape: function identifierNameStartEscape() {
+ if (c2 !== "u") {
+ throw invalidChar(read());
+ }
+ read();
+ var u2 = unicodeEscape();
+ switch (u2) {
+ case "$":
+ case "_":
+ break;
+ default:
+ if (!util.isIdStartChar(u2)) {
+ throw invalidIdentifier();
+ }
+ break;
+ }
+ buffer += u2;
+ lexState = "identifierName";
+ },
+ identifierName: function identifierName() {
+ switch (c2) {
+ case "$":
+ case "_":
+ case "\u200C":
+ case "\u200D":
+ buffer += read();
+ return;
+ case "\\":
+ read();
+ lexState = "identifierNameEscape";
+ return;
+ }
+ if (util.isIdContinueChar(c2)) {
+ buffer += read();
+ return;
+ }
+ return newToken("identifier", buffer);
+ },
+ identifierNameEscape: function identifierNameEscape() {
+ if (c2 !== "u") {
+ throw invalidChar(read());
+ }
+ read();
+ var u2 = unicodeEscape();
+ switch (u2) {
+ case "$":
+ case "_":
+ case "\u200C":
+ case "\u200D":
+ break;
+ default:
+ if (!util.isIdContinueChar(u2)) {
+ throw invalidIdentifier();
+ }
+ break;
+ }
+ buffer += u2;
+ lexState = "identifierName";
+ },
+ sign: function sign$1() {
+ switch (c2) {
+ case ".":
+ buffer = read();
+ lexState = "decimalPointLeading";
+ return;
+ case "0":
+ buffer = read();
+ lexState = "zero";
+ return;
+ case "1":
+ case "2":
+ case "3":
+ case "4":
+ case "5":
+ case "6":
+ case "7":
+ case "8":
+ case "9":
+ buffer = read();
+ lexState = "decimalInteger";
+ return;
+ case "I":
+ read();
+ literal("nfinity");
+ return newToken("numeric", sign * Infinity);
+ case "N":
+ read();
+ literal("aN");
+ return newToken("numeric", NaN);
+ }
+ throw invalidChar(read());
+ },
+ zero: function zero() {
+ switch (c2) {
+ case ".":
+ buffer += read();
+ lexState = "decimalPoint";
+ return;
+ case "e":
+ case "E":
+ buffer += read();
+ lexState = "decimalExponent";
+ return;
+ case "x":
+ case "X":
+ buffer += read();
+ lexState = "hexadecimal";
+ return;
+ }
+ return newToken("numeric", sign * 0);
+ },
+ decimalInteger: function decimalInteger() {
+ switch (c2) {
+ case ".":
+ buffer += read();
+ lexState = "decimalPoint";
+ return;
+ case "e":
+ case "E":
+ buffer += read();
+ lexState = "decimalExponent";
+ return;
+ }
+ if (util.isDigit(c2)) {
+ buffer += read();
+ return;
+ }
+ return newToken("numeric", sign * Number(buffer));
+ },
+ decimalPointLeading: function decimalPointLeading() {
+ if (util.isDigit(c2)) {
+ buffer += read();
+ lexState = "decimalFraction";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ decimalPoint: function decimalPoint() {
+ switch (c2) {
+ case "e":
+ case "E":
+ buffer += read();
+ lexState = "decimalExponent";
+ return;
+ }
+ if (util.isDigit(c2)) {
+ buffer += read();
+ lexState = "decimalFraction";
+ return;
+ }
+ return newToken("numeric", sign * Number(buffer));
+ },
+ decimalFraction: function decimalFraction() {
+ switch (c2) {
+ case "e":
+ case "E":
+ buffer += read();
+ lexState = "decimalExponent";
+ return;
+ }
+ if (util.isDigit(c2)) {
+ buffer += read();
+ return;
+ }
+ return newToken("numeric", sign * Number(buffer));
+ },
+ decimalExponent: function decimalExponent() {
+ switch (c2) {
+ case "+":
+ case "-":
+ buffer += read();
+ lexState = "decimalExponentSign";
+ return;
+ }
+ if (util.isDigit(c2)) {
+ buffer += read();
+ lexState = "decimalExponentInteger";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ decimalExponentSign: function decimalExponentSign() {
+ if (util.isDigit(c2)) {
+ buffer += read();
+ lexState = "decimalExponentInteger";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ decimalExponentInteger: function decimalExponentInteger() {
+ if (util.isDigit(c2)) {
+ buffer += read();
+ return;
+ }
+ return newToken("numeric", sign * Number(buffer));
+ },
+ hexadecimal: function hexadecimal() {
+ if (util.isHexDigit(c2)) {
+ buffer += read();
+ lexState = "hexadecimalInteger";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ hexadecimalInteger: function hexadecimalInteger() {
+ if (util.isHexDigit(c2)) {
+ buffer += read();
+ return;
+ }
+ return newToken("numeric", sign * Number(buffer));
+ },
+ string: function string() {
+ switch (c2) {
+ case "\\":
+ read();
+ buffer += escape();
+ return;
+ case '"':
+ if (doubleQuote) {
+ read();
+ return newToken("string", buffer);
+ }
+ buffer += read();
+ return;
+ case "'":
+ if (!doubleQuote) {
+ read();
+ return newToken("string", buffer);
+ }
+ buffer += read();
+ return;
+ case "\n":
+ case "\r":
+ throw invalidChar(read());
+ case "\u2028":
+ case "\u2029":
+ separatorChar(c2);
+ break;
+ case void 0:
+ throw invalidChar(read());
+ }
+ buffer += read();
+ },
+ start: function start() {
+ switch (c2) {
+ case "{":
+ case "[":
+ return newToken("punctuator", read());
+ }
+ lexState = "value";
+ },
+ beforePropertyName: function beforePropertyName() {
+ switch (c2) {
+ case "$":
+ case "_":
+ buffer = read();
+ lexState = "identifierName";
+ return;
+ case "\\":
+ read();
+ lexState = "identifierNameStartEscape";
+ return;
+ case "}":
+ return newToken("punctuator", read());
+ case '"':
+ case "'":
+ doubleQuote = read() === '"';
+ lexState = "string";
+ return;
+ }
+ if (util.isIdStartChar(c2)) {
+ buffer += read();
+ lexState = "identifierName";
+ return;
+ }
+ throw invalidChar(read());
+ },
+ afterPropertyName: function afterPropertyName() {
+ if (c2 === ":") {
+ return newToken("punctuator", read());
+ }
+ throw invalidChar(read());
+ },
+ beforePropertyValue: function beforePropertyValue() {
+ lexState = "value";
+ },
+ afterPropertyValue: function afterPropertyValue() {
+ switch (c2) {
+ case ",":
+ case "}":
+ return newToken("punctuator", read());
+ }
+ throw invalidChar(read());
+ },
+ beforeArrayValue: function beforeArrayValue() {
+ if (c2 === "]") {
+ return newToken("punctuator", read());
+ }
+ lexState = "value";
+ },
+ afterArrayValue: function afterArrayValue() {
+ switch (c2) {
+ case ",":
+ case "]":
+ return newToken("punctuator", read());
+ }
+ throw invalidChar(read());
+ },
+ end: function end() {
+ throw invalidChar(read());
+ }
+ };
+ function newToken(type, value) {
+ return {
+ type,
+ value,
+ line,
+ column
+ };
+ }
+ function literal(s3) {
+ for (var i2 = 0, list = s3; i2 < list.length; i2 += 1) {
+ var c3 = list[i2];
+ var p3 = peek();
+ if (p3 !== c3) {
+ throw invalidChar(read());
+ }
+ read();
+ }
+ }
+ function escape() {
+ var c3 = peek();
+ switch (c3) {
+ case "b":
+ read();
+ return "\b";
+ case "f":
+ read();
+ return "\f";
+ case "n":
+ read();
+ return "\n";
+ case "r":
+ read();
+ return "\r";
+ case "t":
+ read();
+ return " ";
+ case "v":
+ read();
+ return "\v";
+ case "0":
+ read();
+ if (util.isDigit(peek())) {
+ throw invalidChar(read());
+ }
+ return "\0";
+ case "x":
+ read();
+ return hexEscape();
+ case "u":
+ read();
+ return unicodeEscape();
+ case "\n":
+ case "\u2028":
+ case "\u2029":
+ read();
+ return "";
+ case "\r":
+ read();
+ if (peek() === "\n") {
+ read();
+ }
+ return "";
+ case "1":
+ case "2":
+ case "3":
+ case "4":
+ case "5":
+ case "6":
+ case "7":
+ case "8":
+ case "9":
+ throw invalidChar(read());
+ case void 0:
+ throw invalidChar(read());
+ }
+ return read();
+ }
+ function hexEscape() {
+ var buffer2 = "";
+ var c3 = peek();
+ if (!util.isHexDigit(c3)) {
+ throw invalidChar(read());
+ }
+ buffer2 += read();
+ c3 = peek();
+ if (!util.isHexDigit(c3)) {
+ throw invalidChar(read());
+ }
+ buffer2 += read();
+ return String.fromCodePoint(parseInt(buffer2, 16));
+ }
+ function unicodeEscape() {
+ var buffer2 = "";
+ var count = 4;
+ while (count-- > 0) {
+ var c3 = peek();
+ if (!util.isHexDigit(c3)) {
+ throw invalidChar(read());
+ }
+ buffer2 += read();
+ }
+ return String.fromCodePoint(parseInt(buffer2, 16));
+ }
+ var parseStates = {
+ start: function start() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ push();
+ },
+ beforePropertyName: function beforePropertyName() {
+ switch (token.type) {
+ case "identifier":
+ case "string":
+ key2 = token.value;
+ parseState = "afterPropertyName";
+ return;
+ case "punctuator":
+ pop();
+ return;
+ case "eof":
+ throw invalidEOF();
+ }
+ },
+ afterPropertyName: function afterPropertyName() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ parseState = "beforePropertyValue";
+ },
+ beforePropertyValue: function beforePropertyValue() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ push();
+ },
+ beforeArrayValue: function beforeArrayValue() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ if (token.type === "punctuator" && token.value === "]") {
+ pop();
+ return;
+ }
+ push();
+ },
+ afterPropertyValue: function afterPropertyValue() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ switch (token.value) {
+ case ",":
+ parseState = "beforePropertyName";
+ return;
+ case "}":
+ pop();
+ }
+ },
+ afterArrayValue: function afterArrayValue() {
+ if (token.type === "eof") {
+ throw invalidEOF();
+ }
+ switch (token.value) {
+ case ",":
+ parseState = "beforeArrayValue";
+ return;
+ case "]":
+ pop();
+ }
+ },
+ end: function end() {
+ }
+ };
+ function push() {
+ var value;
+ switch (token.type) {
+ case "punctuator":
+ switch (token.value) {
+ case "{":
+ value = {};
+ break;
+ case "[":
+ value = [];
+ break;
+ }
+ break;
+ case "null":
+ case "boolean":
+ case "numeric":
+ case "string":
+ value = token.value;
+ break;
+ }
+ if (root2 === void 0) {
+ root2 = value;
+ } else {
+ var parent = stack[stack.length - 1];
+ if (Array.isArray(parent)) {
+ parent.push(value);
+ } else {
+ Object.defineProperty(parent, key2, {
+ value,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
+ }
+ if (value !== null && typeof value === "object") {
+ stack.push(value);
+ if (Array.isArray(value)) {
+ parseState = "beforeArrayValue";
+ } else {
+ parseState = "beforePropertyName";
+ }
+ } else {
+ var current = stack[stack.length - 1];
+ if (current == null) {
+ parseState = "end";
+ } else if (Array.isArray(current)) {
+ parseState = "afterArrayValue";
+ } else {
+ parseState = "afterPropertyValue";
+ }
+ }
+ }
+ function pop() {
+ stack.pop();
+ var current = stack[stack.length - 1];
+ if (current == null) {
+ parseState = "end";
+ } else if (Array.isArray(current)) {
+ parseState = "afterArrayValue";
+ } else {
+ parseState = "afterPropertyValue";
+ }
+ }
+ function invalidChar(c3) {
+ if (c3 === void 0) {
+ return syntaxError("JSON5: invalid end of input at " + line + ":" + column);
+ }
+ return syntaxError("JSON5: invalid character '" + formatChar(c3) + "' at " + line + ":" + column);
+ }
+ function invalidEOF() {
+ return syntaxError("JSON5: invalid end of input at " + line + ":" + column);
+ }
+ function invalidIdentifier() {
+ column -= 5;
+ return syntaxError("JSON5: invalid identifier character at " + line + ":" + column);
+ }
+ function separatorChar(c3) {
+ console.warn("JSON5: '" + formatChar(c3) + "' in strings is not valid ECMAScript; consider escaping");
+ }
+ function formatChar(c3) {
+ var replacements = {
+ "'": "\\'",
+ '"': '\\"',
+ "\\": "\\\\",
+ "\b": "\\b",
+ "\f": "\\f",
+ "\n": "\\n",
+ "\r": "\\r",
+ " ": "\\t",
+ "\v": "\\v",
+ "\0": "\\0",
+ "\u2028": "\\u2028",
+ "\u2029": "\\u2029"
+ };
+ if (replacements[c3]) {
+ return replacements[c3];
+ }
+ if (c3 < " ") {
+ var hexString = c3.charCodeAt(0).toString(16);
+ return "\\x" + ("00" + hexString).substring(hexString.length);
+ }
+ return c3;
+ }
+ function syntaxError(message) {
+ var err = new SyntaxError(message);
+ err.lineNumber = line;
+ err.columnNumber = column;
+ return err;
+ }
+ var stringify3 = function stringify4(value, replacer, space) {
+ var stack2 = [];
+ var indent = "";
+ var propertyList;
+ var replacerFunc;
+ var gap = "";
+ var quote;
+ if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
+ space = replacer.space;
+ quote = replacer.quote;
+ replacer = replacer.replacer;
+ }
+ if (typeof replacer === "function") {
+ replacerFunc = replacer;
+ } else if (Array.isArray(replacer)) {
+ propertyList = [];
+ for (var i2 = 0, list = replacer; i2 < list.length; i2 += 1) {
+ var v2 = list[i2];
+ var item = void 0;
+ if (typeof v2 === "string") {
+ item = v2;
+ } else if (typeof v2 === "number" || v2 instanceof String || v2 instanceof Number) {
+ item = String(v2);
+ }
+ if (item !== void 0 && propertyList.indexOf(item) < 0) {
+ propertyList.push(item);
+ }
+ }
+ }
+ if (space instanceof Number) {
+ space = Number(space);
+ } else if (space instanceof String) {
+ space = String(space);
+ }
+ if (typeof space === "number") {
+ if (space > 0) {
+ space = Math.min(10, Math.floor(space));
+ gap = " ".substr(0, space);
+ }
+ } else if (typeof space === "string") {
+ gap = space.substr(0, 10);
+ }
+ return serializeProperty("", { "": value });
+ function serializeProperty(key3, holder) {
+ var value2 = holder[key3];
+ if (value2 != null) {
+ if (typeof value2.toJSON5 === "function") {
+ value2 = value2.toJSON5(key3);
+ } else if (typeof value2.toJSON === "function") {
+ value2 = value2.toJSON(key3);
+ }
+ }
+ if (replacerFunc) {
+ value2 = replacerFunc.call(holder, key3, value2);
+ }
+ if (value2 instanceof Number) {
+ value2 = Number(value2);
+ } else if (value2 instanceof String) {
+ value2 = String(value2);
+ } else if (value2 instanceof Boolean) {
+ value2 = value2.valueOf();
+ }
+ switch (value2) {
+ case null:
+ return "null";
+ case true:
+ return "true";
+ case false:
+ return "false";
+ }
+ if (typeof value2 === "string") {
+ return quoteString(value2, false);
+ }
+ if (typeof value2 === "number") {
+ return String(value2);
+ }
+ if (typeof value2 === "object") {
+ return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
+ }
+ return void 0;
+ }
+ function quoteString(value2) {
+ var quotes = {
+ "'": 0.1,
+ '"': 0.2
+ };
+ var replacements = {
+ "'": "\\'",
+ '"': '\\"',
+ "\\": "\\\\",
+ "\b": "\\b",
+ "\f": "\\f",
+ "\n": "\\n",
+ "\r": "\\r",
+ " ": "\\t",
+ "\v": "\\v",
+ "\0": "\\0",
+ "\u2028": "\\u2028",
+ "\u2029": "\\u2029"
+ };
+ var product = "";
+ for (var i3 = 0; i3 < value2.length; i3++) {
+ var c3 = value2[i3];
+ switch (c3) {
+ case "'":
+ case '"':
+ quotes[c3]++;
+ product += c3;
+ continue;
+ case "\0":
+ if (util.isDigit(value2[i3 + 1])) {
+ product += "\\x00";
+ continue;
+ }
+ }
+ if (replacements[c3]) {
+ product += replacements[c3];
+ continue;
+ }
+ if (c3 < " ") {
+ var hexString = c3.charCodeAt(0).toString(16);
+ product += "\\x" + ("00" + hexString).substring(hexString.length);
+ continue;
+ }
+ product += c3;
+ }
+ var quoteChar = quote || Object.keys(quotes).reduce(function(a2, b2) {
+ return quotes[a2] < quotes[b2] ? a2 : b2;
+ });
+ product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
+ return quoteChar + product + quoteChar;
+ }
+ function serializeObject(value2) {
+ if (stack2.indexOf(value2) >= 0) {
+ throw TypeError("Converting circular structure to JSON5");
+ }
+ stack2.push(value2);
+ var stepback = indent;
+ indent = indent + gap;
+ var keys = propertyList || Object.keys(value2);
+ var partial = [];
+ for (var i3 = 0, list2 = keys; i3 < list2.length; i3 += 1) {
+ var key3 = list2[i3];
+ var propertyString = serializeProperty(key3, value2);
+ if (propertyString !== void 0) {
+ var member = serializeKey(key3) + ":";
+ if (gap !== "") {
+ member += " ";
+ }
+ member += propertyString;
+ partial.push(member);
+ }
+ }
+ var final;
+ if (partial.length === 0) {
+ final = "{}";
+ } else {
+ var properties;
+ if (gap === "") {
+ properties = partial.join(",");
+ final = "{" + properties + "}";
+ } else {
+ var separator = ",\n" + indent;
+ properties = partial.join(separator);
+ final = "{\n" + indent + properties + ",\n" + stepback + "}";
+ }
+ }
+ stack2.pop();
+ indent = stepback;
+ return final;
+ }
+ function serializeKey(key3) {
+ if (key3.length === 0) {
+ return quoteString(key3, true);
+ }
+ var firstChar = String.fromCodePoint(key3.codePointAt(0));
+ if (!util.isIdStartChar(firstChar)) {
+ return quoteString(key3, true);
+ }
+ for (var i3 = firstChar.length; i3 < key3.length; i3++) {
+ if (!util.isIdContinueChar(String.fromCodePoint(key3.codePointAt(i3)))) {
+ return quoteString(key3, true);
+ }
+ }
+ return key3;
+ }
+ function serializeArray(value2) {
+ if (stack2.indexOf(value2) >= 0) {
+ throw TypeError("Converting circular structure to JSON5");
+ }
+ stack2.push(value2);
+ var stepback = indent;
+ indent = indent + gap;
+ var partial = [];
+ for (var i3 = 0; i3 < value2.length; i3++) {
+ var propertyString = serializeProperty(String(i3), value2);
+ partial.push(propertyString !== void 0 ? propertyString : "null");
+ }
+ var final;
+ if (partial.length === 0) {
+ final = "[]";
+ } else {
+ if (gap === "") {
+ var properties = partial.join(",");
+ final = "[" + properties + "]";
+ } else {
+ var separator = ",\n" + indent;
+ var properties$1 = partial.join(separator);
+ final = "[\n" + indent + properties$1 + ",\n" + stepback + "]";
+ }
+ }
+ stack2.pop();
+ indent = stepback;
+ return final;
+ }
+ };
+ var JSON52 = {
+ parse: parse5,
+ stringify: stringify3
+ };
+ var lib = JSON52;
+ var es5 = lib;
+ return es5;
+ });
+ }
+});
+
+// src/main.ts
+var main_exports = {};
+__export(main_exports, {
+ default: () => CodeStylerPlugin
+});
+module.exports = __toCommonJS(main_exports);
+var import_obsidian9 = require("obsidian");
+
+// src/Settings.ts
+var THEME_DEFAULT_SETTINGS = {
+ codeblock: {
+ lineNumbers: true,
+ unwrapLines: true,
+ wrapLinesActive: false,
+ curvature: 4
+ },
+ gutter: {
+ highlight: true,
+ activeLine: false
+ },
+ header: {
+ title: {
+ textFont: "",
+ textBold: false,
+ textItalic: true
+ },
+ languageTag: {
+ display: "none",
+ textFont: "",
+ textBold: true,
+ textItalic: false
+ },
+ languageIcon: {
+ display: "none",
+ displayColour: true
+ },
+ externalReference: {
+ displayRepository: true,
+ displayVersion: true,
+ displayTimestamp: true
+ },
+ fontSize: 14,
+ foldPlaceholder: ""
+ },
+ highlights: {
+ activeCodeblockLine: false,
+ activeEditorLine: false
+ },
+ inline: {
+ syntaxHighlight: true,
+ style: true,
+ fontWeight: 4,
+ curvature: 6,
+ paddingVertical: 5,
+ paddingHorizontal: 5,
+ marginHorizontal: 0,
+ titleFontWeight: 8
+ },
+ advanced: {
+ gradientHighlights: false,
+ gradientHighlightsColourStop: "70%",
+ languageBorderColour: false,
+ languageBorderWidth: 5,
+ iconSize: 28
+ }
+};
+var THEME_FALLBACK_COLOURS = {
+ codeblock: {
+ backgroundColour: "--code-background",
+ textColour: "--code-normal"
+ },
+ gutter: {
+ backgroundColour: "--code-background",
+ textColour: "--text-faint",
+ activeTextColour: "--text-muted"
+ },
+ header: {
+ backgroundColour: "--code-background",
+ title: {
+ textColour: "--code-comment"
+ },
+ languageTag: {
+ backgroundColour: "--code-background",
+ textColour: "--code-comment"
+ },
+ externalReference: {
+ displayRepositoryColour: "#00FFFF",
+ displayVersionColour: "#FF00FF",
+ displayTimestampColour: "#808080"
+ },
+ lineColour: "--color-base-30"
+ },
+ highlights: {
+ activeCodeblockLineColour: "--color-base-30",
+ activeEditorLineColour: "--color-base-20",
+ defaultColour: "--text-highlight-bg",
+ alternativeHighlights: {}
+ },
+ inline: {
+ backgroundColour: "--code-background",
+ textColour: "--code-normal",
+ activeTextColour: "--code-normal",
+ titleTextColour: "--code-comment"
+ },
+ advanced: {
+ buttonColour: "--text-muted",
+ buttonActiveColour: "--text-normal"
+ }
+};
+var SOLARIZED = {
+ "base03": "#002b36",
+ "base02": "#073642",
+ "base01": "#586e75",
+ "base00": "#657b83",
+ "base0": "#839496",
+ "base1": "#93a1a1",
+ "base2": "#eee8d5",
+ "base3": "#fdf6e3",
+ "yellow": "#b58900",
+ "orange": "#cb4b16",
+ "red": "#dc322f",
+ "magenta": "#d33682",
+ "violet": "#6c71c4",
+ "blue": "#268bd2",
+ "cyan": "#2aa198",
+ "green": "#859900"
+};
+var DEFAULT_THEME = {
+ settings: THEME_DEFAULT_SETTINGS,
+ colours: {
+ light: THEME_FALLBACK_COLOURS,
+ dark: THEME_FALLBACK_COLOURS
+ }
+};
+var SOLARIZED_THEME = {
+ settings: THEME_DEFAULT_SETTINGS,
+ colours: {
+ light: {
+ codeblock: {
+ backgroundColour: SOLARIZED.base3,
+ textColour: "#bababa"
+ },
+ gutter: {
+ backgroundColour: SOLARIZED.base2,
+ textColour: "#6c6c6c",
+ activeTextColour: "#8c8c8c"
+ },
+ header: {
+ backgroundColour: "#D5CCB4",
+ title: {
+ textColour: "#866704"
+ },
+ languageTag: {
+ backgroundColour: "#B8B5AA",
+ textColour: "#C25F30"
+ },
+ externalReference: {
+ displayRepositoryColour: "#941100",
+ displayVersionColour: "#ff9300",
+ displayTimestampColour: "#808080"
+ },
+ lineColour: "#EDD489"
+ },
+ highlights: {
+ activeCodeblockLineColour: SOLARIZED.base2,
+ activeEditorLineColour: "#60460633",
+ defaultColour: "#E9DFBA",
+ alternativeHighlights: {}
+ },
+ inline: {
+ backgroundColour: SOLARIZED.base3,
+ textColour: "#bababa",
+ activeTextColour: "#bababa",
+ titleTextColour: "#C25F30"
+ },
+ advanced: {
+ buttonColour: "--text-muted",
+ buttonActiveColour: "--text-normal"
+ }
+ },
+ dark: {
+ codeblock: {
+ backgroundColour: SOLARIZED.base03,
+ textColour: "#bababa"
+ },
+ gutter: {
+ backgroundColour: SOLARIZED.base02,
+ textColour: "#6c6c6c",
+ activeTextColour: "#4c4c4c"
+ },
+ header: {
+ backgroundColour: "#0a4554",
+ title: {
+ textColour: "#dadada"
+ },
+ languageTag: {
+ backgroundColour: "#008080",
+ textColour: "#000000"
+ },
+ externalReference: {
+ displayRepositoryColour: "#00FFFF",
+ displayVersionColour: "#9437ff",
+ displayTimestampColour: "#808080"
+ },
+ lineColour: "#46cced"
+ },
+ highlights: {
+ activeCodeblockLineColour: SOLARIZED.base02,
+ activeEditorLineColour: "#468eeb33",
+ defaultColour: "#054b5c",
+ alternativeHighlights: {}
+ },
+ inline: {
+ backgroundColour: SOLARIZED.base03,
+ textColour: "#bababa",
+ activeTextColour: "#bababa",
+ titleTextColour: "#000000"
+ },
+ advanced: {
+ buttonColour: "--text-muted",
+ buttonActiveColour: "--text-normal"
+ }
+ }
+ }
+};
+var INBUILT_THEMES = {
+ "Default": DEFAULT_THEME,
+ "Solarized": SOLARIZED_THEME
+};
+var EXAMPLE_CODEBLOCK_PARAMETERS = "python title:foo";
+var EXAMPLE_CODEBLOCK_CONTENT = 'print("This line is very long and should be used as an example for how the plugin deals with wrapping and unwrapping very long lines given the choice of codeblock parameters and settings.")\nprint("This line is highlighted.")';
+var EXAMPLE_INLINE_CODE = '{python icon title:foo} print("This is inline code")';
+var EXCLUDED_LANGUAGES = "ad-*, reference";
+var WHITELIST_CODEBLOCKS = "run-*, include";
+var DEFAULT_SETTINGS = {
+ themes: structuredClone(INBUILT_THEMES),
+ selectedTheme: "Default",
+ currentTheme: structuredClone(DEFAULT_THEME),
+ newTheme: "",
+ newHighlight: "",
+ exampleCodeblockParameters: EXAMPLE_CODEBLOCK_PARAMETERS,
+ exampleCodeblockContent: EXAMPLE_CODEBLOCK_CONTENT,
+ exampleInlineCode: EXAMPLE_INLINE_CODE,
+ decoratePrint: true,
+ excludedLanguages: EXCLUDED_LANGUAGES,
+ externalReferenceUpdateOnLoad: false,
+ processedCodeblocksWhitelist: WHITELIST_CODEBLOCKS,
+ redirectLanguages: {},
+ version: "1.1.7"
+};
+function convertSettings(settings) {
+ if (typeof (settings == null ? void 0 : settings.version) === "undefined")
+ return settingsClear();
+ while (semverNewer(DEFAULT_SETTINGS.version, settings.version)) {
+ if (settings.version in settingsUpdaters)
+ settings = settingsUpdaters[settings.version](settings);
+ else
+ settings = settingsClear();
+ }
+ return settings;
+}
+function semverNewer(newVersion, oldVersion) {
+ return newVersion.localeCompare(oldVersion, void 0, { numeric: true }) === 1;
+}
+function settingsVersionUpdate(settings, themeUpdater = (theme) => theme, otherSettingsUpdater = (settings2) => settings2, redirectLanguagesUpdater = (redirectLanguages) => redirectLanguages) {
+ var _a2;
+ for (const [name, theme] of Object.entries(settings.themes)) {
+ settings.themes[name] = themeUpdater(theme);
+ }
+ settings.currentTheme = structuredClone(settings.themes[settings.selectedTheme]);
+ settings.redirectLanguages = redirectLanguagesUpdater(settings.redirectLanguages);
+ settings = otherSettingsUpdater(settings);
+ settings.version = (_a2 = Object.keys(settingsUpdaters).find((value, index2, array) => (array == null ? void 0 : array[index2 - 1]) === settings.version)) != null ? _a2 : "1.0.0";
+ return settings;
+}
+function settingsPreserve(settings) {
+ var _a2;
+ settings.version = (_a2 = Object.keys(settingsUpdaters).find((value, index2, array) => (array == null ? void 0 : array[index2 - 1]) === settings.version)) != null ? _a2 : "1.0.0";
+ return settings;
+}
+function settingsClear() {
+ return DEFAULT_SETTINGS;
+}
+var settingsUpdaters = {
+ "1.0.0": settingsClear,
+ "1.0.1": settingsClear,
+ "1.0.2": settingsClear,
+ "1.0.3": settingsClear,
+ "1.0.4": settingsClear,
+ "1.0.5": settingsClear,
+ "1.0.6": settingsClear,
+ "1.0.7": settingsPreserve,
+ "1.0.8": settingsPreserve,
+ "1.0.9": settingsPreserve,
+ "1.0.10": (settings) => settingsVersionUpdate(settings, (theme) => {
+ theme.settings.inline.style = true;
+ return theme;
+ }, (settings2) => {
+ delete settings2.specialLanguages;
+ return settings2;
+ }),
+ "1.0.11": settingsPreserve,
+ "1.1.0": settingsPreserve,
+ "1.1.1": settingsPreserve,
+ "1.1.2": settingsPreserve,
+ "1.1.3": settingsPreserve,
+ "1.1.4": (settings) => settingsVersionUpdate(settings, (theme) => {
+ theme.settings.header.externalReference = structuredClone(THEME_DEFAULT_SETTINGS.header.externalReference);
+ theme.colours.light.header.externalReference = structuredClone(THEME_FALLBACK_COLOURS.header.externalReference);
+ theme.colours.dark.header.externalReference = structuredClone(THEME_FALLBACK_COLOURS.header.externalReference);
+ return theme;
+ }, (settings2) => {
+ settings2.externalReferenceUpdateOnLoad = false;
+ return settings2;
+ }),
+ "1.1.5": settingsPreserve,
+ "1.1.6": settingsPreserve
+};
+var FOLD_PLACEHOLDER = "Folded Code";
+var PARAMETERS = ["title", "fold", "ln", "wrap", "unwrap", "ignore"];
+var TRANSITION_LENGTH = 240;
+var SPECIAL_LANGUAGES = ["^reference$", "^foofoo", "^preview$", "^include$", "^output$", "^run-.+$"];
+var SETTINGS_SOURCEPATH_PREFIX = "@Code-Styler-Settings:";
+var LOCAL_PREFIX = "@/";
+var REFERENCE_CODEBLOCK = "reference";
+var EXTERNAL_REFERENCE_PATH = "/plugins/code-styler/reference-files/";
+var EXTERNAL_REFERENCE_CACHE = EXTERNAL_REFERENCE_PATH + "cache.json";
+var EXTERNAL_REFERENCE_INFO_SUFFIX = "-info.json";
+var GIT_ICONS = {
+ "branch": "",
+ "tree": ""
+ // commit
+};
+var SITE_ICONS = {
+ "github": "",
+ "gitlab": "",
+ "bitbucket": "",
+ "sourceforge": "",
+ "generic": ""
+};
+var STAMP_ICON = "";
+var UPDATE_ICON = "";
+var PRISM_LANGUAGES = {
+ // Prism Languages: https://prismjs.com/plugins/show-language/
+ // "none": "Plain text", // NOTE: Obsidian uses this for codeblocks without language names
+ "plain": "Plain text",
+ "plaintext": "Plain text",
+ "text": "Plain text",
+ "txt": "Plain text",
+ "html": "HTML",
+ "xml": "XML",
+ "svg": "SVG",
+ "mathml": "MathML",
+ "ssml": "SSML",
+ "rss": "RSS",
+ "css": "CSS",
+ "clike": "C-like",
+ "js": "JavaScript",
+ "abap": "ABAP",
+ "abnf": "ABNF",
+ "al": "AL",
+ "antlr4": "ANTLR4",
+ "g4": "ANTLR4",
+ "apacheconf": "Apache Configuration",
+ "apl": "APL",
+ "aql": "AQL",
+ "ino": "Arduino",
+ "arff": "ARFF",
+ "armasm": "ARM Assembly",
+ "arm-asm": "ARM Assembly",
+ "art": "Arturo",
+ "asciidoc": "AsciiDoc",
+ "adoc": "AsciiDoc",
+ "aspnet": "ASP.NET (C#)",
+ "asm6502": "6502 Assembly",
+ "asmatmel": "Atmel AVR Assembly",
+ "autohotkey": "AutoHotkey",
+ "autoit": "AutoIt",
+ "avisynth": "AviSynth",
+ "avs": "AviSynth",
+ "avro-idl": "Avro IDL",
+ "avdl": "Avro IDL",
+ "awk": "AWK",
+ "gawk": "GAWK",
+ "sh": "Shell",
+ "basic": "BASIC",
+ "bbcode": "BBcode",
+ "bbj": "BBj",
+ "bnf": "BNF",
+ "rbnf": "RBNF",
+ "bqn": "BQN",
+ "bsl": "BSL (1C:Enterprise)",
+ "oscript": "OneScript",
+ "csharp": "C#",
+ "cs": "C#",
+ "dotnet": "C#",
+ "cpp": "C++",
+ "cfscript": "CFScript",
+ "cfc": "CFScript",
+ "cil": "CIL",
+ "cilkc": "Cilk/C",
+ "cilk-c": "Cilk/C",
+ "cilkcpp": "Cilk/C++",
+ "cilk-cpp": "Cilk/C++",
+ "cilk": "Cilk/C++",
+ "cmake": "CMake",
+ "cobol": "COBOL",
+ "coffee": "CoffeeScript",
+ "conc": "Concurnas",
+ "csp": "Content-Security-Policy",
+ "css-extras": "CSS Extras",
+ "csv": "CSV",
+ "cue": "CUE",
+ "dataweave": "DataWeave",
+ "dax": "DAX",
+ "django": "Django/Jinja2",
+ "jinja2": "Django/Jinja2",
+ "dns-zone-file": "DNS zone file",
+ "dns-zone": "DNS zone file",
+ "dockerfile": "Docker",
+ "dot": "DOT (Graphviz)",
+ "gv": "DOT (Graphviz)",
+ "ebnf": "EBNF",
+ "editorconfig": "EditorConfig",
+ "ejs": "EJS",
+ "etlua": "Embedded Lua templating",
+ "erb": "ERB",
+ "excel-formula": "Excel Formula",
+ "xlsx": "Excel Formula",
+ "xls": "Excel Formula",
+ "fsharp": "F#",
+ "firestore-security-rules": "Firestore security rules",
+ "ftl": "FreeMarker Template Language",
+ "gml": "GameMaker Language",
+ "gamemakerlanguage": "GameMaker Language",
+ "gap": "GAP (CAS)",
+ "gcode": "G-code",
+ "gdscript": "GDScript",
+ "gedcom": "GEDCOM",
+ "gettext": "gettext",
+ "po": "gettext",
+ "glsl": "GLSL",
+ "gn": "GN",
+ "gni": "GN",
+ "linker-script": "GNU Linker Script",
+ "ld": "GNU Linker Script",
+ "go-module": "Go module",
+ "go-mod": "Go module",
+ "graphql": "GraphQL",
+ "hbs": "Handlebars",
+ "hs": "Haskell",
+ "hcl": "HCL",
+ "hlsl": "HLSL",
+ "http": "HTTP",
+ "hpkp": "HTTP Public-Key-Pins",
+ "hsts": "HTTP Strict-Transport-Security",
+ "ichigojam": "IchigoJam",
+ "icu-message-format": "ICU Message Format",
+ "idr": "Idris",
+ "ignore": ".ignore",
+ "gitignore": ".gitignore",
+ "hgignore": ".hgignore",
+ "npmignore": ".npmignore",
+ "inform7": "Inform 7",
+ "javadoc": "JavaDoc",
+ "javadoclike": "JavaDoc-like",
+ "javastacktrace": "Java stack trace",
+ "jq": "JQ",
+ "jsdoc": "JSDoc",
+ "js-extras": "JS Extras",
+ "json": "JSON",
+ "webmanifest": "Web App Manifest",
+ "json5": "JSON5",
+ "jsonp": "JSONP",
+ "jsstacktrace": "JS stack trace",
+ "js-templates": "JS Templates",
+ "keepalived": "Keepalived Configure",
+ "kts": "Kotlin Script",
+ "kt": "Kotlin",
+ "kumir": "KuMir (\u041A\u0443\u041C\u0438\u0440)",
+ "kum": "KuMir (\u041A\u0443\u041C\u0438\u0440)",
+ "latex": "LaTeX",
+ "tex": "TeX",
+ "context": "ConTeXt",
+ "lilypond": "LilyPond",
+ "ly": "LilyPond",
+ "emacs": "Lisp",
+ "elisp": "Lisp",
+ "emacs-lisp": "Lisp",
+ "llvm": "LLVM IR",
+ "log": "Log file",
+ "lolcode": "LOLCODE",
+ "magma": "Magma (CAS)",
+ "md": "Markdown",
+ "markup-templating": "Markup templating",
+ "matlab": "MATLAB",
+ "maxscript": "MAXScript",
+ "mel": "MEL",
+ "metafont": "METAFONT",
+ "mongodb": "MongoDB",
+ "moon": "MoonScript",
+ "n1ql": "N1QL",
+ "n4js": "N4JS",
+ "n4jsd": "N4JS",
+ "nand2tetris-hdl": "Nand To Tetris HDL",
+ "naniscript": "Naninovel Script",
+ "nani": "Naninovel Script",
+ "nasm": "NASM",
+ "neon": "NEON",
+ "nginx": "nginx",
+ "nsis": "NSIS",
+ "objectivec": "Objective-C",
+ "objc": "Objective-C",
+ "ocaml": "OCaml",
+ "opencl": "OpenCL",
+ "openqasm": "OpenQasm",
+ "qasm": "OpenQasm",
+ "parigp": "PARI/GP",
+ "objectpascal": "Object Pascal",
+ "psl": "PATROL Scripting Language",
+ "pcaxis": "PC-Axis",
+ "px": "PC-Axis",
+ "peoplecode": "PeopleCode",
+ "pcode": "PeopleCode",
+ "php": "PHP",
+ "phpdoc": "PHPDoc",
+ "php-extras": "PHP Extras",
+ "plant-uml": "PlantUML",
+ "plantuml": "PlantUML",
+ "plsql": "PL/SQL",
+ "powerquery": "PowerQuery",
+ "pq": "PowerQuery",
+ "mscript": "PowerQuery",
+ "powershell": "PowerShell",
+ "promql": "PromQL",
+ "properties": ".properties",
+ "protobuf": "Protocol Buffers",
+ "purebasic": "PureBasic",
+ "pbfasm": "PureBasic",
+ "purs": "PureScript",
+ "py": "Python",
+ "qsharp": "Q#",
+ "qs": "Q#",
+ "q": "Q (kdb+ database)",
+ "qml": "QML",
+ "rkt": "Racket",
+ "cshtml": "Razor C#",
+ "razor": "Razor C#",
+ "jsx": "React JSX",
+ "tsx": "React TSX",
+ "renpy": "Ren'py",
+ "rpy": "Ren'py",
+ "res": "ReScript",
+ "rest": "reST (reStructuredText)",
+ "robotframework": "Robot Framework",
+ "robot": "Robot Framework",
+ "rb": "Ruby",
+ "sas": "SAS",
+ "sass": "Sass (Sass)",
+ "scss": "Sass (SCSS)",
+ "shell-session": "Shell session",
+ "sh-session": "Shell session",
+ "shellsession": "Shell session",
+ "sml": "SML",
+ "smlnj": "SML/NJ",
+ "solidity": "Solidity (Ethereum)",
+ "sol": "Solidity (Ethereum)",
+ "solution-file": "Solution file",
+ "sln": "Solution file",
+ "soy": "Soy (Closure Template)",
+ "sparql": "SPARQL",
+ "rq": "SPARQL",
+ "splunk-spl": "Splunk SPL",
+ "sqf": "SQF: Status Quo Function (Arma 3)",
+ "sql": "SQL",
+ "stata": "Stata Ado",
+ "iecst": "Structured Text (IEC 61131-3)",
+ "supercollider": "SuperCollider",
+ "sclang": "SuperCollider",
+ "systemd": "Systemd configuration file",
+ "t4-templating": "T4 templating",
+ "t4-cs": "T4 Text Templates (C#)",
+ "t4": "T4 Text Templates (C#)",
+ "t4-vb": "T4 Text Templates (VB)",
+ "tap": "TAP",
+ "tt2": "Template Toolkit 2",
+ "toml": "TOML",
+ "trickle": "trickle",
+ "troy": "troy",
+ "trig": "TriG",
+ "ts": "TypeScript",
+ "tsconfig": "TSConfig",
+ "uscript": "UnrealScript",
+ "uc": "UnrealScript",
+ "uorazor": "UO Razor Script",
+ "uri": "URI",
+ "url": "URL",
+ "vbnet": "VB.Net",
+ "vhdl": "VHDL",
+ "vim": "vim",
+ "visual-basic": "Visual Basic",
+ "vba": "VBA",
+ "vb": "Visual Basic",
+ "wasm": "WebAssembly",
+ "web-idl": "Web IDL",
+ "webidl": "Web IDL",
+ "wgsl": "WGSL",
+ "wiki": "Wiki markup",
+ "wolfram": "Wolfram language",
+ "nb": "Mathematica Notebook",
+ "wl": "Wolfram language",
+ "xeoracube": "XeoraCube",
+ "xml-doc": "XML doc (.net)",
+ "xojo": "Xojo (REALbasic)",
+ "xquery": "XQuery",
+ "yaml": "YAML",
+ "yml": "YAML",
+ "yang": "YANG"
+};
+var MANUAL_PRISM_LANGUAGES = {
+ // Manually generated list from https://prismjs.com/ - 297 languages
+ "css": "CSS",
+ "clike": "C-like",
+ "javascript": "JavaScript",
+ "js": "JavaScript",
+ "abap": "ABAP",
+ "abnf": "ABNF",
+ "actionscript": "ActionScript",
+ "ada": "Ada",
+ "agda": "Agda",
+ "al": "AL",
+ "antlr4": "ANTLR4",
+ "g4": "ANTLR4",
+ "apacheconf": "Apache Configuration",
+ "apex": "Apex",
+ "apl": "APL",
+ "applescript": "AppleScript",
+ "aql": "AQL",
+ "arduino": "Arduino",
+ "ino": "Arduino",
+ "arff": "ARFF",
+ "armasm": "ARM Assembly",
+ "arm-asm": "ARM Assembly",
+ "arturo": "Arturo",
+ "art": "Arturo",
+ "asciidoc": "AsciiDoc",
+ "adoc": "AsciiDoc",
+ "aspnet": "ASP.NET (C#)",
+ "asm6502": "6502 Assembly",
+ "asmatmel": "Atmel AVR Assembly",
+ "autohotkey": "AutoHotkey",
+ "autoit": "AutoIt",
+ "avisynth": "AviSynth",
+ "avs": "AviSynth",
+ "avro-idl": "Avro IDL",
+ "avdl": "Avro IDL",
+ "awk": "AWK",
+ "gawk": "GAWK",
+ "bash": "Bash",
+ "sh": "Shell",
+ "shell": "Shell",
+ "basic": "BASIC",
+ "batch": "Batch",
+ "bbcode": "BBcode",
+ "shortcode": "BBcode",
+ "bbj": "BBj",
+ "birb": "Birb",
+ "bison": "Bison",
+ "bnf": "BNF",
+ "rbnf": "BNF",
+ "bqn": "BQN",
+ "brainfuck": "Brainfuck",
+ "brightscript": "BrightScript",
+ "bro": "Bro",
+ "bsl": "BSL (1C)",
+ "oscript": "BSL (1C)",
+ "c": "C",
+ "csharp": "C#",
+ "cs": "C#",
+ "dotnet": "C#",
+ "cpp": "C++",
+ "cfscript": "CFScript",
+ "cfc": "CFScript",
+ "chaiscript": "ChaiScript",
+ "cil": "CIL",
+ "cilkc": "Cilk/C",
+ "cilk-c": "Cilk/C",
+ "cilkcpp": "Cilk/C++",
+ "cilk-cpp": "Cilk/C++",
+ "cilk": "Cilk/C++",
+ "clojure": "Clojure",
+ "cmake": "CMake",
+ "cobol": "COBOL",
+ "coffeescript": "CoffeeScript",
+ "coffee": "CoffeeScript",
+ "concurnas": "Concurnas",
+ "conc": "Concurnas",
+ "csp": "Content-Security-Policy",
+ "cooklang": "Cooklang",
+ "coq": "Coq",
+ "crystal": "Crystal",
+ "css-extras": "CSS Extras",
+ "csv": "CSV",
+ "cue": "CUE",
+ "cypher": "Cypher",
+ "d": "D",
+ "dart": "Dart",
+ "dataweave": "DataWeave",
+ "dax": "DAX",
+ "dhall": "Dhall",
+ "diff": "Diff",
+ "django": "Django/Jinja2",
+ "jinja2": "Django/Jinja2",
+ "dns-zone-file": "DNS zone file",
+ "dns-zone": "DNS zone file",
+ "docker": "Docker",
+ "dockerfile": "Docker",
+ "dot": "DOT (Graphviz)",
+ "gv": "DOT (Graphviz)",
+ "ebnf": "EBNF",
+ "editorconfig": "EditorConfig",
+ "eiffel": "Eiffel",
+ "ejs": "EJS",
+ "eta": "EJS",
+ "elixir": "Elixir",
+ "elm": "Elm",
+ "etlua": "Embedded Lua templating",
+ "erb": "ERB",
+ "erlang": "Erlang",
+ "excel-formula": "Excel Formula",
+ "xlsx": "Excel Formula",
+ "xls": "Excel Formula",
+ "fsharp": "F#",
+ "factor": "Factor",
+ "false": "False",
+ "firestore-security-rules": "Firestore security rules",
+ "flow": "Flow",
+ "fortran": "Fortran",
+ "ftl": "FreeMarker Template Language",
+ "gml": "GameMaker Language",
+ "gamemakerlanguage": "GameMaker Language",
+ "gap": "GAP (CAS)",
+ "gcode": "G-code",
+ "gdscript": "GDScript",
+ "gedcom": "GEDCOM",
+ "gettext": "gettext",
+ "po": "gettext",
+ "gherkin": "Gherkin",
+ "git": "Git",
+ "glsl": "GLSL",
+ "gn": "GN",
+ "gni": "GN",
+ "linker-script": "GNU Linker Script",
+ "ld": "GNU Linker Script",
+ "go": "Go",
+ "go-module": "Go module",
+ "go-mod": "Go module",
+ "gradle": "Gradle",
+ "graphql": "GraphQL",
+ "groovy": "Groovy",
+ "haml": "Haml",
+ "handlebars": "Handlebars",
+ "hbs": "Handlebars",
+ "mustache": "Handlebars",
+ "haskell": "Haskell",
+ "hs": "Haskell",
+ "haxe": "Haxe",
+ "hcl": "HCL",
+ "hlsl": "HLSL",
+ "hoon": "Hoon",
+ "http": "HTTP",
+ "hpkp": "HTTP Public-Key-Pins",
+ "hsts": "HTTP Strict-Transport-Security",
+ "ichigojam": "IchigoJam",
+ "icon": "Icon",
+ "icu-message-format": "ICU Message Format",
+ "idris": "Idris",
+ "idr": "Idris",
+ "inform7": "Inform 7",
+ "ini": "Ini",
+ "io": "Io",
+ "j": "J",
+ "java": "Java",
+ "javadoc": "JavaDoc",
+ "javadoclike": "JavaDoc-like",
+ "javastacktrace": "Java stack trace",
+ "jexl": "Jexl",
+ "jolie": "Jolie",
+ "jq": "JQ",
+ "jsdoc": "JSDoc",
+ "js-extras": "JS Extras",
+ "json": "JSON",
+ "webmanifest": "JSON",
+ "json5": "JSON5",
+ "jsonp": "JSONP",
+ "jsstacktrace": "JS stack trace",
+ "js-templates": "JS Templates",
+ "julia": "Julia",
+ "keepalived": "Keepalived Configure",
+ "keyman": "Keyman",
+ "kotlin": "Kotlin",
+ "kt": "Kotlin",
+ "kts": "Kotlin",
+ "kumir": "KuMir (\u041A\u0443\u041C\u0438\u0440)",
+ "kum": "KuMir (\u041A\u0443\u041C\u0438\u0440)",
+ "kusto": "Kusto",
+ "latex": "LaTeX",
+ "tex": "LaTeX",
+ "context": "LaTeX",
+ "latte": "Latte",
+ "less": "Less",
+ "lilypond": "LilyPond",
+ "ly": "LilyPond",
+ "liquid": "Liquid",
+ "lisp": "Lisp",
+ "emacs": "Lisp",
+ "elisp": "Lisp",
+ "emacs-lisp": "Lisp",
+ "livescript": "LiveScript",
+ "llvm": "LLVM IR",
+ "log": "Log file",
+ "lolcode": "LOLCODE",
+ "lua": "Lua",
+ "magma": "Magma (CAS)",
+ "makefile": "Makefile",
+ "markdown": "Markdown",
+ "md": "Markdown",
+ "markup-templating": "Markup templating",
+ "mata": "Mata",
+ "matlab": "MATLAB",
+ "maxscript": "MAXScript",
+ "mel": "MEL",
+ "mermaid": "Mermaid",
+ "metafont": "METAFONT",
+ "mizar": "Mizar",
+ "mongodb": "MongoDB",
+ "monkey": "Monkey",
+ "moonscript": "MoonScript",
+ "moon": "MoonScript",
+ "n1ql": "N1QL",
+ "n4js": "N4JS",
+ "n4jsd": "N4JS",
+ "nand2tetris-hdl": "Nand To Tetris HDL",
+ "naniscript": "Naninovel Script",
+ "nani": "Naninovel Script",
+ "nasm": "NASM",
+ "neon": "NEON",
+ "nevod": "Nevod",
+ "nginx": "nginx",
+ "nim": "Nim",
+ "nix": "Nix",
+ "nsis": "NSIS",
+ "objectivec": "Objective-C",
+ "objc": "Objective-C",
+ "ocaml": "OCaml",
+ "odin": "Odin",
+ "opencl": "OpenCL",
+ "openqasm": "OpenQasm",
+ "qasm": "OpenQasm",
+ "oz": "Oz",
+ "parigp": "PARI/GP",
+ "parser": "Parser",
+ "pascal": "Pascal",
+ "pascaligo": "Pascaligo",
+ "psl": "PATROL Scripting Language",
+ "pcaxis": "PC-Axis",
+ "px": "PC-Axis",
+ "peoplecode": "PeopleCode",
+ "pcode": "PeopleCode",
+ "perl": "Perl",
+ "php": "PHP",
+ "phpdoc": "PHPDoc",
+ "php-extras": "PHP Extras",
+ "plant-uml": "PlantUML",
+ "plantuml": "PlantUML",
+ "plsql": "PL/SQL",
+ "powerquery": "PowerQuery",
+ "pq": "PowerQuery",
+ "mscript": "PowerQuery",
+ "powershell": "PowerShell",
+ "processing": "Processing",
+ "prolog": "Prolog",
+ "promql": "PromQL",
+ "properties": ".properties",
+ "protobuf": "Protocol Buffers",
+ "pug": "Pug",
+ "puppet": "Puppet",
+ "pure": "Pure",
+ "purebasic": "PureBasic",
+ "pbfasm": "PureBasic",
+ "purescript": "PureScript",
+ "purs": "PureScript",
+ "python": "Python",
+ "py": "Python",
+ "qsharp": "Q#",
+ "qs": "Q#",
+ "q": "Q (kdb+ database)",
+ "qml": "QML",
+ "qore": "Qore",
+ "r": "R",
+ "racket": "Racket",
+ "rkt": "Racket",
+ "cshtml": "Razor C#",
+ "jsx": "React JSX",
+ "tsx": "React TSX",
+ "reason": "Reason",
+ "regex": "Regex",
+ "rego": "Rego",
+ "renpy": "Ren'py",
+ "rpy": "Ren'py",
+ "rescript": "ReScript",
+ "res": "ReScript",
+ "rest": "reST (reStructuredText)",
+ "rip": "Rip",
+ "roboconf": "Roboconf",
+ "robotframework": "Robot Framework",
+ "robot": "Robot Framework",
+ "ruby": "Ruby",
+ "rb": "Ruby",
+ "rust": "Rust",
+ "sas": "SAS",
+ "sass": "Sass (Sass)",
+ "scss": "Sass (SCSS)",
+ "scala": "Scala",
+ "scheme": "Scheme",
+ "shell-session": "Shell session",
+ "sh-session": "Shell session",
+ "shellsession": "Shell session",
+ "smali": "Smali",
+ "smalltalk": "Smalltalk",
+ "smarty": "Smarty",
+ "sml": "SML",
+ "smlnj": "SML",
+ "solidity": "Solidity (Ethereum)",
+ "sol": "Solidity (Ethereum)",
+ "solution-file": "Solution file",
+ "sln": "Solution file",
+ "soy": "Soy (Closure Template)",
+ "sparql": "SPARQL",
+ "rq": "SPARQL",
+ "splunk-spl": "Splunk SPL",
+ "sqf": "SQF",
+ "sql": "SQL",
+ "squirrel": "Squirrel",
+ "stan": "Stan",
+ "stata": "Stata Ado",
+ "iecst": "Structured Text (IEC 61131-3)",
+ "stylus": "Stylus",
+ "supercollider": "SuperCollider",
+ "sclang": "SuperCollider",
+ "swift": "Swift",
+ "systemd": "Systemd configuration file",
+ "t4-templating": "T4 templating",
+ "t4-cs": "T4 Text Templates (C#)",
+ "t4": "T4 Text Templates (C#)",
+ "t4-vb": "T4 Text Templates (VB)",
+ "tap": "TAP",
+ "tcl": "Tcl",
+ "tt2": "Template Toolkit 2",
+ "textile": "Textile",
+ "toml": "TOML",
+ "tremor": "Tremor",
+ "trickle": "Tremor",
+ "troy": "Tremor",
+ "turtle": "Turtle",
+ "trig": "Turtle",
+ "twig": "Twig",
+ "typescript": "TypeScript",
+ "ts": "TypeScript",
+ "typoscript": "TypoScript",
+ "tsconfig": "TSConfig",
+ "unrealscript": "UnrealScript",
+ "uscript": "UnrealScript",
+ "uc": "UnrealScript",
+ "uorazor": "UO Razor Script",
+ "uri": "URI",
+ "url": "URI",
+ "v": "V",
+ "vala": "Vala",
+ "vbnet": "VB.Net",
+ "velocity": "Velocity",
+ "verilog": "Verilog",
+ "vhdl": "VHDL",
+ "vim": "vim",
+ "visual-basic": "Visual Basic",
+ "vb": "Visual Basic",
+ "warpscript": "WarpScript",
+ "wasm": "WebAssembly",
+ "web-idl": "Web IDL",
+ "webidl": "Web IDL",
+ "wgsl": "WGSL",
+ "wiki": "Wiki markup",
+ "wolfram": "Wolfram language",
+ "mathematica": "Wolfram language",
+ "nb": "Wolfram language",
+ "wl": "Wolfram language",
+ "wren": "Wren",
+ "xeora": "Xeora",
+ "xeoracube": "Xeora",
+ "xml-doc": "XML doc (.net)",
+ "xojo": "Xojo (REALbasic)",
+ "xquery": "XQuery",
+ "yaml": "YAML",
+ "yml": "YAML",
+ "yang": "YANG",
+ "zig": "Zig"
+};
+var MANUAL_LANGUAGES = {
+ // Manually created list
+ "fish": "Fish",
+ "octave": "Octave",
+ "maxima": "Maxima",
+ "mysql": "SQL",
+ "postgresql": "SQL",
+ "rscript": "R",
+ "shellscript": "Shell",
+ "sqlite": "SQL",
+ "zsh": "Zsh"
+};
+var LANGUAGE_NAMES = { ...PRISM_LANGUAGES, ...MANUAL_PRISM_LANGUAGES, ...MANUAL_LANGUAGES };
+var LANGUAGES = {
+ ".gitignore": {
+ colour: "#dd4c35",
+ icon: '',
+ inlineComment: [
+ "#"
+ ]
+ },
+ ".hgignore": {
+ colour: "#bfbfbf",
+ icon: ''
+ },
+ ".npmignore": {
+ colour: "#cb3837",
+ icon: ''
+ },
+ ".properties": {
+ colour: "#99b8c4",
+ icon: ''
+ },
+ "6502 Assembly": {
+ colour: "#0000bf",
+ icon: 'file_type_assembly'
+ },
+ "ActionScript": {
+ colour: "#c41718",
+ icon: ''
+ },
+ "Ada": {
+ colour: "#0f23c3",
+ icon: '',
+ inlineComment: [
+ "--"
+ ]
+ },
+ "AL": {
+ colour: "#2ea98e",
+ icon: ''
+ },
+ "ANTLR4": {
+ colour: "#e44a32",
+ icon: ''
+ },
+ "Apache Configuration": {
+ colour: "#c92037",
+ icon: 'file_type_apache'
+ },
+ "Apex": {
+ colour: "#0f9bd7",
+ icon: ''
+ },
+ "APL": {
+ colour: "#d2d2d2",
+ icon: '',
+ inlineComment: [
+ "\u235D"
+ ]
+ },
+ "AppleScript": {
+ colour: "#a8c2ab",
+ icon: '',
+ inlineComment: [
+ "--",
+ "#"
+ ]
+ },
+ "Arduino": {
+ colour: "#2d9094",
+ icon: 'file_type_arduino'
+ },
+ "ARM Assembly": {
+ colour: "#0000bf",
+ icon: 'file_type_assembly'
+ },
+ "AsciiDoc": {
+ colour: "#e40046",
+ icon: ''
+ },
+ "ASP.NET (C#)": {
+ colour: "#33a9dc",
+ icon: 'file_type_aspx'
+ },
+ "AutoHotkey": {
+ colour: "#d8d8d8",
+ icon: 'file_type_autohotkey'
+ },
+ "AutoIt": {
+ colour: "#5d83ac",
+ icon: ''
+ },
+ "Avro IDL": {
+ colour: "#0040ff",
+ icon: ''
+ },
+ "AWK": {
+ colour: "#d2d2d2",
+ icon: ''
+ },
+ "Batch": {
+ colour: "#d9b400",
+ icon: ''
+ },
+ "C#": {
+ colour: "#368832",
+ icon: 'file_type_csharp'
+ },
+ "C": {
+ colour: "#005f91",
+ icon: 'file_type_c',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "C++": {
+ colour: "#984c93",
+ icon: 'file_type_cpp',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "Clojure": {
+ colour: "#91dc47",
+ icon: ''
+ },
+ "CMake": {
+ colour: "#01a300",
+ icon: 'file_type_cmake'
+ },
+ "COBOL": {
+ colour: "#005ca5",
+ icon: ''
+ },
+ "CoffeeScript": {
+ colour: "#6f4e37",
+ icon: ''
+ },
+ "Crystal": {
+ colour: "#c8c8c8",
+ icon: ''
+ },
+ "CSS": {
+ colour: "#1572b6",
+ icon: ''
+ },
+ "CSV": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "D": {
+ colour: "#b03931",
+ icon: 'file_type_dlang',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "Dart": {
+ colour: "#58b6f0",
+ icon: ''
+ },
+ "Dhall": {
+ colour: "#b7b7b7",
+ icon: ''
+ },
+ "Diff": {
+ colour: "#c00000",
+ icon: ''
+ },
+ "Django/Jinja2": {
+ colour: "#ff0000",
+ icon: 'file_type_jinja'
+ },
+ "Docker": {
+ colour: "#0096e6",
+ icon: ''
+ },
+ "DOT (Graphviz)": {
+ colour: "#4ed1f8",
+ icon: ''
+ },
+ "EditorConfig": {
+ colour: "#e3e3f8",
+ icon: ''
+ },
+ "EJS": {
+ colour: "#90a93a",
+ icon: ''
+ },
+ "Elixir": {
+ colour: "#452459",
+ icon: 'file_type_elixir'
+ },
+ "Elm": {
+ colour: "#8cd636",
+ icon: ''
+ },
+ "ERB": {
+ colour: "#921a1e",
+ icon: ''
+ },
+ "Erlang": {
+ colour: "#a2003e",
+ icon: ''
+ },
+ "F#": {
+ colour: "#378bba",
+ icon: ''
+ },
+ "Firestore security rules": {
+ colour: "#f6820c",
+ icon: ''
+ },
+ "Flow": {
+ colour: "#ffb047",
+ icon: 'file_type_flow'
+ },
+ "Fortran": {
+ colour: "#734f96",
+ icon: ''
+ },
+ "FreeMarker Template Language": {
+ colour: "#0050b2",
+ icon: ''
+ },
+ "GameMaker Language": {
+ colour: "#8bc34a",
+ icon: ''
+ },
+ "G-code": {
+ colour: "#ba0000",
+ icon: ''
+ },
+ "GDScript": {
+ colour: "#478cbf",
+ icon: ''
+ },
+ "Git": {
+ colour: "#dd4c35",
+ icon: ''
+ },
+ "GLSL": {
+ colour: "#4386b5",
+ icon: ''
+ },
+ "Go module": {
+ colour: "#ce3262",
+ icon: ''
+ },
+ "Go": {
+ colour: "#00acd7",
+ icon: ''
+ },
+ "Gradle": {
+ colour: "#006533",
+ icon: ''
+ },
+ "GraphQL": {
+ colour: "#e10098",
+ icon: ''
+ },
+ "Groovy": {
+ colour: "#6398aa",
+ icon: ''
+ },
+ "Haml": {
+ colour: "#ecdfa7",
+ icon: ''
+ },
+ "Handlebars": {
+ colour: "#c19770",
+ icon: ''
+ },
+ "Haskell": {
+ colour: "#C04504",
+ icon: 'file_type_haskell2'
+ },
+ "Haxe": {
+ colour: "#f68712",
+ icon: ''
+ },
+ "HLSL": {
+ colour: "#0000ff",
+ icon: ''
+ },
+ "HTML": {
+ colour: "#e44f26",
+ icon: ''
+ },
+ "HTTP": {
+ colour: "#3b61a6",
+ icon: 'file_type_http'
+ },
+ "Idris": {
+ colour: "#8a0819",
+ icon: ''
+ },
+ "Ini": {
+ colour: "#99b8c4",
+ icon: ''
+ },
+ "Io": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "Java": {
+ colour: "#5382a1",
+ icon: '',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "JavaScript": {
+ colour: "#f5de19",
+ icon: '',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "JSON": {
+ colour: "#f5de19",
+ icon: ''
+ },
+ "JSON5": {
+ colour: "#909090",
+ icon: ''
+ },
+ "Julia": {
+ colour: "#4063d8",
+ icon: ''
+ },
+ "Kotlin": {
+ colour: "#9d4b9d",
+ icon: 'file_type_kotlin'
+ },
+ "Kusto": {
+ colour: "#59b4d9",
+ icon: ''
+ },
+ "LaTeX": {
+ colour: "#cfcfcf",
+ icon: '',
+ inlineComment: [
+ "%"
+ ]
+ },
+ "Less": {
+ colour: "#2a4f84",
+ icon: 'file_type_less'
+ },
+ "Liquid": {
+ colour: "#004999",
+ icon: ''
+ },
+ "Lisp": {
+ colour: "#8381c5",
+ icon: 'file_type_emacs'
+ },
+ "LiveScript": {
+ colour: "#317eac",
+ icon: ''
+ },
+ "Log file": {
+ colour: "#00bd02",
+ icon: ''
+ },
+ "LOLCODE": {
+ colour: "#8d2701",
+ icon: ''
+ },
+ "Lua": {
+ colour: "#050080",
+ icon: '',
+ inlineComment: [
+ "--"
+ ]
+ },
+ "Markdown": {
+ colour: "#755838",
+ icon: ''
+ },
+ "MATLAB": {
+ colour: "#ef6c3e",
+ icon: 'file_type_matlab',
+ inlineComment: [
+ "%"
+ ]
+ },
+ "MAXScript": {
+ colour: "#00696b",
+ icon: ''
+ },
+ "MEL": {
+ colour: "#06a0a2",
+ icon: 'file_type_maya'
+ },
+ "MongoDB": {
+ colour: "#41a247",
+ icon: 'file_type_mongo'
+ },
+ "nginx": {
+ colour: "#019639",
+ icon: ''
+ },
+ "Nim": {
+ colour: "#ffe953",
+ icon: '',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Nix": {
+ colour: "#5277c3",
+ icon: ''
+ },
+ "NSIS": {
+ colour: "#a42d26",
+ icon: ''
+ },
+ "Object Pascal": {
+ colour: "#FF6344",
+ icon: 'file_type_delphi'
+ },
+ "Objective-C": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "OCaml": {
+ colour: "#f29104",
+ icon: 'file_type_ocaml'
+ },
+ "Octave": {
+ colour: "#77cce1",
+ icon: ' '
+ },
+ "OpenCL": {
+ colour: "#FF1C1A",
+ icon: 'file_type_opencl'
+ },
+ "Pascal": {
+ colour: "#FF6344",
+ icon: 'file_type_delphi'
+ },
+ "Perl": {
+ colour: "#3a3c5b",
+ icon: '',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "PHP": {
+ colour: "#4c6b96",
+ icon: 'file_type_php',
+ inlineComment: [
+ "#",
+ "//"
+ ]
+ },
+ "PL/SQL": {
+ colour: "#ff0000",
+ icon: ''
+ },
+ "Plain text": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "PlantUML": {
+ colour: "#A11F41",
+ icon: 'file_type_plantuml'
+ },
+ "PowerQuery": {
+ colour: "#cfcfcf",
+ icon: ''
+ },
+ "PowerShell": {
+ colour: "#5391fe",
+ icon: 'file_type_powershell',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Processing": {
+ colour: "#1c4c70",
+ icon: 'file_type_processinglang'
+ },
+ "Prolog": {
+ colour: "#ec1c24",
+ icon: 'file_type_prolog'
+ },
+ "Protocol Buffers": {
+ colour: "#97ff27",
+ icon: ''
+ },
+ "Pug": {
+ colour: "#442823",
+ icon: ''
+ },
+ "Puppet": {
+ colour: "#ffae1a",
+ icon: ''
+ },
+ "PureScript": {
+ colour: "#16171b",
+ icon: ''
+ },
+ "Python": {
+ colour: "#3671A1",
+ icon: 'file_type_python',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Q (kdb+ database)": {
+ colour: "#1e78b3",
+ icon: ''
+ },
+ "Q#": {
+ colour: "#3333cc",
+ icon: ''
+ },
+ "QML": {
+ colour: "#41cd52",
+ icon: ''
+ },
+ "R": {
+ colour: "#276dc3",
+ icon: 'file_type_r',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Racket": {
+ colour: "#9f1d20",
+ icon: ''
+ },
+ "Razor C#": {
+ colour: "#368832",
+ icon: ''
+ },
+ "React JSX": {
+ colour: "#00d8ff",
+ icon: ''
+ },
+ "React TSX": {
+ colour: "#007acc",
+ icon: ''
+ },
+ "Reason": {
+ colour: "#dd4b39",
+ icon: ''
+ },
+ "Rego": {
+ colour: "#78929a",
+ icon: 'file_type_rego'
+ },
+ "ReScript": {
+ colour: "#e84f4f",
+ icon: 'file_type_rescript'
+ },
+ "reST (reStructuredText)": {
+ colour: "#ce3f31",
+ icon: ''
+ },
+ "Robot Framework": {
+ icon: ''
+ },
+ "Ruby": {
+ colour: "#b31301",
+ icon: 'file_type_ruby',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Rust": {
+ colour: "#a04f12",
+ icon: 'file_type_rust'
+ },
+ "SAS": {
+ colour: "#002bb5",
+ icon: ''
+ },
+ "Sass (Sass)": {
+ colour: "#cd6799",
+ icon: ''
+ },
+ "Sass (SCSS)": {
+ colour: "#cd6799",
+ icon: ''
+ },
+ "Scala": {
+ colour: "#e62d2a",
+ icon: 'file_type_scala'
+ },
+ "Shell session": {
+ colour: "#d9b400",
+ icon: ''
+ },
+ "Shell": {
+ colour: "#d9b400",
+ icon: ''
+ },
+ "Smarty": {
+ colour: "#f6e200",
+ icon: 'file_type_smarty'
+ },
+ "Solidity (Ethereum)": {
+ colour: "#c1c1c1",
+ icon: ''
+ },
+ "Solution file": {
+ colour: "#854cc7",
+ icon: 'file_type_sln'
+ },
+ "SPARQL": {
+ colour: "#0c479c",
+ icon: ''
+ },
+ "SQF": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "SQF: Status Quo Function (Arma 3)": {
+ colour: "#c2c2c2",
+ icon: ''
+ },
+ "SQL": {
+ colour: "#ffda44",
+ icon: '',
+ inlineComment: [
+ "--"
+ ]
+ },
+ "Squirrel": {
+ colour: "#a05a2c",
+ icon: ''
+ },
+ "Stan": {
+ colour: "#b2001d",
+ icon: 'file_type_stan',
+ inlineComment: [
+ "#"
+ ]
+ },
+ "Stata Ado": {
+ colour: "#3c6e8f",
+ icon: 'file_type_stata'
+ },
+ "Stylus": {
+ colour: "#c2c2c2",
+ icon: 'file_type_stylus'
+ },
+ "SVG": {
+ colour: "#ffb13b",
+ icon: ''
+ },
+ "Swift": {
+ colour: "#FA5D2D",
+ icon: 'file_type_swift',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "Systemd configuration file": {
+ colour: "#30d475",
+ icon: ''
+ },
+ "T4 templating": {
+ colour: "#1e88e5",
+ icon: ''
+ },
+ "T4 Text Templates (C#)": {
+ colour: "#1e88e5",
+ icon: ''
+ },
+ "T4 Text Templates (VB)": {
+ colour: "#1e88e5",
+ icon: ''
+ },
+ "Tcl": {
+ colour: "#eff1cb",
+ icon: ''
+ },
+ "Template Toolkit 2": {
+ colour: "#3bcefc",
+ icon: ''
+ },
+ "TeX": {
+ colour: "#cfcfcf",
+ icon: '',
+ inlineComment: [
+ "%"
+ ]
+ },
+ "Textile": {
+ colour: "#ffe7ac",
+ icon: ''
+ },
+ "TOML": {
+ colour: "#bfbfbf",
+ icon: ''
+ },
+ "TSConfig": {
+ colour: "#007acc",
+ icon: ''
+ },
+ "Twig": {
+ colour: "#78dc50",
+ icon: ''
+ },
+ "TypeScript": {
+ colour: "#3178c6",
+ icon: '',
+ inlineComment: [
+ "//"
+ ]
+ },
+ "TypoScript": {
+ colour: "#ff8700",
+ icon: ''
+ },
+ "V": {
+ colour: "#5d87bf",
+ icon: ''
+ },
+ "Vala": {
+ colour: "#403757",
+ icon: ''
+ },
+ "VB.Net": {
+ colour: "#00519a",
+ icon: ''
+ },
+ "VBA": {
+ colour: "#d87b30",
+ icon: ''
+ },
+ "Velocity": {
+ colour: "#262692",
+ icon: ''
+ },
+ "Verilog": {
+ colour: "#1a348f",
+ icon: ''
+ },
+ "VHDL": {
+ colour: "#0d9b35",
+ icon: ''
+ },
+ "vim": {
+ colour: "#43b54a",
+ icon: 'file_type_vim'
+ },
+ "Visual Basic": {
+ colour: "#00519a",
+ icon: ''
+ },
+ "WebAssembly": {
+ colour: "#654ff0",
+ icon: ''
+ },
+ "Wolfram language": {
+ colour: "#d01000",
+ icon: ''
+ },
+ "XML": {
+ colour: "#f1662a",
+ icon: ''
+ },
+ "XQuery": {
+ colour: "#f1662a",
+ icon: ''
+ },
+ "YAML": {
+ colour: "#ffe885",
+ icon: ''
+ },
+ "YANG": {
+ colour: "#231f20",
+ icon: ''
+ },
+ "Zig": {
+ colour: "#f7a41d",
+ icon: ''
+ }
+};
+var EXECUTE_CODE_LANGUAGE_ALIASES = ["javascript", "typescript", "bash", "csharp", "wolfram", "nb", "wl", "hs", "py", "scpt"];
+var EXECUTE_CODE_CANONICAL_LANGUAGES = ["js", "ts", "cs", "lean", "lua", "python", "cpp", "prolog", "shell", "groovy", "r", "go", "rust", "java", "powershell", "kotlin", "mathematica", "haskell", "scala", "racket", "fsharp", "c", "dart", "ruby", "batch", "sql", "octave", "maxima", "applescript"];
+var EXECUTE_CODE_SUPPORTED_LANGUAGES = [...EXECUTE_CODE_LANGUAGE_ALIASES, ...EXECUTE_CODE_CANONICAL_LANGUAGES];
+
+// src/SettingsTab.ts
+var import_obsidian = require("obsidian");
+var import_pickr = __toESM(require_pickr_min());
+
+// node_modules/colortranslator/esm/index.js
+var t = function() {
+ return t = Object.assign || function(t2) {
+ for (var e2, n2 = 1, r2 = arguments.length; n2 < r2; n2++)
+ for (var i2 in e2 = arguments[n2])
+ Object.prototype.hasOwnProperty.call(e2, i2) && (t2[i2] = e2[i2]);
+ return t2;
+ }, t.apply(this, arguments);
+};
+function e(t2, e2, n2) {
+ if (n2 || 2 === arguments.length)
+ for (var r2, i2 = 0, o2 = e2.length; i2 < o2; i2++)
+ !r2 && i2 in e2 || (r2 || (r2 = Array.prototype.slice.call(e2, 0, i2)), r2[i2] = e2[i2]);
+ return t2.concat(r2 || Array.prototype.slice.call(e2));
+}
+var n;
+var r;
+var i;
+var o;
+!function(t2) {
+ t2.HEX = "HEX", t2.RGB = "RGB", t2.HSL = "HSL", t2.CMYK = "CMYK";
+}(n || (n = {})), function(t2) {
+ t2.ANALOGOUS = "ANALOGOUS", t2.COMPLEMENTARY = "COMPLEMENTARY", t2.SPLIT_COMPLEMENTARY = "SPLIT_COMPLEMENTARY", t2.TRIADIC = "TRIADIC", t2.TETRADIC = "TETRADIC", t2.SQUARE = "SQUARE";
+}(r || (r = {})), function(t2) {
+ t2.ADDITIVE = "ADDITIVE", t2.SUBTRACTIVE = "SUBTRACTIVE";
+}(i || (i = {})), function(t2) {
+ t2.black = "#000000", t2.silver = "#C0C0C0", t2.gray = "#808080", t2.white = "#FFFFFF", t2.maroon = "#800000", t2.red = "#FF0000", t2.purple = "#800080", t2.fuchsia = "#FF00FF", t2.green = "#008000", t2.lime = "#00FF00", t2.olive = "#808000", t2.yellow = "#FFFF00", t2.navy = "#000080", t2.blue = "#0000FF", t2.teal = "#008080", t2.aqua = "#00FFFF", t2.orange = "#FFA500", t2.aliceblue = "#F0F8FF", t2.antiquewhite = "#FAEBD7", t2.aquamarine = "#7FFFD4", t2.azure = "#F0FFFF", t2.beige = "#F5F5DC", t2.bisque = "#FFE4C4", t2.blanchedalmond = "#FFEBCD", t2.blueviolet = "#8A2BE2", t2.brown = "#A52A2A", t2.burlywood = "#DEB887", t2.cadetblue = "#5F9EA0", t2.chartreuse = "#7FFF00", t2.chocolate = "#D2691E", t2.coral = "#FF7F50", t2.cornflowerblue = "#6495ED", t2.cornsilk = "#FFF8DC", t2.crimson = "#DC143C", t2.cyan = "#00FFFF", t2.darkblue = "#00008B", t2.darkcyan = "#008B8B", t2.darkgoldenrod = "#B8860B", t2.darkgray = "#A9A9A9", t2.darkgreen = "#006400", t2.darkgrey = "#A9A9A9", t2.darkkhaki = "#BDB76B", t2.darkmagenta = "#8B008B", t2.darkolivegreen = "#556B2F", t2.darkorange = "#FF8C00", t2.darkorchid = "#9932CC", t2.darkred = "#8B0000", t2.darksalmon = "#E9967A", t2.darkseagreen = "#8FBC8F", t2.darkslateblue = "#483D8B", t2.darkslategray = "#2F4F4F", t2.darkslategrey = "#2F4F4F", t2.darkturquoise = "#00CED1", t2.darkviolet = "#9400D3", t2.deeppink = "#FF1493", t2.deepskyblue = "#00BFFF", t2.dimgray = "#696969", t2.dimgrey = "#696969", t2.dodgerblue = "#1E90FF", t2.firebrick = "#B22222", t2.floralwhite = "#FFFAF0", t2.forestgreen = "#228B22", t2.gainsboro = "#DCDCDC", t2.ghostwhite = "#F8F8FF", t2.gold = "#FFD700", t2.goldenrod = "#DAA520", t2.greenyellow = "#ADFF2F", t2.grey = "#808080", t2.honeydew = "#F0FFF0", t2.hotpink = "#FF69B4", t2.indianred = "#CD5C5C", t2.indigo = "#4B0082", t2.ivory = "#FFFFF0", t2.khaki = "#F0E68C", t2.lavender = "#E6E6FA", t2.lavenderblush = "#FFF0F5", t2.lawngreen = "#7CFC00", t2.lemonchiffon = "#FFFACD", t2.lightblue = "#ADD8E6", t2.lightcoral = "#F08080", t2.lightcyan = "#E0FFFF", t2.lightgoldenrodyellow = "#FAFAD2", t2.lightgray = "#D3D3D3", t2.lightgreen = "#90EE90", t2.lightgrey = "#D3D3D3", t2.lightpink = "#FFB6C1", t2.lightsalmon = "#FFA07A", t2.lightseagreen = "#20B2AA", t2.lightskyblue = "#87CEFA", t2.lightslategray = "#778899", t2.lightslategrey = "#778899", t2.lightsteelblue = "#B0C4DE", t2.lightyellow = "#FFFFE0", t2.limegreen = "#32CD32", t2.linen = "#FAF0E6", t2.magenta = "#FF00FF", t2.mediumaquamarine = "#66CDAA", t2.mediumblue = "#0000CD", t2.mediumorchid = "#BA55D3", t2.mediumpurple = "#9370DB", t2.mediumseagreen = "#3CB371", t2.mediumslateblue = "#7B68EE", t2.mediumspringgreen = "#00FA9A", t2.mediumturquoise = "#48D1CC", t2.mediumvioletred = "#C71585", t2.midnightblue = "#191970", t2.mintcream = "#F5FFFA", t2.mistyrose = "#FFE4E1", t2.moccasin = "#FFE4B5", t2.navajowhite = "#FFDEAD", t2.oldlace = "#FDF5E6", t2.olivedrab = "#6B8E23", t2.orangered = "#FF4500", t2.orchid = "#DA70D6", t2.palegoldenrod = "#EEE8AA", t2.palegreen = "#98FB98", t2.paleturquoise = "#AFEEEE", t2.palevioletred = "#DB7093", t2.papayawhip = "#FFEFD5", t2.peachpuff = "#FFDAB9", t2.peru = "#CD853F", t2.pink = "#FFC0CB", t2.plum = "#DDA0DD", t2.powderblue = "#B0E0E6", t2.rosybrown = "#BC8F8F", t2.royalblue = "#4169E1", t2.saddlebrown = "#8B4513", t2.salmon = "#FA8072", t2.sandybrown = "#F4A460", t2.seagreen = "#2E8B57", t2.seashell = "#FFF5EE", t2.sienna = "#A0522D", t2.skyblue = "#87CEEB", t2.slateblue = "#6A5ACD", t2.slategray = "#708090", t2.slategrey = "#708090", t2.snow = "#FFFAFA", t2.springgreen = "#00FF7F", t2.steelblue = "#4682B4", t2.tan = "#D2B48C", t2.thistle = "#D8BFD8", t2.tomato = "#FF6347", t2.turquoise = "#40E0D0", t2.violet = "#EE82EE", t2.wheat = "#F5DEB3", t2.whitesmoke = "#F5F5F5", t2.yellowgreen = "#9ACD32", t2.rebeccapurple = "#663399";
+}(o || (o = {}));
+var a;
+var c;
+var u = Object.keys(o);
+var s = { HEX: ["r", "g", "b", "a"], RGB: ["r", "g", "b", "a"], HSL: ["h", "s", "l", "a"], CMYK: ["c", "m", "y", "k", "a"] };
+var d = { BGR: n.RGB, ABGR: n.RGB, HLS: n.HSL, AHLS: n.HSL, CKMY: n.CMYK, ACKMY: n.CMYK };
+!function(t2) {
+ t2.NUMBER = "number", t2.BOOLEAN = "boolean";
+}(a || (a = {}));
+var l;
+var f;
+var h;
+var p = ((c = {})[n.HEX] = /^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i, c[n.RGB] = /^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/, c[n.HSL] = /^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\s*((?:\d*\.)?\d+)%(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/, c[n.CMYK] = /^(?:device-cmyk|cmyk)\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/, c);
+var g = /^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/;
+var m = /^(\d+(?:\.\d+)?|\.\d+)%$/;
+var b = /^0x([a-f\d]{1,2})$/i;
+var A = /\{(\d+)\}/g;
+var y = /,( +|\d+)/g;
+var E = / +/;
+var F = "The provided string color doesn't have a correct format";
+var v = "The provided color object doesn't have the proper keys or format";
+!function(t2) {
+ t2.NONE = "none", t2.DEGREES = "deg", t2.GRADIANS = "grad", t2.RADIANS = "rad", t2.TURNS = "turn";
+}(l || (l = {})), function(t2) {
+ t2.NONE = "none", t2.PERCENT = "percent";
+}(f || (f = {})), function(t2) {
+ t2.DEVICE_CMYK = "device-cmyk", t2.CMYK = "cmyk";
+}(h || (h = {}));
+var H;
+var B;
+var C;
+var S;
+var R;
+var M;
+var D = { decimals: 6, legacyCSS: false, spacesAfterCommas: false, anglesUnit: l.NONE, rgbUnit: f.NONE, cmykUnit: f.PERCENT, alphaUnit: f.NONE, cmykFunction: h.DEVICE_CMYK };
+var O = function(t2, e2) {
+ return Object.prototype.hasOwnProperty.call(t2, e2);
+};
+var L = function(t2) {
+ return +"".concat(t2).replace(m, "$1");
+};
+var G = function(t2) {
+ return m.test("".concat(t2)) ? L(t2) : Math.min(+t2, 100);
+};
+var k = function(t2) {
+ return 1 === t2.length && (t2 += t2), parseInt(t2, 16);
+};
+var j = function(t2) {
+ var e2 = K(t2, 0).toString(16).toUpperCase();
+ return 1 === e2.length ? "0x0".concat(e2) : "0x".concat(e2);
+};
+var X = function(t2, e2) {
+ return void 0 === e2 && (e2 = false), !e2 && m.test(t2) ? Math.min(255 * L(t2) / 100, 255) : b.test(t2) ? (3 === t2.length && (t2 += t2.slice(-1)), e2 ? K(t2) / 255 : K(t2)) : Math.min(+t2, e2 ? 1 : 255);
+};
+var I = function(t2) {
+ return Math.min(m.test(t2) ? L(t2) / 100 : +t2, 1);
+};
+var Y = function(t2) {
+ return e([], t2, true).sort().join("").toUpperCase();
+};
+var K = function(t2, e2) {
+ void 0 === e2 && (e2 = 6);
+ var n2 = Math.pow(10, e2);
+ return Math.round(+t2 * n2) / n2;
+};
+var N = function(t2, e2, n2) {
+ return Math.max(e2, Math.min(t2, n2));
+};
+var T = function(t2) {
+ if ("string" == typeof t2) {
+ var e2 = t2.match(g), n2 = +e2[1];
+ switch (e2[2]) {
+ case l.RADIANS:
+ t2 = K(180 * n2 / Math.PI);
+ break;
+ case l.TURNS:
+ t2 = K(360 * n2);
+ break;
+ case l.GRADIANS:
+ t2 = K(0.9 * n2);
+ break;
+ case l.DEGREES:
+ default:
+ t2 = n2;
+ }
+ }
+ return (t2 > 360 || t2 < 0) && (t2 -= 360 * Math.floor(t2 / 360)), t2;
+};
+var P = function(t2, e2) {
+ var n2;
+ switch (e2) {
+ case l.RADIANS:
+ n2 = K(function(t3) {
+ return t3 * Math.PI / 180;
+ }(t2));
+ break;
+ case l.TURNS:
+ n2 = K(t2 / 360);
+ break;
+ case l.GRADIANS:
+ n2 = K(10 / 9 * t2);
+ break;
+ case l.DEGREES:
+ case l.NONE:
+ default:
+ n2 = t2;
+ }
+ return n2;
+};
+var U = function(t2) {
+ for (var e2 = [], n2 = 1; n2 < arguments.length; n2++)
+ e2[n2 - 1] = arguments[n2];
+ for (var r2 = [], i2 = [], o2 = [], c2 = [], u2 = [], s3 = Object.values(l), d2 = Object.values(f), b2 = Object.values(h), A2 = { legacyCSS: 0, spacesAfterCommas: 0, cmykFunction: 0 }, F2 = 0, v2 = e2; F2 < v2.length; F2++) {
+ var H2 = v2[F2];
+ if ("string" == typeof H2) {
+ if (r2.push(H2), H2.includes(",")) {
+ A2.legacyCSS++;
+ var B2 = H2.match(y);
+ 1 === new Set(B2).size && E.test(B2[0].slice(1)) && A2.spacesAfterCommas++;
+ }
+ if (H2.match(p.HSL)) {
+ var C2 = (k2 = H2.match(p.HSL))[1] || k2[5], S2 = k2[8], R2 = C2.match(g)[2];
+ i2.push("" === R2 ? l.NONE : R2), u2.push(m.test(S2));
+ continue;
+ }
+ if (p.RGB.test(H2)) {
+ var M2 = (k2 = H2.match(p.RGB))[1] || k2[5], O2 = k2[2] || k2[6], L2 = k2[3] || k2[7], G2 = k2[8];
+ o2.push(m.test(M2) && m.test(O2) && m.test(L2)), u2.push(m.test(G2));
+ continue;
+ }
+ if (H2.match(p.CMYK)) {
+ var k2, j2 = (k2 = H2.match(p.CMYK))[1] || k2[6], X2 = k2[2] || k2[7], I2 = k2[3] || k2[8], Y2 = k2[4] || k2[9];
+ G2 = k2[10];
+ c2.push(m.test(j2) && m.test(X2) && m.test(I2) && m.test(Y2)), H2.startsWith("cmyk") && A2.cmykFunction++, u2.push(m.test(G2));
+ }
+ }
+ }
+ return { decimals: typeof t2.decimals === a.NUMBER ? t2.decimals : D.decimals, legacyCSS: typeof t2.legacyCSS === a.BOOLEAN ? t2.legacyCSS : Boolean(r2.length && A2.legacyCSS === r2.length) || D.legacyCSS, spacesAfterCommas: typeof t2.spacesAfterCommas === a.BOOLEAN ? t2.spacesAfterCommas : Boolean(r2.length && A2.spacesAfterCommas === r2.length) || D.spacesAfterCommas, anglesUnit: t2.anglesUnit && s3.includes(t2.anglesUnit) ? t2.anglesUnit : 1 === new Set(i2).size ? i2[0] : D.anglesUnit, rgbUnit: t2.rgbUnit && d2.includes(t2.rgbUnit) ? t2.rgbUnit : 1 === new Set(o2).size && o2[0] ? f.PERCENT : D.rgbUnit, cmykUnit: t2.cmykUnit && d2.includes(t2.cmykUnit) ? t2.cmykUnit : 1 !== new Set(c2).size || c2[0] ? D.cmykUnit : f.NONE, alphaUnit: t2.alphaUnit && d2.includes(t2.alphaUnit) ? t2.alphaUnit : 1 === new Set(u2).size && u2[0] ? f.PERCENT : D.alphaUnit, cmykFunction: t2.cmykFunction && b2.includes(t2.cmykFunction) ? t2.cmykFunction : c2.length && c2.length === A2.cmykFunction ? h.CMYK : D.cmykFunction };
+};
+var w = function(t2, e2, n2) {
+ return n2 < 0 && (n2 += 6), n2 >= 6 && (n2 -= 6), K(n2 < 1 ? 255 * ((e2 - t2) * n2 + t2) : n2 < 3 ? 255 * e2 : n2 < 4 ? 255 * ((e2 - t2) * (4 - n2) + t2) : 255 * t2);
+};
+var x = function(t2, e2, n2) {
+ e2 /= 100;
+ var r2 = (n2 /= 100) <= 0.5 ? n2 * (e2 + 1) : n2 + e2 - n2 * e2, i2 = 2 * n2 - r2;
+ return { r: w(i2, r2, (t2 /= 60) + 2), g: w(i2, r2, t2), b: w(i2, r2, t2 - 2) };
+};
+var V = function(t2, e2, n2, r2) {
+ return { r: K(255 * (1 - t2) * (r2 = 1 - r2)), g: K(255 * (1 - e2) * r2), b: K(255 * (1 - n2) * r2) };
+};
+var q = function(t2, e2, n2) {
+ t2 /= 255, e2 /= 255, n2 /= 255;
+ var r2 = 1 - Math.max(t2, e2, n2), i2 = 1 - r2, o2 = i2 && (i2 - e2) / i2, a2 = i2 && (i2 - n2) / i2;
+ return { c: K(100 * (i2 && (i2 - t2) / i2)), m: K(100 * o2), y: K(100 * a2), k: K(100 * r2) };
+};
+var _ = function(t2, e2, n2, r2) {
+ void 0 === r2 && (r2 = 1), t2 /= 255, e2 /= 255, n2 /= 255, r2 = Math.min(r2, 1);
+ var i2 = Math.max(t2, e2, n2), o2 = Math.min(t2, e2, n2), a2 = i2 - o2, c2 = 0, u2 = 0, s3 = (i2 + o2) / 2;
+ if (0 !== a2) {
+ switch (i2) {
+ case t2:
+ c2 = (e2 - n2) / a2 % 6;
+ break;
+ case e2:
+ c2 = (n2 - t2) / a2 + 2;
+ break;
+ case n2:
+ c2 = (t2 - e2) / a2 + 4;
+ }
+ (c2 = K(60 * c2)) < 0 && (c2 += 360), u2 = a2 / (1 - Math.abs(2 * s3 - 1));
+ }
+ return { h: c2, s: K(100 * u2), l: K(100 * s3), a: r2 };
+};
+var $ = function(t2, e2) {
+ if (t2 < 0 && (t2 += 360), t2 > 360 && (t2 -= 360), 360 === t2 || 0 === t2)
+ return t2;
+ var n2 = [[0, 120], [120, 180], [180, 240], [240, 360]], r2 = [[0, 60], [60, 120], [120, 240], [240, 360]], i2 = e2 ? r2 : n2, o2 = 0, a2 = 0, c2 = 0, u2 = 0;
+ return (e2 ? n2 : r2).find(function(e3, n3) {
+ return t2 >= e3[0] && t2 < e3[1] && (o2 = e3[0], a2 = e3[1], c2 = i2[n3][0], u2 = i2[n3][1], true);
+ }), c2 + (u2 - c2) / (a2 - o2) * (t2 - o2);
+};
+var z = function(t2) {
+ return t2 ? ", " : ",";
+};
+var Q = function(t2, e2) {
+ var n2 = Y(Object.keys(t2));
+ return s[d[n2]].reduce(function(n3, r2, i2) {
+ var o2 = t2[r2];
+ return void 0 !== o2 && n3.push(e2(o2, i2)), n3;
+ }, []);
+};
+var W = function(t2, e2) {
+ return t2.replace(A, function(t3, n2) {
+ return "".concat(e2[+n2 - 1]);
+ });
+};
+var J = function(t2, e2) {
+ var n2 = e2.alphaUnit, r2 = e2.legacyCSS, i2 = e2.decimals;
+ return n2 !== f.PERCENT || r2 ? K(t2, i2) : "".concat(K(100 * t2, i2), "%");
+};
+var Z = ((H = {})[n.HEX] = function(t2) {
+ var e2 = Q(t2, function(t3) {
+ return e3 = K(t3), 1 === (n3 = K(e3, 0).toString(16).toUpperCase()).length && (n3 = "0".concat(n3)), n3;
+ var e3, n3;
+ }), n2 = 4 === e2.length ? "#{1}{2}{3}{4}" : "#{1}{2}{3}";
+ return W(n2, e2);
+}, H[n.RGB] = function(t2, e2) {
+ var n2 = e2.decimals, r2 = e2.legacyCSS, i2 = e2.spacesAfterCommas, o2 = e2.rgbUnit, a2 = z(i2), c2 = Q(t2, function(t3, r3) {
+ return o2 === f.PERCENT && r3 < 3 ? "".concat(function(t4, e3) {
+ return K(t4 / 255 * 100, e3);
+ }(t3, n2), "%") : 3 === r3 ? J(t3, e2) : K(t3, n2);
+ }), u2 = r2 ? 4 === c2.length ? "rgba({1}".concat(a2, "{2}").concat(a2, "{3}").concat(a2, "{4})") : "rgb({1}".concat(a2, "{2}").concat(a2, "{3})") : 4 === c2.length ? "rgb({1} {2} {3} / {4})" : "rgb({1} {2} {3})";
+ return W(u2, c2);
+}, H[n.HSL] = function(t2, e2) {
+ var n2 = e2.decimals, r2 = e2.legacyCSS, i2 = e2.spacesAfterCommas, o2 = e2.anglesUnit, a2 = z(i2), c2 = Q(t2, function(t3, r3) {
+ if (0 === r3 && o2 !== l.NONE) {
+ var i3 = K(P(t3, o2), n2);
+ return "".concat(i3).concat(o2);
+ }
+ return 3 === r3 ? J(t3, e2) : K(t3, n2);
+ }), u2 = r2 ? 4 === c2.length ? "hsla({1}".concat(a2, "{2}%").concat(a2, "{3}%").concat(a2, "{4})") : "hsl({1}".concat(a2, "{2}%").concat(a2, "{3}%)") : 4 === c2.length ? "hsl({1} {2}% {3}% / {4})" : "hsl({1} {2}% {3}%)";
+ return W(u2, c2);
+}, H[n.CMYK] = function(t2, e2) {
+ var n2 = e2.decimals, r2 = e2.legacyCSS, i2 = e2.spacesAfterCommas, o2 = e2.cmykUnit, a2 = e2.cmykFunction, c2 = z(i2), u2 = Q(t2, function(t3, r3) {
+ return o2 === f.PERCENT && r3 < 4 ? "".concat(K(t3, n2), "%") : 4 === r3 ? J(t3, e2) : K(t3 / 100, n2);
+ }), s3 = r2 ? 5 === u2.length ? "".concat(a2, "({1}").concat(c2, "{2}").concat(c2, "{3}").concat(c2, "{4}").concat(c2, "{5})") : "".concat(a2, "({1}").concat(c2, "{2}").concat(c2, "{3}").concat(c2, "{4})") : 5 === u2.length ? "".concat(a2, "({1} {2} {3} {4} / {5})") : "".concat(a2, "({1} {2} {3} {4})");
+ return W(s3, u2);
+}, H);
+var tt = function(t2) {
+ return "string" == typeof t2 && (t2 = m.test(t2) ? L(t2) / 100 : +t2), isNaN(+t2) || t2 > 1 ? 1 : K(t2);
+};
+var et = function(n2, r2, o2) {
+ return r2.reduce(function(r3, a2) {
+ return e(e([], r3, true), [t(t({}, n2), { h: o2 === i.ADDITIVE ? T(n2.h + a2) : T($($(n2.h, false) + a2, true)) })], false);
+ }, [t({}, n2)]);
+};
+var nt = function(t2, e2) {
+ return et(t2, [30, -30], e2);
+};
+var rt = function(t2, e2) {
+ return et(t2, [180], e2);
+};
+var it = function(t2, e2) {
+ return et(t2, [150, -150], e2);
+};
+var ot = function(t2, e2) {
+ return et(t2, [120, -120], e2);
+};
+var at = function(t2, e2) {
+ return et(t2, [60, -120, 180], e2);
+};
+var ct = function(t2, e2) {
+ return et(t2, [90, -90, 180], e2);
+};
+var ut = function(t2) {
+ return "string" == typeof t2 ? function(t3) {
+ var e2;
+ if (Object.keys(n).some(function(n2) {
+ if (p[n2].test(t3))
+ return e2 = n2, true;
+ }), !e2 && ~u.indexOf(t3) && (e2 = n.HEX), !e2)
+ throw new Error(F);
+ return e2;
+ }(t2) : function(t3) {
+ var e2, r2 = false, i2 = Y(Object.keys(t3));
+ if (d[i2] && (e2 = d[i2]), e2 && e2 === n.RGB) {
+ var o2 = Object.entries(t3).some(function(t4) {
+ return !b.test("".concat(t4[1]));
+ }), a2 = Object.entries(t3).some(function(t4) {
+ return !(m.test("".concat(t4[1])) || !b.test("".concat(t4[1])) && !isNaN(+t4[1]) && +t4[1] <= 255);
+ });
+ o2 && a2 && (r2 = true), o2 || (e2 = n.HEX);
+ }
+ if (!e2 || r2)
+ throw new Error(v);
+ return e2;
+ }(t2);
+};
+var st = ((B = {})[n.HEX] = function(t2) {
+ var e2 = (~u.indexOf(t2) ? o[t2] : t2).match(p.HEX), n2 = { r: k(e2[1] || e2[5]), g: k(e2[2] || e2[6]), b: k(e2[3] || e2[7]) }, r2 = e2[4] || e2[8];
+ return void 0 !== r2 && (n2.a = k(r2) / 255), n2;
+}, B[n.RGB] = function(t2) {
+ var e2 = t2.match(p.RGB), n2 = X(e2[1] || e2[5]), r2 = X(e2[2] || e2[6]), i2 = X(e2[3] || e2[7]), o2 = e2[4] || e2[8], a2 = { r: Math.min(n2, 255), g: Math.min(r2, 255), b: Math.min(i2, 255) };
+ return void 0 !== o2 && (a2.a = tt(o2)), a2;
+}, B[n.HSL] = function(t2) {
+ var e2 = t2.match(p.HSL), n2 = T(e2[1] || e2[5]), r2 = G(e2[2] || e2[6]), i2 = G(e2[3] || e2[7]), o2 = e2[4] || e2[8], a2 = x(n2, r2, i2);
+ return void 0 !== o2 && (a2.a = tt(o2)), a2;
+}, B[n.CMYK] = function(t2) {
+ var e2 = t2.match(p.CMYK), n2 = I(e2[1] || e2[6]), r2 = I(e2[2] || e2[7]), i2 = I(e2[3] || e2[8]), o2 = I(e2[4] || e2[9]), a2 = e2[5] || e2[10], c2 = V(n2, r2, i2, o2);
+ return void 0 !== a2 && (c2.a = tt(a2)), c2;
+}, B);
+var dt = ((C = {})[n.HEX] = function(t2) {
+ var e2 = { r: X("".concat(t2.r)), g: X("".concat(t2.g)), b: X("".concat(t2.b)) };
+ return O(t2, "a") && (e2.a = Math.min(X("".concat(t2.a), true), 1)), e2;
+}, C[n.RGB] = function(t2) {
+ return this.HEX(t2);
+}, C[n.HSL] = function(t2) {
+ var e2 = G("".concat(t2.s)), n2 = G("".concat(t2.l)), r2 = x(T(t2.h), e2, n2);
+ return O(t2, "a") && (r2.a = tt(t2.a)), r2;
+}, C[n.CMYK] = function(t2) {
+ var e2 = I("".concat(t2.c)), n2 = I("".concat(t2.m)), r2 = I("".concat(t2.y)), i2 = I("".concat(t2.k)), o2 = V(e2, n2, r2, i2);
+ return O(t2, "a") && (o2.a = tt(t2.a)), o2;
+}, C);
+var lt = function(t2, e2) {
+ return void 0 === e2 && (e2 = ut(t2)), "string" == typeof t2 ? st[e2](t2) : dt[e2](t2);
+};
+var ft = ((S = {})[n.HEX] = function(t2) {
+ return { r: j(t2.r), g: j(t2.g), b: j(t2.b) };
+}, S.HEXA = function(t2) {
+ var e2 = ft.HEX(t2);
+ return e2.a = O(t2, "a") ? j(255 * t2.a) : "0xFF", e2;
+}, S[n.RGB] = function(t2, e2) {
+ var n2 = mt(t2, e2);
+ return O(n2, "a") && delete n2.a, n2;
+}, S.RGBA = function(t2, e2) {
+ var n2 = ft.RGB(t2, e2);
+ return n2.a = O(t2, "a") ? K(t2.a) : 1, n2;
+}, S[n.HSL] = function(t2, e2) {
+ var n2 = _(t2.r, t2.g, t2.b);
+ return delete n2.a, bt(n2, e2);
+}, S.HSLA = function(t2, e2) {
+ var n2 = ft.HSL(t2, e2);
+ return n2.a = O(t2, "a") ? K(t2.a, e2) : 1, n2;
+}, S[n.CMYK] = function(t2, e2) {
+ return At(q(t2.r, t2.g, t2.b), e2);
+}, S.CMYKA = function(t2, e2) {
+ var n2 = ft.CMYK(t2, e2);
+ return n2.a = O(t2, "a") ? K(t2.a, e2) : 1, n2;
+}, S);
+var ht = function(e2, r2, i2, o2) {
+ var a2 = ut(e2), c2 = "string" == typeof e2, u2 = lt(e2, a2), s3 = "string" == typeof e2 && O(u2, "a") || "string" != typeof e2 && O(e2, "a"), d2 = _(u2.r, u2.g, u2.b, u2.a);
+ s3 || delete d2.a;
+ var l2 = i2 ? d2.l / (r2 + 1) : (100 - d2.l) / (r2 + 1), f2 = Array(r2).fill(null).map(function(e3, n2) {
+ return t(t({}, d2), { l: d2.l + l2 * (n2 + 1) * (1 - 2 * +i2) });
+ });
+ switch (a2) {
+ case n.HEX:
+ default:
+ return f2.map(function(e3) {
+ var n2 = x(e3.h, e3.s, e3.l);
+ return s3 && (n2.a = e3.a), c2 ? s3 ? Z.HEX(t(t({}, n2), { a: K(255 * n2.a) })) : Z.HEX(n2) : s3 ? ft.HEXA(n2) : ft.HEX(n2);
+ });
+ case n.RGB:
+ return f2.map(function(t2) {
+ var e3 = x(t2.h, t2.s, t2.l);
+ return s3 && (e3.a = t2.a), c2 ? Z.RGB(e3, o2) : s3 ? ft.RGBA(e3, o2.decimals) : ft.RGB(e3, o2.decimals);
+ });
+ case n.HSL:
+ return f2.map(function(e3) {
+ return c2 ? Z.HSL(e3, o2) : s3 ? ft.HSLA(t(t({}, x(e3.h, e3.s, e3.l)), { a: e3.a }), o2.decimals) : ft.HSL(x(e3.h, e3.s, e3.l), o2.decimals);
+ });
+ }
+};
+var pt = ((R = { buildHarmony: function(t2, e2, r2, i2) {
+ var o2 = ut(t2), a2 = lt(t2, o2), c2 = _(a2.r, a2.g, a2.b, a2.a), u2 = "string" == typeof t2 && O(a2, "a") || "string" != typeof t2 && O(t2, "a"), s3 = "string" == typeof t2;
+ switch (o2) {
+ case n.HEX:
+ default:
+ return u2 ? this.HEXA(bt(c2, 0), e2, r2, s3) : this.HEX(bt(c2, 0), e2, r2, s3);
+ case n.HSL:
+ return u2 ? this.HSLA(c2, e2, r2, s3, i2) : this.HSL(c2, e2, r2, s3, i2);
+ case n.RGB:
+ return u2 ? this.RGBA(c2, e2, r2, s3, i2) : this.RGB(c2, e2, r2, s3, i2);
+ }
+} })[n.HEX] = function(t2, e2, n2, r2) {
+ return e2(t2, n2).map(function(t3) {
+ return r2 ? Z.HEX(x(t3.h, t3.s, t3.l)) : ft.HEX(x(t3.h, t3.s, t3.l));
+ });
+}, R.HEXA = function(e2, n2, r2, i2) {
+ return n2(e2, r2).map(function(e3) {
+ return i2 ? Z.HEX(t(t({}, x(e3.h, e3.s, e3.l)), { a: 255 * tt(e3.a) })) : ft.HEXA(t(t({}, x(e3.h, e3.s, e3.l)), { a: tt(e3.a) }));
+ });
+}, R[n.RGB] = function(t2, e2, n2, r2, i2) {
+ return e2(t2, n2).map(function(t3) {
+ return r2 ? Z.RGB(x(t3.h, t3.s, t3.l), i2) : ft.RGB(x(t3.h, t3.s, t3.l), i2.decimals);
+ });
+}, R.RGBA = function(e2, n2, r2, i2, o2) {
+ return n2(e2, r2).map(function(e3) {
+ return i2 ? Z.RGB(t(t({}, x(e3.h, e3.s, e3.l)), { a: tt(e3.a) }), o2) : ft.RGBA(t(t({}, x(e3.h, e3.s, e3.l)), { a: tt(e3.a) }), o2.decimals);
+ });
+}, R[n.HSL] = function(t2, e2, n2, r2, i2) {
+ return e2(t2, n2).map(function(t3) {
+ return r2 ? Z.HSL({ h: t3.h, s: t3.s, l: t3.l }, i2) : ft.HSL(x(t3.h, t3.s, t3.l), i2.decimals);
+ });
+}, R.HSLA = function(e2, n2, r2, i2, o2) {
+ return n2(e2, r2).map(function(e3) {
+ return i2 ? Z.HSL(t(t({}, e3), { a: tt(e3.a) }), o2) : ft.HSLA(t(t({}, x(e3.h, e3.s, e3.l)), { a: tt(e3.a) }), o2.decimals);
+ });
+}, R);
+var gt = ((M = { mix: function(e2, n2) {
+ var r2, o2, a2, c2, u2, s3, d2, l2, f2, h3, p3, g2, m2, b2, A2, y2 = e2.map(function(t2) {
+ var e3 = ut(t2);
+ return lt(t2, e3);
+ }), E2 = n2 === i.SUBTRACTIVE ? y2.map(function(t2) {
+ var e3, n3, r3, i2, o3, a3, c3, u3, s4, d3, l3, f3, h4, p4, g3 = (e3 = t2.r, n3 = t2.g, r3 = t2.b, i2 = Math.min(e3, n3, r3), o3 = Math.min(255 - e3, 255 - n3, 255 - r3), a3 = e3 - i2, c3 = n3 - i2, u3 = r3 - i2, s4 = Math.min(a3, c3), d3 = a3 - s4, l3 = (c3 + s4) / 2, f3 = (u3 + c3 - s4) / 2, h4 = Math.max(d3, l3, f3) / Math.max(a3, c3, u3), p4 = isNaN(h4) || h4 === 1 / 0 || h4 <= 0 ? 1 : h4, { r: d3 / p4 + o3, y: l3 / p4 + o3, b: f3 / p4 + o3 });
+ return O(t2, "a") && (g3.a = t2.a), g3;
+ }) : null;
+ function F2(e3) {
+ var r3 = n2 === i.ADDITIVE ? { r: 0, g: 0, b: 0, a: 0 } : { r: 0, y: 0, b: 0, a: 0 };
+ return e3.reduce(function(e4, r4) {
+ var o3 = O(r4, "a") ? r4.a : 1, a3 = { r: Math.min(e4.r + r4.r * o3, 255), b: Math.min(e4.b + r4.b * o3, 255), a: 1 - (1 - o3) * (1 - e4.a) }, c3 = "g" in e4 ? e4.g : e4.y, u3 = "g" in r4 ? r4.g : r4.y;
+ return t(t({}, a3), n2 === i.ADDITIVE ? { g: Math.min(c3 + u3 * o3, 255) } : { y: Math.min(c3 + u3 * o3, 255) });
+ }, r3);
+ }
+ if (n2 === i.ADDITIVE)
+ r2 = F2(y2);
+ else {
+ var v2 = F2(E2);
+ o2 = v2.r, a2 = v2.y, c2 = v2.b, u2 = Math.min(o2, a2, c2), s3 = Math.min(255 - o2, 255 - a2, 255 - c2), d2 = o2 - u2, l2 = a2 - u2, f2 = c2 - u2, h3 = Math.min(l2, f2), p3 = d2 + l2 - h3, g2 = l2 + h3, m2 = 2 * (f2 - h3), b2 = Math.max(p3, g2, m2) / Math.max(d2, l2, f2), A2 = isNaN(b2) || b2 === 1 / 0 || b2 <= 0 ? 1 : b2, (r2 = { r: p3 / A2 + s3, g: g2 / A2 + s3, b: m2 / A2 + s3 }).a = v2.a;
+ }
+ return { r: K(r2.r), g: K(r2.g), b: K(r2.b), a: N(r2.a, 0, 1) };
+} })[n.HEX] = function(t2, e2, n2) {
+ var r2 = this.mix(t2, e2);
+ return delete r2.a, n2 ? Z.HEX(r2) : ft.HEX(r2);
+}, M.HEXA = function(t2, e2, n2) {
+ var r2 = this.mix(t2, e2);
+ return r2.a = n2 ? 255 * tt(r2.a) : tt(r2.a), n2 ? Z.HEX(r2) : ft.HEXA(r2);
+}, M[n.RGB] = function(t2, e2, n2, r2) {
+ var i2 = this.mix(t2, e2);
+ return delete i2.a, n2 ? Z.RGB(i2, r2) : ft.RGB(i2, r2.decimals);
+}, M.RGBA = function(t2, e2, n2, r2) {
+ var i2 = this.mix(t2, e2);
+ return n2 ? Z.RGB(i2, r2) : ft.RGBA(i2, r2.decimals);
+}, M[n.HSL] = function(t2, e2, n2, r2) {
+ var i2 = this.mix(t2, e2), o2 = _(i2.r, i2.g, i2.b);
+ return delete i2.a, delete o2.a, n2 ? Z.HSL(o2, r2) : ft.HSL(i2, r2.decimals);
+}, M.HSLA = function(t2, e2, n2, r2) {
+ var i2 = this.mix(t2, e2), o2 = _(i2.r, i2.g, i2.b, i2.a);
+ return n2 ? Z.HSL(o2, r2) : ft.HSLA(i2, r2.decimals);
+}, M);
+var mt = function(e2, n2) {
+ var r2 = K(e2.r, n2), i2 = K(e2.g, n2), o2 = K(e2.b, n2);
+ return t({ r: r2, g: i2, b: o2 }, O(e2, "a") ? { a: K(e2.a, n2) } : {});
+};
+var bt = function(e2, n2) {
+ return t({ h: K(e2.h, n2), s: K(e2.s, n2), l: K(e2.l, n2) }, O(e2, "a") ? { a: K(e2.a, n2) } : {});
+};
+var At = function(t2, e2) {
+ return { c: K(t2.c, e2), m: K(t2.m, e2), y: K(t2.y, e2), k: K(t2.k, e2) };
+};
+var yt = function(t2, e2, n2, r2) {
+ return r2(lt(t2, e2), n2);
+};
+var Et = function(t2, e2, n2, r2, i2) {
+ n2 < 1 && (n2 = 5);
+ var o2 = function(t3, e3, n3) {
+ var r3 = n3 - 1, i3 = (e3.r - t3.r) / r3, o3 = (e3.g - t3.g) / r3, a2 = (e3.b - t3.b) / r3, c2 = tt(t3.a), u2 = (tt(e3.a) - c2) / r3;
+ return Array(n3).fill(null).map(function(n4, s3) {
+ return 0 === s3 ? t3 : s3 === r3 ? e3 : { r: K(t3.r + i3 * s3), g: K(t3.g + o3 * s3), b: K(t3.b + a2 * s3), a: K(c2 + u2 * s3) };
+ });
+ }(lt(t2), lt(e2), n2);
+ return o2.map(function(t3) {
+ return i2(t3, r2);
+ });
+};
+var Ft = function() {
+ function n2(t2, e2) {
+ void 0 === e2 && (e2 = {}), this._options = U(e2, t2), this.rgb = lt(t2), this.updateHSL(), this.updateCMYK();
+ }
+ return n2.prototype.updateRGB = function() {
+ this.rgb = t(t({}, x(this.hsl.h, this.hsl.s, this.hsl.l)), { a: this.hsl.a });
+ }, n2.prototype.updateRGBFromCMYK = function() {
+ this.rgb = t(t({}, V(this.cmyk.c, this.cmyk.m, this.cmyk.y, this.cmyk.k)), { a: this.rgb.a });
+ }, n2.prototype.updateHSL = function() {
+ this.hsl = _(this.rgb.r, this.rgb.g, this.rgb.b, this.rgb.a);
+ }, n2.prototype.updateCMYK = function() {
+ this.cmyk = q(this.rgb.r, this.rgb.g, this.rgb.b);
+ }, n2.prototype.updateRGBAndCMYK = function() {
+ return this.updateRGB(), this.updateCMYK(), this;
+ }, n2.prototype.updateHSLAndCMYK = function() {
+ return this.updateHSL(), this.updateCMYK(), this;
+ }, n2.prototype.updateRGBAndHSL = function() {
+ return this.updateRGBFromCMYK(), this.updateHSL(), this;
+ }, n2.prototype.setOptions = function(e2) {
+ return void 0 === e2 && (e2 = {}), this._options = t(t({}, this._options), e2), this;
+ }, n2.prototype.setH = function(t2) {
+ return this.hsl.h = T(t2), this.updateRGBAndCMYK();
+ }, n2.prototype.setS = function(t2) {
+ return this.hsl.s = N(t2, 0, 100), this.updateRGBAndCMYK();
+ }, n2.prototype.setL = function(t2) {
+ return this.hsl.l = N(t2, 0, 100), this.updateRGBAndCMYK();
+ }, n2.prototype.setR = function(t2) {
+ return this.rgb.r = N(t2, 0, 255), this.updateHSLAndCMYK();
+ }, n2.prototype.setG = function(t2) {
+ return this.rgb.g = N(t2, 0, 255), this.updateHSLAndCMYK();
+ }, n2.prototype.setB = function(t2) {
+ return this.rgb.b = N(t2, 0, 255), this.updateHSLAndCMYK();
+ }, n2.prototype.setA = function(t2) {
+ return this.hsl.a = this.rgb.a = N(t2, 0, 1), this;
+ }, n2.prototype.setC = function(t2) {
+ return this.cmyk.c = N(t2, 0, 100), this.updateRGBAndHSL();
+ }, n2.prototype.setM = function(t2) {
+ return this.cmyk.m = N(t2, 0, 100), this.updateRGBAndHSL();
+ }, n2.prototype.setY = function(t2) {
+ return this.cmyk.y = N(t2, 0, 100), this.updateRGBAndHSL();
+ }, n2.prototype.setK = function(t2) {
+ return this.cmyk.k = N(t2, 0, 100), this.updateRGBAndHSL();
+ }, Object.defineProperty(n2.prototype, "options", { get: function() {
+ return this._options;
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "H", { get: function() {
+ return K(this.hsl.h, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "S", { get: function() {
+ return K(this.hsl.s, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "L", { get: function() {
+ return K(this.hsl.l, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "R", { get: function() {
+ return K(this.rgb.r, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "G", { get: function() {
+ return K(this.rgb.g, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "B", { get: function() {
+ return K(this.rgb.b, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "A", { get: function() {
+ return K(this.hsl.a, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "C", { get: function() {
+ return K(this.cmyk.c, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "M", { get: function() {
+ return K(this.cmyk.m, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "Y", { get: function() {
+ return K(this.cmyk.y, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "K", { get: function() {
+ return K(this.cmyk.k, this.options.decimals);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HEXObject", { get: function() {
+ return ft.HEX(this.rgb);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HEXAObject", { get: function() {
+ return ft.HEXA(this.rgb);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "RGBObject", { get: function() {
+ return { r: this.R, g: this.G, b: this.B };
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "RGBAObject", { get: function() {
+ return t(t({}, this.RGBObject), { a: this.A });
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HSLObject", { get: function() {
+ return { h: this.H, s: this.S, l: this.L };
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HSLAObject", { get: function() {
+ return t(t({}, this.HSLObject), { a: this.A });
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "CMYKObject", { get: function() {
+ return { c: this.C, m: this.M, y: this.Y, k: this.K };
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "CMYKAObject", { get: function() {
+ return t(t({}, this.CMYKObject), { a: this.A });
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HEX", { get: function() {
+ return Z.HEX({ r: this.R, g: this.G, b: this.B });
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HEXA", { get: function() {
+ return Z.HEX({ r: this.R, g: this.G, b: this.B, a: 255 * this.A });
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "RGB", { get: function() {
+ return Z.RGB({ r: this.R, g: this.G, b: this.B }, this.options);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "RGBA", { get: function() {
+ return Z.RGB({ r: this.R, g: this.G, b: this.B, a: this.A }, this.options);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HSL", { get: function() {
+ return Z.HSL({ h: this.H, s: this.S, l: this.L }, this.options);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "HSLA", { get: function() {
+ return Z.HSL({ h: this.H, s: this.S, l: this.L, a: this.A }, this.options);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "CMYK", { get: function() {
+ return Z.CMYK({ c: this.C, m: this.M, y: this.Y, k: this.K }, this.options);
+ }, enumerable: false, configurable: true }), Object.defineProperty(n2.prototype, "CMYKA", { get: function() {
+ return Z.CMYK({ c: this.C, m: this.M, y: this.Y, k: this.K, a: this.A }, this.options);
+ }, enumerable: false, configurable: true }), n2.toHEXObject = function(t2) {
+ var e2 = ut(t2);
+ return yt(t2, e2, 0, ft.HEX);
+ }, n2.toHEX = function(t2) {
+ return Z.HEX(n2.toHEXObject(t2));
+ }, n2.toHEXAObject = function(t2) {
+ var e2 = ut(t2);
+ return yt(t2, e2, 0, ft.HEXA);
+ }, n2.toHEXA = function(t2) {
+ return Z.HEX(n2.toHEXAObject(t2));
+ }, n2.toRGBObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.RGB);
+ }, n2.toRGB = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.RGB);
+ return Z.RGB(i2, r2);
+ }, n2.toRGBAObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.RGBA);
+ }, n2.toRGBA = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.RGBA);
+ return Z.RGB(i2, r2);
+ }, n2.toHSLObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.HSL);
+ }, n2.toHSL = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.HSL);
+ return Z.HSL(i2, r2);
+ }, n2.toHSLAObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.HSLA);
+ }, n2.toHSLA = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.HSLA);
+ return Z.HSL(i2, r2);
+ }, n2.toCMYKObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.CMYK);
+ }, n2.toCMYK = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.CMYK);
+ return Z.CMYK(i2, r2);
+ }, n2.toCMYKAObject = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2);
+ return yt(t2, n3, e2.decimals, ft.CMYKA);
+ }, n2.toCMYKA = function(t2, e2) {
+ void 0 === e2 && (e2 = {});
+ var n3 = ut(t2), r2 = U(e2, t2), i2 = yt(t2, n3, 6, ft.CMYKA);
+ return Z.CMYK(i2, r2);
+ }, n2.getBlendHEXObject = function(t2, e2, n3) {
+ return void 0 === n3 && (n3 = 5), Et(t2, e2, n3, 0, ft.HEX);
+ }, n2.getBlendHEX = function(t2, e2, r2) {
+ return void 0 === r2 && (r2 = 5), n2.getBlendHEXObject(t2, e2, r2).map(function(t3) {
+ return Z.HEX(t3);
+ });
+ }, n2.getBlendHEXAObject = function(t2, e2, n3) {
+ return void 0 === n3 && (n3 = 5), Et(t2, e2, n3, 0, ft.HEXA);
+ }, n2.getBlendHEXA = function(t2, e2, r2) {
+ return void 0 === r2 && (r2 = 5), n2.getBlendHEXAObject(t2, e2, r2).map(function(t3) {
+ return Z.HEX(t3);
+ });
+ }, n2.getBlendRGBObject = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, r2.decimals, ft.RGB);
+ }, n2.getBlendRGB = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, 6, ft.RGB).map(function(n4) {
+ return Z.RGB(n4, U(r2, t2, e2));
+ });
+ }, n2.getBlendRGBAObject = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, r2.decimals, ft.RGBA);
+ }, n2.getBlendRGBA = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, 6, ft.RGBA).map(function(n4) {
+ return Z.RGB(n4, U(r2, t2, e2));
+ });
+ }, n2.getBlendHSLObject = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, r2.decimals, ft.HSL);
+ }, n2.getBlendHSL = function(t2, e2, n3, r2) {
+ void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {});
+ var i2 = U(r2, t2, e2);
+ return Et(t2, e2, n3, 6, ft.HSL).map(function(t3) {
+ return Z.HSL(t3, i2);
+ });
+ }, n2.getBlendHSLAObject = function(t2, e2, n3, r2) {
+ return void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {}), Et(t2, e2, n3, r2.decimals, ft.HSLA);
+ }, n2.getBlendHSLA = function(t2, e2, n3, r2) {
+ void 0 === n3 && (n3 = 5), void 0 === r2 && (r2 = {});
+ var i2 = U(r2, t2, e2);
+ return Et(t2, e2, n3, 6, ft.HSLA).map(function(t3) {
+ return Z.HSL(t3, i2);
+ });
+ }, n2.getMixHEXObject = function(t2, e2) {
+ return void 0 === e2 && (e2 = i.ADDITIVE), gt.HEX(t2, e2, false);
+ }, n2.getMixHEX = function(t2, e2) {
+ return void 0 === e2 && (e2 = i.ADDITIVE), gt.HEX(t2, e2, true);
+ }, n2.getMixHEXAObject = function(t2, e2) {
+ return void 0 === e2 && (e2 = i.ADDITIVE), gt.HEXA(t2, e2, false);
+ }, n2.getMixHEXA = function(t2, e2) {
+ return void 0 === e2 && (e2 = i.ADDITIVE), gt.HEXA(t2, e2, true);
+ }, n2.getMixRGBObject = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.RGB(t2, n3, false, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixRGB = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.RGB(t2, n3, true, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixRGBAObject = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.RGBA(t2, n3, false, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixRGBA = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.RGBA(t2, n3, true, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixHSLObject = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.HSL(t2, n3, false, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixHSL = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.HSL(t2, n3, true, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixHSLAObject = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.HSLA(t2, n3, false, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getMixHSLA = function(t2, n3, r2) {
+ return void 0 === n3 && (n3 = i.ADDITIVE), void 0 === r2 && (r2 = {}), gt.HSLA(t2, n3, true, U.apply(void 0, e([r2], t2, false)));
+ }, n2.getShades = function(t2, e2, n3) {
+ return void 0 === n3 && (n3 = {}), ht(t2, e2, true, U(n3, t2));
+ }, n2.getTints = function(t2, e2, n3) {
+ return void 0 === n3 && (n3 = {}), ht(t2, e2, false, U(n3, t2));
+ }, n2.getHarmony = function(t2, e2, n3, o2) {
+ return void 0 === e2 && (e2 = r.COMPLEMENTARY), void 0 === n3 && (n3 = i.ADDITIVE), void 0 === o2 && (o2 = {}), function(t3, e3, n4, i2) {
+ var o3;
+ return (o3 = {}, o3[r.ANALOGOUS] = pt.buildHarmony(e3, nt, n4, i2), o3[r.COMPLEMENTARY] = pt.buildHarmony(e3, rt, n4, i2), o3[r.SPLIT_COMPLEMENTARY] = pt.buildHarmony(e3, it, n4, i2), o3[r.TRIADIC] = pt.buildHarmony(e3, ot, n4, i2), o3[r.TETRADIC] = pt.buildHarmony(e3, at, n4, i2), o3[r.SQUARE] = pt.buildHarmony(e3, ct, n4, i2), o3)[t3];
+ }(e2, t2, n3, U(o2, t2));
+ }, n2;
+}();
+
+// src/SettingsTab.ts
+var SETTINGS_PAGES = {
+ "main": "Core Settings",
+ "codeblock": "Codeblock Styling",
+ "inline": "Inline Code Styling"
+};
+var CODEBLOCK_PAGES = {
+ "body": "Codeblock Body",
+ "gutter": "Codeblock Gutter",
+ "header": "Codeblock Header",
+ "highlight": "Codeblock Highlighting",
+ "languages": "Codeblock Languages",
+ // "plugins": "Plugin Compatibility",
+ "example": "Example Codeblock Content"
+};
+var DISPLAY_OPTIONS = {
+ "none": "Never",
+ "if_header_shown": "If Header Shown",
+ "always": "Always"
+};
+var SettingsTab = class extends import_obsidian.PluginSettingTab {
+ constructor(app, plugin) {
+ super(app, plugin);
+ this.plugin = plugin;
+ this.pickrs = {};
+ this.page = "main";
+ this.codeblockPage = "body";
+ this.hideAdvanced = true;
+ this.disableableComponents = {};
+ }
+ /**
+ * Builds the html page that is showed in the settings.
+ */
+ display() {
+ this.disableableComponents = {
+ "editorActiveLineHighlight": [],
+ "codeblockActiveLineHighlight": [],
+ "gradientHighlighting": [],
+ "languageBorderColour": []
+ };
+ this.hideAdvanced = true;
+ this.generateSettings(this.containerEl);
+ }
+ // Create Settings Pages
+ displayMainSettings(containerEl) {
+ this.emptySettings(containerEl);
+ this.generateThemeSettings(containerEl);
+ this.generateSettingsSwitcher(containerEl);
+ this.generateCoreSettings(containerEl);
+ this.generateAdvancedHeading(containerEl);
+ this.advancedSettingsContainer = containerEl.createDiv();
+ this.generateAdvancedSettings();
+ this.generateDonationFooter(containerEl);
+ }
+ displayCodeblockSettings(containerEl) {
+ this.emptySettings(containerEl);
+ this.generateThemeSettings(containerEl);
+ this.generateSettingsSwitcher(containerEl);
+ containerEl.createEl("hr");
+ this.exampleCodeblockContainer = containerEl.createDiv();
+ this.generateExampleCodeblock();
+ this.generateCodeblockStylingSwitcher(containerEl);
+ this.codeblockSettingEl = containerEl.createDiv();
+ this.generateCodeblockSetting();
+ }
+ displayInlineCodeSettings(containerEl) {
+ this.emptySettings(containerEl);
+ this.generateThemeSettings(containerEl);
+ this.generateSettingsSwitcher(containerEl);
+ containerEl.createEl("hr");
+ this.exampleInlineCodeContainer = containerEl.createDiv();
+ this.generateExampleInlineCode();
+ this.generateExampleInlineCodeSettings(containerEl);
+ this.generateInlineCodeSettings(containerEl);
+ }
+ // Create Settings Groups
+ emptySettings(containerEl) {
+ containerEl.empty();
+ containerEl.createEl("h1", { text: "Settings for the Code Styler Plugin." });
+ }
+ generateSettings(containerEl) {
+ if (this.page === "main")
+ this.displayMainSettings(containerEl);
+ else if (this.page === "codeblock")
+ this.displayCodeblockSettings(containerEl);
+ else if (this.page === "inline")
+ this.displayInlineCodeSettings(containerEl);
+ }
+ generateSettingsSwitcher(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Choose Settings Page").setDesc("Change dropdown to modify different groups of settings").addDropdown((dropdown) => dropdown.addOptions(SETTINGS_PAGES).setValue(this.page).onChange((value) => {
+ this.page = value;
+ this.generateSettings(containerEl);
+ }));
+ }
+ generateCodeblockStylingSwitcher(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Choose Codeblock Settings").setDesc("Change dropdown to modify styles and settings of different codeblock sections").addDropdown((dropdown) => dropdown.addOptions(CODEBLOCK_PAGES).setValue(this.codeblockPage).onChange((value) => {
+ this.codeblockPage = value;
+ this.generateCodeblockSetting();
+ }));
+ }
+ generateCodeblockSetting() {
+ this.codeblockSettingEl.empty();
+ if (this.codeblockPage === "body")
+ this.generateCodeblockBodySettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "gutter")
+ this.generateCodeblockGutterSettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "header")
+ this.generateCodeblockHeaderSettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "highlight")
+ this.generateCodeblockHighlightSettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "languages")
+ this.generateCodeblockLanguageSettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "plugins")
+ this.generatePluginCompatibilitySettings(this.codeblockSettingEl);
+ else if (this.codeblockPage === "example")
+ this.generateExampleCodeblockSettings(this.codeblockSettingEl);
+ }
+ generateCoreSettings(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Style Code on Export").setDesc("If enabled, styling will be applied when exporting to PDF.").addToggle((toggle) => toggle.setValue(this.plugin.settings.decoratePrint).onChange((value) => {
+ this.plugin.settings.decoratePrint = value;
+ this.saveSettings();
+ }));
+ }
+ generateThemeSettings(containerEl) {
+ containerEl.createEl("h2", { text: "Theme Settings" });
+ let themeDropdown;
+ new import_obsidian.Setting(containerEl).setName("Select Theme").addDropdown((dropdown) => {
+ themeDropdown = dropdown;
+ this.updateDropdown(themeDropdown, this.plugin.settings);
+ themeDropdown.onChange((value) => {
+ this.plugin.settings.selectedTheme = value;
+ this.plugin.settings.currentTheme = structuredClone(this.plugin.settings.themes[this.plugin.settings.selectedTheme]);
+ this.saveSettings();
+ this.display();
+ });
+ }).addExtraButton((button) => {
+ button.setTooltip("Update theme");
+ button.setIcon("save");
+ button.onClick(() => {
+ this.plugin.settings.themes[this.plugin.settings.selectedTheme] = structuredClone(this.plugin.settings.currentTheme);
+ this.updateAlternativeHighlights();
+ new import_obsidian.Notice(`${this.plugin.settings.selectedTheme} theme saved successfully!`);
+ this.saveSettings();
+ });
+ }).addExtraButton((button) => {
+ button.setTooltip("Delete theme");
+ button.setIcon("trash");
+ button.onClick(() => {
+ if (this.plugin.settings.selectedTheme.trim().length === 0)
+ new import_obsidian.Notice("Select a theme first to delete");
+ else if (this.plugin.settings.selectedTheme in DEFAULT_SETTINGS.themes)
+ new import_obsidian.Notice("You cannot delete the default themes");
+ else {
+ delete this.plugin.settings.themes[this.plugin.settings.selectedTheme];
+ new import_obsidian.Notice(`${this.plugin.settings.selectedTheme} theme deleted successfully!`);
+ this.plugin.settings.selectedTheme = "Default";
+ this.plugin.settings.currentTheme = structuredClone(this.plugin.settings.themes[this.plugin.settings.selectedTheme]);
+ this.updateDropdown(themeDropdown, this.plugin.settings);
+ this.saveSettings();
+ this.display();
+ }
+ });
+ });
+ let newThemeName;
+ let newThemeDefault;
+ this.plugin.settings.newTheme = "";
+ new import_obsidian.Setting(containerEl).setName("Add New Theme").setDesc("Create a new theme from the current settings.").addText((text2) => {
+ newThemeName = text2.setPlaceholder("New theme name").setValue(this.plugin.settings.newTheme).onChange((value) => {
+ this.plugin.settings.newTheme = value;
+ });
+ }).addExtraButton((button) => {
+ button.setTooltip("Save theme");
+ button.setIcon("plus");
+ button.onClick(() => {
+ if (this.plugin.settings.newTheme.trim().length === 0)
+ new import_obsidian.Notice("Set a name for your theme");
+ else if (this.plugin.settings.newTheme in DEFAULT_SETTINGS.themes)
+ new import_obsidian.Notice("You can't overwrite the default themes");
+ else {
+ if (this.plugin.settings.newTheme in this.plugin.settings.themes) {
+ this.plugin.settings.themes[this.plugin.settings.newTheme] = structuredClone(this.plugin.settings.currentTheme);
+ new import_obsidian.Notice(`${this.plugin.settings.newTheme} theme updated successfully!`);
+ } else {
+ this.plugin.settings.themes[this.plugin.settings.newTheme] = structuredClone(this.plugin.settings.currentTheme);
+ new import_obsidian.Notice(`${this.plugin.settings.newTheme} theme saved successfully!`);
+ }
+ this.plugin.settings.selectedTheme = this.plugin.settings.newTheme;
+ this.updateDropdown(themeDropdown, this.plugin.settings);
+ this.updateAlternativeHighlights();
+ this.plugin.settings.newTheme = "";
+ newThemeName.setValue("");
+ newThemeDefault.setValue(false);
+ this.saveSettings();
+ }
+ });
+ });
+ }
+ generateCodeblockBodySettings(containerEl) {
+ containerEl.createEl("h3", { text: "Codeblock Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Codeblock Background Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "codeblock_background",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].codeblock.backgroundColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].codeblock.backgroundColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(containerEl).setName("Codeblock Text Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "codeblock_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].codeblock.textColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].codeblock.textColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(containerEl).setName("Codeblock Curvature").setDesc("Determines how rounded the codeblocks appear in pixels.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 25, 1).setValue(this.plugin.settings.currentTheme.settings.codeblock.curvature).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.codeblock.curvature = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default curvature").onClick(() => {
+ this.plugin.settings.currentTheme.settings.codeblock.curvature = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.codeblock.curvature;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.codeblock.curvature);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(containerEl).setName("Language Coloured Borders").setDesc("If enabled, languages with icons display a left border with the colour of the icon. The slider sets the width of the border.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.advanced.languageBorderColour).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.advanced.languageBorderColour = value;
+ this.disableableComponents["languageBorderColour"].forEach((component) => {
+ component.setDisabled(!value);
+ });
+ this.saveSettings();
+ })).then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 20, 1).setValue(this.plugin.settings.currentTheme.settings.advanced.languageBorderWidth).setDisabled(!this.plugin.settings.currentTheme.settings.advanced.languageBorderColour).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.advanced.languageBorderWidth = value;
+ this.saveSettings();
+ });
+ this.disableableComponents["languageBorderColour"].push(resettableSlider);
+ });
+ let resetButton;
+ setting.addExtraButton((button) => {
+ resetButton = button.setIcon("reset").setDisabled(!this.plugin.settings.currentTheme.settings.advanced.languageBorderColour).setTooltip("Restore default colour stop").onClick(() => {
+ this.plugin.settings.currentTheme.settings.advanced.languageBorderWidth = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.advanced.languageBorderWidth;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.advanced.languageBorderWidth);
+ this.saveSettings();
+ });
+ this.disableableComponents["languageBorderColour"].push(resetButton);
+ });
+ });
+ new import_obsidian.Setting(containerEl).setName("Unwrap codeblock lines").setDesc("Choose whether to unwrap lines in reading mode").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.codeblock.unwrapLines).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.codeblock.unwrapLines = value;
+ this.generateWrapLineSettings();
+ this.saveSettings(true);
+ }));
+ this.wrapLinesContainer = containerEl.createDiv();
+ this.generateWrapLineSettings();
+ }
+ generateWrapLineSettings() {
+ this.wrapLinesContainer.empty();
+ if (!this.plugin.settings.currentTheme.settings.codeblock.unwrapLines)
+ return;
+ new import_obsidian.Setting(this.wrapLinesContainer).setName("Wrap Lines on Click").setDesc("If enabled, in reading mode, holding click on a codeblock will wrap the lines for better visibility.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.codeblock.wrapLinesActive).setDisabled(!this.plugin.settings.currentTheme.settings.codeblock.unwrapLines).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.codeblock.wrapLinesActive = value;
+ this.saveSettings(true);
+ }));
+ }
+ generateCodeblockGutterSettings(containerEl) {
+ containerEl.createEl("h3", { text: "Gutter Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Enable Line Numbers").setDesc("If disabled, the below settings are disabled too.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.codeblock.lineNumbers).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.codeblock.lineNumbers = value;
+ this.generateCodeblockLineNumberSettings();
+ this.saveSettings(true);
+ }));
+ this.lineNumbersContainer = containerEl.createDiv();
+ this.generateCodeblockLineNumberSettings();
+ }
+ generateCodeblockLineNumberSettings() {
+ this.lineNumbersContainer.empty();
+ if (!this.plugin.settings.currentTheme.settings.codeblock.lineNumbers)
+ return;
+ new import_obsidian.Setting(this.lineNumbersContainer).setName("Gutter Background Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.lineNumbersContainer,
+ setting,
+ "gutter_background",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].gutter.backgroundColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].gutter.backgroundColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.lineNumbersContainer).setName("Line Number Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.lineNumbersContainer,
+ setting,
+ "line_number",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].gutter.textColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].gutter.textColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.lineNumbersContainer).setName("Highlight Line Numbers").setDesc("If enabled, highlights will also highlight the line numbers.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.gutter.highlight).setDisabled(!this.plugin.settings.currentTheme.settings.codeblock.lineNumbers).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.gutter.highlight = value;
+ this.saveSettings();
+ }));
+ new import_obsidian.Setting(this.lineNumbersContainer).setName("Indicate Current Line Number").setDesc("If enabled, the current line number in codeblocks will be indicated with a separate colour.").setClass("code-styler-spaced").addToggle(
+ (toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.gutter.activeLine).setDisabled(!this.plugin.settings.currentTheme.settings.codeblock.lineNumbers).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.gutter.activeLine = value;
+ this.saveSettings();
+ })
+ ).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.lineNumbersContainer,
+ setting,
+ "active_line_number",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].gutter.activeTextColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].gutter.activeTextColour = saveColour;
+ }
+ );
+ });
+ }
+ generateCodeblockHeaderSettings(containerEl) {
+ containerEl.createEl("h3", { text: "Header Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Header Background Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "header_background",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.backgroundColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.backgroundColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(containerEl).setName("Header Font Size").setDesc("Set the font size for header language tags and titles.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(6, 32, 1).setValue(this.plugin.settings.currentTheme.settings.header.fontSize).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.fontSize = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default font size").onClick(() => {
+ this.plugin.settings.currentTheme.settings.header.fontSize = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.header.fontSize;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.header.fontSize);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(containerEl).setName("Header Title Text Styling").setDesc("Style the header title text using bold and italic toggles, by setting a font or by setting a text colour.").addToggle((toggle) => {
+ toggle.setTooltip("Toggle bold title text").setValue(this.plugin.settings.currentTheme.settings.header.title.textBold).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.title.textBold = value;
+ this.saveSettings();
+ });
+ }).addToggle((toggle) => {
+ toggle.setTooltip("Toggle italic title text").setValue(this.plugin.settings.currentTheme.settings.header.title.textItalic).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.title.textItalic = value;
+ this.saveSettings();
+ });
+ }).addText((text2) => {
+ text2.setPlaceholder("Font").setValue(this.plugin.settings.currentTheme.settings.header.title.textFont).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.title.textFont = value;
+ this.saveSettings();
+ });
+ }).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "header_title_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.title.textColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.title.textColour = saveColour;
+ }
+ );
+ });
+ let foldPlaceholderTimeout = setTimeout(() => {
+ });
+ new import_obsidian.Setting(containerEl).setName("Fold Placeholder Text").setDesc("Title placeholder text for folded code when no title parameter is set.").addText((text2) => text2.setPlaceholder(FOLD_PLACEHOLDER).setValue(this.plugin.settings.currentTheme.settings.header.foldPlaceholder).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.foldPlaceholder = value;
+ this.saveSettings();
+ clearTimeout(foldPlaceholderTimeout);
+ foldPlaceholderTimeout = setTimeout(() => this.rerender(), 1e3);
+ }));
+ new import_obsidian.Setting(containerEl).setName("Header Separator Colour").setDesc("Colour of the line separating the codeblock header and the codeblock.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "header_separator",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.lineColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.lineColour = saveColour;
+ }
+ );
+ });
+ containerEl.createEl("h5", { text: "Header Language Tag Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Display Header Language Tags").setDesc('Determine when to show language tags in the header. "Title Only" will only show language tags when the title parameter is set.').addDropdown((dropdown) => dropdown.addOptions(DISPLAY_OPTIONS).setValue(this.plugin.settings.currentTheme.settings.header.languageTag.display).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageTag.display = value;
+ this.generateHeaderTagSettings();
+ this.saveSettings(true);
+ }));
+ this.headerTagsContainer = containerEl.createDiv();
+ this.generateHeaderTagSettings();
+ containerEl.createEl("h5", { text: "Header Language Icon Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Display Header Language Icons").setDesc('Determine when to show language icons where available. "Title Only" will only show language tags when the title parameter is set.').addDropdown((dropdown) => dropdown.addOptions(DISPLAY_OPTIONS).setValue(this.plugin.settings.currentTheme.settings.header.languageIcon.display).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageIcon.display = value;
+ this.generateHeaderLanguageIconSettings();
+ this.saveSettings(true);
+ }));
+ this.headerIconsContainer = containerEl.createDiv();
+ this.generateHeaderLanguageIconSettings();
+ this.headerExternalReferenceContainer = containerEl.createDiv();
+ this.generateHeaderExternalReferenceSettings();
+ }
+ generateHeaderTagSettings() {
+ this.headerTagsContainer.empty();
+ if (this.plugin.settings.currentTheme.settings.header.languageTag.display === "none")
+ return;
+ new import_obsidian.Setting(this.headerTagsContainer).setName("Header Language Tag Background Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.headerTagsContainer,
+ setting,
+ "header_language_tag_background",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.languageTag.backgroundColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.languageTag.backgroundColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.headerTagsContainer).setName("Header Language Tag Text Styling").setDesc("Style the header language tag text using bold and italic toggles, by setting a font or by setting a text colour.").addToggle((toggle) => toggle.setTooltip("Toggle bold language tag text").setValue(this.plugin.settings.currentTheme.settings.header.languageTag.textBold).setDisabled(this.plugin.settings.currentTheme.settings.header.languageTag.display === "none").onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageTag.textBold = value;
+ this.saveSettings();
+ })).addToggle((toggle) => toggle.setTooltip("Toggle italic language tag text").setValue(this.plugin.settings.currentTheme.settings.header.languageTag.textItalic).setDisabled(this.plugin.settings.currentTheme.settings.header.languageTag.display === "none").onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageTag.textItalic = value;
+ this.saveSettings();
+ })).addText((text2) => text2.setPlaceholder("Font").setValue(this.plugin.settings.currentTheme.settings.header.languageTag.textFont).setDisabled(this.plugin.settings.currentTheme.settings.header.languageTag.display === "none").onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageTag.textFont = value;
+ this.saveSettings();
+ })).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.headerTagsContainer,
+ setting,
+ "header_language_tag_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.languageTag.textColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.languageTag.textColour = saveColour;
+ }
+ );
+ });
+ }
+ generateHeaderLanguageIconSettings() {
+ this.headerIconsContainer.empty();
+ if (this.plugin.settings.currentTheme.settings.header.languageIcon.display === "none")
+ return;
+ new import_obsidian.Setting(this.headerIconsContainer).setName("Language Icons Coloured").setDesc("If disabled, language icons will be black and white.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.header.languageIcon.displayColour).setDisabled(this.plugin.settings.currentTheme.settings.header.languageIcon.display === "none").onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.languageIcon.displayColour = value;
+ this.saveSettings();
+ }));
+ new import_obsidian.Setting(this.headerIconsContainer).setName("Language Icon Size").setDesc("Set the size of the displayed language icons.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(10, 40, 1).setValue(this.plugin.settings.currentTheme.settings.advanced.iconSize).setDisabled(this.plugin.settings.currentTheme.settings.header.languageIcon.display === "none").setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.advanced.iconSize = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => button.setIcon("reset").setDisabled(this.plugin.settings.currentTheme.settings.header.languageIcon.display === "none").setTooltip("Restore default icon size").onClick(() => {
+ this.plugin.settings.currentTheme.settings.advanced.iconSize = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.advanced.iconSize;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.advanced.iconSize);
+ this.saveSettings();
+ }));
+ });
+ }
+ generateHeaderExternalReferenceSettings() {
+ this.headerExternalReferenceContainer.empty();
+ this.headerExternalReferenceContainer.createEl("h5", { text: "External Reference Indicators Appearance" });
+ new import_obsidian.Setting(this.headerExternalReferenceContainer).setName("Display Repository").setDesc("Display repository in codeblock header for external references.").addToggle((toggle) => toggle.setTooltip("Display Repository").setValue(this.plugin.settings.currentTheme.settings.header.externalReference.displayRepository).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.externalReference.displayRepository = value;
+ this.saveSettings();
+ })).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.headerExternalReferenceContainer,
+ setting,
+ "codeblock_header_display_repository",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.externalReference.displayRepositoryColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.externalReference.displayRepositoryColour = saveColour;
+ },
+ () => !this.plugin.settings.currentTheme.settings.header.externalReference.displayRepository
+ );
+ });
+ new import_obsidian.Setting(this.headerExternalReferenceContainer).setName("Display Repository Name").setDesc("Display repository version in codeblock header for external references.").addToggle((toggle) => toggle.setTooltip("Display Repository Version").setValue(this.plugin.settings.currentTheme.settings.header.externalReference.displayVersion).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.externalReference.displayVersion = value;
+ this.saveSettings();
+ })).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.headerExternalReferenceContainer,
+ setting,
+ "codeblock_header_display_version",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.externalReference.displayVersionColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.externalReference.displayVersionColour = saveColour;
+ },
+ () => !this.plugin.settings.currentTheme.settings.header.externalReference.displayVersion
+ );
+ });
+ new import_obsidian.Setting(this.headerExternalReferenceContainer).setName("Display Reference Timestamp").setDesc("Display the timestamp at which the reference was last updated.").addToggle((toggle) => toggle.setTooltip("Display Timestamp").setValue(this.plugin.settings.currentTheme.settings.header.externalReference.displayTimestamp).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.header.externalReference.displayTimestamp = value;
+ this.saveSettings();
+ })).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.headerExternalReferenceContainer,
+ setting,
+ "codeblock_header_display_timestamp",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].header.externalReference.displayTimestampColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].header.externalReference.displayTimestampColour = saveColour;
+ },
+ () => !this.plugin.settings.currentTheme.settings.header.externalReference.displayTimestamp
+ );
+ });
+ }
+ generateCodeblockHighlightSettings(containerEl) {
+ containerEl.createEl("h3", { text: "Highlighting Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Codeblock Active Line Highlight").setDesc("If enabled, highlights the active line inside codeblocks.").setClass("code-styler-spaced").addToggle((toggle) => {
+ return toggle.setValue(this.plugin.settings.currentTheme.settings.highlights.activeCodeblockLine).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.highlights.activeCodeblockLine = value;
+ this.disableableComponents["codeblockActiveLineHighlight"].forEach((component) => {
+ component.setDisabled(!value);
+ });
+ this.saveSettings();
+ });
+ }).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "codeblock_active_line_highlight",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].highlights.activeCodeblockLineColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].highlights.activeCodeblockLineColour = saveColour;
+ },
+ () => !this.plugin.settings.currentTheme.settings.highlights.activeCodeblockLine
+ );
+ });
+ this.disableableComponents["codeblockActiveLineHighlight"].push(this.pickrs["codeblock_active_line_highlight"].resetButton);
+ new import_obsidian.Setting(containerEl).setName("Default Highlight Colour").setDesc("Used by the 'hl' parameter.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "default_highlight",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].highlights.defaultColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].highlights.defaultColour = saveColour;
+ }
+ );
+ });
+ let newHighlightText;
+ new import_obsidian.Setting(containerEl).setName("Add Alternative Highlight").setDesc("Define a new alternative highlight name. The colour can be modified after it is added.").addText((value) => {
+ newHighlightText = value.setPlaceholder("e.g. error, warn").onChange((value2) => {
+ this.plugin.settings.newHighlight = value2;
+ });
+ }).addButton((button) => {
+ button.setButtonText("Add");
+ button.onClick(() => {
+ if (this.plugin.settings.newHighlight.trim() === "")
+ new import_obsidian.Notice("Please enter a colour name.");
+ else if (!/^[^\d]\w*$/.test(this.plugin.settings.newHighlight))
+ new import_obsidian.Notice(`"${this.plugin.settings.newHighlight}" is not a valid colour name.`);
+ else if (this.plugin.settings.newHighlight.trim().toLowerCase() === "hl")
+ new import_obsidian.Notice("Cannot override the default highlight parameter.");
+ else if (PARAMETERS.includes(this.plugin.settings.newHighlight.trim().toLowerCase()))
+ new import_obsidian.Notice("Cannot use other default parameters.");
+ else if (this.plugin.settings.newHighlight in this.plugin.settings.currentTheme.colours.light.highlights.alternativeHighlights)
+ new import_obsidian.Notice(`A highlight with the name "${this.plugin.settings.newHighlight}" already exists.`);
+ else {
+ const newColour = getRandomColour();
+ this.plugin.settings.currentTheme.colours.light.highlights.alternativeHighlights[this.plugin.settings.newHighlight] = newColour;
+ this.plugin.settings.currentTheme.colours.dark.highlights.alternativeHighlights[this.plugin.settings.newHighlight] = newColour;
+ this.updateAlternativeHighlights();
+ new import_obsidian.Notice(`Added highlight "${this.plugin.settings.newHighlight}".`);
+ this.plugin.settings.newHighlight = "";
+ newHighlightText.setValue("");
+ this.saveSettings(true);
+ }
+ });
+ });
+ this.alternativeHighlightsContainer = containerEl.createDiv();
+ this.updateAlternativeHighlights();
+ new import_obsidian.Setting(containerEl).setName("Gradient Highlighting").setDesc("If enabled, highlights fade away to the right. The slider sets the gradient colour stop as a percentage.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.advanced.gradientHighlights).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.advanced.gradientHighlights = value;
+ this.disableableComponents["gradientHighlighting"].forEach((component) => {
+ component.setDisabled(!value);
+ });
+ this.saveSettings();
+ })).then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 100, 1).setValue(+this.plugin.settings.currentTheme.settings.advanced.gradientHighlightsColourStop.slice(0, -1)).setDisabled(!this.plugin.settings.currentTheme.settings.advanced.gradientHighlights).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.advanced.gradientHighlightsColourStop = `${value}%`;
+ this.saveSettings();
+ });
+ this.disableableComponents["gradientHighlighting"].push(resettableSlider);
+ });
+ let resetButton;
+ setting.addExtraButton((button) => {
+ resetButton = button.setIcon("reset").setDisabled(!this.plugin.settings.currentTheme.settings.advanced.gradientHighlights).setTooltip("Restore default colour stop").onClick(() => {
+ this.plugin.settings.currentTheme.settings.advanced.gradientHighlightsColourStop = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.advanced.gradientHighlightsColourStop;
+ resettableSlider.setValue(+this.plugin.settings.currentTheme.settings.advanced.gradientHighlightsColourStop.slice(0, -1));
+ this.saveSettings();
+ });
+ this.disableableComponents["gradientHighlighting"].push(resetButton);
+ });
+ });
+ }
+ generateCodeblockLanguageSettings(containerEl) {
+ let excludeTimeout = setTimeout(() => {
+ });
+ new import_obsidian.Setting(containerEl).setName("Exclude Languages").setDesc("Define languages in a comma separated list which the plugin should not decorate. You can use a wildcard (*) either at the beginning, or at the end. For example: ad-* will exclude codeblocks where the language starts with ad- e.g.: ad-info, ad-error etc.").addText((text2) => text2.setPlaceholder(`e.g. ${EXCLUDED_LANGUAGES} etc.`).setValue(this.plugin.settings.excludedLanguages).onChange((value) => {
+ this.plugin.settings.excludedLanguages = value;
+ this.saveSettings();
+ clearTimeout(excludeTimeout);
+ excludeTimeout = setTimeout(() => this.rerender(), 1e3);
+ }));
+ let whitelistTimeout = setTimeout(() => {
+ });
+ new import_obsidian.Setting(containerEl).setName("Whitelisted Processed Codeblocks").setDesc("Define languages in a comma separated list which the plugin should style despite being processed by another plugin. You can use a wildcard (*) either at the beginning, or at the end. For example: ad-* will exclude codeblocks where the language starts with ad- e.g.: ad-info, ad-error etc.").addText((text2) => text2.setPlaceholder(`e.g. ${WHITELIST_CODEBLOCKS} etc.`).setValue(this.plugin.settings.processedCodeblocksWhitelist).onChange((value) => {
+ this.plugin.settings.processedCodeblocksWhitelist = value;
+ this.saveSettings();
+ clearTimeout(whitelistTimeout);
+ whitelistTimeout = setTimeout(() => this.rerender(), 1e3);
+ }));
+ new import_obsidian.Setting(containerEl).setName("Redirect Language Settings").setDesc("Use this textbox to redirect specific language colours and icons as a JSON with language names as keys and either a colour key, an icon key or both as the value for a given language. Colours should be passed as CSS colours and icons should be passed as a string of the inside of an svg element. This setting is theme independent.").setClass("code-styler-setting-text-area").addTextArea((textArea) => textArea.setValue(JSON.stringify(this.plugin.settings.redirectLanguages) === "{}" ? "" : JSON.stringify(this.plugin.settings.redirectLanguages, null, 4)).setPlaceholder(JSON.stringify({ toml: { colour: "#012345", icon: LANGUAGES["APL"].colour } }, null, 4)).onChange((value) => {
+ if (value === "") {
+ this.plugin.settings.redirectLanguages = {};
+ this.saveSettings();
+ } else {
+ try {
+ this.plugin.settings.redirectLanguages = JSON.parse(value);
+ this.redirectLanguages();
+ this.saveSettings();
+ } catch (e2) {
+ new import_obsidian.Notice("Invalid JSON");
+ }
+ }
+ }));
+ }
+ generateInlineCodeSettings(containerEl) {
+ containerEl.createEl("h3", { text: "Inline Code Appearance" });
+ new import_obsidian.Setting(containerEl).setName("Syntax Highlight Inline Code").setDesc("If enabled, in reading mode, inline code will be syntax highlighted based on a language set with `{language} highlighted_inline_code`. See the README for more information.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.inline.syntaxHighlight).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.syntaxHighlight = value;
+ this.saveSettings(true);
+ }));
+ new import_obsidian.Setting(containerEl).setName("Style Inline Code").setDesc("If enabled, inline code will be styled.").addToggle((toggle) => toggle.setValue(this.plugin.settings.currentTheme.settings.inline.style).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.style = value;
+ this.generateInlineCodeStyleSettings();
+ this.saveSettings();
+ }));
+ this.inlineCodeStylesContainer = containerEl.createDiv();
+ this.generateInlineCodeStyleSettings();
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Title Colour").setDesc("The text colour of inline code titles.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.inlineCodeStylesContainer,
+ setting,
+ "title_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].inline.titleTextColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].inline.titleTextColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Title Font Weight").setDesc("Determines how bold inline code titles appear.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(1, 9, 1).setValue(this.plugin.settings.currentTheme.settings.inline.titleFontWeight).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.titleFontWeight = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default font weight").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.titleFontWeight = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.titleFontWeight;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.titleFontWeight);
+ this.saveSettings();
+ });
+ });
+ });
+ }
+ generateInlineCodeStyleSettings() {
+ this.inlineCodeStylesContainer.empty();
+ if (!this.plugin.settings.currentTheme.settings.inline.style)
+ return;
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Background Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.inlineCodeStylesContainer,
+ setting,
+ "inline_background",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].inline.backgroundColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].inline.backgroundColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Text Colour").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.inlineCodeStylesContainer,
+ setting,
+ "inline_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].inline.textColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].inline.textColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Active Text Colour").setDesc("The text colour when editing inline code.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.inlineCodeStylesContainer,
+ setting,
+ "inline_active_text",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].inline.activeTextColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].inline.activeTextColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Font Weight").setDesc("Determines how bold inline code appears.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(1, 9, 1).setValue(this.plugin.settings.currentTheme.settings.inline.fontWeight).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.fontWeight = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default font weight").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.fontWeight = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.fontWeight;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.fontWeight);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Curvature").setDesc("Determines how rounded inline code appear in pixels.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 12, 1).setValue(this.plugin.settings.currentTheme.settings.inline.curvature).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.curvature = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default curvature").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.curvature = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.curvature;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.curvature);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Vertical Padding").setDesc("Determines how much vertical inner padding in pixels inline code has.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 10, 1).setValue(this.plugin.settings.currentTheme.settings.inline.paddingVertical).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.paddingVertical = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default vertical padding").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.paddingVertical = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.paddingVertical;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.paddingVertical);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Horizontal Padding").setDesc("Determines how much horizontal inner padding in pixels inline code has.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 10, 1).setValue(this.plugin.settings.currentTheme.settings.inline.paddingHorizontal).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.paddingHorizontal = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default horizontal padding").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.paddingHorizontal = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.paddingHorizontal;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.paddingHorizontal);
+ this.saveSettings();
+ });
+ });
+ });
+ new import_obsidian.Setting(this.inlineCodeStylesContainer).setName("Inline Code Horizontal Margin").setDesc("Determines how much horizontal outer margin is added to the inline code in pixels.").then((setting) => {
+ let resettableSlider;
+ setting.addSlider((slider) => {
+ resettableSlider = slider.setLimits(0, 8, 1).setValue(this.plugin.settings.currentTheme.settings.inline.marginHorizontal).setDynamicTooltip().onChange((value) => {
+ this.plugin.settings.currentTheme.settings.inline.marginHorizontal = value;
+ this.saveSettings();
+ });
+ });
+ setting.addExtraButton((button) => {
+ button.setIcon("reset").setTooltip("Restore default horizontal margin").onClick(() => {
+ this.plugin.settings.currentTheme.settings.inline.marginHorizontal = this.plugin.settings.themes[this.plugin.settings.selectedTheme].settings.inline.marginHorizontal;
+ resettableSlider.setValue(this.plugin.settings.currentTheme.settings.inline.marginHorizontal);
+ this.saveSettings();
+ });
+ });
+ });
+ }
+ generateAdvancedHeading(containerEl) {
+ const advancedSettingsHeading = containerEl.createEl("h2", { text: "Advanced Settings", cls: `advanced-settings-header${this.hideAdvanced ? " header-folded" : ""}` });
+ advancedSettingsHeading.addEventListener("click", () => {
+ this.hideAdvanced = !this.hideAdvanced;
+ advancedSettingsHeading.classList.toggle("header-folded", this.hideAdvanced);
+ this.generateAdvancedSettings();
+ });
+ }
+ generateAdvancedSettings() {
+ this.advancedSettingsContainer.empty();
+ if (this.hideAdvanced)
+ return;
+ this.generateInterfaceSettings(this.advancedSettingsContainer);
+ new import_obsidian.Setting(this.advancedSettingsContainer).setName("Editor Active Line Highlight").setDesc("If enabled, highlights the active line outside codeblocks.").setClass("code-styler-spaced").addToggle((toggle) => toggle.setTooltip("Toggle editor active line highlighting").setValue(this.plugin.settings.currentTheme.settings.highlights.activeEditorLine).onChange((value) => {
+ this.plugin.settings.currentTheme.settings.highlights.activeEditorLine = value;
+ this.disableableComponents["editorActiveLineHighlight"].forEach((component) => {
+ component.setDisabled(!value);
+ });
+ this.saveSettings();
+ })).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.advancedSettingsContainer,
+ setting,
+ "editor_active_line_highlight",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].highlights.activeEditorLineColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].highlights.activeEditorLineColour = saveColour;
+ },
+ () => !this.plugin.settings.currentTheme.settings.highlights.activeEditorLine
+ );
+ });
+ new import_obsidian.Setting(this.advancedSettingsContainer).setName("External References Automatic Update on Load").setDesc("If enabled, external references will be updated automatically on load when possible.").addToggle((toggle) => toggle.setTooltip("Toggle auto-update external references").setValue(this.plugin.settings.externalReferenceUpdateOnLoad).onChange((value) => {
+ this.plugin.settings.externalReferenceUpdateOnLoad = value;
+ this.saveSettings();
+ }));
+ this.disableableComponents["editorActiveLineHighlight"].push(this.pickrs["editor_active_line_highlight"].resetButton);
+ new import_obsidian.Setting(this.advancedSettingsContainer).setName("Reset inbuilt themes").setDesc("This will return all inbuilt themes to the plugin defaults").addButton((button) => button.setButtonText("Reset").onClick(() => {
+ Object.entries(INBUILT_THEMES).forEach(([themeName, theme]) => this.plugin.settings.themes[themeName] = structuredClone(theme));
+ if (this.plugin.settings.selectedTheme in INBUILT_THEMES)
+ this.plugin.settings.currentTheme = structuredClone(this.plugin.settings.themes[this.plugin.settings.selectedTheme]);
+ this.saveSettings(true);
+ }));
+ }
+ generateInterfaceSettings(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Button Colour").setDesc("Used for UI buttons like the copy code button.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "default_highlight",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].advanced.buttonColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].advanced.buttonColour = saveColour;
+ }
+ );
+ });
+ new import_obsidian.Setting(containerEl).setName("Button Active Colour").setDesc("Colour buttons use when activated.").then((setting) => {
+ this.createPickr(
+ this.plugin,
+ containerEl,
+ setting,
+ "default_highlight",
+ (relevantThemeColours) => relevantThemeColours[getCurrentMode()].advanced.buttonActiveColour,
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].advanced.buttonActiveColour = saveColour;
+ }
+ );
+ });
+ }
+ generatePluginCompatibilitySettings(containerEl) {
+ containerEl.createSpan("Needs completing");
+ }
+ generateExampleCodeblockSettings(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Example Codeblock Parameter String").setDesc("Parameters and language which would follow codeblock delimiter.").setClass("code-styler-setting-text-wide").addText((text2) => text2.setPlaceholder(EXAMPLE_CODEBLOCK_PARAMETERS).setValue(this.plugin.settings.exampleCodeblockParameters).onChange((value) => {
+ this.plugin.settings.exampleCodeblockParameters = value;
+ this.saveSettings();
+ this.generateExampleCodeblock();
+ }));
+ new import_obsidian.Setting(containerEl).setName("Example Codeblock Parameter String").setDesc("Content for example codeblock.").setClass("code-styler-setting-text-area").addTextArea((textArea) => textArea.setValue(this.plugin.settings.exampleCodeblockContent).setPlaceholder(EXAMPLE_CODEBLOCK_CONTENT).onChange((value) => {
+ this.plugin.settings.exampleCodeblockContent = value;
+ this.saveSettings();
+ this.generateExampleCodeblock();
+ }));
+ }
+ generateExampleCodeblock() {
+ var _a2, _b;
+ this.exampleCodeblockContainer.empty();
+ const codeblockString = "```````" + this.plugin.settings.exampleCodeblockParameters + "\n" + this.plugin.settings.exampleCodeblockContent + "\n```````";
+ import_obsidian.MarkdownRenderer.render(this.plugin.app, codeblockString, this.exampleCodeblockContainer, SETTINGS_SOURCEPATH_PREFIX + codeblockString, this.plugin);
+ (_b = (_a2 = this.exampleCodeblockContainer.querySelector("pre > button.copy-code-button")) == null ? void 0 : _a2.classList) == null ? void 0 : _b.add("code-styler-settings-button");
+ }
+ generateExampleInlineCodeSettings(containerEl) {
+ new import_obsidian.Setting(containerEl).setName("Inline Code Example").setDesc("Text to render as example inside code delimiters.").setClass("code-styler-setting-text-wide").addText((text2) => text2.setPlaceholder(EXAMPLE_INLINE_CODE).setValue(this.plugin.settings.exampleInlineCode).onChange((value) => {
+ this.plugin.settings.exampleInlineCode = value;
+ this.saveSettings();
+ this.generateExampleInlineCode();
+ }));
+ }
+ generateExampleInlineCode() {
+ var _a2, _b;
+ this.exampleInlineCodeContainer.empty();
+ import_obsidian.MarkdownRenderer.render(this.plugin.app, "`" + this.plugin.settings.exampleInlineCode + "`", this.exampleInlineCodeContainer, SETTINGS_SOURCEPATH_PREFIX, this.plugin);
+ (_b = (_a2 = this.exampleInlineCodeContainer.querySelector("code")) == null ? void 0 : _a2.classList) == null ? void 0 : _b.add("code-styler-settings-inline-code");
+ }
+ generateDonationFooter(containerEl) {
+ containerEl.createEl("hr");
+ const donationDiv = containerEl.createEl("div", { cls: "code-styler-donation" });
+ const donationText = createEl("p", { text: "If you like this plugin, and would like to help support continued development, use the button below!" });
+ donationDiv.appendChild(donationText);
+ const donationButton = createEl("a", { href: "https://www.buymeacoffee.com/mayurankv2" });
+ donationButton.innerHTML = '
';
+ donationDiv.appendChild(donationButton);
+ }
+ // Create Settings
+ createPickr(plugin, containerEl, setting, id, getRelevantThemeColour, saveRelevantThemeColour, disabled) {
+ const pickr = new PickrResettable(plugin, containerEl, setting, getRelevantThemeColour, saveRelevantThemeColour);
+ pickr.on("show", (colour, instance) => {
+ if (typeof disabled !== "undefined" && disabled())
+ instance.hide();
+ }).on("save", (colour, instance) => {
+ const savedColour = `#${colour.toHEXA().toString().substring(1)}`;
+ instance.hide();
+ instance.addSwatch(savedColour);
+ instance.saveColour(savedColour);
+ }).on("cancel", (instance) => {
+ instance.hide();
+ });
+ setting.addExtraButton((button) => {
+ pickr.resetButton = button.setIcon("reset").setDisabled(typeof disabled !== "undefined" && disabled()).setTooltip("Restore default colour").onClick(() => {
+ pickr.resetColour();
+ });
+ });
+ this.pickrs[id] = pickr;
+ }
+ // Update Settings
+ saveSettings(rerender2 = false) {
+ (async () => {
+ await this.plugin.saveSettings();
+ })();
+ if (rerender2)
+ this.rerender();
+ }
+ rerender() {
+ this.plugin.renderReadingView();
+ if (this.page === "codeblock")
+ this.generateExampleCodeblock();
+ else if (this.page === "inline")
+ this.generateExampleInlineCode();
+ }
+ updateDropdown(dropdown, settings) {
+ dropdown.selectEl.empty();
+ Object.keys(settings.themes).forEach((theme_name) => {
+ dropdown.addOption(theme_name, theme_name);
+ });
+ dropdown.setValue(settings.selectedTheme);
+ }
+ updateAlternativeHighlights() {
+ if (this.page !== "codeblock" || this.codeblockPage !== "highlight")
+ return;
+ this.alternativeHighlightsContainer.empty();
+ Object.keys(this.plugin.settings.currentTheme.colours.light.highlights.alternativeHighlights).forEach((alternativeHighlightName) => {
+ new import_obsidian.Setting(this.alternativeHighlightsContainer).setName(alternativeHighlightName).setDesc(`To highlight lines with this highlight, use the ${alternativeHighlightName} parameter.`).then((setting) => {
+ this.createPickr(
+ this.plugin,
+ this.alternativeHighlightsContainer,
+ setting,
+ `alternative_highlight_${alternativeHighlightName}`,
+ (relevantThemeColours) => alternativeHighlightName in relevantThemeColours.light.highlights.alternativeHighlights ? relevantThemeColours[getCurrentMode()].highlights.alternativeHighlights[alternativeHighlightName] : this.plugin.settings.currentTheme.colours[getCurrentMode()].highlights.alternativeHighlights[alternativeHighlightName],
+ (relevantThemeColours, saveColour) => {
+ relevantThemeColours[getCurrentMode()].highlights.alternativeHighlights[alternativeHighlightName] = saveColour;
+ }
+ );
+ setting.addExtraButton((button) => {
+ button.setIcon("trash").setTooltip("Delete highlight").onClick(() => {
+ delete this.plugin.settings.currentTheme.colours.light.highlights.alternativeHighlights[alternativeHighlightName];
+ delete this.plugin.settings.currentTheme.colours.dark.highlights.alternativeHighlights[alternativeHighlightName];
+ new import_obsidian.Notice(`Removed highlight "${alternativeHighlightName}".`);
+ this.updateAlternativeHighlights();
+ this.saveSettings();
+ });
+ });
+ });
+ });
+ }
+ redirectLanguages() {
+ Object.entries(this.plugin.settings.redirectLanguages).forEach(([languageName, languageSettings]) => {
+ if ("icon" in languageSettings) {
+ if (LANGUAGE_NAMES[languageName] in this.plugin.languageIcons)
+ URL.revokeObjectURL(this.plugin.languageIcons[LANGUAGE_NAMES[languageName]]);
+ this.plugin.languageIcons[LANGUAGE_NAMES[languageName]] = URL.createObjectURL(new Blob([``], { type: "image/svg+xml" }));
+ }
+ });
+ }
+};
+var PickrResettable = class extends import_pickr.default {
+ constructor(plugin, containerEl, setting, getRelevantThemeColour, saveRelevantThemeColour, tooltip) {
+ const settings = {
+ el: setting.controlEl.createDiv({ cls: "picker" }),
+ theme: "nano",
+ default: getColour(getRelevantThemeColour(plugin.settings.currentTheme.colours)),
+ position: "left-middle",
+ lockOpacity: false,
+ components: {
+ preview: true,
+ hue: true,
+ opacity: true,
+ interaction: {
+ hex: true,
+ rgba: true,
+ hsla: false,
+ input: true,
+ cancel: true,
+ save: true
+ }
+ },
+ i18n: {
+ "ui:dialog": "Colour picker dialog",
+ "btn:toggle": typeof tooltip !== "undefined" ? tooltip : "Select colour",
+ "btn:swatch": "Colour swatch",
+ "btn:last-color": "Use previous colour"
+ }
+ };
+ if (containerEl.parentElement !== null)
+ settings.container = containerEl.parentElement;
+ super(settings);
+ this.saveColour = (saveColour) => {
+ saveRelevantThemeColour(plugin.settings.currentTheme.colours, saveColour);
+ (async () => {
+ await plugin.saveSettings();
+ })();
+ };
+ this.resetColour = () => {
+ const resetColour = getRelevantThemeColour(plugin.settings.themes[plugin.settings.selectedTheme].colours);
+ this.setColor(getColour(resetColour));
+ this.saveColour(resetColour);
+ };
+ }
+};
+function getRandomColour() {
+ const letters = "0123456789ABCDEF";
+ let colour = "";
+ for (let i2 = 0; i2 < 6; i2++)
+ colour += letters[Math.floor(Math.random() * 16)];
+ return `#${colour}FF`;
+}
+function getColour(themeColour) {
+ return isCss(themeColour) ? getCssVariable(themeColour) : themeColour;
+}
+function isCss(possibleCss) {
+ return possibleCss.startsWith("--") && typeof possibleCss === "string";
+}
+function getCssVariable(cssVariable) {
+ const variableValue = window.getComputedStyle(document.body).getPropertyValue(cssVariable).trim();
+ if (typeof variableValue === "string" && variableValue.startsWith("#"))
+ return `#${variableValue.trim().substring(1)}`;
+ else if (variableValue.startsWith("rgb"))
+ return `#${Ft.toHEXA(variableValue.replace(/calc\((.*?)\)/g, (match, capture) => calc(capture))).substring(1)}`;
+ else if (variableValue.startsWith("hsl"))
+ return `#${Ft.toHEXA(variableValue.replace(/calc\((.*?)\)/g, (match, capture) => calc(capture))).substring(1)}`;
+ else
+ console.warn(`Warning: Couldn't determine colour format - ${variableValue}`);
+ return `#${Ft.toHEXA(variableValue).substring(1)}`;
+}
+function calc(calcString) {
+ const splitString = calcString.trim().replace(/(\d*)%/g, "$1").split(" ");
+ const operators = {
+ "+": (num1, num2) => Math.max(num1 + num2, 0),
+ "-": (num1, num2) => Math.max(num1 - num2, 0)
+ };
+ if (splitString.length === 3) {
+ if (splitString[1] in operators)
+ return `${operators[splitString[1]](parseFloat(splitString[0]), parseFloat(splitString[2]))}%`;
+ }
+ console.warn("Warning: Couldn't parse calc string");
+ return calcString;
+}
+function getCurrentMode() {
+ const body3 = document.querySelector("body");
+ if (body3 !== null) {
+ if (body3.classList.contains("theme-light"))
+ return "light";
+ else if (body3.classList.contains("theme-dark"))
+ return "dark";
+ }
+ console.warn("Warning: Couldn't get current theme");
+ return "light";
+}
+
+// src/ApplyStyling.ts
+var STYLE_ID = "code-styler-styles";
+var THEME_STYLES = {
+ "Prism": {
+ border: {
+ size: 1,
+ style: "1px solid var(--window-border-color)"
+ }
+ },
+ "Shimmering Focus": {
+ border: {
+ size: 1,
+ style: "var(--thin-muted-border)"
+ }
+ },
+ "Minimal": {
+ extra: `
+ .markdown-source-view.mod-cm6.is-readable-line-width :not(pre.code-styler-pre) > .code-styler-header-container {
+ box-sizing: border-box;
+ }
+ `
+ },
+ "Obsidianite": {
+ scrollbar: true
+ }
+};
+function updateStyling(settings, app) {
+ const currentTheme = getCurrentTheme(app);
+ let styleTag = document.getElementById(STYLE_ID);
+ if (!styleTag) {
+ styleTag = document.createElement("style");
+ styleTag.id = STYLE_ID;
+ document.getElementsByTagName("head")[0].appendChild(styleTag);
+ }
+ styleTag.innerText = (styleThemeColours(settings.currentTheme.colours) + styleThemeSettings(settings.currentTheme.settings, currentTheme) + styleLanguageColours(settings.currentTheme.settings, settings.redirectLanguages, currentTheme)).trim().replace(/\s+/g, " ");
+ addThemeSettingsClasses(settings.currentTheme.settings);
+}
+function styleThemeColours(themeColours) {
+ return Object.keys(themeColours.light.highlights.alternativeHighlights).reduce((result, alternativeHighlight) => {
+ return result + `
+ body.code-styler .code-styler-line-highlighted-${alternativeHighlight.replace(/\s+/g, "-").toLowerCase()} {
+ --gradient-background-colour: var(--code-styler-${alternativeHighlight.replace(/\s+/g, "-").toLowerCase()}-highlight-colour) !important;
+ }
+ `;
+ }, `
+ body.code-styler.theme-light {
+ ${getThemeColours(themeColours.light)}
+ }
+ body.code-styler.theme-dark {
+ ${getThemeColours(themeColours.dark)}
+ }
+ `);
+}
+function getThemeColours(themeModeColours) {
+ return Object.entries({
+ "codeblock-background-colour": themeModeColours.codeblock.backgroundColour,
+ "codeblock-text-colour": themeModeColours.codeblock.textColour,
+ "gutter-background-colour": themeModeColours.gutter.backgroundColour,
+ "gutter-text-colour": themeModeColours.gutter.textColour,
+ "gutter-active-text-colour": themeModeColours.gutter.activeTextColour,
+ "header-background-colour": themeModeColours.header.backgroundColour,
+ "header-title-text-colour": themeModeColours.header.title.textColour,
+ "header-language-tag-background-colour": themeModeColours.header.languageTag.backgroundColour,
+ "header-language-tag-text-colour": themeModeColours.header.languageTag.textColour,
+ "header-separator-colour": themeModeColours.header.lineColour,
+ "header-external-reference-repository": themeModeColours.header.externalReference.displayRepositoryColour,
+ "header-external-reference-version": themeModeColours.header.externalReference.displayVersionColour,
+ "header-external-reference-timestamp": themeModeColours.header.externalReference.displayTimestampColour,
+ "active-codeblock-line-colour": themeModeColours.highlights.activeCodeblockLineColour,
+ "active-editor-line-colour": themeModeColours.highlights.activeEditorLineColour,
+ "default-highlight-colour": themeModeColours.highlights.defaultColour,
+ "button-colour": themeModeColours.advanced.buttonColour,
+ "button-active-colour": themeModeColours.advanced.buttonActiveColour,
+ "inline-colour": themeModeColours.inline.textColour,
+ "inline-colour-active": themeModeColours.inline.activeTextColour,
+ "inline-background-colour": themeModeColours.inline.backgroundColour,
+ "inline-title-colour": themeModeColours.inline.titleTextColour,
+ ...Object.entries(themeModeColours.highlights.alternativeHighlights).reduce((result, [alternativeHighlight, colour]) => {
+ result[`${alternativeHighlight.replace(/\s+/g, "-").toLowerCase()}-highlight-colour`] = colour;
+ return result;
+ }, {})
+ }).reduce((result, [cssVariable, colour]) => {
+ const styleColour = isCss(colour) ? `var(${colour})` : colour;
+ return result + `--code-styler-${cssVariable}: ${styleColour};`;
+ }, "");
+}
+function styleThemeSettings(themeSettings, currentTheme) {
+ var _a2, _b, _c;
+ return `
+ body.code-styler .code-styler-header-language-tag {
+ --code-styler-header-language-tag-text-bold: ${themeSettings.header.languageTag.textBold ? "bold" : "normal"};
+ --code-styler-header-language-tag-text-italic: ${themeSettings.header.languageTag.textItalic ? "italic" : "normal"};
+ font-family: ${themeSettings.header.languageTag.textFont !== "" ? themeSettings.header.languageTag.textFont : "var(--font-text)"};
+ }
+ body.code-styler .code-styler-header-text {
+ --code-styler-header-title-text-bold: ${themeSettings.header.title.textBold ? "bold" : "normal"};
+ --code-styler-header-title-text-italic: ${themeSettings.header.title.textItalic ? "italic" : "normal"};
+ font-family: ${themeSettings.header.languageTag.textFont !== "" ? themeSettings.header.languageTag.textFont : "var(--font-text)"};
+ }
+ body.code-styler {
+ --border-radius: ${themeSettings.codeblock.curvature}px;
+ --language-icon-size: ${themeSettings.advanced.iconSize}px;
+ --gradient-highlights-colour-stop: ${themeSettings.advanced.gradientHighlights ? themeSettings.advanced.gradientHighlightsColourStop : "100%"};
+ --header-font-size: ${themeSettings.header.fontSize}px;
+ --line-wrapping: ${themeSettings.codeblock.unwrapLines ? "pre" : "pre-wrap"};
+ --code-styler-inline-font-weight: ${themeSettings.inline.fontWeight}00;
+ --code-styler-inline-border-radius: ${themeSettings.inline.curvature}px;
+ --code-styler-inline-padding-vertical: ${themeSettings.inline.paddingVertical}px;
+ --code-styler-inline-padding-horizontal: ${themeSettings.inline.paddingHorizontal}px;
+ --code-styler-inline-margin-horizontal: ${themeSettings.inline.marginHorizontal}px;
+ --code-styler-inline-title-font-weight: ${themeSettings.inline.titleFontWeight}00;
+ ${!themeSettings.codeblock.wrapLinesActive ? "" : "--line-active-wrapping: pre-wrap;"}
+ ${themeSettings.header.languageIcon.displayColour ? "" : "--icon-filter: grayscale(1);"}
+ }
+ ${((_a2 = THEME_STYLES == null ? void 0 : THEME_STYLES[currentTheme]) == null ? void 0 : _a2.border) ? `
+ .markdown-source-view :not(pre.code-styler-pre) > .code-styler-header-container {
+ --code-styler-header-border:` + //@ts-expect-error Does Exist
+ THEME_STYLES[currentTheme].border.style + `;
+ --header-separator-width-padding: calc(var(--header-separator-width) - ` + //@ts-expect-error Does Exist
+ THEME_STYLES[currentTheme].border.size + `px);
+ --folded-bottom-border: var(--code-styler-header-border);
+ }
+ ` : ""}
+ ${((_b = THEME_STYLES == null ? void 0 : THEME_STYLES[currentTheme]) == null ? void 0 : _b.scrollbar) ? `
+ pre.code-styler-pre::-webkit-scrollbar,
+ pre.code-styler-pre > code::-webkit-scrollbar {
+ width: var(--code-padding);
+ height: var(--code-padding);
+ background-color: var(--code-styler-codeblock-background-colour);
+ }
+ ` : ""}
+ ${((_c = THEME_STYLES == null ? void 0 : THEME_STYLES[currentTheme]) == null ? void 0 : _c.extra) ? THEME_STYLES[currentTheme].extra : ""}
+ `;
+}
+function styleLanguageColours(themeSettings, redirectLanguages, currentTheme) {
+ return Object.entries(LANGUAGE_NAMES).reduce((result, [languageName, languageDisplayName]) => {
+ var _a2, _b, _c, _d, _e;
+ if (((_b = (_a2 = LANGUAGES) == null ? void 0 : _a2[languageDisplayName]) == null ? void 0 : _b.colour) || languageName in redirectLanguages && "colour" in redirectLanguages[languageName]) {
+ result += `
+ .language-${languageName} {
+ --language-border-colour: ${(_d = (_c = redirectLanguages == null ? void 0 : redirectLanguages[languageName]) == null ? void 0 : _c["colour"]) != null ? _d : LANGUAGES[languageDisplayName].colour};
+ --language-border-width: ${themeSettings.advanced.languageBorderColour ? themeSettings.advanced.languageBorderWidth : 0}px;
+ }
+ `;
+ if ((_e = THEME_STYLES == null ? void 0 : THEME_STYLES[currentTheme]) == null ? void 0 : _e.border) {
+ result += `
+ .markdown-source-view :not(pre.code-styler-pre) > .code-styler-header-container.language-${languageName} {
+ --language-border-width: ${//@ts-expect-error Does exist
+ themeSettings.advanced.languageBorderColour ? themeSettings.advanced.languageBorderWidth + THEME_STYLES[currentTheme].border.size : 0}px;
+ }`;
+ }
+ }
+ return result;
+ }, "");
+}
+function addThemeSettingsClasses(themeSettings) {
+ themeSettings.inline.style ? document.body.classList.add("code-styler-style-inline") : document.body.classList.remove("code-styler-style-inline");
+ themeSettings.gutter.highlight ? document.body.classList.add("code-styler-gutter-highlight") : document.body.classList.remove("code-styler-gutter-highlight");
+ themeSettings.gutter.activeLine ? document.body.classList.add("code-styler-gutter-active-line") : document.body.classList.remove("code-styler-gutter-active-line");
+ document.body.classList.remove("code-styler-active-line-highlight", "code-styler-active-line-highlight-codeblock", "code-styler-active-line-highlight-editor");
+ if (themeSettings.highlights.activeEditorLine && themeSettings.highlights.activeCodeblockLine)
+ document.body.classList.add("code-styler-active-line-highlight");
+ else if (themeSettings.highlights.activeEditorLine && !themeSettings.highlights.activeCodeblockLine)
+ document.body.classList.add("code-styler-active-line-highlight-editor");
+ else if (!themeSettings.highlights.activeEditorLine && themeSettings.highlights.activeCodeblockLine)
+ document.body.classList.add("code-styler-active-line-highlight-codeblock");
+}
+function removeStylesAndClasses() {
+ var _a2;
+ (_a2 = document.getElementById(STYLE_ID)) == null ? void 0 : _a2.remove();
+ document.body.classList.remove(
+ "code-styler",
+ "code-styler-show-line-numbers",
+ "code-styler-gutter-highlight",
+ "code-styler-gutter-active-line"
+ );
+}
+function getCurrentTheme(app) {
+ return app.vault.getConfig("cssTheme");
+}
+
+// src/EditingView.ts
+var import_obsidian8 = require("obsidian");
+var import_view = require("@codemirror/view");
+var import_state = require("@codemirror/state");
+var import_language = require("@codemirror/language");
+
+// src/Parsing/CodeblockParsing.ts
+var import_obsidian7 = require("obsidian");
+
+// src/External/ExecuteCode/CodeBlockArgs.ts
+var import_obsidian2 = require("obsidian");
+var JSON5 = __toESM(require_dist());
+function getArgs(firstLineOfCode) {
+ if (!firstLineOfCode.contains("{") && !firstLineOfCode.contains("}"))
+ return {};
+ try {
+ let args = firstLineOfCode.substring(firstLineOfCode.indexOf("{") + 1).trim();
+ args = args.replace(/=/g, ":");
+ const exports = [];
+ const handleUnnamedExport = (exportName) => {
+ let i2 = args.indexOf(exportName);
+ while (i2 !== -1) {
+ const nextChar = args[i2 + exportName.length];
+ if (nextChar !== '"' && nextChar !== "'") {
+ args = args.substring(0, i2) + args.substring(i2 + exportName.length + (nextChar === "}" ? 0 : 1));
+ exports.push(exportName);
+ }
+ i2 = args.indexOf(exportName, i2 + 1);
+ }
+ };
+ handleUnnamedExport("pre");
+ handleUnnamedExport("post");
+ args = `{export: ['${exports.join("', '")}'], ${args}`;
+ return JSON5.parse(args);
+ } catch (err) {
+ new import_obsidian2.Notice(`Failed to parse code block arguments from line:
+${firstLineOfCode}
+
+Failed with error:
+${err}`);
+ return {};
+ }
+}
+
+// src/Referencing.ts
+var import_obsidian6 = require("obsidian");
+
+// src/Parsing/ReferenceParsing.ts
+var import_obsidian3 = require("obsidian");
+function parseReferenceParameters(source) {
+ var _a2, _b, _c, _d, _e;
+ source = source.replace(/^([^:]+):(.+)\n/, "$1: $2\n").replace(/(?>> 0) + 2);
+}
+function getLineLimits(codeContent, referenceParameters) {
+ var _a2, _b, _c, _d, _e;
+ try {
+ const lines = codeContent.split("\n");
+ let startIndex;
+ let endIndex;
+ if (referenceParameters.start === null)
+ startIndex = 0;
+ else if (typeof referenceParameters.start === "number")
+ startIndex = referenceParameters.start - 1;
+ else if (((_a2 = referenceParameters.start) == null ? void 0 : _a2.startsWith("/")) && ((_b = referenceParameters.start) == null ? void 0 : _b.endsWith("/"))) {
+ const startRegex = new RegExp(referenceParameters.start.replace(/^\/(.*)\/$/, "$1"));
+ startIndex = lines.findIndex((line) => startRegex.test(line));
+ } else
+ startIndex = lines.findIndex((line) => line.indexOf(referenceParameters.start) > -1);
+ if (referenceParameters.end === null)
+ endIndex = lines.length - 1;
+ else if (typeof referenceParameters.end === "number")
+ endIndex = referenceParameters.end - 1;
+ else if (((_c = referenceParameters.end) == null ? void 0 : _c.startsWith("/")) && ((_d = referenceParameters.end) == null ? void 0 : _d.endsWith("/"))) {
+ const endRegex = new RegExp(referenceParameters.end.replace(/^\/(.*)\/$/, "$1"));
+ endIndex = lines.findIndex((line) => endRegex.test(line));
+ } else if ((_e = referenceParameters.end) == null ? void 0 : _e.startsWith("+"))
+ endIndex = startIndex + Number(referenceParameters.end.slice(1));
+ else
+ endIndex = lines.findIndex((line) => line.indexOf(referenceParameters.end) > -1);
+ if (startIndex > endIndex)
+ throw Error("Specified Start line is afterthe specified End line");
+ else if (startIndex === -1)
+ throw Error("Start line could not be found");
+ else if (endIndex === -1)
+ throw Error("End line could not be found");
+ return { codeSection: lines.slice(startIndex, endIndex + 1).join("\n"), startLine: startIndex + 1 };
+ } catch (error) {
+ throw Error(error);
+ }
+}
+function getLineIdentifier(lineIdentifier) {
+ if (typeof lineIdentifier === "undefined")
+ return null;
+ else if (typeof lineIdentifier === "number")
+ return lineIdentifier;
+ else if (/^\/(.*)\/$/.test(lineIdentifier)) {
+ try {
+ return new RegExp(lineIdentifier.replace(/^\/(.*)\/$/, "$1"));
+ } catch (e2) {
+ throw Error("Invalid Regular Expression");
+ }
+ } else if (/".*"/.test(lineIdentifier))
+ return lineIdentifier.substring(1, lineIdentifier.length - 1);
+ else if (/'.*'/.test(lineIdentifier))
+ return lineIdentifier.substring(1, lineIdentifier.length - 1);
+ else if (/\D/.test(lineIdentifier))
+ return lineIdentifier;
+ else if (/\d+/.test(lineIdentifier))
+ return parseInt(lineIdentifier);
+ return null;
+}
+function timeStamp() {
+ const date = /* @__PURE__ */ new Date();
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hour = String(date.getHours()).padStart(2, "0");
+ const minute = String(date.getMinutes()).padStart(2, "0");
+ return `${year}-${month}-${day} ${hour}:${minute}`;
+}
+
+// src/ReadingView.ts
+var import_obsidian5 = require("obsidian");
+
+// node_modules/unist-util-is/lib/index.js
+var convert = (
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
+ /**
+ * @type {(
+ * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
+ * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
+ * ((test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate) &
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
+ * ((test?: Test) => Check)
+ * )}
+ */
+ /**
+ * @param {Test} [test]
+ * @returns {Check}
+ */
+ function(test) {
+ if (test === null || test === void 0) {
+ return ok;
+ }
+ if (typeof test === "function") {
+ return castFactory(test);
+ }
+ if (typeof test === "object") {
+ return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
+ }
+ if (typeof test === "string") {
+ return typeFactory(test);
+ }
+ throw new Error("Expected function, string, or object as test");
+ }
+);
+function anyFactory(tests) {
+ const checks2 = [];
+ let index2 = -1;
+ while (++index2 < tests.length) {
+ checks2[index2] = convert(tests[index2]);
+ }
+ return castFactory(any);
+ function any(...parameters) {
+ let index3 = -1;
+ while (++index3 < checks2.length) {
+ if (checks2[index3].apply(this, parameters))
+ return true;
+ }
+ return false;
+ }
+}
+function propsFactory(check) {
+ const checkAsRecord = (
+ /** @type {Record} */
+ check
+ );
+ return castFactory(all3);
+ function all3(node) {
+ const nodeAsRecord = (
+ /** @type {Record} */
+ /** @type {unknown} */
+ node
+ );
+ let key2;
+ for (key2 in check) {
+ if (nodeAsRecord[key2] !== checkAsRecord[key2])
+ return false;
+ }
+ return true;
+ }
+}
+function typeFactory(check) {
+ return castFactory(type);
+ function type(node) {
+ return node && node.type === check;
+ }
+}
+function castFactory(testFunction) {
+ return check;
+ function check(value, index2, parent) {
+ return Boolean(
+ looksLikeANode(value) && testFunction.call(
+ this,
+ value,
+ typeof index2 === "number" ? index2 : void 0,
+ parent || void 0
+ )
+ );
+ }
+}
+function ok() {
+ return true;
+}
+function looksLikeANode(value) {
+ return value !== null && typeof value === "object" && "type" in value;
+}
+
+// node_modules/unist-util-visit-parents/lib/color.js
+function color(d2) {
+ return d2;
+}
+
+// node_modules/unist-util-visit-parents/lib/index.js
+var empty = [];
+var CONTINUE = true;
+var EXIT = false;
+var SKIP = "skip";
+function visitParents(tree, test, visitor, reverse) {
+ let check;
+ if (typeof test === "function" && typeof visitor !== "function") {
+ reverse = visitor;
+ visitor = test;
+ } else {
+ check = test;
+ }
+ const is2 = convert(check);
+ const step = reverse ? -1 : 1;
+ factory(tree, void 0, [])();
+ function factory(node, index2, parents) {
+ const value = (
+ /** @type {Record} */
+ node && typeof node === "object" ? node : {}
+ );
+ if (typeof value.type === "string") {
+ const name = (
+ // `hast`
+ typeof value.tagName === "string" ? value.tagName : (
+ // `xast`
+ typeof value.name === "string" ? value.name : void 0
+ )
+ );
+ Object.defineProperty(visit, "name", {
+ value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
+ });
+ }
+ return visit;
+ function visit() {
+ let result = empty;
+ let subresult;
+ let offset;
+ let grandparents;
+ if (!test || is2(node, index2, parents[parents.length - 1] || void 0)) {
+ result = toResult(visitor(node, parents));
+ if (result[0] === EXIT) {
+ return result;
+ }
+ }
+ if ("children" in node && node.children) {
+ const nodeAsParent = (
+ /** @type {UnistParent} */
+ node
+ );
+ if (nodeAsParent.children && result[0] !== SKIP) {
+ offset = (reverse ? nodeAsParent.children.length : -1) + step;
+ grandparents = parents.concat(nodeAsParent);
+ while (offset > -1 && offset < nodeAsParent.children.length) {
+ const child = nodeAsParent.children[offset];
+ subresult = factory(child, offset, grandparents)();
+ if (subresult[0] === EXIT) {
+ return subresult;
+ }
+ offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
+ }
+ }
+ }
+ return result;
+ }
+ }
+}
+function toResult(value) {
+ if (Array.isArray(value)) {
+ return value;
+ }
+ if (typeof value === "number") {
+ return [CONTINUE, value];
+ }
+ return value === null || value === void 0 ? empty : [value];
+}
+
+// node_modules/devlop/lib/default.js
+function ok2() {
+}
+
+// node_modules/property-information/lib/util/schema.js
+var Schema = class {
+ /**
+ * @constructor
+ * @param {Properties} property
+ * @param {Normal} normal
+ * @param {string} [space]
+ */
+ constructor(property, normal, space) {
+ this.property = property;
+ this.normal = normal;
+ if (space) {
+ this.space = space;
+ }
+ }
+};
+Schema.prototype.property = {};
+Schema.prototype.normal = {};
+Schema.prototype.space = null;
+
+// node_modules/property-information/lib/util/merge.js
+function merge(definitions, space) {
+ const property = {};
+ const normal = {};
+ let index2 = -1;
+ while (++index2 < definitions.length) {
+ Object.assign(property, definitions[index2].property);
+ Object.assign(normal, definitions[index2].normal);
+ }
+ return new Schema(property, normal, space);
+}
+
+// node_modules/property-information/lib/normalize.js
+function normalize(value) {
+ return value.toLowerCase();
+}
+
+// node_modules/property-information/lib/util/info.js
+var Info = class {
+ /**
+ * @constructor
+ * @param {string} property
+ * @param {string} attribute
+ */
+ constructor(property, attribute) {
+ this.property = property;
+ this.attribute = attribute;
+ }
+};
+Info.prototype.space = null;
+Info.prototype.boolean = false;
+Info.prototype.booleanish = false;
+Info.prototype.overloadedBoolean = false;
+Info.prototype.number = false;
+Info.prototype.commaSeparated = false;
+Info.prototype.spaceSeparated = false;
+Info.prototype.commaOrSpaceSeparated = false;
+Info.prototype.mustUseProperty = false;
+Info.prototype.defined = false;
+
+// node_modules/property-information/lib/util/types.js
+var types_exports = {};
+__export(types_exports, {
+ boolean: () => boolean,
+ booleanish: () => booleanish,
+ commaOrSpaceSeparated: () => commaOrSpaceSeparated,
+ commaSeparated: () => commaSeparated,
+ number: () => number,
+ overloadedBoolean: () => overloadedBoolean,
+ spaceSeparated: () => spaceSeparated
+});
+var powers = 0;
+var boolean = increment();
+var booleanish = increment();
+var overloadedBoolean = increment();
+var number = increment();
+var spaceSeparated = increment();
+var commaSeparated = increment();
+var commaOrSpaceSeparated = increment();
+function increment() {
+ return 2 ** ++powers;
+}
+
+// node_modules/property-information/lib/util/defined-info.js
+var checks = Object.keys(types_exports);
+var DefinedInfo = class extends Info {
+ /**
+ * @constructor
+ * @param {string} property
+ * @param {string} attribute
+ * @param {number|null} [mask]
+ * @param {string} [space]
+ */
+ constructor(property, attribute, mask, space) {
+ let index2 = -1;
+ super(property, attribute);
+ mark(this, "space", space);
+ if (typeof mask === "number") {
+ while (++index2 < checks.length) {
+ const check = checks[index2];
+ mark(this, checks[index2], (mask & types_exports[check]) === types_exports[check]);
+ }
+ }
+ }
+};
+DefinedInfo.prototype.defined = true;
+function mark(values, key2, value) {
+ if (value) {
+ values[key2] = value;
+ }
+}
+
+// node_modules/property-information/lib/util/create.js
+var own = {}.hasOwnProperty;
+function create(definition) {
+ const property = {};
+ const normal = {};
+ let prop;
+ for (prop in definition.properties) {
+ if (own.call(definition.properties, prop)) {
+ const value = definition.properties[prop];
+ const info = new DefinedInfo(
+ prop,
+ definition.transform(definition.attributes || {}, prop),
+ value,
+ definition.space
+ );
+ if (definition.mustUseProperty && definition.mustUseProperty.includes(prop)) {
+ info.mustUseProperty = true;
+ }
+ property[prop] = info;
+ normal[normalize(prop)] = prop;
+ normal[normalize(info.attribute)] = prop;
+ }
+ }
+ return new Schema(property, normal, definition.space);
+}
+
+// node_modules/property-information/lib/xlink.js
+var xlink = create({
+ space: "xlink",
+ transform(_2, prop) {
+ return "xlink:" + prop.slice(5).toLowerCase();
+ },
+ properties: {
+ xLinkActuate: null,
+ xLinkArcRole: null,
+ xLinkHref: null,
+ xLinkRole: null,
+ xLinkShow: null,
+ xLinkTitle: null,
+ xLinkType: null
+ }
+});
+
+// node_modules/property-information/lib/xml.js
+var xml = create({
+ space: "xml",
+ transform(_2, prop) {
+ return "xml:" + prop.slice(3).toLowerCase();
+ },
+ properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
+});
+
+// node_modules/property-information/lib/util/case-sensitive-transform.js
+function caseSensitiveTransform(attributes, attribute) {
+ return attribute in attributes ? attributes[attribute] : attribute;
+}
+
+// node_modules/property-information/lib/util/case-insensitive-transform.js
+function caseInsensitiveTransform(attributes, property) {
+ return caseSensitiveTransform(attributes, property.toLowerCase());
+}
+
+// node_modules/property-information/lib/xmlns.js
+var xmlns = create({
+ space: "xmlns",
+ attributes: { xmlnsxlink: "xmlns:xlink" },
+ transform: caseInsensitiveTransform,
+ properties: { xmlns: null, xmlnsXLink: null }
+});
+
+// node_modules/property-information/lib/aria.js
+var aria = create({
+ transform(_2, prop) {
+ return prop === "role" ? prop : "aria-" + prop.slice(4).toLowerCase();
+ },
+ properties: {
+ ariaActiveDescendant: null,
+ ariaAtomic: booleanish,
+ ariaAutoComplete: null,
+ ariaBusy: booleanish,
+ ariaChecked: booleanish,
+ ariaColCount: number,
+ ariaColIndex: number,
+ ariaColSpan: number,
+ ariaControls: spaceSeparated,
+ ariaCurrent: null,
+ ariaDescribedBy: spaceSeparated,
+ ariaDetails: null,
+ ariaDisabled: booleanish,
+ ariaDropEffect: spaceSeparated,
+ ariaErrorMessage: null,
+ ariaExpanded: booleanish,
+ ariaFlowTo: spaceSeparated,
+ ariaGrabbed: booleanish,
+ ariaHasPopup: null,
+ ariaHidden: booleanish,
+ ariaInvalid: null,
+ ariaKeyShortcuts: null,
+ ariaLabel: null,
+ ariaLabelledBy: spaceSeparated,
+ ariaLevel: number,
+ ariaLive: null,
+ ariaModal: booleanish,
+ ariaMultiLine: booleanish,
+ ariaMultiSelectable: booleanish,
+ ariaOrientation: null,
+ ariaOwns: spaceSeparated,
+ ariaPlaceholder: null,
+ ariaPosInSet: number,
+ ariaPressed: booleanish,
+ ariaReadOnly: booleanish,
+ ariaRelevant: null,
+ ariaRequired: booleanish,
+ ariaRoleDescription: spaceSeparated,
+ ariaRowCount: number,
+ ariaRowIndex: number,
+ ariaRowSpan: number,
+ ariaSelected: booleanish,
+ ariaSetSize: number,
+ ariaSort: null,
+ ariaValueMax: number,
+ ariaValueMin: number,
+ ariaValueNow: number,
+ ariaValueText: null,
+ role: null
+ }
+});
+
+// node_modules/property-information/lib/html.js
+var html = create({
+ space: "html",
+ attributes: {
+ acceptcharset: "accept-charset",
+ classname: "class",
+ htmlfor: "for",
+ httpequiv: "http-equiv"
+ },
+ transform: caseInsensitiveTransform,
+ mustUseProperty: ["checked", "multiple", "muted", "selected"],
+ properties: {
+ // Standard Properties.
+ abbr: null,
+ accept: commaSeparated,
+ acceptCharset: spaceSeparated,
+ accessKey: spaceSeparated,
+ action: null,
+ allow: null,
+ allowFullScreen: boolean,
+ allowPaymentRequest: boolean,
+ allowUserMedia: boolean,
+ alt: null,
+ as: null,
+ async: boolean,
+ autoCapitalize: null,
+ autoComplete: spaceSeparated,
+ autoFocus: boolean,
+ autoPlay: boolean,
+ blocking: spaceSeparated,
+ capture: null,
+ charSet: null,
+ checked: boolean,
+ cite: null,
+ className: spaceSeparated,
+ cols: number,
+ colSpan: null,
+ content: null,
+ contentEditable: booleanish,
+ controls: boolean,
+ controlsList: spaceSeparated,
+ coords: number | commaSeparated,
+ crossOrigin: null,
+ data: null,
+ dateTime: null,
+ decoding: null,
+ default: boolean,
+ defer: boolean,
+ dir: null,
+ dirName: null,
+ disabled: boolean,
+ download: overloadedBoolean,
+ draggable: booleanish,
+ encType: null,
+ enterKeyHint: null,
+ fetchPriority: null,
+ form: null,
+ formAction: null,
+ formEncType: null,
+ formMethod: null,
+ formNoValidate: boolean,
+ formTarget: null,
+ headers: spaceSeparated,
+ height: number,
+ hidden: boolean,
+ high: number,
+ href: null,
+ hrefLang: null,
+ htmlFor: spaceSeparated,
+ httpEquiv: spaceSeparated,
+ id: null,
+ imageSizes: null,
+ imageSrcSet: null,
+ inert: boolean,
+ inputMode: null,
+ integrity: null,
+ is: null,
+ isMap: boolean,
+ itemId: null,
+ itemProp: spaceSeparated,
+ itemRef: spaceSeparated,
+ itemScope: boolean,
+ itemType: spaceSeparated,
+ kind: null,
+ label: null,
+ lang: null,
+ language: null,
+ list: null,
+ loading: null,
+ loop: boolean,
+ low: number,
+ manifest: null,
+ max: null,
+ maxLength: number,
+ media: null,
+ method: null,
+ min: null,
+ minLength: number,
+ multiple: boolean,
+ muted: boolean,
+ name: null,
+ nonce: null,
+ noModule: boolean,
+ noValidate: boolean,
+ onAbort: null,
+ onAfterPrint: null,
+ onAuxClick: null,
+ onBeforeMatch: null,
+ onBeforePrint: null,
+ onBeforeToggle: null,
+ onBeforeUnload: null,
+ onBlur: null,
+ onCancel: null,
+ onCanPlay: null,
+ onCanPlayThrough: null,
+ onChange: null,
+ onClick: null,
+ onClose: null,
+ onContextLost: null,
+ onContextMenu: null,
+ onContextRestored: null,
+ onCopy: null,
+ onCueChange: null,
+ onCut: null,
+ onDblClick: null,
+ onDrag: null,
+ onDragEnd: null,
+ onDragEnter: null,
+ onDragExit: null,
+ onDragLeave: null,
+ onDragOver: null,
+ onDragStart: null,
+ onDrop: null,
+ onDurationChange: null,
+ onEmptied: null,
+ onEnded: null,
+ onError: null,
+ onFocus: null,
+ onFormData: null,
+ onHashChange: null,
+ onInput: null,
+ onInvalid: null,
+ onKeyDown: null,
+ onKeyPress: null,
+ onKeyUp: null,
+ onLanguageChange: null,
+ onLoad: null,
+ onLoadedData: null,
+ onLoadedMetadata: null,
+ onLoadEnd: null,
+ onLoadStart: null,
+ onMessage: null,
+ onMessageError: null,
+ onMouseDown: null,
+ onMouseEnter: null,
+ onMouseLeave: null,
+ onMouseMove: null,
+ onMouseOut: null,
+ onMouseOver: null,
+ onMouseUp: null,
+ onOffline: null,
+ onOnline: null,
+ onPageHide: null,
+ onPageShow: null,
+ onPaste: null,
+ onPause: null,
+ onPlay: null,
+ onPlaying: null,
+ onPopState: null,
+ onProgress: null,
+ onRateChange: null,
+ onRejectionHandled: null,
+ onReset: null,
+ onResize: null,
+ onScroll: null,
+ onScrollEnd: null,
+ onSecurityPolicyViolation: null,
+ onSeeked: null,
+ onSeeking: null,
+ onSelect: null,
+ onSlotChange: null,
+ onStalled: null,
+ onStorage: null,
+ onSubmit: null,
+ onSuspend: null,
+ onTimeUpdate: null,
+ onToggle: null,
+ onUnhandledRejection: null,
+ onUnload: null,
+ onVolumeChange: null,
+ onWaiting: null,
+ onWheel: null,
+ open: boolean,
+ optimum: number,
+ pattern: null,
+ ping: spaceSeparated,
+ placeholder: null,
+ playsInline: boolean,
+ popover: null,
+ popoverTarget: null,
+ popoverTargetAction: null,
+ poster: null,
+ preload: null,
+ readOnly: boolean,
+ referrerPolicy: null,
+ rel: spaceSeparated,
+ required: boolean,
+ reversed: boolean,
+ rows: number,
+ rowSpan: number,
+ sandbox: spaceSeparated,
+ scope: null,
+ scoped: boolean,
+ seamless: boolean,
+ selected: boolean,
+ shadowRootDelegatesFocus: boolean,
+ shadowRootMode: null,
+ shape: null,
+ size: number,
+ sizes: null,
+ slot: null,
+ span: number,
+ spellCheck: booleanish,
+ src: null,
+ srcDoc: null,
+ srcLang: null,
+ srcSet: null,
+ start: number,
+ step: null,
+ style: null,
+ tabIndex: number,
+ target: null,
+ title: null,
+ translate: null,
+ type: null,
+ typeMustMatch: boolean,
+ useMap: null,
+ value: booleanish,
+ width: number,
+ wrap: null,
+ // Legacy.
+ // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
+ align: null,
+ // Several. Use CSS `text-align` instead,
+ aLink: null,
+ // ``. Use CSS `a:active {color}` instead
+ archive: spaceSeparated,
+ // `