xstate 5.0.0-beta.52 → 5.0.0-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/actions/dist/xstate-actions.cjs.js +2 -3
  2. package/actions/dist/xstate-actions.cjs.mjs +0 -1
  3. package/actions/dist/xstate-actions.development.cjs.js +2 -3
  4. package/actions/dist/xstate-actions.development.cjs.mjs +0 -1
  5. package/actions/dist/xstate-actions.development.esm.js +2 -2
  6. package/actions/dist/xstate-actions.esm.js +2 -2
  7. package/actions/dist/xstate-actions.umd.min.js +1 -1
  8. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  9. package/actors/dist/xstate-actors.cjs.js +17 -17
  10. package/actors/dist/xstate-actors.development.cjs.js +17 -17
  11. package/actors/dist/xstate-actors.development.esm.js +17 -17
  12. package/actors/dist/xstate-actors.esm.js +17 -17
  13. package/actors/dist/xstate-actors.umd.min.js +1 -1
  14. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  15. package/dist/declarations/src/State.d.ts +2 -2
  16. package/dist/declarations/src/StateMachine.d.ts +4 -4
  17. package/dist/declarations/src/StateNode.d.ts +1 -1
  18. package/dist/declarations/src/actions/send.d.ts +1 -9
  19. package/dist/declarations/src/actions.d.ts +1 -1
  20. package/dist/declarations/src/actors/transition.d.ts +1 -1
  21. package/dist/declarations/src/guards.d.ts +1 -1
  22. package/dist/declarations/src/interpreter.d.ts +5 -5
  23. package/dist/declarations/src/stateUtils.d.ts +9 -9
  24. package/dist/declarations/src/types.d.ts +15 -11
  25. package/dist/{log-d160285c.development.cjs.js → log-516ee274.development.cjs.js} +23 -40
  26. package/dist/{log-3d815f5e.cjs.js → log-5b24d580.cjs.js} +23 -40
  27. package/dist/{log-826c9895.development.esm.js → log-5ebdc815.development.esm.js} +24 -40
  28. package/dist/{log-6bc0e1e7.esm.js → log-ee8cb6d6.esm.js} +24 -40
  29. package/dist/{raise-9dd3e757.development.cjs.js → raise-57f3c654.development.cjs.js} +130 -130
  30. package/dist/{raise-367eeb6f.cjs.js → raise-5f22d333.cjs.js} +130 -130
  31. package/dist/{raise-f71460d6.esm.js → raise-6f820d79.esm.js} +130 -130
  32. package/dist/{raise-1caefe80.development.esm.js → raise-a6c478f8.development.esm.js} +130 -130
  33. package/dist/xstate.cjs.js +17 -18
  34. package/dist/xstate.cjs.mjs +0 -1
  35. package/dist/xstate.development.cjs.js +17 -18
  36. package/dist/xstate.development.cjs.mjs +0 -1
  37. package/dist/xstate.development.esm.js +19 -19
  38. package/dist/xstate.esm.js +19 -19
  39. package/dist/xstate.umd.min.js +1 -1
  40. package/dist/xstate.umd.min.js.map +1 -1
  41. package/guards/dist/xstate-guards.cjs.js +1 -1
  42. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  43. package/guards/dist/xstate-guards.development.esm.js +1 -1
  44. package/guards/dist/xstate-guards.esm.js +1 -1
  45. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  46. package/package.json +1 -1
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.cjs.js');
6
- var guards_dist_xstateGuards = require('./raise-367eeb6f.cjs.js');
7
- var log = require('./log-3d815f5e.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-5f22d333.cjs.js');
7
+ var log = require('./log-5b24d580.cjs.js');
8
8
  require('../dev/dist/xstate-dev.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -297,7 +297,7 @@ class StateNode {
297
297
  get initial() {
298
298
  return memo(this, 'initial', () => guards_dist_xstateGuards.formatInitialTransition(this, this.config.initial));
299
299
  }
300
- next(state, event) {
300
+ next(snapshot, event) {
301
301
  const eventType = event.type;
302
302
  const actions = [];
303
303
  let selectedTransition;
@@ -306,10 +306,10 @@ class StateNode {
306
306
  const {
307
307
  guard
308
308
  } = candidate;
309
- const resolvedContext = state.context;
309
+ const resolvedContext = snapshot.context;
310
310
  let guardPassed = false;
311
311
  try {
312
- guardPassed = !guard || guards_dist_xstateGuards.evaluateGuard(guard, resolvedContext, event, state);
312
+ guardPassed = !guard || guards_dist_xstateGuards.evaluateGuard(guard, resolvedContext, event, snapshot);
313
313
  } catch (err) {
314
314
  const guardType = typeof guard === 'string' ? guard : typeof guard === 'object' ? guard.type : undefined;
315
315
  throw new Error(`Unable to evaluate guard ${guardType ? `'${guardType}' ` : ''}in transition for event '${eventType}' in state node '${this.id}':\n${err.message}`);
@@ -390,7 +390,7 @@ class StateMachine {
390
390
  this.version = this.config.version;
391
391
  this.transition = this.transition.bind(this);
392
392
  this.getInitialState = this.getInitialState.bind(this);
393
- this.restoreState = this.restoreState.bind(this);
393
+ this.restoreSnapshot = this.restoreSnapshot.bind(this);
394
394
  this.start = this.start.bind(this);
395
395
  this.root = new StateNode(config, {
396
396
  _key: this.id,
@@ -458,7 +458,7 @@ class StateMachine {
458
458
  * @param event The received event
459
459
  */
460
460
  transition(snapshot, event, actorScope) {
461
- return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).state;
461
+ return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).snapshot;
462
462
  }
463
463
 
464
464
  /**
@@ -468,8 +468,8 @@ class StateMachine {
468
468
  * @param state The current state
469
469
  * @param event The received event
470
470
  */
471
- microstep(state, event, actorScope) {
472
- return guards_dist_xstateGuards.macrostep(state, event, actorScope).microstates;
471
+ microstep(snapshot, event, actorScope) {
472
+ return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).microstates;
473
473
  }
474
474
  getTransitionData(snapshot, event) {
475
475
  return guards_dist_xstateGuards.transitionNode(this.root, snapshot.value, snapshot, event) || [];
@@ -518,12 +518,12 @@ class StateMachine {
518
518
  toJSON: null // TODO: fix
519
519
  }], preInitialState, actorScope, initEvent, true, internalQueue);
520
520
  const {
521
- state: macroState
521
+ snapshot: macroState
522
522
  } = guards_dist_xstateGuards.macrostep(nextState, initEvent, actorScope, internalQueue);
523
523
  return macroState;
524
524
  }
525
- start(state) {
526
- Object.values(state.children).forEach(child => {
525
+ start(snapshot) {
526
+ Object.values(snapshot.children).forEach(child => {
527
527
  if (child.getSnapshot().status === 'active') {
528
528
  child.start();
529
529
  }
@@ -545,15 +545,15 @@ class StateMachine {
545
545
  toJSON() {
546
546
  return this.definition;
547
547
  }
548
- getPersistedState(state, options) {
549
- return guards_dist_xstateGuards.getPersistedState(state, options);
548
+ getPersistedSnapshot(snapshot, options) {
549
+ return guards_dist_xstateGuards.getPersistedSnapshot(snapshot, options);
550
550
  }
551
- restoreState(snapshot, _actorScope) {
551
+ restoreSnapshot(snapshot, _actorScope) {
552
552
  const children = {};
553
553
  const snapshotChildren = snapshot.children;
554
554
  Object.keys(snapshotChildren).forEach(actorId => {
555
555
  const actorData = snapshotChildren[actorId];
556
- const childState = actorData.state;
556
+ const childState = actorData.snapshot;
557
557
  const src = actorData.src;
558
558
  const logic = typeof src === 'string' ? guards_dist_xstateGuards.resolveReferencedActor(this, src) : src;
559
559
  if (!logic) {
@@ -563,7 +563,7 @@ class StateMachine {
563
563
  id: actorId,
564
564
  parent: _actorScope?.self,
565
565
  syncSnapshot: actorData.syncSnapshot,
566
- state: childState,
566
+ snapshot: childState,
567
567
  src,
568
568
  systemId: actorData.systemId
569
569
  });
@@ -719,7 +719,6 @@ exports.toObserver = guards_dist_xstateGuards.toObserver;
719
719
  exports.SpecialTargets = log.SpecialTargets;
720
720
  exports.assign = log.assign;
721
721
  exports.enqueueActions = log.enqueueActions;
722
- exports.escalate = log.escalate;
723
722
  exports.forwardTo = log.forwardTo;
724
723
  exports.log = log.log;
725
724
  exports.sendParent = log.sendParent;
@@ -12,7 +12,6 @@ export {
12
12
  createEmptyActor,
13
13
  createMachine,
14
14
  enqueueActions,
15
- escalate,
16
15
  forwardTo,
17
16
  fromCallback,
18
17
  fromEventObservable,
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.development.cjs.js');
6
- var guards_dist_xstateGuards = require('./raise-9dd3e757.development.cjs.js');
7
- var log = require('./log-d160285c.development.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-57f3c654.development.cjs.js');
7
+ var log = require('./log-516ee274.development.cjs.js');
8
8
  require('../dev/dist/xstate-dev.development.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -297,7 +297,7 @@ class StateNode {
297
297
  get initial() {
298
298
  return memo(this, 'initial', () => guards_dist_xstateGuards.formatInitialTransition(this, this.config.initial));
299
299
  }
300
- next(state, event) {
300
+ next(snapshot, event) {
301
301
  const eventType = event.type;
302
302
  const actions = [];
303
303
  let selectedTransition;
@@ -306,10 +306,10 @@ class StateNode {
306
306
  const {
307
307
  guard
308
308
  } = candidate;
309
- const resolvedContext = state.context;
309
+ const resolvedContext = snapshot.context;
310
310
  let guardPassed = false;
311
311
  try {
312
- guardPassed = !guard || guards_dist_xstateGuards.evaluateGuard(guard, resolvedContext, event, state);
312
+ guardPassed = !guard || guards_dist_xstateGuards.evaluateGuard(guard, resolvedContext, event, snapshot);
313
313
  } catch (err) {
314
314
  const guardType = typeof guard === 'string' ? guard : typeof guard === 'object' ? guard.type : undefined;
315
315
  throw new Error(`Unable to evaluate guard ${guardType ? `'${guardType}' ` : ''}in transition for event '${eventType}' in state node '${this.id}':\n${err.message}`);
@@ -390,7 +390,7 @@ class StateMachine {
390
390
  this.version = this.config.version;
391
391
  this.transition = this.transition.bind(this);
392
392
  this.getInitialState = this.getInitialState.bind(this);
393
- this.restoreState = this.restoreState.bind(this);
393
+ this.restoreSnapshot = this.restoreSnapshot.bind(this);
394
394
  this.start = this.start.bind(this);
395
395
  this.root = new StateNode(config, {
396
396
  _key: this.id,
@@ -461,7 +461,7 @@ class StateMachine {
461
461
  * @param event The received event
462
462
  */
463
463
  transition(snapshot, event, actorScope) {
464
- return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).state;
464
+ return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).snapshot;
465
465
  }
466
466
 
467
467
  /**
@@ -471,8 +471,8 @@ class StateMachine {
471
471
  * @param state The current state
472
472
  * @param event The received event
473
473
  */
474
- microstep(state, event, actorScope) {
475
- return guards_dist_xstateGuards.macrostep(state, event, actorScope).microstates;
474
+ microstep(snapshot, event, actorScope) {
475
+ return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).microstates;
476
476
  }
477
477
  getTransitionData(snapshot, event) {
478
478
  return guards_dist_xstateGuards.transitionNode(this.root, snapshot.value, snapshot, event) || [];
@@ -521,12 +521,12 @@ class StateMachine {
521
521
  toJSON: null // TODO: fix
522
522
  }], preInitialState, actorScope, initEvent, true, internalQueue);
523
523
  const {
524
- state: macroState
524
+ snapshot: macroState
525
525
  } = guards_dist_xstateGuards.macrostep(nextState, initEvent, actorScope, internalQueue);
526
526
  return macroState;
527
527
  }
528
- start(state) {
529
- Object.values(state.children).forEach(child => {
528
+ start(snapshot) {
529
+ Object.values(snapshot.children).forEach(child => {
530
530
  if (child.getSnapshot().status === 'active') {
531
531
  child.start();
532
532
  }
@@ -548,15 +548,15 @@ class StateMachine {
548
548
  toJSON() {
549
549
  return this.definition;
550
550
  }
551
- getPersistedState(state, options) {
552
- return guards_dist_xstateGuards.getPersistedState(state, options);
551
+ getPersistedSnapshot(snapshot, options) {
552
+ return guards_dist_xstateGuards.getPersistedSnapshot(snapshot, options);
553
553
  }
554
- restoreState(snapshot, _actorScope) {
554
+ restoreSnapshot(snapshot, _actorScope) {
555
555
  const children = {};
556
556
  const snapshotChildren = snapshot.children;
557
557
  Object.keys(snapshotChildren).forEach(actorId => {
558
558
  const actorData = snapshotChildren[actorId];
559
- const childState = actorData.state;
559
+ const childState = actorData.snapshot;
560
560
  const src = actorData.src;
561
561
  const logic = typeof src === 'string' ? guards_dist_xstateGuards.resolveReferencedActor(this, src) : src;
562
562
  if (!logic) {
@@ -566,7 +566,7 @@ class StateMachine {
566
566
  id: actorId,
567
567
  parent: _actorScope?.self,
568
568
  syncSnapshot: actorData.syncSnapshot,
569
- state: childState,
569
+ snapshot: childState,
570
570
  src,
571
571
  systemId: actorData.systemId
572
572
  });
@@ -725,7 +725,6 @@ exports.toObserver = guards_dist_xstateGuards.toObserver;
725
725
  exports.SpecialTargets = log.SpecialTargets;
726
726
  exports.assign = log.assign;
727
727
  exports.enqueueActions = log.enqueueActions;
728
- exports.escalate = log.escalate;
729
728
  exports.forwardTo = log.forwardTo;
730
729
  exports.log = log.log;
731
730
  exports.sendParent = log.sendParent;
@@ -12,7 +12,6 @@ export {
12
12
  createEmptyActor,
13
13
  createMachine,
14
14
  enqueueActions,
15
- escalate,
16
15
  forwardTo,
17
16
  fromCallback,
18
17
  fromEventObservable,
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedState, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-1caefe80.development.esm.js';
3
- export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-1caefe80.development.esm.js';
4
- import { a as assign } from './log-826c9895.development.esm.js';
5
- export { S as SpecialTargets, a as assign, e as enqueueActions, b as escalate, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-826c9895.development.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedSnapshot, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-a6c478f8.development.esm.js';
3
+ export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-a6c478f8.development.esm.js';
4
+ import { a as assign } from './log-5ebdc815.development.esm.js';
5
+ export { S as SpecialTargets, a as assign, e as enqueueActions, f as forwardTo, l as log, s as sendParent, b as sendTo } from './log-5ebdc815.development.esm.js';
6
6
  import '../dev/dist/xstate-dev.development.esm.js';
7
7
 
8
8
  class SimulatedClock {
@@ -295,7 +295,7 @@ class StateNode {
295
295
  get initial() {
296
296
  return memo(this, 'initial', () => formatInitialTransition(this, this.config.initial));
297
297
  }
298
- next(state, event) {
298
+ next(snapshot, event) {
299
299
  const eventType = event.type;
300
300
  const actions = [];
301
301
  let selectedTransition;
@@ -304,10 +304,10 @@ class StateNode {
304
304
  const {
305
305
  guard
306
306
  } = candidate;
307
- const resolvedContext = state.context;
307
+ const resolvedContext = snapshot.context;
308
308
  let guardPassed = false;
309
309
  try {
310
- guardPassed = !guard || evaluateGuard(guard, resolvedContext, event, state);
310
+ guardPassed = !guard || evaluateGuard(guard, resolvedContext, event, snapshot);
311
311
  } catch (err) {
312
312
  const guardType = typeof guard === 'string' ? guard : typeof guard === 'object' ? guard.type : undefined;
313
313
  throw new Error(`Unable to evaluate guard ${guardType ? `'${guardType}' ` : ''}in transition for event '${eventType}' in state node '${this.id}':\n${err.message}`);
@@ -388,7 +388,7 @@ class StateMachine {
388
388
  this.version = this.config.version;
389
389
  this.transition = this.transition.bind(this);
390
390
  this.getInitialState = this.getInitialState.bind(this);
391
- this.restoreState = this.restoreState.bind(this);
391
+ this.restoreSnapshot = this.restoreSnapshot.bind(this);
392
392
  this.start = this.start.bind(this);
393
393
  this.root = new StateNode(config, {
394
394
  _key: this.id,
@@ -459,7 +459,7 @@ class StateMachine {
459
459
  * @param event The received event
460
460
  */
461
461
  transition(snapshot, event, actorScope) {
462
- return macrostep(snapshot, event, actorScope).state;
462
+ return macrostep(snapshot, event, actorScope).snapshot;
463
463
  }
464
464
 
465
465
  /**
@@ -469,8 +469,8 @@ class StateMachine {
469
469
  * @param state The current state
470
470
  * @param event The received event
471
471
  */
472
- microstep(state, event, actorScope) {
473
- return macrostep(state, event, actorScope).microstates;
472
+ microstep(snapshot, event, actorScope) {
473
+ return macrostep(snapshot, event, actorScope).microstates;
474
474
  }
475
475
  getTransitionData(snapshot, event) {
476
476
  return transitionNode(this.root, snapshot.value, snapshot, event) || [];
@@ -519,12 +519,12 @@ class StateMachine {
519
519
  toJSON: null // TODO: fix
520
520
  }], preInitialState, actorScope, initEvent, true, internalQueue);
521
521
  const {
522
- state: macroState
522
+ snapshot: macroState
523
523
  } = macrostep(nextState, initEvent, actorScope, internalQueue);
524
524
  return macroState;
525
525
  }
526
- start(state) {
527
- Object.values(state.children).forEach(child => {
526
+ start(snapshot) {
527
+ Object.values(snapshot.children).forEach(child => {
528
528
  if (child.getSnapshot().status === 'active') {
529
529
  child.start();
530
530
  }
@@ -546,15 +546,15 @@ class StateMachine {
546
546
  toJSON() {
547
547
  return this.definition;
548
548
  }
549
- getPersistedState(state, options) {
550
- return getPersistedState(state, options);
549
+ getPersistedSnapshot(snapshot, options) {
550
+ return getPersistedSnapshot(snapshot, options);
551
551
  }
552
- restoreState(snapshot, _actorScope) {
552
+ restoreSnapshot(snapshot, _actorScope) {
553
553
  const children = {};
554
554
  const snapshotChildren = snapshot.children;
555
555
  Object.keys(snapshotChildren).forEach(actorId => {
556
556
  const actorData = snapshotChildren[actorId];
557
- const childState = actorData.state;
557
+ const childState = actorData.snapshot;
558
558
  const src = actorData.src;
559
559
  const logic = typeof src === 'string' ? resolveReferencedActor(this, src) : src;
560
560
  if (!logic) {
@@ -564,7 +564,7 @@ class StateMachine {
564
564
  id: actorId,
565
565
  parent: _actorScope?.self,
566
566
  syncSnapshot: actorData.syncSnapshot,
567
- state: childState,
567
+ snapshot: childState,
568
568
  src,
569
569
  systemId: actorData.systemId
570
570
  });
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedState, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-f71460d6.esm.js';
3
- export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-f71460d6.esm.js';
4
- import { a as assign } from './log-6bc0e1e7.esm.js';
5
- export { S as SpecialTargets, a as assign, e as enqueueActions, b as escalate, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-6bc0e1e7.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedSnapshot, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-6f820d79.esm.js';
3
+ export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-6f820d79.esm.js';
4
+ import { a as assign } from './log-ee8cb6d6.esm.js';
5
+ export { S as SpecialTargets, a as assign, e as enqueueActions, f as forwardTo, l as log, s as sendParent, b as sendTo } from './log-ee8cb6d6.esm.js';
6
6
  import '../dev/dist/xstate-dev.esm.js';
7
7
 
8
8
  class SimulatedClock {
@@ -295,7 +295,7 @@ class StateNode {
295
295
  get initial() {
296
296
  return memo(this, 'initial', () => formatInitialTransition(this, this.config.initial));
297
297
  }
298
- next(state, event) {
298
+ next(snapshot, event) {
299
299
  const eventType = event.type;
300
300
  const actions = [];
301
301
  let selectedTransition;
@@ -304,10 +304,10 @@ class StateNode {
304
304
  const {
305
305
  guard
306
306
  } = candidate;
307
- const resolvedContext = state.context;
307
+ const resolvedContext = snapshot.context;
308
308
  let guardPassed = false;
309
309
  try {
310
- guardPassed = !guard || evaluateGuard(guard, resolvedContext, event, state);
310
+ guardPassed = !guard || evaluateGuard(guard, resolvedContext, event, snapshot);
311
311
  } catch (err) {
312
312
  const guardType = typeof guard === 'string' ? guard : typeof guard === 'object' ? guard.type : undefined;
313
313
  throw new Error(`Unable to evaluate guard ${guardType ? `'${guardType}' ` : ''}in transition for event '${eventType}' in state node '${this.id}':\n${err.message}`);
@@ -388,7 +388,7 @@ class StateMachine {
388
388
  this.version = this.config.version;
389
389
  this.transition = this.transition.bind(this);
390
390
  this.getInitialState = this.getInitialState.bind(this);
391
- this.restoreState = this.restoreState.bind(this);
391
+ this.restoreSnapshot = this.restoreSnapshot.bind(this);
392
392
  this.start = this.start.bind(this);
393
393
  this.root = new StateNode(config, {
394
394
  _key: this.id,
@@ -456,7 +456,7 @@ class StateMachine {
456
456
  * @param event The received event
457
457
  */
458
458
  transition(snapshot, event, actorScope) {
459
- return macrostep(snapshot, event, actorScope).state;
459
+ return macrostep(snapshot, event, actorScope).snapshot;
460
460
  }
461
461
 
462
462
  /**
@@ -466,8 +466,8 @@ class StateMachine {
466
466
  * @param state The current state
467
467
  * @param event The received event
468
468
  */
469
- microstep(state, event, actorScope) {
470
- return macrostep(state, event, actorScope).microstates;
469
+ microstep(snapshot, event, actorScope) {
470
+ return macrostep(snapshot, event, actorScope).microstates;
471
471
  }
472
472
  getTransitionData(snapshot, event) {
473
473
  return transitionNode(this.root, snapshot.value, snapshot, event) || [];
@@ -516,12 +516,12 @@ class StateMachine {
516
516
  toJSON: null // TODO: fix
517
517
  }], preInitialState, actorScope, initEvent, true, internalQueue);
518
518
  const {
519
- state: macroState
519
+ snapshot: macroState
520
520
  } = macrostep(nextState, initEvent, actorScope, internalQueue);
521
521
  return macroState;
522
522
  }
523
- start(state) {
524
- Object.values(state.children).forEach(child => {
523
+ start(snapshot) {
524
+ Object.values(snapshot.children).forEach(child => {
525
525
  if (child.getSnapshot().status === 'active') {
526
526
  child.start();
527
527
  }
@@ -543,15 +543,15 @@ class StateMachine {
543
543
  toJSON() {
544
544
  return this.definition;
545
545
  }
546
- getPersistedState(state, options) {
547
- return getPersistedState(state, options);
546
+ getPersistedSnapshot(snapshot, options) {
547
+ return getPersistedSnapshot(snapshot, options);
548
548
  }
549
- restoreState(snapshot, _actorScope) {
549
+ restoreSnapshot(snapshot, _actorScope) {
550
550
  const children = {};
551
551
  const snapshotChildren = snapshot.children;
552
552
  Object.keys(snapshotChildren).forEach(actorId => {
553
553
  const actorData = snapshotChildren[actorId];
554
- const childState = actorData.state;
554
+ const childState = actorData.snapshot;
555
555
  const src = actorData.src;
556
556
  const logic = typeof src === 'string' ? resolveReferencedActor(this, src) : src;
557
557
  if (!logic) {
@@ -561,7 +561,7 @@ class StateMachine {
561
561
  id: actorId,
562
562
  parent: _actorScope?.self,
563
563
  syncSnapshot: actorData.syncSnapshot,
564
- state: childState,
564
+ snapshot: childState,
565
565
  src,
566
566
  systemId: actorData.systemId
567
567
  });