/*! phoscon-app 2024-02-26 */

export function initMachine(param){const{Machine:Machine,actions:actions}=XState,{interpret:interpret}=XStateInterpreter,{send:send,sendParent:sendParent,log:log,raise:raise,assign:assign}=actions;param.states;let map=param.stateHandlerMap,machine=Machine({id:"login",type:"parallel",context:{service:null},states:{page:param.page,scan:param.scan}},{actions:{callFactoryFunc:(context,event,{action:action})=>{let type=action.state;map[type](context,event,{action:action})},callRouter:(context,event,{action:action})=>{let route=event.route;app.router.navigate(route,{trigger:!0})}}}),service=interpret(machine).onTransition(state=>{console.log("MACHINE event: "+state.event.type),app.Devicetype.sendMessage("MACHINE event",state.event.type),console.log("State object: "+JSON.stringify(state.value,null,4))}).onDone(x=>{});return service.start(),{machine:machine,service:service}};