" : makeWiki(newItem2)}`;
function select_change_handler() {
rel = select_value(this);
$$invalidate(0, rel);
}
function input_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
inputEl = $$value;
$$invalidate(4, inputEl);
});
}
function input_input_handler() {
newItem = this.value;
$$invalidate(5, newItem);
}
const click_handler = async (e) => {
if (rel === "up" && hnItem.depth === 0) {
new import_obsidian11.Notice("Can't add parent to top level item, choose another direction");
return;
} else {
try {
const content = await app.vault.read(file);
const lines = content.split("\n");
const lineNo = rel === "up" ? hnItem.lineNo : hnItem.lineNo + 1;
const depth = rel === "up" ? hnItem.depth - 4 : rel === "down" ? hnItem.depth + 4 : hnItem.depth;
lines.splice(lineNo, 0, buildNewItem(newItem, depth));
await app.vault.modify(file, lines.join("\n"));
modal.close();
} catch (err) {
(0, import_console.error)(err);
new import_obsidian11.Notice("An error occured, please check the console");
}
}
};
$$self.$$set = ($$props2) => {
if ("modal" in $$props2)
$$invalidate(1, modal = $$props2.modal);
if ("settings" in $$props2)
$$invalidate(7, settings = $$props2.settings);
if ("hnItem" in $$props2)
$$invalidate(2, hnItem = $$props2.hnItem);
if ("file" in $$props2)
$$invalidate(3, file = $$props2.file);
if ("rel" in $$props2)
$$invalidate(0, rel = $$props2.rel);
};
return [
rel,
modal,
hnItem,
file,
inputEl,
newItem,
buildNewItem,
settings,
select_change_handler,
input_binding,
input_input_handler,
click_handler
];
}
var ModifyHNItemComp = class extends SvelteComponent {
constructor(options) {
super();
init(
this,
options,
instance8,
create_fragment8,
safe_not_equal,
{
modal: 1,
settings: 7,
hnItem: 2,
file: 3,
rel: 0
},
add_css6
);
}
};
var ModifyHNItemComp_default = ModifyHNItemComp;
// src/AlternativeHierarchies/HierarchyNotes/ModifyHierItemModal.ts
var ModifyHierItemModal = class extends import_obsidian12.Modal {
constructor(plugin, hnItem, file, rel) {
super(app);
this.plugin = plugin;
this.modal = this;
this.hnItem = hnItem;
this.file = file;
this.rel = rel;
}
onOpen() {
const { contentEl } = this;
contentEl.empty();
this.mount = new ModifyHNItemComp_default({
target: contentEl,
props: {
modal: this,
settings: this.plugin.settings,
hnItem: this.hnItem,
file: this.file,
rel: this.rel
}
});
}
onClose() {
this.mount.$destroy();
this.contentEl.empty();
}
};
// src/AlternativeHierarchies/HierarchyNotes/HierarchyNoteManipulator.ts
var HierarchyNoteManipulator = class extends import_obsidian13.FuzzySuggestModal {
constructor(plugin, hierNoteName) {
super(app);
this.plugin = plugin;
this.settings = this.plugin.settings;
this.hierNoteName = hierNoteName;
const chooseOverride = (evt) => {
this.chooser.useSelectedItem(evt);
return false;
};
this.scope.register([], "Delete", chooseOverride);
this.scope.register(["Shift"], "ArrowUp", chooseOverride);
this.scope.register(["Shift"], "ArrowRight", chooseOverride);
this.scope.register(["Shift"], "ArrowDown", chooseOverride);
}
async onOpen() {
this.setPlaceholder("HN Manipulator");
this.setInstructions([
{ command: "Shift + Enter", purpose: "Jump to item" },
{ command: "Shift + \u2191", purpose: "Add parent" },
{ command: "Shift + \u2192", purpose: "Add sibling" },
{ command: "Shift + \u2193 / Enter / Click", purpose: "Add child" },
{ command: "Delete", purpose: "Delete item" }
]);
this.file = app.metadataCache.getFirstLinkpathDest(this.hierNoteName, "");
if (!this.file)
this.lines = [];
console.log(this);
const content = await app.vault.cachedRead(this.file);
this.lines = content.split("\n");
this.listItems = app.metadataCache.getFileCache(this.file).listItems;
console.log(this);
super.onOpen();
}
getItems() {
const items = this.listItems.map((item) => {
const i = item.position.start.line;
return { i, line: this.lines[i] };
}).map((item) => {
const splits = item.line.split("- ");
const depth = splits[0].length;
const line = splits.slice(1).join("- ");
return { depth, line, lineNo: item.i };
});
(0, import_loglevel15.info)(items);
return items;
}
getItemText(item) {
return `${" ".repeat(item.depth)}- ${dropWikilinks(item.line)}`;
}
renderSuggestion(item, el) {
super.renderSuggestion(item, el);
el.innerText = `${" ".repeat(item.item.depth)}- ${dropWikilinks(
item.item.line
)}`;
}
async deleteItem(item) {
try {
this.lines.splice(item.lineNo, 1);
this.listItems.splice(item.lineNo, 1);
await app.vault.modify(this.file, this.lines.join("\n"));
new import_obsidian13.Notice("Item deleted Succesfully");
} catch (err) {
(0, import_loglevel15.error)(err);
new import_obsidian13.Notice("An error occured. Please check the console");
}
}
onChooseItem(item, evt) {
if (evt instanceof KeyboardEvent && evt.key === "Delete") {
this.deleteItem(item);
} else if (evt instanceof KeyboardEvent && evt.key == "Enter" && evt.shiftKey) {
const view = app.workspace.getActiveViewOfType(import_obsidian13.MarkdownView);
const { editor } = view != null ? view : {};
if (!editor)
return;
view.leaf.openFile(this.file, { active: true, mode: "source" });
editor.setCursor({ line: item.lineNo, ch: item.depth + 2 });
} else if (evt instanceof KeyboardEvent || evt instanceof MouseEvent) {
let rel;
if (evt instanceof MouseEvent && evt.type == "click")
rel = "down";
if (evt instanceof KeyboardEvent) {
if (evt.key === "Enter")
rel = "down";
}
if (evt instanceof KeyboardEvent && evt.shiftKey) {
if (evt.key === "ArrowUp")
rel = "up";
if (evt.key === "ArrowDown")
rel = "down";
if (evt.key === "ArrowRight")
rel = "same";
}
new ModifyHierItemModal(
this.plugin,
item,
this.file,
rel
).open();
this.close();
}
}
};
// src/AlternativeHierarchies/HierarchyNotes/HierNoteModal.ts
var HierarchyNoteSelectorModal = class extends import_obsidian14.FuzzySuggestModal {
constructor(plugin) {
super(app);
this.plugin = plugin;
this.settings = this.plugin.settings;
}
onOpen() {
this.setPlaceholder("HN Chooser");
const { hierarchyNotes } = this.settings;
if (hierarchyNotes.length === 0) {
this.close();
new import_obsidian14.Notice("No hierarchy notes found");
} else if (hierarchyNotes.length === 1 && !hierarchyNotes[0].endsWith("/")) {
this.close();
new HierarchyNoteManipulator(
this.plugin,
hierarchyNotes[0]
).open();
} else {
super.onOpen();
}
}
getItems() {
const { hierarchyNotes } = this.settings;
if (hierarchyNotes.length == 1 && hierarchyNotes[0].endsWith("/")) {
let folder = hierarchyNotes[0].slice(0, -1);
if (app.plugins.plugins.dataview != void 0) {
let pages = app.plugins.plugins.dataview.api.pages(
`"${folder}"`
);
return pages.values.map((page) => page.file.path);
} else {
new import_obsidian14.Notice("make sure you have dataview enabled");
}
} else
return hierarchyNotes;
}
getItemText(item) {
return `${item}`;
}
renderSuggestion(item, el) {
super.renderSuggestion(item, el);
}
onChooseItem(item, evt) {
new HierarchyNoteManipulator(this.plugin, item).open();
this.close();
}
};
// src/Codeblocks.ts
var import_loglevel16 = __toESM(require_loglevel());
var import_obsidian16 = require("obsidian");
// src/Components/RenderMarkdown.svelte
var import_obsidian15 = require("obsidian");
function add_css7(target) {
append_styles(target, "svelte-7e9i10", "div.BC-note-content.svelte-7e9i10{padding-left:20px}");
}
function create_fragment9(ctx) {
let div;
return {
c() {
div = element("div");
attr(div, "class", "BC-note-content svelte-7e9i10");
},
m(target, anchor) {
insert(target, div, anchor);
ctx[2](div);
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching)
detach(div);
ctx[2](null);
}
};
}
function instance9($$self, $$props, $$invalidate) {
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
let { path: path2 } = $$props;
function getContent(note) {
return __awaiter(this, void 0, void 0, function* () {
const file = app.metadataCache.getFirstLinkpathDest(note, "");
return yield app.vault.cachedRead(file);
});
}
let el;
onMount(() => __awaiter(void 0, void 0, void 0, function* () {
import_obsidian15.MarkdownRenderer.renderMarkdown(yield getContent(path2), el, path2, null);
}));
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
el = $$value;
$$invalidate(0, el);
});
}
$$self.$$set = ($$props2) => {
if ("path" in $$props2)
$$invalidate(1, path2 = $$props2.path);
};
return [el, path2, div_binding];
}
var RenderMarkdown = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance9, create_fragment9, safe_not_equal, { path: 1 }, add_css7);
}
};
var RenderMarkdown_default = RenderMarkdown;
// src/Components/CBTree.svelte
function add_css8(target) {
append_styles(target, "svelte-1df5nr5", ".BC-tree.svelte-1df5nr5{padding-left:5px}pre.indent.svelte-1df5nr5{display:inline;background-color:transparent;position:top}details.svelte-1df5nr5{display:inline-block}.is-unresolved.svelte-1df5nr5{color:var(--text-muted)}");
}
function get_each_context5(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[17] = list[i][0];
child_ctx[18] = list[i][1];
return child_ctx;
}
function create_if_block_24(ctx) {
let h3;
let t0;
let t1;
let t2;
return {
c() {
h3 = element("h3");
t0 = text(
/*dir*/
ctx[8]
);
t1 = text(" of ");
t2 = text(
/*basename*/
ctx[4]
);
},
m(target, anchor) {
insert(target, h3, anchor);
append(h3, t0);
append(h3, t1);
append(h3, t2);
},
p(ctx2, dirty) {
if (dirty & /*basename*/
16)
set_data(
t2,
/*basename*/
ctx2[4]
);
},
d(detaching) {
if (detaching)
detach(h3);
}
};
}
function create_if_block6(ctx) {
let current_block_type_index;
let if_block;
let if_block_anchor;
let current;
const if_block_creators = [create_if_block_14, create_else_block3];
const if_blocks = [];
function select_block_type(ctx2, dirty) {
if (
/*content*/
ctx2[7] === "open" || /*content*/
ctx2[7] === "closed"
)
return 0;
return 1;
}
current_block_type_index = select_block_type(ctx, -1);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
return {
c() {
if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if_blocks[current_block_type_index].m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
if_block.p(ctx2, dirty);
},
i(local) {
if (current)
return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if_blocks[current_block_type_index].d(detaching);
if (detaching)
detach(if_block_anchor);
}
};
}
function create_else_block3(ctx) {
let div;
let pre;
let t0_value = (
/*indent*/
ctx[17] + "-"
);
let t0;
let t1;
let span;
let a2;
let t2_value = dropDendron(
/*link*/
ctx[18],
/*settings*/
ctx[5]
) + "";
let t2;
let a_class_value;
let t3;
let mounted;
let dispose;
function click_handler_1(...args) {
return (
/*click_handler_1*/
ctx[15](
/*link*/
ctx[18],
...args
)
);
}
function mouseover_handler_1(...args) {
return (
/*mouseover_handler_1*/
ctx[16](
/*link*/
ctx[18],
...args
)
);
}
return {
c() {
div = element("div");
pre = element("pre");
t0 = text(t0_value);
t1 = space();
span = element("span");
a2 = element("a");
t2 = text(t2_value);
t3 = space();
attr(pre, "class", "indent svelte-1df5nr5");
attr(a2, "class", a_class_value = "internal-link " + (isInVault(
/*link*/
ctx[18]
) ? "" : "is-unresolved") + " svelte-1df5nr5");
attr(span, "class", "internal-link");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, pre);
append(pre, t0);
append(div, t1);
append(div, span);
append(span, a2);
append(a2, t2);
append(div, t3);
if (!mounted) {
dispose = [
listen(span, "click", click_handler_1),
listen(span, "mouseover", mouseover_handler_1)
];
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*lines*/
1 && t0_value !== (t0_value = /*indent*/
ctx[17] + "-"))
set_data(t0, t0_value);
if (dirty & /*lines*/
1 && t2_value !== (t2_value = dropDendron(
/*link*/
ctx[18],
/*settings*/
ctx[5]
) + ""))
set_data(t2, t2_value);
if (dirty & /*lines*/
1 && a_class_value !== (a_class_value = "internal-link " + (isInVault(
/*link*/
ctx[18]
) ? "" : "is-unresolved") + " svelte-1df5nr5")) {
attr(a2, "class", a_class_value);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching)
detach(div);
mounted = false;
run_all(dispose);
}
};
}
function create_if_block_14(ctx) {
let div;
let pre;
let t0_value = (
/*indent*/
ctx[17] + ""
);
let t0;
let t1;
let details2;
let summary;
let span;
let a2;
let t2_value = dropDendron(
/*link*/
ctx[18],
/*settings*/
ctx[5]
) + "";
let t2;
let a_class_value;
let t3;
let rendermarkdown;
let details_open_value;
let t4;
let current;
let mounted;
let dispose;
function click_handler(...args) {
return (
/*click_handler*/
ctx[13](
/*link*/
ctx[18],
...args
)
);
}
function mouseover_handler(...args) {
return (
/*mouseover_handler*/
ctx[14](
/*link*/
ctx[18],
...args
)
);
}
rendermarkdown = new RenderMarkdown_default({ props: { path: (
/*link*/
ctx[18]
) } });
return {
c() {
div = element("div");
pre = element("pre");
t0 = text(t0_value);
t1 = space();
details2 = element("details");
summary = element("summary");
span = element("span");
a2 = element("a");
t2 = text(t2_value);
t3 = space();
create_component(rendermarkdown.$$.fragment);
t4 = space();
attr(pre, "class", "indent svelte-1df5nr5");
attr(a2, "class", a_class_value = "internal-link " + (isInVault(
/*link*/
ctx[18]
) ? "" : "is-unresolved") + " svelte-1df5nr5");
attr(span, "class", "internal-link");
details2.open = details_open_value = /*content*/
ctx[7] === "open";
attr(details2, "class", "svelte-1df5nr5");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, pre);
append(pre, t0);
append(div, t1);
append(div, details2);
append(details2, summary);
append(summary, span);
append(span, a2);
append(a2, t2);
append(details2, t3);
mount_component(rendermarkdown, details2, null);
append(div, t4);
current = true;
if (!mounted) {
dispose = [
listen(span, "click", click_handler),
listen(span, "mouseover", mouseover_handler)
];
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if ((!current || dirty & /*lines*/
1) && t0_value !== (t0_value = /*indent*/
ctx[17] + ""))
set_data(t0, t0_value);
if ((!current || dirty & /*lines*/
1) && t2_value !== (t2_value = dropDendron(
/*link*/
ctx[18],
/*settings*/
ctx[5]
) + ""))
set_data(t2, t2_value);
if (!current || dirty & /*lines*/
1 && a_class_value !== (a_class_value = "internal-link " + (isInVault(
/*link*/
ctx[18]
) ? "" : "is-unresolved") + " svelte-1df5nr5")) {
attr(a2, "class", a_class_value);
}
const rendermarkdown_changes = {};
if (dirty & /*lines*/
1)
rendermarkdown_changes.path = /*link*/
ctx[18];
rendermarkdown.$set(rendermarkdown_changes);
},
i(local) {
if (current)
return;
transition_in(rendermarkdown.$$.fragment, local);
current = true;
},
o(local) {
transition_out(rendermarkdown.$$.fragment, local);
current = false;
},
d(detaching) {
if (detaching)
detach(div);
destroy_component(rendermarkdown);
mounted = false;
run_all(dispose);
}
};
}
function create_each_block5(ctx) {
let show_if = meetsConditions(
/*indent*/
ctx[17],
/*link*/
ctx[18],
/*froms*/
ctx[1],
/*min*/
ctx[2],
/*max*/
ctx[3]
);
let if_block_anchor;
let current;
let if_block = show_if && create_if_block6(ctx);
return {
c() {
if (if_block)
if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block)
if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
if (dirty & /*lines, froms, min, max*/
15)
show_if = meetsConditions(
/*indent*/
ctx2[17],
/*link*/
ctx2[18],
/*froms*/
ctx2[1],
/*min*/
ctx2[2],
/*max*/
ctx2[3]
);
if (show_if) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*lines, froms, min, max*/
15) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block6(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current)
return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (if_block)
if_block.d(detaching);
if (detaching)
detach(if_block_anchor);
}
};
}
function create_fragment10(ctx) {
let t;
let div;
let current;
let if_block = (
/*title*/
ctx[6] !== false && create_if_block_24(ctx)
);
let each_value = (
/*lines*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block5(get_each_context5(ctx, each_value, i));
}
const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
return {
c() {
if (if_block)
if_block.c();
t = space();
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(div, "class", "BC-tree svelte-1df5nr5");
},
m(target, anchor) {
if (if_block)
if_block.m(target, anchor);
insert(target, t, anchor);
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
current = true;
},
p(ctx2, [dirty]) {
if (
/*title*/
ctx2[6] !== false
)
if_block.p(ctx2, dirty);
if (dirty & /*content, lines, openOrSwitch, hoverPreview, activeLeafView, isInVault, dropDendron, settings, meetsConditions, froms, min, max*/
687) {
each_value = /*lines*/
ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context5(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block5(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
},
i(local) {
if (current)
return;
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
current = false;
},
d(detaching) {
if (if_block)
if_block.d(detaching);
if (detaching)
detach(t);
if (detaching)
detach(div);
destroy_each(each_blocks, detaching);
}
};
}
function instance10($$self, $$props, $$invalidate) {
;
;
let { plugin } = $$props;
let { el } = $$props;
let { lines } = $$props;
let { froms } = $$props;
let { min: min3 } = $$props;
let { max: max4 } = $$props;
let { basename } = $$props;
let { parsedSource } = $$props;
const { settings } = plugin;
const { title, content, dir } = parsedSource;
const activeLeafView = app.workspace.activeLeaf.view;
const click_handler = async (link2, e) => await openOrSwitch(link2, e);
const mouseover_handler = (link2, e) => hoverPreview(e, activeLeafView, link2);
const click_handler_1 = async (link2, e) => await openOrSwitch(link2, e);
const mouseover_handler_1 = (link2, e) => hoverPreview(e, activeLeafView, link2);
$$self.$$set = ($$props2) => {
if ("plugin" in $$props2)
$$invalidate(10, plugin = $$props2.plugin);
if ("el" in $$props2)
$$invalidate(11, el = $$props2.el);
if ("lines" in $$props2)
$$invalidate(0, lines = $$props2.lines);
if ("froms" in $$props2)
$$invalidate(1, froms = $$props2.froms);
if ("min" in $$props2)
$$invalidate(2, min3 = $$props2.min);
if ("max" in $$props2)
$$invalidate(3, max4 = $$props2.max);
if ("basename" in $$props2)
$$invalidate(4, basename = $$props2.basename);
if ("parsedSource" in $$props2)
$$invalidate(12, parsedSource = $$props2.parsedSource);
};
return [
lines,
froms,
min3,
max4,
basename,
settings,
title,
content,
dir,
activeLeafView,
plugin,
el,
parsedSource,
click_handler,
mouseover_handler,
click_handler_1,
mouseover_handler_1
];
}
var CBTree = class extends SvelteComponent {
constructor(options) {
super();
init(
this,
options,
instance10,
create_fragment10,
safe_not_equal,
{
plugin: 10,
el: 11,
lines: 0,
froms: 1,
min: 2,
max: 3,
basename: 4,
parsedSource: 12
},
add_css8
);
}
};
var CBTree_default = CBTree;
// src/Codeblocks.ts
function getCodeblockCB(plugin) {
const { settings, db } = plugin;
const { userHiers, createIndexIndent } = settings;
return (source, el, ctx) => {
var _a;
db.start2G("Codeblock");
const parsedSource = parseCodeBlockSource(source);
const err = codeblockError(plugin, parsedSource);
if (err !== "") {
el.innerHTML = err;
db.end2G();
return;
}
let min3 = 0, max4 = Infinity;
let { depth, dir, fields, from, implied, flat } = parsedSource;
if (depth !== void 0) {
const minNum = parseInt(depth[0]);
if (!isNaN(minNum))
min3 = minNum;
const maxNum = parseInt(depth[1]);
if (!isNaN(maxNum))
max4 = maxNum;
}
const currFile = app.metadataCache.getFirstLinkpathDest(
ctx.sourcePath,
""
);
const { basename } = currFile;
let froms = void 0;
if (from !== void 0) {
try {
const api = getDVApi(plugin);
if (api) {
const pages = (_a = api.pagePaths(from)) == null ? void 0 : _a.values;
froms = pages.map(dropFolder);
} else
new import_obsidian16.Notice("Dataview must be enabled for `from` to work.");
} catch (e) {
new import_obsidian16.Notice(`The query "${from}" failed.`);
}
}
const oppDir = getOppDir(dir);
const sub = implied === false ? getSubInDirs(plugin.mainG, dir) : getSubInDirs(plugin.mainG, dir, oppDir);
const closed = getReflexiveClosure(sub, userHiers);
const subFields = fields != null ? fields : getFields(userHiers);
const subClosed = getSubForFields(getSubInDirs(closed, dir), subFields);
const allPaths = dfsAllPaths(subClosed, basename);
const index2 = createIndex(allPaths, false, createIndexIndent);
(0, import_loglevel16.info)({ allPaths, index: index2 });
const lines = indexToLinePairs(index2, flat);
switch (parsedSource.type) {
case "tree":
new CBTree_default({
target: el,
props: {
plugin,
el,
min: min3,
max: max4,
lines,
froms,
basename,
parsedSource
}
});
break;
case "juggl":
createdJugglCB(
plugin,
el,
parsedSource,
lines,
froms,
basename,
min3,
max4
);
break;
}
db.end2G();
};
}
var parseAsBool = (value) => value === "true" ? true : value === "false" ? false : value;
function parseCodeBlockSource(source) {
const lines = source.split("\n");
const getValue = (type2) => {
var _a, _b, _c;
return (_c = (_b = (_a = lines.find((l2) => l2.startsWith(`${type2}:`))) == null ? void 0 : _a.split(":")) == null ? void 0 : _b[1]) == null ? void 0 : _c.trim();
};
const results = {};
CODEBLOCK_FIELDS.forEach((field) => {
const value = getValue(field);
results[field] = parseAsBool(value);
});
results.fields = results.fields ? splitAndTrim(results.fields) : void 0;
if (results.depth) {
const match2 = results.depth.match(/(\d*)-?(\d*)/);
results.depth = [match2[1], match2[2]];
}
return results;
}
function codeblockError(plugin, parsedSource) {
var _a;
const { dir, fields, type: type2, title, depth, flat, content, from, implied } = parsedSource;
const { userHiers } = plugin.settings;
let err = "";
if (!CODEBLOCK_TYPES.includes(type2))
err += `type: ${type2}
is not a valid type. It must be one of: ${CODEBLOCK_TYPES.map(
(type3) => `${type3}
`
).join(", ")}.`;
const validDir = DIRECTIONS.includes(dir);
if (!validDir)
err += `dir: ${dir}
is not a valid direction.`;
const allFields = getFields(userHiers);
(_a = [fields].flat()) == null ? void 0 : _a.forEach((f) => {
if (f !== void 0 && !allFields.includes(f))
err += `fields: ${f}
is not a field in your hierarchies.`;
});
if (title !== void 0 && title !== false)
err += `title: ${title}
is not a valid value. It has to be false
, or leave the entire line out.`;
if (depth !== void 0 && depth.every((num) => isNaN(parseInt(num))))
err += `depth: ${depth}
is not a valid value. It has to be a number.`;
if (flat !== void 0 && flat !== true)
err += `flat: ${flat}
is not a valid value. It has to be true
, or leave the entire line out.`;
if (content !== void 0 && content !== "open" && content !== "closed")
err += `content: ${content}
is not a valid value. It has to be open
or closed
, or leave the entire line out.`;
if (from !== void 0 && !app.plugins.enabledPlugins.has("dataview")) {
err += `Dataview must be enabled to use from
.`;
}
if (implied !== void 0 && implied !== false)
err += `implied: ${implied}
is not a valid value. It has to be false
, or leave the entire line out.`;
return err === "" ? "" : `${err}
A valid example would be:
type: tree
dir: ${validDir ? dir : "down"}
fields: ${allFields.map((f) => {
return { f, dir: getFieldInfo(userHiers, f).fieldDir };
}).filter((info14) => info14.dir === dir).map((info14) => info14.f).join(", ") || "child"}
depth: 3
`;
}
var indentToDepth = (indent) => indent.length / 2 + 1;
function meetsConditions(indent, node, froms, min3, max4) {
const depth = indentToDepth(indent);
return depth >= min3 && depth <= max4 && (froms === void 0 || froms.includes(node));
}
function createdJugglCB(plugin, target, args, lines, froms, source, min3, max4) {
const nodes = lines.filter(([indent, node]) => meetsConditions(indent, node, froms, min3, max4)).map(([_, node]) => node + ".md");
if (min3 <= 0)
nodes.push(source + ".md");
createJuggl(plugin, target, nodes, args);
}
// src/Commands/jumpToFirstDir.ts
var import_obsidian17 = require("obsidian");
async function jumpToFirstDir(plugin, dir) {
var _a;
const { limitJumpToFirstFields } = plugin.settings;
const file = getCurrFile();
if (!file) {
new import_obsidian17.Notice("You need to be focussed on a Markdown file");
return;
}
const { basename } = file;
const realsNImplieds = getRealnImplied(plugin, basename, dir)[dir];
const allBCs = [...realsNImplieds.reals, ...realsNImplieds.implieds];
if (allBCs.length === 0) {
new import_obsidian17.Notice(`No ${dir} found`);
return;
}
const toNode = (_a = allBCs.find(
(bc) => limitJumpToFirstFields.includes(bc.field)
)) == null ? void 0 : _a.to;
if (!toNode) {
new import_obsidian17.Notice(
`No note was found in ${dir} given the limited fields allowed: ${limitJumpToFirstFields.join(
", "
)}`
);
return;
}
const toFile = app.metadataCache.getFirstLinkpathDest(toNode, "");
await app.workspace.activeLeaf.openFile(toFile);
}
// src/Commands/threading.ts
var import_obsidian18 = require("obsidian");
var resolveThreadingNameTemplate = (template, currFile, field, dir, dateFormat) => template ? template.replace("{{current}}", currFile.basename).replace("{{field}}", field).replace("{{dir}}", dir).replace("{{date}}", moment().format(dateFormat)) : "Untitled";
function makeFilenameUnique(filename) {
let i = 1, newName = filename;
while (app.metadataCache.getFirstLinkpathDest(newName, "")) {
if (i === 1)
newName += ` ${i}`;
else
newName = newName.slice(0, -2) + ` ${i}`;
i++;
}
return newName;
}
async function resolveThreadingContentTemplate(writeBCsInline, templatePath, oppField, currFile, crumb) {
let newContent = crumb;
if (templatePath) {
const templateFile = app.metadataCache.getFirstLinkpathDest(
templatePath,
""
);
const template = await app.vault.cachedRead(templateFile);
newContent = template.replace(
/\{\{BC-thread-crumb\}\}/i,
writeBCsInline ? `${oppField}:: [[${currFile.basename}]]` : `${oppField}: ['${currFile.basename}']`
);
}
return newContent;
}
async function thread(plugin, field) {
var _a;
const { settings } = plugin;
const {
userHiers,
threadingTemplate,
dateFormat,
threadIntoNewPane,
threadingDirTemplates,
threadUnderCursor,
writeBCsInline
} = settings;
const currFile = getCurrFile();
if (!currFile)
return;
const newFileParent = app.fileManager.getNewFileParent(currFile.path);
const dir = getFieldInfo(userHiers, field).fieldDir;
const oppField = getOppFields(userHiers, field, dir)[0];
let newBasename = resolveThreadingNameTemplate(
threadingTemplate,
currFile,
field,
dir,
dateFormat
);
newBasename = makeFilenameUnique(newBasename);
const oppCrumb = writeBCsInline ? `${oppField}:: [[${currFile.basename}]]` : `---
${oppField}: ['${currFile.basename}']
---`;
const templatePath = threadingDirTemplates[dir];
const newContent = await resolveThreadingContentTemplate(
writeBCsInline,
templatePath,
oppField,
currFile,
oppCrumb
);
const newFile = await app.vault.create(
(0, import_obsidian18.normalizePath)(`${newFileParent.path}/${newBasename}.md`),
newContent
);
if (!writeBCsInline) {
const { api } = (_a = app.plugins.plugins.metaedit) != null ? _a : {};
if (!api) {
new import_obsidian18.Notice(
"Metaedit must be enabled to write to yaml. Alternatively, toggle the setting `Write Breadcrumbs Inline` to use Dataview inline fields instead."
);
return;
}
await createOrUpdateYaml(
field,
newFile.basename,
currFile,
app.metadataCache.getFileCache(currFile).frontmatter,
api
);
} else {
const crumb = `${field}:: [[${newFile.basename}]]`;
const { editor } = app.workspace.activeLeaf.view;
if (threadUnderCursor || !editor) {
editor.replaceRange(crumb, editor.getCursor());
} else {
let content = await app.vault.read(currFile);
const splits = splitAtYaml2(content);
content = splits[0] + (splits[0].length ? "\n" : "") + crumb + (splits[1].length ? "\n" : "") + splits[1];
await app.vault.modify(currFile, content);
}
}
const leaf = threadIntoNewPane ? app.workspace.getLeaf(true) : app.workspace.activeLeaf;
await leaf.openFile(newFile, { active: true, mode: "source" });
if (templatePath) {
if (app.plugins.plugins["templater-obsidian"]) {
app.commands.executeCommandById(
"templater-obsidian:replace-in-file-templater"
);
} else {
new import_obsidian18.Notice(
"The Templater plugin must be enabled to resolve the templates in the new note"
);
}
}
if (threadingTemplate) {
const editor = leaf.view.editor;
editor.setCursor(editor.getValue().length);
} else {
const noteNameInputs = document.getElementsByClassName("view-header-title");
const newNoteInputEl = Array.from(noteNameInputs).find(
(input) => input.innerText === newBasename
);
newNoteInputEl.innerText = "";
newNoteInputEl.focus();
}
}
// src/Commands/WriteBCs.ts
var import_loglevel17 = __toESM(require_loglevel());
var import_obsidian19 = require("obsidian");
async function writeBCToFile(plugin, currFile) {
const { settings, mainG } = plugin;
const file = currFile != null ? currFile : getCurrFile();
const { limitWriteBCCheckboxes, writeBCsInline, userHiers } = settings;
const succInfo = mainG.mapInEdges(file.basename, (k, a2, s2, t) => {
const { field, dir } = a2;
const oppField = getOppFields(userHiers, field, dir)[0];
return { succ: s2, field: oppField };
});
for (const { succ, field } of succInfo) {
if (!limitWriteBCCheckboxes.includes(field))
return;
const content = await app.vault.read(file);
const [yaml, afterYaml] = splitAtYaml2(content);
if (!writeBCsInline) {
const inner = yaml === "" ? yaml : yaml.slice(4, -4);
const newYaml = changeYaml(inner, field, succ);
const newContent = `---
${newYaml}
---${afterYaml}`;
await app.vault.modify(file, newContent);
} else {
const newContent = yaml + (yaml.length ? "\n" : "") + `${field}:: [[${succ}]]` + (afterYaml.length ? "\n" : "") + afterYaml;
await app.vault.modify(file, newContent);
}
}
}
async function writeBCsToAllFiles(plugin) {
if (!plugin.settings.showWriteAllBCsCmd) {
new import_obsidian19.Notice(
"You first need to enable this command in Breadcrumbs' settings."
);
return;
}
if (window.confirm(
"This action will write the implied Breadcrumbs of each file to that file.\nIt uses the MetaEdit plugins API to update the YAML, so it should only affect that frontmatter of your note.\nI can't promise that nothing bad will happen. **This operation cannot be undone**."
)) {
if (window.confirm(
"Are you sure? You have been warned that this operation will attempt to update all files with implied breadcrumbs."
)) {
if (window.confirm("For real, please make a back up before.")) {
const notice = new import_obsidian19.Notice("Operation Started");
const problemFiles = [];
for (const file of app.vault.getMarkdownFiles()) {
try {
await writeBCToFile(plugin, file);
} catch (e) {
problemFiles.push(file.path);
}
}
notice.setMessage("Operation Complete");
if (problemFiles.length) {
new import_obsidian19.Notice(
"Some files were not updated due to errors. Check the console to see which ones."
);
(0, import_loglevel17.warn)({ problemFiles });
}
}
}
}
}
// src/FieldSuggestor.ts
var import_obsidian20 = require("obsidian");
var FieldSuggestor = class extends import_obsidian20.EditorSuggest {
constructor(plugin) {
super(app);
this.getSuggestions = (context) => {
const { query } = context;
return BC_FIELDS_INFO.map((sug) => sug.field).filter(
(sug) => sug.includes(query)
);
};
this.plugin = plugin;
}
onTrigger(cursor, editor, _) {
var _a;
const sub = editor.getLine(cursor.line).substring(0, cursor.ch);
const match2 = (_a = sub.match(/^BC-(.*)$/)) == null ? void 0 : _a[1];
if (match2 !== void 0) {
return {
end: cursor,
start: {
ch: sub.lastIndexOf(match2),
line: cursor.line
},
query: match2
};
}
return null;
}
renderSuggestion(suggestion, el) {
var _a;
el.createDiv({
text: suggestion.replace("BC-", ""),
cls: "BC-suggester-container",
attr: {
"aria-label": (_a = BC_FIELDS_INFO.find((f) => f.field === suggestion)) == null ? void 0 : _a.desc,
"aria-label-position": "right"
}
});
}
selectSuggestion(suggestion) {
const { context, plugin } = this;
if (!context)
return;
const field = BC_FIELDS_INFO.find((f) => f.field === suggestion);
const replacement = `${suggestion}${field == null ? void 0 : field[isInsideYaml() ? "afterYaml" : "afterInline"]}`;
context.editor.replaceRange(
replacement,
{ ch: 0, line: context.start.line },
context.end
);
}
};
// src/RelationSuggestor.ts
var import_obsidian21 = require("obsidian");
var RelationSuggestor = class extends import_obsidian21.EditorSuggest {
constructor(plugin) {
super(app);
this.getSuggestions = (context) => {
const { query } = context;
const { userHiers } = this.plugin.settings;
return getFields(userHiers).filter((sug) => sug.includes(query));
};
this.plugin = plugin;
}
onTrigger(cursor, editor, _) {
var _a;
const trig = this.plugin.settings.relSuggestorTrigger;
const sub = editor.getLine(cursor.line).substring(0, cursor.ch);
const regex = new RegExp(`.*?${escapeRegex(trig)}(.*)$`);
const match2 = (_a = regex.exec(sub)) == null ? void 0 : _a[1];
if (match2 === void 0)
return null;
return {
start: {
ch: sub.lastIndexOf(trig),
line: cursor.line
},
end: cursor,
query: match2
};
}
renderSuggestion(suggestion, el) {
el.createDiv({
text: suggestion,
cls: "codeblock-suggestion"
});
}
selectSuggestion(suggestion) {
const { context, plugin } = this;
if (!context)
return;
const trig = plugin.settings.relSuggestorTrigger;
const { start: start2, end, editor } = context;
const replacement = suggestion + (isInsideYaml() ? ": " : ":: ") + "[[";
editor.replaceRange(
replacement,
{ ch: start2.ch + 1 - trig.length, line: start2.line },
end
);
}
};
// src/Settings/BreadcrumbsSettingTab.ts
var import_obsidian40 = require("obsidian");
// src/Components/KoFi.svelte
function add_css9(target) {
append_styles(target, "svelte-1j4tt4j", ".BC-Kofi-button.svelte-1j4tt4j{margin-top:10px}");
}
function create_fragment11(ctx) {
let script;
let script_src_value;
let t;
let div;
let mounted;
let dispose;
return {
c() {
script = element("script");
t = space();
div = element("div");
attr(script, "type", "text/javascript");
if (!src_url_equal(script.src, script_src_value = "https://ko-fi.com/widgets/widget_2.js"))
attr(script, "src", script_src_value);
attr(div, "class", "BC-Kofi-button svelte-1j4tt4j");
},
m(target, anchor) {
append(document.head, script);
insert(target, t, anchor);
insert(target, div, anchor);
ctx[2](div);
if (!mounted) {
dispose = listen(
script,
"load",
/*initializeKofi*/
ctx[1]
);
mounted = true;
}
},
p: noop,
i: noop,
o: noop,
d(detaching) {
detach(script);
if (detaching)
detach(t);
if (detaching)
detach(div);
ctx[2](null);
mounted = false;
dispose();
}
};
}
function instance11($$self, $$props, $$invalidate) {
let button;
const initializeKofi = () => {
kofiwidget2.init("Support Breadcrumbs development!", "#29abe0", "G2G454TZF");
$$invalidate(0, button.innerHTML = kofiwidget2.getHTML(), button);
};
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
button = $$value;
$$invalidate(0, button);
});
}
return [button, initializeKofi, div_binding];
}
var KoFi = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance11, create_fragment11, safe_not_equal, {}, add_css9);
}
};
var KoFi_default = KoFi;
// src/Settings/CreateIndexSettings.ts
var import_obsidian22 = require("obsidian");
function addCreateIndexSettings(plugin, cmdsDetails) {
const { settings } = plugin;
const createIndexDetails = subDetails("Create Index", cmdsDetails);
new import_obsidian22.Setting(createIndexDetails).setName("Add wiklink brackets").setDesc(
fragWithHTML(
"When creating an index, should it wrap the note name in wikilinks [[]]
or not.\n\u2705 = yes, \u274C = no."
)
).addToggle(
(toggle) => toggle.setValue(settings.wikilinkIndex).onChange(async (value) => {
settings.wikilinkIndex = value;
await plugin.saveSettings();
})
);
new import_obsidian22.Setting(createIndexDetails).setName("Indent Character").setDesc(
fragWithHTML(
"The character(s) used to indent the index. These can be anything you want, but will usually be either spaces or tabs. Enter \\t
to use tabs."
)
).addText((text2) => {
text2.setValue(settings.createIndexIndent).onChange(async (value) => {
settings.createIndexIndent = value;
await plugin.saveSettings();
});
});
new import_obsidian22.Setting(createIndexDetails).setName("Show aliases of notes in index").setDesc("Show the aliases of each note in brackets.\n\u2705 = yes, \u274C = no.").addToggle(
(toggle) => toggle.setValue(settings.aliasesInIndex).onChange(async (value) => {
settings.aliasesInIndex = value;
await plugin.saveSettings();
})
);
}
// src/Settings/CSVSettings.ts
var import_obsidian23 = require("obsidian");
function addCSVSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const csvDetails = subDetails("CSV Notes", alternativeHierarchyDetails);
new import_obsidian23.Setting(csvDetails).setName("CSV Breadcrumb Paths").setDesc("The file path of a csv files with breadcrumbs information.").addText((text2) => {
text2.setValue(settings.CSVPaths);
text2.inputEl.onblur = async () => {
settings.CSVPaths = text2.inputEl.value;
await plugin.saveSettings();
};
});
}
// src/Settings/DataviewNoteSettings.ts
var import_obsidian24 = require("obsidian");
function addDataviewSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const { userHiers } = settings;
const fields = getFields(userHiers);
const dvDetails = subDetails("Dataview Notes", alternativeHierarchyDetails);
new import_obsidian24.Setting(dvDetails).setName("Default Dataview Note Field").setDesc(
fragWithHTML(
"By default, Dataview notes use the first field in your hierarchies (usually an \u2191
field). Choose a different one to use by default, without having to specify BC-dataview-note-field: {field}
.If you don't want to choose a default, select the blank option at the bottom of the list."
)
).addDropdown((dd) => {
fields.forEach((field) => dd.addOption(field, field));
dd.addOption("", "").setValue(settings.dataviewNoteField).onChange(async (field) => {
settings.dataviewNoteField = field;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Settings/DateNoteSettings.ts
var import_obsidian25 = require("obsidian");
function addDateNoteSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const { userHiers } = settings;
const fields = getFields(userHiers);
const fieldOptions = { "": "" };
fields.forEach((field) => fieldOptions[field] = field);
const dateNoteDetails = subDetails("Date Notes", alternativeHierarchyDetails);
new import_obsidian25.Setting(dateNoteDetails).setName("Add Date Notes to Graph").setDesc(
"Breadcrumbs will try to link each daily note to the next one using the date format you provide in the settings below."
).addToggle((toggle) => {
toggle.setValue(settings.addDateNotes).onChange(async (value) => {
settings.addDateNotes = value;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
new import_obsidian25.Setting(dateNoteDetails).setName("Daily Note Format").setDesc(
fragWithHTML(
`The Luxon date format of your daily notes.Note: Luxon uses different formats to Moment, so your format for the Daily Notes plugin may not work here. Be sure to check out the docs to find the right format.
You can escape characters by wrapping them in single quotes (e.g. yyyy-MM-dd 'Daily Note'
)`
)
).addText((text2) => {
text2.setValue(settings.dateNoteFormat);
text2.inputEl.onblur = async () => {
settings.dateNoteFormat = text2.getValue();
await plugin.saveSettings();
await refreshIndex(plugin);
};
});
new import_obsidian25.Setting(dateNoteDetails).setName("Date Note Field").setDesc(
fragWithHTML(
"Select a field to point to tomorrow's note from the current note. The opposite field will be used to point to yesterday's note."
)
).addDropdown((dd) => {
dd.addOptions(fieldOptions).setValue(settings.dateNoteField).onChange(async (field) => {
settings.dateNoteField = field;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Settings/DebuggingSettings.ts
var import_loglevel18 = __toESM(require_loglevel());
var import_obsidian26 = require("obsidian");
function addDebuggingsSettings(plugin, containerEl) {
const { settings } = plugin;
const debugDetails = details("Debugging", containerEl);
new import_obsidian26.Setting(debugDetails).setName("Debug Mode").setDesc(
fragWithHTML(
"Set the minimum level of debug messages to console log. If you choose TRACE
, then everything will be logged. If you choose ERROR
, then only the most necessary issues will be logged. SILENT
will turn off all logs."
)
).addDropdown((dd) => {
Object.keys(import_loglevel18.default.levels).forEach((key) => dd.addOption(key, key));
dd.setValue(settings.debugMode).onChange(async (value) => {
import_loglevel18.default.setLevel(value);
settings.debugMode = value;
await plugin.saveSettings();
});
});
debugDetails.createEl("button", { text: "Console log settings" }, (el) => {
el.addEventListener("click", () => console.log(settings));
});
}
// src/Settings/DendronSettings.ts
var import_obsidian27 = require("obsidian");
function addDendronSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const { userHiers } = settings;
const fields = getFields(userHiers);
const dendronDetails = subDetails(
"Dendron Notes",
alternativeHierarchyDetails
);
new import_obsidian27.Setting(dendronDetails).setName("Add Dendron notes to graph").setDesc(
fragWithHTML(
"Dendron notes create a hierarchy using note names.nmath.algebra
is a note about algebra, whose parent is math
.nmath.calculus.limits
is a note about limits whose parent is the note math.calculus
, the parent of which is math
."
)
).addToggle(
(toggle) => toggle.setValue(settings.addDendronNotes).onChange(async (value) => {
settings.addDendronNotes = value;
await plugin.saveSettings();
})
);
new import_obsidian27.Setting(dendronDetails).setName("Delimiter").setDesc(
fragWithHTML(
"Which delimiter should Breadcrumbs look for? The default is .
."
)
).addText((text2) => {
text2.setPlaceholder("Delimiter").setValue(settings.dendronNoteDelimiter);
text2.inputEl.onblur = async () => {
const value = text2.getValue();
if (value)
settings.dendronNoteDelimiter = value;
else {
new import_obsidian27.Notice(`The delimiter can't be blank`);
settings.dendronNoteDelimiter = DEFAULT_SETTINGS.dendronNoteDelimiter;
}
await plugin.saveSettings();
};
});
new import_obsidian27.Setting(dendronDetails).setName("Trim Dendron Note Names").setDesc(
fragWithHTML(
"When displaying a dendron note name, should it be trimmed to only show the last item in the chain?e.g. A.B.C
\u2192 C
."
)
).addToggle(
(toggle) => toggle.setValue(settings.trimDendronNotes).onChange(async (value) => {
settings.trimDendronNotes = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian27.Setting(dendronDetails).setName("Dendron Note Field").setDesc("Which field should Breadcrumbs use for Dendron notes?").addDropdown((dd) => {
fields.forEach((field) => dd.addOption(field, field));
dd.setValue(settings.dendronNoteField);
dd.onChange(async (value) => {
settings.dendronNoteField = value;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Settings/GeneralSettings.ts
var import_obsidian28 = require("obsidian");
function addGeneralSettings(plugin, containerEl) {
const { settings } = plugin;
const generalDetails = details("General Options", containerEl);
new import_obsidian28.Setting(generalDetails).setName("Refresh Index on Note Change").setDesc(
fragWithHTML(
"Refresh the Breadcrumbs index data everytime you change notes.Note: This can be very slow on large vaults."
)
).addToggle(
(toggle) => toggle.setValue(settings.refreshOnNoteChange).onChange(async (value) => {
settings.refreshOnNoteChange = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Refresh Index On Note Save").addToggle(
(toggle) => toggle.setValue(settings.refreshOnNoteSave).onChange(async (value) => {
settings.refreshOnNoteSave = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Show Refresh Index Notice").setDesc(
"When Refreshing Index, should it show a notice once the operation is complete?"
).addToggle(
(toggle) => toggle.setValue(settings.showRefreshNotice).onChange(async (value) => {
settings.showRefreshNotice = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Alias Fields").setDesc(
fragWithHTML(
"A comma-separated list of fields used to specify aliases. These fields will be checked, in order, to display an alternate note title in different views.This field will probably be alias
or aliases
, but it can be anything, like title
."
)
).addText((text2) => {
text2.setValue(settings.altLinkFields.join(", "));
text2.inputEl.onblur = async () => {
settings.altLinkFields = splitAndTrim(text2.getValue());
await plugin.saveSettings();
};
});
new import_obsidian28.Setting(generalDetails).setName("Only show first alias").setDesc(
"If a note has an alias (using the fields in the setting above), should only the first one be shown?"
).addToggle(
(toggle) => toggle.setValue(!settings.showAllAliases).onChange(async (value) => {
settings.showAllAliases = !value;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
new import_obsidian28.Setting(generalDetails).setName("Use yaml or inline fields for hierarchy data").setDesc(
"If enabled, Breadcrumbs will make it's hierarchy using yaml fields, and inline Dataview fields.\nIf this is disabled, it will only use Juggl links (See below)."
).addToggle(
(toggle) => toggle.setValue(settings.useAllMetadata).onChange(async (value) => {
settings.useAllMetadata = value;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
new import_obsidian28.Setting(generalDetails).setName("Use Juggl link syntax without having Juggl installed.").setDesc(
fragWithHTML(
`Should Breadcrumbs look for Juggl links even if you don't have Juggl installed? If you do have Juggl installed, it will always look for Juggl links.`
)
).addToggle(
(toggle) => toggle.setValue(settings.parseJugglLinksWithoutJuggl).onChange(async (value) => {
settings.parseJugglLinksWithoutJuggl = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Enable Field Suggestor").setDesc(
fragWithHTML(
"Alot of Breadcrumbs features require a metadata (or inline Dataview) field to work. For example, `BC-folder-note`.The Field Suggestor will show an autocomplete menu with all available Breadcrumbs field options when you type BC-
at the start of a line."
)
).addToggle(
(toggle) => toggle.setValue(settings.fieldSuggestor).onChange(async (value) => {
settings.fieldSuggestor = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Enable Relation Suggestor").setDesc(
fragWithHTML(
"Enable an editor suggestor which gets triggered by a custom string to show a list of relations from your hierarchies to insert."
)
).addToggle(
(toggle) => toggle.setValue(settings.enableRelationSuggestor).onChange(async (value) => {
settings.enableRelationSuggestor = value;
await plugin.saveSettings();
})
);
new import_obsidian28.Setting(generalDetails).setName("Relation Suggestor Trigger").setDesc(
fragWithHTML(
"The string used to trigger the relation suggestor. Default is \\
."
)
).addText(
(text2) => text2.setValue(settings.relSuggestorTrigger).onChange(async (value) => {
settings.relSuggestorTrigger = value;
await plugin.saveSettings();
})
);
if (app.plugins.plugins.dataview !== void 0) {
new import_obsidian28.Setting(generalDetails).setName("Dataview Wait Time").setDesc(
"Enter an integer number of seconds to wait for the Dataview Index to load. The larger your vault, the longer it will take. The default is 5 seconds."
).addText(
(text2) => text2.setPlaceholder("Seconds").setValue((settings.dvWaitTime / 1e3).toString()).onChange(async (value) => {
const num = Number(value);
if (num > 0) {
settings.dvWaitTime = num * 1e3;
await plugin.saveSettings();
} else {
new import_obsidian28.Notice("The interval must be a non-negative number");
}
})
);
}
}
// src/Settings/HierarchyNoteSettings.ts
var import_obsidian29 = require("obsidian");
function addHierarchyNoteSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const hierarchyNoteDetails = subDetails(
"Hierarchy Notes",
alternativeHierarchyDetails
);
new import_obsidian29.Setting(hierarchyNoteDetails).setName("Hierarchy Note(s)").setDesc(
fragWithHTML(
"A comma-separated list of notes used to create external Breadcrumb structures.
You can also point to a folder of hierarchy notes by entering folderName/
(ending with a /
).
Hierarchy note names and folders of hierarchy notes can both be entered in the same comma-separated list."
)
).addText((text2) => {
text2.setPlaceholder("Hierarchy Note(s)").setValue(settings.hierarchyNotes.join(", "));
text2.inputEl.onblur = async () => {
const splits = splitAndTrim(text2.getValue());
settings.hierarchyNotes = splits;
await plugin.saveSettings();
};
});
new import_obsidian29.Setting(hierarchyNoteDetails).setName("Hierarchy note is parent of top-level items").setDesc("Should the actual hierarchy note be treated as the parent of all the top-level items in the list? \u2705 = Yes, \u274C = No").addToggle((toggle) => {
toggle.setValue(settings.hierarchyNoteIsParent).onChange(async (value) => {
settings.hierarchyNoteIsParent = value;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
new import_obsidian29.Setting(hierarchyNoteDetails).setName("Default Hierarchy Note Field").setDesc(
fragWithHTML(
"By default, hierarchy notes use the first up
field in your hierarchies. Choose a different one to use by default. If you don't want to choose a default, select the blank option at the bottom of the list."
)
).addDropdown((dd) => {
const upFields = getFields(settings.userHiers, "up");
const options = {};
upFields.forEach(
(field) => options[field] = field
);
dd.addOptions(options).setValue(settings.HNUpField || upFields[0]).onChange(async (field) => {
settings.HNUpField = field;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Components/UserHierarchies.svelte
var import_obsidian30 = require("obsidian");
// node_modules/svelte-icons/components/IconBase.svelte
function add_css10(target) {
append_styles(target, "svelte-c8tyih", "svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}");
}
function create_if_block7(ctx) {
let title_1;
let t;
return {
c() {
title_1 = svg_element("title");
t = text(
/*title*/
ctx[0]
);
},
m(target, anchor) {
insert(target, title_1, anchor);
append(title_1, t);
},
p(ctx2, dirty) {
if (dirty & /*title*/
1)
set_data(
t,
/*title*/
ctx2[0]
);
},
d(detaching) {
if (detaching)
detach(title_1);
}
};
}
function create_fragment12(ctx) {
let svg;
let if_block_anchor;
let current;
let if_block = (
/*title*/
ctx[0] && create_if_block7(ctx)
);
const default_slot_template = (
/*#slots*/
ctx[3].default
);
const default_slot = create_slot(
default_slot_template,
ctx,
/*$$scope*/
ctx[2],
null
);
return {
c() {
svg = svg_element("svg");
if (if_block)
if_block.c();
if_block_anchor = empty();
if (default_slot)
default_slot.c();
attr(svg, "xmlns", "http://www.w3.org/2000/svg");
attr(
svg,
"viewBox",
/*viewBox*/
ctx[1]
);
attr(svg, "class", "svelte-c8tyih");
},
m(target, anchor) {
insert(target, svg, anchor);
if (if_block)
if_block.m(svg, null);
append(svg, if_block_anchor);
if (default_slot) {
default_slot.m(svg, null);
}
current = true;
},
p(ctx2, [dirty]) {
if (
/*title*/
ctx2[0]
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block7(ctx2);
if_block.c();
if_block.m(svg, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/
4)) {
update_slot_base(
default_slot,
default_slot_template,
ctx2,
/*$$scope*/
ctx2[2],
!current ? get_all_dirty_from_scope(
/*$$scope*/
ctx2[2]
) : get_slot_changes(
default_slot_template,
/*$$scope*/
ctx2[2],
dirty,
null
),
null
);
}
}
if (!current || dirty & /*viewBox*/
2) {
attr(
svg,
"viewBox",
/*viewBox*/
ctx2[1]
);
}
},
i(local) {
if (current)
return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (detaching)
detach(svg);
if (if_block)
if_block.d();
if (default_slot)
default_slot.d(detaching);
}
};
}
function instance12($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { title = null } = $$props;
let { viewBox } = $$props;
$$self.$$set = ($$props2) => {
if ("title" in $$props2)
$$invalidate(0, title = $$props2.title);
if ("viewBox" in $$props2)
$$invalidate(1, viewBox = $$props2.viewBox);
if ("$$scope" in $$props2)
$$invalidate(2, $$scope = $$props2.$$scope);
};
return [title, viewBox, $$scope, slots];
}
var IconBase = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance12, create_fragment12, safe_not_equal, { title: 0, viewBox: 1 }, add_css10);
}
};
var IconBase_default = IconBase;
// node_modules/svelte-icons/fa/FaListUl.svelte
function create_default_slot(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M48 48a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm448 16H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment13(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 512 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance13($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaListUl = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance13, create_fragment13, safe_not_equal, {});
}
};
var FaListUl_default = FaListUl;
// node_modules/svelte-icons/fa/FaPlus.svelte
function create_default_slot2(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment14(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 448 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot2] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance14($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaPlus = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance14, create_fragment14, safe_not_equal, {});
}
};
var FaPlus_default = FaPlus;
// node_modules/svelte-icons/fa/FaRegTrashAlt.svelte
function create_default_slot3(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M268 416h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12zM432 80h-82.41l-34-56.7A48 48 0 0 0 274.41 0H173.59a48 48 0 0 0-41.16 23.3L98.41 80H16A16 16 0 0 0 0 96v16a16 16 0 0 0 16 16h16v336a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128h16a16 16 0 0 0 16-16V96a16 16 0 0 0-16-16zM171.84 50.91A6 6 0 0 1 177 48h94a6 6 0 0 1 5.15 2.91L293.61 80H154.39zM368 464H80V128h288zm-212-48h24a12 12 0 0 0 12-12V188a12 12 0 0 0-12-12h-24a12 12 0 0 0-12 12v216a12 12 0 0 0 12 12z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment15(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 448 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot3] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance15($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaRegTrashAlt = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance15, create_fragment15, safe_not_equal, {});
}
};
var FaRegTrashAlt_default = FaRegTrashAlt;
// src/Components/UserHierarchies.svelte
function add_css11(target) {
append_styles(target, "svelte-1e9on6f", "label.BC-Arrow-Label.svelte-1e9on6f.svelte-1e9on6f{display:inline-block;width:20px !important}div.BC-Buttons.svelte-1e9on6f.svelte-1e9on6f{padding-bottom:5px}details.BC-Hier-Details.svelte-1e9on6f.svelte-1e9on6f{border:1px solid var(--background-modifier-border);border-radius:10px;padding:10px 5px 10px 10px;margin-bottom:15px}.BC-Hier-Details.svelte-1e9on6f summary.svelte-1e9on6f::marker{font-size:10px}.BC-Hier-Details.svelte-1e9on6f summary button.svelte-1e9on6f{float:right}.icon.svelte-1e9on6f.svelte-1e9on6f{color:var(--text-normal);display:inline-block;padding-top:3px;width:17px;height:17px}");
}
function get_each_context6(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[13] = list[i];
child_ctx[15] = i;
return child_ctx;
}
function get_each_context_15(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[16] = list[i];
return child_ctx;
}
function create_each_block_15(ctx) {
let div;
let label;
let t0_value = ARROW_DIRECTIONS[
/*dir*/
ctx[16]
] + "";
let t0;
let label_for_value;
let t1;
let input;
let input_name_value;
let input_value_value;
let mounted;
let dispose;
function change_handler(...args) {
return (
/*change_handler*/
ctx[11](
/*i*/
ctx[15],
/*dir*/
ctx[16],
...args
)
);
}
return {
c() {
var _a, _b;
div = element("div");
label = element("label");
t0 = text(t0_value);
t1 = space();
input = element("input");
attr(label, "class", "BC-Arrow-Label svelte-1e9on6f");
attr(label, "for", label_for_value = /*dir*/
ctx[16]);
attr(input, "type", "text");
attr(input, "size", "20");
attr(input, "name", input_name_value = /*dir*/
ctx[16]);
input.value = input_value_value = /*hier*/
(_b = (_a = ctx[13][
/*dir*/
ctx[16]
]) == null ? void 0 : _a.join(", ")) != null ? _b : "";
},
m(target, anchor) {
insert(target, div, anchor);
append(div, label);
append(label, t0);
append(div, t1);
append(div, input);
if (!mounted) {
dispose = listen(input, "change", change_handler);
mounted = true;
}
},
p(new_ctx, dirty) {
var _a, _b;
ctx = new_ctx;
if (dirty & /*currHiers*/
2 && input_value_value !== (input_value_value = /*hier*/
(_b = (_a = ctx[13][
/*dir*/
ctx[16]
]) == null ? void 0 : _a.join(", ")) != null ? _b : "") && input.value !== input_value_value) {
input.value = input_value_value;
}
},
d(detaching) {
if (detaching)
detach(div);
mounted = false;
dispose();
}
};
}
function create_each_block6(ctx) {
let details2;
let summary;
let t0_value = DIRECTIONS.map(func).map(func_1).join(" ") + "";
let t0;
let t1;
let span;
let button0;
let t3;
let button1;
let t5;
let button2;
let t7;
let t8;
let mounted;
let dispose;
function func(...args) {
return (
/*func*/
ctx[7](
/*hier*/
ctx[13],
...args
)
);
}
function click_handler_3() {
return (
/*click_handler_3*/
ctx[8](
/*i*/
ctx[15]
)
);
}
function click_handler_4() {
return (
/*click_handler_4*/
ctx[9](
/*i*/
ctx[15]
)
);
}
function click_handler_5() {
return (
/*click_handler_5*/
ctx[10](
/*i*/
ctx[15]
)
);
}
let each_value_1 = DIRECTIONS;
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_15(get_each_context_15(ctx, each_value_1, i));
}
return {
c() {
details2 = element("details");
summary = element("summary");
t0 = text(t0_value);
t1 = space();
span = element("span");
button0 = element("button");
button0.textContent = "\u2191";
t3 = space();
button1 = element("button");
button1.textContent = "\u2193";
t5 = space();
button2 = element("button");
button2.textContent = "X";
t7 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t8 = space();
attr(button0, "aria-label", "Swap with Hierarchy Above");
attr(button0, "class", "svelte-1e9on6f");
attr(button1, "aria-label", "Swap with Hierarchy Below");
attr(button1, "class", "svelte-1e9on6f");
attr(button2, "aria-label", "Remove Hierarchy");
attr(button2, "class", "svelte-1e9on6f");
attr(span, "class", "BC-Buttons");
attr(summary, "class", "svelte-1e9on6f");
attr(details2, "class", "BC-Hier-Details svelte-1e9on6f");
},
m(target, anchor) {
insert(target, details2, anchor);
append(details2, summary);
append(summary, t0);
append(summary, t1);
append(summary, span);
append(span, button0);
append(span, t3);
append(span, button1);
append(span, t5);
append(span, button2);
append(details2, t7);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(details2, null);
}
}
append(details2, t8);
if (!mounted) {
dispose = [
listen(button0, "click", click_handler_3),
listen(button1, "click", click_handler_4),
listen(button2, "click", click_handler_5)
];
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*currHiers*/
2 && t0_value !== (t0_value = DIRECTIONS.map(func).map(func_1).join(" ") + ""))
set_data(t0, t0_value);
if (dirty & /*DIRECTIONS, currHiers, splitAndTrim, update, settings, plugin, ARROW_DIRECTIONS*/
15) {
each_value_1 = DIRECTIONS;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_15(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_15(child_ctx);
each_blocks[i].c();
each_blocks[i].m(details2, t8);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
},
d(detaching) {
if (detaching)
detach(details2);
destroy_each(each_blocks, detaching);
mounted = false;
run_all(dispose);
}
};
}
function create_fragment16(ctx) {
let div4;
let div3;
let button0;
let div0;
let faplus;
let t0;
let button1;
let div1;
let faregtrashalt;
let t1;
let button2;
let div2;
let falistul;
let t2;
let current;
let mounted;
let dispose;
faplus = new FaPlus_default({});
faregtrashalt = new FaRegTrashAlt_default({});
falistul = new FaListUl_default({});
let each_value = (
/*currHiers*/
ctx[1]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block6(get_each_context6(ctx, each_value, i));
}
return {
c() {
div4 = element("div");
div3 = element("div");
button0 = element("button");
div0 = element("div");
create_component(faplus.$$.fragment);
t0 = space();
button1 = element("button");
div1 = element("div");
create_component(faregtrashalt.$$.fragment);
t1 = space();
button2 = element("button");
div2 = element("div");
create_component(falistul.$$.fragment);
t2 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(div0, "class", "icon svelte-1e9on6f");
attr(button0, "aria-label", "Add New Hierarchy");
attr(div1, "class", "icon svelte-1e9on6f");
attr(button1, "aria-label", "Reset All Hierarchies");
attr(div2, "class", "icon svelte-1e9on6f");
attr(button2, "aria-label", "Show Hierarchies");
attr(div3, "class", "BC-Buttons svelte-1e9on6f");
},
m(target, anchor) {
insert(target, div4, anchor);
append(div4, div3);
append(div3, button0);
append(button0, div0);
mount_component(faplus, div0, null);
append(div3, t0);
append(div3, button1);
append(button1, div1);
mount_component(faregtrashalt, div1, null);
append(div3, t1);
append(div3, button2);
append(button2, div2);
mount_component(falistul, div2, null);
append(div4, t2);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div4, null);
}
}
current = true;
if (!mounted) {
dispose = [
listen(
button0,
"click",
/*click_handler*/
ctx[4]
),
listen(
button1,
"click",
/*click_handler_1*/
ctx[5]
),
listen(
button2,
"click",
/*click_handler_2*/
ctx[6]
)
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & /*DIRECTIONS, currHiers, splitAndTrim, update, settings, plugin, ARROW_DIRECTIONS, swapItems*/
15) {
each_value = /*currHiers*/
ctx2[1];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context6(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block6(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div4, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i(local) {
if (current)
return;
transition_in(faplus.$$.fragment, local);
transition_in(faregtrashalt.$$.fragment, local);
transition_in(falistul.$$.fragment, local);
current = true;
},
o(local) {
transition_out(faplus.$$.fragment, local);
transition_out(faregtrashalt.$$.fragment, local);
transition_out(falistul.$$.fragment, local);
current = false;
},
d(detaching) {
if (detaching)
detach(div4);
destroy_component(faplus);
destroy_component(faregtrashalt);
destroy_component(falistul);
destroy_each(each_blocks, detaching);
mounted = false;
run_all(dispose);
}
};
}
var func_1 = (dirFields) => `(${dirFields})`;
function instance16($$self, $$props, $$invalidate) {
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
;
;
let { plugin } = $$props;
const { settings } = plugin;
let currHiers = [...plugin.settings.userHiers];
function update2(currHiers2) {
return __awaiter(this, void 0, void 0, function* () {
$$invalidate(0, plugin.settings.userHiers = currHiers2, plugin);
yield plugin.saveSettings();
});
}
const click_handler = async () => $$invalidate(1, currHiers = [...currHiers, blankUserHier()]);
const click_handler_1 = async () => {
if (window.confirm("Are you sure you want to reset all hierarchies?")) {
$$invalidate(1, currHiers = []);
await update2(currHiers);
}
};
const click_handler_2 = () => new import_obsidian30.Notice(currHiers.map(hierToStr).join("\n\n"));
const func = (hier, dir) => {
var _a, _b;
return (_b = (_a = hier[dir]) == null ? void 0 : _a.join(", ")) != null ? _b : "";
};
const click_handler_3 = async (i) => {
$$invalidate(1, currHiers = swapItems(i, i - 1, currHiers));
await update2(currHiers);
};
const click_handler_4 = async (i) => {
$$invalidate(1, currHiers = swapItems(i, i + 1, currHiers));
await update2(currHiers);
};
const click_handler_5 = async (i) => {
const oldHier = currHiers.splice(i, 1)[0];
oldHier.up.forEach((upField) => {
const index2 = settings.limitTrailCheckboxes.indexOf(upField);
if (index2 > -1)
settings.limitTrailCheckboxes.splice(index2, 1);
});
DIRECTIONS.forEach((dir) => {
oldHier[dir].forEach((field) => {
const indexI = settings.limitJumpToFirstFields.indexOf(field);
if (indexI > -1)
settings.limitJumpToFirstFields.splice(indexI, 1);
const indexJ = settings.limitWriteBCCheckboxes.indexOf(field);
if (indexJ > -1)
settings.limitJumpToFirstFields.splice(indexJ, 1);
});
});
$$invalidate(1, currHiers);
await update2(currHiers);
};
const change_handler = async (i, dir, e) => {
const { value } = e.target;
const splits = splitAndTrim(value);
$$invalidate(1, currHiers[i][dir] = splits, currHiers);
await update2(currHiers);
splits.forEach((split) => {
if (dir === "up" && !settings.limitTrailCheckboxes.includes(split))
settings.limitTrailCheckboxes.push(split);
if (!settings.limitJumpToFirstFields.includes(split))
settings.limitJumpToFirstFields.push(split);
if (!settings.limitWriteBCCheckboxes.includes(split))
settings.limitWriteBCCheckboxes.push(split);
});
await plugin.saveSettings();
};
$$self.$$set = ($$props2) => {
if ("plugin" in $$props2)
$$invalidate(0, plugin = $$props2.plugin);
};
return [
plugin,
currHiers,
settings,
update2,
click_handler,
click_handler_1,
click_handler_2,
func,
click_handler_3,
click_handler_4,
click_handler_5,
change_handler
];
}
var UserHierarchies = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance16, create_fragment16, safe_not_equal, { plugin: 0 }, add_css11);
}
};
var UserHierarchies_default = UserHierarchies;
// src/Settings/HierarchySettings.ts
function addHierarchySettings(plugin, containerEl) {
const fieldDetails = details("Hierarchies", containerEl);
fieldDetails.createEl("p", {
text: "Here you can set up different hierarchies you use in your vault. To add a new hierarchy, click the plus button. Then, fill in the field names of your hierachy into the 5 boxes that appear."
});
fieldDetails.createEl("p", {
text: "For each direction, you can enter multiple field names in a comma-seperated list. For example: `parent, broader, upper`"
});
new UserHierarchies_default({
target: fieldDetails,
props: { plugin }
});
}
// src/Components/Checkboxes.svelte
var import_loglevel19 = __toESM(require_loglevel());
function add_css12(target) {
append_styles(target, "svelte-d1my4i", ".grid.svelte-d1my4i{display:grid;grid-template-columns:repeat(auto-fit, minmax(100px, 1fr))}");
}
function get_each_context7(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[12] = list[i];
return child_ctx;
}
function create_each_block7(ctx) {
let div;
let label;
let input;
let input_value_value;
let value_has_changed = false;
let t0;
let t1_value = (
/*option*/
ctx[12] + ""
);
let t1;
let t2;
let binding_group;
let mounted;
let dispose;
binding_group = init_binding_group(
/*$$binding_groups*/
ctx[8][0]
);
return {
c() {
div = element("div");
label = element("label");
input = element("input");
t0 = space();
t1 = text(t1_value);
t2 = space();
attr(input, "type", "checkbox");
input.__value = input_value_value = /*option*/
ctx[12];
input.value = input.__value;
binding_group.p(input);
},
m(target, anchor) {
insert(target, div, anchor);
append(div, label);
append(label, input);
input.checked = ~/*selected*/
(ctx[1] || []).indexOf(input.__value);
append(label, t0);
append(label, t1);
append(div, t2);
if (!mounted) {
dispose = [
listen(
input,
"change",
/*input_change_handler*/
ctx[7]
),
listen(
input,
"change",
/*change_handler*/
ctx[9]
)
];
mounted = true;
}
},
p(ctx2, dirty) {
if (dirty & /*options*/
1 && input_value_value !== (input_value_value = /*option*/
ctx2[12])) {
input.__value = input_value_value;
input.value = input.__value;
value_has_changed = true;
}
if (value_has_changed || dirty & /*selected, options*/
3) {
input.checked = ~/*selected*/
(ctx2[1] || []).indexOf(input.__value);
}
if (dirty & /*options*/
1 && t1_value !== (t1_value = /*option*/
ctx2[12] + ""))
set_data(t1, t1_value);
},
d(detaching) {
if (detaching)
detach(div);
binding_group.r();
mounted = false;
run_all(dispose);
}
};
}
function create_fragment17(ctx) {
let div0;
let button;
let t0;
let t1_value = (
/*toNone*/
ctx[2] ? "None" : "All"
);
let t1;
let t2;
let div1;
let mounted;
let dispose;
let each_value = (
/*options*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block7(get_each_context7(ctx, each_value, i));
}
return {
c() {
div0 = element("div");
button = element("button");
t0 = text("Select ");
t1 = text(t1_value);
t2 = space();
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(div1, "class", "grid svelte-d1my4i");
},
m(target, anchor) {
insert(target, div0, anchor);
append(div0, button);
append(button, t0);
append(button, t1);
insert(target, t2, anchor);
insert(target, div1, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div1, null);
}
}
if (!mounted) {
dispose = listen(
button,
"click",
/*click_handler*/
ctx[6]
);
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & /*toNone*/
4 && t1_value !== (t1_value = /*toNone*/
ctx2[2] ? "None" : "All"))
set_data(t1, t1_value);
if (dirty & /*options, selected, save*/
11) {
each_value = /*options*/
ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context7(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block7(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div1, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching)
detach(div0);
if (detaching)
detach(t2);
if (detaching)
detach(div1);
destroy_each(each_blocks, detaching);
mounted = false;
dispose();
}
};
}
function instance17($$self, $$props, $$invalidate) {
let toNone;
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
;
let { plugin } = $$props;
let { settingName } = $$props;
let { options } = $$props;
const { settings } = plugin;
let selected = settings[settingName];
function save() {
return __awaiter(this, void 0, void 0, function* () {
if (settings[settingName] === void 0)
return (0, import_loglevel19.warn)(settingName + " not found in BC settings");
settings[settingName] = selected;
yield plugin.saveSettings();
yield refreshIndex(plugin);
});
}
const $$binding_groups = [[]];
const click_handler = async () => {
if (toNone)
$$invalidate(1, selected = []);
else
$$invalidate(1, selected = options);
await save();
};
function input_change_handler() {
selected = get_binding_group_value($$binding_groups[0], this.__value, this.checked);
$$invalidate(1, selected);
}
const change_handler = async () => await save();
$$self.$$set = ($$props2) => {
if ("plugin" in $$props2)
$$invalidate(4, plugin = $$props2.plugin);
if ("settingName" in $$props2)
$$invalidate(5, settingName = $$props2.settingName);
if ("options" in $$props2)
$$invalidate(0, options = $$props2.options);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*selected*/
2) {
$:
$$invalidate(2, toNone = selected.length === 0 ? false : true);
}
};
return [
options,
selected,
toNone,
save,
plugin,
settingName,
click_handler,
input_change_handler,
$$binding_groups,
change_handler
];
}
var Checkboxes = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance17, create_fragment17, safe_not_equal, { plugin: 4, settingName: 5, options: 0 }, add_css12);
}
};
var Checkboxes_default = Checkboxes;
// src/Settings/JumpToNextSettings.ts
function addJumpToNextSettings(plugin, viewDetails) {
const { settings } = plugin;
const jumpToDirDetails = subDetails("Jump to Next Direction", viewDetails);
jumpToDirDetails.createDiv({ cls: "setting-item-name", text: "Limit which fields to jump to" });
new Checkboxes_default({
target: jumpToDirDetails,
props: {
plugin,
settingName: "limitJumpToFirstFields",
options: getFields(settings.userHiers)
}
});
}
// src/Settings/MatrixViewSettings.ts
var import_obsidian31 = require("obsidian");
function addMatrixViewSettings(plugin, viewDetails) {
const { settings } = plugin;
const MLViewDetails = subDetails("Matrix View", viewDetails);
new import_obsidian31.Setting(MLViewDetails).setName("Show all field names or just relation types").setDesc(
fragWithHTML(
"Show the list of metadata fields for each relation type (e.g. parent, broader, upper
), or just the name of the relation type, i.e. 'Parent
', 'Sibling
', 'Child
'.\u2705 = show the full list."
)
).addToggle(
(toggle) => toggle.setValue(settings.showNameOrType).onChange(async (value) => {
settings.showNameOrType = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Show Relationship Type").setDesc(
fragWithHTML(
"Show whether a link is real or implied."
)
).addToggle(
(toggle) => toggle.setValue(settings.showRelationType).onChange(async (value) => {
settings.showRelationType = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Directions Order").setDesc(
fragWithHTML(
`Change the order in which the directions appear in the Matrix view.The default is "up, same, down, next, prev" (01234
).
- 0 \u2192 up
- 1 \u2192 same
- 2 \u2192 down
- 3 \u2192 next
- 4 \u2192 prev
Note: You can remove numbers to hide those directions in the Matrix View. For example, 02
will only show up and down, in that order.`
)
).addText((text2) => {
text2.setValue(settings.squareDirectionsOrder.join(""));
text2.inputEl.onblur = async () => {
const value = text2.getValue();
const values = value.split("");
if (value.length <= 5 && values.every((value2) => ["0", "1", "2", "3", "4"].includes(value2))) {
settings.squareDirectionsOrder = values.map(
(order) => Number.parseInt(order)
);
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
} else {
new import_obsidian31.Notice(
'The value must be a 5 digit number using only the digits "0", "1", "2", "3", "4"'
);
}
};
});
new import_obsidian31.Setting(MLViewDetails).setName("Enable Alphabetical Sorting").setDesc(
"By default, items in the Matrix view are sorted by the order they appear in your notes. Toggle this on to enable alphabetical sorting."
).addToggle(
(toggle) => toggle.setValue(settings.enableAlphaSort).onChange(async (value) => {
settings.enableAlphaSort = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Sort Alphabetically Ascending/Descending").setDesc(
"Sort square items alphabetically in Ascending (\u2705) or Descending (\u274C) order."
).addToggle(
(toggle) => toggle.setValue(settings.alphaSortAsc).onChange(async (value) => {
settings.alphaSortAsc = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Sort by note name, but show alias").setDesc(
"When this is turned off, notes will first be sorted by their alias, and then by their name if no alias is found. Turn this on to sort by note name always, but still show the alias in the results."
).addToggle(
(toggle) => toggle.setValue(settings.sortByNameShowAlias).onChange(async (value) => {
settings.sortByNameShowAlias = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Show Implied Relations").setDesc("Whether or not to show implied relations at all.").addToggle(
(toggle) => toggle.setValue(settings.showImpliedRelations).onChange(async (value) => {
settings.showImpliedRelations = value;
await plugin.saveSettings();
await plugin.getActiveTYPEView(MATRIX_VIEW).draw();
})
);
new import_obsidian31.Setting(MLViewDetails).setName("Open View in Right or Left side").setDesc(
"When loading the matrix view, should it open on the left or right side leaf? \u2705 = Right, \u274C = Left."
).addToggle(
(toggle) => toggle.setValue(settings.rlLeaf).onChange(async (value) => {
settings.rlLeaf = value;
await plugin.saveSettings();
app.workspace.detachLeavesOfType(MATRIX_VIEW);
await openView(
MATRIX_VIEW,
MatrixView,
value ? "right" : "left"
);
})
);
}
// src/Settings/NoSystemSettings.ts
var import_obsidian32 = require("obsidian");
function addNoSystemSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const { userHiers } = settings;
const fields = getFields(userHiers);
const noSystemDetails = subDetails(
"Naming System",
alternativeHierarchyDetails
);
new import_obsidian32.Setting(noSystemDetails).setName("Naming System Regex").setDesc(
fragWithHTML(
"If you name your notes using the Johnny Decimal System or a related system, enter a regular expression matching the longest possible naming system you use. The regex should only match the naming system part of the name, not the actual note title. For example, if you use the Johnny Decimal System, you might use /^\\d\\.\\d\\.\\w/g
to match the note named 1.2.a Cars
.If you don't want to choose a default, select the blank option at the bottom of the list."
)
).addText((text2) => {
text2.setValue(settings.namingSystemRegex);
text2.inputEl.onblur = async () => {
const value = text2.getValue();
if (value === "" || strToRegex(value)) {
settings.namingSystemRegex = value;
await plugin.saveSettings();
await refreshIndex(plugin);
} else {
new import_obsidian32.Notice("Invalid Regex");
}
};
});
new import_obsidian32.Setting(noSystemDetails).setName("Naming System Delimiter").setDesc(
fragWithHTML(
"What character do you use to split up your naming convention? For example, if you use 1.2.a.b
, then your delimiter is a period (.
)."
)
).addText((text2) => {
text2.setValue(settings.namingSystemSplit);
text2.inputEl.onblur = async () => {
const value = text2.getValue();
settings.namingSystemSplit = value;
await plugin.saveSettings();
await refreshIndex(plugin);
};
});
new import_obsidian32.Setting(noSystemDetails).setName("Naming System Field").setDesc("Which field should Breadcrumbs use for Naming System notes?").addDropdown((dd) => {
fields.forEach((field) => {
dd.addOption(field, field);
});
dd.setValue(settings.namingSystemField);
dd.onChange(async (value) => {
settings.namingSystemField = value;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
new import_obsidian32.Setting(noSystemDetails).setName("Naming System Ends with Delimiter").setDesc(
fragWithHTML(
"Does your naming convention end with the delimiter? For example, 1.2. Note
does end with the delimiter, but 1.2 Note
does not.For matching purposes, it is highly recommended to name your notes with the delimiter on the end. Only turn this setting on if you do name your notes this way, but know that the results may not be as accurate if you don't."
)
).addToggle(
(tog) => tog.setValue(settings.namingSystemEndsWithDelimiter).onChange(async (value) => {
settings.namingSystemEndsWithDelimiter = value;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
}
// src/Settings/RegexNoteSettings.ts
var import_obsidian33 = require("obsidian");
function addRegexNoteSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const regexNoteDetails = subDetails(
"Regex Notes",
alternativeHierarchyDetails
);
new import_obsidian33.Setting(regexNoteDetails).setName("Default Regex Note Field").setDesc(
fragWithHTML(
"By default, regex notes use the first field in your hierarchies (usually an \u2191
field). Choose a different one to use by default, without having to specify BC-regex-note-field: {field}
.If you don't want to choose a default, select the blank option at the bottom of the list."
)
).addDropdown((dd) => {
const options = {};
getFields(settings.userHiers).forEach(
(field) => options[field] = field
);
dd.addOptions(Object.assign(options, { "": "" })).setValue(settings.regexNoteField).onChange(async (field) => {
settings.regexNoteField = field;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Settings/RelationSettings.ts
var import_obsidian34 = require("obsidian");
function addRelationSettings(plugin, containerEl) {
const { settings } = plugin;
const relationDetails = details("Relationships", containerEl);
function mermaidDiagram(diagramStr) {
import_obsidian34.MarkdownRenderer.renderMarkdown(
diagramStr,
relationDetails.createDiv(),
"",
null
);
}
relationDetails.createEl("p", {
text: "Here you can toggle on/off different types of implied relationships. All of your explicit (real) relationships will still show, but you can choose which implied ones get filled in.\nAll implied relationships are given a CSS class of the type of implied relation, so you can style them differently. For example `.BC-Aunt`."
});
new import_obsidian34.Setting(relationDetails).setName("Same Parent is Siblings").setDesc("If one note shares a parent with another, treat them as siblings").addToggle(
(tg) => tg.setValue(settings.impliedRelations.sameParentIsSibling).onChange(async (val) => {
settings.impliedRelations.sameParentIsSibling = val;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
mermaidDiagram("```mermaid\nflowchart LR\nMe -->|up| Dad\nSister -->|up| Dad\nMe <-.->|same| Sister\n```");
new import_obsidian34.Setting(relationDetails).setName("Siblings' Siblings").setDesc("Treat your siblings' siblings as your siblings").addToggle(
(tg) => tg.setValue(settings.impliedRelations.siblingsSiblingIsSibling).onChange(async (val) => {
settings.impliedRelations.siblingsSiblingIsSibling = val;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
mermaidDiagram("```mermaid\nflowchart LR\nMe -->|same| Sister\nMe -->|same| Brother\nSister <-.->|same| Brother\n```");
new import_obsidian34.Setting(relationDetails).setName("Siblings' Parent is Parent").setDesc("Your siblings' parents are your parents").addToggle(
(tg) => tg.setValue(settings.impliedRelations.siblingsParentIsParent).onChange(async (val) => {
settings.impliedRelations.siblingsParentIsParent = val;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
mermaidDiagram("```mermaid\nflowchart LR\nSister -->|up| Dad\nSister <-->|same| Me\nMe -.->|up| Dad\n```");
new import_obsidian34.Setting(relationDetails).setName("Aunt/Uncle").setDesc("Treat your parent's siblings as your parents (aunts/uncles)").addToggle(
(tg) => tg.setValue(settings.impliedRelations.parentsSiblingsIsParents).onChange(async (val) => {
settings.impliedRelations.parentsSiblingsIsParents = val;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
mermaidDiagram("```mermaid\nflowchart LR\nMe -->|up| Dad\nDad -->|same| Uncle\nMe -.->|up| Uncle\n```");
new import_obsidian34.Setting(relationDetails).setName("Cousins").setDesc(
"Treat the cousins of a note as siblings (parents' siblings' children are cousins)"
).addToggle(
(tg) => tg.setValue(settings.impliedRelations.cousinsIsSibling).onChange(async (val) => {
settings.impliedRelations.cousinsIsSibling = val;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
mermaidDiagram("```mermaid\nflowchart LR\nMe -->|up| Dad\nDad -->|same| Uncle\nUncle -->|down| Cousin\nMe <-.->|same| Cousin\n```");
new import_obsidian34.Setting(relationDetails).setName("Make Current Note an Implied Sibling").setDesc(
"Techincally, the current note is always it's own implied sibling. By default, it is not show as such. Toggle this on to make it show."
).addToggle(
(toggle) => toggle.setValue(settings.treatCurrNodeAsImpliedSibling).onChange(async (value) => {
settings.treatCurrNodeAsImpliedSibling = value;
await plugin.saveSettings();
await refreshIndex(plugin);
})
);
}
// src/Settings/TagNoteSettings.ts
var import_obsidian35 = require("obsidian");
function addTagNoteSettings(plugin, alternativeHierarchyDetails) {
const { settings } = plugin;
const tagNoteDetails = subDetails("Tag Notes", alternativeHierarchyDetails);
new import_obsidian35.Setting(tagNoteDetails).setName("Default Tag Note Field").setDesc(
fragWithHTML(
"By default, tag notes use the first field in your hierarchies (usually an \u2191
field). Choose a different one to use by default, without having to specify BC-tag-note-field: {field}
.If you don't want to choose a default, select the blank option at the bottom of the list."
)
).addDropdown((dd) => {
const options = {};
getFields(settings.userHiers).forEach(
(field) => options[field] = field
);
dd.addOptions(Object.assign(options, { "": "" })).setValue(settings.tagNoteField).onChange(async (field) => {
settings.tagNoteField = field;
await plugin.saveSettings();
await refreshIndex(plugin);
});
});
}
// src/Settings/ThreadingSettings.ts
var import_obsidian36 = require("obsidian");
function addThreadingSettings(plugin, cmdsDetails) {
const { settings } = plugin;
const threadingDetails = subDetails("Threading", cmdsDetails);
threadingDetails.createDiv({
text: "Settings for the commands `Create new from current note`"
});
new import_obsidian36.Setting(threadingDetails).setName("Open new threads in new pane or current pane").addToggle((tog) => {
tog.setValue(settings.threadIntoNewPane);
tog.onChange(async (value) => {
settings.threadIntoNewPane = value;
await plugin.saveSettings();
});
});
new import_obsidian36.Setting(threadingDetails).setName("Thread under Cursor").setDesc(
fragWithHTML(
"If the setting Write Breadcrumbs Inline
is enabled, where should the new Breadcrumb be added to the current note? \u2705 = Under the cursor, \u274C = At the top of the note (under the yaml, if applicable)"
)
).addToggle((tog) => {
tog.setValue(settings.threadUnderCursor);
tog.onChange(async (value) => {
settings.threadUnderCursor = value;
await plugin.saveSettings();
});
});
new import_obsidian36.Setting(threadingDetails).setName("New Note Name Template").setDesc(
fragWithHTML(
`When threading into a new note, choose the template for the new note name.
Options include:
{{field}}
: the field being thread into
{{dir}}
: the direction being thread into
{{current}}
: the current note name
{{date}}
: the current date (Set the format in the setting below)
`
)
).addText((text2) => {
text2.setValue(settings.threadingTemplate);
text2.inputEl.onblur = async () => {
const value = text2.getValue();
if (ILLEGAL_FILENAME_CHARS.some((char) => value.includes(char))) {
new import_obsidian36.Notice(
`File name cannot contain any of these characters: ${ILLEGAL_FILENAME_CHARS.join(
" "
)}`
);
text2.setValue(settings.threadingTemplate);
} else {
settings.threadingTemplate = value;
await plugin.saveSettings();
}
};
});
new import_obsidian36.Setting(threadingDetails).setName("Date Format").setDesc("The date format used in the Threading Template (setting above)").addMomentFormat((format2) => {
format2.setDefaultFormat(DEFAULT_SETTINGS.dateFormat).setValue(settings.dateFormat).onChange(async (value) => {
settings.dateFormat = value;
await plugin.saveSettings();
});
});
const threadDirTemplatesSetting = new import_obsidian36.Setting(threadingDetails).setClass("thread-dir-templates").setName("Templater Template per Direction").setDesc(
fragWithHTML(
`For each direction to be thread into, choose a Templater template to insert into the new note.
Give the basename, or the full file path (e.g. Templates/Parent Template
).`
)
);
DIRECTIONS.forEach(
(dir) => threadDirTemplatesSetting.addText((text2) => {
text2.setPlaceholder(ARROW_DIRECTIONS[dir]).setValue(settings.threadingDirTemplates[dir]);
text2.inputEl.onblur = async () => {
settings.threadingDirTemplates[dir] = text2.getValue();
await plugin.saveSettings();
};
})
);
}
// src/Settings/TrailSettings.ts
var import_obsidian37 = require("obsidian");
function addTrailViewSettings(plugin, viewDetails) {
const { settings } = plugin;
const trailDetails = subDetails("Trail/Grid/Juggl", viewDetails);
new import_obsidian37.Setting(trailDetails).setName("Show Breadcrumbs in Edit/Live-Preview Mode").setDesc(
"It always shows in preview mode, but should it also show in the other two?"
).addToggle(
(toggle) => toggle.setValue(settings.showBCsInEditLPMode).onChange(async (value) => {
settings.showBCsInEditLPMode = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
);
trailDetails.createEl("hr");
trailDetails.createDiv({
cls: "setting-item-name",
text: "Limit Trail View to only show certain fields"
});
new Checkboxes_default({
target: trailDetails,
props: {
plugin,
settingName: "limitTrailCheckboxes",
options: getFields(settings.userHiers, "up")
}
});
const viewsToShow = new import_obsidian37.Setting(trailDetails).setName("Views to show").setDesc(
"Choose which of the views to show at the top of the note. Juggl View requires the Juggl plugin."
).addToggle((toggle) => {
toggle.setTooltip("Trail view").setValue(settings.showTrail).onChange(async (value) => {
settings.showTrail = value;
await plugin.saveSettings();
await drawTrail(plugin);
});
}).addToggle((toggle) => {
toggle.setTooltip("Grid view").setValue(settings.showGrid).onChange(async (value) => {
settings.showGrid = value;
await plugin.saveSettings();
await drawTrail(plugin);
});
}).addToggle((toggle) => {
toggle.setTooltip("Next/Previous view").setValue(settings.showPrevNext).onChange(async (value) => {
settings.showPrevNext = value;
await plugin.saveSettings();
await drawTrail(plugin);
});
});
if (app.plugins.plugins.juggl !== void 0) {
viewsToShow.addToggle((toggle) => {
toggle.setTooltip("Juggl view").setValue(settings.showJuggl).onChange(async (value) => {
settings.showJuggl = value;
await plugin.saveSettings();
await drawTrail(plugin);
});
});
}
new import_obsidian37.Setting(trailDetails).setName("Grid view depth").setDesc("Limit the initial depth of the grid view").addSlider((slider) => {
slider.setLimits(0, 25, 1).setValue(settings.gridDefaultDepth).setDynamicTooltip();
slider.sliderEl.onblur = async () => {
settings.gridDefaultDepth = slider.getValue();
await plugin.saveSettings();
await drawTrail(plugin);
};
});
new import_obsidian37.Setting(trailDetails).setName("Index Note(s)").setDesc(
fragWithHTML(
"The note that all of your other notes lead back to. The parent of all your parent notes. Just enter the basename.You can also have multiple index notes (comma-separated list).Leaving this field empty will make the trail show all paths going as far up the parent-tree as possible."
)
).addText((text2) => {
text2.setPlaceholder("Index Note").setValue(settings.indexNotes.join(", "));
text2.inputEl.onblur = async () => {
const splits = splitAndTrim(text2.getValue());
if (splits[0] === void 0 || splits.every((index2) => isInVault(index2))) {
settings.indexNotes = splits;
await plugin.saveSettings();
} else
new import_obsidian37.Notice("Atleast one of the notes is not in your vault");
};
});
new import_obsidian37.Setting(trailDetails).setName("Shows all paths if none to index note are found").setDesc(
"If you have an index note chosen, but the trail view has no paths going up to those index notes, should it show all paths instead?"
).addToggle(
(toggle) => toggle.setValue(settings.showAllPathsIfNoneToIndexNote).onChange(async (value) => {
settings.showAllPathsIfNoneToIndexNote = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
);
new import_obsidian37.Setting(trailDetails).setName("Default: All, Longest, or Shortest").setDesc(
"If multiple paths are found going up the parent tree, which of them should show?"
).addDropdown((dd) => {
const options = {};
TRAIL_LENGTHS.forEach((length) => {
options[length] = length;
});
dd.addOptions(options);
dd.setValue(settings.showAll);
dd.onChange(async (val) => {
settings.showAll = val;
await plugin.saveSettings();
await drawTrail(plugin);
});
});
new import_obsidian37.Setting(trailDetails).setName("Seperator").setDesc(
fragWithHTML(
"The character to show between crumbs in the breadcrumb trail. The default is \u2192
"
)
).addText(
(text2) => text2.setPlaceholder("\u2192").setValue(settings.trailSeperator).onChange(async (value) => {
settings.trailSeperator = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
);
new import_obsidian37.Setting(trailDetails).setName("No path found message").setDesc(
"The text to display when no path to the index note is found, or the current note has no parent."
).addText(
(text2) => text2.setPlaceholder("No path to index note was found").setValue(settings.noPathMessage).onChange(async (value) => {
settings.noPathMessage = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
);
new import_obsidian37.Setting(trailDetails).setName("Respect Readable Line Length").setDesc(
"Should the breadcrumbs trail adjust its width to the readable line length, or use as much space as possible? \u2705 = use readable line length."
).addToggle(
(toggle) => toggle.setValue(settings.respectReadableLineLength).onChange(async (value) => {
settings.respectReadableLineLength = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
);
new import_obsidian37.Setting(trailDetails).setName("Show up fields in Juggl").setDesc("Juggl will show both up and down fields").addToggle((toggle) => {
toggle.setValue(settings.showUpInJuggl).onChange(async (value) => {
settings.showUpInJuggl = value;
await plugin.saveSettings();
});
});
new import_obsidian37.Setting(trailDetails).setName("Juggl view layout").setDesc(
fragWithHTML(
"The layout type to use for the Juggl view.
The hierarchy layout is most natural for Breadcrumbs, but for large graphs D3 Force is recommended."
)
).addDropdown((dc) => {
dc.addOption("hierarchy", "Hierarchy");
dc.addOption("d3-force", "D3 Force");
dc.addOption("cola", "Cola Force");
dc.addOption("grid", "Grid");
dc.addOption("concentric", "Concentric");
dc.setValue(settings.jugglLayout);
dc.onChange(async (value) => {
settings.jugglLayout = value;
await plugin.saveSettings();
await drawTrail(plugin);
});
});
}
// src/Settings/VisModalSettings.ts
var import_obsidian38 = require("obsidian");
function addVisModalSettings(plugin, viewDetails) {
const { settings } = plugin;
const visModalDetails = subDetails("Visualisation Modal", viewDetails);
new import_obsidian38.Setting(visModalDetails).setName("Default Visualisation Type").setDesc("Which visualisation to show by default").addDropdown((cb) => {
VISTYPES.forEach((option) => {
cb.addOption(option, option);
});
cb.setValue(settings.visGraph);
cb.onChange(async (value) => {
settings.visGraph = value;
await plugin.saveSettings();
});
});
new import_obsidian38.Setting(visModalDetails).setName("Default Relation").setDesc("Which relation type to show first when opening the modal").addDropdown((dd) => {
RELATIONS.forEach((option) => {
dd.addOption(option, option);
});
dd.setValue(settings.visRelation);
dd.onChange(async (value) => {
settings.visRelation = value;
await plugin.saveSettings();
});
});
new import_obsidian38.Setting(visModalDetails).setName("Default Real/Closed").setDesc("Show the real or closed graph by default").addDropdown((cb) => {
REAlCLOSED.forEach((option) => {
cb.addOption(option, option);
});
cb.setValue(settings.visClosed);
cb.onChange(async (value) => {
settings.visClosed = value;
await plugin.saveSettings();
});
});
new import_obsidian38.Setting(visModalDetails).setName("Default Unlinked").setDesc("Show all nodes or only those which have links by default").addDropdown((cb) => {
ALLUNLINKED.forEach((option) => {
cb.addOption(option, option);
});
cb.setValue(settings.visAll);
cb.onChange(async (value) => {
settings.visAll = value;
await plugin.saveSettings();
});
});
}
// src/Settings/WriteBCsSettings.ts
var import_obsidian39 = require("obsidian");
function addWriteBCsSettings(plugin, cmdsDetails) {
const { settings } = plugin;
const writeBCsToFileDetails = subDetails(
"Write Breadcrumbs to File",
cmdsDetails
);
writeBCsToFileDetails.createDiv({
cls: "setting-item-name",
text: "Limit to only write certain fields"
});
new Checkboxes_default({
target: writeBCsToFileDetails,
props: {
plugin,
options: getFields(settings.userHiers),
settingName: "limitWriteBCCheckboxes"
}
});
new import_obsidian39.Setting(writeBCsToFileDetails).setName("Write Inline").setDesc(
"When writing BCs to file, should they be written inline (using Dataview syntax), or into the YAML of the note?"
).addToggle(
(toggle) => toggle.setValue(settings.writeBCsInline).onChange(async (value) => {
settings.writeBCsInline = value;
await plugin.saveSettings();
})
);
new import_obsidian39.Setting(writeBCsToFileDetails).setName(
fragWithHTML(
"Show the Write Breadcrumbs to ALL Files
command"
)
).setDesc(
"This command attempts to update ALL files with implied breadcrumbs pointing to them. So, it is not shown by default (even though it has 3 confirmation boxes to ensure you want to run it"
).addToggle(
(toggle) => toggle.setValue(settings.showWriteAllBCsCmd).onChange(async (value) => {
settings.showWriteAllBCsCmd = value;
await plugin.saveSettings();
})
);
}
// src/Settings/BreadcrumbsSettingTab.ts
var fragWithHTML = (html) => createFragment((frag) => frag.createDiv().innerHTML = html);
var details = (text2, parent) => parent.createEl("details", {}, (d) => d.createEl("summary", { text: text2 }));
var subDetails = (text2, parent) => parent.createDiv({
attr: { style: "padding-left: 10px;" }
}).createEl("details", {}, (d) => d.createEl("summary", { text: text2 }));
var BCSettingTab = class extends import_obsidian40.PluginSettingTab {
constructor(plugin) {
super(app, plugin);
this.plugin = plugin;
}
async display() {
const { plugin, containerEl } = this;
const { settings } = plugin;
containerEl.empty();
containerEl.createEl("h2", { text: "Breadcrumbs Settings" });
containerEl.addClass("BC-settings-tab");
addHierarchySettings(plugin, containerEl);
addRelationSettings(plugin, containerEl);
addGeneralSettings(plugin, containerEl);
const viewDetails = details("Views", containerEl);
new import_obsidian40.Setting(viewDetails).setName("Open Views by Default").setDesc(fragWithHTML("Choose which of the views to open onload
Order is: Trail/Grid/Juggl, Matrix, Ducks, Tree")).addToggle(
(toggle) => toggle.setTooltip("Trail/Grid/Juggl").setValue(settings.showBCs).onChange(async (value) => {
settings.showBCs = value;
await plugin.saveSettings();
await drawTrail(plugin);
})
).addToggle((toggle) => {
toggle.setTooltip("Matrix View").setValue(settings.openMatrixOnLoad).onChange(async (value) => {
settings.openMatrixOnLoad = value;
await plugin.saveSettings();
});
}).addToggle((toggle) => {
toggle.setTooltip("Ducks View").setValue(settings.openDuckOnLoad).onChange(async (value) => {
settings.openDuckOnLoad = value;
await plugin.saveSettings();
});
}).addToggle((toggle) => {
toggle.setTooltip("Tree View").setValue(settings.openDownOnLoad).onChange(async (value) => {
settings.openDownOnLoad = value;
await plugin.saveSettings();
});
});
viewDetails.createEl("hr");
addMatrixViewSettings(plugin, viewDetails);
addTrailViewSettings(plugin, viewDetails);
addVisModalSettings(plugin, viewDetails);
const alternativeHierarchyDetails = details(
"Alternative Hierarchies",
containerEl
);
addTagNoteSettings(plugin, alternativeHierarchyDetails);
addRegexNoteSettings(plugin, alternativeHierarchyDetails);
addNoSystemSettings(plugin, alternativeHierarchyDetails);
addHierarchyNoteSettings(plugin, alternativeHierarchyDetails);
addCSVSettings(plugin, alternativeHierarchyDetails);
addDendronSettings(plugin, alternativeHierarchyDetails);
addDataviewSettings(plugin, alternativeHierarchyDetails);
addDateNoteSettings(plugin, alternativeHierarchyDetails);
const cmdsDetails = details("Commands", containerEl);
addWriteBCsSettings(plugin, cmdsDetails);
addCreateIndexSettings(plugin, cmdsDetails);
addThreadingSettings(plugin, cmdsDetails);
addJumpToNextSettings(plugin, cmdsDetails);
addDebuggingsSettings(plugin, containerEl);
new KoFi_default({ target: containerEl });
}
};
// src/Views/DucksView.ts
var import_obsidian41 = require("obsidian");
// node_modules/svelte-icons/fa/FaInfo.svelte
function create_default_slot4(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment18(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 192 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot4] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance18($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaInfo = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance18, create_fragment18, safe_not_equal, {});
}
};
var FaInfo_default = FaInfo;
// src/Components/Ducks.svelte
function add_css13(target) {
append_styles(target, "svelte-gmdm3a", ".icon.svelte-gmdm3a{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}");
}
function get_each_context8(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[13] = list[i];
return child_ctx;
}
function create_each_block8(ctx) {
let div;
let a2;
let t0_value = (
/*duck*/
ctx[13] + ""
);
let t0;
let t1;
let mounted;
let dispose;
function click_handler(...args) {
return (
/*click_handler*/
ctx[8](
/*duck*/
ctx[13],
...args
)
);
}
function mouseover_handler(...args) {
return (
/*mouseover_handler*/
ctx[9](
/*duck*/
ctx[13],
...args
)
);
}
return {
c() {
div = element("div");
a2 = element("a");
t0 = text(t0_value);
t1 = space();
attr(a2, "class", "internal-link");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, a2);
append(a2, t0);
append(div, t1);
if (!mounted) {
dispose = [
listen(div, "click", click_handler),
listen(div, "mouseover", mouseover_handler)
];
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*ducks*/
8 && t0_value !== (t0_value = /*duck*/
ctx[13] + ""))
set_data(t0, t0_value);
},
d(detaching) {
if (detaching)
detach(div);
mounted = false;
run_all(dispose);
}
};
}
function create_fragment19(ctx) {
let div;
let h6;
let t1;
let span;
let fainfo;
let span_aria_label_value;
let t2;
let label;
let t3;
let input0;
let t4;
let input1;
let t5;
let current;
let mounted;
let dispose;
fainfo = new FaInfo_default({});
let each_value = (
/*ducks*/
ctx[3]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block8(get_each_context8(ctx, each_value, i));
}
return {
c() {
div = element("div");
h6 = element("h6");
h6.textContent = "Notes without Breadcrumbs";
t1 = space();
span = element("span");
create_component(fainfo.$$.fragment);
t2 = space();
label = element("label");
t3 = text("Filter:\n ");
input0 = element("input");
t4 = space();
input1 = element("input");
t5 = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(span, "class", "icon svelte-gmdm3a");
attr(span, "aria-label", span_aria_label_value = `A Regex used to filter the results.
If 'Include' is checked, it will only show notes that match the regex.
If 'Include' is not checked, this regex will filter out notes that match it.`);
attr(input0, "type", "text");
attr(input0, "placeholder", "Regex");
attr(input1, "aria-label", "Include");
attr(input1, "type", "checkbox");
attr(div, "class", "BC-Ducks markdown-preview-view");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, h6);
append(div, t1);
append(div, span);
mount_component(fainfo, span, null);
append(div, t2);
append(div, label);
append(label, t3);
append(label, input0);
set_input_value(
input0,
/*query*/
ctx[1]
);
append(div, t4);
append(div, input1);
input1.checked = /*include*/
ctx[2];
append(div, t5);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
current = true;
if (!mounted) {
dispose = [
listen(
input0,
"input",
/*input0_input_handler*/
ctx[6]
),
listen(
input1,
"change",
/*input1_change_handler*/
ctx[7]
)
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & /*query*/
2 && input0.value !== /*query*/
ctx2[1]) {
set_input_value(
input0,
/*query*/
ctx2[1]
);
}
if (dirty & /*include*/
4) {
input1.checked = /*include*/
ctx2[2];
}
if (dirty & /*openOrSwitch, ducks, hoverPreview, ducksView*/
9) {
each_value = /*ducks*/
ctx2[3];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context8(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block8(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i(local) {
if (current)
return;
transition_in(fainfo.$$.fragment, local);
current = true;
},
o(local) {
transition_out(fainfo.$$.fragment, local);
current = false;
},
d(detaching) {
if (detaching)
detach(div);
destroy_component(fainfo);
destroy_each(each_blocks, detaching);
mounted = false;
run_all(dispose);
}
};
}
function instance19($$self, $$props, $$invalidate) {
let ducks;
;
;
let { plugin } = $$props;
let { ducksView } = $$props;
const { mainG } = plugin;
const files = app.vault.getMarkdownFiles();
let query = "";
let regex = new RegExp(query, "g");
let include = true;
const getDucks = (regex2) => {
if (!regex2)
return;
return files.map((file) => file.basename).filter((name) => !mainG.neighbors(name).length && include === regex2.test(name));
};
function input0_input_handler() {
query = this.value;
$$invalidate(1, query);
}
function input1_change_handler() {
include = this.checked;
$$invalidate(2, include);
}
const click_handler = async (duck, e) => await openOrSwitch(duck, e);
const mouseover_handler = (duck, e) => hoverPreview(e, ducksView, duck);
$$self.$$set = ($$props2) => {
if ("plugin" in $$props2)
$$invalidate(4, plugin = $$props2.plugin);
if ("ducksView" in $$props2)
$$invalidate(0, ducksView = $$props2.ducksView);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*query*/
2) {
$: {
try {
const newReg = new RegExp(query, "g");
$$invalidate(5, regex = newReg);
} catch (e) {
}
}
}
if ($$self.$$.dirty & /*regex*/
32) {
$:
$$invalidate(3, ducks = getDucks(regex));
}
};
return [
ducksView,
query,
include,
ducks,
plugin,
regex,
input0_input_handler,
input1_change_handler,
click_handler,
mouseover_handler
];
}
var Ducks = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance19, create_fragment19, safe_not_equal, { plugin: 4, ducksView: 0 }, add_css13);
}
};
var Ducks_default = Ducks;
// src/Views/DucksView.ts
var DucksView = class extends import_obsidian41.ItemView {
constructor(leaf, plugin) {
super(leaf);
// TODO Duck icon
this.icon = DUCK_ICON;
this.plugin = plugin;
}
async onload() {
super.onload();
await this.plugin.saveSettings();
app.workspace.onLayoutReady(async () => {
await this.draw();
});
}
getViewType() {
return DUCK_VIEW;
}
getDisplayText() {
return "Breadcrumbs Ducks";
}
async onOpen() {
}
onClose() {
var _a;
(_a = this.view) == null ? void 0 : _a.$destroy();
return Promise.resolve();
}
async draw() {
this.contentEl.empty();
this.view = new Ducks_default({
target: this.contentEl,
props: { plugin: this.plugin, ducksView: this }
});
}
};
// src/Views/TreeView.ts
var import_obsidian42 = require("obsidian");
// src/Components/SideTree.svelte
var import_loglevel20 = __toESM(require_loglevel());
// node_modules/svelte-icons/fa/FaFire.svelte
function create_default_slot5(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M216 23.86c0-23.8-30.65-32.77-44.15-13.04C48 191.85 224 200 224 288c0 35.63-29.11 64.46-64.85 63.99-35.17-.45-63.15-29.77-63.15-64.94v-85.51c0-21.7-26.47-32.23-41.43-16.5C27.8 213.16 0 261.33 0 320c0 105.87 86.13 192 192 192s192-86.13 192-192c0-170.29-168-193-168-296.14z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment20(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 384 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot5] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance20($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaFire = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance20, create_fragment20, safe_not_equal, {});
}
};
var FaFire_default = FaFire;
// node_modules/svelte-icons/fa/FaRegSnowflake.svelte
function create_default_slot6(ctx) {
let path2;
return {
c() {
path2 = svg_element("path");
attr(path2, "d", "M440.1 355.2l-39.2-23 34.1-9.3c8.4-2.3 13.4-11.1 11.1-19.6l-4.1-15.5c-2.2-8.5-10.9-13.6-19.3-11.3L343 298.2 271.2 256l71.9-42.2 79.7 21.7c8.4 2.3 17-2.8 19.3-11.3l4.1-15.5c2.2-8.5-2.7-17.3-11.1-19.6l-34.1-9.3 39.2-23c7.5-4.4 10.1-14.2 5.8-21.9l-7.9-13.9c-4.3-7.7-14-10.3-21.5-5.9l-39.2 23 9.1-34.7c2.2-8.5-2.7-17.3-11.1-19.6l-15.2-4.1c-8.4-2.3-17 2.8-19.3 11.3l-21.3 81-71.9 42.2v-84.5L306 70.4c6.1-6.2 6.1-16.4 0-22.6l-11.1-11.3c-6.1-6.2-16.1-6.2-22.2 0l-24.9 25.4V16c0-8.8-7-16-15.7-16h-15.7c-8.7 0-15.7 7.2-15.7 16v46.1l-24.9-25.4c-6.1-6.2-16.1-6.2-22.2 0L142.1 48c-6.1 6.2-6.1 16.4 0 22.6l58.3 59.3v84.5l-71.9-42.2-21.3-81c-2.2-8.5-10.9-13.6-19.3-11.3L72.7 84c-8.4 2.3-13.4 11.1-11.1 19.6l9.1 34.7-39.2-23c-7.5-4.4-17.1-1.8-21.5 5.9l-7.9 13.9c-4.3 7.7-1.8 17.4 5.8 21.9l39.2 23-34.1 9.1c-8.4 2.3-13.4 11.1-11.1 19.6L6 224.2c2.2 8.5 10.9 13.6 19.3 11.3l79.7-21.7 71.9 42.2-71.9 42.2-79.7-21.7c-8.4-2.3-17 2.8-19.3 11.3l-4.1 15.5c-2.2 8.5 2.7 17.3 11.1 19.6l34.1 9.3-39.2 23c-7.5 4.4-10.1 14.2-5.8 21.9L10 391c4.3 7.7 14 10.3 21.5 5.9l39.2-23-9.1 34.7c-2.2 8.5 2.7 17.3 11.1 19.6l15.2 4.1c8.4 2.3 17-2.8 19.3-11.3l21.3-81 71.9-42.2v84.5l-58.3 59.3c-6.1 6.2-6.1 16.4 0 22.6l11.1 11.3c6.1 6.2 16.1 6.2 22.2 0l24.9-25.4V496c0 8.8 7 16 15.7 16h15.7c8.7 0 15.7-7.2 15.7-16v-46.1l24.9 25.4c6.1 6.2 16.1 6.2 22.2 0l11.1-11.3c6.1-6.2 6.1-16.4 0-22.6l-58.3-59.3v-84.5l71.9 42.2 21.3 81c2.2 8.5 10.9 13.6 19.3 11.3L375 428c8.4-2.3 13.4-11.1 11.1-19.6l-9.1-34.7 39.2 23c7.5 4.4 17.1 1.8 21.5-5.9l7.9-13.9c4.6-7.5 2.1-17.3-5.5-21.7z");
},
m(target, anchor) {
insert(target, path2, anchor);
},
p: noop,
d(detaching) {
if (detaching)
detach(path2);
}
};
}
function create_fragment21(ctx) {
let iconbase;
let current;
const iconbase_spread_levels = [
{ viewBox: "0 0 448 512" },
/*$$props*/
ctx[0]
];
let iconbase_props = {
$$slots: { default: [create_default_slot6] },
$$scope: { ctx }
};
for (let i = 0; i < iconbase_spread_levels.length; i += 1) {
iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]);
}
iconbase = new IconBase_default({ props: iconbase_props });
return {
c() {
create_component(iconbase.$$.fragment);
},
m(target, anchor) {
mount_component(iconbase, target, anchor);
current = true;
},
p(ctx2, [dirty]) {
const iconbase_changes = dirty & /*$$props*/
1 ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(
/*$$props*/
ctx2[0]
)]) : {};
if (dirty & /*$$scope*/
2) {
iconbase_changes.$$scope = { dirty, ctx: ctx2 };
}
iconbase.$set(iconbase_changes);
},
i(local) {
if (current)
return;
transition_in(iconbase.$$.fragment, local);
current = true;
},
o(local) {
transition_out(iconbase.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(iconbase, detaching);
}
};
}
function instance21($$self, $$props, $$invalidate) {
$$self.$$set = ($$new_props) => {
$$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
};
$$props = exclude_internal_props($$props);
return [$$props];
}
var FaRegSnowflake = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance21, create_fragment21, safe_not_equal, {});
}
};
var FaRegSnowflake_default = FaRegSnowflake;
// src/Components/SideTree.svelte
function add_css14(target) {
append_styles(target, "svelte-8j6nux", "button.svelte-8j6nux{display:inline;padding:1px 6px 2px 6px}.BC-downs.svelte-8j6nux{padding-left:5px}pre.svelte-8j6nux{display:inline}.is-unresolved.svelte-8j6nux{color:var(--text-muted)}.icon.svelte-8j6nux{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}");
}
function get_each_context9(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[16] = list[i];
return child_ctx;
}
function get_each_context_16(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[19] = list[i];
return child_ctx;
}
function create_else_block4(ctx) {
let fafire;
let current;
fafire = new FaFire_default({});
return {
c() {
create_component(fafire.$$.fragment);
},
m(target, anchor) {
mount_component(fafire, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(fafire.$$.fragment, local);
current = true;
},
o(local) {
transition_out(fafire.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(fafire, detaching);
}
};
}
function create_if_block_15(ctx) {
let faregsnowflake;
let current;
faregsnowflake = new FaRegSnowflake_default({});
return {
c() {
create_component(faregsnowflake.$$.fragment);
},
m(target, anchor) {
mount_component(faregsnowflake, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(faregsnowflake.$$.fragment, local);
current = true;
},
o(local) {
transition_out(faregsnowflake.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(faregsnowflake, detaching);
}
};
}
function create_each_block_16(ctx) {
let option;
let t_value = (
/*direction*/
ctx[19] + ""
);
let t;
let option_value_value;
return {
c() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = /*direction*/
ctx[19];
option.value = option.__value;
},
m(target, anchor) {
insert(target, option, anchor);
append(option, t);
},
p: noop,
d(detaching) {
if (detaching)
detach(option);
}
};
}
function create_if_block8(ctx) {
let div;
let pre;
let t0_value = (
/*line*/
ctx[16][0] + "-"
);
let t0;
let t1;
let span;
let a2;
let t2_value = dropDendron(
/*line*/
ctx[16][1],
/*settings*/
ctx[6]
) + "";
let t2;
let a_class_value;
let t3;
let mounted;
let dispose;
function click_handler_2(...args) {
return (
/*click_handler_2*/
ctx[10](
/*line*/
ctx[16],
...args
)
);
}
function mouseover_handler(...args) {
return (
/*mouseover_handler*/
ctx[11](
/*line*/
ctx[16],
...args
)
);
}
return {
c() {
div = element("div");
pre = element("pre");
t0 = text(t0_value);
t1 = space();
span = element("span");
a2 = element("a");
t2 = text(t2_value);
t3 = space();
attr(pre, "class", "svelte-8j6nux");
attr(a2, "class", a_class_value = "internal-link " + (isInVault(
/*line*/
ctx[16][1]
) ? "" : "is-unresolved") + " svelte-8j6nux");
attr(span, "class", "internal-link");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, pre);
append(pre, t0);
append(div, t1);
append(div, span);
append(span, a2);
append(a2, t2);
append(div, t3);
if (!mounted) {
dispose = [
listen(span, "click", click_handler_2),
listen(span, "mouseover", mouseover_handler)
];
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*lines*/
32 && t0_value !== (t0_value = /*line*/
ctx[16][0] + "-"))
set_data(t0, t0_value);
if (dirty & /*lines*/
32 && t2_value !== (t2_value = dropDendron(
/*line*/
ctx[16][1],
/*settings*/
ctx[6]
) + ""))
set_data(t2, t2_value);
if (dirty & /*lines*/
32 && a_class_value !== (a_class_value = "internal-link " + (isInVault(
/*line*/
ctx[16][1]
) ? "" : "is-unresolved") + " svelte-8j6nux")) {
attr(a2, "class", a_class_value);
}
},
d(detaching) {
if (detaching)
detach(div);
mounted = false;
run_all(dispose);
}
};
}
function create_each_block9(ctx) {
let if_block_anchor;
let if_block = (
/*line*/
ctx[16].length > 1 && create_if_block8(ctx)
);
return {
c() {
if (if_block)
if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block)
if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx2, dirty) {
if (
/*line*/
ctx2[16].length > 1
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block8(ctx2);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d(detaching) {
if (if_block)
if_block.d(detaching);
if (detaching)
detach(if_block_anchor);
}
};
}
function create_fragment22(ctx) {
let span;
let current_block_type_index;
let if_block;
let span_aria_label_value;
let t0;
let button;
let t2;
let select;
let t3;
let div;
let current;
let mounted;
let dispose;
const if_block_creators = [create_if_block_15, create_else_block4];
const if_blocks = [];
function select_block_type(ctx2, dirty) {
if (
/*frozen*/
ctx2[4]
)
return 0;
return 1;
}
current_block_type_index = select_block_type(ctx, -1);
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
let each_value_1 = DIRECTIONS;
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_16(get_each_context_16(ctx, each_value_1, i));
}
let each_value = (
/*lines*/
ctx[5]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block9(get_each_context9(ctx, each_value, i));
}
return {
c() {
span = element("span");
if_block.c();
t0 = space();
button = element("button");
button.textContent = "\u21BB";
t2 = space();
select = element("select");
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t3 = space();
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(span, "class", "icon svelte-8j6nux");
attr(span, "aria-label", span_aria_label_value = /*frozen*/
ctx[4] ? `Frozen on: ${/*basename*/
ctx[3]}` : "Unfrozen");
attr(span, "aria-label-position", "left");
attr(button, "aria-label", "Refresh Stats View (also refreshes Breadcrumbs Index)");
attr(button, "class", "svelte-8j6nux");
attr(select, "class", "dropdown");
if (
/*dir*/
ctx[2] === void 0
)
add_render_callback(() => (
/*select_change_handler*/
ctx[9].call(select)
));
attr(div, "class", "BC-downs svelte-8j6nux");
},
m(target, anchor) {
insert(target, span, anchor);
if_blocks[current_block_type_index].m(span, null);
insert(target, t0, anchor);
insert(target, button, anchor);
insert(target, t2, anchor);
insert(target, select, anchor);
for (let i = 0; i < each_blocks_1.length; i += 1) {
if (each_blocks_1[i]) {
each_blocks_1[i].m(select, null);
}
}
select_option(
select,
/*dir*/
ctx[2],
true
);
insert(target, t3, anchor);
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
current = true;
if (!mounted) {
dispose = [
listen(
span,
"click",
/*click_handler*/
ctx[7]
),
listen(
button,
"click",
/*click_handler_1*/
ctx[8]
),
listen(
select,
"change",
/*select_change_handler*/
ctx[9]
)
];
mounted = true;
}
},
p(ctx2, [dirty]) {
let previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(ctx2, dirty);
if (current_block_type_index !== previous_block_index) {
group_outros();
transition_out(if_blocks[previous_block_index], 1, 1, () => {
if_blocks[previous_block_index] = null;
});
check_outros();
if_block = if_blocks[current_block_type_index];
if (!if_block) {
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
if_block.c();
} else {
}
transition_in(if_block, 1);
if_block.m(span, null);
}
if (!current || dirty & /*frozen, basename*/
24 && span_aria_label_value !== (span_aria_label_value = /*frozen*/
ctx2[4] ? `Frozen on: ${/*basename*/
ctx2[3]}` : "Unfrozen")) {
attr(span, "aria-label", span_aria_label_value);
}
if (dirty & /*DIRECTIONS*/
0) {
each_value_1 = DIRECTIONS;
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_16(ctx2, each_value_1, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(child_ctx, dirty);
} else {
each_blocks_1[i] = create_each_block_16(child_ctx);
each_blocks_1[i].c();
each_blocks_1[i].m(select, null);
}
}
for (; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].d(1);
}
each_blocks_1.length = each_value_1.length;
}
if (dirty & /*dir, DIRECTIONS*/
4) {
select_option(
select,
/*dir*/
ctx2[2]
);
}
if (dirty & /*openOrSwitch, lines, hoverPreview, view, isInVault, dropDendron, settings*/
98) {
each_value = /*lines*/
ctx2[5];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context9(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block9(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i(local) {
if (current)
return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching)
detach(span);
if_blocks[current_block_type_index].d();
if (detaching)
detach(t0);
if (detaching)
detach(button);
if (detaching)
detach(t2);
if (detaching)
detach(select);
destroy_each(each_blocks_1, detaching);
if (detaching)
detach(t3);
if (detaching)
detach(div);
destroy_each(each_blocks, detaching);
mounted = false;
run_all(dispose);
}
};
}
function instance22($$self, $$props, $$invalidate) {
var _a;
;
;
;
let { plugin } = $$props;
let { view } = $$props;
const { settings, app: app2, closedG } = plugin;
const { createIndexIndent } = settings;
let dir = "down";
let frozen = false;
let { basename } = (_a = getCurrFile()) !== null && _a !== void 0 ? _a : {};
plugin.registerEvent(app2.workspace.on("active-leaf-change", () => {
var _a2;
if (frozen)
return;
$$invalidate(3, basename = (_a2 = getCurrFile()) === null || _a2 === void 0 ? void 0 : _a2.basename);
}));
let lines;
const click_handler = () => {
var _a2;
$$invalidate(4, frozen = !frozen);
if (!frozen)
$$invalidate(3, basename = (_a2 = getCurrFile()) == null ? void 0 : _a2.basename);
};
const click_handler_1 = async () => {
await refreshIndex(plugin);
await view.draw();
};
function select_change_handler() {
dir = select_value(this);
$$invalidate(2, dir);
}
const click_handler_2 = async (line, e) => await openOrSwitch(line[1], e);
const mouseover_handler = (line, e) => hoverPreview(e, view, line[1]);
$$self.$$set = ($$props2) => {
if ("plugin" in $$props2)
$$invalidate(0, plugin = $$props2.plugin);
if ("view" in $$props2)
$$invalidate(1, view = $$props2.view);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*dir, basename*/
12) {
$: {
const dirG = getSubInDirs(closedG, dir);
const allPaths = dfsAllPaths(dirG, basename);
const index2 = createIndex(allPaths, false, createIndexIndent);
(0, import_loglevel20.info)({ allPaths, index: index2 });
$$invalidate(5, lines = indexToLinePairs(index2));
}
}
};
return [
plugin,
view,
dir,
basename,
frozen,
lines,
settings,
click_handler,
click_handler_1,
select_change_handler,
click_handler_2,
mouseover_handler
];
}
var SideTree = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance22, create_fragment22, safe_not_equal, { plugin: 0, view: 1 }, add_css14);
}
};
var SideTree_default = SideTree;
// src/Views/TreeView.ts
var TreeView = class extends import_obsidian42.ItemView {
constructor(leaf, plugin) {
super(leaf);
this.icon = addFeatherIcon("corner-right-down");
this.plugin = plugin;
}
async onload() {
super.onload();
app.workspace.onLayoutReady(async () => {
await this.draw();
});
}
getViewType() {
return TREE_VIEW;
}
getDisplayText() {
return "Breadcrumbs Down";
}
async onOpen() {
}
onClose() {
var _a;
(_a = this.view) == null ? void 0 : _a.$destroy();
return Promise.resolve();
}
async draw() {
this.contentEl.empty();
this.view = new SideTree_default({
target: this.contentEl,
props: { plugin: this.plugin, view: this }
});
}
};
// node_modules/d3-array/src/ascending.js
function ascending_default(a2, b) {
return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
}
// node_modules/d3-array/src/bisector.js
function bisector_default(f) {
let delta = f;
let compare = f;
if (f.length === 1) {
delta = (d, x4) => f(d) - x4;
compare = ascendingComparator(f);
}
function left(a2, x4, lo, hi) {
if (lo == null)
lo = 0;
if (hi == null)
hi = a2.length;
while (lo < hi) {
const mid = lo + hi >>> 1;
if (compare(a2[mid], x4) < 0)
lo = mid + 1;
else
hi = mid;
}
return lo;
}
function right(a2, x4, lo, hi) {
if (lo == null)
lo = 0;
if (hi == null)
hi = a2.length;
while (lo < hi) {
const mid = lo + hi >>> 1;
if (compare(a2[mid], x4) > 0)
hi = mid;
else
lo = mid + 1;
}
return lo;
}
function center(a2, x4, lo, hi) {
if (lo == null)
lo = 0;
if (hi == null)
hi = a2.length;
const i = left(a2, x4, lo, hi - 1);
return i > lo && delta(a2[i - 1], x4) > -delta(a2[i], x4) ? i - 1 : i;
}
return { left, center, right };
}
function ascendingComparator(f) {
return (d, x4) => ascending_default(f(d), x4);
}
// node_modules/d3-array/src/number.js
function number_default(x4) {
return x4 === null ? NaN : +x4;
}
// node_modules/d3-array/src/bisect.js
var ascendingBisect = bisector_default(ascending_default);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
var bisectCenter = bisector_default(number_default).center;
var bisect_default = bisectRight;
// node_modules/d3-array/src/ticks.js
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
function ticks_default(start2, stop, count2) {
var reverse, i = -1, n2, ticks, step;
stop = +stop, start2 = +start2, count2 = +count2;
if (start2 === stop && count2 > 0)
return [start2];
if (reverse = stop < start2)
n2 = start2, start2 = stop, stop = n2;
if ((step = tickIncrement(start2, stop, count2)) === 0 || !isFinite(step))
return [];
if (step > 0) {
let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
if (r0 * step < start2)
++r0;
if (r1 * step > stop)
--r1;
ticks = new Array(n2 = r1 - r0 + 1);
while (++i < n2)
ticks[i] = (r0 + i) * step;
} else {
step = -step;
let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
if (r0 / step < start2)
++r0;
if (r1 / step > stop)
--r1;
ticks = new Array(n2 = r1 - r0 + 1);
while (++i < n2)
ticks[i] = (r0 + i) / step;
}
if (reverse)
ticks.reverse();
return ticks;
}
function tickIncrement(start2, stop, count2) {
var step = (stop - start2) / Math.max(0, count2), power = Math.floor(Math.log(step) / Math.LN10), error6 = step / Math.pow(10, power);
return power >= 0 ? (error6 >= e10 ? 10 : error6 >= e5 ? 5 : error6 >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error6 >= e10 ? 10 : error6 >= e5 ? 5 : error6 >= e2 ? 2 : 1);
}
function tickStep(start2, stop, count2) {
var step0 = Math.abs(stop - start2) / Math.max(0, count2), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error6 = step0 / step1;
if (error6 >= e10)
step1 *= 10;
else if (error6 >= e5)
step1 *= 5;
else if (error6 >= e2)
step1 *= 2;
return stop < start2 ? -step1 : step1;
}
// node_modules/d3-array/src/max.js
function max(values, valueof) {
let max4;
if (valueof === void 0) {
for (const value of values) {
if (value != null && (max4 < value || max4 === void 0 && value >= value)) {
max4 = value;
}
}
} else {
let index2 = -1;
for (let value of values) {
if ((value = valueof(value, ++index2, values)) != null && (max4 < value || max4 === void 0 && value >= value)) {
max4 = value;
}
}
}
return max4;
}
// node_modules/d3-array/src/range.js
function range_default(start2, stop, step) {
start2 = +start2, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n2 < 3 ? 1 : +step;
var i = -1, n2 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range = new Array(n2);
while (++i < n2) {
range[i] = start2 + i * step;
}
return range;
}
// node_modules/d3-dispatch/src/dispatch.js
var noop2 = { value: () => {
} };
function dispatch() {
for (var i = 0, n2 = arguments.length, _ = {}, t; i < n2; ++i) {
if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t))
throw new Error("illegal type: " + t);
_[t] = [];
}
return new Dispatch(_);
}
function Dispatch(_) {
this._ = _;
}
function parseTypenames(typenames, types) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0)
name = t.slice(i + 1), t = t.slice(0, i);
if (t && !types.hasOwnProperty(t))
throw new Error("unknown type: " + t);
return { type: t, name };
});
}
Dispatch.prototype = dispatch.prototype = {
constructor: Dispatch,
on: function(typename, callback) {
var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n2 = T.length;
if (arguments.length < 2) {
while (++i < n2)
if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name)))
return t;
return;
}
if (callback != null && typeof callback !== "function")
throw new Error("invalid callback: " + callback);
while (++i < n2) {
if (t = (typename = T[i]).type)
_[t] = set(_[t], typename.name, callback);
else if (callback == null)
for (t in _)
_[t] = set(_[t], typename.name, null);
}
return this;
},
copy: function() {
var copy3 = {}, _ = this._;
for (var t in _)
copy3[t] = _[t].slice();
return new Dispatch(copy3);
},
call: function(type2, that) {
if ((n2 = arguments.length - 2) > 0)
for (var args = new Array(n2), i = 0, n2, t; i < n2; ++i)
args[i] = arguments[i + 2];
if (!this._.hasOwnProperty(type2))
throw new Error("unknown type: " + type2);
for (t = this._[type2], i = 0, n2 = t.length; i < n2; ++i)
t[i].value.apply(that, args);
},
apply: function(type2, that, args) {
if (!this._.hasOwnProperty(type2))
throw new Error("unknown type: " + type2);
for (var t = this._[type2], i = 0, n2 = t.length; i < n2; ++i)
t[i].value.apply(that, args);
}
};
function get(type2, name) {
for (var i = 0, n2 = type2.length, c3; i < n2; ++i) {
if ((c3 = type2[i]).name === name) {
return c3.value;
}
}
}
function set(type2, name, callback) {
for (var i = 0, n2 = type2.length; i < n2; ++i) {
if (type2[i].name === name) {
type2[i] = noop2, type2 = type2.slice(0, i).concat(type2.slice(i + 1));
break;
}
}
if (callback != null)
type2.push({ name, value: callback });
return type2;
}
var dispatch_default = dispatch;
// node_modules/d3-selection/src/namespaces.js
var xhtml = "http://www.w3.org/1999/xhtml";
var namespaces_default = {
svg: "http://www.w3.org/2000/svg",
xhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
// node_modules/d3-selection/src/namespace.js
function namespace_default(name) {
var prefix = name += "", i = prefix.indexOf(":");
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
name = name.slice(i + 1);
return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
}
// node_modules/d3-selection/src/creator.js
function creatorInherit(name) {
return function() {
var document2 = this.ownerDocument, uri = this.namespaceURI;
return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
};
}
function creatorFixed(fullname) {
return function() {
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
};
}
function creator_default(name) {
var fullname = namespace_default(name);
return (fullname.local ? creatorFixed : creatorInherit)(fullname);
}
// node_modules/d3-selection/src/selector.js
function none() {
}
function selector_default(selector) {
return selector == null ? none : function() {
return this.querySelector(selector);
};
}
// node_modules/d3-selection/src/selection/select.js
function select_default(select) {
if (typeof select !== "function")
select = selector_default(select);
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i = 0; i < n2; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node)
subnode.__data__ = node.__data__;
subgroup[i] = subnode;
}
}
}
return new Selection(subgroups, this._parents);
}
// node_modules/d3-selection/src/array.js
function array_default(x4) {
return typeof x4 === "object" && "length" in x4 ? x4 : Array.from(x4);
}
// node_modules/d3-selection/src/selectorAll.js
function empty2() {
return [];
}
function selectorAll_default(selector) {
return selector == null ? empty2 : function() {
return this.querySelectorAll(selector);
};
}
// node_modules/d3-selection/src/selection/selectAll.js
function arrayAll(select) {
return function() {
var group = select.apply(this, arguments);
return group == null ? [] : array_default(group);
};
}
function selectAll_default(select) {
if (typeof select === "function")
select = arrayAll(select);
else
select = selectorAll_default(select);
for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, node, i = 0; i < n2; ++i) {
if (node = group[i]) {
subgroups.push(select.call(node, node.__data__, i, group));
parents.push(node);
}
}
}
return new Selection(subgroups, parents);
}
// node_modules/d3-selection/src/matcher.js
function matcher_default(selector) {
return function() {
return this.matches(selector);
};
}
function childMatcher(selector) {
return function(node) {
return node.matches(selector);
};
}
// node_modules/d3-selection/src/selection/selectChild.js
var find = Array.prototype.find;
function childFind(match2) {
return function() {
return find.call(this.children, match2);
};
}
function childFirst() {
return this.firstElementChild;
}
function selectChild_default(match2) {
return this.select(match2 == null ? childFirst : childFind(typeof match2 === "function" ? match2 : childMatcher(match2)));
}
// node_modules/d3-selection/src/selection/selectChildren.js
var filter = Array.prototype.filter;
function children2() {
return this.children;
}
function childrenFilter(match2) {
return function() {
return filter.call(this.children, match2);
};
}
function selectChildren_default(match2) {
return this.selectAll(match2 == null ? children2 : childrenFilter(typeof match2 === "function" ? match2 : childMatcher(match2)));
}
// node_modules/d3-selection/src/selection/filter.js
function filter_default(match2) {
if (typeof match2 !== "function")
match2 = matcher_default(match2);
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n2; ++i) {
if ((node = group[i]) && match2.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
}
}
return new Selection(subgroups, this._parents);
}
// node_modules/d3-selection/src/selection/sparse.js
function sparse_default(update2) {
return new Array(update2.length);
}
// node_modules/d3-selection/src/selection/enter.js
function enter_default() {
return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
}
function EnterNode(parent, datum2) {
this.ownerDocument = parent.ownerDocument;
this.namespaceURI = parent.namespaceURI;
this._next = null;
this._parent = parent;
this.__data__ = datum2;
}
EnterNode.prototype = {
constructor: EnterNode,
appendChild: function(child) {
return this._parent.insertBefore(child, this._next);
},
insertBefore: function(child, next) {
return this._parent.insertBefore(child, next);
},
querySelector: function(selector) {
return this._parent.querySelector(selector);
},
querySelectorAll: function(selector) {
return this._parent.querySelectorAll(selector);
}
};
// node_modules/d3-selection/src/constant.js
function constant_default(x4) {
return function() {
return x4;
};
}
// node_modules/d3-selection/src/selection/data.js
function bindIndex(parent, group, enter, update2, exit, data) {
var i = 0, node, groupLength = group.length, dataLength = data.length;
for (; i < dataLength; ++i) {
if (node = group[i]) {
node.__data__ = data[i];
update2[i] = node;
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
for (; i < groupLength; ++i) {
if (node = group[i]) {
exit[i] = node;
}
}
}
function bindKey(parent, group, enter, update2, exit, data, key) {
var i, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
for (i = 0; i < groupLength; ++i) {
if (node = group[i]) {
keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
if (nodeByKeyValue.has(keyValue)) {
exit[i] = node;
} else {
nodeByKeyValue.set(keyValue, node);
}
}
}
for (i = 0; i < dataLength; ++i) {
keyValue = key.call(parent, data[i], i, data) + "";
if (node = nodeByKeyValue.get(keyValue)) {
update2[i] = node;
node.__data__ = data[i];
nodeByKeyValue.delete(keyValue);
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
for (i = 0; i < groupLength; ++i) {
if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
exit[i] = node;
}
}
}
function datum(node) {
return node.__data__;
}
function data_default(value, key) {
if (!arguments.length)
return Array.from(this, datum);
var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
if (typeof value !== "function")
value = constant_default(value);
for (var m2 = groups.length, update2 = new Array(m2), enter = new Array(m2), exit = new Array(m2), j = 0; j < m2; ++j) {
var parent = parents[j], group = groups[j], groupLength = group.length, data = array_default(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update2[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
if (previous = enterGroup[i0]) {
if (i0 >= i1)
i1 = i0 + 1;
while (!(next = updateGroup[i1]) && ++i1 < dataLength)
;
previous._next = next || null;
}
}
}
update2 = new Selection(update2, parents);
update2._enter = enter;
update2._exit = exit;
return update2;
}
// node_modules/d3-selection/src/selection/exit.js
function exit_default() {
return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
}
// node_modules/d3-selection/src/selection/join.js
function join_default(onenter, onupdate, onexit) {
var enter = this.enter(), update2 = this, exit = this.exit();
enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + "");
if (onupdate != null)
update2 = onupdate(update2);
if (onexit == null)
exit.remove();
else
onexit(exit);
return enter && update2 ? enter.merge(update2).order() : update2;
}
// node_modules/d3-selection/src/selection/merge.js
function merge_default(selection2) {
if (!(selection2 instanceof Selection))
throw new Error("invalid merge");
for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n2 = group0.length, merge = merges[j] = new Array(n2), node, i = 0; i < n2; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Selection(merges, this._parents);
}
// node_modules/d3-selection/src/selection/order.js
function order_default() {
for (var groups = this._groups, j = -1, m2 = groups.length; ++j < m2; ) {
for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
if (node = group[i]) {
if (next && node.compareDocumentPosition(next) ^ 4)
next.parentNode.insertBefore(node, next);
next = node;
}
}
}
return this;
}
// node_modules/d3-selection/src/selection/sort.js
function sort_default(compare) {
if (!compare)
compare = ascending;
function compareNode(a2, b) {
return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b;
}
for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, sortgroup = sortgroups[j] = new Array(n2), node, i = 0; i < n2; ++i) {
if (node = group[i]) {
sortgroup[i] = node;
}
}
sortgroup.sort(compareNode);
}
return new Selection(sortgroups, this._parents).order();
}
function ascending(a2, b) {
return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN;
}
// node_modules/d3-selection/src/selection/call.js
function call_default() {
var callback = arguments[0];
arguments[0] = this;
callback.apply(null, arguments);
return this;
}
// node_modules/d3-selection/src/selection/nodes.js
function nodes_default() {
return Array.from(this);
}
// node_modules/d3-selection/src/selection/node.js
function node_default() {
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
for (var group = groups[j], i = 0, n2 = group.length; i < n2; ++i) {
var node = group[i];
if (node)
return node;
}
}
return null;
}
// node_modules/d3-selection/src/selection/size.js
function size_default() {
let size = 0;
for (const node of this)
++size;
return size;
}
// node_modules/d3-selection/src/selection/empty.js
function empty_default() {
return !this.node();
}
// node_modules/d3-selection/src/selection/each.js
function each_default(callback) {
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
for (var group = groups[j], i = 0, n2 = group.length, node; i < n2; ++i) {
if (node = group[i])
callback.call(node, node.__data__, i, group);
}
}
return this;
}
// node_modules/d3-selection/src/selection/attr.js
function attrRemove(name) {
return function() {
this.removeAttribute(name);
};
}
function attrRemoveNS(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function attrConstant(name, value) {
return function() {
this.setAttribute(name, value);
};
}
function attrConstantNS(fullname, value) {
return function() {
this.setAttributeNS(fullname.space, fullname.local, value);
};
}
function attrFunction(name, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null)
this.removeAttribute(name);
else
this.setAttribute(name, v);
};
}
function attrFunctionNS(fullname, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null)
this.removeAttributeNS(fullname.space, fullname.local);
else
this.setAttributeNS(fullname.space, fullname.local, v);
};
}
function attr_default(name, value) {
var fullname = namespace_default(name);
if (arguments.length < 2) {
var node = this.node();
return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
}
return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
}
// node_modules/d3-selection/src/window.js
function window_default(node) {
return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
}
// node_modules/d3-selection/src/selection/style.js
function styleRemove(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleConstant(name, value, priority) {
return function() {
this.style.setProperty(name, value, priority);
};
}
function styleFunction(name, value, priority) {
return function() {
var v = value.apply(this, arguments);
if (v == null)
this.style.removeProperty(name);
else
this.style.setProperty(name, v, priority);
};
}
function style_default(name, value, priority) {
return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
}
function styleValue(node, name) {
return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
}
// node_modules/d3-selection/src/selection/property.js
function propertyRemove(name) {
return function() {
delete this[name];
};
}
function propertyConstant(name, value) {
return function() {
this[name] = value;
};
}
function propertyFunction(name, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null)
delete this[name];
else
this[name] = v;
};
}
function property_default(name, value) {
return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
}
// node_modules/d3-selection/src/selection/classed.js
function classArray(string) {
return string.trim().split(/^|\s+/);
}
function classList(node) {
return node.classList || new ClassList(node);
}
function ClassList(node) {
this._node = node;
this._names = classArray(node.getAttribute("class") || "");
}
ClassList.prototype = {
add: function(name) {
var i = this._names.indexOf(name);
if (i < 0) {
this._names.push(name);
this._node.setAttribute("class", this._names.join(" "));
}
},
remove: function(name) {
var i = this._names.indexOf(name);
if (i >= 0) {
this._names.splice(i, 1);
this._node.setAttribute("class", this._names.join(" "));
}
},
contains: function(name) {
return this._names.indexOf(name) >= 0;
}
};
function classedAdd(node, names) {
var list = classList(node), i = -1, n2 = names.length;
while (++i < n2)
list.add(names[i]);
}
function classedRemove(node, names) {
var list = classList(node), i = -1, n2 = names.length;
while (++i < n2)
list.remove(names[i]);
}
function classedTrue(names) {
return function() {
classedAdd(this, names);
};
}
function classedFalse(names) {
return function() {
classedRemove(this, names);
};
}
function classedFunction(names, value) {
return function() {
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
};
}
function classed_default(name, value) {
var names = classArray(name + "");
if (arguments.length < 2) {
var list = classList(this.node()), i = -1, n2 = names.length;
while (++i < n2)
if (!list.contains(names[i]))
return false;
return true;
}
return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
}
// node_modules/d3-selection/src/selection/text.js
function textRemove() {
this.textContent = "";
}
function textConstant(value) {
return function() {
this.textContent = value;
};
}
function textFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
};
}
function text_default(value) {
return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
}
// node_modules/d3-selection/src/selection/html.js
function htmlRemove() {
this.innerHTML = "";
}
function htmlConstant(value) {
return function() {
this.innerHTML = value;
};
}
function htmlFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
};
}
function html_default(value) {
return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
}
// node_modules/d3-selection/src/selection/raise.js
function raise() {
if (this.nextSibling)
this.parentNode.appendChild(this);
}
function raise_default() {
return this.each(raise);
}
// node_modules/d3-selection/src/selection/lower.js
function lower() {
if (this.previousSibling)
this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function lower_default() {
return this.each(lower);
}
// node_modules/d3-selection/src/selection/append.js
function append_default(name) {
var create2 = typeof name === "function" ? name : creator_default(name);
return this.select(function() {
return this.appendChild(create2.apply(this, arguments));
});
}
// node_modules/d3-selection/src/selection/insert.js
function constantNull() {
return null;
}
function insert_default(name, before) {
var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
return this.select(function() {
return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
});
}
// node_modules/d3-selection/src/selection/remove.js
function remove() {
var parent = this.parentNode;
if (parent)
parent.removeChild(this);
}
function remove_default() {
return this.each(remove);
}
// node_modules/d3-selection/src/selection/clone.js
function selection_cloneShallow() {
var clone3 = this.cloneNode(false), parent = this.parentNode;
return parent ? parent.insertBefore(clone3, this.nextSibling) : clone3;
}
function selection_cloneDeep() {
var clone3 = this.cloneNode(true), parent = this.parentNode;
return parent ? parent.insertBefore(clone3, this.nextSibling) : clone3;
}
function clone_default(deep) {
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
}
// node_modules/d3-selection/src/selection/datum.js
function datum_default(value) {
return arguments.length ? this.property("__data__", value) : this.node().__data__;
}
// node_modules/d3-selection/src/selection/on.js
function contextListener(listener) {
return function(event) {
listener.call(this, event, this.__data__);
};
}
function parseTypenames2(typenames) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0)
name = t.slice(i + 1), t = t.slice(0, i);
return { type: t, name };
});
}
function onRemove(typename) {
return function() {
var on = this.__on;
if (!on)
return;
for (var j = 0, i = -1, m2 = on.length, o; j < m2; ++j) {
if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.options);
} else {
on[++i] = o;
}
}
if (++i)
on.length = i;
else
delete this.__on;
};
}
function onAdd(typename, value, options) {
return function() {
var on = this.__on, o, listener = contextListener(value);
if (on)
for (var j = 0, m2 = on.length; j < m2; ++j) {
if ((o = on[j]).type === typename.type && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.options);
this.addEventListener(o.type, o.listener = listener, o.options = options);
o.value = value;
return;
}
}
this.addEventListener(typename.type, listener, options);
o = { type: typename.type, name: typename.name, value, listener, options };
if (!on)
this.__on = [o];
else
on.push(o);
};
}
function on_default(typename, value, options) {
var typenames = parseTypenames2(typename + ""), i, n2 = typenames.length, t;
if (arguments.length < 2) {
var on = this.node().__on;
if (on)
for (var j = 0, m2 = on.length, o; j < m2; ++j) {
for (i = 0, o = on[j]; i < n2; ++i) {
if ((t = typenames[i]).type === o.type && t.name === o.name) {
return o.value;
}
}
}
return;
}
on = value ? onAdd : onRemove;
for (i = 0; i < n2; ++i)
this.each(on(typenames[i], value, options));
return this;
}
// node_modules/d3-selection/src/selection/dispatch.js
function dispatchEvent(node, type2, params) {
var window2 = window_default(node), event = window2.CustomEvent;
if (typeof event === "function") {
event = new event(type2, params);
} else {
event = window2.document.createEvent("Event");
if (params)
event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
else
event.initEvent(type2, false, false);
}
node.dispatchEvent(event);
}
function dispatchConstant(type2, params) {
return function() {
return dispatchEvent(this, type2, params);
};
}
function dispatchFunction(type2, params) {
return function() {
return dispatchEvent(this, type2, params.apply(this, arguments));
};
}
function dispatch_default2(type2, params) {
return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
}
// node_modules/d3-selection/src/selection/iterator.js
function* iterator_default() {
for (var groups = this._groups, j = 0, m2 = groups.length; j < m2; ++j) {
for (var group = groups[j], i = 0, n2 = group.length, node; i < n2; ++i) {
if (node = group[i])
yield node;
}
}
}
// node_modules/d3-selection/src/selection/index.js
var root = [null];
function Selection(groups, parents) {
this._groups = groups;
this._parents = parents;
}
function selection() {
return new Selection([[document.documentElement]], root);
}
function selection_selection() {
return this;
}
Selection.prototype = selection.prototype = {
constructor: Selection,
select: select_default,
selectAll: selectAll_default,
selectChild: selectChild_default,
selectChildren: selectChildren_default,
filter: filter_default,
data: data_default,
enter: enter_default,
exit: exit_default,
join: join_default,
merge: merge_default,
selection: selection_selection,
order: order_default,
sort: sort_default,
call: call_default,
nodes: nodes_default,
node: node_default,
size: size_default,
empty: empty_default,
each: each_default,
attr: attr_default,
style: style_default,
property: property_default,
classed: classed_default,
text: text_default,
html: html_default,
raise: raise_default,
lower: lower_default,
append: append_default,
insert: insert_default,
remove: remove_default,
clone: clone_default,
datum: datum_default,
on: on_default,
dispatch: dispatch_default2,
[Symbol.iterator]: iterator_default
};
var selection_default = selection;
// node_modules/d3-selection/src/select.js
function select_default2(selector) {
return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
}
// node_modules/d3-selection/src/sourceEvent.js
function sourceEvent_default(event) {
let sourceEvent;
while (sourceEvent = event.sourceEvent)
event = sourceEvent;
return event;
}
// node_modules/d3-selection/src/pointer.js
function pointer_default(event, node) {
event = sourceEvent_default(event);
if (node === void 0)
node = event.currentTarget;
if (node) {
var svg = node.ownerSVGElement || node;
if (svg.createSVGPoint) {
var point3 = svg.createSVGPoint();
point3.x = event.clientX, point3.y = event.clientY;
point3 = point3.matrixTransform(node.getScreenCTM().inverse());
return [point3.x, point3.y];
}
if (node.getBoundingClientRect) {
var rect = node.getBoundingClientRect();
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
}
}
return [event.pageX, event.pageY];
}
// node_modules/d3-drag/src/noevent.js
function nopropagation(event) {
event.stopImmediatePropagation();
}
function noevent_default(event) {
event.preventDefault();
event.stopImmediatePropagation();
}
// node_modules/d3-drag/src/nodrag.js
function nodrag_default(view) {
var root2 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, true);
if ("onselectstart" in root2) {
selection2.on("selectstart.drag", noevent_default, true);
} else {
root2.__noselect = root2.style.MozUserSelect;
root2.style.MozUserSelect = "none";
}
}
function yesdrag(view, noclick) {
var root2 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
if (noclick) {
selection2.on("click.drag", noevent_default, true);
setTimeout(function() {
selection2.on("click.drag", null);
}, 0);
}
if ("onselectstart" in root2) {
selection2.on("selectstart.drag", null);
} else {
root2.style.MozUserSelect = root2.__noselect;
delete root2.__noselect;
}
}
// node_modules/d3-drag/src/constant.js
var constant_default2 = (x4) => () => x4;
// node_modules/d3-drag/src/event.js
function DragEvent(type2, {
sourceEvent,
subject,
target,
identifier,
active,
x: x4,
y: y4,
dx,
dy,
dispatch: dispatch2
}) {
Object.defineProperties(this, {
type: { value: type2, enumerable: true, configurable: true },
sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
subject: { value: subject, enumerable: true, configurable: true },
target: { value: target, enumerable: true, configurable: true },
identifier: { value: identifier, enumerable: true, configurable: true },
active: { value: active, enumerable: true, configurable: true },
x: { value: x4, enumerable: true, configurable: true },
y: { value: y4, enumerable: true, configurable: true },
dx: { value: dx, enumerable: true, configurable: true },
dy: { value: dy, enumerable: true, configurable: true },
_: { value: dispatch2 }
});
}
DragEvent.prototype.on = function() {
var value = this._.on.apply(this._, arguments);
return value === this._ ? this : value;
};
// node_modules/d3-drag/src/drag.js
function defaultFilter(event) {
return !event.ctrlKey && !event.button;
}
function defaultContainer() {
return this.parentNode;
}
function defaultSubject(event, d) {
return d == null ? { x: event.x, y: event.y } : d;
}
function defaultTouchable() {
return navigator.maxTouchPoints || "ontouchstart" in this;
}
function drag_default() {
var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
function drag(selection2) {
selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
function mousedowned(event, d) {
if (touchending || !filter2.call(this, event, d))
return;
var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
if (!gesture)
return;
select_default2(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
nodrag_default(event.view);
nopropagation(event);
mousemoving = false;
mousedownx = event.clientX;
mousedowny = event.clientY;
gesture("start", event);
}
function mousemoved(event) {
noevent_default(event);
if (!mousemoving) {
var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
mousemoving = dx * dx + dy * dy > clickDistance2;
}
gestures.mouse("drag", event);
}
function mouseupped(event) {
select_default2(event.view).on("mousemove.drag mouseup.drag", null);
yesdrag(event.view, mousemoving);
noevent_default(event);
gestures.mouse("end", event);
}
function touchstarted(event, d) {
if (!filter2.call(this, event, d))
return;
var touches = event.changedTouches, c3 = container.call(this, event, d), n2 = touches.length, i, gesture;
for (i = 0; i < n2; ++i) {
if (gesture = beforestart(this, c3, event, d, touches[i].identifier, touches[i])) {
nopropagation(event);
gesture("start", event, touches[i]);
}
}
}
function touchmoved(event) {
var touches = event.changedTouches, n2 = touches.length, i, gesture;
for (i = 0; i < n2; ++i) {
if (gesture = gestures[touches[i].identifier]) {
noevent_default(event);
gesture("drag", event, touches[i]);
}
}
}
function touchended(event) {
var touches = event.changedTouches, n2 = touches.length, i, gesture;
if (touchending)
clearTimeout(touchending);
touchending = setTimeout(function() {
touchending = null;
}, 500);
for (i = 0; i < n2; ++i) {
if (gesture = gestures[touches[i].identifier]) {
nopropagation(event);
gesture("end", event, touches[i]);
}
}
}
function beforestart(that, container2, event, d, identifier, touch) {
var dispatch2 = listeners.copy(), p = pointer_default(touch || event, container2), dx, dy, s2;
if ((s2 = subject.call(that, new DragEvent("beforestart", {
sourceEvent: event,
target: drag,
identifier,
active,
x: p[0],
y: p[1],
dx: 0,
dy: 0,
dispatch: dispatch2
}), d)) == null)
return;
dx = s2.x - p[0] || 0;
dy = s2.y - p[1] || 0;
return function gesture(type2, event2, touch2) {
var p0 = p, n2;
switch (type2) {
case "start":
gestures[identifier] = gesture, n2 = active++;
break;
case "end":
delete gestures[identifier], --active;
case "drag":
p = pointer_default(touch2 || event2, container2), n2 = active;
break;
}
dispatch2.call(
type2,
that,
new DragEvent(type2, {
sourceEvent: event2,
subject: s2,
target: drag,
identifier,
active: n2,
x: p[0] + dx,
y: p[1] + dy,
dx: p[0] - p0[0],
dy: p[1] - p0[1],
dispatch: dispatch2
}),
d
);
};
}
drag.filter = function(_) {
return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default2(!!_), drag) : filter2;
};
drag.container = function(_) {
return arguments.length ? (container = typeof _ === "function" ? _ : constant_default2(_), drag) : container;
};
drag.subject = function(_) {
return arguments.length ? (subject = typeof _ === "function" ? _ : constant_default2(_), drag) : subject;
};
drag.touchable = function(_) {
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default2(!!_), drag) : touchable;
};
drag.on = function() {
var value = listeners.on.apply(listeners, arguments);
return value === listeners ? drag : value;
};
drag.clickDistance = function(_) {
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
};
return drag;
}
// node_modules/d3-color/src/define.js
function define_default(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition)
prototype[key] = definition[key];
return prototype;
}
// node_modules/d3-color/src/color.js
function Color() {
}
var darker = 0.7;
var brighter = 1 / darker;
var reI = "\\s*([+-]?\\d+)\\s*";
var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
var reHex = /^#([0-9a-f]{3,8})$/;
var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
var named = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
rebeccapurple: 6697881,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
};
define_default(Color, color, {
copy: function(channels) {
return Object.assign(new this.constructor(), this, channels);
},
displayable: function() {
return this.rgb().displayable();
},
hex: color_formatHex,
// Deprecated! Use color.formatHex.
formatHex: color_formatHex,
formatHsl: color_formatHsl,
formatRgb: color_formatRgb,
toString: color_formatRgb
});
function color_formatHex() {
return this.rgb().formatHex();
}
function color_formatHsl() {
return hslConvert(this).formatHsl();
}
function color_formatRgb() {
return this.rgb().formatRgb();
}
function color(format2) {
var m2, l2;
format2 = (format2 + "").trim().toLowerCase();
return (m2 = reHex.exec(format2)) ? (l2 = m2[1].length, m2 = parseInt(m2[1], 16), l2 === 6 ? rgbn(m2) : l2 === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l2 === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l2 === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
}
function rgbn(n2) {
return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1);
}
function rgba(r, g, b, a2) {
if (a2 <= 0)
r = g = b = NaN;
return new Rgb(r, g, b, a2);
}
function rgbConvert(o) {
if (!(o instanceof Color))
o = color(o);
if (!o)
return new Rgb();
o = o.rgb();
return new Rgb(o.r, o.g, o.b, o.opacity);
}
function rgb(r, g, b, opacity) {
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function Rgb(r, g, b, opacity) {
this.r = +r;
this.g = +g;
this.b = +b;
this.opacity = +opacity;
}
define_default(Rgb, rgb, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
},
hex: rgb_formatHex,
// Deprecated! Use color.formatHex.
formatHex: rgb_formatHex,
formatRgb: rgb_formatRgb,
toString: rgb_formatRgb
}));
function rgb_formatHex() {
return "#" + hex(this.r) + hex(this.g) + hex(this.b);
}
function rgb_formatRgb() {
var a2 = this.opacity;
a2 = isNaN(a2) ? 1 : Math.max(0, Math.min(1, a2));
return (a2 === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a2 === 1 ? ")" : ", " + a2 + ")");
}
function hex(value) {
value = Math.max(0, Math.min(255, Math.round(value) || 0));
return (value < 16 ? "0" : "") + value.toString(16);
}
function hsla(h, s2, l2, a2) {
if (a2 <= 0)
h = s2 = l2 = NaN;
else if (l2 <= 0 || l2 >= 1)
h = s2 = NaN;
else if (s2 <= 0)
h = NaN;
return new Hsl(h, s2, l2, a2);
}
function hslConvert(o) {
if (o instanceof Hsl)
return new Hsl(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Color))
o = color(o);
if (!o)
return new Hsl();
if (o instanceof Hsl)
return o;
o = o.rgb();
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min3 = Math.min(r, g, b), max4 = Math.max(r, g, b), h = NaN, s2 = max4 - min3, l2 = (max4 + min3) / 2;
if (s2) {
if (r === max4)
h = (g - b) / s2 + (g < b) * 6;
else if (g === max4)
h = (b - r) / s2 + 2;
else
h = (r - g) / s2 + 4;
s2 /= l2 < 0.5 ? max4 + min3 : 2 - max4 - min3;
h *= 60;
} else {
s2 = l2 > 0 && l2 < 1 ? 0 : h;
}
return new Hsl(h, s2, l2, o.opacity);
}
function hsl(h, s2, l2, opacity) {
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s2, l2, opacity == null ? 1 : opacity);
}
function Hsl(h, s2, l2, opacity) {
this.h = +h;
this.s = +s2;
this.l = +l2;
this.opacity = +opacity;
}
define_default(Hsl, hsl, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m2 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
},
formatHsl: function() {
var a2 = this.opacity;
a2 = isNaN(a2) ? 1 : Math.max(0, Math.min(1, a2));
return (a2 === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a2 === 1 ? ")" : ", " + a2 + ")");
}
}));
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
}
// node_modules/d3-color/src/math.js
var radians = Math.PI / 180;
var degrees = 180 / Math.PI;
// node_modules/d3-color/src/cubehelix.js
var A = -0.14861;
var B = 1.78277;
var C = -0.29227;
var D = -0.90649;
var E = 1.97294;
var ED = E * D;
var EB = E * B;
var BC_DA = B * C - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix)
return new Cubehelix(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Rgb))
o = rgbConvert(o);
var r = o.r / 255, g = o.g / 255, b = o.b / 255, l2 = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l2, k = (E * (g - l2) - C * bl) / D, s2 = Math.sqrt(k * k + bl * bl) / (E * l2 * (1 - l2)), h = s2 ? Math.atan2(k, bl) * degrees - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, s2, l2, o.opacity);
}
function cubehelix(h, s2, l2, opacity) {
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s2, l2, opacity == null ? 1 : opacity);
}
function Cubehelix(h, s2, l2, opacity) {
this.h = +h;
this.s = +s2;
this.l = +l2;
this.opacity = +opacity;
}
define_default(Cubehelix, cubehelix, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * radians, l2 = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l2 * (1 - l2), cosh2 = Math.cos(h), sinh2 = Math.sin(h);
return new Rgb(
255 * (l2 + a2 * (A * cosh2 + B * sinh2)),
255 * (l2 + a2 * (C * cosh2 + D * sinh2)),
255 * (l2 + a2 * (E * cosh2)),
this.opacity
);
}
}));
// node_modules/d3-interpolate/src/basis.js
function basis(t1, v0, v1, v2, v3) {
var t2 = t1 * t1, t3 = t2 * t1;
return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
}
function basis_default(values) {
var n2 = values.length - 1;
return function(t) {
var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n2 - 1) : Math.floor(t * n2), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n2 - 1 ? values[i + 2] : 2 * v2 - v1;
return basis((t - i / n2) * n2, v0, v1, v2, v3);
};
}
// node_modules/d3-interpolate/src/basisClosed.js
function basisClosed_default(values) {
var n2 = values.length;
return function(t) {
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n2), v0 = values[(i + n2 - 1) % n2], v1 = values[i % n2], v2 = values[(i + 1) % n2], v3 = values[(i + 2) % n2];
return basis((t - i / n2) * n2, v0, v1, v2, v3);
};
}
// node_modules/d3-interpolate/src/constant.js
var constant_default3 = (x4) => () => x4;
// node_modules/d3-interpolate/src/color.js
function linear(a2, d) {
return function(t) {
return a2 + t * d;
};
}
function exponential(a2, b, y4) {
return a2 = Math.pow(a2, y4), b = Math.pow(b, y4) - a2, y4 = 1 / y4, function(t) {
return Math.pow(a2 + t * b, y4);
};
}
function hue(a2, b) {
var d = b - a2;
return d ? linear(a2, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant_default3(isNaN(a2) ? b : a2);
}
function gamma(y4) {
return (y4 = +y4) === 1 ? nogamma : function(a2, b) {
return b - a2 ? exponential(a2, b, y4) : constant_default3(isNaN(a2) ? b : a2);
};
}
function nogamma(a2, b) {
var d = b - a2;
return d ? linear(a2, d) : constant_default3(isNaN(a2) ? b : a2);
}
// node_modules/d3-interpolate/src/rgb.js
var rgb_default = function rgbGamma(y4) {
var color2 = gamma(y4);
function rgb2(start2, end) {
var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
return function(t) {
start2.r = r(t);
start2.g = g(t);
start2.b = b(t);
start2.opacity = opacity(t);
return start2 + "";
};
}
rgb2.gamma = rgbGamma;
return rgb2;
}(1);
function rgbSpline(spline) {
return function(colors) {
var n2 = colors.length, r = new Array(n2), g = new Array(n2), b = new Array(n2), i, color2;
for (i = 0; i < n2; ++i) {
color2 = rgb(colors[i]);
r[i] = color2.r || 0;
g[i] = color2.g || 0;
b[i] = color2.b || 0;
}
r = spline(r);
g = spline(g);
b = spline(b);
color2.opacity = 1;
return function(t) {
color2.r = r(t);
color2.g = g(t);
color2.b = b(t);
return color2 + "";
};
};
}
var rgbBasis = rgbSpline(basis_default);
var rgbBasisClosed = rgbSpline(basisClosed_default);
// node_modules/d3-interpolate/src/numberArray.js
function numberArray_default(a2, b) {
if (!b)
b = [];
var n2 = a2 ? Math.min(b.length, a2.length) : 0, c3 = b.slice(), i;
return function(t) {
for (i = 0; i < n2; ++i)
c3[i] = a2[i] * (1 - t) + b[i] * t;
return c3;
};
}
function isNumberArray(x4) {
return ArrayBuffer.isView(x4) && !(x4 instanceof DataView);
}
// node_modules/d3-interpolate/src/array.js
function genericArray(a2, b) {
var nb = b ? b.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x4 = new Array(na), c3 = new Array(nb), i;
for (i = 0; i < na; ++i)
x4[i] = value_default(a2[i], b[i]);
for (; i < nb; ++i)
c3[i] = b[i];
return function(t) {
for (i = 0; i < na; ++i)
c3[i] = x4[i](t);
return c3;
};
}
// node_modules/d3-interpolate/src/date.js
function date_default(a2, b) {
var d = new Date();
return a2 = +a2, b = +b, function(t) {
return d.setTime(a2 * (1 - t) + b * t), d;
};
}
// node_modules/d3-interpolate/src/number.js
function number_default2(a2, b) {
return a2 = +a2, b = +b, function(t) {
return a2 * (1 - t) + b * t;
};
}
// node_modules/d3-interpolate/src/object.js
function object_default(a2, b) {
var i = {}, c3 = {}, k;
if (a2 === null || typeof a2 !== "object")
a2 = {};
if (b === null || typeof b !== "object")
b = {};
for (k in b) {
if (k in a2) {
i[k] = value_default(a2[k], b[k]);
} else {
c3[k] = b[k];
}
}
return function(t) {
for (k in i)
c3[k] = i[k](t);
return c3;
};
}
// node_modules/d3-interpolate/src/string.js
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
function zero(b) {
return function() {
return b;
};
}
function one(b) {
return function(t) {
return b(t) + "";
};
}
function string_default(a2, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s2 = [], q = [];
a2 = a2 + "", b = b + "";
while ((am = reA.exec(a2)) && (bm = reB.exec(b))) {
if ((bs = bm.index) > bi) {
bs = b.slice(bi, bs);
if (s2[i])
s2[i] += bs;
else
s2[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) {
if (s2[i])
s2[i] += bm;
else
s2[++i] = bm;
} else {
s2[++i] = null;
q.push({ i, x: number_default2(am, bm) });
}
bi = reB.lastIndex;
}
if (bi < b.length) {
bs = b.slice(bi);
if (s2[i])
s2[i] += bs;
else
s2[++i] = bs;
}
return s2.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
for (var i2 = 0, o; i2 < b; ++i2)
s2[(o = q[i2]).i] = o.x(t);
return s2.join("");
});
}
// node_modules/d3-interpolate/src/value.js
function value_default(a2, b) {
var t = typeof b, c3;
return b == null || t === "boolean" ? constant_default3(b) : (t === "number" ? number_default2 : t === "string" ? (c3 = color(b)) ? (b = c3, rgb_default) : string_default : b instanceof color ? rgb_default : b instanceof Date ? date_default : isNumberArray(b) ? numberArray_default : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object_default : number_default2)(a2, b);
}
// node_modules/d3-interpolate/src/round.js
function round_default(a2, b) {
return a2 = +a2, b = +b, function(t) {
return Math.round(a2 * (1 - t) + b * t);
};
}
// node_modules/d3-interpolate/src/transform/decompose.js
var degrees2 = 180 / Math.PI;
var identity = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function decompose_default(a2, b, c3, d, e, f) {
var scaleX, scaleY, skewX;
if (scaleX = Math.sqrt(a2 * a2 + b * b))
a2 /= scaleX, b /= scaleX;
if (skewX = a2 * c3 + b * d)
c3 -= a2 * skewX, d -= b * skewX;
if (scaleY = Math.sqrt(c3 * c3 + d * d))
c3 /= scaleY, d /= scaleY, skewX /= scaleY;
if (a2 * d < b * c3)
a2 = -a2, b = -b, skewX = -skewX, scaleX = -scaleX;
return {
translateX: e,
translateY: f,
rotate: Math.atan2(b, a2) * degrees2,
skewX: Math.atan(skewX) * degrees2,
scaleX,
scaleY
};
}
// node_modules/d3-interpolate/src/transform/parse.js
var svgNode;
function parseCss(value) {
const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
}
function parseSvg(value) {
if (value == null)
return identity;
if (!svgNode)
svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
svgNode.setAttribute("transform", value);
if (!(value = svgNode.transform.baseVal.consolidate()))
return identity;
value = value.matrix;
return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
}
// node_modules/d3-interpolate/src/transform/index.js
function interpolateTransform(parse2, pxComma, pxParen, degParen) {
function pop(s2) {
return s2.length ? s2.pop() + " " : "";
}
function translate(xa, ya, xb, yb, s2, q) {
if (xa !== xb || ya !== yb) {
var i = s2.push("translate(", null, pxComma, null, pxParen);
q.push({ i: i - 4, x: number_default2(xa, xb) }, { i: i - 2, x: number_default2(ya, yb) });
} else if (xb || yb) {
s2.push("translate(" + xb + pxComma + yb + pxParen);
}
}
function rotate(a2, b, s2, q) {
if (a2 !== b) {
if (a2 - b > 180)
b += 360;
else if (b - a2 > 180)
a2 += 360;
q.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default2(a2, b) });
} else if (b) {
s2.push(pop(s2) + "rotate(" + b + degParen);
}
}
function skewX(a2, b, s2, q) {
if (a2 !== b) {
q.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default2(a2, b) });
} else if (b) {
s2.push(pop(s2) + "skewX(" + b + degParen);
}
}
function scale(xa, ya, xb, yb, s2, q) {
if (xa !== xb || ya !== yb) {
var i = s2.push(pop(s2) + "scale(", null, ",", null, ")");
q.push({ i: i - 4, x: number_default2(xa, xb) }, { i: i - 2, x: number_default2(ya, yb) });
} else if (xb !== 1 || yb !== 1) {
s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
}
}
return function(a2, b) {
var s2 = [], q = [];
a2 = parse2(a2), b = parse2(b);
translate(a2.translateX, a2.translateY, b.translateX, b.translateY, s2, q);
rotate(a2.rotate, b.rotate, s2, q);
skewX(a2.skewX, b.skewX, s2, q);
scale(a2.scaleX, a2.scaleY, b.scaleX, b.scaleY, s2, q);
a2 = b = null;
return function(t) {
var i = -1, n2 = q.length, o;
while (++i < n2)
s2[(o = q[i]).i] = o.x(t);
return s2.join("");
};
};
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
// node_modules/d3-interpolate/src/zoom.js
var epsilon2 = 1e-12;
function cosh(x4) {
return ((x4 = Math.exp(x4)) + 1 / x4) / 2;
}
function sinh(x4) {
return ((x4 = Math.exp(x4)) - 1 / x4) / 2;
}
function tanh(x4) {
return ((x4 = Math.exp(2 * x4)) - 1) / (x4 + 1);
}
var zoom_default = function zoomRho(rho, rho2, rho4) {
function zoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;
if (d2 < epsilon2) {
S = Math.log(w1 / w0) / rho;
i = function(t) {
return [
ux0 + t * dx,
uy0 + t * dy,
w0 * Math.exp(rho * t * S)
];
};
} else {
var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / rho;
i = function(t) {
var s2 = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
return [
ux0 + u * dx,
uy0 + u * dy,
w0 * coshr0 / cosh(rho * s2 + r0)
];
};
}
i.duration = S * 1e3 * rho / Math.SQRT2;
return i;
}
zoom.rho = function(_) {
var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
return zoomRho(_1, _2, _4);
};
return zoom;
}(Math.SQRT2, 2, 4);
// node_modules/d3-interpolate/src/cubehelix.js
function cubehelix2(hue2) {
return function cubehelixGamma(y4) {
y4 = +y4;
function cubehelix3(start2, end) {
var h = hue2((start2 = cubehelix(start2)).h, (end = cubehelix(end)).h), s2 = nogamma(start2.s, end.s), l2 = nogamma(start2.l, end.l), opacity = nogamma(start2.opacity, end.opacity);
return function(t) {
start2.h = h(t);
start2.s = s2(t);
start2.l = l2(Math.pow(t, y4));
start2.opacity = opacity(t);
return start2 + "";
};
}
cubehelix3.gamma = cubehelixGamma;
return cubehelix3;
}(1);
}
var cubehelix_default = cubehelix2(hue);
var cubehelixLong = cubehelix2(nogamma);
// node_modules/d3-interpolate/src/quantize.js
function quantize_default(interpolator, n2) {
var samples = new Array(n2);
for (var i = 0; i < n2; ++i)
samples[i] = interpolator(i / (n2 - 1));
return samples;
}
// node_modules/d3-timer/src/timer.js
var frame = 0;
var timeout = 0;
var interval = 0;
var pokeDelay = 1e3;
var taskHead;
var taskTail;
var clockLast = 0;
var clockNow = 0;
var clockSkew = 0;
var clock = typeof performance === "object" && performance.now ? performance : Date;
var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
setTimeout(f, 17);
};
function now2() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
clockNow = 0;
}
function Timer() {
this._call = this._time = this._next = null;
}
Timer.prototype = timer.prototype = {
constructor: Timer,
restart: function(callback, delay, time) {
if (typeof callback !== "function")
throw new TypeError("callback is not a function");
time = (time == null ? now2() : +time) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
if (taskTail)
taskTail._next = this;
else
taskHead = this;
taskTail = this;
}
this._call = callback;
this._time = time;
sleep();
},
stop: function() {
if (this._call) {
this._call = null;
this._time = Infinity;
sleep();
}
}
};
function timer(callback, delay, time) {
var t = new Timer();
t.restart(callback, delay, time);
return t;
}
function timerFlush() {
now2();
++frame;
var t = taskHead, e;
while (t) {
if ((e = clockNow - t._time) >= 0)
t._call.call(null, e);
t = t._next;
}
--frame;
}
function wake() {
clockNow = (clockLast = clock.now()) + clockSkew;
frame = timeout = 0;
try {
timerFlush();
} finally {
frame = 0;
nap();
clockNow = 0;
}
}
function poke() {
var now3 = clock.now(), delay = now3 - clockLast;
if (delay > pokeDelay)
clockSkew -= delay, clockLast = now3;
}
function nap() {
var t0, t1 = taskHead, t2, time = Infinity;
while (t1) {
if (t1._call) {
if (time > t1._time)
time = t1._time;
t0 = t1, t1 = t1._next;
} else {
t2 = t1._next, t1._next = null;
t1 = t0 ? t0._next = t2 : taskHead = t2;
}
}
taskTail = t0;
sleep(time);
}
function sleep(time) {
if (frame)
return;
if (timeout)
timeout = clearTimeout(timeout);
var delay = time - clockNow;
if (delay > 24) {
if (time < Infinity)
timeout = setTimeout(wake, time - clock.now() - clockSkew);
if (interval)
interval = clearInterval(interval);
} else {
if (!interval)
clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
// node_modules/d3-timer/src/timeout.js
function timeout_default(callback, delay, time) {
var t = new Timer();
delay = delay == null ? 0 : +delay;
t.restart((elapsed) => {
t.stop();
callback(elapsed + delay);
}, delay, time);
return t;
}
// node_modules/d3-transition/src/transition/schedule.js
var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
var emptyTween = [];
var CREATED = 0;
var SCHEDULED = 1;
var STARTING = 2;
var STARTED = 3;
var RUNNING = 4;
var ENDING = 5;
var ENDED = 6;
function schedule_default(node, name, id2, index2, group, timing) {
var schedules = node.__transition;
if (!schedules)
node.__transition = {};
else if (id2 in schedules)
return;
create(node, id2, {
name,
index: index2,
// For context during callback.
group,
// For context during callback.
on: emptyOn,
tween: emptyTween,
time: timing.time,
delay: timing.delay,
duration: timing.duration,
ease: timing.ease,
timer: null,
state: CREATED
});
}
function init2(node, id2) {
var schedule = get2(node, id2);
if (schedule.state > CREATED)
throw new Error("too late; already scheduled");
return schedule;
}
function set2(node, id2) {
var schedule = get2(node, id2);
if (schedule.state > STARTED)
throw new Error("too late; already running");
return schedule;
}
function get2(node, id2) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id2]))
throw new Error("transition not found");
return schedule;
}
function create(node, id2, self2) {
var schedules = node.__transition, tween;
schedules[id2] = self2;
self2.timer = timer(schedule, 0, self2.time);
function schedule(elapsed) {
self2.state = SCHEDULED;
self2.timer.restart(start2, self2.delay, self2.time);
if (self2.delay <= elapsed)
start2(elapsed - self2.delay);
}
function start2(elapsed) {
var i, j, n2, o;
if (self2.state !== SCHEDULED)
return stop();
for (i in schedules) {
o = schedules[i];
if (o.name !== self2.name)
continue;
if (o.state === STARTED)
return timeout_default(start2);
if (o.state === RUNNING) {
o.state = ENDED;
o.timer.stop();
o.on.call("interrupt", node, node.__data__, o.index, o.group);
delete schedules[i];
} else if (+i < id2) {
o.state = ENDED;
o.timer.stop();
o.on.call("cancel", node, node.__data__, o.index, o.group);
delete schedules[i];
}
}
timeout_default(function() {
if (self2.state === STARTED) {
self2.state = RUNNING;
self2.timer.restart(tick2, self2.delay, self2.time);
tick2(elapsed);
}
});
self2.state = STARTING;
self2.on.call("start", node, node.__data__, self2.index, self2.group);
if (self2.state !== STARTING)
return;
self2.state = STARTED;
tween = new Array(n2 = self2.tween.length);
for (i = 0, j = -1; i < n2; ++i) {
if (o = self2.tween[i].value.call(node, node.__data__, self2.index, self2.group)) {
tween[++j] = o;
}
}
tween.length = j + 1;
}
function tick2(elapsed) {
var t = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i = -1, n2 = tween.length;
while (++i < n2) {
tween[i].call(node, t);
}
if (self2.state === ENDING) {
self2.on.call("end", node, node.__data__, self2.index, self2.group);
stop();
}
}
function stop() {
self2.state = ENDED;
self2.timer.stop();
delete schedules[id2];
for (var i in schedules)
return;
delete node.__transition;
}
}
// node_modules/d3-transition/src/interrupt.js
function interrupt_default(node, name) {
var schedules = node.__transition, schedule, active, empty3 = true, i;
if (!schedules)
return;
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).name !== name) {
empty3 = false;
continue;
}
active = schedule.state > STARTING && schedule.state < ENDING;
schedule.state = ENDED;
schedule.timer.stop();
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
delete schedules[i];
}
if (empty3)
delete node.__transition;
}
// node_modules/d3-transition/src/selection/interrupt.js
function interrupt_default2(name) {
return this.each(function() {
interrupt_default(this, name);
});
}
// node_modules/d3-transition/src/transition/tween.js
function tweenRemove(id2, name) {
var tween0, tween1;
return function() {
var schedule = set2(this, id2), tween = schedule.tween;
if (tween !== tween0) {
tween1 = tween0 = tween;
for (var i = 0, n2 = tween1.length; i < n2; ++i) {
if (tween1[i].name === name) {
tween1 = tween1.slice();
tween1.splice(i, 1);
break;
}
}
}
schedule.tween = tween1;
};
}
function tweenFunction(id2, name, value) {
var tween0, tween1;
if (typeof value !== "function")
throw new Error();
return function() {
var schedule = set2(this, id2), tween = schedule.tween;
if (tween !== tween0) {
tween1 = (tween0 = tween).slice();
for (var t = { name, value }, i = 0, n2 = tween1.length; i < n2; ++i) {
if (tween1[i].name === name) {
tween1[i] = t;
break;
}
}
if (i === n2)
tween1.push(t);
}
schedule.tween = tween1;
};
}
function tween_default(name, value) {
var id2 = this._id;
name += "";
if (arguments.length < 2) {
var tween = get2(this.node(), id2).tween;
for (var i = 0, n2 = tween.length, t; i < n2; ++i) {
if ((t = tween[i]).name === name) {
return t.value;
}
}
return null;
}
return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
}
function tweenValue(transition2, name, value) {
var id2 = transition2._id;
transition2.each(function() {
var schedule = set2(this, id2);
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
});
return function(node) {
return get2(node, id2).value[name];
};
}
// node_modules/d3-transition/src/transition/interpolate.js
function interpolate_default(a2, b) {
var c3;
return (typeof b === "number" ? number_default2 : b instanceof color ? rgb_default : (c3 = color(b)) ? (b = c3, rgb_default) : string_default)(a2, b);
}
// node_modules/d3-transition/src/transition/attr.js
function attrRemove2(name) {
return function() {
this.removeAttribute(name);
};
}
function attrRemoveNS2(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function attrConstant2(name, interpolate, value1) {
var string00, string1 = value1 + "", interpolate0;
return function() {
var string0 = this.getAttribute(name);
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
};
}
function attrConstantNS2(fullname, interpolate, value1) {
var string00, string1 = value1 + "", interpolate0;
return function() {
var string0 = this.getAttributeNS(fullname.space, fullname.local);
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
};
}
function attrFunction2(name, interpolate, value) {
var string00, string10, interpolate0;
return function() {
var string0, value1 = value(this), string1;
if (value1 == null)
return void this.removeAttribute(name);
string0 = this.getAttribute(name);
string1 = value1 + "";
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function attrFunctionNS2(fullname, interpolate, value) {
var string00, string10, interpolate0;
return function() {
var string0, value1 = value(this), string1;
if (value1 == null)
return void this.removeAttributeNS(fullname.space, fullname.local);
string0 = this.getAttributeNS(fullname.space, fullname.local);
string1 = value1 + "";
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function attr_default2(name, value) {
var fullname = namespace_default(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i, value));
}
// node_modules/d3-transition/src/transition/attrTween.js
function attrInterpolate(name, i) {
return function(t) {
this.setAttribute(name, i.call(this, t));
};
}
function attrInterpolateNS(fullname, i) {
return function(t) {
this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
};
}
function attrTweenNS(fullname, value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0)
t0 = (i0 = i) && attrInterpolateNS(fullname, i);
return t0;
}
tween._value = value;
return tween;
}
function attrTween(name, value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0)
t0 = (i0 = i) && attrInterpolate(name, i);
return t0;
}
tween._value = value;
return tween;
}
function attrTween_default(name, value) {
var key = "attr." + name;
if (arguments.length < 2)
return (key = this.tween(key)) && key._value;
if (value == null)
return this.tween(key, null);
if (typeof value !== "function")
throw new Error();
var fullname = namespace_default(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
}
// node_modules/d3-transition/src/transition/delay.js
function delayFunction(id2, value) {
return function() {
init2(this, id2).delay = +value.apply(this, arguments);
};
}
function delayConstant(id2, value) {
return value = +value, function() {
init2(this, id2).delay = value;
};
}
function delay_default(value) {
var id2 = this._id;
return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
}
// node_modules/d3-transition/src/transition/duration.js
function durationFunction(id2, value) {
return function() {
set2(this, id2).duration = +value.apply(this, arguments);
};
}
function durationConstant(id2, value) {
return value = +value, function() {
set2(this, id2).duration = value;
};
}
function duration_default(value) {
var id2 = this._id;
return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
}
// node_modules/d3-transition/src/transition/ease.js
function easeConstant(id2, value) {
if (typeof value !== "function")
throw new Error();
return function() {
set2(this, id2).ease = value;
};
}
function ease_default(value) {
var id2 = this._id;
return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
}
// node_modules/d3-transition/src/transition/easeVarying.js
function easeVarying(id2, value) {
return function() {
var v = value.apply(this, arguments);
if (typeof v !== "function")
throw new Error();
set2(this, id2).ease = v;
};
}
function easeVarying_default(value) {
if (typeof value !== "function")
throw new Error();
return this.each(easeVarying(this._id, value));
}
// node_modules/d3-transition/src/transition/filter.js
function filter_default2(match2) {
if (typeof match2 !== "function")
match2 = matcher_default(match2);
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n2; ++i) {
if ((node = group[i]) && match2.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
}
}
return new Transition(subgroups, this._parents, this._name, this._id);
}
// node_modules/d3-transition/src/transition/merge.js
function merge_default2(transition2) {
if (transition2._id !== this._id)
throw new Error();
for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n2 = group0.length, merge = merges[j] = new Array(n2), node, i = 0; i < n2; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Transition(merges, this._parents, this._name, this._id);
}
// node_modules/d3-transition/src/transition/on.js
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
var i = t.indexOf(".");
if (i >= 0)
t = t.slice(0, i);
return !t || t === "start";
});
}
function onFunction(id2, name, listener) {
var on0, on1, sit = start(name) ? init2 : set2;
return function() {
var schedule = sit(this, id2), on = schedule.on;
if (on !== on0)
(on1 = (on0 = on).copy()).on(name, listener);
schedule.on = on1;
};
}
function on_default2(name, listener) {
var id2 = this._id;
return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
}
// node_modules/d3-transition/src/transition/remove.js
function removeFunction(id2) {
return function() {
var parent = this.parentNode;
for (var i in this.__transition)
if (+i !== id2)
return;
if (parent)
parent.removeChild(this);
};
}
function remove_default2() {
return this.on("end.remove", removeFunction(this._id));
}
// node_modules/d3-transition/src/transition/select.js
function select_default3(select) {
var name = this._name, id2 = this._id;
if (typeof select !== "function")
select = selector_default(select);
for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, subgroup = subgroups[j] = new Array(n2), node, subnode, i = 0; i < n2; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node)
subnode.__data__ = node.__data__;
subgroup[i] = subnode;
schedule_default(subgroup[i], name, id2, i, subgroup, get2(node, id2));
}
}
}
return new Transition(subgroups, this._parents, name, id2);
}
// node_modules/d3-transition/src/transition/selectAll.js
function selectAll_default2(select) {
var name = this._name, id2 = this._id;
if (typeof select !== "function")
select = selectorAll_default(select);
for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, node, i = 0; i < n2; ++i) {
if (node = group[i]) {
for (var children3 = select.call(node, node.__data__, i, group), child, inherit2 = get2(node, id2), k = 0, l2 = children3.length; k < l2; ++k) {
if (child = children3[k]) {
schedule_default(child, name, id2, k, children3, inherit2);
}
}
subgroups.push(children3);
parents.push(node);
}
}
}
return new Transition(subgroups, parents, name, id2);
}
// node_modules/d3-transition/src/transition/selection.js
var Selection2 = selection_default.prototype.constructor;
function selection_default2() {
return new Selection2(this._groups, this._parents);
}
// node_modules/d3-transition/src/transition/style.js
function styleNull(name, interpolate) {
var string00, string10, interpolate0;
return function() {
var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
};
}
function styleRemove2(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleConstant2(name, interpolate, value1) {
var string00, string1 = value1 + "", interpolate0;
return function() {
var string0 = styleValue(this, name);
return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
};
}
function styleFunction2(name, interpolate, value) {
var string00, string10, interpolate0;
return function() {
var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
if (value1 == null)
string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
};
}
function styleMaybeRemove(id2, name) {
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
return function() {
var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
if (on !== on0 || listener0 !== listener)
(on1 = (on0 = on).copy()).on(event, listener0 = listener);
schedule.on = on1;
};
}
function style_default2(name, value, priority) {
var i = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i, value), priority).on("end.style." + name, null);
}
// node_modules/d3-transition/src/transition/styleTween.js
function styleInterpolate(name, i, priority) {
return function(t) {
this.style.setProperty(name, i.call(this, t), priority);
};
}
function styleTween(name, value, priority) {
var t, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0)
t = (i0 = i) && styleInterpolate(name, i, priority);
return t;
}
tween._value = value;
return tween;
}
function styleTween_default(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2)
return (key = this.tween(key)) && key._value;
if (value == null)
return this.tween(key, null);
if (typeof value !== "function")
throw new Error();
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
}
// node_modules/d3-transition/src/transition/text.js
function textConstant2(value) {
return function() {
this.textContent = value;
};
}
function textFunction2(value) {
return function() {
var value1 = value(this);
this.textContent = value1 == null ? "" : value1;
};
}
function text_default2(value) {
return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
}
// node_modules/d3-transition/src/transition/textTween.js
function textInterpolate(i) {
return function(t) {
this.textContent = i.call(this, t);
};
}
function textTween(value) {
var t0, i0;
function tween() {
var i = value.apply(this, arguments);
if (i !== i0)
t0 = (i0 = i) && textInterpolate(i);
return t0;
}
tween._value = value;
return tween;
}
function textTween_default(value) {
var key = "text";
if (arguments.length < 1)
return (key = this.tween(key)) && key._value;
if (value == null)
return this.tween(key, null);
if (typeof value !== "function")
throw new Error();
return this.tween(key, textTween(value));
}
// node_modules/d3-transition/src/transition/transition.js
function transition_default() {
var name = this._name, id0 = this._id, id1 = newId();
for (var groups = this._groups, m2 = groups.length, j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, node, i = 0; i < n2; ++i) {
if (node = group[i]) {
var inherit2 = get2(node, id0);
schedule_default(node, name, id1, i, group, {
time: inherit2.time + inherit2.delay + inherit2.duration,
delay: 0,
duration: inherit2.duration,
ease: inherit2.ease
});
}
}
}
return new Transition(groups, this._parents, name, id1);
}
// node_modules/d3-transition/src/transition/end.js
function end_default() {
var on0, on1, that = this, id2 = that._id, size = that.size();
return new Promise(function(resolve, reject) {
var cancel = { value: reject }, end = { value: function() {
if (--size === 0)
resolve();
} };
that.each(function() {
var schedule = set2(this, id2), on = schedule.on;
if (on !== on0) {
on1 = (on0 = on).copy();
on1._.cancel.push(cancel);
on1._.interrupt.push(cancel);
on1._.end.push(end);
}
schedule.on = on1;
});
if (size === 0)
resolve();
});
}
// node_modules/d3-transition/src/transition/index.js
var id = 0;
function Transition(groups, parents, name, id2) {
this._groups = groups;
this._parents = parents;
this._name = name;
this._id = id2;
}
function transition(name) {
return selection_default().transition(name);
}
function newId() {
return ++id;
}
var selection_prototype = selection_default.prototype;
Transition.prototype = transition.prototype = {
constructor: Transition,
select: select_default3,
selectAll: selectAll_default2,
filter: filter_default2,
merge: merge_default2,
selection: selection_default2,
transition: transition_default,
call: selection_prototype.call,
nodes: selection_prototype.nodes,
node: selection_prototype.node,
size: selection_prototype.size,
empty: selection_prototype.empty,
each: selection_prototype.each,
on: on_default2,
attr: attr_default2,
attrTween: attrTween_default,
style: style_default2,
styleTween: styleTween_default,
text: text_default2,
textTween: textTween_default,
remove: remove_default2,
tween: tween_default,
delay: delay_default,
duration: duration_default,
ease: ease_default,
easeVarying: easeVarying_default,
end: end_default,
[Symbol.iterator]: selection_prototype[Symbol.iterator]
};
// node_modules/d3-ease/src/cubic.js
function cubicInOut(t) {
return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
// node_modules/d3-transition/src/selection/transition.js
var defaultTiming = {
time: null,
// Set on use.
delay: 0,
duration: 250,
ease: cubicInOut
};
function inherit(node, id2) {
var timing;
while (!(timing = node.__transition) || !(timing = timing[id2])) {
if (!(node = node.parentNode)) {
throw new Error(`transition ${id2} not found`);
}
}
return timing;
}
function transition_default2(name) {
var id2, timing;
if (name instanceof Transition) {
id2 = name._id, name = name._name;
} else {
id2 = newId(), (timing = defaultTiming).time = now2(), name = name == null ? null : name + "";
}
for (var groups = this._groups, m2 = groups.length, j = 0; j < m2; ++j) {
for (var group = groups[j], n2 = group.length, node, i = 0; i < n2; ++i) {
if (node = group[i]) {
schedule_default(node, name, id2, i, group, timing || inherit(node, id2));
}
}
}
return new Transition(groups, this._parents, name, id2);
}
// node_modules/d3-transition/src/selection/index.js
selection_default.prototype.interrupt = interrupt_default2;
selection_default.prototype.transition = transition_default2;
// node_modules/d3-brush/src/brush.js
var { abs, max: max2, min } = Math;
function number1(e) {
return [+e[0], +e[1]];
}
function number2(e) {
return [number1(e[0]), number1(e[1])];
}
var X = {
name: "x",
handles: ["w", "e"].map(type),
input: function(x4, e) {
return x4 == null ? null : [[+x4[0], e[0][1]], [+x4[1], e[1][1]]];
},
output: function(xy) {
return xy && [xy[0][0], xy[1][0]];
}
};
var Y = {
name: "y",
handles: ["n", "s"].map(type),
input: function(y4, e) {
return y4 == null ? null : [[e[0][0], +y4[0]], [e[1][0], +y4[1]]];
},
output: function(xy) {
return xy && [xy[0][1], xy[1][1]];
}
};
var XY = {
name: "xy",
handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
input: function(xy) {
return xy == null ? null : number2(xy);
},
output: function(xy) {
return xy;
}
};
function type(t) {
return { type: t };
}
// node_modules/d3-path/src/path.js
var pi = Math.PI;
var tau = 2 * pi;
var epsilon = 1e-6;
var tauEpsilon = tau - epsilon;
function Path() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null;
this._ = "";
}
function path() {
return new Path();
}
Path.prototype = path.prototype = {
constructor: Path,
moveTo: function(x4, y4) {
this._ += "M" + (this._x0 = this._x1 = +x4) + "," + (this._y0 = this._y1 = +y4);
},
closePath: function() {
if (this._x1 !== null) {
this._x1 = this._x0, this._y1 = this._y0;
this._ += "Z";
}
},
lineTo: function(x4, y4) {
this._ += "L" + (this._x1 = +x4) + "," + (this._y1 = +y4);
},
quadraticCurveTo: function(x1, y1, x4, y4) {
this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x4) + "," + (this._y1 = +y4);
},
bezierCurveTo: function(x1, y1, x22, y22, x4, y4) {
this._ += "C" + +x1 + "," + +y1 + "," + +x22 + "," + +y22 + "," + (this._x1 = +x4) + "," + (this._y1 = +y4);
},
arcTo: function(x1, y1, x22, y22, r) {
x1 = +x1, y1 = +y1, x22 = +x22, y22 = +y22, r = +r;
var x0 = this._x1, y0 = this._y1, x21 = x22 - x1, y21 = y22 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
if (r < 0)
throw new Error("negative radius: " + r);
if (this._x1 === null) {
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
} else if (!(l01_2 > epsilon))
;
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
} else {
var x20 = x22 - x0, y20 = y22 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l2 = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l2 / l01, t21 = l2 / l21;
if (Math.abs(t01 - 1) > epsilon) {
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
}
this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
}
},
arc: function(x4, y4, r, a0, a1, ccw) {
x4 = +x4, y4 = +y4, r = +r, ccw = !!ccw;
var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x4 + dx, y0 = y4 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
if (r < 0)
throw new Error("negative radius: " + r);
if (this._x1 === null) {
this._ += "M" + x0 + "," + y0;
} else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
this._ += "L" + x0 + "," + y0;
}
if (!r)
return;
if (da < 0)
da = da % tau + tau;
if (da > tauEpsilon) {
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x4 - dx) + "," + (y4 - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
} else if (da > epsilon) {
this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x4 + r * Math.cos(a1)) + "," + (this._y1 = y4 + r * Math.sin(a1));
}
},
rect: function(x4, y4, w, h) {
this._ += "M" + (this._x0 = this._x1 = +x4) + "," + (this._y0 = this._y1 = +y4) + "h" + +w + "v" + +h + "h" + -w + "Z";
},
toString: function() {
return this._;
}
};
var path_default = path;
// node_modules/d3-force/src/center.js
function center_default(x4, y4) {
var nodes, strength = 1;
if (x4 == null)
x4 = 0;
if (y4 == null)
y4 = 0;
function force() {
var i, n2 = nodes.length, node, sx = 0, sy = 0;
for (i = 0; i < n2; ++i) {
node = nodes[i], sx += node.x, sy += node.y;
}
for (sx = (sx / n2 - x4) * strength, sy = (sy / n2 - y4) * strength, i = 0; i < n2; ++i) {
node = nodes[i], node.x -= sx, node.y -= sy;
}
}
force.initialize = function(_) {
nodes = _;
};
force.x = function(_) {
return arguments.length ? (x4 = +_, force) : x4;
};
force.y = function(_) {
return arguments.length ? (y4 = +_, force) : y4;
};
force.strength = function(_) {
return arguments.length ? (strength = +_, force) : strength;
};
return force;
}
// node_modules/d3-quadtree/src/add.js
function add_default(d) {
const x4 = +this._x.call(null, d), y4 = +this._y.call(null, d);
return add(this.cover(x4, y4), x4, y4, d);
}
function add(tree, x4, y4, d) {
if (isNaN(x4) || isNaN(y4))
return tree;
var parent, node = tree._root, leaf = { data: d }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j;
if (!node)
return tree._root = leaf, tree;
while (node.length) {
if (right = x4 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y4 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
if (parent = node, !(node = node[i = bottom << 1 | right]))
return parent[i] = leaf, tree;
}
xp = +tree._x.call(null, node.data);
yp = +tree._y.call(null, node.data);
if (x4 === xp && y4 === yp)
return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
do {
parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
if (right = x4 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y4 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
} while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm));
return parent[j] = node, parent[i] = leaf, tree;
}
function addAll(data) {
var d, i, n2 = data.length, x4, y4, xz = new Array(n2), yz = new Array(n2), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
for (i = 0; i < n2; ++i) {
if (isNaN(x4 = +this._x.call(null, d = data[i])) || isNaN(y4 = +this._y.call(null, d)))
continue;
xz[i] = x4;
yz[i] = y4;
if (x4 < x0)
x0 = x4;
if (x4 > x1)
x1 = x4;
if (y4 < y0)
y0 = y4;
if (y4 > y1)
y1 = y4;
}
if (x0 > x1 || y0 > y1)
return this;
this.cover(x0, y0).cover(x1, y1);
for (i = 0; i < n2; ++i) {
add(this, xz[i], yz[i], data[i]);
}
return this;
}
// node_modules/d3-quadtree/src/cover.js
function cover_default(x4, y4) {
if (isNaN(x4 = +x4) || isNaN(y4 = +y4))
return this;
var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
if (isNaN(x0)) {
x1 = (x0 = Math.floor(x4)) + 1;
y1 = (y0 = Math.floor(y4)) + 1;
} else {
var z = x1 - x0 || 1, node = this._root, parent, i;
while (x0 > x4 || x4 >= x1 || y0 > y4 || y4 >= y1) {
i = (y4 < y0) << 1 | x4 < x0;
parent = new Array(4), parent[i] = node, node = parent, z *= 2;
switch (i) {
case 0:
x1 = x0 + z, y1 = y0 + z;
break;
case 1:
x0 = x1 - z, y1 = y0 + z;
break;
case 2:
x1 = x0 + z, y0 = y1 - z;
break;
case 3:
x0 = x1 - z, y0 = y1 - z;
break;
}
}
if (this._root && this._root.length)
this._root = node;
}
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
return this;
}
// node_modules/d3-quadtree/src/data.js
function data_default2() {
var data = [];
this.visit(function(node) {
if (!node.length)
do
data.push(node.data);
while (node = node.next);
});
return data;
}
// node_modules/d3-quadtree/src/extent.js
function extent_default(_) {
return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]];
}
// node_modules/d3-quadtree/src/quad.js
function quad_default(node, x0, y0, x1, y1) {
this.node = node;
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
}
// node_modules/d3-quadtree/src/find.js
function find_default(x4, y4, radius) {
var data, x0 = this._x0, y0 = this._y0, x1, y1, x22, y22, x32 = this._x1, y32 = this._y1, quads = [], node = this._root, q, i;
if (node)
quads.push(new quad_default(node, x0, y0, x32, y32));
if (radius == null)
radius = Infinity;
else {
x0 = x4 - radius, y0 = y4 - radius;
x32 = x4 + radius, y32 = y4 + radius;
radius *= radius;
}
while (q = quads.pop()) {
if (!(node = q.node) || (x1 = q.x0) > x32 || (y1 = q.y0) > y32 || (x22 = q.x1) < x0 || (y22 = q.y1) < y0)
continue;
if (node.length) {
var xm = (x1 + x22) / 2, ym = (y1 + y22) / 2;
quads.push(
new quad_default(node[3], xm, ym, x22, y22),
new quad_default(node[2], x1, ym, xm, y22),
new quad_default(node[1], xm, y1, x22, ym),
new quad_default(node[0], x1, y1, xm, ym)
);
if (i = (y4 >= ym) << 1 | x4 >= xm) {
q = quads[quads.length - 1];
quads[quads.length - 1] = quads[quads.length - 1 - i];
quads[quads.length - 1 - i] = q;
}
} else {
var dx = x4 - +this._x.call(null, node.data), dy = y4 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
if (d2 < radius) {
var d = Math.sqrt(radius = d2);
x0 = x4 - d, y0 = y4 - d;
x32 = x4 + d, y32 = y4 + d;
data = node.data;
}
}
}
return data;
}
// node_modules/d3-quadtree/src/remove.js
function remove_default3(d) {
if (isNaN(x4 = +this._x.call(null, d)) || isNaN(y4 = +this._y.call(null, d)))
return this;
var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x4, y4, xm, ym, right, bottom, i, j;
if (!node)
return this;
if (node.length)
while (true) {
if (right = x4 >= (xm = (x0 + x1) / 2))
x0 = xm;
else
x1 = xm;
if (bottom = y4 >= (ym = (y0 + y1) / 2))
y0 = ym;
else
y1 = ym;
if (!(parent = node, node = node[i = bottom << 1 | right]))
return this;
if (!node.length)
break;
if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3])
retainer = parent, j = i;
}
while (node.data !== d)
if (!(previous = node, node = node.next))
return this;
if (next = node.next)
delete node.next;
if (previous)
return next ? previous.next = next : delete previous.next, this;
if (!parent)
return this._root = next, this;
next ? parent[i] = next : delete parent[i];
if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) {
if (retainer)
retainer[j] = node;
else
this._root = node;
}
return this;
}
function removeAll(data) {
for (var i = 0, n2 = data.length; i < n2; ++i)
this.remove(data[i]);
return this;
}
// node_modules/d3-quadtree/src/root.js
function root_default() {
return this._root;
}
// node_modules/d3-quadtree/src/size.js
function size_default2() {
var size = 0;
this.visit(function(node) {
if (!node.length)
do
++size;
while (node = node.next);
});
return size;
}
// node_modules/d3-quadtree/src/visit.js
function visit_default(callback) {
var quads = [], q, node = this._root, child, x0, y0, x1, y1;
if (node)
quads.push(new quad_default(node, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[3])
quads.push(new quad_default(child, xm, ym, x1, y1));
if (child = node[2])
quads.push(new quad_default(child, x0, ym, xm, y1));
if (child = node[1])
quads.push(new quad_default(child, xm, y0, x1, ym));
if (child = node[0])
quads.push(new quad_default(child, x0, y0, xm, ym));
}
}
return this;
}
// node_modules/d3-quadtree/src/visitAfter.js
function visitAfter_default(callback) {
var quads = [], next = [], q;
if (this._root)
quads.push(new quad_default(this._root, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
var node = q.node;
if (node.length) {
var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[0])
quads.push(new quad_default(child, x0, y0, xm, ym));
if (child = node[1])
quads.push(new quad_default(child, xm, y0, x1, ym));
if (child = node[2])
quads.push(new quad_default(child, x0, ym, xm, y1));
if (child = node[3])
quads.push(new quad_default(child, xm, ym, x1, y1));
}
next.push(q);
}
while (q = next.pop()) {
callback(q.node, q.x0, q.y0, q.x1, q.y1);
}
return this;
}
// node_modules/d3-quadtree/src/x.js
function defaultX(d) {
return d[0];
}
function x_default(_) {
return arguments.length ? (this._x = _, this) : this._x;
}
// node_modules/d3-quadtree/src/y.js
function defaultY(d) {
return d[1];
}
function y_default(_) {
return arguments.length ? (this._y = _, this) : this._y;
}
// node_modules/d3-quadtree/src/quadtree.js
function quadtree(nodes, x4, y4) {
var tree = new Quadtree(x4 == null ? defaultX : x4, y4 == null ? defaultY : y4, NaN, NaN, NaN, NaN);
return nodes == null ? tree : tree.addAll(nodes);
}
function Quadtree(x4, y4, x0, y0, x1, y1) {
this._x = x4;
this._y = y4;
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
this._root = void 0;
}
function leaf_copy(leaf) {
var copy3 = { data: leaf.data }, next = copy3;
while (leaf = leaf.next)
next = next.next = { data: leaf.data };
return copy3;
}
var treeProto = quadtree.prototype = Quadtree.prototype;
treeProto.copy = function() {
var copy3 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child;
if (!node)
return copy3;
if (!node.length)
return copy3._root = leaf_copy(node), copy3;
nodes = [{ source: node, target: copy3._root = new Array(4) }];
while (node = nodes.pop()) {
for (var i = 0; i < 4; ++i) {
if (child = node.source[i]) {
if (child.length)
nodes.push({ source: child, target: node.target[i] = new Array(4) });
else
node.target[i] = leaf_copy(child);
}
}
}
return copy3;
};
treeProto.add = add_default;
treeProto.addAll = addAll;
treeProto.cover = cover_default;
treeProto.data = data_default2;
treeProto.extent = extent_default;
treeProto.find = find_default;
treeProto.remove = remove_default3;
treeProto.removeAll = removeAll;
treeProto.root = root_default;
treeProto.size = size_default2;
treeProto.visit = visit_default;
treeProto.visitAfter = visitAfter_default;
treeProto.x = x_default;
treeProto.y = y_default;
// node_modules/d3-force/src/constant.js
function constant_default5(x4) {
return function() {
return x4;
};
}
// node_modules/d3-force/src/jiggle.js
function jiggle_default(random) {
return (random() - 0.5) * 1e-6;
}
// node_modules/d3-force/src/collide.js
function x(d) {
return d.x + d.vx;
}
function y(d) {
return d.y + d.vy;
}
function collide_default(radius) {
var nodes, radii, random, strength = 1, iterations = 1;
if (typeof radius !== "function")
radius = constant_default5(radius == null ? 1 : +radius);
function force() {
var i, n2 = nodes.length, tree, node, xi, yi, ri, ri2;
for (var k = 0; k < iterations; ++k) {
tree = quadtree(nodes, x, y).visitAfter(prepare);
for (i = 0; i < n2; ++i) {
node = nodes[i];
ri = radii[node.index], ri2 = ri * ri;
xi = node.x + node.vx;
yi = node.y + node.vy;
tree.visit(apply);
}
}
function apply(quad, x0, y0, x1, y1) {
var data = quad.data, rj = quad.r, r = ri + rj;
if (data) {
if (data.index > node.index) {
var x4 = xi - data.x - data.vx, y4 = yi - data.y - data.vy, l2 = x4 * x4 + y4 * y4;
if (l2 < r * r) {
if (x4 === 0)
x4 = jiggle_default(random), l2 += x4 * x4;
if (y4 === 0)
y4 = jiggle_default(random), l2 += y4 * y4;
l2 = (r - (l2 = Math.sqrt(l2))) / l2 * strength;
node.vx += (x4 *= l2) * (r = (rj *= rj) / (ri2 + rj));
node.vy += (y4 *= l2) * r;
data.vx -= x4 * (r = 1 - r);
data.vy -= y4 * r;
}
}
return;
}
return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
}
}
function prepare(quad) {
if (quad.data)
return quad.r = radii[quad.data.index];
for (var i = quad.r = 0; i < 4; ++i) {
if (quad[i] && quad[i].r > quad.r) {
quad.r = quad[i].r;
}
}
}
function initialize() {
if (!nodes)
return;
var i, n2 = nodes.length, node;
radii = new Array(n2);
for (i = 0; i < n2; ++i)
node = nodes[i], radii[node.index] = +radius(node, i, nodes);
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random = _random;
initialize();
};
force.iterations = function(_) {
return arguments.length ? (iterations = +_, force) : iterations;
};
force.strength = function(_) {
return arguments.length ? (strength = +_, force) : strength;
};
force.radius = function(_) {
return arguments.length ? (radius = typeof _ === "function" ? _ : constant_default5(+_), initialize(), force) : radius;
};
return force;
}
// node_modules/d3-force/src/link.js
function index(d) {
return d.index;
}
function find2(nodeById, nodeId) {
var node = nodeById.get(nodeId);
if (!node)
throw new Error("node not found: " + nodeId);
return node;
}
function link_default(links) {
var id2 = index, strength = defaultStrength, strengths, distance = constant_default5(30), distances, nodes, count2, bias, random, iterations = 1;
if (links == null)
links = [];
function defaultStrength(link2) {
return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]);
}
function force(alpha) {
for (var k = 0, n2 = links.length; k < iterations; ++k) {
for (var i = 0, link2, source, target, x4, y4, l2, b; i < n2; ++i) {
link2 = links[i], source = link2.source, target = link2.target;
x4 = target.x + target.vx - source.x - source.vx || jiggle_default(random);
y4 = target.y + target.vy - source.y - source.vy || jiggle_default(random);
l2 = Math.sqrt(x4 * x4 + y4 * y4);
l2 = (l2 - distances[i]) / l2 * alpha * strengths[i];
x4 *= l2, y4 *= l2;
target.vx -= x4 * (b = bias[i]);
target.vy -= y4 * b;
source.vx += x4 * (b = 1 - b);
source.vy += y4 * b;
}
}
}
function initialize() {
if (!nodes)
return;
var i, n2 = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d, i2) => [id2(d, i2, nodes), d])), link2;
for (i = 0, count2 = new Array(n2); i < m2; ++i) {
link2 = links[i], link2.index = i;
if (typeof link2.source !== "object")
link2.source = find2(nodeById, link2.source);
if (typeof link2.target !== "object")
link2.target = find2(nodeById, link2.target);
count2[link2.source.index] = (count2[link2.source.index] || 0) + 1;
count2[link2.target.index] = (count2[link2.target.index] || 0) + 1;
}
for (i = 0, bias = new Array(m2); i < m2; ++i) {
link2 = links[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]);
}
strengths = new Array(m2), initializeStrength();
distances = new Array(m2), initializeDistance();
}
function initializeStrength() {
if (!nodes)
return;
for (var i = 0, n2 = links.length; i < n2; ++i) {
strengths[i] = +strength(links[i], i, links);
}
}
function initializeDistance() {
if (!nodes)
return;
for (var i = 0, n2 = links.length; i < n2; ++i) {
distances[i] = +distance(links[i], i, links);
}
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random = _random;
initialize();
};
force.links = function(_) {
return arguments.length ? (links = _, initialize(), force) : links;
};
force.id = function(_) {
return arguments.length ? (id2 = _, force) : id2;
};
force.iterations = function(_) {
return arguments.length ? (iterations = +_, force) : iterations;
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant_default5(+_), initializeStrength(), force) : strength;
};
force.distance = function(_) {
return arguments.length ? (distance = typeof _ === "function" ? _ : constant_default5(+_), initializeDistance(), force) : distance;
};
return force;
}
// node_modules/d3-force/src/lcg.js
var a = 1664525;
var c = 1013904223;
var m = 4294967296;
function lcg_default() {
let s2 = 1;
return () => (s2 = (a * s2 + c) % m) / m;
}
// node_modules/d3-force/src/simulation.js
function x2(d) {
return d.x;
}
function y2(d) {
return d.y;
}
var initialRadius = 10;
var initialAngle = Math.PI * (3 - Math.sqrt(5));
function simulation_default(nodes) {
var simulation, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer(step), event = dispatch_default("tick", "end"), random = lcg_default();
if (nodes == null)
nodes = [];
function step() {
tick2();
event.call("tick", simulation);
if (alpha < alphaMin) {
stepper.stop();
event.call("end", simulation);
}
}
function tick2(iterations) {
var i, n2 = nodes.length, node;
if (iterations === void 0)
iterations = 1;
for (var k = 0; k < iterations; ++k) {
alpha += (alphaTarget - alpha) * alphaDecay;
forces.forEach(function(force) {
force(alpha);
});
for (i = 0; i < n2; ++i) {
node = nodes[i];
if (node.fx == null)
node.x += node.vx *= velocityDecay;
else
node.x = node.fx, node.vx = 0;
if (node.fy == null)
node.y += node.vy *= velocityDecay;
else
node.y = node.fy, node.vy = 0;
}
}
return simulation;
}
function initializeNodes() {
for (var i = 0, n2 = nodes.length, node; i < n2; ++i) {
node = nodes[i], node.index = i;
if (node.fx != null)
node.x = node.fx;
if (node.fy != null)
node.y = node.fy;
if (isNaN(node.x) || isNaN(node.y)) {
var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle;
node.x = radius * Math.cos(angle);
node.y = radius * Math.sin(angle);
}
if (isNaN(node.vx) || isNaN(node.vy)) {
node.vx = node.vy = 0;
}
}
}
function initializeForce(force) {
if (force.initialize)
force.initialize(nodes, random);
return force;
}
initializeNodes();
return simulation = {
tick: tick2,
restart: function() {
return stepper.restart(step), simulation;
},
stop: function() {
return stepper.stop(), simulation;
},
nodes: function(_) {
return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes;
},
alpha: function(_) {
return arguments.length ? (alpha = +_, simulation) : alpha;
},
alphaMin: function(_) {
return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
},
alphaDecay: function(_) {
return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
},
alphaTarget: function(_) {
return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
},
velocityDecay: function(_) {
return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
},
randomSource: function(_) {
return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random;
},
force: function(name, _) {
return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name);
},
find: function(x4, y4, radius) {
var i = 0, n2 = nodes.length, dx, dy, d2, node, closest;
if (radius == null)
radius = Infinity;
else
radius *= radius;
for (i = 0; i < n2; ++i) {
node = nodes[i];
dx = x4 - node.x;
dy = y4 - node.y;
d2 = dx * dx + dy * dy;
if (d2 < radius)
closest = node, radius = d2;
}
return closest;
},
on: function(name, _) {
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
}
};
}
// node_modules/d3-force/src/manyBody.js
function manyBody_default() {
var nodes, node, random, alpha, strength = constant_default5(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81;
function force(_) {
var i, n2 = nodes.length, tree = quadtree(nodes, x2, y2).visitAfter(accumulate);
for (alpha = _, i = 0; i < n2; ++i)
node = nodes[i], tree.visit(apply);
}
function initialize() {
if (!nodes)
return;
var i, n2 = nodes.length, node2;
strengths = new Array(n2);
for (i = 0; i < n2; ++i)
node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes);
}
function accumulate(quad) {
var strength2 = 0, q, c3, weight = 0, x4, y4, i;
if (quad.length) {
for (x4 = y4 = i = 0; i < 4; ++i) {
if ((q = quad[i]) && (c3 = Math.abs(q.value))) {
strength2 += q.value, weight += c3, x4 += c3 * q.x, y4 += c3 * q.y;
}
}
quad.x = x4 / weight;
quad.y = y4 / weight;
} else {
q = quad;
q.x = q.data.x;
q.y = q.data.y;
do
strength2 += strengths[q.data.index];
while (q = q.next);
}
quad.value = strength2;
}
function apply(quad, x1, _, x22) {
if (!quad.value)
return true;
var x4 = quad.x - node.x, y4 = quad.y - node.y, w = x22 - x1, l2 = x4 * x4 + y4 * y4;
if (w * w / theta2 < l2) {
if (l2 < distanceMax2) {
if (x4 === 0)
x4 = jiggle_default(random), l2 += x4 * x4;
if (y4 === 0)
y4 = jiggle_default(random), l2 += y4 * y4;
if (l2 < distanceMin2)
l2 = Math.sqrt(distanceMin2 * l2);
node.vx += x4 * quad.value * alpha / l2;
node.vy += y4 * quad.value * alpha / l2;
}
return true;
} else if (quad.length || l2 >= distanceMax2)
return;
if (quad.data !== node || quad.next) {
if (x4 === 0)
x4 = jiggle_default(random), l2 += x4 * x4;
if (y4 === 0)
y4 = jiggle_default(random), l2 += y4 * y4;
if (l2 < distanceMin2)
l2 = Math.sqrt(distanceMin2 * l2);
}
do
if (quad.data !== node) {
w = strengths[quad.data.index] * alpha / l2;
node.vx += x4 * w;
node.vy += y4 * w;
}
while (quad = quad.next);
}
force.initialize = function(_nodes, _random) {
nodes = _nodes;
random = _random;
initialize();
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant_default5(+_), initialize(), force) : strength;
};
force.distanceMin = function(_) {
return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
};
force.distanceMax = function(_) {
return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
};
force.theta = function(_) {
return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
};
return force;
}
// node_modules/d3-format/src/formatDecimal.js
function formatDecimal_default(x4) {
return Math.abs(x4 = Math.round(x4)) >= 1e21 ? x4.toLocaleString("en").replace(/,/g, "") : x4.toString(10);
}
function formatDecimalParts(x4, p) {
if ((i = (x4 = p ? x4.toExponential(p - 1) : x4.toExponential()).indexOf("e")) < 0)
return null;
var i, coefficient = x4.slice(0, i);
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x4.slice(i + 1)
];
}
// node_modules/d3-format/src/exponent.js
function exponent_default(x4) {
return x4 = formatDecimalParts(Math.abs(x4)), x4 ? x4[1] : NaN;
}
// node_modules/d3-format/src/formatGroup.js
function formatGroup_default(grouping, thousands) {
return function(value, width) {
var i = value.length, t = [], j = 0, g = grouping[0], length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width)
g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width)
break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}
// node_modules/d3-format/src/formatNumerals.js
function formatNumerals_default(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
}
// node_modules/d3-format/src/formatSpecifier.js
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function formatSpecifier(specifier) {
if (!(match2 = re.exec(specifier)))
throw new Error("invalid format: " + specifier);
var match2;
return new FormatSpecifier({
fill: match2[1],
align: match2[2],
sign: match2[3],
symbol: match2[4],
zero: match2[5],
width: match2[6],
comma: match2[7],
precision: match2[8] && match2[8].slice(1),
trim: match2[9],
type: match2[10]
});
}
formatSpecifier.prototype = FormatSpecifier.prototype;
function FormatSpecifier(specifier) {
this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
this.align = specifier.align === void 0 ? ">" : specifier.align + "";
this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
this.zero = !!specifier.zero;
this.width = specifier.width === void 0 ? void 0 : +specifier.width;
this.comma = !!specifier.comma;
this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
this.trim = !!specifier.trim;
this.type = specifier.type === void 0 ? "" : specifier.type + "";
}
FormatSpecifier.prototype.toString = function() {
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
// node_modules/d3-format/src/formatTrim.js
function formatTrim_default(s2) {
out:
for (var n2 = s2.length, i = 1, i0 = -1, i1; i < n2; ++i) {
switch (s2[i]) {
case ".":
i0 = i1 = i;
break;
case "0":
if (i0 === 0)
i0 = i;
i1 = i;
break;
default:
if (!+s2[i])
break out;
if (i0 > 0)
i0 = 0;
break;
}
}
return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
}
// node_modules/d3-format/src/formatPrefixAuto.js
var prefixExponent;
function formatPrefixAuto_default(x4, p) {
var d = formatDecimalParts(x4, p);
if (!d)
return x4 + "";
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length;
return i === n2 ? coefficient : i > n2 ? coefficient + new Array(i - n2 + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x4, Math.max(0, p + i - 1))[0];
}
// node_modules/d3-format/src/formatRounded.js
function formatRounded_default(x4, p) {
var d = formatDecimalParts(x4, p);
if (!d)
return x4 + "";
var coefficient = d[0], exponent = d[1];
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
}
// node_modules/d3-format/src/formatTypes.js
var formatTypes_default = {
"%": (x4, p) => (x4 * 100).toFixed(p),
"b": (x4) => Math.round(x4).toString(2),
"c": (x4) => x4 + "",
"d": formatDecimal_default,
"e": (x4, p) => x4.toExponential(p),
"f": (x4, p) => x4.toFixed(p),
"g": (x4, p) => x4.toPrecision(p),
"o": (x4) => Math.round(x4).toString(8),
"p": (x4, p) => formatRounded_default(x4 * 100, p),
"r": formatRounded_default,
"s": formatPrefixAuto_default,
"X": (x4) => Math.round(x4).toString(16).toUpperCase(),
"x": (x4) => Math.round(x4).toString(16)
};
// node_modules/d3-format/src/identity.js
function identity_default(x4) {
return x4;
}
// node_modules/d3-format/src/locale.js
var map = Array.prototype.map;
var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function locale_default(locale2) {
var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero2 = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type;
if (type2 === "n")
comma = true, type2 = "g";
else if (!formatTypes_default[type2])
precision === void 0 && (precision = 12), trim = true, type2 = "g";
if (zero2 || fill === "0" && align === "=")
zero2 = true, fill = "0", align = "=";
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
function format2(value) {
var valuePrefix = prefix, valueSuffix = suffix, i, n2, c3;
if (type2 === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
var valueNegative = value < 0 || 1 / value < 0;
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
if (trim)
value = formatTrim_default(value);
if (valueNegative && +value === 0 && sign !== "+")
valueNegative = false;
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
if (maybeSuffix) {
i = -1, n2 = value.length;
while (++i < n2) {
if (c3 = value.charCodeAt(i), 48 > c3 || c3 > 57) {
valueSuffix = (c3 === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
if (comma && !zero2)
value = group(value, Infinity);
var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
if (comma && zero2)
value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
switch (align) {
case "<":
value = valuePrefix + value + valueSuffix + padding;
break;
case "=":
value = valuePrefix + padding + value + valueSuffix;
break;
case "^":
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
break;
default:
value = padding + valuePrefix + value + valueSuffix;
break;
}
return numerals(value);
}
format2.toString = function() {
return specifier + "";
};
return format2;
}
function formatPrefix2(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
return function(value2) {
return f(k * value2) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix2
};
}
// node_modules/d3-format/src/defaultLocale.js
var locale;
var format;
var formatPrefix;
defaultLocale2({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function defaultLocale2(definition) {
locale = locale_default(definition);
format = locale.format;
formatPrefix = locale.formatPrefix;
return locale;
}
// node_modules/d3-format/src/precisionFixed.js
function precisionFixed_default(step) {
return Math.max(0, -exponent_default(Math.abs(step)));
}
// node_modules/d3-format/src/precisionPrefix.js
function precisionPrefix_default(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
}
// node_modules/d3-format/src/precisionRound.js
function precisionRound_default(step, max4) {
step = Math.abs(step), max4 = Math.abs(max4) - step;
return Math.max(0, exponent_default(max4) - exponent_default(step)) + 1;
}
// node_modules/d3-hierarchy/src/cluster.js
function defaultSeparation(a2, b) {
return a2.parent === b.parent ? 1 : 2;
}
function meanX(children3) {
return children3.reduce(meanXReduce, 0) / children3.length;
}
function meanXReduce(x4, c3) {
return x4 + c3.x;
}
function maxY(children3) {
return 1 + children3.reduce(maxYReduce, 0);
}
function maxYReduce(y4, c3) {
return Math.max(y4, c3.y);
}
function leafLeft(node) {
var children3;
while (children3 = node.children)
node = children3[0];
return node;
}
function leafRight(node) {
var children3;
while (children3 = node.children)
node = children3[children3.length - 1];
return node;
}
function cluster_default() {
var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false;
function cluster(root2) {
var previousNode, x4 = 0;
root2.eachAfter(function(node) {
var children3 = node.children;
if (children3) {
node.x = meanX(children3);
node.y = maxY(children3);
} else {
node.x = previousNode ? x4 += separation(node, previousNode) : 0;
node.y = 0;
previousNode = node;
}
});
var left = leafLeft(root2), right = leafRight(root2), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
return root2.eachAfter(nodeSize ? function(node) {
node.x = (node.x - root2.x) * dx;
node.y = (root2.y - node.y) * dy;
} : function(node) {
node.x = (node.x - x0) / (x1 - x0) * dx;
node.y = (1 - (root2.y ? node.y / root2.y : 1)) * dy;
});
}
cluster.separation = function(x4) {
return arguments.length ? (separation = x4, cluster) : separation;
};
cluster.size = function(x4) {
return arguments.length ? (nodeSize = false, dx = +x4[0], dy = +x4[1], cluster) : nodeSize ? null : [dx, dy];
};
cluster.nodeSize = function(x4) {
return arguments.length ? (nodeSize = true, dx = +x4[0], dy = +x4[1], cluster) : nodeSize ? [dx, dy] : null;
};
return cluster;
}
// node_modules/d3-hierarchy/src/hierarchy/count.js
function count(node) {
var sum = 0, children3 = node.children, i = children3 && children3.length;
if (!i)
sum = 1;
else
while (--i >= 0)
sum += children3[i].value;
node.value = sum;
}
function count_default() {
return this.eachAfter(count);
}
// node_modules/d3-hierarchy/src/hierarchy/each.js
function each_default2(callback, that) {
let index2 = -1;
for (const node of this) {
callback.call(that, node, ++index2, this);
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
function eachBefore_default(callback, that) {
var node = this, nodes = [node], children3, i, index2 = -1;
while (node = nodes.pop()) {
callback.call(that, node, ++index2, this);
if (children3 = node.children) {
for (i = children3.length - 1; i >= 0; --i) {
nodes.push(children3[i]);
}
}
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
function eachAfter_default(callback, that) {
var node = this, nodes = [node], next = [], children3, i, n2, index2 = -1;
while (node = nodes.pop()) {
next.push(node);
if (children3 = node.children) {
for (i = 0, n2 = children3.length; i < n2; ++i) {
nodes.push(children3[i]);
}
}
}
while (node = next.pop()) {
callback.call(that, node, ++index2, this);
}
return this;
}
// node_modules/d3-hierarchy/src/hierarchy/find.js
function find_default2(callback, that) {
let index2 = -1;
for (const node of this) {
if (callback.call(that, node, ++index2, this)) {
return node;
}
}
}
// node_modules/d3-hierarchy/src/hierarchy/sum.js
function sum_default(value) {
return this.eachAfter(function(node) {
var sum = +value(node.data) || 0, children3 = node.children, i = children3 && children3.length;
while (--i >= 0)
sum += children3[i].value;
node.value = sum;
});
}
// node_modules/d3-hierarchy/src/hierarchy/sort.js
function sort_default2(compare) {
return this.eachBefore(function(node) {
if (node.children) {
node.children.sort(compare);
}
});
}
// node_modules/d3-hierarchy/src/hierarchy/path.js
function path_default2(end) {
var start2 = this, ancestor = leastCommonAncestor(start2, end), nodes = [start2];
while (start2 !== ancestor) {
start2 = start2.parent;
nodes.push(start2);
}
var k = nodes.length;
while (end !== ancestor) {
nodes.splice(k, 0, end);
end = end.parent;
}
return nodes;
}
function leastCommonAncestor(a2, b) {
if (a2 === b)
return a2;
var aNodes = a2.ancestors(), bNodes = b.ancestors(), c3 = null;
a2 = aNodes.pop();
b = bNodes.pop();
while (a2 === b) {
c3 = a2;
a2 = aNodes.pop();
b = bNodes.pop();
}
return c3;
}
// node_modules/d3-hierarchy/src/hierarchy/ancestors.js
function ancestors_default() {
var node = this, nodes = [node];
while (node = node.parent) {
nodes.push(node);
}
return nodes;
}
// node_modules/d3-hierarchy/src/hierarchy/descendants.js
function descendants_default() {
return Array.from(this);
}
// node_modules/d3-hierarchy/src/hierarchy/leaves.js
function leaves_default() {
var leaves = [];
this.eachBefore(function(node) {
if (!node.children) {
leaves.push(node);
}
});
return leaves;
}
// node_modules/d3-hierarchy/src/hierarchy/links.js
function links_default() {
var root2 = this, links = [];
root2.each(function(node) {
if (node !== root2) {
links.push({ source: node.parent, target: node });
}
});
return links;
}
// node_modules/d3-hierarchy/src/hierarchy/iterator.js
function* iterator_default2() {
var node = this, current, next = [node], children3, i, n2;
do {
current = next.reverse(), next = [];
while (node = current.pop()) {
yield node;
if (children3 = node.children) {
for (i = 0, n2 = children3.length; i < n2; ++i) {
next.push(children3[i]);
}
}
}
} while (next.length);
}
// node_modules/d3-hierarchy/src/hierarchy/index.js
function hierarchy(data, children3) {
if (data instanceof Map) {
data = [void 0, data];
if (children3 === void 0)
children3 = mapChildren;
} else if (children3 === void 0) {
children3 = objectChildren;
}
var root2 = new Node(data), node, nodes = [root2], child, childs, i, n2;
while (node = nodes.pop()) {
if ((childs = children3(node.data)) && (n2 = (childs = Array.from(childs)).length)) {
node.children = childs;
for (i = n2 - 1; i >= 0; --i) {
nodes.push(child = childs[i] = new Node(childs[i]));
child.parent = node;
child.depth = node.depth + 1;
}
}
}
return root2.eachBefore(computeHeight);
}
function node_copy() {
return hierarchy(this).eachBefore(copyData);
}
function objectChildren(d) {
return d.children;
}
function mapChildren(d) {
return Array.isArray(d) ? d[1] : null;
}
function copyData(node) {
if (node.data.value !== void 0)
node.value = node.data.value;
node.data = node.data.data;
}
function computeHeight(node) {
var height = 0;
do
node.height = height;
while ((node = node.parent) && node.height < ++height);
}
function Node(data) {
this.data = data;
this.depth = this.height = 0;
this.parent = null;
}
Node.prototype = hierarchy.prototype = {
constructor: Node,
count: count_default,
each: each_default2,
eachAfter: eachAfter_default,
eachBefore: eachBefore_default,
find: find_default2,
sum: sum_default,
sort: sort_default2,
path: path_default2,
ancestors: ancestors_default,
descendants: descendants_default,
leaves: leaves_default,
links: links_default,
copy: node_copy,
[Symbol.iterator]: iterator_default2
};
// node_modules/d3-hierarchy/src/accessors.js
function required(f) {
if (typeof f !== "function")
throw new Error();
return f;
}
// node_modules/d3-hierarchy/src/constant.js
function constantZero() {
return 0;
}
function constant_default6(x4) {
return function() {
return x4;
};
}
// node_modules/d3-hierarchy/src/treemap/round.js
function round_default2(node) {
node.x0 = Math.round(node.x0);
node.y0 = Math.round(node.y0);
node.x1 = Math.round(node.x1);
node.y1 = Math.round(node.y1);
}
// node_modules/d3-hierarchy/src/treemap/dice.js
function dice_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, node, i = -1, n2 = nodes.length, k = parent.value && (x1 - x0) / parent.value;
while (++i < n2) {
node = nodes[i], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k;
}
}
// node_modules/d3-hierarchy/src/partition.js
function partition_default() {
var dx = 1, dy = 1, padding = 0, round = false;
function partition(root2) {
var n2 = root2.height + 1;
root2.x0 = root2.y0 = padding;
root2.x1 = dx;
root2.y1 = dy / n2;
root2.eachBefore(positionNode(dy, n2));
if (round)
root2.eachBefore(round_default2);
return root2;
}
function positionNode(dy2, n2) {
return function(node) {
if (node.children) {
dice_default(node, node.x0, dy2 * (node.depth + 1) / n2, node.x1, dy2 * (node.depth + 2) / n2);
}
var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
};
}
partition.round = function(x4) {
return arguments.length ? (round = !!x4, partition) : round;
};
partition.size = function(x4) {
return arguments.length ? (dx = +x4[0], dy = +x4[1], partition) : [dx, dy];
};
partition.padding = function(x4) {
return arguments.length ? (padding = +x4, partition) : padding;
};
return partition;
}
// node_modules/d3-hierarchy/src/stratify.js
var preroot = { depth: -1 };
var ambiguous = {};
function defaultId(d) {
return d.id;
}
function defaultParentId(d) {
return d.parentId;
}
function stratify_default() {
var id2 = defaultId, parentId = defaultParentId;
function stratify2(data) {
var nodes = Array.from(data), n2 = nodes.length, d, i, root2, parent, node, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map();
for (i = 0; i < n2; ++i) {
d = nodes[i], node = nodes[i] = new Node(d);
if ((nodeId = id2(d, i, data)) != null && (nodeId += "")) {
nodeKey = node.id = nodeId;
nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
}
if ((nodeId = parentId(d, i, data)) != null && (nodeId += "")) {
node.parent = nodeId;
}
}
for (i = 0; i < n2; ++i) {
node = nodes[i];
if (nodeId = node.parent) {
parent = nodeByKey.get(nodeId);
if (!parent)
throw new Error("missing: " + nodeId);
if (parent === ambiguous)
throw new Error("ambiguous: " + nodeId);
if (parent.children)
parent.children.push(node);
else
parent.children = [node];
node.parent = parent;
} else {
if (root2)
throw new Error("multiple roots");
root2 = node;
}
}
if (!root2)
throw new Error("no root");
root2.parent = preroot;
root2.eachBefore(function(node2) {
node2.depth = node2.parent.depth + 1;
--n2;
}).eachBefore(computeHeight);
root2.parent = null;
if (n2 > 0)
throw new Error("cycle");
return root2;
}
stratify2.id = function(x4) {
return arguments.length ? (id2 = required(x4), stratify2) : id2;
};
stratify2.parentId = function(x4) {
return arguments.length ? (parentId = required(x4), stratify2) : parentId;
};
return stratify2;
}
// node_modules/d3-hierarchy/src/tree.js
function defaultSeparation2(a2, b) {
return a2.parent === b.parent ? 1 : 2;
}
function nextLeft(v) {
var children3 = v.children;
return children3 ? children3[0] : v.t;
}
function nextRight(v) {
var children3 = v.children;
return children3 ? children3[children3.length - 1] : v.t;
}
function moveSubtree(wm, wp, shift) {
var change = shift / (wp.i - wm.i);
wp.c -= change;
wp.s += shift;
wm.c += change;
wp.z += shift;
wp.m += shift;
}
function executeShifts(v) {
var shift = 0, change = 0, children3 = v.children, i = children3.length, w;
while (--i >= 0) {
w = children3[i];
w.z += shift;
w.m += shift;
shift += w.s + (change += w.c);
}
}
function nextAncestor(vim, v, ancestor) {
return vim.a.parent === v.parent ? vim.a : ancestor;
}
function TreeNode(node, i) {
this._ = node;
this.parent = null;
this.children = null;
this.A = null;
this.a = this;
this.z = 0;
this.m = 0;
this.c = 0;
this.s = 0;
this.t = null;
this.i = i;
}
TreeNode.prototype = Object.create(Node.prototype);
function treeRoot(root2) {
var tree = new TreeNode(root2, 0), node, nodes = [tree], child, children3, i, n2;
while (node = nodes.pop()) {
if (children3 = node._.children) {
node.children = new Array(n2 = children3.length);
for (i = n2 - 1; i >= 0; --i) {
nodes.push(child = node.children[i] = new TreeNode(children3[i], i));
child.parent = node;
}
}
}
(tree.parent = new TreeNode(null, 0)).children = [tree];
return tree;
}
function tree_default() {
var separation = defaultSeparation2, dx = 1, dy = 1, nodeSize = null;
function tree(root2) {
var t = treeRoot(root2);
t.eachAfter(firstWalk), t.parent.m = -t.z;
t.eachBefore(secondWalk);
if (nodeSize)
root2.eachBefore(sizeNode);
else {
var left = root2, right = root2, bottom = root2;
root2.eachBefore(function(node) {
if (node.x < left.x)
left = node;
if (node.x > right.x)
right = node;
if (node.depth > bottom.depth)
bottom = node;
});
var s2 = left === right ? 1 : separation(left, right) / 2, tx = s2 - left.x, kx = dx / (right.x + s2 + tx), ky = dy / (bottom.depth || 1);
root2.eachBefore(function(node) {
node.x = (node.x + tx) * kx;
node.y = node.depth * ky;
});
}
return root2;
}
function firstWalk(v) {
var children3 = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;
if (children3) {
executeShifts(v);
var midpoint = (children3[0].z + children3[children3.length - 1].z) / 2;
if (w) {
v.z = w.z + separation(v._, w._);
v.m = v.z - midpoint;
} else {
v.z = midpoint;
}
} else if (w) {
v.z = w.z + separation(v._, w._);
}
v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
}
function secondWalk(v) {
v._.x = v.z + v.parent.m;
v.m += v.parent.m;
}
function apportion(v, w, ancestor) {
if (w) {
var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift;
while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {
vom = nextLeft(vom);
vop = nextRight(vop);
vop.a = v;
shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);
if (shift > 0) {
moveSubtree(nextAncestor(vim, v, ancestor), v, shift);
sip += shift;
sop += shift;
}
sim += vim.m;
sip += vip.m;
som += vom.m;
sop += vop.m;
}
if (vim && !nextRight(vop)) {
vop.t = vim;
vop.m += sim - sop;
}
if (vip && !nextLeft(vom)) {
vom.t = vip;
vom.m += sip - som;
ancestor = v;
}
}
return ancestor;
}
function sizeNode(node) {
node.x *= dx;
node.y = node.depth * dy;
}
tree.separation = function(x4) {
return arguments.length ? (separation = x4, tree) : separation;
};
tree.size = function(x4) {
return arguments.length ? (nodeSize = false, dx = +x4[0], dy = +x4[1], tree) : nodeSize ? null : [dx, dy];
};
tree.nodeSize = function(x4) {
return arguments.length ? (nodeSize = true, dx = +x4[0], dy = +x4[1], tree) : nodeSize ? [dx, dy] : null;
};
return tree;
}
// node_modules/d3-hierarchy/src/treemap/slice.js
function slice_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, node, i = -1, n2 = nodes.length, k = parent.value && (y1 - y0) / parent.value;
while (++i < n2) {
node = nodes[i], node.x0 = x0, node.x1 = x1;
node.y0 = y0, node.y1 = y0 += node.value * k;
}
}
// node_modules/d3-hierarchy/src/treemap/squarify.js
var phi = (1 + Math.sqrt(5)) / 2;
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n2 = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
while (i0 < n2) {
dx = x1 - x0, dy = y1 - y0;
do
sumValue = nodes[i1++].value;
while (!sumValue && i1 < n2);
minValue = maxValue = sumValue;
alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
beta = sumValue * sumValue * alpha;
minRatio = Math.max(maxValue / beta, beta / minValue);
for (; i1 < n2; ++i1) {
sumValue += nodeValue = nodes[i1].value;
if (nodeValue < minValue)
minValue = nodeValue;
if (nodeValue > maxValue)
maxValue = nodeValue;
beta = sumValue * sumValue * alpha;
newRatio = Math.max(maxValue / beta, beta / minValue);
if (newRatio > minRatio) {
sumValue -= nodeValue;
break;
}
minRatio = newRatio;
}
rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
if (row.dice)
dice_default(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
else
slice_default(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
value -= sumValue, i0 = i1;
}
return rows;
}
var squarify_default = function custom(ratio) {
function squarify(parent, x0, y0, x1, y1) {
squarifyRatio(ratio, parent, x0, y0, x1, y1);
}
squarify.ratio = function(x4) {
return custom((x4 = +x4) > 1 ? x4 : 1);
};
return squarify;
}(phi);
// node_modules/d3-hierarchy/src/treemap/index.js
function treemap_default() {
var tile = squarify_default, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
function treemap(root2) {
root2.x0 = root2.y0 = 0;
root2.x1 = dx;
root2.y1 = dy;
root2.eachBefore(positionNode);
paddingStack = [0];
if (round)
root2.eachBefore(round_default2);
return root2;
}
function positionNode(node) {
var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
if (node.children) {
p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
x0 += paddingLeft(node) - p;
y0 += paddingTop(node) - p;
x1 -= paddingRight(node) - p;
y1 -= paddingBottom(node) - p;
if (x1 < x0)
x0 = x1 = (x0 + x1) / 2;
if (y1 < y0)
y0 = y1 = (y0 + y1) / 2;
tile(node, x0, y0, x1, y1);
}
}
treemap.round = function(x4) {
return arguments.length ? (round = !!x4, treemap) : round;
};
treemap.size = function(x4) {
return arguments.length ? (dx = +x4[0], dy = +x4[1], treemap) : [dx, dy];
};
treemap.tile = function(x4) {
return arguments.length ? (tile = required(x4), treemap) : tile;
};
treemap.padding = function(x4) {
return arguments.length ? treemap.paddingInner(x4).paddingOuter(x4) : treemap.paddingInner();
};
treemap.paddingInner = function(x4) {
return arguments.length ? (paddingInner = typeof x4 === "function" ? x4 : constant_default6(+x4), treemap) : paddingInner;
};
treemap.paddingOuter = function(x4) {
return arguments.length ? treemap.paddingTop(x4).paddingRight(x4).paddingBottom(x4).paddingLeft(x4) : treemap.paddingTop();
};
treemap.paddingTop = function(x4) {
return arguments.length ? (paddingTop = typeof x4 === "function" ? x4 : constant_default6(+x4), treemap) : paddingTop;
};
treemap.paddingRight = function(x4) {
return arguments.length ? (paddingRight = typeof x4 === "function" ? x4 : constant_default6(+x4), treemap) : paddingRight;
};
treemap.paddingBottom = function(x4) {
return arguments.length ? (paddingBottom = typeof x4 === "function" ? x4 : constant_default6(+x4), treemap) : paddingBottom;
};
treemap.paddingLeft = function(x4) {
return arguments.length ? (paddingLeft = typeof x4 === "function" ? x4 : constant_default6(+x4), treemap) : paddingLeft;
};
return treemap;
}
// node_modules/d3-hierarchy/src/treemap/binary.js
function binary_default(parent, x0, y0, x1, y1) {
var nodes = parent.children, i, n2 = nodes.length, sum, sums = new Array(n2 + 1);
for (sums[0] = sum = i = 0; i < n2; ++i) {
sums[i + 1] = sum += nodes[i].value;
}
partition(0, n2, parent.value, x0, y0, x1, y1);
function partition(i2, j, value, x02, y02, x12, y12) {
if (i2 >= j - 1) {
var node = nodes[i2];
node.x0 = x02, node.y0 = y02;
node.x1 = x12, node.y1 = y12;
return;
}
var valueOffset = sums[i2], valueTarget = value / 2 + valueOffset, k = i2 + 1, hi = j - 1;
while (k < hi) {
var mid = k + hi >>> 1;
if (sums[mid] < valueTarget)
k = mid + 1;
else
hi = mid;
}
if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k)
--k;
var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft;
if (x12 - x02 > y12 - y02) {
var xk = value ? (x02 * valueRight + x12 * valueLeft) / value : x12;
partition(i2, k, valueLeft, x02, y02, xk, y12);
partition(k, j, valueRight, xk, y02, x12, y12);
} else {
var yk = value ? (y02 * valueRight + y12 * valueLeft) / value : y12;
partition(i2, k, valueLeft, x02, y02, x12, yk);
partition(k, j, valueRight, x02, yk, x12, y12);
}
}
}
// node_modules/d3-scale/src/init.js
function initRange(domain, range) {
switch (arguments.length) {
case 0:
break;
case 1:
this.range(domain);
break;
default:
this.range(range).domain(domain);
break;
}
return this;
}
// node_modules/d3-scale/src/ordinal.js
var implicit = Symbol("implicit");
function ordinal() {
var index2 = /* @__PURE__ */ new Map(), domain = [], range = [], unknown = implicit;
function scale(d) {
var key = d + "", i = index2.get(key);
if (!i) {
if (unknown !== implicit)
return unknown;
index2.set(key, i = domain.push(d));
}
return range[(i - 1) % range.length];
}
scale.domain = function(_) {
if (!arguments.length)
return domain.slice();
domain = [], index2 = /* @__PURE__ */ new Map();
for (const value of _) {
const key = value + "";
if (index2.has(key))
continue;
index2.set(key, domain.push(value));
}
return scale;
};
scale.range = function(_) {
return arguments.length ? (range = Array.from(_), scale) : range.slice();
};
scale.unknown = function(_) {
return arguments.length ? (unknown = _, scale) : unknown;
};
scale.copy = function() {
return ordinal(domain, range).unknown(unknown);
};
initRange.apply(scale, arguments);
return scale;
}
// node_modules/d3-scale/src/band.js
function band() {
var scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
delete scale.unknown;
function rescale() {
var n2 = domain().length, reverse = r1 < r0, start2 = reverse ? r1 : r0, stop = reverse ? r0 : r1;
step = (stop - start2) / Math.max(1, n2 - paddingInner + paddingOuter * 2);
if (round)
step = Math.floor(step);
start2 += (stop - start2 - step * (n2 - paddingInner)) * align;
bandwidth = step * (1 - paddingInner);
if (round)
start2 = Math.round(start2), bandwidth = Math.round(bandwidth);
var values = range_default(n2).map(function(i) {
return start2 + step * i;
});
return ordinalRange(reverse ? values.reverse() : values);
}
scale.domain = function(_) {
return arguments.length ? (domain(_), rescale()) : domain();
};
scale.range = function(_) {
return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
};
scale.rangeRound = function(_) {
return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
};
scale.bandwidth = function() {
return bandwidth;
};
scale.step = function() {
return step;
};
scale.round = function(_) {
return arguments.length ? (round = !!_, rescale()) : round;
};
scale.padding = function(_) {
return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
};
scale.paddingInner = function(_) {
return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
};
scale.paddingOuter = function(_) {
return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
};
scale.align = function(_) {
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
};
scale.copy = function() {
return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
};
return initRange.apply(rescale(), arguments);
}
function pointish(scale) {
var copy3 = scale.copy;
scale.padding = scale.paddingOuter;
delete scale.paddingInner;
delete scale.paddingOuter;
scale.copy = function() {
return pointish(copy3());
};
return scale;
}
function point() {
return pointish(band.apply(null, arguments).paddingInner(1));
}
// node_modules/d3-scale/src/constant.js
function constants(x4) {
return function() {
return x4;
};
}
// node_modules/d3-scale/src/number.js
function number(x4) {
return +x4;
}
// node_modules/d3-scale/src/continuous.js
var unit = [0, 1];
function identity2(x4) {
return x4;
}
function normalize(a2, b) {
return (b -= a2 = +a2) ? function(x4) {
return (x4 - a2) / b;
} : constants(isNaN(b) ? NaN : 0.5);
}
function clamper(a2, b) {
var t;
if (a2 > b)
t = a2, a2 = b, b = t;
return function(x4) {
return Math.max(a2, Math.min(b, x4));
};
}
function bimap(domain, range, interpolate) {
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
if (d1 < d0)
d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
else
d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
return function(x4) {
return r0(d0(x4));
};
}
function polymap(domain, range, interpolate) {
var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1;
if (domain[j] < domain[0]) {
domain = domain.slice().reverse();
range = range.slice().reverse();
}
while (++i < j) {
d[i] = normalize(domain[i], domain[i + 1]);
r[i] = interpolate(range[i], range[i + 1]);
}
return function(x4) {
var i2 = bisect_default(domain, x4, 1, j) - 1;
return r[i2](d[i2](x4));
};
}
function copy2(source, target) {
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
}
function transformer() {
var domain = unit, range = unit, interpolate = value_default, transform2, untransform, unknown, clamp = identity2, piecewise, output, input;
function rescale() {
var n2 = Math.min(domain.length, range.length);
if (clamp !== identity2)
clamp = clamper(domain[0], domain[n2 - 1]);
piecewise = n2 > 2 ? polymap : bimap;
output = input = null;
return scale;
}
function scale(x4) {
return x4 == null || isNaN(x4 = +x4) ? unknown : (output || (output = piecewise(domain.map(transform2), range, interpolate)))(transform2(clamp(x4)));
}
scale.invert = function(y4) {
return clamp(untransform((input || (input = piecewise(range, domain.map(transform2), number_default2)))(y4)));
};
scale.domain = function(_) {
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
};
scale.rangeRound = function(_) {
return range = Array.from(_), interpolate = round_default, rescale();
};
scale.clamp = function(_) {
return arguments.length ? (clamp = _ ? true : identity2, rescale()) : clamp !== identity2;
};
scale.interpolate = function(_) {
return arguments.length ? (interpolate = _, rescale()) : interpolate;
};
scale.unknown = function(_) {
return arguments.length ? (unknown = _, scale) : unknown;
};
return function(t, u) {
transform2 = t, untransform = u;
return rescale();
};
}
function continuous() {
return transformer()(identity2, identity2);
}
// node_modules/d3-scale/src/tickFormat.js
function tickFormat(start2, stop, count2, specifier) {
var step = tickStep(start2, stop, count2), precision;
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
switch (specifier.type) {
case "s": {
var value = Math.max(Math.abs(start2), Math.abs(stop));
if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step, value)))
specifier.precision = precision;
return formatPrefix(specifier, value);
}
case "":
case "e":
case "g":
case "p":
case "r": {
if (specifier.precision == null && !isNaN(precision = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
specifier.precision = precision - (specifier.type === "e");
break;
}
case "f":
case "%": {
if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step)))
specifier.precision = precision - (specifier.type === "%") * 2;
break;
}
}
return format(specifier);
}
// node_modules/d3-scale/src/linear.js
function linearish(scale) {
var domain = scale.domain;
scale.ticks = function(count2) {
var d = domain();
return ticks_default(d[0], d[d.length - 1], count2 == null ? 10 : count2);
};
scale.tickFormat = function(count2, specifier) {
var d = domain();
return tickFormat(d[0], d[d.length - 1], count2 == null ? 10 : count2, specifier);
};
scale.nice = function(count2) {
if (count2 == null)
count2 = 10;
var d = domain();
var i0 = 0;
var i1 = d.length - 1;
var start2 = d[i0];
var stop = d[i1];
var prestep;
var step;
var maxIter = 10;
if (stop < start2) {
step = start2, start2 = stop, stop = step;
step = i0, i0 = i1, i1 = step;
}
while (maxIter-- > 0) {
step = tickIncrement(start2, stop, count2);
if (step === prestep) {
d[i0] = start2;
d[i1] = stop;
return domain(d);
} else if (step > 0) {
start2 = Math.floor(start2 / step) * step;
stop = Math.ceil(stop / step) * step;
} else if (step < 0) {
start2 = Math.ceil(start2 * step) / step;
stop = Math.floor(stop * step) / step;
} else {
break;
}
prestep = step;
}
return scale;
};
return scale;
}
function linear2() {
var scale = continuous();
scale.copy = function() {
return copy2(scale, linear2());
};
initRange.apply(scale, arguments);
return linearish(scale);
}
// node_modules/d3-scale-chromatic/src/colors.js
function colors_default(specifier) {
var n2 = specifier.length / 6 | 0, colors = new Array(n2), i = 0;
while (i < n2)
colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
return colors;
}
// node_modules/d3-scale-chromatic/src/categorical/category10.js
var category10_default = colors_default("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
// node_modules/d3-scale-chromatic/src/sequential-multi/rainbow.js
var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.5, 0.8));
var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.5, 0.8));
var c2 = cubehelix();
function rainbow_default(t) {
if (t < 0 || t > 1)
t -= Math.floor(t);
var ts = Math.abs(t - 0.5);
c2.h = 360 * t - 100;
c2.s = 1.5 - 1.5 * ts;
c2.l = 0.8 - 0.9 * ts;
return c2 + "";
}
// node_modules/d3-shape/src/constant.js
function constant_default7(x4) {
return function constant() {
return x4;
};
}
// node_modules/d3-shape/src/math.js
var abs2 = Math.abs;
var atan2 = Math.atan2;
var cos = Math.cos;
var max3 = Math.max;
var min2 = Math.min;
var sin = Math.sin;
var sqrt = Math.sqrt;
var epsilon3 = 1e-12;
var pi2 = Math.PI;
var halfPi = pi2 / 2;
var tau2 = 2 * pi2;
function acos(x4) {
return x4 > 1 ? 0 : x4 < -1 ? pi2 : Math.acos(x4);
}
function asin(x4) {
return x4 >= 1 ? halfPi : x4 <= -1 ? -halfPi : Math.asin(x4);
}
// node_modules/d3-shape/src/arc.js
function arcInnerRadius(d) {
return d.innerRadius;
}
function arcOuterRadius(d) {
return d.outerRadius;
}
function arcStartAngle(d) {
return d.startAngle;
}
function arcEndAngle(d) {
return d.endAngle;
}
function arcPadAngle(d) {
return d && d.padAngle;
}
function intersect(x0, y0, x1, y1, x22, y22, x32, y32) {
var x10 = x1 - x0, y10 = y1 - y0, x322 = x32 - x22, y322 = y32 - y22, t = y322 * x10 - x322 * y10;
if (t * t < epsilon3)
return;
t = (x322 * (y0 - y22) - y322 * (x0 - x22)) / t;
return [x0 + t * x10, y0 + t * y10];
}
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max3(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
cx0 = cx1, cy0 = cy1;
return {
cx: cx0,
cy: cy0,
x01: -ox,
y01: -oy,
x11: cx0 * (r1 / r - 1),
y11: cy0 * (r1 / r - 1)
};
}
function arc_default() {
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant_default7(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
function arc() {
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs2(a1 - a0), cw = a1 > a0;
if (!context)
context = buffer = path_default();
if (r1 < r0)
r = r1, r1 = r0, r0 = r;
if (!(r1 > epsilon3))
context.moveTo(0, 0);
else if (da > tau2 - epsilon3) {
context.moveTo(r1 * cos(a0), r1 * sin(a0));
context.arc(0, 0, r1, a0, a1, !cw);
if (r0 > epsilon3) {
context.moveTo(r0 * cos(a1), r0 * sin(a1));
context.arc(0, 0, r0, a1, a0, cw);
}
} else {
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon3 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min2(abs2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
if (rp > epsilon3) {
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
if ((da0 -= p0 * 2) > epsilon3)
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
else
da0 = 0, a00 = a10 = (a0 + a1) / 2;
if ((da1 -= p1 * 2) > epsilon3)
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
else
da1 = 0, a01 = a11 = (a0 + a1) / 2;
}
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
if (rc > epsilon3) {
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
if (da < pi2 && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = min2(rc, (r0 - lc) / (kc - 1));
rc1 = min2(rc, (r1 - lc) / (kc + 1));
}
}
if (!(da1 > epsilon3))
context.moveTo(x01, y01);
else if (rc1 > epsilon3) {
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
if (rc1 < rc)
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
else {
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
} else
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
if (!(r0 > epsilon3) || !(da0 > epsilon3))
context.lineTo(x10, y10);
else if (rc0 > epsilon3) {
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
if (rc0 < rc)
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
else {
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
} else
context.arc(0, 0, r0, a10, a00, cw);
}
context.closePath();
if (buffer)
return context = null, buffer + "" || null;
}
arc.centroid = function() {
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi2 / 2;
return [cos(a2) * r, sin(a2) * r];
};
arc.innerRadius = function(_) {
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant_default7(+_), arc) : innerRadius;
};
arc.outerRadius = function(_) {
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant_default7(+_), arc) : outerRadius;
};
arc.cornerRadius = function(_) {
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant_default7(+_), arc) : cornerRadius;
};
arc.padRadius = function(_) {
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant_default7(+_), arc) : padRadius;
};
arc.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default7(+_), arc) : startAngle;
};
arc.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default7(+_), arc) : endAngle;
};
arc.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default7(+_), arc) : padAngle;
};
arc.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, arc) : context;
};
return arc;
}
// node_modules/d3-shape/src/array.js
var slice = Array.prototype.slice;
function array_default2(x4) {
return typeof x4 === "object" && "length" in x4 ? x4 : Array.from(x4);
}
// node_modules/d3-shape/src/curve/linear.js
function Linear(context) {
this._context = context;
}
Linear.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
if (this._line || this._line !== 0 && this._point === 1)
this._context.closePath();
this._line = 1 - this._line;
},
point: function(x4, y4) {
x4 = +x4, y4 = +y4;
switch (this._point) {
case 0:
this._point = 1;
this._line ? this._context.lineTo(x4, y4) : this._context.moveTo(x4, y4);
break;
case 1:
this._point = 2;
default:
this._context.lineTo(x4, y4);
break;
}
}
};
function linear_default(context) {
return new Linear(context);
}
// node_modules/d3-shape/src/point.js
function x3(p) {
return p[0];
}
function y3(p) {
return p[1];
}
// node_modules/d3-shape/src/line.js
function line_default(x4, y4) {
var defined = constant_default7(true), context = null, curve = linear_default, output = null;
x4 = typeof x4 === "function" ? x4 : x4 === void 0 ? x3 : constant_default7(x4);
y4 = typeof y4 === "function" ? y4 : y4 === void 0 ? y3 : constant_default7(y4);
function line(data) {
var i, n2 = (data = array_default2(data)).length, d, defined0 = false, buffer;
if (context == null)
output = curve(buffer = path_default());
for (i = 0; i <= n2; ++i) {
if (!(i < n2 && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0)
output.lineStart();
else
output.lineEnd();
}
if (defined0)
output.point(+x4(d, i, data), +y4(d, i, data));
}
if (buffer)
return output = null, buffer + "" || null;
}
line.x = function(_) {
return arguments.length ? (x4 = typeof _ === "function" ? _ : constant_default7(+_), line) : x4;
};
line.y = function(_) {
return arguments.length ? (y4 = typeof _ === "function" ? _ : constant_default7(+_), line) : y4;
};
line.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant_default7(!!_), line) : defined;
};
line.curve = function(_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
};
line.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
};
return line;
}
// node_modules/d3-shape/src/curve/radial.js
var curveRadialLinear = curveRadial(linear_default);
function Radial(curve) {
this._curve = curve;
}
Radial.prototype = {
areaStart: function() {
this._curve.areaStart();
},
areaEnd: function() {
this._curve.areaEnd();
},
lineStart: function() {
this._curve.lineStart();
},
lineEnd: function() {
this._curve.lineEnd();
},
point: function(a2, r) {
this._curve.point(r * Math.sin(a2), r * -Math.cos(a2));
}
};
function curveRadial(curve) {
function radial(context) {
return new Radial(curve(context));
}
radial._curve = curve;
return radial;
}
// node_modules/d3-shape/src/lineRadial.js
function lineRadial(l2) {
var c3 = l2.curve;
l2.angle = l2.x, delete l2.x;
l2.radius = l2.y, delete l2.y;
l2.curve = function(_) {
return arguments.length ? c3(curveRadial(_)) : c3()._curve;
};
return l2;
}
function lineRadial_default() {
return lineRadial(line_default().curve(curveRadialLinear));
}
// node_modules/d3-shape/src/link/index.js
function linkSource(d) {
return d.source;
}
function linkTarget(d) {
return d.target;
}
function link(curve) {
var source = linkSource, target = linkTarget, x4 = x3, y4 = y3, context = null;
function link2() {
var buffer, argv = slice.call(arguments), s2 = source.apply(this, argv), t = target.apply(this, argv);
if (!context)
context = buffer = path_default();
curve(context, +x4.apply(this, (argv[0] = s2, argv)), +y4.apply(this, argv), +x4.apply(this, (argv[0] = t, argv)), +y4.apply(this, argv));
if (buffer)
return context = null, buffer + "" || null;
}
link2.source = function(_) {
return arguments.length ? (source = _, link2) : source;
};
link2.target = function(_) {
return arguments.length ? (target = _, link2) : target;
};
link2.x = function(_) {
return arguments.length ? (x4 = typeof _ === "function" ? _ : constant_default7(+_), link2) : x4;
};
link2.y = function(_) {
return arguments.length ? (y4 = typeof _ === "function" ? _ : constant_default7(+_), link2) : y4;
};
link2.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, link2) : context;
};
return link2;
}
function curveHorizontal(context, x0, y0, x1, y1) {
context.moveTo(x0, y0);
context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
}
function linkHorizontal() {
return link(curveHorizontal);
}
// node_modules/d3-shape/src/curve/basis.js
function point2(that, x4, y4) {
that._context.bezierCurveTo(
(2 * that._x0 + that._x1) / 3,
(2 * that._y0 + that._y1) / 3,
(that._x0 + 2 * that._x1) / 3,
(that._y0 + 2 * that._y1) / 3,
(that._x0 + 4 * that._x1 + x4) / 6,
(that._y0 + 4 * that._y1 + y4) / 6
);
}
function Basis(context) {
this._context = context;
}
Basis.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = NaN;
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 3:
point2(this, this._x1, this._y1);
case 2:
this._context.lineTo(this._x1, this._y1);
break;
}
if (this._line || this._line !== 0 && this._point === 1)
this._context.closePath();
this._line = 1 - this._line;
},
point: function(x4, y4) {
x4 = +x4, y4 = +y4;
switch (this._point) {
case 0:
this._point = 1;
this._line ? this._context.lineTo(x4, y4) : this._context.moveTo(x4, y4);
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3;
this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
default:
point2(this, x4, y4);
break;
}
this._x0 = this._x1, this._x1 = x4;
this._y0 = this._y1, this._y1 = y4;
}
};
// node_modules/d3-shape/src/curve/bundle.js
function Bundle(context, beta) {
this._basis = new Basis(context);
this._beta = beta;
}
Bundle.prototype = {
lineStart: function() {
this._x = [];
this._y = [];
this._basis.lineStart();
},
lineEnd: function() {
var x4 = this._x, y4 = this._y, j = x4.length - 1;
if (j > 0) {
var x0 = x4[0], y0 = y4[0], dx = x4[j] - x0, dy = y4[j] - y0, i = -1, t;
while (++i <= j) {
t = i / j;
this._basis.point(
this._beta * x4[i] + (1 - this._beta) * (x0 + t * dx),
this._beta * y4[i] + (1 - this._beta) * (y0 + t * dy)
);
}
}
this._x = this._y = null;
this._basis.lineEnd();
},
point: function(x4, y4) {
this._x.push(+x4);
this._y.push(+y4);
}
};
var bundle_default = function custom2(beta) {
function bundle(context) {
return beta === 1 ? new Basis(context) : new Bundle(context, beta);
}
bundle.beta = function(beta2) {
return custom2(+beta2);
};
return bundle;
}(0.85);
// node_modules/d3-zoom/src/constant.js
var constant_default8 = (x4) => () => x4;
// node_modules/d3-zoom/src/event.js
function ZoomEvent(type2, {
sourceEvent,
target,
transform: transform2,
dispatch: dispatch2
}) {
Object.defineProperties(this, {
type: { value: type2, enumerable: true, configurable: true },
sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
target: { value: target, enumerable: true, configurable: true },
transform: { value: transform2, enumerable: true, configurable: true },
_: { value: dispatch2 }
});
}
// node_modules/d3-zoom/src/transform.js
function Transform(k, x4, y4) {
this.k = k;
this.x = x4;
this.y = y4;
}
Transform.prototype = {
constructor: Transform,
scale: function(k) {
return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
},
translate: function(x4, y4) {
return x4 === 0 & y4 === 0 ? this : new Transform(this.k, this.x + this.k * x4, this.y + this.k * y4);
},
apply: function(point3) {
return [point3[0] * this.k + this.x, point3[1] * this.k + this.y];
},
applyX: function(x4) {
return x4 * this.k + this.x;
},
applyY: function(y4) {
return y4 * this.k + this.y;
},
invert: function(location) {
return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
},
invertX: function(x4) {
return (x4 - this.x) / this.k;
},
invertY: function(y4) {
return (y4 - this.y) / this.k;
},
rescaleX: function(x4) {
return x4.copy().domain(x4.range().map(this.invertX, this).map(x4.invert, x4));
},
rescaleY: function(y4) {
return y4.copy().domain(y4.range().map(this.invertY, this).map(y4.invert, y4));
},
toString: function() {
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
}
};
var identity3 = new Transform(1, 0, 0);
transform.prototype = Transform.prototype;
function transform(node) {
while (!node.__zoom)
if (!(node = node.parentNode))
return identity3;
return node.__zoom;
}
// node_modules/d3-zoom/src/noevent.js
function nopropagation3(event) {
event.stopImmediatePropagation();
}
function noevent_default3(event) {
event.preventDefault();
event.stopImmediatePropagation();
}
// node_modules/d3-zoom/src/zoom.js
function defaultFilter2(event) {
return (!event.ctrlKey || event.type === "wheel") && !event.button;
}
function defaultExtent() {
var e = this;
if (e instanceof SVGElement) {
e = e.ownerSVGElement || e;
if (e.hasAttribute("viewBox")) {
e = e.viewBox.baseVal;
return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
}
return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
}
return [[0, 0], [e.clientWidth, e.clientHeight]];
}
function defaultTransform() {
return this.__zoom || identity3;
}
function defaultWheelDelta(event) {
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
}
function defaultTouchable2() {
return navigator.maxTouchPoints || "ontouchstart" in this;
}
function defaultConstrain(transform2, extent, translateExtent) {
var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
return transform2.translate(
dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
);
}
function zoom_default2() {
var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
function zoom(selection2) {
selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
zoom.transform = function(collection, transform2, point3, event) {
var selection2 = collection.selection ? collection.selection() : collection;
selection2.property("__zoom", defaultTransform);
if (collection !== selection2) {
schedule(collection, transform2, point3, event);
} else {
selection2.interrupt().each(function() {
gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
});
}
};
zoom.scaleBy = function(selection2, k, p, event) {
zoom.scaleTo(selection2, function() {
var k0 = this.__zoom.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
return k0 * k1;
}, p, event);
};
zoom.scaleTo = function(selection2, k, p, event) {
zoom.transform(selection2, function() {
var e = extent.apply(this, arguments), t0 = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p0), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
}, p, event);
};
zoom.translateBy = function(selection2, x4, y4, event) {
zoom.transform(selection2, function() {
return constrain(this.__zoom.translate(
typeof x4 === "function" ? x4.apply(this, arguments) : x4,
typeof y4 === "function" ? y4.apply(this, arguments) : y4
), extent.apply(this, arguments), translateExtent);
}, null, event);
};
zoom.translateTo = function(selection2, x4, y4, p, event) {
zoom.transform(selection2, function() {
var e = extent.apply(this, arguments), t = this.__zoom, p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
return constrain(identity3.translate(p0[0], p0[1]).scale(t.k).translate(
typeof x4 === "function" ? -x4.apply(this, arguments) : -x4,
typeof y4 === "function" ? -y4.apply(this, arguments) : -y4
), e, translateExtent);
}, p, event);
};
function scale(transform2, k) {
k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
}
function translate(transform2, p0, p1) {
var x4 = p0[0] - p1[0] * transform2.k, y4 = p0[1] - p1[1] * transform2.k;
return x4 === transform2.x && y4 === transform2.y ? transform2 : new Transform(transform2.k, x4, y4);
}
function centroid(extent2) {
return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
}
function schedule(transition2, transform2, point3, event) {
transition2.on("start.zoom", function() {
gesture(this, arguments).event(event).start();
}).on("interrupt.zoom end.zoom", function() {
gesture(this, arguments).event(event).end();
}).tween("zoom", function() {
var that = this, args = arguments, g = gesture(that, args).event(event), e = extent.apply(that, args), p = point3 == null ? centroid(e) : typeof point3 === "function" ? point3.apply(that, args) : point3, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a2 = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate(a2.invert(p).concat(w / a2.k), b.invert(p).concat(w / b.k));
return function(t) {
if (t === 1)
t = b;
else {
var l2 = i(t), k = w / l2[2];
t = new Transform(k, p[0] - l2[0] * k, p[1] - l2[1] * k);
}
g.zoom(null, t);
};
});
}
function gesture(that, args, clean) {
return !clean && that.__zooming || new Gesture(that, args);
}
function Gesture(that, args) {
this.that = that;
this.args = args;
this.active = 0;
this.sourceEvent = null;
this.extent = extent.apply(that, args);
this.taps = 0;
}
Gesture.prototype = {
event: function(event) {
if (event)
this.sourceEvent = event;
return this;
},
start: function() {
if (++this.active === 1) {
this.that.__zooming = this;
this.emit("start");
}
return this;
},
zoom: function(key, transform2) {
if (this.mouse && key !== "mouse")
this.mouse[1] = transform2.invert(this.mouse[0]);
if (this.touch0 && key !== "touch")
this.touch0[1] = transform2.invert(this.touch0[0]);
if (this.touch1 && key !== "touch")
this.touch1[1] = transform2.invert(this.touch1[0]);
this.that.__zoom = transform2;
this.emit("zoom");
return this;
},
end: function() {
if (--this.active === 0) {
delete this.that.__zooming;
this.emit("end");
}
return this;
},
emit: function(type2) {
var d = select_default2(this.that).datum();
listeners.call(
type2,
this.that,
new ZoomEvent(type2, {
sourceEvent: this.sourceEvent,
target: zoom,
type: type2,
transform: this.that.__zoom,
dispatch: listeners
}),
d
);
}
};
function wheeled(event, ...args) {
if (!filter2.apply(this, arguments))
return;
var g = gesture(this, args).event(event), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer_default(event);
if (g.wheel) {
if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
g.mouse[1] = t.invert(g.mouse[0] = p);
}
clearTimeout(g.wheel);
} else if (t.k === k)
return;
else {
g.mouse = [p, t.invert(p)];
interrupt_default(this);
g.start();
}
noevent_default3(event);
g.wheel = setTimeout(wheelidled, wheelDelay);
g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
function wheelidled() {
g.wheel = null;
g.end();
}
}
function mousedowned(event, ...args) {
if (touchending || !filter2.apply(this, arguments))
return;
var g = gesture(this, args, true).event(event), v = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer_default(event, currentTarget), currentTarget = event.currentTarget, x0 = event.clientX, y0 = event.clientY;
nodrag_default(event.view);
nopropagation3(event);
g.mouse = [p, this.__zoom.invert(p)];
interrupt_default(this);
g.start();
function mousemoved(event2) {
noevent_default3(event2);
if (!g.moved) {
var dx = event2.clientX - x0, dy = event2.clientY - y0;
g.moved = dx * dx + dy * dy > clickDistance2;
}
g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer_default(event2, currentTarget), g.mouse[1]), g.extent, translateExtent));
}
function mouseupped(event2) {
v.on("mousemove.zoom mouseup.zoom", null);
yesdrag(event2.view, g.moved);
noevent_default3(event2);
g.event(event2).end();
}
}
function dblclicked(event, ...args) {
if (!filter2.apply(this, arguments))
return;
var t0 = this.__zoom, p0 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p0), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);
noevent_default3(event);
if (duration > 0)
select_default2(this).transition().duration(duration).call(schedule, t1, p0, event);
else
select_default2(this).call(zoom.transform, t1, p0, event);
}
function touchstarted(event, ...args) {
if (!filter2.apply(this, arguments))
return;
var touches = event.touches, n2 = touches.length, g = gesture(this, args, event.changedTouches.length === n2).event(event), started, i, t, p;
nopropagation3(event);
for (i = 0; i < n2; ++i) {
t = touches[i], p = pointer_default(t, this);
p = [p, this.__zoom.invert(p), t.identifier];
if (!g.touch0)
g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
else if (!g.touch1 && g.touch0[2] !== p[2])
g.touch1 = p, g.taps = 0;
}
if (touchstarting)
touchstarting = clearTimeout(touchstarting);
if (started) {
if (g.taps < 2)
touchfirst = p[0], touchstarting = setTimeout(function() {
touchstarting = null;
}, touchDelay);
interrupt_default(this);
g.start();
}
}
function touchmoved(event, ...args) {
if (!this.__zooming)
return;
var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i, t, p, l2;
noevent_default3(event);
for (i = 0; i < n2; ++i) {
t = touches[i], p = pointer_default(t, this);
if (g.touch0 && g.touch0[2] === t.identifier)
g.touch0[0] = p;
else if (g.touch1 && g.touch1[2] === t.identifier)
g.touch1[0] = p;
}
t = g.that.__zoom;
if (g.touch1) {
var p0 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
t = scale(t, Math.sqrt(dp / dl));
p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
} else if (g.touch0)
p = g.touch0[0], l2 = g.touch0[1];
else
return;
g.zoom("touch", constrain(translate(t, p, l2), g.extent, translateExtent));
}
function touchended(event, ...args) {
if (!this.__zooming)
return;
var g = gesture(this, args).event(event), touches = event.changedTouches, n2 = touches.length, i, t;
nopropagation3(event);
if (touchending)
clearTimeout(touchending);
touchending = setTimeout(function() {
touchending = null;
}, touchDelay);
for (i = 0; i < n2; ++i) {
t = touches[i];
if (g.touch0 && g.touch0[2] === t.identifier)
delete g.touch0;
else if (g.touch1 && g.touch1[2] === t.identifier)
delete g.touch1;
}
if (g.touch1 && !g.touch0)
g.touch0 = g.touch1, delete g.touch1;
if (g.touch0)
g.touch0[1] = this.__zoom.invert(g.touch0[0]);
else {
g.end();
if (g.taps === 2) {
t = pointer_default(t, this);
if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {
var p = select_default2(this).on("dblclick.zoom");
if (p)
p.apply(this, arguments);
}
}
}
}
zoom.wheelDelta = function(_) {
return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant_default8(+_), zoom) : wheelDelta;
};
zoom.filter = function(_) {
return arguments.length ? (filter2 = typeof _ === "function" ? _ : constant_default8(!!_), zoom) : filter2;
};
zoom.touchable = function(_) {
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant_default8(!!_), zoom) : touchable;
};
zoom.extent = function(_) {
return arguments.length ? (extent = typeof _ === "function" ? _ : constant_default8([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
};
zoom.scaleExtent = function(_) {
return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
};
zoom.translateExtent = function(_) {
return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
};
zoom.constrain = function(_) {
return arguments.length ? (constrain = _, zoom) : constrain;
};
zoom.duration = function(_) {
return arguments.length ? (duration = +_, zoom) : duration;
};
zoom.interpolate = function(_) {
return arguments.length ? (interpolate = _, zoom) : interpolate;
};
zoom.on = function() {
var value = listeners.on.apply(listeners, arguments);
return value === listeners ? zoom : value;
};
zoom.clickDistance = function(_) {
return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
};
zoom.tapDistance = function(_) {
return arguments.length ? (tapDistance = +_, zoom) : tapDistance;
};
return zoom;
}
// src/Visualisations/VisModal.ts
var import_obsidian43 = require("obsidian");
// src/Components/VisComp.svelte
var import_loglevel21 = __toESM(require_loglevel());
// src/Visualisations/ArcDiagram.ts
var arcDiagram = (graph, currFile, modal, width, height) => {
const data = graphlibToD3(graph);
const margin = { top: 20, right: 20, bottom: 20, left: 150 };
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width);
const nodes = data.nodes.map(({ id: id2, name }) => ({
id: id2,
name,
sourceLinks: [],
targetLinks: []
}));
const nodeById = new Map(nodes.map((d) => [d.id, d]));
const links = data.links.map(({ source, target }) => ({
source: nodeById.get(source),
target: nodeById.get(target)
}));
for (const link2 of links) {
const { source, target } = link2;
source.sourceLinks.push(link2);
target.targetLinks.push(link2);
}
svg.append("style").text(`
path {
stroke: #808080;
opacity: 0.8;
}
text {
stroke: var(--text-a);
opacity: 0.8;
}
.hover g.primary text {
fill: black;
}
.hover g.secondary text {
fill: #333;
}
.hover .secondary {
color: red;
}
.hover path.primary {
stroke: #333;
stroke-opacity: 1;
}
.hover rect {
opacity: 1;
cursor: pointer;
}
`);
const y4 = point(nodes.map((d) => d.name).sort(ascending_default), [
margin.top,
height - margin.bottom
]);
const label = svg.append("g").attr("font-family", "sans-serif").attr("font-size", 10).attr("text-anchor", "end").selectAll("g").data(nodes).join("g").attr("transform", (d) => `translate(${margin.left},${d.y = y4(d.name)})`).call(
(g) => g.append("text").attr("x", -6).attr("dy", "0.35em").text((d) => d.name)
).call(
(g) => g.append("circle").attr("r", 3)
// .attr("fill", (d) => color(d.group))
);
const path2 = svg.insert("g", "*").attr("fill", "none").attr("stroke-opacity", 0.6).attr("stroke-width", 1.5).selectAll("path").data(links).join("path").attr("d", arc);
const step = 104;
const nodeClick = (event, dest) => {
openOrSwitch(dest, event);
modal.close();
};
const overlay = svg.append("g").attr("fill", "none").attr("pointer-events", "all").selectAll("rect").data(nodes).join("rect").attr("width", margin.left + 40).attr("height", step).attr("y", (d) => y4(d.name) - step / 2).on("mouseover", (d) => {
svg.classed("hover", true);
label.classed("primary", (n2) => n2 === d);
label.classed(
"secondary",
(n2) => n2.sourceLinks.some((l2) => l2.target === d) || n2.targetLinks.some((l2) => l2.source === d)
);
path2.classed("primary", (l2) => l2.source === d || l2.target === d).filter(".primary").raise();
}).on("mouseout", (d) => {
svg.classed("hover", false);
label.classed("primary", false);
label.classed("secondary", false);
path2.classed("primary", false).order();
}).on("click", (event, d) => {
nodeClick(event, d.name);
});
function arc(d) {
const y1 = d.source.y;
const y22 = d.target.y;
const r = Math.abs(y22 - y1) / 2;
return `M${margin.left},${y1}A${r},${r} 0,0,${y1 < y22 ? 1 : 0} ${margin.left},${y22}`;
}
function zoomed({ transform: transform2 }) {
svg.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 8]).on("zoom", zoomed)
);
};
// src/Visualisations/CirclePacking.ts
var circlePacking = (graph, currFile, modal, width, height) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hierarchy2 = stratify_default()(flatAdj);
console.log({ hierarchy: hierarchy2 });
const adjList = bfsAdjList(graph, currFile.basename);
console.log({ adjList });
const noDoubles = [...adjList];
noDoubles.forEach((a2, i) => {
if (noDoubles.some((b, j) => i !== j && a2.name === b.name)) {
const index2 = noDoubles.findIndex((b, j) => i !== j && a2.name === b.name);
noDoubles.splice(index2, 1);
}
});
console.log({ noDoubles });
const linkArr = noDoubles.map((d) => {
return { source: d.name, target: d.parentId };
});
const links = linkArr.map((d) => Object.create(d));
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width);
const nodeColour = getComputedStyle(document.body).getPropertyValue(
"--text-accent"
);
const node = svg.append("g").selectAll("circle").data(noDoubles).join("circle").attr("r", (d) => Math.round(d.height / 10) + 10).attr("cx", width / 2).attr("cy", height / 2).style("fill", nodeColour).style("fill-opacity", 0.6).attr("stroke", nodeColour).style("stroke-width", 4);
node.attr("aria-label", (d) => d.name);
const nodeClick = (event, dest) => {
const currFile2 = getCurrFile();
openOrSwitch(dest, event);
modal.close();
};
node.on("click", (event, d) => {
nodeClick(event, d.name);
});
const link2 = svg.append("g").attr("stroke", "#868282").attr("stroke-opacity", 0.6).selectAll("line").data(links).join("line").attr("stroke-width", 0.8);
const simulation = simulation_default().force(
"center",
center_default().x(width / 2).y(height / 2)
).force("charge", manyBody_default().strength(0.5)).force(
"collide",
collide_default().strength(0.025).radius(30).iterations(1)
);
simulation.nodes(noDoubles).on("tick", function(d) {
node.attr("cx", (d2) => d2.x).attr("cy", (d2) => d2.y);
});
function zoomed({ transform: transform2 }) {
node.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 8]).on("zoom", zoomed)
);
const drag = (simulation2) => {
function dragstarted(event, d) {
if (!event.active)
simulation2.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}
function dragged(event, d) {
d.fx = event.x;
d.fy = event.y;
}
function dragended(event, d) {
if (!event.active)
simulation2.alphaTarget(0);
d.fx = null;
d.fy = null;
}
return drag_default().on("start", dragstarted).on("drag", dragged).on("end", dragended);
};
node.call(drag(simulation));
};
// src/Visualisations/EdgeBundling.ts
var edgeBundling = (graph, currFile, modal, width, height) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hier = stratify_default()(flatAdj);
console.log({ hier });
const PADDING_BUBBLE = 15;
const PADDING_LABEL = 30;
const BUBBLE_SIZE_MIN = 4;
const BUBBLE_SIZE_MAX = 20;
var diameter = 560, radius = diameter / 2, innerRadius = radius - 170;
var cluster = cluster_default().size([360, innerRadius]);
var line = lineRadial_default().curve(bundle_default.beta(0.85)).radius(function(d) {
return d[1];
}).angle(function(d) {
return d[0] / 180 * Math.PI;
});
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width).append("g").attr("transform", "translate(" + radius + "," + radius + ")");
var link2 = svg.append("g").selectAll(".link"), label = svg.append("g").selectAll(".label"), bubble = svg.append("g").selectAll(".bubble");
var bubbleSizeScale = linear2().domain([0, 100]).range([BUBBLE_SIZE_MIN, BUBBLE_SIZE_MAX]);
var root2 = packageHierarchy(hier).sum(function(d) {
console.log(d);
return d.height;
});
cluster(root2);
const leaves = root2.leaves();
const _link = link2.data(packageImports(leaves)).enter().append("path").each(function(d) {
d.source = d[0], d.target = d[d.length - 1];
}).attr("class", "link").attr("d", line).attr("fill", "none").attr("stroke", "black");
const _label = label.data(leaves).enter().append("text").attr("class", "label").attr("dy", "0.31em").attr("transform", function(d) {
return "rotate(" + (d.x - 90) + ")translate(" + (d.y + PADDING_LABEL) + ",0)" + (d.x < 180 ? "" : "rotate(180)");
}).attr("text-anchor", function(d) {
return d.x < 180 ? "start" : "end";
}).text(function(d) {
return d.data.key;
});
const _bubble = bubble.data(leaves).enter().append("circle").attr("class", "bubble").attr("transform", function(d) {
return "rotate(" + (d.x - 90) + ")translate(" + (d.y + PADDING_BUBBLE) + ",0)";
}).attr("r", (d) => bubbleSizeScale(d.value)).attr("stroke", "black").attr("fill", "#69a3b2").style("opacity", 0.2);
function packageHierarchy(classes) {
var map2 = {};
function find3(name, data) {
var node = map2[name], i;
if (!node) {
node = map2[name] = data || { name, children: [] };
if (name.length) {
node.parent = find3(name.substring(0, i = name.lastIndexOf(".")));
node.parent.children.push(node);
node.key = name.substring(i + 1);
}
}
return node;
}
classes.forEach(function(d) {
find3(d.name, d);
});
return hierarchy(map2[""]);
}
function packageImports(nodes) {
var map2 = {}, imports = [];
nodes.forEach(function(d) {
map2[d.data.name] = d;
});
nodes.forEach(function(d) {
if (d.data.imports)
d.data.imports.forEach(function(i) {
imports.push(map2[d.data.name].path(map2[i]));
});
});
return imports;
}
};
// src/Visualisations/ForceDirectedG.ts
var forceDirectedG = (graph, currFile, modal, width, height) => {
const { settings } = modal.plugin;
let nodeToGetTo = currFile.basename;
console.log({ nodeToGetTo });
console.time("Find all paths");
console.timeEnd("Find all paths");
const defaultNodeColour = getComputedStyle(document.body).getPropertyValue(
"--text-accent"
);
let currNodeColour = defaultNodeColour;
const colourChangeInput = select_default2(".d3-graph").append("input").attr("type", "color");
colourChangeInput.on("change", function changeColor(el) {
currNodeColour = el.target.value;
node.transition().duration(300).style("fill", (d) => {
if (d.index === currNodeIndex)
return;
return currNodeColour;
});
});
const data = graphlibToD3(graph);
const links = data.links.map((d) => Object.create(d));
const currNode = data.nodes.find((node2) => node2.name === currFile.basename);
let currNodeIndex;
if (!currNode) {
const id2 = data.nodes.length;
data.nodes.push({ id: id2, name: currFile.basename });
currNodeIndex = id2;
} else {
currNodeIndex = currNode.id;
}
const nodes = data.nodes.map((d) => Object.create(d));
const simulation = simulation_default(nodes).force(
"link",
link_default(links).id((d) => d.id)
).force("charge", manyBody_default().strength(-8)).force("center", center_default(width / 2, height / 2).strength(0.5));
const drag = (simulation2) => {
function dragstarted(event, d) {
if (!event.active)
simulation2.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}
function dragged(event, d) {
d.fx = event.x;
d.fy = event.y;
}
function dragended(event, d) {
if (!event.active)
simulation2.alphaTarget(0);
d.fx = null;
d.fy = null;
}
return drag_default().on("start", dragstarted).on("drag", dragged).on("end", dragended);
};
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width).attr("class", "forceDirectedG");
const link2 = svg.append("g").attr("stroke", "#868282").attr("stroke-opacity", 0.6).selectAll("line").data(links).join("line").attr("stroke-width", 0.8).attr("marker-end", "url(#end)");
var path2 = svg.append("svg:g").selectAll("path").data(links).enter().append("svg:path").attr("class", "link").attr("marker-end", "url(#end)");
const arrowHead = svg.append("svg:defs").selectAll("marker").data(["end"]).enter().append("svg:marker").attr("id", String).attr("viewBox", "0 -5 10 10").attr("refX", 20).attr("refY", 0.1).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").attr("stroke-width", 10).append("svg:path").attr("d", "M0,-5L10,0L0,5");
const nameFromIndex = (d) => data.nodes.find((node2) => node2.id === d.index).name;
const indexFromName = (name) => data.nodes.find((node2) => node2.name === name).id;
const node = svg.append("g").selectAll("circle").data(nodes).join("circle").attr("r", 5).attr("fill", (d) => {
if (nameFromIndex(d) === currFile.basename) {
return "#ffffff";
} else {
return currNodeColour;
}
}).call(drag(simulation));
node.attr("aria-label", (d) => d.name);
const nodeClick = (event, dest) => {
openOrSwitch(dest, event);
modal.close();
};
node.on("click", (event, d) => {
nodeClick(event, d.name);
});
node.on("mousedown", (event, d) => {
if (event.button === 2) {
nodeToGetTo = d.name;
node.style("fill", (n2) => {
if (n2.name === nodeToGetTo) {
return "#ff0000";
} else
return currNodeColour;
});
}
});
function linked(a2, b) {
if (a2 === b)
return true;
const linkedArr = links.find(
(link3) => link3.source.index === a2 && link3.target.index === b || link3.target.index === a2 && link3.source.index === b
);
return !!linkedArr;
}
node.on("mouseover", (event, d) => {
node.transition().duration(150).style("opacity", (o) => {
return linked(d.index, o.index) ? 1 : 0.2;
});
link2.transition().duration(150).style("opacity", function(o) {
return o.source.index === d.index || o.target.index === d.index ? 1 : 0.2;
});
const hoveredNode = nameFromIndex(d);
}).on("mouseout", unfocus);
function focusNeighbours(d, event) {
}
function unfocus() {
node.style("opacity", 1);
link2.style("opacity", 1).style("stroke", "#868282");
}
simulation.on("tick", () => {
link2.attr("x1", (d) => d.source.x).attr("y1", (d) => d.source.y).attr("x2", (d) => d.target.x).attr("y2", (d) => d.target.y);
node.attr("cx", (d) => d.x).attr("cy", (d) => d.y);
});
function zoomed({ transform: transform2 }) {
node.attr("transform", transform2);
link2.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 10]).on("zoom", zoomed)
);
function saveGraph() {
const clone3 = svg.clone(true);
localStorage.setItem("FDG", JSON.stringify(clone3));
}
};
// src/Visualisations/Icicle.ts
var icicle = (graph, currFile, modal, width, viewHeight) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hier = stratify_default()(flatAdj);
console.log({ hier });
const format2 = format(",d");
const color2 = ordinal(
quantize_default(rainbow_default, hier.children.length + 1)
);
const partition = (data) => {
const root3 = hierarchy(data).sum((d) => d.value).sort((a2, b) => b.height - a2.height || b.value - a2.value);
return partition_default().size([viewHeight, (root3.height + 1) * width / 3])(
root3
);
};
const root2 = partition(hier);
let focus = root2;
const svg = select_default2(".d3-graph").append("svg").attr("height", viewHeight).attr("width", width).style("font", "10px sans-serif");
const cell = svg.selectAll("g").data(root2.descendants()).join("g").attr("transform", (d) => `translate(${d.y0},${d.x0})`);
const rect = cell.append("rect").attr("width", (d) => d.y1 - d.y0 - 1).attr("height", (d) => rectHeight(d)).attr("fill-opacity", 0.6).attr("fill", (d) => {
if (!d.depth)
return "#ccc";
while (d.depth > 1)
d = d.parent;
return color2(d.data.data.name);
}).style("cursor", "pointer").on("click", clicked);
const text2 = cell.append("text").style("user-select", "none").attr("pointer-events", "none").attr("x", 4).attr("y", 13);
text2.append("tspan").text((d) => d.data.data.name);
const tspan = text2.append("tspan").attr("fill-opacity", (d) => (labelVisible(d) ? 1 : 0) * 0.7).text((d) => ` ${format2(d.value)}`);
cell.append("title").text(
(d) => `${d.ancestors().map((d2) => d2.data.data.name)}`
);
function clicked(event, p) {
console.log({ p });
focus = focus === p ? p = p.parent : p;
root2.each((d) => {
d.target = {
x0: (d.x0 - p.x0) / (p.x1 - p.x0) * viewHeight,
x1: (d.x1 - p.x0) / (p.x1 - p.x0) * viewHeight,
y0: d.y0 - p.y0,
y1: d.y1 - p.y0
};
console.log(d.target.x0);
});
const t = cell.transition().duration(750).attr("transform", (d) => `translate(${d.target.y0},${d.target.x0})`);
rect.transition(t).attr("height", (d) => rectHeight(d.target));
text2.transition(t).attr("fill-opacity", (d) => +labelVisible(d.target));
tspan.transition(t).attr("fill-opacity", (d) => (labelVisible(d) ? 1 : 0) * 0.7);
}
function rectHeight(d) {
console.log({ d });
return d.x1 - d.x0 - Math.min(1, (d.x1 - d.x0) / 2);
}
function labelVisible(d) {
return d.y1 <= width && d.y0 >= 0 && d.x1 - d.x0 > 16;
}
};
// src/Visualisations/RadialTree.ts
var radialTree = (graph, currFile, modal, width, height) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hierarchy2 = stratify_default()(flatAdj);
console.log({ hierarchy: hierarchy2 });
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width);
const root2 = hierarchy(hierarchy2, (d) => d.children).sum((d) => d.children ? 0 : 1).sort((a2, b) => a2.depth - b.depth);
const outerRadius = width / 2;
const innerRadius = outerRadius - 170;
const cluster = cluster_default().size([360, innerRadius]).separation((a2, b) => 1);
const color2 = ordinal().domain(graph.nodes()).range(category10_default);
function maxLength(d) {
return d.data.data.depth + (d.children ? max(d.children, maxLength) : 0);
}
function setRadius(d, y0, k) {
d.radius = (y0 += d.data.data.depth) * k;
if (d.children)
d.children.forEach((d2) => setRadius(d2, y0, k));
}
function setColor(d) {
var name = d.data.data.name;
d.color = color2.domain().indexOf(name) >= 0 ? color2(name) : d.parent ? d.parent.color : null;
if (d.children)
d.children.forEach(setColor);
}
function linkVariable(d) {
return linkStep(d.source.x, d.source.radius, d.target.x, d.target.radius);
}
function linkConstant(d) {
return linkStep(d.source.x, d.source.y, d.target.x, d.target.y);
}
function linkExtensionVariable(d) {
return linkStep(d.target.x, d.target.radius, d.target.x, innerRadius);
}
function linkExtensionConstant(d) {
return linkStep(d.target.x, d.target.y, d.target.x, innerRadius);
}
function linkStep(startAngle, startRadius, endAngle, endRadius) {
const c0 = Math.cos(startAngle = (startAngle - 90) / 180 * Math.PI);
const s0 = Math.sin(startAngle);
const c1 = Math.cos(endAngle = (endAngle - 90) / 180 * Math.PI);
const s1 = Math.sin(endAngle);
return "M" + startRadius * c0 + "," + startRadius * s0 + (endAngle === startAngle ? "" : "A" + startRadius + "," + startRadius + " 0 0 " + (endAngle > startAngle ? 1 : 0) + " " + startRadius * c1 + "," + startRadius * s1) + "L" + endRadius * c1 + "," + endRadius * s1;
}
const legend = (svg2) => {
const g = svg2.selectAll("g").data(color2.domain()).join("g").attr(
"transform",
(d, i) => `translate(${-outerRadius},${-outerRadius + i * 20})`
);
g.append("rect").attr("width", 18).attr("height", 18).attr("fill", color2);
g.append("text").attr("x", 24).attr("y", 9).attr("dy", "0.35em").text((d) => d);
};
cluster(root2);
setRadius(root2, root2.data.data.depth = 0, innerRadius / maxLength(root2));
setColor(root2);
svg.append("g").call(legend);
svg.append("style").text(`
.link--active {
stroke: #000 !important;
stroke-width: 1.5px;
}
.link-extension--active {
stroke-opacity: .6;
}
.label--active {
font-weight: bold;
}
`);
const linkExtension = svg.append("g").attr("fill", "none").attr("stroke", "#000").attr("stroke-opacity", 0.25).selectAll("path").data(root2.links().filter((d) => !d.target.children)).join("path").each(function(d) {
d.target.linkExtensionNode = this;
}).attr("d", linkExtensionConstant);
const link2 = svg.append("g").attr("fill", "none").attr("stroke", "#000").selectAll("path").data(root2.links()).join("path").each(function(d) {
d.target.linkNode = this;
}).attr("d", linkConstant).attr("stroke", (d) => d.target.color);
const label = svg.append("g").selectAll("text").data(root2.leaves()).join("text").attr("dy", ".31em").attr(
"transform",
(d) => `rotate(${d.x - 90}) translate(${innerRadius + 4},0)${d.x < 180 ? "" : " rotate(180)"}`
).attr("text-anchor", (d) => d.x < 180 ? "start" : "end").text((d) => d.data.data.name).on("mouseover", mouseovered(true)).on("mouseout", mouseovered(false));
function mouseovered(active) {
return function(event, d) {
select_default2(this).classed("label--active", active);
select_default2(d.linkExtensionNode).classed("link-extension--active", active).raise();
do
select_default2(d.linkNode).classed("link--active", active).raise();
while (d = d.parent);
};
}
function zoomed({ transform: transform2 }) {
linkExtension.attr("transform", transform2);
link2.attr("transform", transform2);
label.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 8]).on("zoom", zoomed)
);
};
// src/Visualisations/Sunburst.ts
var sunburst = (graph, currFile, modal, width, height) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hierarchy2 = stratify_default()(flatAdj);
console.log({ hierarchy: hierarchy2 });
var radius = Math.min(width, height) / 2;
var color2 = ordinal(category10_default);
var g = select_default2("svg").attr("width", width).attr("height", height).append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var g = select_default2("svg").attr("width", width).attr("height", height).append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var g = select_default2("svg").attr("width", width).attr("height", height).append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
var partition = partition_default().size([2 * Math.PI, radius]);
var root2 = hierarchy(hierarchy2).sum(function(d) {
return d.height;
});
partition(root2);
var arc = arc_default().startAngle(function(d) {
return d.x0;
}).endAngle(function(d) {
return d.x1;
}).innerRadius(function(d) {
return d.y0;
}).outerRadius(function(d) {
return d.y1;
});
g.selectAll("path").data(root2.descendants()).enter().append("path").attr("display", function(d) {
return d.depth ? null : "none";
}).attr("d", arc).style("stroke", "#fff").style("fill", function(d) {
return color2((d.children ? d : d.parent).data.name);
});
};
// src/Visualisations/TidyTree.ts
var tidyTree = (graph, currFile, modal, width, height) => {
const tree = (data) => {
const root3 = hierarchy(data);
root3.dx = 10;
root3.dy = width / (root3.height + 1);
return tree_default().nodeSize([root3.dx, root3.dy])(root3);
};
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hierarchy2 = stratify_default()(flatAdj);
console.log({ hierarchy: hierarchy2 });
const root2 = tree(hierarchy2);
console.log(root2);
let x0 = Infinity;
let x1 = -x0;
root2.each((d) => {
if (d.x > x1)
x1 = d.x;
if (d.x < x0)
x0 = d.x;
});
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width);
const g = svg.append("g").attr("font-family", "sans-serif").attr("font-size", 10).attr("transform", `translate(${root2.dy / 3},${root2.dx - x0})`);
const link2 = g.append("g").attr("fill", "none").attr("stroke", "#555").attr("stroke-opacity", 0.4).attr("stroke-width", 1.5).selectAll("path").data(root2.links()).join("path").attr(
"d",
linkHorizontal().x((d) => d.y).y((d) => d.x)
);
const node = g.append("g").attr("stroke-linejoin", "round").attr("stroke-width", 10).selectAll("g").data(root2.descendants()).join("g").attr("transform", (d) => `translate(${d.y},${d.x})`);
node.append("circle").attr("fill", (d) => d.children ? "#555" : "#999").attr("r", 10);
node.attr("aria-label", (d) => {
console.log(d);
return d.data.data.name;
});
const nodeClick = (event, dest) => {
openOrSwitch(dest, event);
modal.close();
};
node.on("click", (event, d) => {
console.log({ d });
nodeClick(event, d.data.data.name);
});
node.append("text").attr("dy", "0.31em").attr("x", (d) => d.children ? -6 : 6).attr("text-anchor", (d) => d.children ? "end" : "start").text((d) => d.data.data.name).clone(true).lower().attr("stroke", "white");
function zoomed({ transform: transform2 }) {
svg.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 8]).on("zoom", zoomed)
);
};
// src/Visualisations/TreeMap.ts
var treeMap = (graph, currFile, modal, width, height) => {
const flatAdj = dfsFlatAdjList(graph, currFile.basename);
console.log({ flatAdj });
const hierarchy2 = stratify_default()(flatAdj);
console.log({ hierarchy: hierarchy2 });
const root2 = treemap_default().tile(binary_default).size([width, height]).padding(1).round(true)(
hierarchy2.sum((d) => d.height).sort((a2, b) => b.height - a2.height)
);
const svg = select_default2(".d3-graph").append("svg").attr("height", height).attr("width", width).style("font", "10px sans-serif");
const leaf = svg.selectAll("g").data(root2.leaves()).join("g").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
leaf.attr("aria-label", (d) => d.data.name);
const color2 = ordinal(category10_default);
leaf.append("rect").attr("fill", (d) => {
while (d.depth > 1)
d = d.parent;
return color2(d.data.id);
}).attr("fill-opacity", 0.6).attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0);
leaf.append("clipPath").append("use");
const nodeClick = (event, dest) => {
openOrSwitch(dest, event);
modal.close();
};
leaf.on("click", (event, d) => {
console.log({ d });
nodeClick(event, d.data.name);
});
function zoomed({ transform: transform2 }) {
svg.attr("transform", transform2);
}
svg.call(
zoom_default2().extent([
[0, 0],
[width, height]
]).scaleExtent([0.5, 8]).on("zoom", zoomed)
);
};
// src/Components/VisComp.svelte
function get_each_context10(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[23] = list[i].text;
child_ctx[24] = list[i].options;
child_ctx[25] = list[i].val;
child_ctx[26] = list;
child_ctx[27] = i;
return child_ctx;
}
function get_each_context_17(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[28] = list[i];
return child_ctx;
}
function create_each_block_17(ctx) {
let option;
let t_value = (
/*op*/
ctx[28] + ""
);
let t;
let option_value_value;
return {
c() {
option = element("option");
t = text(t_value);
option.__value = option_value_value = /*op*/
ctx[28];
option.value = option.__value;
},
m(target, anchor) {
insert(target, option, anchor);
append(option, t);
},
p(ctx2, dirty) {
if (dirty & /*selectors*/
1 && t_value !== (t_value = /*op*/
ctx2[28] + ""))
set_data(t, t_value);
if (dirty & /*selectors*/
1 && option_value_value !== (option_value_value = /*op*/
ctx2[28])) {
option.__value = option_value_value;
option.value = option.__value;
}
},
d(detaching) {
if (detaching)
detach(option);
}
};
}
function create_each_block10(ctx) {
let span;
let t0_value = (
/*text*/
ctx[23] + ""
);
let t0;
let t1;
let select;
let t2;
let mounted;
let dispose;
let each_value_1 = (
/*options*/
ctx[24]
);
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_17(get_each_context_17(ctx, each_value_1, i));
}
function select_change_handler() {
ctx[2].call(
select,
/*each_value*/
ctx[26],
/*each_index*/
ctx[27]
);
}
return {
c() {
span = element("span");
t0 = text(t0_value);
t1 = text(":\n ");
select = element("select");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t2 = space();
if (
/*val*/
ctx[25] === void 0
)
add_render_callback(select_change_handler);
},
m(target, anchor) {
insert(target, span, anchor);
append(span, t0);
append(span, t1);
append(span, select);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(select, null);
}
}
select_option(
select,
/*val*/
ctx[25],
true
);
append(span, t2);
if (!mounted) {
dispose = listen(select, "change", select_change_handler);
mounted = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*selectors*/
1 && t0_value !== (t0_value = /*text*/
ctx[23] + ""))
set_data(t0, t0_value);
if (dirty & /*selectors*/
1) {
each_value_1 = /*options*/
ctx[24];
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_17(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_17(child_ctx);
each_blocks[i].c();
each_blocks[i].m(select, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
if (dirty & /*selectors*/
1) {
select_option(
select,
/*val*/
ctx[25]
);
}
},
d(detaching) {
if (detaching)
detach(span);
destroy_each(each_blocks, detaching);
mounted = false;
dispose();
}
};
}
function create_fragment23(ctx) {
let div0;
let t;
let div1;
let each_value = (
/*selectors*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block10(get_each_context10(ctx, each_value, i));
}
return {
c() {
div0 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
div1 = element("div");
attr(div1, "class", "d3-graph");
},
m(target, anchor) {
insert(target, div0, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div0, null);
}
}
insert(target, t, anchor);
insert(target, div1, anchor);
},
p(ctx2, [dirty]) {
if (dirty & /*selectors*/
1) {
each_value = /*selectors*/
ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context10(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block10(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div0, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching)
detach(div0);
destroy_each(each_blocks, detaching);
if (detaching)
detach(t);
if (detaching)
detach(div1);
}
};
}
function instance23($$self, $$props, $$invalidate) {
let argArr;
;
;
let { modal } = $$props;
const { plugin } = modal;
const { mainG, settings } = plugin;
const { visGraph, visRelation, visClosed, visAll } = settings;
const currFile = getCurrFile();
const selectors = [
{
text: "Type",
options: VISTYPES,
val: visGraph
},
{
text: "Relation",
options: RELATIONS,
val: visRelation
},
{
text: "Close Implied",
options: REAlCLOSED,
val: visClosed
},
{
text: "No Unlinked",
options: ALLUNLINKED,
val: visAll
}
];
const [width, height] = [Math.round(window.innerWidth / 1.3), Math.round(window.innerHeight / 1.3)];
const [up, same, down] = [
getSubInDirs(mainG, "up"),
getSubInDirs(mainG, "same"),
getSubInDirs(mainG, "down")
];
const [closedParentNoSingle, closedSiblingNoSingle, closedChildNoSingle] = [
closeImpliedLinks(up, down),
closeImpliedLinks(same, same),
closeImpliedLinks(down, up)
];
const graphs = {
Parent: {
Real: {
All: up,
"No Unlinked": removeUnlinkedNodes(up)
},
Closed: {
All: closedParentNoSingle,
"No Unlinked": removeUnlinkedNodes(closedParentNoSingle)
}
},
Sibling: {
Real: {
All: same,
"No Unlinked": removeUnlinkedNodes(same)
},
Closed: {
All: closedSiblingNoSingle,
"No Unlinked": removeUnlinkedNodes(closedSiblingNoSingle)
}
},
Child: {
Real: {
All: down,
"No Unlinked": removeUnlinkedNodes(down)
},
Closed: {
All: closedChildNoSingle,
"No Unlinked": removeUnlinkedNodes(closedChildNoSingle)
}
}
};
const types = {
"Force Directed Graph": forceDirectedG,
"Tidy Tree": tidyTree,
"Circle Packing": circlePacking,
"Edge Bundling": edgeBundling,
"Arc Diagram": arcDiagram,
Sunburst: sunburst,
"Tree Map": treeMap,
Icicle: icicle,
"Radial Tree": radialTree
};
function draw(type2) {
if (!document.querySelector(".d3-graph")) {
setTimeout(
() => {
var _a;
(_a = document.querySelector(".d3-graph")) === null || _a === void 0 ? void 0 : _a.empty();
try {
types[type2](...argArr);
} catch (error6) {
(0, import_loglevel21.warn)(error6);
}
},
10
);
} else {
document.querySelector(".d3-graph").empty();
try {
types[type2](...argArr);
} catch (error6) {
(0, import_loglevel21.warn)(error6);
}
}
}
function select_change_handler(each_value, each_index) {
each_value[each_index].val = select_value(this);
$$invalidate(0, selectors);
}
$$self.$$set = ($$props2) => {
if ("modal" in $$props2)
$$invalidate(1, modal = $$props2.modal);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*selectors, modal*/
3) {
$:
argArr = [
graphs[selectors[1].val][selectors[2].val][selectors[3].val],
app,
currFile,
modal,
width,
height
];
}
if ($$self.$$.dirty & /*selectors*/
1) {
$:
draw(selectors[0].val);
}
};
return [selectors, modal, select_change_handler];
}
var VisComp = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance23, create_fragment23, safe_not_equal, { modal: 1 });
}
};
var VisComp_default = VisComp;
// src/Visualisations/VisModal.ts
function graphlibToD3(g) {
const d3Graph = { nodes: [], links: [] };
const nodeIDs = {};
g.nodes().forEach((node, i) => {
d3Graph.nodes.push({ id: i, name: node });
nodeIDs[node] = i;
});
g.forEachEdge((k, a2, s2, t) => {
d3Graph.links.push({
source: nodeIDs[s2],
target: nodeIDs[t]
});
});
return d3Graph;
}
function bfsAdjList(g, startNode) {
const queue = [startNode];
const adjList = [];
let i = 0;
while (queue.length && i < 1e3) {
i++;
const currNode = queue.shift();
const neighbours = {
succs: getOutNeighbours(g, currNode),
pres: getInNeighbours(g, currNode)
};
console.log({ currNode, neighbours });
const next = {
name: currNode,
pres: void 0,
succs: void 0,
parentId: i,
depth: i
};
if (neighbours.succs.length) {
next.succs = neighbours.succs;
queue.push(...neighbours.succs);
}
if (neighbours.pres.length) {
next.pres = neighbours.pres;
}
adjList.push(next);
}
const maxDepth = adjList.sort((a2, b) => a2.depth - b.depth).last().depth;
adjList.forEach((item) => item.height = maxDepth - item.depth);
return adjList;
}
function dfsFlatAdjList(g, startNode) {
const nodes = g.nodes();
const nodeCount = nodes.length;
const visits = {};
nodes.forEach((node, i2) => {
visits[node] = nodeCount * i2;
});
const queue = [startNode];
const adjList = [];
let depth = 1;
let i = 0;
while (queue.length && i < 1e3) {
i++;
const currNode = queue.shift();
const next = getOutNeighbours(g, currNode);
if (next.length) {
queue.unshift(...next);
next.forEach((succ) => {
const parentId = nodeCount * nodes.indexOf(succ);
if (!adjList.some(
(adjItem) => adjItem.name === currNode && adjItem.parentId === parentId
)) {
adjList.push({
id: visits[currNode],
name: currNode,
parentId,
depth
});
visits[currNode]++;
}
});
depth++;
} else {
adjList.push({
id: visits[currNode],
name: currNode,
parentId: 999999999,
depth
});
depth = 1;
visits[currNode]++;
}
}
adjList.push({
id: 999999999,
name: "CONTAINER",
parentId: void 0,
depth: 0
});
const maxDepth = adjList.sort((a2, b) => a2.depth - b.depth).last().depth;
adjList.forEach((item) => item.height = maxDepth - item.depth);
console.log({ visits });
return adjList;
}
var stratify = stratify_default().id(function(d) {
console.log({ d });
return d.name;
}).parentId(function(d) {
return d.parentId;
});
var VisModal8 = class extends import_obsidian43.Modal {
constructor(plugin) {
super(app);
this.plugin = plugin;
this.modal = this;
}
onOpen() {
new import_obsidian43.Notice(
"Alot of these features may not work, it is still very experimental."
);
const { contentEl } = this;
contentEl.empty();
new VisComp_default({
target: contentEl,
props: {
modal: this
}
});
}
onClose() {
this.contentEl.empty();
}
};
// src/main.ts
var BCPlugin = class extends import_obsidian44.Plugin {
constructor() {
super(...arguments);
this.visited = [];
this.activeLeafChange = void 0;
this.layoutChange = void 0;
this.loadSettings = async () => this.settings = Object.assign(
{},
DEFAULT_SETTINGS,
await this.loadData()
);
this.saveSettings = async () => await this.saveData(this.settings);
}
registerActiveLeafChangeEvent() {
this.activeLeafChange = app.workspace.on(
"file-open",
async () => {
if (this.settings.refreshOnNoteChange)
await refreshIndex(this);
else {
const activeView = this.getActiveTYPEView(MATRIX_VIEW);
if (activeView)
await activeView.draw();
}
}
);
this.registerEvent(this.activeLeafChange);
}
registerLayoutChangeEvent() {
this.layoutChange = app.workspace.on("layout-change", async () => {
if (this.settings.showBCs)
await drawTrail(this);
});
this.registerEvent(this.layoutChange);
}
async onload() {
console.log("loading breadcrumbs plugin");
await this.loadSettings();
this.addSettingTab(new BCSettingTab(this));
this.db = new Debugger(this);
const { settings } = this;
const {
fieldSuggestor,
enableRelationSuggestor,
openMatrixOnLoad,
openDuckOnLoad,
openDownOnLoad,
showBCs,
userHiers
} = settings;
if (fieldSuggestor)
this.registerEditorSuggest(new FieldSuggestor(this));
if (enableRelationSuggestor)
this.registerEditorSuggest(new RelationSuggestor(this));
if (settings.limitTrailCheckboxes.length === 0)
settings.limitTrailCheckboxes = getFields(settings.userHiers);
if (typeof settings.showAll === "boolean")
settings.showAll = settings.showAll ? "All" : "Shortest";
this.VIEWS = [
{
plain: "Matrix",
type: MATRIX_VIEW,
constructor: MatrixView,
openOnLoad: openMatrixOnLoad
},
{
plain: "Duck",
type: DUCK_VIEW,
constructor: DucksView,
openOnLoad: openDuckOnLoad
},
{
plain: "Down",
type: TREE_VIEW,
constructor: TreeView,
openOnLoad: openDownOnLoad
}
];
for (const { constructor, type: type2 } of this.VIEWS) {
this.registerView(
type2,
(leaf) => (
//@ts-ignore
new constructor(leaf, this)
)
);
}
(0, import_obsidian44.addIcon)(DUCK_ICON, DUCK_ICON_SVG);
(0, import_obsidian44.addIcon)(TRAIL_ICON, TRAIL_ICON_SVG);
this.addRibbonIcon(
addFeatherIcon("tv"),
"Breadcrumbs Visualisation",
() => new VisModal8(this).open()
);
await waitForCache(this);
this.mainG = await buildMainG(this);
this.closedG = buildClosedG(this);
app.workspace.onLayoutReady(async () => {
var _a;
const noFiles = app.vault.getMarkdownFiles().length;
if (((_a = this.mainG) == null ? void 0 : _a.nodes().length) < noFiles) {
await wait(3e3);
this.mainG = await buildMainG(this);
this.closedG = buildClosedG(this);
}
for (const { openOnLoad, type: type2, constructor } of this.VIEWS)
if (openOnLoad)
await openView(type2, constructor);
if (showBCs)
await drawTrail(this);
this.registerActiveLeafChangeEvent();
this.registerLayoutChangeEvent();
const saveCommandDefinition = app.commands.commands["editor:save-file"];
const save = saveCommandDefinition == null ? void 0 : saveCommandDefinition.callback;
if (typeof save === "function") {
saveCommandDefinition.callback = async () => {
await save();
if (this.settings.refreshOnNoteSave) {
await refreshIndex(this);
const activeView = this.getActiveTYPEView(MATRIX_VIEW);
if (activeView)
await activeView.draw();
}
};
}
app.workspace.iterateAllLeaves((leaf) => {
if (leaf instanceof import_obsidian44.MarkdownView)
leaf.view.previewMode.rerender(true);
});
});
for (const { type: type2, plain, constructor } of this.VIEWS) {
this.addCommand({
id: `show-${type2}-view`,
name: `Open ${plain} View`,
//@ts-ignore
checkCallback: async (checking) => {
if (checking)
return app.workspace.getLeavesOfType(type2).length === 0;
await openView(type2, constructor);
}
});
}
this.addCommand({
id: "open-vis-modal",
name: "Open Visualisation Modal",
callback: () => new VisModal8(this).open()
});
this.addCommand({
id: "manipulate-hierarchy-notes",
name: "Adjust Hierarchy Notes",
callback: () => new HierarchyNoteSelectorModal(this).open()
});
this.addCommand({
id: "Refresh-Breadcrumbs-Index",
name: "Refresh Breadcrumbs Index",
callback: async () => await refreshIndex(this)
});
this.addCommand({
id: "Toggle-trail-in-Edit&LP",
name: "Toggle: Show Trail/Grid in Edit & LP mode",
callback: async () => {
settings.showBCsInEditLPMode = !settings.showBCsInEditLPMode;
await this.saveSettings();
await drawTrail(this);
}
});
this.addCommand({
id: "Write-Breadcrumbs-to-Current-File",
name: "Write Breadcrumbs to Current File",
callback: async () => await writeBCToFile(this)
});
this.addCommand({
id: "Write-Breadcrumbs-to-All-Files",
name: "Write Breadcrumbs to **ALL** Files",
callback: async () => await writeBCsToAllFiles(this)
});
this.addCommand({
id: "local-index",
name: "Copy a Local Index to the clipboard",
callback: async () => await copyLocalIndex(this)
});
this.addCommand({
id: "global-index",
name: "Copy a Global Index to the clipboard",
callback: async () => await copyGlobalIndex(this)
});
["up", "down", "next", "prev"].forEach((dir) => {
this.addCommand({
id: `jump-to-first-${dir}`,
name: `Jump to first '${dir}'`,
callback: async () => await jumpToFirstDir(this, dir)
});
});
getFields(userHiers).forEach((field) => {
this.addCommand({
id: `new-file-with-curr-as-${field}`,
name: `Create a new '${field}' from the current note`,
callback: async () => await thread(this, field)
});
});
this.registerMarkdownCodeBlockProcessor(
"breadcrumbs",
getCodeblockCB(this)
);
const jugglPlugin = getPlugin(app);
if (jugglPlugin) {
this.bcStore = new BCStore(this.mainG, app.metadataCache);
jugglPlugin.registerStore(this.bcStore);
}
this.api = new BCAPI(this);
(window[API_NAME] = this.api) && this.register(() => delete window[API_NAME]);
}
getActiveTYPEView(type2) {
const { constructor } = this.VIEWS.find((view) => view.type === type2);
const leaves = app.workspace.getLeavesOfType(type2);
if (leaves && leaves.length >= 1) {
const { view } = leaves[0];
if (view instanceof constructor)
return view;
}
return null;
}
onunload() {
console.log("unloading");
this.VIEWS.forEach(async (view) => {
app.workspace.getLeavesOfType(view.type).forEach((leaf) => {
leaf.detach();
});
});
this.visited.forEach((visit) => visit[1].remove());
if (this.bcStore) {
const jugglPlugin = getPlugin(app);
if (jugglPlugin) {
jugglPlugin.removeStore(this.bcStore);
}
}
}
};
/*! Bundled license information:
feather-icons/dist/feather.js:
(*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*)
lodash/lodash.js:
(**
* @license
* Lodash
* Copyright OpenJS Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/