/*! phoscon-app 2024-10-07 */

import{ButtonEvents,StateEvents,WifiEvents,GeneralStates,UiStates}from"./state-constants.js";import{appSetState,initAccessPointState}from"./state-handler.js";export var apHandlerFactory=(view,setState,wifi)=>event=>{if(event===StateEvents.ENTER_STATE)view.showAccessPoint(),initAccessPointState();else if(event!==StateEvents.LEAVE_STATE)return StateEvents.NOT_HANDLED};export var apOverwriteClientHandlerFactory=(view,setState,wifi)=>event=>{if(event===StateEvents.ENTER_STATE)view.show();else if(event===StateEvents.LEAVE_STATE)view.hide();else if(event===WifiEvents.CONFIG_CHANGED)setState(UiStates.AP);else if(event===ButtonEvents.CONFIGURE_AP_PRESSED)appSetState(UiStates.CASE_5_PAGE_1);else{if(event!==ButtonEvents.TAB_CLIENT_PRESSED)return StateEvents.NOT_HANDLED;appSetState(UiStates.CLIENT)}};export var apConfiguredHandlerFactory=(view,setState,wifi)=>event=>{if(event===StateEvents.ENTER_STATE)view.show();else if(event===StateEvents.LEAVE_STATE)view.hide();else if(event===WifiEvents.CONFIG_CHANGED)setState(UiStates.AP);else if(event===ButtonEvents.CHANGE_AP_PRESSED)appSetState(UiStates.CASE_6_PAGE_1);else if(event===ButtonEvents.DEACTIVATE_AP_PRESSED)appSetState(UiStates.CASE_8_PAGE_1);else{if(event!==ButtonEvents.TAB_CLIENT_PRESSED)return StateEvents.NOT_HANDLED;appSetState(UiStates.CLIENT)}};export var apDeactivatedHandlerFactory=(view,setState,wifi)=>event=>{if(event===StateEvents.ENTER_STATE)view.show();else if(event===StateEvents.LEAVE_STATE)view.hide();else if(event===WifiEvents.CONFIG_CHANGED)setState(UiStates.AP);else if(event===ButtonEvents.CONFIGURE_AP_PRESSED)appSetState(UiStates.CASE_5_PAGE_1);else{if(event!==ButtonEvents.TAB_CLIENT_PRESSED)return StateEvents.NOT_HANDLED;appSetState(UiStates.CLIENT)}};export var apActiveNotConfHandlerFactory=(view,setState,wifi)=>event=>{if(event===StateEvents.ENTER_STATE)view.show();else if(event===StateEvents.LEAVE_STATE)view.hide();else if(event===WifiEvents.CONFIG_CHANGED)setState(UiStates.AP);else if(event===ButtonEvents.CHANGE_AP_PRESSED)appSetState(UiStates.CASE_6_PAGE_1);else{if(event!==ButtonEvents.TAB_CLIENT_PRESSED)return StateEvents.NOT_HANDLED;appSetState(UiStates.CLIENT)}};