"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index$1 = require("./api/index.js");
const getInstance = require("../../../utils/getInstance.js");
const index = require("../flowChart/index.js");
;/* empty css                */
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
const _sfc_main = {
  __name: "flowChart",
  props: {
    traceNo: {
      type: String,
      required: true
    },
    type: {
      type: String,
      default: "app"
    }
  },
  emits: ["loaded"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const flowchartCanvasRef = Vue.ref();
    const emit = __emit;
    const ctx = getInstance.getCurrentVueInstance();
    let flowChart;
    Vue.onMounted(() => {
      flowChart = new index.default(".flowchart-canvas");
      importChartData(props.traceNo);
    });
    Vue.watch(
      () => props.traceNo,
      (traceNo) => {
        importChartData(traceNo);
      },
      {
        immediate: true
      }
    );
    function importChartData(traceNo) {
      if (flowChart && traceNo) {
        index$1.default.findFlowChartByTraceNo(ctx.$http, traceNo, props.type).then((data) => {
          if (data) {
            flowChart.import(data);
            Vue.nextTick(() => {
              emit("loaded", flowchartCanvasRef.value);
            });
          }
        });
      }
    }
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createElementBlock("div", {
        class: "flowchart-canvas",
        ref_key: "flowchartCanvasRef",
        ref: flowchartCanvasRef
      }, null, 512);
    };
  }
};
const FecFlowChart = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-7728ec91"]]);
exports.default = FecFlowChart;
