| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | "use strict";var __read = (this && this.__read) || function (o, n) {    var m = typeof Symbol === "function" && o[Symbol.iterator];    if (!m) return o;    var i = m.call(o), r, ar = [], e;    try {        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);    }    catch (error) { e = { error: error }; }    finally {        try {            if (r && !r.done && (m = i["return"])) m.call(i);        }        finally { if (e) throw e.error; }    }    return ar;};var __values = (this && this.__values) || function(o) {    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;    if (m) return m.call(o);    if (o && typeof o.length === "number") return {        next: function () {            if (o && i >= o.length) o = void 0;            return { value: o && o[i++], done: !o };        }    };    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");};Object.defineProperty(exports, "__esModule", { value: true });exports.isInterpreterStateEqual = exports.isService = exports.shallowEqual = exports.getServiceSnapshot = exports.partition = void 0;var xstate_1 = require("xstate");function partition(items, predicate) {    var e_1, _a;    var _b = __read([[], []], 2), truthy = _b[0], falsy = _b[1];    try {        for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {            var item = items_1_1.value;            if (predicate(item)) {                truthy.push(item);            }            else {                falsy.push(item);            }        }    }    catch (e_1_1) { e_1 = { error: e_1_1 }; }    finally {        try {            if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);        }        finally { if (e_1) throw e_1.error; }    }    return [truthy, falsy];}exports.partition = partition;function getServiceSnapshot(service) {    return service.status !== 0        ? service.getSnapshot()        : service.machine.initialState;}exports.getServiceSnapshot = getServiceSnapshot;// From https://github.com/reduxjs/react-redux/blob/master/src/utils/shallowEqual.tsfunction is(x, y) {    if (x === y) {        return x !== 0 || y !== 0 || 1 / x === 1 / y;    }    else {        return x !== x && y !== y;    }}function shallowEqual(objA, objB) {    if (is(objA, objB))        return true;    if (typeof objA !== 'object' ||        objA === null ||        typeof objB !== 'object' ||        objB === null) {        return false;    }    var keysA = Object.keys(objA);    var keysB = Object.keys(objB);    if (keysA.length !== keysB.length)        return false;    for (var i = 0; i < keysA.length; i++) {        if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||            !is(objA[keysA[i]], objB[keysA[i]])) {            return false;        }    }    return true;}exports.shallowEqual = shallowEqual;function isService(actor) {    return 'state' in actor && 'machine' in actor;}exports.isService = isService;function isInterpreterStateEqual(service, prevState, nextState) {    if (service.status === xstate_1.InterpreterStatus.NotStarted) {        return true;    }    // Only change the current state if:    // - the incoming state is the "live" initial state (since it might have new actors)    // - OR the incoming state actually changed.    //    // The "live" initial state will have .changed === undefined.    var initialStateChanged = nextState.changed === undefined &&        (Object.keys(nextState.children).length > 0 ||            typeof prevState.changed === 'boolean');    return !(nextState.changed || initialStateChanged);}exports.isInterpreterStateEqual = isInterpreterStateEqual;
 |