diff --git a/main.js b/main.js index 14476f1c..1f7645b1 100644 --- a/main.js +++ b/main.js @@ -20104,52 +20104,159 @@ async function openView(app, viewType, viewClass, side = "right") { return leaf.view; } -class Debugger { - constructor(plugin) { - this.debugLessThan = (level) => loglevel.levels[this.plugin.settings.debugMode] < level; - this.plugin = plugin; - } - start2G(group) { - if (this.debugLessThan(3)) - console.groupCollapsed(group); - } - end2G(...msgs) { - if (this.debugLessThan(3)) { - if (msgs.length) - loglevel.info(...msgs); - console.groupEnd(); - } - } - start1G(group) { - if (this.debugLessThan(2)) - console.groupCollapsed(group); - } - end1G(...msgs) { - if (this.debugLessThan(2)) { - if (msgs.length) - loglevel.debug(...msgs); - console.groupEnd(); - } - } - startGs(...groups) { - this.start2G(groups[0]); - if (groups[1]) - this.start1G(groups[1]); - } - /** - * End a debug and info group, logging `msgs` in `endDebugGroup` - * @param {1|2} count The number of groups to end. `1` ends Trace, 2 ends both - * @param {any[]} ...msgs - */ - endGs(count, ...msgs) { - if (count === 1) - this.end2G(...msgs); - else { - this.end1G(); - this.end2G(...msgs); - } - } -} +const MATRIX_VIEW = "BC-matrix"; +const STATS_VIEW = "BC-stats"; +const DUCK_VIEW = "BC-ducks"; +const DOWN_VIEW = "BC-down"; +const TRAIL_ICON = "BC-trail-icon"; +const TRAIL_ICON_SVG = ''; +const splitLinksRegex = new RegExp(/\[\[(.+?)\]\]/g); +const dropHeaderOrAlias = new RegExp(/\[\[([^#|]+)\]\]/); +const VISTYPES = [ + "Force Directed Graph", + "Tidy Tree", + "Circle Packing", + "Edge Bundling", + "Arc Diagram", + "Sunburst", + "Tree Map", + "Icicle", + "Radial Tree", +]; +const DIRECTIONS$1 = ["up", "same", "down", "next", "prev"]; +const ARROW_DIRECTIONS = { + up: "↑", + same: "↔", + down: "↓", + next: "→", + prev: "←", +}; +const RELATIONS = ["Parent", "Sibling", "Child"]; +const REAlCLOSED = ["Real", "Closed"]; +const ALLUNLINKED = ["All", "No Unlinked"]; +const blankUserHier = () => { + return { up: [], same: [], down: [], next: [], prev: [] }; +}; +const blankRealNImplied = () => { + return { + up: { reals: [], implieds: [] }, + down: { reals: [], implieds: [] }, + same: { reals: [], implieds: [] }, + next: { reals: [], implieds: [] }, + prev: { reals: [], implieds: [] }, + }; +}; +const [BC_FOLDER_NOTE, BC_TAG_NOTE, BC_TAG_NOTE_FIELD, BC_LINK_NOTE, BC_TRAVERSE_NOTE, BC_HIDE_TRAIL, BC_ORDER,] = [ + "BC-folder-note", + "BC-tag-note", + "BC-tag-note-field", + "BC-link-note", + "BC-traverse-note", + "BC-hide-trail", + "BC-order", +]; +const BC_FIELDS_INFO = [ + { + field: BC_FOLDER_NOTE, + desc: "Set this note as a Breadcrumbs folder-note. All other notes in this folder will be added to the graph with the field name specified in this key's value", + after: ": ", + alt: true, + }, + { + field: BC_TAG_NOTE, + desc: "Set this note as a Breadcrumbs tag-note. All other notes with this tag will be added to the graph in the direction you specify with `BC-tag-note-field: fieldName`", + after: ": '#", + alt: true, + }, + { + field: BC_TAG_NOTE_FIELD, + desc: "Manually choose the field for this tag-note to use", + after: ": ", + alt: false, + }, + { + field: BC_LINK_NOTE, + desc: "Set this note as a Breadcrumbs link-note. All links leaving this note will be added to the graph with the field name specified in this key's value.", + after: ": ", + alt: true, + }, + { + field: BC_TRAVERSE_NOTE, + desc: "Set this note as a Breadcrumbs traverse-note. Starting from this note, the Obsidian graph will be traversed in depth-first order, and all notes along the way will be added to the BC graph using the fieldName you specify", + after: ": ", + alt: true, + }, + { + field: BC_HIDE_TRAIL, + desc: "Don't show the trail in this note", + after: ": true", + alt: false, + }, + { + field: BC_ORDER, + desc: "Set the order of this note in the List/Matrix view. A lower value places this note higher in the order.", + after: ": ", + alt: false, + }, +]; +const BC_ALTS = BC_FIELDS_INFO.filter((f) => f.alt).map((f) => f.field); +const DEFAULT_SETTINGS = { + aliasesInIndex: false, + alphaSortAsc: true, + altLinkFields: [], + CSVPaths: "", + debugMode: "WARN", + defaultView: true, + dvWaitTime: 5000, + dotsColour: "#000000", + fieldSuggestor: true, + filterImpliedSiblingsOfDifferentTypes: false, + limitWriteBCCheckboxStates: {}, + indexNotes: [""], + hierarchyNotes: [""], + HNUpField: "", + refreshOnNoteChange: false, + useAllMetadata: true, + openMatrixOnLoad: true, + openStatsOnLoad: true, + openDuckOnLoad: false, + openDownOnLoad: true, + parseJugglLinksWithoutJuggl: false, + showNameOrType: true, + showRelationType: true, + rlLeaf: true, + showAllPathsIfNoneToIndexNote: false, + showBCs: true, + showBCsInEditLPMode: false, + showRefreshNotice: true, + showTrail: true, + showGrid: true, + showPrevNext: true, + limitTrailCheckboxStates: {}, + gridDots: false, + gridHeatmap: false, + heatmapColour: getComputedStyle(document.body).getPropertyValue("--text-accent"), + showAll: false, + noPathMessage: `This note has no real or implied parents`, + trailSeperator: "→", + respectReadableLineLength: true, + userHiers: [ + { + up: ["up"], + same: ["same"], + down: ["down"], + next: ["next"], + prev: ["prev"], + }, + ], + writeBCsInline: false, + showWriteAllBCsCmd: false, + visGraph: "Force Directed Graph", + visRelation: "Parent", + visClosed: "Real", + visAll: "All", + wikilinkIndex: true, +}; function noop() { } function assign(tar, src) { @@ -20553,824 +20660,1352 @@ class SvelteComponent { } } -/* src\Components\KoFi.svelte generated by Svelte v3.35.0 */ - -function create_fragment$h(ctx) { - let script; - let script_src_value; - let t; - let div; - let mounted; - let dispose; +class Debugger { + constructor(plugin) { + this.debugLessThan = (level) => loglevel.levels[this.plugin.settings.debugMode] < level; + this.plugin = plugin; + } + start2G(group) { + if (this.debugLessThan(3)) + console.groupCollapsed(group); + } + end2G(...msgs) { + if (this.debugLessThan(3)) { + if (msgs.length) + loglevel.info(...msgs); + console.groupEnd(); + } + } + start1G(group) { + if (this.debugLessThan(2)) + console.groupCollapsed(group); + } + end1G(...msgs) { + if (this.debugLessThan(2)) { + if (msgs.length) + loglevel.debug(...msgs); + console.groupEnd(); + } + } + startGs(...groups) { + this.start2G(groups[0]); + if (groups[1]) + this.start1G(groups[1]); + } + /** + * End a debug and info group, logging `msgs` in `endDebugGroup` + * @param {1|2} count The number of groups to end. `1` ends Trace, 2 ends both + * @param {any[]} ...msgs + */ + endGs(count, ...msgs) { + if (count === 1) + this.end2G(...msgs); + else { + this.end1G(); + this.end2G(...msgs); + } + } +} - return { - c() { - script = element("script"); - t = space(); - div = element("div"); - attr(script, "type", "text/javascript"); - if (script.src !== (script_src_value = "https://ko-fi.com/widgets/widget_2.js")) attr(script, "src", script_src_value); +// TODO - this is a hack to get the graph to work with the approvals +// I shouldn't need +const DIRECTIONS = ["up", "same", "down", "next", "prev"]; +// This function takes the real & implied graphs for a given relation, and returns a new graphs with both. +// It makes implied relations real +// TODO use reflexiveClosure instead +function closeImpliedLinks(real, implied) { + const closedG = real.copy(); + implied.forEachEdge((key, a, s, t) => { + closedG.mergeEdge(t, s, a); + }); + return closedG; +} +function removeUnlinkedNodes(g) { + const copy = g.copy(); + copy.forEachNode((node) => { + if (!copy.degree(node)) + copy.dropNode(node); + }); + return copy; +} +/** + * Return a subgraph of all nodes & edges with `dirs.includes(a.dir)` + * @param {MultiGraph} main + * @param {Directions} dir + */ +function getSubInDirs(main, ...dirs) { + const sub = new graphology_umd_min.MultiGraph(); + main.forEachEdge((k, a, s, t) => { + if (dirs.includes(a.dir)) { + //@ts-ignore + addNodesIfNot(sub, [s, t], a); + sub.addEdge(s, t, a); + } + }); + return sub; +} +/** + * Return a subgraph of all nodes & edges with `files.includes(a.field)` + * @param {MultiGraph} main + * @param {string[]} fields + */ +function getSubForFields(main, fields) { + const sub = new graphology_umd_min.MultiGraph(); + main.forEachEdge((k, a, s, t) => { + if (fields.includes(a.field)) { + //@ts-ignore + addNodesIfNot(sub, [s, t], a); + sub.addEdge(s, t, a); + } + }); + return sub; +} +/** + * For every edge in `g`, add the reverse of the edge to a copy of `g`. + * + * It also sets the attrs of the reverse edges to `oppDir` and `oppFields[0]` + * @param {MultiGraph} g + * @param {UserHier[]} userHiers + * @param {boolean} closeAsOpposite + */ +function getReflexiveClosure(g, userHiers, closeAsOpposite = true) { + const copy = g.copy(); + copy.forEachEdge((k, a, s, t) => { + const { dir, field } = a; + if (field === undefined) + return; + const oppDir = getOppDir(dir); + const oppField = getOppFields(userHiers, field)[0]; + addNodesIfNot(copy, [s, t], { + //@ts-ignore + dir: closeAsOpposite ? oppDir : dir, + field: closeAsOpposite ? oppField : field, + }); + addEdgeIfNot(copy, t, s, { + //@ts-ignore + dir: closeAsOpposite ? oppDir : dir, + field: closeAsOpposite ? oppField : field, + }); + }); + return copy; +} +function addNodesIfNot(g, nodes, attr) { + nodes.forEach((node) => { + if (!g.hasNode(node)) + g.addNode(node, attr); + }); +} +function addEdgeIfNot(g, source, target, attr) { + if (!g.hasEdge(source, target)) + g.addEdge(source, target, attr); +} +const getSinks = (g) => g.filterNodes((node) => g.hasNode(node) && !g.outDegree(node)); +const getOutNeighbours = (g, node) => g.hasNode(node) ? g.outNeighbors(node) : []; +const getInNeighbours = (g, node) => g.hasNode(node) ? g.inNeighbors(node) : []; +const getOppDir = (dir) => { + switch (dir) { + case "up": + return "down"; + case "down": + return "up"; + case "same": + return "same"; + case "next": + return "prev"; + case "prev": + return "next"; + } +}; +/** + * Get the hierarchy and direction that `field` is in + * */ +function getFieldInfo(userHiers, field) { + let fieldDir; + let fieldHier; + DIRECTIONS.forEach((dir) => { + userHiers.forEach((hier) => { + if (hier[dir].includes(field)) { + fieldDir = dir; + fieldHier = hier; + return; + } + }); + }); + return { fieldHier, fieldDir }; +} +function getOppFields(userHiers, field) { + const { fieldHier, fieldDir } = getFieldInfo(userHiers, field); + const oppDir = getOppDir(fieldDir); + return fieldHier[oppDir]; +} +function dfsAllPaths(g, startNode) { + const queue = [ + { node: startNode, path: [] }, + ]; + const visited = []; + const allPaths = []; + let i = 0; + while (queue.length > 0 && i < 1000) { + i++; + const { node, path } = queue.shift(); + const extPath = [node, ...path]; + const succsNotVisited = g.hasNode(node) + ? g.filterOutNeighbors(node, (n, a) => !visited.includes(n)) + : []; + const newItems = succsNotVisited.map((n) => { + return { node: n, path: extPath }; + }); + visited.push(...succsNotVisited); + queue.unshift(...newItems); + if (!g.hasNode(node) || !g.outDegree(node)) + allPaths.push(extPath); + } + return allPaths; +} + +function normalise(arr) { + const max = Math.max(...arr); + return arr.map((item) => item / max); +} +/** + * Get basename from a **Markdown** `path` + * @param {string} path + */ +const getBaseFromMDPath = (path) => { + const splitSlash = path.split("/").last(); + if (splitSlash.endsWith(".md")) { + return splitSlash.split(".md").slice(0, -1).join("."); + } + else + return splitSlash; +}; +const getDVBasename = (file) => file.basename || file.name; +const getFolder = (file) => { var _a; +//@ts-ignore +return ((_a = file === null || file === void 0 ? void 0 : file.parent) === null || _a === void 0 ? void 0 : _a.name) || file.folder; }; +const splitAndTrim = (fields) => { + if (fields === "") + return []; + else + return fields.split(",").map((str) => str.trim()); +}; +function padArray(arr, finalLength, filler = "") { + const copy = [...arr]; + const currLength = copy.length; + if (currLength > finalLength) { + throw new Error("Current length is greater than final length"); + } + else if (currLength === finalLength) { + return copy; + } + else { + for (let i = currLength; i < finalLength; i++) { + copy.push(filler); + } + return copy; + } +} +function transpose(A) { + const cols = A[0].length; + const AT = []; + // For each column + for (let j = 0; j < cols; j++) { + // Add a new row to AT + AT.push([]); + // And fill it with the values in the jth column of A + A.forEach((row) => AT[j].push(row[j])); + } + return AT; +} +function runs(arr) { + const runs = []; + let i = 0; + while (i < arr.length) { + const currValue = arr[i]; + runs.push({ value: currValue, first: i, last: undefined }); + while (currValue === arr[i]) { + i++; + } + runs.last().last = i - 1; + } + return runs; +} +function makeWiki(str, wikiQ = true) { + let copy = str.slice(); + if (wikiQ) { + copy = "[[" + copy; + copy += "]]"; + } + return copy; +} +function dropWikilinks(str) { + let copy = str.slice(); + if (copy.startsWith("[[") && copy.endsWith("]]")) + copy = copy.slice(2, -2); + return copy; +} +/** + * Get all the fields in `dir`. + * Returns all fields if `dir === 'all'` + * @param {UserHier[]} userHiers + * @param {Directions|"all"} dir + */ +function getFields(userHiers, dir = "all") { + const fields = []; + userHiers.forEach((hier) => { + if (dir === "all") { + DIRECTIONS$1.forEach((eachDir) => { + fields.push(...hier[eachDir]); + }); + } + else { + fields.push(...hier[dir]); + } + }); + return fields; +} +const hierToStr = (hier) => DIRECTIONS$1.map((dir) => `${ARROW_DIRECTIONS[dir]}: ${hier[dir].join(", ")}`).join("\n"); +/** + * Adds or updates the given yaml `key` to `value` in the given TFile + * @param {string} key + * @param {string} value + * @param {TFile} file + * @param {FrontMatterCache|undefined} frontmatter + * @param {MetaeditApi} api + */ +const createOrUpdateYaml = async (key, value, file, frontmatter, api) => { + const valueStr = value.toString(); + if (!frontmatter || frontmatter[key] === undefined) { + console.log(`Creating: ${key}: ${valueStr}`); + await api.createYamlProperty(key, `['${valueStr}']`, file); + } + else if ([...[frontmatter[key]]].flat(3).some((val) => val == valueStr)) { + console.log("Already Exists!"); + return; + } + else { + const oldValueFlat = [...[frontmatter[key]]].flat(4); + const newValue = [...oldValueFlat, `'${valueStr}'`]; + console.log(`Updating: ${key}: ${newValue}`); + await api.update(key, `[${newValue.join(", ")}]`, file); + } +}; +function splitAtYaml(content) { + const startsWithYaml = content.startsWith("---"); + if (!startsWithYaml) + return ["", content]; + else { + const splits = content.split("---"); + return [ + splits.slice(0, 2).join("---") + "---", + splits.slice(2).join("---"), + ]; + } +} +function swapItems(i, j, arr) { + const max = arr.length - 1; + if (i < 0 || i > max || j < 0 || j > max) + return arr; + const tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + return arr; +} +const linkClass = (app, to, realQ = true) => `internal-link BC-Link ${isInVault(app, to) ? "" : "is-unresolved"} ${realQ ? "" : "BC-Implied"}`; +/** Remember to filter by hierarchy in MatrixView! */ +function getRealnImplied(plugin, currNode, dir = null) { + const realsnImplieds = blankRealNImplied(); + const { userHiers } = plugin.settings; + plugin.mainG.forEachEdge(currNode, (k, a, s, t) => { + const { field, dir: edgeDir } = a; + const oppField = getOppFields(userHiers, field)[0]; + (dir ? [dir, getOppDir(dir)] : DIRECTIONS$1).forEach((currDir) => { + const oppDir = getOppDir(currDir); + // Reals + if (s === currNode && (edgeDir === currDir || edgeDir === oppDir)) { + const arr = realsnImplieds[edgeDir].reals; + if (arr.findIndex((item) => item.to === t) === -1) { + arr.push({ to: t, real: true, field }); + } + } + // Implieds + // If `s !== currNode` then `t` must be + else if (edgeDir === currDir || edgeDir === oppDir) { + const arr = realsnImplieds[getOppDir(edgeDir)].implieds; + if (arr.findIndex((item) => item.to === s) === -1) { + arr.push({ + to: s, + real: false, + field: oppField, + }); + } + } + }); + }); + return realsnImplieds; +} +function iterateHiers(userHiers, fn) { + userHiers.forEach((hier) => { + DIRECTIONS$1.forEach((dir) => { + hier[dir].forEach((field) => { + fn(hier, dir, field); + }); + }); + }); +} + +/* src\Components\Stats.svelte generated by Svelte v3.35.0 */ + +function add_css$9() { + var style = element("style"); + style.id = "svelte-rb5mhu-style"; + style.textContent = "table.svelte-rb5mhu{border-collapse:collapse}td.svelte-rb5mhu:first-child{text-align:right}td.svelte-rb5mhu,th.svelte-rb5mhu{padding:3px;border:1px solid var(--background-modifier-border);white-space:pre-line}"; + append(document.head, style); +} + +function get_each_context$9(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_1$7(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_2$3(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_3$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[35] = list[i]; + child_ctx[37] = i; + return child_ctx; +} + +function get_each_context_4(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_5(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_6(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +function get_each_context_7(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[28] = list[i]; + return child_ctx; +} + +// (94:4) {#each DIRECTIONS as dir} +function create_each_block_7(ctx) { + let td; + let t_value = ARROW_DIRECTIONS[/*dir*/ ctx[28]] + ""; + let t; + + return { + c() { + td = element("td"); + t = text(t_value); + attr(td, "class", "svelte-rb5mhu"); + }, + m(target, anchor) { + insert(target, td, anchor); + append(td, t); + }, + p: noop, + d(detaching) { + if (detaching) detach(td); + } + }; +} + +// (106:6) {#each DIRECTIONS as dir} +function create_each_block_6(ctx) { + let td; + let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.nodes.length + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; + + function click_handler_1() { + return /*click_handler_1*/ ctx[6](/*i*/ ctx[37], /*dir*/ ctx[28]); + } + + return { + c() { + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.nodesStr); + attr(td, "class", "svelte-rb5mhu"); + }, + m(target, anchor) { + insert(target, td, anchor); + append(td, t0); + append(td, t1); + + if (!mounted) { + dispose = listen(td, "click", click_handler_1); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + }, + d(detaching) { + if (detaching) detach(td); + mounted = false; + dispose(); + } + }; +} + +// (127:6) {#each DIRECTIONS as dir} +function create_each_block_5(ctx) { + let td; + let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.edges.length + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; + + function click_handler_3() { + return /*click_handler_3*/ ctx[9](/*i*/ ctx[37], /*dir*/ ctx[28]); + } + + return { + c() { + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.edgesStr); + attr(td, "class", "svelte-rb5mhu"); }, m(target, anchor) { - append(document.head, script); - insert(target, t, anchor); - insert(target, div, anchor); - /*div_binding*/ ctx[2](div); + insert(target, td, anchor); + append(td, t0); + append(td, t1); if (!mounted) { - dispose = listen(script, "load", /*initializeKofi*/ ctx[1]); + dispose = listen(td, "click", click_handler_3); mounted = true; } }, - p: noop, - i: noop, - o: noop, + p(new_ctx, dirty) { + ctx = new_ctx; + }, d(detaching) { - detach(script); - if (detaching) detach(t); - if (detaching) detach(div); - /*div_binding*/ ctx[2](null); + if (detaching) detach(td); mounted = false; dispose(); } }; } -function instance$h($$self, $$props, $$invalidate) { - let button; - - var 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]; -} +// (148:6) {#each DIRECTIONS as dir} +function create_each_block_4(ctx) { + let td; + let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Implied.edges.length + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; -class KoFi extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$h, create_fragment$h, safe_not_equal, {}); + function click_handler_5() { + return /*click_handler_5*/ ctx[12](/*i*/ ctx[37], /*dir*/ ctx[28]); } -} - -/* node_modules\svelte-icons\components\IconBase.svelte generated by Svelte v3.35.0 */ - -function add_css$9() { - var style = element("style"); - style.id = "svelte-c8tyih-style"; - style.textContent = "svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}"; - append(document.head, style); -} - -// (18:2) {#if title} -function create_if_block$5(ctx) { - let title_1; - let t; return { c() { - title_1 = svg_element("title"); - t = text(/*title*/ ctx[0]); + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Implied.edgesStr); + attr(td, "class", "svelte-rb5mhu"); }, m(target, anchor) { - insert(target, title_1, anchor); - append(title_1, t); + insert(target, td, anchor); + append(td, t0); + append(td, t1); + + if (!mounted) { + dispose = listen(td, "click", click_handler_5); + mounted = true; + } }, - p(ctx, dirty) { - if (dirty & /*title*/ 1) set_data(t, /*title*/ ctx[0]); + p(new_ctx, dirty) { + ctx = new_ctx; }, d(detaching) { - if (detaching) detach(title_1); + if (detaching) detach(td); + mounted = false; + dispose(); } }; } -function create_fragment$g(ctx) { - let svg; - let if_block_anchor; - let current; - let if_block = /*title*/ ctx[0] && create_if_block$5(ctx); - const default_slot_template = /*#slots*/ ctx[3].default; - const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], null); +// (100:2) {#each userHiers as hier, i} +function create_each_block_3$2(ctx) { + let tr0; + let td0; + let t0_value = /*hierStrs*/ ctx[4][/*i*/ ctx[37]] + ""; + let t0; + let t1; + let td1; + let t3; + let t4; + let td2; + let t5_value = lodash.sum(DIRECTIONS$1.map(func)) + ""; + let t5; + let td2_aria_label_value; + let t6; + let tr1; + let td3; + let t8; + let t9; + let td4; + let t10_value = lodash.sum(DIRECTIONS$1.map(func_1)) + ""; + let t10; + let td4_aria_label_value; + let t11; + let tr2; + let td5; + let t13; + let t14; + let td6; + let t15_value = lodash.sum(DIRECTIONS$1.map(func_2)) + ""; + let t15; + let td6_aria_label_value; + let mounted; + let dispose; + let each_value_6 = DIRECTIONS$1; + let each_blocks_2 = []; + + for (let i = 0; i < each_value_6.length; i += 1) { + each_blocks_2[i] = create_each_block_6(get_each_context_6(ctx, each_value_6, i)); + } + + function func(...args) { + return /*func*/ ctx[7](/*i*/ ctx[37], ...args); + } + + function click_handler_2() { + return /*click_handler_2*/ ctx[8](/*i*/ ctx[37]); + } + + let each_value_5 = DIRECTIONS$1; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_5.length; i += 1) { + each_blocks_1[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i)); + } + + function func_1(...args) { + return /*func_1*/ ctx[10](/*i*/ ctx[37], ...args); + } + + function click_handler_4() { + return /*click_handler_4*/ ctx[11](/*i*/ ctx[37]); + } + + let each_value_4 = DIRECTIONS$1; + let each_blocks = []; + + for (let i = 0; i < each_value_4.length; i += 1) { + each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i)); + } + + function func_2(...args) { + return /*func_2*/ ctx[13](/*i*/ ctx[37], ...args); + } + + function click_handler_6() { + return /*click_handler_6*/ ctx[14](/*i*/ ctx[37]); + } 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); + tr0 = element("tr"); + td0 = element("td"); + t0 = text(t0_value); + t1 = space(); + td1 = element("td"); + td1.textContent = "Nodes"; + t3 = space(); - if (default_slot) { - default_slot.m(svg, null); + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].c(); } - current = true; - }, - p(ctx, [dirty]) { - if (/*title*/ ctx[0]) { - if (if_block) { - if_block.p(ctx, dirty); - } else { - if_block = create_if_block$5(ctx); - if_block.c(); - if_block.m(svg, if_block_anchor); - } - } else if (if_block) { - if_block.d(1); - if_block = null; + t4 = space(); + td2 = element("td"); + t5 = text(t5_value); + t6 = space(); + tr1 = element("tr"); + td3 = element("td"); + td3.textContent = "Real Edges"; + t8 = space(); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + t9 = space(); + td4 = element("td"); + t10 = text(t10_value); + t11 = space(); + tr2 = element("tr"); + td5 = element("td"); + td5.textContent = "Implied Edges"; + t13 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); } - if (default_slot) { - if (default_slot.p && dirty & /*$$scope*/ 4) { - update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[2], dirty, null, null); - } + t14 = space(); + td6 = element("td"); + t15 = text(t15_value); + attr(td0, "rowspan", "3"); + attr(td0, "class", "svelte-rb5mhu"); + attr(td1, "class", "svelte-rb5mhu"); + attr(td2, "aria-label-position", "left"); + attr(td2, "aria-label", td2_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Merged", "nodesStr")); + attr(td2, "class", "svelte-rb5mhu"); + attr(td3, "class", "svelte-rb5mhu"); + attr(td4, "aria-label-position", "left"); + attr(td4, "aria-label", td4_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Merged", "edgesStr")); + attr(td4, "class", "svelte-rb5mhu"); + attr(td5, "class", "svelte-rb5mhu"); + attr(td6, "aria-label-position", "left"); + attr(td6, "aria-label", td6_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Implied", "edgesStr")); + attr(td6, "class", "svelte-rb5mhu"); + }, + m(target, anchor) { + insert(target, tr0, anchor); + append(tr0, td0); + append(td0, t0); + append(tr0, t1); + append(tr0, td1); + append(tr0, t3); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].m(tr0, null); } - if (!current || dirty & /*viewBox*/ 2) { - attr(svg, "viewBox", /*viewBox*/ ctx[1]); + append(tr0, t4); + append(tr0, td2); + append(td2, t5); + insert(target, t6, anchor); + insert(target, tr1, anchor); + append(tr1, td3); + append(tr1, t8); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(tr1, null); } - }, - 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 instance$g($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - let { title = null } = $$props; - let { viewBox } = $$props; + append(tr1, t9); + append(tr1, td4); + append(td4, t10); + insert(target, t11, anchor); + insert(target, tr2, anchor); + append(tr2, td5); + append(tr2, t13); - $$self.$$set = $$props => { - if ("title" in $$props) $$invalidate(0, title = $$props.title); - if ("viewBox" in $$props) $$invalidate(1, viewBox = $$props.viewBox); - if ("$$scope" in $$props) $$invalidate(2, $$scope = $$props.$$scope); - }; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tr2, null); + } - return [title, viewBox, $$scope, slots]; -} + append(tr2, t14); + append(tr2, td6); + append(td6, t15); -class IconBase extends SvelteComponent { - constructor(options) { - super(); - if (!document.getElementById("svelte-c8tyih-style")) add_css$9(); - init(this, options, instance$g, create_fragment$g, safe_not_equal, { title: 0, viewBox: 1 }); - } -} + if (!mounted) { + dispose = [ + listen(td2, "click", click_handler_2), + listen(td4, "click", click_handler_4), + listen(td6, "click", click_handler_6) + ]; -/* node_modules\svelte-icons\fa\FaFire.svelte generated by Svelte v3.35.0 */ + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; -function create_default_slot$5(ctx) { - let path; + if (dirty[0] & /*data*/ 4) { + each_value_6 = DIRECTIONS$1; + let i; - return { - c() { - path = svg_element("path"); - attr(path, "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, path, anchor); - }, - d(detaching) { - if (detaching) detach(path); - } - }; -} + for (i = 0; i < each_value_6.length; i += 1) { + const child_ctx = get_each_context_6(ctx, each_value_6, i); -function create_fragment$f(ctx) { - let iconbase; - let current; - const iconbase_spread_levels = [{ viewBox: "0 0 384 512" }, /*$$props*/ ctx[0]]; + if (each_blocks_2[i]) { + each_blocks_2[i].p(child_ctx, dirty); + } else { + each_blocks_2[i] = create_each_block_6(child_ctx); + each_blocks_2[i].c(); + each_blocks_2[i].m(tr0, t4); + } + } - let iconbase_props = { - $$slots: { default: [create_default_slot$5] }, - $$scope: { ctx } - }; + for (; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].d(1); + } - for (let i = 0; i < iconbase_spread_levels.length; i += 1) { - iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); - } + each_blocks_2.length = each_value_6.length; + } - iconbase = new IconBase({ props: iconbase_props }); + if (dirty[0] & /*data*/ 4) { + each_value_5 = DIRECTIONS$1; + let i; - return { - c() { - create_component(iconbase.$$.fragment); - }, - m(target, anchor) { - mount_component(iconbase, target, anchor); - current = true; - }, - p(ctx, [dirty]) { - const iconbase_changes = (dirty & /*$$props*/ 1) - ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) - : {}; + for (i = 0; i < each_value_5.length; i += 1) { + const child_ctx = get_each_context_5(ctx, each_value_5, i); - if (dirty & /*$$scope*/ 2) { - iconbase_changes.$$scope = { dirty, ctx }; - } + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_5(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(tr1, t9); + } + } - 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); - } - }; -} + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } -function instance$f($$self, $$props, $$invalidate) { - $$self.$$set = $$new_props => { - $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); - }; + each_blocks_1.length = each_value_5.length; + } - $$props = exclude_internal_props($$props); - return [$$props]; -} + if (dirty[0] & /*data*/ 4) { + each_value_4 = DIRECTIONS$1; + let i; -class FaFire extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$f, create_fragment$f, safe_not_equal, {}); - } -} + for (i = 0; i < each_value_4.length; i += 1) { + const child_ctx = get_each_context_4(ctx, each_value_4, i); -/* node_modules\svelte-icons\fa\FaRegSnowflake.svelte generated by Svelte v3.35.0 */ + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_4(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(tr2, t14); + } + } -function create_default_slot$4(ctx) { - let path; + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } - return { - c() { - path = svg_element("path"); - attr(path, "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, path, anchor); + each_blocks.length = each_value_4.length; + } }, d(detaching) { - if (detaching) detach(path); + if (detaching) detach(tr0); + destroy_each(each_blocks_2, detaching); + if (detaching) detach(t6); + if (detaching) detach(tr1); + destroy_each(each_blocks_1, detaching); + if (detaching) detach(t11); + if (detaching) detach(tr2); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); } }; } -function create_fragment$e(ctx) { - let iconbase; - let current; - const iconbase_spread_levels = [{ viewBox: "0 0 448 512" }, /*$$props*/ ctx[0]]; +// (171:4) {#each DIRECTIONS as dir} +function create_each_block_2$3(ctx) { + let td; + let t0_value = lodash.sum(/*data*/ ctx[2].map(func_3)) + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; - let iconbase_props = { - $$slots: { default: [create_default_slot$4] }, - $$scope: { ctx } - }; + function func_3(...args) { + return /*func_3*/ ctx[15](/*dir*/ ctx[28], ...args); + } - for (let i = 0; i < iconbase_spread_levels.length; i += 1) { - iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); + function func_4(...args) { + return /*func_4*/ ctx[16](/*dir*/ ctx[28], ...args); } - iconbase = new IconBase({ props: iconbase_props }); + function click_handler_7() { + return /*click_handler_7*/ ctx[17](/*dir*/ ctx[28]); + } return { c() { - create_component(iconbase.$$.fragment); + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_4).join("\n")); + attr(td, "class", "svelte-rb5mhu"); }, m(target, anchor) { - mount_component(iconbase, target, anchor); - current = true; - }, - p(ctx, [dirty]) { - const iconbase_changes = (dirty & /*$$props*/ 1) - ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) - : {}; + insert(target, td, anchor); + append(td, t0); + append(td, t1); - if (dirty & /*$$scope*/ 2) { - iconbase_changes.$$scope = { dirty, ctx }; + if (!mounted) { + dispose = listen(td, "click", click_handler_7); + mounted = true; } - - 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; + p(new_ctx, dirty) { + ctx = new_ctx; }, d(detaching) { - destroy_component(iconbase, detaching); + if (detaching) detach(td); + mounted = false; + dispose(); } }; } -function instance$e($$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]; -} +// (213:4) {#each DIRECTIONS as dir} +function create_each_block_1$7(ctx) { + let td; + let t0_value = lodash.sum(/*data*/ ctx[2].map(func_5)) + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; -class FaRegSnowflake extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$e, create_fragment$e, safe_not_equal, {}); + function func_5(...args) { + return /*func_5*/ ctx[18](/*dir*/ ctx[28], ...args); } -} - -// TODO - this is a hack to get the graph to work with the approvals -// I shouldn't need -const DIRECTIONS$1 = ["up", "same", "down", "next", "prev"]; -// This function takes the real & implied graphs for a given relation, and returns a new graphs with both. -// It makes implied relations real -// TODO use reflexiveClosure instead -function closeImpliedLinks(real, implied) { - const closedG = real.copy(); - implied.forEachEdge((key, a, s, t) => { - closedG.mergeEdge(t, s, a); - }); - return closedG; -} -function removeUnlinkedNodes(g) { - const copy = g.copy(); - copy.forEachNode((node) => { - if (!copy.degree(node)) - copy.dropNode(node); - }); - return copy; -} -/** - * Return a subgraph of all nodes & edges with `dirs.includes(a.dir)` - * @param {MultiGraph} main - * @param {Directions} dir - */ -function getSubInDirs(main, ...dirs) { - const sub = new graphology_umd_min.MultiGraph(); - main.forEachEdge((k, a, s, t) => { - if (dirs.includes(a.dir)) { - //@ts-ignore - addNodesIfNot(sub, [s, t], a); - sub.addEdge(s, t, a); - } - }); - return sub; -} -/** - * Return a subgraph of all nodes & edges with `files.includes(a.field)` - * @param {MultiGraph} main - * @param {string[]} fields - */ -function getSubForFields(main, fields) { - const sub = new graphology_umd_min.MultiGraph(); - main.forEachEdge((k, a, s, t) => { - if (fields.includes(a.field)) { - //@ts-ignore - addNodesIfNot(sub, [s, t], a); - sub.addEdge(s, t, a); - } - }); - return sub; -} -/** - * For every edge in `g`, add the reverse of the edge to a copy of `g`. - * - * It also sets the attrs of the reverse edges to `oppDir` and `oppFields[0]` - * @param {MultiGraph} g - * @param {UserHier[]} userHiers - * @param {boolean} closeAsOpposite - */ -function getReflexiveClosure(g, userHiers, closeAsOpposite = true) { - const copy = g.copy(); - copy.forEachEdge((k, a, s, t) => { - const { dir, field } = a; - if (field === undefined) - return; - const oppDir = getOppDir(dir); - const oppField = getOppFields(userHiers, field)[0]; - addNodesIfNot(copy, [s, t], { - //@ts-ignore - dir: closeAsOpposite ? oppDir : dir, - field: closeAsOpposite ? oppField : field, - }); - addEdgeIfNot(copy, t, s, { - //@ts-ignore - dir: closeAsOpposite ? oppDir : dir, - field: closeAsOpposite ? oppField : field, - }); - }); - return copy; -} -function addNodesIfNot(g, nodes, attr) { - nodes.forEach((node) => { - if (!g.hasNode(node)) - g.addNode(node, attr); - }); -} -function addEdgeIfNot(g, source, target, attr) { - if (!g.hasEdge(source, target)) - g.addEdge(source, target, attr); -} -const getSinks = (g) => g.filterNodes((node) => g.hasNode(node) && !g.outDegree(node)); -const getOutNeighbours = (g, node) => g.hasNode(node) ? g.outNeighbors(node) : []; -const getInNeighbours = (g, node) => g.hasNode(node) ? g.inNeighbors(node) : []; -const getOppDir = (dir) => { - switch (dir) { - case "up": - return "down"; - case "down": - return "up"; - case "same": - return "same"; - case "next": - return "prev"; - case "prev": - return "next"; - } -}; -/** - * Get the hierarchy and direction that `field` is in - * */ -function getFieldInfo(userHiers, field) { - let fieldDir; - let fieldHier; - DIRECTIONS$1.forEach((dir) => { - userHiers.forEach((hier) => { - if (hier[dir].includes(field)) { - fieldDir = dir; - fieldHier = hier; - return; - } - }); - }); - return { fieldHier, fieldDir }; -} -function getOppFields(userHiers, field) { - const { fieldHier, fieldDir } = getFieldInfo(userHiers, field); - const oppDir = getOppDir(fieldDir); - return fieldHier[oppDir]; -} -function dfsAllPaths(g, startNode) { - const queue = [ - { node: startNode, path: [] }, - ]; - const visited = []; - const allPaths = []; - let i = 0; - while (queue.length > 0 && i < 1000) { - i++; - const { node, path } = queue.shift(); - const extPath = [node, ...path]; - const succsNotVisited = g.hasNode(node) - ? g.filterOutNeighbors(node, (n, a) => !visited.includes(n)) - : []; - const newItems = succsNotVisited.map((n) => { - return { node: n, path: extPath }; - }); - visited.push(...succsNotVisited); - queue.unshift(...newItems); - if (!g.hasNode(node) || !g.outDegree(node)) - allPaths.push(extPath); - } - return allPaths; -} - -/* src\Components\Down.svelte generated by Svelte v3.35.0 */ - -function add_css$8() { - var style = element("style"); - style.id = "svelte-n6zmin-style"; - style.textContent = ".BC-downs.svelte-n6zmin.svelte-n6zmin{padding-left:5px}.BC-downs.svelte-n6zmin>div.svelte-n6zmin{white-space:nowrap}pre.svelte-n6zmin.svelte-n6zmin{display:inline}.is-unresolved.svelte-n6zmin.svelte-n6zmin{color:var(--text-muted)}"; - append(document.head, style); -} -function get_each_context$9(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[11] = list[i]; - return child_ctx; -} + function func_6(...args) { + return /*func_6*/ ctx[19](/*dir*/ ctx[28], ...args); + } -// (47:4) {:else} -function create_else_block$1(ctx) { - let fafire; - let current; - fafire = new FaFire({}); + function click_handler_8() { + return /*click_handler_8*/ ctx[20](/*dir*/ ctx[28]); + } return { c() { - create_component(fafire.$$.fragment); + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_6).join("\n")); + attr(td, "class", "svelte-rb5mhu"); }, m(target, anchor) { - mount_component(fafire, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(fafire.$$.fragment, local); - current = true; + insert(target, td, anchor); + append(td, t0); + append(td, t1); + + if (!mounted) { + dispose = listen(td, "click", click_handler_8); + mounted = true; + } }, - o(local) { - transition_out(fafire.$$.fragment, local); - current = false; + p(new_ctx, dirty) { + ctx = new_ctx; }, d(detaching) { - destroy_component(fafire, detaching); + if (detaching) detach(td); + mounted = false; + dispose(); } }; } -// (45:4) {#if frozen} -function create_if_block_1$3(ctx) { - let faregsnowflake; - let current; - faregsnowflake = new FaRegSnowflake({}); +// (251:4) {#each DIRECTIONS as dir} +function create_each_block$9(ctx) { + let td; + let t0_value = lodash.sum(/*data*/ ctx[2].map(func_7)) + ""; + let t0; + let t1; + let td_aria_label_value; + let mounted; + let dispose; + + function func_7(...args) { + return /*func_7*/ ctx[21](/*dir*/ ctx[28], ...args); + } + + function func_8(...args) { + return /*func_8*/ ctx[22](/*dir*/ ctx[28], ...args); + } + + function click_handler_9() { + return /*click_handler_9*/ ctx[23](/*dir*/ ctx[28]); + } return { c() { - create_component(faregsnowflake.$$.fragment); + td = element("td"); + t0 = text(t0_value); + t1 = space(); + attr(td, "aria-label-position", "left"); + attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_8).join("\n")); + attr(td, "class", "svelte-rb5mhu"); }, m(target, anchor) { - mount_component(faregsnowflake, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(faregsnowflake.$$.fragment, local); - current = true; + insert(target, td, anchor); + append(td, t0); + append(td, t1); + + if (!mounted) { + dispose = listen(td, "click", click_handler_9); + mounted = true; + } }, - o(local) { - transition_out(faregsnowflake.$$.fragment, local); - current = false; + p(new_ctx, dirty) { + ctx = new_ctx; }, d(detaching) { - destroy_component(faregsnowflake, detaching); + if (detaching) detach(td); + mounted = false; + dispose(); } }; } -// (64:4) {#if line.length > 1} -function create_if_block$4(ctx) { - let div; - let pre; - let t0_value = /*line*/ ctx[11][0] + "-" + ""; - let t0; +function create_fragment$h(ctx) { + let table; + let thead; + let tr0; + let th0; let t1; - let span; - let a; - let t2_value = /*line*/ ctx[11][1] + ""; + let th1; let t2; - let a_class_value; let t3; + let tr1; + let td0; + let button; + let t5; + let td1; + let t7; + let t8; + let td2; + let t10; + let t11; + let tr2; + let td3; + let t13; + let td4; + let t15; + let t16; + let tr3; + let td5; + let t18; + let t19; + let tr4; + let td6; + let t21; let mounted; let dispose; + let each_value_7 = DIRECTIONS$1; + let each_blocks_4 = []; - function click_handler_2(...args) { - return /*click_handler_2*/ ctx[7](/*line*/ ctx[11], ...args); + for (let i = 0; i < each_value_7.length; i += 1) { + each_blocks_4[i] = create_each_block_7(get_each_context_7(ctx, each_value_7, i)); } - function mouseover_handler(...args) { - return /*mouseover_handler*/ ctx[8](/*line*/ ctx[11], ...args); + let each_value_3 = /*userHiers*/ ctx[1]; + let each_blocks_3 = []; + + for (let i = 0; i < each_value_3.length; i += 1) { + each_blocks_3[i] = create_each_block_3$2(get_each_context_3$2(ctx, each_value_3, i)); + } + + let each_value_2 = DIRECTIONS$1; + let each_blocks_2 = []; + + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks_2[i] = create_each_block_2$3(get_each_context_2$3(ctx, each_value_2, i)); + } + + let each_value_1 = DIRECTIONS$1; + let each_blocks_1 = []; + + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks_1[i] = create_each_block_1$7(get_each_context_1$7(ctx, each_value_1, i)); + } + + let each_value = DIRECTIONS$1; + let each_blocks = []; + + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$9(get_each_context$9(ctx, each_value, i)); } - return { - c() { - div = element("div"); - pre = element("pre"); - t0 = text(t0_value); - t1 = space(); - span = element("span"); - a = element("a"); - t2 = text(t2_value); - t3 = space(); - attr(pre, "class", "svelte-n6zmin"); + return { + c() { + table = element("table"); + thead = element("thead"); + tr0 = element("tr"); + th0 = element("th"); + th0.textContent = "Hierarchy"; + t1 = space(); + th1 = element("th"); + t2 = text("Count"); + t3 = space(); + tr1 = element("tr"); + td0 = element("td"); + button = element("button"); + button.textContent = "↻"; + t5 = space(); + td1 = element("td"); + td1.textContent = "Measure"; + t7 = space(); + + for (let i = 0; i < each_blocks_4.length; i += 1) { + each_blocks_4[i].c(); + } + + t8 = space(); + td2 = element("td"); + td2.textContent = "Total"; + t10 = space(); + + for (let i = 0; i < each_blocks_3.length; i += 1) { + each_blocks_3[i].c(); + } + + t11 = space(); + tr2 = element("tr"); + td3 = element("td"); + td3.textContent = "Totals"; + t13 = space(); + td4 = element("td"); + td4.textContent = "Nodes"; + t15 = space(); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].c(); + } + + t16 = space(); + tr3 = element("tr"); + td5 = element("td"); + td5.textContent = "Real Edges"; + t18 = space(); + + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + + t19 = space(); + tr4 = element("tr"); + td6 = element("td"); + td6.textContent = "Implied Edges"; + t21 = space(); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(th0, "scope", "col"); + attr(th0, "class", "svelte-rb5mhu"); + attr(th1, "scope", "col"); + attr(th1, "colspan", DIRECTIONS$1.length + 2); + attr(th1, "class", "svelte-rb5mhu"); + attr(button, "class", "icon"); + attr(button, "aria-label", "Refresh Stats View (also refreshes Breadcrumbs Index)"); + attr(td0, "class", "svelte-rb5mhu"); + attr(td1, "class", "svelte-rb5mhu"); + attr(td2, "class", "svelte-rb5mhu"); + attr(td3, "rowspan", "3"); + attr(td3, "class", "svelte-rb5mhu"); + attr(td4, "class", "svelte-rb5mhu"); + attr(td5, "class", "svelte-rb5mhu"); + attr(td6, "class", "svelte-rb5mhu"); + attr(table, "class", "svelte-rb5mhu"); + }, + m(target, anchor) { + insert(target, table, anchor); + append(table, thead); + append(thead, tr0); + append(tr0, th0); + append(tr0, t1); + append(tr0, th1); + append(th1, t2); + append(table, t3); + append(table, tr1); + append(tr1, td0); + append(td0, button); + append(tr1, t5); + append(tr1, td1); + append(tr1, t7); + + for (let i = 0; i < each_blocks_4.length; i += 1) { + each_blocks_4[i].m(tr1, null); + } + + append(tr1, t8); + append(tr1, td2); + append(table, t10); + + for (let i = 0; i < each_blocks_3.length; i += 1) { + each_blocks_3[i].m(table, null); + } + + append(table, t11); + append(table, tr2); + append(tr2, td3); + append(tr2, t13); + append(tr2, td4); + append(tr2, t15); + + for (let i = 0; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].m(tr2, null); + } + + append(table, t16); + append(table, tr3); + append(tr3, td5); + append(tr3, t18); - attr(a, "class", a_class_value = "internal-link " + (isInVault(/*plugin*/ ctx[0].app, /*line*/ ctx[11][1]) - ? "" - : "is-unresolved") + " svelte-n6zmin"); + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].m(tr3, null); + } - attr(span, "class", "internal-link"); - attr(div, "class", "svelte-n6zmin"); - }, - m(target, anchor) { - insert(target, div, anchor); - append(div, pre); - append(pre, t0); - append(div, t1); - append(div, span); - append(span, a); - append(a, t2); - append(div, t3); + append(table, t19); + append(table, tr4); + append(tr4, td6); + append(tr4, t21); - if (!mounted) { - dispose = [ - listen(span, "click", click_handler_2), - listen(span, "mouseover", mouseover_handler) - ]; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(tr4, null); + } + if (!mounted) { + dispose = listen(button, "click", /*click_handler*/ ctx[5]); mounted = true; } }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (dirty & /*lines*/ 16 && t0_value !== (t0_value = /*line*/ ctx[11][0] + "-" + "")) set_data(t0, t0_value); - if (dirty & /*lines*/ 16 && t2_value !== (t2_value = /*line*/ ctx[11][1] + "")) set_data(t2, t2_value); + p(ctx, dirty) { + if (dirty & /*ARROW_DIRECTIONS, DIRECTIONS*/ 0) { + each_value_7 = DIRECTIONS$1; + let i; - if (dirty & /*plugin, lines*/ 17 && a_class_value !== (a_class_value = "internal-link " + (isInVault(/*plugin*/ ctx[0].app, /*line*/ ctx[11][1]) - ? "" - : "is-unresolved") + " svelte-n6zmin")) { - attr(a, "class", a_class_value); - } - }, - d(detaching) { - if (detaching) detach(div); - mounted = false; - run_all(dispose); - } - }; -} + for (i = 0; i < each_value_7.length; i += 1) { + const child_ctx = get_each_context_7(ctx, each_value_7, i); -// (63:2) {#each lines as line} -function create_each_block$9(ctx) { - let if_block_anchor; - let if_block = /*line*/ ctx[11].length > 1 && create_if_block$4(ctx); + if (each_blocks_4[i]) { + each_blocks_4[i].p(child_ctx, dirty); + } else { + each_blocks_4[i] = create_each_block_7(child_ctx); + each_blocks_4[i].c(); + each_blocks_4[i].m(tr1, t8); + } + } - 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(ctx, dirty) { - if (/*line*/ ctx[11].length > 1) { - if (if_block) { - if_block.p(ctx, dirty); - } else { - if_block = create_if_block$4(ctx); - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); + for (; i < each_blocks_4.length; i += 1) { + each_blocks_4[i].d(1); } - } 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_fragment$d(ctx) { - let div0; - let span; - let current_block_type_index; - let if_block; - let span_aria_label_value; - let t0; - let button; - let t2; - let div1; - let current; - let mounted; - let dispose; - const if_block_creators = [create_if_block_1$3, create_else_block$1]; - const if_blocks = []; + each_blocks_4.length = each_value_7.length; + } - function select_block_type(ctx, dirty) { - if (/*frozen*/ ctx[3]) return 0; - return 1; - } + if (dirty[0] & /*cellStr, data, hierStrs*/ 28) { + each_value_3 = /*userHiers*/ ctx[1]; + let i; - current_block_type_index = select_block_type(ctx); - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - let each_value = /*lines*/ ctx[4]; - let each_blocks = []; + for (i = 0; i < each_value_3.length; i += 1) { + const child_ctx = get_each_context_3$2(ctx, each_value_3, i); - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block$9(get_each_context$9(ctx, each_value, i)); - } + if (each_blocks_3[i]) { + each_blocks_3[i].p(child_ctx, dirty); + } else { + each_blocks_3[i] = create_each_block_3$2(child_ctx); + each_blocks_3[i].c(); + each_blocks_3[i].m(table, t11); + } + } - return { - c() { - div0 = element("div"); - span = element("span"); - if_block.c(); - t0 = space(); - button = element("button"); - button.textContent = "↻"; - t2 = space(); - div1 = element("div"); + for (; i < each_blocks_3.length; i += 1) { + each_blocks_3[i].d(1); + } - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); + each_blocks_3.length = each_value_3.length; } - attr(span, "class", "icon nav-action-button"); - - attr(span, "aria-label", span_aria_label_value = /*frozen*/ ctx[3] - ? `Frozen on: ${/*basename*/ ctx[2]}` - : "Unfrozen"); - - attr(span, "aria-label-position", "left"); - attr(button, "class", "icon"); - attr(button, "aria-label", "Refresh Stats View (also refreshes Breadcrumbs Index)"); - attr(div1, "class", "BC-downs svelte-n6zmin"); - }, - m(target, anchor) { - insert(target, div0, anchor); - append(div0, span); - if_blocks[current_block_type_index].m(span, null); - append(div0, t0); - append(div0, button); - insert(target, t2, anchor); - insert(target, div1, anchor); + if (dirty[0] & /*data*/ 4) { + each_value_2 = DIRECTIONS$1; + let i; - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div1, null); - } + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2$3(ctx, each_value_2, i); - current = true; + if (each_blocks_2[i]) { + each_blocks_2[i].p(child_ctx, dirty); + } else { + each_blocks_2[i] = create_each_block_2$3(child_ctx); + each_blocks_2[i].c(); + each_blocks_2[i].m(tr2, null); + } + } - if (!mounted) { - dispose = [ - listen(span, "click", /*click_handler*/ ctx[5]), - listen(button, "click", /*click_handler_1*/ ctx[6]) - ]; + for (; i < each_blocks_2.length; i += 1) { + each_blocks_2[i].d(1); + } - mounted = true; + each_blocks_2.length = each_value_2.length; } - }, - p(ctx, [dirty]) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx); - if (current_block_type_index !== previous_block_index) { - group_outros(); - - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); + if (dirty[0] & /*data*/ 4) { + each_value_1 = DIRECTIONS$1; + let i; - check_outros(); - if_block = if_blocks[current_block_type_index]; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1$7(ctx, each_value_1, i); - if (!if_block) { - if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); - if_block.c(); + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_1$7(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(tr3, null); + } } - transition_in(if_block, 1); - if_block.m(span, null); - } + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } - if (!current || dirty & /*frozen, basename*/ 12 && span_aria_label_value !== (span_aria_label_value = /*frozen*/ ctx[3] - ? `Frozen on: ${/*basename*/ ctx[2]}` - : "Unfrozen")) { - attr(span, "aria-label", span_aria_label_value); + each_blocks_1.length = each_value_1.length; } - if (dirty & /*openOrSwitch, plugin, lines, hoverPreview, view, isInVault*/ 19) { - each_value = /*lines*/ ctx[4]; + if (dirty[0] & /*data*/ 4) { + each_value = DIRECTIONS$1; let i; for (i = 0; i < each_value.length; i += 1) { @@ -21381,7 +22016,7 @@ function create_fragment$d(ctx) { } else { each_blocks[i] = create_each_block$9(child_ctx); each_blocks[i].c(); - each_blocks[i].m(div1, null); + each_blocks[i].m(tr4, null); } } @@ -21389,841 +22024,801 @@ function create_fragment$d(ctx) { 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; + each_blocks.length = each_value.length; + } }, + i: noop, + o: noop, d(detaching) { - if (detaching) detach(div0); - if_blocks[current_block_type_index].d(); - if (detaching) detach(t2); - if (detaching) detach(div1); + if (detaching) detach(table); + destroy_each(each_blocks_4, detaching); + destroy_each(each_blocks_3, detaching); + destroy_each(each_blocks_2, detaching); + destroy_each(each_blocks_1, detaching); destroy_each(each_blocks, detaching); mounted = false; - run_all(dispose); + dispose(); } }; } -function instance$d($$self, $$props, $$invalidate) { +function instance$h($$self, $$props, $$invalidate) { let { plugin } = $$props; - let { view } = $$props; - const { settings } = plugin; + const { settings, mainG } = plugin; const { userHiers } = settings; - let frozen = false; - let { basename } = plugin.app.workspace.getActiveFile(); - - plugin.app.workspace.on("active-leaf-change", () => { - if (frozen) return; - $$invalidate(2, basename = plugin.app.workspace.getActiveFile().basename); - }); - - let lines; - - const click_handler = () => { - $$invalidate(3, frozen = !frozen); - if (!frozen) $$invalidate(2, basename = plugin.app.workspace.getActiveFile().basename); - }; - - const click_handler_1 = async () => { - await plugin.refreshIndex(); - await view.draw(); - }; - - const click_handler_2 = async (line, e) => await openOrSwitch(plugin.app, line[1], e); - const mouseover_handler = (line, e) => hoverPreview(e, view, line[1]); + const db = new Debugger(plugin); + db.start2G("StatsView"); - $$self.$$set = $$props => { - if ("plugin" in $$props) $$invalidate(0, plugin = $$props.plugin); - if ("view" in $$props) $$invalidate(1, view = $$props.view); - }; + function fillInInfo(dir, gType, hierData, nodesToo = true) { + const gInfo = hierData[dir][gType]; + const { wikilinkIndex } = settings; - $$self.$$.update = () => { - if ($$self.$$.dirty & /*plugin, basename*/ 5) { - { - const { mainG } = plugin; - const upnDown = getSubInDirs(mainG, "up", "down"); - const closed = getReflexiveClosure(upnDown, userHiers); - const down = getSubInDirs(closed, "down"); - const allPaths = dfsAllPaths(down, basename); - const index = plugin.createIndex(allPaths, false); - loglevel.info({ allPaths, index }); - $$invalidate(4, lines = index.split("\n").map(line => line.split("- ")).filter(pair => pair.length > 1)); - } + if (nodesToo) { + gInfo.nodes = gInfo.graph.nodes(); + gInfo.nodesStr = gInfo.nodes.map(n => makeWiki(n, wikilinkIndex)).join("\n"); } - }; - - return [ - plugin, - view, - basename, - frozen, - lines, - click_handler, - click_handler_1, - click_handler_2, - mouseover_handler - ]; -} -class Down extends SvelteComponent { - constructor(options) { - super(); - if (!document.getElementById("svelte-n6zmin-style")) add_css$8(); - init(this, options, instance$d, create_fragment$d, safe_not_equal, { plugin: 0, view: 1 }); + gInfo.edges = gInfo.graph.edges(); + const edgeStrArr = gInfo.graph.mapEdges((k, a, s, t) => `${makeWiki(nodesToo ? s : t, wikilinkIndex)} ${ARROW_DIRECTIONS[dir]} ${makeWiki(nodesToo ? t : s, wikilinkIndex)}`); + gInfo.edgesStr = edgeStrArr.join("\n"); } -} - -class DownView extends require$$0.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.icon = addFeatherIcon("corner-right-down"); - this.plugin = plugin; - } - async onload() { - super.onload(); - this.app.workspace.onLayoutReady(async () => { - await this.draw(); - }); - } - getViewType() { - return DOWN_VIEW; - } - getDisplayText() { - return "Breadcrumbs Down"; - } - async onOpen() { } - onClose() { - if (this.view) { - this.view.$destroy(); - } - return Promise.resolve(); - } - async draw() { - this.contentEl.empty(); - this.view = new Down({ - target: this.contentEl, - props: { plugin: this.plugin, view: this }, - }); - } -} -/* node_modules\svelte-icons\fa\FaInfo.svelte generated by Svelte v3.35.0 */ + const data = settings.userHiers.map(hier => { + const hierData = { + //@ts-ignore + up: { Merged: {}, Closed: {}, Implied: {} }, + //@ts-ignore + same: { Merged: {}, Closed: {}, Implied: {} }, + //@ts-ignore + down: { Merged: {}, Closed: {}, Implied: {} }, + //@ts-ignore + next: { Merged: {}, Closed: {}, Implied: {} }, + //@ts-ignore + prev: { Merged: {}, Closed: {}, Implied: {} } + }; -function create_default_slot$3(ctx) { - let path; + DIRECTIONS$1.forEach(dir => { + // Merged Graphs + /// Smoosh all fieldGs from one dir into a merged graph for that direction as a whole + const mergedInDir = getSubForFields(mainG, hier[dir]); - return { - c() { - path = svg_element("path"); - attr(path, "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, path, anchor); - }, - d(detaching) { - if (detaching) detach(path); - } - }; -} + const mergedInOppDir = getSubForFields(mainG, hier[getOppDir(dir)]); + hierData[dir].Merged.graph = mergedInDir; + fillInInfo(dir, "Merged", hierData); -function create_fragment$c(ctx) { - let iconbase; - let current; - const iconbase_spread_levels = [{ viewBox: "0 0 192 512" }, /*$$props*/ ctx[0]]; + // Closed graphs + if (dir !== "same") { + hierData[dir].Closed.graph = closeImpliedLinks(mergedInDir, mergedInOppDir); + } else { + hierData[dir].Closed.graph = closeImpliedLinks(mergedInDir, mergedInDir); + } - let iconbase_props = { - $$slots: { default: [create_default_slot$3] }, - $$scope: { ctx } - }; + fillInInfo(dir, "Closed", hierData); - for (let i = 0; i < iconbase_spread_levels.length; i += 1) { - iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); - } + if (dir !== "same") { + hierData[dir].Implied.graph = mergedInOppDir; + } else { + hierData[dir].Implied.graph = closeImpliedLinks(mergedInDir, mergedInDir); + } - iconbase = new IconBase({ props: iconbase_props }); + fillInInfo(dir, "Implied", hierData, false); + }); - return { - c() { - create_component(iconbase.$$.fragment); - }, - m(target, anchor) { - mount_component(iconbase, target, anchor); - current = true; - }, - p(ctx, [dirty]) { - const iconbase_changes = (dirty & /*$$props*/ 1) - ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) - : {}; + return hierData; + }); - if (dirty & /*$$scope*/ 2) { - iconbase_changes.$$scope = { dirty, ctx }; - } + loglevel.debug({ data }); + const cellStr = (i, type, info) => DIRECTIONS$1.map(dir => data[i][dir][type][info]).join("\n"); + let hierStrs = userHiers.map(hierToStr); + db.end2G(); - 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); - } + const click_handler = async () => { + await plugin.refreshIndex(); + await plugin.getActiveTYPEView(STATS_VIEW)?.draw(); }; -} -function instance$c($$self, $$props, $$invalidate) { - $$self.$$set = $$new_props => { - $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); + const click_handler_1 = async (i, dir) => await copy(data[i][dir].Merged.nodesStr); + const func = (i, dir) => data[i][dir].Merged.nodes.length; + const click_handler_2 = async i => await copy(cellStr(i, "Merged", "nodesStr")); + const click_handler_3 = async (i, dir) => await copy(data[i][dir].Merged.edgesStr); + const func_1 = (i, dir) => data[i][dir].Merged.edges.length; + const click_handler_4 = async i => await copy(cellStr(i, "Merged", "edgesStr")); + const click_handler_5 = async (i, dir) => await copy(data[i][dir].Implied.edgesStr); + const func_2 = (i, dir) => data[i][dir].Implied.edges.length; + const click_handler_6 = async i => await copy(cellStr(i, "Implied", "edgesStr")); + const func_3 = (dir, datum) => datum[dir].Merged.nodes.length; + const func_4 = (dir, datum) => datum[dir].Merged.nodesStr; + const click_handler_7 = async dir => await copy(data.map(datum => datum[dir].Merged.nodesStr).join("\n")); + const func_5 = (dir, datum) => datum[dir].Merged.edges.length; + const func_6 = (dir, datum) => datum[dir].Merged.edgesStr; + const click_handler_8 = async dir => await copy(data.map(datum => datum[dir].Merged.edgesStr).join("\n")); + const func_7 = (dir, datum) => datum[dir].Implied.edges.length; + const func_8 = (dir, datum) => datum[dir].Implied.edgesStr; + const click_handler_9 = async dir => await copy(data.map(datum => datum[dir].Implied.edgesStr).join("\n")); + + $$self.$$set = $$props => { + if ("plugin" in $$props) $$invalidate(0, plugin = $$props.plugin); }; - $$props = exclude_internal_props($$props); - return [$$props]; + return [ + plugin, + userHiers, + data, + cellStr, + hierStrs, + click_handler, + click_handler_1, + func, + click_handler_2, + click_handler_3, + func_1, + click_handler_4, + click_handler_5, + func_2, + click_handler_6, + func_3, + func_4, + click_handler_7, + func_5, + func_6, + click_handler_8, + func_7, + func_8, + click_handler_9 + ]; } -class FaInfo extends SvelteComponent { +class Stats extends SvelteComponent { constructor(options) { super(); - init(this, options, instance$c, create_fragment$c, safe_not_equal, {}); + if (!document.getElementById("svelte-rb5mhu-style")) add_css$9(); + init(this, options, instance$h, create_fragment$h, safe_not_equal, { plugin: 0 }, [-1, -1]); } } -/* src\Components\Ducks.svelte generated by Svelte v3.35.0 */ +class StatsView extends require$$0.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.icon = "info"; + this.plugin = plugin; + } + async onload() { + super.onload(); + this.app.workspace.onLayoutReady(() => { + setTimeout(async () => await this.draw(), this.plugin.settings.dvWaitTime); + }); + } + getViewType() { + return STATS_VIEW; + } + getDisplayText() { + return "Breadcrumbs Stats"; + } + async onOpen() { + await this.plugin.saveSettings(); + } + onClose() { + if (this.view) { + this.view.$destroy(); + } + return Promise.resolve(); + } + async draw() { + const { contentEl, plugin } = this; + contentEl.empty(); + this.view = new Stats({ + target: contentEl, + props: { plugin }, + }); + } +} -function add_css$7() { +/* node_modules\svelte-icons\components\IconBase.svelte generated by Svelte v3.35.0 */ + +function add_css$8() { var style = element("style"); - style.id = "svelte-gmdm3a-style"; - style.textContent = ".icon.svelte-gmdm3a{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}"; + style.id = "svelte-c8tyih-style"; + style.textContent = "svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}"; append(document.head, style); } -function get_each_context$8(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[13] = list[i]; - return child_ctx; -} - -// (48:2) {#each ducks as duck} -function create_each_block$8(ctx) { - let div; - let a; - let t0_value = /*duck*/ ctx[13] + ""; - let t0; - let t1; - let mounted; - let dispose; - - function click_handler(...args) { - return /*click_handler*/ ctx[9](/*duck*/ ctx[13], ...args); - } - - function mouseover_handler(...args) { - return /*mouseover_handler*/ ctx[10](/*duck*/ ctx[13], ...args); - } +// (18:2) {#if title} +function create_if_block$5(ctx) { + let title_1; + let t; return { c() { - div = element("div"); - a = element("a"); - t0 = text(t0_value); - t1 = space(); - attr(a, "class", "internal-link"); + title_1 = svg_element("title"); + t = text(/*title*/ ctx[0]); }, m(target, anchor) { - insert(target, div, anchor); - append(div, a); - append(a, t0); - append(div, t1); - - if (!mounted) { - dispose = [ - listen(div, "click", click_handler), - listen(div, "mouseover", mouseover_handler) - ]; - - mounted = true; - } + insert(target, title_1, anchor); + append(title_1, t); }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (dirty & /*ducks*/ 16 && t0_value !== (t0_value = /*duck*/ ctx[13] + "")) set_data(t0, t0_value); + p(ctx, dirty) { + if (dirty & /*title*/ 1) set_data(t, /*title*/ ctx[0]); }, d(detaching) { - if (detaching) detach(div); - mounted = false; - run_all(dispose); + if (detaching) detach(title_1); } }; } -function create_fragment$b(ctx) { - let div; - let h6; - let t1; - let span; - let fainfo; - let t2; - let label; - let t4; - let input0; - let t5; - let input1; - let t6; +function create_fragment$g(ctx) { + let svg; + let if_block_anchor; let current; - let mounted; - let dispose; - fainfo = new FaInfo({}); - let each_value = /*ducks*/ ctx[4]; - let each_blocks = []; - - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block$8(get_each_context$8(ctx, each_value, i)); - } + let if_block = /*title*/ ctx[0] && create_if_block$5(ctx); + const default_slot_template = /*#slots*/ ctx[3].default; + const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[2], null); 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"); - label.textContent = "Filter:"; - t4 = space(); - input0 = element("input"); - t5 = space(); - input1 = element("input"); - t6 = 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", `A Regex used to filter the results.\nIf 'Include' is checked, it will only show notes that match the regex.\nIf 'Include' is not checked, this regex will filter out notes that match it.`); - attr(label, "for", "regex"); - attr(input0, "type", "text"); - attr(input0, "name", "regex"); - attr(input0, "placeholder", "Regex"); - input0.value = /*query*/ ctx[2]; - attr(input1, "aria-label", "Include"); - attr(input1, "type", "checkbox"); - input1.checked = /*include*/ ctx[3]; - attr(div, "class", "BC-Ducks markdown-preview-view"); + 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, div, anchor); - append(div, h6); - append(div, t1); - append(div, span); - mount_component(fainfo, span, null); - append(div, t2); - append(div, label); - append(div, t4); - append(div, input0); - append(div, t5); - append(div, input1); - append(div, t6); + insert(target, svg, anchor); + if (if_block) if_block.m(svg, null); + append(svg, if_block_anchor); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); + if (default_slot) { + default_slot.m(svg, null); } current = true; - - if (!mounted) { - dispose = [ - listen(input0, "change", /*change_handler*/ ctx[7]), - listen(input1, "change", /*change_handler_1*/ ctx[8]) - ]; - - mounted = true; - } }, p(ctx, [dirty]) { - if (!current || dirty & /*query*/ 4 && input0.value !== /*query*/ ctx[2]) { - input0.value = /*query*/ ctx[2]; - } - - if (!current || dirty & /*include*/ 8) { - input1.checked = /*include*/ ctx[3]; - } - - if (dirty & /*openOrSwitch, app, ducks, hoverPreview, ducksView*/ 19) { - each_value = /*ducks*/ ctx[4]; - let i; - - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context$8(ctx, each_value, i); - - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block$8(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(div, null); - } + if (/*title*/ ctx[0]) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$5(ctx); + if_block.c(); + if_block.m(svg, if_block_anchor); } + } else if (if_block) { + if_block.d(1); + if_block = null; + } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); + if (default_slot) { + if (default_slot.p && dirty & /*$$scope*/ 4) { + update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[2], dirty, null, null); } + } - each_blocks.length = each_value.length; + if (!current || dirty & /*viewBox*/ 2) { + attr(svg, "viewBox", /*viewBox*/ ctx[1]); } }, i(local) { if (current) return; - transition_in(fainfo.$$.fragment, local); + transition_in(default_slot, local); current = true; }, o(local) { - transition_out(fainfo.$$.fragment, local); + transition_out(default_slot, local); current = false; }, d(detaching) { - if (detaching) detach(div); - destroy_component(fainfo); - destroy_each(each_blocks, detaching); - mounted = false; - run_all(dispose); + if (detaching) detach(svg); + if (if_block) if_block.d(); + if (default_slot) default_slot.d(detaching); } }; } -function instance$b($$self, $$props, $$invalidate) { - - - - let { plugin } = $$props; - let { app } = $$props; - let { ducksView } = $$props; - const { mainG } = plugin; - const files = app.vault.getMarkdownFiles(); - let query = ""; - let include = true; - let regex = new RegExp(query, "g"); - let ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name)); - const change_handler = e => $$invalidate(2, query = e.target.value); - const change_handler_1 = e => $$invalidate(3, include = e.target.checked); - const click_handler = async (duck, e) => await openOrSwitch(app, duck, e); - const mouseover_handler = (duck, e) => hoverPreview(e, ducksView, duck); +function instance$g($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + let { title = null } = $$props; + let { viewBox } = $$props; $$self.$$set = $$props => { - if ("plugin" in $$props) $$invalidate(5, plugin = $$props.plugin); - if ("app" in $$props) $$invalidate(0, app = $$props.app); - if ("ducksView" in $$props) $$invalidate(1, ducksView = $$props.ducksView); - }; - - $$self.$$.update = () => { - if ($$self.$$.dirty & /*query*/ 4) { - $$invalidate(6, regex = new RegExp(query, "g")); - } - - if ($$self.$$.dirty & /*include, regex*/ 72) { - { - $$invalidate(4, ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name))); - } - } - - if ($$self.$$.dirty & /*ducks, query, include, regex*/ 92) { - console.log({ ducks, query, include, regex }); - } + if ("title" in $$props) $$invalidate(0, title = $$props.title); + if ("viewBox" in $$props) $$invalidate(1, viewBox = $$props.viewBox); + if ("$$scope" in $$props) $$invalidate(2, $$scope = $$props.$$scope); }; - return [ - app, - ducksView, - query, - include, - ducks, - plugin, - regex, - change_handler, - change_handler_1, - click_handler, - mouseover_handler - ]; + return [title, viewBox, $$scope, slots]; } -class Ducks extends SvelteComponent { +class IconBase extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-gmdm3a-style")) add_css$7(); - init(this, options, instance$b, create_fragment$b, safe_not_equal, { plugin: 5, app: 0, ducksView: 1 }); + if (!document.getElementById("svelte-c8tyih-style")) add_css$8(); + init(this, options, instance$g, create_fragment$g, safe_not_equal, { title: 0, viewBox: 1 }); } } -class DucksView extends require$$0.ItemView { - constructor(leaf, plugin) { - super(leaf); - // TODO Duck icon - this.icon = "info"; - this.plugin = plugin; - } - async onload() { - super.onload(); - await this.plugin.saveSettings(); - this.app.workspace.onLayoutReady(async () => { - await this.draw(); - }); - } - getViewType() { - return DUCK_VIEW; - } - getDisplayText() { - return "Breadcrumbs Ducks"; - } - async onOpen() { } - onClose() { - if (this.view) { - this.view.$destroy(); - } - return Promise.resolve(); - } - async draw() { - this.contentEl.empty(); - this.view = new Ducks({ - target: this.contentEl, - props: { plugin: this.plugin, app: this.app, ducksView: this }, - }); - } -} - -/* src\Components\Lists.svelte generated by Svelte v3.35.0 */ +/* node_modules\svelte-icons\fa\FaFire.svelte generated by Svelte v3.35.0 */ -function add_css$6() { - var style = element("style"); - style.id = "svelte-ifpk85-style"; - style.textContent = "summary.hier-summary.svelte-ifpk85{color:var(--text-title-h2);font-size:larger}summary.svelte-ifpk85{color:var(--text-title-h3)}h5.BC-header.svelte-ifpk85{color:var(--text-title-h5)}ol.markdown-preview-view.svelte-ifpk85{padding-top:3px;padding-bottom:5px}"; - append(document.head, style); -} +function create_default_slot$5(ctx) { + let path; -function get_each_context$7(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[9] = list[i]; - return child_ctx; + return { + c() { + path = svg_element("path"); + attr(path, "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, path, anchor); + }, + d(detaching) { + if (detaching) detach(path); + } + }; } -function get_each_context_1$7(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i]; - return child_ctx; -} +function create_fragment$f(ctx) { + let iconbase; + let current; + const iconbase_spread_levels = [{ viewBox: "0 0 384 512" }, /*$$props*/ ctx[0]]; -function get_each_context_2$3(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} + let iconbase_props = { + $$slots: { default: [create_default_slot$5] }, + $$scope: { ctx } + }; -function get_each_context_3$2(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[18] = list[i]; - return child_ctx; -} + for (let i = 0; i < iconbase_spread_levels.length; i += 1) { + iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); + } -// (20:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$3(ctx) { - let details; - let summary; - let t0_value = /*square*/ ctx[12].field + ""; - let t0; - let t1; - let t2; - let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_3$1(ctx); - let if_block1 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$2(ctx); + iconbase = new IconBase({ props: iconbase_props }); return { c() { - details = element("details"); - summary = element("summary"); - t0 = text(t0_value); - t1 = space(); - if (if_block0) if_block0.c(); - t2 = space(); - if (if_block1) if_block1.c(); - attr(summary, "class", "svelte-ifpk85"); - details.open = true; - attr(details, "class", "BC-details"); + create_component(iconbase.$$.fragment); }, m(target, anchor) { - insert(target, details, anchor); - append(details, summary); - append(summary, t0); - append(details, t1); - if (if_block0) if_block0.m(details, null); - append(details, t2); - if (if_block1) if_block1.m(details, null); + mount_component(iconbase, target, anchor); + current = true; }, - p(ctx, dirty) { - if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = /*square*/ ctx[12].field + "")) set_data(t0, t0_value); + p(ctx, [dirty]) { + const iconbase_changes = (dirty & /*$$props*/ 1) + ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) + : {}; - if (/*square*/ ctx[12].realItems.length) { - if (if_block0) { - if_block0.p(ctx, dirty); - } else { - if_block0 = create_if_block_3$1(ctx); - if_block0.c(); - if_block0.m(details, t2); - } - } else if (if_block0) { - if_block0.d(1); - if_block0 = null; + if (dirty & /*$$scope*/ 2) { + iconbase_changes.$$scope = { dirty, ctx }; } - if (/*square*/ ctx[12].impliedItems.length) { - if (if_block1) { - if_block1.p(ctx, dirty); - } else { - if_block1 = create_if_block_1$2(ctx); - if_block1.c(); - if_block1.m(details, null); - } - } else if (if_block1) { - if_block1.d(1); - if_block1 = null; - } + 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 instance$f($$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]; +} + +class FaFire extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$f, create_fragment$f, safe_not_equal, {}); + } +} + +/* node_modules\svelte-icons\fa\FaRegSnowflake.svelte generated by Svelte v3.35.0 */ + +function create_default_slot$4(ctx) { + let path; + + return { + c() { + path = svg_element("path"); + attr(path, "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, path, anchor); }, d(detaching) { - if (detaching) detach(details); - if (if_block0) if_block0.d(); - if (if_block1) if_block1.d(); + if (detaching) detach(path); } }; } -// (23:12) {#if square.realItems.length} -function create_if_block_3$1(ctx) { - let t; - let ol; - let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_4$1(); - let each_value_3 = /*square*/ ctx[12].realItems; - let each_blocks = []; +function create_fragment$e(ctx) { + let iconbase; + let current; + const iconbase_spread_levels = [{ viewBox: "0 0 448 512" }, /*$$props*/ ctx[0]]; - for (let i = 0; i < each_value_3.length; i += 1) { - each_blocks[i] = create_each_block_3$2(get_each_context_3$2(ctx, each_value_3, i)); + let iconbase_props = { + $$slots: { default: [create_default_slot$4] }, + $$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({ props: iconbase_props }); + return { c() { - if (if_block) if_block.c(); - t = space(); - ol = element("ol"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - attr(ol, "class", "markdown-preview-view svelte-ifpk85"); + create_component(iconbase.$$.fragment); }, m(target, anchor) { - if (if_block) if_block.m(target, anchor); - insert(target, t, anchor); - insert(target, ol, anchor); + mount_component(iconbase, target, anchor); + current = true; + }, + p(ctx, [dirty]) { + const iconbase_changes = (dirty & /*$$props*/ 1) + ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) + : {}; - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(ol, null); + if (dirty & /*$$scope*/ 2) { + iconbase_changes.$$scope = { dirty, ctx }; } + + iconbase.$set(iconbase_changes); }, - p(ctx, dirty) { - if (/*settings*/ ctx[1].showRelationType) { - if (if_block) ; else { - if_block = create_if_block_4$1(); - if_block.c(); - if_block.m(t.parentNode, t); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } + 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); + } + }; +} - if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView*/ 13) { - each_value_3 = /*square*/ ctx[12].realItems; - let i; +function instance$e($$self, $$props, $$invalidate) { + $$self.$$set = $$new_props => { + $$invalidate(0, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); + }; - for (i = 0; i < each_value_3.length; i += 1) { - const child_ctx = get_each_context_3$2(ctx, each_value_3, i); + $$props = exclude_internal_props($$props); + return [$$props]; +} - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block_3$2(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(ol, null); - } - } +class FaRegSnowflake extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$e, create_fragment$e, safe_not_equal, {}); + } +} - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } +/* src\Components\Down.svelte generated by Svelte v3.35.0 */ - each_blocks.length = each_value_3.length; - } +function add_css$7() { + var style = element("style"); + style.id = "svelte-1e6c2hm-style"; + style.textContent = ".BC-downs.svelte-1e6c2hm.svelte-1e6c2hm{padding-left:5px}.BC-downs.svelte-1e6c2hm>div.svelte-1e6c2hm{white-space:nowrap}pre.svelte-1e6c2hm.svelte-1e6c2hm{display:inline}.is-unresolved.svelte-1e6c2hm.svelte-1e6c2hm{color:var(--text-muted)}.icon.svelte-1e6c2hm.svelte-1e6c2hm{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}"; + append(document.head, style); +} + +function get_each_context$8(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + return child_ctx; +} + +// (47:4) {:else} +function create_else_block$1(ctx) { + let fafire; + let current; + fafire = new FaFire({}); + + 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) { - if (if_block) if_block.d(detaching); - if (detaching) detach(t); - if (detaching) detach(ol); - destroy_each(each_blocks, detaching); + destroy_component(fafire, detaching); } }; } -// (24:14) {#if settings.showRelationType} -function create_if_block_4$1(ctx) { - let h5; +// (45:4) {#if frozen} +function create_if_block_1$3(ctx) { + let faregsnowflake; + let current; + faregsnowflake = new FaRegSnowflake({}); return { c() { - h5 = element("h5"); - h5.textContent = "Real"; - attr(h5, "class", "BC-header svelte-ifpk85"); + create_component(faregsnowflake.$$.fragment); }, m(target, anchor) { - insert(target, h5, 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) { - if (detaching) detach(h5); + destroy_component(faregsnowflake, detaching); } }; } -// (29:16) {#each square.realItems as realItem} -function create_each_block_3$2(ctx) { - let li; +// (63:4) {#if line.length > 1} +function create_if_block$4(ctx) { let div; - let t0_value = (/*realItem*/ ctx[18].alt ?? /*realItem*/ ctx[18].to.split("/").last()) + ""; + let pre; + let t0_value = /*line*/ ctx[11][0] + "-" + ""; let t0; - let div_class_value; let t1; + let span; + let a; + let t2_value = /*line*/ ctx[11][1] + ""; + let t2; + let a_class_value; + let t3; let mounted; let dispose; - function click_handler(...args) { - return /*click_handler*/ ctx[5](/*realItem*/ ctx[18], ...args); + function click_handler_2(...args) { + return /*click_handler_2*/ ctx[7](/*line*/ ctx[11], ...args); } function mouseover_handler(...args) { - return /*mouseover_handler*/ ctx[6](/*realItem*/ ctx[18], ...args); + return /*mouseover_handler*/ ctx[8](/*line*/ ctx[11], ...args); } return { c() { - li = element("li"); div = element("div"); + pre = element("pre"); t0 = text(t0_value); t1 = space(); - attr(div, "class", div_class_value = /*realItem*/ ctx[18].cls); + span = element("span"); + a = element("a"); + t2 = text(t2_value); + t3 = space(); + attr(pre, "class", "svelte-1e6c2hm"); + + attr(a, "class", a_class_value = "internal-link " + (isInVault(/*plugin*/ ctx[0].app, /*line*/ ctx[11][1]) + ? "" + : "is-unresolved") + " svelte-1e6c2hm"); + + attr(span, "class", "internal-link"); + attr(div, "class", "svelte-1e6c2hm"); }, m(target, anchor) { - insert(target, li, anchor); - append(li, div); - append(div, t0); - append(li, t1); + insert(target, div, anchor); + append(div, pre); + append(pre, t0); + append(div, t1); + append(div, span); + append(span, a); + append(a, t2); + append(div, t3); if (!mounted) { dispose = [ - listen(div, "click", click_handler), - listen(div, "mouseover", mouseover_handler) + listen(span, "click", click_handler_2), + listen(span, "mouseover", mouseover_handler) ]; - mounted = true; - } + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*lines*/ 16 && t0_value !== (t0_value = /*line*/ ctx[11][0] + "-" + "")) set_data(t0, t0_value); + if (dirty & /*lines*/ 16 && t2_value !== (t2_value = /*line*/ ctx[11][1] + "")) set_data(t2, t2_value); + + if (dirty & /*plugin, lines*/ 17 && a_class_value !== (a_class_value = "internal-link " + (isInVault(/*plugin*/ ctx[0].app, /*line*/ ctx[11][1]) + ? "" + : "is-unresolved") + " svelte-1e6c2hm")) { + attr(a, "class", a_class_value); + } + }, + d(detaching) { + if (detaching) detach(div); + mounted = false; + run_all(dispose); + } + }; +} + +// (62:2) {#each lines as line} +function create_each_block$8(ctx) { + let if_block_anchor; + let if_block = /*line*/ ctx[11].length > 1 && create_if_block$4(ctx); + + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = (/*realItem*/ ctx[18].alt ?? /*realItem*/ ctx[18].to.split("/").last()) + "")) set_data(t0, t0_value); - - if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = /*realItem*/ ctx[18].cls)) { - attr(div, "class", div_class_value); + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx, dirty) { + if (/*line*/ ctx[11].length > 1) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$4(ctx); + 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 (detaching) detach(li); - mounted = false; - run_all(dispose); + if (if_block) if_block.d(detaching); + if (detaching) detach(if_block_anchor); } }; } -// (44:12) {#if square.impliedItems.length} -function create_if_block_1$2(ctx) { - let t; - let ol; - let ol_start_value; - let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_2$2(); - let each_value_2 = /*square*/ ctx[12].impliedItems; +function create_fragment$d(ctx) { + let div0; + let span; + let current_block_type_index; + let if_block; + let span_aria_label_value; + let t0; + let button; + let t2; + let div1; + let current; + let mounted; + let dispose; + const if_block_creators = [create_if_block_1$3, create_else_block$1]; + const if_blocks = []; + + function select_block_type(ctx, dirty) { + if (/*frozen*/ ctx[3]) return 0; + return 1; + } + + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + let each_value = /*lines*/ ctx[4]; let each_blocks = []; - for (let i = 0; i < each_value_2.length; i += 1) { - each_blocks[i] = create_each_block_2$3(get_each_context_2$3(ctx, each_value_2, i)); + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$8(get_each_context$8(ctx, each_value, i)); } return { c() { - if (if_block) if_block.c(); - t = space(); - ol = element("ol"); + div0 = element("div"); + span = element("span"); + if_block.c(); + t0 = space(); + button = element("button"); + button.textContent = "↻"; + t2 = space(); + div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } - attr(ol, "class", "markdown-preview-view svelte-ifpk85"); - attr(ol, "start", ol_start_value = /*square*/ ctx[12].realItems.length + 1); + attr(span, "class", "icon nav-action-button svelte-1e6c2hm"); + + attr(span, "aria-label", span_aria_label_value = /*frozen*/ ctx[3] + ? `Frozen on: ${/*basename*/ ctx[2]}` + : "Unfrozen"); + + attr(span, "aria-label-position", "left"); + attr(button, "aria-label", "Refresh Stats View (also refreshes Breadcrumbs Index)"); + attr(div1, "class", "BC-downs svelte-1e6c2hm"); }, m(target, anchor) { - if (if_block) if_block.m(target, anchor); - insert(target, t, anchor); - insert(target, ol, anchor); + insert(target, div0, anchor); + append(div0, span); + if_blocks[current_block_type_index].m(span, null); + append(div0, t0); + append(div0, button); + insert(target, t2, anchor); + insert(target, div1, anchor); for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(ol, null); + each_blocks[i].m(div1, null); + } + + current = true; + + if (!mounted) { + dispose = [ + listen(span, "click", /*click_handler*/ ctx[5]), + listen(button, "click", /*click_handler_1*/ ctx[6]) + ]; + + mounted = true; } }, - p(ctx, dirty) { - if (/*settings*/ ctx[1].showRelationType) { - if (if_block) ; else { - if_block = create_if_block_2$2(); + p(ctx, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx); + + if (current_block_type_index !== previous_block_index) { + group_outros(); + + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + + check_outros(); + if_block = if_blocks[current_block_type_index]; + + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); - if_block.m(t.parentNode, t); } - } else if (if_block) { - if_block.d(1); - if_block = null; + + transition_in(if_block, 1); + if_block.m(span, null); } - if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView*/ 13) { - each_value_2 = /*square*/ ctx[12].impliedItems; + if (!current || dirty & /*frozen, basename*/ 12 && span_aria_label_value !== (span_aria_label_value = /*frozen*/ ctx[3] + ? `Frozen on: ${/*basename*/ ctx[2]}` + : "Unfrozen")) { + attr(span, "aria-label", span_aria_label_value); + } + + if (dirty & /*openOrSwitch, plugin, lines, hoverPreview, view, isInVault*/ 19) { + each_value = /*lines*/ ctx[4]; let i; - for (i = 0; i < each_value_2.length; i += 1) { - const child_ctx = get_each_context_2$3(ctx, each_value_2, i); + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$8(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block_2$3(child_ctx); + each_blocks[i] = create_each_block$8(child_ctx); each_blocks[i].c(); - each_blocks[i].m(ol, null); + each_blocks[i].m(div1, null); } } @@ -22231,216 +22826,306 @@ function create_if_block_1$2(ctx) { each_blocks[i].d(1); } - each_blocks.length = each_value_2.length; - } - - if (dirty & /*filteredSquaresArr*/ 1 && ol_start_value !== (ol_start_value = /*square*/ ctx[12].realItems.length + 1)) { - attr(ol, "start", ol_start_value); + 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 (if_block) if_block.d(detaching); - if (detaching) detach(t); - if (detaching) detach(ol); + if (detaching) detach(div0); + if_blocks[current_block_type_index].d(); + if (detaching) detach(t2); + if (detaching) detach(div1); destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} + +function instance$d($$self, $$props, $$invalidate) { + + + let { plugin } = $$props; + let { view } = $$props; + const { settings } = plugin; + const { userHiers } = settings; + let frozen = false; + let { basename } = plugin.app.workspace.getActiveFile(); + + plugin.app.workspace.on("active-leaf-change", () => { + if (frozen) return; + $$invalidate(2, basename = plugin.app.workspace.getActiveFile().basename); + }); + + let lines; + + const click_handler = () => { + $$invalidate(3, frozen = !frozen); + if (!frozen) $$invalidate(2, basename = plugin.app.workspace.getActiveFile().basename); + }; + + const click_handler_1 = async () => { + await plugin.refreshIndex(); + await view.draw(); + }; + + const click_handler_2 = async (line, e) => await openOrSwitch(plugin.app, line[1], e); + const mouseover_handler = (line, e) => hoverPreview(e, view, line[1]); + + $$self.$$set = $$props => { + if ("plugin" in $$props) $$invalidate(0, plugin = $$props.plugin); + if ("view" in $$props) $$invalidate(1, view = $$props.view); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*plugin, basename*/ 5) { + { + const { mainG } = plugin; + const upnDown = getSubInDirs(mainG, "up", "down"); + const closed = getReflexiveClosure(upnDown, userHiers); + const down = getSubInDirs(closed, "down"); + const allPaths = dfsAllPaths(down, basename); + const index = plugin.createIndex(allPaths, false); + loglevel.info({ allPaths, index }); + $$invalidate(4, lines = index.split("\n").map(line => line.split("- ")).filter(pair => pair.length > 1)); + } } }; + + return [ + plugin, + view, + basename, + frozen, + lines, + click_handler, + click_handler_1, + click_handler_2, + mouseover_handler + ]; +} + +class Down extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-1e6c2hm-style")) add_css$7(); + init(this, options, instance$d, create_fragment$d, safe_not_equal, { plugin: 0, view: 1 }); + } +} + +class DownView extends require$$0.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.icon = addFeatherIcon("corner-right-down"); + this.plugin = plugin; + } + async onload() { + super.onload(); + this.app.workspace.onLayoutReady(async () => { + await this.draw(); + }); + } + getViewType() { + return DOWN_VIEW; + } + getDisplayText() { + return "Breadcrumbs Down"; + } + async onOpen() { } + onClose() { + if (this.view) { + this.view.$destroy(); + } + return Promise.resolve(); + } + async draw() { + this.contentEl.empty(); + this.view = new Down({ + target: this.contentEl, + props: { plugin: this.plugin, view: this }, + }); + } } -// (45:14) {#if settings.showRelationType} -function create_if_block_2$2(ctx) { - let h5; +/* node_modules\svelte-icons\fa\FaInfo.svelte generated by Svelte v3.35.0 */ + +function create_default_slot$3(ctx) { + let path; return { c() { - h5 = element("h5"); - h5.textContent = "Implied"; - attr(h5, "class", "BC-header svelte-ifpk85"); + path = svg_element("path"); + attr(path, "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, h5, anchor); + insert(target, path, anchor); }, d(detaching) { - if (detaching) detach(h5); + if (detaching) detach(path); } }; } -// (53:16) {#each square.impliedItems as impliedItem} -function create_each_block_2$3(ctx) { - let li; - let div; - let t_value = (/*impliedItem*/ ctx[15].alt ?? /*impliedItem*/ ctx[15].to.split("/").last()) + ""; - let t; - let div_class_value; - let div_aria_label_value; - let mounted; - let dispose; +function create_fragment$c(ctx) { + let iconbase; + let current; + const iconbase_spread_levels = [{ viewBox: "0 0 192 512" }, /*$$props*/ ctx[0]]; - function click_handler_1(...args) { - return /*click_handler_1*/ ctx[7](/*impliedItem*/ ctx[15], ...args); - } + let iconbase_props = { + $$slots: { default: [create_default_slot$3] }, + $$scope: { ctx } + }; - function mouseover_handler_1(...args) { - return /*mouseover_handler_1*/ ctx[8](/*impliedItem*/ ctx[15], ...args); + for (let i = 0; i < iconbase_spread_levels.length; i += 1) { + iconbase_props = assign(iconbase_props, iconbase_spread_levels[i]); } + iconbase = new IconBase({ props: iconbase_props }); + return { c() { - li = element("li"); - div = element("div"); - t = text(t_value); - attr(div, "class", div_class_value = /*impliedItem*/ ctx[15].cls); - attr(div, "aria-label", div_aria_label_value = /*impliedItem*/ ctx[15].parent ?? ""); - attr(li, "class", "BC-Implied"); + create_component(iconbase.$$.fragment); }, m(target, anchor) { - insert(target, li, anchor); - append(li, div); - append(div, t); - - if (!mounted) { - dispose = [ - listen(div, "click", click_handler_1), - listen(div, "mouseover", mouseover_handler_1) - ]; - - mounted = true; - } + mount_component(iconbase, target, anchor); + current = true; }, - p(new_ctx, dirty) { - ctx = new_ctx; - if (dirty & /*filteredSquaresArr*/ 1 && t_value !== (t_value = (/*impliedItem*/ ctx[15].alt ?? /*impliedItem*/ ctx[15].to.split("/").last()) + "")) set_data(t, t_value); + p(ctx, [dirty]) { + const iconbase_changes = (dirty & /*$$props*/ 1) + ? get_spread_update(iconbase_spread_levels, [iconbase_spread_levels[0], get_spread_object(/*$$props*/ ctx[0])]) + : {}; - if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = /*impliedItem*/ ctx[15].cls)) { - attr(div, "class", div_class_value); + if (dirty & /*$$scope*/ 2) { + iconbase_changes.$$scope = { dirty, ctx }; } - if (dirty & /*filteredSquaresArr*/ 1 && div_aria_label_value !== (div_aria_label_value = /*impliedItem*/ ctx[15].parent ?? "")) { - attr(div, "aria-label", div_aria_label_value); - } + 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) { - if (detaching) detach(li); - mounted = false; - run_all(dispose); + destroy_component(iconbase, detaching); } }; } -// (19:6) {#each squares as square} -function create_each_block_1$7(ctx) { - let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$3(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(ctx, dirty) { - if (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) { - if (if_block) { - if_block.p(ctx, dirty); - } else { - if_block = create_if_block$3(ctx); - 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 instance$c($$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]; } -// (13:2) {#each filteredSquaresArr as squares} +class FaInfo extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$c, create_fragment$c, safe_not_equal, {}); + } +} + +/* src\Components\Ducks.svelte generated by Svelte v3.35.0 */ + +function add_css$6() { + var style = element("style"); + style.id = "svelte-gmdm3a-style"; + style.textContent = ".icon.svelte-gmdm3a{color:var(--text-normal);display:inline-block;padding-top:5px !important;width:20px;height:20px}"; + append(document.head, style); +} + +function get_each_context$7(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[13] = list[i]; + return child_ctx; +} + +// (48:2) {#each ducks as duck} function create_each_block$7(ctx) { - let details; - let summary; - let t0_value = /*squares*/ ctx[9].map(func).join(", ") + ""; + let div; + let a; + let t0_value = /*duck*/ ctx[13] + ""; let t0; let t1; - let t2; - let each_value_1 = /*squares*/ ctx[9]; - let each_blocks = []; + let mounted; + let dispose; - for (let i = 0; i < each_value_1.length; i += 1) { - each_blocks[i] = create_each_block_1$7(get_each_context_1$7(ctx, each_value_1, i)); + function click_handler(...args) { + return /*click_handler*/ ctx[9](/*duck*/ ctx[13], ...args); + } + + function mouseover_handler(...args) { + return /*mouseover_handler*/ ctx[10](/*duck*/ ctx[13], ...args); } return { c() { - details = element("details"); - summary = element("summary"); + div = element("div"); + a = element("a"); t0 = text(t0_value); t1 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr(summary, "class", "hier-summary svelte-ifpk85"); - details.open = true; + attr(a, "class", "internal-link"); }, m(target, anchor) { - insert(target, details, anchor); - append(details, summary); - append(summary, t0); - append(details, t1); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(details, null); - } - - append(details, t2); - }, - p(ctx, dirty) { - if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = /*squares*/ ctx[9].map(func).join(", ") + "")) set_data(t0, t0_value); - - if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView, settings*/ 15) { - each_value_1 = /*squares*/ ctx[9]; - let i; - - for (i = 0; i < each_value_1.length; i += 1) { - const child_ctx = get_each_context_1$7(ctx, each_value_1, i); - - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block_1$7(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(details, t2); - } - } + insert(target, div, anchor); + append(div, a); + append(a, t0); + append(div, t1); - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } + if (!mounted) { + dispose = [ + listen(div, "click", click_handler), + listen(div, "mouseover", mouseover_handler) + ]; - each_blocks.length = each_value_1.length; + mounted = true; } }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*ducks*/ 16 && t0_value !== (t0_value = /*duck*/ ctx[13] + "")) set_data(t0, t0_value); + }, d(detaching) { - if (detaching) detach(details); - destroy_each(each_blocks, detaching); + if (detaching) detach(div); + mounted = false; + run_all(dispose); } }; } -function create_fragment$a(ctx) { +function create_fragment$b(ctx) { let div; - let each_value = /*filteredSquaresArr*/ ctx[0]; + let h6; + let t1; + let span; + let fainfo; + let t2; + let label; + let t4; + let input0; + let t5; + let input1; + let t6; + let current; + let mounted; + let dispose; + fainfo = new FaInfo({}); + let each_value = /*ducks*/ ctx[4]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -22450,23 +23135,76 @@ function create_fragment$a(ctx) { 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"); + label.textContent = "Filter:"; + t4 = space(); + input0 = element("input"); + t5 = space(); + input1 = element("input"); + t6 = space(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } - attr(div, "class", "BC-list"); + attr(span, "class", "icon svelte-gmdm3a"); + attr(span, "aria-label", `A Regex used to filter the results.\nIf 'Include' is checked, it will only show notes that match the regex.\nIf 'Include' is not checked, this regex will filter out notes that match it.`); + attr(label, "for", "regex"); + attr(input0, "type", "text"); + attr(input0, "name", "regex"); + attr(input0, "placeholder", "Regex"); + input0.value = /*query*/ ctx[2]; + attr(input1, "aria-label", "Include"); + attr(input1, "type", "checkbox"); + input1.checked = /*include*/ ctx[3]; + 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(div, t4); + append(div, input0); + append(div, t5); + append(div, input1); + append(div, t6); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div, null); } + + current = true; + + if (!mounted) { + dispose = [ + listen(input0, "change", /*change_handler*/ ctx[7]), + listen(input1, "change", /*change_handler_1*/ ctx[8]) + ]; + + mounted = true; + } }, p(ctx, [dirty]) { - if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView, settings*/ 15) { - each_value = /*filteredSquaresArr*/ ctx[0]; + if (!current || dirty & /*query*/ 4 && input0.value !== /*query*/ ctx[2]) { + input0.value = /*query*/ ctx[2]; + } + + if (!current || dirty & /*include*/ 8) { + input1.checked = /*include*/ ctx[3]; + } + + if (dirty & /*openOrSwitch, app, ducks, hoverPreview, ducksView*/ 19) { + each_value = /*ducks*/ ctx[4]; let i; for (i = 0; i < each_value.length; i += 1) { @@ -22488,73 +23226,130 @@ function create_fragment$a(ctx) { each_blocks.length = each_value.length; } }, - i: noop, - o: noop, + 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); } }; } -const func = square => square.field; - -function instance$a($$self, $$props, $$invalidate) { +function instance$b($$self, $$props, $$invalidate) { - let { filteredSquaresArr } = $$props; - let { currFile } = $$props; - let { settings } = $$props; - let { matrixView } = $$props; + let { plugin } = $$props; let { app } = $$props; - const click_handler = async (realItem, e) => openOrSwitch(app, realItem.to, e); - const mouseover_handler = (realItem, e) => hoverPreview(e, matrixView, realItem.to); - const click_handler_1 = async (impliedItem, e) => openOrSwitch(app, impliedItem.to, e); - const mouseover_handler_1 = (impliedItem, e) => hoverPreview(e, matrixView, impliedItem.to); + let { ducksView } = $$props; + const { mainG } = plugin; + const files = app.vault.getMarkdownFiles(); + let query = ""; + let include = true; + let regex = new RegExp(query, "g"); + let ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name)); + const change_handler = e => $$invalidate(2, query = e.target.value); + const change_handler_1 = e => $$invalidate(3, include = e.target.checked); + const click_handler = async (duck, e) => await openOrSwitch(app, duck, e); + const mouseover_handler = (duck, e) => hoverPreview(e, ducksView, duck); $$self.$$set = $$props => { - if ("filteredSquaresArr" in $$props) $$invalidate(0, filteredSquaresArr = $$props.filteredSquaresArr); - if ("currFile" in $$props) $$invalidate(4, currFile = $$props.currFile); - if ("settings" in $$props) $$invalidate(1, settings = $$props.settings); - if ("matrixView" in $$props) $$invalidate(2, matrixView = $$props.matrixView); - if ("app" in $$props) $$invalidate(3, app = $$props.app); + if ("plugin" in $$props) $$invalidate(5, plugin = $$props.plugin); + if ("app" in $$props) $$invalidate(0, app = $$props.app); + if ("ducksView" in $$props) $$invalidate(1, ducksView = $$props.ducksView); + }; + + $$self.$$.update = () => { + if ($$self.$$.dirty & /*query*/ 4) { + $$invalidate(6, regex = new RegExp(query, "g")); + } + + if ($$self.$$.dirty & /*include, regex*/ 72) { + { + $$invalidate(4, ducks = files.map(file => file.basename).filter(name => !mainG.neighbors(name).length && include === regex.test(name))); + } + } + + if ($$self.$$.dirty & /*ducks, query, include, regex*/ 92) { + console.log({ ducks, query, include, regex }); + } }; return [ - filteredSquaresArr, - settings, - matrixView, app, - currFile, + ducksView, + query, + include, + ducks, + plugin, + regex, + change_handler, + change_handler_1, click_handler, - mouseover_handler, - click_handler_1, - mouseover_handler_1 + mouseover_handler ]; } -class Lists extends SvelteComponent { +class Ducks extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-ifpk85-style")) add_css$6(); - - init(this, options, instance$a, create_fragment$a, safe_not_equal, { - filteredSquaresArr: 0, - currFile: 4, - settings: 1, - matrixView: 2, - app: 3 - }); + if (!document.getElementById("svelte-gmdm3a-style")) add_css$6(); + init(this, options, instance$b, create_fragment$b, safe_not_equal, { plugin: 5, app: 0, ducksView: 1 }); } } -/* src\Components\Matrix.svelte generated by Svelte v3.35.0 */ +class DucksView extends require$$0.ItemView { + constructor(leaf, plugin) { + super(leaf); + // TODO Duck icon + this.icon = "info"; + this.plugin = plugin; + } + async onload() { + super.onload(); + await this.plugin.saveSettings(); + this.app.workspace.onLayoutReady(async () => { + await this.draw(); + }); + } + getViewType() { + return DUCK_VIEW; + } + getDisplayText() { + return "Breadcrumbs Ducks"; + } + async onOpen() { } + onClose() { + if (this.view) { + this.view.$destroy(); + } + return Promise.resolve(); + } + async draw() { + this.contentEl.empty(); + this.view = new Ducks({ + target: this.contentEl, + props: { plugin: this.plugin, app: this.app, ducksView: this }, + }); + } +} + +/* src\Components\Lists.svelte generated by Svelte v3.35.0 */ function add_css$5() { var style = element("style"); - style.id = "svelte-sp0k97-style"; - style.textContent = "div.BC-Matrix.svelte-sp0k97.svelte-sp0k97{padding:5px}div.BC-Matrix.svelte-sp0k97>div.svelte-sp0k97{border:3px solid var(--background-modifier-border);border-radius:3px;text-align:center;margin:3px;position:relative;height:fit-content}div.BC-Matrix-square.svelte-sp0k97.svelte-sp0k97{border:1px solid var(--background-modifier-border)}div.BC-Matrix-headers.svelte-sp0k97.svelte-sp0k97{display:flex;justify-content:space-between;align-items:center}.BC-Matrix-header.svelte-sp0k97.svelte-sp0k97{margin:2px;padding:0px 10px}ol.svelte-sp0k97.svelte-sp0k97{margin:3px;padding-left:30px}"; + style.id = "svelte-ifpk85-style"; + style.textContent = "summary.hier-summary.svelte-ifpk85{color:var(--text-title-h2);font-size:larger}summary.svelte-ifpk85{color:var(--text-title-h3)}h5.BC-header.svelte-ifpk85{color:var(--text-title-h5)}ol.markdown-preview-view.svelte-ifpk85{padding-top:3px;padding-bottom:5px}"; append(document.head, style); } @@ -22582,47 +23377,38 @@ function get_each_context_3$1(ctx, list, i) { return child_ctx; } -// (16:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} -function create_if_block$2(ctx) { - let div1; - let div0; - let h4; +// (20:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} +function create_if_block$3(ctx) { + let details; + let summary; let t0_value = /*square*/ ctx[12].field + ""; let t0; let t1; let t2; - let t3; - let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_5(ctx); - let if_block1 = /*square*/ ctx[12].realItems.length && create_if_block_4(ctx); - let if_block2 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$1(ctx); + let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_3$1(ctx); + let if_block1 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$2(ctx); return { c() { - div1 = element("div"); - div0 = element("div"); - h4 = element("h4"); + details = element("details"); + summary = element("summary"); t0 = text(t0_value); t1 = space(); if (if_block0) if_block0.c(); t2 = space(); if (if_block1) if_block1.c(); - t3 = space(); - if (if_block2) if_block2.c(); - attr(h4, "class", "BC-Matrix-header svelte-sp0k97"); - attr(div0, "class", "BC-Matrix-headers svelte-sp0k97"); - attr(div1, "class", "BC-Matrix-square svelte-sp0k97"); + attr(summary, "class", "svelte-ifpk85"); + details.open = true; + attr(details, "class", "BC-details"); }, - m(target, anchor) { - insert(target, div1, anchor); - append(div1, div0); - append(div0, h4); - append(h4, t0); - append(div0, t1); - if (if_block0) if_block0.m(div0, null); - append(div1, t2); - if (if_block1) if_block1.m(div1, null); - append(div1, t3); - if (if_block2) if_block2.m(div1, null); + m(target, anchor) { + insert(target, details, anchor); + append(details, summary); + append(summary, t0); + append(details, t1); + if (if_block0) if_block0.m(details, null); + append(details, t2); + if (if_block1) if_block1.m(details, null); }, p(ctx, dirty) { if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = /*square*/ ctx[12].field + "")) set_data(t0, t0_value); @@ -22631,105 +23417,41 @@ function create_if_block$2(ctx) { if (if_block0) { if_block0.p(ctx, dirty); } else { - if_block0 = create_if_block_5(ctx); + if_block0 = create_if_block_3$1(ctx); if_block0.c(); - if_block0.m(div0, null); + if_block0.m(details, t2); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } - if (/*square*/ ctx[12].realItems.length) { + if (/*square*/ ctx[12].impliedItems.length) { if (if_block1) { if_block1.p(ctx, dirty); } else { - if_block1 = create_if_block_4(ctx); + if_block1 = create_if_block_1$2(ctx); if_block1.c(); - if_block1.m(div1, t3); + if_block1.m(details, null); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } - - if (/*square*/ ctx[12].impliedItems.length) { - if (if_block2) { - if_block2.p(ctx, dirty); - } else { - if_block2 = create_if_block_1$1(ctx); - if_block2.c(); - if_block2.m(div1, null); - } - } else if (if_block2) { - if_block2.d(1); - if_block2 = null; - } }, d(detaching) { - if (detaching) detach(div1); + if (detaching) detach(details); if (if_block0) if_block0.d(); if (if_block1) if_block1.d(); - if (if_block2) if_block2.d(); - } - }; -} - -// (20:14) {#if square.realItems.length} -function create_if_block_5(ctx) { - let if_block_anchor; - let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_6(); - - 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(ctx, dirty) { - if (/*settings*/ ctx[1].showRelationType) { - if (if_block) ; else { - if_block = create_if_block_6(); - 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); - } - }; -} - -// (21:16) {#if settings.showRelationType} -function create_if_block_6(ctx) { - let h6; - - return { - c() { - h6 = element("h6"); - h6.textContent = "Real"; - attr(h6, "class", "BC-Matrix-header svelte-sp0k97"); - }, - m(target, anchor) { - insert(target, h6, anchor); - }, - d(detaching) { - if (detaching) detach(h6); } }; } -// (26:12) {#if square.realItems.length} -function create_if_block_4(ctx) { +// (23:12) {#if square.realItems.length} +function create_if_block_3$1(ctx) { + let t; let ol; + let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_4$1(); let each_value_3 = /*square*/ ctx[12].realItems; let each_blocks = []; @@ -22739,15 +23461,19 @@ function create_if_block_4(ctx) { return { c() { + if (if_block) if_block.c(); + t = space(); ol = element("ol"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } - attr(ol, "class", "svelte-sp0k97"); + attr(ol, "class", "markdown-preview-view svelte-ifpk85"); }, m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, t, anchor); insert(target, ol, anchor); for (let i = 0; i < each_blocks.length; i += 1) { @@ -22755,6 +23481,17 @@ function create_if_block_4(ctx) { } }, p(ctx, dirty) { + if (/*settings*/ ctx[1].showRelationType) { + if (if_block) ; else { + if_block = create_if_block_4$1(); + if_block.c(); + if_block.m(t.parentNode, t); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView*/ 13) { each_value_3 = /*square*/ ctx[12].realItems; let i; @@ -22779,13 +23516,34 @@ function create_if_block_4(ctx) { } }, d(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach(t); if (detaching) detach(ol); destroy_each(each_blocks, detaching); } }; } -// (28:16) {#each square.realItems as realItem} +// (24:14) {#if settings.showRelationType} +function create_if_block_4$1(ctx) { + let h5; + + return { + c() { + h5 = element("h5"); + h5.textContent = "Real"; + attr(h5, "class", "BC-header svelte-ifpk85"); + }, + m(target, anchor) { + insert(target, h5, anchor); + }, + d(detaching) { + if (detaching) detach(h5); + } + }; +} + +// (29:16) {#each square.realItems as realItem} function create_each_block_3$1(ctx) { let li; let div; @@ -22810,7 +23568,7 @@ function create_each_block_3$1(ctx) { div = element("div"); t0 = text(t0_value); t1 = space(); - attr(div, "class", div_class_value = "" + (null_to_empty(/*realItem*/ ctx[18].cls) + " svelte-sp0k97")); + attr(div, "class", div_class_value = /*realItem*/ ctx[18].cls); }, m(target, anchor) { insert(target, li, anchor); @@ -22831,7 +23589,7 @@ function create_each_block_3$1(ctx) { ctx = new_ctx; if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = (/*realItem*/ ctx[18].alt ?? /*realItem*/ ctx[18].to.split("/").last()) + "")) set_data(t0, t0_value); - if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*realItem*/ ctx[18].cls) + " svelte-sp0k97"))) { + if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = /*realItem*/ ctx[18].cls)) { attr(div, "class", div_class_value); } }, @@ -22843,15 +23601,12 @@ function create_each_block_3$1(ctx) { }; } -// (43:12) {#if square.impliedItems.length} -function create_if_block_1$1(ctx) { - let div; - let h4; - let t0; - let t1; +// (44:12) {#if square.impliedItems.length} +function create_if_block_1$2(ctx) { + let t; let ol; let ol_start_value; - let if_block = /*square*/ ctx[12].impliedItems.length && create_if_block_2$1(ctx); + let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_2$2(); let each_value_2 = /*square*/ ctx[12].impliedItems; let each_blocks = []; @@ -22861,28 +23616,20 @@ function create_if_block_1$1(ctx) { return { c() { - div = element("div"); - h4 = element("h4"); - t0 = space(); if (if_block) if_block.c(); - t1 = space(); + t = space(); ol = element("ol"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } - attr(h4, "class", "BC-Matrix-header svelte-sp0k97"); - attr(div, "class", "BC-Matrix-headers svelte-sp0k97"); + attr(ol, "class", "markdown-preview-view svelte-ifpk85"); attr(ol, "start", ol_start_value = /*square*/ ctx[12].realItems.length + 1); - attr(ol, "class", "svelte-sp0k97"); }, m(target, anchor) { - insert(target, div, anchor); - append(div, h4); - append(div, t0); - if (if_block) if_block.m(div, null); - insert(target, t1, anchor); + if (if_block) if_block.m(target, anchor); + insert(target, t, anchor); insert(target, ol, anchor); for (let i = 0; i < each_blocks.length; i += 1) { @@ -22890,13 +23637,11 @@ function create_if_block_1$1(ctx) { } }, p(ctx, dirty) { - if (/*square*/ ctx[12].impliedItems.length) { - if (if_block) { - if_block.p(ctx, dirty); - } else { - if_block = create_if_block_2$1(ctx); + if (/*settings*/ ctx[1].showRelationType) { + if (if_block) ; else { + if_block = create_if_block_2$2(); if_block.c(); - if_block.m(div, null); + if_block.m(t.parentNode, t); } } else if (if_block) { if_block.d(1); @@ -22931,63 +23676,29 @@ function create_if_block_1$1(ctx) { } }, d(detaching) { - if (detaching) detach(div); - if (if_block) if_block.d(); - if (detaching) detach(t1); + if (if_block) if_block.d(detaching); + if (detaching) detach(t); if (detaching) detach(ol); destroy_each(each_blocks, detaching); } }; } -// (46:16) {#if square.impliedItems.length} -function create_if_block_2$1(ctx) { - let if_block_anchor; - let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_3(); - - 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(ctx, dirty) { - if (/*settings*/ ctx[1].showRelationType) { - if (if_block) ; else { - if_block = create_if_block_3(); - 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); - } - }; -} - -// (47:18) {#if settings.showRelationType} -function create_if_block_3(ctx) { - let h6; +// (45:14) {#if settings.showRelationType} +function create_if_block_2$2(ctx) { + let h5; return { c() { - h6 = element("h6"); - h6.textContent = "Implied"; - attr(h6, "class", "BC-Matrix-header svelte-sp0k97"); + h5 = element("h5"); + h5.textContent = "Implied"; + attr(h5, "class", "BC-header svelte-ifpk85"); }, m(target, anchor) { - insert(target, h6, anchor); + insert(target, h5, anchor); }, d(detaching) { - if (detaching) detach(h6); + if (detaching) detach(h5); } }; } @@ -23016,7 +23727,7 @@ function create_each_block_2$2(ctx) { li = element("li"); div = element("div"); t = text(t_value); - attr(div, "class", div_class_value = "" + (null_to_empty(/*impliedItem*/ ctx[15].cls) + " svelte-sp0k97")); + attr(div, "class", div_class_value = /*impliedItem*/ ctx[15].cls); attr(div, "aria-label", div_aria_label_value = /*impliedItem*/ ctx[15].parent ?? ""); attr(li, "class", "BC-Implied"); }, @@ -23038,7 +23749,7 @@ function create_each_block_2$2(ctx) { ctx = new_ctx; if (dirty & /*filteredSquaresArr*/ 1 && t_value !== (t_value = (/*impliedItem*/ ctx[15].alt ?? /*impliedItem*/ ctx[15].to.split("/").last()) + "")) set_data(t, t_value); - if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*impliedItem*/ ctx[15].cls) + " svelte-sp0k97"))) { + if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = /*impliedItem*/ ctx[15].cls)) { attr(div, "class", div_class_value); } @@ -23054,10 +23765,10 @@ function create_each_block_2$2(ctx) { }; } -// (15:6) {#each squares as square} +// (19:6) {#each squares as square} function create_each_block_1$6(ctx) { let if_block_anchor; - let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$2(ctx); + let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$3(ctx); return { c() { @@ -23073,7 +23784,7 @@ function create_each_block_1$6(ctx) { if (if_block) { if_block.p(ctx, dirty); } else { - if_block = create_if_block$2(ctx); + if_block = create_if_block$3(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } @@ -23091,8 +23802,12 @@ function create_each_block_1$6(ctx) { // (13:2) {#each filteredSquaresArr as squares} function create_each_block$6(ctx) { - let div; - let t; + let details; + let summary; + let t0_value = /*squares*/ ctx[9].map(func).join(", ") + ""; + let t0; + let t1; + let t2; let each_value_1 = /*squares*/ ctx[9]; let each_blocks = []; @@ -23102,25 +23817,34 @@ function create_each_block$6(ctx) { return { c() { - div = element("div"); + details = element("details"); + summary = element("summary"); + t0 = text(t0_value); + t1 = space(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } - t = space(); - attr(div, "class", "svelte-sp0k97"); + t2 = space(); + attr(summary, "class", "hier-summary svelte-ifpk85"); + details.open = true; }, m(target, anchor) { - insert(target, div, anchor); + insert(target, details, anchor); + append(details, summary); + append(summary, t0); + append(details, t1); for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); + each_blocks[i].m(details, null); } - append(div, t); + append(details, t2); }, p(ctx, dirty) { + if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = /*squares*/ ctx[9].map(func).join(", ") + "")) set_data(t0, t0_value); + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView, settings*/ 15) { each_value_1 = /*squares*/ ctx[9]; let i; @@ -23133,7 +23857,7 @@ function create_each_block$6(ctx) { } else { each_blocks[i] = create_each_block_1$6(child_ctx); each_blocks[i].c(); - each_blocks[i].m(div, t); + each_blocks[i].m(details, t2); } } @@ -23145,13 +23869,13 @@ function create_each_block$6(ctx) { } }, d(detaching) { - if (detaching) detach(div); + if (detaching) detach(details); destroy_each(each_blocks, detaching); } }; } -function create_fragment$9(ctx) { +function create_fragment$a(ctx) { let div; let each_value = /*filteredSquaresArr*/ ctx[0]; let each_blocks = []; @@ -23168,7 +23892,7 @@ function create_fragment$9(ctx) { each_blocks[i].c(); } - attr(div, "class", "BC-Matrix markdown-preview-view svelte-sp0k97"); + attr(div, "class", "BC-list"); }, m(target, anchor) { insert(target, div, anchor); @@ -23206,913 +23930,429 @@ function create_fragment$9(ctx) { d(detaching) { if (detaching) detach(div); destroy_each(each_blocks, detaching); - } - }; -} - -function instance$9($$self, $$props, $$invalidate) { - - - - let { filteredSquaresArr } = $$props; - let { currFile } = $$props; - let { settings } = $$props; - let { matrixView } = $$props; - let { app } = $$props; - const click_handler = async (realItem, e) => openOrSwitch(app, realItem.to, e); - const mouseover_handler = (realItem, event) => hoverPreview(event, matrixView, realItem.to); - const click_handler_1 = async (impliedItem, e) => openOrSwitch(app, impliedItem.to, e); - const mouseover_handler_1 = (impliedItem, e) => hoverPreview(e, matrixView, impliedItem.to); - - $$self.$$set = $$props => { - if ("filteredSquaresArr" in $$props) $$invalidate(0, filteredSquaresArr = $$props.filteredSquaresArr); - if ("currFile" in $$props) $$invalidate(4, currFile = $$props.currFile); - if ("settings" in $$props) $$invalidate(1, settings = $$props.settings); - if ("matrixView" in $$props) $$invalidate(2, matrixView = $$props.matrixView); - if ("app" in $$props) $$invalidate(3, app = $$props.app); - }; - - return [ - filteredSquaresArr, - settings, - matrixView, - app, - currFile, - click_handler, - mouseover_handler, - click_handler_1, - mouseover_handler_1 - ]; -} - -class Matrix extends SvelteComponent { - constructor(options) { - super(); - if (!document.getElementById("svelte-sp0k97-style")) add_css$5(); - - init(this, options, instance$9, create_fragment$9, safe_not_equal, { - filteredSquaresArr: 0, - currFile: 4, - settings: 1, - matrixView: 2, - app: 3 - }); - } -} - -function normalise(arr) { - const max = Math.max(...arr); - return arr.map((item) => item / max); -} -/** - * Get basename from a **Markdown** `path` - * @param {string} path - */ -const getBaseFromMDPath = (path) => { - const splitSlash = path.split("/").last(); - if (splitSlash.endsWith(".md")) { - return splitSlash.split(".md").slice(0, -1).join("."); - } - else - return splitSlash; -}; -const getDVBasename = (file) => file.basename || file.name; -const getFolder = (file) => { var _a; -//@ts-ignore -return ((_a = file === null || file === void 0 ? void 0 : file.parent) === null || _a === void 0 ? void 0 : _a.name) || file.folder; }; -const splitAndTrim = (fields) => { - if (fields === "") - return []; - else - return fields.split(",").map((str) => str.trim()); -}; -function padArray(arr, finalLength, filler = "") { - const copy = [...arr]; - const currLength = copy.length; - if (currLength > finalLength) { - throw new Error("Current length is greater than final length"); - } - else if (currLength === finalLength) { - return copy; - } - else { - for (let i = currLength; i < finalLength; i++) { - copy.push(filler); - } - return copy; - } -} -function transpose(A) { - const cols = A[0].length; - const AT = []; - // For each column - for (let j = 0; j < cols; j++) { - // Add a new row to AT - AT.push([]); - // And fill it with the values in the jth column of A - A.forEach((row) => AT[j].push(row[j])); - } - return AT; -} -function runs(arr) { - const runs = []; - let i = 0; - while (i < arr.length) { - const currValue = arr[i]; - runs.push({ value: currValue, first: i, last: undefined }); - while (currValue === arr[i]) { - i++; - } - runs.last().last = i - 1; - } - return runs; -} -function makeWiki(str, wikiQ = true) { - let copy = str.slice(); - if (wikiQ) { - copy = "[[" + copy; - copy += "]]"; - } - return copy; -} -function dropWikilinks(str) { - let copy = str.slice(); - if (copy.startsWith("[[") && copy.endsWith("]]")) - copy = copy.slice(2, -2); - return copy; -} -/** - * Get all the fields in `dir`. - * Returns all fields if `dir === 'all'` - * @param {UserHier[]} userHiers - * @param {Directions|"all"} dir - */ -function getFields(userHiers, dir = "all") { - const fields = []; - userHiers.forEach((hier) => { - if (dir === "all") { - DIRECTIONS.forEach((eachDir) => { - fields.push(...hier[eachDir]); - }); - } - else { - fields.push(...hier[dir]); - } - }); - return fields; -} -const hierToStr = (hier) => DIRECTIONS.map((dir) => `${ARROW_DIRECTIONS[dir]}: ${hier[dir].join(", ")}`).join("\n"); -/** - * Adds or updates the given yaml `key` to `value` in the given TFile - * @param {string} key - * @param {string} value - * @param {TFile} file - * @param {FrontMatterCache|undefined} frontmatter - * @param {MetaeditApi} api - */ -const createOrUpdateYaml = async (key, value, file, frontmatter, api) => { - const valueStr = value.toString(); - if (!frontmatter || frontmatter[key] === undefined) { - console.log(`Creating: ${key}: ${valueStr}`); - await api.createYamlProperty(key, `['${valueStr}']`, file); - } - else if ([...[frontmatter[key]]].flat(3).some((val) => val == valueStr)) { - console.log("Already Exists!"); - return; - } - else { - const oldValueFlat = [...[frontmatter[key]]].flat(4); - const newValue = [...oldValueFlat, `'${valueStr}'`]; - console.log(`Updating: ${key}: ${newValue}`); - await api.update(key, `[${newValue.join(", ")}]`, file); - } -}; -function splitAtYaml(content) { - const startsWithYaml = content.startsWith("---"); - if (!startsWithYaml) - return ["", content]; - else { - const splits = content.split("---"); - return [ - splits.slice(0, 2).join("---") + "---", - splits.slice(2).join("---"), - ]; - } -} -function swapItems(i, j, arr) { - const max = arr.length - 1; - if (i < 0 || i > max || j < 0 || j > max) - return arr; - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; - return arr; -} -const linkClass = (app, to, realQ = true) => `internal-link BC-Link ${isInVault(app, to) ? "" : "is-unresolved"} ${realQ ? "" : "BC-Implied"}`; -/** Remember to filter by hierarchy in MatrixView! */ -function getRealnImplied(plugin, currNode, dir = null) { - const realsnImplieds = blankRealNImplied(); - const { userHiers } = plugin.settings; - plugin.mainG.forEachEdge(currNode, (k, a, s, t) => { - const { field, dir: edgeDir } = a; - const oppField = getOppFields(userHiers, field)[0]; - (dir ? [dir, getOppDir(dir)] : DIRECTIONS).forEach((currDir) => { - const oppDir = getOppDir(currDir); - // Reals - if (s === currNode && (edgeDir === currDir || edgeDir === oppDir)) { - const arr = realsnImplieds[edgeDir].reals; - if (arr.findIndex((item) => item.to === t) === -1) { - arr.push({ to: t, real: true, field }); - } - } - // Implieds - // If `s !== currNode` then `t` must be - else if (edgeDir === currDir || edgeDir === oppDir) { - const arr = realsnImplieds[getOppDir(edgeDir)].implieds; - if (arr.findIndex((item) => item.to === s) === -1) { - arr.push({ - to: s, - real: false, - field: oppField, - }); - } - } - }); - }); - return realsnImplieds; -} -function iterateHiers(userHiers, fn) { - userHiers.forEach((hier) => { - DIRECTIONS.forEach((dir) => { - hier[dir].forEach((field) => { - fn(hier, dir, field); - }); - }); - }); + } + }; } -class MatrixView extends require$$0.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.icon = TRAIL_ICON; - this.toInternalLinkObj = (to, realQ = true, parent) => { - return { - to, - cls: linkClass(this.app, to, realQ), - alt: this.getAlt(to, this.plugin.settings), - order: this.getOrder(to), - parent, - }; - }; - this.getOrder = (node) => Number.parseInt(this.plugin.mainG.getNodeAttribute(node, "order")); - this.plugin = plugin; - this.db = new Debugger(plugin); - } - async onload() { - super.onload(); - this.matrixQ = this.plugin.settings.defaultView; - this.app.workspace.onLayoutReady(async () => { - setTimeout(async () => await this.draw(), this.app.plugins.plugins.dataview - ? this.app.plugins.plugins.dataview.api - ? 1 - : this.plugin.settings.dvWaitTime - : 3000); - }); - } - getViewType() { - return MATRIX_VIEW; - } - getDisplayText() { - return "Breadcrumbs Matrix"; - } - async onOpen() { } - onClose() { - var _a; - (_a = this.view) === null || _a === void 0 ? void 0 : _a.$destroy(); - return Promise.resolve(); - } - getAlt(node, settings) { - let alt = null; - if (settings.altLinkFields.length) { - const file = this.app.metadataCache.getFirstLinkpathDest(node, ""); - if (file) { - const metadata = this.app.metadataCache.getFileCache(file); - settings.altLinkFields.forEach((altLinkField) => { - var _a; - alt = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.frontmatter) === null || _a === void 0 ? void 0 : _a[altLinkField]; - }); - } - } - return alt; - } - // ANCHOR Remove duplicate implied links - removeDuplicateImplied(reals, implieds) { - const realTos = reals.map((real) => real.to); - return implieds.filter((implied) => !realTos.includes(implied.to)); - } - getHierSquares(userHiers, currFile, settings) { - const { plugin } = this; - const { mainG } = plugin; - if (!mainG) { - new require$$0.Notice("Breadcrumbs graph was not initialised yet. Please Refresh Index"); - return []; - } - const { basename } = currFile; - const realsnImplieds = getRealnImplied(plugin, basename); - return userHiers.map((hier) => { - const filteredRealNImplied = blankRealNImplied(); - for (const dir in realsnImplieds) { - const { reals, implieds } = realsnImplieds[dir]; - filteredRealNImplied[dir].reals = reals - .filter((real) => hier[dir].includes(real.field)) - .map((item) => this.toInternalLinkObj(item.to, true)); - filteredRealNImplied[dir].implieds = implieds - .filter((implied) => hier[dir].includes(implied.field)) - .map((item) => this.toInternalLinkObj(item.to, false)); - } - let { up: { reals: ru, implieds: iu }, same: { reals: rs, implieds: is }, down: { reals: rd, implieds: id }, next: { reals: rn, implieds: iN }, prev: { reals: rp, implieds: ip }, } = filteredRealNImplied; - // SECTION Implied Siblings - /// Notes with the same parents - const g = getSubInDirs(mainG, "up", "down"); - const closed = getReflexiveClosure(g, userHiers); - const closedUp = getSubInDirs(closed, "up"); - let iSameArr = []; - const currParents = closedUp.hasNode(basename) - ? closedUp.filterOutNeighbors(basename, (n, a) => hier.up.includes(a.field)) - : []; - currParents.forEach((parent) => { - let impliedSiblings = []; - // const { field } = up.getEdgeAttributes(basename, parent); - closedUp.forEachInEdge(parent, (k, a, s, t) => { - if (s === basename) - return; - // if (!settings.filterImpliedSiblingsOfDifferentTypes) - impliedSiblings.push(s); - // else if (a.field === field) { - // impliedSiblings.push(s); - // } - }); - impliedSiblings.forEach((impliedSibling) => { - iSameArr.push(this.toInternalLinkObj(impliedSibling, false, parent)); - }); - }); - /// A real sibling implies the reverse sibling - iSameArr.push(...is); - // !SECTION - iu = this.removeDuplicateImplied(ru, iu); - iSameArr = this.removeDuplicateImplied(rs, iSameArr); - id = this.removeDuplicateImplied(rd, id); - iN = this.removeDuplicateImplied(rn, iN); - ip = this.removeDuplicateImplied(rp, ip); - const iSameNoDup = []; - iSameArr.forEach((impSib) => { - if (iSameNoDup.every((noDup) => noDup.to !== impSib.to)) { - iSameNoDup.push(impSib); - } - }); - iSameArr = iSameNoDup; - const getFieldInHier = (dir) => hier[dir][0] - ? hier[dir].join(", ") - : `${hier[getOppDir(dir)].join(",")}${ARROW_DIRECTIONS[dir]}`; - const { alphaSortAsc } = settings; - [ru, rs, rd, rn, rp, iu, iSameArr, id, iN, ip].forEach((a) => a - .sort((a, b) => a.to < b.to ? (alphaSortAsc ? -1 : 1) : alphaSortAsc ? 1 : -1) - .sort((a, b) => a.order - b.order)); - loglevel.debug({ ru }, { rs }, { rd }, { rn }, { rp }, { iu }, { iSameArr }, { id }, { iN }, { ip }); - return [ - { - realItems: ru, - impliedItems: iu, - field: getFieldInHier("up"), - }, - { - realItems: rs, - impliedItems: iSameArr, - field: getFieldInHier("same"), - }, - { - realItems: rd, - impliedItems: id, - field: getFieldInHier("down"), - }, - { - realItems: rn, - impliedItems: iN, - field: getFieldInHier("next"), - }, - { - realItems: rp, - impliedItems: ip, - field: getFieldInHier("prev"), - }, - ]; - }); - } - async draw() { - try { - const { contentEl, db } = this; - db.start2G("Draw Matrix/List View"); - contentEl.empty(); - const { settings } = this.plugin; - const { userHiers } = settings; - const currFile = this.app.workspace.getActiveFile(); - contentEl.createEl("button", { - text: this.matrixQ ? "List" : "Matrix", - }, (el) => { - el.onclick = async () => { - this.matrixQ = !this.matrixQ; - el.innerText = this.matrixQ ? "List" : "Matrix"; - await this.draw(); - }; - }); - contentEl.createEl("button", { text: "↻" }, (el) => { - el.onclick = async () => await this.plugin.refreshIndex(); - }); - const hierSquares = this.getHierSquares(userHiers, currFile, settings).filter((squareArr) => squareArr.some((square) => square.realItems.length + square.impliedItems.length > 0)); - const compInput = { - target: contentEl, - props: { - filteredSquaresArr: hierSquares, - currFile, - settings, - matrixView: this, - app: this.app, - }, - }; - this.matrixQ - ? (this.view = new Matrix(compInput)) - : (this.view = new Lists(compInput)); - db.end2G(); - } - catch (err) { - loglevel.error(err); - this.db.end2G(); - } - } +const func = square => square.field; + +function instance$a($$self, $$props, $$invalidate) { + + + + let { filteredSquaresArr } = $$props; + let { currFile } = $$props; + let { settings } = $$props; + let { matrixView } = $$props; + let { app } = $$props; + const click_handler = async (realItem, e) => openOrSwitch(app, realItem.to, e); + const mouseover_handler = (realItem, e) => hoverPreview(e, matrixView, realItem.to); + const click_handler_1 = async (impliedItem, e) => openOrSwitch(app, impliedItem.to, e); + const mouseover_handler_1 = (impliedItem, e) => hoverPreview(e, matrixView, impliedItem.to); + + $$self.$$set = $$props => { + if ("filteredSquaresArr" in $$props) $$invalidate(0, filteredSquaresArr = $$props.filteredSquaresArr); + if ("currFile" in $$props) $$invalidate(4, currFile = $$props.currFile); + if ("settings" in $$props) $$invalidate(1, settings = $$props.settings); + if ("matrixView" in $$props) $$invalidate(2, matrixView = $$props.matrixView); + if ("app" in $$props) $$invalidate(3, app = $$props.app); + }; + + return [ + filteredSquaresArr, + settings, + matrixView, + app, + currFile, + click_handler, + mouseover_handler, + click_handler_1, + mouseover_handler_1 + ]; } -/* src\Components\Stats.svelte generated by Svelte v3.35.0 */ +class Lists extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-ifpk85-style")) add_css$5(); + + init(this, options, instance$a, create_fragment$a, safe_not_equal, { + filteredSquaresArr: 0, + currFile: 4, + settings: 1, + matrixView: 2, + app: 3 + }); + } +} + +/* src\Components\Matrix.svelte generated by Svelte v3.35.0 */ function add_css$4() { var style = element("style"); - style.id = "svelte-rb5mhu-style"; - style.textContent = "table.svelte-rb5mhu{border-collapse:collapse}td.svelte-rb5mhu:first-child{text-align:right}td.svelte-rb5mhu,th.svelte-rb5mhu{padding:3px;border:1px solid var(--background-modifier-border);white-space:pre-line}"; + style.id = "svelte-sp0k97-style"; + style.textContent = "div.BC-Matrix.svelte-sp0k97.svelte-sp0k97{padding:5px}div.BC-Matrix.svelte-sp0k97>div.svelte-sp0k97{border:3px solid var(--background-modifier-border);border-radius:3px;text-align:center;margin:3px;position:relative;height:fit-content}div.BC-Matrix-square.svelte-sp0k97.svelte-sp0k97{border:1px solid var(--background-modifier-border)}div.BC-Matrix-headers.svelte-sp0k97.svelte-sp0k97{display:flex;justify-content:space-between;align-items:center}.BC-Matrix-header.svelte-sp0k97.svelte-sp0k97{margin:2px;padding:0px 10px}ol.svelte-sp0k97.svelte-sp0k97{margin:3px;padding-left:30px}"; append(document.head, style); } function get_each_context$5(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; + child_ctx[9] = list[i]; return child_ctx; } function get_each_context_1$5(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; + child_ctx[12] = list[i]; return child_ctx; } function get_each_context_2$1(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; + child_ctx[15] = list[i]; return child_ctx; } function get_each_context_3(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[35] = list[i]; - child_ctx[37] = i; + child_ctx[18] = list[i]; return child_ctx; } -function get_each_context_4(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; - return child_ctx; -} +// (16:8) {#if square.realItems.length > 0 || square.impliedItems.length > 0} +function create_if_block$2(ctx) { + let div1; + let div0; + let h4; + let t0_value = /*square*/ ctx[12].field + ""; + let t0; + let t1; + let t2; + let t3; + let if_block0 = /*square*/ ctx[12].realItems.length && create_if_block_5(ctx); + let if_block1 = /*square*/ ctx[12].realItems.length && create_if_block_4(ctx); + let if_block2 = /*square*/ ctx[12].impliedItems.length && create_if_block_1$1(ctx); -function get_each_context_5(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; - return child_ctx; -} + return { + c() { + div1 = element("div"); + div0 = element("div"); + h4 = element("h4"); + t0 = text(t0_value); + t1 = space(); + if (if_block0) if_block0.c(); + t2 = space(); + if (if_block1) if_block1.c(); + t3 = space(); + if (if_block2) if_block2.c(); + attr(h4, "class", "BC-Matrix-header svelte-sp0k97"); + attr(div0, "class", "BC-Matrix-headers svelte-sp0k97"); + attr(div1, "class", "BC-Matrix-square svelte-sp0k97"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + append(div0, h4); + append(h4, t0); + append(div0, t1); + if (if_block0) if_block0.m(div0, null); + append(div1, t2); + if (if_block1) if_block1.m(div1, null); + append(div1, t3); + if (if_block2) if_block2.m(div1, null); + }, + p(ctx, dirty) { + if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = /*square*/ ctx[12].field + "")) set_data(t0, t0_value); -function get_each_context_6(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; - return child_ctx; -} + if (/*square*/ ctx[12].realItems.length) { + if (if_block0) { + if_block0.p(ctx, dirty); + } else { + if_block0 = create_if_block_5(ctx); + if_block0.c(); + if_block0.m(div0, null); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } -function get_each_context_7(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[28] = list[i]; - return child_ctx; + if (/*square*/ ctx[12].realItems.length) { + if (if_block1) { + if_block1.p(ctx, dirty); + } else { + if_block1 = create_if_block_4(ctx); + if_block1.c(); + if_block1.m(div1, t3); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + + if (/*square*/ ctx[12].impliedItems.length) { + if (if_block2) { + if_block2.p(ctx, dirty); + } else { + if_block2 = create_if_block_1$1(ctx); + if_block2.c(); + if_block2.m(div1, null); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + }, + d(detaching) { + if (detaching) detach(div1); + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + if (if_block2) if_block2.d(); + } + }; } -// (94:4) {#each DIRECTIONS as dir} -function create_each_block_7(ctx) { - let td; - let t_value = ARROW_DIRECTIONS[/*dir*/ ctx[28]] + ""; - let t; +// (20:14) {#if square.realItems.length} +function create_if_block_5(ctx) { + let if_block_anchor; + let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_6(); return { c() { - td = element("td"); - t = text(t_value); - attr(td, "class", "svelte-rb5mhu"); + if (if_block) if_block.c(); + if_block_anchor = empty(); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t); + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx, dirty) { + if (/*settings*/ ctx[1].showRelationType) { + if (if_block) ; else { + if_block = create_if_block_6(); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } }, - p: noop, d(detaching) { - if (detaching) detach(td); + if (if_block) if_block.d(detaching); + if (detaching) detach(if_block_anchor); } }; } -// (106:6) {#each DIRECTIONS as dir} -function create_each_block_6(ctx) { - let td; - let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.nodes.length + ""; - let t0; - let t1; - let td_aria_label_value; - let mounted; - let dispose; - - function click_handler_1() { - return /*click_handler_1*/ ctx[6](/*i*/ ctx[37], /*dir*/ ctx[28]); - } +// (21:16) {#if settings.showRelationType} +function create_if_block_6(ctx) { + let h6; return { c() { - td = element("td"); - t0 = text(t0_value); - t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.nodesStr); - attr(td, "class", "svelte-rb5mhu"); + h6 = element("h6"); + h6.textContent = "Real"; + attr(h6, "class", "BC-Matrix-header svelte-sp0k97"); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); - - if (!mounted) { - dispose = listen(td, "click", click_handler_1); - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; + insert(target, h6, anchor); }, d(detaching) { - if (detaching) detach(td); - mounted = false; - dispose(); + if (detaching) detach(h6); } }; } -// (127:6) {#each DIRECTIONS as dir} -function create_each_block_5(ctx) { - let td; - let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.edges.length + ""; - let t0; - let t1; - let td_aria_label_value; - let mounted; - let dispose; +// (26:12) {#if square.realItems.length} +function create_if_block_4(ctx) { + let ol; + let each_value_3 = /*square*/ ctx[12].realItems; + let each_blocks = []; - function click_handler_3() { - return /*click_handler_3*/ ctx[9](/*i*/ ctx[37], /*dir*/ ctx[28]); + for (let i = 0; i < each_value_3.length; i += 1) { + each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i)); } return { c() { - td = element("td"); - t0 = text(t0_value); - t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Merged.edgesStr); - attr(td, "class", "svelte-rb5mhu"); + ol = element("ol"); + + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + + attr(ol, "class", "svelte-sp0k97"); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); + insert(target, ol, anchor); - if (!mounted) { - dispose = listen(td, "click", click_handler_3); - mounted = true; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(ol, null); } }, - p(new_ctx, dirty) { - ctx = new_ctx; + p(ctx, dirty) { + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView*/ 13) { + each_value_3 = /*square*/ ctx[12].realItems; + let i; + + for (i = 0; i < each_value_3.length; i += 1) { + const child_ctx = get_each_context_3(ctx, each_value_3, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_3(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, null); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_3.length; + } }, d(detaching) { - if (detaching) detach(td); - mounted = false; - dispose(); + if (detaching) detach(ol); + destroy_each(each_blocks, detaching); } }; } -// (148:6) {#each DIRECTIONS as dir} -function create_each_block_4(ctx) { - let td; - let t0_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Implied.edges.length + ""; +// (28:16) {#each square.realItems as realItem} +function create_each_block_3(ctx) { + let li; + let div; + let t0_value = (/*realItem*/ ctx[18].alt ?? /*realItem*/ ctx[18].to.split("/").last()) + ""; let t0; + let div_class_value; let t1; - let td_aria_label_value; let mounted; let dispose; - function click_handler_5() { - return /*click_handler_5*/ ctx[12](/*i*/ ctx[37], /*dir*/ ctx[28]); + function click_handler(...args) { + return /*click_handler*/ ctx[5](/*realItem*/ ctx[18], ...args); + } + + function mouseover_handler(...args) { + return /*mouseover_handler*/ ctx[6](/*realItem*/ ctx[18], ...args); } return { c() { - td = element("td"); + li = element("li"); + div = element("div"); t0 = text(t0_value); t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2][/*i*/ ctx[37]][/*dir*/ ctx[28]].Implied.edgesStr); - attr(td, "class", "svelte-rb5mhu"); + attr(div, "class", div_class_value = "" + (null_to_empty(/*realItem*/ ctx[18].cls) + " svelte-sp0k97")); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); + insert(target, li, anchor); + append(li, div); + append(div, t0); + append(li, t1); if (!mounted) { - dispose = listen(td, "click", click_handler_5); + dispose = [ + listen(div, "click", click_handler), + listen(div, "mouseover", mouseover_handler) + ]; + mounted = true; } }, p(new_ctx, dirty) { ctx = new_ctx; + if (dirty & /*filteredSquaresArr*/ 1 && t0_value !== (t0_value = (/*realItem*/ ctx[18].alt ?? /*realItem*/ ctx[18].to.split("/").last()) + "")) set_data(t0, t0_value); + + if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*realItem*/ ctx[18].cls) + " svelte-sp0k97"))) { + attr(div, "class", div_class_value); + } }, d(detaching) { - if (detaching) detach(td); + if (detaching) detach(li); mounted = false; - dispose(); + run_all(dispose); } }; } -// (100:2) {#each userHiers as hier, i} -function create_each_block_3(ctx) { - let tr0; - let td0; - let t0_value = /*hierStrs*/ ctx[4][/*i*/ ctx[37]] + ""; +// (43:12) {#if square.impliedItems.length} +function create_if_block_1$1(ctx) { + let div; + let h4; let t0; let t1; - let td1; - let t3; - let t4; - let td2; - let t5_value = lodash.sum(DIRECTIONS.map(func)) + ""; - let t5; - let td2_aria_label_value; - let t6; - let tr1; - let td3; - let t8; - let t9; - let td4; - let t10_value = lodash.sum(DIRECTIONS.map(func_1)) + ""; - let t10; - let td4_aria_label_value; - let t11; - let tr2; - let td5; - let t13; - let t14; - let td6; - let t15_value = lodash.sum(DIRECTIONS.map(func_2)) + ""; - let t15; - let td6_aria_label_value; - let mounted; - let dispose; - let each_value_6 = DIRECTIONS; - let each_blocks_2 = []; - - for (let i = 0; i < each_value_6.length; i += 1) { - each_blocks_2[i] = create_each_block_6(get_each_context_6(ctx, each_value_6, i)); - } - - function func(...args) { - return /*func*/ ctx[7](/*i*/ ctx[37], ...args); - } - - function click_handler_2() { - return /*click_handler_2*/ ctx[8](/*i*/ ctx[37]); - } - - let each_value_5 = DIRECTIONS; - let each_blocks_1 = []; - - for (let i = 0; i < each_value_5.length; i += 1) { - each_blocks_1[i] = create_each_block_5(get_each_context_5(ctx, each_value_5, i)); - } - - function func_1(...args) { - return /*func_1*/ ctx[10](/*i*/ ctx[37], ...args); - } - - function click_handler_4() { - return /*click_handler_4*/ ctx[11](/*i*/ ctx[37]); - } - - let each_value_4 = DIRECTIONS; + let ol; + let ol_start_value; + let if_block = /*square*/ ctx[12].impliedItems.length && create_if_block_2$1(ctx); + let each_value_2 = /*square*/ ctx[12].impliedItems; let each_blocks = []; - for (let i = 0; i < each_value_4.length; i += 1) { - each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i)); - } - - function func_2(...args) { - return /*func_2*/ ctx[13](/*i*/ ctx[37], ...args); - } - - function click_handler_6() { - return /*click_handler_6*/ ctx[14](/*i*/ ctx[37]); + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks[i] = create_each_block_2$1(get_each_context_2$1(ctx, each_value_2, i)); } return { c() { - tr0 = element("tr"); - td0 = element("td"); - t0 = text(t0_value); + div = element("div"); + h4 = element("h4"); + t0 = space(); + if (if_block) if_block.c(); t1 = space(); - td1 = element("td"); - td1.textContent = "Nodes"; - t3 = space(); - - for (let i = 0; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].c(); - } - - t4 = space(); - td2 = element("td"); - t5 = text(t5_value); - t6 = space(); - tr1 = element("tr"); - td3 = element("td"); - td3.textContent = "Real Edges"; - t8 = space(); - - for (let i = 0; i < each_blocks_1.length; i += 1) { - each_blocks_1[i].c(); - } - - t9 = space(); - td4 = element("td"); - t10 = text(t10_value); - t11 = space(); - tr2 = element("tr"); - td5 = element("td"); - td5.textContent = "Implied Edges"; - t13 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t14 = space(); - td6 = element("td"); - t15 = text(t15_value); - attr(td0, "rowspan", "3"); - attr(td0, "class", "svelte-rb5mhu"); - attr(td1, "class", "svelte-rb5mhu"); - attr(td2, "aria-label-position", "left"); - attr(td2, "aria-label", td2_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Merged", "nodesStr")); - attr(td2, "class", "svelte-rb5mhu"); - attr(td3, "class", "svelte-rb5mhu"); - attr(td4, "aria-label-position", "left"); - attr(td4, "aria-label", td4_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Merged", "edgesStr")); - attr(td4, "class", "svelte-rb5mhu"); - attr(td5, "class", "svelte-rb5mhu"); - attr(td6, "aria-label-position", "left"); - attr(td6, "aria-label", td6_aria_label_value = /*cellStr*/ ctx[3](/*i*/ ctx[37], "Implied", "edgesStr")); - attr(td6, "class", "svelte-rb5mhu"); - }, - m(target, anchor) { - insert(target, tr0, anchor); - append(tr0, td0); - append(td0, t0); - append(tr0, t1); - append(tr0, td1); - append(tr0, t3); - - for (let i = 0; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].m(tr0, null); - } - - append(tr0, t4); - append(tr0, td2); - append(td2, t5); - insert(target, t6, anchor); - insert(target, tr1, anchor); - append(tr1, td3); - append(tr1, t8); - - for (let i = 0; i < each_blocks_1.length; i += 1) { - each_blocks_1[i].m(tr1, null); - } - - append(tr1, t9); - append(tr1, td4); - append(td4, t10); - insert(target, t11, anchor); - insert(target, tr2, anchor); - append(tr2, td5); - append(tr2, t13); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(tr2, null); - } - - append(tr2, t14); - append(tr2, td6); - append(td6, t15); - - if (!mounted) { - dispose = [ - listen(td2, "click", click_handler_2), - listen(td4, "click", click_handler_4), - listen(td6, "click", click_handler_6) - ]; - - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - - if (dirty[0] & /*data*/ 4) { - each_value_6 = DIRECTIONS; - let i; - - for (i = 0; i < each_value_6.length; i += 1) { - const child_ctx = get_each_context_6(ctx, each_value_6, i); - - if (each_blocks_2[i]) { - each_blocks_2[i].p(child_ctx, dirty); - } else { - each_blocks_2[i] = create_each_block_6(child_ctx); - each_blocks_2[i].c(); - each_blocks_2[i].m(tr0, t4); - } - } - - for (; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].d(1); - } + ol = element("ol"); - each_blocks_2.length = each_value_6.length; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); } - if (dirty[0] & /*data*/ 4) { - each_value_5 = DIRECTIONS; - let i; - - for (i = 0; i < each_value_5.length; i += 1) { - const child_ctx = get_each_context_5(ctx, each_value_5, i); - - if (each_blocks_1[i]) { - each_blocks_1[i].p(child_ctx, dirty); - } else { - each_blocks_1[i] = create_each_block_5(child_ctx); - each_blocks_1[i].c(); - each_blocks_1[i].m(tr1, t9); - } - } + attr(h4, "class", "BC-Matrix-header svelte-sp0k97"); + attr(div, "class", "BC-Matrix-headers svelte-sp0k97"); + attr(ol, "start", ol_start_value = /*square*/ ctx[12].realItems.length + 1); + attr(ol, "class", "svelte-sp0k97"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, h4); + append(div, t0); + if (if_block) if_block.m(div, null); + insert(target, t1, anchor); + insert(target, ol, anchor); - for (; i < each_blocks_1.length; i += 1) { - each_blocks_1[i].d(1); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(ol, null); + } + }, + p(ctx, dirty) { + if (/*square*/ ctx[12].impliedItems.length) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_2$1(ctx); + if_block.c(); + if_block.m(div, null); } - - each_blocks_1.length = each_value_5.length; + } else if (if_block) { + if_block.d(1); + if_block = null; } - if (dirty[0] & /*data*/ 4) { - each_value_4 = DIRECTIONS; + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView*/ 13) { + each_value_2 = /*square*/ ctx[12].impliedItems; let i; - for (i = 0; i < each_value_4.length; i += 1) { - const child_ctx = get_each_context_4(ctx, each_value_4, i); + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2$1(ctx, each_value_2, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { - each_blocks[i] = create_each_block_4(child_ctx); + each_blocks[i] = create_each_block_2$1(child_ctx); each_blocks[i].c(); - each_blocks[i].m(tr2, t14); + each_blocks[i].m(ol, null); } } @@ -24120,243 +24360,237 @@ function create_each_block_3(ctx) { each_blocks[i].d(1); } - each_blocks.length = each_value_4.length; + each_blocks.length = each_value_2.length; + } + + if (dirty & /*filteredSquaresArr*/ 1 && ol_start_value !== (ol_start_value = /*square*/ ctx[12].realItems.length + 1)) { + attr(ol, "start", ol_start_value); } }, d(detaching) { - if (detaching) detach(tr0); - destroy_each(each_blocks_2, detaching); - if (detaching) detach(t6); - if (detaching) detach(tr1); - destroy_each(each_blocks_1, detaching); - if (detaching) detach(t11); - if (detaching) detach(tr2); + if (detaching) detach(div); + if (if_block) if_block.d(); + if (detaching) detach(t1); + if (detaching) detach(ol); destroy_each(each_blocks, detaching); - mounted = false; - run_all(dispose); } }; } -// (171:4) {#each DIRECTIONS as dir} -function create_each_block_2$1(ctx) { - let td; - let t0_value = lodash.sum(/*data*/ ctx[2].map(func_3)) + ""; - let t0; - let t1; - let td_aria_label_value; - let mounted; - let dispose; - - function func_3(...args) { - return /*func_3*/ ctx[15](/*dir*/ ctx[28], ...args); - } - - function func_4(...args) { - return /*func_4*/ ctx[16](/*dir*/ ctx[28], ...args); - } - - function click_handler_7() { - return /*click_handler_7*/ ctx[17](/*dir*/ ctx[28]); - } +// (46:16) {#if square.impliedItems.length} +function create_if_block_2$1(ctx) { + let if_block_anchor; + let if_block = /*settings*/ ctx[1].showRelationType && create_if_block_3(); return { c() { - td = element("td"); - t0 = text(t0_value); - t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_4).join("\n")); - attr(td, "class", "svelte-rb5mhu"); + if (if_block) if_block.c(); + if_block_anchor = empty(); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); - - if (!mounted) { - dispose = listen(td, "click", click_handler_7); - mounted = true; + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx, dirty) { + if (/*settings*/ ctx[1].showRelationType) { + if (if_block) ; else { + if_block = create_if_block_3(); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; } }, - p(new_ctx, dirty) { - ctx = new_ctx; + d(detaching) { + if (if_block) if_block.d(detaching); + if (detaching) detach(if_block_anchor); + } + }; +} + +// (47:18) {#if settings.showRelationType} +function create_if_block_3(ctx) { + let h6; + + return { + c() { + h6 = element("h6"); + h6.textContent = "Implied"; + attr(h6, "class", "BC-Matrix-header svelte-sp0k97"); + }, + m(target, anchor) { + insert(target, h6, anchor); }, d(detaching) { - if (detaching) detach(td); - mounted = false; - dispose(); + if (detaching) detach(h6); } }; } -// (213:4) {#each DIRECTIONS as dir} -function create_each_block_1$5(ctx) { - let td; - let t0_value = lodash.sum(/*data*/ ctx[2].map(func_5)) + ""; - let t0; - let t1; - let td_aria_label_value; +// (53:16) {#each square.impliedItems as impliedItem} +function create_each_block_2$1(ctx) { + let li; + let div; + let t_value = (/*impliedItem*/ ctx[15].alt ?? /*impliedItem*/ ctx[15].to.split("/").last()) + ""; + let t; + let div_class_value; + let div_aria_label_value; let mounted; let dispose; - function func_5(...args) { - return /*func_5*/ ctx[18](/*dir*/ ctx[28], ...args); - } - - function func_6(...args) { - return /*func_6*/ ctx[19](/*dir*/ ctx[28], ...args); + function click_handler_1(...args) { + return /*click_handler_1*/ ctx[7](/*impliedItem*/ ctx[15], ...args); } - function click_handler_8() { - return /*click_handler_8*/ ctx[20](/*dir*/ ctx[28]); + function mouseover_handler_1(...args) { + return /*mouseover_handler_1*/ ctx[8](/*impliedItem*/ ctx[15], ...args); } return { c() { - td = element("td"); - t0 = text(t0_value); - t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_6).join("\n")); - attr(td, "class", "svelte-rb5mhu"); + li = element("li"); + div = element("div"); + t = text(t_value); + attr(div, "class", div_class_value = "" + (null_to_empty(/*impliedItem*/ ctx[15].cls) + " svelte-sp0k97")); + attr(div, "aria-label", div_aria_label_value = /*impliedItem*/ ctx[15].parent ?? ""); + attr(li, "class", "BC-Implied"); }, m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); + insert(target, li, anchor); + append(li, div); + append(div, t); if (!mounted) { - dispose = listen(td, "click", click_handler_8); + dispose = [ + listen(div, "click", click_handler_1), + listen(div, "mouseover", mouseover_handler_1) + ]; + mounted = true; } }, p(new_ctx, dirty) { ctx = new_ctx; + if (dirty & /*filteredSquaresArr*/ 1 && t_value !== (t_value = (/*impliedItem*/ ctx[15].alt ?? /*impliedItem*/ ctx[15].to.split("/").last()) + "")) set_data(t, t_value); + + if (dirty & /*filteredSquaresArr*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*impliedItem*/ ctx[15].cls) + " svelte-sp0k97"))) { + attr(div, "class", div_class_value); + } + + if (dirty & /*filteredSquaresArr*/ 1 && div_aria_label_value !== (div_aria_label_value = /*impliedItem*/ ctx[15].parent ?? "")) { + attr(div, "aria-label", div_aria_label_value); + } }, d(detaching) { - if (detaching) detach(td); + if (detaching) detach(li); mounted = false; - dispose(); + run_all(dispose); } }; } -// (251:4) {#each DIRECTIONS as dir} -function create_each_block$5(ctx) { - let td; - let t0_value = lodash.sum(/*data*/ ctx[2].map(func_7)) + ""; - let t0; - let t1; - let td_aria_label_value; - let mounted; - let dispose; - - function func_7(...args) { - return /*func_7*/ ctx[21](/*dir*/ ctx[28], ...args); - } - - function func_8(...args) { - return /*func_8*/ ctx[22](/*dir*/ ctx[28], ...args); - } - - function click_handler_9() { - return /*click_handler_9*/ ctx[23](/*dir*/ ctx[28]); - } +// (15:6) {#each squares as square} +function create_each_block_1$5(ctx) { + let if_block_anchor; + let if_block = (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) && create_if_block$2(ctx); return { c() { - td = element("td"); - t0 = text(t0_value); - t1 = space(); - attr(td, "aria-label-position", "left"); - attr(td, "aria-label", td_aria_label_value = /*data*/ ctx[2].map(func_8).join("\n")); - attr(td, "class", "svelte-rb5mhu"); + 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); }, - m(target, anchor) { - insert(target, td, anchor); - append(td, t0); - append(td, t1); - - if (!mounted) { - dispose = listen(td, "click", click_handler_9); - mounted = true; + p(ctx, dirty) { + if (/*square*/ ctx[12].realItems.length > 0 || /*square*/ ctx[12].impliedItems.length > 0) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block$2(ctx); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; } }, - p(new_ctx, dirty) { - ctx = new_ctx; - }, d(detaching) { - if (detaching) detach(td); - mounted = false; - dispose(); + if (if_block) if_block.d(detaching); + if (detaching) detach(if_block_anchor); } }; } -function create_fragment$8(ctx) { - let table; - let thead; - let tr0; - let th0; - let t1; - let th1; - let t2; - let t3; - let tr1; - let td0; - let button; - let t5; - let td1; - let t7; - let t8; - let td2; - let t10; - let t11; - let tr2; - let td3; - let t13; - let td4; - let t15; - let t16; - let tr3; - let td5; - let t18; - let t19; - let tr4; - let td6; - let t21; - let mounted; - let dispose; - let each_value_7 = DIRECTIONS; - let each_blocks_4 = []; +// (13:2) {#each filteredSquaresArr as squares} +function create_each_block$5(ctx) { + let div; + let t; + let each_value_1 = /*squares*/ ctx[9]; + let each_blocks = []; - for (let i = 0; i < each_value_7.length; i += 1) { - each_blocks_4[i] = create_each_block_7(get_each_context_7(ctx, each_value_7, i)); + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1$5(get_each_context_1$5(ctx, each_value_1, i)); } - let each_value_3 = /*userHiers*/ ctx[1]; - let each_blocks_3 = []; + return { + c() { + div = element("div"); - for (let i = 0; i < each_value_3.length; i += 1) { - each_blocks_3[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i)); - } + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } - let each_value_2 = DIRECTIONS; - let each_blocks_2 = []; + t = space(); + attr(div, "class", "svelte-sp0k97"); + }, + m(target, anchor) { + insert(target, div, anchor); - for (let i = 0; i < each_value_2.length; i += 1) { - each_blocks_2[i] = create_each_block_2$1(get_each_context_2$1(ctx, each_value_2, i)); - } + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); + } - let each_value_1 = DIRECTIONS; - let each_blocks_1 = []; + append(div, t); + }, + p(ctx, dirty) { + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView, settings*/ 15) { + each_value_1 = /*squares*/ ctx[9]; + let i; - for (let i = 0; i < each_value_1.length; i += 1) { - each_blocks_1[i] = create_each_block_1$5(get_each_context_1$5(ctx, each_value_1, i)); - } + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1$5(ctx, each_value_1, i); + + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1$5(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, t); + } + } + + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + + each_blocks.length = each_value_1.length; + } + }, + d(detaching) { + if (detaching) detach(div); + destroy_each(each_blocks, detaching); + } + }; +} - let each_value = DIRECTIONS; +function create_fragment$9(ctx) { + let div; + let each_value = /*filteredSquaresArr*/ ctx[0]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { @@ -24365,274 +24599,341 @@ function create_fragment$8(ctx) { return { c() { - table = element("table"); - thead = element("thead"); - tr0 = element("tr"); - th0 = element("th"); - th0.textContent = "Hierarchy"; - t1 = space(); - th1 = element("th"); - t2 = text("Count"); - t3 = space(); - tr1 = element("tr"); - td0 = element("td"); - button = element("button"); - button.textContent = "↻"; - t5 = space(); - td1 = element("td"); - td1.textContent = "Measure"; - t7 = space(); - - for (let i = 0; i < each_blocks_4.length; i += 1) { - each_blocks_4[i].c(); - } - - t8 = space(); - td2 = element("td"); - td2.textContent = "Total"; - t10 = space(); + div = element("div"); - for (let i = 0; i < each_blocks_3.length; i += 1) { - each_blocks_3[i].c(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); } - t11 = space(); - tr2 = element("tr"); - td3 = element("td"); - td3.textContent = "Totals"; - t13 = space(); - td4 = element("td"); - td4.textContent = "Nodes"; - t15 = space(); + attr(div, "class", "BC-Matrix markdown-preview-view svelte-sp0k97"); + }, + m(target, anchor) { + insert(target, div, anchor); - for (let i = 0; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].c(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].m(div, null); } + }, + p(ctx, [dirty]) { + if (dirty & /*filteredSquaresArr, openOrSwitch, app, hoverPreview, matrixView, settings*/ 15) { + each_value = /*filteredSquaresArr*/ ctx[0]; + let i; - t16 = space(); - tr3 = element("tr"); - td5 = element("td"); - td5.textContent = "Real Edges"; - t18 = space(); + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$5(ctx, each_value, i); - for (let i = 0; i < each_blocks_1.length; i += 1) { - each_blocks_1[i].c(); - } + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block$5(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } - t19 = space(); - tr4 = element("tr"); - td6 = element("td"); - td6.textContent = "Implied Edges"; - t21 = space(); + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); + each_blocks.length = each_value.length; } - - attr(th0, "scope", "col"); - attr(th0, "class", "svelte-rb5mhu"); - attr(th1, "scope", "col"); - attr(th1, "colspan", DIRECTIONS.length + 2); - attr(th1, "class", "svelte-rb5mhu"); - attr(button, "class", "icon"); - attr(button, "aria-label", "Refresh Stats View (also refreshes Breadcrumbs Index)"); - attr(td0, "class", "svelte-rb5mhu"); - attr(td1, "class", "svelte-rb5mhu"); - attr(td2, "class", "svelte-rb5mhu"); - attr(td3, "rowspan", "3"); - attr(td3, "class", "svelte-rb5mhu"); - attr(td4, "class", "svelte-rb5mhu"); - attr(td5, "class", "svelte-rb5mhu"); - attr(td6, "class", "svelte-rb5mhu"); - attr(table, "class", "svelte-rb5mhu"); }, - m(target, anchor) { - insert(target, table, anchor); - append(table, thead); - append(thead, tr0); - append(tr0, th0); - append(tr0, t1); - append(tr0, th1); - append(th1, t2); - append(table, t3); - append(table, tr1); - append(tr1, td0); - append(td0, button); - append(tr1, t5); - append(tr1, td1); - append(tr1, t7); + i: noop, + o: noop, + d(detaching) { + if (detaching) detach(div); + destroy_each(each_blocks, detaching); + } + }; +} - for (let i = 0; i < each_blocks_4.length; i += 1) { - each_blocks_4[i].m(tr1, null); - } +function instance$9($$self, $$props, $$invalidate) { + + + + let { filteredSquaresArr } = $$props; + let { currFile } = $$props; + let { settings } = $$props; + let { matrixView } = $$props; + let { app } = $$props; + const click_handler = async (realItem, e) => openOrSwitch(app, realItem.to, e); + const mouseover_handler = (realItem, event) => hoverPreview(event, matrixView, realItem.to); + const click_handler_1 = async (impliedItem, e) => openOrSwitch(app, impliedItem.to, e); + const mouseover_handler_1 = (impliedItem, e) => hoverPreview(e, matrixView, impliedItem.to); - append(tr1, t8); - append(tr1, td2); - append(table, t10); + $$self.$$set = $$props => { + if ("filteredSquaresArr" in $$props) $$invalidate(0, filteredSquaresArr = $$props.filteredSquaresArr); + if ("currFile" in $$props) $$invalidate(4, currFile = $$props.currFile); + if ("settings" in $$props) $$invalidate(1, settings = $$props.settings); + if ("matrixView" in $$props) $$invalidate(2, matrixView = $$props.matrixView); + if ("app" in $$props) $$invalidate(3, app = $$props.app); + }; - for (let i = 0; i < each_blocks_3.length; i += 1) { - each_blocks_3[i].m(table, null); - } + return [ + filteredSquaresArr, + settings, + matrixView, + app, + currFile, + click_handler, + mouseover_handler, + click_handler_1, + mouseover_handler_1 + ]; +} - append(table, t11); - append(table, tr2); - append(tr2, td3); - append(tr2, t13); - append(tr2, td4); - append(tr2, t15); +class Matrix extends SvelteComponent { + constructor(options) { + super(); + if (!document.getElementById("svelte-sp0k97-style")) add_css$4(); - for (let i = 0; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].m(tr2, null); - } + init(this, options, instance$9, create_fragment$9, safe_not_equal, { + filteredSquaresArr: 0, + currFile: 4, + settings: 1, + matrixView: 2, + app: 3 + }); + } +} - append(table, t16); - append(table, tr3); - append(tr3, td5); - append(tr3, t18); +class MatrixView extends require$$0.ItemView { + constructor(leaf, plugin) { + super(leaf); + this.icon = TRAIL_ICON; + this.toInternalLinkObj = (to, realQ = true, parent) => { + return { + to, + cls: linkClass(this.app, to, realQ), + alt: this.getAlt(to, this.plugin.settings), + order: this.getOrder(to), + parent, + }; + }; + this.getOrder = (node) => Number.parseInt(this.plugin.mainG.getNodeAttribute(node, "order")); + this.plugin = plugin; + this.db = new Debugger(plugin); + } + async onload() { + super.onload(); + this.matrixQ = this.plugin.settings.defaultView; + this.app.workspace.onLayoutReady(async () => { + setTimeout(async () => await this.draw(), this.app.plugins.plugins.dataview + ? this.app.plugins.plugins.dataview.api + ? 1 + : this.plugin.settings.dvWaitTime + : 3000); + }); + } + getViewType() { + return MATRIX_VIEW; + } + getDisplayText() { + return "Breadcrumbs Matrix"; + } + async onOpen() { } + onClose() { + var _a; + (_a = this.view) === null || _a === void 0 ? void 0 : _a.$destroy(); + return Promise.resolve(); + } + getAlt(node, settings) { + let alt = null; + if (settings.altLinkFields.length) { + const file = this.app.metadataCache.getFirstLinkpathDest(node, ""); + if (file) { + const metadata = this.app.metadataCache.getFileCache(file); + settings.altLinkFields.forEach((altLinkField) => { + var _a; + alt = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.frontmatter) === null || _a === void 0 ? void 0 : _a[altLinkField]; + }); + } + } + return alt; + } + // ANCHOR Remove duplicate implied links + removeDuplicateImplied(reals, implieds) { + const realTos = reals.map((real) => real.to); + return implieds.filter((implied) => !realTos.includes(implied.to)); + } + getHierSquares(userHiers, currFile, settings) { + const { plugin } = this; + const { mainG } = plugin; + if (!mainG) { + new require$$0.Notice("Breadcrumbs graph was not initialised yet. Please Refresh Index"); + return []; + } + const { basename } = currFile; + const realsnImplieds = getRealnImplied(plugin, basename); + return userHiers.map((hier) => { + const filteredRealNImplied = blankRealNImplied(); + for (const dir in realsnImplieds) { + const { reals, implieds } = realsnImplieds[dir]; + filteredRealNImplied[dir].reals = reals + .filter((real) => hier[dir].includes(real.field)) + .map((item) => this.toInternalLinkObj(item.to, true)); + filteredRealNImplied[dir].implieds = implieds + .filter((implied) => hier[dir].includes(implied.field)) + .map((item) => this.toInternalLinkObj(item.to, false)); + } + let { up: { reals: ru, implieds: iu }, same: { reals: rs, implieds: is }, down: { reals: rd, implieds: id }, next: { reals: rn, implieds: iN }, prev: { reals: rp, implieds: ip }, } = filteredRealNImplied; + // SECTION Implied Siblings + /// Notes with the same parents + const g = getSubInDirs(mainG, "up", "down"); + const closed = getReflexiveClosure(g, userHiers); + const closedUp = getSubInDirs(closed, "up"); + let iSameArr = []; + const currParents = closedUp.hasNode(basename) + ? closedUp.filterOutNeighbors(basename, (n, a) => hier.up.includes(a.field)) + : []; + currParents.forEach((parent) => { + let impliedSiblings = []; + // const { field } = up.getEdgeAttributes(basename, parent); + closedUp.forEachInEdge(parent, (k, a, s, t) => { + if (s === basename) + return; + // if (!settings.filterImpliedSiblingsOfDifferentTypes) + impliedSiblings.push(s); + // else if (a.field === field) { + // impliedSiblings.push(s); + // } + }); + impliedSiblings.forEach((impliedSibling) => { + iSameArr.push(this.toInternalLinkObj(impliedSibling, false, parent)); + }); + }); + /// A real sibling implies the reverse sibling + iSameArr.push(...is); + // !SECTION + iu = this.removeDuplicateImplied(ru, iu); + iSameArr = this.removeDuplicateImplied(rs, iSameArr); + id = this.removeDuplicateImplied(rd, id); + iN = this.removeDuplicateImplied(rn, iN); + ip = this.removeDuplicateImplied(rp, ip); + const iSameNoDup = []; + iSameArr.forEach((impSib) => { + if (iSameNoDup.every((noDup) => noDup.to !== impSib.to)) { + iSameNoDup.push(impSib); + } + }); + iSameArr = iSameNoDup; + const getFieldInHier = (dir) => hier[dir][0] + ? hier[dir].join(", ") + : `${hier[getOppDir(dir)].join(",")}${ARROW_DIRECTIONS[dir]}`; + const { alphaSortAsc } = settings; + [ru, rs, rd, rn, rp, iu, iSameArr, id, iN, ip].forEach((a) => a + .sort((a, b) => a.to < b.to ? (alphaSortAsc ? -1 : 1) : alphaSortAsc ? 1 : -1) + .sort((a, b) => a.order - b.order)); + loglevel.debug({ ru }, { rs }, { rd }, { rn }, { rp }, { iu }, { iSameArr }, { id }, { iN }, { ip }); + return [ + { + realItems: ru, + impliedItems: iu, + field: getFieldInHier("up"), + }, + { + realItems: rs, + impliedItems: iSameArr, + field: getFieldInHier("same"), + }, + { + realItems: rd, + impliedItems: id, + field: getFieldInHier("down"), + }, + { + realItems: rn, + impliedItems: iN, + field: getFieldInHier("next"), + }, + { + realItems: rp, + impliedItems: ip, + field: getFieldInHier("prev"), + }, + ]; + }); + } + async draw() { + try { + const { contentEl, db } = this; + db.start2G("Draw Matrix/List View"); + contentEl.empty(); + const { settings } = this.plugin; + const { userHiers } = settings; + const currFile = this.app.workspace.getActiveFile(); + contentEl.createEl("button", { + text: this.matrixQ ? "List" : "Matrix", + }, (el) => { + el.onclick = async () => { + this.matrixQ = !this.matrixQ; + el.innerText = this.matrixQ ? "List" : "Matrix"; + await this.draw(); + }; + }); + contentEl.createEl("button", { text: "↻" }, (el) => { + el.onclick = async () => await this.plugin.refreshIndex(); + }); + const hierSquares = this.getHierSquares(userHiers, currFile, settings).filter((squareArr) => squareArr.some((square) => square.realItems.length + square.impliedItems.length > 0)); + const compInput = { + target: contentEl, + props: { + filteredSquaresArr: hierSquares, + currFile, + settings, + matrixView: this, + app: this.app, + }, + }; + this.matrixQ + ? (this.view = new Matrix(compInput)) + : (this.view = new Lists(compInput)); + db.end2G(); + } + catch (err) { + loglevel.error(err); + this.db.end2G(); + } + } +} - for (let i = 0; i < each_blocks_1.length; i += 1) { - each_blocks_1[i].m(tr3, null); - } +/* src\Components\KoFi.svelte generated by Svelte v3.35.0 */ - append(table, t19); - append(table, tr4); - append(tr4, td6); - append(tr4, t21); +function create_fragment$8(ctx) { + let script; + let script_src_value; + let t; + let div; + let mounted; + let dispose; - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(tr4, null); - } + return { + c() { + script = element("script"); + t = space(); + div = element("div"); + attr(script, "type", "text/javascript"); + if (script.src !== (script_src_value = "https://ko-fi.com/widgets/widget_2.js")) attr(script, "src", script_src_value); + }, + m(target, anchor) { + append(document.head, script); + insert(target, t, anchor); + insert(target, div, anchor); + /*div_binding*/ ctx[2](div); if (!mounted) { - dispose = listen(button, "click", /*click_handler*/ ctx[5]); + dispose = listen(script, "load", /*initializeKofi*/ ctx[1]); mounted = true; } }, - p(ctx, dirty) { - if (dirty & /*ARROW_DIRECTIONS, DIRECTIONS*/ 0) { - each_value_7 = DIRECTIONS; - let i; - - for (i = 0; i < each_value_7.length; i += 1) { - const child_ctx = get_each_context_7(ctx, each_value_7, i); - - if (each_blocks_4[i]) { - each_blocks_4[i].p(child_ctx, dirty); - } else { - each_blocks_4[i] = create_each_block_7(child_ctx); - each_blocks_4[i].c(); - each_blocks_4[i].m(tr1, t8); - } - } - - for (; i < each_blocks_4.length; i += 1) { - each_blocks_4[i].d(1); - } - - each_blocks_4.length = each_value_7.length; - } - - if (dirty[0] & /*cellStr, data, hierStrs*/ 28) { - each_value_3 = /*userHiers*/ ctx[1]; - let i; - - for (i = 0; i < each_value_3.length; i += 1) { - const child_ctx = get_each_context_3(ctx, each_value_3, i); - - if (each_blocks_3[i]) { - each_blocks_3[i].p(child_ctx, dirty); - } else { - each_blocks_3[i] = create_each_block_3(child_ctx); - each_blocks_3[i].c(); - each_blocks_3[i].m(table, t11); - } - } - - for (; i < each_blocks_3.length; i += 1) { - each_blocks_3[i].d(1); - } - - each_blocks_3.length = each_value_3.length; - } - - if (dirty[0] & /*data*/ 4) { - each_value_2 = DIRECTIONS; - let i; - - for (i = 0; i < each_value_2.length; i += 1) { - const child_ctx = get_each_context_2$1(ctx, each_value_2, i); - - if (each_blocks_2[i]) { - each_blocks_2[i].p(child_ctx, dirty); - } else { - each_blocks_2[i] = create_each_block_2$1(child_ctx); - each_blocks_2[i].c(); - each_blocks_2[i].m(tr2, null); - } - } - - for (; i < each_blocks_2.length; i += 1) { - each_blocks_2[i].d(1); - } - - each_blocks_2.length = each_value_2.length; - } - - if (dirty[0] & /*data*/ 4) { - each_value_1 = DIRECTIONS; - let i; - - for (i = 0; i < each_value_1.length; i += 1) { - const child_ctx = get_each_context_1$5(ctx, 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_1$5(child_ctx); - each_blocks_1[i].c(); - each_blocks_1[i].m(tr3, 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[0] & /*data*/ 4) { - each_value = DIRECTIONS; - let i; - - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context$5(ctx, each_value, i); - - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block$5(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(tr4, null); - } - } - - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - - each_blocks.length = each_value.length; - } - }, + p: noop, i: noop, o: noop, d(detaching) { - if (detaching) detach(table); - destroy_each(each_blocks_4, detaching); - destroy_each(each_blocks_3, detaching); - destroy_each(each_blocks_2, detaching); - destroy_each(each_blocks_1, detaching); - destroy_each(each_blocks, detaching); + detach(script); + if (detaching) detach(t); + if (detaching) detach(div); + /*div_binding*/ ctx[2](null); mounted = false; dispose(); } @@ -24640,344 +24941,30 @@ function create_fragment$8(ctx) { } function instance$8($$self, $$props, $$invalidate) { - - - let { plugin } = $$props; - const { settings, mainG } = plugin; - const { userHiers } = settings; - const db = new Debugger(plugin); - db.start2G("StatsView"); - - function fillInInfo(dir, gType, hierData, nodesToo = true) { - const gInfo = hierData[dir][gType]; - const { wikilinkIndex } = settings; - - if (nodesToo) { - gInfo.nodes = gInfo.graph.nodes(); - gInfo.nodesStr = gInfo.nodes.map(n => makeWiki(n, wikilinkIndex)).join("\n"); - } - - gInfo.edges = gInfo.graph.edges(); - const edgeStrArr = gInfo.graph.mapEdges((k, a, s, t) => `${makeWiki(nodesToo ? s : t, wikilinkIndex)} ${ARROW_DIRECTIONS[dir]} ${makeWiki(nodesToo ? t : s, wikilinkIndex)}`); - gInfo.edgesStr = edgeStrArr.join("\n"); - } - - const data = settings.userHiers.map(hier => { - const hierData = { - //@ts-ignore - up: { Merged: {}, Closed: {}, Implied: {} }, - //@ts-ignore - same: { Merged: {}, Closed: {}, Implied: {} }, - //@ts-ignore - down: { Merged: {}, Closed: {}, Implied: {} }, - //@ts-ignore - next: { Merged: {}, Closed: {}, Implied: {} }, - //@ts-ignore - prev: { Merged: {}, Closed: {}, Implied: {} } - }; - - DIRECTIONS.forEach(dir => { - // Merged Graphs - /// Smoosh all fieldGs from one dir into a merged graph for that direction as a whole - const mergedInDir = getSubForFields(mainG, hier[dir]); - - const mergedInOppDir = getSubForFields(mainG, hier[getOppDir(dir)]); - hierData[dir].Merged.graph = mergedInDir; - fillInInfo(dir, "Merged", hierData); - - // Closed graphs - if (dir !== "same") { - hierData[dir].Closed.graph = closeImpliedLinks(mergedInDir, mergedInOppDir); - } else { - hierData[dir].Closed.graph = closeImpliedLinks(mergedInDir, mergedInDir); - } - - fillInInfo(dir, "Closed", hierData); - - if (dir !== "same") { - hierData[dir].Implied.graph = mergedInOppDir; - } else { - hierData[dir].Implied.graph = closeImpliedLinks(mergedInDir, mergedInDir); - } - - fillInInfo(dir, "Implied", hierData, false); - }); - - return hierData; - }); - - loglevel.debug({ data }); - const cellStr = (i, type, info) => DIRECTIONS.map(dir => data[i][dir][type][info]).join("\n"); - let hierStrs = userHiers.map(hierToStr); - db.end2G(); + let button; - const click_handler = async () => { - await plugin.refreshIndex(); - await plugin.getActiveTYPEView(STATS_VIEW)?.draw(); + var initializeKofi = () => { + kofiwidget2.init("Support Breadcrumbs development!", "#29abe0", "G2G454TZF"); + $$invalidate(0, button.innerHTML = kofiwidget2.getHTML(), button); }; - const click_handler_1 = async (i, dir) => await copy(data[i][dir].Merged.nodesStr); - const func = (i, dir) => data[i][dir].Merged.nodes.length; - const click_handler_2 = async i => await copy(cellStr(i, "Merged", "nodesStr")); - const click_handler_3 = async (i, dir) => await copy(data[i][dir].Merged.edgesStr); - const func_1 = (i, dir) => data[i][dir].Merged.edges.length; - const click_handler_4 = async i => await copy(cellStr(i, "Merged", "edgesStr")); - const click_handler_5 = async (i, dir) => await copy(data[i][dir].Implied.edgesStr); - const func_2 = (i, dir) => data[i][dir].Implied.edges.length; - const click_handler_6 = async i => await copy(cellStr(i, "Implied", "edgesStr")); - const func_3 = (dir, datum) => datum[dir].Merged.nodes.length; - const func_4 = (dir, datum) => datum[dir].Merged.nodesStr; - const click_handler_7 = async dir => await copy(data.map(datum => datum[dir].Merged.nodesStr).join("\n")); - const func_5 = (dir, datum) => datum[dir].Merged.edges.length; - const func_6 = (dir, datum) => datum[dir].Merged.edgesStr; - const click_handler_8 = async dir => await copy(data.map(datum => datum[dir].Merged.edgesStr).join("\n")); - const func_7 = (dir, datum) => datum[dir].Implied.edges.length; - const func_8 = (dir, datum) => datum[dir].Implied.edgesStr; - const click_handler_9 = async dir => await copy(data.map(datum => datum[dir].Implied.edgesStr).join("\n")); - - $$self.$$set = $$props => { - if ("plugin" in $$props) $$invalidate(0, plugin = $$props.plugin); - }; + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + button = $$value; + $$invalidate(0, button); + }); + } - return [ - plugin, - userHiers, - data, - cellStr, - hierStrs, - click_handler, - click_handler_1, - func, - click_handler_2, - click_handler_3, - func_1, - click_handler_4, - click_handler_5, - func_2, - click_handler_6, - func_3, - func_4, - click_handler_7, - func_5, - func_6, - click_handler_8, - func_7, - func_8, - click_handler_9 - ]; + return [button, initializeKofi, div_binding]; } -class Stats extends SvelteComponent { +class KoFi extends SvelteComponent { constructor(options) { super(); - if (!document.getElementById("svelte-rb5mhu-style")) add_css$4(); - init(this, options, instance$8, create_fragment$8, safe_not_equal, { plugin: 0 }, [-1, -1]); + init(this, options, instance$8, create_fragment$8, safe_not_equal, {}); } } -class StatsView extends require$$0.ItemView { - constructor(leaf, plugin) { - super(leaf); - this.icon = "info"; - this.plugin = plugin; - } - async onload() { - super.onload(); - this.app.workspace.onLayoutReady(() => { - setTimeout(async () => await this.draw(), this.plugin.settings.dvWaitTime); - }); - } - getViewType() { - return STATS_VIEW; - } - getDisplayText() { - return "Breadcrumbs Stats"; - } - async onOpen() { - await this.plugin.saveSettings(); - } - onClose() { - if (this.view) { - this.view.$destroy(); - } - return Promise.resolve(); - } - async draw() { - const { contentEl, plugin } = this; - contentEl.empty(); - this.view = new Stats({ - target: contentEl, - props: { plugin }, - }); - } -} - -const MATRIX_VIEW = "BC-matrix"; -const STATS_VIEW = "BC-stats"; -const DUCK_VIEW = "BC-ducks"; -const DOWN_VIEW = "BC-down"; -const VIEWS = [ - { - plain: "Matrix", - type: MATRIX_VIEW, - constructor: MatrixView, - openOnLoad: true, - }, - { - plain: "Stats", - type: STATS_VIEW, - constructor: StatsView, - openOnLoad: true, - }, - { plain: "Duck", type: DUCK_VIEW, constructor: DucksView, openOnLoad: false }, - { plain: "Down", type: DOWN_VIEW, constructor: DownView, openOnLoad: true }, -]; -const TRAIL_ICON = "BC-trail-icon"; -const TRAIL_ICON_SVG = ''; -const splitLinksRegex = new RegExp(/\[\[(.+?)\]\]/g); -const dropHeaderOrAlias = new RegExp(/\[\[([^#|]+)\]\]/); -const VISTYPES = [ - "Force Directed Graph", - "Tidy Tree", - "Circle Packing", - "Edge Bundling", - "Arc Diagram", - "Sunburst", - "Tree Map", - "Icicle", - "Radial Tree", -]; -const DIRECTIONS = ["up", "same", "down", "next", "prev"]; -const ARROW_DIRECTIONS = { - up: "↑", - same: "↔", - down: "↓", - next: "→", - prev: "←", -}; -const RELATIONS = ["Parent", "Sibling", "Child"]; -const REAlCLOSED = ["Real", "Closed"]; -const ALLUNLINKED = ["All", "No Unlinked"]; -const blankUserHier = () => { - return { up: [], same: [], down: [], next: [], prev: [] }; -}; -const blankRealNImplied = () => { - return { - up: { reals: [], implieds: [] }, - down: { reals: [], implieds: [] }, - same: { reals: [], implieds: [] }, - next: { reals: [], implieds: [] }, - prev: { reals: [], implieds: [] }, - }; -}; -const [BC_FOLDER_NOTE, BC_TAG_NOTE, BC_TAG_NOTE_FIELD, BC_LINK_NOTE, BC_TRAVERSE_NOTE, BC_HIDE_TRAIL, BC_ORDER,] = [ - "BC-folder-note", - "BC-tag-note", - "BC-tag-note-field", - "BC-link-note", - "BC-traverse-note", - "BC-hide-trail", - "BC-order", -]; -const BC_FIELDS_INFO = [ - { - field: BC_FOLDER_NOTE, - desc: "Set this note as a Breadcrumbs folder-note. All other notes in this folder will be added to the graph with the field name specified in this key's value", - after: ": ", - alt: true, - }, - { - field: BC_TAG_NOTE, - desc: "Set this note as a Breadcrumbs tag-note. All other notes with this tag will be added to the graph in the direction you specify with `BC-tag-note-field: fieldName`", - after: ": '#", - alt: true, - }, - { - field: BC_TAG_NOTE_FIELD, - desc: "Manually choose the field for this tag-note to use", - after: ": ", - alt: false, - }, - { - field: BC_LINK_NOTE, - desc: "Set this note as a Breadcrumbs link-note. All links leaving this note will be added to the graph with the field name specified in this key's value.", - after: ": ", - alt: true, - }, - { - field: BC_TRAVERSE_NOTE, - desc: "Set this note as a Breadcrumbs traverse-note. Starting from this note, the Obsidian graph will be traversed in depth-first order, and all notes along the way will be added to the BC graph using the fieldName you specify", - after: ": ", - alt: true, - }, - { - field: BC_HIDE_TRAIL, - desc: "Don't show the trail in this note", - after: ": true", - alt: false, - }, - { - field: BC_ORDER, - desc: "Set the order of this note in the List/Matrix view. A lower value places this note higher in the order.", - after: ": ", - alt: false, - }, -]; -const BC_ALTS = BC_FIELDS_INFO.filter((f) => f.alt).map((f) => f.field); -const DEFAULT_SETTINGS = { - aliasesInIndex: false, - alphaSortAsc: true, - altLinkFields: [], - CSVPaths: "", - debugMode: "WARN", - defaultView: true, - dvWaitTime: 5000, - dotsColour: "#000000", - fieldSuggestor: true, - filterImpliedSiblingsOfDifferentTypes: false, - limitWriteBCCheckboxStates: {}, - indexNotes: [""], - hierarchyNotes: [""], - HNUpField: "", - refreshOnNoteChange: false, - useAllMetadata: true, - parseJugglLinksWithoutJuggl: false, - showNameOrType: true, - showRelationType: true, - rlLeaf: true, - showAllPathsIfNoneToIndexNote: false, - showBCs: true, - showBCsInEditLPMode: false, - showRefreshNotice: true, - showTrail: true, - showGrid: true, - showPrevNext: true, - limitTrailCheckboxStates: {}, - gridDots: false, - gridHeatmap: false, - heatmapColour: getComputedStyle(document.body).getPropertyValue("--text-accent"), - showAll: false, - noPathMessage: `This note has no real or implied parents`, - trailSeperator: "→", - respectReadableLineLength: true, - userHiers: [ - { - up: ["up"], - same: ["same"], - down: ["down"], - next: ["next"], - prev: ["prev"], - }, - ], - writeBCsInline: false, - showWriteAllBCsCmd: false, - visGraph: "Force Directed Graph", - visRelation: "Parent", - visClosed: "Real", - visAll: "All", - wikilinkIndex: true, -}; - /* node_modules\svelte-icons\fa\FaListUl.svelte generated by Svelte v3.35.0 */ function create_default_slot$2(ctx) { @@ -25318,7 +25305,7 @@ function create_each_block_1$4(ctx) { function create_each_block$4(ctx) { let details; let summary; - let t0_value = DIRECTIONS.map(func).map(func_1).join(" ") + ""; + let t0_value = DIRECTIONS$1.map(func).map(func_1).join(" ") + ""; let t0; let t1; let span; @@ -25348,7 +25335,7 @@ function create_each_block$4(ctx) { return /*click_handler_5*/ ctx[9](/*i*/ ctx[14]); } - let each_value_1 = DIRECTIONS; + let each_value_1 = DIRECTIONS$1; let each_blocks = []; for (let i = 0; i < each_value_1.length; i += 1) { @@ -25418,10 +25405,10 @@ function create_each_block$4(ctx) { }, p(new_ctx, dirty) { ctx = new_ctx; - if (dirty & /*currHiers*/ 1 && t0_value !== (t0_value = DIRECTIONS.map(func).map(func_1).join(" ") + "")) set_data(t0, t0_value); + if (dirty & /*currHiers*/ 1 && t0_value !== (t0_value = DIRECTIONS$1.map(func).map(func_1).join(" ") + "")) set_data(t0, t0_value); if (dirty & /*DIRECTIONS, currHiers, splitAndTrim, update, ARROW_DIRECTIONS*/ 3) { - each_value_1 = DIRECTIONS; + each_value_1 = DIRECTIONS$1; let i; for (i = 0; i < each_value_1.length; i += 1) { @@ -25793,6 +25780,45 @@ class BCSettingTab extends require$$0.PluginSettingTab { settings.showRefreshNotice = value; await plugin.saveSettings(); })); + new require$$0.Setting(generalDetails) + .setName("Open Views by Default") + .setDesc("Choose which of the views to open onload") + .addToggle((toggle) => { + toggle + .setTooltip("Matrix View") + .setValue(settings.openMatrixOnLoad) + .onChange(async (value) => { + settings.openMatrixOnLoad = value; + await plugin.saveSettings(); + }); + }) + .addToggle((toggle) => { + toggle + .setTooltip("Stats View") + .setValue(settings.openStatsOnLoad) + .onChange(async (value) => { + settings.openStatsOnLoad = 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("Down View") + .setValue(settings.openDownOnLoad) + .onChange(async (value) => { + settings.openDownOnLoad = value; + await plugin.saveSettings(); + }); + }); new require$$0.Setting(generalDetails) .setName("Enable Field Suggestor") .setDesc('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 the content you type matches the regex /^BC-.*$/. Basically, just type "BC-" at the start of a line to trigger it.') @@ -26173,7 +26199,7 @@ class BCSettingTab extends require$$0.PluginSettingTab { limitWriteBCCheckboxDiv.empty(); const checkboxStates = settings.limitWriteBCCheckboxStates; settings.userHiers.forEach((userHier) => { - DIRECTIONS.forEach((dir) => { + DIRECTIONS$1.forEach((dir) => { var _a; (_a = userHier[dir]) === null || _a === void 0 ? void 0 : _a.forEach(async (field) => { if (field === "") @@ -49438,7 +49464,7 @@ class BCPlugin extends require$$0.Plugin { this.initEverything = async () => { const { settings } = this; this.mainG = await this.initGraphs(); - for (const view of VIEWS) { + for (const view of this.VIEWS) { if (view.openOnLoad) await openView(this.app, view.type, view.constructor); } @@ -49489,7 +49515,7 @@ class BCPlugin extends require$$0.Plugin { if (!this.layoutChange) this.registerLayoutChangeEvent(); this.mainG = await this.initGraphs(); - for (const view of VIEWS) + for (const view of this.VIEWS) await ((_a = this.getActiveTYPEView(view.type)) === null || _a === void 0 ? void 0 : _a.draw()); if (this.settings.showTrail) await this.drawTrail(); @@ -49547,7 +49573,33 @@ class BCPlugin extends require$$0.Plugin { delete this.settings.limitTrailCheckboxStates[field]; } } - for (const view of VIEWS) { + this.VIEWS = [ + { + plain: "Matrix", + type: MATRIX_VIEW, + constructor: MatrixView, + openOnLoad: this.settings.openMatrixOnLoad, + }, + { + plain: "Stats", + type: STATS_VIEW, + constructor: StatsView, + openOnLoad: this.settings.openStatsOnLoad, + }, + { + plain: "Duck", + type: DUCK_VIEW, + constructor: DucksView, + openOnLoad: this.settings.openDuckOnLoad, + }, + { + plain: "Down", + type: DOWN_VIEW, + constructor: DownView, + openOnLoad: this.settings.openDownOnLoad, + }, + ]; + for (const view of this.VIEWS) { this.registerView(view.type, (leaf) => new view.constructor(leaf, this)); } this.db = new Debugger(this); @@ -49567,7 +49619,7 @@ class BCPlugin extends require$$0.Plugin { } }); require$$0.addIcon(TRAIL_ICON, TRAIL_ICON_SVG); - for (const view of VIEWS) { + for (const view of this.VIEWS) { this.addCommand({ id: `show-${view.type}-view`, name: `Open ${view.plain} View`, @@ -49675,7 +49727,7 @@ class BCPlugin extends require$$0.Plugin { this.addSettingTab(new BCSettingTab(this.app, this)); } getActiveTYPEView(type) { - const { constructor } = VIEWS.find((view) => view.type === type); + const { constructor } = this.VIEWS.find((view) => view.type === type); const leaves = this.app.workspace.getLeavesOfType(type); if (leaves && leaves.length >= 1) { const view = leaves[0].view; @@ -50523,7 +50575,11 @@ class BCPlugin extends require$$0.Plugin { } onunload() { console.log("unloading"); - VIEWS.forEach((view) => this.app.workspace.detachLeavesOfType(view.type)); + this.VIEWS.forEach(async (view) => { + var _a; + await ((_a = this.getActiveTYPEView(view.type)) === null || _a === void 0 ? void 0 : _a.onClose()); + this.app.workspace.detachLeavesOfType(view.type); + }); this.visited.forEach((visit) => visit[1].remove()); } } diff --git a/src/main.ts b/src/main.ts index 715916a9..be464b99 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1509,7 +1509,10 @@ export default class BCPlugin extends Plugin { onunload(): void { console.log("unloading"); - VIEWS.forEach((view) => this.app.workspace.detachLeavesOfType(view.type)); + this.VIEWS.forEach(async (view) => { + await this.getActiveTYPEView(view.type)?.onClose(); + this.app.workspace.detachLeavesOfType(view.type); + }); this.visited.forEach((visit) => visit[1].remove()); }