@camstack/addon-admin-ui 1.2.296 → 1.2.298
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/dist/assets/{AddonCollectionPage-BYg2x8gf.js → AddonCollectionPage-Df7TFa8c.js} +1 -1
- package/dist/assets/{Addons-Crn8un71.js → Addons-BL0l83HX.js} +1 -1
- package/dist/assets/{AdminTabs-BA9jXMUp.js → AdminTabs-_3rYGvff.js} +1 -1
- package/dist/assets/{AiProfiles-BtgWxHI0.js → AiProfiles-Cb_Zmt2e.js} +1 -1
- package/dist/assets/{BrokerForm-C-p5JCOm.js → BrokerForm-O4qx5NOl.js} +1 -1
- package/dist/assets/{Build-Dj_zXiE8.js → Build-CNQhG6ma.js} +4 -4
- package/dist/assets/{Capabilities-C86MVt18.js → Capabilities-BhWA9I3U.js} +1 -1
- package/dist/assets/{CapabilityBadges-CaHJk_kn.js → CapabilityBadges-E822NR6-.js} +1 -1
- package/dist/assets/{Cluster-BBeV0Zv6.js → Cluster-CytT6oOR.js} +1 -1
- package/dist/assets/CompositionEditor-BhWVT7RV.js +1 -0
- package/dist/assets/{CompositionEditorPage-D8Gb-eyp.js → CompositionEditorPage-D-Pr98e9.js} +1 -1
- package/dist/assets/{Data-cYP7RKZm.js → Data-C_5nuknP.js} +1 -1
- package/dist/assets/{DetectionIntelligence-DpAvvILQ.js → DetectionIntelligence-Ddu_ubPT.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-BAasJnH-.js → DeviceAggregateSection-kHgMnzdV.js} +1 -1
- package/dist/assets/{DeviceDetail-iwKTRpR7.js → DeviceDetail-BZJKkllF.js} +2 -2
- package/dist/assets/{Devices-DwRHoqNP.js → Devices-CkDDnlUY.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-DYfiijJR.js → EmbedPlayerPage-4bKTeu-8.js} +1 -1
- package/dist/assets/{Events-CZQMZnE9.js → Events-DoN_tLnP.js} +1 -1
- package/dist/assets/{FormBuilder-DgJhzkoh.js → FormBuilder-DFkvqrJD.js} +1 -1
- package/dist/assets/{Identity-CkWu1THf.js → Identity-Bs0HMUZv.js} +1 -1
- package/dist/assets/{IntegrationDetail-BOPlkuN_.js → IntegrationDetail-Cr5-tJiw.js} +1 -1
- package/dist/assets/Integrations-D5LYSgWQ.js +1 -0
- package/dist/assets/{Integrations-C9ZZcrwg.js → Integrations-D5hX1u4b.js} +1 -1
- package/dist/assets/{Locations-DO4x0GA7.js → Locations-NysPu2nw.js} +2 -2
- package/dist/assets/{Logs-Dk77T2Bb.js → Logs-CdSMPoxV.js} +1 -1
- package/dist/assets/{ModelLicenses-D68PlKOO.js → ModelLicenses-GuvIn1gk.js} +1 -1
- package/dist/assets/{MotionZonesSettings-NZEXcsG8.js → MotionZonesSettings-C5cymw6R.js} +1 -1
- package/dist/assets/{MyAccess-j0D_LCeZ.js → MyAccess-DKvcVvYi.js} +1 -1
- package/dist/assets/{Network-Br0n4yEW.js → Network-DO7j65It.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-D2-Cx1iE.js → NodeAddonsSettingsPanel-Bj_BK8BK.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-Bp0orPpK.js → NodeInferenceDevices-DEF7iUIy.js} +1 -1
- package/dist/assets/Notifications-R4TlE5EH.js +1 -0
- package/dist/assets/{Pipeline-CB4PxyJT.js → Pipeline-C3rd2o0z.js} +1 -1
- package/dist/assets/{Plates-MQalPPfq.js → Plates-KK9Jucpy.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-D6vMdxim.js → PrivacyMaskSettings-DLWoWKa1.js} +1 -1
- package/dist/assets/{ProviderIcon-hq07i2PL.js → ProviderIcon-B95H0OGs.js} +1 -1
- package/dist/assets/{Recordings-BpVhWIC5.js → Recordings-BIMt47G_.js} +1 -1
- package/dist/assets/{ScanNetworkModal-d3bqZibj.js → ScanNetworkModal-C745HgYN.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-CyAWuivX.js → SceneMonitorEditor-DEFeKrQi.js} +1 -1
- package/dist/assets/{Scenes-BXubfc12.js → Scenes-31t1OF8h.js} +1 -1
- package/dist/assets/{Settings-BcWgYeD-.js → Settings-rfP-ZvI0.js} +1 -1
- package/dist/assets/{Showroom-BDtopXj_.js → Showroom-Df8NV8QK.js} +1 -1
- package/dist/assets/{StorageLocationsPanel-ZSVB4Pin.js → StorageLocationsPanel-DGsk0Ute.js} +1 -1
- package/dist/assets/{Terminal-CycbSKEu.js → Terminal-CDJOGeqz.js} +1 -1
- package/dist/assets/{Viewer-CrrlBAJl.js → Viewer-BjRST1rI.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D8lY-jG1.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C4tT4btJ.js} +1 -1
- package/dist/assets/{archive-CkZkXqo-.js → archive-TrxiLNcl.js} +1 -1
- package/dist/assets/{authed-media-vQQeg0sB.js → authed-media-CH1U0Z7I.js} +1 -1
- package/dist/assets/{boxes-C4i_E5C-.js → boxes-BAiYOams.js} +1 -1
- package/dist/assets/circle-slash-Di12V3ul.js +1 -0
- package/dist/assets/{debounced-invalidate-DdBpZuBC.js → debounced-invalidate-BDeU9yPQ.js} +1 -1
- package/dist/assets/{device-integration-icon-DJkPgoDE.js → device-integration-icon-CHkYoY0a.js} +1 -1
- package/dist/assets/dist-3HV5hQQl.js +349 -0
- package/dist/assets/{dist-H-apj5aF.js → dist-a0ex8Xy3.js} +1 -1
- package/dist/assets/{face-bbox-DkMseqPn.js → face-bbox-BO4f9HS4.js} +1 -1
- package/dist/assets/{hard-drive-download-Dl1Mi_Bd.js → hard-drive-download-DMTgloj5.js} +1 -1
- package/dist/assets/{hostInit-NAmBeyk9.js → hostInit-DImvGASf.js} +1 -1
- package/dist/assets/{index-DbfYR34Q.js → index-CgXPc-AV.js} +3 -3
- package/dist/assets/{layers-C8SA-eys.js → layers-eROspUmA.js} +1 -1
- package/dist/assets/{location-owned-usage-D5g_0SgR.js → location-owned-usage-sOE3xLhc.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-10b9958d.js → mf-entry-bootstrap-0-84890b2e.js} +2 -2
- package/dist/assets/{player-overlays-T90xSvHE.js → player-overlays-o54P23P2.js} +1 -1
- package/dist/assets/remoteEntry-nDKnWQvr.js +1 -0
- package/dist/assets/{send-lMovTHqD.js → send-D0d5eZ61.js} +1 -1
- package/dist/assets/{settings-2-DzRjNRlj.js → settings-2-Dqj-Whfr.js} +1 -1
- package/dist/assets/{square-check-big-BA8dtN5I.js → square-check-big-CC2dU6RF.js} +1 -1
- package/dist/assets/src-C36-vO5A.js +349 -0
- package/dist/assets/{src-D-Ti2TOa.js → src-f3OJiuN1.js} +8 -8
- package/dist/assets/{use-scenes-feed-DSJqfwpQ.js → use-scenes-feed-R-GEBDBU.js} +1 -1
- package/dist/assets/{use-stationary-objects-CI4KvzKa.js → use-stationary-objects-CO4PdIFG.js} +1 -1
- package/dist/assets/{useDevice-DjspuePz.js → useDevice-BU0imY9B.js} +1 -1
- package/dist/assets/useEventInvalidation-BxCnrh5u.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BD8hpYlw.js → useNodeUrlSelection-Dlf0CWPU.js} +1 -1
- package/dist/assets/user-round-CXdkrmGZ.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BWLhl4sL.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DAaE-Myc.js} +2 -2
- package/dist/index.html +5 -5
- package/dist/server/addon.js +297 -184
- package/package.json +2 -2
- package/dist/assets/CompositionEditor-DUwxzCDI.js +0 -1
- package/dist/assets/Integrations-DORjNhJB.js +0 -1
- package/dist/assets/Notifications-K-xF1cD6.js +0 -1
- package/dist/assets/circle-slash-KMkDUERh.js +0 -1
- package/dist/assets/dist-CQ1Wje9Q.js +0 -349
- package/dist/assets/remoteEntry-CtptjVdP.js +0 -1
- package/dist/assets/src-BvHjCPd8.js +0 -349
- package/dist/assets/useEventInvalidation-DOcu13bt.js +0 -1
- package/dist/assets/user-round-N5qlAYPg.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -11571,6 +11571,68 @@ method(object({
|
|
|
11571
11571
|
password: string()
|
|
11572
11572
|
}), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
|
|
11573
11573
|
/**
|
|
11574
|
+
* How long one snapshot may take end to end: the pinned copy of the whole
|
|
11575
|
+
* database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
|
|
11576
|
+
* disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
|
|
11577
|
+
* generous because a timeout fails the whole backup run.
|
|
11578
|
+
*/
|
|
11579
|
+
var DATABASE_SNAPSHOT_TIMEOUT_MS = 30 * 6e4;
|
|
11580
|
+
/**
|
|
11581
|
+
* The databases an owner snapshots — declared by the OWNER, so a caller never
|
|
11582
|
+
* guesses which file is live from what sits beside it (a cleanly closed
|
|
11583
|
+
* database has no sidecars and is just as owned). Paths are absolute on the
|
|
11584
|
+
* owner's host.
|
|
11585
|
+
*/
|
|
11586
|
+
var DatabaseSnapshotTargetsSchema = object({ databases: array(object({ livePath: string() })) });
|
|
11587
|
+
/** One b-tree table of the snapshot and the rows it holds. */
|
|
11588
|
+
var DatabaseSnapshotTableSchema = object({
|
|
11589
|
+
name: string(),
|
|
11590
|
+
rows: number().int().nonnegative()
|
|
11591
|
+
});
|
|
11592
|
+
/**
|
|
11593
|
+
* What the owner wrote. Every path is ABSOLUTE on the owner's host — the
|
|
11594
|
+
* caller pins the call to its own node, so it can read the file; a caller
|
|
11595
|
+
* that finds the path outside its own data root refuses it rather than
|
|
11596
|
+
* archiving something it cannot place.
|
|
11597
|
+
*/
|
|
11598
|
+
var DatabaseSnapshotResultSchema = object({
|
|
11599
|
+
/** The live database the snapshot copies. Never to be copied as a file. */
|
|
11600
|
+
livePath: string(),
|
|
11601
|
+
/** The verified copy: `<livePath>` + {@link DATABASE_SNAPSHOT_SUFFIX}. */
|
|
11602
|
+
snapshotPath: string(),
|
|
11603
|
+
sizeBytes: number().int().nonnegative(),
|
|
11604
|
+
pageCount: number().int().nonnegative(),
|
|
11605
|
+
pageSize: number().int().positive(),
|
|
11606
|
+
/**
|
|
11607
|
+
* Every b-tree table with its row count. Read inside the SAME read
|
|
11608
|
+
* transaction the copy was taken from, and found EQUAL on the copy — so
|
|
11609
|
+
* this is the content of the snapshot, not an estimate of the source.
|
|
11610
|
+
*/
|
|
11611
|
+
tables: array(DatabaseSnapshotTableSchema),
|
|
11612
|
+
/** Wall time of the pinned copy (row counts included). */
|
|
11613
|
+
copyMs: number().nonnegative(),
|
|
11614
|
+
/** Wall time of the checks on the copy (`integrity_check`, row counts). */
|
|
11615
|
+
verifyMs: number().nonnegative(),
|
|
11616
|
+
/** When the pinned read transaction began (ms epoch) — the snapshot's instant. */
|
|
11617
|
+
takenAt: number()
|
|
11618
|
+
});
|
|
11619
|
+
/**
|
|
11620
|
+
* A snapshot as an ARCHIVE records it (`ArchiveManifest.sqliteSnapshots`):
|
|
11621
|
+
* the same facts, with both paths relative to the archive root (the node's
|
|
11622
|
+
* data dir), because an archive outlives the host that made it.
|
|
11623
|
+
*/
|
|
11624
|
+
var ArchiveSqliteSnapshotSchema = DatabaseSnapshotResultSchema.extend({
|
|
11625
|
+
/** Archive-relative path of the live database the archive does NOT carry. */
|
|
11626
|
+
livePath: string(),
|
|
11627
|
+
/** Archive-relative path of the verified copy it carries in its place. */
|
|
11628
|
+
snapshotPath: string()
|
|
11629
|
+
});
|
|
11630
|
+
method(object({}), DatabaseSnapshotTargetsSchema, { auth: "admin" }), method(object({}), DatabaseSnapshotResultSchema, {
|
|
11631
|
+
kind: "mutation",
|
|
11632
|
+
auth: "admin",
|
|
11633
|
+
timeoutMs: DATABASE_SNAPSHOT_TIMEOUT_MS
|
|
11634
|
+
});
|
|
11635
|
+
/**
|
|
11574
11636
|
* Orchestrator-side destination metadata. The orchestrator computes
|
|
11575
11637
|
* `id = <addonId>:<subId>` from its provider lookup so consumers
|
|
11576
11638
|
* (admin UI, restore flow) see one canonical key.
|
|
@@ -11681,7 +11743,12 @@ var ArchiveManifestSchema = object({
|
|
|
11681
11743
|
locations: array(string()),
|
|
11682
11744
|
entries: array(ArchiveEntrySchema),
|
|
11683
11745
|
totalBytes: number(),
|
|
11684
|
-
totalFiles: number()
|
|
11746
|
+
totalFiles: number(),
|
|
11747
|
+
/**
|
|
11748
|
+
* Live SQLite databases this archive carries as their OWNER's verified
|
|
11749
|
+
* snapshot instead of as files (D693). Absent on archives made before.
|
|
11750
|
+
*/
|
|
11751
|
+
sqliteSnapshots: array(ArchiveSqliteSnapshotSchema).optional()
|
|
11685
11752
|
});
|
|
11686
11753
|
var LocationStatSchema = object({
|
|
11687
11754
|
name: string(),
|
|
@@ -13105,6 +13172,52 @@ var CompositionBlockStateSchema = object({
|
|
|
13105
13172
|
reason: string().optional(),
|
|
13106
13173
|
fields: array(CompositionFieldStateSchema)
|
|
13107
13174
|
});
|
|
13175
|
+
var ComposerBlockSchema = object({
|
|
13176
|
+
id: string().min(1),
|
|
13177
|
+
name: string().min(1).max(120),
|
|
13178
|
+
enabled: boolean(),
|
|
13179
|
+
updatedAt: number(),
|
|
13180
|
+
composition: CompositionSchema
|
|
13181
|
+
});
|
|
13182
|
+
/**
|
|
13183
|
+
* A stored composition row that no longer PARSES — a schema a release
|
|
13184
|
+
* tightened, a row written by a newer build. Sent by id so the composer keeps
|
|
13185
|
+
* its device as a placeholder and reports the block `failed` naming the parse
|
|
13186
|
+
* error. Leaving it out would read, twice, exactly like a delete (D49).
|
|
13187
|
+
*/
|
|
13188
|
+
var ComposerUnreadableBlockSchema = object({
|
|
13189
|
+
id: string().min(1),
|
|
13190
|
+
/** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
|
|
13191
|
+
name: string().nullable(),
|
|
13192
|
+
/** The parse error, in the operator's words. */
|
|
13193
|
+
error: string()
|
|
13194
|
+
});
|
|
13195
|
+
method(object({
|
|
13196
|
+
/** The shared Blocks integration; null until `core-blocks` has reconciled it. */
|
|
13197
|
+
integrationId: string().nullable(),
|
|
13198
|
+
/** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
|
|
13199
|
+
storeLoaded: boolean(),
|
|
13200
|
+
blocks: array(ComposerBlockSchema),
|
|
13201
|
+
/** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
|
|
13202
|
+
restartBlockIds: array(string()),
|
|
13203
|
+
/** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
|
|
13204
|
+
unreadableBlocks: array(ComposerUnreadableBlockSchema)
|
|
13205
|
+
}), object({
|
|
13206
|
+
blocks: array(object({
|
|
13207
|
+
blockId: string(),
|
|
13208
|
+
status: CompositionRunStatusSchema,
|
|
13209
|
+
reason: string().optional()
|
|
13210
|
+
})),
|
|
13211
|
+
/**
|
|
13212
|
+
* False when the composer declared and withdrew NOTHING (store not loaded,
|
|
13213
|
+
* integration unknown, its own rows unread or read empty once). An empty
|
|
13214
|
+
* apply the caller owes is paid off only by one the composer acted on (D49).
|
|
13215
|
+
*/
|
|
13216
|
+
acted: boolean()
|
|
13217
|
+
}), {
|
|
13218
|
+
kind: "mutation",
|
|
13219
|
+
auth: "admin"
|
|
13220
|
+
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
13108
13221
|
var NUMBER = {
|
|
13109
13222
|
kind: "fixed",
|
|
13110
13223
|
result: ["number"]
|
|
@@ -13341,52 +13454,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
13341
13454
|
auth: "admin",
|
|
13342
13455
|
access: "view"
|
|
13343
13456
|
});
|
|
13344
|
-
var ComposerBlockSchema = object({
|
|
13345
|
-
id: string().min(1),
|
|
13346
|
-
name: string().min(1).max(120),
|
|
13347
|
-
enabled: boolean(),
|
|
13348
|
-
updatedAt: number(),
|
|
13349
|
-
composition: CompositionSchema
|
|
13350
|
-
});
|
|
13351
|
-
/**
|
|
13352
|
-
* A stored composition row that no longer PARSES — a schema a release
|
|
13353
|
-
* tightened, a row written by a newer build. Sent by id so the composer keeps
|
|
13354
|
-
* its device as a placeholder and reports the block `failed` naming the parse
|
|
13355
|
-
* error. Leaving it out would read, twice, exactly like a delete (D49).
|
|
13356
|
-
*/
|
|
13357
|
-
var ComposerUnreadableBlockSchema = object({
|
|
13358
|
-
id: string().min(1),
|
|
13359
|
-
/** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
|
|
13360
|
-
name: string().nullable(),
|
|
13361
|
-
/** The parse error, in the operator's words. */
|
|
13362
|
-
error: string()
|
|
13363
|
-
});
|
|
13364
|
-
method(object({
|
|
13365
|
-
/** The shared Blocks integration; null until `core-blocks` has reconciled it. */
|
|
13366
|
-
integrationId: string().nullable(),
|
|
13367
|
-
/** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
|
|
13368
|
-
storeLoaded: boolean(),
|
|
13369
|
-
blocks: array(ComposerBlockSchema),
|
|
13370
|
-
/** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
|
|
13371
|
-
restartBlockIds: array(string()),
|
|
13372
|
-
/** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
|
|
13373
|
-
unreadableBlocks: array(ComposerUnreadableBlockSchema)
|
|
13374
|
-
}), object({
|
|
13375
|
-
blocks: array(object({
|
|
13376
|
-
blockId: string(),
|
|
13377
|
-
status: CompositionRunStatusSchema,
|
|
13378
|
-
reason: string().optional()
|
|
13379
|
-
})),
|
|
13380
|
-
/**
|
|
13381
|
-
* False when the composer declared and withdrew NOTHING (store not loaded,
|
|
13382
|
-
* integration unknown, its own rows unread or read empty once). An empty
|
|
13383
|
-
* apply the caller owes is paid off only by one the composer acted on (D49).
|
|
13384
|
-
*/
|
|
13385
|
-
acted: boolean()
|
|
13386
|
-
}), {
|
|
13387
|
-
kind: "mutation",
|
|
13388
|
-
auth: "admin"
|
|
13389
|
-
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
13390
13457
|
/**
|
|
13391
13458
|
* `custom-model-registry` — collection cap exposing operator-registered
|
|
13392
13459
|
* custom detection models. Each provider (today: `addon-model-studio`)
|
|
@@ -15235,6 +15302,138 @@ method(object({
|
|
|
15235
15302
|
deviceIds: array(number()).readonly(),
|
|
15236
15303
|
caps: array(string()).readonly().optional()
|
|
15237
15304
|
}), record(string(), record(string(), unknown().nullable())));
|
|
15305
|
+
object({
|
|
15306
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
15307
|
+
lastPressedAt: number().nullable(),
|
|
15308
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
15309
|
+
pressCountSinceStart: number()
|
|
15310
|
+
});
|
|
15311
|
+
object({
|
|
15312
|
+
deviceId: number(),
|
|
15313
|
+
timestamp: number()
|
|
15314
|
+
});
|
|
15315
|
+
/**
|
|
15316
|
+
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
15317
|
+
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
15318
|
+
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
15319
|
+
*/
|
|
15320
|
+
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
15321
|
+
DeviceType.Camera;
|
|
15322
|
+
DeviceType.Button, DeviceType.Camera;
|
|
15323
|
+
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
15324
|
+
DeviceType.Camera, DeviceType.Camera;
|
|
15325
|
+
/** A slot's editable value, discriminated on `slot`. */
|
|
15326
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
15327
|
+
DeviceType.Camera;
|
|
15328
|
+
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
15329
|
+
state: literal("unreachable"),
|
|
15330
|
+
reason: string()
|
|
15331
|
+
})]);
|
|
15332
|
+
/** One provider of slots — the D554 source-listing row. */
|
|
15333
|
+
var ExtensionSourceSchema = object({
|
|
15334
|
+
/** The routing prefix of every `slotRef` this provider serves. */
|
|
15335
|
+
source: string(),
|
|
15336
|
+
label: string(),
|
|
15337
|
+
/** Stamped by the dispatcher from the registry (D557). */
|
|
15338
|
+
addonId: string().optional(),
|
|
15339
|
+
availability: ExtensionSourceAvailabilitySchema
|
|
15340
|
+
});
|
|
15341
|
+
/**
|
|
15342
|
+
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
15343
|
+
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
15344
|
+
* (a source owned by another addon); `unavailable` — it exists but is not a
|
|
15345
|
+
* valid source now (a container, which is never a pick). A source in any of
|
|
15346
|
+
* these states is SHOWN, never silently dropped or re-pointed.
|
|
15347
|
+
*/
|
|
15348
|
+
var ExtensionSourceHealthSchema = _enum([
|
|
15349
|
+
"ok",
|
|
15350
|
+
"missing",
|
|
15351
|
+
"foreign",
|
|
15352
|
+
"unavailable"
|
|
15353
|
+
]);
|
|
15354
|
+
var ExtensionSlotSourceSchema = object({
|
|
15355
|
+
deviceId: number().int(),
|
|
15356
|
+
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
15357
|
+
name: string().nullable(),
|
|
15358
|
+
health: ExtensionSourceHealthSchema,
|
|
15359
|
+
detail: string().optional()
|
|
15360
|
+
});
|
|
15361
|
+
/**
|
|
15362
|
+
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
15363
|
+
* reported read-only, named, never written through this contract (D62). The
|
|
15364
|
+
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
15365
|
+
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
15366
|
+
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
15367
|
+
*/
|
|
15368
|
+
var ExtensionSlotActivationSchema = object({
|
|
15369
|
+
state: _enum([
|
|
15370
|
+
"active",
|
|
15371
|
+
"inactive",
|
|
15372
|
+
"unknown"
|
|
15373
|
+
]),
|
|
15374
|
+
authority: string(),
|
|
15375
|
+
detail: string().optional()
|
|
15376
|
+
});
|
|
15377
|
+
var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
15378
|
+
state: literal("ok"),
|
|
15379
|
+
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
15380
|
+
slotRef: string(),
|
|
15381
|
+
slot: ExtensionSlotIdSchema,
|
|
15382
|
+
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
15383
|
+
authority: string(),
|
|
15384
|
+
activation: ExtensionSlotActivationSchema.nullable(),
|
|
15385
|
+
value: ExtensionSlotValueSchema,
|
|
15386
|
+
sources: array(ExtensionSlotSourceSchema),
|
|
15387
|
+
/**
|
|
15388
|
+
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
15389
|
+
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
15390
|
+
* the child a picked container stands for (D356 — a container is never a
|
|
15391
|
+
* pick, its children are). Read-only; the editor shows them and may offer
|
|
15392
|
+
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
15393
|
+
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
15394
|
+
* older than D655.
|
|
15395
|
+
*/
|
|
15396
|
+
impliedSources: array(ExtensionSlotSourceSchema).optional()
|
|
15397
|
+
}), object({
|
|
15398
|
+
state: literal("unreachable"),
|
|
15399
|
+
addonId: string(),
|
|
15400
|
+
reason: string()
|
|
15401
|
+
})]);
|
|
15402
|
+
var ExtensionCandidatesSchema = object({ candidates: array(object({
|
|
15403
|
+
deviceId: number().int(),
|
|
15404
|
+
name: string(),
|
|
15405
|
+
type: string(),
|
|
15406
|
+
location: string().nullable(),
|
|
15407
|
+
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
15408
|
+
parentName: string().nullable(),
|
|
15409
|
+
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
15410
|
+
suggested: boolean(),
|
|
15411
|
+
/** Why it is suggested ("same location"), null when it is not. */
|
|
15412
|
+
reason: string().nullable()
|
|
15413
|
+
})) });
|
|
15414
|
+
/**
|
|
15415
|
+
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
15416
|
+
* reloaded the host (or, for an accessory child, its parent) because the
|
|
15417
|
+
* write changed what the host REGISTERS. A slot never adds a capability to its
|
|
15418
|
+
* host — that is a composition (D663) — so today's owners answer `none`.
|
|
15419
|
+
*/
|
|
15420
|
+
var ExtensionSetResultSchema = object({
|
|
15421
|
+
applied: literal(true),
|
|
15422
|
+
reload: _enum([
|
|
15423
|
+
"none",
|
|
15424
|
+
"host",
|
|
15425
|
+
"parent"
|
|
15426
|
+
])
|
|
15427
|
+
});
|
|
15428
|
+
var ExtensionSlotRefInputSchema = object({
|
|
15429
|
+
deviceId: number().int(),
|
|
15430
|
+
slotRef: string().min(1)
|
|
15431
|
+
});
|
|
15432
|
+
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
15433
|
+
method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
15434
|
+
kind: "mutation",
|
|
15435
|
+
auth: "admin"
|
|
15436
|
+
});
|
|
15238
15437
|
/**
|
|
15239
15438
|
* Per-field ownership (D663). A composition may CLAIM fields of a native
|
|
15240
15439
|
* cap's runtime-state slice on an existing device: `replace` overlays the
|
|
@@ -18207,17 +18406,25 @@ var NcScheduleSchema = object({
|
|
|
18207
18406
|
*/
|
|
18208
18407
|
var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
|
|
18209
18408
|
/**
|
|
18409
|
+
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
18410
|
+
* every section; `section` = one notification per section with something to
|
|
18411
|
+
* say (an unavailable section included), each titled by its section.
|
|
18412
|
+
*/
|
|
18413
|
+
var NcStateSummarySplitSchema = _enum(["rule", "section"]);
|
|
18414
|
+
/**
|
|
18210
18415
|
* `summary`: the rule sends NOTHING per event. When a window of `schedule`
|
|
18211
18416
|
* CLOSES, it sends one notification with the current state of its kinds
|
|
18212
18417
|
* (low batteries, consumables to replace, devices offline, updates
|
|
18213
|
-
* available, ...), after its own filters
|
|
18418
|
+
* available, ...), after its own filters — or, with `split: 'section'`
|
|
18419
|
+
* (D698), one notification per section. Nothing to report sends nothing.
|
|
18214
18420
|
* The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
|
|
18215
18421
|
* midnight crossing); the send time is each window's END. Refused on the
|
|
18216
18422
|
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
18217
18423
|
*/
|
|
18218
18424
|
var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
|
|
18219
18425
|
mode: literal("summary"),
|
|
18220
|
-
schedule: NcScheduleSchema
|
|
18426
|
+
schedule: NcScheduleSchema,
|
|
18427
|
+
split: NcStateSummarySplitSchema.optional()
|
|
18221
18428
|
})]);
|
|
18222
18429
|
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
18223
18430
|
var NcPlateMatcherSchema = object({
|
|
@@ -19216,11 +19423,23 @@ var NcStateSummaryPreviewSectionSchema = object({
|
|
|
19216
19423
|
reason: string().optional()
|
|
19217
19424
|
});
|
|
19218
19425
|
/**
|
|
19426
|
+
* One notification a previewed summary would send (D698): the whole summary on
|
|
19427
|
+
* a `rule` split (no `section`), one section's on a `section` split.
|
|
19428
|
+
*/
|
|
19429
|
+
var NcStateSummaryPreviewRowSchema = object({
|
|
19430
|
+
section: string().optional(),
|
|
19431
|
+
/** The section's name on a per-section row; every reported section's, joined, on a combined one. */
|
|
19432
|
+
title: string(),
|
|
19433
|
+
text: string(),
|
|
19434
|
+
count: number().int().nonnegative()
|
|
19435
|
+
});
|
|
19436
|
+
/**
|
|
19219
19437
|
* The summary a rule would send now. `empty` = nothing to report and every
|
|
19220
19438
|
* section read: such a summary is NOT sent. `dropped` counts the open states
|
|
19221
19439
|
* the rule's own filters (or a camera mute) left out, by reason.
|
|
19222
19440
|
* `excludedGroups` names the kind groups selected that have no state to report
|
|
19223
|
-
* (backups & exports).
|
|
19441
|
+
* (backups & exports). `split` and `rows` (D698) say how it would be sent —
|
|
19442
|
+
* optional, so an older hub's answer still parses.
|
|
19224
19443
|
*/
|
|
19225
19444
|
var NcStateSummaryPreviewSchema = object({
|
|
19226
19445
|
empty: boolean(),
|
|
@@ -19228,7 +19447,9 @@ var NcStateSummaryPreviewSchema = object({
|
|
|
19228
19447
|
text: string(),
|
|
19229
19448
|
sections: array(NcStateSummaryPreviewSectionSchema),
|
|
19230
19449
|
dropped: record(string(), number().int().nonnegative()),
|
|
19231
|
-
excludedGroups: array(string())
|
|
19450
|
+
excludedGroups: array(string()),
|
|
19451
|
+
split: NcStateSummarySplitSchema.optional(),
|
|
19452
|
+
rows: array(NcStateSummaryPreviewRowSchema).optional()
|
|
19232
19453
|
});
|
|
19233
19454
|
var NcTestResultSchema = object({
|
|
19234
19455
|
recordId: string(),
|
|
@@ -26707,138 +26928,6 @@ DeviceType.Camera, method(object({
|
|
|
26707
26928
|
kind: "query",
|
|
26708
26929
|
auth: "protected"
|
|
26709
26930
|
});
|
|
26710
|
-
object({
|
|
26711
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
26712
|
-
lastPressedAt: number().nullable(),
|
|
26713
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
26714
|
-
pressCountSinceStart: number()
|
|
26715
|
-
});
|
|
26716
|
-
object({
|
|
26717
|
-
deviceId: number(),
|
|
26718
|
-
timestamp: number()
|
|
26719
|
-
});
|
|
26720
|
-
/**
|
|
26721
|
-
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
26722
|
-
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
26723
|
-
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
26724
|
-
*/
|
|
26725
|
-
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
26726
|
-
DeviceType.Camera;
|
|
26727
|
-
DeviceType.Button, DeviceType.Camera;
|
|
26728
|
-
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
26729
|
-
DeviceType.Camera, DeviceType.Camera;
|
|
26730
|
-
/** A slot's editable value, discriminated on `slot`. */
|
|
26731
|
-
var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
26732
|
-
DeviceType.Camera;
|
|
26733
|
-
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
26734
|
-
state: literal("unreachable"),
|
|
26735
|
-
reason: string()
|
|
26736
|
-
})]);
|
|
26737
|
-
/** One provider of slots — the D554 source-listing row. */
|
|
26738
|
-
var ExtensionSourceSchema = object({
|
|
26739
|
-
/** The routing prefix of every `slotRef` this provider serves. */
|
|
26740
|
-
source: string(),
|
|
26741
|
-
label: string(),
|
|
26742
|
-
/** Stamped by the dispatcher from the registry (D557). */
|
|
26743
|
-
addonId: string().optional(),
|
|
26744
|
-
availability: ExtensionSourceAvailabilitySchema
|
|
26745
|
-
});
|
|
26746
|
-
/**
|
|
26747
|
-
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
26748
|
-
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
26749
|
-
* (a source owned by another addon); `unavailable` — it exists but is not a
|
|
26750
|
-
* valid source now (a container, which is never a pick). A source in any of
|
|
26751
|
-
* these states is SHOWN, never silently dropped or re-pointed.
|
|
26752
|
-
*/
|
|
26753
|
-
var ExtensionSourceHealthSchema = _enum([
|
|
26754
|
-
"ok",
|
|
26755
|
-
"missing",
|
|
26756
|
-
"foreign",
|
|
26757
|
-
"unavailable"
|
|
26758
|
-
]);
|
|
26759
|
-
var ExtensionSlotSourceSchema = object({
|
|
26760
|
-
deviceId: number().int(),
|
|
26761
|
-
/** The device's name, or null when it could not be resolved (`missing`). */
|
|
26762
|
-
name: string().nullable(),
|
|
26763
|
-
health: ExtensionSourceHealthSchema,
|
|
26764
|
-
detail: string().optional()
|
|
26765
|
-
});
|
|
26766
|
-
/**
|
|
26767
|
-
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
26768
|
-
* reported read-only, named, never written through this contract (D62). The
|
|
26769
|
-
* virtual doorbell's sources ring only while the wrapper is bound to the
|
|
26770
|
-
* camera, and that binding belongs to `deviceManager.setWrapperActive`.
|
|
26771
|
-
* `unknown` means the gate could not be read; it is not "inactive" (D315).
|
|
26772
|
-
*/
|
|
26773
|
-
var ExtensionSlotActivationSchema = object({
|
|
26774
|
-
state: _enum([
|
|
26775
|
-
"active",
|
|
26776
|
-
"inactive",
|
|
26777
|
-
"unknown"
|
|
26778
|
-
]),
|
|
26779
|
-
authority: string(),
|
|
26780
|
-
detail: string().optional()
|
|
26781
|
-
});
|
|
26782
|
-
var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
26783
|
-
state: literal("ok"),
|
|
26784
|
-
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
26785
|
-
slotRef: string(),
|
|
26786
|
-
slot: ExtensionSlotIdSchema,
|
|
26787
|
-
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
26788
|
-
authority: string(),
|
|
26789
|
-
activation: ExtensionSlotActivationSchema.nullable(),
|
|
26790
|
-
value: ExtensionSlotValueSchema,
|
|
26791
|
-
sources: array(ExtensionSlotSourceSchema),
|
|
26792
|
-
/**
|
|
26793
|
-
* Devices the owner links to the host ON ITS OWN, by structure, and that
|
|
26794
|
-
* are therefore not in `value` (D655): a camera's device-tree children, and
|
|
26795
|
-
* the child a picked container stands for (D356 — a container is never a
|
|
26796
|
-
* pick, its children are). Read-only; the editor shows them and may offer
|
|
26797
|
-
* per-device options on them (the linked-devices tracked-event opt-in).
|
|
26798
|
-
* Absent when the owner links nothing beyond the picks, and from an owner
|
|
26799
|
-
* older than D655.
|
|
26800
|
-
*/
|
|
26801
|
-
impliedSources: array(ExtensionSlotSourceSchema).optional()
|
|
26802
|
-
}), object({
|
|
26803
|
-
state: literal("unreachable"),
|
|
26804
|
-
addonId: string(),
|
|
26805
|
-
reason: string()
|
|
26806
|
-
})]);
|
|
26807
|
-
var ExtensionCandidatesSchema = object({ candidates: array(object({
|
|
26808
|
-
deviceId: number().int(),
|
|
26809
|
-
name: string(),
|
|
26810
|
-
type: string(),
|
|
26811
|
-
location: string().nullable(),
|
|
26812
|
-
/** The container a child belongs to — "Spotlight 2" alone does not say which. */
|
|
26813
|
-
parentName: string().nullable(),
|
|
26814
|
-
/** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
|
|
26815
|
-
suggested: boolean(),
|
|
26816
|
-
/** Why it is suggested ("same location"), null when it is not. */
|
|
26817
|
-
reason: string().nullable()
|
|
26818
|
-
})) });
|
|
26819
|
-
/**
|
|
26820
|
-
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
26821
|
-
* reloaded the host (or, for an accessory child, its parent) because the
|
|
26822
|
-
* write changed what the host REGISTERS. A slot never adds a capability to its
|
|
26823
|
-
* host — that is a composition (D663) — so today's owners answer `none`.
|
|
26824
|
-
*/
|
|
26825
|
-
var ExtensionSetResultSchema = object({
|
|
26826
|
-
applied: literal(true),
|
|
26827
|
-
reload: _enum([
|
|
26828
|
-
"none",
|
|
26829
|
-
"host",
|
|
26830
|
-
"parent"
|
|
26831
|
-
])
|
|
26832
|
-
});
|
|
26833
|
-
var ExtensionSlotRefInputSchema = object({
|
|
26834
|
-
deviceId: number().int(),
|
|
26835
|
-
slotRef: string().min(1)
|
|
26836
|
-
});
|
|
26837
|
-
var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
|
|
26838
|
-
method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
|
|
26839
|
-
kind: "mutation",
|
|
26840
|
-
auth: "admin"
|
|
26841
|
-
});
|
|
26842
26931
|
/**
|
|
26843
26932
|
* Optional client-side hints sent at session creation to help the provider
|
|
26844
26933
|
* pick the best native source. All fields optional — a viewer that knows
|
|
@@ -37938,6 +38027,18 @@ Object.freeze({
|
|
|
37938
38027
|
addonId: null,
|
|
37939
38028
|
access: "view"
|
|
37940
38029
|
},
|
|
38030
|
+
"databaseSnapshot.listDatabases": {
|
|
38031
|
+
capName: "database-snapshot",
|
|
38032
|
+
capScope: "system",
|
|
38033
|
+
addonId: null,
|
|
38034
|
+
access: "view"
|
|
38035
|
+
},
|
|
38036
|
+
"databaseSnapshot.writeSnapshot": {
|
|
38037
|
+
capName: "database-snapshot",
|
|
38038
|
+
capScope: "system",
|
|
38039
|
+
addonId: null,
|
|
38040
|
+
access: "create"
|
|
38041
|
+
},
|
|
37941
38042
|
"dataStoreProvider.aggregate": {
|
|
37942
38043
|
capName: "data-store-provider",
|
|
37943
38044
|
capScope: "system",
|
|
@@ -46466,6 +46567,18 @@ var STATE_SUMMARY_VARS = [
|
|
|
46466
46567
|
systemEventKinds: [...SUMMARISABLE],
|
|
46467
46568
|
systemEventDeliveries: ["summary"]
|
|
46468
46569
|
},
|
|
46570
|
+
{
|
|
46571
|
+
name: "summarySection",
|
|
46572
|
+
label: "Summary: this section",
|
|
46573
|
+
description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
|
|
46574
|
+
example: "Batterie scariche",
|
|
46575
|
+
group: "system",
|
|
46576
|
+
families: ["rule"],
|
|
46577
|
+
fields: [...RULE_TEXT],
|
|
46578
|
+
kinds: ["system"],
|
|
46579
|
+
systemEventKinds: [...SUMMARISABLE],
|
|
46580
|
+
systemEventDeliveries: ["summary"]
|
|
46581
|
+
},
|
|
46469
46582
|
...STATE_SUMMARY_SECTION_VARS.map((v) => ({
|
|
46470
46583
|
name: v.name,
|
|
46471
46584
|
label: v.label,
|
|
@@ -47005,7 +47118,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
47005
47118
|
capability: adminUiCapability,
|
|
47006
47119
|
provider: {
|
|
47007
47120
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
47008
|
-
getVersion: async () => ({ version: "1.2.
|
|
47121
|
+
getVersion: async () => ({ version: "1.2.298" })
|
|
47009
47122
|
}
|
|
47010
47123
|
}];
|
|
47011
47124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-admin-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.298",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Admin UI — Vite frontend build and server-side addon",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"preview": "vite preview",
|
|
42
42
|
"test": "vitest run",
|
|
43
43
|
"test:watch": "vitest",
|
|
44
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.server.json",
|
|
44
|
+
"typecheck": "tsc --noEmit -p tsconfig.spec.json && tsc --noEmit -p tsconfig.server.json",
|
|
45
45
|
"publish:npm": "npm publish --access public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{G as e,I as t,K as n,Q as r,S as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{at as l}from"./player-overlays-T90xSvHE.js";import{B as u,H as d,Rr as f,Vr as p,_i as m,an as h,c as g,cn as _,qi as v,tn as y,vi as b}from"./src-D-Ti2TOa.js";import{An as x,Cn as S,Dt as C,Et as w,Mn as ee,Nn as te,_n as ne,bn as T,cn as E,dn as re,fn as ie,gn as ae,hn as oe,jn as se,pn as ce,vn as D,wn as O,yn as k}from"./src-BvHjCPd8.js";import{l as A}from"./index-DbfYR34Q.js";r();function le(e){return{target:{kind:`new`,type:e},name:``,features:[]}}function ue(e){return{target:{kind:`existing`,device:e},name:``,features:[]}}function de(e,t){return{target:e.target,name:t,features:e.features.flatMap(e=>e.kind===`fields`?[e]:[])}}function j(e,t,n){return{...e,features:e.features.map(e=>e.cap===t?n(e):e)}}function M(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>e!==t))}function fe(e,t){switch(t.type){case`set-new-type`:return e.target.kind===`new`?{...e,target:{...e.target,type:t.deviceType}}:e;case`set-new-role`:{if(e.target.kind!==`new`)return e;let{role:n,...r}=e.target;return{...e,target:t.role===null?r:{...r,role:t.role}}}case`set-name`:return{...e,name:t.name};case`add-feature`:return e.features.some(e=>e.cap===t.cap)?e:{...e,features:[...e.features,{kind:`fields`,cap:t.cap,fields:{}}]};case`remove-feature`:return{...e,features:e.features.filter(e=>e.cap!==t.cap)};case`set-field`:return j(e,t.cap,e=>({...e,fields:{...e.fields,[t.path]:t.source}}));case`clear-field`:return j(e,t.cap,e=>({...e,fields:M(e.fields,t.path)}));case`copy-feature`:return j(e,t.cap,e=>({...e,fields:{...e.fields,...Object.fromEntries(t.paths.map(e=>[e,{kind:`from`,source:t.from,cap:t.sourceCap,fieldPath:e}]))}}))}}function pe(e){let t=ce.safeParse({target:e.target,features:e.features});return t.success?{ok:!0,composition:t.data}:{ok:!1,problems:t.error.issues.map(e=>`${e.path.join(`.`)||`composition`}: ${e.message}`)}}function me(e){for(let t=1;;t++){let n=`s${t}`;if(!e.includes(n))return n}}function N(e){return{addonId:e.addonId,stableId:e.stableId}}function P(e){return new Map(e.map(e=>[k(N(e)),e]))}function he(e,t,n){return e.filter(e=>e.id!==n&&e.type!==O.Container&&t.includes(e.id)).toSorted((e,t)=>e.name.localeCompare(t.name))}function ge(e,t,n){let r=e?.features??[],i=r.findIndex(e=>e.cap===n.cap);return{target:e?.target??{kind:`existing`,device:t},features:i===-1?[...r,n]:r.map((e,t)=>t===i?n:e)}}function _e(e,t){let n=e.features.filter(e=>e.cap!==t);return n.length===0?null:{target:e.target,features:n}}function F(e,t){let n=e?.features.find(e=>e.cap===t);return n!==void 0&&n.kind===`fields`?n:null}function I(e){return Array.isArray(e)?e.map(I):typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,I(t)]))}function L(e){return JSON.stringify(I(e))}function R(e,t){return L(e)===L(t)}function ve(e,t){switch(e.kind){case`pending`:return{kind:`refused`,reason:`the customization has not been read yet — try again`};case`unknown`:return{kind:`refused`,reason:`the customization could not be read: ${e.reason}`};case`not-loaded`:return{kind:`refused`,reason:`the customizations are not loaded yet: ${e.reason}`};case`none`:return t===null?{kind:`noop`}:{kind:`create`,input:{enabled:!0,composition:t}};case`present`:{let n=e.view.block.id;return t===null?{kind:`delete`,blockId:n}:L(t)===L(e.composition)?{kind:`noop`}:{kind:`update`,blockId:n,expectedUpdatedAt:e.view.block.updatedAt,composition:t}}}}function z(e,t){let n=e===`enum`?`string`:e,r=t.kind===`enum`?`string`:t.kind,i={source:t.source,cap:t.cap,fieldPath:t.fieldPath};return r===n?{kind:`from`,...i}:n===`number`&&r===`string`?{kind:`expression`,expr:`number(x)`,bindings:{x:{kind:`from`,...i}}}:null}function B(e){return{kind:`expression`,expr:e,bindings:{}}}function V(e){let t=z(`number`,e.percentage);return t===null?null:{kind:`fields`,cap:`battery`,fields:e.mode===`replace`?{percentage:t}:{percentage:t,charging:B(`"unknown"`),sleeping:B(`false`),lastUpdated:B(`now`)}}}var H=ee.filter(e=>e!==`switch`&&e!==`motion`);function ye(e){let t=te[e.cap];return t===void 0||!H.includes(e.cap)?null:{kind:`fields`,cap:e.cap,fields:{[t]:{kind:`expression`,expr:`!v`,bindings:{v:{kind:`from`,source:e.self,cap:e.cap,fieldPath:t}}}}}}function be(e){return e.from===e.to||!C(e.from,e.to)?null:{kind:`fields`,cap:e.cap,fields:{[e.fieldPath]:{kind:`expression`,expr:`convert(v, ${JSON.stringify(e.from)}, ${JSON.stringify(e.to)})`,bindings:{v:{kind:`from`,source:e.self,cap:e.cap,fieldPath:e.fieldPath}}},...e.unitField===null?{}:{[e.unitField]:B(JSON.stringify(e.to))}}}}function xe(e,t){let n=z(`number`,t.remaining);if(n===null||!ie.test(t.key)||t.label.trim()===``)return null;let r={label:t.label.trim(),fields:{"remaining.value":n,"remaining.unit":B(JSON.stringify(t.unit))}};return{kind:`fields`,cap:`consumables`,...e?.enabled===void 0?{}:{enabled:e.enabled},fields:e?.fields??{lastChangedAt:B(`now`),lastFetchedAt:B(`now`)},items:{...e?.items,[t.key]:r}}}function Se(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function Ce(e){let t=e.fields.lastPressedAt;if(t===void 0||t.kind!==`expression`)return[];let n=Object.entries(t.bindings).filter(([e])=>e.startsWith(`active`)).flatMap(([,e])=>e.kind===`from`?[e.source]:[]);return[...new Map(n.map(e=>[k(e),e])).values()]}function we(e){let t=e.fields.lastPressedAt;if(t===void 0||t.kind!==`expression`)return[];let n=t.bindings;return Object.entries(n).flatMap(([e,t])=>{if(!e.startsWith(`active`)||t.kind!==`from`)return[];let r=n[`changed${e.slice(6)}`];return r===void 0||r.kind!==`from`?[]:[{source:t.source,cap:t.cap,activeField:t.fieldPath,changedAtField:r.fieldPath}]})}function Te(e){if(e===void 0)return null;if(e.kind===`from`){let{kind:t,...n}=e;return{...n,kind:`number`}}if(e.kind!==`expression`||e.expr!==`number(x)`)return null;let t=e.bindings.x;if(t===void 0||t.kind!==`from`||Object.keys(e.bindings).length!==1)return null;let{kind:n,...r}=t;return{...r,kind:`string`}}function Ee(e,t){let n=Te(e.fields.percentage);if(n===null)return!1;let r=V({percentage:n,mode:t}),{enabled:i,...a}=e;return r!==null&&R(a,r)}function U(e){return e.map(e=>({id:e.id,name:e.name,addonId:e.addonId,stableId:e.stableId,location:e.location,type:e.type}))}function De(e,t,n){let r=t.trim().toLowerCase();return r===``?[]:e.filter(e=>!n.includes(e.id)&&[e.name,e.stableId,e.location??``].some(e=>e.toLowerCase().includes(r))).toSorted((e,t)=>e.name.localeCompare(t.name)).slice(0,20)}function W(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Object.getOwnPropertyDescriptor(n,e)?.value}return n}function Oe(e,t,n,r){return r===null?{kind:`from`,source:e,cap:t,fieldPath:n.path}:z(r,{source:e,cap:t,fieldPath:n.path,kind:n.kind})}function ke(e,t,n,r){let i={addonId:e.addonId,stableId:e.stableId};return t.caps.flatMap(e=>e.fields.filter(e=>e.item!==!0).map(t=>({cap:e.cap,path:t.path,kind:t.kind,value:n===null?void 0:W(n[e.cap],t.path),source:Oe(i,e.cap,t,r)})))}function G(e,t){return t?e===void 0?`—`:e===null?`null`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e):`…`}var K=[];function q({title:e,targetKind:t,excludeDeviceIds:n=K,onPick:r,onCancel:a}){let{t:c}=A(),[l,u]=o(null);return i(`aside`,{"aria-label":e,className:`rounded-lg border border-border bg-surface p-3 flex flex-col gap-2`,children:[s(`h3`,{className:`text-xs font-semibold`,children:e}),l===null?s(Ae,{excludeDeviceIds:n,onSelect:u}):s(je,{device:l,targetKind:t,onPick:r,onBack:()=>u(null)}),s(`div`,{children:s(_,{variant:`ghost`,onClick:a,children:c(`customize.picker.cancel`)})})]})}function Ae({excludeDeviceIds:e,onSelect:t}){let{t:n}=A(),[r,c]=o(``),l=b({projection:`slim`});return i(a,{children:[i(`label`,{className:`flex flex-col gap-1 text-[11px]`,children:[n(`customize.picker.search`),s(`input`,{type:`search`,"aria-label":n(`customize.picker.search`),className:`px-1.5 py-0.5 text-[11px] bg-background border border-border rounded`,value:r,onChange:e=>c(e.target.value)})]}),l.status===`pending`&&s(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:n(`customize.picker.loadingDevices`)}),l.status===`error`&&s(h,{title:n(`customize.picker.devicesFailed`),message:l.error?.message??``}),l.status===`success`&&s(`ul`,{className:`flex flex-col gap-1`,children:De(U(l.data),r,e).map(e=>s(`li`,{children:i(`button`,{type:`button`,className:`text-left text-[11px] hover:underline`,onClick:()=>t(e),children:[e.name,` `,i(`span`,{className:`text-foreground-subtle`,children:[`· `,e.stableId]})]})},e.id))})]})}function je({device:e,targetKind:t,onPick:n,onBack:r}){let{t:a}=A(),o=m({deviceId:e.id}),c=v({deviceId:e.id});if(o.status===`pending`)return s(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:a(`customize.picker.loadingFields`)});if(o.status===`error`)return s(h,{title:a(`customize.picker.fieldsFailed`),message:o.error?.message??``});let l=ke(e,o.data,c.status===`success`?c.data:null,t),u=l.filter(e=>e.source===null).length,d={addonId:e.addonId,stableId:e.stableId};return i(`div`,{className:`flex flex-col gap-1`,children:[i(`button`,{type:`button`,className:`text-left text-[11px] text-primary`,onClick:r,children:[`← `,e.name]}),c.status===`error`&&s(`p`,{role:`alert`,className:`text-[10px] text-warning`,children:a(`customize.picker.valuesFailed`,{reason:c.error?.message??``})}),s(`ul`,{role:`listbox`,"aria-label":a(`customize.picker.fields`),className:`flex flex-col gap-1`,children:l.map(t=>{let r=t.source;if(r===null)return null;let a=()=>n({device:e,ref:d,cap:t.cap,path:t.path,kind:t.kind,source:r,value:t.value});return i(`li`,{role:`option`,"aria-selected":!1,tabIndex:0,className:`flex justify-between gap-2 text-[11px] cursor-pointer hover:bg-surface-hover rounded px-1`,onClick:a,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&a()},children:[i(`span`,{className:`font-mono`,children:[t.cap,`.`,t.path]}),s(`span`,{children:G(t.value,c.status===`success`)})]},`${t.cap}.${t.path}`)})}),u>0&&t!==null&&s(`p`,{className:`text-[10px] text-foreground-subtle`,children:a(`customize.picker.hidden`,{count:u,kind:a(`customize.kinds.${t}`)})})]})}var J=`integration`;function Y(e,t){switch(e.kind){case`from`:{let n=k(e.source);return`${t.get(n)??n} · ${e.cap}.${e.fieldPath}`}case`expression`:return e.expr;case`code`:return`code`}}function Me(e,t){if(e.kind===`unreachable`)return{kind:`unknown`,reason:e.error};if(e.state===null)return{kind:`unknown`,reason:`the composer has not reported this customization yet`};let n=e.state.fields.find(t);return n===void 0?{kind:`unknown`,reason:`the composer reports no value for this field`}:n.state===`unavailable`?{kind:`unavailable`,reason:n.reason??`unavailable`}:{kind:`value`,value:n.value,staleReason:n.state===`stale`?n.reason??`stale`:null}}function X(e,t,n,r){return{key:`${e.feature.cap}.${t}`,cap:e.feature.cap,field:t,origin:`composed`,mode:e.mode,from:Y(n,e.input.sourceNames),value:e.enabled?Me(e.input.state,r):{kind:`off`}}}function Ne(e){let t=e.feature.cap;return Object.entries(e.feature.fields).map(([n,r])=>X(e,n,r,e=>e.cap===t&&e.path===n&&e.item===void 0))}function Pe(e){let t=e.feature.cap;return Object.entries(e.feature.items??{}).flatMap(([n,r])=>Object.entries(r.fields).map(([r,i])=>X(e,ae(re,n,r),i,e=>e.cap===t&&e.path===r&&e.item?.arrayPath===`items`&&e.item.key===n)))}function Fe(e,t,n){if(e===null)return{kind:`unknown`,reason:`the device state could not be read`};let r=W(e[t],n),i=r===void 0?void 0:x(r);return i===void 0?{kind:`unknown`,reason:`not reported`}:{kind:`value`,value:i,staleReason:null}}function Ie(e){if(e.mode!==`replace`)return[];let t=e.feature.cap,n=new Set(Object.keys(e.feature.fields));return(e.input.nativeFields.get(t)??[]).filter(e=>!n.has(e)).map(n=>({key:`${t}.${n}`,cap:t,field:n,origin:`native`,mode:e.mode,from:J,value:Fe(e.input.snapshot,t,n)}))}function Le(e){return e.composition.features.flatMap(t=>{if(t.kind!==`fields`)return[];let n={feature:t,mode:e.nativeCaps.has(t.cap)?`replace`:`add`,enabled:oe(t),input:e};return[...Ne(n),...Pe(n),...Ie(n)]})}var Re={min:`min(a, b, …)`,max:`max(a, b, …)`,abs:`abs(x)`,floor:`floor(x)`,ceil:`ceil(x)`,sqrt:`sqrt(x)`,round:`round(x, digits?)`,pow:`pow(x, y)`,clamp:`clamp(x, lo, hi)`,avg:`avg(a, b, …)`,sum:`sum(a, b, …)`,coalesce:`coalesce(a, b, …)`,age:`age(now, ts)`,convert:`convert(x, "from", "to")`,any:`any(a, b, …)`,all:`all(a, b, …)`,within:`within(ts, ms)`,number:`number(x)`,latest:`latest(ts, …)`,rose:`rose(level, changedAt, debounceMs?)`,count:`count(x)`},Z=/[A-Za-z_][A-Za-z0-9_]*$/;function ze(e,t,n){let r=Z.exec(e.slice(0,t))?.[0]??``;if(r===``)return[];let i=n.filter(e=>e.startsWith(r)).toSorted().map(e=>({kind:`binding`,label:e,insert:e,hintKey:null})),a=`now`.startsWith(r)?[{kind:`now`,label:`now`,insert:`now`,hintKey:`compositionEditor.now`}]:[],o=[...se].filter(e=>e.startsWith(r)).toSorted().map(e=>({kind:`builtin`,label:Re[e]??e,insert:`${e}(`,hintKey:`compositionEditor.builtins.${e}`}));return[...i,...a,...o].slice(0,8)}function Be(e,t,n){let r=t-(Z.exec(e.slice(0,t))?.[0]??``).length;return{text:`${e.slice(0,r)}${n.insert}${e.slice(t)}`,cursor:r+n.insert.length}}r();function Ve({label:e,value:t,bindings:r,onChange:a}){let{t:c}=A(),l=n(null),[u,d]=o(t.length),f=ze(t,u,r);return i(`div`,{className:`flex flex-col gap-1`,children:[i(`label`,{className:`flex flex-col gap-1 text-[11px]`,children:[e,s(`input`,{ref:l,className:`font-mono px-1.5 py-0.5 text-[11px] bg-background border border-border rounded`,value:t,onChange:e=>{a(e.target.value),d(e.target.selectionStart??e.target.value.length)},onSelect:e=>d(e.currentTarget.selectionStart??t.length)})]}),f.length>0&&s(`ul`,{role:`listbox`,"aria-label":c(`compositionEditor.suggestions`),className:`rounded border border-border bg-surface text-[11px]`,children:f.map(e=>i(`li`,{role:`option`,"aria-selected":!1,tabIndex:0,className:`flex justify-between gap-2 px-1 cursor-pointer hover:bg-surface-hover`,onClick:()=>{let n=Be(t,u,e);a(n.text),d(n.cursor),l.current?.focus()},children:[s(`span`,{className:`font-mono`,children:e.label}),e.hintKey!==null&&s(`span`,{className:`text-foreground-subtle`,children:c(e.hintKey)})]},`${e.kind}:${e.label}`))})]})}function He(e,t,n){if(e.kind===`code`)return{kind:`unavailable`,reason:`code fields arrive in slice 4`};if(e.kind===`expression`&&(E(e.expr,`rose`)||E(e.expr,`count`)))return{kind:`runtime-only`};let r=T(e).filter(e=>t.get(D(e.source,e.cap))?.kind!==`value`).map(ne);if(r.length>0)return{kind:`waiting`,missing:r};let i=w({source:e,now:n,read:e=>{let n=t.get(D(e.source,e.cap)),r=n?.kind===`value`?W(n.slice,e.fieldPath):void 0,i=r===void 0?void 0:x(r);return i===void 0?{state:`unavailable`,reason:`${e.cap}.${e.fieldPath} is not reported`,fatal:!1}:{state:`fresh`,value:i}}});return i.state===`unavailable`?{kind:`unavailable`,reason:i.reason}:{kind:`value`,value:i.value,stale:i.reason}}r();function Ue({sliceKey:e,deviceId:t,capName:n,onReading:r}){let i=g(l().trpcClient,t,n);return c(()=>{r(e,i===void 0?{kind:`pending`}:{kind:`value`,slice:i})},[e,i,r]),null}function We(e,t){return[...new Map(T(e).map(e=>[D(e.source,e.cap),e]))].map(([e,n])=>({key:e,read:n,device:t.get(k(n.source))}))}function Ge({source:e}){let{t:n}=A(),r=b({projection:`slim`}),[a,c]=o(new Map),l=t((e,t)=>{c(n=>new Map([...n,[e,t]]))},[]),u=We(e,P(r.status===`success`?U(r.data):[])),d=r.status===`success`?u.filter(e=>e.device===void 0).map(e=>k(e.read.source)):[];return i(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px]`,children:[u.map(e=>e.device===void 0?null:s(Ue,{sliceKey:e.key,deviceId:e.device.id,capName:e.read.cap,onReading:l},e.key)),s(`span`,{className:`text-foreground-subtle`,children:n(`compositionEditor.preview.label`)}),r.status===`error`?s(`span`,{className:`text-warning`,children:n(`compositionEditor.preview.devicesFailed`,{reason:r.error?.message??``})}):d.length>0?s(`span`,{className:`text-warning`,children:n(`compositionEditor.preview.unknownDevice`,{sources:d.join(`, `)})}):s(Ke,{preview:He(e,a,Date.now())})]})}function Ke({preview:e}){let{t}=A();switch(e.kind){case`value`:return i(`strong`,{children:[`→ `,G(e.value,!0),e.stale===null?``:` (${e.stale})`]});case`unavailable`:return s(`span`,{className:`text-warning`,children:e.reason});case`waiting`:return s(`span`,{className:`text-foreground-subtle`,children:t(`compositionEditor.preview.waiting`,{sources:e.missing.join(`, `)})});case`runtime-only`:return s(`span`,{className:`text-foreground-subtle`,children:t(`compositionEditor.preview.runtimeOnly`)})}}r();function qe({path:e,kind:t,required:n,source:r,onSet:c,onClear:l,sourceNames:u}){let{t:d}=A(),[f,p]=o(`idle`),m=r?.kind===`expression`?r:null;return i(`div`,{className:`flex flex-col gap-1 rounded border border-border p-2`,children:[i(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`span`,{className:`font-mono text-[11px]`,children:e}),i(`span`,{className:`text-[10px] text-foreground-subtle`,children:[d(`customize.kinds.${t}`),n?` · ${d(`compositionEditor.required`)}`:``]}),s(_,{size:`sm`,variant:`outline`,onClick:()=>p(`take`),children:d(`compositionEditor.takeFrom`)}),s(_,{size:`sm`,variant:`outline`,"aria-pressed":m!==null,onClick:()=>c(m??{kind:`expression`,expr:`null`,bindings:{}}),children:d(`compositionEditor.formula`)}),r!==void 0&&s(_,{size:`sm`,variant:`ghost`,onClick:l,children:d(`compositionEditor.clear`)})]}),r?.kind===`from`&&s(`span`,{className:`text-[11px]`,children:Y(r,u)}),m!==null&&i(a,{children:[s(Ve,{label:d(`compositionEditor.formulaFor`,{path:e}),value:m.expr,bindings:Object.keys(m.bindings),onChange:e=>c({...m,expr:e})}),s(`ul`,{className:`text-[11px] flex flex-col gap-0.5`,children:Object.entries(m.bindings).map(([e,t])=>i(`li`,{className:`flex gap-2`,children:[s(`span`,{className:`font-mono`,children:e}),s(`span`,{children:t.kind===`from`?Y(t,u):JSON.stringify(t.value)})]},e))}),s(_,{size:`sm`,variant:`ghost`,onClick:()=>p(`add-binding`),children:d(`compositionEditor.addSource`)})]}),f!==`idle`&&s(q,{title:d(f===`take`?`compositionEditor.takeFrom`:`compositionEditor.addSource`),targetKind:f===`take`?t:null,onCancel:()=>p(`idle`),onPick:e=>{if(f===`take`)c(e.source);else if(m!==null){let t=me(Object.keys(m.bindings));c({...m,bindings:{...m.bindings,[t]:{kind:`from`,source:e.ref,cap:e.cap,fieldPath:e.path}}})}p(`idle`)}}),r!==void 0&&s(Ge,{source:r})]})}r();function Q(e){return e===null||e.kind===`known`?null:e}function Je({draft:e,deviceType:t,nativeCaps:n,targetFields:r,dispatch:c}){let{t:l}=A(),u=f({deviceType:t}),d=b({projection:`slim`}),p=new Map([...P(d.status===`success`?U(d.data):[])].map(([e,t])=>[e,t.name])),[m,h]=o(null),g=Q(n)??Q(r),v=n?.kind===`known`?n.value:new Set,x=new Set(e.features.map(e=>e.cap)),S=u.status===`success`?u.data.caps.filter(e=>!x.has(e.cap)&&!v.has(e.cap)):[],C=[...v].filter(e=>!x.has(e)),w=e=>v.has(e)?((r?.kind===`known`?r.value.caps.find(t=>t.cap===e):void 0)?.fields??[]).filter(e=>e.item!==!0&&!e.path.includes(`.`)).map(e=>({path:e.path,kind:e.kind,required:!1})):((u.status===`success`?u.data.caps.find(t=>t.cap===e):void 0)?.fields??[]).map(e=>({path:e.path,kind:e.kind,required:e.required}));return g===null?i(a,{children:[i(`section`,{"aria-labelledby":`editor-features`,className:`flex flex-col gap-2`,children:[s(`h2`,{id:`editor-features`,className:`text-sm font-semibold`,children:l(`compositionEditor.steps.features`)}),u.status===`pending`&&s(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:l(`customize.presets.checking`)}),u.status===`error`&&s(`p`,{role:`alert`,className:`text-[11px] text-warning`,children:l(`customize.presets.unknown`,{reason:u.error?.message??``})}),i(`div`,{className:`flex flex-wrap gap-1`,children:[e.features.map(e=>i(`span`,{className:`flex items-center gap-1 rounded border border-border px-1.5 text-[11px]`,children:[e.cap,s(y,{variant:v.has(e.cap)?`default`:`info`,children:v.has(e.cap)?l(`compositionEditor.replaces`):l(`customize.fields.added`)}),s(`button`,{type:`button`,"aria-label":l(`compositionEditor.removeFeature`,{cap:e.cap}),onClick:()=>c({type:`remove-feature`,cap:e.cap}),children:`×`})]},e.cap)),S.map(e=>i(_,{size:`sm`,variant:`outline`,onClick:()=>c({type:`add-feature`,cap:e.cap}),children:[`+ `,e.cap]},e.cap)),C.map(e=>s(_,{size:`sm`,variant:`ghost`,onClick:()=>c({type:`add-feature`,cap:e}),children:l(`compositionEditor.replaceIn`,{cap:e})},e))]})]}),e.features.map(e=>i(`section`,{"aria-label":l(`compositionEditor.steps.fieldsOf`,{cap:e.cap}),className:`flex flex-col gap-2`,children:[i(`div`,{className:`flex items-center justify-between`,children:[s(`h2`,{className:`text-sm font-semibold`,children:l(`compositionEditor.steps.fieldsOf`,{cap:e.cap})}),s(_,{size:`sm`,variant:`outline`,onClick:()=>h(e.cap),children:l(`compositionEditor.copyFeature`)})]}),m===e.cap&&s(q,{title:l(`compositionEditor.copyFeature`),targetKind:null,onCancel:()=>h(null),onPick:t=>{c({type:`copy-feature`,cap:e.cap,from:t.ref,sourceCap:t.cap,paths:w(e.cap).map(e=>e.path)}),h(null)}}),w(e.cap).map(t=>s(qe,{path:t.path,kind:t.kind,required:t.required,source:e.fields[t.path],onSet:n=>c({type:`set-field`,cap:e.cap,path:t.path,source:n}),onClear:()=>c({type:`clear-field`,cap:e.cap,path:t.path}),sourceNames:p},t.path))]},e.cap))]}):i(`section`,{"aria-labelledby":`editor-features`,className:`flex flex-col gap-2`,children:[s(`h2`,{id:`editor-features`,className:`text-sm font-semibold`,children:l(`compositionEditor.steps.features`)}),s(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:g.kind===`unknown`?g.reason:l(`customize.fields.reading`)})]})}var $=`px-1.5 py-0.5 text-[11px] bg-background border border-border rounded`;function Ye({draft:e,targetName:t,dispatch:n}){let{t:r}=A(),a=e.target;return i(`section`,{"aria-labelledby":`editor-target`,className:`flex flex-col gap-2`,children:[s(`h2`,{id:`editor-target`,className:`text-sm font-semibold`,children:r(`compositionEditor.steps.target`)}),a.kind===`existing`?s(`p`,{className:`text-[11px]`,children:r(`compositionEditor.existingTarget`,{name:t??`${a.device.addonId}/${a.device.stableId}`})}):i(`div`,{className:`grid grid-cols-3 gap-2`,children:[i(`label`,{className:`flex flex-col gap-1 text-[11px]`,children:[r(`customize.identity.type`),s(`select`,{className:$,value:a.type,onChange:e=>{let t=Object.values(O).find(t=>t===e.target.value);t!==void 0&&n({type:`set-new-type`,deviceType:t})},children:Object.values(O).map(e=>s(`option`,{value:e,children:d(e).label},e))})]}),i(`label`,{className:`flex flex-col gap-1 text-[11px]`,children:[r(`customize.identity.role`),i(`select`,{className:$,value:a.role??``,onChange:e=>n({type:`set-new-role`,role:Object.values(S).find(t=>t===e.target.value)??null}),children:[s(`option`,{value:``,children:r(`customize.identity.noRole`)}),Object.values(S).map(e=>s(`option`,{value:e,children:u(e).label},e))]})]}),i(`label`,{className:`flex flex-col gap-1 text-[11px]`,children:[r(`compositionEditor.name`),s(`input`,{className:$,value:e.name,onChange:e=>n({type:`set-name`,name:e.target.value})})]})]})]})}r();function Xe({draft:e,blockId:t,saving:n,onSave:r,onCancel:a}){let{t:l}=A(),u=p(),d=pe(e),f=d.ok?JSON.stringify(d.composition):``,[m,h]=o({key:``,state:{kind:`checking`}});c(()=>{if(!d.ok)return;let e=d.composition,n=setTimeout(()=>{u.mutateAsync({composition:e,...t===null?{}:{blockId:t}}).then(e=>h({key:f,state:e.ok?{kind:`ok`}:{kind:`refused`,problems:e.problems}})).catch(e=>h({key:f,state:{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}))},500);return()=>clearTimeout(n)},[f,t]);let g=d.ok?m.key===f?m.state:{kind:`checking`}:{kind:`invalid-draft`,problems:d.problems};return i(`section`,{"aria-labelledby":`editor-verify`,className:`flex flex-col gap-2`,children:[s(`h2`,{id:`editor-verify`,className:`text-sm font-semibold`,children:l(`compositionEditor.steps.verify`)}),g.kind===`checking`&&s(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:l(`compositionEditor.verify.checking`)}),g.kind===`ok`&&s(`p`,{className:`text-[11px] text-success`,children:l(`compositionEditor.verify.ok`)}),g.kind===`unknown`&&s(`p`,{role:`alert`,className:`text-[11px] text-warning`,children:l(`compositionEditor.verify.unknown`,{reason:g.reason})}),(g.kind===`invalid-draft`||g.kind===`refused`)&&s(`ul`,{role:`alert`,className:`flex flex-col gap-1 text-[11px] text-danger`,children:g.kind===`invalid-draft`?g.problems.map(e=>s(`li`,{children:e},e)):g.problems.map(e=>i(`li`,{children:[s(`span`,{className:`font-mono`,children:e.path}),` — `,e.message]},`${e.path}:${e.code}`))}),i(`div`,{className:`flex gap-2`,children:[s(_,{variant:`ghost`,onClick:a,children:l(`compositionEditor.cancel`)}),s(_,{disabled:g.kind!==`ok`||n||!d.ok,onClick:()=>d.ok&&r(d.composition),children:l(`compositionEditor.save`)})]})]})}r();function Ze({initial:t,blockId:n,deviceType:r,targetName:a=null,nativeCaps:c,targetFields:l,save:u,onCancel:d}){let[f,p]=e(fe,t),[m,h]=o(!1),[g,_]=o(null),v=f.target.kind===`new`?f.target.type:r,y=async e=>{h(!0);let t=await u(e,f.name);h(!1),_(t.kind===`refused`?t.reason:null)};return i(`div`,{className:`flex flex-col gap-4`,children:[s(Ye,{draft:f,targetName:a,dispatch:p}),s(Je,{draft:f,deviceType:v,nativeCaps:c,targetFields:l,dispatch:p}),s(Xe,{draft:f,blockId:n,saving:m,onSave:e=>void y(e),onCancel:d}),g!==null&&s(`p`,{role:`alert`,className:`text-[11px] text-danger break-words`,children:g})]})}export{he as C,le as D,ue as E,P as S,de as T,F as _,G as a,ge as b,H as c,be as d,Ce as f,Se as g,Ee as h,q as i,V as l,ye as m,J as n,W as o,we as p,Le as r,U as s,Ze as t,xe as u,ve as v,N as w,_e as x,R as y};
|