import { _ as h, B as m, E as r } from "./index-CgeNF-PU.js";
import { C as y } from "./ContentMixin-NLNFG_hM.js";
import { resolveComponent as p, openBlock as d, createElementBlock as l, createVNode as v } from "vue";
const g = {
  name: "ConnectivityGraph",
  mixins: [y],
  components: {
    MapUtilitiesConnectivityGraph: m
  },
  computed: {
    graphEntry() {
      return this.entry.resource;
    },
    connectivityError() {
      return {};
    },
    connectivityFromMap() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.connectivityFromMap) || null;
    },
    origins() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.origins) || [];
    },
    components() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.components) || [];
    },
    destinations() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.destinations) || [];
    },
    originsWithDatasets() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.originsWithDatasets) || [];
    },
    componentsWithDatasets() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.componentsWithDatasets) || [];
    },
    destinationsWithDatasets() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.destinationsWithDatasets) || [];
    },
    hasSingleConnectivityList() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.hasSingleConnectivityList) || !1;
    },
    originsCombinations() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.originsCombinations) || [];
    },
    componentsCombinations() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.componentsCombinations) || [];
    },
    destinationsCombinations() {
      var t;
      return ((t = this.entry.graphPayload) == null ? void 0 : t.destinationsCombinations) || [];
    },
    mapServer() {
      return this.entry.mapServer || null;
    },
    sckanVersion() {
      return this.entry.sckanVersion || null;
    }
  },
  methods: {
    onTapNode: function(t) {
      const i = t.map((s) => s.label).join(", ");
      this.onConnectivityHovered(i), i || r.emit("show-connectivity", {
        featureIds: [this.entry.resource]
      });
    },
    onConnectivityHovered: function(t) {
      const i = {
        connectivityInfo: this.graphEntry,
        label: t,
        data: t ? this.getConnectivityDatasets(t) : []
      };
      r.emit("connectivity-hovered", i);
    },
    getConnectivityDatasets: function(t) {
      var o;
      const i = ((o = this.entry.graphPayload) == null ? void 0 : o.allWithDatasets) || [], s = t.split(",");
      let a = [];
      return s.forEach((n) => {
        const e = i.find(
          (c) => c.name.toLowerCase().trim() === n.toLowerCase().trim()
        );
        e && a.push({
          id: e.id,
          label: e.name
        });
      }), a;
    }
  }
}, u = { class: "viewer-container" };
function C(t, i, s, a, o, n) {
  const e = p("MapUtilitiesConnectivityGraph");
  return d(), l("div", u, [
    v(e, {
      entry: n.graphEntry,
      mapServer: n.mapServer,
      sckanVersion: n.sckanVersion,
      connectivityFromMap: n.connectivityFromMap,
      connectivityError: n.connectivityError,
      origins: n.origins,
      components: n.components,
      destinations: n.destinations,
      originsWithDatasets: n.originsWithDatasets,
      componentsWithDatasets: n.componentsWithDatasets,
      destinationsWithDatasets: n.destinationsWithDatasets,
      hasSingleConnectivityList: n.hasSingleConnectivityList,
      originsCombinations: n.originsCombinations,
      componentsCombinations: n.componentsCombinations,
      destinationsCombinations: n.destinationsCombinations,
      onTapNode: n.onTapNode
    }, null, 8, ["entry", "mapServer", "sckanVersion", "connectivityFromMap", "connectivityError", "origins", "components", "destinations", "originsWithDatasets", "componentsWithDatasets", "destinationsWithDatasets", "hasSingleConnectivityList", "originsCombinations", "componentsCombinations", "destinationsCombinations", "onTapNode"])
  ]);
}
const b = /* @__PURE__ */ h(g, [["render", C], ["__scopeId", "data-v-485c95c8"]]);
export {
  b as default
};
