"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const TreeNode = ;/* empty css              */
const Add = require("./Add.vue2.js");
;/* empty css                 */
const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
const _hoisted_1 = { class: "gateway-node" };
const _hoisted_2 = { class: "add-branch" };
const _hoisted_3 = ["onClick"];
const _hoisted_4 = ["onClick"];
const _sfc_main = {
  __name: "GatewayNode",
  props: {
    node: Object
  },
  emits: ["addNode"],
  setup(__props, { emit: __emit }) {
    const $emits = __emit;
    const props = __props;
    const { readOnly } = Vue.inject("flowDesign", { readOnly: Vue.ref(false) });
    const addNode = (type, node) => {
      $emits("addNode", type, node || props.node);
    };
    const moveRight = (index) => {
      const node = props.node.branches[index];
      props.node.branches.splice(index, 1);
      props.node.branches.splice(index + 1, 0, node);
    };
    const moveLeft = (index) => {
      const node = props.node.branches[index];
      props.node.branches.splice(index, 1);
      props.node.branches.splice(index - 1, 0, node);
    };
    return (_ctx, _cache) => {
      const _component_svg_icon = Vue.resolveComponent("svg-icon");
      return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
        Vue.createElementVNode("div", _hoisted_1, [
          Vue.createElementVNode("div", _hoisted_2, [
            Vue.renderSlot(_ctx.$slots, "default", {
              addNode,
              readOnly: Vue.unref(readOnly)
            }, void 0, true)
          ]),
          (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.node.branches, (item, index) => {
            return Vue.openBlock(), Vue.createElementBlock("div", {
              key: item.id,
              class: "col-box"
            }, [
              index === 0 ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 0 }, [
                _cache[0] || (_cache[0] = Vue.createElementVNode("div", { class: "top-left-border" }, null, -1)),
                _cache[1] || (_cache[1] = Vue.createElementVNode("div", { class: "bottom-left-border" }, null, -1))
              ], 64)) : __props.node.branches.length === index + 1 ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 1 }, [
                _cache[2] || (_cache[2] = Vue.createElementVNode("div", { class: "top-right-border" }, null, -1)),
                _cache[3] || (_cache[3] = Vue.createElementVNode("div", { class: "bottom-right-border" }, null, -1))
              ], 64)) : Vue.createCommentVNode("", true),
              Vue.createVNode(TreeNode.default, Vue.mergeProps({
                node: item,
                ref_for: true
              }, _ctx.$attrs, {
                onAddNode: addNode,
                class: "col-node"
              }), {
                append: Vue.withCtx(() => [
                  Vue.withDirectives(Vue.createElementVNode("div", {
                    class: "move-left",
                    onClick: Vue.withModifiers(($event) => moveLeft(index), ["stop"])
                  }, [
                    Vue.createVNode(_component_svg_icon, { name: "el:ArrowLeft" })
                  ], 8, _hoisted_3), [
                    [Vue.vShow, index !== 0 && __props.node.branches.length !== index + 1 && !Vue.unref(readOnly)]
                  ]),
                  Vue.withDirectives(Vue.createElementVNode("div", {
                    class: "move-right",
                    onClick: Vue.withModifiers(($event) => moveRight(index), ["stop"])
                  }, [
                    Vue.createVNode(_component_svg_icon, { name: "el:ArrowRight" })
                  ], 8, _hoisted_4), [
                    [Vue.vShow, ![index + 1, index + 2].includes(__props.node.branches.length) && !Vue.unref(readOnly)]
                  ])
                ]),
                _: 2
              }, 1040, ["node"])
            ]);
          }), 128))
        ]),
        Vue.createVNode(Add.default, {
          onAddNode: addNode,
          class: "branch-but"
        })
      ], 64);
    };
  }
};
const GatewayNode = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-3050b6e4"]]);
exports.default = GatewayNode;
