@deepblend/dsh-blender-bundle 0.15.0 → 0.18.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/lib/client.js CHANGED
@@ -112,6 +112,47 @@ window.__ModuleLoader__.load({
112
112
  'workbench.system': '跟随系统',
113
113
  'workbench.light': '浅色',
114
114
  'workbench.dark': '深色',
115
+ 'lighttable.start': '开始',
116
+ 'lighttable.brief': '需求',
117
+ 'lighttable.briefHint': '保存目标与参考,再查看结果。需要新的建模操作时,在 DSH 对话中继续描述。',
118
+ 'lighttable.historyTitle': '已保存的结果',
119
+ 'lighttable.overview': '场景信息',
120
+ 'recipes.about': '说明与许可',
121
+ 'assembly.saving': '正在保存并生成预览…',
122
+ 'lighttable.result': '看结果',
123
+ 'lighttable.adjust': '调整',
124
+ 'lighttable.deliver': '导出',
125
+ 'lighttable.new': '新作品',
126
+ 'lighttable.project': '当前作品',
127
+ 'lighttable.settings': '工作台设置',
128
+ 'lighttable.beginTitle': '从一个想法,开始一件作品',
129
+ 'lighttable.beginHint': '选择一个起点,看到结果后继续调整。也可以在 DSH 对话中描述需求,让 DeepBlend 工具完成建模。',
130
+ 'lighttable.goalHint': '记录这件作品的目标;自动建模请在 DSH 对话中描述需求。',
131
+ 'lighttable.recent': '最近结果',
132
+ 'lighttable.allVersions': '全部版本',
133
+ 'lighttable.noImage': '这个版本还没有预览',
134
+ 'lighttable.noImageHint': '保存的工程仍在。回到当前版本生成预览,或从版本页保存可编辑副本。',
135
+ 'lighttable.saved': '已保存 · {revision}',
136
+ 'lighttable.imageSource': '图片来源 · {revision}',
137
+ 'lighttable.sourceUnknown': '来源暂无法确认',
138
+ 'lighttable.history': '正在查看历史版本 {revision};当前保存的是 {current}。',
139
+ 'lighttable.backCurrent': '回到当前版本',
140
+ 'lighttable.compareCurrent': '与当前版本比较',
141
+ 'lighttable.historyExport': '到版本页保存这份副本',
142
+ 'lighttable.details': '图片与来源详情',
143
+ 'lighttable.tools': '调整作品',
144
+ 'lighttable.toolsHint': '修改尺寸、外观与摄影,保存后查看真实结果。',
145
+ 'lighttable.previewTools': '查看与检查',
146
+ 'lighttable.previewHint': '生成新预览,或比较已保存的结果。',
147
+ 'lighttable.deliveryTitle': '交付作品',
148
+ 'lighttable.deliveryHint': '渲染影片,或保存一个可以继续编辑的版本。',
149
+ 'lighttable.editable': '保存可编辑副本',
150
+ 'lighttable.outline': '选择对象与查看场景',
151
+ 'lighttable.photography': '摄影与灯光',
152
+ 'lighttable.assets': '素材与参考',
153
+ 'lighttable.guide': '创作提示',
154
+ 'lighttable.projectList': '继续已有作品',
155
+ 'lighttable.loading': '正在打开你的工作台',
115
156
  'workbench.navigation': '工作台页面',
116
157
  'workbench.unsaved': '有未保存的修改',
117
158
  'projects.name': '作品名称',
@@ -615,7 +656,7 @@ window.__ModuleLoader__.load({
615
656
  'preview.latest': '最新预览',
616
657
  'preview.compare': '查看:',
617
658
  'preview.lastVsThis': '上一次 vs 本次渲染',
618
- 'preview.twoRevisions': '两个 revision',
659
+ 'preview.twoRevisions': '版本对比',
619
660
  'preview.structuralDiff': '看结构差异',
620
661
  'preview.identical': '结构完全相同',
621
662
  'jobs.empty': '还没有渲染任务。',
@@ -672,8 +713,42 @@ window.__ModuleLoader__.load({
672
713
  'revisions.compare': '与当前版对比',
673
714
  'revisions.compareCurrent': '与另一版对比',
674
715
  'revisions.compareHint': '选择已保存版本与当前版对比;选择当前版会对比相邻的另一版。需要至少两版,查看不会改动作品。',
716
+ 'revisions.sourceChanged': '工程内容有变化',
717
+ 'revisions.sourceUnchanged': '工程内容未变化',
718
+ 'revisions.sourceUnknown': '暂无法确认工程内容变化',
675
719
  'revisions.restore': '恢复',
676
- 'host.reading': '读取 Host 状态…',
720
+ "snapshot.title": "保存可编辑副本",
721
+ "snapshot.scope": "包含 Blender 工程、源文件与相关外部素材。",
722
+ "snapshot.details": "副本范围",
723
+ "snapshot.detailText": "仅包含选定的已保存版本。仅用于观察的外部参考图不另行附带;工程内嵌内容未另行检查。可附带同版本的已完成影片。未保存的编辑不会进入副本。",
724
+ "snapshot.revision": "已保存版本",
725
+ "snapshot.video": "附带影片",
726
+ "snapshot.noVideo": "不附带影片",
727
+ "snapshot.prepare": "准备下载",
728
+ "snapshot.preparing": "正在准备副本…",
729
+ "snapshot.checking": "正在检查已有副本…",
730
+ "snapshot.cancel": "取消准备",
731
+ "snapshot.cancelling": "正在取消…",
732
+ "snapshot.retry": "重试准备",
733
+ "snapshot.check": "重新检查",
734
+ "snapshot.download": "下载 ZIP",
735
+ "snapshot.ready": "{revision} 的副本已准备好 · {bytes}",
736
+ "snapshot.failed": "准备未完成,可重试同一份副本。",
737
+ "snapshot.cancelled": "准备已取消,可重试同一份副本。",
738
+ "snapshot.uncertain": "暂时无法确认准备状态。请重新检查,或重试同一请求。",
739
+ "snapshot.invalid": "副本信息与所选工程不一致,已停止提供下载。请重新检查。",
740
+ "snapshot.saved": "正在处理已固定的 {revision}。",
741
+ "snapshot.newSelection": "已选择不同的版本或影片;点击“准备下载”创建新的副本。",
742
+ "snapshot.storage": "浏览器未能记住这次请求。请保留此页面,关闭后可能无法自动恢复。",
743
+ "snapshot.upgrade": "请更新并重启 Host,以使用可编辑副本。",
744
+ "snapshot.local": "请在运行 Host 的电脑上打开工作台来保存副本。",
745
+ "snapshot.copying": "正在复制文件",
746
+ "snapshot.verifying": "正在验证副本",
747
+ "snapshot.verifiedBytes": "已校验 {bytes}",
748
+ "snapshot.publishing": "正在完成副本",
749
+ "snapshot.progress": "{done} / {total}",
750
+ "snapshot.noRevision": "暂无可保存的版本。",
751
+ "snapshot.interrupted": "准备被中断,可重试同一份副本。",
677
752
  'diagnostics.exportHint': '导出一份可以附在问题里的诊断信息(版本、配置、项目与任务的摘要)',
678
753
  'diagnostics.export': '导出诊断',
679
754
  'common.refresh': '刷新',
@@ -728,7 +803,6 @@ window.__ModuleLoader__.load({
728
803
  'jobs.approval': '需审批:{frames} 帧 > 阈值 {threshold}',
729
804
  'jobs.approvalShort': '需审批:{frames} 帧 > {threshold}',
730
805
  'qa.noticeCount': '{count} 条 notices',
731
- 'workbench.title': '{panel} 工作台',
732
806
  'jobs.unfinished': '{count} 个任务在跑',
733
807
  'blender.probedAt': '探测于 {when}',
734
808
  'visual.operationCount': '{count} 个操作',
@@ -745,6 +819,47 @@ window.__ModuleLoader__.load({
745
819
  'workbench.system': 'System',
746
820
  'workbench.light': 'Light',
747
821
  'workbench.dark': 'Dark',
822
+ 'lighttable.start': 'Start',
823
+ 'lighttable.brief': 'Brief',
824
+ 'lighttable.briefHint': 'Save the goal and references, then inspect the result. Describe further modeling work in DSH chat.',
825
+ 'lighttable.historyTitle': 'Saved result',
826
+ 'lighttable.overview': 'Scene information',
827
+ 'recipes.about': 'About and license',
828
+ 'assembly.saving': 'Saving and rendering…',
829
+ 'lighttable.result': 'See results',
830
+ 'lighttable.adjust': 'Adjust',
831
+ 'lighttable.deliver': 'Export',
832
+ 'lighttable.new': 'New work',
833
+ 'lighttable.project': 'Current work',
834
+ 'lighttable.settings': 'Workbench settings',
835
+ 'lighttable.beginTitle': 'Start with an idea',
836
+ 'lighttable.beginHint': 'Choose a starting point, see the result, then refine it. You can also describe the work in DSH chat and use the DeepBlend tools to model it.',
837
+ 'lighttable.goalHint': 'Record the goal for this work. Describe modeling instructions in DSH chat to run the tools.',
838
+ 'lighttable.recent': 'Recent results',
839
+ 'lighttable.allVersions': 'All versions',
840
+ 'lighttable.noImage': 'No preview for this version yet',
841
+ 'lighttable.noImageHint': 'The saved project is still available. Return to the current version to render a preview, or save an editable copy from Versions.',
842
+ 'lighttable.saved': 'Saved · {revision}',
843
+ 'lighttable.imageSource': 'Image source · {revision}',
844
+ 'lighttable.sourceUnknown': 'Source not yet confirmed',
845
+ 'lighttable.history': 'Viewing saved version {revision}; the current saved version is {current}.',
846
+ 'lighttable.backCurrent': 'Return to current version',
847
+ 'lighttable.compareCurrent': 'Compare with current',
848
+ 'lighttable.historyExport': 'Save this version from Versions',
849
+ 'lighttable.details': 'Image and source details',
850
+ 'lighttable.tools': 'Adjust your work',
851
+ 'lighttable.toolsHint': 'Change dimensions, appearance and photography, then save to see the real result.',
852
+ 'lighttable.previewTools': 'View and inspect',
853
+ 'lighttable.previewHint': 'Render a new preview or compare saved results.',
854
+ 'lighttable.deliveryTitle': 'Deliver your work',
855
+ 'lighttable.deliveryHint': 'Render a film or save a version you can keep editing.',
856
+ 'lighttable.editable': 'Save an editable copy',
857
+ 'lighttable.outline': 'Choose an object and explore the scene',
858
+ 'lighttable.photography': 'Photography and lighting',
859
+ 'lighttable.assets': 'Assets and references',
860
+ 'lighttable.guide': 'Creative guidance',
861
+ 'lighttable.projectList': 'Continue an existing work',
862
+ 'lighttable.loading': 'Opening your workbench',
748
863
  'workbench.navigation': 'Workbench pages',
749
864
  'workbench.unsaved': 'Unsaved changes',
750
865
  'projects.name': 'Project name',
@@ -1305,8 +1420,42 @@ window.__ModuleLoader__.load({
1305
1420
  'revisions.compare': 'Compare with current',
1306
1421
  'revisions.compareCurrent': 'Compare with another version',
1307
1422
  'revisions.compareHint': 'Compare a saved version with the current one. The current version uses its nearest other version. At least two versions are needed; viewing does not change the project.',
1423
+ 'revisions.sourceChanged': 'Project content changed',
1424
+ 'revisions.sourceUnchanged': 'Project content unchanged',
1425
+ 'revisions.sourceUnknown': 'Project content change could not be confirmed',
1308
1426
  'revisions.restore': 'restore',
1309
- 'host.reading': 'Reading Host state…',
1427
+ "snapshot.title": "Save an editable copy",
1428
+ "snapshot.scope": "Includes the Blender project, source files and relevant external assets.",
1429
+ "snapshot.details": "What the copy includes",
1430
+ "snapshot.detailText": "Includes only the selected saved version. External images used only as visual references are omitted; embedded content is not separately inspected. You can include a completed video from the same version. Unsaved edits are not included.",
1431
+ "snapshot.revision": "Saved version",
1432
+ "snapshot.video": "Include a video",
1433
+ "snapshot.noVideo": "No video",
1434
+ "snapshot.prepare": "Prepare download",
1435
+ "snapshot.preparing": "Preparing the copy…",
1436
+ "snapshot.checking": "Checking the existing copy…",
1437
+ "snapshot.cancel": "Cancel preparation",
1438
+ "snapshot.cancelling": "Cancelling…",
1439
+ "snapshot.retry": "Retry preparation",
1440
+ "snapshot.check": "Check again",
1441
+ "snapshot.download": "Download ZIP",
1442
+ "snapshot.ready": "Copy of {revision} is ready · {bytes}",
1443
+ "snapshot.failed": "Preparation did not finish. You can retry the same copy.",
1444
+ "snapshot.cancelled": "Preparation was cancelled. You can retry the same copy.",
1445
+ "snapshot.uncertain": "The preparation status could not be confirmed. Check again or retry the same request.",
1446
+ "snapshot.invalid": "The copy information does not match this project. Download is unavailable. Check again.",
1447
+ "snapshot.saved": "Working on the fixed version {revision}.",
1448
+ "snapshot.newSelection": "You selected a different version or video. Choose Prepare download to create a new copy.",
1449
+ "snapshot.storage": "The browser could not remember this request. Keep this page open; recovery after closing it may be unavailable.",
1450
+ "snapshot.upgrade": "Update and restart the Host to save editable copies.",
1451
+ "snapshot.local": "Open the workbench on the computer running the Host to save a copy.",
1452
+ "snapshot.copying": "Copying files",
1453
+ "snapshot.verifying": "Verifying the copy",
1454
+ "snapshot.verifiedBytes": "Verified {bytes}",
1455
+ "snapshot.publishing": "Finalizing the copy",
1456
+ "snapshot.progress": "{done} / {total}",
1457
+ "snapshot.noRevision": "There is no saved version yet.",
1458
+ "snapshot.interrupted": "Preparation was interrupted. You can retry the same copy.",
1310
1459
  'diagnostics.exportHint': 'Export diagnostics you can attach to a bug report (versions, config, a summary of projects and jobs)',
1311
1460
  'diagnostics.export': 'Export diagnostics',
1312
1461
  'common.refresh': 'Refresh',
@@ -1361,7 +1510,6 @@ window.__ModuleLoader__.load({
1361
1510
  'jobs.approval': 'approval needed: {frames} frames > threshold {threshold}',
1362
1511
  'jobs.approvalShort': 'approval needed: {frames} frames > {threshold}',
1363
1512
  'qa.noticeCount': '{count} notice(s)',
1364
- 'workbench.title': '{panel} workbench',
1365
1513
  'jobs.unfinished': '{count} job(s) running',
1366
1514
  'blender.probedAt': 'probed {when}',
1367
1515
  'visual.operationCount': '{count} operation(s)',
@@ -1466,12 +1614,12 @@ window.__ModuleLoader__.load({
1466
1614
  const POLL_IDLE_MS = 8000
1467
1615
 
1468
1616
  const VIEWS = [
1469
- { id: 'projects', get label() { return t('tab.projects') } },
1470
- { id: 'scene', get label() { return t('tab.scene') } },
1471
- { id: 'preview', get label() { return t('tab.preview') } },
1472
- { id: 'jobs', get label() { return t('tab.jobs') } },
1473
- { id: 'qa', label: 'QA' },
1474
- { id: 'revisions', get label() { return t('tab.revisions') } },
1617
+ { id: 'projects', stage: 0, get label() { return t('lighttable.start') } },
1618
+ { id: 'scene', stage: 2, get label() { return t('lighttable.adjust') } },
1619
+ { id: 'preview', stage: 1, get label() { return t('lighttable.result') } },
1620
+ { id: 'jobs', stage: 3, get label() { return t('lighttable.deliver') } },
1621
+ { id: 'qa', secondaryOrder: 1, label: 'QA' },
1622
+ { id: 'revisions', secondaryOrder: 0, get label() { return t('tab.revisions') } },
1475
1623
  ]
1476
1624
 
1477
1625
  /** Every DeepBlend wire tool name this package draws a card for. */
@@ -1776,9 +1924,9 @@ window.__ModuleLoader__.load({
1776
1924
  const BRAND_MARK = 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22512%22%20height%3D%22512%22%20viewBox%3D%220%200%20512%20512%22%20role%3D%22img%22%20aria-label%3D%22DeepBlend%20Studio%20logo%22%3E%0A%20%20%3Ctitle%3EDeepBlend%20Studio%3C%2Ftitle%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3ClinearGradient%20id%3D%22mark%22%20x1%3D%220.1%22%20y1%3D%220%22%20x2%3D%220.85%22%20y2%3D%221%22%3E%0A%20%20%20%20%20%20%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23FFC078%22%2F%3E%0A%20%20%20%20%20%20%3Cstop%20offset%3D%220.45%22%20stop-color%3D%22%23F2802A%22%2F%3E%0A%20%20%20%20%20%20%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23C85C08%22%2F%3E%0A%20%20%20%20%3C%2FlinearGradient%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Crect%20width%3D%22512%22%20height%3D%22512%22%20rx%3D%22112%22%20fill%3D%22url%28%23mark%29%22%2F%3E%0A%20%20%3Cg%20stroke%3D%22%23FFFFFF%22%20stroke-width%3D%2211%22%20stroke-linejoin%3D%22round%22%20stroke-linecap%3D%22round%22%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20106%20L386%20181%20L386%20331%20L256%20406%20L126%20331%20L126%20181%20Z%22%20fill%3D%22%23FFFFFF%22%20fill-opacity%3D%220.14%22%2F%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20106%20L386%20181%20L256%20256%20L126%20181%20Z%22%20fill%3D%22%23FFFFFF%22%20fill-opacity%3D%220.34%22%20stroke%3D%22none%22%2F%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20256%20L126%20181%20L126%20331%20L256%20406%20Z%22%20fill%3D%22%237A3200%22%20fill-opacity%3D%220.16%22%20stroke%3D%22none%22%2F%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20256%20L386%20181%20L386%20331%20L256%20406%20Z%22%20fill%3D%22%235C2400%22%20fill-opacity%3D%220.22%22%20stroke%3D%22none%22%2F%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20106%20L386%20181%20L386%20331%20L256%20406%20L126%20331%20L126%20181%20Z%22%20fill%3D%22none%22%20opacity%3D%220.93%22%2F%3E%0A%20%20%20%20%3Cpath%20d%3D%22M256%20256%20L256%20106%20M256%20256%20L386%20331%20M256%20256%20L126%20331%22%20fill%3D%22none%22%20opacity%3D%220.93%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A'
1777
1925
 
1778
1926
  const CSS = `
1779
- .db-root{container-type:inline-size;container-name:deepblend;--db-good:#23704e;--db-warn:#946109;--db-bad:#b0303c;--db-input-border:#8492a5;--db-accent:#b95516;--db-accent-soft:#f8e9de;--db-canvas:var(--dsw-alias-bg-layer-1);--db-surface:var(--dsw-alias-bg-layer-1);--db-border:var(--dsw-alias-border-l1);--db-fill:var(--dsw-alias-fill-l2);--db-text:var(--dsw-alias-label-primary);--db-subtle:var(--dsw-alias-label-secondary);--db-muted:var(--dsw-alias-label-secondary);display:flex;flex-direction:column;height:100%;min-height:0;min-width:0;background:var(--db-canvas);color:var(--db-text);font:13px/1.55 var(--dsw-font-sans,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif)}
1780
- .db-root[data-theme=light],.db-root[data-theme=system]{color-scheme:light;--db-canvas:#f1f3f6;--db-surface:#fff;--db-border:#dce1e8;--db-fill:#f0f3f7;--db-text:#202b3c;--db-subtle:#4e5d70;--db-muted:#637186}
1781
- .db-root[data-theme=dark]{color-scheme:dark;--db-canvas:#10151d;--db-surface:#19212d;--db-border:#334155;--db-fill:#253142;--db-text:#edf2f8;--db-subtle:#c2ccda;--db-muted:#a2afc1;--db-good:#77c9a0;--db-warn:#efbc73;--db-bad:#ff979c;--db-input-border:#657692;--db-accent:#f3a365;--db-accent-soft:#3c2d23}
1927
+ .db-root{container-type:inline-size;container-name:deepblend;--db-good:#23704e;--db-warn:#946109;--db-bad:#b0303c;--db-input-border:#8492a5;--db-accent:#295bc8;--db-accent-soft:#e8eefc;--db-canvas:var(--dsw-alias-bg-layer-1);--db-surface:var(--dsw-alias-bg-layer-1);--db-border:var(--dsw-alias-border-l1);--db-fill:var(--dsw-alias-fill-l2);--db-text:var(--dsw-alias-label-primary);--db-subtle:var(--dsw-alias-label-secondary);--db-muted:var(--dsw-alias-label-secondary);display:flex;flex-direction:column;height:100%;min-height:0;min-width:0;background:var(--db-canvas);color:var(--db-text);font:14px/1.55 var(--dsw-font-sans,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif)}
1928
+ .db-root[data-theme=light],.db-root[data-theme=system]{color-scheme:light;--db-canvas:#f4f6fa;--db-surface:#fff;--db-border:#d8dee8;--db-fill:#edf1f7;--db-text:#20252e;--db-subtle:#47566a;--db-muted:#58677c}
1929
+ .db-root[data-theme=dark]{color-scheme:dark;--db-canvas:#10151d;--db-surface:#19212d;--db-border:#334155;--db-fill:#253142;--db-text:#edf2f8;--db-subtle:#c2ccda;--db-muted:#a2afc1;--db-good:#77c9a0;--db-warn:#efbc73;--db-bad:#ff979c;--db-input-border:#657692;--db-accent:#96b6ff;--db-accent-soft:#263b62}
1782
1930
  .db-root *{box-sizing:border-box}
1783
1931
  .db-head{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--db-border,var(--dsw-alias-border-l1));background:var(--db-surface,var(--dsw-alias-bg-layer-1));flex:none;flex-wrap:wrap}
1784
1932
  .db-brand{display:flex;align-items:center;gap:10px;flex:none}
@@ -1806,11 +1954,11 @@ window.__ModuleLoader__.load({
1806
1954
  .db-row>span:first-child{color:var(--db-muted,var(--dsw-alias-label-tertiary));flex:none;min-width:90px}
1807
1955
  .db-row>span:last-child{min-width:0;overflow-wrap:anywhere;font-family:var(--dsw-font-mono);font-size:12px}
1808
1956
  .db-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--db-fill,var(--dsw-alias-fill-l2));border:1px solid var(--db-border,var(--dsw-alias-border-l1));border-radius:7px;color:var(--db-text,var(--dsw-alias-label-primary));cursor:pointer;font:inherit;font-size:12px;min-height:34px;padding:6px 12px;text-decoration:none;line-height:1.4}
1809
- .db-btn:hover:not(:disabled){border-color:var(--db-accent,var(--dsw-alias-brand-primary));background:var(--db-accent-soft,var(--dsw-alias-fill-l2))}
1957
+ .db-btn:hover:not(:disabled):not([data-tone=primary]){border-color:var(--db-accent,var(--dsw-alias-brand-primary));background:var(--db-accent-soft,var(--dsw-alias-fill-l2))}
1810
1958
  .db-btn:active:not(:disabled){filter:brightness(.95)}
1811
1959
  .db-btn:disabled{opacity:.48;cursor:not-allowed}
1812
1960
  .db-btn[data-tone=primary]{background:var(--db-accent,var(--dsw-alias-brand-primary,#3b6ef5));border-color:transparent;color:#fff;font-weight:650}
1813
- .db-root[data-theme=dark] .db-btn[data-tone=primary]{color:#20170f}
1961
+ .db-root[data-theme=dark] .db-btn[data-tone=primary]{color:#14213b}
1814
1962
  .db-btn[data-tone=danger]{color:var(--db-bad,var(--dsw-alias-label-error,#d13438))}
1815
1963
  .db-btn[aria-pressed=true]{border-color:var(--db-accent);background:var(--db-accent-soft);color:var(--db-accent)}
1816
1964
  .db-root :is(button,a,input,select,textarea,summary):focus-visible{outline:2px solid var(--db-accent);outline-offset:3px}
@@ -1885,9 +2033,9 @@ window.__ModuleLoader__.load({
1885
2033
  .db-scene-outline .db-kind{min-width:0;display:inline;margin:0 6px}
1886
2034
  .db-scene-outline .db-list>li>div{overflow-wrap:anywhere;font-size:12px}
1887
2035
  .db-scene-inspector{min-width:0}
1888
- .db-notice{border-left:3px solid var(--db-good,var(--dsw-alias-label-success,#2f9e44));background:var(--db-fill,var(--dsw-alias-fill-l2));border-radius:6px;padding:9px 12px;color:var(--db-text,var(--dsw-alias-label-primary))}
2036
+ .db-notice{border:1px solid var(--db-border);background:var(--db-fill,var(--dsw-alias-fill-l2));border-radius:6px;padding:9px 12px;color:var(--db-text,var(--dsw-alias-label-primary))}
1889
2037
  .db-editor-actions{position:sticky;bottom:0;z-index:2;background:var(--db-surface);border-top:1px solid var(--db-border);margin:16px -18px -16px;padding:12px 18px;border-radius:0 0 12px 12px;box-shadow:0 -5px 18px #00000008}
1890
- @media(prefers-color-scheme:dark){.db-root[data-theme=system]{color-scheme:dark;--db-accent:#f3a365;--db-accent-soft:#3c2d23;--db-canvas:#10151d;--db-surface:#19212d;--db-border:#334155;--db-fill:#253142;--db-text:#edf2f8;--db-subtle:#c2ccda;--db-muted:#a2afc1;--db-good:#77c9a0;--db-warn:#efbc73;--db-bad:#ff979c;--db-input-border:#657692}.db-root[data-theme=system] .db-btn[data-tone=primary]{color:#20170f}}
2038
+ @media(prefers-color-scheme:dark){.db-root[data-theme=system]{color-scheme:dark;--db-accent:#96b6ff;--db-accent-soft:#263b62;--db-canvas:#10151d;--db-surface:#19212d;--db-border:#334155;--db-fill:#253142;--db-text:#edf2f8;--db-subtle:#c2ccda;--db-muted:#a2afc1;--db-good:#77c9a0;--db-warn:#efbc73;--db-bad:#ff979c;--db-input-border:#657692}.db-root[data-theme=system] .db-btn[data-tone=primary]{color:#14213b}}
1891
2039
  @media(max-width:1000px){.db-recipe-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.db-head{padding:12px 16px}.db-body{padding:16px}.db-project-context{max-width:45%}.db-scene-layout{grid-template-columns:minmax(190px,240px) minmax(0,1fr);gap:14px}}
1892
2040
  @media(max-width:700px){.db-scene-layout{grid-template-columns:minmax(0,1fr)}.db-scene-outline{position:static;max-height:none;overflow:visible}.db-scene-outline>.db-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.db-project-context{max-width:100%;border-left:0;padding-left:0}.db-head-actions{margin-left:0;width:100%}.db-head-actions .db-theme{margin-left:auto}.db-head{gap:8px}.db-nav{padding:8px 12px}.db-create-footer{grid-template-columns:1fr 1fr}.db-create-footer .db-btn{grid-column:1/-1}.db-card{padding:14px}.db-body{padding:12px}.db-create-footer{margin:14px -14px -14px;padding:12px 14px}}
1893
2041
  @media(max-width:440px){.db-recipe-grid{grid-template-columns:minmax(0,1fr)}.db-create-footer{position:static;grid-template-columns:minmax(0,1fr)}.db-scene-outline>.db-grid{grid-template-columns:minmax(0,1fr)}.db-badge[data-badge=unsaved]{white-space:normal}.db-nav button{padding:6px 10px}.db-head{padding:10px 12px}.db-body{padding-top:8px}.db-tabs{gap:6px;padding:0 0 6px}}
@@ -1896,6 +2044,113 @@ window.__ModuleLoader__.load({
1896
2044
  @container deepblend (max-width:440px){.db-recipe-grid{grid-template-columns:minmax(0,1fr)}.db-create-footer{position:static;grid-template-columns:minmax(0,1fr)}.db-scene-outline>.db-grid{grid-template-columns:minmax(0,1fr)}.db-badge[data-badge=unsaved]{white-space:normal}.db-nav button{padding:6px 10px}.db-head{padding:10px 12px}.db-body{padding-top:8px}.db-tabs{gap:6px;padding:0 0 6px}}
1897
2045
  @media(pointer:coarse){.db-root .db-btn,.db-root .db-input,.db-nav button{min-height:42px}}
1898
2046
  @media(prefers-reduced-motion:reduce){.db-root *{scroll-behavior:auto!important;transition:none!important}}
2047
+ .db-root{--db-radius:8px;--db-space:16px;--db-motion:180ms;caret-color:var(--db-accent);font-variant-numeric:tabular-nums}
2048
+ .db-root ::selection{background:var(--db-accent-soft);color:var(--db-text)}
2049
+ .db-root a{text-underline-offset:.2em}
2050
+ .db-head{padding:12px 24px;gap:16px;flex-wrap:nowrap}
2051
+ .db-logo{width:28px;height:28px;border-radius:6px}
2052
+ .db-title{font-size:15px;letter-spacing:-.02em;white-space:nowrap}
2053
+ .db-head-actions{gap:6px;flex-wrap:nowrap}
2054
+ .db-project-switch{min-width:100px;max-width:280px;flex:1}
2055
+ .db-project-switch .db-input{background:transparent;border-color:transparent;font-weight:600}
2056
+ .db-nav{padding:0 24px;gap:24px;align-items:center;justify-content:space-between;overflow:visible}
2057
+ .db-journey,.db-secondary-nav{display:flex;gap:4px;min-width:0}
2058
+ .db-nav button{border-radius:0;border:0;border-bottom:2px solid transparent;min-height:46px;padding:10px 18px;font-size:13px}
2059
+ .db-nav button[data-active=true]{background:transparent;border-color:var(--db-accent);color:var(--db-accent)}
2060
+ .db-secondary-nav button{color:var(--db-muted);font-size:12px;padding:10px}
2061
+ .db-nav button:disabled{opacity:.42;cursor:not-allowed}
2062
+ .db-body{padding:24px;scroll-padding:24px}
2063
+ .db-body>[data-view],.db-body>.db-lighttable{max-width:1680px;margin-inline:auto}
2064
+ .db-card{border-radius:var(--db-radius);box-shadow:none}
2065
+ .db-card .db-card{border:0;border-top:1px solid var(--db-border);border-radius:0;padding-inline:0;background:transparent}
2066
+ .db-btn{min-height:36px;border-radius:6px;font-size:13px;transition:background var(--db-motion) ease-out,border-color var(--db-motion) ease-out}
2067
+ .db-input,.db-area{border-radius:6px;font-size:14px;min-height:38px}
2068
+ .db-btn[data-tone=primary]{box-shadow:none}
2069
+ .db-notice{border-left-width:1px;border-radius:6px}
2070
+ .db-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
2071
+ .db-utility-menu{position:relative;flex:none}
2072
+ .db-utility-menu>summary{font-size:12px;min-height:36px!important;padding:8px!important;white-space:nowrap}
2073
+ .db-utility-content{position:absolute;right:0;top:calc(100% + 8px);z-index:20;width:240px;background:var(--db-surface);border:1px solid var(--db-border);border-radius:8px;padding:16px;display:grid;gap:14px}
2074
+ .db-host-warning{margin:0;padding:8px 24px;color:var(--db-warn);background:var(--db-surface);font-size:12px}
2075
+ .db-lighttable{display:grid;grid-template-columns:minmax(0,1fr) minmax(320px,360px);gap:28px;align-items:start}
2076
+ .db-lighttable-stage{min-width:0;position:sticky;top:0}
2077
+ .db-result-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;min-height:45px}
2078
+ .db-result-heading h2{font-size:20px;line-height:1.3;letter-spacing:-.02em;margin:0 0 3px;font-weight:650;overflow-wrap:anywhere}
2079
+ .db-result-source{font-size:12px;color:var(--db-muted)}
2080
+ .db-result-mat{--db-result-image-height:clamp(240px,calc(100dvh - 550px),560px);display:flex;align-items:center;justify-content:center;background:var(--db-fill);min-height:240px;height:clamp(220px,calc(100dvh - 550px),560px);overflow:hidden;border-radius:6px}
2081
+ .db-result-image{display:block;width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain}
2082
+ .db-result-empty{max-width:40ch;text-align:center;padding:32px;color:var(--db-muted)}
2083
+ .db-result-empty h3{font-size:17px;color:var(--db-text);margin:0 0 12px;font-weight:600}
2084
+ .db-result-empty p{margin:0;font-size:13px}
2085
+ .db-result-caption{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;font-size:12px;flex-wrap:wrap}
2086
+ .db-image-details{font-size:12px;margin-top:8px;overflow-wrap:anywhere}
2087
+ .db-image-details>summary{font-size:12px;font-weight:400!important;min-height:28px!important}
2088
+ .db-image-details code{font-size:11px;overflow-wrap:anywhere}
2089
+ .db-filmstrip-heading{display:flex;align-items:center;justify-content:space-between;margin:12px 0 8px;gap:12px}
2090
+ .db-filmstrip-heading h3{font-size:13px;margin:0;font-weight:600}
2091
+ .db-filmstrip-heading .db-btn{border-color:transparent;background:transparent;font-size:12px;min-height:28px;padding:4px 0}
2092
+ .db-filmstrip{display:grid;grid-template-columns:repeat(6,minmax(0,110px));gap:10px}
2093
+ .db-film-frame{display:flex;flex-direction:column;min-width:0;background:transparent;border:1px solid transparent;border-radius:5px;padding:4px;cursor:pointer;color:var(--db-muted);font:inherit;text-align:left;transition:border-color 180ms ease-out,background-color 180ms ease-out}
2094
+ .db-film-frame img,.db-film-empty{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:3px;background:var(--db-fill)}
2095
+ .db-film-frame img{display:block}
2096
+ .db-film-empty{display:flex;align-items:center;justify-content:center;font-size:10px;text-align:center;padding:6px}
2097
+ .db-film-frame:hover{background:var(--db-surface)}
2098
+ .db-film-frame[aria-pressed=true]{border-color:var(--db-accent);color:var(--db-accent);background:var(--db-surface)}
2099
+ .db-film-caption{display:flex;gap:4px;justify-content:space-between;font-size:11px;padding-top:5px;flex-wrap:wrap}
2100
+ .db-context-pane{min-width:0;max-height:calc(100dvh - 165px);overflow:auto;scrollbar-width:thin;scrollbar-color:var(--db-border) transparent;padding:0 4px 24px 0;scroll-padding:16px}
2101
+ .db-context-heading{margin-bottom:20px}
2102
+ .db-context-heading h2{font-size:17px;line-height:1.3;margin:0 0 8px;font-weight:650}
2103
+ .db-context-heading p{color:var(--db-muted);font-size:12px;max-width:44ch;margin:0}
2104
+ .db-context-pane .db-card{border:0;border-bottom:1px solid var(--db-border);border-radius:0;background:transparent;padding:0 0 20px;margin-bottom:20px}
2105
+ .db-context-pane .db-card h4{font-size:14px}
2106
+ .db-context-pane .db-inline{gap:8px}
2107
+ .db-context-pane .db-tabs{gap:8px}
2108
+ .db-context-pane .db-scene-layout{display:block}
2109
+ .db-context-pane .db-scene-outline{position:static;max-height:none;overflow:visible;border-block:1px solid var(--db-border);margin-bottom:16px}
2110
+ .db-context-pane .db-scene-outline>.db-grid{display:block;max-height:320px;overflow:auto;scrollbar-width:thin}
2111
+ .db-context-pane .db-scene-inspector{display:block}
2112
+ .db-context-pane .db-grid{grid-template-columns:minmax(0,1fr)}
2113
+ .db-context-pane .db-editor-actions{position:static;margin:16px 0 0;padding:12px 0;border-radius:0;box-shadow:none}
2114
+ .db-context-pane .db-area{min-height:180px}
2115
+ .db-context-pane .db-row{flex-wrap:wrap;gap:4px 12px}
2116
+ .db-context-pane .db-kv{grid-template-columns:minmax(80px,auto) minmax(0,1fr)}
2117
+ .db-tool-disclosure{border-top:1px solid var(--db-border);padding-top:8px;margin-top:16px}
2118
+ .db-guide{margin-top:20px;border-top:1px solid var(--db-border);padding:10px 0;font-size:12px}
2119
+ .db-guide-top{display:block;padding-top:8px}
2120
+ .db-guide-top>.db-inline{margin-top:10px}
2121
+ .db-guide .db-guide-notes{border:0}
2122
+ .db-history-context{display:grid;gap:12px;font-size:13px}
2123
+ .db-history-context p{margin:0 0 8px;color:var(--db-muted)}
2124
+ .db-lighttable--comparison{grid-template-columns:minmax(0,1fr)}
2125
+ .db-lighttable--comparison .db-lighttable-stage{position:static}
2126
+ .db-lighttable--comparison .db-context-pane{max-height:none;overflow:visible}
2127
+ .db-lighttable--comparison .db-context-pane .db-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
2128
+ .db-lighttable-stage--compact .db-filmstrip{display:flex;overflow:auto}
2129
+ .db-lighttable-stage--compact .db-film-frame{width:110px;flex:none}
2130
+ .db-project-create{max-width:1120px;margin-inline:auto;padding:30px;border:0;background:transparent}
2131
+ .db-start-title{margin:0 0 12px;font-size:28px;line-height:1.25;letter-spacing:-.025em;font-weight:650;text-wrap:balance}
2132
+ .db-start-intro{max-width:65ch;color:var(--db-muted);margin:0 0 28px!important;font-size:14px}
2133
+ .db-project-create>.db-muted{display:none}
2134
+ .db-project-create .db-recipes{margin-top:24px}
2135
+ .db-recipe-grid{gap:16px}
2136
+ .db-recipe{padding:0 0 14px;border-radius:8px;overflow:hidden;border:0;background:var(--db-surface)}
2137
+ .db-recipe img{border-radius:0;aspect-ratio:4/3}
2138
+ .db-recipe h5,.db-recipe p,.db-recipe>.db-btn{margin-inline:14px}
2139
+ .db-recipe .db-btn{margin-top:auto}
2140
+ .db-recipe[data-selected=true]{box-shadow:none;outline:2px solid var(--db-accent);outline-offset:2px;background:var(--db-surface)}
2141
+ .db-create-footer{position:static;border-radius:8px;margin:24px 0 0;padding:20px;background:var(--db-surface);border:0;box-shadow:none}
2142
+ .db-project-list{max-width:1060px;margin:36px auto 0;border:0;border-top:1px solid var(--db-border);border-radius:0;background:transparent;padding:24px 0}
2143
+ .db-project-list .db-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:28px}
2144
+ .db-loading{max-width:1200px;margin-inline:auto;width:100%}
2145
+ .db-loading-stage{height:48dvh;min-height:240px;background:var(--db-fill);border-radius:6px}
2146
+ .db-loading-line{height:36px;background:var(--db-fill);max-width:360px;margin-top:16px;border-radius:6px}
2147
+ @media(max-width:1000px){.db-lighttable{grid-template-columns:minmax(0,1fr) 320px;gap:20px}.db-head{padding:12px 16px}.db-nav{padding-inline:16px}.db-project-create{padding:20px}.db-journey button{padding-inline:12px}.db-result-mat{min-height:240px}.db-filmstrip{grid-template-columns:repeat(3,minmax(0,110px))}}
2148
+ @container deepblend (max-width:1000px){.db-lighttable{grid-template-columns:minmax(0,1fr) 320px;gap:20px}.db-head{padding:12px 16px}.db-nav{padding-inline:16px}.db-project-create{padding:20px}.db-journey button{padding-inline:12px}.db-result-mat{min-height:240px}.db-filmstrip{grid-template-columns:repeat(3,minmax(0,110px))}}
2149
+ @media(max-width:760px){.db-head{flex-wrap:wrap;gap:10px}.db-project-switch{max-width:none}.db-head-actions{margin-left:0;width:100%;justify-content:flex-end}.db-head-actions>.db-btn:first-child{margin-right:auto}.db-nav{gap:8px;overflow-x:auto}.db-journey{flex:none}.db-nav button{padding:9px 12px;min-height:42px}.db-secondary-nav{margin-left:auto}.db-secondary-nav button{padding-inline:8px}.db-body{padding:16px}.db-lighttable{grid-template-columns:minmax(0,1fr);gap:28px}.db-lighttable-stage{position:static}.db-result-heading h2{font-size:19px}.db-result-mat{--db-result-image-height:max(220px,calc((100cqw - 32px) * .75));min-height:220px;height:auto;aspect-ratio:4/3}.db-result-image{max-height:none;min-height:0}.db-context-pane{max-height:none;overflow:visible;padding-right:0}.db-filmstrip{display:flex;overflow-x:auto;padding-bottom:6px}.db-film-frame{width:100px;flex:none}.db-project-create{padding:12px 0}.db-start-title{font-size:25px}.db-create-footer{grid-template-columns:minmax(0,1fr);padding:16px}.db-start-intro{font-size:13px}.db-project-list .db-list{grid-template-columns:minmax(0,1fr)}.db-lighttable--comparison .db-context-pane .db-grid{grid-template-columns:minmax(0,1fr)}}
2150
+ @container deepblend (max-width:760px){.db-head{flex-wrap:wrap;gap:10px}.db-project-switch{max-width:none}.db-head-actions{margin-left:0;width:100%;justify-content:flex-end}.db-head-actions>.db-btn:first-child{margin-right:auto}.db-nav{gap:8px;overflow-x:auto}.db-journey{flex:none}.db-nav button{padding:9px 12px;min-height:42px}.db-secondary-nav{margin-left:auto}.db-secondary-nav button{padding-inline:8px}.db-body{padding:16px}.db-lighttable{grid-template-columns:minmax(0,1fr);gap:28px}.db-lighttable-stage{position:static}.db-result-heading h2{font-size:19px}.db-result-mat{--db-result-image-height:max(220px,calc((100cqw - 32px) * .75));min-height:220px;height:auto;aspect-ratio:4/3}.db-result-image{max-height:none;min-height:0}.db-context-pane{max-height:none;overflow:visible;padding-right:0}.db-filmstrip{display:flex;overflow-x:auto;padding-bottom:6px}.db-film-frame{width:100px;flex:none}.db-project-create{padding:12px 0}.db-start-title{font-size:25px}.db-create-footer{grid-template-columns:minmax(0,1fr);padding:16px}.db-start-intro{font-size:13px}.db-project-list .db-list{grid-template-columns:minmax(0,1fr)}.db-lighttable--comparison .db-context-pane .db-grid{grid-template-columns:minmax(0,1fr)}}
2151
+ @media(pointer:coarse){.db-root .db-btn,.db-root .db-input,.db-nav button,.db-root summary{min-height:44px}}
2152
+ @media(prefers-reduced-motion:reduce){.db-root *{transition:none!important}}
2153
+
1899
2154
  `
1900
2155
 
1901
2156
  /**
@@ -1974,6 +2229,17 @@ window.__ModuleLoader__.load({
1974
2229
  * function tag loudly for the same reason.
1975
2230
  */
1976
2231
 
2232
+ const disclosureKey = (state, id) => JSON.stringify([state.projectsRoot, state.storeIdentity,
2233
+ id.startsWith('new:') ? 'new' : id.startsWith('global:') ? 'global' : state.activeProjectId || 'new', id])
2234
+
2235
+ function Disclosure({ state, actions }, id, title, props, ...children) {
2236
+ const key = disclosureKey(state, id), { defaultOpen = false, ...rest } = props || {}
2237
+ return el('details', { ...rest, key, 'data-disclosure': key,
2238
+ open: state.disclosures?.[key] ?? defaultOpen,
2239
+ onToggle: event => actions.setDisclosure(key, event.currentTarget.open) },
2240
+ el('summary', { 'data-field': `disclosure-${encodeURIComponent(key)}` }, title), ...children)
2241
+ }
2242
+
1977
2243
  function Badge(props) {
1978
2244
  return el('span', { className: 'db-badge', 'data-tone': props.tone || 'muted', 'data-badge': props.name || undefined }, props.children)
1979
2245
  }
@@ -2798,6 +3064,34 @@ window.__ModuleLoader__.load({
2798
3064
  } }
2799
3065
  }
2800
3066
 
3067
+ const SNAPSHOT_STORAGE_KEY = 'deepblend.editable-snapshots/v1'
3068
+ const snapshotContextKey = state => state.projectsRoot && state.storeIdentity && state.activeProjectId
3069
+ ? JSON.stringify([state.projectsRoot, state.storeIdentity, state.activeProjectId]) : null
3070
+ const snapshotEntry = state => state.editableSnapshots?.[snapshotContextKey(state)] || null
3071
+ const snapshotVideos = (state, revision) => (state.jobs || []).filter(job => job.status === 'completed'
3072
+ && job.revisionId === revision && typeof job.delivery?.videoPath === 'string' && job.delivery.videoPath.length > 0)
3073
+ const snapshotSupported = state => state.editableSnapshotProtocol === 1 && /^[a-f0-9]{64}$/.test(state.storeIdentity || '')
3074
+ && state.editableSnapshotAvailability?.available === true
3075
+ const snapshotSameSelection = entry => entry?.handle && entry.revision === entry.handle.revision && entry.videoJobId === entry.handle.videoJobId
3076
+ const snapshotBytes = value => value >= 1048576 ? `${(value / 1048576).toFixed(1)} MiB` : value >= 1024 ? `${(value / 1024).toFixed(1)} KiB` : `${value} B`
3077
+ const snapshotExportId = async requestId => `snapshot-${(await imageByteHash(Uint8Array.from(requestId, char => char.charCodeAt(0)), undefined, true)).slice(0, 40)}`
3078
+ function validSnapshotHandle(handle) {
3079
+ return handle && /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,95}$/.test(handle.requestId || '')
3080
+ && /^snapshot-[a-f0-9]{40}$/.test(handle.exportId || '') && /^[a-f0-9]{64}$/.test(handle.storeIdentity || '')
3081
+ && typeof handle.projectId === 'string' && handle.projectId.length > 0 && handle.projectId.length <= 200
3082
+ && /^r[0-9]+$/.test(handle.revision || '') && (handle.videoJobId === null || typeof handle.videoJobId === 'string' && handle.videoJobId.length > 0 && handle.videoJobId.length <= 200)
3083
+ }
3084
+ function validSnapshotReply(value, handle) {
3085
+ if (!value || !['preparing', 'ready', 'failed', 'cancelled'].includes(value.state)
3086
+ || ['requestId', 'exportId', 'storeIdentity', 'projectId', 'revision', 'videoJobId'].some(key => value[key] !== handle[key])) return false
3087
+ if (value.state === 'ready') {
3088
+ const expected = projectRoute(handle.projectId, `/editable-snapshots/${handle.exportId}/download?storeIdentity=${handle.storeIdentity}`)
3089
+ if (value.downloadUrl !== expected || !Number.isSafeInteger(value.archive?.bytes) || value.archive.bytes <= 0
3090
+ || !/^[a-f0-9]{64}$/.test(value.archive?.sha256 || '')) return false
3091
+ }
3092
+ return true
3093
+ }
3094
+
2801
3095
  /** A blank snapshot, so `getState()` always answers the same shape. */
2802
3096
  function emptySnapshot() {
2803
3097
  return {
@@ -2807,6 +3101,10 @@ window.__ModuleLoader__.load({
2807
3101
  hostApiVersion: null,
2808
3102
  projects: [],
2809
3103
  projectsRoot: null,
3104
+ storeIdentity: null,
3105
+ editableSnapshotProtocol: null,
3106
+ editableSnapshotAvailability: null,
3107
+ editableSnapshots: {},
2810
3108
  recipeCatalog: { recipes: [], errors: [] },
2811
3109
  selected: null,
2812
3110
  currentRevision: null,
@@ -2817,11 +3115,13 @@ window.__ModuleLoader__.load({
2817
3115
  previewContext: null,
2818
3116
  previewReadStatus: 'idle',
2819
3117
  view: 'projects',
3118
+ projectTask: 'brief',
2820
3119
  projectId: null,
2821
3120
  activeProjectId: null,
2822
3121
  compareLeft: null,
2823
3122
  compareRight: null,
2824
3123
  compareMode: 'result',
3124
+ lighttableSelection: null,
2825
3125
  diff: null,
2826
3126
  diffError: null,
2827
3127
  previewBusy: false,
@@ -2904,6 +3204,9 @@ window.__ModuleLoader__.load({
2904
3204
  const imageDownloadTimeoutMs = settings.imageDownloadTimeoutMs ?? 30000
2905
3205
  if (!Number.isSafeInteger(imageDownloadTimeoutMs) || imageDownloadTimeoutMs <= 0 || imageDownloadTimeoutMs > 2147483647) throw new Error('Image download timeout must be a positive timer-safe integer')
2906
3206
 
3207
+ const snapshotTimeoutMs = settings.editableSnapshotTimeoutMs ?? 30000
3208
+ const snapshotPollMs = settings.editableSnapshotPollMs ?? 2000
3209
+ if (![snapshotTimeoutMs, snapshotPollMs].every(value => Number.isSafeInteger(value) && value > 0 && value <= 2147483647)) throw new Error('Snapshot timers must be positive timer-safe integers')
2907
3210
  const preferenceStorage = appearanceStorage(settings)
2908
3211
  let data = { ...emptySnapshot(), appearance: savedAppearance(preferenceStorage) }
2909
3212
  let snapshot = { ...data }
@@ -2921,6 +3224,9 @@ window.__ModuleLoader__.load({
2921
3224
  let creationDraftClosed = false
2922
3225
  const draftLifecycle = settings.creationDraftLifecycle ?? globalThis.window
2923
3226
  let fileChoiceSignature = null, fileChoicesStopped = false
3227
+ const snapshotStorage = settings.editableSnapshotStorage ?? preferenceStorage
3228
+ const snapshotControllers = new Set()
3229
+ let snapshotTimer = null, snapshotGeneration = 0, activeSnapshotContext = null
2924
3230
  const photographyControllers = new Map()
2925
3231
  const photographySourceControllers = new Map()
2926
3232
  let photographySourceSequence = 0
@@ -2976,6 +3282,7 @@ window.__ModuleLoader__.load({
2976
3282
  }
2977
3283
  /** Change the snapshot and tell everyone. @param {object} patch */
2978
3284
  const set = (patch) => {
3285
+ if (Object.hasOwn(patch, 'view') && patch.view !== 'projects') patch = { ...patch, projectTask: 'brief' }
2979
3286
  if (['projectId', 'projectsRoot', 'activeProjectId']
2980
3287
  .some(key => Object.hasOwn(patch, key) && patch[key] !== data[key])) previewSourceGeneration += 1
2981
3288
  // Automatic edit images are source snapshots too. They cannot override
@@ -2998,6 +3305,9 @@ window.__ModuleLoader__.load({
2998
3305
  diffSequence += 1
2999
3306
  patch = { ...patch, diff: null, diffError: null }
3000
3307
  }
3308
+ if (['projectsRoot', 'storeIdentity', 'activeProjectId'].some(key => Object.hasOwn(patch, key) && patch[key] !== data[key])) retireSnapshotContext()
3309
+ if (['projectsRoot', 'storeIdentity', 'activeProjectId', 'currentRevision'].some(key => Object.hasOwn(patch, key) && patch[key] !== data[key])
3310
+ || Object.hasOwn(patch, 'view') && patch.view !== 'preview') patch = { ...patch, lighttableSelection: null }
3001
3311
  data = { ...data, ...patch }; notify()
3002
3312
  }
3003
3313
  /** Change one nested table. @param {'forms'|'busy'|'notices'} table @param {string} key @param {any} value */
@@ -3079,6 +3389,9 @@ window.__ModuleLoader__.load({
3079
3389
  projects: payload.projects || [],
3080
3390
  recipeCatalog: payload.recipeCatalog ?? { recipes: [], errors: [] },
3081
3391
  projectsRoot: payload.projectsRoot ?? null,
3392
+ storeIdentity: payload.storeIdentity ?? null,
3393
+ editableSnapshotProtocol: payload.editableSnapshotProtocol ?? null,
3394
+ editableSnapshotAvailability: payload.editableSnapshotAvailability ?? null,
3082
3395
  creationRequestProtocol: payload.creationRequestProtocol ?? null,
3083
3396
  cameraTargetResetSupported: payload.cameraTargetResetSupported === true,
3084
3397
  selected: payload.selected ?? null,
@@ -3161,6 +3474,7 @@ window.__ModuleLoader__.load({
3161
3474
  }
3162
3475
  refreshCreationDrafts()
3163
3476
  set(patch)
3477
+ syncSnapshotContext()
3164
3478
  arm()
3165
3479
  }
3166
3480
 
@@ -3176,6 +3490,133 @@ window.__ModuleLoader__.load({
3176
3490
  /** A write just happened: re-run every read, including the view-specific ones. */
3177
3491
  const reload = () => { tick += 1; void load() }
3178
3492
 
3493
+ // A handle fixes the revision/video request while the Host plans its files.
3494
+ // The browser stores no scene content or archive bytes; download is a link.
3495
+ function retireSnapshotContext() {
3496
+ snapshotGeneration += 1; activeSnapshotContext = null
3497
+ if (snapshotTimer !== null) { clearTimeout(snapshotTimer); snapshotTimer = null }
3498
+ for (const controller of snapshotControllers) controller.abort()
3499
+ snapshotControllers.clear()
3500
+ }
3501
+ function changeSnapshot(key, patch) {
3502
+ const entries = { ...data.editableSnapshots, [key]: { ...data.editableSnapshots[key], ...patch } }
3503
+ const keys = Object.keys(entries)
3504
+ for (const old of keys.slice(0, Math.max(0, keys.length - 20))) if (old !== key) delete entries[old]
3505
+ set({ editableSnapshots: entries })
3506
+ }
3507
+ function storedSnapshots() {
3508
+ if (!snapshotStorage) throw new Error('Storage is unavailable')
3509
+ const raw = snapshotStorage.getItem(SNAPSHOT_STORAGE_KEY)
3510
+ if (!raw) return []
3511
+ if (raw.length > 81920) throw new Error('Snapshot handles exceed their storage bound')
3512
+ const records = JSON.parse(raw)
3513
+ if (!Array.isArray(records) || records.length > 20) throw new Error('Invalid snapshot handle storage')
3514
+ return records.filter(record => typeof record.key === 'string' && record.key.length <= 4096 && validSnapshotHandle(record.handle))
3515
+ }
3516
+ function rememberSnapshot(key, handle) {
3517
+ try {
3518
+ const records = storedSnapshots().filter(record => record.key !== key).slice(-19)
3519
+ records.push({ key, handle, savedAt: new Date().toISOString() })
3520
+ const raw = JSON.stringify(records)
3521
+ if (raw.length > 81920) throw new Error('Snapshot handles exceed their storage bound')
3522
+ snapshotStorage.setItem(SNAPSHOT_STORAGE_KEY, raw)
3523
+ if (snapshotStorage.getItem(SNAPSHOT_STORAGE_KEY) !== raw) throw new Error('Snapshot handle did not persist')
3524
+ changeSnapshot(key, { storageUnavailable: false })
3525
+ } catch { changeSnapshot(key, { storageUnavailable: true }) }
3526
+ }
3527
+ function syncSnapshotContext() {
3528
+ const key = snapshotContextKey(data)
3529
+ if (!key || key === activeSnapshotContext) return
3530
+ activeSnapshotContext = key
3531
+ let entry = data.editableSnapshots[key]
3532
+ if (!entry) {
3533
+ let handle = null, storageUnavailable = false
3534
+ try { handle = storedSnapshots().find(record => record.key === key)?.handle || null } catch { storageUnavailable = true }
3535
+ if (handle && (handle.storeIdentity !== data.storeIdentity || handle.projectId !== data.activeProjectId)) handle = null
3536
+ entry = { revision: handle?.revision || data.currentRevision, videoJobId: handle?.videoJobId || null, handle, result: null, issue: null, busy: {}, attempt: 0, storageUnavailable }
3537
+ }
3538
+ changeSnapshot(key, { ...entry, busy: {} })
3539
+ if (entry.handle && running && snapshotSupported(data)) void snapshotRequest('check')
3540
+ }
3541
+ function armSnapshot(key) {
3542
+ if (snapshotTimer !== null) { clearTimeout(snapshotTimer); snapshotTimer = null }
3543
+ const entry = data.editableSnapshots[key]
3544
+ if (!running || key !== snapshotContextKey(data) || !snapshotSupported(data) || entry?.result?.state !== 'preparing' || entry.issue) return
3545
+ snapshotTimer = setTimeout(() => { snapshotTimer = null; void snapshotRequest('check') }, snapshotPollMs)
3546
+ }
3547
+ async function snapshotControl(handle, kind, signal) {
3548
+ const suffix = kind === 'prepare' ? '' : `/${handle.exportId}${kind === 'cancel' ? '/cancel' : ''}`
3549
+ const body = kind === 'prepare' ? { requestId: handle.requestId, revision: handle.revision, ...(handle.videoJobId ? { videoJobId: handle.videoJobId } : {}), expectedStoreIdentity: handle.storeIdentity }
3550
+ : kind === 'cancel' ? { expectedStoreIdentity: handle.storeIdentity } : null
3551
+ const response = await fetchImpl(projectRoute(handle.projectId, `/editable-snapshots${suffix}`), {
3552
+ method: body ? 'POST' : 'GET', cache: 'no-store', headers: { accept: 'application/json', ...(body ? { 'content-type': 'application/json' } : {}) },
3553
+ ...(body ? { body: JSON.stringify(body) } : {}), signal,
3554
+ })
3555
+ const result = await response.json()
3556
+ if (!response.ok || result?.ok !== true) throw Object.assign(new Error(result?.error?.message || 'Snapshot request failed'), { code: result?.error?.code || 'UI_SNAPSHOT_NETWORK' })
3557
+ if (!validSnapshotReply(result.snapshot, handle)) throw Object.assign(new Error('Snapshot identity mismatch'), { code: 'UI_SNAPSHOT_MISMATCH' })
3558
+ return result.snapshot
3559
+ }
3560
+ async function snapshotRequest(kind) {
3561
+ const key = snapshotContextKey(data), entry = data.editableSnapshots[key]
3562
+ if (!key || !entry || !snapshotSupported(data)) return
3563
+ if (entry.busy?.[kind] || kind === 'prepare' && Object.values(entry.busy || {}).some(Boolean)) return
3564
+ if (kind !== 'prepare' && !entry.handle) return
3565
+ if (kind === 'cancel' && entry.result?.state !== 'preparing') return
3566
+ if (kind === 'prepare' && snapshotSameSelection(entry) && ['preparing', 'ready'].includes(entry.result?.state) && !entry.issue) return
3567
+ if (kind === 'prepare' && !entry.handle && !(data.selected?.revisions || []).some(item => item.revision === entry.revision)) return
3568
+ const generation = snapshotGeneration
3569
+ const attempt = (entry.attempt || 0) + (kind === 'prepare' ? 1 : 0)
3570
+ changeSnapshot(key, { busy: { ...entry.busy, [kind]: true }, issue: null, attempt, ...(kind === 'prepare' ? { result: null } : {}) })
3571
+ const stillCurrent = () => generation === snapshotGeneration && key === snapshotContextKey(data) && data.editableSnapshots[key]?.attempt === attempt
3572
+ const controller = new AbortController(); snapshotControllers.add(controller)
3573
+ let deadline = null, abortListener = null
3574
+ try {
3575
+ let handle = entry.handle
3576
+ if (kind === 'prepare' && !snapshotSameSelection(entry)) {
3577
+ if (!(data.selected?.revisions || []).some(item => item.revision === entry.revision)
3578
+ || entry.videoJobId && !snapshotVideos(data, entry.revision).some(job => job.jobId === entry.videoJobId)) throw Object.assign(new Error('Saved source unavailable'), { code: 'UI_SNAPSHOT_MISMATCH' })
3579
+ const requestId = newCreationKey().replace(/^create-/, 'copy-')
3580
+ handle = { requestId, exportId: await snapshotExportId(requestId), projectId: data.activeProjectId,
3581
+ revision: entry.revision, videoJobId: entry.videoJobId, storeIdentity: data.storeIdentity }
3582
+ if (!stillCurrent()) return
3583
+ changeSnapshot(key, { handle, result: null })
3584
+ rememberSnapshot(key, handle)
3585
+ }
3586
+ if (!handle || await snapshotExportId(handle.requestId) !== handle.exportId) throw Object.assign(new Error('Invalid remembered request'), { code: 'UI_SNAPSHOT_MISMATCH' })
3587
+ if (!stillCurrent()) return
3588
+ const aborted = new Promise((_, reject) => {
3589
+ abortListener = () => reject(Object.assign(new Error('Snapshot request interrupted'), { code: 'UI_SNAPSHOT_NETWORK' }))
3590
+ controller.signal.addEventListener('abort', abortListener, { once: true })
3591
+ deadline = setTimeout(() => controller.abort(), snapshotTimeoutMs)
3592
+ })
3593
+ const result = await Promise.race([snapshotControl(handle, kind, controller.signal), aborted])
3594
+ if (!stillCurrent()) return
3595
+ const current = data.editableSnapshots[key]
3596
+ // An attachment already finalized on the Host survives a late cancel.
3597
+ // A stale in-flight status read cannot undo any terminal response.
3598
+ if (current.result?.state === 'ready' || kind === 'check' && current.result && current.result.state !== 'preparing' && result.state === 'preparing') return
3599
+ changeSnapshot(key, { result, issue: null })
3600
+ } catch (error) {
3601
+ if (stillCurrent() && !(kind === 'cancel' && data.editableSnapshots[key]?.result?.state === 'ready')) changeSnapshot(key, { issue: { code: error.code || 'UI_SNAPSHOT_NETWORK' } })
3602
+ } finally {
3603
+ if (deadline !== null) clearTimeout(deadline)
3604
+ if (abortListener) controller.signal.removeEventListener('abort', abortListener)
3605
+ snapshotControllers.delete(controller)
3606
+ if (stillCurrent()) {
3607
+ changeSnapshot(key, { busy: { ...data.editableSnapshots[key].busy, [kind]: false } })
3608
+ armSnapshot(key)
3609
+ }
3610
+ }
3611
+ }
3612
+ function setSnapshotSelection(field, value) {
3613
+ const key = snapshotContextKey(data), entry = data.editableSnapshots[key]
3614
+ if (!entry || entry.result?.state === 'preparing' || Object.values(entry.busy || {}).some(Boolean)) return
3615
+ if (field === 'revision' && !(data.selected?.revisions || []).some(item => item.revision === value)) return
3616
+ if (field === 'videoJobId' && value && !snapshotVideos(data, entry.revision).some(job => job.jobId === value)) return
3617
+ changeSnapshot(key, { [field]: value || null, ...(field === 'revision' ? { videoJobId: null } : {}) })
3618
+ }
3619
+
3179
3620
  const creationBody = () => creationRequestBody(data.forms)
3180
3621
 
3181
3622
  async function submitCreation(attempt) {
@@ -3303,6 +3744,11 @@ window.__ModuleLoader__.load({
3303
3744
  }
3304
3745
  }
3305
3746
  const actions = {
3747
+ setSnapshotRevision: value => setSnapshotSelection('revision', value),
3748
+ setSnapshotVideo: value => setSnapshotSelection('videoJobId', value),
3749
+ prepareEditableSnapshot: () => snapshotRequest('prepare'),
3750
+ checkEditableSnapshot: () => snapshotRequest('check'),
3751
+ cancelEditableSnapshot: () => snapshotRequest('cancel'),
3306
3752
  setAssemblyValue: (id, value) => {
3307
3753
  const draft = assemblyDraftFor(data)
3308
3754
  if (!draft || data.busy.assembly || draft.attempt || !draft.parameters.some(parameter => parameter.id === id)) return
@@ -3363,7 +3809,9 @@ window.__ModuleLoader__.load({
3363
3809
  * you just made. Clicking the tab you are already on is not a re-entry, so
3364
3810
  * it clears nothing.
3365
3811
  */
3366
- setView: (view) => (view === data.view ? undefined : set({ view, notices: { ...data.notices, [view]: null } })),
3812
+ setView: (view) => (view === data.view ? undefined
3813
+ : set({ view, ...(view === 'projects' ? { projectTask: 'brief' } : {}), notices: { ...data.notices, [view]: null } })),
3814
+ beginNewWork: () => set({ view: 'projects', projectTask: 'new' }),
3367
3815
  selectProject: (projectId) => {
3368
3816
  if (projectId === data.activeProjectId) { reload(); return }
3369
3817
  const operation = bundleOperations.get(data.activeProjectId)
@@ -3617,7 +4065,7 @@ window.__ModuleLoader__.load({
3617
4065
  if (recipe && data.forms.recipe && recipeChoiceIdentity(recipe) === recipeChoiceIdentity(data.forms.recipe)) return
3618
4066
  const saved = recipe ? data.recipeChoices.find(choice => recipeChoiceIdentity(choice.recipe) === recipeChoiceIdentity(recipe)) : null
3619
4067
  if (saved && !recipeChoiceFits(recipe, saved.parameters)) { set({ creationDraftStorageStatus: 'invalid' }); return }
3620
- set({ creationDraftMissingRecipe: null, forms: { ...data.forms, recipe,
4068
+ set({ creationDraftMissingRecipe: null, disclosures: { ...data.disclosures, [disclosureKey(data, 'new:recipe-gallery')]: false }, forms: { ...data.forms, recipe,
3621
4069
  recipeParameters: recipe ? saved ? copyRecipeParameters(saved.parameters)
3622
4070
  : Object.fromEntries(recipe.parameters.map(parameter => [parameter.id, Array.isArray(parameter.default) ? [...parameter.default] : parameter.default])) : {},
3623
4071
  title: !data.forms.title || data.forms.title === data.forms.recipe?.title ? recipe?.title || '' : data.forms.title,
@@ -3629,6 +4077,15 @@ window.__ModuleLoader__.load({
3629
4077
  [parameter.id, Array.isArray(parameter.default) ? [...parameter.default] : parameter.default])) } })
3630
4078
  },
3631
4079
  setRecipeParameter: (id, value) => setIn('forms', 'recipeParameters', { ...data.forms.recipeParameters, [id]: value }),
4080
+ selectLighttableResult: revision => {
4081
+ const saved = data.selected?.revisions?.some(entry => entry.revision === revision)
4082
+ const available = data.previews?.revisions?.some(entry => entry.revision === revision)
4083
+ if (!data.activeProjectId || !saved || !available) return
4084
+ set({ view: 'preview', compareMode: 'result', lighttableSelection: {
4085
+ projectId: data.activeProjectId, projectsRoot: data.projectsRoot, storeIdentity: data.storeIdentity, anchorRevision: data.currentRevision, revision,
4086
+ } })
4087
+ },
4088
+ returnToCurrentResult: () => set({ view: 'preview', compareMode: 'result', lighttableSelection: null }),
3632
4089
  setCompareMode: (compareMode) => set({ compareMode }),
3633
4090
  pickCompare: (side, revision) => set(side === 'left'
3634
4091
  ? { compareLeft: revision, diff: null, diffError: null }
@@ -3742,7 +4199,8 @@ window.__ModuleLoader__.load({
3742
4199
  selectPhotography: (kind, id) => {
3743
4200
  const current = photographyDraftFor(data)
3744
4201
  if (!current || photographyBusy(data.photographyWork[current.projectId]) || !['camera', 'light'].includes(kind) || !current[`${kind}s`].some(item => item.id === id)) return
3745
- set({ photographyDrafts: { ...data.photographyDrafts, [current.projectId]: { ...current, [`${kind}Id`]: id } } })
4202
+ set({ disclosures: { ...data.disclosures, [disclosureKey(data, 'photography')]: true },
4203
+ photographyDrafts: { ...data.photographyDrafts, [current.projectId]: { ...current, [`${kind}Id`]: id } } })
3746
4204
  },
3747
4205
  resetPhotography: () => {
3748
4206
  const projectId = data.activeProjectId, scene = data.selected?.scene
@@ -4098,7 +4556,7 @@ window.__ModuleLoader__.load({
4098
4556
  const recipe = ref ? data.recipeCatalog.recipes.find(recipe => recipe.id === ref.id && recipe.version === ref.version && recipe.digest === ref.digest) : null
4099
4557
  creationDraftId = newCreationKey(); restoredCreationSource = { id, raw: source.raw }; persistedCreationSignature = null
4100
4558
  creationAttempt = saved.attempt ? editorClone(saved.attempt) : null
4101
- set({ view: 'projects', recipeChoices: editorClone(saved.recipeChoices || []), forms: { ...data.forms, ...editorClone(saved.forms), recipe: recipe || null },
4559
+ set({ view: 'projects', projectTask: 'new', recipeChoices: editorClone(saved.recipeChoices || []), forms: { ...data.forms, ...editorClone(saved.forms), recipe: recipe || null },
4102
4560
  creationDraftMissingRecipe: ref && !recipe ? ref : null,
4103
4561
  creationWork: creationAttempt ? { status: 'error', title: creationAttempt.body.title, code: 'UI_FETCH_FAILED' } : null,
4104
4562
  notices: { ...data.notices, projects: { kind: 'creation', ok: true, message: t('projects.draftRestored') } } })
@@ -4166,7 +4624,12 @@ window.__ModuleLoader__.load({
4166
4624
  const projectId = data.activeProjectId, destination = { goal: 'projects', route: 'projects', parts: 'scene', form: 'preview', detail: 'preview', appearance: 'scene', delivery: 'jobs' }[step]
4167
4625
  if (!destination) return
4168
4626
  if (projectId && ['form', 'detail'].includes(step)) actions.setInspection('mode', step === 'form' ? 'clay' : 'beauty')
4169
- set({ view: destination, guideFocus: { ...data.guideFocus, [projectId || 'new']: step } })
4627
+ const targets = { route: ['new:recipe-gallery'], parts: ['scene-outline'], form: ['inspection'], detail: ['inspection'],
4628
+ appearance: ['scene-outline', 'photography', 'assets'] }[step] || []
4629
+ set({ view: destination, ...(destination === 'projects' ? { projectTask: step === 'route' ? 'new' : 'brief' } : {}),
4630
+ ...(['form', 'detail'].includes(step) ? { lighttableSelection: null, compareMode: 'result' } : {}),
4631
+ disclosures: { ...data.disclosures, ...Object.fromEntries(targets.map(id => [disclosureKey(data, id), true])) },
4632
+ guideFocus: { ...data.guideFocus, [projectId || 'new']: step } })
4170
4633
  },
4171
4634
  cancelInspection: () => inspectionControllers.get(data.activeProjectId)?.abort(),
4172
4635
  renderInspection: async () => {
@@ -4292,6 +4755,7 @@ window.__ModuleLoader__.load({
4292
4755
  void load()
4293
4756
  },
4294
4757
  stop() {
4758
+ retireSnapshotContext()
4295
4759
  previewSourceGeneration += 1
4296
4760
  loadSequence += 1
4297
4761
  diffSequence += 1
@@ -4363,37 +4827,8 @@ window.__ModuleLoader__.load({
4363
4827
  function ProjectsView(ctx) {
4364
4828
  const state = ctx.state
4365
4829
  const actions = ctx.actions
4366
- return el('div', { 'data-view': 'projects' },
4367
- ErrorBox({ error: state.error }),
4368
- state.projects.length ? el('div', { className: 'db-card db-project-list' },
4369
- el('h4', null, t('tab.projects')),
4370
- state.projects.length === 0
4371
- ? el('div', { className: 'db-muted' }, t('projects.empty'))
4372
- : el('ul', { className: 'db-list' }, state.projects.map(project => el('li', { key: project.projectId, 'data-project': project.projectId },
4373
- el('div', { className: 'db-inline' },
4374
- Button({
4375
- tone: project.projectId === state.activeProjectId ? 'primary' : undefined,
4376
- action: `select-project:${project.projectId}`,
4377
- disabled: project.creationPending,
4378
- onClick: () => actions.selectProject(project.projectId),
4379
- children: project.title || project.projectId,
4380
- }),
4381
- el('span', { className: 'db-muted db-mono' }, project.projectId),
4382
- project.creationPending ? Badge({ tone: 'live', name: 'creation-pending', children: t('projects.incomplete') }) : null,
4383
- project.unfinishedJobs > 0 ? Badge({ tone: 'live', name: 'unfinished', children: t('projects.unfinishedJobs', { count: project.unfinishedJobs }) }) : null,
4384
- el('span', { className: 'db-muted' }, t('projects.revisionCount', { count: project.revisionCount })),
4385
- ),
4386
- el('div', { className: 'db-muted db-mono' }, t('projects.updated', { revision: project.currentRevision || '—', when: formatTime(project.updatedAt) })),
4387
- project.goal ? el('div', { className: 'db-muted' }, project.goal) : null,
4388
- ))),
4389
- ) : null,
4390
-
4391
- el('div', { className: 'db-card db-project-create' },
4392
- el('h4', null, t('projects.create')),
4393
- CreationDraftsView(ctx),
4394
- !state.projects.length ? el('p', { className: 'db-muted' }, t('projects.startHint')) : null,
4395
- RecipesView(ctx),
4396
- el('div', { className: 'db-create-footer' },
4830
+ const setup = state.disclosures?.[disclosureKey(state, 'new:recipe-gallery')] === false
4831
+ const createFields = el('div', { className: 'db-create-footer' },
4397
4832
  el('label', { className: 'db-field' }, t('projects.name'),
4398
4833
  el('input', {
4399
4834
  className: 'db-input',
@@ -4408,6 +4843,7 @@ window.__ModuleLoader__.load({
4408
4843
  'data-field': 'project-goal',
4409
4844
  'aria-label': t('projects.goal'),
4410
4845
  placeholder: t('projects.goal'),
4846
+ title: t('lighttable.goalHint'),
4411
4847
  value: state.forms.goal,
4412
4848
  onChange: event => actions.setForm('goal', event.target.value),
4413
4849
  })),
@@ -4418,7 +4854,17 @@ window.__ModuleLoader__.load({
4418
4854
  onClick: actions.createProject,
4419
4855
  children: state.busy.create ? (state.forms.recipe ? t('recipes.creatingPreview') : t('projects.creating')) : (state.forms.recipe ? t('recipes.createPreview') : t('projects.createButton')),
4420
4856
  }),
4421
- ),
4857
+ )
4858
+ return el('div', { 'data-view': 'projects' },
4859
+ ErrorBox({ error: state.error }),
4860
+ el('section', { className: 'db-card db-project-create', 'aria-label': t('projects.create') },
4861
+ el('h2', { className: 'db-start-title' }, t('lighttable.beginTitle')),
4862
+ el('p', { className: 'db-start-intro' }, t('lighttable.beginHint')),
4863
+ CreationDraftsView(ctx),
4864
+ !state.projects.length ? el('p', { className: 'db-muted' }, t('projects.startHint')) : null,
4865
+ setup ? createFields : null,
4866
+ RecipesView(ctx),
4867
+ setup ? null : createFields,
4422
4868
  state.notices.projects ? Notice(state.notices.projects, { marginTop: '8px' }) : null,
4423
4869
  state.status === 'ok' && state.creationRequestProtocol !== CREATION_REQUEST_PROTOCOL
4424
4870
  ? el('p', { className: 'db-muted', 'data-creation-host-stale': true }, t('projects.hostNeedsRestart')) : null,
@@ -4433,11 +4879,11 @@ window.__ModuleLoader__.load({
4433
4879
  el('summary', null, t('projects.creationDetails')), el('pre', { className: 'db-pre' }, state.notices.projects.technicalDetails)) : null,
4434
4880
  ) : null,
4435
4881
  ),
4436
- el('details', { className: 'db-storage' }, el('summary', null, t('projects.storage')),
4882
+ Disclosure(ctx, 'global:storage', t('projects.storage'), { className: 'db-storage' },
4437
4883
  el('span', { className: 'db-muted db-mono' }, `projectsRoot: ${state.projectsRoot || '—'}`)),
4438
4884
 
4439
- BriefEditor({ state, actions }),
4440
- state.selected ? el('div', { className: 'db-card' },
4885
+ ctx.newWork ? null : BriefEditor({ state, actions }),
4886
+ state.selected && !ctx.newWork ? el('div', { className: 'db-card' },
4441
4887
  el('h4', null, t('projects.currentProject', { title: state.selected.project.title })),
4442
4888
  KeyValues({ entries: [
4443
4889
  { label: 'projectId', value: state.selected.project.projectId },
@@ -4453,6 +4899,29 @@ window.__ModuleLoader__.load({
4453
4899
  ] }),
4454
4900
  el('div', { className: 'db-muted', style: { marginTop: '6px' } }, state.selected.qa.summary),
4455
4901
  ) : null,
4902
+ state.projects.length ? el('div', { className: 'db-card db-project-list' },
4903
+ el('h4', null, t('lighttable.projectList')),
4904
+ state.projects.length === 0
4905
+ ? el('div', { className: 'db-muted' }, t('projects.empty'))
4906
+ : el('ul', { className: 'db-list' }, state.projects.map(project => el('li', { key: project.projectId, 'data-project': project.projectId },
4907
+ el('div', { className: 'db-inline' },
4908
+ Button({
4909
+ tone: project.projectId === state.activeProjectId ? 'primary' : undefined,
4910
+ action: `select-project:${project.projectId}`,
4911
+ disabled: project.creationPending,
4912
+ onClick: () => { actions.selectProject(project.projectId); actions.setView('preview') },
4913
+ children: project.title || project.projectId,
4914
+ }),
4915
+ el('span', { className: 'db-muted db-mono' }, project.projectId),
4916
+ project.creationPending ? Badge({ tone: 'live', name: 'creation-pending', children: t('projects.incomplete') }) : null,
4917
+ project.unfinishedJobs > 0 ? Badge({ tone: 'live', name: 'unfinished', children: t('projects.unfinishedJobs', { count: project.unfinishedJobs }) }) : null,
4918
+ el('span', { className: 'db-muted' }, t('projects.revisionCount', { count: project.revisionCount })),
4919
+ ),
4920
+ el('div', { className: 'db-muted db-mono' }, t('projects.updated', { revision: project.currentRevision || '—', when: formatTime(project.updatedAt) })),
4921
+ project.goal ? el('div', { className: 'db-muted' }, project.goal) : null,
4922
+ ))),
4923
+ ) : null,
4924
+
4456
4925
  )
4457
4926
  }
4458
4927
 
@@ -4489,6 +4958,7 @@ window.__ModuleLoader__.load({
4489
4958
  el('p', { className: 'db-muted' }, t('recipes.previewNote')),
4490
4959
  !recipeSelectionCurrent(state) ? el('p', { role: 'alert', className: 'db-error' }, t('recipes.stale')) : null,
4491
4960
  catalog.errors.length ? el('p', { className: 'db-error' }, t('recipes.unavailable')) : null,
4961
+ Disclosure({ state, actions }, 'new:recipe-gallery', selected?.title || t('recipes.heading'), { className: 'db-recipe-picker', defaultOpen: true },
4492
4962
  Button({ action: 'recipe-blank',
4493
4963
  onClick: () => actions.selectRecipe(null), children: t('recipes.blank') }),
4494
4964
  el('div', { className: 'db-recipe-grid' },
@@ -4496,12 +4966,14 @@ window.__ModuleLoader__.load({
4496
4966
  const chosen = selected?.id === recipe.id && selected?.version === recipe.version && selected?.digest === recipe.digest
4497
4967
  return el('article', { key: `${recipe.id}@${recipe.version}`, 'data-recipe': recipe.id, className: 'db-recipe', 'data-selected': String(chosen) },
4498
4968
  el('img', { src: recipe.previewUrl, alt: recipe.title, loading: 'lazy' }),
4499
- el('h5', null, recipe.title), el('p', { className: 'db-muted db-recipe-description' }, recipe.description),
4500
- el('p', { className: 'db-muted db-recipe-license' }, `${t('recipes.license')}: ${recipe.author.name} · ${recipe.license} · v${recipe.version}`),
4969
+ el('h5', null, recipe.title),
4970
+ Disclosure({ state, actions }, `new:recipe-about:${recipe.id}@${recipe.version}`, t('recipes.about'), { className: 'db-recipe-about' },
4971
+ el('p', { className: 'db-muted db-recipe-description' }, recipe.description),
4972
+ el('p', { className: 'db-muted db-recipe-license' }, `${t('recipes.license')}: ${recipe.author.name} · ${recipe.license} · v${recipe.version}`)),
4501
4973
  Button({ action: `select-recipe:${recipe.id}@${recipe.version}`, tone: chosen ? 'primary' : undefined,
4502
4974
  onClick: () => actions.selectRecipe(recipe), children: chosen ? t('recipes.selected') : t('recipes.select') }),
4503
4975
  )
4504
- })),
4976
+ }))),
4505
4977
  selected ? el('fieldset', { className: 'db-recipe-parameters' },
4506
4978
  el('legend', null, t('recipes.parameters')),
4507
4979
  Button({ action: 'reset-recipe', onClick: actions.resetRecipe, children: t('recipes.reset') }),
@@ -4629,7 +5101,7 @@ window.__ModuleLoader__.load({
4629
5101
  min: parameter.minimum, max: parameter.maximum, step: 'any', value: draft.values[parameter.id],
4630
5102
  disabled: state.busy.assembly || Boolean(draft.attempt), onInput: event => actions.setAssemblyValue(parameter.id, event.currentTarget.value) })))),
4631
5103
  el('div', { className: 'db-inline' }, Button({ action: 'assembly-save', disabled: Boolean(blocked) || assemblyInvalid(draft) || !assemblyDirty(draft),
4632
- onClick: actions.saveAssembly, children: draft.attempt ? t('assembly.retry') : t('assembly.save') }),
5104
+ onClick: actions.saveAssembly, children: state.busy.assembly ? t('assembly.saving') : draft.attempt ? t('assembly.retry') : t('assembly.save') }),
4633
5105
  Button({ action: 'assembly-reset', disabled: state.busy.assembly, onClick: actions.resetAssembly, children: t('editor.reset') })))
4634
5106
  }
4635
5107
 
@@ -4867,8 +5339,7 @@ window.__ModuleLoader__.load({
4867
5339
  Button({ action: 'editor-reset', disabled: state.busy.editor, onClick: actions.resetEditor, children: t('editor.reset') }),
4868
5340
  Button({ action: 'editor-review-subject', disabled: disabled || draft.entity.visible === false || draft.entity.kind === 'empty'
4869
5341
  || state.briefWork[state.activeProjectId]?.saving || state.visualRuns[state.activeProjectId]?.busy,
4870
- onClick: () => actions.setReviewSubject(draft.entityId), children: t('brief.subjectShortcut') }), restore),
4871
- Notice(state.notices.scene))
5342
+ onClick: () => actions.setReviewSubject(draft.entityId), children: t('brief.subjectShortcut') }), restore))
4872
5343
  }
4873
5344
 
4874
5345
  /** 场景树: the Scene Tree of the revision in view. */
@@ -5110,9 +5581,10 @@ window.__ModuleLoader__.load({
5110
5581
  ? el('div', { className: 'db-muted' }, t('common.empty'))
5111
5582
  : el('ul', { className: 'db-list' }, items.map(item => el('li', { key: item.id }, render(item)))))
5112
5583
 
5113
- return el('div', { 'data-view': 'scene' },
5584
+ return el('div', { 'data-view': 'scene', role: 'region', 'aria-label': t('tab.scene') },
5114
5585
  ErrorBox({ error: state.error }),
5115
- el('div', { className: 'db-card' },
5586
+ Notice(state.notices.scene),
5587
+ Disclosure(ctx, 'scene-overview', t('lighttable.overview'), { className: 'db-scene-overview' },
5116
5588
  el('div', { className: 'db-inline' },
5117
5589
  el('strong', null, String(scene.project.title || scene.project.id || '')),
5118
5590
  Badge({ children: scene.revision }),
@@ -5121,7 +5593,7 @@ window.__ModuleLoader__.load({
5121
5593
  ),
5122
5594
  ),
5123
5595
  el('div', { className: 'db-scene-layout' },
5124
- el('aside', { className: 'db-scene-outline', 'data-scroll-key': JSON.stringify([state.activeProjectId, 'scene-outline']), 'aria-label': t('scene.outline') },
5596
+ Disclosure(ctx, 'scene-outline', t('lighttable.outline'), { className: 'db-scene-outline', 'data-scroll-key': JSON.stringify([state.activeProjectId, 'scene-outline']), 'aria-label': t('scene.outline') },
5125
5597
  el('div', { className: 'db-grid' },
5126
5598
  section(t('scene.entities'), scene.nodes.entities, entity => el('div', null,
5127
5599
  el('button', { type: 'button', className: 'db-btn', 'data-action': `select-entity:${entity.id}`, 'data-entity-id': entity.id,
@@ -5161,8 +5633,8 @@ window.__ModuleLoader__.load({
5161
5633
  )),
5162
5634
  el('section', { className: 'db-scene-inspector', 'aria-label': t('scene.inspector') },
5163
5635
  AssemblyEditor(ctx), SceneEditor(ctx),
5164
- PhotographyEditor(ctx),
5165
- AssetsView(ctx),
5636
+ Disclosure(ctx, 'photography', t('lighttable.photography'), { className: 'db-tool-disclosure' }, PhotographyEditor(ctx)),
5637
+ Disclosure(ctx, 'assets', t('lighttable.assets'), { className: 'db-tool-disclosure' }, AssetsView(ctx)),
5166
5638
  el('details', { key: advancedDisclosure, 'data-disclosure': advancedDisclosure, open: state.disclosures?.[advancedDisclosure] ?? false,
5167
5639
  onToggle: event => actions.setDisclosure(advancedDisclosure, event.currentTarget.open), className: 'db-card' }, el('summary', null, t('editor.advanced')),
5168
5640
  el('h4', null, t('scene.patch')),
@@ -5182,7 +5654,6 @@ window.__ModuleLoader__.load({
5182
5654
  children: state.busy.patch ? t('scene.submitting') : t('scene.submit'),
5183
5655
  }),
5184
5656
  Button({ action: 'reset-patch', onClick: () => actions.setForm('patch', null), children: t('scene.resetTemplate') }),
5185
- Notice(state.notices.scene, { border: 0, padding: '0 6px', marginBottom: 0 }),
5186
5657
  ),
5187
5658
  ))),
5188
5659
  )
@@ -5347,7 +5818,7 @@ window.__ModuleLoader__.load({
5347
5818
  { id: 'delivery', label: t('guide.delivery'), hint: t('guide.deliveryHint') },
5348
5819
  ]
5349
5820
  const disclosure = JSON.stringify([projectId || 'new', 'guide-notes'])
5350
- return el('section', { className: 'db-card db-guide', 'data-creation-guide': projectId || 'new' },
5821
+ return Disclosure({ state, actions }, 'creation-guide', t('lighttable.guide'), { className: 'db-guide', 'data-creation-guide': projectId || 'new' },
5351
5822
  el('div', { className: 'db-guide-top' }, el('strong', null, t('guide.title')),
5352
5823
  el('div', { className: 'db-inline' }, steps.map(step =>
5353
5824
  Button({ action: `guide-${step.id}`, disabled: !projectId && !['goal', 'route'].includes(step.id), onClick: () => actions.openCreationStep(step.id), children: step.label })))),
@@ -5416,11 +5887,11 @@ window.__ModuleLoader__.load({
5416
5887
  const actions = ctx.actions
5417
5888
  const previews = state.previews
5418
5889
  if (previews === null) {
5419
- if (state.previewReadStatus === 'error') return el('div', { 'data-view': 'preview', 'data-preview-state': 'error', className: 'db-card' },
5890
+ if (state.previewReadStatus === 'error') return el('div', { 'data-view': ctx.lighttable ? undefined : 'preview', 'data-preview-state': 'error', className: 'db-card' },
5420
5891
  el('div', { className: 'db-muted' }, t('preview.readFailed')),
5421
5892
  Button({ action: 'preview-reload', onClick: actions.reload, children: t('common.refresh') }))
5422
- if (state.previewReadStatus === 'loading') return el('div', { 'data-view': 'preview', 'data-preview-state': 'loading', className: 'db-muted' }, t('preview.reading'))
5423
- return el('div', { 'data-view': 'preview', className: 'db-muted' }, t('common.noProject'))
5893
+ if (state.previewReadStatus === 'loading') return el('div', { 'data-view': ctx.lighttable ? undefined : 'preview', 'data-preview-state': 'loading', className: 'db-muted' }, t('preview.reading'))
5894
+ return el('div', { 'data-view': ctx.lighttable ? undefined : 'preview', className: 'db-muted' }, t('common.noProject'))
5424
5895
  }
5425
5896
  const revisions = previews.revisions
5426
5897
  const { left, right } = previewRevisionPair(state)
@@ -5531,7 +6002,7 @@ window.__ModuleLoader__.load({
5531
6002
  t('preview.notRenderedHere')),
5532
6003
  ]
5533
6004
 
5534
- return el('div', { 'data-view': 'preview' },
6005
+ return el('div', { 'data-view': ctx.lighttable ? undefined : 'preview' },
5535
6006
  ErrorBox({ error: state.error }),
5536
6007
  el('div', { className: 'db-tabs' },
5537
6008
  Button({
@@ -5585,7 +6056,7 @@ window.__ModuleLoader__.load({
5585
6056
  resultMode ? null : rendersMode ? PreviewConditions(pair.previous, pair.current)
5586
6057
  : editPair ? PreviewConditions(editPair.beforeArtifact, editPair.afterArtifact) : PreviewConditions(sheetOf(entryOf(left)), sheetOf(entryOf(right))),
5587
6058
  resultMode
5588
- ? el('div', { style: { maxWidth: '960px', margin: '0 auto' } }, imagePane('current', t('preview.latest'), sheetOf(entryOf(state.currentRevision)), t('preview.noneForRevision')))
6059
+ ? ctx.lighttable ? null : el('div', { style: { maxWidth: '960px', margin: '0 auto' } }, imagePane('current', t('preview.latest'), sheetOf(entryOf(state.currentRevision)), t('preview.noneForRevision')))
5589
6060
  : el('div', { className: 'db-grid' }, rendersMode ? renderPairPanes : editorPanes || [revisionPane(entryOf(left), 'left'), revisionPane(entryOf(right), 'right')]),
5590
6061
  state.diff ? el('div', { className: 'db-card', 'data-diff': state.diff.identical ? 'identical' : 'changed' },
5591
6062
  el('h4', null, `${state.diff.fromRevision} → ${state.diff.toRevision}:${state.diff.identical ? t('preview.identical') : t('preview.changeCount', { count: state.diff.totalChanges })}`),
@@ -5604,7 +6075,7 @@ window.__ModuleLoader__.load({
5604
6075
  ) : null,
5605
6076
  state.diffError ? ErrorBox({ error: state.diffError }) : null,
5606
6077
  ),
5607
- InspectionPanel(ctx),
6078
+ ctx.lighttable ? Disclosure(ctx, 'inspection', t('inspection.title'), { className: 'db-tool-disclosure' }, InspectionPanel(ctx)) : InspectionPanel(ctx),
5608
6079
  )
5609
6080
  }
5610
6081
 
@@ -5759,6 +6230,46 @@ window.__ModuleLoader__.load({
5759
6230
  )
5760
6231
  }
5761
6232
 
6233
+ function EditableSnapshotView({ state, actions }) {
6234
+ const entry = snapshotEntry(state), result = entry?.result, busy = entry?.busy || {}
6235
+ const enabled = snapshotSupported(state), working = Object.values(busy).some(Boolean), preparing = result?.state === 'preparing'
6236
+ const same = snapshotSameSelection(entry), videos = snapshotVideos(state, entry?.revision)
6237
+ const revisions = state.selected?.revisions || []
6238
+ const phases = { writing: t('snapshot.copying'), verifying: t('snapshot.verifying'), publishing: t('snapshot.publishing') }
6239
+ const done = result?.phase === 'verifying' ? result.verifiedBytes : result?.writtenBytes
6240
+ const measured = result?.phase === 'writing' && Number.isSafeInteger(done) && done >= 0 && Number.isSafeInteger(result?.totalBytes) && result.totalBytes > 0
6241
+ return el('section', { className: 'db-card', 'data-editable-snapshot': result?.state || 'idle', 'aria-label': t('snapshot.title') },
6242
+ el('h4', null, t('snapshot.title')),
6243
+ el('p', { className: 'db-muted' }, t('snapshot.scope')),
6244
+ Disclosure({ state, actions }, 'snapshot-scope', t('snapshot.details'), {}, el('p', { className: 'db-muted', style: { maxWidth: '72ch' } }, t('snapshot.detailText'))),
6245
+ !enabled ? el('p', { className: 'db-muted', 'data-snapshot-unavailable': true }, state.editableSnapshotAvailability?.reason === 'local-only' ? t('snapshot.local') : t('snapshot.upgrade')) : null,
6246
+ el('div', { className: 'db-inline', style: { marginTop: '12px', alignItems: 'end' } },
6247
+ el('label', { className: 'db-field', style: { flex: '1 1 180px', maxWidth: '360px' } }, t('snapshot.revision'), el('select', { className: 'db-input', 'data-field': 'snapshot-revision', value: entry?.revision || '', disabled: !enabled || working || preparing,
6248
+ onChange: event => actions.setSnapshotRevision(event.target.value) }, revisions.map(item => el('option', { key: item.revision, value: item.revision }, item.revision + (item.isCurrent ? ` · ${t('revisions.current')}` : ''))))),
6249
+ el('label', { className: 'db-field', style: { flex: '1 1 180px', maxWidth: '360px' } }, t('snapshot.video'), el('select', { className: 'db-input', 'data-field': 'snapshot-video', value: entry?.videoJobId || '', disabled: !enabled || working || preparing,
6250
+ onChange: event => actions.setSnapshotVideo(event.target.value) }, el('option', { value: '' }, t('snapshot.noVideo')),
6251
+ entry?.videoJobId && !videos.some(job => job.jobId === entry.videoJobId) ? el('option', { value: entry.videoJobId }, entry.videoJobId) : null,
6252
+ videos.map(job => el('option', { key: job.jobId, value: job.jobId }, job.jobId))))),
6253
+ revisions.length === 0 ? el('p', { className: 'db-muted' }, t('snapshot.noRevision')) : null,
6254
+ el('div', { 'aria-live': 'polite', role: 'status', style: { marginTop: '12px' } },
6255
+ busy.cancel ? el('p', null, t('snapshot.cancelling')) : busy.check && !result ? el('p', null, t('snapshot.checking')) : busy.prepare || preparing ? el('p', null, phases[result?.phase] || t('snapshot.preparing')) : null,
6256
+ result?.state === 'ready' ? el('p', null, t('snapshot.ready', { revision: result.revision, bytes: snapshotBytes(result.archive.bytes) })) : null,
6257
+ ['failed', 'cancelled'].includes(result?.state) ? el('p', { className: 'db-muted' }, result.error?.code === 'SNAPSHOT_INTERRUPTED' ? t('snapshot.interrupted') : result.state === 'failed' ? t('snapshot.failed') : t('snapshot.cancelled')) : null,
6258
+ result?.state === 'failed' && result.error?.message ? el('p', { className: 'db-error' }, result.error.message) : null,
6259
+ (preparing || busy.prepare) && entry?.handle ? el('p', { className: 'db-muted' }, t('snapshot.saved', entry.handle)) : null,
6260
+ preparing && result.phase === 'verifying' && Number.isSafeInteger(result.verifiedBytes) && result.verifiedBytes >= 0 ? el('p', { className: 'db-muted' }, t('snapshot.verifiedBytes', { bytes: snapshotBytes(result.verifiedBytes) })) : null,
6261
+ preparing && measured ? el('div', null, ProgressBar({ percent: done / result.totalBytes * 100 }), el('p', { className: 'db-muted' }, t('snapshot.progress', { done: snapshotBytes(done), total: snapshotBytes(result.totalBytes) }))) : null,
6262
+ entry?.issue ? el('p', { className: 'db-error', 'data-snapshot-issue': entry.issue.code }, entry.issue.code === 'UI_SNAPSHOT_MISMATCH' ? t('snapshot.invalid') : t('snapshot.uncertain')) : null),
6263
+ entry?.handle && !same ? el('p', { className: 'db-muted' }, t('snapshot.newSelection')) : null,
6264
+ entry?.storageUnavailable && entry.handle ? el('p', { className: 'db-muted' }, t('snapshot.storage')) : null,
6265
+ el('div', { className: 'db-inline', style: { marginTop: '12px' } },
6266
+ enabled && result?.state === 'ready' && !entry.issue ? el('a', { className: 'db-btn', 'data-tone': 'primary', href: result.downloadUrl, download: true, 'data-action': 'snapshot-download' }, t('snapshot.download')) : null,
6267
+ preparing ? Button({ action: 'snapshot-cancel', disabled: !enabled || busy.cancel || busy.prepare, onClick: actions.cancelEditableSnapshot, children: t('snapshot.cancel') }) : null,
6268
+ entry?.issue || entry?.handle && !result ? Button({ action: 'snapshot-check', disabled: !enabled || working, onClick: actions.checkEditableSnapshot, children: t('snapshot.check') }) : null,
6269
+ (!preparing || entry?.issue) && !(same && result?.state === 'ready' && !entry.issue) ? Button({ action: 'snapshot-prepare', tone: 'primary', disabled: !enabled || !entry?.revision || working,
6270
+ onClick: actions.prepareEditableSnapshot, children: entry?.handle && same ? t('snapshot.retry') : t('snapshot.prepare') }) : null))
6271
+ }
6272
+
5762
6273
  /** 版本: the revision list, restore, and the hand-off to Preview Compare. */
5763
6274
  function RevisionsView(ctx) {
5764
6275
  const state = ctx.state
@@ -5768,10 +6279,11 @@ window.__ModuleLoader__.load({
5768
6279
 
5769
6280
  return el('div', { 'data-view': 'revisions' },
5770
6281
  ErrorBox({ error: state.error }),
6282
+ EditableSnapshotView(ctx),
5771
6283
  el('div', { className: 'db-card' },
5772
6284
  el('h4', null, t('revisions.title', { count: revisions.length })),
5773
6285
  el('p', { className: 'db-muted' }, t('revisions.compareHint')),
5774
- el('ul', { className: 'db-list' }, revisions.map(entry => el('li', { key: entry.revision, 'data-revision': entry.revision },
6286
+ el('ul', { className: 'db-list' }, [...revisions].reverse().map(entry => el('li', { key: entry.revision, 'data-revision': entry.revision },
5775
6287
  el('div', { className: 'db-inline' },
5776
6288
  el('span', { className: 'db-mono' }, entry.revision),
5777
6289
  entry.isCurrent ? Badge({ tone: 'ok', children: t('revisions.current') }) : null,
@@ -5783,6 +6295,10 @@ window.__ModuleLoader__.load({
5783
6295
  entry.isCurrent ? null : Button({ action: `restore:${entry.revision}`, disabled: state.busy.restore, onClick: () => actions.restoreRevision(entry.revision), children: t('revisions.restore') }),
5784
6296
  ),
5785
6297
  el('div', { className: 'db-muted' }, entry.summary || t('common.noNote')),
6298
+ el('div', { className: 'db-muted', 'data-spec-change-status':
6299
+ ['changed', 'unchanged'].includes(entry.specChangeStatus) ? entry.specChangeStatus : 'unknown' },
6300
+ entry.specChangeStatus === 'changed' ? t('revisions.sourceChanged')
6301
+ : entry.specChangeStatus === 'unchanged' ? t('revisions.sourceUnchanged') : t('revisions.sourceUnknown')),
5786
6302
  el('div', { className: 'db-muted db-mono' }, `previews ${(entry.previews || []).length} · validation ${entry.validation ? (entry.validation.ok ? 'ok' : `${entry.validation.errorCount} errors`) : '—'}`),
5787
6303
  ))),
5788
6304
  Notice(state.notices.revisions, { marginTop: '8px' }),
@@ -5812,61 +6328,134 @@ window.__ModuleLoader__.load({
5812
6328
  * @param {object} state - the store's snapshot
5813
6329
  * @param {object} actions - the store's action table
5814
6330
  */
5815
- function buildWorkbenchView(state, actions) {
5816
- const ctx = { state, actions }
5817
- const stale = state.status === 'stale'
5818
- const body = stale
5819
- ? el('div', { className: 'db-body' }, ErrorBox({ error: state.error }))
5820
- : state.status === 'loading'
5821
- ? el('div', { className: 'db-body db-muted' }, t('host.reading'))
5822
- : el('div', { className: 'db-body', 'data-scroll-key': JSON.stringify([state.activeProjectId, state.view]) },
5823
- state.view === 'preview' || !state.activeProjectId ? renderView(ctx) : CreationGuide(ctx),
5824
- state.view === 'preview' || !state.activeProjectId ? CreationGuide(ctx) : renderView(ctx))
6331
+ function lighttableResult(state) {
6332
+ const selection = state.lighttableSelection
6333
+ const selected = state.view === 'preview' && selection?.projectId === state.activeProjectId
6334
+ && selection.projectsRoot === state.projectsRoot && selection.storeIdentity === state.storeIdentity
6335
+ && selection.anchorRevision === state.currentRevision ? selection.revision : state.view === 'revisions' ? snapshotEntry(state)?.revision || state.currentRevision : state.currentRevision
6336
+ const entry = state.previews?.revisions?.find(item => item.revision === selected) || null
6337
+ return { revision: selected, entry, artifact: sheetOf(entry), historical: Boolean(selected && selected !== state.currentRevision) }
6338
+ }
6339
+
6340
+ function LighttableStage({ state, actions }, { compact = false } = {}) {
6341
+ const result = lighttableResult(state), artifact = result.artifact
6342
+ const dimensions = Number.isSafeInteger(artifact?.width) && artifact.width > 0
6343
+ && Number.isSafeInteger(artifact?.height) && artifact.height > 0 ? { width: artifact.width, height: artifact.height } : {}
6344
+ const recent = [...(state.previews?.revisions || [])].reverse().slice(0, 6)
6345
+ return el('section', { className: `db-lighttable-stage${compact ? ' db-lighttable-stage--compact' : ''}`, 'aria-label': t('tab.preview'), 'data-lighttable-revision': result.revision || '' },
6346
+ el('div', { className: 'db-result-heading' },
6347
+ el('div', null, el('h2', null, state.selected?.project?.title || t('lighttable.result')),
6348
+ el('span', { className: 'db-result-source' }, t('lighttable.saved', { revision: result.revision || '—' }))),
6349
+ result.historical ? Button({ action: 'lighttable-current', onClick: actions.returnToCurrentResult, children: t('lighttable.backCurrent') }) : null),
6350
+ compact ? null : el('div', { className: 'db-result-mat', 'data-compare': 'current', 'data-compare-kind': artifact ? 'image' : 'empty' },
6351
+ artifact ? el('img', {
6352
+ className: 'db-result-image', key: artifact.path,
6353
+ 'data-artifact': artifact.path, 'data-artifact-digest': artifact.sha256 || '',
6354
+ 'data-artifact-source-digest': artifact.sourceDigest || '', 'data-artifact-slot': artifact.slot || '',
6355
+ 'data-artifact-revision': artifact.sourceRevision || '', 'data-artifact-at': artifact.at || '',
6356
+ ...dimensions,
6357
+ style: {
6358
+ width: dimensions.width ? `min(${dimensions.width}px, 100%, calc(min(calc(100vh - 300px), var(--db-result-image-height)) * ${dimensions.width / dimensions.height}))` : 'auto',
6359
+ aspectRatio: dimensions.width ? `${dimensions.width} / ${dimensions.height}` : undefined,
6360
+ height: 'auto', maxWidth: '100%', maxHeight: 'min(calc(100vh - 300px), var(--db-result-image-height))',
6361
+ },
6362
+ alt: `${state.selected?.project?.title || t('lighttable.result')} · ${artifact.sourceRevision || t('lighttable.sourceUnknown')}`,
6363
+ src: artifactUrl(state.artifactBase, artifact),
6364
+ }) : el('div', { className: 'db-result-empty' }, el('h3', null, state.previewReadStatus === 'error' ? t('preview.readFailed') : state.previewReadStatus === 'loading' ? t('preview.reading') : t('lighttable.noImage')),
6365
+ state.previewReadStatus === 'loading' ? null : el('p', null, t('lighttable.noImageHint')))),
6366
+ compact ? null : el('div', { className: 'db-result-caption' },
6367
+ el('span', { className: 'db-muted' }, artifact?.sourceRevision ? t('lighttable.imageSource', { revision: artifact.sourceRevision }) : t('lighttable.sourceUnknown')),
6368
+ ImageDownload({ state, actions, artifact })),
6369
+ artifact && !compact ? Disclosure({ state, actions }, `image-details:${result.revision}`, t('lighttable.details'), { className: 'db-image-details' }, PreviewSettings(artifact),
6370
+ el('code', null, artifact.sha256 || '—')) : null,
6371
+ compact ? null : el('div', { className: 'db-filmstrip-heading' }, el('h3', null, t('lighttable.recent')),
6372
+ Button({ action: 'lighttable-versions', onClick: () => actions.setView('revisions'), children: t('lighttable.allVersions') })),
6373
+ compact ? null : el('div', { className: 'db-filmstrip', 'aria-label': t('lighttable.recent') }, recent.map(entry => {
6374
+ const image = sheetOf(entry)
6375
+ return el('button', { type: 'button', key: entry.revision, className: 'db-film-frame',
6376
+ 'data-action': `lighttable-result:${entry.revision}`, 'data-lighttable-thumb': entry.revision,
6377
+ 'aria-pressed': String(result.revision === entry.revision), onClick: () => actions.selectLighttableResult(entry.revision) },
6378
+ image ? el('img', { src: artifactUrl(state.artifactBase, image), alt: '', loading: 'lazy' }) : el('span', { className: 'db-film-empty' }, t('lighttable.noImage')),
6379
+ el('span', { className: 'db-film-caption' }, entry.revision, entry.revision === state.currentRevision ? el('span', null, t('revisions.current')) : null))
6380
+ })))
6381
+ }
6382
+
6383
+ function LighttableWorkspace(ctx) {
6384
+ const { state, actions } = ctx, result = lighttableResult(state)
6385
+ const comparison = state.view === 'preview' && state.compareMode !== 'result'
6386
+ const title = state.view === 'projects' ? t('lighttable.brief') : state.view === 'scene' ? t('lighttable.tools') : state.view === 'jobs' ? t('lighttable.deliveryTitle')
6387
+ : state.view === 'revisions' ? t('tab.revisions') : state.view === 'qa' ? 'QA' : result.historical && !comparison ? t('lighttable.historyTitle') : t('lighttable.previewTools')
6388
+ const hint = state.view === 'projects' ? t('lighttable.briefHint') : state.view === 'scene' ? t('lighttable.toolsHint') : state.view === 'jobs' ? t('lighttable.deliveryHint')
6389
+ : state.view === 'preview' && !result.historical ? t('lighttable.previewHint') : null
6390
+ let tools
6391
+ if (state.view === 'preview' && result.historical && !comparison) {
6392
+ const target = revisionComparisonTarget(state, result.revision)
6393
+ const snapshot = snapshotEntry(state), snapshotBusy = !snapshot || snapshot.result?.state === 'preparing' || Object.values(snapshot.busy || {}).some(Boolean)
6394
+ tools = el('div', { className: 'db-history-context' },
6395
+ el('p', { role: 'status' }, t('lighttable.history', { revision: result.revision, current: state.currentRevision })),
6396
+ target ? Button({ action: 'lighttable-compare-current', tone: 'primary', onClick: () => actions.compareFrom(result.revision), children: t('lighttable.compareCurrent') }) : null,
6397
+ Button({ action: 'lighttable-history-export', disabled: snapshotBusy, onClick: () => { actions.setSnapshotRevision(result.revision); actions.setView('revisions') }, children: t('lighttable.historyExport') }))
6398
+ } else tools = state.view === 'projects'
6399
+ ? [state.notices.projects?.projectId === state.activeProjectId ? Notice(state.notices.projects) : null, BriefEditor(ctx)]
6400
+ : state.view === 'preview' ? PreviewView({ ...ctx, lighttable: true }) : renderView(ctx)
6401
+ return el('div', { className: `db-lighttable${comparison ? ' db-lighttable--comparison' : ''}`, ...(state.view === 'preview' ? { 'data-view': 'preview' } : { 'data-view': state.view }) },
6402
+ LighttableStage(ctx, { compact: comparison }),
6403
+ el('section', { className: 'db-context-pane', 'data-scroll-key': JSON.stringify([state.activeProjectId, 'tools', state.view]), 'aria-label': title },
6404
+ el('div', { className: 'db-context-heading' }, el('h2', null, title), hint ? el('p', null, hint) : null),
6405
+ state.view === 'jobs' ? Button({ action: 'lighttable-editable', onClick: () => actions.setView('revisions'), children: t('lighttable.editable') }) : null,
6406
+ tools,
6407
+ CreationGuide(ctx)))
6408
+ }
5825
6409
 
6410
+ function buildWorkbenchView(state, actions) {
6411
+ const ctx = { state, actions }, stale = state.status === 'stale'
6412
+ const creationSetup = state.view === 'projects' && state.projectTask === 'new'
6413
+ && state.disclosures?.[disclosureKey(state, 'new:recipe-gallery')] === false
6414
+ const bodyKey = JSON.stringify([state.activeProjectId, state.view, creationSetup])
6415
+ const active = Boolean(state.activeProjectId)
6416
+ const pendingSelection = !active && Boolean(state.projectId) && state.view === 'preview' && state.previewReadStatus === 'loading'
6417
+ const primary = VIEWS.filter(entry => Number.isInteger(entry.stage)).sort((a, b) => a.stage - b.stage)
6418
+ const secondary = VIEWS.filter(entry => !Number.isInteger(entry.stage)).sort((a, b) => a.secondaryOrder - b.secondaryOrder)
6419
+ const nav = (id, label) => el('button', { key: id, type: 'button',
6420
+ 'data-view-tab': id, 'data-active': String(state.view === id),
6421
+ 'aria-current': state.view === id ? 'page' : undefined, 'data-field': `nav-${id}`,
6422
+ disabled: id !== 'projects' && !active, onClick: () => actions.setView(id),
6423
+ }, label)
6424
+ const body = stale ? el('div', { className: 'db-body' }, ErrorBox({ error: state.error }))
6425
+ : state.status === 'loading' || pendingSelection ? el('div', { className: 'db-body db-loading', 'aria-busy': 'true', 'data-preview-state': pendingSelection ? 'loading' : undefined },
6426
+ pendingSelection ? el('h2', null, state.projects.find(project => project.projectId === state.projectId)?.title || state.projectId) : null,
6427
+ el('p', null, t('lighttable.loading')), el('div', { className: 'db-loading-stage' }), el('div', { className: 'db-loading-line' }))
6428
+ : el('div', { className: 'db-body', key: bodyKey, 'data-scroll-key': bodyKey },
6429
+ active && (state.view !== 'projects' || state.projectTask !== 'new') ? LighttableWorkspace(ctx) : [
6430
+ state.view === 'preview' && state.notices.preview?.kind === 'creation' ? Notice(state.notices.preview) : null,
6431
+ ProjectsView({ ...ctx, newWork: true }), CreationGuide(ctx)])
5826
6432
  return el('div', { className: 'db-root', 'data-theme': state.appearance || 'system', 'data-deepblend-panel': PANEL_ID },
5827
- el('div', { className: 'db-head' },
5828
- el('div', { className: 'db-brand' },
5829
- el('img', { className: 'db-logo', src: BRAND_MARK, alt: '', width: 34, height: 34 }),
5830
- el('div', null, el('h1', { className: 'db-title' }, 'DeepBlend Studio'), el('small', null, t('workbench.title', { panel: PANEL_LABEL })))),
5831
- state.selected ? el('div', { className: 'db-project-context' },
5832
- el('span', { className: 'db-project-name', title: state.selected.project.title }, state.selected.project.title),
5833
- Badge({ children: state.selected.currentRevision || '—' })) : null,
6433
+ el('header', { className: 'db-head' },
6434
+ el('div', { className: 'db-brand' }, el('img', { className: 'db-logo', src: BRAND_MARK, alt: '', width: 28, height: 28 }),
6435
+ el('h1', { className: 'db-title' }, 'DeepBlend Studio')),
6436
+ state.projects.length ? el('label', { className: 'db-project-switch' }, el('span', { className: 'db-sr-only' }, t('lighttable.project')),
6437
+ el('select', { className: 'db-input', 'data-field': 'lighttable-project', 'aria-label': t('tab.projects'), value: state.activeProjectId || (pendingSelection ? state.projectId : ''),
6438
+ onChange: event => { actions.selectProject(event.target.value); actions.setView('preview') } },
6439
+ !state.activeProjectId ? el('option', { value: '' }, t('lighttable.project')) : null,
6440
+ state.projects.map(project => el('option', { value: project.projectId, disabled: project.creationPending, key: project.projectId }, project.title || project.projectId)))) : null,
5834
6441
  projectHasUnsavedDrafts(state) ? Badge({ tone: 'warn', name: 'unsaved', children: t('workbench.unsaved') }) : null,
5835
- state.unfinishedJobs.length > 0
5836
- ? Badge({ tone: 'live', name: 'unfinished', children: t('jobs.unfinished', { count: state.unfinishedJobs.length }) })
5837
- : null,
5838
- typeof state.hostApiVersion === 'number' && state.hostApiVersion < EXPECTED_HOST_API
5839
- ? Badge({ tone: 'warn', name: 'api', children: `hostApiVersion ${state.hostApiVersion} < ${EXPECTED_HOST_API}` })
5840
- : null,
6442
+ state.unfinishedJobs.length ? Badge({ tone: 'live', name: 'unfinished', children: t('jobs.unfinished', { count: state.unfinishedJobs.length }) }) : null,
5841
6443
  el('div', { className: 'db-head-actions' },
5842
- el('select', { className: 'db-input db-theme', 'data-field': 'workbench-appearance', 'aria-label': t('workbench.appearance'), value: state.appearance || 'system',
5843
- onChange: event => actions.setAppearance(event.target.value) },
5844
- [['system', t('workbench.system')], ['light', t('workbench.light')], ['dark', t('workbench.dark')]].map(([theme, label]) => el('option', { value: theme }, label))),
5845
- // AN ANCHOR, NOT A BUTTON. The export is a download, and a download is what an anchor with
5846
- // `download` does: the browser fetches the route and writes the file itself, in both faces
5847
- // (React passes `href`/`download` through, the DOM binding sets them as attributes). A button
5848
- // would need imperative blob plumbing in a renderer that has no place to put it.
5849
- el('a', {
5850
- className: 'db-btn',
5851
- href: ROUTES.diagnostics,
5852
- download: 'deepblend-diagnostics.json',
5853
- 'data-action': 'export-diagnostics',
5854
- title: t('diagnostics.exportHint'),
5855
- }, t('diagnostics.export')),
5856
- Button({ action: 'reload', onClick: actions.reload, children: t('common.refresh') })),
5857
- ),
5858
- el('nav', { className: 'db-nav', 'aria-label': t('workbench.navigation') }, VIEWS.map(entry => el('button', {
5859
- key: entry.id,
5860
- type: 'button',
5861
- 'data-view-tab': entry.id,
5862
- 'data-active': String(state.view === entry.id),
5863
- 'aria-current': state.view === entry.id ? 'page' : undefined,
5864
- 'data-field': `nav-${entry.id}`,
5865
- onClick: () => actions.setView(entry.id),
5866
- }, entry.label))),
5867
- state.error !== null && state.error !== undefined && !stale ? el('div', { style: { padding: '8px 14px 0' } }, ErrorBox({ error: state.error })) : null,
5868
- body,
5869
- )
6444
+ Button({ action: 'new-work', onClick: actions.beginNewWork, children: t('lighttable.new') }),
6445
+ Button({ action: 'reload', onClick: actions.reload, children: t('common.refresh') }),
6446
+ Disclosure(ctx, 'global:settings', t('lighttable.settings'), { className: 'db-utility-menu' },
6447
+ el('div', { className: 'db-utility-content' },
6448
+ el('label', { className: 'db-field' }, t('workbench.appearance'),
6449
+ el('select', { className: 'db-input db-theme', 'data-field': 'workbench-appearance', value: state.appearance || 'system', onChange: event => actions.setAppearance(event.target.value) },
6450
+ [['system', t('workbench.system')], ['light', t('workbench.light')], ['dark', t('workbench.dark')]].map(([theme, label]) => el('option', { value: theme }, label)))),
6451
+ el('a', { className: 'db-btn', href: ROUTES.diagnostics, download: 'deepblend-diagnostics.json', 'data-action': 'export-diagnostics', title: t('diagnostics.exportHint') }, t('diagnostics.export')))))),
6452
+ el('nav', { className: 'db-nav', 'aria-label': t('workbench.navigation') },
6453
+ el('div', { className: 'db-journey' }, primary.map(entry => nav(entry.id, entry.id === 'projects' && active && (state.view !== 'projects' || state.projectTask !== 'new') ? t('lighttable.brief') : entry.label))),
6454
+ el('div', { className: 'db-secondary-nav' }, secondary.map(entry => nav(entry.id, entry.label)))),
6455
+ typeof state.hostApiVersion === 'number' && state.hostApiVersion < EXPECTED_HOST_API
6456
+ ? el('p', { className: 'db-host-warning' }, t('projects.hostNeedsRestart')) : null,
6457
+ state.error && !stale ? ErrorBox({ error: state.error }) : null,
6458
+ body)
5870
6459
  }
5871
6460
 
5872
6461
  // =========================================================================