@oasys/oecs 0.5.4 → 0.6.0
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.
- package/CHANGELOG.md +1223 -266
- package/README.md +217 -112
- package/dist/core/ecs/access_check.d.cts +29 -29
- package/dist/core/ecs/access_check.d.ts +29 -29
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +217 -209
- package/dist/core/ecs/archetype.d.ts +217 -209
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_closure.d.cts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts +23 -0
- package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
- package/dist/core/ecs/archetype_graph.d.cts +33 -33
- package/dist/core/ecs/archetype_graph.d.ts +33 -33
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
- package/dist/core/ecs/archetype_types.d.cts +55 -0
- package/dist/core/ecs/archetype_types.d.ts +55 -0
- package/dist/core/ecs/archetype_types.d.ts.map +1 -0
- package/dist/core/ecs/change_feed.d.cts +53 -0
- package/dist/core/ecs/change_feed.d.ts +53 -0
- package/dist/core/ecs/change_feed.d.ts.map +1 -0
- package/dist/core/ecs/changed_query.d.cts +36 -0
- package/dist/core/ecs/changed_query.d.ts +36 -0
- package/dist/core/ecs/changed_query.d.ts.map +1 -0
- package/dist/core/ecs/chunk_columns.d.cts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts +49 -0
- package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
- package/dist/core/ecs/command_log.d.cts +26 -26
- package/dist/core/ecs/command_log.d.ts +26 -26
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +43 -42
- package/dist/core/ecs/component.d.ts +43 -42
- package/dist/core/ecs/component.d.ts.map +1 -1
- package/dist/core/ecs/component_registry.d.cts +53 -0
- package/dist/core/ecs/component_registry.d.ts +53 -0
- package/dist/core/ecs/component_registry.d.ts.map +1 -0
- package/dist/core/ecs/compute_backend.d.cts +18 -7
- package/dist/core/ecs/compute_backend.d.ts +18 -7
- package/dist/core/ecs/compute_backend.d.ts.map +1 -1
- package/dist/core/ecs/deferred_commands.d.cts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts +15 -14
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
- package/dist/core/ecs/dispatch_trace.d.cts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts +32 -31
- package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
- package/dist/core/ecs/ecs.d.cts +289 -270
- package/dist/core/ecs/ecs.d.ts +289 -270
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts +134 -136
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
- package/dist/core/ecs/ecs_options.d.cts +89 -0
- package/dist/core/ecs/ecs_options.d.ts +89 -0
- package/dist/core/ecs/ecs_options.d.ts.map +1 -0
- package/dist/core/ecs/entity.d.cts +4 -4
- package/dist/core/ecs/entity.d.ts +4 -4
- package/dist/core/ecs/entity_allocator.d.cts +20 -18
- package/dist/core/ecs/entity_allocator.d.ts +20 -18
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +36 -22
- package/dist/core/ecs/event.d.ts +36 -22
- package/dist/core/ecs/event.d.ts.map +1 -1
- package/dist/core/ecs/facades.d.cts +12 -126
- package/dist/core/ecs/facades.d.ts +12 -126
- package/dist/core/ecs/facades.d.ts.map +1 -1
- package/dist/core/ecs/frame_stepper.d.cts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts +12 -12
- package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
- package/dist/core/ecs/frame_trace.d.cts +32 -32
- package/dist/core/ecs/frame_trace.d.ts +32 -32
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +103 -85
- package/dist/core/ecs/host_commands.d.ts +103 -85
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +21 -11
- package/dist/core/ecs/index.d.ts +21 -11
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +39 -120
- package/dist/core/ecs/observer.d.ts +39 -120
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/phase.d.cts +79 -0
- package/dist/core/ecs/phase.d.ts +79 -0
- package/dist/core/ecs/phase.d.ts.map +1 -0
- package/dist/core/ecs/plugin.d.cts +125 -0
- package/dist/core/ecs/plugin.d.ts +125 -0
- package/dist/core/ecs/plugin.d.ts.map +1 -0
- package/dist/core/ecs/plugin_slots.d.cts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts +26 -0
- package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
- package/dist/core/ecs/query.d.cts +208 -578
- package/dist/core/ecs/query.d.ts +208 -578
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/query_cache.d.cts +130 -0
- package/dist/core/ecs/query_cache.d.ts +130 -0
- package/dist/core/ecs/query_cache.d.ts.map +1 -0
- package/dist/core/ecs/query_registry.d.cts +47 -0
- package/dist/core/ecs/query_registry.d.ts +47 -0
- package/dist/core/ecs/query_registry.d.ts.map +1 -0
- package/dist/core/ecs/query_terms.d.cts +126 -0
- package/dist/core/ecs/query_terms.d.ts +126 -0
- package/dist/core/ecs/query_terms.d.ts.map +1 -0
- package/dist/core/ecs/ref.d.cts +100 -39
- package/dist/core/ecs/ref.d.ts +100 -39
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +101 -182
- package/dist/core/ecs/relation.d.ts +101 -182
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +13 -13
- package/dist/core/ecs/resource.d.ts +13 -13
- package/dist/core/ecs/resource_registry.d.cts +5 -5
- package/dist/core/ecs/resource_registry.d.ts +5 -5
- package/dist/core/ecs/resource_registry.d.ts.map +1 -1
- package/dist/core/ecs/row_kinds.d.cts +24 -0
- package/dist/core/ecs/row_kinds.d.ts +24 -0
- package/dist/core/ecs/row_kinds.d.ts.map +1 -0
- package/dist/core/ecs/run_condition.d.cts +23 -23
- package/dist/core/ecs/run_condition.d.ts +23 -23
- package/dist/core/ecs/run_condition.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +91 -120
- package/dist/core/ecs/schedule.d.ts +91 -120
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/schedule_plan.d.cts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts +33 -0
- package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
- package/dist/core/ecs/snapshot.d.cts +77 -0
- package/dist/core/ecs/snapshot.d.ts +77 -0
- package/dist/core/ecs/snapshot.d.ts.map +1 -0
- package/dist/core/ecs/snapshot_mount.d.cts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts +42 -0
- package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
- package/dist/core/ecs/sparse_store.d.cts +108 -51
- package/dist/core/ecs/sparse_store.d.ts +108 -51
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +527 -473
- package/dist/core/ecs/store.d.ts +527 -473
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +6 -6
- package/dist/core/ecs/store_layout_listener.d.ts +6 -6
- package/dist/core/ecs/store_types.d.cts +122 -0
- package/dist/core/ecs/store_types.d.ts +122 -0
- package/dist/core/ecs/store_types.d.ts.map +1 -0
- package/dist/core/ecs/system.d.cts +146 -61
- package/dist/core/ecs/system.d.ts +146 -61
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/core/ecs/system_context.d.cts +296 -0
- package/dist/core/ecs/system_context.d.ts +296 -0
- package/dist/core/ecs/system_context.d.ts.map +1 -0
- package/dist/core/ecs/system_set.d.cts +48 -0
- package/dist/core/ecs/system_set.d.ts +48 -0
- package/dist/core/ecs/system_set.d.ts.map +1 -0
- package/dist/core/ecs/utils/arrays.d.cts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts +15 -1
- package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
- package/dist/core/ecs/utils/error.d.cts +82 -6
- package/dist/core/ecs/utils/error.d.ts +82 -6
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
- package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
- package/dist/core/restore_errors.d.cts +30 -0
- package/dist/core/restore_errors.d.ts +30 -0
- package/dist/core/restore_errors.d.ts.map +1 -0
- package/dist/core/store/action_ring.d.cts +44 -44
- package/dist/core/store/action_ring.d.ts +44 -44
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +149 -95
- package/dist/core/store/allocator.d.ts +149 -95
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts +17 -17
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +124 -86
- package/dist/core/store/column_store.d.ts +124 -86
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +14 -15
- package/dist/core/store/command_dispatch.d.ts +14 -15
- package/dist/core/store/command_dispatch.d.ts.map +1 -1
- package/dist/core/store/command_ring.d.cts +36 -39
- package/dist/core/store/command_ring.d.ts +36 -39
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +34 -17
- package/dist/core/store/descriptor.d.ts +34 -17
- package/dist/core/store/descriptor.d.ts.map +1 -1
- package/dist/core/store/entity_index.d.cts +34 -35
- package/dist/core/store/entity_index.d.ts +34 -35
- package/dist/core/store/entity_index.d.ts.map +1 -1
- package/dist/core/store/event_ring.d.cts +36 -38
- package/dist/core/store/event_ring.d.ts +36 -38
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +13 -7
- package/dist/core/store/extend.d.ts +13 -7
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +2 -2
- package/dist/core/store/grow.d.ts +2 -2
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +31 -27
- package/dist/core/store/header.d.ts +31 -27
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/index.d.cts +10 -10
- package/dist/core/store/index.d.ts +10 -10
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +71 -62
- package/dist/core/store/layout_ops.d.ts +71 -62
- package/dist/core/store/layout_ops.d.ts.map +1 -1
- package/dist/core/store/region_table.d.cts +28 -21
- package/dist/core/store/region_table.d.ts +28 -21
- package/dist/core/store/region_table.d.ts.map +1 -1
- package/dist/core/store/snapshot.d.cts +31 -16
- package/dist/core/store/snapshot.d.ts +31 -16
- package/dist/core/store/snapshot.d.ts.map +1 -1
- package/dist/core/store/state_hash.d.cts +12 -12
- package/dist/core/store/state_hash.d.ts +12 -12
- package/dist/core/store/state_hash.d.ts.map +1 -1
- package/dist/core/store/store_regions.d.cts +10 -10
- package/dist/core/store/store_regions.d.ts +10 -10
- package/dist/core/store/store_regions.d.ts.map +1 -1
- package/dist/core/store/vendored_abi/abi.d.cts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts +27 -2
- package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
- package/dist/host_commands-B2KMx8O2.cjs +1 -0
- package/dist/host_commands-ClVPvhSa.cjs +2 -0
- package/dist/host_commands-CwxVQS1z.js +1524 -0
- package/dist/host_commands-nJvTy88E.js +1667 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +5804 -5203
- package/dist/index.js +5323 -4764
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.cts +5 -2
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.development.cjs +1 -1
- package/dist/internal.development.js +70 -20
- package/dist/internal.js +138 -83
- package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
- package/dist/plugins/abi-NP8pNxpd.js +42 -0
- package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
- package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
- package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
- package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
- package/dist/{extensions → plugins}/editor/editor.d.cts +54 -54
- package/dist/{extensions → plugins}/editor/editor.d.ts +54 -54
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +12 -12
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +12 -12
- package/dist/plugins/editor/field_handle.d.ts.map +1 -0
- package/dist/plugins/editor/index.d.cts +22 -0
- package/dist/plugins/editor/index.d.ts +22 -0
- package/dist/plugins/editor/index.d.ts.map +1 -0
- package/dist/plugins/editor.cjs +1 -0
- package/dist/plugins/editor.d.cts +1 -0
- package/dist/plugins/editor.d.ts +1 -0
- package/dist/plugins/editor.development.cjs +1 -0
- package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +81 -64
- package/dist/{extensions/editor/index.js → plugins/editor.js} +81 -64
- package/dist/plugins/events/event_channel.d.cts +13 -0
- package/dist/plugins/events/event_channel.d.ts +13 -0
- package/dist/plugins/events/event_channel.d.ts.map +1 -0
- package/dist/plugins/events/event_registry.d.cts +22 -0
- package/dist/plugins/events/event_registry.d.ts +22 -0
- package/dist/plugins/events/event_registry.d.ts.map +1 -0
- package/dist/plugins/events/facade.d.cts +26 -0
- package/dist/plugins/events/facade.d.ts +26 -0
- package/dist/plugins/events/facade.d.ts.map +1 -0
- package/dist/plugins/events/index.d.cts +10 -0
- package/dist/plugins/events/index.d.ts +10 -0
- package/dist/plugins/events/index.d.ts.map +1 -0
- package/dist/plugins/events.cjs +1 -0
- package/dist/plugins/events.d.cts +1 -0
- package/dist/plugins/events.d.ts +1 -0
- package/dist/plugins/events.development.cjs +1 -0
- package/dist/plugins/events.development.js +174 -0
- package/dist/plugins/events.js +159 -0
- package/dist/plugins/observers/index.d.cts +23 -0
- package/dist/plugins/observers/index.d.ts +23 -0
- package/dist/plugins/observers/index.d.ts.map +1 -0
- package/dist/plugins/observers/observer_registry.d.cts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts +101 -0
- package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
- package/dist/plugins/observers.cjs +1 -0
- package/dist/plugins/observers.d.cts +1 -0
- package/dist/plugins/observers.d.ts +1 -0
- package/dist/plugins/observers.development.cjs +1 -0
- package/dist/plugins/observers.development.js +431 -0
- package/dist/plugins/observers.js +403 -0
- package/dist/plugins/relation_store-BsoegrZh.js +313 -0
- package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
- package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
- package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
- package/dist/plugins/relations/builtin_relations.d.cts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts +48 -0
- package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
- package/dist/plugins/relations/facade.d.cts +73 -0
- package/dist/plugins/relations/facade.d.ts +73 -0
- package/dist/plugins/relations/facade.d.ts.map +1 -0
- package/dist/plugins/relations/index.d.cts +11 -0
- package/dist/plugins/relations/index.d.ts +11 -0
- package/dist/plugins/relations/index.d.ts.map +1 -0
- package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +85 -97
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +85 -97
- package/dist/plugins/relations/relation_service.d.ts.map +1 -0
- package/dist/plugins/relations/relation_store.d.cts +177 -0
- package/dist/plugins/relations/relation_store.d.ts +177 -0
- package/dist/plugins/relations/relation_store.d.ts.map +1 -0
- package/dist/plugins/relations.cjs +1 -0
- package/dist/plugins/relations.d.cts +1 -0
- package/dist/plugins/relations.d.ts +1 -0
- package/dist/plugins/relations.development.cjs +1 -0
- package/dist/plugins/relations.development.js +603 -0
- package/dist/plugins/relations.js +553 -0
- package/dist/plugins/snapshots/index.d.cts +33 -0
- package/dist/plugins/snapshots/index.d.ts +33 -0
- package/dist/plugins/snapshots/index.d.ts.map +1 -0
- package/dist/plugins/snapshots/resume.d.cts +57 -0
- package/dist/plugins/snapshots/resume.d.ts +57 -0
- package/dist/plugins/snapshots/resume.d.ts.map +1 -0
- package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
- package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
- package/dist/plugins/snapshots.cjs +1 -0
- package/dist/plugins/snapshots.d.cts +1 -0
- package/dist/plugins/snapshots.d.ts +1 -0
- package/dist/plugins/snapshots.development.cjs +1 -0
- package/dist/plugins/snapshots.development.js +737 -0
- package/dist/plugins/snapshots.js +737 -0
- package/dist/plugins/solid/index.d.cts +8 -0
- package/dist/plugins/solid/index.d.ts +8 -0
- package/dist/plugins/solid/index.d.ts.map +1 -0
- package/dist/plugins/solid/solid.d.cts +97 -0
- package/dist/plugins/solid/solid.d.ts +97 -0
- package/dist/plugins/solid/solid.d.ts.map +1 -0
- package/dist/plugins/solid.cjs +1 -0
- package/dist/plugins/solid.d.cts +1 -0
- package/dist/plugins/solid.d.ts +1 -0
- package/dist/plugins/solid.development.cjs +1 -0
- package/dist/plugins/solid.development.js +319 -0
- package/dist/plugins/solid.js +319 -0
- package/dist/plugins/workers/index.d.cts +75 -0
- package/dist/plugins/workers/index.d.ts +75 -0
- package/dist/plugins/workers/index.d.ts.map +1 -0
- package/dist/plugins/workers/node_threads.d.cts +25 -0
- package/dist/plugins/workers/node_threads.d.ts +25 -0
- package/dist/plugins/workers/node_threads.d.ts.map +1 -0
- package/dist/plugins/workers/plan.d.cts +61 -0
- package/dist/plugins/workers/plan.d.ts +61 -0
- package/dist/plugins/workers/plan.d.ts.map +1 -0
- package/dist/plugins/workers/pool.d.cts +144 -0
- package/dist/plugins/workers/pool.d.ts +144 -0
- package/dist/plugins/workers/pool.d.ts.map +1 -0
- package/dist/plugins/workers/protocol.d.cts +112 -0
- package/dist/plugins/workers/protocol.d.ts +112 -0
- package/dist/plugins/workers/protocol.d.ts.map +1 -0
- package/dist/plugins/workers/worker_bind.d.cts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts +64 -0
- package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
- package/dist/plugins/workers/worker_loop.d.cts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts +14 -0
- package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
- package/dist/plugins/workers.cjs +1 -0
- package/dist/plugins/workers.d.cts +1 -0
- package/dist/plugins/workers.d.ts +1 -0
- package/dist/plugins/workers.development.cjs +1 -0
- package/dist/plugins/workers.development.js +596 -0
- package/dist/plugins/workers.js +474 -0
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.d.cts +4 -4
- package/dist/primitives.d.ts +4 -4
- package/dist/primitives.development.cjs +1 -1
- package/dist/primitives.development.js +66 -22
- package/dist/primitives.js +66 -22
- package/dist/shared-BKl12xF1.js +132 -0
- package/dist/shared-Dk-pACZT.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +7 -7
- package/dist/shared.d.ts +7 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.development.cjs +1 -1
- package/dist/shared.development.js +4 -3
- package/dist/shared.js +4 -3
- package/dist/topological_sort-Cc_yXqPT.js +346 -0
- package/dist/topological_sort-vp1imU6D.cjs +1 -0
- package/dist/type_primitives/assertions.d.cts +12 -16
- package/dist/type_primitives/assertions.d.ts +12 -16
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
- package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.cts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts +7 -11
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/brand.d.cts +2 -7
- package/dist/type_primitives/brand.d.ts +2 -7
- package/dist/type_primitives/brand.d.ts.map +1 -1
- package/dist/type_primitives/error.d.cts +1 -2
- package/dist/type_primitives/error.d.ts +1 -2
- package/dist/type_primitives/error.d.ts.map +1 -1
- package/dist/type_primitives/index.d.cts +1 -1
- package/dist/type_primitives/index.d.ts +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
- package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +16 -15
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +16 -15
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/version.d.cts +3 -3
- package/dist/version.d.ts +3 -3
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +17 -0
- package/dist/worker.d.ts +17 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.development.cjs +1 -0
- package/dist/worker.development.js +253 -0
- package/dist/worker.js +253 -0
- package/package.json +363 -191
- package/dist/core/ecs/builtin_relations.d.cts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts +0 -43
- package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
- package/dist/core/ecs/event_registry.d.cts +0 -22
- package/dist/core/ecs/event_registry.d.ts +0 -22
- package/dist/core/ecs/event_registry.d.ts.map +0 -1
- package/dist/core/ecs/relation_service.d.ts.map +0 -1
- package/dist/core/ecs/resume.d.cts +0 -85
- package/dist/core/ecs/resume.d.ts +0 -85
- package/dist/core/ecs/resume.d.ts.map +0 -1
- package/dist/core/ecs/snapshot_service.d.cts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts +0 -94
- package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
- package/dist/extensions/editor/editor.d.ts.map +0 -1
- package/dist/extensions/editor/field_handle.d.ts.map +0 -1
- package/dist/extensions/editor/index.cjs +0 -1
- package/dist/extensions/editor/index.d.cts +0 -21
- package/dist/extensions/editor/index.d.ts +0 -21
- package/dist/extensions/editor/index.d.ts.map +0 -1
- package/dist/extensions/editor/index.development.cjs +0 -1
- package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
- package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
- package/dist/extensions/reactive/index.cjs +0 -1
- package/dist/extensions/reactive/index.d.cts +0 -23
- package/dist/extensions/reactive/index.d.ts +0 -23
- package/dist/extensions/reactive/index.d.ts.map +0 -1
- package/dist/extensions/reactive/index.development.cjs +0 -1
- package/dist/extensions/reactive/index.development.js +0 -215
- package/dist/extensions/reactive/index.js +0 -215
- package/dist/extensions/solid/index.cjs +0 -1
- package/dist/extensions/solid/index.d.cts +0 -6
- package/dist/extensions/solid/index.d.ts +0 -6
- package/dist/extensions/solid/index.d.ts.map +0 -1
- package/dist/extensions/solid/index.development.cjs +0 -1
- package/dist/extensions/solid/index.development.js +0 -40
- package/dist/extensions/solid/index.js +0 -36
- package/dist/extensions/solid/kernel_solid.d.cts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts +0 -45
- package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
- package/dist/host_commands-BlR3oZ3x.js +0 -2406
- package/dist/host_commands-C2cpU3yC.cjs +0 -1
- package/dist/internal-BoxWl4dG.js +0 -2565
- package/dist/internal-CGBEwfeB.cjs +0 -2
- package/dist/interop-CT-REx0W.cjs +0 -1
- package/dist/interop-CcY6ASQc.js +0 -18
- package/dist/interop-DqxleBo7.js +0 -18
- package/dist/interop-T1HZ-Dpa.cjs +0 -1
- package/dist/kernel-Cz2Kxlwl.js +0 -240
- package/dist/kernel-DgyrLFjW.js +0 -227
- package/dist/kernel-sw7ScKWu.cjs +0 -1
- package/dist/kernel-yWV3XnAb.cjs +0 -1
- package/dist/reactive/array.d.cts +0 -24
- package/dist/reactive/array.d.ts +0 -24
- package/dist/reactive/array.d.ts.map +0 -1
- package/dist/reactive/index.cjs +0 -1
- package/dist/reactive/index.d.cts +0 -11
- package/dist/reactive/index.d.ts +0 -11
- package/dist/reactive/index.d.ts.map +0 -1
- package/dist/reactive/index.development.cjs +0 -1
- package/dist/reactive/index.development.js +0 -18
- package/dist/reactive/index.js +0 -18
- package/dist/reactive/interop.d.cts +0 -19
- package/dist/reactive/interop.d.ts +0 -19
- package/dist/reactive/interop.d.ts.map +0 -1
- package/dist/reactive/kernel.d.cts +0 -73
- package/dist/reactive/kernel.d.ts +0 -73
- package/dist/reactive/kernel.d.ts.map +0 -1
- package/dist/reactive/map.d.cts +0 -16
- package/dist/reactive/map.d.ts +0 -16
- package/dist/reactive/map.d.ts.map +0 -1
- package/dist/reactive/shallow.d.cts +0 -11
- package/dist/reactive/shallow.d.ts +0 -11
- package/dist/reactive/shallow.d.ts.map +0 -1
- package/dist/reactive/struct.d.cts +0 -10
- package/dist/reactive/struct.d.ts +0 -10
- package/dist/reactive/struct.d.ts.map +0 -1
- package/dist/shallow-Bs39EPh1.js +0 -150
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-CiFC70Dz.js +0 -159
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shared-B4v0L1cw.js +0 -109
- package/dist/shared-DU78k0pU.cjs +0 -1
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
- package/dist/typed_arrays-DIVwVy5_.js +0 -258
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const P=require("./shared-DU78k0pU.cjs"),We=require("./topological_sort-BDvEyb9W.cjs");class ze extends Error{constructor(e,n,r){super(e),this.isOperational=n,this.context=r,this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}}var Se=(t=>(t.ASSERTION_FAIL_CONDITION="ASSERTION_FAIL_CONDITION",t.VALIDATION_FAIL_CONDITION="VALIDATION_FAIL_CONDITION",t.ASSERTION_FAIL_NON_NULLABLE="ASSERTION_FAIL_NON_NULLABLE",t.ASSERTION_FAIL_UNREACHABLE="ASSERTION_FAIL_UNREACHABLE",t))(Se||{});class qe extends ze{constructor(e,n,r){super(n,!1,r),this.category=e}}const Et=t=>Number.isInteger(t)&&t>=0;function mt(t,e,n){if(!e(t))throw new qe(Se.VALIDATION_FAIL_CONDITION,`Expected value to meet validation: ${n}`);return t}function gt(t){return t}function pt(t,e){throw new qe(Se.ASSERTION_FAIL_UNREACHABLE,`Unhandled ${e}: ${String(t)}`)}var T=(t=>(t.EID_MAX_INDEX_OVERFLOW="EID_MAX_INDEX_OVERFLOW",t.EID_MAX_GEN_OVERFLOW="EID_MAX_GEN_OVERFLOW",t.COMPONENT_NOT_REGISTERED="COMPONENT_NOT_REGISTERED",t.COMPONENT_LIMIT_EXCEEDED="COMPONENT_LIMIT_EXCEEDED",t.ENTITY_NOT_ALIVE="ENTITY_NOT_ALIVE",t.CIRCULAR_SYSTEM_DEPENDENCY="CIRCULAR_SYSTEM_DEPENDENCY",t.DUPLICATE_SYSTEM="DUPLICATE_SYSTEM",t.ARCHETYPE_NOT_FOUND="ARCHETYPE_NOT_FOUND",t.RESOURCE_NOT_REGISTERED="RESOURCE_NOT_REGISTERED",t.RESOURCE_ALREADY_REGISTERED="RESOURCE_ALREADY_REGISTERED",t.EVENT_ALREADY_REGISTERED="EVENT_ALREADY_REGISTERED",t.EVENT_NOT_REGISTERED="EVENT_NOT_REGISTERED",t.FIELD_NOT_REGISTERED="FIELD_NOT_REGISTERED",t.RELATION_NOT_REGISTERED="RELATION_NOT_REGISTERED",t.RELATION_MODE_INVALID="RELATION_MODE_INVALID",t.RELATION_MODE_MISMATCH="RELATION_MODE_MISMATCH",t.RELATION_CYCLE="RELATION_CYCLE",t.SPARSE_CACHE_KEY_OVERFLOW="SPARSE_CACHE_KEY_OVERFLOW",t.SPARSE_QUERY_DENSE_PATH="SPARSE_QUERY_DENSE_PATH",t.HIERARCHY_ALREADY_SET="HIERARCHY_ALREADY_SET",t.HIERARCHY_INVALID_MAX_DEPTH="HIERARCHY_INVALID_MAX_DEPTH",t.OBSERVER_NON_CONVERGENT="OBSERVER_NON_CONVERGENT",t.OBSERVER_INVALID_CONFIG="OBSERVER_INVALID_CONFIG",t.OBSERVER_ONSET_EMIT="OBSERVER_ONSET_EMIT",t.INVALID_FIXED_TIMESTEP="INVALID_FIXED_TIMESTEP",t.INVALID_MAX_FIXED_STEPS="INVALID_MAX_FIXED_STEPS",t.INVALID_RECORDER_SCHEDULE="INVALID_RECORDER_SCHEDULE",t.EMPTY_ARCHETYPE_MATERIALIZE="EMPTY_ARCHETYPE_MATERIALIZE",t.COMPONENT_INDEX_INVARIANT="COMPONENT_INDEX_INVARIANT",t.ARCHETYPE_ROW_INVARIANT="ARCHETYPE_ROW_INVARIANT",t.OPTIONAL_TERM_NOT_DECLARED="OPTIONAL_TERM_NOT_DECLARED",t.QUERY_ACCESS_UNDECLARED="QUERY_ACCESS_UNDECLARED",t.ACCESS_UNDECLARED="ACCESS_UNDECLARED",t.QUERY_NOT_SINGLETON="QUERY_NOT_SINGLETON",t.INVALID_RUN_CONDITION="INVALID_RUN_CONDITION",t.SYSTEM_FN_ARITY="SYSTEM_FN_ARITY",t.PARTITION_APPEND_NEEDS_ENTITY_ROW="PARTITION_APPEND_NEEDS_ENTITY_ROW",t.PARTITION_BULK_INTO_DISABLED="PARTITION_BULK_INTO_DISABLED",t.ENTITY_NOT_DISABLED="ENTITY_NOT_DISABLED",t.STRUCTURAL_DURING_ITERATION="STRUCTURAL_DURING_ITERATION",t.BACKEND_ALREADY_ATTACHED="BACKEND_ALREADY_ATTACHED",t.DETERMINISM_DISABLED="DETERMINISM_DISABLED",t.NON_DETERMINISTIC_COLUMN_TYPE="NON_DETERMINISTIC_COLUMN_TYPE",t.INVALID_MEMORY_OPTIONS="INVALID_MEMORY_OPTIONS",t.STORE_CAP_EXCEEDED="STORE_CAP_EXCEEDED",t.REGION_NOT_DECLARED="REGION_NOT_DECLARED",t.COMMAND_LOG_TAG_COLLISION="COMMAND_LOG_TAG_COLLISION",t.INVALID_FRAME_STEP="INVALID_FRAME_STEP",t))(T||{});class A extends ze{constructor(e,n,r){super(n??e,!0,r),this.category=e}}function Tt(t){return t instanceof A}const At=-1,yt=-1,It=Object.freeze(Object.create(null)),St=2654435769,Rt=1367130551,F=1024,Nt=0,wt=31,Dt=1/60,Ot=4,Ct=0,W=20,Re=(1<<W)-1,U=Re,bt=wt-W,J=(1<<bt)-1,vt=J,Lt=J-1,ge=J<<W|U,Ut=(t,e)=>{{if(t<0||t>U)throw new A(T.EID_MAX_INDEX_OVERFLOW);if(e<0||e>J)throw new A(T.EID_MAX_GEN_OVERFLOW)}return e<<W|t},L=t=>t&Re,pe=t=>t>>W,Mt=(t,e,n)=>new A(T.ENTITY_NOT_ALIVE,`${t}: entity ${e} (index ${L(e)}, generation ${pe(e)}) is not alive${n?` — ${n}`:""} (destroyed, never created, or a stale handle; guard with isAlive() first)`,{entity:e,index:L(e),generation:pe(e),op:t}),Ne=new WeakMap;function Pt(t,e){Ne.set(t,e)}function $t(t){return Ne.get(t)}function Ke(t){const e=Ne.get(t);return e!==void 0?`'${e}' (component ${t.id})`:`component ${t.id}`}const je=827148627,Qe=0,Q=4,Ze=52,E={magic:0,sim_abi_version:4,view_stamp:8,capacity:12,archetype_count:16,layout_descriptor_off:20,command_ring_off:24,action_ring_off:28,entity_index_off:32,event_ring_off:36,region_table_off:40,region_table_count:44,bindings_off:48},ee=12,$={region_id:0,byte_offset:4,byte_length:8},ce=16,O={component_id:0,field_id:2,type_tag:4,byte_off:8,stride:12},le=36,N={archetype_id:0,component_mask:4,row_count:20,row_capacity:24,column_count:28,enabled_count:32};function Bt(t,e){t.setUint32(E.magic,e.magic,!0),t.setUint32(E.sim_abi_version,e.simAbiVersion,!0),t.setUint32(E.view_stamp,e.viewStamp,!0),t.setUint32(E.capacity,e.capacity,!0),t.setUint32(E.archetype_count,e.archetypeCount,!0),t.setUint32(E.layout_descriptor_off,e.layoutDescriptorOff,!0),t.setUint32(E.command_ring_off,e.commandRingOff,!0),t.setUint32(E.action_ring_off,e.actionRingOff,!0),t.setUint32(E.entity_index_off,e.entityIndexOff,!0),t.setUint32(E.event_ring_off,e.eventRingOff,!0),t.setUint32(E.region_table_off,e.regionTableOff,!0),t.setUint32(E.region_table_count,e.regionTableCount,!0),t.setUint32(E.bindings_off,e.bindingsOff,!0)}function Ft(t){return{magic:t.getUint32(E.magic,!0),simAbiVersion:t.getUint32(E.sim_abi_version,!0),viewStamp:t.getUint32(E.view_stamp,!0),capacity:t.getUint32(E.capacity,!0),archetypeCount:t.getUint32(E.archetype_count,!0),layoutDescriptorOff:t.getUint32(E.layout_descriptor_off,!0),commandRingOff:t.getUint32(E.command_ring_off,!0),actionRingOff:t.getUint32(E.action_ring_off,!0),entityIndexOff:t.getUint32(E.entity_index_off,!0),eventRingOff:t.getUint32(E.event_ring_off,!0),regionTableOff:t.getUint32(E.region_table_off,!0),regionTableCount:t.getUint32(E.region_table_count,!0),bindingsOff:t.getUint32(E.bindings_off,!0)}}const g={u8:0,i8:1,u16:2,i16:3,u32:4,i32:5,f32:6,f64:7},Te=Object.freeze({[g.u8]:1,[g.i8]:1,[g.u16]:2,[g.i16]:2,[g.u32]:4,[g.i32]:4,[g.f32]:4,[g.f64]:8}),xt={u8:g.u8,i8:g.i8,u16:g.u16,i16:g.i16,u32:g.u32,i32:g.i32,f32:g.f32,f64:g.f64};function Yt(t,e,n){t.setUint16(e+O.component_id,n.componentId,!0),t.setUint16(e+O.field_id,n.fieldId,!0),t.setUint8(e+O.type_tag,n.typeTag),t.setUint32(e+O.byte_off,n.byteOff,!0),t.setUint16(e+O.stride,n.stride,!0)}function kt(t,e){return{componentId:t.getUint16(e+O.component_id,!0),fieldId:t.getUint16(e+O.field_id,!0),typeTag:t.getUint8(e+O.type_tag),byteOff:t.getUint32(e+O.byte_off,!0),stride:t.getUint16(e+O.stride,!0)}}const Ht=Q*32;function we(t){return le+t*ce}function Je(t,e,n){t.setUint32(e+N.archetype_id,n.archetypeId,!0);for(let s=0;s<Q;s++)t.setUint32(e+N.component_mask+s*4,n.componentMask[s]??0,!0);t.setUint32(e+N.row_count,n.rowCount,!0),t.setUint32(e+N.row_capacity,n.rowCapacity,!0),t.setUint32(e+N.column_count,n.columns.length,!0),t.setUint32(e+N.enabled_count,n.enabledCount,!0);let r=e+le;for(let s=0;s<n.columns.length;s++)Yt(t,r,n.columns[s]),r+=ce;return r}function Gt(t,e){const n=t.getUint32(e+N.column_count,!0),r=new Array(n);let s=e+le;for(let i=0;i<n;i++)r[i]=kt(t,s),s+=ce;const o=new Array(Q);for(let i=0;i<Q;i++)o[i]=t.getUint32(e+N.component_mask+i*4,!0);return{archetypeId:t.getUint32(e+N.archetype_id,!0),componentMask:o,rowCount:t.getUint32(e+N.row_count,!0),rowCapacity:t.getUint32(e+N.row_capacity,!0),enabledCount:t.getUint32(e+N.enabled_count,!0),columns:r}}function Vt(t,e,n){let r=e;for(let s=0;s<n.length;s++)r=Je(t,r,n[s]);return r}function Xt(t,e,n){const r=new Array(n);let s=e;for(let o=0;o<n;o++){const i=Gt(t,s);r[o]=i,s+=we(i.columns.length)}return r}function Wt(t){let e=0;for(let n=0;n<t.length;n++)e+=we(t[n].columns.length);return e}const et=16,x=16,zt=256,C={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},De=0;function $e(t){return et+t*x}function qt(t){return t>0&&(t&t-1)===0}class M extends Error{constructor(e){super(e),this.name="CommandRingError"}}function Kt(t,e,n){if(!qt(n))throw new M(`command ring capacity_slots must be a positive power of two (got ${n})`);t.setUint32(e+C.write_head,0,!0),t.setUint32(e+C.read_head,0,!0),t.setUint32(e+C.capacity_slots,n,!0),t.setUint32(e+C.overflow_flag,0,!0)}function jt(t,e){return t.getUint32(e+C.write_head,!0)}function Qt(t,e){return t.getUint32(e+C.read_head,!0)}function Zt(t,e){return t.getUint32(e+C.capacity_slots,!0)}function Jt(t,e,n){if(n.byteLength!==x-1)throw new M(`outPayload must be ${x-1} bytes (got ${n.byteLength})`);const r=jt(t,e),s=Qt(t,e);if(r===s)return De;const o=Zt(t,e),i=s&o-1,a=e+et+i*x,c=t.getUint8(a),l=new Uint8Array(t.buffer,a+1,x-1);return n.set(l),t.setUint32(e+C.read_head,s+1>>>0,!0),c}function en(t,e,n){let r=0;const s=new Uint8Array(x-1);for(;;){const o=Jt(t,e,s);if(o===De)return r;n(o,s.slice()),r++}}const te=16,w=12,Z={length:0,capacity:4},v=1<<20;function Be(t){if(t<0||!Number.isInteger(t))throw new tt(`entity index capacity must be a non-negative integer (got ${t})`);return te+t*w}function tn(t){return t+te}function nn(t,e){return t+te+e*4}function sn(t,e){return t+te+e*8}class tt extends Error{constructor(e){super(e),this.name="EntityIndexError"}}function rn(t,e,n){if(n<0||!Number.isInteger(n))throw new tt(`entity index capacity must be a non-negative integer (got ${n})`);t.setUint32(e+Z.length,0,!0),t.setUint32(e+Z.capacity,n,!0)}function on(t,e,n){return{generations:new Int32Array(t,tn(e),n),archetypes:new Int32Array(t,nn(e,n),n),rows:new Int32Array(t,sn(e,n),n)}}const an=16,cn=16,ln=256,G={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12};function Fe(t){return an+t*cn}function dn(t){return t>0&&(t&t-1)===0}class un extends Error{constructor(e){super(e),this.name="EventRingError"}}function fn(t,e,n){if(!dn(n))throw new un(`event ring capacity_slots must be a positive power of two (got ${n})`);t.setUint32(e+G.write_head,0,!0),t.setUint32(e+G.read_head,0,!0),t.setUint32(e+G.capacity_slots,n,!0),t.setUint32(e+G.overflow_flag,0,!0)}const _n=16,hn=16,En=256,V={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},mn=V.write_head/4,gn=V.read_head/4,pn=V.capacity_slots/4,Tn=V.overflow_flag/4;function An(t,e){return new Int32Array(t.buffer,t.byteOffset+e,4)}function xe(t){return _n+t*hn}function yn(t){return t>0&&(t&t-1)===0}class Ye extends Error{constructor(e){super(e),this.name="ActionRingError"}}function In(t,e,n){if(!yn(n))throw new Ye(`action ring capacity_slots must be a positive power of two (got ${n})`);if((t.byteOffset+e)%4!==0)throw new Ye(`action ring header must be 4-byte aligned for Atomics (view.byteOffset ${t.byteOffset} + ringOff ${e} is not a multiple of 4)`);const r=An(t,e);Atomics.store(r,mn,0),Atomics.store(r,gn,0),Atomics.store(r,pn,n),Atomics.store(r,Tn,0)}const q=[{name:"command_ring",headerOff:"command_ring_off",sizeFromOptions:t=>t.commandRingCapacitySlots!==void 0?$e(t.commandRingCapacitySlots):0,init:(t,e,n)=>Kt(t,e,n.commandRingCapacitySlots),regionBytes:(t,e)=>$e(t.getUint32(e+C.capacity_slots,!0)),readOptions:(t,e,n)=>{n.commandRingCapacitySlots=t.getUint32(e+C.capacity_slots,!0)}},{name:"entity_index",headerOff:"entity_index_off",sizeFromOptions:t=>t.entityIndexCapacity!==void 0?Be(t.entityIndexCapacity):0,init:(t,e,n)=>rn(t,e,n.entityIndexCapacity),regionBytes:(t,e)=>Be(t.getUint32(e+Z.capacity,!0)),readOptions:(t,e,n)=>{n.entityIndexCapacity=t.getUint32(e+Z.capacity,!0)}},{name:"event_ring",headerOff:"event_ring_off",sizeFromOptions:t=>t.eventRingCapacitySlots!==void 0?Fe(t.eventRingCapacitySlots):0,init:(t,e,n)=>fn(t,e,n.eventRingCapacitySlots),regionBytes:(t,e)=>Fe(t.getUint32(e+G.capacity_slots,!0)),readOptions:(t,e,n)=>{n.eventRingCapacitySlots=t.getUint32(e+G.capacity_slots,!0)}},{name:"action_ring",headerOff:"action_ring_off",sizeFromOptions:t=>t.actionRingCapacitySlots!==void 0?xe(t.actionRingCapacitySlots):0,init:(t,e,n)=>In(t,e,n.actionRingCapacitySlots),regionBytes:(t,e)=>xe(t.getUint32(e+V.capacity_slots,!0)),readOptions:(t,e,n)=>{n.actionRingCapacitySlots=t.getUint32(e+V.capacity_slots,!0)}}];class se extends Error{constructor(e){super(e),this.name="RegionRegistryError"}}function nt(t){return t*ee}function Oe(t,e){const n=t.getUint32(E.region_table_count,!0);if(e+nt(n)>t.byteLength)throw new se(`region table of ${n} entries at byte ${e} overruns the buffer (${t.byteLength} bytes)`);return n}function Sn(t){const e=new Set;for(let n=0;n<t.length;n++){const r=t[n];if(!Number.isInteger(r.id)||r.id<=0)throw new se(`region "${r.name}" has invalid id ${r.id} — region ids must be positive integers (0 is the absent sentinel)`);if(e.has(r.id))throw new se(`duplicate region id ${r.id} (region "${r.name}") — ids must be distinct within a consumer's region set`);if(e.add(r.id),!Number.isInteger(r.bytes)||r.bytes<=0)throw new se(`region "${r.name}" (id ${r.id}) has invalid byte size ${r.bytes} — must be a positive integer`)}}function Rn(t,e,n){t.setUint32(e+$.region_id,n.regionId,!0),t.setUint32(e+$.byte_offset,n.byteOffset,!0),t.setUint32(e+$.byte_length,n.byteLength,!0)}function st(t,e){return{regionId:t.getUint32(e+$.region_id,!0),byteOffset:t.getUint32(e+$.byte_offset,!0),byteLength:t.getUint32(e+$.byte_length,!0)}}function Nn(t,e,n){for(let r=0;r<n.length;r++)Rn(t,e+r*ee,n[r])}function wn(t,e,n){const r=new Array(n);for(let s=0;s<n;s++)r[s]=st(t,e+s*ee);return r}function Dn(t){const e=t.getUint32(E.region_table_off,!0);if(e===0)return[];const n=Oe(t,e);return wn(t,e,n)}function On(t,e){const n=t.getUint32(E.region_table_off,!0);if(n===0)return 0;const r=Oe(t,n);for(let s=0;s<r;s++){const o=n+s*ee;if(t.getUint32(o+$.region_id,!0)===e)return t.getUint32(o+$.byte_offset,!0)}return 0}function Cn(t,e){const n=t.getUint32(E.region_table_off,!0);if(n===0)return null;const r=Oe(t,n);for(let s=0;s<r;s++){const o=st(t,n+s*ee);if(o.regionId===e)return o}return null}function rt(t,e){return t<<16|e}const de=2**31;class Ce extends Error{constructor(e){super(`SAB column layout offset ${e} reaches or exceeds the 2³¹ (${de}-byte) ceiling. Past 2 GiB the signed-32-bit bitwise alignment math wraps to negative/misaligned offsets. This is a structural limit independent of the (default 256 MiB) allocator cap — a single SAB cannot back more than ~2 GiB of column data.`),this.name="StoreLayoutOverflowError"}}function be(t,e){if(t+e>de)throw new Ce(t);return t+(e-1)&~(e-1)}function bn(t,e,n,r){switch(e){case g.u8:return new Uint8Array(t,n,r);case g.i8:return new Int8Array(t,n,r);case g.u16:return new Uint16Array(t,n,r);case g.i16:return new Int16Array(t,n,r);case g.u32:return new Uint32Array(t,n,r);case g.i32:return new Int32Array(t,n,r);case g.f32:return new Float32Array(t,n,r);case g.f64:return new Float64Array(t,n,r)}}function vn(t,e,n=0){const s=Wt(t.map(a=>({archetypeId:a.archetypeId,componentMask:a.componentMask,rowCount:0,enabledCount:0,rowCapacity:a.rowCapacity,columns:a.columns.map(c=>({componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:0,stride:Te[c.typeTag]}))})))+n;let o=e+s;const i=new Array(t.length);for(let a=0;a<t.length;a++){const c=t[a],l=new Array(c.columns.length);for(let d=0;d<c.columns.length;d++){const f=c.columns[d],_=Te[f.typeTag];o=be(o,_),l[d]={componentId:f.componentId,fieldId:f.fieldId,typeTag:f.typeTag,byteOff:o,stride:_},o+=_*c.rowCapacity}i[a]={archetypeId:c.archetypeId,componentMask:c.componentMask,rowCount:0,enabledCount:0,rowCapacity:c.rowCapacity,columns:l}}if(o>de)throw new Ce(o);return{descriptors:i,totalBytes:o,regionBytes:s}}function Ln(t){const e=t;return typeof e._regionBytes=="number"&&typeof e._allocator=="function"&&typeof e._reservedDescriptorBytes=="number"}function Un(t,e=P.DEFAULT_SAB_ALLOCATOR,n={}){const r={};let s=Ze;for(let S=0;S<q.length;S++){const b=q[S],z=b.sizeFromOptions(n);r[b.headerOff]=z===0?0:s,s+=z}const o=n.regions??[];Sn(o);const i=o.length,a=i>0?s:0;s+=nt(i);const c=new Array(i);for(let S=0;S<o.length;S++){const b=o[S];c[S]={regionId:b.id,byteOffset:s,byteLength:b.bytes},s+=b.bytes}const l=n.bindingsRegionBytes??0,d=l===0?0:s;s+=l;const f=s,{descriptors:_,totalBytes:m,regionBytes:p}=vn(t,f,n.reservedDescriptorBytes??0),u=e(m),h=new DataView(u),I={magic:je,simAbiVersion:Qe,viewStamp:0,capacity:m,archetypeCount:t.length,layoutDescriptorOff:f,bindingsOff:d,regionTableOff:a,regionTableCount:i,commandRingOff:r.command_ring_off,entityIndexOff:r.entity_index_off,eventRingOff:r.event_ring_off,actionRingOff:r.action_ring_off};Bt(h,I),l>0&&new Uint8Array(u,d,l).fill(0);for(let S=0;S<q.length;S++){const b=q[S],z=r[b.headerOff];z!==0&&b.init(h,z,n)}a!==0&&Nn(h,a,c);for(let S=0;S<o.length;S++)o[S].init(h,c[S].byteOffset);Vt(h,f,_);const Y=ot(u,_);return{buffer:u,view:h,header:I,archetypes:Y,_regionBytes:p,_allocator:e,_reservedDescriptorBytes:n.reservedDescriptorBytes??0}}function ot(t,e){const n=new Map;for(let r=0;r<e.length;r++){const s=e[r],o=new Array(s.columns.length),i=new Map;for(let a=0;a<s.columns.length;a++){const c=s.columns[a],l={componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:c.byteOff,stride:c.stride,view:bn(t,c.typeTag,c.byteOff,s.rowCapacity)};o[a]=l,i.set(rt(c.componentId,c.fieldId),l)}n.set(s.archetypeId,{archetypeId:s.archetypeId,componentMask:s.componentMask,rowCapacity:s.rowCapacity,columns:i,columnsInOrder:o})}return n}const it=2166136261,ve=16777619;function _e(t,e){return t=(t^e&255)>>>0,Math.imul(t,ve)>>>0}function Mn(t,e){return t=(t^e>>>0)>>>0,Math.imul(t,ve)>>>0}class Pn{_data=new We.SparseMap;fieldNames;fieldTypes;fieldIndex;constructor(e,n){this.fieldNames=e,this.fieldTypes=n;const r=Object.create(null);for(let s=0;s<e.length;s++)r[e[s]]=s;this.fieldIndex=r}get size(){return this._data.size}get indices(){return this._data.keys}canonicalIndices(){return this._data.keys.slice().sort((e,n)=>e-n)}getRow(e){return this._data.get(e)}clear(){this._data.clear()}setRawRow(e,n){this._data.set(e,n)}has(e){return this._data.has(e)}setRow(e,n){const r=this.fieldNames,s=new Array(r.length);for(let o=0;o<r.length;o++){const i=n[r[o]];s[o]=i===void 0?0:i}this._data.set(e,s)}remove(e){return this._data.delete(e)}getField(e,n){const r=this._data.get(e);return r===void 0?void 0:r[n]}setField(e,n,r){const s=this._data.get(e);return s===void 0?!1:(s[n]=r,!0)}}class y extends Error{constructor(e){super(e),this.name="SparseRestoreError"}}const Le=12,Ue=4,X=8;function Me(t,e){let n=it;const r=s=>{for(let o=0;o<s.length;o++)n=_e(n,s.charCodeAt(o))};for(let s=0;s<t.length;s++)r(t[s]),n=_e(n,31),r(e[s]),n=_e(n,30);return n>>>0}function $n(t){let e=4;for(let o=0;o<t.length;o++){const i=t[o],a=i.fieldNames.length;e+=Le+i.size*(Ue+a*X)}const n=new Uint8Array(e),r=new DataView(n.buffer);let s=0;r.setUint32(s,t.length,!0),s+=4;for(let o=0;o<t.length;o++){const i=t[o],a=i.fieldNames.length,c=i.canonicalIndices();r.setUint32(s,a,!0),s+=4,r.setUint32(s,Me(i.fieldNames,i.fieldTypes),!0),s+=4,r.setUint32(s,c.length,!0),s+=4;for(let l=0;l<c.length;l++){const d=c[l];r.setUint32(s,d,!0),s+=4;const f=i.getRow(d);for(let _=0;_<a;_++)r.setFloat64(s,f[_],!0),s+=X}}return n}function Bn(t,e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=e.byteLength;let s=0;const o=a=>{if(s+a>r)throw new y(`sparse snapshot truncated: need ${a} more bytes at offset ${s}, have ${r-s}`)};o(4);const i=n.getUint32(s,!0);if(s+=4,i!==t.length)throw new y(`sparse store count mismatch: snapshot=${i}, registered=${t.length}`);for(let a=0;a<t.length;a++){const c=t[a];o(Le);const l=n.getUint32(s,!0);s+=4;const d=n.getUint32(s,!0);s+=4;const f=n.getUint32(s,!0);if(s+=4,l!==c.fieldNames.length)throw new y(`sparse store ${a} field-count mismatch: snapshot=${l}, registered=${c.fieldNames.length}`);const _=Me(c.fieldNames,c.fieldTypes);if(d!==_)throw new y(`sparse store ${a} schema identity mismatch: snapshot hash=${d}, registered=${_} (same field count, different field names/types — likely a registration-order divergence between the snapshot and restore worlds)`);c.clear();for(let m=0;m<f;m++){o(Ue+l*X);const p=n.getUint32(s,!0);if(s+=4,p>U)throw new y(`sparse store ${a} member ${m} entity index ${p} exceeds MAX_INDEX (${U})`);const u=new Array(l);for(let h=0;h<l;h++)u[h]=n.getFloat64(s,!0),s+=X;c.setRawRow(p,u)}}if(s!==r)throw new y(`sparse snapshot has ${r-s} trailing bytes after the last store (not a canonical encoding)`)}function Fn(t,e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=e.byteLength;let s=0;const o=a=>{if(s+a>r)throw new y(`sparse snapshot truncated: need ${a} more bytes at offset ${s}, have ${r-s}`)};o(4);const i=n.getUint32(s,!0);if(s+=4,i!==t.length)throw new y(`sparse store count mismatch: snapshot=${i}, registered=${t.length}`);for(let a=0;a<t.length;a++){const c=t[a];o(Le);const l=n.getUint32(s,!0);s+=4;const d=n.getUint32(s,!0);s+=4;const f=n.getUint32(s,!0);if(s+=4,l!==c.fieldNames.length)throw new y(`sparse store ${a} field-count mismatch: snapshot=${l}, registered=${c.fieldNames.length}`);const _=Me(c.fieldNames,c.fieldTypes);if(d!==_)throw new y(`sparse store ${a} schema identity mismatch: snapshot hash=${d}, registered=${_} (same field count, different field names/types — likely a registration-order divergence between the snapshot and restore worlds)`);for(let m=0;m<f;m++){o(Ue+l*X);const p=n.getUint32(s,!0);if(s+=4,p>U)throw new y(`sparse store ${a} member ${m} entity index ${p} exceeds MAX_INDEX (${U})`);s+=l*X}}if(s!==r)throw new y(`sparse snapshot has ${r-s} trailing bytes after the last store (not a canonical encoding)`)}const Ae=2147483647,xn="orphan",at="target",Yn=Object.freeze({});class ct{exclusive;sparse;onDeleteTarget;_store;_reverse=new Map;constructor(e,n,r,s){this.exclusive=e,this.sparse=n,this._store=r,this.onDeleteTarget=s}linkReverse(e,n){let r=this._reverse.get(e);r===void 0&&(r=new Set,this._reverse.set(e,r)),r.add(n)}unlinkReverse(e,n){const r=this._reverse.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._reverse.delete(e))}pruneDeadReverse(e){let n=0;for(const r of this._reverse.keys())e(r)||(this._reverse.delete(r),n++);return n}sourcesOf(e){const n=this._reverse.get(e);if(n===void 0||n.size===0)return[];const r=new Array(n.size);let s=0;return n.forEach(o=>{r[s++]=o}),r.sort((o,i)=>o-i),r}resetIndices(){this._reverse.clear(),this._resetForward()}}class kn extends ct{constructor(e,n,r){super(!0,e,n,r)}_resetForward(){}link(e,n){const r=L(e),s=this._store.getField(r,0);if(s!==void 0){if(s===n)return;this.unlinkReverse(s,e)}this._store.setRow(r,{[at]:n}),this.linkReverse(n,e)}unlink(e,n){const r=L(e),s=this._store.getField(r,0);s!==void 0&&(n!==void 0&&s!==n||(this.unlinkReverse(s,e),this._store.remove(r)))}purgeSource(e){const n=L(e),r=this._store.getField(n,0);r!==void 0&&this.unlinkReverse(r,e)}singleTarget(e){const n=this._store.getField(e,0);return n===void 0?void 0:n}targetsOf(e){const n=this._store.getField(e,0);return n===void 0?[]:[n]}has(e){return this._store.has(e)}forEachCanonicalTargetSet(e){}forEachCanonicalPair(e,n){const r=this._store.canonicalIndices();for(let s=0;s<r.length;s++){const o=r[s];n(e(o),this._store.getField(o,0))}}rebuildReverseFromForward(e){const n=this._store.indices;for(let r=0;r<n.length;r++){const s=n[r];this.linkReverse(this._store.getField(s,0),e(s))}}restoreAddTarget(){throw new y("exclusive relation has no multi forward sources to restore (snapshot header should have guarded this)")}}class Hn extends ct{_forward=new Map;constructor(e,n,r){super(!1,e,n,r)}_resetForward(){this._forward.clear()}link(e,n){const r=L(e);let s=this._forward.get(r);s===void 0&&(s=new Set,this._forward.set(r,s),this._store.setRow(r,Yn)),s.add(n),this.linkReverse(n,e)}unlink(e,n){const r=L(e),s=this._forward.get(r);if(s!==void 0){if(n===void 0){this._forward.delete(r),s.forEach(o=>this.unlinkReverse(o,e)),this._store.remove(r);return}s.has(n)&&(s.delete(n),this.unlinkReverse(n,e),s.size===0&&(this._forward.delete(r),this._store.remove(r)))}}purgeSource(e){const n=L(e),r=this._forward.get(n);r!==void 0&&(this._forward.delete(n),r.forEach(s=>this.unlinkReverse(s,e)))}singleTarget(){}targetsOf(e){const n=this._forward.get(e);if(n===void 0||n.size===0)return[];const r=new Array(n.size);let s=0;return n.forEach(o=>{r[s++]=o}),r.sort((o,i)=>o-i),r}has(e){return this._store.has(e)}forEachCanonicalTargetSet(e){const n=Array.from(this._forward.keys()).sort((r,s)=>r-s);for(let r=0;r<n.length;r++){const s=this.targetsOf(n[r]);s.length!==0&&e(n[r],s)}}forEachCanonicalPair(e,n){this.forEachCanonicalTargetSet((r,s)=>{const o=e(r);for(let i=0;i<s.length;i++)n(o,s[i])})}rebuildReverseFromForward(){}restoreAddTarget(e,n,r){let s=this._forward.get(e);s===void 0&&(s=new Set,this._forward.set(e,s)),s.add(n),this.linkReverse(n,r)}}function Gn(t,e,n,r){return t?new kn(e,n,r):new Hn(e,n,r)}const lt=4,dt=4,ut=8,re=8;function Vn(t){const e=new Array(t.length);let n=4;for(let i=0;i<t.length;i++){n+=lt;const a=t[i];if(a.exclusive){e[i]=null;continue}const c=[];a.forEachCanonicalTargetSet((l,d)=>c.push([l,d])),e[i]=c,n+=dt;for(let l=0;l<c.length;l++)n+=ut+c[l][1].length*re}const r=new Uint8Array(n),s=new DataView(r.buffer);let o=0;s.setUint32(o,t.length,!0),o+=4;for(let i=0;i<t.length;i++){s.setUint32(o,t[i].exclusive?0:1,!0),o+=4;const a=e[i];if(a!==null){s.setUint32(o,a.length,!0),o+=4;for(let c=0;c<a.length;c++){const l=a[c][0],d=a[c][1];s.setUint32(o,l,!0),o+=4,s.setUint32(o,d.length,!0),o+=4;for(let f=0;f<d.length;f++)s.setFloat64(o,d[f],!0),o+=re}}}return r}function Xn(t,e,n){const r=new DataView(e.buffer,e.byteOffset,e.byteLength),s=e.byteLength;let o=0;const i=c=>{if(o+c>s)throw new y(`relation snapshot truncated: need ${c} more bytes at offset ${o}, have ${s-o}`)};for(let c=0;c<t.length;c++)t[c].resetIndices();i(4);const a=r.getUint32(o,!0);if(o+=4,a!==t.length)throw new y(`relation count mismatch: snapshot=${a}, registered=${t.length}`);for(let c=0;c<t.length;c++){const l=t[c];i(lt);const d=r.getUint32(o,!0);if(o+=4,d===1===l.exclusive)throw new y(`relation ${c} cardinality mismatch: snapshot ${d?"multi":"exclusive"}, registered ${l.exclusive?"exclusive":"multi"}`);if(l.exclusive)continue;i(dt);const f=r.getUint32(o,!0);o+=4;for(let _=0;_<f;_++){i(ut);const m=r.getUint32(o,!0);o+=4;const p=r.getUint32(o,!0);if(o+=4,m>U)throw new y(`relation ${c} source index ${m} exceeds MAX_INDEX (${U})`);i(p*re);const u=n(m);for(let h=0;h<p;h++){const I=r.getFloat64(o,!0);o+=re;const Y=I;if(!Number.isInteger(Y)||Y<0||Y>ge)throw new y(`relation ${c} target ${Y} is not a well-formed packed EntityID (expected an integer in [0, ${ge}])`);l.restoreAddTarget(m,I,u)}}}if(o!==s)throw new y(`relation snapshot has ${s-o} trailing bytes after the last relation (not a canonical encoding)`)}const ke=new WeakMap;function Wn(t){const e=new Set,n=new Set,r=new Set,s=new Set,o=new Set,i=new Set,a=new Set,c=new Set,l=new Set,d=new Set;for(let u=0;u<t.writes.length;u++){const h=t.writes[u].id;n.add(h),e.add(h),r.add(h)}for(let u=0;u<t.reads.length;u++)e.add(t.reads[u].id);for(let u=0;u<t.spawns.length;u++){const h=t.spawns[u];for(let I=0;I<h.length;I++)r.add(h[I].id)}for(let u=0;u<t.transitions.length;u++){const h=t.transitions[u];if(h.add)for(let I=0;I<h.add.length;I++)r.add(h.add[I].id);if(h.remove)for(let I=0;I<h.remove.length;I++)s.add(h.remove[I].id)}for(let u=0;u<t.despawns.length;u++)s.add(t.despawns[u].id);for(let u=0;u<t.resourceReads.length;u++)o.add(t.resourceReads[u]);for(let u=0;u<t.resourceWrites.length;u++){const h=t.resourceWrites[u];i.add(h),o.add(h)}const f=t.sparseWrites;if(f!==void 0)for(let u=0;u<f.length;u++){const h=f[u];c.add(h),a.add(h)}const _=t.sparseReads;if(_!==void 0)for(let u=0;u<_.length;u++)a.add(_[u]);const m=t.relationWrites;if(m!==void 0)for(let u=0;u<m.length;u++){const h=m[u];d.add(h),l.add(h)}const p=t.relationReads;if(p!==void 0)for(let u=0;u<p.length;u++)l.add(p[u]);return{reads:e,writes:n,addAllowed:r,removeAllowed:s,hasDespawns:t.despawns.length>0,resourceReads:o,resourceWrites:i,sparseReads:a,sparseWrites:c,relationReads:l,relationWrites:d}}function zn(t){const e=ke.get(t);if(e!==void 0)return e;const n=Wn(t);return ke.set(t,n),n}const He=new WeakMap;function qn(t){const e=new Set,n=new Set;if(t.reads!==void 0)for(let r=0;r<t.reads.length;r++)e.add(t.reads[r].id);if(t.resourceReads!==void 0)for(let r=0;r<t.resourceReads.length;r++)n.add(t.resourceReads[r]);return{reads:e,writes:new Set,addAllowed:new Set,removeAllowed:new Set,hasDespawns:!1,resourceReads:n,resourceWrites:new Set,sparseReads:new Set,sparseWrites:new Set,relationReads:new Set,relationWrites:new Set}}function Kn(t){const e=He.get(t);if(e!==void 0)return e;const n=qn(t);return He.set(t,n),n}class jn{active=null;sets=null;activeName=null;exclusive=!1;enter(e){this.active=e,this.activeName=e.name??`system_${e.id}`,this.exclusive=e.exclusive===!0,this.sets=this.exclusive?null:zn(e)}enterCondition(e){this.active=null,this.activeName=e.name,this.sets=Kn(e)}leave(){this.active=null,this.activeName=null,this.sets=null,this.exclusive=!1}isActive(){return this.sets!==null||this.exclusive}current(){return this.active}checkRead(e){this.sets!==null&&(this.sets.reads.has(e.id)||this.failComponent("read",e,"reads"))}checkWrite(e){this.sets!==null&&(this.sets.writes.has(e.id)||this.failComponent("write",e,"writes"))}checkAdd(e){this.sets!==null&&(this.sets.addAllowed.has(e.id)||this.failComponent("addComponent",e,"spawns / transitions.add / writes"))}checkRemove(e){this.sets!==null&&(this.sets.removeAllowed.has(e.id)||this.failComponent("removeComponent",e,"despawns / transitions.remove"))}checkDestroy(){if(this.sets===null||this.sets.hasDespawns)return;const e=this.activeName;throw new A(T.ACCESS_UNDECLARED,`system '${e}' called despawn but didn't declare any despawns — declare the components this system removes via despawn in its 'despawns'`,{system:e,op:"despawn"})}checkResourceRead(e){if(this.sets===null)return;const n=e;this.sets.resourceReads.has(n)||this.failResource("read",e,"resourceReads")}checkResourceWrite(e){if(this.sets===null)return;const n=e;this.sets.resourceWrites.has(n)||this.failResource("write",e,"resourceWrites")}checkSparseRead(e){if(this.sets===null)return;const n=e;this.sets.sparseReads.has(n)||this.failSparse("read",n,"sparseReads")}checkSparseWrite(e){if(this.sets===null)return;const n=e;this.sets.sparseWrites.has(n)||this.failSparse("write",n,"sparseWrites")}checkRelationRead(e){if(this.sets===null)return;const n=e;this.sets.relationReads.has(n)||this.failRelation("read",n,"relationReads")}checkRelationWrite(e){if(this.sets===null)return;const n=e;this.sets.relationWrites.has(n)||this.failRelation("write",n,"relationWrites")}checkRelationReadAny(){this.sets!==null&&(this.sets.relationReads.has(Ae)||this.failRelation("(*, T) wildcard read",Ae,"relationReads (as ANY_RELATION)"))}optionalScopes=[];enterOptionalScope(e){this.optionalScopes.push(e)}leaveOptionalScope(){this.optionalScopes.pop()}checkOptionalFetch(e){const n=this.optionalScopes.length;if(n===0)return;const r=this.optionalScopes[n-1],s=e.id;for(let o=0;o<r.length;o++)if(r[o]===s)return;throw new A(T.OPTIONAL_TERM_NOT_DECLARED,`getOptionalColumnRead fetched optional component ${s} but the iterating query didn't declare it — add .optional(component) to the query before fetching it`)}failComponent(e,n,r){const s=this.activeName,o=Ke(n);throw new A(T.ACCESS_UNDECLARED,`system '${s}' performed ${e} on ${o} but didn't declare it — add it to '${r}' (see docs/api/systems.md)`,{system:s,op:e,component:n.id})}failSparse(e,n,r){const s=this.activeName;throw new A(T.ACCESS_UNDECLARED,`system '${s}' performed ${e} on sparse component ${n} but didn't declare it — add it to '${r}' (see docs/api/systems.md)`,{system:s,op:e,sparse:n})}failRelation(e,n,r){const s=this.activeName;throw new A(T.ACCESS_UNDECLARED,`system '${s}' performed ${e} on relation ${n} but didn't declare it — add it to '${r}' (see docs/api/systems.md)`,{system:s,op:e,relation:n})}failResource(e,n,r){const s=this.activeName,o=n.description??"<unnamed>";throw new A(T.ACCESS_UNDECLARED,`system '${s}' performed resource ${e} on '${o}' but didn't declare it — add the resource key to '${r}' (see docs/api/systems.md)`,{system:s,op:e,resource:o})}}const K=new jn,Qn="/packages/engine/src/core/ecs/";class Zn{activeCache=null;repoRootCache=null;buf=new Map;callsiteCache=new Map;isActive(){if(this.activeCache!==null)return this.activeCache;const n=globalThis.process?.env?.VISUAL_INTEL_TRACE;return this.activeCache=n==="1"||n==="true"}repoRoot(){if(this.repoRootCache!==null)return this.repoRootCache;const e=globalThis.process;return this.repoRootCache=e?.cwd?.()??""}resolveCallsite(){return es(new Error().stack??null,this.repoRoot(),this.callsiteCache)}record(e,n,r){const s=this.resolveCallsite();if(!s)return;const o=`${e} ${n} ${r} ${s}`;this.buf.set(o,(this.buf.get(o)??0)+1)}recordEmit(e){this.record("ecs-events","emit",e)}recordRead(e){this.record("ecs-events","read",e)}recordResourceRead(e){this.record("resources","read",e)}recordResourceWrite(e){this.record("resources","write",e)}recordResourceRegister(e){this.record("resources","register",e)}recordResourceRemove(e){this.record("resources","remove",e)}recordSendAction(e){this.record("actions","send_action",e)}recordHandleAction(e){this.record("actions","handle_action",e)}snapshot(){const e={"ecs-events":{emit:[],read:[]},actions:{send_action:[],handle_action:[]},resources:{read:[],write:[],register:[],remove:[]}};for(const[n,r]of this.buf.entries()){const[s,o,i,a]=n.split(" ");if(!s||!o||a===void 0)continue;const l={key:s==="actions"?Number(i):i,file:a,count:r},f=e[s][o];f&&f.push(l)}for(const n of Object.values(e))for(const r of Object.values(n))r.sort((s,o)=>{if(s.file!==o.file)return s.file<o.file?-1:1;const i=String(s.key),a=String(o.key);return i<a?-1:i>a?1:0});return{schemaVersion:1,capturedAt:new Date().toISOString(),channels:e}}reset(){this.buf.clear(),this.callsiteCache.clear(),this.activeCache=null,this.repoRootCache=null}}function Jn(t){const e=/\(([^)]+):\d+:\d+\)\s*$/.exec(t);if(e)return e[1]??null;const n=/at\s+([^\s][^()]*?):\d+:\d+\s*$/.exec(t);return n&&(n[1]??"").trim()||null}function es(t,e,n){if(!t)return null;const r=t.split(`
|
|
2
|
-
`);for(let s=0;s<r.length;s++){const o=r[s],i=n?.get(o);if(i!==void 0){if(i===null)continue;return i}const a=Jn(o);if(!a){n?.set(o,null);continue}if(a.includes(Qn)){n?.set(o,null);continue}const c=ts(a,e);return n?.set(o,c),c}return null}function ts(t,e){let n=t;return n.startsWith("file://")&&(n=n.slice(7)),e&&n.startsWith(e+"/")&&(n=n.slice(e.length+1)),n.replace(/\\/g,"/")}const ns=new Zn;var B=(t=>(t.PRE_STARTUP="PRE_STARTUP",t.STARTUP="STARTUP",t.POST_STARTUP="POST_STARTUP",t.FIXED_UPDATE="FIXED_UPDATE",t.PRE_UPDATE="PRE_UPDATE",t.UPDATE="UPDATE",t.POST_UPDATE="POST_UPDATE",t))(B||{});const he=["PRE_STARTUP","STARTUP","POST_STARTUP"],Ee=["PRE_UPDATE","UPDATE","POST_UPDATE"];function ss(t){return Object.freeze({name:t})}function rs(t){return!("fn"in t)}const j=Object.freeze([]);function me(t){return t===void 0?j:Array.isArray(t)?t:[t]}class os{labelSystems=new Map;sortedCache=new Map;systemIndex=new Map;systemLastRun=[];lastRunSlots=new Map;freeLastRunSlots=[];_driveDepth=0;gatedSystems=new Map;setConditions=new Map;setOrdering=new Map;nextInsertionOrder=0;_backend=null;onWarn;_fixedNodes=[];constructor(e){this.onWarn=e??(n=>console.warn(n));for(let n=0;n<he.length;n++)this.labelSystems.set(he[n],[]);this.labelSystems.set("FIXED_UPDATE",this._fixedNodes);for(let n=0;n<Ee.length;n++)this.labelSystems.set(Ee[n],[])}addSystems(e,...n){for(const r of n){const s="system"in r,o=s?r.system:r,i=s?r.ordering:void 0,a=s?me(r.runIf):j,c=s?me(r.set):j;if(this.systemIndex.has(o))throw new A(T.DUPLICATE_SYSTEM,`System ${o.name??o.id} is already scheduled`);const l={descriptor:o,insertionOrder:this.nextInsertionOrder++,before:new Set(i?.before??[]),after:new Set(i?.after??[]),conditions:a,sets:c};this.labelSystems.get(e).push(l),this.systemIndex.set(o,e),this._assignLastRunSlot(o),(a.length>0||c.length>0)&&this.gatedSystems.set(o,l),this.sortedCache.delete(e)}}configureSet(e,n){const r=me(n.runIf);if(r.length>0){const s=this.setConditions.get(e);s===void 0?this.setConditions.set(e,[...r]):s.push(...r)}if(n.before!==void 0||n.after!==void 0){let s=this.setOrdering.get(e);s===void 0&&(s={before:new Set,after:new Set},this.setOrdering.set(e,s));for(const o of n.before??j)s.before.add(o);for(const o of n.after??j)s.after.add(o);this.sortedCache.clear()}}removeSystem(e){const n=this.systemIndex.get(e);if(n===void 0)return;const r=this.labelSystems.get(n),s=r.findIndex(i=>i.descriptor===e);if(s!==-1){const i=r.length-1;s!==i&&(r[s]=r[i]),r.pop();for(const a of r)a.before.delete(e),a.after.delete(e)}this.systemIndex.delete(e);const o=this.lastRunSlots.get(e);o!==void 0&&(this.systemLastRun[o]=0,this.lastRunSlots.delete(e),this.freeLastRunSlots.push(o)),this.gatedSystems.delete(e),this.sortedCache.clear()}setBackend(e){this._backend=e}runStartup(e,n){this._driveDepth++;try{for(const r of he)this.runLabel(r,e,Ct,n)}finally{this._driveDepth--}}runUpdate(e,n,r){this._driveDepth++;try{for(const s of Ee)this.runLabel(s,e,n,r)}finally{this._driveDepth--}}runFixedUpdate(e,n,r){this._driveDepth++;try{this.runLabel("FIXED_UPDATE",e,n,r)}finally{this._driveDepth--}}hasFixedSystems(){return this._fixedNodes.length>0}getAllSystems(){const e=[];for(const n of this.labelSystems.values())for(const r of n)e.push(r.descriptor);return e}hasSystem(e){return this.systemIndex.has(e)}_assignLastRunSlot(e){let n=this.lastRunSlots.get(e);if(n===void 0){const r=this._driveDepth===0?this.freeLastRunSlots.pop():void 0;r!==void 0?(n=r,this.systemLastRun[n]=0):(n=this.systemLastRun.length,this.systemLastRun.push(0)),this.lastRunSlots.set(e,n)}return n}clear(){for(const e of this.labelSystems.values())e.length=0;this.sortedCache.clear(),this.systemIndex.clear(),this._driveDepth===0?this.systemLastRun.length=0:this.systemLastRun.fill(0),this.lastRunSlots.clear(),this.freeLastRunSlots.length=0,this.gatedSystems.clear(),this.setConditions.clear(),this.setOrdering.clear()}runLabel(e,n,r,s){const o=this.getSorted(e),i=o.sorted,a=o.slots,c=this.gatedSystems.size>0,l=this._backend,d=c?new Map:void 0;for(let f=0;f<i.length;f++){const _=i[f];if(c){const p=this.gatedSystems.get(_);if(p!==void 0&&!this.shouldRun(p,n,d))continue}n.lastRunTick=this.systemLastRun[a[f]];const m=l!==null?_.backendHandle:void 0;K.enter(_),n._trace?.systemStart(_,e);try{m!==void 0?l.run(m):_.fn?.(n,r)}finally{n._trace?.systemEnd(_),K.leave()}this.systemLastRun[a[f]]=s}n._trace?.flushBegin(e),n.flush(),n._trace?.flushEnd(e),n._trace?.phaseBoundary(e)}shouldRun(e,n,r){if(e.conditions.length>0&&!this.evalConditions(e.conditions,n))return!1;for(let s=0;s<e.sets.length;s++){const o=e.sets[s];let i=r.get(o);if(i===void 0){const a=this.setConditions.get(o);i=a===void 0||a.length===0?!0:this.evalConditions(a,n),r.set(o,i)}if(!i)return!1}return!0}evalConditions(e,n){for(let r=0;r<e.length;r++){const s=e[r];K.enterCondition(s);let o;try{o=s.evaluate(n)}finally{K.leave()}if(!o)return!1}return!0}getSorted(e){const n=this.sortedCache.get(e);if(n!==void 0)return n;const r=this.labelSystems.get(e),s=this.sortSystems(r,e),o=new Int32Array(s.length);for(let a=0;a<s.length;a++)o[a]=this._assignLastRunSlot(s[a]);const i={sorted:s,slots:o};return this.sortedCache.set(e,i),i}sortSystems(e,n){if(e.length===0)return[];const r=[],s=new Map,o=new Set,i=new Map;for(const d of e){r.push(d.descriptor),s.set(d.descriptor,d.insertionOrder),o.add(d.descriptor);for(let f=0;f<d.sets.length;f++){const _=d.sets[f];let m=i.get(_);m===void 0&&(m=[],i.set(_,m)),m.push(d.descriptor)}}const a=new Map;for(const d of e)a.set(d.descriptor,[]);for(const d of e){this.resolveEdges(d.descriptor,d.before,"before",o,i,a,n),this.resolveEdges(d.descriptor,d.after,"after",o,i,a,n);for(let f=0;f<d.sets.length;f++){const _=this.setOrdering.get(d.sets[f]);_!==void 0&&(this.resolveEdges(d.descriptor,_.before,"before",o,i,a,n),this.resolveEdges(d.descriptor,_.after,"after",o,i,a,n))}}const c=(d,f)=>s.get(d)-s.get(f),l=d=>d.name??`system_${d.id}`;try{return We.topologicalSort(r,a,c,l)}catch(d){throw d instanceof TypeError?new A(T.CIRCULAR_SYSTEM_DEPENDENCY,`Circular system dependency detected in ${n}: ${d.message}`):d}}resolveEdges(e,n,r,s,o,i,a){for(const c of n){if(rs(c)){const l=o.get(c);if(l===void 0)continue;for(let d=0;d<l.length;d++){const f=l[d];f!==e&&this.addDirectedEdge(e,f,r,i)}continue}if(!s.has(c)){this.warnDroppedEdge(e,c,r,a);continue}this.addDirectedEdge(e,c,r,i)}}addDirectedEdge(e,n,r,s){r==="before"?s.get(e).push(n):s.get(n).push(e)}warnDroppedEdge(e,n,r,s){if(this.systemIndex.has(n))return;const o=i=>i.name??`system_${i.id}`;this.onWarn(`Schedule[${s}]: \`${o(e)}\` declares \`${r}\` ordering against \`${o(n)}\`, which is not registered in any phase — the constraint is ignored. Check for a typo or a missing add_systems() call.`)}}const oe=1024,ie=1024*oe,Ge=64*oe,H=256*ie,ye=3,ft=64,_t=8,Ve=4*ie,Xe=t=>2**Math.ceil(Math.log2(Math.max(1,t))),ne=t=>2**Math.floor(Math.log2(Math.max(1,t))),k=(t,e,n)=>Math.min(n,Math.max(e,t)),R=t=>t>=ie?`${(t/ie).toFixed(1)} MiB`:t>=oe?`${(t/oe).toFixed(0)} KiB`:`${t} B`;function D(t,e){if(!Number.isInteger(e)||e<=0)throw new A(T.INVALID_MEMORY_OPTIONS,`memory.${t} must be a positive integer (got ${e})`)}function is(t){const e=["budget","maxBytes","wasm","allocator","heap","shared"].filter(s=>t!==void 0&&t[s]!==void 0);if(e.length>1)throw new A(T.INVALID_MEMORY_OPTIONS,`memory takes at most one of budget | maxBytes | wasm | allocator | heap | shared (got: ${e.join(", ")})`);const n=t?.columnCapacity;if(n!==void 0&&D("columnCapacity",n),t?.budget!==void 0){const{entities:s}=t.budget,o=t.budget.archetypes??_t,i=t.budget.bytesPerEntity??ft;if(D("budget.entities",s),D("budget.archetypes",o),D("budget.bytesPerEntity",i),s>1<<20)throw new A(T.INVALID_MEMORY_OPTIONS,`memory.budget.entities=${s} exceeds the EntityID index space (1<<20 = ${1<<20})`);const a=n??k(Xe(Math.ceil(s/o)),64,1<<20),c=k(Xe(s*2),4096,1<<20),l=c*w,d=s*i*ye,f=be(Math.max(l+d,Ve),Ge);return{source:"budget",allocator:P.heapArraybufferAllocator(f),columnCapacity:a,entityIndexCapacity:c,capBytes:f,intentLabel:`budget of ${s} entities`,budgetEntities:s,derivation:[`columnCapacity = ${n!==void 0?`${a} (pinned)`:`pow2(${s}/${o} per archetype) = ${a}`}`,`entityIndex = pow2(2 × ${s}) = ${c} slots × ${w} B = ${R(l)}`,`columns = ${s} × ${i} B × ${ye} (double+holes headroom) = ${R(d)}`,`cap = align64K(max(index + columns, ${R(Ve)} floor)) = ${R(f)}`],wasmMemory:null}}if(t?.maxBytes!==void 0){D("maxBytes",t.maxBytes);const s=n??F,o=k(ne(t.maxBytes/4/w),4096,v);return{source:"maxBytes",allocator:P.heapArraybufferAllocator(t.maxBytes),columnCapacity:s,entityIndexCapacity:o,capBytes:t.maxBytes,intentLabel:`explicit cap of ${R(t.maxBytes)}`,budgetEntities:null,derivation:[`cap = ${R(t.maxBytes)} (caller-declared)`,`columnCapacity = ${s} (${n!==void 0?"pinned":"default"})`,`entityIndex = floor_pow2(cap/4 ÷ ${w} B) = ${o} slots`],wasmMemory:null}}if(t?.wasm!==void 0){const s=t.wasm,o=n??F;if(s.memory!==void 0){if(!(s.memory.buffer instanceof SharedArrayBuffer))throw new A(T.INVALID_MEMORY_OPTIONS,"memory.wasm.memory must be constructed with `shared: true` — the SAB substrate requires a SharedArrayBuffer-backed WebAssembly.Memory");return{source:"wasm",allocator:P.wasmMemoryAllocator(s.memory),columnCapacity:o,entityIndexCapacity:v,capBytes:null,intentLabel:"caller-supplied WebAssembly.Memory",budgetEntities:null,derivation:["backing = wasm_memory_allocator(memory) — zero-copy with the sim (is_in_place ✓)","cap = the Memory's own `maximum` (declared by the caller; not readable from JS)",`columnCapacity = ${o} (${n!==void 0?"pinned":"default"})`],wasmMemory:s.memory}}D("wasm.maximumPages",s.maximumPages);const i=s.initialPages??Math.min(32,s.maximumPages);if(D("wasm.initialPages",i),i>s.maximumPages)throw new A(T.INVALID_MEMORY_OPTIONS,`memory.wasm.initialPages (${i}) exceeds maximumPages (${s.maximumPages})`);const a=new WebAssembly.Memory({initial:i,maximum:s.maximumPages,shared:!0}),c=s.maximumPages*Ge,l=k(ne(c/4/w),4096,v);return{source:"wasm",allocator:P.wasmMemoryAllocator(a),columnCapacity:o,entityIndexCapacity:l,capBytes:c,intentLabel:`engine-constructed WebAssembly.Memory (max ${s.maximumPages} pages)`,budgetEntities:null,derivation:[`cap = ${s.maximumPages} pages × 64 KiB = ${R(c)} (Memory maximum)`,`initial = ${i} pages (${s.initialPages!==void 0?"declared":"default"})`,`entityIndex = floor_pow2(cap/4 ÷ ${w} B) = ${l} slots`,`columnCapacity = ${o} (${n!==void 0?"pinned":"default"})`],wasmMemory:a}}if(t?.allocator!==void 0){if(t.allocator.isInPlace!==!0)throw new A(T.INVALID_MEMORY_OPTIONS,"memory.allocator must declare `isInPlace: true`: a live Store's flush loops hoist entity-index views across grows, so a non-in-place allocator (e.g. DEFAULT_SAB_ALLOCATOR) corrupts the entity→row mapping. Use growableSabAllocator / wasmMemoryAllocator; non-in-place allocators are snapshot/test sizing only.");const s=n??F,o=t.capBytesHint;return o!==void 0&&D("capBytesHint",o),{source:"allocator",allocator:t.allocator,columnCapacity:s,entityIndexCapacity:v,capBytes:o??null,intentLabel:o!==void 0?`custom in-place allocator (cap hint ${R(o)})`:"custom in-place allocator",budgetEntities:null,derivation:["backing = caller allocator (is_in_place ✓ checked at construction)",o!==void 0?`cap = ${R(o)} (caller hint — diagnostics only; the allocator owns the real cap)`:"cap = allocator-owned (no hint)",`columnCapacity = ${s} (${n!==void 0?"pinned":"default"})`],wasmMemory:null}}if(t?.heap!==void 0){t.heap.maxBytes!==void 0&&D("heap.maxBytes",t.heap.maxBytes);const s=t.heap.maxBytes??H,o=n??F,i=k(ne(s/4/w),4096,v);return{source:"heap",allocator:P.heapArraybufferAllocator(s),columnCapacity:o,entityIndexCapacity:i,capBytes:s,intentLabel:`pure-TS heap backing (${R(s)} growable cap, no SharedArrayBuffer)`,budgetEntities:null,derivation:[`backing = heap_arraybuffer_allocator(${R(s)}) — fixed ArrayBuffer reserved at the cap, no SAB / no COOP+COEP (is_in_place ✓)`,"trade-off: no worker offload / no WASM backend (both need a transferable SharedArrayBuffer)",`columnCapacity = ${o} (${n!==void 0?"pinned":"default"})`,`entityIndex = floor_pow2(cap/4 ÷ ${w} B) = ${i} slots`],wasmMemory:null}}if(t?.shared!==void 0){t.shared.maxBytes!==void 0&&D("shared.maxBytes",t.shared.maxBytes);const s=t.shared.maxBytes??H,o=n??F,i=k(ne(s/4/w),4096,v);return{source:"shared",allocator:P.growableSabAllocator(s),columnCapacity:o,entityIndexCapacity:i,capBytes:s,intentLabel:`shared SharedArrayBuffer backing (${R(s)} growable cap, needs COOP/COEP)`,budgetEntities:null,derivation:[`backing = growable_sab_allocator(${R(s)}) — growable SharedArrayBuffer (is_in_place ✓); needs cross-origin isolation`,"enables worker offload + a WASM compute backend (transferable SharedArrayBuffer)",`columnCapacity = ${o} (${n!==void 0?"pinned":"default"})`,`entityIndex = floor_pow2(cap/4 ÷ ${w} B) = ${i} slots`],wasmMemory:null}}const r=n??F;return{source:"default",allocator:P.heapArraybufferAllocator(),columnCapacity:r,entityIndexCapacity:v,capBytes:H,intentLabel:`default sizing (${R(H)} growable cap)`,budgetEntities:null,derivation:[`cap = ${R(H)} (heap_arraybuffer_allocator default)`,`columnCapacity = ${r} (${n!==void 0?"pinned":"DEFAULT_COLUMN_CAPACITY"})`,`entityIndex = ${v} slots (full EntityID space, ~12 MiB virtual)`],wasmMemory:null}}function as(t,e){return{def:t,values:e}}function ae(t,e){switch(e.kind){case"spawn":{const n=t.commands.spawn();for(const r of e.components)t.commands.add(n,r.def,r.values);return e.onSpawned?.(n),n}case"despawn":t.commands.despawn(e.eid);return;case"add_component":t.commands.add(e.eid,e.def,e.values);return;case"remove_component":t.commands.remove(e.eid,e.def);return;case"set_field":if(!t.hasComponent(e.eid,e.def))throw new A(T.COMPONENT_NOT_REGISTERED,`host set_field on entity ${e.eid} targets a component it does not have. If you added that component via a host command this same frame, the add is deferred to the phase flush while set_field is immediate — carry the value in add_component/spawnEntry instead of a separate set_field, or set it next frame. (host write seam)`);t.setField(e.eid,e.def,e.field,e.value);return;case"disable":t.commands.disable(e.eid);return;case"enable":t.commands.enable(e.eid);return;default:return pt(e,"HostCommand kind")}}class ht{queued=[];spawn(e,n){return this.queued.push({kind:"spawn",components:e,onSpawned:n}),this}despawn(e){return this.queued.push({kind:"despawn",eid:e}),this}add(e,n,r){return this.queued.push({kind:"add_component",eid:e,def:n,values:r}),this}remove(e,n){return this.queued.push({kind:"remove_component",eid:e,def:n}),this}setField(e,n,r,s){return this.queued.push({kind:"set_field",eid:e,def:n,field:r,value:s}),this}disable(e){return this.queued.push({kind:"disable",eid:e}),this}enable(e){return this.queued.push({kind:"enable",eid:e}),this}push(e){return this.queued.push(e),this}get pending(){return this.queued.length}clear(){const e=this.queued.length;return this.queued.length=0,e}drain(e,n){const r=this.queued.length;if(r===0)return 0;if(n===void 0)for(let s=0;s<r;s++)ae(e,this.queued[s]);else for(let s=0;s<r;s++){const o=this.queued[s];n(o),ae(e,o)}return this.queued.splice(0,r),r}}const Pe=x-1;function cs(t){if(t===De)throw new M("cannot bind opCode 0 (reserved as the command-ring empty-slot marker)");if(t<0||t>255||!Number.isInteger(t))throw new M(`command opCode must be a u8 in [1, 255] (got ${t})`)}function ue(t){const e=new Uint8Array(Pe);return new DataView(e.buffer).setUint32(0,t,!0),e}function fe(t){return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!0)}function ls(t,e){return{encode(n){if(n.kind!=="set_field")throw new M(`ringSetFieldCodec encodes a "set_field" command (got "${n.kind}")`);const r=new Uint8Array(Pe),s=new DataView(r.buffer);return s.setUint32(0,n.eid,!0),s.setFloat64(4,n.value,!0),r},decode(n){const r=new DataView(n.buffer,n.byteOffset,n.byteLength);return{kind:"set_field",eid:r.getUint32(0,!0),def:t,field:e,value:r.getFloat64(4,!0)}}}}function ds(){return{encode(t){if(t.kind!=="despawn")throw new M(`ringDespawnCodec encodes a "despawn" command (got "${t.kind}")`);return ue(t.eid)},decode:t=>({kind:"despawn",eid:fe(t)})}}function us(){return{encode(t){if(t.kind!=="disable")throw new M(`ringDisableCodec encodes a "disable" command (got "${t.kind}")`);return ue(t.eid)},decode:t=>({kind:"disable",eid:fe(t)})}}function fs(){return{encode(t){if(t.kind!=="enable")throw new M(`ringEnableCodec encodes an "enable" command (got "${t.kind}")`);return ue(t.eid)},decode:t=>({kind:"enable",eid:fe(t)})}}function _s(t){return{encode(e){if(e.kind!=="remove_component")throw new M(`ringRemoveComponentCodec encodes a "remove_component" command (got "${e.kind}")`);return ue(e.eid)},decode:e=>({kind:"remove_component",eid:fe(e),def:t})}}class hs{appliers=new Map;on(e,n){return cs(e),this.appliers.set(e,n),this}off(e){return this.appliers.delete(e)}onCommand(e,n){return this.on(e,(r,s,o)=>{const i=n.decode(s);o?.(i),ae(r,i)})}drain(e,n,r,s){return en(n,r,(o,i)=>{const a=this.appliers.get(o);a!==void 0&&a(e,i,s)})}}const Es=new Set([B.PRE_STARTUP,B.STARTUP,B.POST_STARTUP]),Ie=new WeakMap;function ms(t,e){const n=Ie.get(e);if(n===void 0)return!1;for(const r of n)t.removeSystem(r);return Ie.delete(e),e.clear(),!0}function gs(t,e){const n=new ht,r=[];Ie.set(n,r);const s=e?.name??"host_command_apply",o=e?.ring,i=e?.recorder,a=i?.record,c=e?.schedules??[B.PRE_STARTUP,B.PRE_UPDATE];if(i!==void 0&&c.includes(B.FIXED_UPDATE))throw new A(T.INVALID_RECORDER_SCHEDULE,"install_host_command_seam: a recorder cannot drain on SCHEDULE.FIXED_UPDATE — it would log the fixed-step dt instead of the host update(dt) and diverge on replay. Use a variable-update phase (PRE_UPDATE/UPDATE/POST_UPDATE).");for(const l of c){const d=!Es.has(l),f=t.registerSystem({name:`${s}:${l}`,reads:[],writes:[],exclusive:!0,fn:(_,m)=>{if(i!==void 0&&d&&i.openTick(_.ecsTick,m),n.drain(_,a),o!==void 0){const p=t.columnStore,u=p.header.commandRingOff;u!==0&&o.drain(_,p.view,u,a)}}});t.addSystems(l,f),r.push(f)}return n}exports.ACTION_RING_DEFAULT_CAPACITY_SLOTS=En;exports.ANY_RELATION=Ae;exports.ARCHETYPE_DESCRIPTOR_HEADER_BYTES=le;exports.ARCHETYPE_DESCRIPTOR_OFFSETS=N;exports.BUDGET_DEFAULT_ARCHETYPES=_t;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=ft;exports.BUDGET_GROWTH_HEADROOM=ye;exports.COLUMN_DESCRIPTOR_BYTES=ce;exports.COMMAND_RING_DEFAULT_CAPACITY_SLOTS=zt;exports.COMPONENT_MASK_WORDS=Q;exports.DEFAULT_COLUMN_CAPACITY=F;exports.DEFAULT_ECS_CAP_BYTES=H;exports.DEFAULT_FIXED_TIMESTEP=Dt;exports.DEFAULT_MAX_FIXED_STEPS=Ot;exports.DEFAULT_ON_DELETE_TARGET=xn;exports.ECSError=A;exports.ECS_ERROR=T;exports.EMPTY_VALUES=It;exports.ENTITY_INDEX_DEFAULT_CAPACITY=v;exports.ENTITY_INDEX_HEADER_BYTES=te;exports.ENTITY_INDEX_HEADER_OFFSETS=Z;exports.EVENT_RING_DEFAULT_CAPACITY_SLOTS=ln;exports.FNV1A_OFFSET_BASIS=it;exports.FNV1A_PRIME=ve;exports.HASH_GOLDEN_RATIO=St;exports.HASH_SECONDARY_PRIME=Rt;exports.HOST_COMMAND_PAYLOAD_BYTES=Pe;exports.HostCommandDispatcher=hs;exports.HostCommandQueue=ht;exports.INDEX_BITS=W;exports.INDEX_MASK=Re;exports.INITIAL_GENERATION=Nt;exports.MAX_ENTITY_ID=ge;exports.MAX_GENERATION=J;exports.MAX_INDEX=U;exports.MAX_LIVE_GENERATION=Lt;exports.NO_SWAP=yt;exports.RELATION_TARGET_FIELD=at;exports.RETIRED_GENERATION=vt;exports.SCHEDULE=B;exports.SIM_ABI_VERSION=Qe;exports.STORE_DESCRIPTOR_COMPONENT_LIMIT=Ht;exports.STORE_HEADER_BYTES=Ze;exports.STORE_HEADER_OFFSETS=E;exports.STORE_MAGIC=je;exports.STORE_MAX_BYTE_OFFSET=de;exports.STORE_PREFIX_REGIONS=q;exports.Schedule=os;exports.SparseComponentStore=Pn;exports.SparseRestoreError=y;exports.StoreLayoutOverflowError=Ce;exports.TYPED_ARRAY_TAG_TO_TYPE_TAG=xt;exports.TYPE_TAG_STRIDE=Te;exports.UNASSIGNED=At;exports.accessCheck=K;exports.alignUp=be;exports.applyHostCommand=ae;exports.archetypeDescriptorBytes=we;exports.buildArchetypeViews=ot;exports.buildEntityIndexViews=on;exports.columnKey=rt;exports.componentDebugName=$t;exports.componentLabel=Ke;exports.createColumnStore=Un;exports.createEntityId=Ut;exports.dispatchTrace=ns;exports.entityNotAliveError=Mt;exports.findRegionEntry=Cn;exports.findRegionOffset=On;exports.fnv1aStepWord=Mn;exports.getEntityGeneration=pe;exports.getEntityIndex=L;exports.installHostCommandSeam=gs;exports.isColumnStoreInternal=Ln;exports.isEcsError=Tt;exports.isNonNegativeInteger=Et;exports.makeRelationStore=Gn;exports.readHeaderRegionTable=Dn;exports.readLayoutDescriptorRegion=Xt;exports.readStoreHeader=Ft;exports.resolveECSMemory=is;exports.restoreRelations=Xn;exports.restoreSparseStores=Bn;exports.ringDespawnCodec=ds;exports.ringDisableCodec=us;exports.ringEnableCodec=fs;exports.ringRemoveComponentCodec=_s;exports.ringSetFieldCodec=ls;exports.setComponentDebugName=Pt;exports.snapshotRelations=Vn;exports.snapshotSparseStores=$n;exports.spawnEntry=as;exports.systemSet=ss;exports.uninstallHostCommandSeam=ms;exports.unsafeCast=gt;exports.validateAndCast=mt;exports.validateSparseStores=Fn;exports.writeArchetypeDescriptor=Je;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./kernel-yWV3XnAb.cjs");function u(e,t){let r=!1;return n.effect(()=>{const s=e();r?n.untrack(()=>t(s)):r=!0})}function i(e){return{subscribe:t=>u(e,()=>t()),getSnapshot:e}}exports.subscribe=u;exports.toExternalStore=i;
|
package/dist/interop-CcY6ASQc.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { e as n, u } from "./kernel-DgyrLFjW.js";
|
|
2
|
-
function a(e, t) {
|
|
3
|
-
let r = !1;
|
|
4
|
-
return n(() => {
|
|
5
|
-
const s = e();
|
|
6
|
-
r ? u(() => t(s)) : r = !0;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function f(e) {
|
|
10
|
-
return {
|
|
11
|
-
subscribe: (t) => a(e, () => t()),
|
|
12
|
-
getSnapshot: e
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
a as s,
|
|
17
|
-
f as t
|
|
18
|
-
};
|
package/dist/interop-DqxleBo7.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { e as n, u } from "./kernel-Cz2Kxlwl.js";
|
|
2
|
-
function a(e, t) {
|
|
3
|
-
let r = !1;
|
|
4
|
-
return n(() => {
|
|
5
|
-
const s = e();
|
|
6
|
-
r ? u(() => t(s)) : r = !0;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function f(e) {
|
|
10
|
-
return {
|
|
11
|
-
subscribe: (t) => a(e, () => t()),
|
|
12
|
-
getSnapshot: e
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
a as s,
|
|
17
|
-
f as t
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./kernel-sw7ScKWu.cjs");function u(e,t){let r=!1;return n.effect(()=>{const s=e();r?n.untrack(()=>t(s)):r=!0})}function i(e){return{subscribe:t=>u(e,()=>t()),getSnapshot:e}}exports.subscribe=u;exports.toExternalStore=i;
|
package/dist/kernel-Cz2Kxlwl.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
let r = null, h = 0, d = !1, O = 0;
|
|
2
|
-
const f = [];
|
|
3
|
-
let c, l = null;
|
|
4
|
-
function a(s) {
|
|
5
|
-
const e = s.owned;
|
|
6
|
-
if (e !== null) {
|
|
7
|
-
s.owned = null;
|
|
8
|
-
for (let t = e.length - 1; t >= 0; t--) e[t].dispose();
|
|
9
|
-
}
|
|
10
|
-
const i = s.cleanups;
|
|
11
|
-
if (i !== null) {
|
|
12
|
-
s.cleanups = null;
|
|
13
|
-
for (let t = i.length - 1; t >= 0; t--) i[t]();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function D(s) {
|
|
17
|
-
l !== null && (l.owned ??= []).push(s);
|
|
18
|
-
}
|
|
19
|
-
function b(s, e) {
|
|
20
|
-
const i = e.depsTail;
|
|
21
|
-
if (i !== void 0 && i.source === s) {
|
|
22
|
-
i.version = s.version;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const t = i !== void 0 ? i.nextDep : e.deps;
|
|
26
|
-
if (t !== void 0 && t.source === s) {
|
|
27
|
-
t.version = s.version, e.depsTail = t;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const n = N(s, e, i, t);
|
|
31
|
-
n.version = s.version, i !== void 0 ? i.nextDep = n : e.deps = n, t !== void 0 && (t.prevDep = n), e.depsTail = n, n.prevSub = s.subsTail, s.subsTail !== void 0 ? s.subsTail.nextSub = n : s.subs = n, s.subsTail = n;
|
|
32
|
-
}
|
|
33
|
-
function N(s, e, i, t) {
|
|
34
|
-
const n = c;
|
|
35
|
-
return n !== void 0 ? (c = n.nextDep, n.source = s, n.target = e, n.version = 0, n.prevDep = i, n.nextDep = t, n.prevSub = void 0, n.nextSub = void 0, n) : { source: s, target: e, version: 0, prevSub: void 0, nextSub: void 0, prevDep: i, nextDep: t };
|
|
36
|
-
}
|
|
37
|
-
function p(s) {
|
|
38
|
-
const { source: e, target: i, prevDep: t, nextDep: n, prevSub: o, nextSub: u } = s;
|
|
39
|
-
return t !== void 0 ? t.nextDep = n : i.deps = n, n !== void 0 && (n.prevDep = t), o !== void 0 ? o.nextSub = u : e.subs = u, u !== void 0 ? u.prevSub = o : e.subsTail = o, s.prevDep = void 0, s.prevSub = void 0, s.nextSub = void 0, s.nextDep = c, c = s, n;
|
|
40
|
-
}
|
|
41
|
-
function T(s) {
|
|
42
|
-
s.depsTail = void 0;
|
|
43
|
-
}
|
|
44
|
-
function S(s) {
|
|
45
|
-
const e = s.depsTail;
|
|
46
|
-
let i = e !== void 0 ? e.nextDep : s.deps;
|
|
47
|
-
for (; i !== void 0; ) i = p(i);
|
|
48
|
-
}
|
|
49
|
-
function g(s) {
|
|
50
|
-
for (let e = s.deps; e !== void 0; e = e.nextDep)
|
|
51
|
-
if (e.source.refresh(), e.version !== e.source.version) return !0;
|
|
52
|
-
return !1;
|
|
53
|
-
}
|
|
54
|
-
function E(s) {
|
|
55
|
-
for (let e = s.subs; e !== void 0; e = e.nextSub)
|
|
56
|
-
e.target.notify();
|
|
57
|
-
}
|
|
58
|
-
class y {
|
|
59
|
-
value;
|
|
60
|
-
eq;
|
|
61
|
-
version = 0;
|
|
62
|
-
subs = void 0;
|
|
63
|
-
subsTail = void 0;
|
|
64
|
-
constructor(e, i) {
|
|
65
|
-
this.value = e, this.eq = i;
|
|
66
|
-
}
|
|
67
|
-
refresh() {
|
|
68
|
-
}
|
|
69
|
-
get() {
|
|
70
|
-
return r !== null && b(this, r), this.value;
|
|
71
|
-
}
|
|
72
|
-
set(e) {
|
|
73
|
-
this.eq(this.value, e) || (this.value = e, this.version++, this.subs !== void 0 && (E(this), h === 0 && w()));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class x {
|
|
77
|
-
value;
|
|
78
|
-
// assigned by the first refresh, which always runs before any read
|
|
79
|
-
fn;
|
|
80
|
-
eq;
|
|
81
|
-
version = 0;
|
|
82
|
-
subs = void 0;
|
|
83
|
-
subsTail = void 0;
|
|
84
|
-
deps = void 0;
|
|
85
|
-
depsTail = void 0;
|
|
86
|
-
flags = 4;
|
|
87
|
-
cleanups = null;
|
|
88
|
-
owned = null;
|
|
89
|
-
constructor(e, i) {
|
|
90
|
-
this.fn = e, this.eq = i;
|
|
91
|
-
}
|
|
92
|
-
refresh() {
|
|
93
|
-
if (this.flags & 9 || (this.flags &= -3, !(this.flags & 4) && this.version !== 0) || (this.flags &= -5, this.version !== 0 && !g(this))) return;
|
|
94
|
-
this.flags |= 1, a(this), T(this);
|
|
95
|
-
const e = r, i = l;
|
|
96
|
-
r = this, l = this;
|
|
97
|
-
try {
|
|
98
|
-
const t = this.fn();
|
|
99
|
-
(this.version === 0 || !this.eq(this.value, t)) && (this.value = t, this.version++);
|
|
100
|
-
} finally {
|
|
101
|
-
r = e, l = i, S(this), this.flags &= -2;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
get() {
|
|
105
|
-
return this.flags & 1 ? this.value : (this.refresh(), r !== null && b(this, r), this.value);
|
|
106
|
-
}
|
|
107
|
-
notify() {
|
|
108
|
-
this.flags & 2 || (this.flags |= 6, E(this));
|
|
109
|
-
}
|
|
110
|
-
dispose() {
|
|
111
|
-
if (this.flags & 8) return;
|
|
112
|
-
this.flags |= 8;
|
|
113
|
-
let e = this.deps;
|
|
114
|
-
for (; e !== void 0; ) e = p(e);
|
|
115
|
-
this.depsTail = void 0, a(this);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
class A {
|
|
119
|
-
fn;
|
|
120
|
-
deps = void 0;
|
|
121
|
-
depsTail = void 0;
|
|
122
|
-
flags = 0;
|
|
123
|
-
lastFlush = 0;
|
|
124
|
-
// the flush generation this effect last ran in (cycle backstop)
|
|
125
|
-
cleanups = null;
|
|
126
|
-
owned = null;
|
|
127
|
-
constructor(e) {
|
|
128
|
-
this.fn = e;
|
|
129
|
-
}
|
|
130
|
-
notify() {
|
|
131
|
-
this.flags & 2 || (this.flags |= 18, f.push(this));
|
|
132
|
-
}
|
|
133
|
-
run() {
|
|
134
|
-
if (this.flags & 8) return;
|
|
135
|
-
a(this), T(this);
|
|
136
|
-
const e = r, i = l;
|
|
137
|
-
r = this, l = this;
|
|
138
|
-
try {
|
|
139
|
-
this.fn();
|
|
140
|
-
} finally {
|
|
141
|
-
r = e, l = i, S(this);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
dispose() {
|
|
145
|
-
if (this.flags & 8) return;
|
|
146
|
-
this.flags |= 8;
|
|
147
|
-
let e = this.deps;
|
|
148
|
-
for (; e !== void 0; ) e = p(e);
|
|
149
|
-
this.depsTail = void 0, a(this);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function w() {
|
|
153
|
-
if (d) return;
|
|
154
|
-
d = !0;
|
|
155
|
-
const s = ++O;
|
|
156
|
-
let e = 0, i, t = !1;
|
|
157
|
-
try {
|
|
158
|
-
for (let n = 0; n < f.length; n++) {
|
|
159
|
-
const o = f[n];
|
|
160
|
-
if (o.flags &= -19, !(o.flags & 8) && g(o)) {
|
|
161
|
-
if (o.lastFlush === s && ++e > 1e5)
|
|
162
|
-
throw new Error(
|
|
163
|
-
"reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)"
|
|
164
|
-
);
|
|
165
|
-
o.lastFlush = s;
|
|
166
|
-
try {
|
|
167
|
-
o.run();
|
|
168
|
-
} catch (u) {
|
|
169
|
-
t || (i = u, t = !0);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} finally {
|
|
174
|
-
f.length = 0, d = !1;
|
|
175
|
-
}
|
|
176
|
-
if (t) throw i;
|
|
177
|
-
}
|
|
178
|
-
function U(s, e = Object.is) {
|
|
179
|
-
const i = new y(s, e);
|
|
180
|
-
return [() => i.get(), (t) => i.set(t)];
|
|
181
|
-
}
|
|
182
|
-
function k(s, e = Object.is) {
|
|
183
|
-
l === null && I(
|
|
184
|
-
"computed() created outside an ownership scope is permanently subscribed and can never be disposed — create it under root() or inside an effect."
|
|
185
|
-
);
|
|
186
|
-
const i = new x(s, e);
|
|
187
|
-
return D(i), () => i.get();
|
|
188
|
-
}
|
|
189
|
-
function C(s) {
|
|
190
|
-
const e = new A(s);
|
|
191
|
-
return D(e), e.run(), () => e.dispose();
|
|
192
|
-
}
|
|
193
|
-
function F(s) {
|
|
194
|
-
h++;
|
|
195
|
-
try {
|
|
196
|
-
s();
|
|
197
|
-
} finally {
|
|
198
|
-
--h === 0 && w();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function P(s) {
|
|
202
|
-
const e = r;
|
|
203
|
-
r = null;
|
|
204
|
-
try {
|
|
205
|
-
return s();
|
|
206
|
-
} finally {
|
|
207
|
-
r = e;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
function q(s) {
|
|
211
|
-
const e = { cleanups: null, owned: null }, i = l;
|
|
212
|
-
l = e;
|
|
213
|
-
try {
|
|
214
|
-
return s(() => a(e));
|
|
215
|
-
} finally {
|
|
216
|
-
l = i;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function G(s) {
|
|
220
|
-
if (l === null) {
|
|
221
|
-
I(
|
|
222
|
-
"onCleanup() called outside an ownership scope — the callback is dropped. Call it inside root(), an effect, or a computed."
|
|
223
|
-
);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
(l.cleanups ??= []).push(s);
|
|
227
|
-
}
|
|
228
|
-
const v = /* @__PURE__ */ new Set();
|
|
229
|
-
function I(s) {
|
|
230
|
-
v.has(s) || (v.add(s), console.warn(`[oecs/reactive] ${s}`));
|
|
231
|
-
}
|
|
232
|
-
export {
|
|
233
|
-
F as b,
|
|
234
|
-
k as c,
|
|
235
|
-
C as e,
|
|
236
|
-
G as o,
|
|
237
|
-
q as r,
|
|
238
|
-
U as s,
|
|
239
|
-
P as u
|
|
240
|
-
};
|
package/dist/kernel-DgyrLFjW.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
let l = null, v = 0, c = !1, I = 0;
|
|
2
|
-
const a = [];
|
|
3
|
-
let h, r = null;
|
|
4
|
-
function f(s) {
|
|
5
|
-
const e = s.owned;
|
|
6
|
-
if (e !== null) {
|
|
7
|
-
s.owned = null;
|
|
8
|
-
for (let t = e.length - 1; t >= 0; t--) e[t].dispose();
|
|
9
|
-
}
|
|
10
|
-
const i = s.cleanups;
|
|
11
|
-
if (i !== null) {
|
|
12
|
-
s.cleanups = null;
|
|
13
|
-
for (let t = i.length - 1; t >= 0; t--) i[t]();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function d(s) {
|
|
17
|
-
r !== null && (r.owned ??= []).push(s);
|
|
18
|
-
}
|
|
19
|
-
function D(s, e) {
|
|
20
|
-
const i = e.depsTail;
|
|
21
|
-
if (i !== void 0 && i.source === s) {
|
|
22
|
-
i.version = s.version;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const t = i !== void 0 ? i.nextDep : e.deps;
|
|
26
|
-
if (t !== void 0 && t.source === s) {
|
|
27
|
-
t.version = s.version, e.depsTail = t;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const n = O(s, e, i, t);
|
|
31
|
-
n.version = s.version, i !== void 0 ? i.nextDep = n : e.deps = n, t !== void 0 && (t.prevDep = n), e.depsTail = n, n.prevSub = s.subsTail, s.subsTail !== void 0 ? s.subsTail.nextSub = n : s.subs = n, s.subsTail = n;
|
|
32
|
-
}
|
|
33
|
-
function O(s, e, i, t) {
|
|
34
|
-
const n = h;
|
|
35
|
-
return n !== void 0 ? (h = n.nextDep, n.source = s, n.target = e, n.version = 0, n.prevDep = i, n.nextDep = t, n.prevSub = void 0, n.nextSub = void 0, n) : { source: s, target: e, version: 0, prevSub: void 0, nextSub: void 0, prevDep: i, nextDep: t };
|
|
36
|
-
}
|
|
37
|
-
function p(s) {
|
|
38
|
-
const { source: e, target: i, prevDep: t, nextDep: n, prevSub: o, nextSub: u } = s;
|
|
39
|
-
return t !== void 0 ? t.nextDep = n : i.deps = n, n !== void 0 && (n.prevDep = t), o !== void 0 ? o.nextSub = u : e.subs = u, u !== void 0 ? u.prevSub = o : e.subsTail = o, s.prevDep = void 0, s.prevSub = void 0, s.nextSub = void 0, s.nextDep = h, h = s, n;
|
|
40
|
-
}
|
|
41
|
-
function T(s) {
|
|
42
|
-
s.depsTail = void 0;
|
|
43
|
-
}
|
|
44
|
-
function g(s) {
|
|
45
|
-
const e = s.depsTail;
|
|
46
|
-
let i = e !== void 0 ? e.nextDep : s.deps;
|
|
47
|
-
for (; i !== void 0; ) i = p(i);
|
|
48
|
-
}
|
|
49
|
-
function S(s) {
|
|
50
|
-
for (let e = s.deps; e !== void 0; e = e.nextDep)
|
|
51
|
-
if (e.source.refresh(), e.version !== e.source.version) return !0;
|
|
52
|
-
return !1;
|
|
53
|
-
}
|
|
54
|
-
function b(s) {
|
|
55
|
-
for (let e = s.subs; e !== void 0; e = e.nextSub)
|
|
56
|
-
e.target.notify();
|
|
57
|
-
}
|
|
58
|
-
class w {
|
|
59
|
-
value;
|
|
60
|
-
eq;
|
|
61
|
-
version = 0;
|
|
62
|
-
subs = void 0;
|
|
63
|
-
subsTail = void 0;
|
|
64
|
-
constructor(e, i) {
|
|
65
|
-
this.value = e, this.eq = i;
|
|
66
|
-
}
|
|
67
|
-
refresh() {
|
|
68
|
-
}
|
|
69
|
-
get() {
|
|
70
|
-
return l !== null && D(this, l), this.value;
|
|
71
|
-
}
|
|
72
|
-
set(e) {
|
|
73
|
-
this.eq(this.value, e) || (this.value = e, this.version++, this.subs !== void 0 && (b(this), v === 0 && E()));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class N {
|
|
77
|
-
value;
|
|
78
|
-
// assigned by the first refresh, which always runs before any read
|
|
79
|
-
fn;
|
|
80
|
-
eq;
|
|
81
|
-
version = 0;
|
|
82
|
-
subs = void 0;
|
|
83
|
-
subsTail = void 0;
|
|
84
|
-
deps = void 0;
|
|
85
|
-
depsTail = void 0;
|
|
86
|
-
flags = 4;
|
|
87
|
-
cleanups = null;
|
|
88
|
-
owned = null;
|
|
89
|
-
constructor(e, i) {
|
|
90
|
-
this.fn = e, this.eq = i;
|
|
91
|
-
}
|
|
92
|
-
refresh() {
|
|
93
|
-
if (this.flags & 9 || (this.flags &= -3, !(this.flags & 4) && this.version !== 0) || (this.flags &= -5, this.version !== 0 && !S(this))) return;
|
|
94
|
-
this.flags |= 1, f(this), T(this);
|
|
95
|
-
const e = l, i = r;
|
|
96
|
-
l = this, r = this;
|
|
97
|
-
try {
|
|
98
|
-
const t = this.fn();
|
|
99
|
-
(this.version === 0 || !this.eq(this.value, t)) && (this.value = t, this.version++);
|
|
100
|
-
} finally {
|
|
101
|
-
l = e, r = i, g(this), this.flags &= -2;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
get() {
|
|
105
|
-
return this.flags & 1 ? this.value : (this.refresh(), l !== null && D(this, l), this.value);
|
|
106
|
-
}
|
|
107
|
-
notify() {
|
|
108
|
-
this.flags & 2 || (this.flags |= 6, b(this));
|
|
109
|
-
}
|
|
110
|
-
dispose() {
|
|
111
|
-
if (this.flags & 8) return;
|
|
112
|
-
this.flags |= 8;
|
|
113
|
-
let e = this.deps;
|
|
114
|
-
for (; e !== void 0; ) e = p(e);
|
|
115
|
-
this.depsTail = void 0, f(this);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
class y {
|
|
119
|
-
fn;
|
|
120
|
-
deps = void 0;
|
|
121
|
-
depsTail = void 0;
|
|
122
|
-
flags = 0;
|
|
123
|
-
lastFlush = 0;
|
|
124
|
-
// the flush generation this effect last ran in (cycle backstop)
|
|
125
|
-
cleanups = null;
|
|
126
|
-
owned = null;
|
|
127
|
-
constructor(e) {
|
|
128
|
-
this.fn = e;
|
|
129
|
-
}
|
|
130
|
-
notify() {
|
|
131
|
-
this.flags & 2 || (this.flags |= 18, a.push(this));
|
|
132
|
-
}
|
|
133
|
-
run() {
|
|
134
|
-
if (this.flags & 8) return;
|
|
135
|
-
f(this), T(this);
|
|
136
|
-
const e = l, i = r;
|
|
137
|
-
l = this, r = this;
|
|
138
|
-
try {
|
|
139
|
-
this.fn();
|
|
140
|
-
} finally {
|
|
141
|
-
l = e, r = i, g(this);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
dispose() {
|
|
145
|
-
if (this.flags & 8) return;
|
|
146
|
-
this.flags |= 8;
|
|
147
|
-
let e = this.deps;
|
|
148
|
-
for (; e !== void 0; ) e = p(e);
|
|
149
|
-
this.depsTail = void 0, f(this);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function E() {
|
|
153
|
-
if (c) return;
|
|
154
|
-
c = !0;
|
|
155
|
-
const s = ++I;
|
|
156
|
-
let e = 0, i, t = !1;
|
|
157
|
-
try {
|
|
158
|
-
for (let n = 0; n < a.length; n++) {
|
|
159
|
-
const o = a[n];
|
|
160
|
-
if (o.flags &= -19, !(o.flags & 8) && S(o)) {
|
|
161
|
-
if (o.lastFlush === s && ++e > 1e5)
|
|
162
|
-
throw new Error(
|
|
163
|
-
"reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)"
|
|
164
|
-
);
|
|
165
|
-
o.lastFlush = s;
|
|
166
|
-
try {
|
|
167
|
-
o.run();
|
|
168
|
-
} catch (u) {
|
|
169
|
-
t || (i = u, t = !0);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} finally {
|
|
174
|
-
a.length = 0, c = !1;
|
|
175
|
-
}
|
|
176
|
-
if (t) throw i;
|
|
177
|
-
}
|
|
178
|
-
function x(s, e = Object.is) {
|
|
179
|
-
const i = new w(s, e);
|
|
180
|
-
return [() => i.get(), (t) => i.set(t)];
|
|
181
|
-
}
|
|
182
|
-
function A(s, e = Object.is) {
|
|
183
|
-
const i = new N(s, e);
|
|
184
|
-
return d(i), () => i.get();
|
|
185
|
-
}
|
|
186
|
-
function U(s) {
|
|
187
|
-
const e = new y(s);
|
|
188
|
-
return d(e), e.run(), () => e.dispose();
|
|
189
|
-
}
|
|
190
|
-
function F(s) {
|
|
191
|
-
v++;
|
|
192
|
-
try {
|
|
193
|
-
s();
|
|
194
|
-
} finally {
|
|
195
|
-
--v === 0 && E();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function k(s) {
|
|
199
|
-
const e = l;
|
|
200
|
-
l = null;
|
|
201
|
-
try {
|
|
202
|
-
return s();
|
|
203
|
-
} finally {
|
|
204
|
-
l = e;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function P(s) {
|
|
208
|
-
const e = { cleanups: null, owned: null }, i = r;
|
|
209
|
-
r = e;
|
|
210
|
-
try {
|
|
211
|
-
return s(() => f(e));
|
|
212
|
-
} finally {
|
|
213
|
-
r = i;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function C(s) {
|
|
217
|
-
r !== null && (r.cleanups ??= []).push(s);
|
|
218
|
-
}
|
|
219
|
-
export {
|
|
220
|
-
F as b,
|
|
221
|
-
A as c,
|
|
222
|
-
U as e,
|
|
223
|
-
C as o,
|
|
224
|
-
P as r,
|
|
225
|
-
x as s,
|
|
226
|
-
k as u
|
|
227
|
-
};
|
package/dist/kernel-sw7ScKWu.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";let r=null,h=0,d=!1,O=0;const a=[];let c,l=null;function f(s){const e=s.owned;if(e!==null){s.owned=null;for(let i=e.length-1;i>=0;i--)e[i].dispose()}const t=s.cleanups;if(t!==null){s.cleanups=null;for(let i=t.length-1;i>=0;i--)t[i]()}}function D(s){l!==null&&(l.owned??=[]).push(s)}function b(s,e){const t=e.depsTail;if(t!==void 0&&t.source===s){t.version=s.version;return}const i=t!==void 0?t.nextDep:e.deps;if(i!==void 0&&i.source===s){i.version=s.version,e.depsTail=i;return}const n=N(s,e,t,i);n.version=s.version,t!==void 0?t.nextDep=n:e.deps=n,i!==void 0&&(i.prevDep=n),e.depsTail=n,n.prevSub=s.subsTail,s.subsTail!==void 0?s.subsTail.nextSub=n:s.subs=n,s.subsTail=n}function N(s,e,t,i){const n=c;return n!==void 0?(c=n.nextDep,n.source=s,n.target=e,n.version=0,n.prevDep=t,n.nextDep=i,n.prevSub=void 0,n.nextSub=void 0,n):{source:s,target:e,version:0,prevSub:void 0,nextSub:void 0,prevDep:t,nextDep:i}}function p(s){const{source:e,target:t,prevDep:i,nextDep:n,prevSub:o,nextSub:u}=s;return i!==void 0?i.nextDep=n:t.deps=n,n!==void 0&&(n.prevDep=i),o!==void 0?o.nextSub=u:e.subs=u,u!==void 0?u.prevSub=o:e.subsTail=o,s.prevDep=void 0,s.prevSub=void 0,s.nextSub=void 0,s.nextDep=c,c=s,n}function T(s){s.depsTail=void 0}function S(s){const e=s.depsTail;let t=e!==void 0?e.nextDep:s.deps;for(;t!==void 0;)t=p(t)}function g(s){for(let e=s.deps;e!==void 0;e=e.nextDep)if(e.source.refresh(),e.version!==e.source.version)return!0;return!1}function E(s){for(let e=s.subs;e!==void 0;e=e.nextSub)e.target.notify()}class y{value;eq;version=0;subs=void 0;subsTail=void 0;constructor(e,t){this.value=e,this.eq=t}refresh(){}get(){return r!==null&&b(this,r),this.value}set(e){this.eq(this.value,e)||(this.value=e,this.version++,this.subs!==void 0&&(E(this),h===0&&w()))}}class x{value;fn;eq;version=0;subs=void 0;subsTail=void 0;deps=void 0;depsTail=void 0;flags=4;cleanups=null;owned=null;constructor(e,t){this.fn=e,this.eq=t}refresh(){if(this.flags&9||(this.flags&=-3,!(this.flags&4)&&this.version!==0)||(this.flags&=-5,this.version!==0&&!g(this)))return;this.flags|=1,f(this),T(this);const e=r,t=l;r=this,l=this;try{const i=this.fn();(this.version===0||!this.eq(this.value,i))&&(this.value=i,this.version++)}finally{r=e,l=t,S(this),this.flags&=-2}}get(){return this.flags&1?this.value:(this.refresh(),r!==null&&b(this,r),this.value)}notify(){this.flags&2||(this.flags|=6,E(this))}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}class A{fn;deps=void 0;depsTail=void 0;flags=0;lastFlush=0;cleanups=null;owned=null;constructor(e){this.fn=e}notify(){this.flags&2||(this.flags|=18,a.push(this))}run(){if(this.flags&8)return;f(this),T(this);const e=r,t=l;r=this,l=this;try{this.fn()}finally{r=e,l=t,S(this)}}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}function w(){if(d)return;d=!0;const s=++O;let e=0,t,i=!1;try{for(let n=0;n<a.length;n++){const o=a[n];if(o.flags&=-19,!(o.flags&8)&&g(o)){if(o.lastFlush===s&&++e>1e5)throw new Error("reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)");o.lastFlush=s;try{o.run()}catch(u){i||(t=u,i=!0)}}}}finally{a.length=0,d=!1}if(i)throw t}function U(s,e=Object.is){const t=new y(s,e);return[()=>t.get(),i=>t.set(i)]}function k(s,e=Object.is){l===null&&I("computed() created outside an ownership scope is permanently subscribed and can never be disposed — create it under root() or inside an effect.");const t=new x(s,e);return D(t),()=>t.get()}function C(s){const e=new A(s);return D(e),e.run(),()=>e.dispose()}function F(s){h++;try{s()}finally{--h===0&&w()}}function P(s){const e=r;r=null;try{return s()}finally{r=e}}function q(s){const e={cleanups:null,owned:null},t=l;l=e;try{return s(()=>f(e))}finally{l=t}}function G(s){if(l===null){I("onCleanup() called outside an ownership scope — the callback is dropped. Call it inside root(), an effect, or a computed.");return}(l.cleanups??=[]).push(s)}const v=new Set;function I(s){v.has(s)||(v.add(s),console.warn(`[oecs/reactive] ${s}`))}exports.batch=F;exports.computed=k;exports.effect=C;exports.onCleanup=G;exports.root=q;exports.signal=U;exports.untrack=P;
|
package/dist/kernel-yWV3XnAb.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";let l=null,v=0,c=!1,I=0;const a=[];let h,r=null;function f(s){const e=s.owned;if(e!==null){s.owned=null;for(let i=e.length-1;i>=0;i--)e[i].dispose()}const t=s.cleanups;if(t!==null){s.cleanups=null;for(let i=t.length-1;i>=0;i--)t[i]()}}function d(s){r!==null&&(r.owned??=[]).push(s)}function D(s,e){const t=e.depsTail;if(t!==void 0&&t.source===s){t.version=s.version;return}const i=t!==void 0?t.nextDep:e.deps;if(i!==void 0&&i.source===s){i.version=s.version,e.depsTail=i;return}const n=O(s,e,t,i);n.version=s.version,t!==void 0?t.nextDep=n:e.deps=n,i!==void 0&&(i.prevDep=n),e.depsTail=n,n.prevSub=s.subsTail,s.subsTail!==void 0?s.subsTail.nextSub=n:s.subs=n,s.subsTail=n}function O(s,e,t,i){const n=h;return n!==void 0?(h=n.nextDep,n.source=s,n.target=e,n.version=0,n.prevDep=t,n.nextDep=i,n.prevSub=void 0,n.nextSub=void 0,n):{source:s,target:e,version:0,prevSub:void 0,nextSub:void 0,prevDep:t,nextDep:i}}function p(s){const{source:e,target:t,prevDep:i,nextDep:n,prevSub:o,nextSub:u}=s;return i!==void 0?i.nextDep=n:t.deps=n,n!==void 0&&(n.prevDep=i),o!==void 0?o.nextSub=u:e.subs=u,u!==void 0?u.prevSub=o:e.subsTail=o,s.prevDep=void 0,s.prevSub=void 0,s.nextSub=void 0,s.nextDep=h,h=s,n}function T(s){s.depsTail=void 0}function g(s){const e=s.depsTail;let t=e!==void 0?e.nextDep:s.deps;for(;t!==void 0;)t=p(t)}function S(s){for(let e=s.deps;e!==void 0;e=e.nextDep)if(e.source.refresh(),e.version!==e.source.version)return!0;return!1}function b(s){for(let e=s.subs;e!==void 0;e=e.nextSub)e.target.notify()}class w{value;eq;version=0;subs=void 0;subsTail=void 0;constructor(e,t){this.value=e,this.eq=t}refresh(){}get(){return l!==null&&D(this,l),this.value}set(e){this.eq(this.value,e)||(this.value=e,this.version++,this.subs!==void 0&&(b(this),v===0&&E()))}}class N{value;fn;eq;version=0;subs=void 0;subsTail=void 0;deps=void 0;depsTail=void 0;flags=4;cleanups=null;owned=null;constructor(e,t){this.fn=e,this.eq=t}refresh(){if(this.flags&9||(this.flags&=-3,!(this.flags&4)&&this.version!==0)||(this.flags&=-5,this.version!==0&&!S(this)))return;this.flags|=1,f(this),T(this);const e=l,t=r;l=this,r=this;try{const i=this.fn();(this.version===0||!this.eq(this.value,i))&&(this.value=i,this.version++)}finally{l=e,r=t,g(this),this.flags&=-2}}get(){return this.flags&1?this.value:(this.refresh(),l!==null&&D(this,l),this.value)}notify(){this.flags&2||(this.flags|=6,b(this))}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}class y{fn;deps=void 0;depsTail=void 0;flags=0;lastFlush=0;cleanups=null;owned=null;constructor(e){this.fn=e}notify(){this.flags&2||(this.flags|=18,a.push(this))}run(){if(this.flags&8)return;f(this),T(this);const e=l,t=r;l=this,r=this;try{this.fn()}finally{l=e,r=t,g(this)}}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}function E(){if(c)return;c=!0;const s=++I;let e=0,t,i=!1;try{for(let n=0;n<a.length;n++){const o=a[n];if(o.flags&=-19,!(o.flags&8)&&S(o)){if(o.lastFlush===s&&++e>1e5)throw new Error("reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)");o.lastFlush=s;try{o.run()}catch(u){i||(t=u,i=!0)}}}}finally{a.length=0,c=!1}if(i)throw t}function x(s,e=Object.is){const t=new w(s,e);return[()=>t.get(),i=>t.set(i)]}function A(s,e=Object.is){const t=new N(s,e);return d(t),()=>t.get()}function U(s){const e=new y(s);return d(e),e.run(),()=>e.dispose()}function k(s){v++;try{s()}finally{--v===0&&E()}}function F(s){const e=l;l=null;try{return s()}finally{l=e}}function C(s){const e={cleanups:null,owned:null},t=r;r=e;try{return s(()=>f(e))}finally{r=t}}function P(s){r!==null&&(r.cleanups??=[]).push(s)}exports.batch=k;exports.computed=A;exports.effect=U;exports.onCleanup=P;exports.root=C;exports.signal=x;exports.untrack=F;
|