/*! phoscon-app 2024-08-14 */

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{renameGw}from"./settings-gateway-functions.js";export var renameViewHandlerFactory=view=>(ctx,activity)=>{let event=activity.type;view.getName();if(event===states.RENAME)view.show(),view.page1(),view.setName(),serviceSend(states.RENAME_PAGE_1_INVALID);else if(event===events.NAME_CHANGED)view.isValidInputName()?serviceSend(states.RENAME_PAGE_1_VALID):serviceSend(states.RENAME_PAGE_1_INVALID);else if(event===events.NEXT_PRESSED){let name=view.getName();name&&renameGw(name),view.hide(),serviceSend(states.IDLE)}else if(event===events.CLOSE_PRESSED||event===events.CANCEL_PRESSED){view.hide(),serviceSend(states.IDLE),document.querySelector(".context-menu-icon").parentNode.classList.remove("show-context")}else view.hide()};export var renameViewPage1ValidHandlerFactory=view=>(ctx,activity)=>{activity.type===states.RENAME_PAGE_1_VALID&&view.page1Valid()};export var renameViewPage1InvalidHandlerFactory=view=>(ctx,activity)=>{activity.type===states.RENAME_PAGE_1_INVALID&&view.page1Invalid()};