diff --git a/.obsidian/plugins/metaedit/main.js b/.obsidian/plugins/metaedit/main.js
index d07970d..9916f59 100644
--- a/.obsidian/plugins/metaedit/main.js
+++ b/.obsidian/plugins/metaedit/main.js
@@ -98,21 +98,22 @@ function children(element) {
}
function set_data(text, data) {
data = '' + data;
- if (text.wholeText !== data)
- text.data = data;
+ if (text.data === data)
+ return;
+ text.data = data;
}
function set_input_value(input, value) {
input.value = value == null ? '' : value;
}
function set_style(node, key, value, important) {
- if (value === null) {
+ if (value == null) {
node.style.removeProperty(key);
}
else {
node.style.setProperty(key, value, important ? 'important' : '');
}
}
-function select_option(select, value) {
+function select_option(select, value, mounting) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
if (option.__value === value) {
@@ -120,10 +121,12 @@ function select_option(select, value) {
return;
}
}
- select.selectedIndex = -1; // no option should be selected
+ if (!mounting || value !== undefined) {
+ select.selectedIndex = -1; // no option should be selected
+ }
}
function select_value(select) {
- const selected_option = select.querySelector(':checked') || select.options[0];
+ const selected_option = select.querySelector(':checked');
return selected_option && selected_option.__value;
}
@@ -151,9 +154,9 @@ function onMount(fn) {
const dirty_components = [];
const binding_callbacks = [];
-const render_callbacks = [];
+let render_callbacks = [];
const flush_callbacks = [];
-const resolved_promise = Promise.resolve();
+const resolved_promise = /* @__PURE__ */ Promise.resolve();
let update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
@@ -244,6 +247,16 @@ function update($$) {
$$.after_update.forEach(add_render_callback);
}
}
+/**
+ * Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
+ */
+function flush_render_callbacks(fns) {
+ const filtered = [];
+ const targets = [];
+ render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
+ targets.forEach((c) => c());
+ render_callbacks = filtered;
+}
const outroing = new Set();
function transition_in(block, local) {
if (block && block.i) {
@@ -277,6 +290,7 @@ function mount_component(component, target, anchor, customElement) {
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
+ flush_render_callbacks($$.after_update);
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
// TODO null out other refs, including component.$$ (but need to
@@ -390,7 +404,7 @@ var ProgressPropertyOptions;
ProgressPropertyOptions["TaskIncomplete"] = "Incomplete Tasks";
})(ProgressPropertyOptions || (ProgressPropertyOptions = {}));
-/* src/Modals/ProgressPropertiesSettingModal/ProgressPropertiesModalContent.svelte generated by Svelte v3.55.1 */
+/* src/Modals/ProgressPropertiesSettingModal/ProgressPropertiesModalContent.svelte generated by Svelte v3.59.2 */
function add_css$3(target) {
append_styles(target, "svelte-kqcr7b", ".buttonContainer.svelte-kqcr7b{display:flex;justify-content:center;margin-top:1rem}select.svelte-kqcr7b{border-radius:4px;width:100%;height:30px;border:1px solid #dbdbdc;color:#383a42;background-color:#fff;padding:3px}button.svelte-kqcr7b{margin-left:5px;margin-right:5px;font-size:15px}");
@@ -500,10 +514,12 @@ function create_each_block$3(ctx) {
append(td1, select);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(select, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(select, null);
+ }
}
- select_option(select, /*property*/ ctx[10].type);
+ select_option(select, /*property*/ ctx[10].type, true);
append(tr, t1);
append(tr, td2);
append(td2, input1);
@@ -612,7 +628,9 @@ function create_fragment$4(ctx) {
append(table, t3);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(table, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(table, null);
+ }
}
append(div1, t4);
@@ -722,7 +740,7 @@ class ProgressPropertiesModalContent extends SvelteComponent {
}
}
-/* src/Modals/AutoPropertiesSettingModal/AutoPropertiesModalContent.svelte generated by Svelte v3.55.1 */
+/* src/Modals/AutoPropertiesSettingModal/AutoPropertiesModalContent.svelte generated by Svelte v3.59.2 */
function add_css$2(target) {
append_styles(target, "svelte-kqcr7b", ".buttonContainer.svelte-kqcr7b{display:flex;justify-content:center;margin-top:1rem}button.svelte-kqcr7b{margin-left:5px;margin-right:5px;font-size:15px}");
@@ -891,7 +909,9 @@ function create_each_block$2(ctx) {
append(tr, td2);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(td2, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(td2, null);
+ }
}
append(tr, t2);
@@ -1001,7 +1021,9 @@ function create_fragment$3(ctx) {
append(table, t4);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(table, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(table, null);
+ }
}
append(div1, t5);
@@ -1291,7 +1313,7 @@ var round = Math.round;
function getUAString() {
var uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands) {
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
return uaData.brands.map(function (item) {
return item.brand + "/" + item.version;
}).join(' ');
@@ -1578,17 +1600,7 @@ function effect$1(_ref2) {
}
}
- if (process.env.NODE_ENV !== "production") {
- if (!isHTMLElement(arrowElement)) {
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
- }
- }
-
if (!contains(state.elements.popper, arrowElement)) {
- if (process.env.NODE_ENV !== "production") {
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
- }
-
return;
}
@@ -1619,10 +1631,9 @@ var unsetSides = {
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
-function roundOffsetsByDPR(_ref) {
+function roundOffsetsByDPR(_ref, win) {
var x = _ref.x,
y = _ref.y;
- var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
@@ -1705,7 +1716,7 @@ function mapToStyles(_ref2) {
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x: x,
y: y
- }) : {
+ }, getWindow(popper)) : {
x: x,
y: y
};
@@ -1731,17 +1742,6 @@ function computeStyles(_ref5) {
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
_options$roundOffsets = options.roundOffsets,
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
-
- if (process.env.NODE_ENV !== "production") {
- var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
-
- if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
- return transitionProperty.indexOf(property) >= 0;
- })) {
- console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
- }
- }
-
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
@@ -2182,10 +2182,6 @@ function computeAutoPlacement(state, options) {
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
-
- if (process.env.NODE_ENV !== "production") {
- console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
- }
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
@@ -2737,108 +2733,6 @@ function debounce(fn) {
};
}
-function format(str) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- return [].concat(args).reduce(function (p, c) {
- return p.replace(/%s/, c);
- }, str);
-}
-
-var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
-var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
-var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
-function validateModifiers(modifiers) {
- modifiers.forEach(function (modifier) {
- [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
- .filter(function (value, index, self) {
- return self.indexOf(value) === index;
- }).forEach(function (key) {
- switch (key) {
- case 'name':
- if (typeof modifier.name !== 'string') {
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
- }
-
- break;
-
- case 'enabled':
- if (typeof modifier.enabled !== 'boolean') {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
- }
-
- break;
-
- case 'phase':
- if (modifierPhases.indexOf(modifier.phase) < 0) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
- }
-
- break;
-
- case 'fn':
- if (typeof modifier.fn !== 'function') {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
- }
-
- break;
-
- case 'effect':
- if (modifier.effect != null && typeof modifier.effect !== 'function') {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
- }
-
- break;
-
- case 'requires':
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
- }
-
- break;
-
- case 'requiresIfExists':
- if (!Array.isArray(modifier.requiresIfExists)) {
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
- }
-
- break;
-
- case 'options':
- case 'data':
- break;
-
- default:
- console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
- return "\"" + s + "\"";
- }).join(', ') + "; but \"" + key + "\" was provided.");
- }
-
- modifier.requires && modifier.requires.forEach(function (requirement) {
- if (modifiers.find(function (mod) {
- return mod.name === requirement;
- }) == null) {
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
- }
- });
- });
- });
-}
-
-function uniqueBy(arr, fn) {
- var identifiers = new Set();
- return arr.filter(function (item) {
- var identifier = fn(item);
-
- if (!identifiers.has(identifier)) {
- identifiers.add(identifier);
- return true;
- }
- });
-}
-
function mergeByName(modifiers) {
var merged = modifiers.reduce(function (merged, current) {
var existing = merged[current.name];
@@ -2854,8 +2748,6 @@ function mergeByName(modifiers) {
});
}
-var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
-var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
var DEFAULT_OPTIONS = {
placement: 'bottom',
modifiers: [],
@@ -2917,42 +2809,7 @@ function popperGenerator(generatorOptions) {
state.orderedModifiers = orderedModifiers.filter(function (m) {
return m.enabled;
- }); // Validate the provided modifiers so that the consumer will get warned
- // if one of the modifiers is invalid for any reason
-
- if (process.env.NODE_ENV !== "production") {
- var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
- var name = _ref.name;
- return name;
- });
- validateModifiers(modifiers);
-
- if (getBasePlacement(state.options.placement) === auto) {
- var flipModifier = state.orderedModifiers.find(function (_ref2) {
- var name = _ref2.name;
- return name === 'flip';
- });
-
- if (!flipModifier) {
- console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
- }
- }
-
- var _getComputedStyle = getComputedStyle(popper),
- marginTop = _getComputedStyle.marginTop,
- marginRight = _getComputedStyle.marginRight,
- marginBottom = _getComputedStyle.marginBottom,
- marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
- // cause bugs with positioning, so we'll warn the consumer
-
-
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
- return parseFloat(margin);
- })) {
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
- }
- }
-
+ });
runModifierEffects();
return instance.update();
},
@@ -2972,10 +2829,6 @@ function popperGenerator(generatorOptions) {
// anymore
if (!areValidElements(reference, popper)) {
- if (process.env.NODE_ENV !== "production") {
- console.error(INVALID_ELEMENT_ERROR);
- }
-
return;
} // Store the reference and popper rects to be read by modifiers
@@ -2998,18 +2851,8 @@ function popperGenerator(generatorOptions) {
state.orderedModifiers.forEach(function (modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
});
- var __debug_loops__ = 0;
for (var index = 0; index < state.orderedModifiers.length; index++) {
- if (process.env.NODE_ENV !== "production") {
- __debug_loops__ += 1;
-
- if (__debug_loops__ > 100) {
- console.error(INFINITE_LOOP_ERROR);
- break;
- }
- }
-
if (state.reset === true) {
state.reset = false;
index = -1;
@@ -3047,10 +2890,6 @@ function popperGenerator(generatorOptions) {
};
if (!areValidElements(reference, popper)) {
- if (process.env.NODE_ENV !== "production") {
- console.error(INVALID_ELEMENT_ERROR);
- }
-
return instance;
}
@@ -3065,11 +2904,11 @@ function popperGenerator(generatorOptions) {
// one.
function runModifierEffects() {
- state.orderedModifiers.forEach(function (_ref3) {
- var name = _ref3.name,
- _ref3$options = _ref3.options,
- options = _ref3$options === void 0 ? {} : _ref3$options,
- effect = _ref3.effect;
+ state.orderedModifiers.forEach(function (_ref) {
+ var name = _ref.name,
+ _ref$options = _ref.options,
+ options = _ref$options === void 0 ? {} : _ref$options,
+ effect = _ref.effect;
if (typeof effect === 'function') {
var cleanupFn = effect({
@@ -3284,7 +3123,7 @@ class LogManager {
LogManager.loggers = [];
const log = new LogManager();
-/* src/Modals/KanbanHelperSetting/KanbanHelperSettingContent.svelte generated by Svelte v3.55.1 */
+/* src/Modals/KanbanHelperSetting/KanbanHelperSettingContent.svelte generated by Svelte v3.59.2 */
function add_css$1(target) {
append_styles(target, "svelte-kqcr7b", ".buttonContainer.svelte-kqcr7b{display:flex;justify-content:center;margin-top:1rem}button.svelte-kqcr7b{margin-left:5px;margin-right:5px;font-size:15px}");
@@ -3451,7 +3290,9 @@ function create_fragment$2(ctx) {
append(table, t6);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(table, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(table, null);
+ }
}
append(div1, t7);
@@ -3617,7 +3458,7 @@ class KanbanHelperSettingContent extends SvelteComponent {
}
}
-/* src/Modals/shared/SingleValueTableEditorContent.svelte generated by Svelte v3.55.1 */
+/* src/Modals/shared/SingleValueTableEditorContent.svelte generated by Svelte v3.59.2 */
function add_css(target) {
append_styles(target, "svelte-kqcr7b", ".buttonContainer.svelte-kqcr7b{display:flex;justify-content:center;margin-top:1rem}button.svelte-kqcr7b{margin-left:5px;margin-right:5px;font-size:15px}");
@@ -3750,7 +3591,9 @@ function create_fragment$1(ctx) {
append(table, t2);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(table, null);
+ if (each_blocks[i]) {
+ each_blocks[i].m(table, null);
+ }
}
append(div1, t3);
@@ -4462,7 +4305,7 @@ class GenericTextSuggester extends TextInputSuggest {
}
}
-/* src/Modals/GenericPrompt/GenericPromptContent.svelte generated by Svelte v3.55.1 */
+/* src/Modals/GenericPrompt/GenericPromptContent.svelte generated by Svelte v3.59.2 */
function create_fragment(ctx) {
let div;
@@ -5357,6 +5200,8 @@ var OnModifyAutomatorType;
OnModifyAutomatorType["ProgressProperties"] = "ProgressProperties";
})(OnModifyAutomatorType || (OnModifyAutomatorType = {}));
+const MARKDOWN_HEADING = /#+\s+(.+)/;
+const TASK_REGEX = /(\s*)-\s*\[([ Xx\.]?)\]\s*(.+)/i;
class KanbanHelper extends OnFileModifyAutomator {
get boards() { return this.plugin.settings.KanbanHelper.boards; }
constructor(plugin) {
@@ -5371,20 +5216,87 @@ class KanbanHelper extends OnFileModifyAutomator {
const { links } = kanbanBoardFileCache;
if (!links)
return;
- await this.updateFilesInBoard(links, targetBoard, kanbanBoardFileContent);
+ await this.updateFilesInBoard(links, targetBoard, file.path, kanbanBoardFileContent);
}
findBoardByName(boardName) {
return this.boards.find(board => board.boardName === boardName);
}
- getLinkFile(link) {
- const markdownFiles = this.app.vault.getMarkdownFiles();
- return markdownFiles.find(f => f.path.endsWith(`/${link.link}.md`) || f.path === `${link.link}.md`);
+ resolveLinkFile(link, sourcePath) {
+ const linkpath = this.normalizeLinkpath(link === null || link === void 0 ? void 0 : link.link);
+ if (!linkpath)
+ return null;
+ const candidates = this.buildLinkpathCandidates(linkpath);
+ const resolvedFromCache = this.resolveByMetadataCache(candidates, sourcePath);
+ if (resolvedFromCache)
+ return resolvedFromCache;
+ const resolvedByPath = this.resolveByPathCandidates(candidates);
+ if (resolvedByPath)
+ return resolvedByPath;
+ return this.resolveByBasenameCandidates(candidates);
}
- async updateFilesInBoard(links, board, kanbanBoardFileContent) {
+ normalizeLinkpath(link) {
+ if (!link)
+ return null;
+ let normalized = link;
+ try {
+ normalized = decodeURIComponent(normalized);
+ }
+ catch (_a) {
+ // Keep original link if decoding fails
+ }
+ normalized = normalized.replace(/^\/+/, "");
+ normalized = obsidian.normalizePath(normalized);
+ return obsidian.getLinkpath(normalized);
+ }
+ buildLinkpathCandidates(linkpath) {
+ const withoutExtension = this.stripMarkdownExtension(linkpath);
+ return Array.from(new Set([linkpath, withoutExtension]));
+ }
+ stripMarkdownExtension(path) {
+ return path.toLowerCase().endsWith(".md") ? path.slice(0, -3) : path;
+ }
+ ensureMarkdownExtension(path) {
+ return path.toLowerCase().endsWith(".md") ? path : `${path}.md`;
+ }
+ resolveByMetadataCache(candidates, sourcePath) {
+ for (const candidate of candidates) {
+ const resolved = this.app.metadataCache.getFirstLinkpathDest(candidate, sourcePath);
+ if (resolved)
+ return resolved;
+ }
+ return null;
+ }
+ resolveByPathCandidates(candidates) {
+ for (const candidate of candidates) {
+ const file = this.app.vault.getAbstractFileByPath(this.ensureMarkdownExtension(candidate));
+ const markdownFile = abstractFileToMarkdownTFile(file);
+ if (markdownFile)
+ return markdownFile;
+ }
+ return null;
+ }
+ resolveByBasenameCandidates(candidates) {
+ var _a;
+ const markdownFiles = this.app.vault.getMarkdownFiles();
+ for (const candidate of candidates) {
+ if (candidate.includes("/"))
+ continue;
+ const basename = this.stripMarkdownExtension((_a = candidate.split("/").pop()) !== null && _a !== void 0 ? _a : "");
+ if (!basename)
+ continue;
+ const found = markdownFiles.find(f => f.basename === basename);
+ if (found)
+ return found;
+ }
+ return null;
+ }
+ isMarkdownFile(file) {
+ return !!file && file.extension === "md";
+ }
+ async updateFilesInBoard(links, board, sourcePath, kanbanBoardFileContent) {
for (const link of links) {
- const linkFile = this.getLinkFile(link);
- const linkIsMarkdownFile = !!abstractFileToMarkdownTFile(linkFile);
- if (!linkFile || !linkIsMarkdownFile) {
+ const linkFile = this.resolveLinkFile(link, sourcePath);
+ if (!this.isMarkdownFile(linkFile)) {
log.logMessage(`${link.link} is not updatable for the KanbanHelper.`);
continue;
}
@@ -5404,19 +5316,17 @@ class KanbanHelper extends OnFileModifyAutomator {
}
const targetProperty = fileProperties.find(prop => prop.key === board.property);
if (!targetProperty) {
- log.logWarning(`'${board.property} not found in ${board.boardName} for file "${linkFile.name}".'`);
- new obsidian.Notice(`'${board.property} not found in ${board.boardName} for file "${linkFile.name}".'`); // This notice will help users debug "Property not found in board" errors.
+ log.logWarning(`'${board.property}' not found in '${board.boardName}' for file "${linkFile.name}".`);
+ new obsidian.Notice(`'${board.property}' not found in '${board.boardName}' for file "${linkFile.name}".`); // This notice will help users debug "Property not found in board" errors.
return;
}
- const propertyHasChanged = (targetProperty.content != heading); // Kanban Helper will check if the file's property is different from its current heading in the kanban and will only make changes to the file if there's a difference
+ const propertyHasChanged = targetProperty.content !== heading;
if (propertyHasChanged) {
- console.debug("Updating " + targetProperty.key + " of file " + linkFile.name + " to " + heading);
+ console.debug(`Updating ${targetProperty.key} of file ${linkFile.name} to ${heading}`);
await this.plugin.controller.updatePropertyInFile(targetProperty, heading, linkFile);
}
}
getTaskHeading(targetTaskContent, fileContent) {
- const MARKDOWN_HEADING = new RegExp(/#+\s+(.+)/);
- const TASK_REGEX = new RegExp(/(\s*)-\s*\[([ Xx\.]?)\]\s*(.+)/, "i");
let lastHeading = "";
const contentLines = fileContent.split("\n");
for (const line of contentLines) {
@@ -5429,7 +5339,7 @@ class KanbanHelper extends OnFileModifyAutomator {
if (taskMatch) {
const taskContent = taskMatch[3];
if (taskContent.includes(targetTaskContent)) {
- return lastHeading;
+ return lastHeading || null;
}
}
}
@@ -5536,3 +5446,5 @@ class MetaEdit extends obsidian.Plugin {
}
module.exports = MetaEdit;
+
+/* nosourcemap */
\ No newline at end of file
diff --git a/.obsidian/plugins/metaedit/manifest.json b/.obsidian/plugins/metaedit/manifest.json
index a04a992..9ceab88 100644
--- a/.obsidian/plugins/metaedit/manifest.json
+++ b/.obsidian/plugins/metaedit/manifest.json
@@ -1,7 +1,7 @@
{
"id": "metaedit",
"name": "MetaEdit",
- "version": "1.8.2",
+ "version": "1.8.4",
"minAppVersion": "1.4.1",
"description": "MetaEdit helps you manage your metadata.",
"author": "Christian B. B. Houmann",
diff --git a/.obsidian/plugins/quickadd/data.json b/.obsidian/plugins/quickadd/data.json
index 2895fc0..17c3d9d 100644
--- a/.obsidian/plugins/quickadd/data.json
+++ b/.obsidian/plugins/quickadd/data.json
@@ -95,7 +95,13 @@
},
"openFile": false,
"openFileInMode": "default",
- "activeFileWritePosition": "cursor"
+ "activeFileWritePosition": "cursor",
+ "fileOpening": {
+ "location": "tab",
+ "direction": "vertical",
+ "focus": true,
+ "mode": "default"
+ }
}
}
]
@@ -147,7 +153,13 @@
"openFile": false,
"openFileInMode": "default",
"fileExistsMode": "Increment the file name",
- "setFileExistsBehavior": false
+ "setFileExistsBehavior": false,
+ "fileOpening": {
+ "location": "tab",
+ "direction": "vertical",
+ "focus": true,
+ "mode": "default"
+ }
}
},
{
@@ -194,7 +206,13 @@
},
"openFile": false,
"openFileInMode": "default",
- "activeFileWritePosition": "cursor"
+ "activeFileWritePosition": "cursor",
+ "fileOpening": {
+ "location": "tab",
+ "direction": "vertical",
+ "focus": true,
+ "mode": "default"
+ }
}
}
]
@@ -243,7 +261,13 @@
"openFile": false,
"openFileInMode": "default",
"fileExistsMode": "Increment the file name",
- "setFileExistsBehavior": false
+ "setFileExistsBehavior": false,
+ "fileOpening": {
+ "location": "tab",
+ "direction": "vertical",
+ "focus": true,
+ "mode": "default"
+ }
}
},
{
@@ -289,7 +313,13 @@
"focus": true
},
"openFile": false,
- "openFileInMode": "default"
+ "openFileInMode": "default",
+ "fileOpening": {
+ "location": "tab",
+ "direction": "vertical",
+ "focus": true,
+ "mode": "default"
+ }
}
}
]
@@ -298,10 +328,12 @@
}
],
"inputPrompt": "single-line",
+ "persistInputPromptDrafts": true,
+ "useSelectionAsCaptureValue": true,
"devMode": false,
"templateFolderPath": "Resources/Templates",
"announceUpdates": "all",
- "version": "2.9.4",
+ "version": "2.10.0",
"globalVariables": {},
"onePageInputEnabled": false,
"disableOnlineFeatures": true,
@@ -309,6 +341,17 @@
"showCaptureNotification": true,
"showInputCancellationNotification": false,
"enableTemplatePropertyTypes": false,
+ "dateAliases": {
+ "t": "today",
+ "tm": "tomorrow",
+ "yd": "yesterday",
+ "nw": "next week",
+ "nm": "next month",
+ "ny": "next year",
+ "lw": "last week",
+ "lm": "last month",
+ "ly": "last year"
+ },
"ai": {
"defaultModel": "Ask me",
"defaultSystemPrompt": "As an AI assistant within Obsidian, your primary goal is to help users manage their ideas and knowledge more effectively. Format your responses using Markdown syntax. Please use the [[Obsidian]] link format. You can write aliases for the links by writing [[Obsidian|the alias after the pipe symbol]]. To use mathematical notation, use LaTeX syntax. LaTeX syntax for larger equations should be on separate lines, surrounded with double dollar signs ($$). You can also inline math expressions by wrapping it in $ symbols. For example, use $$w_{ij}^{\text{new}}:=w_{ij}^{\text{current}}+etacdotdelta_jcdot x_{ij}$$ on a separate line, but you can write \"($eta$ = learning rate, $delta_j$ = error term, $x_{ij}$ = input)\" inline.",
@@ -362,6 +405,8 @@
"addDefaultAIProviders": true,
"removeMacroIndirection": true,
"migrateFileOpeningSettings": true,
- "setProviderModelDiscoveryMode": true
+ "setProviderModelDiscoveryMode": true,
+ "backfillFileOpeningDefaults": true,
+ "migrateProviderApiKeysToSecretStorage": true
}
}
\ No newline at end of file
diff --git a/.obsidian/plugins/quickadd/main.js b/.obsidian/plugins/quickadd/main.js
index c64088b..fe07bf1 100644
--- a/.obsidian/plugins/quickadd/main.js
+++ b/.obsidian/plugins/quickadd/main.js
@@ -3,98 +3,103 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
-var yE=Object.create;var Xm=Object.defineProperty;var oE=Object.getOwnPropertyDescriptor;var CE=Object.getOwnPropertyNames;var iE=Object.getPrototypeOf,gE=Object.prototype.hasOwnProperty;var AE=(b,I,G)=>I in b?Xm(b,I,{enumerable:!0,configurable:!0,writable:!0,value:G}):b[I]=G;var La=(b,I)=>()=>(I||b((I={exports:{}}).exports,I),I.exports),ol=(b,I)=>{for(var G in I)Xm(b,G,{get:I[G],enumerable:!0})},cp=(b,I,G,l)=>{if(I&&typeof I=="object"||typeof I=="function")for(let c of CE(I))!gE.call(b,c)&&c!==G&&Xm(b,c,{get:()=>I[c],enumerable:!(l=oE(I,c))||l.enumerable});return b};var UI=(b,I,G)=>(G=b!=null?yE(iE(b)):{},cp(I||!b||!b.__esModule?Xm(G,"default",{value:b,enumerable:!0}):G,b)),rE=b=>cp(Xm({},"__esModule",{value:!0}),b);var GI=(b,I,G)=>AE(b,typeof I!="symbol"?I+"":I,G);var Sp=La((on,Cn)=>{(function(b,I){typeof on=="object"&&typeof Cn<"u"?Cn.exports=I():typeof define=="function"&&define.amd?define(I):(b=typeof globalThis<"u"?globalThis:b||self).dayjs_plugin_quarterOfYear=I()})(on,function(){"use strict";var b="month",I="quarter";return function(G,l){var c=l.prototype;c.quarter=function(d){return this.$utils().u(d)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(d-1))};var Z=c.add;c.add=function(d,m){return d=Number(d),this.$utils().p(m)===I?this.add(3*d,b):Z.bind(this)(d,m)};var W=c.startOf;c.startOf=function(d,m){var N=this.$utils(),Y=!!N.u(m)||m;if(N.p(d)===I){var a=this.quarter()-1;return Y?this.month(3*a).startOf(b).startOf("day"):this.month(3*a+2).endOf(b).endOf("day")}return W.bind(this)(d,m)}}})});var MI=La((gn,An)=>{(function(b,I){typeof gn=="object"&&typeof An<"u"?An.exports=I():typeof define=="function"&&define.amd?define(I):(b=typeof globalThis<"u"?globalThis:b||self).dayjs=I()})(gn,function(){"use strict";var b=1e3,I=6e4,G=36e5,l="millisecond",c="second",Z="minute",W="hour",d="day",m="week",N="month",Y="quarter",a="year",V="date",h="Invalid Date",n=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,X=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var z=["th","st","nd","rd"],r=L%100;return"["+L+(z[(r-20)%10]||z[r]||z[0])+"]"}},e=function(L,z,r){var w=String(L);return!w||w.length>=z?L:""+Array(z+1-w.length).join(r)+L},Q={s:e,z:function(L){var z=-L.utcOffset(),r=Math.abs(z),w=Math.floor(r/60),i=r%60;return(z<=0?"+":"-")+e(w,2,"0")+":"+e(i,2,"0")},m:function L(z,r){if(z.date()p)throw new Error(`Chunk size (${r}) is larger than the maximum chunk size (${p}). Please check your chunk separator.`);let w=await G(m,{chunk:z});Q.push(w)}let R=nh(b,c,Z,d,Y),J=["prompting",`${Q.length} prompts being sent.`];l.setMessage(J[0],J[1]);let E=new mt(5,1e3*30),H=Promise.all(Q.map(z=>E.add(()=>R(z)))),k=(await Nt(H,100,z=>{l.setMessage(J[0],`${J[1]} (${(z/1e3).toFixed(2)}s)`)},z=>{l.setMessage("finished",`Took ${(z/1e3).toFixed(2)}s.`)})).map(z=>z.content).join(I.resultJoiner),f=("> "+k).replace(/\n/g,`
-> `),L={[W]:k,[`${W}-quoted`]:f};return setTimeout(()=>l.hide(),5e3),L}catch(c){throw l.setMessage("dead",c.message),setTimeout(()=>l.hide(),5e3),c}}var sd=require("obsidian"),TY=class b extends sd.Modal{constructor(G,l,c=[]){super(G);this.items=l;this.selectedItems=c;this._selectedItems=[...c],this.promise=new Promise((Z,W)=>{this.resolvePromise=Z,this.rejectPromise=W}),this.display(),this.open()}static Open(G,l,c){return new b(G,l,c).promise}display(){this.contentEl.empty(),this.containerEl.addClass("quickAddModal","checkboxPrompt"),this.addCheckboxRows(),this.addSubmitButton()}onClose(){super.onClose(),this.resolved||this.rejectPromise("no input given.")}addCheckboxRows(){let G=this.contentEl.createDiv("checkboxRowContainer");this.items.forEach(l=>this.addCheckboxRow(l,G))}addCheckboxRow(G,l){let c=l.createDiv("checkboxRow");c.createEl("span",{text:G}),new sd.ToggleComponent(c).setTooltip(`Toggle ${G}`).setValue(this._selectedItems.contains(G)).onChange(W=>{if(W)this._selectedItems.push(G);else{let d=this._selectedItems.findIndex(m=>G===m);this._selectedItems.splice(d,1)}})}addSubmitButton(){let G=this.contentEl.createDiv("submitButtonContainer");new sd.ButtonComponent(G).setButtonText("Submit").setCta().onClick(c=>{this.resolved=!0,this.resolvePromise(this._selectedItems),this.close()})}};var Fh=require("obsidian"),SY=class b extends Fh.Modal{constructor(G,l,c){super(G);this.header=l;this.text=c;this.waitForClose=new Promise(Z=>{this.resolvePromise=Z}),this.open(),this.display()}static Show(G,l,c){return new b(G,l,c).waitForClose}display(){this.contentEl.empty(),this.titleEl.textContent=this.header,String.isString(this.text)?this.contentEl.createEl("p",{text:this.text}):Array.isArray(this.text)&&this.text.forEach(c=>this.contentEl.createEl("p",{text:c}));let G=this.contentEl.createDiv(),l=new Fh.ButtonComponent(G).setButtonText("OK").onClick(()=>this.close());Object.assign(G.style,{display:"flex",justifyContent:"flex-end"}),l.buttonEl.focus()}onClose(){super.onClose(),this.resolvePromise()}};var wd=require("obsidian");var ZW=class b extends wd.Modal{constructor(G,l,c,Z,W){super(G);this.header=l;this.linkSourcePath=W;this.didSubmit=!1;this.submitClickCallback=G=>this.submit();this.cancelClickCallback=G=>this.cancel();this.submitEnterCallback=G=>{(G.ctrlKey||G.metaKey)&&G.key==="Enter"&&(G.preventDefault(),this.submit())};this.placeholder=c??"",this.input=Z??"",this.waitForClose=new Promise((d,m)=>{this.resolvePromise=d,this.rejectPromise=m}),this.display(),this.open(),this.fileSuggester=new ed(G,this.inputComponent.inputEl,{sourcePath:this.linkSourcePath}),this.tagSuggester=new Qd(G,this.inputComponent.inputEl)}static Prompt(G,l,c,Z){return new b(G,l,c,Z,void 0).waitForClose}static PromptWithContext(G,l,c,Z,W){return new b(G,l,c,Z,W).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaWideInputPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header;let G=this.contentEl.createDiv();this.inputComponent=this.createInputField(G,this.placeholder,this.input),this.createButtonBar(G)}createInputField(G,l,c){let Z=new wd.TextAreaComponent(G);return Z.inputEl.classList.add("wideInputPromptInputEl"),Z.inputEl.setAttribute("dir","auto"),Z.setPlaceholder(l??"").setValue(c??"").onChange(W=>this.input=W).inputEl.addEventListener("keydown",this.submitEnterCallback),Z}createButton(G,l,c){let Z=new wd.ButtonComponent(G);return Z.setButtonText(l).onClick(c),Z}createButtonBar(G){let l=G.createDiv();this.createButton(l,"Ok",this.submitClickCallback).setCta().buttonEl.style.marginRight="0",this.createButton(l,"Cancel",this.cancelClickCallback),l.style.display="flex",l.style.flexDirection="row-reverse",l.style.justifyContent="flex-start",l.style.marginTop="1rem",l.style.gap="0.5rem"}escapeBackslashes(G){return G.replace(/\\/g,"\\\\")}submit(){this.didSubmit||(this.didSubmit=!0,this.input=this.escapeBackslashes(this.input),this.close())}cancel(){this.close()}resolveInput(){this.didSubmit?this.resolvePromise(this.input):this.rejectPromise("No input given.")}removeInputListener(){this.inputComponent.inputEl.removeEventListener("keydown",this.submitEnterCallback)}onOpen(){super.onOpen(),this.inputComponent.inputEl.focus(),this.inputComponent.inputEl.select()}onClose(){super.onClose(),this.resolveInput(),this.removeInputListener()}};var fY=require("obsidian"),hb=class b extends fY.Modal{constructor(G,l,c){super(G);this.header=l;this.text=c;this.didSubmit=!1;this.waitForClose=new Promise((Z,W)=>{this.resolvePromise=Z,this.rejectPromise=W}),this.open(),this.display()}static Prompt(G,l,c){return new b(G,l,c).waitForClose}display(){this.containerEl.addClass("quickAddModal","qaYesNoPrompt"),this.contentEl.empty(),this.titleEl.textContent=this.header,this.contentEl.createEl("p",{text:this.text});let G=this.contentEl.createDiv({cls:"yesNoPromptButtonContainer"}),l=new fY.ButtonComponent(G).setButtonText("No").onClick(()=>this.submit(!1)),c=new fY.ButtonComponent(G).setButtonText("Yes").onClick(()=>this.submit(!0)).setWarning();c.buttonEl.focus(),ei([l.buttonEl,c.buttonEl])}submit(G){this.input=G,this.didSubmit=!0,this.close()}onClose(){super.onClose(),this.didSubmit?this.resolvePromise(this.input):this.rejectPromise("No answer given.")}};function ei(b){b.forEach(I=>{I.addEventListener("keydown",G=>{if(G.key==="ArrowRight"||G.key==="ArrowLeft"){let c=(b.indexOf(I)+(G.key==="ArrowRight"?1:-1)+b.length)%b.length;b[c].focus(),G.preventDefault()}})})}var mG=require("obsidian");var vd=class{static parse(I){let G=I.split("|").map(Z=>Z.trim()),l=G[0],c={};for(let Z=1;Z
Select choices to bundle. Dependencies are added automatically.
',l=K(),c=v("section"),Z=v("input"),d=K(),m=v("div"),N=v("button"),N.textContent="Select visible",Y=K(),a=v("button"),a.textContent="Clear selection",V=K(),h=v("section"),II.c(),n=K(),X=v("section"),p=v("h3"),p.textContent="Package summary",e=K(),Q=v("div"),s=v("div"),R=v("strong"),E=NI(J),H=K(),g=v("span"),g.textContent="Selected choices",C=K(),k=v("div"),f=v("strong"),z=NI(L),r=K(),w=v("span"),w.textContent="Total packaged",i=K(),o=v("div"),B=v("strong"),_=NI(j),YI=K(),aI=v("span"),aI.textContent="Auto-included",QI=K(),vI=v("div"),tI=v("strong"),EI=NI(VI),_I=K(),RG=v("span"),RG.textContent="Scripts embedded",EG=K(),tG=v("div"),eb=v("strong"),Bl=NI(Ul),Yl=K(),al=v("span"),al.textContent="Templates embedded",T=K(),P&&P.c(),LI=K(),hI&&hI.c(),xI=K(),KI=v("section"),Pl=v("div"),Vl=v("button"),lG.c(),rc=K(),nc=v("div"),_l=v("label"),Lc=v("span"),Lc.textContent="Save to file",hZ=K(),kc=v("div"),Qb=v("input"),Aa=K(),Hb=v("button"),OG.c(),tm=K(),RZ=v("section"),ub=v("button"),ra=NI("Cancel"),t(G,"class","svelte-iqd8ho"),t(Z,"type","text"),t(Z,"placeholder","Filter choices"),t(Z,"autocapitalize","off"),t(Z,"autocorrect","off"),t(Z,"spellcheck",W=!1),t(Z,"class","svelte-iqd8ho"),t(N,"type","button"),t(N,"class","svelte-iqd8ho"),t(a,"type","button"),t(a,"class","svelte-iqd8ho"),t(m,"class","controlButtons svelte-iqd8ho"),t(c,"class","controls svelte-iqd8ho"),t(h,"class","choiceList svelte-iqd8ho"),t(p,"class","svelte-iqd8ho"),t(R,"class","svelte-iqd8ho"),t(s,"class","svelte-iqd8ho"),t(f,"class","svelte-iqd8ho"),t(k,"class","svelte-iqd8ho"),t(B,"class","svelte-iqd8ho"),t(o,"class","svelte-iqd8ho"),t(tI,"class","svelte-iqd8ho"),t(vI,"class","svelte-iqd8ho"),t(eb,"class","svelte-iqd8ho"),t(tG,"class","svelte-iqd8ho"),t(Q,"class","summaryGrid svelte-iqd8ho"),t(X,"class","summary svelte-iqd8ho"),t(Vl,"type","button"),t(Vl,"class","secondary svelte-iqd8ho"),Vl.disabled=Ol=b[5]!==null,t(Pl,"class","actionGroup svelte-iqd8ho"),t(Qb,"type","text"),t(Qb,"placeholder","QuickAdd Packages/quickadd-package-YYYY-MM-DD.quickadd.json"),t(Qb,"class","svelte-iqd8ho"),t(Hb,"type","button"),Hb.disabled=nZ=b[5]!==null,t(Hb,"class","svelte-iqd8ho"),t(kc,"class","saveRow svelte-iqd8ho"),t(nc,"class","actionGroup svelte-iqd8ho"),t(KI,"class","actions svelte-iqd8ho"),t(ub,"type","button"),t(ub,"class","secondary svelte-iqd8ho"),ub.disabled=u=b[5]!==null,t(RZ,"class","footer svelte-iqd8ho"),t(I,"class","exportPackageModal svelte-iqd8ho")},m(MG,FG){cI(MG,I,FG),F(I,G),F(I,l),F(I,c),F(c,Z),DI(Z,b[1]),F(c,d),F(c,m),F(m,N),F(m,Y),F(m,a),F(I,V),F(I,h),II.m(h,null),F(I,n),F(I,X),F(X,p),F(X,e),F(X,Q),F(Q,s),F(s,R),F(R,E),F(s,H),F(s,g),F(Q,C),F(Q,k),F(k,f),F(f,z),F(k,r),F(k,w),F(Q,i),F(Q,o),F(o,B),F(B,_),F(o,YI),F(o,aI),F(Q,QI),F(Q,vI),F(vI,tI),F(tI,EI),F(vI,_I),F(vI,RG),F(Q,EG),F(Q,tG),F(tG,eb),F(eb,Bl),F(tG,Yl),F(tG,al),F(X,T),P&&P.m(X,null),F(I,LI),hI&&hI.m(I,null),F(I,xI),F(I,KI),F(KI,Pl),F(Pl,Vl),lG.m(Vl,null),F(KI,rc),F(KI,nc),F(nc,_l),F(_l,Lc),F(_l,hZ),F(_l,kc),F(kc,Qb),DI(Qb,b[3]),F(kc,Aa),F(kc,Hb),OG.m(Hb,null),F(I,tm),F(I,RZ),F(RZ,ub),F(ub,ra),A||(x=[S(Z,"input",b[21]),S(N,"click",b[11]),S(a,"click",b[12]),S(Vl,"click",b[13]),S(Qb,"input",b[24]),S(Hb,"click",b[14]),S(ub,"click",function(){gI(b[0])&&b[0].apply(this,arguments)})],A=!0)},p(MG,FG){b=MG,FG[0]&2&&Z.value!==b[1]&&DI(Z,b[1]),$===($=D(b,FG))&&II?II.p(b,FG):(II.d(1),II=$(b),II&&(II.c(),II.m(h,null))),FG[0]&256&&J!==(J=b[8].rootCount+"")&&sI(E,J),FG[0]&256&&L!==(L=b[8].totalChoices+"")&&sI(z,L),FG[0]&256&&j!==(j=b[8].dependencyCount+"")&&sI(_,j),FG[0]&256&&VI!==(VI=b[8].userScripts+b[8].conditionalScripts+"")&&sI(EI,VI),FG[0]&256&&Ul!==(Ul=b[8].templateFiles+b[8].captureTemplates+"")&&sI(Bl,Ul),b[8].missingChoiceIds.length>0?P?P.p(b,FG):(P=ov(b),P.c(),P.m(X,null)):P&&(P.d(1),P=null),b[4]?hI?hI.p(b,FG):(hI=Cv(b),hI.c(),hI.m(I,xI)):hI&&(hI.d(1),hI=null),JG!==(JG=$I(b,FG))&&(lG.d(1),lG=JG(b),lG&&(lG.c(),lG.m(Vl,null))),FG[0]&32&&Ol!==(Ol=b[5]!==null)&&(Vl.disabled=Ol),FG[0]&8&&Qb.value!==b[3]&&DI(Qb,b[3]),BG!==(BG=$l(b,FG))&&(OG.d(1),OG=BG(b),OG&&(OG.c(),OG.m(Hb,null))),FG[0]&32&&nZ!==(nZ=b[5]!==null)&&(Hb.disabled=nZ),FG[0]&32&&u!==(u=b[5]!==null)&&(ub.disabled=u)},i:SI,o:SI,d(MG){MG&&lI(I),II.d(),P&&P.d(),hI&&hI.d(),lG.d(),OG.d(),A=!1,uI(x)}}}function rv(b,I=[],G=0,l=null){let c=[];for(let Z of b){let W=[...I,Z.name];c.push({choice:Z,id:Z.id,path:W,depth:G,parentId:l}),Lv(Z)&&c.push(...rv(Z.choices??[],W,G+1,Z.id))}return c}function Lv(b){return b.type==="Multi"}function jL(b,I){let G=I.trim().toLowerCase();return G?b.filter(l=>`${l.path.join(" ")} ${l.choice.type}`.toLowerCase().includes(G)):b}function kv(b){let I=[];if(Lv(b)){let G=b.choices??[];for(let l of G)I.push(l.id,...kv(l))}return I}function KL(b,I){let G=[];for(let l of b)I.has(l.id)&&(!l.parentId||!I.has(l.parentId))&&G.push(l.id);return G}function DL(b){let{missingChoiceIds:I,missingAssets:G}=b;return I.length===0&&G.length===0?null:{missingChoices:I,missingAssets:G}}async function TL(b){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(b);return}let I=document.createElement("textarea");I.value=b,I.setAttribute("readonly","true"),I.style.position="fixed",I.style.opacity="0",document.body.appendChild(I),I.focus(),I.select();let G=document.execCommand("copy");if(document.body.removeChild(I),!G)throw new Error("Clipboard copy is not supported in this environment.")}function SL(b,I,G){let l,c,Z,W,{app:d}=I,{plugin:m}=I,{allChoices:N}=I,{close:Y}=I,a={"user-script":"User script","conditional-script":"Conditional script",template:"Template file","capture-template":"Capture template"},V="",h=new Set,n=new Set,X=[],p=Hv(),e=null,Q=null;function s(w,i){let o=[w.id,...kv(w)];if(i){let B=new Set(h);for(let j of o)B.add(j);if(G(2,h=B),n.size>0){let j=new Set(n);for(let _ of o)j.delete(_);G(18,n=j)}}else{let B=new Set(h);for(let _ of o)B.delete(_);G(2,h=B);let j=new Set(n);for(let _ of o)j.add(_);G(18,n=j)}}function R(w){let i=l.find(B=>B.id===w);if(!i)return;let o=h.has(w);s(i.choice,!o),G(4,e=null)}function J(){for(let w of c)s(w.choice,!0);G(4,e=null)}function E(){G(2,h=new Set),G(18,n=new Set),G(4,e=null)}function H(w,i,o){if(i.length===0)return{rootCount:0,totalChoices:0,dependencyCount:0,missingChoiceIds:[],userScripts:0,conditionalScripts:0,templateFiles:0,captureTemplates:0};let B=M2(w,i,{excludedChoiceIds:o}),j=j2(B.catalog,B.choiceIds),_=K2(B.catalog,B.choiceIds);return{rootCount:i.length,totalChoices:B.choiceIds.length,dependencyCount:Math.max(B.choiceIds.length-i.length,0),missingChoiceIds:B.missingChoiceIds,userScripts:j.userScriptPaths.size,conditionalScripts:j.conditionalScriptPaths.size,templateFiles:_.templatePaths.size,captureTemplates:_.captureTemplatePaths.size}}async function g(){if(X.length===0)return new Vc.Notice("Select at least one choice to export."),null;try{let w=await uv(d,{choices:N,rootChoiceIds:X,excludedChoiceIds:Array.from(n),quickAddVersion:m.manifest.version});return G(4,e=DL(w)),w}catch(w){return console.error(w),G(4,e=null),new Vc.Notice(`Export failed: ${w?.message??String(w)}`),null}}async function C(){if(!Q){G(5,Q="copy");try{let w=await g();if(!w)return;let i=JSON.stringify(w.pkg,null,2);await TL(i),new Vc.Notice(`Copied package (${w.pkg.choices.length} choice${w.pkg.choices.length===1?"":"s"}) to clipboard.`),e?new Vc.Notice("Package copied with warnings. Review details below."):Y()}catch(w){console.error(w),new Vc.Notice(`Copy failed: ${w?.message??String(w)}`)}finally{G(5,Q=null)}}}async function k(){if(Q)return;let w=p.trim();if(!w){new Vc.Notice("Enter a file path before saving.");return}G(5,Q="save");try{let i=await g();if(!i)return;await wv(d,i.pkg,w),new Vc.Notice(`Saved package (${i.pkg.choices.length} choice${i.pkg.choices.length===1?"":"s"}) to '${w}'.`),e?new Vc.Notice("Package saved with warnings. Review details below."):Y()}catch(i){console.error(i),new Vc.Notice(`Save failed: ${i?.message??String(i)}`)}finally{G(5,Q=null)}}function f(){V=this.value,G(1,V)}let L=w=>R(w.id),z=w=>W.get(w)??w;function r(){p=this.value,G(3,p)}return b.$$set=w=>{"app"in w&&G(15,d=w.app),"plugin"in w&&G(16,m=w.plugin),"allChoices"in w&&G(17,N=w.allChoices),"close"in w&&G(0,Y=w.close)},b.$$.update=()=>{b.$$.dirty[0]&131072&&G(20,l=rv(N)),b.$$.dirty[0]&1048578&&G(6,c=jL(l,V)),b.$$.dirty[0]&1048580&&G(19,X=KL(l,h)),b.$$.dirty[0]&917504&&G(8,Z=H(N,X,n)),b.$$.dirty[0]&1048576&&G(7,W=new Map(l.map(w=>[w.id,w.path.join(" / ")])))},[Y,V,h,p,e,Q,c,W,Z,a,R,J,E,C,k,d,m,N,n,X,l,f,L,z,r]}var UX=class extends oI{constructor(I){super(),zI(this,I,SL,ML,kI,{app:15,plugin:16,allChoices:17,close:0},LL,[-1,-1])}},zv=UX;var S2=class extends xv.Modal{constructor(G,l,c){super(G);this.plugin=l;this.choices=c;this.component=null}onOpen(){this.modalEl.addClass("quickAddModal","packageExportModal"),this.component=new zv({target:this.contentEl,props:{app:this.app,plugin:this.plugin,allChoices:this.choices,close:()=>this.close()}})}onClose(){this.component&&(this.component.$destroy(),this.component=null)}};var bE=require("obsidian");var QW=require("obsidian");var Uv=require("obsidian");function Bv(b){let I;try{I=JSON.parse(b)}catch(G){throw new Error(`Package content is not valid JSON: ${G?.message??G}`)}if(!nv(I))throw new Error("Content is not a valid QuickAdd package.");if(I.schemaVersion>1)throw new Error(`Package schema version ${I.schemaVersion} is newer than this plugin supports (${1}).`);return I}async function Ov(b,I,G){let l=new Map(Lb(I).map(W=>[W.id,W])),c=G.choices.map(W=>({choiceId:W.choice.id,name:W.choice.name,parentChoiceId:W.parentChoiceId,pathHint:W.pathHint??[],exists:l.has(W.choice.id)})),Z=[];for(let W of G.assets){let d=await b.vault.adapter.exists(W.originalPath);Z.push({originalPath:W.originalPath,exists:d,kind:W.kind})}return{choiceConflicts:c,assetConflicts:Z}}async function Mv(b){let{app:I,existingChoices:G,pkg:l}=b,c=new Map(b.choiceDecisions.map(H=>[H.choiceId,H.mode])),Z=new Map(b.assetDecisions.map(H=>[H.originalPath,H])),W=new Map(l.choices.map(H=>[H.choice.id,H])),d=new Set,m=new Map,N=new Set,Y=H=>{if(m.has(H))return m.get(H);if(N.has(H))return!0;if(N.add(H),c.get(H)==="skip")return m.set(H,!1),N.delete(H),!1;let C=W.get(H);if(!C)return m.set(H,!1),N.delete(H),!1;let k=C.parentChoiceId;if(!k||!W.has(k)||c.get(k)==="skip")return m.set(H,!0),N.delete(H),!0;let L=Y(k);return m.set(H,L),N.delete(H),L};for(let H of l.choices)Y(H.choice.id)&&d.add(H.choice.id);let a=new Set,V=new Map,h=H=>{if(!d.has(H))return!1;if(a.has(H))return!0;if(c.get(H)==="duplicate")return a.add(H),!0;let k=W.get(H)?.parentChoiceId??null;return k&&(c.get(k)==="duplicate"||d.has(k)&&h(k))?(a.add(H),!0):!1};for(let H of l.choices){if(!d.has(H.choice.id))continue;let C=h(H.choice.id)?tl():H.choice.id;V.set(H.choice.id,C)}let n=cG(G),X=[],p=[],e=[],Q=new Map;for(let H of l.choices){if(!d.has(H.choice.id)){e.push(H.choice.id);continue}let g=cG(H.choice),C=MX(g,V,d);Q.set(H.choice.id,C)}let s=new Set;for(let H of l.choices){let g=H.choice.id;if(!d.has(g)||s.has(g))continue;let C=Q.get(g);if(!C)continue;let k=C.id,f=c.get(g)??"import",L=H.parentChoiceId;if(L&&d.has(L)?Q.get(L):null){s.add(g);continue}if((f==="overwrite"||f==="import")&&jv(n,C)){p.push(k),s.add(g);continue}if(L){let w=V.get(L)??L;if(Kv(n,w,C)){X.push(k),s.add(g);continue}let o=qL(n,H.pathHint.slice(0,-1));if(o){Dv(o,C),X.push(k),s.add(g);continue}M.logWarning(`QuickAdd import: could not locate parent for '${H.choice.name}'. Adding to root.`)}let r=n.findIndex(w=>w.id===k);r!==-1?(n.splice(r,1,C),p.push(k)):(n.push(C),X.push(k)),s.add(g)}let R=new Map,J=[],E=[];for(let H of l.assets){let g=Z.get(H.originalPath),C=g?.destinationPath?.trim(),k=C?(0,Uv.normalizePath)(C):H.originalPath,f=await fL(I,k);if((g?.mode??(f?"overwrite":"write"))==="skip"){E.push(k);continue}await PL(I,k);let z=ev(H.content);await I.vault.adapter.write(k,z),J.push(k),R.set(H.originalPath,k)}for(let H of Q.values())jX(H,R);return{updatedChoices:n,addedChoiceIds:X,overwrittenChoiceIds:p,skippedChoiceIds:e,writtenAssets:J,skippedAssets:E}}async function fL(b,I){try{return await b.vault.adapter.exists(I)}catch{return!1}}function MX(b,I,G){let l=b.id,c=I.get(l)??l;b.id=c;let Z=c!==l;if(b.type==="Macro"){let W=b;Z&&(W.macro.id=tl()),BX(W.macro.commands,I,G,Z)}if(b.type==="Multi"){let W=b;Array.isArray(W.choices)&&(W.choices=W.choices.filter(d=>G.has(d.id)).map(d=>MX(d,I,G)))}return b}function BX(b,I,G,l){for(let c of b)if(c)switch(l&&(c.id=tl()),c.type){case"Choice":{let Z=c,W=I.get(Z.choiceId);W&&(Z.choiceId=W);break}case"Conditional":{let Z=c;BX(Z.thenCommands,I,G,l),BX(Z.elseCommands,I,G,l);break}case"NestedChoice":{let Z=c;Z.choice&&G.has(Z.choice.id)&&(Z.choice=MX(Z.choice,I,G));break}default:break}}function jv(b,I){for(let G=0;GSelect a package file, review conflicts, and choose how to import each item.
',l=K(),c=v("section"),Z=v("label"),W=v("span"),W.textContent="Paste package JSON",d=K(),m=v("textarea"),N=K(),E&&E.c(),Y=K(),H&&H.c(),a=K(),V=v("section"),h=v("button"),n=NI("Cancel"),X=K(),p=v("button"),k.c(),t(G,"class","svelte-x9dt2q"),t(W,"class","svelte-x9dt2q"),t(m,"placeholder","Paste the contents of a .quickadd.json package here"),t(m,"rows","8"),t(m,"class","svelte-x9dt2q"),t(Z,"class","svelte-x9dt2q"),t(c,"class","pasteSection svelte-x9dt2q"),t(h,"type","button"),t(h,"class","secondary svelte-x9dt2q"),h.disabled=b[4],t(p,"type","button"),t(p,"class","primary svelte-x9dt2q"),p.disabled=e=b[4]||!b[1]||!b[2],t(V,"class","footer svelte-x9dt2q"),t(I,"class","importPackageModal svelte-x9dt2q")},m(f,L){cI(f,I,L),F(I,G),F(I,l),F(I,c),F(c,Z),F(Z,W),F(Z,d),F(Z,m),DI(m,b[8]),F(c,N),E&&E.m(c,null),F(I,Y),H&&H.m(I,null),F(I,a),F(I,V),F(V,h),F(h,n),F(V,X),F(V,p),k.m(p,null),Q||(s=[S(m,"input",b[19]),S(m,"input",b[16]),S(h,"click",function(){gI(b[0])&&b[0].apply(this,arguments)}),S(p,"click",function(){gI(b[10]?b[0]:b[17])&&(b[10]?b[0]:b[17]).apply(this,arguments)})],Q=!0)},p(f,L){b=f,L[0]&256&&DI(m,b[8]),J===(J=R(b,L))&&E?E.p(b,L):(E&&E.d(1),E=J&&J(b),E&&(E.c(),E.m(c,null))),b[1]&&b[2]?H?H.p(b,L):(H=fv(b),H.c(),H.m(I,a)):H&&(H.d(1),H=null),L[0]&16&&(h.disabled=b[4]),C!==(C=g(b,L))&&(k.d(1),k=C(b),k&&(k.c(),k.m(p,null))),L[0]&22&&e!==(e=b[4]||!b[1]||!b[2])&&(p.disabled=e)},i:SI,o:SI,d(f){f&&lI(I),E&&E.d(),H&&H.d(),k.d(),Q=!1,uI(s)}}}function N3(b,I){let G=I.destinationExists;return I.mode==="skip"?{className:"assetBadge--info",label:"Skipped"}:I.mode==="overwrite"?{className:G?"assetBadge--warning":"assetBadge--info",label:G?"Will overwrite":"Overwrite"}:{className:G?"assetBadge--warning":"assetBadge--info",label:G?"Will overwrite":"New file"}}function GE(b){return!b||b.length===0?"Root":b.slice(0,-1).join(" \u203A ")||"Root"}function Y3(b,I,G){let{app:l}=I,{close:c}=I,Z=null,W=null,d=null,m=!1,N=null,Y=new Map,a=new Map,V="",h=!1,n=0,X=!1;function p(i){let o=dI.getState().templateFolderPath?.trim(),B=i.kind==="template"||i.kind==="capture-template";if(o&&B){let j=i.originalPath.split("/").pop()??i.originalPath,_=o.replace(/\/+$/,"");return _?`${_}/${j}`:j}return i.originalPath}function e(i){let o=i.trim();if(!o)return!1;let B=(0,QW.normalizePath)(o);return!!l.vault.getAbstractFileByPath(B)}function Q(){if(G(6,Y=new Map),G(7,a=new Map),!!W){for(let i of W.choiceConflicts){let o=i.exists?"overwrite":"import";Y.set(i.choiceId,o)}for(let i of W.assetConflicts){let o=p(i),B=i.exists||e(o),j=B?"overwrite":"write";a.set(i.originalPath,{mode:j,destinationPath:o,destinationExists:B})}}}function s(i,o){let B=new Map(Y);B.set(i,o),G(6,Y=B)}function R(i,o){let j={...a.get(i)??{mode:o,destinationPath:i,destinationExists:e(i)},mode:o},_=new Map(a);_.set(i,j),G(7,a=_)}function J(i,o){let B=a.get(i.originalPath)??{mode:"write",destinationPath:i.originalPath,destinationExists:e(i.originalPath)},j=o.trim(),_=j||i.originalPath,YI=j||o,aI=e(_),QI=B.mode;B.mode!=="skip"&&(aI&&B.mode==="write"?QI="overwrite":!aI&&B.mode==="overwrite"&&(QI="write"));let vI={...B,mode:QI,destinationPath:YI,destinationExists:aI},tI=new Map(a);tI.set(i.originalPath,vI),G(7,a=tI)}function E(i,o){let j=o.currentTarget.value;s(i,j)}function H(i,o){let j=o.currentTarget.value;R(i,j)}function g(i,o){let B=o.currentTarget.value;J(i,B)}async function C(i){let o=i.trim(),B=++n;if(G(5,N=null),G(10,X=!1),!o){G(1,Z=null),G(2,W=null),G(6,Y=new Map),G(7,a=new Map),G(3,d=null);return}G(9,h=!0);try{let j=Bv(o),_=await Ov(l,dI.getState().choices,j);if(B!==n)return;G(1,Z={pkg:j,path:"[pasted]"}),G(2,W=_),G(3,d=null),Q()}catch(j){if(B!==n)return;G(3,d=j?.message??String(j)),G(1,Z=null),G(2,W=null),G(6,Y=new Map),G(7,a=new Map)}finally{B===n&&G(9,h=!1)}}function k(i){let o=i.currentTarget.value;G(8,V=o),C(o)}async function f(){if(X){new QW.Notice("This package has already been imported.");return}if(!Z||!W){new QW.Notice("Load a package before importing.");return}G(4,m=!0),G(5,N=null);try{let i=W.choiceConflicts.map(j=>{let _=Y.get(j.choiceId)??"import",YI=j.exists||_!=="overwrite"?_:"import";return{choiceId:j.choiceId,mode:YI}}),o=W.assetConflicts.map(j=>{let _=a.get(j.originalPath),YI=_?.destinationPath?.trim()||j.originalPath,aI=_?.destinationExists??(j.exists?!0:e(YI)),QI=_?.mode??(aI?"overwrite":"write");return{originalPath:j.originalPath,destinationPath:YI,mode:QI}}),B=await Mv({app:l,existingChoices:dI.getState().choices,pkg:Z.pkg,choiceDecisions:i,assetDecisions:o});dI.setState(j=>({...j,choices:B.updatedChoices})),G(5,N={added:B.addedChoiceIds.length,overwritten:B.overwrittenChoiceIds.length,skipped:B.skippedChoiceIds.length,assetsWritten:B.writtenAssets.length,assetsSkipped:B.skippedAssets.length}),G(10,X=!0),new QW.Notice(`Imported ${B.addedChoiceIds.length+B.overwrittenChoiceIds.length} choice${B.addedChoiceIds.length+B.overwrittenChoiceIds.length===1?"":"s"} successfully.`)}catch(i){console.error(i),new QW.Notice(`Import failed: ${i?.message??i}`)}finally{G(4,m=!1)}}function L(){V=this.value,G(8,V)}let z=(i,o)=>E(i.choiceId,o),r=(i,o)=>g(i,o),w=(i,o)=>H(i.originalPath,o);return b.$$set=i=>{"app"in i&&G(18,l=i.app),"close"in i&&G(0,c=i.close)},[c,Z,W,d,m,N,Y,a,V,h,X,p,e,E,H,g,k,f,l,L,z,r,w]}var KX=class extends oI{constructor(I){super(),zI(this,I,Y3,m3,kI,{app:18,close:0},_L,[-1,-1])}},lE=KX;var f2=class extends bE.Modal{constructor(G){super(G);this.component=null}onOpen(){this.modalEl.addClass("quickAddModal","packageImportModal"),this.component=new lE({target:this.contentEl,props:{app:this.app,close:()=>this.close()}})}onClose(){this.component?.$destroy(),this.component=null}};var ja={choices:[],inputPrompt:"single-line",devMode:!1,templateFolderPath:"",announceUpdates:"all",version:"0.0.0",globalVariables:{},onePageInputEnabled:!1,disableOnlineFeatures:!0,enableRibbonIcon:!1,showCaptureNotification:!0,showInputCancellationNotification:!1,enableTemplatePropertyTypes:!1,ai:{defaultModel:"Ask me",defaultSystemPrompt:'As an AI assistant within Obsidian, your primary goal is to help users manage their ideas and knowledge more effectively. Format your responses using Markdown syntax. Please use the [[Obsidian]] link format. You can write aliases for the links by writing [[Obsidian|the alias after the pipe symbol]]. To use mathematical notation, use LaTeX syntax. LaTeX syntax for larger equations should be on separate lines, surrounded with double dollar signs ($$). You can also inline math expressions by wrapping it in $ symbols. For example, use $$w_{ij}^{ ext{new}}:=w_{ij}^{ ext{current}}+etacdotdelta_jcdot x_{ij}$$ on a separate line, but you can write "($eta$ = learning rate, $delta_j$ = error term, $x_{ij}$ = input)" inline.',promptTemplatesFolderPath:"",showAssistant:!0,providers:B2},migrations:{migrateToMacroIDFromEmbeddedMacro:!0,useQuickAddTemplateFolder:!1,incrementFileNameSettingMoveToDefaultBehavior:!1,mutualExclusionInsertAfterAndWriteToBottomOfFile:!1,setVersionAfterUpdateModalRelease:!1,addDefaultAIProviders:!1,removeMacroIndirection:!1,migrateFileOpeningSettings:!1,setProviderModelDiscoveryMode:!1}},q2=class extends Zl.PluginSettingTab{constructor(I,G){super(I,G),this.plugin=G}display(){let{containerEl:I}=this;I.empty(),I.createEl("h2",{text:"QuickAdd Settings"}),this.addChoicesSetting(),this.addPackagesSetting(),this.addUseMultiLineInputPromptSetting(),this.addTemplateFolderPathSetting(),this.addAnnounceUpdatesSetting(),this.addShowCaptureNotificationSetting(),this.addShowInputCancellationNotificationSetting(),this.addTemplatePropertyTypesSetting(),this.addGlobalVariablesSetting(),this.addOnePageInputSetting(),this.addDisableOnlineFeaturesSetting(),this.addEnableRibbonIconSetting(),this.addDevelopmentInfoSetting()}addDevelopmentInfoSetting(){}addGlobalVariablesSetting(){let I=new Zl.Setting(this.containerEl);I.infoEl.remove(),I.settingEl.style.display="block",new av({target:I.settingEl,props:{app:this.app,plugin:this.plugin}})}addAnnounceUpdatesSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Announce Updates"),I.setDesc("Display release notes when a new version is installed. This includes new features, demo videos, and bug fixes."),I.addDropdown(G=>{let l=dI.getState().announceUpdates;G.addOption("all","Show updates on each new release").addOption("major","Show updates only on major releases (new features, breaking changes)").addOption("none","Don't show").setValue(l).onChange(c=>{dI.setState({announceUpdates:c})})})}addShowCaptureNotificationSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Show Capture Notifications"),I.setDesc("Display a notification when content is captured successfully to confirm the operation completed."),I.addToggle(G=>{G.setValue(dI.getState().showCaptureNotification),G.onChange(l=>{dI.setState({showCaptureNotification:l})})})}addShowInputCancellationNotificationSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Show Input Cancellation Notifications"),I.setDesc("Display a notification when an input prompt is cancelled without submitting. Disable this to avoid extra notices when dismissing prompts."),I.addToggle(G=>{G.setValue(dI.getState().showInputCancellationNotification),G.onChange(l=>{dI.setState({showInputCancellationNotification:l})})})}addTemplatePropertyTypesSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Format template variables as proper property types (Beta)"),I.setDesc("When enabled, template variables in front matter will be formatted as proper Obsidian property types. Arrays become List properties, numbers become Number properties, booleans become Checkbox properties, etc. This is a beta feature that may have edge cases."),I.addToggle(G=>{G.setValue(dI.getState().enableTemplatePropertyTypes),G.onChange(l=>{dI.setState({enableTemplatePropertyTypes:l})})})}hide(){this.choiceView&&this.choiceView.$destroy()}addChoicesSetting(){let I=new Zl.Setting(this.containerEl);I.infoEl.remove(),I.settingEl.style.display="block",this.choiceView=new mv({target:I.settingEl,props:{app:this.app,plugin:this.plugin,choices:dI.getState().choices,saveChoices:G=>{dI.setState({choices:G})}}})}addPackagesSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Packages"),I.setDesc("Bundle or import QuickAdd automations as reusable packages."),I.addButton(G=>G.setButtonText("Export package\u2026").setCta().onClick(()=>{let l=dI.getState().choices;new S2(this.app,this.plugin,l).open()})),I.addButton(G=>G.setButtonText("Import package\u2026").onClick(()=>{new f2(this.app).open()}))}addUseMultiLineInputPromptSetting(){new Zl.Setting(this.containerEl).setName("Use Multi-line Input Prompt").setDesc("Use multi-line input prompt instead of single-line input prompt").addToggle(I=>I.setValue(this.plugin.settings.inputPrompt==="multi-line").setTooltip("Use multi-line input prompt").onChange(G=>{G?dI.setState({inputPrompt:"multi-line"}):dI.setState({inputPrompt:"single-line"})}))}addTemplateFolderPathSetting(){let I=new Zl.Setting(this.containerEl);I.setName("Template Folder Path"),I.setDesc("Path to the folder where templates are stored. Used to suggest template files when configuring QuickAdd."),I.addText(G=>{G.setPlaceholder("templates/").setValue(dI.getState().templateFolderPath).onChange(l=>{dI.setState({templateFolderPath:l})}),new Xl(this.app,G.inputEl,this.app.vault.getAllLoadedFiles().filter(l=>l instanceof Zl.TFolder&&l.path!=="/").map(l=>l.path))})}addOnePageInputSetting(){new Zl.Setting(this.containerEl).setName("One-page input for choices (Beta)").setDesc("Experimental. Resolve variables up front and show a single dynamic form before executing Template/Capture choices. See Advanced \u2192 One-page Inputs in docs.").addToggle(I=>I.setValue(dI.getState().onePageInputEnabled).onChange(G=>{dI.setState({onePageInputEnabled:G})}))}addDisableOnlineFeaturesSetting(){new Zl.Setting(this.containerEl).setName("Disable AI & Online features").setDesc("This prevents the plugin from making requests to external providers like OpenAI. You can still use User Scripts to execute arbitrary code, including contacting external providers. However, this setting disables plugin features like the AI Assistant from doing so. You need to disable this setting to use the AI Assistant.").addToggle(I=>I.setValue(dI.getState().disableOnlineFeatures).onChange(G=>{dI.setState({disableOnlineFeatures:G}),this.display()}))}addEnableRibbonIconSetting(){new Zl.Setting(this.containerEl).setName("Show icon in sidebar").setDesc("Add QuickAdd icon to the sidebar ribbon. Requires a reload.").addToggle(I=>{I.setValue(dI.getState().enableRibbonIcon).onChange(G=>{dI.setState({enableRibbonIcon:G}),this.display()})})}};var hm=class{formatOutputString(I){return`QuickAdd: (${I.level}) ${I.message}`}getQuickAddError(I,G,l,c){return{message:I,level:G,time:Date.now(),stack:l,originalError:c}}};var Ja=class extends hm{constructor(){super(...arguments);this.ErrorLog=[]}logError(G,l,c){let Z=this.getQuickAddError(G,"ERROR",l,c);this.addMessageToErrorLog(Z);let W=c||new Error(G);console.error(this.formatOutputString(Z),W)}logWarning(G,l,c){let Z=this.getQuickAddError(G,"WARNING",l,c);this.addMessageToErrorLog(Z);let W=c||new Error(G);console.warn(this.formatOutputString(Z),W)}logMessage(G,l,c){let Z=this.getQuickAddError(G,"LOG",l,c);this.addMessageToErrorLog(Z),c?console.log(this.formatOutputString(Z),c):console.log(this.formatOutputString(Z))}addMessageToErrorLog(G){this.ErrorLog.push(G),this.ErrorLog.length>eF&&(this.ErrorLog=this.ErrorLog.slice(-eF))}clearErrorLog(){this.ErrorLog=[]}};var DX=require("obsidian");var P2=class extends hm{constructor(G){super();this.plugin=G}logError(G,l,c){let Z=this.getQuickAddError(G,"ERROR",l,c);new DX.Notice(this.formatOutputString(Z),15e3)}logWarning(G,l,c){let Z=this.getQuickAddError(G,"WARNING",l,c);new DX.Notice(this.formatOutputString(Z))}logMessage(G,l,c){}};var _2=class{constructor(I,G,l,c){this.app=I;this.plugin=G;this.choices=l;this.choiceExecutor=c}async run(){let I=Lb(this.choices).filter(G=>G.type==="Macro"&&G.runOnStartup);for(let G of I)await new cc(this.app,this.plugin,G,this.choiceExecutor,new Map).run()}};var cE=require("obsidian");var $2=class extends qd{constructor(I,G,l,c){super(I,G,c),this.choiceExecutor=c,this.choice=l}async run(){try{Dl(this.choice.templatePath,()=>`Invalid template path for ${this.choice.name}. ${this.choice.templatePath.length===0?"Template path is empty.":`Template path is not valid: ${this.choice.templatePath}`}`);let I=qc(this.choice.appendLink);this.setLinkToCurrentFileBehavior(I.enabled&&!I.requireActiveFile?"optional":"required");let G="";if(this.choice.folder.enabled)G=await this.getFolderPath();else{let m=this.app.fileManager.getNewFileParent(this.app.workspace.getActiveFile()?.path??"");G=m===this.app.vault.getRoot()?"":m.path}let l=this.choice.fileNameFormat.enabled?this.choice.fileNameFormat.format:QZ,c=await this.formatter.formatFileName(l,this.choice.name),Z=this.normalizeTemplateFilePath(G,c,this.choice.templatePath);this.choice.fileExistsMode===sZ&&(Z=await this.incrementFileName(Z));let W,d=!1;if(await this.app.vault.adapter.exists(Z)){let m=this.app.vault.getAbstractFileByPath(Z);if(!(m instanceof cE.TFile)||m.extension!=="md"&&m.extension!=="canvas"){M.logError(`'${Z}' already exists and is not a valid markdown or canvas file.`);return}let N=this.choice.fileExistsMode;if(!this.choice.setFileExistsBehavior)try{N=await Fl.Suggest(this.app,[...yn],[...yn])}catch(Y){throw XG(Y)?new qI("Input cancelled by user"):Y}switch(N){case zW:W=await this.appendToFileWithTemplate(m,this.choice.templatePath,"top");break;case kW:W=await this.appendToFileWithTemplate(m,this.choice.templatePath,"bottom");break;case xW:W=await this.overwriteFileWithTemplate(m,this.choice.templatePath);break;case wZ:W=m,d=!0,M.logMessage(`Opening existing file: ${m.path}`);break;case sZ:{let Y=await this.incrementFileName(Z);W=await this.createFileWithTemplate(Y,this.choice.templatePath);break}default:M.logWarning("File not written to.");return}}else if(W=await this.createFileWithTemplate(Z,this.choice.templatePath),!W){M.logWarning(`Could not create file '${Z}'.`);return}if(I.enabled&&W&&rV(this.app,W,I),(this.choice.openFile||d)&&W){let m=this.choice.fileOpening.focus??!0;LV(this.app,W,m)||await ad(this.app,W,this.choice.fileOpening),await AV(this.app,W)}}catch(I){if(WZ(I,{logPrefix:"Template execution aborted",noticePrefix:"Template execution aborted",defaultReason:"Template execution aborted"})){this.choiceExecutor.signalAbort?.(I);return}IG(I,`Error running template choice "${this.choice.name}"`)}}async formatFolderPaths(I){return await Promise.all(I.map(async l=>await this.formatter.formatFolderPath(l)))}async getFolderPath(){let I=await this.formatFolderPaths([...this.choice.folder.folders]);if(this.choice.folder?.chooseFromSubfolders&&!(this.choice.folder?.chooseWhenCreatingNote||this.choice.folder?.createInSameFolderAsActiveFile)){let l=rY(this.app).filter(c=>I.some(Z=>c.startsWith(Z)));return await this.getOrCreateFolder(l)}if(this.choice.folder?.chooseWhenCreatingNote){let G=rY(this.app);return await this.getOrCreateFolder(G)}if(this.choice.folder?.createInSameFolderAsActiveFile){let G=this.app.workspace.getActiveFile();return!G||!G.parent?(M.logWarning("No active file or active file has no parent. Cannot create file in same folder as active file. Creating in root folder."),""):this.getOrCreateFolder([G.parent.path])}return await this.getOrCreateFolder(I)}};var $X=require("obsidian");var In=class{isResolved(){return!this.hasConflicts}isConflicted(){return this.hasConflicts}},ya=class b extends In{constructor(I,G,l){super(),this.left=I,this.base=G,this.right=l,this.hasConflicts=!0}static create(I){return new b(I.left,I.base,I.right)}apply(I){return b.create({left:I(this.left),base:I(this.base),right:I(this.right)})}},pb=class b extends In{constructor(I){super(),this.hasConflicts=!1,this.result=I}combine(I){this.result=this.result.concat(I.result)}apply(I){return new b(I(this.result))}};var ic=class b{constructor(I,G){this.left=I,this.right=G}static executeDiff(I,G){if(!I.push)throw new Error("Argument is not an array");let l=b.diff(I,G);return new SX(I,G,l).convertToTypedOutput()}static diff(I,G){return new b(I,G).performDiff()}performDiff(){let I=this.identifyUniquePositions();I.sort((Z,W)=>W[0]-Z[0]);let[G,l]=this.findNextChange(),c=new Gn(G,l,[]);return I.forEach(Z=>{c=this.getDifferences(c,Z)}),c.changeRanges}getDifferences(I,G){let[l,c]=[I.leftChangePos,I.rightChangePos],[Z,W]=G;if(ZSelect choices to bundle. Dependencies are added automatically.
',G=M(),c=F("section"),t=F("input"),d=M(),Z=F("div"),m=F("button"),m.textContent="Select visible",a=M(),n=F("button"),n.textContent="Clear selection",W=M(),N=F("section"),lI.c(),Y=M(),u=F("section"),C=F("h3"),C.textContent="Package summary",p=M(),o=F("div"),R=F("div"),s=F("strong"),r=mI(Q),V=M(),w=F("span"),w.textContent="Selected choices",H=M(),O=F("div"),f=F("strong"),A=mI(k),E=M(),L=F("span"),L.textContent="Total packaged",y=M(),v=F("div"),x=F("strong"),$=mI(D),aI=M(),nI=F("span"),nI.textContent="Auto-included",VI=M(),rI=F("div"),CI=F("strong"),LI=mI(WI),$I=M(),sl=F("span"),sl.textContent="Scripts embedded",wl=M(),Cl=F("div"),Qe=F("strong"),BG=mI(zG),nG=M(),WG=F("span"),WG.textContent="Templates embedded",S=M(),_&&_.c(),EI=M(),NI&&NI.c(),KI=M(),MI=F("section"),Ie=F("div"),NG=F("button"),cl.c(),Uc=M(),ic=F("div"),le=F("label"),xc=F("span"),xc.textContent="Save to file",ot=M(),zc=F("div"),Re=F("input"),$n=M(),re=F("button"),Bl.c(),HZ=M(),Qt=F("section"),Le=F("button"),IW=mI("Cancel"),h(l,"class","svelte-iqd8ho"),h(t,"type","text"),h(t,"placeholder","Filter choices"),h(t,"autocapitalize","off"),h(t,"autocorrect","off"),h(t,"spellcheck",b=!1),h(t,"class","svelte-iqd8ho"),h(m,"type","button"),h(m,"class","svelte-iqd8ho"),h(n,"type","button"),h(n,"class","svelte-iqd8ho"),h(Z,"class","controlButtons svelte-iqd8ho"),h(c,"class","controls svelte-iqd8ho"),h(N,"class","choiceList svelte-iqd8ho"),h(C,"class","svelte-iqd8ho"),h(s,"class","svelte-iqd8ho"),h(R,"class","svelte-iqd8ho"),h(f,"class","svelte-iqd8ho"),h(O,"class","svelte-iqd8ho"),h(x,"class","svelte-iqd8ho"),h(v,"class","svelte-iqd8ho"),h(CI,"class","svelte-iqd8ho"),h(rI,"class","svelte-iqd8ho"),h(Qe,"class","svelte-iqd8ho"),h(Cl,"class","svelte-iqd8ho"),h(o,"class","summaryGrid svelte-iqd8ho"),h(u,"class","summary svelte-iqd8ho"),h(NG,"type","button"),h(NG,"class","secondary svelte-iqd8ho"),NG.disabled=DG=e[5]!==null,h(Ie,"class","actionGroup svelte-iqd8ho"),h(Re,"type","text"),h(Re,"placeholder","QuickAdd Packages/quickadd-package-YYYY-MM-DD.quickadd.json"),h(Re,"class","svelte-iqd8ho"),h(re,"type","button"),re.disabled=Xt=e[5]!==null,h(re,"class","svelte-iqd8ho"),h(zc,"class","saveRow svelte-iqd8ho"),h(ic,"class","actionGroup svelte-iqd8ho"),h(MI,"class","actions svelte-iqd8ho"),h(Le,"type","button"),h(Le,"class","secondary svelte-iqd8ho"),Le.disabled=X=e[5]!==null,h(Qt,"class","footer svelte-iqd8ho"),h(I,"class","exportPackageModal svelte-iqd8ho")},m(Dl,ul){tI(Dl,I,ul),i(I,l),i(I,G),i(I,c),i(c,t),jI(t,e[1]),i(c,d),i(c,Z),i(Z,m),i(Z,a),i(Z,n),i(I,W),i(I,N),lI.m(N,null),i(I,Y),i(I,u),i(u,C),i(u,p),i(u,o),i(o,R),i(R,s),i(s,r),i(R,V),i(R,w),i(o,H),i(o,O),i(O,f),i(f,A),i(O,E),i(O,L),i(o,y),i(o,v),i(v,x),i(x,$),i(v,aI),i(v,nI),i(o,VI),i(o,rI),i(rI,CI),i(CI,LI),i(rI,$I),i(rI,sl),i(o,wl),i(o,Cl),i(Cl,Qe),i(Qe,BG),i(Cl,nG),i(Cl,WG),i(u,S),_&&_.m(u,null),i(I,EI),NI&&NI.m(I,null),i(I,KI),i(I,MI),i(MI,Ie),i(Ie,NG),cl.m(NG,null),i(MI,Uc),i(MI,ic),i(ic,le),i(le,xc),i(le,ot),i(le,zc),i(zc,Re),jI(Re,e[3]),i(zc,$n),i(zc,re),Bl.m(re,null),i(I,HZ),i(I,Qt),i(Qt,Le),i(Le,IW),J||(U=[T(t,"input",e[21]),T(m,"click",e[11]),T(n,"click",e[12]),T(NG,"click",e[13]),T(Re,"input",e[24]),T(re,"click",e[14]),T(Le,"click",function(){yI(e[0])&&e[0].apply(this,arguments)})],J=!0)},p(Dl,ul){e=Dl,ul[0]&2&&t.value!==e[1]&&jI(t,e[1]),II===(II=j(e,ul))&&lI?lI.p(e,ul):(lI.d(1),lI=II(e),lI&&(lI.c(),lI.m(N,null))),ul[0]&256&&Q!==(Q=e[8].rootCount+"")&&QI(r,Q),ul[0]&256&&k!==(k=e[8].totalChoices+"")&&QI(A,k),ul[0]&256&&D!==(D=e[8].dependencyCount+"")&&QI($,D),ul[0]&256&&WI!==(WI=e[8].userScripts+e[8].conditionalScripts+"")&&QI(LI,WI),ul[0]&256&&zG!==(zG=e[8].templateFiles+e[8].captureTemplates+"")&&QI(BG,zG),e[8].missingChoiceIds.length>0?_?_.p(e,ul):(_=rL(e),_.c(),_.m(u,null)):_&&(_.d(1),_=null),e[4]?NI?NI.p(e,ul):(NI=LL(e),NI.c(),NI.m(I,KI)):NI&&(NI.d(1),NI=null),gl!==(gl=Il(e,ul))&&(cl.d(1),cl=gl(e),cl&&(cl.c(),cl.m(NG,null))),ul[0]&32&&DG!==(DG=e[5]!==null)&&(NG.disabled=DG),ul[0]&8&&Re.value!==e[3]&&jI(Re,e[3]),zl!==(zl=Ge(e,ul))&&(Bl.d(1),Bl=zl(e),Bl&&(Bl.c(),Bl.m(re,null))),ul[0]&32&&Xt!==(Xt=e[5]!==null)&&(re.disabled=Xt),ul[0]&32&&X!==(X=e[5]!==null)&&(Le.disabled=X)},i:TI,o:TI,d(Dl){Dl&&eI(I),lI.d(),_&&_.d(),NI&&NI.d(),cl.d(),Bl.d(),J=!1,XI(U)}}}function HL(e,I=[],l=0,G=null){let c=[];for(let t of e){let b=[...I,t.name];c.push({choice:t,id:t.id,path:b,depth:l,parentId:G}),vL(t)&&c.push(...HL(t.choices??[],b,l+1,t.id))}return c}function vL(e){return e.type==="Multi"}function Sk(e,I){let l=I.trim().toLowerCase();return l?e.filter(G=>`${G.path.join(" ")} ${G.choice.type}`.toLowerCase().includes(l)):e}function yL(e){let I=[];if(vL(e)){let l=e.choices??[];for(let G of l)I.push(G.id,...yL(G))}return I}function Tk(e,I){let l=[];for(let G of e)I.has(G.id)&&(!G.parentId||!I.has(G.parentId))&&l.push(G.id);return l}function qk(e){let{missingChoiceIds:I,missingAssets:l}=e;return I.length===0&&l.length===0?null:{missingChoices:I,missingAssets:l}}async function Pk(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}let I=document.createElement("textarea");I.value=e,I.setAttribute("readonly","true"),I.style.position="fixed",I.style.opacity="0",document.body.appendChild(I),I.focus(),I.select();let l=document.execCommand("copy");if(document.body.removeChild(I),!l)throw new Error("Clipboard copy is not supported in this environment.")}function _k(e,I,l){let G,c,t,b,{app:d}=I,{plugin:Z}=I,{allChoices:m}=I,{close:a}=I,n={"user-script":"User script","conditional-script":"Conditional script",template:"Template file","capture-template":"Capture template"},W="",N=new Set,Y=new Set,u=[],C=iL(),p=null,o=null;function R(L,y){let v=[L.id,...yL(L)];if(y){let x=new Set(N);for(let D of v)x.add(D);if(l(2,N=x),Y.size>0){let D=new Set(Y);for(let $ of v)D.delete($);l(18,Y=D)}}else{let x=new Set(N);for(let $ of v)x.delete($);l(2,N=x);let D=new Set(Y);for(let $ of v)D.add($);l(18,Y=D)}}function s(L){let y=G.find(x=>x.id===L);if(!y)return;let v=N.has(L);R(y.choice,!v),l(4,p=null)}function Q(){for(let L of c)R(L.choice,!0);l(4,p=null)}function r(){l(2,N=new Set),l(18,Y=new Set),l(4,p=null)}function V(L,y,v){if(y.length===0)return{rootCount:0,totalChoices:0,dependencyCount:0,missingChoiceIds:[],userScripts:0,conditionalScripts:0,templateFiles:0,captureTemplates:0};let x=Ws(L,y,{excludedChoiceIds:v}),D=Ns(x.catalog,x.choiceIds),$=Ys(x.catalog,x.choiceIds);return{rootCount:y.length,totalChoices:x.choiceIds.length,dependencyCount:Math.max(x.choiceIds.length-y.length,0),missingChoiceIds:x.missingChoiceIds,userScripts:D.userScriptPaths.size,conditionalScripts:D.conditionalScriptPaths.size,templateFiles:$.templatePaths.size,captureTemplates:$.captureTemplatePaths.size}}async function w(){if(u.length===0)return new uc.Notice("Select at least one choice to export."),null;try{let L=await hL(d,{choices:m,rootChoiceIds:u,excludedChoiceIds:Array.from(Y),quickAddVersion:Z.manifest.version});return l(4,p=qk(L)),L}catch(L){return console.error(L),l(4,p=null),new uc.Notice(`Export failed: ${L?.message??String(L)}`),null}}async function H(){if(!o){l(5,o="copy");try{let L=await w();if(!L)return;let y=JSON.stringify(L.pkg,null,2);await Pk(y),new uc.Notice(`Copied package (${L.pkg.choices.length} choice${L.pkg.choices.length===1?"":"s"}) to clipboard.`),p?new uc.Notice("Package copied with warnings. Review details below."):a()}catch(L){console.error(L),new uc.Notice(`Copy failed: ${L?.message??String(L)}`)}finally{l(5,o=null)}}}async function O(){if(o)return;let L=C.trim();if(!L){new uc.Notice("Enter a file path before saving.");return}l(5,o="save");try{let y=await w();if(!y)return;await VL(d,y.pkg,L),new uc.Notice(`Saved package (${y.pkg.choices.length} choice${y.pkg.choices.length===1?"":"s"}) to '${L}'.`),p?new uc.Notice("Package saved with warnings. Review details below."):a()}catch(y){console.error(y),new uc.Notice(`Save failed: ${y?.message??String(y)}`)}finally{l(5,o=null)}}function f(){W=this.value,l(1,W)}let k=L=>s(L.id),A=L=>b.get(L)??L;function E(){C=this.value,l(3,C)}return e.$$set=L=>{"app"in L&&l(15,d=L.app),"plugin"in L&&l(16,Z=L.plugin),"allChoices"in L&&l(17,m=L.allChoices),"close"in L&&l(0,a=L.close)},e.$$.update=()=>{e.$$.dirty[0]&131072&&l(20,G=HL(m)),e.$$.dirty[0]&1048578&&l(6,c=Sk(G,W)),e.$$.dirty[0]&1048580&&l(19,u=Tk(G,N)),e.$$.dirty[0]&917504&&l(8,t=V(m,u,Y)),e.$$.dirty[0]&1048576&&l(7,b=new Map(G.map(L=>[L.id,L.path.join(" / ")])))},[a,W,N,C,p,o,c,b,t,n,s,Q,r,H,O,d,Z,m,Y,u,G,f,k,A,E]}var s0=class extends gI{constructor(I){super(),OI(this,I,_k,fk,kI,{app:15,plugin:16,allChoices:17,close:0},Uk,[-1,-1])}},JL=s0;var Cs=class extends AL.Modal{constructor(l,G,c){super(l);this.plugin=G;this.choices=c;this.component=null}onOpen(){this.modalEl.addClass("quickAddModal","packageExportModal"),this.component=new JL({target:this.contentEl,props:{app:this.app,plugin:this.plugin,allChoices:this.choices,close:()=>this.close()}})}onClose(){this.component&&(this.component.$destroy(),this.component=null)}};var $L=require("obsidian");var wb=require("obsidian");var EL=require("obsidian");function kL(e){let I;try{I=JSON.parse(e)}catch(l){throw new Error(`Package content is not valid JSON: ${l?.message??l}`)}if(!aL(I))throw new Error("Content is not a valid QuickAdd package.");if(I.schemaVersion>1)throw new Error(`Package schema version ${I.schemaVersion} is newer than this plugin supports (${1}).`);return I}async function OL(e,I,l){let G=new Map(Ue(I).map(b=>[b.id,b])),c=l.choices.map(b=>({choiceId:b.choice.id,name:b.choice.name,parentChoiceId:b.parentChoiceId,pathHint:b.pathHint??[],exists:G.has(b.choice.id)})),t=[];for(let b of l.assets){let d=await e.vault.adapter.exists(b.originalPath);t.push({originalPath:b.originalPath,exists:d,kind:b.kind})}return{choiceConflicts:c,assetConflicts:t}}async function KL(e){let{app:I,existingChoices:l,pkg:G}=e,c=new Map(e.choiceDecisions.map(V=>[V.choiceId,V.mode])),t=new Map(e.assetDecisions.map(V=>[V.originalPath,V])),b=new Map(G.choices.map(V=>[V.choice.id,V])),d=new Set,Z=new Map,m=new Set,a=V=>{if(Z.has(V))return Z.get(V);if(m.has(V))return!0;if(m.add(V),c.get(V)==="skip")return Z.set(V,!1),m.delete(V),!1;let H=b.get(V);if(!H)return Z.set(V,!1),m.delete(V),!1;let O=H.parentChoiceId;if(!O||!b.has(O)||c.get(O)==="skip")return Z.set(V,!0),m.delete(V),!0;let k=a(O);return Z.set(V,k),m.delete(V),k};for(let V of G.choices)a(V.choice.id)&&d.add(V.choice.id);let n=new Set,W=new Map,N=V=>{if(!d.has(V))return!1;if(n.has(V))return!0;if(c.get(V)==="duplicate")return n.add(V),!0;let O=b.get(V)?.parentChoiceId??null;return O&&(c.get(O)==="duplicate"||d.has(O)&&N(O))?(n.add(V),!0):!1};for(let V of G.choices){if(!d.has(V.choice.id))continue;let H=N(V.choice.id)?iG():V.choice.id;W.set(V.choice.id,H)}let Y=Gl(l),u=[],C=[],p=[],o=new Map;for(let V of G.choices){if(!d.has(V.choice.id)){p.push(V.choice.id);continue}let w=Gl(V.choice),H=i0(w,W,d);o.set(V.choice.id,H)}let R=new Set;for(let V of G.choices){let w=V.choice.id;if(!d.has(w)||R.has(w))continue;let H=o.get(w);if(!H)continue;let O=H.id,f=c.get(w)??"import",k=V.parentChoiceId;if(k&&d.has(k)?o.get(k):null){R.add(w);continue}if((f==="overwrite"||f==="import")&&UL(Y,H)){C.push(O),R.add(w);continue}if(k){let L=W.get(k)??k;if(xL(Y,L,H)){u.push(O),R.add(w);continue}let v=IO(Y,V.pathHint.slice(0,-1));if(v){zL(v,H),u.push(O),R.add(w);continue}K.logWarning(`QuickAdd import: could not locate parent for '${V.choice.name}'. Adding to root.`)}let E=Y.findIndex(L=>L.id===O);E!==-1?(Y.splice(E,1,H),C.push(O)):(Y.push(H),u.push(O)),R.add(w)}let s=new Map,Q=[],r=[];for(let V of G.assets){let w=t.get(V.originalPath),H=w?.destinationPath?.trim(),O=H?(0,EL.normalizePath)(H):V.originalPath,f=await $k(I,O);if((w?.mode??(f?"overwrite":"write"))==="skip"){r.push(O);continue}await lO(I,O);let A=uL(V.content);await I.vault.adapter.write(O,A),Q.push(O),s.set(V.originalPath,O)}for(let V of o.values())h0(V,s);return{updatedChoices:Y,addedChoiceIds:u,overwrittenChoiceIds:C,skippedChoiceIds:p,writtenAssets:Q,skippedAssets:r}}async function $k(e,I){try{return await e.vault.adapter.exists(I)}catch{return!1}}function i0(e,I,l){let G=e.id,c=I.get(G)??G;e.id=c;let t=c!==G;if(e.type==="Macro"){let b=e;t&&(b.macro.id=iG()),u0(b.macro.commands,I,l,t)}if(e.type==="Multi"){let b=e;Array.isArray(b.choices)&&(b.choices=b.choices.filter(d=>l.has(d.id)).map(d=>i0(d,I,l)))}return e}function u0(e,I,l,G){for(let c of e)if(c)switch(G&&(c.id=iG()),c.type){case"Choice":{let t=c,b=I.get(t.choiceId);b&&(t.choiceId=b);break}case"Conditional":{let t=c;u0(t.thenCommands,I,l,G),u0(t.elseCommands,I,l,G);break}case"NestedChoice":{let t=c;t.choice&&l.has(t.choice.id)&&(t.choice=i0(t.choice,I,l));break}default:break}}function UL(e,I){for(let l=0;lSelect a package file, review conflicts, and choose how to import each item.
',G=M(),c=F("section"),t=F("label"),b=F("span"),b.textContent="Paste package JSON",d=M(),Z=F("textarea"),m=M(),r&&r.c(),a=M(),V&&V.c(),n=M(),W=F("section"),N=F("button"),Y=mI("Cancel"),u=M(),C=F("button"),O.c(),h(l,"class","svelte-x9dt2q"),h(b,"class","svelte-x9dt2q"),h(Z,"placeholder","Paste the contents of a .quickadd.json package here"),h(Z,"rows","8"),h(Z,"class","svelte-x9dt2q"),h(t,"class","svelte-x9dt2q"),h(c,"class","pasteSection svelte-x9dt2q"),h(N,"type","button"),h(N,"class","secondary svelte-x9dt2q"),N.disabled=e[4],h(C,"type","button"),h(C,"class","primary svelte-x9dt2q"),C.disabled=p=e[4]||!e[1]||!e[2],h(W,"class","footer svelte-x9dt2q"),h(I,"class","importPackageModal svelte-x9dt2q")},m(f,k){tI(f,I,k),i(I,l),i(I,G),i(I,c),i(c,t),i(t,b),i(t,d),i(t,Z),jI(Z,e[8]),i(c,m),r&&r.m(c,null),i(I,a),V&&V.m(I,null),i(I,n),i(I,W),i(W,N),i(N,Y),i(W,u),i(W,C),O.m(C,null),o||(R=[T(Z,"input",e[19]),T(Z,"input",e[16]),T(N,"click",function(){yI(e[0])&&e[0].apply(this,arguments)}),T(C,"click",function(){yI(e[10]?e[0]:e[17])&&(e[10]?e[0]:e[17]).apply(this,arguments)})],o=!0)},p(f,k){e=f,k[0]&256&&jI(Z,e[8]),Q===(Q=s(e,k))&&r?r.p(e,k):(r&&r.d(1),r=Q&&Q(e),r&&(r.c(),r.m(c,null))),e[1]&&e[2]?V?V.p(e,k):(V=ML(e),V.c(),V.m(I,n)):V&&(V.d(1),V=null),k[0]&16&&(N.disabled=e[4]),H!==(H=w(e,k))&&(O.d(1),O=H(e),O&&(O.c(),O.m(C,null))),k[0]&22&&p!==(p=e[4]||!e[1]||!e[2])&&(C.disabled=p)},i:TI,o:TI,d(f){f&&eI(I),r&&r.d(),V&&V.d(),O.d(),o=!1,XI(R)}}}function NO(e,I){let l=I.destinationExists;return I.mode==="skip"?{className:"assetBadge--info",label:"Skipped"}:I.mode==="overwrite"?{className:l?"assetBadge--warning":"assetBadge--info",label:l?"Will overwrite":"Overwrite"}:{className:l?"assetBadge--warning":"assetBadge--info",label:l?"Will overwrite":"New file"}}function PL(e){return!e||e.length===0?"Root":e.slice(0,-1).join(" \u203A ")||"Root"}function YO(e,I,l){let{app:G}=I,{close:c}=I,t=null,b=null,d=null,Z=!1,m=null,a=new Map,n=new Map,W="",N=!1,Y=0,u=!1;function C(y){let v=P.getState().templateFolderPath?.trim(),x=y.kind==="template"||y.kind==="capture-template";if(v&&x){let D=y.originalPath.split("/").pop()??y.originalPath,$=v.replace(/\/+$/,"");return $?`${$}/${D}`:D}return y.originalPath}function p(y){let v=y.trim();if(!v)return!1;let x=(0,wb.normalizePath)(v);return!!G.vault.getAbstractFileByPath(x)}function o(){if(l(6,a=new Map),l(7,n=new Map),!!b){for(let y of b.choiceConflicts){let v=y.exists?"overwrite":"import";a.set(y.choiceId,v)}for(let y of b.assetConflicts){let v=C(y),x=y.exists||p(v),D=x?"overwrite":"write";n.set(y.originalPath,{mode:D,destinationPath:v,destinationExists:x})}}}function R(y,v){let x=new Map(a);x.set(y,v),l(6,a=x)}function s(y,v){let D={...n.get(y)??{mode:v,destinationPath:y,destinationExists:p(y)},mode:v},$=new Map(n);$.set(y,D),l(7,n=$)}function Q(y,v){let x=n.get(y.originalPath)??{mode:"write",destinationPath:y.originalPath,destinationExists:p(y.originalPath)},D=v.trim(),$=D||y.originalPath,aI=D||v,nI=p($),VI=x.mode;x.mode!=="skip"&&(nI&&x.mode==="write"?VI="overwrite":!nI&&x.mode==="overwrite"&&(VI="write"));let rI={...x,mode:VI,destinationPath:aI,destinationExists:nI},CI=new Map(n);CI.set(y.originalPath,rI),l(7,n=CI)}function r(y,v){let D=v.currentTarget.value;R(y,D)}function V(y,v){let D=v.currentTarget.value;s(y,D)}function w(y,v){let x=v.currentTarget.value;Q(y,x)}async function H(y){let v=y.trim(),x=++Y;if(l(5,m=null),l(10,u=!1),!v){l(1,t=null),l(2,b=null),l(6,a=new Map),l(7,n=new Map),l(3,d=null);return}l(9,N=!0);try{let D=kL(v),$=await OL(G,P.getState().choices,D);if(x!==Y)return;l(1,t={pkg:D,path:"[pasted]"}),l(2,b=$),l(3,d=null),o()}catch(D){if(x!==Y)return;l(3,d=D?.message??String(D)),l(1,t=null),l(2,b=null),l(6,a=new Map),l(7,n=new Map)}finally{x===Y&&l(9,N=!1)}}function O(y){let v=y.currentTarget.value;l(8,W=v),H(v)}async function f(){if(u){new wb.Notice("This package has already been imported.");return}if(!t||!b){new wb.Notice("Load a package before importing.");return}l(4,Z=!0),l(5,m=null);try{let y=b.choiceConflicts.map(D=>{let $=a.get(D.choiceId)??"import",aI=D.exists||$!=="overwrite"?$:"import";return{choiceId:D.choiceId,mode:aI}}),v=b.assetConflicts.map(D=>{let $=n.get(D.originalPath),aI=$?.destinationPath?.trim()||D.originalPath,nI=$?.destinationExists??(D.exists?!0:p(aI)),VI=$?.mode??(nI?"overwrite":"write");return{originalPath:D.originalPath,destinationPath:aI,mode:VI}}),x=await KL({app:G,existingChoices:P.getState().choices,pkg:t.pkg,choiceDecisions:y,assetDecisions:v});P.setState(D=>({...D,choices:x.updatedChoices})),l(5,m={added:x.addedChoiceIds.length,overwritten:x.overwrittenChoiceIds.length,skipped:x.skippedChoiceIds.length,assetsWritten:x.writtenAssets.length,assetsSkipped:x.skippedAssets.length}),l(10,u=!0),new wb.Notice(`Imported ${x.addedChoiceIds.length+x.overwrittenChoiceIds.length} choice${x.addedChoiceIds.length+x.overwrittenChoiceIds.length===1?"":"s"} successfully.`)}catch(y){console.error(y),new wb.Notice(`Import failed: ${y?.message??y}`)}finally{l(4,Z=!1)}}function k(){W=this.value,l(8,W)}let A=(y,v)=>r(y.choiceId,v),E=(y,v)=>w(y,v),L=(y,v)=>V(y.originalPath,v);return e.$$set=y=>{"app"in y&&l(18,G=y.app),"close"in y&&l(0,c=y.close)},[c,t,b,d,Z,m,a,n,W,N,u,C,p,r,V,w,O,f,G,k,A,E,L]}var p0=class extends gI{constructor(I){super(),OI(this,I,YO,WO,kI,{app:18,close:0},GO,[-1,-1])}},_L=p0;var is=class extends $L.Modal{constructor(l){super(l);this.component=null}onOpen(){this.modalEl.addClass("quickAddModal","packageImportModal"),this.component=new _L({target:this.contentEl,props:{app:this.app,close:()=>this.close()}})}onClose(){this.component?.$destroy(),this.component=null}};var hs=class extends oe.BaseComponent{constructor(l){super();this.containerEl=l}},ps=class extends oe.PluginSettingTab{constructor(l,G){super(l,G);this.choiceView=null;this.globalVariablesView=null;this.plugin=G,this.icon="zap"}display(){this.destroySettingViews();let{containerEl:l}=this;l.empty();let G=this.createSettingGroup("Choices & Packages");this.addChoicesSetting(G),this.addPackagesSetting(G);let c=this.createSettingGroup("Input");this.addUseMultiLineInputPromptSetting(c),this.addPersistInputPromptDraftsSetting(c),this.addUseSelectionAsValueSetting(c),this.addOnePageInputSetting(c),this.addDateAliasesSetting(c);let t=this.createSettingGroup("Templates & Properties");this.addTemplateFolderPathSetting(t),this.addTemplatePropertyTypesSetting(t);let b=this.createSettingGroup("Notifications");this.addAnnounceUpdatesSetting(b),this.addShowCaptureNotificationSetting(b),this.addShowInputCancellationNotificationSetting(b);let d=this.createSettingGroup("Global Variables");this.addGlobalVariablesSetting(d);let Z=this.createSettingGroup("AI & Online");this.addDisableOnlineFeaturesSetting(Z);let m=this.createSettingGroup("Appearance");this.addEnableRibbonIconSetting(m)}destroySettingViews(){this.choiceView?.$destroy(),this.choiceView=null,this.globalVariablesView?.$destroy(),this.globalVariablesView=null}createSettingGroup(l,G){if(typeof oe.SettingGroup=="function"){let t=new oe.SettingGroup(this.containerEl).setHeading(l);return G&&t.addClass(G),t}let c=new oe.Setting(this.containerEl).setName(l).setHeading();return G&&c.settingEl.addClass(G),{addSetting:t=>{t(new oe.Setting(this.containerEl))}}}prepareFullWidthSetting(l){l.infoEl.remove(),l.settingEl.style.display="block",l.controlEl.style.width="100%",l.controlEl.style.flex="1 1 auto",l.controlEl.style.display="block",l.controlEl.style.marginLeft="0",l.controlEl.style.justifyContent="flex-start",l.controlEl.style.alignItems="stretch",l.controlEl.style.textAlign="left"}addDevelopmentInfoSetting(l){l.addSetting(G=>{G.setName("Development Information"),G.setDesc("Git information for developers.");let c=G.settingEl.createDiv();c.style.marginTop="10px",c.style.fontFamily="var(--font-monospace)",c.style.fontSize="0.9em"})}addGlobalVariablesSetting(l){l.addSetting(G=>{this.prepareFullWidthSetting(G);let c=t=>{this.globalVariablesView=new dL({target:t,props:{app:this.app,plugin:this.plugin}})};if(typeof G.addComponent=="function"){G.addComponent(t=>(c(t),new hs(t)));return}c(G.settingEl)})}addChoicesSetting(l){l.addSetting(G=>{this.prepareFullWidthSetting(G);let c=t=>{this.choiceView=new cL({target:t,props:{app:this.app,plugin:this.plugin,choices:P.getState().choices,saveChoices:b=>{P.setState({choices:b})}}})};if(typeof G.addComponent=="function"){G.addComponent(t=>(c(t),new hs(t)));return}c(G.settingEl)})}addPackagesSetting(l){l.addSetting(G=>{G.setName("Packages"),G.setDesc("Bundle or import QuickAdd automations as reusable packages."),G.addButton(c=>c.setButtonText("Export package\u2026").setCta().onClick(()=>{let t=P.getState().choices;new Cs(this.app,this.plugin,t).open()})),G.addButton(c=>c.setButtonText("Import package\u2026").onClick(()=>{new is(this.app).open()}))})}addAnnounceUpdatesSetting(l){l.addSetting(G=>{G.setName("Announce Updates"),G.setDesc("Display release notes when a new version is installed. This includes new features, demo videos, and bug fixes."),G.addDropdown(c=>{let t=P.getState().announceUpdates;c.addOption("all","Show updates on each new release").addOption("major","Show updates only on major releases (new features, breaking changes)").addOption("none","Don't show").setValue(t).onChange(b=>{P.setState({announceUpdates:b})})})})}addShowCaptureNotificationSetting(l){l.addSetting(G=>{G.setName("Show Capture Notifications"),G.setDesc("Display a notification when content is captured successfully to confirm the operation completed."),G.addToggle(c=>{c.setValue(P.getState().showCaptureNotification),c.onChange(t=>{P.setState({showCaptureNotification:t})})})})}addShowInputCancellationNotificationSetting(l){l.addSetting(G=>{G.setName("Show Input Cancellation Notifications"),G.setDesc("Display a notification when an input prompt is cancelled without submitting. Disable this to avoid extra notices when dismissing prompts."),G.addToggle(c=>{c.setValue(P.getState().showInputCancellationNotification),c.onChange(t=>{P.setState({showInputCancellationNotification:t})})})})}addTemplatePropertyTypesSetting(l){l.addSetting(G=>{G.setName("Format template variables as proper property types (Beta)"),G.setDesc("When enabled, template variables in front matter will be formatted as proper Obsidian property types. Arrays become List properties, numbers become Number properties, booleans become Checkbox properties, etc. This is a beta feature that may have edge cases."),G.addToggle(c=>{c.setValue(P.getState().enableTemplatePropertyTypes),c.onChange(t=>{P.setState({enableTemplatePropertyTypes:t})})})})}hide(){this.destroySettingViews()}addUseMultiLineInputPromptSetting(l){l.addSetting(G=>{G.setName("Use Multi-line Input Prompt").setDesc("Use multi-line input prompt instead of single-line input prompt").addToggle(c=>c.setValue(this.plugin.settings.inputPrompt==="multi-line").setTooltip("Use multi-line input prompt").onChange(t=>{t?P.setState({inputPrompt:"multi-line"}):P.setState({inputPrompt:"single-line"})}))})}addPersistInputPromptDraftsSetting(l){l.addSetting(G=>{G.setName("Persist Input Prompt Drafts").setDesc("Keep drafts when closing input prompts so they can be restored on reopen. Drafts are stored only for this session.").addToggle(c=>c.setValue(P.getState().persistInputPromptDrafts).onChange(t=>{P.setState({persistInputPromptDrafts:t}),t||vd.getInstance().clearAll()}))})}addUseSelectionAsValueSetting(l){l.addSetting(G=>{G.setName("Use editor selection as default Capture value").setDesc("When enabled, Capture uses the current editor selection as {{VALUE}} and may skip the prompt. When disabled, Capture always prompts for {{VALUE}}.").addToggle(c=>c.setValue(P.getState().useSelectionAsCaptureValue).onChange(t=>{P.setState({useSelectionAsCaptureValue:t})}))})}addTemplateFolderPathSetting(l){l.addSetting(G=>{G.setName("Template Folder Path"),G.setDesc("Path to the folder where templates are stored. Used to suggest template files when configuring QuickAdd."),G.addText(c=>{c.setPlaceholder("templates/").setValue(P.getState().templateFolderPath).onChange(t=>{P.setState({templateFolderPath:t})}),new hG(this.app,c.inputEl,this.app.vault.getAllLoadedFiles().filter(t=>t instanceof oe.TFolder&&t.path!=="/").map(t=>t.path))})})}addOnePageInputSetting(l){l.addSetting(G=>{G.setName("One-page input for choices (Beta)").setDesc("Experimental. Resolve variables up front and show a single dynamic form before executing Template/Capture choices. See Advanced \u2192 One-page Inputs in docs.").addToggle(c=>c.setValue(P.getState().onePageInputEnabled).onChange(t=>{P.setState({onePageInputEnabled:t})}))})}addDateAliasesSetting(l){l.addSetting(G=>{G.setName("Date aliases"),G.setDesc("Shortcodes for natural language date parsing. One per line: alias = phrase. Example: tm = tomorrow."),G.settingEl.style.alignItems="flex-start",G.controlEl.style.display="flex",G.controlEl.style.flexWrap="wrap",G.controlEl.style.gap="0.5rem",G.controlEl.style.alignItems="flex-start",G.controlEl.style.flex="1 1 320px",G.controlEl.style.minWidth="240px";let c=null;G.addTextArea(t=>{c=t,t.setPlaceholder(`t = today +tm = tomorrow +yd = yesterday`).setValue(qs(P.getState().dateAliases)).onChange(b=>{P.setState({dateAliases:P0(b)})}),t.inputEl.style.width="100%",t.inputEl.style.minHeight="6rem",t.inputEl.style.flex="1 1 280px",t.inputEl.style.maxWidth="100%",t.inputEl.style.boxSizing="border-box"}),G.addButton(t=>{t.setButtonText("Reset to defaults").onClick(()=>{P.setState({dateAliases:Ob}),c&&c.setValue(qs(Ob))}),t.buttonEl.style.alignSelf="flex-start",t.buttonEl.style.whiteSpace="nowrap"})})}addDisableOnlineFeaturesSetting(l){l.addSetting(G=>{G.setName("Disable AI & Online features").setDesc("This prevents the plugin from making requests to external providers like OpenAI. You can still use User Scripts to execute arbitrary code, including contacting external providers. However, this setting disables plugin features like the AI Assistant from doing so. You need to disable this setting to use the AI Assistant.").addToggle(c=>c.setValue(P.getState().disableOnlineFeatures).onChange(t=>{P.setState({disableOnlineFeatures:t}),this.display()}))})}addEnableRibbonIconSetting(l){l.addSetting(G=>{G.setName("Show icon in sidebar").setDesc("Add QuickAdd icon to the sidebar ribbon. Requires a reload.").addToggle(c=>{c.setValue(P.getState().enableRibbonIcon).onChange(t=>{P.setState({enableRibbonIcon:t}),this.display()})})})}};var LZ=class{formatOutputString(I){return`QuickAdd: (${I.level}) ${I.message}`}getQuickAddError(I,l,G,c){return{message:I,level:l,time:Date.now(),stack:G,originalError:c}}};var fn=class extends LZ{constructor(){super(...arguments);this.ErrorLog=[]}logError(l,G,c){let t=this.getQuickAddError(l,"ERROR",G,c);this.addMessageToErrorLog(t);let b=c||new Error(l);console.error(this.formatOutputString(t),b)}logWarning(l,G,c){let t=this.getQuickAddError(l,"WARNING",G,c);this.addMessageToErrorLog(t);let b=c||new Error(l);console.warn(this.formatOutputString(t),b)}logMessage(l,G,c){let t=this.getQuickAddError(l,"LOG",G,c);this.addMessageToErrorLog(t),c?console.log(this.formatOutputString(t),c):console.log(this.formatOutputString(t))}addMessageToErrorLog(l){this.ErrorLog.push(l),this.ErrorLog.length>SC&&(this.ErrorLog=this.ErrorLog.slice(-SC))}clearErrorLog(){this.ErrorLog=[]}};var V0=require("obsidian");var Vs=class extends LZ{constructor(l){super();this.plugin=l}logError(l,G,c){let t=this.getQuickAddError(l,"ERROR",G,c);new V0.Notice(this.formatOutputString(t),15e3)}logWarning(l,G,c){let t=this.getQuickAddError(l,"WARNING",G,c);new V0.Notice(this.formatOutputString(t))}logMessage(l,G,c){}};var os=class{constructor(I,l,G,c){this.app=I;this.plugin=l;this.choices=G;this.choiceExecutor=c}async run(){let I=Ue(this.choices).filter(l=>l.type==="Macro"&&l.runOnStartup);for(let l of I)await new dc(this.app,this.plugin,l,this.choiceExecutor,new Map).run()}};var o0=require("obsidian");var Xs=class extends aZ{constructor(I,l,G,c){super(I,l,c),this.choiceExecutor=c,this.choice=G}async run(){try{SG(this.choice.templatePath,()=>`Invalid template path for ${this.choice.name}. ${this.choice.templatePath.length===0?"Template path is empty.":`Template path is not valid: ${this.choice.templatePath}`}`);let I=lt(this.choice.appendLink);this.setLinkToCurrentFileBehavior(I.enabled&&!I.requireActiveFile?"optional":"required");let l="";if(this.choice.folder.enabled)l=await this.getFolderPath();else{let Z=this.app.fileManager.getNewFileParent(this.app.workspace.getActiveFile()?.path??"");l=Z===this.app.vault.getRoot()?"":Z.path}let G=this.choice.fileNameFormat.enabled?this.choice.fileNameFormat.format:gt,c=await this.formatter.formatFileName(G,this.choice.name),t=this.normalizeTemplateFilePath(l,c,this.choice.templatePath);this.choice.fileExistsMode===yt&&(t=await this.incrementFileName(t));let b,d=!1;if(await this.app.vault.adapter.exists(t)){let Z=this.findExistingFile(t);if(!(Z instanceof o0.TFile)||Z.extension!=="md"&&Z.extension!=="canvas"){K.logError(`'${t}' already exists but could not be resolved as a markdown or canvas file.`);return}let m=this.choice.fileExistsMode;if(!this.choice.setFileExistsBehavior)try{m=await CG.Suggest(this.app,[...cu],[...cu])}catch(a){throw il(a)?new SI("Input cancelled by user"):a}switch(m){case Sb:b=await this.appendToFileWithTemplate(Z,this.choice.templatePath,"top");break;case fb:b=await this.appendToFileWithTemplate(Z,this.choice.templatePath,"bottom");break;case Tb:b=await this.overwriteFileWithTemplate(Z,this.choice.templatePath);break;case Jt:b=Z,d=!0,K.logMessage(`Opening existing file: ${Z.path}`);break;case yt:{let a=await this.incrementFileName(t);b=await this.createFileWithTemplate(a,this.choice.templatePath);break}default:K.logWarning("File not written to.");return}}else if(b=await this.createFileWithTemplate(t,this.choice.templatePath),!b){K.logWarning(`Could not create file '${t}'.`);return}if(I.enabled&&b&&GN(this.app,b,I),(this.choice.openFile||d)&&b){let Z=KG(this.choice.fileOpening),m=Z.focus??!0;eN(this.app,b,m)||await Vd(this.app,b,Z),await lN(this.app,b)}}catch(I){if(Yt(I,{logPrefix:"Template execution aborted",noticePrefix:"Template execution aborted",defaultReason:"Template execution aborted"})){this.choiceExecutor.signalAbort?.(I);return}qI(I,`Error running template choice "${this.choice.name}"`)}}findExistingFile(I){let l=this.app.vault.getAbstractFileByPath(I);if(l instanceof o0.TFile)return l;if(l)return null;let G=I.toLowerCase(),c=this.app.vault.getFiles().filter(t=>t.path.toLowerCase()===G);if(c.length===1)return c[0];if(c.length>1){let t=c.map(b=>b.path).join(", ");K.logError(`Multiple files match '${I}' when ignoring case: ${t}`)}return null}async formatFolderPaths(I){return await Promise.all(I.map(async G=>await this.formatter.formatFolderPath(G)))}async getFolderPath(){let I=await this.formatFolderPaths([...this.choice.folder.folders]),l=this.getCurrentFolderSuggestion(),G=l?[l]:[];if(this.choice.folder?.chooseFromSubfolders&&!(this.choice.folder?.chooseWhenCreatingNote||this.choice.folder?.createInSameFolderAsActiveFile)){let t=_a(this.app).filter(b=>I.some(d=>b.startsWith(d)));return await this.getOrCreateFolder(t,{allowCreate:!0,allowedRoots:I,topItems:G})}if(this.choice.folder?.chooseWhenCreatingNote){let c=_a(this.app);return await this.getOrCreateFolder(c,{allowCreate:!0,topItems:G})}if(this.choice.folder?.createInSameFolderAsActiveFile){let c=this.app.workspace.getActiveFile();return!c||!c.parent?(K.logWarning("No active file or active file has no parent. Cannot create file in same folder as active file. Creating in root folder."),""):await this.getOrCreateFolder([c.parent.path],{allowCreate:!0,topItems:G})}return await this.getOrCreateFolder(I,{allowCreate:!0,allowedRoots:I,topItems:G})}getCurrentFolderSuggestion(){let I=this.app.workspace.getActiveFile(),l=I?.parent;return!I||!l?null:{path:l.path??"",label:"