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2CAA4CM,MAAO9D,KAAK+C,cAC3K,CACA,QAAIgB,GAAS,OAAO,IAAAC,GAAWhE,KAAO,CACtC,mBAAWiE,GAAa,MAAO,CAC3B,UAAa,CAAC,qBACd,KAAQ,CAAC,gBACT,MAAS,CAAC,iBACV,MAAS,CAAC,iBACV,KAAQ,CAAC,gBACT,OAAU,CAAC,kBACX,MAAS,CAAC,iBACX,GAEPrE,EAASkE,MAhIW,6hD,kBCLpB,SAASI,EAAWjG,EAAOkG,EAAgB5F,GACvC,IAAK4F,EAAeC,SAASnG,GACzB,MAAM,IAAIW,MAAML,EACxB,C","sources":["webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/index-f41b763f.js","webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/check-non-empty-58bd6b17.js","webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/constants-8d548297.js","webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/package-113efb04.js","webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/post-icon-46fcfb37.js","webpack://glaux-group-webpack/./node_modules/@swisspost/design-system-components/dist/esm/check-one-of-6b3ef8eb.js"],"sourcesContent":["import { E as EMPTY_VALUES } from './constants-8d548297.js';\nimport { c as checkOneOf } from './check-one-of-6b3ef8eb.js';\n\nfunction emptyOr(check) {\n    return (...args) => {\n        const value = args[0];\n        if (!EMPTY_VALUES.some(v => v === value))\n            check(...args);\n    };\n}\n\nfunction checkPattern(value, pattern, errorMessage) {\n    if (typeof value !== 'string' || !pattern.test(value))\n        throw new Error(errorMessage);\n}\n\nfunction checkType(value, type, error) {\n    const typeIsArray = type === 'array';\n    const valueIsArray = Array.isArray(value);\n    if (typeIsArray || valueIsArray) {\n        if (valueIsArray !== typeIsArray)\n            throw new Error(error);\n    }\n    else {\n        if (typeof value !== type)\n            throw new Error(error);\n    }\n}\n\nfunction checkUrl(value, error) {\n    if (typeof value !== 'string' && !(value instanceof URL))\n        throw new Error(error);\n    try {\n        new URL(value);\n    }\n    catch (e) {\n        throw new Error(error);\n    }\n}\n\nconst checkEmptyOrOneOf = emptyOr(checkOneOf);\nconst checkEmptyOrPattern = emptyOr(checkPattern);\nconst checkEmptyOrType = emptyOr(checkType);\nconst checkEmptyOrUrl = emptyOr(checkUrl);\n\nexport { checkType as a, checkEmptyOrPattern as b, checkEmptyOrOneOf as c, checkEmptyOrType as d, checkEmptyOrUrl as e };\n","import { E as EMPTY_VALUES } from './constants-8d548297.js';\n\nfunction checkNonEmpty(value, error) {\n    if (EMPTY_VALUES.some(v => v === value)) {\n        throw new Error(error);\n    }\n}\n\nexport { checkNonEmpty as c };\n","const EMPTY_VALUES = [undefined, null, ''];\n\nexport { EMPTY_VALUES as E };\n","const version = \"8.9.2\";\n\nexport { version as v };\n","import { r as registerInstance, h, H as Host, g as getElement } from './index-61528ac5.js';\nimport { c as checkEmptyOrOneOf, d as checkEmptyOrType, a as checkType } from './index-f41b763f.js';\nimport { v as version } from './package-113efb04.js';\nimport { c as checkNonEmpty } from './check-non-empty-58bd6b17.js';\n\nconst postIconCss = \":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}\";\nconst PostIconStyle0 = postIconCss;\n\nconst CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';\nconst ANIMATION_NAMES = [\n    'cylon',\n    'cylon-vertical',\n    'spin',\n    'spin-reverse',\n    'fade',\n    'throb',\n];\nconst ANIMATION_KEYS = [...ANIMATION_NAMES];\nconst PostIcon = class {\n    constructor(hostRef) {\n        registerInstance(this, hostRef);\n        this.animation = null;\n        this.base = null;\n        this.flipH = false;\n        this.flipV = false;\n        this.name = undefined;\n        this.rotate = null;\n        this.scale = null;\n    }\n    validateAnimation(newValue = this.animation) {\n        if (newValue !== undefined)\n            checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon \"animation\" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);\n    }\n    validateBase(newValue = this.base) {\n        checkEmptyOrType(newValue, 'string', 'The post-icon \"base\" prop should be a string.');\n    }\n    validateFlipH(newValue = this.flipH) {\n        checkEmptyOrType(newValue, 'boolean', 'The post-icon \"flipH\" prop should be a boolean.');\n    }\n    validateFlipV(newValue = this.flipV) {\n        checkEmptyOrType(newValue, 'boolean', 'The post-icon \"flipV\" prop should be a boolean.');\n    }\n    validateName(newValue = this.name) {\n        checkNonEmpty(newValue, 'The post-icon \"name\" prop is required!.');\n        checkType(newValue, 'string', 'The post-icon \"name\" prop should be a string.');\n    }\n    validateRotate(newValue = this.rotate) {\n        checkEmptyOrType(newValue, 'number', 'The post-icon \"rotate\" prop should be a number.');\n    }\n    validateScale(newValue = this.scale) {\n        checkEmptyOrType(newValue, 'number', 'The post-icon \"scale\" prop should be a number.');\n    }\n    // Construct the icon url from different possible sources\n    getUrl() {\n        var _a, _b, _c, _d, _e, _f, _g;\n        // the first definition object which defines a domain, will be used to set the domain of the file url\n        // the first definition object which defines a slug, will be used to set the slug of the file url\n        const urlDefinitions = [\n            getUrlDefinition(this.base, 'both'),\n            getUrlDefinition((_a = document.head\n                .querySelector('meta[name=\"design-system-settings\"][data-post-icon-base]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-post-icon-base'), 'relative'),\n            getUrlDefinition((_b = document.querySelector('base[href]')) === null || _b === void 0 ? void 0 : _b.getAttribute('href'), 'both'),\n        ];\n        // in case no other definition defines a domain, the current origin is used as a fallback\n        const origin = (_e = (_d = (_c = urlDefinitions.find(d => d.definesDomain)) === null || _c === void 0 ? void 0 : _c.url) === null || _d === void 0 ? void 0 : _d.origin) !== null && _e !== void 0 ? _e : window.location.origin;\n        // in case no other definition defines a slug, the cdn url is used as a fallback\n        const slug = (_g = (_f = urlDefinitions.find(d => d.definesSlug)) === null || _f === void 0 ? void 0 : _f.url) === null || _g === void 0 ? void 0 : _g.pathname;\n        const file = `${this.name}.svg`;\n        let url;\n        if (slug) {\n            url = new URL(`${origin}${slug}/${file}`).toString();\n        }\n        else {\n            url = new URL(`${CDN_URL}/${file}`).toString();\n        }\n        return url;\n        function getUrlDefinition(url, allow) {\n            return {\n                url: getUrlObject(url),\n                definesDomain: allow !== 'relative' ? definesDomain(url) : false,\n                definesSlug: allow !== 'absolute' ? definesSlug(url) : false,\n            };\n            function getUrlObject(url) {\n                if (url) {\n                    return definesDomain(url) ? new URL(url) : new URL(url, window.location.origin);\n                }\n                else {\n                    return null;\n                }\n            }\n            function definesDomain(url) {\n                return url ? /^https?:\\/\\//.test(url) : false;\n            }\n            function definesSlug(url) {\n                const urlObject = getUrlObject(url);\n                return Boolean(/^\\/.+/.test(urlObject === null || urlObject === void 0 ? void 0 : urlObject.pathname));\n            }\n        }\n    }\n    getStyles() {\n        const url = this.getUrl();\n        return Object.entries({\n            '-webkit-mask-image': `url(${url})`,\n            'mask-image': `url('${url}')`,\n            'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +\n                (this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),\n        })\n            .filter(([_key, value]) => value !== null)\n            .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});\n    }\n    componentDidLoad() {\n        this.validateBase();\n        this.validateName();\n        this.validateFlipH();\n        this.validateFlipV();\n        this.validateScale();\n        this.validateRotate();\n        this.validateAnimation();\n    }\n    render() {\n        return (h(Host, { key: '77740745eb170076301edb3ff96b846e48c7f2f4', \"data-version\": version }, h(\"span\", { key: '573f2acd8e92ec5f2f8853b5cb05386bcaee693d', style: this.getStyles() })));\n    }\n    get host() { return getElement(this); }\n    static get watchers() { return {\n        \"animation\": [\"validateAnimation\"],\n        \"base\": [\"validateBase\"],\n        \"flipH\": [\"validateFlipH\"],\n        \"flipV\": [\"validateFlipV\"],\n        \"name\": [\"validateName\"],\n        \"rotate\": [\"validateRotate\"],\n        \"scale\": [\"validateScale\"]\n    }; }\n};\nPostIcon.style = PostIconStyle0;\n\nexport { PostIcon as P };\n","function checkOneOf(value, possibleValues, error) {\n    if (!possibleValues.includes(value))\n        throw new Error(error);\n}\n\nexport { checkOneOf as c };\n"],"names":["emptyOr","check","args","value","E","some","v","checkType","type","error","typeIsArray","valueIsArray","Array","isArray","Error","checkEmptyOrOneOf","c","checkEmptyOrPattern","pattern","errorMessage","test","checkEmptyOrType","checkEmptyOrUrl","URL","e","checkNonEmpty","EMPTY_VALUES","undefined","version","ANIMATION_KEYS","PostIcon","constructor","hostRef","r","this","animation","base","flipH","flipV","name","rotate","scale","validateAnimation","newValue","join","validateBase","validateFlipH","validateFlipV","validateName","validateRotate","validateScale","getUrl","_a","_b","_c","_d","_e","_f","_g","urlDefinitions","getUrlDefinition","document","head","querySelector","getAttribute","origin","find","d","definesDomain","url","window","location","slug","definesSlug","pathname","file","toString","allow","getUrlObject","urlObject","Boolean","getStyles","Object","entries","isNaN","Number","filter","_key","reduce","styles","key","assign","componentDidLoad","render","h","H","style","host","g","watchers","checkOneOf","possibleValues","includes"],"sourceRoot":""}