/* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ import{LitElement as S,html as a,nothing as c}from"lit";import{property as m,state as v,customElement as T}from"lit/decorators.js";import{live as C}from"lit/directives/live.js";import"@typo3/backend/element/spinner-element.js";import"@typo3/backend/element/icon-element.js";import k from"@typo3/backend/notification.js";import f from"@typo3/backend/utility/dom-helper.js";import R from"@typo3/core/ajax/ajax-request.js";import{copyToClipboard as w}from"@typo3/backend/copy-to-clipboard.js";import{markdown as E}from"@typo3/core/directive/markdown.js";import"@typo3/backend/settings/editor/editable-setting.js";import{SettingsMode as g,sanitizeSettingsMode as _}from"@typo3/backend/settings/enum/settings-mode.enum.js";import p from"~labels/backend.settingseditor";import D from"~labels/backend.copytoclipboard";import"@typo3/backend/settings/type/bool.js";import"@typo3/backend/settings/type/int.js";import"@typo3/backend/settings/type/number.js";import"@typo3/backend/settings/type/string.js";import"@typo3/backend/settings/type/stringlist.js";var d=function(u,i,e,t){var s=arguments.length,n=s<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,e):t,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(u,i,e,t);else for(var r=u.length-1;r>=0;r--)(o=u[r])&&(n=(s<3?o(n):s>3?o(i,e,n):o(i,e))||n);return s>3&&n&&Object.defineProperty(i,e,n),n};class b extends Event{static{this.eventName="typo3:settings-editor:submit"}constructor(i,e){super(b.eventName,{bubbles:!0,composed:!0,cancelable:!1}),this.originalEvent=i,this.formData=e}}let l=class extends S{constructor(){super(...arguments),this.formName="settings_form",this.customFormData={},this.mode=g.basic,this.searchTerm="",this.activeCategory="",this.visibleCategories={},this.observer=null}disconnectedCallback(){super.disconnectedCallback(),this.observer?.disconnect()}createRenderRoot(){return this}adjustNavigationSize(){const i=f.scrollableParent(this),e=this.querySelector(".settings-navigation-inner"),t=this.querySelector(".settings-search"),s=this.querySelector(".settings-navigation");if(s!==null&&e){const n=i.getBoundingClientRect(),o=s.getBoundingClientRect(),r=t?.getBoundingClientRect().bottom??Math.max(n.top,e.getBoundingClientRect().top),h=Math.min(n.bottom,window.innerHeight),y=Math.max(0,h-o.bottom),$=h-r-y;e.style.maxHeight=`${$}px`}}firstUpdated(){f.scrollEventTarget(this).addEventListener("scroll",()=>{this.adjustNavigationSize()})}updated(i){if(i.has("mode")&&this.mode===g.minimal)this.observer?.disconnect(),this.observer=null;else if(i.has("mode")&&this.mode!==g.minimal){const e=f.scrollableParent(this);this.observer=new IntersectionObserver(t=>{t.forEach(o=>{const r=o.target.dataset.key;this.visibleCategories[r]=o.isIntersecting});const s=o=>o.reduce((r,h)=>[...r,h.key,...s(h.categories)],[]),n=s(this.categories).filter(o=>this.visibleCategories[o])[0]||"";n&&(this.activeCategory=n)},{root:e===document.documentElement?null:e,threshold:.1})}if([...this.renderRoot.querySelectorAll(".settings-category")].map(e=>this.observer?.observe(e)),this.adjustNavigationSize(),i.has("activeCategory")){const e=this.querySelector(".settings-navigation-inner"),t=this.querySelector(".settings-navigation-item.active");if(e&&t){const s=e.scrollTop,n=e.getBoundingClientRect().height,o=t.getBoundingClientRect().height,r=t.offsetTop>=s,h=t.offsetTop+o<=s+n;r?h||this.querySelector(".settings-navigation-inner").scrollTo({top:Math.max(0,t.offsetTop+o),behavior:"auto"}):this.querySelector(".settings-navigation-inner").scrollTo({top:Math.max(0,t.offsetTop-o),behavior:"auto"})}}}renderCategoryTree(i,e){return a`