@oasys/oecs 0.5.3 → 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 +1399 -276
- package/README.md +327 -169
- package/dist/core/ecs/access_check.d.cts +31 -31
- package/dist/core/ecs/access_check.d.ts +31 -31
- package/dist/core/ecs/access_check.d.ts.map +1 -1
- package/dist/core/ecs/archetype.d.cts +273 -205
- package/dist/core/ecs/archetype.d.ts +273 -205
- 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 +34 -34
- package/dist/core/ecs/archetype_graph.d.ts +34 -34
- 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 +30 -30
- package/dist/core/ecs/command_log.d.ts +30 -30
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +45 -44
- package/dist/core/ecs/component.d.ts +45 -44
- 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 +337 -276
- package/dist/core/ecs/ecs.d.ts +337 -276
- 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 +24 -22
- package/dist/core/ecs/entity_allocator.d.ts +24 -22
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +37 -23
- package/dist/core/ecs/event.d.ts +37 -23
- 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 +34 -34
- package/dist/core/ecs/frame_trace.d.ts +34 -34
- package/dist/core/ecs/frame_trace.d.ts.map +1 -1
- package/dist/core/ecs/host_commands.d.cts +107 -89
- package/dist/core/ecs/host_commands.d.ts +107 -89
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +22 -12
- package/dist/core/ecs/index.d.ts +22 -12
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +41 -122
- package/dist/core/ecs/observer.d.ts +41 -122
- 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 +219 -568
- package/dist/core/ecs/query.d.ts +219 -568
- 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 +129 -16
- package/dist/core/ecs/ref.d.ts +129 -16
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +105 -186
- package/dist/core/ecs/relation.d.ts +105 -186
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +14 -14
- package/dist/core/ecs/resource.d.ts +14 -14
- package/dist/core/ecs/resource_registry.d.cts +6 -6
- package/dist/core/ecs/resource_registry.d.ts +6 -6
- 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 +98 -114
- package/dist/core/ecs/schedule.d.ts +98 -114
- 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 +110 -53
- package/dist/core/ecs/sparse_store.d.ts +110 -53
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +644 -511
- package/dist/core/ecs/store.d.ts +644 -511
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +8 -8
- package/dist/core/ecs/store_layout_listener.d.ts +8 -8
- 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 +151 -66
- package/dist/core/ecs/system.d.ts +151 -66
- 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 +87 -4
- package/dist/core/ecs/utils/error.d.ts +87 -4
- 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 +48 -49
- package/dist/core/store/action_ring.d.ts +48 -49
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +166 -114
- package/dist/core/store/allocator.d.ts +166 -114
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts +21 -22
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +138 -100
- package/dist/core/store/column_store.d.ts +138 -100
- 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 +41 -45
- package/dist/core/store/command_ring.d.ts +41 -45
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +35 -18
- package/dist/core/store/descriptor.d.ts +35 -18
- 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 +40 -42
- package/dist/core/store/event_ring.d.ts +40 -42
- package/dist/core/store/event_ring.d.ts.map +1 -1
- package/dist/core/store/extend.d.cts +15 -9
- package/dist/core/store/extend.d.ts +15 -9
- package/dist/core/store/extend.d.ts.map +1 -1
- package/dist/core/store/grow.d.cts +3 -3
- package/dist/core/store/grow.d.ts +3 -3
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +37 -33
- package/dist/core/store/header.d.ts +37 -33
- 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 +72 -63
- package/dist/core/store/layout_ops.d.ts +72 -63
- 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 +14 -14
- package/dist/core/store/state_hash.d.ts +14 -14
- 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 +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +6709 -5729
- package/dist/index.js +5664 -4743
- 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 +56 -56
- package/dist/{extensions → plugins}/editor/editor.d.ts +56 -56
- package/dist/plugins/editor/editor.d.ts.map +1 -0
- package/dist/{extensions → plugins}/editor/field_handle.d.cts +13 -13
- package/dist/{extensions → plugins}/editor/field_handle.d.ts +13 -13
- 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} +83 -66
- package/dist/{extensions/editor/index.js → plugins/editor.js} +83 -66
- 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 +93 -105
- package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +93 -105
- 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 +18 -17
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +18 -17
- 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 +4 -4
- package/dist/version.d.ts +4 -4
- 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-3jyFfWNg.js +0 -2326
- package/dist/host_commands-DNf0f6ko.cjs +0 -1
- package/dist/internal-C9jjL90H.js +0 -2485
- package/dist/internal-RZN14uMw.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-9S1pY_Iw.js +0 -159
- package/dist/shallow-C5YmTbtb.cjs +0 -1
- package/dist/shallow-DQ8aG51_.cjs +0 -1
- package/dist/shallow-DfnAm9vG.js +0 -150
- package/dist/shared-BMXh9hxm.cjs +0 -1
- package/dist/shared-DQKK0i-E.js +0 -109
- package/dist/topological_sort-BDvEyb9W.cjs +0 -1
- package/dist/topological_sort-DK6EjpWa.js +0 -135
- package/dist/typed_arrays-BcXcnzB4.js +0 -258
- package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const H=require("./shared-Dk-pACZT.cjs");class ve extends Error{constructor(t,n,o){super(t),this.isOperational=n,this.context=o,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,this.constructor)}}var Be=(e=>(e.ASSERTION_FAIL_CONDITION="ASSERTION_FAIL_CONDITION",e.VALIDATION_FAIL_CONDITION="VALIDATION_FAIL_CONDITION",e.ASSERTION_FAIL_NON_NULLABLE="ASSERTION_FAIL_NON_NULLABLE",e.ASSERTION_FAIL_UNREACHABLE="ASSERTION_FAIL_UNREACHABLE",e))(Be||{});class qe extends ve{constructor(t,n,o){super(n,!1,o),this.category=t,this.name="AssertionError"}}function Je(e,t,n){return e}function Ze(e){return e}function et(e,t){throw new qe(Be.ASSERTION_FAIL_UNREACHABLE,`Unhandled ${t}: ${String(e)}`)}var A=(e=>(e.EID_MAX_INDEX_OVERFLOW="EID_MAX_INDEX_OVERFLOW",e.EID_MAX_GEN_OVERFLOW="EID_MAX_GEN_OVERFLOW",e.COMPONENT_NOT_REGISTERED="COMPONENT_NOT_REGISTERED",e.COMPONENT_LIMIT_EXCEEDED="COMPONENT_LIMIT_EXCEEDED",e.ENTITY_NOT_ALIVE="ENTITY_NOT_ALIVE",e.CIRCULAR_SYSTEM_DEPENDENCY="CIRCULAR_SYSTEM_DEPENDENCY",e.DUPLICATE_SYSTEM="DUPLICATE_SYSTEM",e.UNKNOWN_PHASE="UNKNOWN_PHASE",e.CIRCULAR_PHASE_DEPENDENCY="CIRCULAR_PHASE_DEPENDENCY",e.ARCHETYPE_NOT_FOUND="ARCHETYPE_NOT_FOUND",e.RESOURCE_NOT_REGISTERED="RESOURCE_NOT_REGISTERED",e.RESOURCE_ALREADY_REGISTERED="RESOURCE_ALREADY_REGISTERED",e.EVENT_ALREADY_REGISTERED="EVENT_ALREADY_REGISTERED",e.EVENT_NOT_REGISTERED="EVENT_NOT_REGISTERED",e.INVALID_EVENT_ID="INVALID_EVENT_ID",e.FIELD_NOT_REGISTERED="FIELD_NOT_REGISTERED",e.RELATION_NOT_REGISTERED="RELATION_NOT_REGISTERED",e.RELATION_MODE_INVALID="RELATION_MODE_INVALID",e.RELATION_MODE_MISMATCH="RELATION_MODE_MISMATCH",e.RELATION_CYCLE="RELATION_CYCLE",e.SPARSE_CACHE_KEY_OVERFLOW="SPARSE_CACHE_KEY_OVERFLOW",e.SPARSE_QUERY_DENSE_PATH="SPARSE_QUERY_DENSE_PATH",e.QUERY_TERM_DENSE_PATH="QUERY_TERM_DENSE_PATH",e.HIERARCHY_ALREADY_SET="HIERARCHY_ALREADY_SET",e.HIERARCHY_INVALID_MAX_DEPTH="HIERARCHY_INVALID_MAX_DEPTH",e.OBSERVER_NON_CONVERGENT="OBSERVER_NON_CONVERGENT",e.OBSERVER_INVALID_CONFIG="OBSERVER_INVALID_CONFIG",e.OBSERVER_ONSET_EMIT="OBSERVER_ONSET_EMIT",e.ROW_TICKS_NOT_TRACKED="ROW_TICKS_NOT_TRACKED",e.INVALID_FIXED_TIMESTEP="INVALID_FIXED_TIMESTEP",e.INVALID_MAX_FIXED_STEPS="INVALID_MAX_FIXED_STEPS",e.INVALID_RECORDER_SCHEDULE="INVALID_RECORDER_SCHEDULE",e.EMPTY_ARCHETYPE_MATERIALIZE="EMPTY_ARCHETYPE_MATERIALIZE",e.COMPONENT_INDEX_INVARIANT="COMPONENT_INDEX_INVARIANT",e.ARCHETYPE_ROW_INVARIANT="ARCHETYPE_ROW_INVARIANT",e.OPTIONAL_TERM_NOT_DECLARED="OPTIONAL_TERM_NOT_DECLARED",e.QUERY_ACCESS_UNDECLARED="QUERY_ACCESS_UNDECLARED",e.ACCESS_UNDECLARED="ACCESS_UNDECLARED",e.QUERY_NOT_SINGLETON="QUERY_NOT_SINGLETON",e.INVALID_RUN_CONDITION="INVALID_RUN_CONDITION",e.SYSTEM_FN_ARITY="SYSTEM_FN_ARITY",e.INVALID_SYSTEM_ID="INVALID_SYSTEM_ID",e.PARTITION_APPEND_NEEDS_ENTITY_ROW="PARTITION_APPEND_NEEDS_ENTITY_ROW",e.PARTITION_BULK_INTO_DISABLED="PARTITION_BULK_INTO_DISABLED",e.STRUCTURAL_DURING_ITERATION="STRUCTURAL_DURING_ITERATION",e.BACKEND_ALREADY_ATTACHED="BACKEND_ALREADY_ATTACHED",e.DETERMINISM_DISABLED="DETERMINISM_DISABLED",e.SNAPSHOT_RESTORE_FAILED="SNAPSHOT_RESTORE_FAILED",e.NON_DETERMINISTIC_COLUMN_TYPE="NON_DETERMINISTIC_COLUMN_TYPE",e.INVALID_MEMORY_OPTIONS="INVALID_MEMORY_OPTIONS",e.STORE_CAP_EXCEEDED="STORE_CAP_EXCEEDED",e.REGION_NOT_DECLARED="REGION_NOT_DECLARED",e.COMMAND_LOG_TAG_COLLISION="COMMAND_LOG_TAG_COLLISION",e.INVALID_FRAME_STEP="INVALID_FRAME_STEP",e.INVALID_TEMPLATE="INVALID_TEMPLATE",e.PLUGIN_NOT_INSTALLED="PLUGIN_NOT_INSTALLED",e.PLUGIN_ALREADY_INSTALLED="PLUGIN_ALREADY_INSTALLED",e.PLUGIN_SURFACE_COLLISION="PLUGIN_SURFACE_COLLISION",e.WORKERS_ATTACHED="WORKERS_ATTACHED",e.WORKERS_NEED_SHARED_BACKING="WORKERS_NEED_SHARED_BACKING",e.WORKERS_HOST_CANNOT_PARK="WORKERS_HOST_CANNOT_PARK",e.WORKERS_COUNT_INVALID="WORKERS_COUNT_INVALID",e.WORKERS_ENTRY_UNREACHABLE="WORKERS_ENTRY_UNREACHABLE",e.PARALLEL_ACCESS="PARALLEL_ACCESS",e.PARALLEL_KERNEL_MODULE="PARALLEL_KERNEL_MODULE",e.PARALLEL_KERNEL_FAILED="PARALLEL_KERNEL_FAILED",e))(A||{});class E extends ve{constructor(t,n,o){super(n??t,!0,o),this.category=t,this.name="ECSError"}}function tt(e){return e instanceof E}class nt extends E{constructor(t){super("SNAPSHOT_RESTORE_FAILED",t),this.name="ECSRestoreError"}}const ot=-1,rt=-1,it=Object.freeze(Object.create(null)),st=2654435769,at=1367130551,Ye=1024,ct=0,_t=31,dt=1/60,lt=4,ut=0,$=20,ue=(1<<$)-1,$e=ue,Et=_t-$,Z=(1<<Et)-1,At=Z,mt=Z-1,ft=Z<<$|$e,Tt=(e,t)=>t<<$|e,ie=e=>e&ue,se=e=>e>>$,It=(e,t,n)=>new E(A.ENTITY_NOT_ALIVE,`${e}: entity ${t} (index ${ie(t)}, generation ${se(t)}) is not alive${n?`, ${n}`:""}. It was destroyed, never created, or the handle is stale. Guard with isAlive() first`,{entity:t,index:ie(t),generation:se(t),op:e}),Ee=new WeakMap;function pt(e,t){Ee.set(e,t)}function Nt(e){return Ee.get(e)}function Fe(e){const t=Ee.get(e);return t!==void 0?`'${t}' (component ${e.id})`:`component ${e.id}`}const ht=827148627,St=1,Ae=4,gt=52,N={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},k=12,P={region_id:0,byte_offset:4,byte_length:8},me=16,x={component_id:0,field_id:2,type_tag:4,byte_off:8,stride:12},fe=40,b={archetype_id:0,component_mask:4,row_count:20,row_capacity:24,column_count:28,enabled_count:32,entity_ids_off:36},m={u8:0,i8:1,u16:2,i16:3,u32:4,i32:5,f32:6,f64:7},ae=Object.freeze({[m.u8]:1,[m.i8]:1,[m.u16]:2,[m.i16]:2,[m.u32]:4,[m.i32]:4,[m.f32]:4,[m.f64]:8}),yt={u8:m.u8,i8:m.i8,u16:m.u16,i16:m.i16,u32:m.u32,i32:m.i32,f32:m.f32,f64:m.f64};function Dt(e,t,n){e.setUint16(t+x.component_id,n.componentId,!0),e.setUint16(t+x.field_id,n.fieldId,!0),e.setUint8(t+x.type_tag,n.typeTag),e.setUint32(t+x.byte_off,n.byteOff,!0),e.setUint16(t+x.stride,n.stride,!0)}const Ot=Ae*32;function Te(e,t=fe){return t+e*me}function xe(e,t,n){e.setUint32(t+b.archetype_id,n.archetypeId,!0);for(let r=0;r<Ae;r++)e.setUint32(t+b.component_mask+r*4,n.componentMask[r]??0,!0);e.setUint32(t+b.row_count,n.rowCount,!0),e.setUint32(t+b.row_capacity,n.rowCapacity,!0),e.setUint32(t+b.column_count,n.columns.length,!0),e.setUint32(t+b.enabled_count,n.enabledCount,!0),e.setUint32(t+b.entity_ids_off,0,!0);let o=t+fe;for(let r=0;r<n.columns.length;r++)Dt(e,o,n.columns[r]),o+=me;return o}function Rt(e,t,n){let o=t;for(let r=0;r<n.length;r++)o=xe(e,o,n[r]);return o}function wt(e){let t=0;for(let n=0;n<e.length;n++)t+=Te(e[n].columns.length);return t}function Lt(e,t){e.setUint32(N.magic,t.magic,!0),e.setUint32(N.sim_abi_version,t.simAbiVersion,!0),e.setUint32(N.view_stamp,t.viewStamp,!0),e.setUint32(N.capacity,t.capacity,!0),e.setUint32(N.archetype_count,t.archetypeCount,!0),e.setUint32(N.layout_descriptor_off,t.layoutDescriptorOff,!0),e.setUint32(N.command_ring_off,t.commandRingOff,!0),e.setUint32(N.action_ring_off,t.actionRingOff,!0),e.setUint32(N.entity_index_off,t.entityIndexOff,!0),e.setUint32(N.event_ring_off,t.eventRingOff,!0),e.setUint32(N.region_table_off,t.regionTableOff,!0),e.setUint32(N.region_table_count,t.regionTableCount,!0),e.setUint32(N.bindings_off,t.bindingsOff,!0)}const He=16,U=16,bt=256,O={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},Ie=0;function ge(e){return He+e*U}function Ct(e){return e>0&&(e&e-1)===0}class w extends Error{constructor(t){super(t),this.name="CommandRingError"}}function Pt(e,t,n){if(!Ct(n))throw new w(`command ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+O.write_head,0,!0),e.setUint32(t+O.read_head,0,!0),e.setUint32(t+O.capacity_slots,n,!0),e.setUint32(t+O.overflow_flag,0,!0)}function Mt(e,t){return e.getUint32(t+O.write_head,!0)}function Ut(e,t){return e.getUint32(t+O.read_head,!0)}function vt(e,t){return e.getUint32(t+O.capacity_slots,!0)}function Bt(e,t,n){if(n.byteLength!==U-1)throw new w(`outPayload must be ${U-1} bytes (got ${n.byteLength})`);const o=Mt(e,t),r=Ut(e,t);if(o===r)return Ie;const s=vt(e,t),d=r&s-1,_=t+He+d*U,c=e.getUint8(_),l=new Uint8Array(e.buffer,e.byteOffset+_+1,U-1);return n.set(l),e.setUint32(t+O.read_head,r+1>>>0,!0),c}function Yt(e,t,n){let o=0;const r=new Uint8Array(U-1);for(;;){const s=Bt(e,t,r);if(s===Ie)return o;n(s,r.slice()),o++}}const ee=16,C=12,V={length:0,capacity:4},ce=1<<20;function ye(e){if(e<0||!Number.isInteger(e))throw new Ge(`entity index capacity must be a non-negative integer (got ${e})`);return ee+e*C}function $t(e){return e+ee}function Ft(e,t){return e+ee+t*4}function xt(e,t){return e+ee+t*8}class Ge extends Error{constructor(t){super(t),this.name="EntityIndexError"}}function Ht(e,t,n){if(n<0||!Number.isInteger(n))throw new Ge(`entity index capacity must be a non-negative integer (got ${n})`);e.setUint32(t+V.length,0,!0),e.setUint32(t+V.capacity,n,!0)}function Gt(e,t,n){return{generations:new Int32Array(e,$t(t),n),archetypes:new Int32Array(e,Ft(t,n),n),rows:new Int32Array(e,xt(t,n),n)}}const Vt=16,kt=16,Wt=256,v={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12};function De(e){return Vt+e*kt}function Xt(e){return e>0&&(e&e-1)===0}class Kt extends Error{constructor(t){super(t),this.name="EventRingError"}}function zt(e,t,n){if(!Xt(n))throw new Kt(`event ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+v.write_head,0,!0),e.setUint32(t+v.read_head,0,!0),e.setUint32(t+v.capacity_slots,n,!0),e.setUint32(t+v.overflow_flag,0,!0)}const jt=16,Qt=16,qt=256,Y={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},Jt=Y.write_head/4,Zt=Y.read_head/4,en=Y.capacity_slots/4,tn=Y.overflow_flag/4;function nn(e,t){return new Int32Array(e.buffer,e.byteOffset+t,4)}function Oe(e){return jt+e*Qt}function on(e){return e>0&&(e&e-1)===0}class Re extends Error{constructor(t){super(t),this.name="ActionRingError"}}function rn(e,t,n){if(!on(n))throw new Re(`action ring capacity_slots must be a positive power of two (got ${n})`);if((e.byteOffset+t)%4!==0)throw new Re(`action ring header must be 4-byte aligned for Atomics (view.byteOffset ${e.byteOffset} + ringOff ${t} is not a multiple of 4)`);const o=nn(e,t);Atomics.store(o,Jt,0),Atomics.store(o,Zt,0),Atomics.store(o,en,n),Atomics.store(o,tn,0)}const G=[{name:"command_ring",headerOff:"command_ring_off",sizeFromOptions:e=>e.commandRingCapacitySlots!==void 0?ge(e.commandRingCapacitySlots):0,init:(e,t,n)=>Pt(e,t,n.commandRingCapacitySlots),regionBytes:(e,t)=>ge(e.getUint32(t+O.capacity_slots,!0)),readOptions:(e,t,n)=>{n.commandRingCapacitySlots=e.getUint32(t+O.capacity_slots,!0)}},{name:"entity_index",headerOff:"entity_index_off",sizeFromOptions:e=>e.entityIndexCapacity!==void 0?ye(e.entityIndexCapacity):0,init:(e,t,n)=>Ht(e,t,n.entityIndexCapacity),regionBytes:(e,t)=>ye(e.getUint32(t+V.capacity,!0)),readOptions:(e,t,n)=>{n.entityIndexCapacity=e.getUint32(t+V.capacity,!0)}},{name:"event_ring",headerOff:"event_ring_off",sizeFromOptions:e=>e.eventRingCapacitySlots!==void 0?De(e.eventRingCapacitySlots):0,init:(e,t,n)=>zt(e,t,n.eventRingCapacitySlots),regionBytes:(e,t)=>De(e.getUint32(t+v.capacity_slots,!0)),readOptions:(e,t,n)=>{n.eventRingCapacitySlots=e.getUint32(t+v.capacity_slots,!0)}},{name:"action_ring",headerOff:"action_ring_off",sizeFromOptions:e=>e.actionRingCapacitySlots!==void 0?Oe(e.actionRingCapacitySlots):0,init:(e,t,n)=>rn(e,t,n.actionRingCapacitySlots),regionBytes:(e,t)=>Oe(e.getUint32(t+Y.capacity_slots,!0)),readOptions:(e,t,n)=>{n.actionRingCapacitySlots=e.getUint32(t+Y.capacity_slots,!0)}}];class W extends Error{constructor(t){super(t),this.name="RegionRegistryError"}}function Ve(e){return e*k}function pe(e,t){const n=e.getUint32(N.region_table_count,!0);if(t+Ve(n)>e.byteLength)throw new W(`region table of ${n} entries at byte ${t} overruns the buffer (${e.byteLength} bytes)`);return n}function sn(e){const t=new Set;for(let n=0;n<e.length;n++){const o=e[n];if(!Number.isInteger(o.id)||o.id<=0)throw new W(`region "${o.name}" has invalid id ${o.id}, region ids must be positive integers (0 is the absent sentinel)`);if(t.has(o.id))throw new W(`duplicate region id ${o.id} (region "${o.name}"), ids must be distinct within a consumer's region set`);if(t.add(o.id),!Number.isInteger(o.bytes)||o.bytes<=0)throw new W(`region "${o.name}" (id ${o.id}) has invalid byte size ${o.bytes}, must be a positive integer`)}}function an(e,t,n){e.setUint32(t+P.region_id,n.regionId,!0),e.setUint32(t+P.byte_offset,n.byteOffset,!0),e.setUint32(t+P.byte_length,n.byteLength,!0)}function ke(e,t){return{regionId:e.getUint32(t+P.region_id,!0),byteOffset:e.getUint32(t+P.byte_offset,!0),byteLength:e.getUint32(t+P.byte_length,!0)}}function cn(e,t,n){for(let o=0;o<n.length;o++)an(e,t+o*k,n[o])}function _n(e,t,n){const o=new Array(n);for(let r=0;r<n;r++)o[r]=ke(e,t+r*k);return o}function dn(e){const t=e.getUint32(N.region_table_off,!0);if(t===0)return[];const n=pe(e,t);return _n(e,t,n)}function ln(e,t){const n=e.getUint32(N.region_table_off,!0);if(n===0)return 0;const o=pe(e,n);for(let r=0;r<o;r++){const s=n+r*k;if(e.getUint32(s+P.region_id,!0)===t)return e.getUint32(s+P.byte_offset,!0)}return 0}function un(e,t){const n=e.getUint32(N.region_table_off,!0);if(n===0)return null;const o=pe(e,n);for(let r=0;r<o;r++){const s=ke(e,n+r*k);if(s.regionId===t)return s}return null}function We(e,t){return e<<16|t}const te=2**31;class Ne extends Error{constructor(t){super(`SAB column layout offset ${t} reaches or exceeds the 2³¹ (${te}-byte) ceiling. Past 2 GiB the signed-32-bit bitwise alignment math wraps to a negative or misaligned offset. This is a structural limit independent of the allocator cap, so a single store cannot back more than 2 GiB of column data.`),this.name="StoreLayoutOverflowError"}}function he(e,t){if(e+t>te)throw new Ne(e);return e+(t-1)&~(t-1)}function En(e,t,n,o,r){const s=t+o;switch(n){case m.u8:return new Uint8Array(e,s,r);case m.i8:return new Int8Array(e,s,r);case m.u16:return new Uint16Array(e,s,r);case m.i16:return new Int16Array(e,s,r);case m.u32:return new Uint32Array(e,s,r);case m.i32:return new Int32Array(e,s,r);case m.f32:return new Float32Array(e,s,r);case m.f64:return new Float64Array(e,s,r)}}function An(e,t,n=0){const r=wt(e.map(_=>({archetypeId:_.archetypeId,componentMask:_.componentMask,rowCount:0,enabledCount:0,rowCapacity:_.rowCapacity,columns:_.columns.map(c=>({componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:0,stride:ae[c.typeTag]}))})))+n;let s=t+r;const d=new Array(e.length);for(let _=0;_<e.length;_++){const c=e[_],l=new Array(c.columns.length);for(let f=0;f<c.columns.length;f++){const p=c.columns[f],I=ae[p.typeTag];s=he(s,I),l[f]={componentId:p.componentId,fieldId:p.fieldId,typeTag:p.typeTag,byteOff:s,stride:I},s+=I*c.rowCapacity}d[_]={archetypeId:c.archetypeId,componentMask:c.componentMask,rowCount:0,enabledCount:0,rowCapacity:c.rowCapacity,columns:l}}if(s>te)throw new Ne(s);return{descriptors:d,totalBytes:s,regionBytes:r}}const K=16;function mn(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`createColumnStore: storeBase must be an integer >= 0, got ${e}`);if(e%K!==0)throw new RangeError(`createColumnStore: storeBase must be a multiple of ${K}, got ${e}`)}function Xe(e){let t=0;for(const[,n]of e)t+=Te(n.columnsInOrder.length);return t}function fn(e){const t=e;return typeof t._regionBytes=="number"&&typeof t._allocator=="function"&&typeof t._reservedDescriptorBytes=="number"}function Tn(e,t=H.DEFAULT_SAB_ALLOCATOR,n={}){const o=n.storeBase??0;mn(o);const r={};let s=gt;for(let h=0;h<G.length;h++){const R=G[h],F=R.sizeFromOptions(n);r[R.headerOff]=F===0?0:s,s+=F}const d=n.regions??[];sn(d);const _=d.length,c=_>0?s:0;s+=Ve(_);const l=new Array(_);for(let h=0;h<d.length;h++){const R=d[h];l[h]={regionId:R.id,byteOffset:s,byteLength:R.bytes},s+=R.bytes}const f=n.bindingsRegionBytes??0,p=f===0?0:s;s+=f;const I=s,{descriptors:y,totalBytes:S,regionBytes:a}=An(e,I,n.reservedDescriptorBytes??0),i=t(o+S),u=new DataView(i,o),D={magic:ht,simAbiVersion:St,viewStamp:0,capacity:S,archetypeCount:e.length,layoutDescriptorOff:I,bindingsOff:p,regionTableOff:c,regionTableCount:_,commandRingOff:r.command_ring_off,entityIndexOff:r.entity_index_off,eventRingOff:r.event_ring_off,actionRingOff:r.action_ring_off};Lt(u,D),f>0&&new Uint8Array(i,o+p,f).fill(0);for(let h=0;h<G.length;h++){const R=G[h],F=r[R.headerOff];F!==0&&R.init(u,F,n)}c!==0&&cn(u,c,l);for(let h=0;h<d.length;h++)d[h].init(u,l[h].byteOffset);Rt(u,I,y);const g=Ke(i,o,y);return{buffer:i,view:u,header:D,storeBase:o,archetypes:g,_regionBytes:a,_allocator:t,_reservedDescriptorBytes:n.reservedDescriptorBytes??0,_usedDescriptorBytes:Xe(g)}}function Ke(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const s=n[r],d=new Array(s.columns.length),_=new Map;for(let c=0;c<s.columns.length;c++){const l=s.columns[c],f={componentId:l.componentId,fieldId:l.fieldId,typeTag:l.typeTag,byteOff:l.byteOff,stride:l.stride,view:En(e,t,l.typeTag,l.byteOff,s.rowCapacity)};d[c]=f,_.set(We(l.componentId,l.fieldId),f)}o.set(s.archetypeId,{archetypeId:s.archetypeId,componentMask:s.componentMask,rowCapacity:s.rowCapacity,columns:_,columnsInOrder:d})}return o}const _e=2147483647,we=new WeakMap;function In(e){const t=new Set,n=new Set,o=new Set,r=new Set,s=new Set,d=new Set,_=new Set,c=new Set,l=new Set,f=new Set;for(let a=0;a<e.writes.length;a++){const i=e.writes[a].id;n.add(i),t.add(i),o.add(i)}for(let a=0;a<e.reads.length;a++)t.add(e.reads[a].id);for(let a=0;a<e.spawns.length;a++){const i=e.spawns[a];for(let u=0;u<i.length;u++)o.add(i[u].id)}for(let a=0;a<e.transitions.length;a++){const i=e.transitions[a];if(i.add)for(let u=0;u<i.add.length;u++)o.add(i.add[u].id);if(i.remove)for(let u=0;u<i.remove.length;u++)r.add(i.remove[u].id)}for(let a=0;a<e.despawns.length;a++)r.add(e.despawns[a].id);for(let a=0;a<e.resourceReads.length;a++)s.add(e.resourceReads[a]);for(let a=0;a<e.resourceWrites.length;a++){const i=e.resourceWrites[a];d.add(i),s.add(i)}const p=e.sparseWrites;if(p!==void 0)for(let a=0;a<p.length;a++){const i=p[a];c.add(i),_.add(i)}const I=e.sparseReads;if(I!==void 0)for(let a=0;a<I.length;a++)_.add(I[a]);const y=e.relationWrites;if(y!==void 0)for(let a=0;a<y.length;a++){const i=y[a];f.add(i),l.add(i)}const S=e.relationReads;if(S!==void 0)for(let a=0;a<S.length;a++)l.add(S[a]);return{reads:t,writes:n,addAllowed:o,removeAllowed:r,hasDespawns:e.despawns.length>0,resourceReads:s,resourceWrites:d,sparseReads:_,sparseWrites:c,relationReads:l,relationWrites:f}}function pn(e){const t=we.get(e);if(t!==void 0)return t;const n=In(e);return we.set(e,n),n}const Le=new WeakMap;function Nn(e){const t=new Set,n=new Set;if(e.reads!==void 0)for(let o=0;o<e.reads.length;o++)t.add(e.reads[o].id);if(e.resourceReads!==void 0)for(let o=0;o<e.resourceReads.length;o++)n.add(e.resourceReads[o]);return{reads:t,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 hn(e){const t=Le.get(e);if(t!==void 0)return t;const n=Nn(e);return Le.set(e,n),n}class Sn{_activeSystem=null;_activeSets=null;_activeName=null;_exclusive=!1;enter(t){this._activeSystem=t,this._activeName=t.name??`system_${t.id}`,this._exclusive=t.exclusive===!0,this._activeSets=this._exclusive?null:pn(t)}enterCondition(t){this._activeSystem=null,this._activeName=t.name,this._activeSets=hn(t)}leave(){this._activeSystem=null,this._activeName=null,this._activeSets=null,this._exclusive=!1}isActive(){return this._activeSets!==null||this._exclusive}current(){return this._activeSystem}assertRead(t){this._activeSets!==null&&(this._activeSets.reads.has(t.id)||this._failComponent("read",t,"reads"))}assertWrite(t){this._activeSets!==null&&(this._activeSets.writes.has(t.id)||this._failComponent("write",t,"writes"))}assertAdd(t){this._activeSets!==null&&(this._activeSets.addAllowed.has(t.id)||this._failComponent("addComponent",t,"spawns, transitions.add or writes"))}assertRemove(t){this._activeSets!==null&&(this._activeSets.removeAllowed.has(t.id)||this._failComponent("removeComponent",t,"despawns or transitions.remove"))}assertDespawn(){if(this._activeSets===null||this._activeSets.hasDespawns)return;const t=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${t}' called despawn but did not declare any despawns. Name the components it removes in 'despawns'`,{system:t,op:"despawn"})}assertResourceRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceReads.has(n)||this._failResource("read",t,"resourceReads")}assertResourceWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceWrites.has(n)||this._failResource("write",t,"resourceWrites")}assertSparseRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseReads.has(n)||this._failSparse("read",n,"sparseReads")}assertSparseWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseWrites.has(n)||this._failSparse("write",n,"sparseWrites")}assertRelationRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationReads.has(n)||this._failRelation("read",n,"relationReads")}assertRelationWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationWrites.has(n)||this._failRelation("write",n,"relationWrites")}assertRelationReadAny(){this._activeSets!==null&&(this._activeSets.relationReads.has(_e)||this._failRelation("(*, T) wildcard read",_e,"relationReads (as ANY_RELATION)"))}_optionalScopes=[];enterOptionalScope(t){this._optionalScopes.push(t)}leaveOptionalScope(){this._optionalScopes.pop()}assertOptionalFetch(t){const n=this._optionalScopes.length;if(n===0)return;const o=this._optionalScopes[n-1],r=t.id;for(let s=0;s<o.length;s++)if(o[s]===r)return;throw new E(A.OPTIONAL_TERM_NOT_DECLARED,`getOptionalColumnRead fetched optional component ${r} but the iterating query did not declare it. Add .optional(component) to the query before the fetch`)}_failComponent(t,n,o){const r=this._activeName,s=Fe(n);throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on ${s} but did not declare it. Add it to '${o}'`,{system:r,op:t,component:n.id})}_failSparse(t,n,o){const r=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on sparse component ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,sparse:n})}_failRelation(t,n,o){const r=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on relation ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,relation:n})}_failResource(t,n,o){const r=this._activeName,s=n.description??"<unnamed>";throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed resource ${t} on '${s}' but did not declare it. Add the resource key to '${o}'`,{system:r,op:t,resource:s})}}const gn=new Sn;function yn(e,t){return new E(A.PLUGIN_NOT_INSTALLED,`${t} needs the ${e} plugin, which this world did not install. Pass it at construction: ECS.create({ plugins: [${e}()] }), imported from @oasys/oecs/${e}`,{plugin:e})}function Dn(e){return new E(A.PLUGIN_ALREADY_INSTALLED,`${e} is already installed on this world. Pass each plugin once to ECS.create`,{plugin:e})}var z=(e=>(e.PRE_STARTUP="PRE_STARTUP",e.STARTUP="STARTUP",e.POST_STARTUP="POST_STARTUP",e.FIXED_UPDATE="FIXED_UPDATE",e.PRE_UPDATE="PRE_UPDATE",e.UPDATE="UPDATE",e.POST_UPDATE="POST_UPDATE",e))(z||{});function be(e){if(typeof e!="string")return e.loop;switch(e){case"PRE_STARTUP":case"STARTUP":case"POST_STARTUP":return"startup";case"FIXED_UPDATE":return"fixed";case"PRE_UPDATE":case"UPDATE":case"POST_UPDATE":return"update"}}function Ce(e){return typeof e=="string"?e:e.name}const j=1024,Q=1024*j,B=64*j,q=B;function On(e,t=0){if(!Number.isFinite(t)||t<0)throw new E(A.INVALID_MEMORY_OPTIONS,`storeBaseAbove: extraBytes must be a finite number >= 0, got ${String(t)}`);const n=e?.__heap_base,o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;if(typeof o!="number"||!Number.isFinite(o))throw new E(A.INVALID_MEMORY_OPTIONS,`storeBaseAbove: the module exports no numeric '__heap_base', got ${String(o)}. Link with --export=__heap_base, or pass memory.storeBase by hand.`);const r=Math.ceil((o+t)/B)*B;return Math.max(q,r)}const X=256*Q,de=3,ze=64,je=8,Pe=4*Q,Me=e=>2**Math.ceil(Math.log2(Math.max(1,e))),Rn=e=>2**Math.floor(Math.log2(Math.max(1,e))),re=(e,t,n)=>Math.min(n,Math.max(t,e)),T=e=>e>=Q?`${(e/Q).toFixed(1)} MiB`:e>=j?`${(e/j).toFixed(0)} KiB`:`${e} B`;function wn(e,t){if(e===void 0)return t?q:0;if(!Number.isInteger(e)||e<0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase must be an integer >= 0, got ${e}`);if(e%K!==0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase must be a multiple of ${K}, got ${e}. The alignment keeps every column on its element boundary.`);if(t&&e===0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase is 0, and a header at address 0 is unreadable from a safe build of a WASM module. Pass a storeBase of at least one page (${q}), above the module's own data.`);return e}function M(e,t){if(!Number.isInteger(t)||t<=0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.${e} must be a positive integer (got ${t})`)}const Ue={budget:"{ budget: { entities: N } } → { entities: N }",heap:'{ heap: { maxBytes: X } } → { maxBytes: X, backing: "heap" }',shared:'{ shared: { maxBytes: X } } → { maxBytes: X, backing: "shared" }',wasm:"{ wasm: W } → { backing: { wasm: W } }",allocator:"{ allocator: A } → { backing: { allocator: A } }",capBytesHint:"{ capBytesHint: X } → { maxBytes: X }"};function Ln(e){const t=Object.prototype.hasOwnProperty,n=Object.keys(Ue).filter(o=>t.call(e,o));if(n.length!==0)throw new E(A.INVALID_MEMORY_OPTIONS,`${n.map(o=>`memory.${o}`).join(" and ")} ${n.length>1?"were":"was"} removed in 0.6. Sizing and backing are now two independent fields, so every combination of them is expressible. Rewrite as: `+n.map(o=>Ue[o]).join(". "))}function bn(e){e!==void 0&&Ln(e);const t=e?.entities,n=e?.maxBytes,o=e?.columnCapacity,r=e?.backing??"heap",s=typeof r=="object"&&r.wasm!==void 0,d=wn(e?.storeBase,s);if(o!==void 0&&M("columnCapacity",o),n!==void 0&&M("maxBytes",n),t===void 0){for(const i of["archetypes","bytesPerEntity"])if(e?.[i]!==void 0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.${i} shapes the sizing derived from memory.entities, which was not given. Add memory.entities, or drop memory.${i}.`)}let _,c,l=null;const f=[];if(t!==void 0){const i=e?.archetypes??je,u=e?.bytesPerEntity??ze;if(M("entities",t),M("archetypes",i),M("bytesPerEntity",u),t>1<<20)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.entities=${t} exceeds the EntityID index space (1<<20 = ${1<<20})`);_=o??re(Me(Math.ceil(t/i)),64,1<<20),c=re(Me(t*2),4096,1<<20);const D=c*C,g=t*u*de;l=he(Math.max(D+g,Pe),B),f.push(`columnCapacity = ${o!==void 0?`${_} (pinned)`:`pow2(${t}/${i} per archetype) = ${_}`}`,`entityIndex = pow2(2 × ${t}) = ${c} slots × ${C} B = ${T(D)}`,`columns = ${t} × ${u} B × ${de} (double+holes headroom) = ${T(g)}`)}else _=o??Ye,c=ce,f.push(`columnCapacity = ${_} (${o!==void 0?"pinned":"default"})`);const p=i=>re(Rn(i/4/C),4096,ce),I=t!==void 0?n!==void 0?"entities+maxBytes":"entities":n!==void 0?"maxBytes":"default",y=i=>n!==void 0?`${T(i)} (caller-declared maxBytes; the ${T(l??i)} the entity count implies is overridden)`:`align64K(max(index + columns, ${T(Pe)} floor)) = ${T(i)}`,S=(i,u,D,g,L)=>(t===void 0&&(c=p(i)),{source:u,sizing:I,allocator:D,columnCapacity:_,entityIndexCapacity:c,capBytes:i,storeBase:d,intentLabel:g,budgetEntities:t??null,derivation:[...L,...d>0?[`storeBase = ${T(d)}, the store writes nothing below it`]:[],...f,t===void 0?`entityIndex = floor_pow2(cap/4 ÷ ${C} B) = ${c} slots`:`cap = ${y(i)}`],wasmMemory:null});if(typeof r=="object"&&r.wasm!==void 0){const i=r.wasm;if(i.memory!==void 0){if(!(i.memory.buffer instanceof SharedArrayBuffer))throw new E(A.INVALID_MEMORY_OPTIONS,"memory.backing.wasm.memory must be constructed with `shared: true`, the SAB substrate requires a SharedArrayBuffer-backed WebAssembly.Memory");const L=n??X;return t===void 0&&(c=p(Math.max(L-d,0))),{source:"wasm",sizing:I,allocator:H.wasmMemoryAllocator(i.memory),columnCapacity:_,entityIndexCapacity:c,capBytes:L,storeBase:d,intentLabel:`caller-supplied WebAssembly.Memory (declared cap ${T(L)})`,budgetEntities:t??null,derivation:["backing = wasm_memory_allocator(memory), zero-copy with a WASM compute backend (is_in_place ✓)",n!==void 0?`cap = ${T(L)} (caller-declared maxBytes; the Memory's own maximum is not readable from JS)`:`cap = ${T(L)} (default; the Memory's own maximum is not readable from JS)`,`storeBase = ${T(d)}, the module owns every byte below it`,...f,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${C} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:i.memory}}M("backing.wasm.maximumPages",i.maximumPages);const u=i.initialPages??Math.min(32,i.maximumPages);if(M("backing.wasm.initialPages",u),u>i.maximumPages)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.backing.wasm.initialPages (${u}) exceeds maximumPages (${i.maximumPages})`);if(n!==void 0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.maxBytes (${T(n)}) cannot be given beside memory.backing.wasm.maximumPages (${i.maximumPages} pages = ${T(i.maximumPages*B)}), the Memory's page maximum IS the ceiling. Declare it once, in pages.`);const D=new WebAssembly.Memory({initial:u,maximum:i.maximumPages,shared:!0}),g=i.maximumPages*B;return t===void 0&&(c=p(Math.max(g-d,0))),{source:"wasm",sizing:I,allocator:H.wasmMemoryAllocator(D),columnCapacity:_,entityIndexCapacity:c,capBytes:g,storeBase:d,intentLabel:`engine-constructed WebAssembly.Memory (max ${i.maximumPages} pages)`,budgetEntities:t??null,derivation:[`cap = ${i.maximumPages} pages × 64 KiB = ${T(g)} (Memory maximum)`,`initial = ${u} pages (${i.initialPages!==void 0?"declared":"default"})`,`storeBase = ${T(d)}, the module owns every byte below it`,...f,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${C} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:D}}if(typeof r=="object"&&r.allocator!==void 0){if(r.allocator.isInPlace!==!0)throw new E(A.INVALID_MEMORY_OPTIONS,"memory.backing.allocator must declare `isInPlace: true`. A live Store's flush loops hoist entity-index views across grows, so an allocator that is not in-place (DEFAULT_SAB_ALLOCATOR, for example) corrupts the entity→row mapping. Use growableSabAllocator, fixedSabAllocator or wasmMemoryAllocator. An allocator that is not in-place is for snapshot and test sizing only.");const i=n??null;return t===void 0&&i!==null&&(c=p(i)),{source:"allocator",sizing:I,allocator:r.allocator,columnCapacity:_,entityIndexCapacity:c,capBytes:i,storeBase:d,intentLabel:i!==null?`custom in-place allocator (declared cap ${T(i)})`:"custom in-place allocator",budgetEntities:t??null,derivation:["backing = caller allocator (is_in_place ✓ checked at construction)",i!==null?`cap = ${T(i)} (caller-declared; the allocator owns the real ceiling)`:"cap = allocator-owned (no maxBytes declared)",...f,t!==void 0?"entityIndex sized from the entity count above":i!==null?`entityIndex = floor_pow2(cap/4 ÷ ${C} B) = ${c} slots`:`entityIndex = ${c} slots (default, no entity count and no declared cap)`],wasmMemory:null}}if(r==="shared"){const i=n??l??X;return S(i,"shared",H.growableSabAllocator(i),`shared SharedArrayBuffer backing (${T(i)} growable cap, needs COOP and COEP)`,[`backing = growable_sab_allocator(${T(i)}), growable SharedArrayBuffer (is_in_place ✓), needs cross-origin isolation`,"enables worker offload + a WASM compute backend (transferable SharedArrayBuffer)"])}if(r!=="heap")throw new E(A.INVALID_MEMORY_OPTIONS,`memory.backing must be "heap", "shared", { wasm }, or { allocator } (got ${JSON.stringify(r)})`);const a=n??l??X;return S(a,"heap",H.heapArrayBufferAllocator(a),I==="default"?`default sizing (${T(a)} reserved cap)`:t!==void 0?`budget of ${t} entities`:`explicit cap of ${T(a)}`,[`backing = heap_arraybuffer_allocator(${T(a)}), fixed ArrayBuffer reserved at the cap, no SAB and no COOP+COEP (is_in_place ✓)`,"trade-off: no worker offload and no WASM backend (both need a transferable SharedArrayBuffer)"])}function Cn(e,t){return{def:e,values:t}}function J(e,t){switch(t.kind){case"spawn":{const n=e.commands.spawn();for(const o of t.components)e.commands.add(n,o.def,o.values);return t.onSpawned?.(n),n}case"despawn":e.commands.despawn(t.eid);return;case"add_component":e.commands.add(t.eid,t.def,t.values);return;case"remove_component":e.commands.remove(t.eid,t.def);return;case"set_field":e.setField(t.eid,t.def,t.field,t.value);return;case"disable":e.commands.disable(t.eid);return;case"enable":e.commands.enable(t.eid);return;default:return et(t,"HostCommand kind")}}class Qe{_pending=[];spawn(t,n){return this._pending.push({kind:"spawn",components:t,onSpawned:n}),this}despawn(t){return this._pending.push({kind:"despawn",eid:t}),this}add(t,n,o){return this._pending.push({kind:"add_component",eid:t,def:n,values:o}),this}remove(t,n){return this._pending.push({kind:"remove_component",eid:t,def:n}),this}setField(t,n,o,r){return this._pending.push({kind:"set_field",eid:t,def:n,field:o,value:r}),this}disable(t){return this._pending.push({kind:"disable",eid:t}),this}enable(t){return this._pending.push({kind:"enable",eid:t}),this}push(t){return this._pending.push(t),this}get pendingCount(){return this._pending.length}clear(){const t=this._pending.length;return this._pending.length=0,t}drain(t,n){const o=this._pending.length;if(o===0)return 0;if(n===void 0)for(let r=0;r<o;r++)J(t,this._pending[r]);else for(let r=0;r<o;r++){const s=this._pending[r];n(s),J(t,s)}return this._pending.splice(0,o),o}}const Se=U-1;function Pn(e){if(e===Ie)throw new w("cannot bind opCode 0 (reserved as the command-ring empty-slot marker)");if(e<0||e>255||!Number.isInteger(e))throw new w(`command opCode must be a u8 in [1, 255] (got ${e})`)}function ne(e){const t=new Uint8Array(Se);return new DataView(t.buffer).setUint32(0,e,!0),t}function oe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)}function Mn(e,t){return{encode(n){if(n.kind!=="set_field")throw new w(`ringSetFieldCodec encodes a "set_field" command (got "${n.kind}")`);const o=new Uint8Array(Se),r=new DataView(o.buffer);return r.setUint32(0,n.eid,!0),r.setFloat64(4,n.value,!0),o},decode(n){const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return{kind:"set_field",eid:o.getUint32(0,!0),def:e,field:t,value:o.getFloat64(4,!0)}}}}function Un(){return{encode(e){if(e.kind!=="despawn")throw new w(`ringDespawnCodec encodes a "despawn" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"despawn",eid:oe(e)})}}function vn(){return{encode(e){if(e.kind!=="disable")throw new w(`ringDisableCodec encodes a "disable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"disable",eid:oe(e)})}}function Bn(){return{encode(e){if(e.kind!=="enable")throw new w(`ringEnableCodec encodes an "enable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"enable",eid:oe(e)})}}function Yn(e){return{encode(t){if(t.kind!=="remove_component")throw new w(`ringRemoveComponentCodec encodes a "remove_component" command (got "${t.kind}")`);return ne(t.eid)},decode:t=>({kind:"remove_component",eid:oe(t),def:e})}}class $n{_appliers=new Map;on(t,n){return Pn(t),this._appliers.set(t,n),this}off(t){return this._appliers.delete(t)}onCommand(t,n){return this.on(t,(o,r,s)=>{const d=n.decode(r);s?.(d),J(o,d)})}drain(t,n,o,r){return Yt(n,o,(s,d)=>{const _=this._appliers.get(s);_!==void 0&&_(t,d,r)})}}const le=new WeakMap;function Fn(e,t){const n=le.get(t);if(n===void 0)return!1;for(const o of n)e.removeSystem(o);return le.delete(t),t.clear(),!0}function xn(e,t){const n=new Qe,o=[];le.set(n,o);const r=t?.name??"host_command_apply",s=t?.ring,d=t?.recorder,_=d?.record,c=t?.schedules??[z.PRE_STARTUP,z.PRE_UPDATE];if(d!==void 0){for(const l of c)if(be(l)==="fixed")throw new E(A.INVALID_RECORDER_SCHEDULE,`installHostCommandSeam: a recorder cannot drain at ${Ce(l)}, a phase of the fixed loop. It would log the fixed timestep and not the host update dt, so a replay would diverge. Drain at a phase of the update loop instead.`)}for(const l of c){const f=be(l)!=="startup",p=e.registerSystem({name:`${r}:${Ce(l)}`,reads:[],writes:[],exclusive:!0,fn:(I,y)=>{if(d!==void 0&&f&&d.openTick(I.ecsTick,y),n.drain(I,_),s!==void 0){const S=e.columnStore,a=S.header.commandRingOff;a!==0&&s.drain(I,S.view,a,_)}}});e.addSystems(l,p),o.push(p)}return n}exports.ACTION_RING_DEFAULT_CAPACITY_SLOTS=qt;exports.ANY_RELATION=_e;exports.ARCHETYPE_DESCRIPTOR_HEADER_BYTES=fe;exports.ARCHETYPE_DESCRIPTOR_OFFSETS=b;exports.BUDGET_DEFAULT_ARCHETYPES=je;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=ze;exports.BUDGET_GROWTH_HEADROOM=de;exports.COLUMN_DESCRIPTOR_BYTES=me;exports.COMMAND_RING_DEFAULT_CAPACITY_SLOTS=bt;exports.COMPONENT_MASK_WORDS=Ae;exports.DEFAULT_COLUMN_CAPACITY=Ye;exports.DEFAULT_ECS_CAP_BYTES=X;exports.DEFAULT_FIXED_TIMESTEP=dt;exports.DEFAULT_MAX_FIXED_STEPS=lt;exports.ECSError=E;exports.ECSRestoreError=nt;exports.ECS_ERROR=A;exports.EMPTY_VALUES=it;exports.ENTITY_INDEX_DEFAULT_CAPACITY=ce;exports.ENTITY_INDEX_HEADER_OFFSETS=V;exports.EVENT_RING_DEFAULT_CAPACITY_SLOTS=Wt;exports.HASH_GOLDEN_RATIO=st;exports.HASH_SECONDARY_PRIME=at;exports.HOST_COMMAND_PAYLOAD_BYTES=Se;exports.HostCommandDispatcher=$n;exports.HostCommandQueue=Qe;exports.INDEX_BITS=$;exports.INDEX_MASK=ue;exports.INITIAL_GENERATION=ct;exports.MAX_ENTITY_ID=ft;exports.MAX_GENERATION=Z;exports.MAX_INDEX=$e;exports.MAX_LIVE_GENERATION=mt;exports.NO_SWAP=rt;exports.RETIRED_GENERATION=At;exports.SCHEDULE=z;exports.STARTUP_DELTA_TIME=ut;exports.STORE_DESCRIPTOR_COMPONENT_LIMIT=Ot;exports.STORE_HEADER_OFFSETS=N;exports.STORE_MAX_BYTE_OFFSET=te;exports.STORE_PREFIX_REGIONS=G;exports.StoreLayoutOverflowError=Ne;exports.TYPED_ARRAY_TAG_TO_TYPE_TAG=yt;exports.TYPE_TAG=m;exports.TYPE_TAG_STRIDE=ae;exports.UNASSIGNED=ot;exports.WASM_STORE_BASE_BYTES=q;exports.accessCheck=gn;exports.alignUp=he;exports.applyHostCommand=J;exports.archetypeDescriptorBytes=Te;exports.columnKey=We;exports.componentDebugName=Nt;exports.componentLabel=Fe;exports.createArchetypeViews=Ke;exports.createColumnStore=Tn;exports.createEntityId=Tt;exports.createEntityIndexViews=Gt;exports.entityNotAliveError=It;exports.findRegionEntry=un;exports.findRegionOffset=ln;exports.getEntityGeneration=se;exports.getEntityIndex=ie;exports.installHostCommandSeam=xn;exports.isColumnStoreInternal=fn;exports.isEcsError=tt;exports.pluginInstalledTwiceError=Dn;exports.pluginMissingError=yn;exports.readHeaderRegionTable=dn;exports.resolveECSMemory=bn;exports.ringDespawnCodec=Un;exports.ringDisableCodec=vn;exports.ringEnableCodec=Bn;exports.ringRemoveComponentCodec=Yn;exports.ringSetFieldCodec=Mn;exports.setComponentDebugName=pt;exports.spawnEntry=Cn;exports.storeBaseAbove=On;exports.uninstallHostCommandSeam=Fn;exports.unsafeCast=Ze;exports.usedDescriptorBytes=Xe;exports.validateAndCast=Je;exports.writeArchetypeDescriptor=xe;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const H=require("./shared-Dk-pACZT.cjs");class Ye extends Error{constructor(t,n,o){super(t),this.isOperational=n,this.context=o,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,this.constructor)}}var ue=(e=>(e.ASSERTION_FAIL_CONDITION="ASSERTION_FAIL_CONDITION",e.VALIDATION_FAIL_CONDITION="VALIDATION_FAIL_CONDITION",e.ASSERTION_FAIL_NON_NULLABLE="ASSERTION_FAIL_NON_NULLABLE",e.ASSERTION_FAIL_UNREACHABLE="ASSERTION_FAIL_UNREACHABLE",e))(ue||{});class Fe extends Ye{constructor(t,n,o){super(n,!1,o),this.category=t,this.name="AssertionError"}}const Ze=e=>Number.isInteger(e)&&e>=0;function et(e,t,n){if(!t(e))throw new Fe(ue.VALIDATION_FAIL_CONDITION,`Expected value to meet validation: ${n}`);return e}function tt(e){return e}function nt(e,t){throw new Fe(ue.ASSERTION_FAIL_UNREACHABLE,`Unhandled ${t}: ${String(e)}`)}var f=(e=>(e.EID_MAX_INDEX_OVERFLOW="EID_MAX_INDEX_OVERFLOW",e.EID_MAX_GEN_OVERFLOW="EID_MAX_GEN_OVERFLOW",e.COMPONENT_NOT_REGISTERED="COMPONENT_NOT_REGISTERED",e.COMPONENT_LIMIT_EXCEEDED="COMPONENT_LIMIT_EXCEEDED",e.ENTITY_NOT_ALIVE="ENTITY_NOT_ALIVE",e.CIRCULAR_SYSTEM_DEPENDENCY="CIRCULAR_SYSTEM_DEPENDENCY",e.DUPLICATE_SYSTEM="DUPLICATE_SYSTEM",e.UNKNOWN_PHASE="UNKNOWN_PHASE",e.CIRCULAR_PHASE_DEPENDENCY="CIRCULAR_PHASE_DEPENDENCY",e.ARCHETYPE_NOT_FOUND="ARCHETYPE_NOT_FOUND",e.RESOURCE_NOT_REGISTERED="RESOURCE_NOT_REGISTERED",e.RESOURCE_ALREADY_REGISTERED="RESOURCE_ALREADY_REGISTERED",e.EVENT_ALREADY_REGISTERED="EVENT_ALREADY_REGISTERED",e.EVENT_NOT_REGISTERED="EVENT_NOT_REGISTERED",e.INVALID_EVENT_ID="INVALID_EVENT_ID",e.FIELD_NOT_REGISTERED="FIELD_NOT_REGISTERED",e.RELATION_NOT_REGISTERED="RELATION_NOT_REGISTERED",e.RELATION_MODE_INVALID="RELATION_MODE_INVALID",e.RELATION_MODE_MISMATCH="RELATION_MODE_MISMATCH",e.RELATION_CYCLE="RELATION_CYCLE",e.SPARSE_CACHE_KEY_OVERFLOW="SPARSE_CACHE_KEY_OVERFLOW",e.SPARSE_QUERY_DENSE_PATH="SPARSE_QUERY_DENSE_PATH",e.QUERY_TERM_DENSE_PATH="QUERY_TERM_DENSE_PATH",e.HIERARCHY_ALREADY_SET="HIERARCHY_ALREADY_SET",e.HIERARCHY_INVALID_MAX_DEPTH="HIERARCHY_INVALID_MAX_DEPTH",e.OBSERVER_NON_CONVERGENT="OBSERVER_NON_CONVERGENT",e.OBSERVER_INVALID_CONFIG="OBSERVER_INVALID_CONFIG",e.OBSERVER_ONSET_EMIT="OBSERVER_ONSET_EMIT",e.ROW_TICKS_NOT_TRACKED="ROW_TICKS_NOT_TRACKED",e.INVALID_FIXED_TIMESTEP="INVALID_FIXED_TIMESTEP",e.INVALID_MAX_FIXED_STEPS="INVALID_MAX_FIXED_STEPS",e.INVALID_RECORDER_SCHEDULE="INVALID_RECORDER_SCHEDULE",e.EMPTY_ARCHETYPE_MATERIALIZE="EMPTY_ARCHETYPE_MATERIALIZE",e.COMPONENT_INDEX_INVARIANT="COMPONENT_INDEX_INVARIANT",e.ARCHETYPE_ROW_INVARIANT="ARCHETYPE_ROW_INVARIANT",e.OPTIONAL_TERM_NOT_DECLARED="OPTIONAL_TERM_NOT_DECLARED",e.QUERY_ACCESS_UNDECLARED="QUERY_ACCESS_UNDECLARED",e.ACCESS_UNDECLARED="ACCESS_UNDECLARED",e.QUERY_NOT_SINGLETON="QUERY_NOT_SINGLETON",e.INVALID_RUN_CONDITION="INVALID_RUN_CONDITION",e.SYSTEM_FN_ARITY="SYSTEM_FN_ARITY",e.INVALID_SYSTEM_ID="INVALID_SYSTEM_ID",e.PARTITION_APPEND_NEEDS_ENTITY_ROW="PARTITION_APPEND_NEEDS_ENTITY_ROW",e.PARTITION_BULK_INTO_DISABLED="PARTITION_BULK_INTO_DISABLED",e.STRUCTURAL_DURING_ITERATION="STRUCTURAL_DURING_ITERATION",e.BACKEND_ALREADY_ATTACHED="BACKEND_ALREADY_ATTACHED",e.DETERMINISM_DISABLED="DETERMINISM_DISABLED",e.SNAPSHOT_RESTORE_FAILED="SNAPSHOT_RESTORE_FAILED",e.NON_DETERMINISTIC_COLUMN_TYPE="NON_DETERMINISTIC_COLUMN_TYPE",e.INVALID_MEMORY_OPTIONS="INVALID_MEMORY_OPTIONS",e.STORE_CAP_EXCEEDED="STORE_CAP_EXCEEDED",e.REGION_NOT_DECLARED="REGION_NOT_DECLARED",e.COMMAND_LOG_TAG_COLLISION="COMMAND_LOG_TAG_COLLISION",e.INVALID_FRAME_STEP="INVALID_FRAME_STEP",e.INVALID_TEMPLATE="INVALID_TEMPLATE",e.PLUGIN_NOT_INSTALLED="PLUGIN_NOT_INSTALLED",e.PLUGIN_ALREADY_INSTALLED="PLUGIN_ALREADY_INSTALLED",e.PLUGIN_SURFACE_COLLISION="PLUGIN_SURFACE_COLLISION",e.WORKERS_ATTACHED="WORKERS_ATTACHED",e.WORKERS_NEED_SHARED_BACKING="WORKERS_NEED_SHARED_BACKING",e.WORKERS_HOST_CANNOT_PARK="WORKERS_HOST_CANNOT_PARK",e.WORKERS_COUNT_INVALID="WORKERS_COUNT_INVALID",e.WORKERS_ENTRY_UNREACHABLE="WORKERS_ENTRY_UNREACHABLE",e.PARALLEL_ACCESS="PARALLEL_ACCESS",e.PARALLEL_KERNEL_MODULE="PARALLEL_KERNEL_MODULE",e.PARALLEL_KERNEL_FAILED="PARALLEL_KERNEL_FAILED",e))(f||{});class E extends Ye{constructor(t,n,o){super(n??t,!0,o),this.category=t,this.name="ECSError"}}function ot(e){return e instanceof E}class rt extends E{constructor(t){super("SNAPSHOT_RESTORE_FAILED",t),this.name="ECSRestoreError"}}const it=-1,st=-1,at=Object.freeze(Object.create(null)),ct=2654435769,_t=1367130551,xe=1024,dt=0,lt=31,ut=1/60,Et=4,ft=0,Y=20,Ee=(1<<Y)-1,fe=Ee,mt=lt-Y,k=(1<<mt)-1,At=k,Tt=k-1,It=k<<Y|fe,ht=(e,t)=>{{if(e<0||e>fe)throw new E(f.EID_MAX_INDEX_OVERFLOW);if(t<0||t>k)throw new E(f.EID_MAX_GEN_OVERFLOW)}return t<<Y|e},ie=e=>e&Ee,se=e=>e>>Y,pt=(e,t,n)=>new E(f.ENTITY_NOT_ALIVE,`${e}: entity ${t} (index ${ie(t)}, generation ${se(t)}) is not alive${n?`, ${n}`:""}. It was destroyed, never created, or the handle is stale. Guard with isAlive() first`,{entity:t,index:ie(t),generation:se(t),op:e}),me=new WeakMap;function Nt(e,t){me.set(e,t)}function gt(e){return me.get(e)}function He(e){const t=me.get(e);return t!==void 0?`'${t}' (component ${e.id})`:`component ${e.id}`}const St=827148627,yt=1,Ae=4,Dt=52,p={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},W=12,P={region_id:0,byte_offset:4,byte_length:8},Te=16,x={component_id:0,field_id:2,type_tag:4,byte_off:8,stride:12},Ie=40,C={archetype_id:0,component_mask:4,row_count:20,row_capacity:24,column_count:28,enabled_count:32,entity_ids_off:36},A={u8:0,i8:1,u16:2,i16:3,u32:4,i32:5,f32:6,f64:7},ae=Object.freeze({[A.u8]:1,[A.i8]:1,[A.u16]:2,[A.i16]:2,[A.u32]:4,[A.i32]:4,[A.f32]:4,[A.f64]:8}),Ot={u8:A.u8,i8:A.i8,u16:A.u16,i16:A.i16,u32:A.u32,i32:A.i32,f32:A.f32,f64:A.f64};function Rt(e,t,n){e.setUint16(t+x.component_id,n.componentId,!0),e.setUint16(t+x.field_id,n.fieldId,!0),e.setUint8(t+x.type_tag,n.typeTag),e.setUint32(t+x.byte_off,n.byteOff,!0),e.setUint16(t+x.stride,n.stride,!0)}const wt=Ae*32;function he(e,t=Ie){return t+e*Te}function Ve(e,t,n){e.setUint32(t+C.archetype_id,n.archetypeId,!0);for(let r=0;r<Ae;r++)e.setUint32(t+C.component_mask+r*4,n.componentMask[r]??0,!0);e.setUint32(t+C.row_count,n.rowCount,!0),e.setUint32(t+C.row_capacity,n.rowCapacity,!0),e.setUint32(t+C.column_count,n.columns.length,!0),e.setUint32(t+C.enabled_count,n.enabledCount,!0),e.setUint32(t+C.entity_ids_off,0,!0);let o=t+Ie;for(let r=0;r<n.columns.length;r++)Rt(e,o,n.columns[r]),o+=Te;return o}function Lt(e,t,n){let o=t;for(let r=0;r<n.length;r++)o=Ve(e,o,n[r]);return o}function Ct(e){let t=0;for(let n=0;n<e.length;n++)t+=he(e[n].columns.length);return t}function bt(e,t){e.setUint32(p.magic,t.magic,!0),e.setUint32(p.sim_abi_version,t.simAbiVersion,!0),e.setUint32(p.view_stamp,t.viewStamp,!0),e.setUint32(p.capacity,t.capacity,!0),e.setUint32(p.archetype_count,t.archetypeCount,!0),e.setUint32(p.layout_descriptor_off,t.layoutDescriptorOff,!0),e.setUint32(p.command_ring_off,t.commandRingOff,!0),e.setUint32(p.action_ring_off,t.actionRingOff,!0),e.setUint32(p.entity_index_off,t.entityIndexOff,!0),e.setUint32(p.event_ring_off,t.eventRingOff,!0),e.setUint32(p.region_table_off,t.regionTableOff,!0),e.setUint32(p.region_table_count,t.regionTableCount,!0),e.setUint32(p.bindings_off,t.bindingsOff,!0)}const Ge=16,v=16,Pt=256,O={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},pe=0;function De(e){return Ge+e*v}function Mt(e){return e>0&&(e&e-1)===0}class w extends Error{constructor(t){super(t),this.name="CommandRingError"}}function vt(e,t,n){if(!Mt(n))throw new w(`command ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+O.write_head,0,!0),e.setUint32(t+O.read_head,0,!0),e.setUint32(t+O.capacity_slots,n,!0),e.setUint32(t+O.overflow_flag,0,!0)}function Ut(e,t){return e.getUint32(t+O.write_head,!0)}function Bt(e,t){return e.getUint32(t+O.read_head,!0)}function $t(e,t){return e.getUint32(t+O.capacity_slots,!0)}function Yt(e,t,n){if(n.byteLength!==v-1)throw new w(`outPayload must be ${v-1} bytes (got ${n.byteLength})`);const o=Ut(e,t),r=Bt(e,t);if(o===r)return pe;const i=$t(e,t),d=r&i-1,_=t+Ge+d*v,c=e.getUint8(_),l=new Uint8Array(e.buffer,e.byteOffset+_+1,v-1);return n.set(l),e.setUint32(t+O.read_head,r+1>>>0,!0),c}function Ft(e,t,n){let o=0;const r=new Uint8Array(v-1);for(;;){const i=Yt(e,t,r);if(i===pe)return o;n(i,r.slice()),o++}}const ee=16,b=12,G={length:0,capacity:4},ce=1<<20;function Oe(e){if(e<0||!Number.isInteger(e))throw new ke(`entity index capacity must be a non-negative integer (got ${e})`);return ee+e*b}function xt(e){return e+ee}function Ht(e,t){return e+ee+t*4}function Vt(e,t){return e+ee+t*8}class ke extends Error{constructor(t){super(t),this.name="EntityIndexError"}}function Gt(e,t,n){if(n<0||!Number.isInteger(n))throw new ke(`entity index capacity must be a non-negative integer (got ${n})`);e.setUint32(t+G.length,0,!0),e.setUint32(t+G.capacity,n,!0)}function kt(e,t,n){return{generations:new Int32Array(e,xt(t),n),archetypes:new Int32Array(e,Ht(t,n),n),rows:new Int32Array(e,Vt(t,n),n)}}const Wt=16,Xt=16,Kt=256,U={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12};function Re(e){return Wt+e*Xt}function zt(e){return e>0&&(e&e-1)===0}class jt extends Error{constructor(t){super(t),this.name="EventRingError"}}function Qt(e,t,n){if(!zt(n))throw new jt(`event ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+U.write_head,0,!0),e.setUint32(t+U.read_head,0,!0),e.setUint32(t+U.capacity_slots,n,!0),e.setUint32(t+U.overflow_flag,0,!0)}const qt=16,Jt=16,Zt=256,$={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},en=$.write_head/4,tn=$.read_head/4,nn=$.capacity_slots/4,on=$.overflow_flag/4;function rn(e,t){return new Int32Array(e.buffer,e.byteOffset+t,4)}function we(e){return qt+e*Jt}function sn(e){return e>0&&(e&e-1)===0}class Le extends Error{constructor(t){super(t),this.name="ActionRingError"}}function an(e,t,n){if(!sn(n))throw new Le(`action ring capacity_slots must be a positive power of two (got ${n})`);if((e.byteOffset+t)%4!==0)throw new Le(`action ring header must be 4-byte aligned for Atomics (view.byteOffset ${e.byteOffset} + ringOff ${t} is not a multiple of 4)`);const o=rn(e,t);Atomics.store(o,en,0),Atomics.store(o,tn,0),Atomics.store(o,nn,n),Atomics.store(o,on,0)}const V=[{name:"command_ring",headerOff:"command_ring_off",sizeFromOptions:e=>e.commandRingCapacitySlots!==void 0?De(e.commandRingCapacitySlots):0,init:(e,t,n)=>vt(e,t,n.commandRingCapacitySlots),regionBytes:(e,t)=>De(e.getUint32(t+O.capacity_slots,!0)),readOptions:(e,t,n)=>{n.commandRingCapacitySlots=e.getUint32(t+O.capacity_slots,!0)}},{name:"entity_index",headerOff:"entity_index_off",sizeFromOptions:e=>e.entityIndexCapacity!==void 0?Oe(e.entityIndexCapacity):0,init:(e,t,n)=>Gt(e,t,n.entityIndexCapacity),regionBytes:(e,t)=>Oe(e.getUint32(t+G.capacity,!0)),readOptions:(e,t,n)=>{n.entityIndexCapacity=e.getUint32(t+G.capacity,!0)}},{name:"event_ring",headerOff:"event_ring_off",sizeFromOptions:e=>e.eventRingCapacitySlots!==void 0?Re(e.eventRingCapacitySlots):0,init:(e,t,n)=>Qt(e,t,n.eventRingCapacitySlots),regionBytes:(e,t)=>Re(e.getUint32(t+U.capacity_slots,!0)),readOptions:(e,t,n)=>{n.eventRingCapacitySlots=e.getUint32(t+U.capacity_slots,!0)}},{name:"action_ring",headerOff:"action_ring_off",sizeFromOptions:e=>e.actionRingCapacitySlots!==void 0?we(e.actionRingCapacitySlots):0,init:(e,t,n)=>an(e,t,n.actionRingCapacitySlots),regionBytes:(e,t)=>we(e.getUint32(t+$.capacity_slots,!0)),readOptions:(e,t,n)=>{n.actionRingCapacitySlots=e.getUint32(t+$.capacity_slots,!0)}}];class X extends Error{constructor(t){super(t),this.name="RegionRegistryError"}}function We(e){return e*W}function Ne(e,t){const n=e.getUint32(p.region_table_count,!0);if(t+We(n)>e.byteLength)throw new X(`region table of ${n} entries at byte ${t} overruns the buffer (${e.byteLength} bytes)`);return n}function cn(e){const t=new Set;for(let n=0;n<e.length;n++){const o=e[n];if(!Number.isInteger(o.id)||o.id<=0)throw new X(`region "${o.name}" has invalid id ${o.id}, region ids must be positive integers (0 is the absent sentinel)`);if(t.has(o.id))throw new X(`duplicate region id ${o.id} (region "${o.name}"), ids must be distinct within a consumer's region set`);if(t.add(o.id),!Number.isInteger(o.bytes)||o.bytes<=0)throw new X(`region "${o.name}" (id ${o.id}) has invalid byte size ${o.bytes}, must be a positive integer`)}}function _n(e,t,n){e.setUint32(t+P.region_id,n.regionId,!0),e.setUint32(t+P.byte_offset,n.byteOffset,!0),e.setUint32(t+P.byte_length,n.byteLength,!0)}function Xe(e,t){return{regionId:e.getUint32(t+P.region_id,!0),byteOffset:e.getUint32(t+P.byte_offset,!0),byteLength:e.getUint32(t+P.byte_length,!0)}}function dn(e,t,n){for(let o=0;o<n.length;o++)_n(e,t+o*W,n[o])}function ln(e,t,n){const o=new Array(n);for(let r=0;r<n;r++)o[r]=Xe(e,t+r*W);return o}function un(e){const t=e.getUint32(p.region_table_off,!0);if(t===0)return[];const n=Ne(e,t);return ln(e,t,n)}function En(e,t){const n=e.getUint32(p.region_table_off,!0);if(n===0)return 0;const o=Ne(e,n);for(let r=0;r<o;r++){const i=n+r*W;if(e.getUint32(i+P.region_id,!0)===t)return e.getUint32(i+P.byte_offset,!0)}return 0}function fn(e,t){const n=e.getUint32(p.region_table_off,!0);if(n===0)return null;const o=Ne(e,n);for(let r=0;r<o;r++){const i=Xe(e,n+r*W);if(i.regionId===t)return i}return null}function Ke(e,t){return e<<16|t}const te=2**31;class ge extends Error{constructor(t){super(`SAB column layout offset ${t} reaches or exceeds the 2³¹ (${te}-byte) ceiling. Past 2 GiB the signed-32-bit bitwise alignment math wraps to a negative or misaligned offset. This is a structural limit independent of the allocator cap, so a single store cannot back more than 2 GiB of column data.`),this.name="StoreLayoutOverflowError"}}function Se(e,t){if(e+t>te)throw new ge(e);return e+(t-1)&~(t-1)}function mn(e,t,n,o,r){const i=t+o;switch(n){case A.u8:return new Uint8Array(e,i,r);case A.i8:return new Int8Array(e,i,r);case A.u16:return new Uint16Array(e,i,r);case A.i16:return new Int16Array(e,i,r);case A.u32:return new Uint32Array(e,i,r);case A.i32:return new Int32Array(e,i,r);case A.f32:return new Float32Array(e,i,r);case A.f64:return new Float64Array(e,i,r)}}function An(e,t,n=0){const r=Ct(e.map(_=>({archetypeId:_.archetypeId,componentMask:_.componentMask,rowCount:0,enabledCount:0,rowCapacity:_.rowCapacity,columns:_.columns.map(c=>({componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:0,stride:ae[c.typeTag]}))})))+n;let i=t+r;const d=new Array(e.length);for(let _=0;_<e.length;_++){const c=e[_],l=new Array(c.columns.length);for(let m=0;m<c.columns.length;m++){const T=c.columns[m],h=ae[T.typeTag];i=Se(i,h),l[m]={componentId:T.componentId,fieldId:T.fieldId,typeTag:T.typeTag,byteOff:i,stride:h},i+=h*c.rowCapacity}d[_]={archetypeId:c.archetypeId,componentMask:c.componentMask,rowCount:0,enabledCount:0,rowCapacity:c.rowCapacity,columns:l}}if(i>te)throw new ge(i);return{descriptors:d,totalBytes:i,regionBytes:r}}const z=16;function Tn(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`createColumnStore: storeBase must be an integer >= 0, got ${e}`);if(e%z!==0)throw new RangeError(`createColumnStore: storeBase must be a multiple of ${z}, got ${e}`)}function ze(e){let t=0;for(const[,n]of e)t+=he(n.columnsInOrder.length);return t}function In(e){const t=e;return typeof t._regionBytes=="number"&&typeof t._allocator=="function"&&typeof t._reservedDescriptorBytes=="number"}function hn(e,t=H.DEFAULT_SAB_ALLOCATOR,n={}){const o=n.storeBase??0;Tn(o);const r={};let i=Dt;for(let N=0;N<V.length;N++){const R=V[N],F=R.sizeFromOptions(n);r[R.headerOff]=F===0?0:i,i+=F}const d=n.regions??[];cn(d);const _=d.length,c=_>0?i:0;i+=We(_);const l=new Array(_);for(let N=0;N<d.length;N++){const R=d[N];l[N]={regionId:R.id,byteOffset:i,byteLength:R.bytes},i+=R.bytes}const m=n.bindingsRegionBytes??0,T=m===0?0:i;i+=m;const h=i,{descriptors:y,totalBytes:g,regionBytes:a}=An(e,h,n.reservedDescriptorBytes??0),s=t(o+g),u=new DataView(s,o),D={magic:St,simAbiVersion:yt,viewStamp:0,capacity:g,archetypeCount:e.length,layoutDescriptorOff:h,bindingsOff:T,regionTableOff:c,regionTableCount:_,commandRingOff:r.command_ring_off,entityIndexOff:r.entity_index_off,eventRingOff:r.event_ring_off,actionRingOff:r.action_ring_off};bt(u,D),m>0&&new Uint8Array(s,o+T,m).fill(0);for(let N=0;N<V.length;N++){const R=V[N],F=r[R.headerOff];F!==0&&R.init(u,F,n)}c!==0&&dn(u,c,l);for(let N=0;N<d.length;N++)d[N].init(u,l[N].byteOffset);Lt(u,h,y);const S=je(s,o,y);return{buffer:s,view:u,header:D,storeBase:o,archetypes:S,_regionBytes:a,_allocator:t,_reservedDescriptorBytes:n.reservedDescriptorBytes??0,_usedDescriptorBytes:ze(S)}}function je(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const i=n[r],d=new Array(i.columns.length),_=new Map;for(let c=0;c<i.columns.length;c++){const l=i.columns[c],m={componentId:l.componentId,fieldId:l.fieldId,typeTag:l.typeTag,byteOff:l.byteOff,stride:l.stride,view:mn(e,t,l.typeTag,l.byteOff,i.rowCapacity)};d[c]=m,_.set(Ke(l.componentId,l.fieldId),m)}o.set(i.archetypeId,{archetypeId:i.archetypeId,componentMask:i.componentMask,rowCapacity:i.rowCapacity,columns:_,columnsInOrder:d})}return o}const _e=2147483647,Ce=new WeakMap;function pn(e){const t=new Set,n=new Set,o=new Set,r=new Set,i=new Set,d=new Set,_=new Set,c=new Set,l=new Set,m=new Set;for(let a=0;a<e.writes.length;a++){const s=e.writes[a].id;n.add(s),t.add(s),o.add(s)}for(let a=0;a<e.reads.length;a++)t.add(e.reads[a].id);for(let a=0;a<e.spawns.length;a++){const s=e.spawns[a];for(let u=0;u<s.length;u++)o.add(s[u].id)}for(let a=0;a<e.transitions.length;a++){const s=e.transitions[a];if(s.add)for(let u=0;u<s.add.length;u++)o.add(s.add[u].id);if(s.remove)for(let u=0;u<s.remove.length;u++)r.add(s.remove[u].id)}for(let a=0;a<e.despawns.length;a++)r.add(e.despawns[a].id);for(let a=0;a<e.resourceReads.length;a++)i.add(e.resourceReads[a]);for(let a=0;a<e.resourceWrites.length;a++){const s=e.resourceWrites[a];d.add(s),i.add(s)}const T=e.sparseWrites;if(T!==void 0)for(let a=0;a<T.length;a++){const s=T[a];c.add(s),_.add(s)}const h=e.sparseReads;if(h!==void 0)for(let a=0;a<h.length;a++)_.add(h[a]);const y=e.relationWrites;if(y!==void 0)for(let a=0;a<y.length;a++){const s=y[a];m.add(s),l.add(s)}const g=e.relationReads;if(g!==void 0)for(let a=0;a<g.length;a++)l.add(g[a]);return{reads:t,writes:n,addAllowed:o,removeAllowed:r,hasDespawns:e.despawns.length>0,resourceReads:i,resourceWrites:d,sparseReads:_,sparseWrites:c,relationReads:l,relationWrites:m}}function Nn(e){const t=Ce.get(e);if(t!==void 0)return t;const n=pn(e);return Ce.set(e,n),n}const be=new WeakMap;function gn(e){const t=new Set,n=new Set;if(e.reads!==void 0)for(let o=0;o<e.reads.length;o++)t.add(e.reads[o].id);if(e.resourceReads!==void 0)for(let o=0;o<e.resourceReads.length;o++)n.add(e.resourceReads[o]);return{reads:t,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 Sn(e){const t=be.get(e);if(t!==void 0)return t;const n=gn(e);return be.set(e,n),n}class yn{_activeSystem=null;_activeSets=null;_activeName=null;_exclusive=!1;enter(t){this._activeSystem=t,this._activeName=t.name??`system_${t.id}`,this._exclusive=t.exclusive===!0,this._activeSets=this._exclusive?null:Nn(t)}enterCondition(t){this._activeSystem=null,this._activeName=t.name,this._activeSets=Sn(t)}leave(){this._activeSystem=null,this._activeName=null,this._activeSets=null,this._exclusive=!1}isActive(){return this._activeSets!==null||this._exclusive}current(){return this._activeSystem}assertRead(t){this._activeSets!==null&&(this._activeSets.reads.has(t.id)||this._failComponent("read",t,"reads"))}assertWrite(t){this._activeSets!==null&&(this._activeSets.writes.has(t.id)||this._failComponent("write",t,"writes"))}assertAdd(t){this._activeSets!==null&&(this._activeSets.addAllowed.has(t.id)||this._failComponent("addComponent",t,"spawns, transitions.add or writes"))}assertRemove(t){this._activeSets!==null&&(this._activeSets.removeAllowed.has(t.id)||this._failComponent("removeComponent",t,"despawns or transitions.remove"))}assertDespawn(){if(this._activeSets===null||this._activeSets.hasDespawns)return;const t=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${t}' called despawn but did not declare any despawns. Name the components it removes in 'despawns'`,{system:t,op:"despawn"})}assertResourceRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceReads.has(n)||this._failResource("read",t,"resourceReads")}assertResourceWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceWrites.has(n)||this._failResource("write",t,"resourceWrites")}assertSparseRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseReads.has(n)||this._failSparse("read",n,"sparseReads")}assertSparseWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseWrites.has(n)||this._failSparse("write",n,"sparseWrites")}assertRelationRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationReads.has(n)||this._failRelation("read",n,"relationReads")}assertRelationWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationWrites.has(n)||this._failRelation("write",n,"relationWrites")}assertRelationReadAny(){this._activeSets!==null&&(this._activeSets.relationReads.has(_e)||this._failRelation("(*, T) wildcard read",_e,"relationReads (as ANY_RELATION)"))}_optionalScopes=[];enterOptionalScope(t){this._optionalScopes.push(t)}leaveOptionalScope(){this._optionalScopes.pop()}assertOptionalFetch(t){const n=this._optionalScopes.length;if(n===0)return;const o=this._optionalScopes[n-1],r=t.id;for(let i=0;i<o.length;i++)if(o[i]===r)return;throw new E(f.OPTIONAL_TERM_NOT_DECLARED,`getOptionalColumnRead fetched optional component ${r} but the iterating query did not declare it. Add .optional(component) to the query before the fetch`)}_failComponent(t,n,o){const r=this._activeName,i=He(n);throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on ${i} but did not declare it. Add it to '${o}'`,{system:r,op:t,component:n.id})}_failSparse(t,n,o){const r=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on sparse component ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,sparse:n})}_failRelation(t,n,o){const r=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on relation ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,relation:n})}_failResource(t,n,o){const r=this._activeName,i=n.description??"<unnamed>";throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed resource ${t} on '${i}' but did not declare it. Add the resource key to '${o}'`,{system:r,op:t,resource:i})}}const Dn=new yn;function On(e,t){return new E(f.PLUGIN_NOT_INSTALLED,`${t} needs the ${e} plugin, which this world did not install. Pass it at construction: ECS.create({ plugins: [${e}()] }), imported from @oasys/oecs/${e}`,{plugin:e})}function Rn(e){return new E(f.PLUGIN_ALREADY_INSTALLED,`${e} is already installed on this world. Pass each plugin once to ECS.create`,{plugin:e})}const Pe=["/oecs/src/","/@oasys/oecs/"];function wn(e){for(let t=0;t<Pe.length;t++)if(e.includes(Pe[t]))return!0;return!1}class Ln{_activeCache=null;_repoRootCache=null;_counts=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 t=globalThis.process;return this._repoRootCache=t?.cwd?.()??""}_resolveCallsite(){return bn(new Error().stack??null,this._repoRoot(),this._callsiteCache)}_record(t,n,o){const r=this._resolveCallsite();if(!r)return;const i=`${t} ${n} ${o} ${r}`;this._counts.set(i,(this._counts.get(i)??0)+1)}recordEventEmit(t){this._record("ecs-events","emit",t)}recordEventRead(t){this._record("ecs-events","read",t)}recordResourceRead(t){this._record("resources","read",t)}recordResourceWrite(t){this._record("resources","write",t)}recordResourceRegister(t){this._record("resources","register",t)}recordResourceRemove(t){this._record("resources","remove",t)}recordSendAction(t){this._record("actions","send_action",t)}recordHandleAction(t){this._record("actions","handle_action",t)}snapshot(){const t={"ecs-events":{emit:[],read:[]},actions:{send_action:[],handle_action:[]},resources:{read:[],write:[],register:[],remove:[]}};for(const[n,o]of this._counts.entries()){const[r,i,d,_]=n.split(" ");if(!r||!i||_===void 0)continue;const l={key:r==="actions"?Number(d):d,file:_,count:o},T=t[r][i];T&&T.push(l)}for(const n of Object.values(t))for(const o of Object.values(n))o.sort((r,i)=>{if(r.file!==i.file)return r.file<i.file?-1:1;const d=String(r.key),_=String(i.key);return d<_?-1:d>_?1:0});return{schemaVersion:1,capturedAt:new Date().toISOString(),channels:t}}reset(){this._counts.clear(),this._callsiteCache.clear(),this._activeCache=null,this._repoRootCache=null}}function Cn(e){const t=/\(([^)]+):\d+:\d+\)\s*$/.exec(e);if(t)return t[1]??null;const n=/at\s+([^\s][^()]*?):\d+:\d+\s*$/.exec(e);return n&&(n[1]??"").trim()||null}function bn(e,t,n){if(!e)return null;const o=e.split(`
|
|
2
|
+
`);for(let r=0;r<o.length;r++){const i=o[r],d=n?.get(i);if(d!==void 0){if(d===null)continue;return d}const _=Cn(i);if(!_){n?.set(i,null);continue}if(wn(_)){n?.set(i,null);continue}const c=Pn(_,t);return n?.set(i,c),c}return null}function Pn(e,t){let n=e;return n.startsWith("file://")&&(n=n.slice(7)),t&&n.startsWith(t+"/")&&(n=n.slice(t.length+1)),n.replace(/\\/g,"/")}const Mn=new Ln;var j=(e=>(e.PRE_STARTUP="PRE_STARTUP",e.STARTUP="STARTUP",e.POST_STARTUP="POST_STARTUP",e.FIXED_UPDATE="FIXED_UPDATE",e.PRE_UPDATE="PRE_UPDATE",e.UPDATE="UPDATE",e.POST_UPDATE="POST_UPDATE",e))(j||{});function Me(e){if(typeof e!="string")return e.loop;switch(e){case"PRE_STARTUP":case"STARTUP":case"POST_STARTUP":return"startup";case"FIXED_UPDATE":return"fixed";case"PRE_UPDATE":case"UPDATE":case"POST_UPDATE":return"update"}}function ve(e){return typeof e=="string"?e:e.name}const Q=1024,q=1024*Q,B=64*Q,J=B;function vn(e,t=0){if(!Number.isFinite(t)||t<0)throw new E(f.INVALID_MEMORY_OPTIONS,`storeBaseAbove: extraBytes must be a finite number >= 0, got ${String(t)}`);const n=e?.__heap_base,o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;if(typeof o!="number"||!Number.isFinite(o))throw new E(f.INVALID_MEMORY_OPTIONS,`storeBaseAbove: the module exports no numeric '__heap_base', got ${String(o)}. Link with --export=__heap_base, or pass memory.storeBase by hand.`);const r=Math.ceil((o+t)/B)*B;return Math.max(J,r)}const K=256*q,de=3,Qe=64,qe=8,Ue=4*q,Be=e=>2**Math.ceil(Math.log2(Math.max(1,e))),Un=e=>2**Math.floor(Math.log2(Math.max(1,e))),re=(e,t,n)=>Math.min(n,Math.max(t,e)),I=e=>e>=q?`${(e/q).toFixed(1)} MiB`:e>=Q?`${(e/Q).toFixed(0)} KiB`:`${e} B`;function Bn(e,t){if(e===void 0)return t?J:0;if(!Number.isInteger(e)||e<0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase must be an integer >= 0, got ${e}`);if(e%z!==0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase must be a multiple of ${z}, got ${e}. The alignment keeps every column on its element boundary.`);if(t&&e===0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase is 0, and a header at address 0 is unreadable from a safe build of a WASM module. Pass a storeBase of at least one page (${J}), above the module's own data.`);return e}function M(e,t){if(!Number.isInteger(t)||t<=0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.${e} must be a positive integer (got ${t})`)}const $e={budget:"{ budget: { entities: N } } → { entities: N }",heap:'{ heap: { maxBytes: X } } → { maxBytes: X, backing: "heap" }',shared:'{ shared: { maxBytes: X } } → { maxBytes: X, backing: "shared" }',wasm:"{ wasm: W } → { backing: { wasm: W } }",allocator:"{ allocator: A } → { backing: { allocator: A } }",capBytesHint:"{ capBytesHint: X } → { maxBytes: X }"};function $n(e){const t=Object.prototype.hasOwnProperty,n=Object.keys($e).filter(o=>t.call(e,o));if(n.length!==0)throw new E(f.INVALID_MEMORY_OPTIONS,`${n.map(o=>`memory.${o}`).join(" and ")} ${n.length>1?"were":"was"} removed in 0.6. Sizing and backing are now two independent fields, so every combination of them is expressible. Rewrite as: `+n.map(o=>$e[o]).join(". "))}function Yn(e){e!==void 0&&$n(e);const t=e?.entities,n=e?.maxBytes,o=e?.columnCapacity,r=e?.backing??"heap",i=typeof r=="object"&&r.wasm!==void 0,d=Bn(e?.storeBase,i);if(o!==void 0&&M("columnCapacity",o),n!==void 0&&M("maxBytes",n),t===void 0){for(const s of["archetypes","bytesPerEntity"])if(e?.[s]!==void 0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.${s} shapes the sizing derived from memory.entities, which was not given. Add memory.entities, or drop memory.${s}.`)}let _,c,l=null;const m=[];if(t!==void 0){const s=e?.archetypes??qe,u=e?.bytesPerEntity??Qe;if(M("entities",t),M("archetypes",s),M("bytesPerEntity",u),t>1<<20)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.entities=${t} exceeds the EntityID index space (1<<20 = ${1<<20})`);_=o??re(Be(Math.ceil(t/s)),64,1<<20),c=re(Be(t*2),4096,1<<20);const D=c*b,S=t*u*de;l=Se(Math.max(D+S,Ue),B),m.push(`columnCapacity = ${o!==void 0?`${_} (pinned)`:`pow2(${t}/${s} per archetype) = ${_}`}`,`entityIndex = pow2(2 × ${t}) = ${c} slots × ${b} B = ${I(D)}`,`columns = ${t} × ${u} B × ${de} (double+holes headroom) = ${I(S)}`)}else _=o??xe,c=ce,m.push(`columnCapacity = ${_} (${o!==void 0?"pinned":"default"})`);const T=s=>re(Un(s/4/b),4096,ce),h=t!==void 0?n!==void 0?"entities+maxBytes":"entities":n!==void 0?"maxBytes":"default",y=s=>n!==void 0?`${I(s)} (caller-declared maxBytes; the ${I(l??s)} the entity count implies is overridden)`:`align64K(max(index + columns, ${I(Ue)} floor)) = ${I(s)}`,g=(s,u,D,S,L)=>(t===void 0&&(c=T(s)),{source:u,sizing:h,allocator:D,columnCapacity:_,entityIndexCapacity:c,capBytes:s,storeBase:d,intentLabel:S,budgetEntities:t??null,derivation:[...L,...d>0?[`storeBase = ${I(d)}, the store writes nothing below it`]:[],...m,t===void 0?`entityIndex = floor_pow2(cap/4 ÷ ${b} B) = ${c} slots`:`cap = ${y(s)}`],wasmMemory:null});if(typeof r=="object"&&r.wasm!==void 0){const s=r.wasm;if(s.memory!==void 0){if(!(s.memory.buffer instanceof SharedArrayBuffer))throw new E(f.INVALID_MEMORY_OPTIONS,"memory.backing.wasm.memory must be constructed with `shared: true`, the SAB substrate requires a SharedArrayBuffer-backed WebAssembly.Memory");const L=n??K;return t===void 0&&(c=T(Math.max(L-d,0))),{source:"wasm",sizing:h,allocator:H.wasmMemoryAllocator(s.memory),columnCapacity:_,entityIndexCapacity:c,capBytes:L,storeBase:d,intentLabel:`caller-supplied WebAssembly.Memory (declared cap ${I(L)})`,budgetEntities:t??null,derivation:["backing = wasm_memory_allocator(memory), zero-copy with a WASM compute backend (is_in_place ✓)",n!==void 0?`cap = ${I(L)} (caller-declared maxBytes; the Memory's own maximum is not readable from JS)`:`cap = ${I(L)} (default; the Memory's own maximum is not readable from JS)`,`storeBase = ${I(d)}, the module owns every byte below it`,...m,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${b} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:s.memory}}M("backing.wasm.maximumPages",s.maximumPages);const u=s.initialPages??Math.min(32,s.maximumPages);if(M("backing.wasm.initialPages",u),u>s.maximumPages)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.backing.wasm.initialPages (${u}) exceeds maximumPages (${s.maximumPages})`);if(n!==void 0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.maxBytes (${I(n)}) cannot be given beside memory.backing.wasm.maximumPages (${s.maximumPages} pages = ${I(s.maximumPages*B)}), the Memory's page maximum IS the ceiling. Declare it once, in pages.`);const D=new WebAssembly.Memory({initial:u,maximum:s.maximumPages,shared:!0}),S=s.maximumPages*B;return t===void 0&&(c=T(Math.max(S-d,0))),{source:"wasm",sizing:h,allocator:H.wasmMemoryAllocator(D),columnCapacity:_,entityIndexCapacity:c,capBytes:S,storeBase:d,intentLabel:`engine-constructed WebAssembly.Memory (max ${s.maximumPages} pages)`,budgetEntities:t??null,derivation:[`cap = ${s.maximumPages} pages × 64 KiB = ${I(S)} (Memory maximum)`,`initial = ${u} pages (${s.initialPages!==void 0?"declared":"default"})`,`storeBase = ${I(d)}, the module owns every byte below it`,...m,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${b} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:D}}if(typeof r=="object"&&r.allocator!==void 0){if(r.allocator.isInPlace!==!0)throw new E(f.INVALID_MEMORY_OPTIONS,"memory.backing.allocator must declare `isInPlace: true`. A live Store's flush loops hoist entity-index views across grows, so an allocator that is not in-place (DEFAULT_SAB_ALLOCATOR, for example) corrupts the entity→row mapping. Use growableSabAllocator, fixedSabAllocator or wasmMemoryAllocator. An allocator that is not in-place is for snapshot and test sizing only.");const s=n??null;return t===void 0&&s!==null&&(c=T(s)),{source:"allocator",sizing:h,allocator:r.allocator,columnCapacity:_,entityIndexCapacity:c,capBytes:s,storeBase:d,intentLabel:s!==null?`custom in-place allocator (declared cap ${I(s)})`:"custom in-place allocator",budgetEntities:t??null,derivation:["backing = caller allocator (is_in_place ✓ checked at construction)",s!==null?`cap = ${I(s)} (caller-declared; the allocator owns the real ceiling)`:"cap = allocator-owned (no maxBytes declared)",...m,t!==void 0?"entityIndex sized from the entity count above":s!==null?`entityIndex = floor_pow2(cap/4 ÷ ${b} B) = ${c} slots`:`entityIndex = ${c} slots (default, no entity count and no declared cap)`],wasmMemory:null}}if(r==="shared"){const s=n??l??K;return g(s,"shared",H.growableSabAllocator(s),`shared SharedArrayBuffer backing (${I(s)} growable cap, needs COOP and COEP)`,[`backing = growable_sab_allocator(${I(s)}), growable SharedArrayBuffer (is_in_place ✓), needs cross-origin isolation`,"enables worker offload + a WASM compute backend (transferable SharedArrayBuffer)"])}if(r!=="heap")throw new E(f.INVALID_MEMORY_OPTIONS,`memory.backing must be "heap", "shared", { wasm }, or { allocator } (got ${JSON.stringify(r)})`);const a=n??l??K;return g(a,"heap",H.heapArrayBufferAllocator(a),h==="default"?`default sizing (${I(a)} reserved cap)`:t!==void 0?`budget of ${t} entities`:`explicit cap of ${I(a)}`,[`backing = heap_arraybuffer_allocator(${I(a)}), fixed ArrayBuffer reserved at the cap, no SAB and no COOP+COEP (is_in_place ✓)`,"trade-off: no worker offload and no WASM backend (both need a transferable SharedArrayBuffer)"])}function Fn(e,t){return{def:e,values:t}}function Z(e,t){switch(t.kind){case"spawn":{const n=e.commands.spawn();for(const o of t.components)e.commands.add(n,o.def,o.values);return t.onSpawned?.(n),n}case"despawn":e.commands.despawn(t.eid);return;case"add_component":e.commands.add(t.eid,t.def,t.values);return;case"remove_component":e.commands.remove(t.eid,t.def);return;case"set_field":if(!e.hasComponent(t.eid,t.def))throw new E(f.COMPONENT_NOT_REGISTERED,`host set_field on entity ${t.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 or in spawnEntry instead of a separate set_field, or set it next frame. (host write seam)`);e.setField(t.eid,t.def,t.field,t.value);return;case"disable":e.commands.disable(t.eid);return;case"enable":e.commands.enable(t.eid);return;default:return nt(t,"HostCommand kind")}}class Je{_pending=[];spawn(t,n){return this._pending.push({kind:"spawn",components:t,onSpawned:n}),this}despawn(t){return this._pending.push({kind:"despawn",eid:t}),this}add(t,n,o){return this._pending.push({kind:"add_component",eid:t,def:n,values:o}),this}remove(t,n){return this._pending.push({kind:"remove_component",eid:t,def:n}),this}setField(t,n,o,r){return this._pending.push({kind:"set_field",eid:t,def:n,field:o,value:r}),this}disable(t){return this._pending.push({kind:"disable",eid:t}),this}enable(t){return this._pending.push({kind:"enable",eid:t}),this}push(t){return this._pending.push(t),this}get pendingCount(){return this._pending.length}clear(){const t=this._pending.length;return this._pending.length=0,t}drain(t,n){const o=this._pending.length;if(o===0)return 0;if(n===void 0)for(let r=0;r<o;r++)Z(t,this._pending[r]);else for(let r=0;r<o;r++){const i=this._pending[r];n(i),Z(t,i)}return this._pending.splice(0,o),o}}const ye=v-1;function xn(e){if(e===pe)throw new w("cannot bind opCode 0 (reserved as the command-ring empty-slot marker)");if(e<0||e>255||!Number.isInteger(e))throw new w(`command opCode must be a u8 in [1, 255] (got ${e})`)}function ne(e){const t=new Uint8Array(ye);return new DataView(t.buffer).setUint32(0,e,!0),t}function oe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)}function Hn(e,t){return{encode(n){if(n.kind!=="set_field")throw new w(`ringSetFieldCodec encodes a "set_field" command (got "${n.kind}")`);const o=new Uint8Array(ye),r=new DataView(o.buffer);return r.setUint32(0,n.eid,!0),r.setFloat64(4,n.value,!0),o},decode(n){const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return{kind:"set_field",eid:o.getUint32(0,!0),def:e,field:t,value:o.getFloat64(4,!0)}}}}function Vn(){return{encode(e){if(e.kind!=="despawn")throw new w(`ringDespawnCodec encodes a "despawn" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"despawn",eid:oe(e)})}}function Gn(){return{encode(e){if(e.kind!=="disable")throw new w(`ringDisableCodec encodes a "disable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"disable",eid:oe(e)})}}function kn(){return{encode(e){if(e.kind!=="enable")throw new w(`ringEnableCodec encodes an "enable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"enable",eid:oe(e)})}}function Wn(e){return{encode(t){if(t.kind!=="remove_component")throw new w(`ringRemoveComponentCodec encodes a "remove_component" command (got "${t.kind}")`);return ne(t.eid)},decode:t=>({kind:"remove_component",eid:oe(t),def:e})}}class Xn{_appliers=new Map;on(t,n){return xn(t),this._appliers.set(t,n),this}off(t){return this._appliers.delete(t)}onCommand(t,n){return this.on(t,(o,r,i)=>{const d=n.decode(r);i?.(d),Z(o,d)})}drain(t,n,o,r){return Ft(n,o,(i,d)=>{const _=this._appliers.get(i);_!==void 0&&_(t,d,r)})}}const le=new WeakMap;function Kn(e,t){const n=le.get(t);if(n===void 0)return!1;for(const o of n)e.removeSystem(o);return le.delete(t),t.clear(),!0}function zn(e,t){const n=new Je,o=[];le.set(n,o);const r=t?.name??"host_command_apply",i=t?.ring,d=t?.recorder,_=d?.record,c=t?.schedules??[j.PRE_STARTUP,j.PRE_UPDATE];if(d!==void 0){for(const l of c)if(Me(l)==="fixed")throw new E(f.INVALID_RECORDER_SCHEDULE,`installHostCommandSeam: a recorder cannot drain at ${ve(l)}, a phase of the fixed loop. It would log the fixed timestep and not the host update dt, so a replay would diverge. Drain at a phase of the update loop instead.`)}for(const l of c){const m=Me(l)!=="startup",T=e.registerSystem({name:`${r}:${ve(l)}`,reads:[],writes:[],exclusive:!0,fn:(h,y)=>{if(d!==void 0&&m&&d.openTick(h.ecsTick,y),n.drain(h,_),i!==void 0){const g=e.columnStore,a=g.header.commandRingOff;a!==0&&i.drain(h,g.view,a,_)}}});e.addSystems(l,T),o.push(T)}return n}exports.ACTION_RING_DEFAULT_CAPACITY_SLOTS=Zt;exports.ANY_RELATION=_e;exports.ARCHETYPE_DESCRIPTOR_HEADER_BYTES=Ie;exports.ARCHETYPE_DESCRIPTOR_OFFSETS=C;exports.BUDGET_DEFAULT_ARCHETYPES=qe;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=Qe;exports.BUDGET_GROWTH_HEADROOM=de;exports.COLUMN_DESCRIPTOR_BYTES=Te;exports.COMMAND_RING_DEFAULT_CAPACITY_SLOTS=Pt;exports.COMPONENT_MASK_WORDS=Ae;exports.DEFAULT_COLUMN_CAPACITY=xe;exports.DEFAULT_ECS_CAP_BYTES=K;exports.DEFAULT_FIXED_TIMESTEP=ut;exports.DEFAULT_MAX_FIXED_STEPS=Et;exports.ECSError=E;exports.ECSRestoreError=rt;exports.ECS_ERROR=f;exports.EMPTY_VALUES=at;exports.ENTITY_INDEX_DEFAULT_CAPACITY=ce;exports.ENTITY_INDEX_HEADER_OFFSETS=G;exports.EVENT_RING_DEFAULT_CAPACITY_SLOTS=Kt;exports.HASH_GOLDEN_RATIO=ct;exports.HASH_SECONDARY_PRIME=_t;exports.HOST_COMMAND_PAYLOAD_BYTES=ye;exports.HostCommandDispatcher=Xn;exports.HostCommandQueue=Je;exports.INDEX_BITS=Y;exports.INDEX_MASK=Ee;exports.INITIAL_GENERATION=dt;exports.MAX_ENTITY_ID=It;exports.MAX_GENERATION=k;exports.MAX_INDEX=fe;exports.MAX_LIVE_GENERATION=Tt;exports.NO_SWAP=st;exports.RETIRED_GENERATION=At;exports.SCHEDULE=j;exports.STARTUP_DELTA_TIME=ft;exports.STORE_DESCRIPTOR_COMPONENT_LIMIT=wt;exports.STORE_HEADER_OFFSETS=p;exports.STORE_MAX_BYTE_OFFSET=te;exports.STORE_PREFIX_REGIONS=V;exports.StoreLayoutOverflowError=ge;exports.TYPED_ARRAY_TAG_TO_TYPE_TAG=Ot;exports.TYPE_TAG=A;exports.TYPE_TAG_STRIDE=ae;exports.UNASSIGNED=it;exports.WASM_STORE_BASE_BYTES=J;exports.accessCheck=Dn;exports.alignUp=Se;exports.applyHostCommand=Z;exports.archetypeDescriptorBytes=he;exports.columnKey=Ke;exports.componentDebugName=gt;exports.componentLabel=He;exports.createArchetypeViews=je;exports.createColumnStore=hn;exports.createEntityId=ht;exports.createEntityIndexViews=kt;exports.dispatchTrace=Mn;exports.entityNotAliveError=pt;exports.findRegionEntry=fn;exports.findRegionOffset=En;exports.getEntityGeneration=se;exports.getEntityIndex=ie;exports.installHostCommandSeam=zn;exports.isColumnStoreInternal=In;exports.isEcsError=ot;exports.isNonNegativeInteger=Ze;exports.pluginInstalledTwiceError=Rn;exports.pluginMissingError=On;exports.readHeaderRegionTable=un;exports.resolveECSMemory=Yn;exports.ringDespawnCodec=Vn;exports.ringDisableCodec=Gn;exports.ringEnableCodec=kn;exports.ringRemoveComponentCodec=Wn;exports.ringSetFieldCodec=Hn;exports.setComponentDebugName=Nt;exports.spawnEntry=Fn;exports.storeBaseAbove=vn;exports.uninstallHostCommandSeam=Kn;exports.unsafeCast=tt;exports.usedDescriptorBytes=ze;exports.validateAndCast=et;exports.writeArchetypeDescriptor=Ve;
|