@floless/app 0.170.0 → 0.171.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.
Files changed (53) hide show
  1. package/dist/floless-server.cjs +33000 -22928
  2. package/dist/schemas/steel.model.v2.schema.json +194 -3
  3. package/dist/skills/floless-app-bridge/SKILL.md +3 -3
  4. package/dist/skills/floless-app-knowledge/SKILL.md +4 -3
  5. package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
  6. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
  7. package/dist/skills/floless-app-queue/SKILL.md +2 -3
  8. package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
  9. package/dist/skills/floless-app-steel-model/SKILL.md +35 -35
  10. package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
  11. package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
  12. package/dist/skills/floless-app-ui/SKILL.md +71 -126
  13. package/dist/web/add-ons.js +407 -0
  14. package/dist/web/analytics.js +1 -1
  15. package/dist/web/app.css +108 -189
  16. package/dist/web/app.js +11 -12
  17. package/dist/web/aware.js +49 -29
  18. package/dist/web/chat.css +6 -1
  19. package/dist/web/chat.js +133 -18
  20. package/dist/web/commands-filter.js +23 -0
  21. package/dist/web/commands-shell.js +39 -67
  22. package/dist/web/commands-steel.js +9 -1
  23. package/dist/web/commands-tekla-parser.js +23 -0
  24. package/dist/web/connections.js +14 -3
  25. package/dist/web/failure-copy.js +1 -0
  26. package/dist/web/guide.js +3 -3
  27. package/dist/web/index.html +29 -56
  28. package/dist/web/instructor.js +2 -2
  29. package/dist/web/kb-categories.js +64 -7
  30. package/dist/web/model-change-findings.js +430 -0
  31. package/dist/web/model-change-review.js +414 -0
  32. package/dist/web/model-editor-steel-adapter.js +2 -2
  33. package/dist/web/project-history.js +7 -1
  34. package/dist/web/revit-editor.css +85 -0
  35. package/dist/web/revit-editor.js +36 -1
  36. package/dist/web/sha256-sync.js +62 -0
  37. package/dist/web/steel-3d-core.js +7 -0
  38. package/dist/web/steel-3d-flo.js +127 -3
  39. package/dist/web/steel-3d-view.js +25 -2
  40. package/dist/web/steel-custom-connection.js +161 -0
  41. package/dist/web/steel-custom-sections.js +1796 -0
  42. package/dist/web/steel-editor.html +279 -41
  43. package/dist/web/steel-filter-usage.js +299 -0
  44. package/dist/web/steel-filter.html +101 -4
  45. package/dist/web/steel-model-v2-client-validation.js +3 -0
  46. package/dist/web/steel-model-v2-commands.js +95 -6
  47. package/dist/web/steel-model-v2-projection.js +1 -1
  48. package/dist/web/steel-read-confidence.js +1 -56
  49. package/dist/web/tekla-editor.html +1 -0
  50. package/dist/web/workspaces.js +263 -28
  51. package/launch.mjs +87 -9
  52. package/package.json +1 -1
  53. package/dist/web/panels.js +0 -831
@@ -2,11 +2,11 @@
2
2
  * workspaces.js — the Workspaces | Workflows mode shell (slice 1).
3
3
  * Owns: mode state, the landing project grid, the open-project view (Drawings |
4
4
  * Model iframes), the project picker + lifecycle menu, and per-project Approve.
5
- * Composes with app.js/panels.js by CLASS-GATING (CSS hides Workflows chrome under
5
+ * Composes with app.js by CLASS-GATING (CSS hides Workflows chrome under
6
6
  * .app.mode-workspaces) — it never removes their DOM or unwires their handlers.
7
7
  * Reuses app.js globals (escapeHtml, escapeAttr, showToast) and the flolessBridge
8
- * seams (api, formModal, loadRequests) like panels.js does.
9
- * SECURITY CONTRACT (same as panels.js): every innerHTML interpolation passes
8
+ * seams (api, formModal, loadRequests).
9
+ * SECURITY CONTRACT: every innerHTML interpolation passes
10
10
  * escapeHtml/escapeAttr — project names are user-authored; no unescaped string may
11
11
  * ever reach the DOM. textContent wherever no markup is needed.
12
12
  * See docs/superpowers/specs/2026-07-03-workspaces-two-mode-shell-design.md.
@@ -554,7 +554,8 @@
554
554
  }
555
555
  }
556
556
  await visit(root, '', 1);
557
- return { label: root.name, kind: 'folder', entries: validateTeklaPickedEntries(entries) };
557
+ // `root` lets change review list the folder again after the copy, so a file that appeared is seen too (#3352).
558
+ return { label: root.name, kind: 'folder', entries: validateTeklaPickedEntries(entries), root };
558
559
  }
559
560
 
560
561
  async function pickTeklaFolder(fallbackInput) {
@@ -732,7 +733,7 @@
732
733
  if (!$switch || !$landing || !$app) return; // markup absent — nothing to wire
733
734
 
734
735
  // The picker menu is a `.menu` (display:none by default; `.menu.show` → display:block, which
735
- // OVERRIDES the `hidden` attribute). So close must clear BOTH — same idiom as the ext-menu.
736
+ // OVERRIDES the `hidden` attribute). So close must clear BOTH.
736
737
  // Hand focus back to the kebab BEFORE hiding, when the menu is what currently holds it. Clicking a
737
738
  // menu item focuses that item (browsers focus a <button> on click), and the very next thing several
738
739
  // items do is open a formModal, which on close returns focus to whatever was focused when it opened
@@ -5308,7 +5309,9 @@
5308
5309
  teklaUploadProjectId = project.id;
5309
5310
  const isCurrentProject = () => current?.id === project.id;
5310
5311
  const declaredFiles = source.kind === 'folder'
5311
- ? source.entries.map((entry) => ({ path: entry.path, bytes: entry.file.size })) : undefined;
5312
+ ? source.entries.map((entry) => ({ path: entry.path, bytes: entry.file.size,
5313
+ ...(Number.isSafeInteger(entry.file.lastModified) && entry.file.lastModified >= 0 ? { lastModified: entry.file.lastModified } : {}) }))
5314
+ : undefined;
5312
5315
  let sessionId = null;
5313
5316
  let finishAttempted = false;
5314
5317
  try {
@@ -5379,8 +5382,17 @@
5379
5382
  // A completed admission owns session cleanup. Retrying DELETE after its refusal only produces
5380
5383
  // a spurious browser error for a session it already removed; earlier upload failures still delete.
5381
5384
  finishAttempted = true;
5385
+ // #3352: look at every file again now the copy is done, so change review can tell whether Tekla saved during
5386
+ // it. Only a folder opened through the folder picker keeps handles to look again; otherwise say nothing.
5387
+ // Kept inside this function: test harnesses lift it whole, so a separate helper would be undefined there.
5388
+ // The whole folder is listed again (not only the files picked), so a file that appeared during the copy is seen.
5389
+ const recheck = source.kind === 'folder' && source.root
5390
+ ? await filesFromDirectoryHandle(source.root)
5391
+ .then((again) => again.entries.map((entry) => ({ path: entry.path, bytes: entry.file.size, lastModified: entry.file.lastModified })))
5392
+ .catch(() => null) // the folder could not be listed again: the capture record says it was not rechecked
5393
+ : null;
5382
5394
  const finalize = (catalogues) => api(`/api/tekla-source-sessions/${encodeURIComponent(sessionId)}/finalize`, {
5383
- method: 'POST', body: JSON.stringify({ projectId: project.id, ...(catalogues ? { catalogues } : {}) }),
5395
+ method: 'POST', body: JSON.stringify({ projectId: project.id, ...(catalogues ? { catalogues } : {}), ...(recheck ? { recheck } : {}) }),
5384
5396
  });
5385
5397
  let started = await finalize();
5386
5398
  let status = '';
@@ -9689,7 +9701,8 @@
9689
9701
  `${chev}<span class="kb-cat-name">${name}</span><span class="kb-cat-count" aria-label="${item.count} reference${item.count === 1 ? '' : 's'}">(${item.count})</span></button>` +
9690
9702
  (isU ? '' : `<button type="button" class="kb-cat-more" data-kb-cat-menu="${escapeAttr(item.id)}" aria-label="More for ${escapeAttr(item.name)}" aria-haspopup="menu" data-tip="Rename, move or delete" data-command-id="shell.kb-category-menu#${escapeAttr(item.id)}" data-command-instance-label="${escapeAttr(item.name)}">⋯</button>`) +
9691
9703
  '</div>' +
9692
- (item.open && item.empty ? `<div class="kb-cat-empty" style="--kb-depth:${item.depth + 1}">${isU ? 'Nothing here.' : 'Empty. Drag references here.'}</div>` : '');
9704
+ // #3413: the hint under an empty category is part of its drop target: a reference dropped on it lands in the category.
9705
+ (item.open && item.empty ? `<div class="kb-cat-empty" style="--kb-depth:${item.depth + 1}" data-kb-drop-into="${escapeAttr(id)}">${isU ? 'Nothing here.' : 'Empty. Drag references here.'}</div>` : '');
9693
9706
  }
9694
9707
 
9695
9708
  /** The References list as a tree (once the first category exists), with the inline name box where it was asked for. */
@@ -9697,17 +9710,35 @@
9697
9710
  const file = kbCats(st);
9698
9711
  const folded = kbCatCollapsedFor(current);
9699
9712
  const open = new Set(['uncategorized', ...file.categories.map((c) => c.id)].filter((id) => !folded.has(id)));
9700
- const items = kbcTreeItems(file, rows, open);
9713
+ // #3413: a design-set drawing placed in a category counts there (the map colours it by that category), and the open
9714
+ // category says so in one quiet line; the drawing itself stays listed under its issue in the Design set.
9715
+ const drawings = st.sources.filter((s) => kbInDesignSet(s, st) && kbcPlacement(file, s.sourceId));
9716
+ const isDrawing = new Set(drawings.map((s) => s.sourceId));
9717
+ const items = kbcTreeItems(file, [...rows, ...drawings], open);
9701
9718
  let html = '';
9719
+ let held = [];
9720
+ const flush = () => { if (held.length) html += kbCatDrawingsHtml(held.map((x) => x.row), held[0].depth); held = []; };
9702
9721
  for (const item of items) {
9722
+ if (item.kind === 'row' && isDrawing.has(item.row.sourceId)) { held.push(item); continue; }
9723
+ flush();
9703
9724
  if (item.kind === 'row') { html += kbSourceRow(item.row, st, item.depth); continue; }
9704
9725
  html += kbCatRowHtml(item, file);
9705
9726
  if (kbCatEdit && kbCatEdit.mode === 'new' && kbCatEdit.parentId && kbCatEdit.parentId === item.id && item.open) html += kbCatEditHtml(item.depth + 1);
9706
9727
  }
9728
+ flush();
9707
9729
  if (kbCatEdit && kbCatEdit.mode === 'new' && !kbCatEdit.parentId) html = kbCatEditHtml(0) + html;
9708
9730
  return `<div class="kb-tree" role="group" aria-label="References by category">${html}</div>`;
9709
9731
  }
9710
9732
 
9733
+ /** Design-set drawings placed in a category: counted there, named once, never a second draggable row. */
9734
+ function kbCatDrawingsHtml(rows, depth) {
9735
+ const names = rows.map((r) => r.filename || 'drawing');
9736
+ const shown = names.slice(0, 2).join(', ') + (names.length > 2 ? ` and ${names.length - 2} more` : '');
9737
+ const one = rows.length === 1;
9738
+ return `<div class="kb-cat-ds" style="--kb-depth:${depth}">${one ? '1 design-set drawing' : `${rows.length} design-set drawings`}: ` +
9739
+ `<span class="kb-cat-ds-names">${escapeHtml(shown)}</span>. Listed under ${one ? 'its issue' : 'their issues'} in the Design set.</div>`;
9740
+ }
9741
+
9711
9742
  /** The bar under the list while references are selected. */
9712
9743
  function kbSelBarHtml(st) {
9713
9744
  const n = kbSelFor(current, st).selected.size;
@@ -10186,7 +10217,11 @@
10186
10217
  return chip;
10187
10218
  }
10188
10219
  function kbDropTargetOf(e) {
10189
- const el = e.target.closest && e.target.closest('[data-kb-drop-cat]');
10220
+ // #3413: the "Empty" hint under a category stands for its header, which shows the landing highlight and label.
10221
+ const hint = e.target.closest && e.target.closest('.kb-cat-empty[data-kb-drop-into]');
10222
+ const el = hint
10223
+ ? hint.parentElement && [...hint.parentElement.querySelectorAll('[data-kb-drop-cat]')].find((h) => h.dataset.kbDropCat === hint.dataset.kbDropInto)
10224
+ : e.target.closest && e.target.closest('[data-kb-drop-cat]');
10190
10225
  return el && el.closest('.kb-refs-body') ? el : null;
10191
10226
  }
10192
10227
  /** Open a folded category during a drag without repainting the column (the dragged row must survive). */
@@ -10599,7 +10634,7 @@
10599
10634
  // Organized again while the map was coming in: start over on the new generation (a few times at most).
10600
10635
  if (++restarts > 3) throw new Error('the map kept changing');
10601
10636
  generation = g.generationId; cursor = 0;
10602
- kbGm.model = kbgCreate(generation); kbGm.pos = new Map(); kbGm.layoutKey = null;
10637
+ kbGm.model = kbgCreate(generation); kbGm.pos = new Map(); kbGm.layoutKey = null; kbGm.labels = null; kbGm.labelKey = null;
10603
10638
  continue;
10604
10639
  }
10605
10640
  if (!Array.isArray(g.nodes)) throw new Error('bad graph envelope');
@@ -10646,13 +10681,47 @@
10646
10681
  }
10647
10682
 
10648
10683
  const KB_TYPE_LABEL = { source: 'Source', concept: 'Concept', person: 'Person' };
10684
+ const kbgNodeLabel = (n) => (n.kind === 'document' ? (n.filename || 'document') : (n.title || n.slug));
10685
+ /** #3413: where each drawn label goes (kbgLabelPlan), worked out once per layout, not on every repaint. */
10686
+ function kbGraphLabels(view, layoutKey) {
10687
+ const items = view.nodes.map((n) => ({ id: n.id, label: kbgNodeLabel(n), doc: n.kind === 'document', degree: (view.adj.get(n.id) || new Set()).size }));
10688
+ // The names are part of the key: a page renamed in a new generation with the same ids must not keep its old label.
10689
+ const key = `${layoutKey}|${items.map((it) => it.label).join('\n')}`;
10690
+ if (kbGm.labelKey === key && kbGm.labels) return kbGm.labels;
10691
+ kbGm.labels = kbgLabelPlan(items, kbGm.pos, { w: kbGm.w, h: kbGm.h }, kbGraphMeasure());
10692
+ kbGm.labelKey = key;
10693
+ return kbGm.labels;
10694
+ }
10695
+ /** The width of a map label in layout units, measured with the font the labels are drawn in (12px of the map's own
10696
+ * font), so the label plan never underestimates a wide name. No canvas (an old or headless page): the plan's estimate. */
10697
+ let kbGraphMeasurer = null;
10698
+ function kbGraphMeasure() {
10699
+ if (kbGraphMeasurer) return kbGraphMeasurer;
10700
+ const canvas = document.createElement('canvas');
10701
+ const ctx = canvas.getContext ? canvas.getContext('2d') : null;
10702
+ if (!ctx) return undefined;
10703
+ const host = $wsKnowledge || document.body;
10704
+ // Measured at 600, the weight a search match is drawn in (`.kb-g-node.match text`): the widest a label ever gets, so
10705
+ // one plan holds whether or not it is matched.
10706
+ ctx.font = `600 12px ${getComputedStyle(host).fontFamily || 'sans-serif'}`;
10707
+ const seen = new Map();
10708
+ kbGraphMeasurer = (t) => { let w = seen.get(t); if (w === undefined) { w = Math.ceil(ctx.measureText(t).width) + 1; seen.set(t, w); } return w; };
10709
+ return kbGraphMeasurer;
10710
+ }
10711
+ /** A label where the plan put it; a hidden one keeps its full name, shown only on point, focus, neighbour or match. */
10712
+ function kbGraphLabelSvg(spot, label) {
10713
+ if (spot.hidden) return `<text class="kb-g-quiet" x="13" y="4">${escapeHtml(label.length > 40 ? label.slice(0, 39) + '…' : label)}</text>`;
10714
+ const at = spot.side === 'l' ? 'x="-13" y="4" text-anchor="end"' : spot.side === 'b' ? 'x="0" y="24" text-anchor="middle"'
10715
+ : spot.side === 't' ? 'x="0" y="-16" text-anchor="middle"' : 'x="13" y="4"';
10716
+ return `<text ${at}>${escapeHtml(spot.text)}</text>`;
10717
+ }
10649
10718
  function kbGraphNodeHtml(n, view, file) {
10650
10719
  const p = kbGm.pos.get(n.id);
10651
10720
  if (!p) return '';
10652
10721
  const m = view.member.get(n.id) || { cats: [], grouped: false };
10653
10722
  const cats = m.cats.slice(0, 3);
10654
10723
  const col = kbgColour(file, cats[0] || null);
10655
- const label = n.kind === 'document' ? (n.filename || 'document') : (n.title || n.slug);
10724
+ const label = kbgNodeLabel(n);
10656
10725
  const where = !m.grouped ? 'Not yet grouped' : m.cats.map((c) => (c === 'uncategorized' ? 'Uncategorized' : kbcLabel(file, c))).join(', ');
10657
10726
  const more = m.cats.length > 3 ? ` (+${m.cats.length - 3})` : '';
10658
10727
  // A document removed since the map was loaded is shown as gone at once: the cached map keeps the old flag.
@@ -10660,7 +10729,9 @@
10660
10729
  const kind = n.kind === 'document' ? (gone ? 'document, no longer in Knowledge' : 'document') : (KB_TYPE_LABEL[n.type] || 'Concept').toLowerCase() + ' page';
10661
10730
  const tip = `${label} · ${kind} · ${where}${more}`;
10662
10731
  const match = view.matchSet.has(n.id) ? ' match' : '';
10663
- const cls = `kb-g-node ${n.kind === 'document' ? 'kb-g-doc' : 'kb-g-page kb-g-' + escapeAttr(n.type || 'concept')}${m.grouped ? '' : ' ungrouped'}${gone ? ' gone' : ''}${col.hatch ? ' hatch' : ''}${match}`;
10732
+ const spot = (kbGm.labels && kbGm.labels.get(n.id)) || { side: 'r', text: label.length > 40 ? label.slice(0, 39) + '…' : label };
10733
+ const quiet = spot.hidden ? ' nolabel' : '';
10734
+ const cls = `kb-g-node ${n.kind === 'document' ? 'kb-g-doc' : 'kb-g-page kb-g-' + escapeAttr(n.type || 'concept')}${m.grouped ? '' : ' ungrouped'}${gone ? ' gone' : ''}${col.hatch ? ' hatch' : ''}${match}${quiet}`;
10664
10735
  const act = n.kind === 'document' ? `data-kb-doc="${escapeAttr(n.sourceId)}"` : `data-kb-node="${escapeAttr(n.slug)}"`;
10665
10736
  const shape = n.kind === 'document'
10666
10737
  ? '<rect class="kb-g-dot" x="-7" y="-7" width="14" height="14" rx="3"/>'
@@ -10668,13 +10739,13 @@
10668
10739
  const rings = cats.slice(1).map((c, i) => `<circle class="kb-g-ring" r="${11 + i * 3}" style="--kbg-c:var(${kbgColour(file, c).token})"/>`).join('');
10669
10740
  return `<g class="${cls}" tabindex="0" role="button" ${act} data-command-id="shell.kb-graph-open#${escapeAttr(n.id)}" data-command-instance-label="${escapeAttr(label)}" data-kb-gid="${escapeAttr(n.id)}" aria-label="${escapeAttr(tip)}" data-tip="${escapeAttr(tip)}"` +
10670
10741
  ` style="--kbg-c:var(${col.token})" transform="translate(${p.x.toFixed(1)},${p.y.toFixed(1)})">` +
10671
- `<circle class="kb-g-hit" r="16"/>${rings}${shape}<text x="13" y="4">${escapeHtml(label.length > 40 ? label.slice(0, 39) + '…' : label)}</text></g>`;
10742
+ `<circle class="kb-g-hit" r="16"/>${rings}${shape}${kbGraphLabelSvg(spot, label)}</g>`;
10672
10743
  }
10673
10744
 
10674
10745
  function kbGraphControlsHtml(view, file) {
10675
10746
  const legend = kbgLegend(kbGm.model, file).map((c) =>
10676
10747
  `<button type="button" class="kb-gchip${c.hatch ? ' hatch' : ''}${c.dashed ? ' dashed' : ''}" aria-pressed="${kbGo.hiddenCats.has(c.id) ? 'false' : 'true'}" data-kb-gcat="${escapeAttr(c.id)}"` +
10677
- ` style="--kbg-c:var(${c.token})" data-command-id="shell.kb-graph-filter#${escapeAttr('cat-' + c.id)}" data-command-instance-label="${escapeAttr(c.name)}" data-tip="Show or hide ${escapeAttr(c.name)}"><span class="kb-gsw" aria-hidden="true"></span>${escapeHtml(c.name)} <span class="kb-gn">${c.n}</span></button>`).join('');
10748
+ ` style="--kbg-c:var(${c.token})" data-command-id="shell.kb-graph-filter#${escapeAttr('cat-' + c.id)}" data-command-instance-label="${escapeAttr(c.name)}" data-tip="${escapeAttr(kbgChipTip(c))}" aria-label="${escapeAttr(kbgChipTip(c))}"><span class="kb-gsw" aria-hidden="true"></span>${escapeHtml(c.name)} <span class="kb-gn">${c.n}</span></button>`).join('');
10678
10749
  const types = ['source', 'concept', 'person'].map((t) =>
10679
10750
  `<button type="button" class="kb-gchip kb-gtype" aria-pressed="${kbGo.hiddenTypes.has(t) ? 'false' : 'true'}" data-kb-gtype="${t}" data-command-id="shell.kb-graph-filter#${escapeAttr('type-' + t)}" data-command-instance-label="${escapeAttr(KB_TYPE_LABEL[t] + ' pages')}">${KB_TYPE_LABEL[t]} pages</button>`).join('');
10680
10751
  const hidden = kbGo.hiddenCats.size || kbGo.hiddenTypes.size;
@@ -10745,11 +10816,15 @@
10745
10816
  const W = Math.round(kbGm.w), H = Math.round(kbGm.h);
10746
10817
  const lines = view.edges.map(([a, b]) => { const p = kbGm.pos.get(a), q = kbGm.pos.get(b);
10747
10818
  return p && q ? `<line class="kb-g-edge" data-a="${escapeAttr(a)}" data-b="${escapeAttr(b)}" x1="${p.x.toFixed(1)}" y1="${p.y.toFixed(1)}" x2="${q.x.toFixed(1)}" y2="${q.y.toFixed(1)}"/>` : ''; }).join('');
10819
+ const labels = kbGraphLabels(view, `${kbGm.layoutKey}|${layoutKey}`);
10748
10820
  const dots = view.nodes.map((n) => kbGraphNodeHtml(n, view, file)).join('');
10821
+ const drawn = view.nodes.filter((n) => kbGm.pos.get(n.id));
10822
+ const quiet = drawn.filter((n) => labels.get(n.id)?.hidden).length;
10823
+ const labelNote = quiet ? `<div class="kb-g-labelnote" role="note">Showing ${drawn.length - quiet} of ${drawn.length} labels. Point at a dot or search to see the rest.</div>` : '';
10749
10824
  const defs = '<defs><pattern id="kbg-hatch" width="4" height="4" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><line x1="0" y1="0" x2="0" y2="4" class="kb-g-hatchline"/></pattern></defs>';
10750
10825
  const body = kbGo.list ? kbGraphListHtml(view, file)
10751
10826
  : `<div class="kb-graph-body"><svg viewBox="0 0 ${W} ${H}" data-vb-base="0 0 ${W} ${H}" class="kb-graph-svg" role="group" aria-label="Knowledge map, ${view.nodes.length} items">${defs}${lines}${dots}</svg>` +
10752
- '<button type="button" class="kb-g-fit" data-kb-fit hidden data-tip="Zoom to fit (Home)" aria-label="Zoom to fit" data-command-id="shell.kb-graph-fit">⤢ Fit</button></div>';
10827
+ '<button type="button" class="kb-g-fit" data-kb-fit hidden data-tip="Zoom to fit (Home)" aria-label="Zoom to fit" data-command-id="shell.kb-graph-fit">⤢ Fit</button>' + labelNote + '</div>';
10753
10828
  h.innerHTML = '<section class="kb-col kb-graph">' + kbGraphControlsHtml(view, file) + kbGraphNotesHtml(view, file) + body + '</section>';
10754
10829
  kbGm.view = view;
10755
10830
  const back = (kbGFocus || focusId) && h.querySelector(`[data-kb-gid="${CSS.escape(kbGFocus || focusId)}"]`);
@@ -11183,6 +11258,14 @@
11183
11258
  const notice = truncated
11184
11259
  ? `<div class="kb-view-note">Showing the first ${escapeHtml(kbBytes(KB_TEXT_CAP))} of ${escapeHtml(kbBytes(row.bytes))}.</div>`
11185
11260
  : '';
11261
+ // #3412: a connected source's copy is markdown FloLess wrote, so it reads as text, not as its source: the escaping
11262
+ // renderer the Knowledge pages use, with FloLess's own markers (record ids, the evidence fence) left out.
11263
+ const md = row.kind === 'connected' && window.flolessChat?.markdownHtml;
11264
+ if (md) {
11265
+ kbPaintView(row, `<div class="kb-page-body kb-conn-view" tabindex="0" role="region" aria-label="Text synced into “${escapeAttr(row.filename || 'untitled')}”">` +
11266
+ `<div class="kb-page-body-measure kb-page-md">${kbConnPreviewHtml(text, md)}</div></div>${notice}`);
11267
+ return;
11268
+ }
11186
11269
  kbPaintView(row, `<pre class="kb-view-pre"></pre>${notice}`);
11187
11270
  const pre = kbViewHost() && kbViewHost().querySelector('.kb-view-pre');
11188
11271
  if (pre) pre.textContent = text; // THE escaping guarantee — `<img src=x onerror=…>` stays literal
@@ -11210,6 +11293,31 @@
11210
11293
  // #2470 R6.8 slice 2: a Trimble Connect project is the third kind: its topics (coordination issues), their comments and
11211
11294
  // its ToDos. It has no window; its row says how the copy is kept up to date, from the last sync.
11212
11295
  const kbConnIsTrimble = (c) => !!(c && c.scope === 'trimble-project');
11296
+
11297
+ /**
11298
+ * #3412: a connected source's markdown as a person reads it. FloLess writes it (server knowledge-connected-*-render),
11299
+ * so its structure is known: headings, block quotes holding what people wrote with every markdown character
11300
+ * backslash-escaped, and HTML comments that are FloLess's own markers (`<!-- upstream-id … -->`, the untrusted-evidence
11301
+ * fence). Comment-only lines are left out; each escaped character is held aside while `markdownHtml` (the chat's
11302
+ * escaping renderer) runs and put back as plain text after, so a `\*` shows as `*` and can never become emphasis, a
11303
+ * tag or a link. The text is never inserted as HTML by any other route.
11304
+ */
11305
+ function kbConnPreviewHtml(text, markdownHtml) {
11306
+ const BASE = 0xE100;
11307
+ const ESCAPABLE = '\\`*_[]<>#|!{}~+-.)=';
11308
+ const lines = String(text ?? '').replace(/\r\n?/g, '\n').split('\n');
11309
+ const kept = lines.filter((line, i) => !/^[ \t]*<!--.*-->[ \t]*$/.test(line)
11310
+ // The preview may stop inside a last marker (the text cap), so an unclosed one on the last line goes too.
11311
+ && !(i === lines.length - 1 && /^[ \t]*<!--/.test(line)));
11312
+ const held = kept.join('\n')
11313
+ .replace(/[-]/g, '�')
11314
+ .replace(/\\([\\`*_[\]<>#|!{}~+\-.)=])/g, (all, ch) => String.fromCharCode(BASE + ESCAPABLE.indexOf(ch)));
11315
+ const entity = { '&': '&amp;', '<': '&lt;', '>': '&gt;' };
11316
+ return String(markdownHtml(held)).replace(/[-]/g, (ch) => {
11317
+ const original = ESCAPABLE[ch.charCodeAt(0) - BASE] ?? '�';
11318
+ return entity[original] || original;
11319
+ });
11320
+ }
11213
11321
  const kbConnKindName = (c) => (kbConnIsTrimble(c) ? 'Trimble Connect project' : kbConnIsMail(c) ? 'Outlook folder' : 'Teams chat');
11214
11322
  const kbConnService = (c) => (kbConnIsTrimble(c) ? 'Trimble Connect' : 'Microsoft 365');
11215
11323
  const kbConnThing = (c) => (kbConnIsTrimble(c) ? 'project' : kbConnIsMail(c) ? 'folder' : 'chat');
@@ -11382,8 +11490,11 @@
11382
11490
  : Number.isFinite(since) ? `messages since ${new Date(since).toLocaleDateString()}` : '';
11383
11491
  const unread = !!(st && st.connected && st.connected.unreadable);
11384
11492
  const service = c ? kbConnService(c) : 'Connected source';
11385
- const meta = unread ? `${service} · FloLess could not read its sync status just now. Reopen Knowledge to try again.`
11386
- : [service, c && c.account, scope, when, versions].filter(Boolean).join(' · ');
11493
+ // Each part its own span (#3425), so the line breaks between parts before it breaks inside one (an email address).
11494
+ const meta = (unread ? [service, 'FloLess could not read its sync status just now. Reopen Knowledge to try again.']
11495
+ : [service, c && c.account, scope, when, versions].filter(Boolean))
11496
+ // The dot is held to its part (kb-fmeta-sep does not wrap), so a line never ends on a lone separator.
11497
+ .map((part, i) => `<span class="kb-fmeta-part">${i ? '<span class="kb-fmeta-sep" aria-hidden="true">· </span>' : ''}${escapeHtml(part)}</span>`).join(' ');
11387
11498
  const chips = (syncing ? '<span class="kb-chip">syncing…</span>' : '') +
11388
11499
  (c && c.paused ? '<span class="kb-chip kb-conn-paused">paused</span>' : '') +
11389
11500
  (c && c.organizedPending ? '<span class="kb-chip new" data-tip="Organize again to use what this sync brought in">synced after the last Organize</span>' : '');
@@ -11400,6 +11511,7 @@
11400
11511
  `<div>Microsoft 365 said more messages may have changed at these times than one sync reads, so some may not be in this copy. Sync more often to keep a busy chat complete.</div>` +
11401
11512
  `<ul>${c.gaps.map((g) => `<li>${escapeHtml(new Date(g.from).toLocaleString())} – ${escapeHtml(new Date(g.to).toLocaleString())}</li>`).join('')}</ul></details>`
11402
11513
  : '';
11514
+ const notes = (mail && !unread ? kbConnMailHtml(s.sourceId, c, name) : '') + (trimble && !unread ? kbConnTrimbleHtml(s.sourceId, c, name) : '') + gaps;
11403
11515
  return `<div class="kb-src kb-conn${on ? '' : ' off'}${sel ? ' selected' : ''}" draggable="true"` +
11404
11516
  (depth != null ? ` style="--kb-depth:${depth}"` : '') +
11405
11517
  ` data-source-id="${escapeAttr(s.sourceId)}"${isOpen ? ' aria-current="true"' : ''}>` +
@@ -11407,10 +11519,10 @@
11407
11519
  '<div class="kb-fbody">' +
11408
11520
  `<button type="button" class="kb-fname" data-kb-open="${escapeAttr(s.sourceId)}" data-command-id="shell.kb-reference#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}" ` +
11409
11521
  `data-tip="Preview what was synced from “${escapeAttr(name)}” · Ctrl or Shift to select">${escapeHtml(name)}${sel ? '<span class="kb-sr"> (selected)</span>' : ''}</button>` +
11410
- `<div class="kb-fmeta"${Number.isFinite(at) || mail ? ` data-tip="${escapeAttr([mail && Number.isFinite(since) ? `Mail received since ${new Date(since).toLocaleDateString()}` : '',
11411
- Number.isFinite(at) ? `Last synced ${new Date(at).toLocaleString()}` : ''].filter(Boolean).join(' · '))}"` : ''}>${escapeHtml(meta)}${chips}</div>` +
11412
- (mail && !unread ? kbConnMailHtml(s.sourceId, c, name) : '') + (trimble && !unread ? kbConnTrimbleHtml(s.sourceId, c, name) : '') + stopped + gaps +
11413
11522
  '</div>' +
11523
+ // #3425: the name shares the first line with the controls, one group pinned to its top; the status line and the
11524
+ // notes below take the width under them, so nothing is drawn over the text and a row that grows never moves its ⟳.
11525
+ '<span class="kb-conn-ctl">' +
11414
11526
  `<button type="button" class="kb-conn-sync" data-kb-conn-sync="${escapeAttr(s.sourceId)}" aria-label="Sync “${escapeAttr(name)}” now"${syncing ? ' aria-busy="true" disabled' : ''}` +
11415
11527
  ` data-command-id="shell.kb-connected-sync#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}"` +
11416
11528
  ` data-tip="${syncing ? 'Syncing…' : c && c.paused ? 'Paused. Sync now asks to resume it first' : `Sync now: read what changed in this ${kbConnThing(c)}`}"><span aria-hidden="true">⟳</span></button>` +
@@ -11419,6 +11531,11 @@
11419
11531
  `data-tip="${on ? 'Included in the knowledge base — click to exclude' : 'Excluded from the knowledge base — click to include'}"></button>` +
11420
11532
  `<button type="button" class="kb-cat-more kb-conn-more" data-kb-conn-menu="${escapeAttr(s.sourceId)}" aria-haspopup="menu" aria-label="More for “${escapeAttr(name)}”"` +
11421
11533
  ` data-command-id="shell.kb-connected-menu#${escapeAttr(s.sourceId)}" data-command-instance-label="${escapeAttr(name)}" data-tip="Sync, pause, remove or erase">⋯</button>` +
11534
+ '</span>' +
11535
+ `<div class="kb-conn-extra kb-conn-meta"><div class="kb-fmeta"${Number.isFinite(at) || mail ? ` data-tip="${escapeAttr([mail && Number.isFinite(since) ? `Mail received since ${new Date(since).toLocaleDateString()}` : '',
11536
+ Number.isFinite(at) ? `Last synced ${new Date(at).toLocaleString()}` : ''].filter(Boolean).join(' · '))}"` : ''}>${meta}${chips ? ` ${chips}` : ''}</div></div>` +
11537
+ // A stop comes next and takes the whole width (its choices need the room); the notes line up with the name.
11538
+ (stopped ? `<div class="kb-conn-extra kb-conn-extra-stop">${stopped}</div>` : '') + (notes ? `<div class="kb-conn-extra">${notes}</div>` : '') +
11422
11539
  '</div>';
11423
11540
  }
11424
11541
 
@@ -12182,12 +12299,14 @@
12182
12299
  // make one. A categories file that cannot be read shows every reference flat and says so.
12183
12300
  kbSelFor(current, st);
12184
12301
  const tree = kbCatUsable(st) && kbCats(st).categories.length > 0;
12302
+ // #3413: design-set drawings sorted into categories keep the tree (and its counts) even when nothing else is loose.
12303
+ const placedDrawings = tree && st.sources.some((s) => kbInDesignSet(s, st) && kbcPlacement(kbCats(st), s.sourceId));
12185
12304
  const newCat = kbCatUsable(st) && loose.length && !(kbCatEdit && kbCatEdit.mode === 'new' && !kbCatEdit.parentId)
12186
12305
  ? '<button type="button" class="kb-link kb-cat-new" data-kb-cat-new data-command-id="shell.kb-category-new" data-tip="Group references into categories">+ New category</button>' : '';
12187
12306
  const flatEdit = !tree && kbCatEdit && kbCatEdit.mode === 'new' ? kbCatEditHtml(0) : '';
12188
12307
  const connect = '<button type="button" class="kb-link kb-conn-new" data-kb-conn-new data-command-id="shell.kb-connected-new" data-tip="Sync a Teams chat, an Outlook folder or a Trimble Connect project into this project’s knowledge, with the account chosen in Integrations">+ Connect a source</button>';
12189
12308
  const body = '<div class="kb-reference-head"><h3>Reference files</h3><span class="kb-reference-actions">' + newCat + connect + '</span></div>' +
12190
- kbCatUnavailableHtml(st) + (loose.length
12309
+ kbCatUnavailableHtml(st) + (loose.length || placedDrawings
12191
12310
  ? (tree ? kbTreeHtml(st, loose) : flatEdit + '<h4 class="kb-uncategorized-head">Uncategorized references</h4>' + loose.map((source) => kbSourceRow(source, st)).join(''))
12192
12311
  : '<div class="kb-empty">' + (inSet ? 'Other reference files will appear here. Drawings are listed in the Design set above.' : 'No references added yet. Add files below to get started.') + '</div>') + kbConnExtrasHtml(st) + kbSelBarHtml(st);
12193
12312
  const selected = st.sources.filter((s) => s.useAsKb).length;
@@ -13991,7 +14110,14 @@
13991
14110
  $wsKnowledge.addEventListener('input', (e) => { if (e.target && e.target.id === 'kb-adjust-input') kbSyncAdjustSubmit(); });
13992
14111
  // #2491 R6.9: the map's search highlights matches (it hides nothing); hover and focus light a node's neighbours.
13993
14112
  $wsKnowledge.addEventListener('input', (e) => { if (e.target && e.target.classList && e.target.classList.contains('kb-gsearch')) { kbGo.search = e.target.value; kbGraphRender(true); } });
13994
- $wsKnowledge.addEventListener('mouseover', (e) => { const n = e.target.closest && e.target.closest('.kb-g-node[data-kb-gid]'); if (n) kbGraphHighlight(n.dataset.kbGid); });
14113
+ $wsKnowledge.addEventListener('mouseover', (e) => {
14114
+ const n = e.target.closest && e.target.closest('.kb-g-node[data-kb-gid]');
14115
+ if (!n) return;
14116
+ kbGraphHighlight(n.dataset.kbGid);
14117
+ // #3413: SVG draws in document order, so a pointed-at node whose label was hidden goes last and its label reads over
14118
+ // its neighbours. Only for the pointer: moving a focused node would take its keyboard focus away.
14119
+ if (n.classList.contains('nolabel') && n.nextElementSibling && !n.contains(document.activeElement)) n.parentNode.appendChild(n);
14120
+ });
13995
14121
  $wsKnowledge.addEventListener('mouseout', (e) => { if (e.target.closest && e.target.closest('.kb-g-node') && !(e.relatedTarget && e.relatedTarget.closest && e.relatedTarget.closest('.kb-g-node'))) kbGraphHighlight(null); });
13996
14122
  $wsKnowledge.addEventListener('focusin', (e) => { const n = e.target.closest && e.target.closest('.kb-g-node[data-kb-gid]'); if (n) kbGraphHighlight(n.dataset.kbGid); });
13997
14123
  // #2491 R6.3: Replace file… picks exactly one file.
@@ -14025,10 +14151,13 @@
14025
14151
  // No cache invalidation here: a repaint during the drag would destroy this row and the browser would cancel the drop.
14026
14152
  // The paint guard holds repaints while a drag is in flight; the end of the drag catches the column up.
14027
14153
  row.classList.add('dragging');
14154
+ // #3413: every empty category shows where a reference can land while one is being dragged.
14155
+ $wsKnowledge.classList.add('kb-refs-dragging');
14028
14156
  });
14029
14157
  $wsKnowledge.addEventListener('dragend', () => {
14030
14158
  kbDragIds = null;
14031
14159
  kbClearDropHover();
14160
+ $wsKnowledge.classList.remove('kb-refs-dragging');
14032
14161
  $wsKnowledge.querySelectorAll('.kb-src.dragging').forEach((el) => el.classList.remove('dragging'));
14033
14162
  kbInvalidateRefs();
14034
14163
  if (knowledgeState) paintKnowledge(knowledgeState);
@@ -14072,6 +14201,7 @@
14072
14201
  $wsKnowledge.addEventListener('drop', (e) => {
14073
14202
  e.preventDefault();
14074
14203
  kbClearDrag();
14204
+ $wsKnowledge.classList.remove('kb-refs-dragging'); // the dragged row may be repainted away before its dragend
14075
14205
  const cat = kbDropTargetOf(e);
14076
14206
  kbClearDropHover();
14077
14207
  const to = cat ? (cat.dataset.kbDropCat === 'uncategorized' ? null : cat.dataset.kbDropCat) : undefined;
@@ -14687,6 +14817,30 @@
14687
14817
  *
14688
14818
  * Amber, like `.e-receipt.partial`, because it is the same news: this file is not the whole model.
14689
14819
  */
14820
+ /**
14821
+ * Add-ons S1a: the custom sections the IFC file carries on an assumption, read from its receipt so the card still
14822
+ * says so after the export toast is gone (a bounding box standing in for a shape the file cannot carry, or a
14823
+ * section FloLess could not verify that the person accepted).
14824
+ */
14825
+ function customSectionAssumedHtml(approved) {
14826
+ const entry = approved && exportState ? exportState.ifc : null;
14827
+ const record = entry && entry.customSections && typeof entry.customSections === 'object' ? entry.customSections : null;
14828
+ const total = record && Number.isSafeInteger(record.total) ? record.total : 0;
14829
+ if (!total) return '';
14830
+ // The counts cover every member; the rows only name the ones the receipt could store.
14831
+ const rows = Array.isArray(record.rows) ? record.rows : [];
14832
+ const boxes = Number(record.boundingBox) || 0;
14833
+ const accepted = Number(record.assumed) || 0;
14834
+ const parts = [
14835
+ boxes ? `${boxes} sent as ${boxes === 1 ? 'its' : 'their'} bounding box` : '',
14836
+ accepted ? `${accepted} accepted as an assumption` : '',
14837
+ ].filter(Boolean);
14838
+ const names = [...new Set(rows.map((row) => row && row.designation).filter(Boolean))].join(', ');
14839
+ return `<div class="e-receipt partial"><span>` +
14840
+ escapeHtml(`${total} custom section${total === 1 ? '' : 's'} in this file rest${total === 1 ? 's' : ''} on an assumption: ${parts.join(', ')}${names ? ` (${names}${rows.length < total ? ', and others' : ''})` : ''}.`) +
14841
+ `</span></div>`;
14842
+ }
14843
+
14690
14844
  function omittedHtml(kind, approved) {
14691
14845
  if (!approved || !exportState) return '';
14692
14846
  const byMember = new Map();
@@ -14721,6 +14875,8 @@
14721
14875
  'view-scale-invalid': 'a source view with no valid drawing scale',
14722
14876
  'cross-view-conflict': 'source views that disagree on placement',
14723
14877
  'placement-evidence-conflict': 'invalid scale and conflicting placement evidence',
14878
+ 'custom-section-unverified': 'a custom section that cannot be checked',
14879
+ 'custom-section-not-exported': 'a custom section this export does not carry',
14724
14880
  };
14725
14881
  const parts = Object.keys(byReason).sort().map((r) => `${byReason[r]} with ${WORDS[r] || r}`);
14726
14882
  // The stored rows are capped, so the parts can add up to less than the total. Say so rather than
@@ -15012,7 +15168,7 @@
15012
15168
  const instance = escapeAttr(row.profile);
15013
15169
  const stale = row.staleSaved ? ` Your saved choice “${escapeHtml(row.staleSaved)}” is not in this catalogue, so it was not applied.` : '';
15014
15170
  return `<div class="pm-row${chosen !== initial.get(row.profile) ? ' changed' : ''}" data-pm-row="${instance}">
15015
- <div class="pm-from"><span class="pm-name">${escapeHtml(row.profile)}</span><span class="pm-count">${escapeHtml(plural(row.memberCount, 'member', 'members'))}${row.choiceFrom === 'saved' ? ' · from your saved table' : ''}</span></div>
15171
+ <div class="pm-from"><span class="pm-name">${escapeHtml(row.profile)}</span><span class="pm-count">${escapeHtml(plural(row.memberCount, 'member', 'members'))}${row.choiceFrom === 'saved' ? (row.choice == null ? ' · your saved choice: a profile-less line' : ' · your saved choice') : ''}</span></div>
15016
15172
  <div class="pm-sugg"><span class="pm-chip ${chipClass}">${escapeHtml(chipText)}</span>
15017
15173
  <span class="pm-why">${row.suggestion.to ? `<strong>${escapeHtml(row.suggestion.to)}</strong> — ` : ''}${escapeHtml(row.suggestion.note)}${stale}</span></div>
15018
15174
  <div class="pm-pick wf-combo fm-select">
@@ -15064,9 +15220,19 @@
15064
15220
  </div>`;
15065
15221
  };
15066
15222
 
15223
+ // #3418: a re-send whose every missing profile already has the person's saved choice says so,
15224
+ // instead of reading like a new problem each time. Still shown (it decides what the send replaces in Tekla), and
15225
+ // it goes back to the ordinary wording the moment the person changes a choice here. Only the words change: the
15226
+ // button keeps its label and the window its focus, so Instructor narrates exactly what is on screen.
15227
+ const savedCount = () => (check.rows || []).filter((row) => row.choiceFrom === 'saved').length;
15228
+ const allSaved = () => check.supported !== false && (check.rows || []).length > 0
15229
+ && savedCount() === check.rows.length
15230
+ && check.rows.every((row) => choices.get(row.profile) === initial.get(row.profile));
15067
15231
  const render = () => {
15068
15232
  const rows = check.rows || [];
15233
+ const saved = allSaved();
15069
15234
  $title.textContent = check.supported === false ? 'Check the profiles before sending'
15235
+ : saved ? 'Your saved Tekla profile choices'
15070
15236
  : rows.length ? 'Profiles Tekla does not have' : 'Every profile is in Tekla';
15071
15237
  $sources.hidden = true;
15072
15238
  if (check.supported === false) {
@@ -15076,14 +15242,22 @@
15076
15242
  $note.textContent = '';
15077
15243
  $apply.textContent = 'Continue without checking';
15078
15244
  } else {
15079
- $sub.textContent = rows.length
15080
- ? `${rows.length} of the ${plural(check.counts.profiles, 'profile', 'profiles')} in this model (${plural(rows.reduce((sum, row) => sum + row.memberCount, 0), 'member', 'members')}) ${rows.length === 1 ? 'is' : 'are'} not in Tekla. FloLess suggests a match; you can change any of them. Whatever you leave unmapped is still sent, and Tekla makes a line you give a profile to there. The model and the bill of materials keep their own names.`
15245
+ const members = plural(rows.reduce((sum, row) => sum + row.memberCount, 0), 'member', 'members');
15246
+ const kept = savedCount();
15247
+ const keptText = kept && kept < rows.length
15248
+ ? `${kept} of them already ${kept === 1 ? 'has' : 'have'} your saved choice; the other ${rows.length - kept} ${rows.length - kept === 1 ? 'needs' : 'need'} your review. `
15249
+ : '';
15250
+ $sub.textContent = saved
15251
+ ? `${rows.length === 1 ? 'The profile Tekla does not have' : rows.length === 2 ? 'Both profiles Tekla does not have' : `All ${rows.length} profiles Tekla does not have`} (${members}) already ${rows.length === 1 ? 'has' : 'have'} your saved choice. Choose Apply and continue to use ${rows.length === 1 ? 'it, or change it first' : 'them, or change any of them first'}.`
15252
+ : rows.length
15253
+ ? `${rows.length} of the ${plural(check.counts.profiles, 'profile', 'profiles')} in this model (${members}) ${rows.length === 1 ? 'is' : 'are'} not in Tekla. ${keptText}FloLess suggests a match; you can change any of them. Whatever you leave unmapped is still sent, and Tekla makes a line you give a profile to there. The model and the bill of materials keep their own names.`
15081
15254
  : `All ${plural(check.counts.profiles, 'profile', 'profiles')} in this model are in ${sourceName()}. Nothing needs mapping.`;
15082
15255
  $source.textContent = `Checked against ${sourceName()}.`;
15083
15256
  $body.innerHTML = rows.length
15084
15257
  ? `<div class="pm-head" aria-hidden="true"><span>In the model</span><span>Suggestion</span><span>Send to Tekla as</span></div>${rows.map(rowHtml).join('')}`
15085
15258
  : '<div class="pm-empty">Nothing to map for this catalogue.</div>';
15086
- $note.textContent = 'Sending replaces the parts FloLess sent to this Tekla model before, including any you gave a profile to by hand. Your choices are kept with the project for the next send.';
15259
+ $note.textContent = 'Sending replaces the parts FloLess sent to this Tekla model before, including any you gave a profile to by hand.'
15260
+ + (saved ? '' : ' Your choices are kept with the project for the next send.');
15087
15261
  $apply.textContent = rows.length ? 'Apply and continue' : 'Continue';
15088
15262
  }
15089
15263
  const imported = check.imported || [];
@@ -15386,6 +15560,8 @@
15386
15560
  'view-scale-invalid': 'no valid drawing scale',
15387
15561
  'cross-view-conflict': 'conflicting drawing views',
15388
15562
  'placement-evidence-conflict': 'conflicting placement evidence',
15563
+ 'custom-section-unverified': 'a custom section that cannot be checked',
15564
+ 'custom-section-not-exported': 'a custom section this export does not carry',
15389
15565
  };
15390
15566
  const grouped = {};
15391
15567
  rows.forEach((row) => { grouped[row.reason] = (grouped[row.reason] || 0) + 1; });
@@ -16177,6 +16353,7 @@
16177
16353
  // says what the producer could not emit from what it was given, this says what was never
16178
16354
  // given to it. A model missing three heights and an AWARE weld failure are not one fact.
16179
16355
  (c.kind === 'send-host' ? '' : omittedHtml(c.kind, approved)) +
16356
+ (c.kind === 'ifc' ? customSectionAssumedHtml(approved) : '') +
16180
16357
  (c.kind === 'send-host' ? '' : exportProvenanceHtml(c.kind, approved)) +
16181
16358
  // REGISTERED, because #1156a changed what this button DOES. It used to refuse an export outright
16182
16359
  // when any member's endpoint elevation was unresolved; now the file exports build what they can
@@ -17079,8 +17256,11 @@
17079
17256
  const body = renderOptions || bomOptions;
17080
17257
  // #2521 row 5b: a render of a Quick model may ask how to continue (the caption). Answered here, so the render
17081
17258
  // proceeds only once the person has chosen; a cancelled question ends it, having said what was saved.
17259
+ // Add-ons S1a: an IFC export may ask about custom sections with no IFC shape. Answered here the same way.
17082
17260
  const res = kind === 'render'
17083
17261
  ? await postRenderAnsweringCaption(projectId, app, capturedSource.handleId, body)
17262
+ : kind === 'ifc'
17263
+ ? await postIfcAnsweringCustomSections(projectId, app, capturedSource.handleId)
17084
17264
  : await api(exportUrl(kind, projectId, app, capturedSource.handleId), body
17085
17265
  ? { method: 'POST', body: JSON.stringify(body), headers: { 'content-type': 'application/json' } }
17086
17266
  : { method: 'POST' });
@@ -17135,9 +17315,12 @@
17135
17315
  // toast is raised. `showToast` appends rather than replaces, so emitting a clean "Exported"
17136
17316
  // and then a warning would leave the user reading two contradictory messages at once.
17137
17317
  const omittedNow = Array.isArray(res.skippedDetail) ? res.skippedDetail.length : 0;
17318
+ const boxedNow = Array.isArray(res.customSections) ? res.customSections.filter((row) => row && row.sent === 'bounding-box').length : 0;
17138
17319
  const gaps = [
17139
17320
  summary && summary.partial ? summary.text : null,
17140
17321
  omittedNow ? `${omittedNow} member${omittedNow === 1 ? '' : 's'} left out — see the card for why` : null,
17322
+ // Add-ons S1a: a custom section sent as its bounding box is in the file, but not as itself.
17323
+ boxedNow ? `${boxedNow} sent as a bounding box, named in the file as an assumption` : null,
17141
17324
  ].filter(Boolean);
17142
17325
  // #2521 row 5b: a file made from a Quick (or possibly Quick) model says so here too; the file carries it as well.
17143
17326
  const quickBit = res.quick && res.quick.label ? ` — ${res.quick.label}, named in the file` : '';
@@ -17230,6 +17413,58 @@
17230
17413
  }
17231
17414
  }
17232
17415
 
17416
+ /**
17417
+ * Add-ons S1a: POST an IFC export, answering the question it asks when members use a custom section whose shape an
17418
+ * IFC file cannot carry as itself. The question is asked before the source is spent, so the answer exports the same
17419
+ * frozen version. Resolves the export's answer, or null when the person cancelled (the source is released).
17420
+ */
17421
+ async function postIfcAnsweringCustomSections(projectId, app, handleId) {
17422
+ let request = null;
17423
+ for (;;) {
17424
+ try {
17425
+ return await api(exportUrl('ifc', projectId, app, handleId), request
17426
+ ? { method: 'POST', body: JSON.stringify(request), headers: { 'content-type': 'application/json' } }
17427
+ : { method: 'POST' });
17428
+ } catch (err) {
17429
+ const ask = err && err.body && err.body.needsChoice === 'custom-sections' ? err.body : null;
17430
+ // Asked once: a second question for the same click means the model changed under it, which the next click asks about.
17431
+ if (!ask || request) throw err;
17432
+ const choice = await askIfcCustomSections(ask, projectId);
17433
+ if (!choice) {
17434
+ try { await releaseCapturedSources(projectId, [handleId]); } catch { /* it expires on its own */ }
17435
+ showToast('IFC export stopped. Nothing was exported.', 'info');
17436
+ return null;
17437
+ }
17438
+ request = { customSections: { choice, key: ask.key } };
17439
+ }
17440
+ }
17441
+ }
17442
+
17443
+ /** The custom-section question itself. Resolves 'leave-out', 'bounding-box', or null when cancelled. */
17444
+ async function askIfcCustomSections(ask, projectId) {
17445
+ if (!bridge.formModal) return null;
17446
+ const members = Array.isArray(ask.members) ? ask.members : [];
17447
+ const named = members.slice(0, 6).map((m) => `${m.id} (${m.designation})`).join(', ') + (members.length > 6 ? `, and ${members.length - 6} more` : '');
17448
+ const chosen = await bridge.formModal({
17449
+ title: 'Custom sections in this IFC file',
17450
+ sub: `${ask.message}${named ? ` Members: ${named}.` : ''} Nothing is exported until you choose.`,
17451
+ okLabel: 'Export',
17452
+ returnFocusTo: $wsExports.querySelector('[data-export="ifc"]'),
17453
+ returnFocusFallback: () => (current && current.id === projectId
17454
+ ? $wsExports.querySelector('[data-export="ifc"]')
17455
+ : null),
17456
+ fields: [{
17457
+ name: 'choice', label: 'For these members', type: 'select', value: 'leave-out', commandId: 'shell.ifc-custom-section-choice',
17458
+ options: [
17459
+ { value: 'leave-out', label: 'Leave them out', meta: 'Recommended · listed as left out' },
17460
+ { value: 'bounding-box', label: 'Send their bounding box', meta: 'Named as an assumption' },
17461
+ ],
17462
+ }],
17463
+ });
17464
+ if (!chosen) return null;
17465
+ return chosen.choice === 'bounding-box' ? 'bounding-box' : 'leave-out';
17466
+ }
17467
+
17233
17468
  /** The caption question itself. Resolves 'update', 'without-caption', or null when cancelled. */
17234
17469
  async function askRenderCaption(ask, projectId, saved) {
17235
17470
  if (!bridge.formModal) return null;
@@ -23034,5 +23269,5 @@
23034
23269
  // #2470 R6.2b: a project kind's name as the person sees it ("Trace", "Drawing Checker"), for labels outside this file.
23035
23270
  kindLabelOf: (project) => (project && wsDescOf(project)?.displayName) || null,
23036
23271
  };
23037
- applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
23272
+ applyMode(); // restore persisted mode immediately
23038
23273
  })();