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

const{Machine:Machine,actions:actions}=XState,{interpret:interpret}=XStateInterpreter,{choose:choose}=actions;export const getMachine=(views,constants,factorys)=>{const stateHandlerMap={overviewFactory:factorys.overviewHandlerFactory(views.overviewView,views.sceneListView,constants),emptyviewFactory:factorys.emptyHandlerFactory(views.emptyView,constants),settingsviewFactory:factorys.settingsHandlerFactory(views.settingsView,views.navView,views.sceneListView,constants),navviewFactory:factorys.navHandlerFactory(views.navView,views.settingsView,constants),sceneListviewFactory:factorys.sceneListHandlerFactory(views.sceneListView,views.settingsView,constants)};let machine=Machine({id:"scenesMachine",initial:"overview",states:{overview:{on:{OVERVIEW:"overview",SETTINGS:"settings",EMPTY:"empty",EDIT_SCENE_CLICKED:{actions:["callOverviewFactory"]},LIGHT_CLICKED:{actions:["callOverviewFactory"]},DELETE_CLICKED:{actions:["callOverviewFactory"]},BULB_CLICKED:{actions:["callOverviewFactory"]},ADD_SCENE:{actions:["callOverviewFactory"]},CREATE_SCENE:{actions:["callNavviewFactory"]},SCENE_SELECTED:{actions:["callSceneListviewFactory"]},SCENE_CHANGED:{actions:["callNavviewFactory"]},SAVE_CLICKED:{actions:["callNavviewFactory"]},SET_SCENE_STATE_IDLE:{actions:["callNavviewFactory"]}},onEntry:["callOverviewFactory"],onExit:["callOverviewFactory"]},empty:{on:{OVERVIEW:"overview",SETTINGS:"settings",EMPTY:"empty",ADD_SCENE:{actions:["callEmptyviewFactory"]}},onEntry:["callEmptyviewFactory"],onExit:["callEmptyviewFactory"]},settings:{on:{OVERVIEW:"overview",SETTINGS:"settings",EMPTY:"empty",FADING_TIME_CHANGED:{actions:["callSettingsviewFactory"]},DELETE_CLICKED:{actions:["callSettingsviewFactory"]},ADD_SCENE:{actions:["callSettingsviewFactory"]},CREATE_SCENE:{actions:["callNavviewFactory"]},EDIT_SCENE_CLICKED:{actions:["callOverviewFactory"]},SCENE_SELECTED:{actions:["callSceneListviewFactory"]},SAVE_CLICKED:{actions:["callNavviewFactory"]},SET_SCENE_STATE_IDLE:{actions:["callNavviewFactory"]}},onEntry:["callSettingsviewFactory"],onExit:["callSettingsviewFactory"]}}},{actions:{callOverviewFactory:stateHandlerMap.overviewFactory,callEmptyviewFactory:stateHandlerMap.emptyviewFactory,callSettingsviewFactory:stateHandlerMap.settingsviewFactory,callNavviewFactory:stateHandlerMap.navviewFactory,callSceneListviewFactory:stateHandlerMap.sceneListviewFactory}}),service=interpret(machine).onTransition(state=>{console.log("machine event: "+state.event.type)});return service.start(),{machine:machine,service:service}};