<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/*
 *   Copyright (c) 2022 Esri
 *   All rights reserved.

 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at

 *   http://www.apache.org/licenses/LICENSE-2.0

 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
var __decorate = (this &amp;&amp; this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c &lt; 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" &amp;&amp; typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i &gt;= 0; i--) if (d = decorators[i]) r = (c &lt; 3 ? d(r) : c &gt; 3 ? d(target, key, r) : d(target, key)) || r;
    return c &gt; 3 &amp;&amp; r &amp;&amp; Object.defineProperty(target, key, r), r;
};
var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) {
    return (mod &amp;&amp; mod.__esModule) ? mod : { "default": mod };
};
define(["require", "exports", "esri/core/accessorSupport/decorators", "esri/widgets/support/widget", "esri/widgets/Widget", "ArcGISHTMLSanitizer", "TemplatesCommonLib/functionality/securityUtils", "TemplatesCommonLib/functionality/token"], function (require, exports, decorators_1, widget_1, Widget_1, ArcGISHTMLSanitizer_1, securityUtils_1, token_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    Widget_1 = __importDefault(Widget_1);
    ArcGISHTMLSanitizer_1 = __importDefault(ArcGISHTMLSanitizer_1);
    const CSS = {
        base: "media-details-panel",
        content: "media-details-panel__content"
    };
    let Details = class Details extends Widget_1.default {
        constructor(props) {
            super(props);
            this.defaultDescription = null;
            this.i18n = null;
            this.rootNode = null;
            this._sanitizer = (0, securityUtils_1.createSanitizerInstance)(ArcGISHTMLSanitizer_1.default);
        }
        initialize() {
            const webmap = this.view.map;
            if (webmap?.portalItem) {
                this.defaultDescription = webmap.portalItem?.description || webmap.portalItem?.snippet;
            }
        }
        render() {
            const { detailsContent } = this.config;
            const map = this?.view?.map;
            let token;
            if (map?.portalItem?.portal) {
                token = map.portalItem.portal?.credential?.token;
            }
            let updatedContent = token &amp;&amp; token !== "" &amp;&amp; token !== undefined
                ? (0, token_1.applyImgTokens)(detailsContent, token)
                : detailsContent;
            const content = updatedContent ? updatedContent : this.defaultDescription;
            return (0, widget_1.tsx)("div", { id: "details", innerHTML: this._sanitizer.sanitize(content) });
        }
        _renderSplashButton() {
            let { splashButtonText } = this.config;
            if (splashButtonText === "" || splashButtonText === undefined) {
                splashButtonText = this.i18n.enter;
            }
            return ((0, widget_1.tsx)("calcite-button", { bind: this, kind: "brand", onclick: this._closePanel, slot: "primary", width: "full" }, splashButtonText));
        }
        _closePanel() {
            if (this.rootNode) {
                this.rootNode.removeAttribute("open");
            }
        }
        displaySplash(container) {
            this.rootNode = container;
            // if there isn't a value in session storage
            //show the splash screen
            container.setAttribute("open", "");
            const sameSession = window.sessionStorage.getItem("splash-key");
            if (sameSession) {
                this._closePanel();
            }
            else {
                window.sessionStorage.setItem("splash-key", "true");
            }
        }
        open() {
            // enable disable splash by adding and removing active prop
            if (this.rootNode) {
                this.rootNode.setAttribute("open", "");
            }
        }
    };
    __decorate([
        (0, decorators_1.property)()
    ], Details.prototype, "config", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], Details.prototype, "view", void 0);
    __decorate([
        (0, decorators_1.property)()
    ], Details.prototype, "defaultDescription", void 0);
    __decorate([
        (0, decorators_1.property)(),
        (0, widget_1.messageBundle)("instant/../t9n/common")
    ], Details.prototype, "i18n", void 0);
    Details = __decorate([
        (0, decorators_1.subclass)("Details")
    ], Details);
    exports.default = Details;
});
</pre></body></html>