{"version":3,"file":"stylesheets/6248.css?h=cb42d8b7c62f5193b68b","mappings":"AAwPA,wBACA,qBACA,CC3NA,+BAMA,+CAGA,sBANA,+BAEA,QACA,8BACA,WACA,YACA,qBACA,kBACA,CAEA,uDAZA,kEACA,yCAEA,oDAiBA,CARA,wBAKA,6CAEA,0BAJA,YAEA,uBACA,gBACA,wBACA,CCgDA,sBACA,iDAGA,+CAHA,oBACA,0CACA,qDACA,8BACA,UACA,CAEA,uBAEA,uCACA,4BAFA,YACA,YACA,2BACA,UACA,CAEA,wCACA,gBACA,mBACA,CAEA,wBACA,+CAGA,wDAEA,6CALA,mBACA,yCACA,YACA,uDACA,qDACA,uBACA,WACA,CAEA,+BACA,kCACA,CAEA,yCAEA,0BADA,8BACA,wBACA,CAEA,4CACA,gDACA,CAEA,8BAEA,8BAEA,0DACA,oDACA,aALA,sBAMA,CAEA,yEAEA,UACA,CCdA,mDACA,qDACA,kCACA,QACA,CACA,oDACA,uCACA,mFADA,WAEA,CACA,0DAEA,eADA,UAEA,CACA,4CACA,uCACA,qBAGA,YAFA,sBACA,UAEA,CCpIA,yCACA,0EACA,iBACA,CACA,6CACA,iBACA,cACA,eACA,CAEA,qBACA,cACA,YACA,eACA,UACA,CCbA,gDACA,gBACA,iBACA,CACA,4DAMA,qBAEA,4BAPA,wBAMA,oBAFA,eAHA,gBACA,uBACA,UAKA,CACA,qDACA,wDACA,CCYA,oBAIA,2CACA,kEAJA,qDACA,kCACA,SACA,2BAEA,gBACA,cACA","sources":["webpack://@studip/core/./resources/vue/components/StudipIdentImage.vue","webpack://@studip/core/./resources/vue/components/ActiveFilter.vue","webpack://@studip/core/./resources/vue/components/SearchWithFilter.vue","webpack://@studip/core/./resources/vue/components/stock-images/SelectorSearch.vue","webpack://@studip/core/./resources/vue/components/stock-images/Thumbnail.vue","webpack://@studip/core/./resources/vue/components/stock-images/SelectableImageCard.vue","webpack://@studip/core/./resources/vue/components/stock-images/Selector.vue"],"sourcesContent":["<template>\n    <canvas v-show=\"showCanvas\" ref=\"canvas\"></canvas>\n</template>\n\n<script>\nexport default {\n    name: 'studip-ident-image',\n    props: {\n        value: {\n            type: String,\n        },\n        showCanvas: {\n            type: Boolean,\n            default: false,\n        },\n        baseColor: {\n            type: String, // hex color\n        },\n        pattern: {\n            type: String,\n            required: true,\n        },\n        width: {\n            type: Number,\n            default: 1080,\n        },\n        height: {\n            type: Number,\n            default: 720,\n        },\n        shapesMin: {\n            type: Number,\n            default: 5,\n        },\n        shapesMax: {\n            type: Number,\n            default: 8,\n        },\n    },\n    data() {\n        return {\n            random: null,\n            ellipse: null,\n        };\n    },\n    methods: {\n        randint(min, max) {\n            return Math.floor(this.random() * (max - min) + min);\n        },\n        renderIdentimage() {\n            let canvas = this.$refs.canvas;\n            canvas.width = this.width;\n            canvas.height = this.height;\n\n            const minSize = Math.min(this.width, this.height) * 0.2;\n            const ctx = canvas.getContext('2d');\n            const backgroundHSL = this.hexToHSL(this.baseColor);\n            const numShape = this.randint(this.shapesMin, this.shapesMax);\n            const shapeSizes = [];\n\n            ctx.fillStyle = this.hexToRgbA(this.baseColor, 0.8);\n            ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n            const curveStart = this.randint(10, 70)/100 * this.height;\n            const curveEnd = this.randint(10, 70)/100 * this.height;\n            ctx.strokeStyle = `rgba(255, 255, 255, ${this.randint(50, 70) / 100})`;\n            const curvedistance = this.randint(20, 40);\n            const xFactor = this.randint(10, 45) / 100;\n            const yFactor = this.randint(10, 45) / 100;\n            for (let c = 0; c < numShape * 2; c++) {\n                ctx.beginPath();\n                ctx.moveTo(0, curveStart + curvedistance * c);\n                ctx.bezierCurveTo(this.width * xFactor, this.height * yFactor, this.width * (xFactor + 0.5), this.height * (yFactor + 0.5), this.width, curveEnd + curvedistance * c);\n                ctx.stroke();\n            }\n\n            for (let i = 0; i < numShape; i++) {\n                shapeSizes.push(this.randint(minSize*0.2, minSize*2) + minSize);\n            }\n\n            shapeSizes.sort((a, b) => {\n                return a < b ? 1 : a > b ? -1 : 0;\n            });\n\n            shapeSizes.forEach((shapeSizes, index) => {\n                const radius = shapeSizes / 2;\n                const [x, y] = this.createPointInEllipse(ctx);\n                const x_center = x * (this.width + radius / 2) - radius / 4;\n                const y_center = y * (this.height + radius / 2) - radius / 4;\n\n                ctx.fillStyle = `rgba(255, 255, 255, ${this.randint(10, 80) / 100})`;\n\n                ctx.beginPath();\n\n                if (index % 2 === 0) {\n                    ctx.arc(x_center, y_center, radius, 0, 2 * Math.PI);\n                } else {\n                    const size = radius;\n                    ctx.moveTo(x_center + size * Math.cos(0), y_center + size * Math.sin(0));\n\n                    for (let side = 0; side < 7; side++) {\n                        ctx.lineTo(\n                            x_center + size * Math.cos((side * 2 * Math.PI) / 6),\n                            y_center + size * Math.sin((side * 2 * Math.PI) / 6)\n                        );\n                    }\n                }\n\n                ctx.fill();\n            });\n\n            this.$emit('input', canvas.toDataURL());\n        },\n        createPointInEllipse(ctx) {\n            const x = this.random();\n            const y = this.random();\n\n            if (ctx.isPointInPath(this.ellipse, x, y)) {\n                return [x, y];\n            }\n\n            return this.createPointInEllipse(...arguments);\n        },\n\n        cyrb128(value) {\n            let h1 = 1779033703,\n                h2 = 3144134277,\n                h3 = 1013904242,\n                h4 = 2773480762;\n\n            for (let i = 0, k; i < value.length; i++) {\n                k = value.charCodeAt(i);\n                h1 = h2 ^ Math.imul(h1 ^ k, 597399067);\n                h2 = h3 ^ Math.imul(h2 ^ k, 2869860233);\n                h3 = h4 ^ Math.imul(h3 ^ k, 951274213);\n                h4 = h1 ^ Math.imul(h4 ^ k, 2716044179);\n            }\n\n            h1 = Math.imul(h3 ^ (h1 >>> 18), 597399067);\n            h2 = Math.imul(h4 ^ (h2 >>> 22), 2869860233);\n            h3 = Math.imul(h1 ^ (h3 >>> 17), 951274213);\n            h4 = Math.imul(h2 ^ (h4 >>> 19), 2716044179);\n\n            return [(h1 ^ h2 ^ h3 ^ h4) >>> 0, (h2 ^ h1) >>> 0, (h3 ^ h1) >>> 0, (h4 ^ h1) >>> 0];\n        },\n        sfc32(a, b, c, d) {\n            return function () {\n                a >>>= 0;\n                b >>>= 0;\n                c >>>= 0;\n                d >>>= 0;\n                var t = (a + b) | 0;\n                a = b ^ (b >>> 9);\n                b = (c + (c << 3)) | 0;\n                c = (c << 21) | (c >>> 11);\n                d = (d + 1) | 0;\n                t = (t + d) | 0;\n                c = (c + t) | 0;\n\n                return (t >>> 0) / 4294967296;\n            };\n        },\n\n        hexToRGB(color) {\n            color = color.slice(1); // remove #\n            let val = parseInt(color, 16);\n            let r = val >> 16;\n            let g = (val >> 8) & 0x00ff;\n            let b = val & 0x0000ff;\n\n            if (g > 255) {\n                g = 255;\n            } else if (g < 0) {\n                g = 0;\n            }\n            if (b > 255) {\n                b = 255;\n            } else if (b < 0) {\n                b = 0;\n            }\n\n            return { r: r, g: g, b: b };\n        },\n        RGBToHSL(r, g, b) {\n            r /= 255;\n            g /= 255;\n            b /= 255;\n\n            let cmin = Math.min(r, g, b),\n                cmax = Math.max(r, g, b),\n                delta = cmax - cmin,\n                h = 0,\n                s = 0,\n                l = 0;\n            if (delta == 0) h = 0;\n            // Red is max\n            else if (cmax == r) h = ((g - b) / delta) % 6;\n            // Green is max\n            else if (cmax == g) h = (b - r) / delta + 2;\n            // Blue is max\n            else h = (r - g) / delta + 4;\n\n            h = Math.round(h * 60);\n\n            if (h < 0) h += 360;\n            l = (cmax + cmin) / 2;\n\n            s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n\n            s = +(s * 100).toFixed(1);\n            l = +(l * 100).toFixed(1);\n\n            return { h: h, s: s, l: l };\n            // return 'hsl(' + h + ',' + s + '%,' + l + '%)';\n        },\n        hexToHSL(color) {\n            const RGB = this.hexToRGB(color);\n            return this.RGBToHSL(RGB.r, RGB.g, RGB.b);\n        },\n        hexToRgbA(hex, a){\n            const RGB = this.hexToRGB(hex);\n\n            return 'rgba(' + RGB.r + ',' + RGB.g + ',' + RGB.b + ',' + a +')';\n        },\n        init() {\n            const seed = this.cyrb128(this.pattern);\n            this.random = this.sfc32(...seed);\n            this.ellipse = new Path2D();\n            this.ellipse.ellipse(0.5, 0.5, 0.5, 0.5, 0, 0, Math.PI * 2);\n            this.renderIdentimage();\n        }\n    },\n    mounted() {\n        this.init();\n    },\n    watch: {\n        baseColor() {\n            this.init();\n        },\n    },\n};\n</script>\n<style scoped>\n  canvas {\n    background-color: #fff;\n  }\n</style>\n","<template>\n    <span class=\"activefilter\">\n        <slot></slot>\n        <button\n            @click=\"onRemoveActiveFilter\"\n            type=\"button\"\n            :title=\"$gettextInterpolate($gettext('Filter \\'%{name}\\' entfernen'), { name }, true)\"\n        >\n            <StudipIcon class=\"text-bottom\" shape=\"decline\" role=\"presentation\" alt=\"\" />\n        </button>\n    </span>\n</template>\n\n<script>\nimport StudipIcon from './StudipIcon.vue';\nexport default {\n    props: {\n        name: {\n            type: String,\n            required: true,\n        },\n    },\n    methods: {\n        onRemoveActiveFilter() {\n            this.$emit('remove');\n        },\n    },\n};\n</script>\n\n<style scoped>\n.activefilter {\n    align-items: center;\n    background-color: var(--content-color-20);\n    border: solid thin var(--black);\n    display: flex;\n    gap: 4px;\n    justify-content: space-between;\n    margin: 3px;\n    padding: 5px;\n    padding-inline-end: 0;\n    white-space: nowrap;\n}\n\nbutton {\n    align-items: center;\n    background-color: var(--content-color-20);\n    border: none;\n    display: flex;\n    justify-content: center;\n    margin-inline: 0;\n    padding-inline-start: 4px;\n}\n</style>\n","<template>\n    <div>\n        <form @submit.prevent=\"onSearch\">\n            <slot name=\"filters\"></slot>\n\n            <input\n                :id=\"`search-bar-input-${searchId}`\"\n                class=\"search-bar-input\"\n                type=\"text\"\n                v-model=\"searchTerm\"\n                :aria-label=\"$gettext('Geben Sie einen Suchbegriff mit mindestens 3 Zeichen ein.')\"\n            />\n\n            <button\n                v-if=\"showSearchResults\"\n                class=\"search-bar-erase\"\n                type=\"button\"\n                :title=\"$gettext('Suchformular zurücksetzen')\"\n                @click=\"onReset\"\n            >\n                <StudipIcon shape=\"decline\" :size=\"20\" />\n            </button>\n\n            <button\n                type=\"button\"\n                :title=\"$gettext('Suchfilter einstellen')\"\n                class=\"search-bar-filter\"\n                :class=\"{ active: showFilterPanel }\"\n                @click=\"onToggleFilterPanel\"\n                :aria-controls=\"`search-bar-filter-panel-${searchId}`\"\n                :aria-expanded=\"showFilterPanel ? 'true' : 'false'\"\n            >\n                <StudipIcon shape=\"filter\" :role=\"showFilterPanel ? 'info_alt' : 'clickable'\" :size=\"20\" alt=\"\" />\n            </button>\n\n            <button\n                type=\"submit\"\n                :value=\"$gettext('Suchen')\"\n                :aria-controls=\"`search-bar-input-${searchId}`\"\n                class=\"submit-search\"\n                :title=\"$gettext('Suche starten')\"\n            >\n                <StudipIcon shape=\"search\" :size=\"20\" role=\"presentation\" alt=\"\" />\n            </button>\n        </form>\n        <div :id=\"`search-bar-filter-panel-${searchId}`\" class=\"filterpanel\" ref=\"filterPanel\" v-if=\"showFilterPanel\">\n            <slot></slot>\n        </div>\n    </div>\n</template>\n\n<script>\nimport StudipIcon from './StudipIcon.vue';\n\nlet searchIndex = 0;\n\nexport default {\n    props: {\n        query: {\n            type: String,\n            required: true,\n        },\n    },\n    components: {\n        StudipIcon,\n    },\n    data: () => ({\n        searchId: searchIndex++,\n        showFilterPanel: false,\n        searchTerm: '',\n    }),\n    computed: {\n        showSearchResults() {\n            return this.query.length > 0;\n        },\n    },\n    methods: {\n        onReset() {\n            this.searchTerm = '';\n            this.onSearch();\n        },\n        onSearch() {\n            this.$emit('search', this.searchTerm);\n        },\n        onToggleFilterPanel() {\n            this.showFilterPanel = !this.showFilterPanel;\n        },\n    },\n    mounted() {\n        this.searchTerm = this.query;\n    },\n    watch: {\n        query(searchTerm) {\n            this.searchTerm = searchTerm;\n        },\n    },\n};\n</script>\n\n<style scoped>\nform {\n    align-items: stretch;\n    border: thin solid var(--content-color-40);\n    display: flex;\n    justify-content: space-between;\n    width: 100%;\n}\n\ninput {\n    border: none;\n    flex-grow: 1;\n    padding-inline-start: 0.75em;\n    width: 100%;\n}\n\ninput.search-bar-input {\n    line-height: 1.5;\n    padding-block: 0.25em;\n}\n\nbutton {\n    align-items: center;\n    background-color: var(--content-color-20);\n    border: none;\n    border-inline-start: thin solid var(--content-color-40);\n    display: flex;\n    justify-content: center;\n    width: 2.5em;\n}\n\nbutton.active {\n    background-color: var(--base-color);\n}\n\nbutton.search-bar-erase {\n    background-color: var(--white);\n    border-inline-start: none;\n}\n\n.search-bar-filter--remove {\n    margin-inline-start: 5px;\n}\n\n.filterpanel {\n    width: calc(100% + 2px);\n    background-color: var(--white);\n    border: thin solid var(--content-color-40);\n    border-top: none;\n    box-sizing: border-box;\n    padding: 10px;\n}\n\n.filterpanel::before,\n.filterpanel::after {\n    right: 50px;\n}\n</style>\n","<template>\n    <SearchWithFilter :query=\"query\" @search=\"onSearch\">\n        <template #filters>\n            <ActiveFilter\n                v-if=\"hasOrientationFilter\"\n                :name=\"orientations[orientation].text\"\n                @remove=\"onRemoveOrientationFilter()\"\n            >\n                {{ orientations[orientation].text }}\n            </ActiveFilter>\n\n            <ActiveFilter\n                v-for=\"color in selectedColors\"\n                :key=\"color.hex\"\n                :name=\"$gettextInterpolate($gettext('Farbe %{color}'), { color: color.name })\"\n                @remove=\"onRemoveColorFilter(color)\"\n            >\n                <label>\n                    <b class=\"stock-images-color-patch\" :style=\"`background-color: ${color.hex}`\"></b>\n                </label>\n            </ActiveFilter>\n        </template>\n\n        <div class=\"stock-images-search-filter-panel\">\n            <div>\n                <label>\n                    <div>{{ $gettext('Seitenausrichtung') }}</div>\n\n                    <select v-model=\"orientation\">\n                        <option v-for=\"[key, value] in Object.entries(orientations)\" :value=\"key\" :key=\"`orientation-option-${key}`\">\n                            {{ value.text }}\n                        </option>\n                    </select>\n                </label>\n            </div>\n\n            <div>\n                <div>{{ $gettext('Farbfilter') }}</div>\n\n                <studip-select\n                    multiple\n                    v-model=\"selectedColors\"\n                    :options=\"selectableColors\"\n                    label=\"name\"\n                >\n                    <template #open-indicator>\n                        <span><studip-icon shape=\"arr_1down\" :size=\"10\" /></span>\n                    </template>\n\n                    <template #option=\"option\">\n                        <span class=\"vs__option-color\" :style=\"{ 'background-color': option.hex }\"></span>\n                        <span>{{ option.name }}</span>\n                    </template>\n\n                    <template #selected-option-container>{{ ' ' }}</template>\n\n                    <template #no-options>{{ $gettext('Keine Auswahlmöglichkeiten') }}</template>\n                </studip-select>\n            </div>\n        </div>\n    </SearchWithFilter>\n</template>\n\n<script>\nimport ActiveFilter from '../ActiveFilter.vue';\nimport SearchWithFilter from '../SearchWithFilter.vue';\nimport { colors as selectableColors } from './colors.js';\nimport { orientations, similarColors } from './filters.js';\n\nexport default {\n    props: {\n        activeFilters: {\n            type: Object,\n            required: true,\n        },\n        query: {\n            type: String,\n            required: true,\n        },\n    },\n    components: {\n        ActiveFilter,\n        SearchWithFilter,\n    },\n    data: () => ({\n        orientation: 'any',\n        selectedColors: [],\n    }),\n    computed: {\n        hasOrientationFilter() {\n            return this.orientation && this.orientation !== 'any';\n        },\n        orientations: () => orientations,\n        selectableColors: () => selectableColors,\n        showSearchResults() {\n            return this.query.length > 0;\n        },\n    },\n    methods: {\n        onRemoveColorFilter(color) {\n            this.selectedColors = this.selectedColors.filter((clr) => clr.hex !== color.hex);\n            this.updateActiveFilters();\n        },\n        onRemoveOrientationFilter() {\n            this.orientation = 'any';\n        },\n        onReset() {\n            this.onSearch();\n        },\n        onSearch(searchTerm = null) {\n            this.$emit('search', searchTerm);\n        },\n        resetLocalFilters() {\n            this.selectedColors = this.activeFilters?.colors\n                ? this.selectableColors.filter(({ hex }) => this.activeFilters.colors.includes(hex))\n                : [];\n            this.orientation = this.activeFilters?.orientation ?? 'any';\n        },\n        updateActiveFilters() {\n            const activeFilters = {\n                colors: this.selectedColors.map(({ hex }) => hex),\n                orientation: this.orientation,\n            };\n            this.$emit('update-active-filters', activeFilters);\n        },\n    },\n    mounted() {\n        this.resetLocalFilters();\n    },\n    watch: {\n        activeFilters() {\n            this.resetLocalFilters();\n        },\n        orientation(newVal, oldVal) {\n            this.updateActiveFilters();\n        },\n    },\n};\n</script>\n\n<style scoped>\n.stock-images-search-filter-panel {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 2rem;\n}\n.stock-images-search-filter-panel > * {\n    flex-grow: 1;\n    flex-basis: calc((30rem - 100%) * 999);\n}\n.stock-images-search-filter-panel select {\n    width: 100%;\n    max-width: 48em;\n}\nb.stock-images-color-patch {\n    border: solid thin var(--base-color-20);\n    display: inline-block;\n    vertical-align: bottom;\n    width: 20px;\n    height: 20px;\n}\n</style>\n","<template>\n    <div class=\"stock-images-thumbnail\" v-if=\"url\">\n        <div :style=\"{ width }\">\n            <img :src=\"url\" :style=\"{ 'object-fit': contain ? 'contain' : 'cover' }\" role=\"presentation\" />\n        </div>\n    </div>\n</template>\n\n<script>\nexport default {\n    props: {\n        url: {\n            type: String,\n            required: true,\n        },\n        width: {\n            type: String,\n            default: '6rem',\n        },\n        contain: {\n            type: Boolean,\n            default: false\n        }\n    },\n};\n</script>\n\n<style scoped>\n.stock-images-thumbnail {\n    display: inline-flex;\n    position: relative;\n}\n.stock-images-thumbnail > div {\n    aspect-ratio: 1/1;\n    display: block;\n    overflow: hidden;\n}\n\nimg {\n    display: block;\n    height: 100%;\n    max-width: 100%;\n    width: 100%;\n}\n</style>\n","<template>\n    <div class=\"stock-images-selectable-image\" tabindex=\"0\">\n        <Thumbnail :url=\"thumbnailUrl\" contain class=\"stock-images-image-card__thumbnail\" width=\"8rem\" />\n        <div>{{ stockImage.attributes?.title ?? '' }}</div>\n    </div>\n</template>\n\n<script>\nimport Thumbnail from './Thumbnail.vue';\n\nexport default {\n    props: {\n        stockImage: {\n            type: Object,\n            required: true,\n        },\n    },\n    components: { Thumbnail },\n    computed: {\n        thumbnailUrl() {\n            return (\n                this.stockImage.attributes['download-urls'].small ??\n                this.stockImage.attributes['download-urls'].original\n            );\n        },\n    },\n};\n</script>\n\n<style scoped>\n.stock-images-selectable-image {\n    overflow: hidden;\n    position: relative;\n}\n.stock-images-selectable-image > :last-child {\n    background: var(--white);\n    overflow: hidden;\n    text-overflow: ellipsis;\n    width: 8rem;\n    min-height: 3em;\n    -webkit-line-clamp: 2;\n    display: -webkit-box;\n    -webkit-box-orient: vertical;\n}\n.stock-images-image-card__thumbnail {\n    background-image: url(../images/checkered-background.png);\n}\n</style>\n","<template>\n    <div>\n        <div>\n            <SelectorSearch\n                :active-filters=\"activeFilters\"\n                :query=\"query\"\n                @search=\"onSearch\"\n                @update-active-filters=\"onUpdateActiveFilters\"\n            />\n        </div>\n        <ul>\n            <li v-for=\"stockImage in filteredStockImages\" :key=\"stockImage.id\">\n                <SelectableImageCard :stock-image=\"stockImage\" @click.native=\"onSelectImage(stockImage)\" @keyup.enter.native=\"onSelectImage(stockImage)\" />\n            </li>\n        </ul>\n    </div>\n</template>\n\n<script>\nimport SelectorSearch from './SelectorSearch.vue';\nimport SelectableImageCard from './SelectableImageCard.vue';\nimport { searchFilterAndSortImages } from './filters.js';\n\nexport default {\n    props: {\n        stockImages: {\n            type: Array,\n            required: true,\n        },\n    },\n    data: () => ({\n        activeFilters: {\n            colors: [],\n            orientation: 'landscape',\n        },\n        query: '',\n    }),\n    components: { SelectorSearch, SelectableImageCard },\n    computed: {\n        filteredStockImages() {\n            return searchFilterAndSortImages(this.stockImages, this.query, this.activeFilters);\n        },\n    },\n    methods: {\n        onUpdateActiveFilters(activeFilters) {\n            this.activeFilters = activeFilters;\n        },\n        onSearch(query) {\n            this.query = query;\n        },\n        onSelectImage(stockImage) {\n            this.$emit('select', stockImage);\n        },\n    },\n};\n</script>\n\n<style scoped>\nul {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 1rem;\n    justify-content: flex-start;\n    align-items: center;\n    list-style: none;\n    padding: 1rem 0;\n}\n</style>\n"],"names":[],"sourceRoot":""}