/*! phoscon-app 2023-07-31 */

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{setTimezone}from"./settings-gateway-functions.js";export var timezoneViewHandlerFactory=view=>(ctx,activity)=>{let event=activity.type;view.getTimezone();if(event===states.CHANGE_TIMEZONE)view.show(),view.page1(),serviceSend(states.CHANGE_TIMEZONE_PAGE_1_INVALID);else if(event===events.TIMEZONE_CHANGED)view.isValidTimezone()?serviceSend(states.CHANGE_TIMEZONE_PAGE_1_VALID):serviceSend(states.CHANGE_TIMEZONE_PAGE_1_INVALID);else if(event===events.NEXT_PRESSED){let tz=view.getTimezone();tz&&setTimezone(tz),view.hide(),serviceSend(states.IDLE)}else event===events.CLOSE_PRESSED||event===events.CANCEL_PRESSED?(view.hide(),serviceSend(states.IDLE)):view.hide()};export var timezoneViewPage1ValidHandlerFactory=view=>(ctx,activity)=>{activity.type===states.CHANGE_TIMEZONE_PAGE_1_VALID&&view.page1Valid()};export var timezoneViewPage1InvalidHandlerFactory=view=>(ctx,activity)=>{activity.type===states.CHANGE_TIMEZONE_PAGE_1_INVALID&&view.page1Invalid()};