"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ImageCarousel = exports.ImageCarouselConstructor = void 0; var ImageSearcher_1 = require("../../Logic/ImageSearcher"); var SlideShow_1 = require("../SlideShow"); var FixedUiElement_1 = require("../Base/FixedUiElement"); var VariableUIElement_1 = require("../Base/VariableUIElement"); var ConfirmDialog_1 = require("../ConfirmDialog"); var UIElementConstructor_1 = require("../../Customizations/UIElementConstructor"); var ImageCarouselConstructor = /** @class */ (function () { function ImageCarouselConstructor() { } ImageCarouselConstructor.prototype.IsKnown = function (properties) { return true; }; ImageCarouselConstructor.prototype.IsQuestioning = function (properties) { return false; }; ImageCarouselConstructor.prototype.Priority = function () { return 0; }; ImageCarouselConstructor.prototype.construct = function (tags, changes) { return new ImageCarousel(tags, changes); }; return ImageCarouselConstructor; }()); exports.ImageCarouselConstructor = ImageCarouselConstructor; var ImageCarousel = /** @class */ (function (_super) { __extends(ImageCarousel, _super); function ImageCarousel(tags, changes) { var _this = _super.call(this, tags) || this; _this._userDetails = changes.login.userDetails; var self = _this; _this.searcher = new ImageSearcher_1.ImageSearcher(tags, changes); _this._uiElements = _this.searcher.map(function (imageURLS) { var uiElements = []; for (var _i = 0, imageURLS_1 = imageURLS; _i < imageURLS_1.length; _i++) { var url = imageURLS_1[_i]; var image = ImageSearcher_1.ImageSearcher.CreateImageElement(url); uiElements.push(image); } return uiElements; }); _this.slideshow = new SlideShow_1.SlideShow(_this._uiElements, new FixedUiElement_1.FixedUiElement("")).HideOnEmpty(true); var showDeleteButton = _this.slideshow._currentSlide.map(function (i) { if (!self._userDetails.data.loggedIn) { return false; } return self.searcher.IsDeletable(self.searcher.data[i]); }, [_this.searcher, _this._userDetails]); _this.slideshow._currentSlide.addCallback(function () { showDeleteButton.ping(); // This pings the showDeleteButton, which indicates that it has to hide it's subbuttons }); var deleteCurrent = function () { self.searcher.Delete(self.searcher.data[self.slideshow._currentSlide.data]); }; _this._deleteButton = new ConfirmDialog_1.ConfirmDialog(showDeleteButton, "", "Afbeelding verwijderen", "Terug", deleteCurrent, function () { }, 'delete-image-confirm', 'delete-image-cancel'); var mapping = _this.slideshow._currentSlide.map(function (i) { if (_this.searcher._deletedImages.data.indexOf(_this.searcher.data[i]) >= 0) { return "