function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Layer } from "mobility-toolbox-js/ol";
import TrafimageMapboxLayer from "../../layers/TrafimageMapboxLayer";
import MapboxStyleLayer from "../../layers/MapboxStyleLayer";
import SchmalspurLayer from "../../layers/SchmalspurLayer";
import { KilometrageLayer } from "../../layers";
import { MapsIsbFilter, MapsIsbFilterValues } from "../../utils/constants";

// eslint-disable-next-line import/prefer-default-export
export const getIsbLayers = () => {
  const netzkarteIsb = new TrafimageMapboxLayer({
    name: "ch.sbb.isb",
    visible: true,
    zIndex: -1,
    style: "basemap_infra_bright_ch.sbb.infrastrukturbetreiber",
    properties: {
      isBaseLayer: true
    },
    mapOptions: {
      preserveDrawingBuffer: true
    }
  });

  // Order is important for the legend
  // WARNING: use UPPER CASE for the key
  const shortToLongNameOther = {
    AB: "Appenzeller Bahnen",
    asm: "Aare Seeland mobil AG",
    AVA: "Aargau Verkehr AG",
    DB: "Deutsche Bahn AG",
    ÖBB: "Österreichische Bundesbahnen",
    RB: "Rigi Bahnen",
    RBS: "Regionalverkehr Bern-Solothurn AG",
    RhB: "Rhätische Bahn AG",
    SEHR: "Stein am Rhein-Etzwilen-Hemishofen-Ramsen-Bahn",
    SZU: "Sihltal Zürich Uetliberg Bahn SZU AG",
    TL: "Transports publics de la région lausannoise",
    VVT: "Vapeur Val-de-Travers",
    zb: "Zentralbahn AG"
  };
  const isbOther = new MapboxStyleLayer({
    name: "ch.sbb.isb.other",
    mapboxLayer: netzkarteIsb,
    styleLayersFilter: _ref => {
      let {
        metadata
      } = _ref;
      return [MapsIsbFilterValues.OTHER, MapsIsbFilterValues.OTHER_HIGHLIGHT, MapsIsbFilterValues.OTHER_FLAG].includes(metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]);
    },
    queryRenderedLayersFilter: _ref2 => {
      let {
        metadata
      } = _ref2;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]) === MapsIsbFilterValues.OTHER;
    },
    properties: {
      isQueryable: true,
      hasInfos: true,
      useOverlay: true,
      popupComponent: "IsbPopup",
      layerInfoComponent: "IsbOtherLayerInfo",
      shortToLongName: shortToLongNameOther,
      defaultColor: "rgba(153, 71, 241, 1)" // Must be the same as in the style.
    }
  });

  // Order is important for the legend
  // WARNING: use UPPER CASE for the key
  const shortToLongNameTVS = {
    "SBB CFF FFS": "SBB Infrastruktur",
    BLS: "BLS Netz AG",
    SOB: "SOB AG Infrastruktur",
    CJ: "Compagnie des chemins de fer du Jura SA",
    ETB: "Emmentalbahn GmbH",
    HBS: "Hafenbahn Schweiz AG",
    OeBB: "Oensingen-Balsthal-Bahn",
    ST: "Sursee-Triengen-Bahn",
    SZU: "Sihltal Zürich Uetliberg Bahn SZU AG",
    TMR: "Transports de Martigny et Régions SA",
    TPF: "Transports publics fribourgeois SA",
    TRAVYS: "Travys",
    TRN: "Transports Publics Neuchâtelois"
  };
  const isbTVS = new MapboxStyleLayer({
    name: "ch.sbb.isb.tvs",
    mapboxLayer: netzkarteIsb,
    styleLayersFilter: _ref3 => {
      let {
        metadata
      } = _ref3;
      return [MapsIsbFilterValues.TVS, MapsIsbFilterValues.TVS_HIGHLIGHT, MapsIsbFilterValues.TVS_FLAG].includes(metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]);
    },
    queryRenderedLayersFilter: _ref4 => {
      let {
        metadata
      } = _ref4;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]) === MapsIsbFilterValues.TVS;
    },
    properties: {
      isQueryable: true,
      hasInfos: true,
      useOverlay: true,
      popupComponent: "IsbPopup",
      layerInfoComponent: "IsbTVSLayerInfo",
      shortToLongName: shortToLongNameTVS,
      defaultColor: "rgba(0,91,169 , 1)",
      // Must be the same as in the style.
      colors: {
        "SBB CFF FFS": "rgba(209, 1, 7, 1)",
        BLS: "rgba(53,164,48, 1)",
        SOB: "rgba(195, 156, 54, 1)"
      }
    }
  });
  const isbNormalspurbahnen = new Layer({
    name: "ch.sbb.isb.normalspurbahnen",
    visible: true,
    group: "ch.sbb.isb",
    children: [isbOther, isbTVS],
    properties: {
      hasInfos: true,
      layerInfoComponent: "IsbNormalspurLayerInfo",
      shortToLongName: _objectSpread(_objectSpread({}, shortToLongNameTVS), shortToLongNameOther)
    }
  });
  const shortToLongNameSchmalspur = {
    AB: "Appenzeller Bahnen",
    asm: "Aare Seeland mobil AG",
    AVA: "Aargau Verkehr AG",
    BLM: "Bergbahn Lauterbrunnen-Mürren AG",
    BLT: "Baselland Transport AG",
    BOB: "Berner Oberland-Bahn",
    CJ: "Compagnie des chemins de fer du Jura SA",
    DFB: "Dampfbahn Furka-Bergstrecke",
    FART: "Società per le Ferrovie Autolinee Regionali Ticinesi SA",
    FB: "Forchbahn AG",
    FLP: "Ferrovie Luganesi SA",
    LEB: "Compagnie du Chemin de fer Lausanne – Echallens – Bercher SA",
    MBC: "Transports de la région Morges – Bière – Cossonay SA",
    MGB: "Matterhorn Gotthard Verkehrs AG",
    MOB: "Compagnie du Chemin de fer Montreux Oberland bernois SA",
    MVR: "Transports Montreux-Vevey-Riviera",
    NStCM: "Compagnie du chemin de fer Nyon-St-Cergue-Morez SA",
    PAC: "Parc d'Attractions du Châtelard VS SA",
    RBS: "Regionalverkehr Bern-Solothurn AG",
    RhB: "Rhätische Bahn AG",
    TMR: "Transports de Martigny et Régions SA",
    TPC: "Transports publics du Chablais SA",
    TPF: "Transports publics fribourgeois SA",
    TPG: "Transports publics genevois SA",
    TRAVYS: "Travys",
    TRN: "Transports Publics Neuchâtelois",
    zb: "Zentralbahn AG"
  };
  const isbSchmalspurbahnen = new SchmalspurLayer({
    name: "ch.sbb.isb.schmalspurbahnen",
    visible: false,
    mapboxLayer: netzkarteIsb,
    group: "ch.sbb.isb",
    styleLayersFilter: _ref5 => {
      let {
        metadata
      } = _ref5;
      return [MapsIsbFilterValues.SCHMALSPUR_FLAG, MapsIsbFilterValues.SCHMALSPUR_LINE, MapsIsbFilterValues.SCHMALSPUR_LINE_HIGHLIGHT, MapsIsbFilterValues.SCHMALSPUR_STATIONEN].includes(metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]);
    },
    queryRenderedLayersFilter: _ref6 => {
      let {
        metadata
      } = _ref6;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsIsbFilter]) === MapsIsbFilterValues.SCHMALSPUR_LINE;
    },
    properties: {
      useOverlay: true,
      isQueryable: true,
      popupComponent: "SchmalspurPopup",
      hasInfos: true,
      shortToLongName: shortToLongNameSchmalspur,
      layerInfoComponent: "IsbSchmalspurLayerInfo"
    }
  });
  const kilometrageLayer = new KilometrageLayer({
    mapboxLayer: netzkarteIsb
  });
  return [kilometrageLayer, netzkarteIsb, isbSchmalspurbahnen, isbNormalspurbahnen];
};
//# sourceMappingURL=index.js.map