import './index2.js';
import './index5.js';
import './index3.js';
import { c as commonjsGlobal } from './_commonjsHelpers.js';
import './index6.js';

var lodash_isdate = {exports: {}};

/**
 * lodash (Custom Build) <https://lodash.com/>
 * Build: `lodash modularize exports="npm" -o ./`
 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */

var hasRequiredLodash_isdate;

function requireLodash_isdate () {
	if (hasRequiredLodash_isdate) return lodash_isdate.exports;
	hasRequiredLodash_isdate = 1;
	(function (module, exports) {
		/** `Object#toString` result references. */
		var dateTag = '[object Date]';

		/** Detect free variable `global` from Node.js. */
		var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;

		/** Detect free variable `exports`. */
		var freeExports = exports && !exports.nodeType && exports;

		/** Detect free variable `module`. */
		var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;

		/** Detect the popular CommonJS extension `module.exports`. */
		var moduleExports = freeModule && freeModule.exports === freeExports;

		/** Detect free variable `process` from Node.js. */
		var freeProcess = moduleExports && freeGlobal.process;

		/** Used to access faster Node.js helpers. */
		var nodeUtil = (function() {
		  try {
		    return freeProcess && freeProcess.binding('util');
		  } catch (e) {}
		}());

		/* Node.js helper references. */
		var nodeIsDate = nodeUtil && nodeUtil.isDate;

		/**
		 * The base implementation of `_.unary` without support for storing metadata.
		 *
		 * @private
		 * @param {Function} func The function to cap arguments for.
		 * @returns {Function} Returns the new capped function.
		 */
		function baseUnary(func) {
		  return function(value) {
		    return func(value);
		  };
		}

		/** Used for built-in method references. */
		var objectProto = Object.prototype;

		/**
		 * Used to resolve the
		 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
		 * of values.
		 */
		var objectToString = objectProto.toString;

		/**
		 * The base implementation of `_.isDate` without Node.js optimizations.
		 *
		 * @private
		 * @param {*} value The value to check.
		 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
		 */
		function baseIsDate(value) {
		  return isObjectLike(value) && objectToString.call(value) == dateTag;
		}

		/**
		 * Checks if `value` is classified as a `Date` object.
		 *
		 * @static
		 * @memberOf _
		 * @since 0.1.0
		 * @category Lang
		 * @param {*} value The value to check.
		 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
		 * @example
		 *
		 * _.isDate(new Date);
		 * // => true
		 *
		 * _.isDate('Mon April 23 2012');
		 * // => false
		 */
		var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;

		/**
		 * Checks if `value` is object-like. A value is object-like if it's not `null`
		 * and has a `typeof` result of "object".
		 *
		 * @static
		 * @memberOf _
		 * @since 4.0.0
		 * @category Lang
		 * @param {*} value The value to check.
		 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
		 * @example
		 *
		 * _.isObjectLike({});
		 * // => true
		 *
		 * _.isObjectLike([1, 2, 3]);
		 * // => true
		 *
		 * _.isObjectLike(_.noop);
		 * // => false
		 *
		 * _.isObjectLike(null);
		 * // => false
		 */
		function isObjectLike(value) {
		  return !!value && typeof value == 'object';
		}

		module.exports = isDate; 
	} (lodash_isdate, lodash_isdate.exports));
	return lodash_isdate.exports;
}

requireLodash_isdate();

/**
 * Returns `true` if the keyboard event was triggered by the `Space` key
 */
function isSpaceKey(event) {
    return event.key === ' ';
}
/**
 * Returns `true` if the keyboard event was triggered by the `Escape` key
 */
function isEscapeKey(event) {
    return event.key === 'Escape';
}

var RequestState;
(function (RequestState) {
    RequestState[RequestState["INIT"] = 0] = "INIT";
    RequestState[RequestState["RUNNING"] = 1] = "RUNNING";
    RequestState[RequestState["SUCCESS"] = 2] = "SUCCESS";
    RequestState[RequestState["ERROR"] = 3] = "ERROR";
})(RequestState || (RequestState = {}));

class Language {
    constructor(key) {
        this.key = key;
    }
}

const INTEGRATION_BASE_URL = 'https://www.baloise.ch';
const INTEGRATION_BASE_PATH = '/app-integration';
const getIntegrationBaseUrl = () => {
    const host = getHost();
    if (host && host.indexOf('www.baloise.ch') >= 0) {
        return `https://${host}`;
    }
    return INTEGRATION_BASE_URL;
};
const getIntegrationUrl = (lang, region = 'CH', type = IntegrationType.FOOTER, version = 'v2') => {
    let langPath = lang.key;
    if (type === IntegrationType.ONETRUST) {
        langPath = 'all';
    }
    else {
        if (region === 'DE') {
            langPath = 'de';
        }
    }
    return `${getIntegrationBaseUrl()}${INTEGRATION_BASE_PATH}/${version}/${region.toLowerCase()}/${type}/${langPath}.json`;
};
const getHost = () => { var _a; return ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || undefined; };
var IntegrationType;
(function (IntegrationType) {
    IntegrationType["FOOTER"] = "footer";
    IntegrationType["SOCIAL_MEDIA"] = "socialmediachannels";
    IntegrationType["ONETRUST"] = "onetrust";
})(IntegrationType || (IntegrationType = {}));

const loadFooterLinks = (lang, region = 'CH') => {
    const url = getIntegrationUrl(lang, region, IntegrationType.FOOTER);
    return fetch(url)
        .then(res => res.json())
        .then(res => res);
};

const loadSocialMediaLinks = (lang, region = 'CH') => {
    const url = getIntegrationUrl(lang, region, IntegrationType.SOCIAL_MEDIA, 'v1');
    return fetch(url)
        .then(res => res.json())
        .then(res => res);
};

export { Language as L, loadSocialMediaLinks as a, isSpaceKey as b, isEscapeKey as i, loadFooterLinks as l };
