/*
 * 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!
 */
var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=a);var n=Object.getOwnPropertyDescriptor(t,a);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,r,n)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&__createBinding(t,e,a);return __setModuleDefault(t,e),t};define(["require","exports","TYPO3/CMS/Backend/Utility","TYPO3/CMS/Backend/Event/EventDispatcher"],(function(e,t,a,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImmediateActionElement=void 0;class n extends HTMLElement{constructor(){super(...arguments),this.args=[]}static async getDelegate(t){switch(t){case"TYPO3.ModuleMenu.App.refreshMenu":const a=await new Promise((t,a)=>{e(["TYPO3/CMS/Backend/ModuleMenu"],t,a)}).then(__importStar);return a.App.refreshMenu.bind(a.App);case"TYPO3.Backend.Topbar.refresh":const n=await new Promise((t,a)=>{e(["TYPO3/CMS/Backend/Viewport"],t,a)}).then(__importStar);return n.Topbar.refresh.bind(n.Topbar);case"TYPO3.WindowManager.localOpen":const i=await new Promise((t,a)=>{e(["TYPO3/CMS/Backend/WindowManager"],t,a)}).then(__importStar);return i.localOpen.bind(i);case"TYPO3.Backend.Storage.ModuleStateStorage.update":return(await new Promise((t,a)=>{e(["TYPO3/CMS/Backend/Storage/ModuleStateStorage"],t,a)}).then(__importStar)).ModuleStateStorage.update;case"TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount":return(await new Promise((t,a)=>{e(["TYPO3/CMS/Backend/Storage/ModuleStateStorage"],t,a)}).then(__importStar)).ModuleStateStorage.updateWithCurrentMount;case"TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent":return r.EventDispatcher.dispatchCustomEvent;default:throw Error('Unknown action "'+t+'"')}}static get observedAttributes(){return["action","args","args-list"]}attributeChangedCallback(e,t,r){if("action"===e)this.action=r;else if("args"===e){const e=r.replace(/&quot;/g,'"'),t=JSON.parse(e);this.args=t instanceof Array?a.trimItems(t):[]}else if("args-list"===e){const e=r.split(",");this.args=a.trimItems(e)}}connectedCallback(){if(!this.action)throw new Error("Missing mandatory action attribute");n.getDelegate(this.action).then(e=>e.apply(null,this.args))}}t.ImmediateActionElement=n,window.customElements.define("typo3-immediate-action",n)}));