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,KAAK,WAAW,OAAO,UAAY,GAC9C,EAAyD,KAAzC,KAAK,WAAW,OAAO,UAAY,IACnD,EAAiB,GAAX,EACZ,OAAO;;;2CAG4B,KAAK,WAAW,OAAO,iBAClD,KAAK,wBAAwB,KAAK,WAAW,OAAO,OAAS,KAAK;+BACnD,KAAK,WAAW,OAAO;6BACzB;;;;4BAID,KAAK,WAAW,MAAQ,kBAAoB;8BAC1C,KAAK,WAAW;6BACjB,IAAM,KAAK,mBAAmB,KAAK,WAAW,KAAK;;sBAE1D,KAAK,WAAW;;;sBAGhB,EACE,KAAK,WAAW,UAAY,IAC3B,GAAS,EAAK,QACd,GAAS;;kDAEgB,KAAK,aAAa,KAAK,WAAW,IAAS,WAAa;8CAC5D;yCACL,IAAM,KAAK,mBAAmB,KAAK,WAAW;;kCAErD,EAAK,SACD;;kEAE4B,cAAyB;iDAC1C,EAAK;;wCAGhB;kCACJ,EAAK;;;;;SAOnC,GAvKS,EAoEF,OAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAnEY,EAAA,CAA3B,EAAS,CAAE,KAAM,UADT,EACmB,UAAA,eACA,EAAA,CAA3B,EAAS,CAAE,KAAM,UAFT,EAEmB,UAAA,WACA,EAAA,CAA3B,EAAS,CAAE,KAAM,UAHT,EAGmB,UAAA,WAEX,EAAA,CAAhB,KALQ,EAKQ,UAAA,kBACA,EAAA,CAAhB,KANQ,EAMQ,UAAA,qBANR,EAAN,EAAA,CADN,EAAc,0BACF,U","file":"/npm/@record-evolution/widget-sidenav@1.0.13/dist/widget-sidenav.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@record-evolution/widget-sidenav@1.0.13/dist/widget-sidenav.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport { InputData } from './definition-schema'\n\nimport '@material/web/icon/icon.js'\n\ntype Theme = {\n    theme_name: string\n    theme_object: any\n}\n@customElement('widget-sidenav-versionplaceholder')\nexport class WidgetSidenav extends LitElement {\n    @property({ type: Object }) inputData?: InputData\n    @property({ type: Object }) theme?: Theme\n    @property({ type: String }) route?: string\n\n    @state() private themeBgColor?: string\n    @state() private themeTitleColor?: string\n\n    version: string = 'versionplaceholder'\n\n    update(changedProperties: Map<string, any>) {\n        if (changedProperties.has('theme')) {\n            this.registerTheme(this.theme)\n        }\n\n        super.update(changedProperties)\n    }\n\n    protected firstUpdated(_changedProperties: PropertyValues): void {\n        this.registerTheme(this.theme)\n    }\n\n    registerTheme(theme?: Theme) {\n        const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()\n        const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim()\n        this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor\n        this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color\n    }\n\n    handleNavItemClick(route?: string) {\n        // console.log('Navigating to:', item.route)\n        const event = new CustomEvent('nav-submit', {\n            detail: { path: String(route) },\n            bubbles: true,\n            composed: true\n        })\n        this.dispatchEvent(event)\n    }\n\n    trimRoute(route?: string) {\n        route = String(route)\n        if (!route) return ''\n        return '/' + route.split('/').filter(Boolean).join('/')\n    }\n\n    addSlashes(item?: any): string | undefined {\n        item.route = String(item.route)\n        if (!item.route?.endsWith('/') && item.trailingSlash) {\n            item.route += '/'\n        }\n        if (!item.route?.startsWith('/') && item.leadingSlash) {\n            item.route = '/' + item.route\n        }\n        return item.route\n    }\n\n    matchesRoute(itemRoute?: string) {\n        if (itemRoute === undefined) return false\n        itemRoute = String(itemRoute)\n        const route = this.trimRoute(decodeURIComponent(this.route || '/'))\n        const subRoute = this.trimRoute(itemRoute)\n        if (itemRoute.startsWith('/')) {\n            return route.startsWith(subRoute)\n        } else {\n            return route.endsWith(subRoute) || route === subRoute\n        }\n    }\n\n    static styles = css`\n        :host {\n            display: block;\n            font-family: sans-serif;\n            box-sizing: border-box;\n            margin: auto;\n        }\n\n        .paging:not([active]) {\n            display: none !important;\n        }\n\n        .wrapper {\n            display: flex;\n            flex-direction: column;\n            height: 100%;\n            width: 100%;\n            padding: 12px;\n            box-sizing: border-box;\n        }\n\n        .nav-list {\n            display: flex;\n            flex-direction: column;\n            gap: 2px;\n            margin-top: 12px;\n            overflow-y: auto;\n            flex-grow: 1;\n        }\n\n        .nav-item {\n            cursor: pointer;\n            display: flex;\n            align-items: center;\n            gap: 8px;\n            padding: 8px;\n            border-radius: 4px;\n        }\n\n        md-icon {\n            font-family: 'Material Symbols Outlined';\n        }\n\n        .selected {\n            background-color: rgba(0, 0, 0, 0.1);\n        }\n\n        h2 {\n            margin: 0;\n            padding: 0px;\n            font-size: 1.2em;\n        }\n    `\n\n    render() {\n        const fontSize = this.inputData?.style?.fontSize ?? 16\n        const iconFontSize = (this.inputData?.style?.fontSize ?? 16) * 1.5\n        const gap = fontSize * 0.4\n        return html`\n            <div\n                class=\"wrapper\"\n                style=\"background-color: ${this.inputData?.style?.backgroundColor ||\n                this.themeBgColor}; color: ${this.inputData?.style?.color || this.themeTitleColor};\n                font-weight: ${this.inputData?.style?.fontWeight};\n                font-size: ${fontSize}px;\"\n            >\n                <h2\n                    class=\"paging\"\n                    style=${this.inputData?.route ? 'cursor: pointer' : ''}\n                    ?active=${this.inputData?.title}\n                    @click=${() => this.handleNavItemClick(this.addSlashes(this.inputData))}\n                >\n                    ${this.inputData?.title}\n                </h2>\n                <div class=\"nav-list\">\n                    ${repeat(\n                        this.inputData?.navItems || [],\n                        (item) => item.label,\n                        (item) => html`\n                            <div\n                                class=\"nav-item ${this.matchesRoute(this.addSlashes(item)) ? 'selected' : ''}\"\n                                style=\"gap: ${gap}px;\"\n                                @click=${() => this.handleNavItemClick(this.addSlashes(item))}\n                            >\n                                ${item.iconName\n                                    ? html`\n                                          <md-icon\n                                              style=\"font-size: ${iconFontSize}px;width: ${iconFontSize}px;\"\n                                              >${item.iconName}\n                                          </md-icon>\n                                      `\n                                    : ''}\n                                ${item.label}\n                            </div>\n                        `\n                    )}\n                </div>\n            </div>\n        `\n    }\n}\n"]}