UNPKG

@andreasdymek/branching-scenario

Version:

Create adaptive learning experiences by authoring a gamebook, where you present the student with choices on how to continue. The content in the gamebook can be based on a all other WebWriter content types.

516 lines (514 loc) 1.15 MB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name); var __typeError = (msg) => { throw TypeError(msg); }; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to2, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to2, key) && key !== except) __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to2; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)]; var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"]; var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn; var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) }); var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]); var __runInitializers = (array, flags, self2, value) => { for (var i5 = 0, fns = array[flags >> 1], n7 = fns && fns.length; i5 < n7; i5++) flags & 1 ? fns[i5].call(self2) : value = fns[i5].call(self2, value); return value; }; var __decorateElement = (array, flags, name, decorators, target, extra) => { var fn, it, done, ctx, access, k3 = flags & 7, s6 = !!(flags & 8), p3 = !!(flags & 16); var j3 = k3 > 3 ? array.length + 1 : k3 ? s6 ? 1 : 2 : 0, key = __decoratorStrings[k3 + 5]; var initializers = k3 > 3 && (array[j3 - 1] = []), extraInitializers = array[j3] || (array[j3] = []); var desc = k3 && (!p3 && !s6 && (target = target.prototype), k3 < 5 && (k3 > 3 || !p3) && __getOwnPropDesc(k3 < 4 ? target : { get [name]() { return __privateGet(this, extra); }, set [name](x4) { return __privateSet(this, extra, x4); } }, name)); k3 ? p3 && k3 < 4 && __name(extra, (k3 > 2 ? "set " : k3 > 1 ? "get " : "") + name) : __name(target, name); for (var i5 = decorators.length - 1; i5 >= 0; i5--) { ctx = __decoratorContext(k3, name, done = {}, array[3], extraInitializers); if (k3) { ctx.static = s6, ctx.private = p3, access = ctx.access = { has: p3 ? (x4) => __privateIn(target, x4) : (x4) => name in x4 }; if (k3 ^ 3) access.get = p3 ? (x4) => (k3 ^ 1 ? __privateGet : __privateMethod)(x4, target, k3 ^ 4 ? extra : desc.get) : (x4) => x4[name]; if (k3 > 2) access.set = p3 ? (x4, y3) => __privateSet(x4, target, y3, k3 ^ 4 ? extra : desc.set) : (x4, y3) => x4[name] = y3; } it = (0, decorators[i5])(k3 ? k3 < 4 ? p3 ? extra : desc[key] : k3 > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1; if (k3 ^ 4 || it === void 0) __expectFn(it) && (k3 > 4 ? initializers.unshift(it) : k3 ? p3 ? extra = it : desc[key] = it : target = it); else if (typeof it !== "object" || it === null) __typeError("Object expected"); else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn); } return k3 || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p3 ? k3 ^ 4 ? extra : desc : target; }; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); // node_modules/drawflow/dist/drawflow.min.js var require_drawflow_min = __commonJS({ "node_modules/drawflow/dist/drawflow.min.js"(exports, module) { !function(e10, t8) { "object" == typeof exports && "object" == typeof module ? module.exports = t8() : "function" == typeof define && define.amd ? define([], t8) : "object" == typeof exports ? exports.Drawflow = t8() : e10.Drawflow = t8(); }("undefined" != typeof self ? self : exports, function() { return function(e10) { var t8 = {}; function n7(i5) { if (t8[i5]) return t8[i5].exports; var s6 = t8[i5] = { i: i5, l: false, exports: {} }; return e10[i5].call(s6.exports, s6, s6.exports, n7), s6.l = true, s6.exports; } return n7.m = e10, n7.c = t8, n7.d = function(e11, t9, i5) { n7.o(e11, t9) || Object.defineProperty(e11, t9, { enumerable: true, get: i5 }); }, n7.r = function(e11) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e11, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e11, "__esModule", { value: true }); }, n7.t = function(e11, t9) { if (1 & t9 && (e11 = n7(e11)), 8 & t9) return e11; if (4 & t9 && "object" == typeof e11 && e11 && e11.__esModule) return e11; var i5 = /* @__PURE__ */ Object.create(null); if (n7.r(i5), Object.defineProperty(i5, "default", { enumerable: true, value: e11 }), 2 & t9 && "string" != typeof e11) for (var s6 in e11) n7.d(i5, s6, function(t10) { return e11[t10]; }.bind(null, s6)); return i5; }, n7.n = function(e11) { var t9 = e11 && e11.__esModule ? function() { return e11.default; } : function() { return e11; }; return n7.d(t9, "a", t9), t9; }, n7.o = function(e11, t9) { return Object.prototype.hasOwnProperty.call(e11, t9); }, n7.p = "", n7(n7.s = 0); }([function(e10, t8, n7) { "use strict"; n7.r(t8), n7.d(t8, "default", function() { return i5; }); class i5 { constructor(e11, t9 = null, n8 = null) { this.events = {}, this.container = e11, this.precanvas = null, this.nodeId = 1, this.ele_selected = null, this.node_selected = null, this.drag = false, this.reroute = false, this.reroute_fix_curvature = false, this.curvature = 0.5, this.reroute_curvature_start_end = 0.5, this.reroute_curvature = 0.5, this.reroute_width = 6, this.drag_point = false, this.editor_selected = false, this.connection = false, this.connection_ele = null, this.connection_selected = null, this.canvas_x = 0, this.canvas_y = 0, this.pos_x = 0, this.pos_x_start = 0, this.pos_y = 0, this.pos_y_start = 0, this.mouse_x = 0, this.mouse_y = 0, this.line_path = 5, this.first_click = null, this.force_first_input = false, this.draggable_inputs = true, this.useuuid = false, this.parent = n8, this.noderegister = {}, this.render = t9, this.drawflow = { drawflow: { Home: { data: {} } } }, this.module = "Home", this.editor_mode = "edit", this.zoom = 1, this.zoom_max = 1.6, this.zoom_min = 0.5, this.zoom_value = 0.1, this.zoom_last_value = 1, this.evCache = new Array(), this.prevDiff = -1; } start() { this.container.classList.add("parent-drawflow"), this.container.tabIndex = 0, this.precanvas = document.createElement("div"), this.precanvas.classList.add("drawflow"), this.container.appendChild(this.precanvas), this.container.addEventListener("mouseup", this.dragEnd.bind(this)), this.container.addEventListener("mousemove", this.position.bind(this)), this.container.addEventListener("mousedown", this.click.bind(this)), this.container.addEventListener("touchend", this.dragEnd.bind(this)), this.container.addEventListener("touchmove", this.position.bind(this)), this.container.addEventListener("touchstart", this.click.bind(this)), this.container.addEventListener("contextmenu", this.contextmenu.bind(this)), this.container.addEventListener("keydown", this.key.bind(this)), this.container.addEventListener("wheel", this.zoom_enter.bind(this)), this.container.addEventListener("input", this.updateNodeValue.bind(this)), this.container.addEventListener("dblclick", this.dblclick.bind(this)), this.container.onpointerdown = this.pointerdown_handler.bind(this), this.container.onpointermove = this.pointermove_handler.bind(this), this.container.onpointerup = this.pointerup_handler.bind(this), this.container.onpointercancel = this.pointerup_handler.bind(this), this.container.onpointerout = this.pointerup_handler.bind(this), this.container.onpointerleave = this.pointerup_handler.bind(this), this.load(); } pointerdown_handler(e11) { this.evCache.push(e11); } pointermove_handler(e11) { for (var t9 = 0; t9 < this.evCache.length; t9++) if (e11.pointerId == this.evCache[t9].pointerId) { this.evCache[t9] = e11; break; } if (2 == this.evCache.length) { var n8 = Math.abs(this.evCache[0].clientX - this.evCache[1].clientX); this.prevDiff > 100 && (n8 > this.prevDiff && this.zoom_in(), n8 < this.prevDiff && this.zoom_out()), this.prevDiff = n8; } } pointerup_handler(e11) { this.remove_event(e11), this.evCache.length < 2 && (this.prevDiff = -1); } remove_event(e11) { for (var t9 = 0; t9 < this.evCache.length; t9++) if (this.evCache[t9].pointerId == e11.pointerId) { this.evCache.splice(t9, 1); break; } } load() { for (var e11 in this.drawflow.drawflow[this.module].data) this.addNodeImport(this.drawflow.drawflow[this.module].data[e11], this.precanvas); if (this.reroute) for (var e11 in this.drawflow.drawflow[this.module].data) this.addRerouteImport(this.drawflow.drawflow[this.module].data[e11]); for (var e11 in this.drawflow.drawflow[this.module].data) this.updateConnectionNodes("node-" + e11); const t9 = this.drawflow.drawflow; let n8 = 1; Object.keys(t9).map(function(e12, i6) { Object.keys(t9[e12].data).map(function(e13, t10) { parseInt(e13) >= n8 && (n8 = parseInt(e13) + 1); }); }), this.nodeId = n8; } removeReouteConnectionSelected() { this.dispatch("connectionUnselected", true), this.reroute_fix_curvature && this.connection_selected.parentElement.querySelectorAll(".main-path").forEach((e11, t9) => { e11.classList.remove("selected"); }); } click(e11) { if (this.dispatch("click", e11), "fixed" === this.editor_mode) { if (e11.preventDefault(), "parent-drawflow" !== e11.target.classList[0] && "drawflow" !== e11.target.classList[0]) return false; this.ele_selected = e11.target.closest(".parent-drawflow"); } else "view" === this.editor_mode ? (null != e11.target.closest(".drawflow") || e11.target.matches(".parent-drawflow")) && (this.ele_selected = e11.target.closest(".parent-drawflow"), e11.preventDefault()) : (this.first_click = e11.target, this.ele_selected = e11.target, 0 === e11.button && this.contextmenuDel(), null != e11.target.closest(".drawflow_content_node") && (this.ele_selected = e11.target.closest(".drawflow_content_node").parentElement)); switch (this.ele_selected.classList[0]) { case "drawflow-node": null != this.node_selected && (this.node_selected.classList.remove("selected"), this.node_selected != this.ele_selected && this.dispatch("nodeUnselected", true)), null != this.connection_selected && (this.connection_selected.classList.remove("selected"), this.removeReouteConnectionSelected(), this.connection_selected = null), this.node_selected != this.ele_selected && this.dispatch("nodeSelected", this.ele_selected.id.slice(5)), this.node_selected = this.ele_selected, this.node_selected.classList.add("selected"), this.draggable_inputs ? "SELECT" !== e11.target.tagName && (this.drag = true) : "INPUT" !== e11.target.tagName && "TEXTAREA" !== e11.target.tagName && "SELECT" !== e11.target.tagName && true !== e11.target.hasAttribute("contenteditable") && (this.drag = true); break; case "output": this.connection = true, null != this.node_selected && (this.node_selected.classList.remove("selected"), this.node_selected = null, this.dispatch("nodeUnselected", true)), null != this.connection_selected && (this.connection_selected.classList.remove("selected"), this.removeReouteConnectionSelected(), this.connection_selected = null), this.drawConnection(e11.target); break; case "parent-drawflow": case "drawflow": null != this.node_selected && (this.node_selected.classList.remove("selected"), this.node_selected = null, this.dispatch("nodeUnselected", true)), null != this.connection_selected && (this.connection_selected.classList.remove("selected"), this.removeReouteConnectionSelected(), this.connection_selected = null), this.editor_selected = true; break; case "main-path": null != this.node_selected && (this.node_selected.classList.remove("selected"), this.node_selected = null, this.dispatch("nodeUnselected", true)), null != this.connection_selected && (this.connection_selected.classList.remove("selected"), this.removeReouteConnectionSelected(), this.connection_selected = null), this.connection_selected = this.ele_selected, this.connection_selected.classList.add("selected"); const t9 = this.connection_selected.parentElement.classList; t9.length > 1 && (this.dispatch("connectionSelected", { output_id: t9[2].slice(14), input_id: t9[1].slice(13), output_class: t9[3], input_class: t9[4] }), this.reroute_fix_curvature && this.connection_selected.parentElement.querySelectorAll(".main-path").forEach((e12, t10) => { e12.classList.add("selected"); })); break; case "point": this.drag_point = true, this.ele_selected.classList.add("selected"); break; case "drawflow-delete": this.node_selected && this.removeNodeId(this.node_selected.id), this.connection_selected && this.removeConnection(), null != this.node_selected && (this.node_selected.classList.remove("selected"), this.node_selected = null, this.dispatch("nodeUnselected", true)), null != this.connection_selected && (this.connection_selected.classList.remove("selected"), this.removeReouteConnectionSelected(), this.connection_selected = null); } "touchstart" === e11.type ? (this.pos_x = e11.touches[0].clientX, this.pos_x_start = e11.touches[0].clientX, this.pos_y = e11.touches[0].clientY, this.pos_y_start = e11.touches[0].clientY, this.mouse_x = e11.touches[0].clientX, this.mouse_y = e11.touches[0].clientY) : (this.pos_x = e11.clientX, this.pos_x_start = e11.clientX, this.pos_y = e11.clientY, this.pos_y_start = e11.clientY), ["input", "output", "main-path"].includes(this.ele_selected.classList[0]) && e11.preventDefault(), this.dispatch("clickEnd", e11); } position(e11) { if ("touchmove" === e11.type) var t9 = e11.touches[0].clientX, n8 = e11.touches[0].clientY; else t9 = e11.clientX, n8 = e11.clientY; if (this.connection && this.updateConnection(t9, n8), this.editor_selected && (i6 = this.canvas_x + -(this.pos_x - t9), s6 = this.canvas_y + -(this.pos_y - n8), this.dispatch("translate", { x: i6, y: s6 }), this.precanvas.style.transform = "translate(" + i6 + "px, " + s6 + "px) scale(" + this.zoom + ")"), this.drag) { e11.preventDefault(); var i6 = (this.pos_x - t9) * this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom), s6 = (this.pos_y - n8) * this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom); this.pos_x = t9, this.pos_y = n8, this.ele_selected.style.top = this.ele_selected.offsetTop - s6 + "px", this.ele_selected.style.left = this.ele_selected.offsetLeft - i6 + "px", this.drawflow.drawflow[this.module].data[this.ele_selected.id.slice(5)].pos_x = this.ele_selected.offsetLeft - i6, this.drawflow.drawflow[this.module].data[this.ele_selected.id.slice(5)].pos_y = this.ele_selected.offsetTop - s6, this.updateConnectionNodes(this.ele_selected.id); } if (this.drag_point) { i6 = (this.pos_x - t9) * this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom), s6 = (this.pos_y - n8) * this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom); this.pos_x = t9, this.pos_y = n8; var o7 = this.pos_x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - this.precanvas.getBoundingClientRect().x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)), l3 = this.pos_y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - this.precanvas.getBoundingClientRect().y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)); this.ele_selected.setAttributeNS(null, "cx", o7), this.ele_selected.setAttributeNS(null, "cy", l3); const e12 = this.ele_selected.parentElement.classList[2].slice(9), c6 = this.ele_selected.parentElement.classList[1].slice(13), d3 = this.ele_selected.parentElement.classList[3], a3 = this.ele_selected.parentElement.classList[4]; let r9 = Array.from(this.ele_selected.parentElement.children).indexOf(this.ele_selected) - 1; if (this.reroute_fix_curvature) { r9 -= this.ele_selected.parentElement.querySelectorAll(".main-path").length - 1, r9 < 0 && (r9 = 0); } const h5 = e12.slice(5), u3 = this.drawflow.drawflow[this.module].data[h5].outputs[d3].connections.findIndex(function(e13, t10) { return e13.node === c6 && e13.output === a3; }); this.drawflow.drawflow[this.module].data[h5].outputs[d3].connections[u3].points[r9] = { pos_x: o7, pos_y: l3 }; const p3 = this.ele_selected.parentElement.classList[2].slice(9); this.updateConnectionNodes(p3); } "touchmove" === e11.type && (this.mouse_x = t9, this.mouse_y = n8), this.dispatch("mouseMove", { x: t9, y: n8 }); } dragEnd(e11) { if ("touchend" === e11.type) var t9 = this.mouse_x, n8 = this.mouse_y, i6 = document.elementFromPoint(t9, n8); else t9 = e11.clientX, n8 = e11.clientY, i6 = e11.target; if (this.drag && (this.pos_x_start == t9 && this.pos_y_start == n8 || this.dispatch("nodeMoved", this.ele_selected.id.slice(5))), this.drag_point && (this.ele_selected.classList.remove("selected"), this.pos_x_start == t9 && this.pos_y_start == n8 || this.dispatch("rerouteMoved", this.ele_selected.parentElement.classList[2].slice(14))), this.editor_selected && (this.canvas_x = this.canvas_x + -(this.pos_x - t9), this.canvas_y = this.canvas_y + -(this.pos_y - n8), this.editor_selected = false), true === this.connection) if ("input" === i6.classList[0] || this.force_first_input && (null != i6.closest(".drawflow_content_node") || "drawflow-node" === i6.classList[0])) { if (!this.force_first_input || null == i6.closest(".drawflow_content_node") && "drawflow-node" !== i6.classList[0]) s6 = i6.parentElement.parentElement.id, o7 = i6.classList[1]; else { if (null != i6.closest(".drawflow_content_node")) var s6 = i6.closest(".drawflow_content_node").parentElement.id; else var s6 = i6.id; if (0 === Object.keys(this.getNodeFromId(s6.slice(5)).inputs).length) var o7 = false; else var o7 = "input_1"; } var l3 = this.ele_selected.parentElement.parentElement.id, c6 = this.ele_selected.classList[1]; if (l3 !== s6 && false !== o7) { if (0 === this.container.querySelectorAll(".connection.node_in_" + s6 + ".node_out_" + l3 + "." + c6 + "." + o7).length) { this.connection_ele.classList.add("node_in_" + s6), this.connection_ele.classList.add("node_out_" + l3), this.connection_ele.classList.add(c6), this.connection_ele.classList.add(o7); var d3 = s6.slice(5), a3 = l3.slice(5); this.drawflow.drawflow[this.module].data[a3].outputs[c6].connections.push({ node: d3, output: o7 }), this.drawflow.drawflow[this.module].data[d3].inputs[o7].connections.push({ node: a3, input: c6 }), this.updateConnectionNodes("node-" + a3), this.updateConnectionNodes("node-" + d3), this.dispatch("connectionCreated", { output_id: a3, input_id: d3, output_class: c6, input_class: o7 }); } else this.dispatch("connectionCancel", true), this.connection_ele.remove(); this.connection_ele = null; } else this.dispatch("connectionCancel", true), this.connection_ele.remove(), this.connection_ele = null; } else this.dispatch("connectionCancel", true), this.connection_ele.remove(), this.connection_ele = null; this.drag = false, this.drag_point = false, this.connection = false, this.ele_selected = null, this.editor_selected = false, this.dispatch("mouseUp", e11); } contextmenu(e11) { if (this.dispatch("contextmenu", e11), e11.preventDefault(), "fixed" === this.editor_mode || "view" === this.editor_mode) return false; if (this.precanvas.getElementsByClassName("drawflow-delete").length && this.precanvas.getElementsByClassName("drawflow-delete")[0].remove(), this.node_selected || this.connection_selected) { var t9 = document.createElement("div"); t9.classList.add("drawflow-delete"), t9.innerHTML = "x", this.node_selected && this.node_selected.appendChild(t9), this.connection_selected && this.connection_selected.parentElement.classList.length > 1 && (t9.style.top = e11.clientY * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - this.precanvas.getBoundingClientRect().y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) + "px", t9.style.left = e11.clientX * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - this.precanvas.getBoundingClientRect().x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) + "px", this.precanvas.appendChild(t9)); } } contextmenuDel() { this.precanvas.getElementsByClassName("drawflow-delete").length && this.precanvas.getElementsByClassName("drawflow-delete")[0].remove(); } key(e11) { if (this.dispatch("keydown", e11), "fixed" === this.editor_mode || "view" === this.editor_mode) return false; ("Delete" === e11.key || "Backspace" === e11.key && e11.metaKey) && (null != this.node_selected && "INPUT" !== this.first_click.tagName && "TEXTAREA" !== this.first_click.tagName && true !== this.first_click.hasAttribute("contenteditable") && this.removeNodeId(this.node_selected.id), null != this.connection_selected && this.removeConnection()); } zoom_enter(e11, t9) { e11.ctrlKey && (e11.preventDefault(), e11.deltaY > 0 ? this.zoom_out() : this.zoom_in()); } zoom_refresh() { this.dispatch("zoom", this.zoom), this.canvas_x = this.canvas_x / this.zoom_last_value * this.zoom, this.canvas_y = this.canvas_y / this.zoom_last_value * this.zoom, this.zoom_last_value = this.zoom, this.precanvas.style.transform = "translate(" + this.canvas_x + "px, " + this.canvas_y + "px) scale(" + this.zoom + ")"; } zoom_in() { this.zoom < this.zoom_max && (this.zoom += this.zoom_value, this.zoom_refresh()); } zoom_out() { this.zoom > this.zoom_min && (this.zoom -= this.zoom_value, this.zoom_refresh()); } zoom_reset() { 1 != this.zoom && (this.zoom = 1, this.zoom_refresh()); } createCurvature(e11, t9, n8, i6, s6, o7) { var l3 = e11, c6 = t9, d3 = n8, a3 = i6, r9 = s6; switch (o7) { case "open": if (e11 >= n8) var h5 = l3 + Math.abs(d3 - l3) * r9, u3 = d3 - Math.abs(d3 - l3) * (-1 * r9); else h5 = l3 + Math.abs(d3 - l3) * r9, u3 = d3 - Math.abs(d3 - l3) * r9; return " M " + l3 + " " + c6 + " C " + h5 + " " + c6 + " " + u3 + " " + a3 + " " + d3 + " " + a3; case "close": if (e11 >= n8) h5 = l3 + Math.abs(d3 - l3) * (-1 * r9), u3 = d3 - Math.abs(d3 - l3) * r9; else h5 = l3 + Math.abs(d3 - l3) * r9, u3 = d3 - Math.abs(d3 - l3) * r9; return " M " + l3 + " " + c6 + " C " + h5 + " " + c6 + " " + u3 + " " + a3 + " " + d3 + " " + a3; case "other": if (e11 >= n8) h5 = l3 + Math.abs(d3 - l3) * (-1 * r9), u3 = d3 - Math.abs(d3 - l3) * (-1 * r9); else h5 = l3 + Math.abs(d3 - l3) * r9, u3 = d3 - Math.abs(d3 - l3) * r9; return " M " + l3 + " " + c6 + " C " + h5 + " " + c6 + " " + u3 + " " + a3 + " " + d3 + " " + a3; default: return " M " + l3 + " " + c6 + " C " + (h5 = l3 + Math.abs(d3 - l3) * r9) + " " + c6 + " " + (u3 = d3 - Math.abs(d3 - l3) * r9) + " " + a3 + " " + d3 + " " + a3; } } drawConnection(e11) { var t9 = document.createElementNS("http://www.w3.org/2000/svg", "svg"); this.connection_ele = t9; var n8 = document.createElementNS("http://www.w3.org/2000/svg", "path"); n8.classList.add("main-path"), n8.setAttributeNS(null, "d", ""), t9.classList.add("connection"), t9.appendChild(n8), this.precanvas.appendChild(t9); var i6 = e11.parentElement.parentElement.id.slice(5), s6 = e11.classList[1]; this.dispatch("connectionStart", { output_id: i6, output_class: s6 }); } updateConnection(e11, t9) { const n8 = this.precanvas, i6 = this.zoom; let s6 = n8.clientWidth / (n8.clientWidth * i6); s6 = s6 || 0; let o7 = n8.clientHeight / (n8.clientHeight * i6); o7 = o7 || 0; var l3 = this.connection_ele.children[0], c6 = this.ele_selected.offsetWidth / 2 + (this.ele_selected.getBoundingClientRect().x - n8.getBoundingClientRect().x) * s6, d3 = this.ele_selected.offsetHeight / 2 + (this.ele_selected.getBoundingClientRect().y - n8.getBoundingClientRect().y) * o7, a3 = e11 * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - this.precanvas.getBoundingClientRect().x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)), r9 = t9 * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - this.precanvas.getBoundingClientRect().y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)), h5 = this.curvature, u3 = this.createCurvature(c6, d3, a3, r9, h5, "openclose"); l3.setAttributeNS(null, "d", u3); } addConnection(e11, t9, n8, i6) { var s6 = this.getModuleFromNodeId(e11); if (s6 === this.getModuleFromNodeId(t9)) { var o7 = this.getNodeFromId(e11), l3 = false; for (var c6 in o7.outputs[n8].connections) { var d3 = o7.outputs[n8].connections[c6]; d3.node == t9 && d3.output == i6 && (l3 = true); } if (false === l3) { if (this.drawflow.drawflow[s6].data[e11].outputs[n8].connections.push({ node: t9.toString(), output: i6 }), this.drawflow.drawflow[s6].data[t9].inputs[i6].connections.push({ node: e11.toString(), input: n8 }), this.module === s6) { var a3 = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r9 = document.createElementNS("http://www.w3.org/2000/svg", "path"); r9.classList.add("main-path"), r9.setAttributeNS(null, "d", ""), a3.classList.add("connection"), a3.classList.add("node_in_node-" + t9), a3.classList.add("node_out_node-" + e11), a3.classList.add(n8), a3.classList.add(i6), a3.appendChild(r9), this.precanvas.appendChild(a3), this.updateConnectionNodes("node-" + e11), this.updateConnectionNodes("node-" + t9); } this.dispatch("connectionCreated", { output_id: e11, input_id: t9, output_class: n8, input_class: i6 }); } } } updateConnectionNodes(e11) { const t9 = "node_in_" + e11, n8 = "node_out_" + e11; this.line_path; const i6 = this.container, s6 = this.precanvas, o7 = this.curvature, l3 = this.createCurvature, c6 = this.reroute_curvature, d3 = this.reroute_curvature_start_end, a3 = this.reroute_fix_curvature, r9 = this.reroute_width, h5 = this.zoom; let u3 = s6.clientWidth / (s6.clientWidth * h5); u3 = u3 || 0; let p3 = s6.clientHeight / (s6.clientHeight * h5); p3 = p3 || 0; const f5 = i6.querySelectorAll("." + n8); Object.keys(f5).map(function(t10, n9) { if (null === f5[t10].querySelector(".point")) { var m4 = i6.querySelector("#" + e11), g3 = f5[t10].classList[1].replace("node_in_", ""), _3 = i6.querySelector("#" + g3).querySelectorAll("." + f5[t10].classList[4])[0], w3 = _3.offsetWidth / 2 + (_3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, v3 = _3.offsetHeight / 2 + (_3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, y3 = m4.querySelectorAll("." + f5[t10].classList[3])[0], C = y3.offsetWidth / 2 + (y3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, x4 = y3.offsetHeight / 2 + (y3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3; const n10 = l3(C, x4, w3, v3, o7, "openclose"); f5[t10].children[0].setAttributeNS(null, "d", n10); } else { const n10 = f5[t10].querySelectorAll(".point"); let o8 = ""; const m5 = []; n10.forEach((t11, a4) => { if (0 === a4 && n10.length - 1 == 0) { var f6 = i6.querySelector("#" + e11), g4 = ((x5 = t11).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, _4 = (x5.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, w4 = (L = f6.querySelectorAll("." + t11.parentElement.classList[3])[0]).offsetWidth / 2 + (L.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, v4 = L.offsetHeight / 2 + (L.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, y4 = l3(w4, v4, g4, _4, d3, "open"); o8 += y4, m5.push(y4); f6 = t11; var C2 = t11.parentElement.classList[1].replace("node_in_", ""), x5 = (E3 = i6.querySelector("#" + C2)).querySelectorAll("." + t11.parentElement.classList[4])[0]; g4 = (R3 = E3.querySelectorAll("." + t11.parentElement.classList[4])[0]).offsetWidth / 2 + (R3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, _4 = R3.offsetHeight / 2 + (R3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, w4 = (f6.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, v4 = (f6.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, y4 = l3(w4, v4, g4, _4, d3, "close"); o8 += y4, m5.push(y4); } else if (0 === a4) { var L; f6 = i6.querySelector("#" + e11), g4 = ((x5 = t11).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, _4 = (x5.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, w4 = (L = f6.querySelectorAll("." + t11.parentElement.classList[3])[0]).offsetWidth / 2 + (L.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, v4 = L.offsetHeight / 2 + (L.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, y4 = l3(w4, v4, g4, _4, d3, "open"); o8 += y4, m5.push(y4); f6 = t11, g4 = ((x5 = n10[a4 + 1]).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, _4 = (x5.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, w4 = (f6.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, v4 = (f6.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, y4 = l3(w4, v4, g4, _4, c6, "other"); o8 += y4, m5.push(y4); } else if (a4 === n10.length - 1) { var E3, R3; f6 = t11, C2 = t11.parentElement.classList[1].replace("node_in_", ""), x5 = (E3 = i6.querySelector("#" + C2)).querySelectorAll("." + t11.parentElement.classList[4])[0], g4 = (R3 = E3.querySelectorAll("." + t11.parentElement.classList[4])[0]).offsetWidth / 2 + (R3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, _4 = R3.offsetHeight / 2 + (R3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, w4 = (f6.getBoundingClientRect().x - s6.getBoundingClientRect().x) * (s6.clientWidth / (s6.clientWidth * h5)) + r9, v4 = (f6.getBoundingClientRect().y - s6.getBoundingClientRect().y) * (s6.clientHeight / (s6.clientHeight * h5)) + r9, y4 = l3(w4, v4, g4, _4, d3, "close"); o8 += y4, m5.push(y4); } else { f6 = t11, g4 = ((x5 = n10[a4 + 1]).getBoundingClientRect().x - s6.getBoundingClientRect().x) * (s6.clientWidth / (s6.clientWidth * h5)) + r9, _4 = (x5.getBoundingClientRect().y - s6.getBoundingClientRect().y) * (s6.clientHeight / (s6.clientHeight * h5)) + r9, w4 = (f6.getBoundingClientRect().x - s6.getBoundingClientRect().x) * (s6.clientWidth / (s6.clientWidth * h5)) + r9, v4 = (f6.getBoundingClientRect().y - s6.getBoundingClientRect().y) * (s6.clientHeight / (s6.clientHeight * h5)) + r9, y4 = l3(w4, v4, g4, _4, c6, "other"); o8 += y4, m5.push(y4); } }), a3 ? m5.forEach((e12, n11) => { f5[t10].children[n11].setAttributeNS(null, "d", e12); }) : f5[t10].children[0].setAttributeNS(null, "d", o8); } }); const m3 = i6.querySelectorAll("." + t9); Object.keys(m3).map(function(t10, n9) { if (null === m3[t10].querySelector(".point")) { var h6 = i6.querySelector("#" + e11), f6 = m3[t10].classList[2].replace("node_out_", ""), g3 = i6.querySelector("#" + f6).querySelectorAll("." + m3[t10].classList[3])[0], _3 = g3.offsetWidth / 2 + (g3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, w3 = g3.offsetHeight / 2 + (g3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, v3 = (h6 = h6.querySelectorAll("." + m3[t10].classList[4])[0]).offsetWidth / 2 + (h6.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, y3 = h6.offsetHeight / 2 + (h6.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3; const n10 = l3(_3, w3, v3, y3, o7, "openclose"); m3[t10].children[0].setAttributeNS(null, "d", n10); } else { const n10 = m3[t10].querySelectorAll(".point"); let o8 = ""; const h7 = []; n10.forEach((t11, a4) => { if (0 === a4 && n10.length - 1 == 0) { var f7 = i6.querySelector("#" + e11), m4 = ((C = t11).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, g4 = (C.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, _4 = (E3 = f7.querySelectorAll("." + t11.parentElement.classList[4])[0]).offsetWidth / 2 + (E3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, w4 = E3.offsetHeight / 2 + (E3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, v4 = l3(m4, g4, _4, w4, d3, "close"); o8 += v4, h7.push(v4); f7 = t11; var y4 = t11.parentElement.classList[2].replace("node_out_", ""), C = (L = i6.querySelector("#" + y4)).querySelectorAll("." + t11.parentElement.classList[3])[0]; m4 = (x4 = L.querySelectorAll("." + t11.parentElement.classList[3])[0]).offsetWidth / 2 + (x4.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, g4 = x4.offsetHeight / 2 + (x4.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, _4 = (f7.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, w4 = (f7.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, v4 = l3(m4, g4, _4, w4, d3, "open"); o8 += v4, h7.push(v4); } else if (0 === a4) { var x4; f7 = t11, y4 = t11.parentElement.classList[2].replace("node_out_", ""), C = (L = i6.querySelector("#" + y4)).querySelectorAll("." + t11.parentElement.classList[3])[0], m4 = (x4 = L.querySelectorAll("." + t11.parentElement.classList[3])[0]).offsetWidth / 2 + (x4.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, g4 = x4.offsetHeight / 2 + (x4.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, _4 = (f7.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, w4 = (f7.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, v4 = l3(m4, g4, _4, w4, d3, "open"); o8 += v4, h7.push(v4); f7 = t11, _4 = ((C = n10[a4 + 1]).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, w4 = (C.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, m4 = (f7.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, g4 = (f7.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, v4 = l3(m4, g4, _4, w4, c6, "other"); o8 += v4, h7.push(v4); } else if (a4 === n10.length - 1) { var L, E3; f7 = t11, y4 = t11.parentElement.classList[1].replace("node_in_", ""), C = (L = i6.querySelector("#" + y4)).querySelectorAll("." + t11.parentElement.classList[4])[0], _4 = (E3 = L.querySelectorAll("." + t11.parentElement.classList[4])[0]).offsetWidth / 2 + (E3.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3, w4 = E3.offsetHeight / 2 + (E3.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3, m4 = (f7.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, g4 = (f7.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, v4 = l3(m4, g4, _4, w4, d3, "close"); o8 += v4, h7.push(v4); } else { f7 = t11, _4 = ((C = n10[a4 + 1]).getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, w4 = (C.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, m4 = (f7.getBoundingClientRect().x - s6.getBoundingClientRect().x) * u3 + r9, g4 = (f7.getBoundingClientRect().y - s6.getBoundingClientRect().y) * p3 + r9, v4 = l3(m4, g4, _4, w4, c6, "other"); o8 += v4, h7.push(v4); } }), a3 ? h7.forEach((e12, n11) => { m3[t10].children[n11].setAttributeNS(null, "d", e12); }) : m3[t10].children[0].setAttributeNS(null, "d", o8); } }); } dblclick(e11) { null != this.connection_selected && this.reroute && this.createReroutePoint(this.connection_selected), "point" === e11.target.classList[0] && this.removeReroutePoint(e11.target); } createReroutePoint(e11) { this.connection_selected.classList.remove("selected"); const t9 = this.connection_selected.parentElement.classList[2].slice(9), n8 = this.connection_selected.parentElement.classList[1].slice(13), i6 = this.connection_selected.parentElement.classList[3], s6 = this.connection_selected.parentElement.classList[4]; this.connection_selected = null; const o7 = document.createElementNS("http://www.w3.org/2000/svg", "circle"); o7.classList.add("point"); var l3 = this.pos_x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - this.precanvas.getBoundingClientRect().x * (this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)), c6 = this.pos_y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - this.precanvas.getBoundingClientRect().y * (this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)); o7.setAttributeNS(null, "cx", l3), o7.setAttributeNS(null, "cy", c6), o7.setAttributeNS(null, "r", this.reroute_width); let d3 = 0; if (this.reroute_fix_curvature) { const t10 = e11.parentElement.querySelectorAll(".main-path").length; var a3 = document.createElementNS("http://www.w3.org/2000/svg", "path"); if (a3.classList.add("main-path"), a3.setAttributeNS(null, "d", ""), e11.parentElement.insertBefore(a3, e11.parentElement.children[t10]), 1 === t10) e11.parentElement.appendChild(o7); else { const n9 = Array.from(e11.parentElement.children).indexOf(e11); d3 = n9, e11.parentElement.insertBefore(o7, e11.parentElement.children[n9 + t10 + 1]); } } else e11.parentElement.appendChild(o7); const r9 = t9.slice(5), h5 = this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections.findIndex(function(e12, t10) { return e12.node === n8 && e12.output === s6; }); void 0 === this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points && (this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points = []), this.reroute_fix_curvature ? (d3 > 0 || this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points !== [] ? this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points.splice(d3, 0, { pos_x: l3, pos_y: c6 }) : this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points.push({ pos_x: l3, pos_y: c6 }), e11.parentElement.querySelectorAll(".main-path").forEach((e12, t10) => { e12.classList.remove("selected"); })) : this.drawflow.drawflow[this.module].data[r9].outputs[i6].connections[h5].points.push({ pos_x: l3, pos_y: c6 }), this.dispatch("addReroute", r9), this.updateConnectionNodes(t9); } removeReroutePoint(e11) { const t9 = e11.parentElement.classList[2].slice(9), n8 = e11.parentElement.classList[1].slice(13), i6 = e11.parentElement.classList[3], s6 = e11.parentElement.classList[4]; let o7 = Array.from(e11.parentElement.children).indexOf(e11); const l3 = t9.slice(5), c6 = this.drawflow.drawflow[this.module].data[l3].outputs[i6].connections.findIndex(function(e12, t10) { return e12.node === n8 && e12.output === s6; }); if (this.reroute_fix_curvature) { const t10 = e11.parentElement.querySelectorAll(".main-path").length; e11.parentElement.children[t10 - 1].remove(), o7 -= t10, o7 < 0 && (o7 = 0); } else o7--; this.drawflow.drawflow[this.module].data[l3].outputs[i6].connections[c6].points.splice(o7, 1), e11.remove(), this.dispatch("removeReroute", l3), this.updateConnectionNodes(t9); } registerNode(e11, t9, n8 = null, i6 = null) { this.noderegister[e11] = { html: t9, props: n8, options: i6 }; } getNodeFromId(e11) { var t9 = this.getModuleFromNodeId(e11); return JSON.parse(JSON.stringify(this.drawflow.drawflow[t9].data[e11])); } getNodesFromName(e11) { var t9 = []; const n8 = this.drawflow.drawflow; return Object.keys(n8).map(function(i6, s6) { for (var o7 in n8[i6].data) n8[i6].data[o7].name == e11 && t9.push(n8[i6].data[o7].id); }), t9; } addNode(e11, t9, n8, i6, s6, o7, l3, c6, d3 = false) { if (this.useuuid) var a3 = this.getUuid(); else a3 = this.nodeId; const r9 = document.createElement("div"); r9.classList.add("parent-node"); const h5 = document.createElement("div"); h5.innerHTML = "", h5.setAttribute("id", "node-" + a3), h5.classList.add("drawflow-node"), "" != o7 && h5.classList.add(...o7.split(" ")); const u3 = document.createElement("div"); u3.classList.add("inputs"); const p3 = document.createElement("div"); p3.classList.add("outputs"); const f5 = {}; for (var m3 = 0; m3 < t9; m3++) { const e12 = document.createElement("div"); e12.classList.add("input"), e12.classList.add("input_" + (m3 + 1)), f5["input_" + (m3 + 1)] = { connections: [] }, u3.appendChild(e12); } const g3 = {}; for (m3 = 0; m3 < n8; m3++) { const e12 = document.createElement("div"); e12.classList.add("output"), e12.classList.add("output_" + (m3 + 1)), g3["output_" + (m3 + 1)] = { connections: [] }, p3.appendChild(e12); } const _3 = document.createElement("div"); if (_3.classList.add("drawflow_content_node"), false === d3) _3.innerHTML = c6; else if (true === d3) _3.appendChild(this.noderegister[c6].html.cloneNode(true)); else if (3 === parseInt(this.render.version)) { let e12 = this.render.h(this.noderegister[c6].html, this.noderegister[c6].props, this.noderegister[c6].options); e12.appContext = this.parent, this.render.render(e12, _3); } else { let e12 = new this.render({ parent: this.parent, render: (e13) => e13(this.noderegister[c6].html, { props: this.noderegister[c6].props }), ...this.noderegister[c6].options }).$mount(); _3.appendChild(e12.$el); } Object.entries(l3).forEach(function(e12, t10) { if ("object" == typeof e12[1]) !function e13(t11, n10, i8) { if (null === t11) t11 = l3[n10]; else t11 = t11[n10]; null !== t11 && Object.entries(t11).forEach(function(n11, s7) { if ("object" == typeof n11[1]) e13(t11, n11[0], i8 + "-" + n11[0]); else for (var o8 = _3.querySelectorAll("[df-" + i8 + "-" + n11[0] + "]"), l4 = 0; l4 < o8.length; l4++) o8[l4].value = n11[1], o8[l4].isContentEditable && (o8[l4].innerText = n11[1]); }); }(null, e12[0], e12[0]); else for (var n9 = _3.querySelectorAll("[df-" + e12[0] + "]"), i7 = 0; i7 < n9.length; i7++) n9[i7].value = e12[1], n9[i7].isContentEditable && (n9[i7].innerText = e12[1]); }), h5.appendChild(u3), h5.appendChild(_3), h5.appendChild(p3), h5.style.top = s6 + "px", h5.style.left = i6 + "px", r9.appendChild(h5), this.precanvas.appendChild(r9); var w3 = { id: a3, name: e11, data: l3, class: o7, html: c6, typenode: d3, inputs: f5, outputs: g3, pos_x: i6, pos_y: s6 }; return this.drawflow.drawflow[this.module].data[a3] = w3, this.dispatch("nodeCreated", a3), this.useuuid || this.nodeId++, a3; } addNodeImport(e11, t9) { const n8 = document.createElement("div"); n8.classList.add("parent-node"); const i6 = document.createElement("div"); i6.innerHTML = "", i6.setAttribute("id", "node-" + e11.id), i6.classList.add("drawflow-node"), "" != e11.class && i6.classList.add(...e11.class.split(" ")); const s6 = document.createElement("div"); s6.classList.add("inputs"); const o7 = document.createElement("div");