@floless/app 0.169.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 (87) hide show
  1. package/dist/floless-server.cjs +65531 -43728
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  3. package/dist/schemas/steel.model.v2.schema.json +196 -4
  4. package/dist/skills/floless-app-bridge/SKILL.md +3 -3
  5. package/dist/skills/floless-app-knowledge/SKILL.md +46 -15
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  7. package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
  8. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
  9. package/dist/skills/floless-app-queue/SKILL.md +2 -3
  10. package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
  11. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  12. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  13. package/dist/skills/floless-app-steel-model/SKILL.md +42 -39
  14. package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
  15. package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
  16. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  17. package/dist/skills/floless-app-ui/SKILL.md +71 -126
  18. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  19. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  20. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  21. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  22. package/dist/web/add-ons.js +407 -0
  23. package/dist/web/agent-steps.js +89 -18
  24. package/dist/web/agents.js +32 -22
  25. package/dist/web/analytics.js +1 -1
  26. package/dist/web/app.css +331 -190
  27. package/dist/web/app.js +33 -13
  28. package/dist/web/aware.js +926 -218
  29. package/dist/web/chat.css +6 -1
  30. package/dist/web/chat.js +316 -112
  31. package/dist/web/checkpoint-standard.js +5 -3
  32. package/dist/web/commands-drawing-check.js +1 -0
  33. package/dist/web/commands-filter.js +23 -0
  34. package/dist/web/commands-shell.js +479 -78
  35. package/dist/web/commands-steel.js +69 -2
  36. package/dist/web/commands-tekla-parser.js +23 -0
  37. package/dist/web/connections.js +14 -3
  38. package/dist/web/drawing-check-editor.js +352 -88
  39. package/dist/web/failure-copy.js +33 -2
  40. package/dist/web/filter-ai-proposal.js +11 -8
  41. package/dist/web/flo-3d.js +1 -1
  42. package/dist/web/guide.js +36 -29
  43. package/dist/web/index.html +98 -57
  44. package/dist/web/instructor.js +101 -17
  45. package/dist/web/kb-categories.js +64 -7
  46. package/dist/web/left-pane.js +4 -1
  47. package/dist/web/local-discovery.js +8 -7
  48. package/dist/web/missed-routines.js +239 -0
  49. package/dist/web/model-change-findings.js +430 -0
  50. package/dist/web/model-change-review.js +414 -0
  51. package/dist/web/model-editor-steel-adapter.js +2 -2
  52. package/dist/web/model-measure.js +6 -0
  53. package/dist/web/model-spatial-panel.js +19 -4
  54. package/dist/web/model-spatial-tools.js +3 -3
  55. package/dist/web/model-viewport-revit-adapter.js +3 -3
  56. package/dist/web/origin-rule.js +155 -0
  57. package/dist/web/project-access.js +1 -1
  58. package/dist/web/project-history.js +7 -1
  59. package/dist/web/project-modules.js +2 -2
  60. package/dist/web/project-rfis.js +6 -1
  61. package/dist/web/project-workflows.js +2 -2
  62. package/dist/web/revit-editor.css +85 -0
  63. package/dist/web/revit-editor.js +58 -9
  64. package/dist/web/run-history.js +12 -1
  65. package/dist/web/sha256-sync.js +62 -0
  66. package/dist/web/steel-3d-core.js +46 -9
  67. package/dist/web/steel-3d-flo.js +153 -7
  68. package/dist/web/steel-3d-view.js +33 -5
  69. package/dist/web/steel-ai-marks.js +3 -1
  70. package/dist/web/steel-custom-connection.js +161 -0
  71. package/dist/web/steel-custom-sections.js +1796 -0
  72. package/dist/web/steel-editor.html +732 -161
  73. package/dist/web/steel-environments.js +297 -0
  74. package/dist/web/steel-filter-usage.js +299 -0
  75. package/dist/web/steel-filter.html +104 -6
  76. package/dist/web/steel-model-v2-client-validation.js +11 -1
  77. package/dist/web/steel-model-v2-commands.js +116 -13
  78. package/dist/web/steel-model-v2-projection.js +1 -1
  79. package/dist/web/steel-read-confidence.js +1 -56
  80. package/dist/web/step-rename.js +3 -2
  81. package/dist/web/tekla-editor.html +1 -0
  82. package/dist/web/terminal-requests.js +1 -1
  83. package/dist/web/tool-updates.js +7 -6
  84. package/dist/web/workspaces.js +1968 -138
  85. package/launch.mjs +87 -9
  86. package/package.json +4 -1
  87. package/dist/web/panels.js +0 -831
@@ -1989,6 +1989,17 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1989
1989
  #panel .mp-more{width:100%;margin-top:6px;font-size:11px;padding:4px 7px}
1990
1990
  #panel .mp-sheet{font-weight:400;color:var(--mut)}
1991
1991
  #panel .mp-done{margin-top:12px;font-size:12px;line-height:1.5;color:var(--text)}
1992
+ /* #2554 slice 2b: Read the rest. The list scrolls inside the panel; the global * scrollbar rule themes it. */
1993
+ #panel .mp-rest{display:grid;gap:6px;margin:6px 0 4px;padding:7px 8px;border:1px solid var(--line);border-radius:6px;background:var(--hover-soft)}
1994
+ #panel .mp-rest-modes{display:grid;gap:3px}
1995
+ #panel .mp-rest-mode,#panel .mp-rest-file{display:flex;align-items:flex-start;gap:6px;font-size:11.5px;line-height:1.4;color:var(--text);text-transform:none;letter-spacing:0;cursor:pointer}
1996
+ #panel .mp-rest-mode input,#panel .mp-rest-file input{margin-top:2px}
1997
+ #panel .mp-rest-acts,#panel .mp-rest-head{display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap}
1998
+ #panel .mp-rest-acts{justify-content:flex-start}
1999
+ #panel .mp-rest-acts button{font-size:11px;padding:4px 10px}
2000
+ #panel .mp-rest-head .ghost{font-size:11px;padding:3px 8px}
2001
+ #panel .mp-rest-list{display:grid;gap:3px;max-height:180px;overflow:auto;padding:4px 2px;border-top:1px solid var(--line)}
2002
+ #panel .mp-rest-file span{overflow-wrap:anywhere}
1992
2003
  #panel .mp-done:focus:not(:focus-visible){outline:none}
1993
2004
  #panel .mp-done .hint{margin-top:4px}
1994
2005
  #quickStat.is-unknown{text-decoration:underline dashed;text-underline-offset:3px}
@@ -1996,6 +2007,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1996
2007
  full list is in its tip. */
1997
2008
  #coverageStat{white-space:nowrap;color:var(--mut);max-width:16ch;overflow:hidden;text-overflow:ellipsis}
1998
2009
  #coverageStat.is-unknown{text-decoration:underline dashed;text-underline-offset:3px}
2010
+ #coverageStat[role=button]{cursor:pointer}
2011
+ #coverageStat[role=button]:hover{color:var(--text)}
1999
2012
  .conf-quick{margin:0 0 8px;padding:6px 10px;border:1px solid var(--warn-edge);border-radius:6px;color:var(--mut);font-size:12px;line-height:1.45}
2000
2013
  .conf-quick b{color:var(--warn)}
2001
2014
  #srcStat b{display:inline-block;max-width:130px;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom}
@@ -2879,6 +2892,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
2879
2892
  #m3dLegend .lrow.sub{padding-left:34px} /* a row inside a nested category — indented one level deeper */
2880
2893
  #m3dLegend .drag-handle{font-size:11px;color:var(--mut);cursor:grab;opacity:0;transition:opacity .1s;flex:none;padding:0 1px;line-height:1}
2881
2894
  #m3dLegend .lrow:hover .drag-handle{opacity:1}
2895
+ #m3dLegend .drag-handle:focus{opacity:1}
2896
+ #m3dLegend .drag-handle:focus-visible,#m3dLegend .cat-hdr:focus-visible{outline:2px solid var(--brand);outline-offset:-2px} /* #3208: Instructor focuses these (tabindex -1, never a tab stop) */
2882
2897
  #m3dLegend .lrow.flash{background:rgba(59,130,246,.12)}
2883
2898
  .leg-drag-ghost{position:fixed;pointer-events:none;z-index:70;background:var(--panel);border:1px solid var(--brand);border-radius:5px;padding:3px 8px;display:flex;align-items:center;gap:7px;font:12px var(--ui);color:var(--text);width:200px;opacity:.88;box-shadow:0 4px 16px rgba(0,0,0,.6)}
2884
2899
  /* The Ctrl+Shift drag-out badge. Same recipe as .leg-drag-ghost but sized to its text (a fixed width
@@ -2902,6 +2917,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
2902
2917
  #m3dLegend .lrow.qhide,#m3dLegend .cat-hdr.qhide{display:none} /* filtered OUT by search → gone (distinct from .off = hidden-in-3D, which only dims the swatch) */
2903
2918
  #m3dLegend .lsempty{color:var(--mut);font-size:11px;padding:10px 4px;text-align:center}
2904
2919
  #m3dLegend .lidhit{color:var(--mut);font-size:11px;margin-left:2px;min-width:0;overflow:hidden;text-overflow:ellipsis} /* #2998: the member id a search matched, after a profile row's label */
2920
+ #m3dLegend .lrow[data-mix]::after{content:attr(data-mix);color:var(--mut);font-size:11px;margin-left:2px;min-width:0;overflow:hidden;text-overflow:ellipsis} /* #3208: how a mixed row's members split — the .lidhit recipe; CSS content, so search never matches it */
2905
2921
  /* Show-all reset bar — panel-local entry to showAllGroups(); shown only when something is hidden/isolated. Clones the
2906
2922
  .lsearch full-width box recipe; brand border on hover only (a one-shot action, not a mode → no solid fill). */
2907
2923
  #m3dLegend .lreset{display:none;align-items:center;justify-content:center;gap:6px;height:26px;margin-bottom:6px;background:var(--bg);border:1px solid var(--line);border-radius:6px;color:var(--text);font:12px var(--ui);cursor:pointer;flex:none;user-select:none}
@@ -4191,7 +4207,8 @@ let GridDisplay = null; // grid-display.js — the Grid pane's ONE boundary betw
4191
4207
  let ViewGen = null; // steel-view-generation.js pure F11 helpers — loaded before saved views are sanitised
4192
4208
  let ModelCmd = null; // steel-model-commands.js — the model boundary's WRITE half (unit 5, P3a); the read half is steel-model-adapter.js
4193
4209
  let AiMarks = null; // steel-ai-marks.js (#2521 row 6): which members rest on an AI decision
4194
- let V2Projection = null, V2Commands = null, V2Validation = null, FilterCore = null, ProfileColours = null, ReferenceSheet = null, ReadConfidence = null;
4210
+ let CustomConn = null; // steel-custom-connection.js (#2303 slice A): what Inspect says about a custom connection built from standard parts
4211
+ let V2Projection = null, V2Commands = null, V2Validation = null, FilterCore = null, ProfileColours = null, ReferenceSheet = null, ReadConfidence = null, CustomSections = null;
4195
4212
  let ChatQuestions = null; // model-chat-questions.js — the Questions in chat card and chat labels, shared with every model viewer
4196
4213
  let FramesCore = null; // steel-frames-core.js — the moment-frame schedule rules the server shares: what a frame row is, which girder sizes a sheet shows, how a read may add (#2210)
4197
4214
  let MarksCore = null; // steel-marks-core.js — the callout rules the server shares: where a callout leads, what a new one must say, when two marks are the same (#2211)
@@ -4206,6 +4223,7 @@ function legendBody(key){
4206
4223
  return legendBodies[key];
4207
4224
  }
4208
4225
  let PlanXf = null; // steel-plan-transform.js — the px↔world registration boundary. Already in the module graph (V2Projection imports it); named here so the classic script can read a sheet's registration angle and fit scale when it draws a rolled section footprint.
4226
+ let SteelEnv = null; // steel-environments.js — the ONE registry of steel-environment TRAITS (units, shapes route, scale grammar, default grade, catalogue noun…). Every behaviour that differs by standard reads a trait from it; nothing on this page compares an environment id. Dynamic import for the same reason DisplayUnits is one.
4209
4227
  let CkStd = null; // checkpoint-standard.js — the ONE place a steel standard is named for a reader. A
4210
4228
  // dynamic import for the same reason DisplayUnits is one: a `<script type=module>` is DEFERRED and
4211
4229
  // binds AFTER this classic script has already drawn. The Drawing Filter checkpoint imports the same
@@ -4413,6 +4431,8 @@ let reviewCycle = null; // the in-flight ref
4413
4431
  function reviewEventMatches(m){return m&&typeof m==='object'&&m.type==='review-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4414
4432
  /* #2449: an assumption on one of this project's connections was recorded or withdrawn. */
4415
4433
  function aiDecisionsEventMatches(m){return m&&typeof m==='object'&&m.type==='ai-decisions-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4434
+ /* #2303 slice A: the AI-assisted label switches changed (here, in another tab, or from AI Chat). */
4435
+ function connectionDisplayEventMatches(m){return m&&typeof m==='object'&&m.type==='connection-display-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4416
4436
  function assumptionEventMatches(m){return m&&typeof m==='object'&&m.type==='connection-assumptions-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4417
4437
  function reviewFrameOrderable(m){return Number.isSafeInteger(m.reviewRevision)&&m.reviewRevision>=0;}
4418
4438
  function editorHasUnsavedWork(){const sv=document.getElementById('saveStat');return !!sv&&(sv.classList.contains('dirty')||sv.classList.contains('err')||sv.classList.contains('conflict'));}
@@ -4590,10 +4610,18 @@ function handleReviewChanged(m){
4590
4610
  if(c===undefined)return;
4591
4611
  const el=document.getElementById('coverageStat');if(!el)return;
4592
4612
  const shown=c&&(c.state==='part'||c.state==='unknown')&&typeof c.short==='string'&&c.short?c:null;
4593
- if(!shown){el.style.display='none';el.textContent='';el.removeAttribute('data-tip');return;}
4613
+ if(!shown){el.style.display='none';el.textContent='';el.removeAttribute('data-tip');el.removeAttribute('role');el.onclick=el.onkeydown=null;return;}
4594
4614
  el.textContent=shown.short;
4595
4615
  el.classList.toggle('is-unknown',shown.state==='unknown');
4596
- el.setAttribute('data-tip',(shown.text||shown.short)+' Shown as last loaded.');
4616
+ // #2554 slice 2b: the way back to Read the rest once every AI decision is reviewed and the strip's Make precise is gone.
4617
+ const opens=!!PROJECT;
4618
+ el.setAttribute('data-tip',(shown.text||shown.short)+' Shown as last loaded.'+(opens?' Press to see the files left for later and what can read them.':''));
4619
+ if(opens){
4620
+ el.setAttribute('role','button');
4621
+ const open=()=>{if(window.openMakePrecise)window.openMakePrecise();};
4622
+ el.onclick=e=>{e.stopPropagation();open();};
4623
+ el.onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();open();}};
4624
+ }
4597
4625
  el.style.display='';
4598
4626
  }
4599
4627
  /* The confidence report's line: scoped to the last saved model, and it says so when the report shows unsaved edits. */
@@ -4667,6 +4695,7 @@ function startContractEvents(){
4667
4695
  // #2521 row 6: the AI-decision record changed. Forget what Inspect was told (a late answer from before is dropped by the epoch).
4668
4696
  if(aiDecisionsEventMatches(m)){if(contractEventReady&&window.aiMarksRecordChanged)window.aiMarksRecordChanged();return;}
4669
4697
  if(assumptionEventMatches(m)){if(contractEventReady&&window.forgetConnectionAssumptions)window.forgetConnectionAssumptions();return;}
4698
+ if(connectionDisplayEventMatches(m)){if(window.reloadConnectionDisplay)window.reloadConnectionDisplay(m.rev);return;}
4670
4699
  if(reviewEventMatches(m)){if(!contractEventReady){if(reviewFrameOrderable(m)&&(!reviewEventWatermark||m.reviewRevision>=reviewEventWatermark.reviewRevision))reviewEventWatermark=m;}else handleReviewChanged(m);return;}
4671
4700
  if(!contractEventMatches(m))return;if(!contractEventReady)bufferContractEvent(m);else handleContractChanged(m);};
4672
4701
  source.onerror=()=>{if(source!==contractEventSource)return;contractEventReady=false;if(source.readyState===EventSource.CLOSED){ownWrites.length=0;uncertainWrites.clear();console.warn('steel-editor: SSE channel closed — live updates paused');showAiUpdateBanner('Live updates disconnected — reload to resume change detection.');}};
@@ -4889,26 +4918,39 @@ function replyFailureText(status, body, ctx) {
4889
4918
  return personText(body) || failureCopy({ status, body: body && typeof body === 'object' ? body : null }, ctx).text;
4890
4919
  }
4891
4920
 
4921
+ /* #3097 3b: the sentence for a caught error is failure-copy.js errorText(e, ctx): the server's reply read again when
4922
+ the error carries one, a sentence this page wrote when it is marked `forPerson`, else the shared sentence. */
4923
+
4892
4924
  /**
4893
- * #3097: the sentence for a caught error. An error this page threw FOR a person (`forPerson`, its message already a
4894
- * sentence) is said as written; anything else — the browser's "Failed to fetch", a check that threw, a save's own
4895
- * bookkeeping message — is a developer's text, so it goes to the console and the person gets the shared sentence.
4925
+ * #3097 3b: the sentence for a refused reference request, whose reply `d` was already read. A busy lock, a sign-in
4926
+ * refusal or an unreadable answer gets the shared sentence for it (never the lock's time estimate); otherwise the
4927
+ * server's sentence for the person, else the caller's own words, with the reply kept in the console.
4896
4928
  */
4897
- function personErrorText(e, ctx) {
4898
- if (e && e.forPerson && typeof e.message === 'string' && e.message.trim()) return e.message;
4899
- console.warn('steel-editor: ' + ((ctx && ctx.action) || 'a step') + ' failed', e);
4900
- return failureCopy(e, ctx).text;
4929
+ /** A review route's refusal is a fragment written to follow " — "; said on its own, it starts a sentence and ends one. */
4930
+ function sentenceCase(text){
4931
+ const t=String(text||'').trim();
4932
+ return !t?t:(t.charAt(0).toUpperCase()+t.slice(1)+(/[.!?]$/.test(t)?'':'.'));
4933
+ }
4934
+
4935
+ function refusalText(d, fallback, ctx){
4936
+ const body=d&&typeof d==='object'?d:{code:'response-unreadable'};
4937
+ const kind=failureKind({body});
4938
+ if(kind==='busy'||kind==='access'||kind==='connection'||kind==='outdated')return errorText({body},ctx);
4939
+ const said=personText(body);
4940
+ if(!said)console.warn('steel-editor: '+((ctx&&ctx.action)||'a reference step')+' was refused with nothing to say to the person',body);
4941
+ return said||fallback;
4901
4942
  }
4902
4943
 
4903
4944
  /**
4904
- * #3097: what a failed switch to the 3D view says. The scene route's own sentence keeps its old lead ("Could not
4905
- * open 3D view: …"); anything else — an unreadable reply, a refusal with nothing said, no answer, a renderer that
4906
- * threw while loading — is the shared sentence. Opening the view only reads, so a retry is safe to offer.
4945
+ * #3097: what a failed switch to the 3D view says. The scene route's own sentence for the person keeps its old lead
4946
+ * ("Could not open 3D view: …"), read again from the reply (personText), never from the error's message; anything
4947
+ * else — an unreadable reply, a refusal with nothing said, no answer, a renderer that threw while loading — is the
4948
+ * shared sentence. Opening the view only reads, so a retry is safe to offer.
4907
4949
  */
4908
4950
  function threeDOpenFailureText(e) {
4909
- if (e && e.forPerson && typeof e.message === 'string' && e.message.trim()) return 'Could not open 3D view: ' + e.message;
4910
- console.error('steel-editor: the 3D view did not open', e);
4911
- return failureCopy(e, { action: 'open the 3D view', retrySafe: true }).text;
4951
+ const said = e && personText(e.body);
4952
+ if (said) return 'Could not open 3D view: ' + said;
4953
+ return errorText(e, { action: 'open the 3D view', retrySafe: true });
4912
4954
  }
4913
4955
 
4914
4956
  /* WHY A SECOND COUNTER AND NOT JUST `modelEditGeneration`.
@@ -4927,7 +4969,7 @@ async function boot() {
4927
4969
  if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
4928
4970
  armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
4929
4971
  startContractEvents(); // subscribe first; contract events buffer until the atomic snapshot is installed
4930
- [DisplayUnits, GridDisplay, SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView, FilterCore, PlanXf, CatalogPicker, ModelEditor, ViewportToolbar, ModelLighting, PointerDock, EditorShell, ReviewClient, ProfileColours, ReferenceSheet, ReadConfidence, CkStd, ModelPanelBridge, ChatQuestions, SteelSlim, LastSeen, MarksCore, FramesCore, AiMarks] = await Promise.all([
4972
+ [DisplayUnits, GridDisplay, SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView, FilterCore, PlanXf, CatalogPicker, ModelEditor, ViewportToolbar, ModelLighting, PointerDock, EditorShell, ReviewClient, ProfileColours, ReferenceSheet, ReadConfidence, CkStd, SteelEnv, ModelPanelBridge, ChatQuestions, SteelSlim, LastSeen, MarksCore, FramesCore, AiMarks, CustomSections, CustomConn] = await Promise.all([
4931
4973
  import('./display-units.js'), import('./grid-display.js'),
4932
4974
  import('./steel-3d-core.js'), import('./steel-view-generation.js'), import('./steel-model-commands.js'),
4933
4975
  import('./steel-detail-refs.js'), import('./steel-model-v2-projection.js'),
@@ -4937,8 +4979,10 @@ async function boot() {
4937
4979
  import('./model-viewport-toolbar.js'), import('./model-viewport-lighting.js'), import('./model-pointer-dock.js'), import('./model-editor-shell.js'),
4938
4980
  import('./connection-review-client.js'), import('./steel-profile-colours.js'),
4939
4981
  import('./steel-reference-sheet.js'), import('./steel-read-confidence.js'),
4940
- import('./checkpoint-standard.js'), import('./model-panel-bridge.js'), import('./model-chat-questions.js'),
4982
+ import('./checkpoint-standard.js'), import('./steel-environments.js'), import('./model-panel-bridge.js'), import('./model-chat-questions.js'),
4941
4983
  import('./steel-model-slim.js'), import('./steel-last-seen.js'), import('./steel-marks-core.js'), import('./steel-frames-core.js'), import('./steel-ai-marks.js'),
4984
+ import('./steel-custom-sections.js'),
4985
+ import('./steel-custom-connection.js'),
4942
4986
  ]);
4943
4987
  ({ FT_TO_MM, IN_TO_MM, LB_PER_FT_TO_KG_PER_M } = SteelCore); // the shared unit constants, bound before main() and every reader of them
4944
4988
  // BEFORE the first paint, deliberately. Every length on this page reads through it, so resolving it
@@ -5134,7 +5178,7 @@ async function boot() {
5134
5178
  // showed the UK chip while every profile, weight, material and RFI on the page stayed US-backed —
5135
5179
  // so the editor told the user their catalogue held US shapes only, for steel the server resolves
5136
5180
  // perfectly. `C` is loaded by here (the lines below read it), so the contract can answer.
5137
- const _sr = await fetch(C && C.environment === 'UK' ? '/api/uk-shapes' : '/api/aisc-shapes');
5181
+ const _sr = await fetch(SteelEnv.traitsFor(C && C.environment).shapesPath);
5138
5182
  if (!_sr.ok) throw new Error('HTTP ' + _sr.status);
5139
5183
  const _sj = await _sr.json();
5140
5184
  if (!_sj.weights || typeof _sj.weights !== 'object' || !_sj.sections || typeof _sj.sections !== 'object') throw new Error('payload missing weights/sections');
@@ -5143,6 +5187,9 @@ async function boot() {
5143
5187
  window.__STEEL_SECTIONS = _sj.sections;
5144
5188
  window.__STEEL_PROFILE_CATALOG = _sj.catalog;
5145
5189
  window.__STEEL_MATERIAL_CATALOG = _sj.materials;
5190
+ // Spellings that stand on a default the drawing did not state (EU `RHS`/`SHS` -> cold-formed), with the label for each.
5191
+ // Absent from the US and UK payloads, which have none.
5192
+ window.__STEEL_ASSUMED = _sj.assumed && typeof _sj.assumed === 'object' ? _sj.assumed : {};
5146
5193
  } catch (e) {
5147
5194
  window.__STEEL_CATALOG_LOAD_FAILED = true;
5148
5195
  bumpRfiEpoch(); // …and the failure is a change of answer too, not an absence of one
@@ -5683,7 +5730,7 @@ function aiNoteText(item,marks,wrote){
5683
5730
  switch(item.channel){
5684
5731
  case'filter':return'The Drawing Filter (which sheets and areas the read used) was chosen by the AI'+chosen+'. Every member rests on that choice.';
5685
5732
  case'scope':return'The drawing set was too large to read at once, so the AI chose which files to read'+chosen+'. The model covers only those files.';
5686
- case'setup-origin':return'The model origin was chosen by the AI'+chosen+'. Every member’s position rests on it.';
5733
+ case'setup-origin':return'The model origin was chosen by the AI'+chosen+'. '+(item.rule?item.rule+' ':'')+'Every member’s position rests on it.';
5687
5734
  case'audit-gap':return'The AI settled a question the drawings left open'+chosen+'.';
5688
5735
  case'unmodelled-detail':return'The AI left a detail unmodelled'+chosen+'.';
5689
5736
  case'connection':return'The AI assumed a connection FloLess cannot place on a member now'+chosen+'.';
@@ -5885,19 +5932,32 @@ function aiReviewsRefresh(){
5885
5932
  started is applied, so an older answer arriving last never offers again what was just recorded. */
5886
5933
  let mpLoadSeq=0;
5887
5934
  const MP_REFRESH_FAILED='FloLess could not refresh the list just now, so it may still show some that are already reviewed. Close and reopen Make precise to see the latest.';
5935
+ // The latest read also settles the note a stale Read the rest left (state.restNote), and lets go of the panel the press
5936
+ // held for it: whichever read that is, so the press never has to tell which read landed.
5937
+ function mpRestSettle(state,phase){
5938
+ const n=state.restNote;if(!n)return;
5939
+ if(phase)n.phase=phase;
5940
+ if(n.holds){n.holds=false;state.busy=false;}
5941
+ }
5888
5942
  async function mpLoad(keepLive){
5889
5943
  const state=makePrecise;if(!state||!PROJECT)return;
5890
5944
  const seq=++mpLoadSeq;
5891
5945
  try{
5892
- const d=await mpRead();if(makePrecise!==state||seq!==mpLoadSeq)return;
5946
+ const d=await mpRead();if(makePrecise!==state){mpRestSettle(state);return;}if(seq!==mpLoadSeq)return;
5893
5947
  mpAdopt(d);state.review=d;state.status='ready';if(!keepLive)state.live='';
5948
+ mpRestSettle(state,'shown');
5894
5949
  const ids=new Set(d.groups.flatMap(g=>g.items.map(c=>c.decisionId)));for(const id of [...state.changed])if(!ids.has(id))state.changed.delete(id);
5895
5950
  }catch(e){
5896
- if(makePrecise!==state||seq!==mpLoadSeq)return;
5951
+ if(makePrecise!==state){mpRestSettle(state);return;}if(seq!==mpLoadSeq)return;
5897
5952
  console.warn('make precise: could not read the AI decisions',String(e&&e.message||e));
5953
+ // While the note is up it says the list could not be refreshed, once; the live line only takes back its promise.
5954
+ if(state.restNote){
5955
+ mpRestSettle(state,'failed');
5956
+ if(keepLive&&state.live)state.live=state.live.replace(/ ?The list now shows what is still to review\.$/,'');
5957
+ }
5898
5958
  // What the confirm said stays (it may be that FloLess cannot tell what was recorded); only its promise that the
5899
5959
  // list shows the latest is taken back.
5900
- if(state.review){
5960
+ else if(state.review){
5901
5961
  const said=keepLive&&state.live&&!state.live.endsWith(MP_REFRESH_FAILED)?state.live.replace(/ ?The list now shows what is still to review\.$/,''):'';
5902
5962
  state.live=keepLive&&state.live.endsWith(MP_REFRESH_FAILED)?state.live:(said?said+' ':'')+MP_REFRESH_FAILED;
5903
5963
  }
@@ -5917,9 +5977,12 @@ function openMakePrecise(){
5917
5977
  makePrecise={status:'loading',review:null,live:'',busy:false,changed:new Set(),arm:null,armTimer:0,limits:{},focus:{key:'title'},mark:null};
5918
5978
  render();mpLoad();
5919
5979
  }
5980
+ window.openMakePrecise=openMakePrecise; // the header's Part of the set chip (paintCoverageStat) opens it from another scope
5920
5981
  function closeMakePrecise(){
5921
5982
  if(!makePrecise)return;clearTimeout(makePrecise.armTimer);makePrecise=null;render();
5922
- (document.getElementById('aiPreciseB')||moreBtn).focus();
5983
+ // Back where it was opened from: the strip's button, else the Part of the set chip once the review is done.
5984
+ const chip=document.getElementById('coverageStat'),chipOpens=chip&&chip.getAttribute('role')==='button'&&chip.style.display!=='none';
5985
+ (document.getElementById('aiPreciseB')||(chipOpens?chip:null)||moreBtn).focus();
5923
5986
  }
5924
5987
  /* The chat UI session cookie the confirm route asks for. Minted once; asked again once if it expired. */
5925
5988
  function mpSession(){
@@ -6000,7 +6063,9 @@ async function mpConfirm(items){
6000
6063
  ...(items.every(c=>c.outcome==='changed')?{changed:true}:{})});
6001
6064
  if(differently){state.mark=null;state.focus={after:[...rest,...after]};await mpLoad(true);return;}
6002
6065
  if(conflict){
6003
- state.review=d.review;for(const id of d.changed||[])state.changed.add(id);
6066
+ // A conflict's review carries the decisions only: Files left for later is the same model's, so it stays until the next load.
6067
+ state.review=d.review&&!d.review.readRest&&state.review&&state.review.readRest?{...d.review,readRest:state.review.readRest}:d.review;
6068
+ for(const id of d.changed||[])state.changed.add(id);
6004
6069
  state.focus={after:[...(d.changed||[]),...rest,...after]};render();return;
6005
6070
  }
6006
6071
  // Focus: after a full confirm the next one to review; otherwise the first one this confirm did not record.
@@ -6058,11 +6123,150 @@ function mpWhereToChange(c){
6058
6123
  default:return'Change it in the model here in the editor, or read the drawings again from Attach revised drawings in the workspace.';
6059
6124
  }
6060
6125
  }
6126
+ /* #2554 slice 2b: Read the rest. What the model left for later (`review.readRest`, server-owned) and the control that
6127
+ queues a read of it from the project's own stored copies. One read takes up to `max` files; the person picks Precise or
6128
+ Quick as on any read. Every warning names what is wrong and what to do; nothing here refuses. */
6129
+ const MP_REST_ATTACH='Attach them again with Attach revised drawings in the workspace.';
6130
+ const mpRestIds=x=>x.version+':'+x.files.map(f=>f.sha256).join(','); // one offer: the version and its files, in order
6131
+ function mpRestState(state){
6132
+ const r=state.review&&state.review.readRest;if(!r||!Array.isArray(r.files))return null;
6133
+ if(!state.rest||state.rest.src!==r){
6134
+ // A refresh of the same offer keeps what the person did; a new one (another read published since) starts afresh, so
6135
+ // an old "queued" or warning never hides the files that are left now.
6136
+ const old=state.rest&&mpRestIds(state.rest.src)===mpRestIds(r)?state.rest:null,keep=old&&old.chosen?new Set(r.files.map(f=>f.sha256).filter(s=>old.chosen.has(s))):null;
6137
+ state.rest={src:r,chosen:keep&&keep.size?keep:new Set(r.files.slice(0,r.max).map(f=>f.sha256)),mode:state.rest?state.rest.mode:'precise',open:!!(state.rest&&state.rest.open),
6138
+ msg:old?old.msg:'',msgKind:old?old.msgKind:'',missing:old?old.missing:[],queued:old?old.queued:null,cap:false};
6139
+ }
6140
+ return state.rest;
6141
+ }
6142
+ // After a stale answer: why nothing was queued, and where the refresh stands (refreshing, shown, failed).
6143
+ function mpRestNoteText(state){
6144
+ const n=state.restNote,why='The model changed since this panel opened, so nothing was queued.';if(!n)return'';
6145
+ const r=state.review&&state.review.readRest,left=!!(r&&Array.isArray(r.files)&&r.files.length);
6146
+ return why+' '+(n.phase==='refreshing'?'FloLess is refreshing the files left for later.':n.phase==='failed'?MP_REFRESH_FAILED
6147
+ :left?'Files left for later now shows what is left to read.':'Every file is read now, so nothing is left for later.');
6148
+ }
6149
+ const mpRestNames=names=>names.length<=3?names.join(', ').replace(/, ([^,]*)$/,' and $1'):names.slice(0,3).join(', ')+' and '+(names.length-3)+' more';
6150
+ function mpRestHtml(state){
6151
+ const r=state.review.readRest,rs=mpRestState(state);if(!rs)return'';
6152
+ const dis=state.busy||rs.busy?' disabled':'',n=r.files.length,s=k=>k===1?'':'s';
6153
+ let h='';
6154
+ if(r.unknown)h+=`<div class=mp-banner role=note>FloLess cannot tell every drawing file this model left out${n?', so it can name only these '+n:''}. ${esc(MP_REST_ATTACH)}</div>`;
6155
+ if(!n)return h;
6156
+ if(r.version==null){
6157
+ if(r.noVersion==='unreadable'){
6158
+ h+=`<div class=mp-banner role=note>FloLess could not read this project’s saved versions just now, so it can’t read the stored copies yet. Nothing is lost; try again in a moment.</div>`
6159
+ +`<div class=mp-rest-acts><button type=button class=ghost data-mp-rest-retry data-mp-key=rest-retry data-command-id="steel.make-precise-read-rest-retry"${dis}>Try again</button></div>`;
6160
+ return h;
6161
+ }
6162
+ h+=`<div class=mp-banner role=note>${r.noVersion==='changed'?'This model’s list of files left for later differs from its newest saved version':'No saved version of this model holds these files yet'}, so FloLess can read its stored copies once the model is published. ${esc(MP_REST_ATTACH)}</div>`;
6163
+ return h;
6164
+ }
6165
+ if(rs.queued){
6166
+ h+=`<div class=hint role=status>${esc(rs.queued)}</div>`;
6167
+ return h;
6168
+ }
6169
+ const chosen=r.files.filter(f=>rs.chosen.has(f.sha256)),k=chosen.length,isDefault=k===Math.min(n,r.max)&&r.files.slice(0,r.max).every(f=>rs.chosen.has(f.sha256));
6170
+ const label=!k?'Read the rest':isDefault?(n>r.max?`Read the rest (${r.max} of ${n})`:`Read the rest (${n} file${s(n)})`):`Read ${k} chosen file${s(k)}`;
6171
+ const mode=m=>`<label class=mp-rest-mode><input type=radio name=mpRestMode value=${esc(m)} data-mp-rest-mode=${esc(m)} data-mp-key="rm:${esc(m)}" data-command-id="steel.make-precise-read-rest-mode#${esc(m)}" data-command-instance-label="${m==='quick'?'Quick':'Precise'}"${rs.mode===m?' checked':''}${dis}> ${m==='quick'?'Quick: faster. The model is labelled Quick model until you review its AI decisions.':'Precise: takes longer; the read asks you where the drawings leave something open.'}</label>`;
6172
+ h+=`<div class=mp-rest role=group aria-label="Read the files left for later">`;
6173
+ h+=`<div class=mp-rest-modes role=radiogroup aria-label="Read as"><span class=hint>Read as</span>${mode('precise')}${mode('quick')}</div>`;
6174
+ if(rs.msg)h+=`<div class="${rs.msgKind==='alert'?'mp-banner':'hint'}" role=${rs.msgKind==='alert'?'alert':'status'}>${esc(rs.msg)}</div>`;
6175
+ h+=`<div class=mp-rest-acts><button type=button class=mp-yes data-mp-rest-go data-mp-key=rest data-command-id="steel.make-precise-read-rest" data-tip="Queue one drawing read of these files, from the copies saved with the project"${!k?' disabled':dis}>${esc(label)}</button>`;
6176
+ if(n>1)h+=`<button type=button class=ghost data-mp-rest-choose data-mp-key=rest-choose data-command-id="steel.make-precise-read-rest-choose" aria-expanded="${rs.open}" aria-controls=mpRestList${dis}>${rs.open?'Hide files':'Choose files'}</button>`;
6177
+ h+='</div>';
6178
+ if(!k)h+='<div class=hint>Choose at least one file.</div>';
6179
+ if(rs.open&&n>1){
6180
+ h+=`<div class=mp-rest-head><span class=hint>${k} of ${n} chosen${n>r.max?' · one read takes up to '+r.max:''}</span><span class=mp-arm><button type=button class=ghost data-mp-rest-first data-mp-key=rest-first data-command-id="steel.make-precise-read-rest-first"${dis}>First ${Math.min(n,r.max)}</button><button type=button class=ghost data-mp-rest-clear data-mp-key=rest-clear data-command-id="steel.make-precise-read-rest-clear"${dis}>Clear</button></span></div>`;
6181
+ if(rs.cap)h+=`<div class=hint role=note>${r.max} is the most one read takes. The rest stay for another read.</div>`;
6182
+ h+=`<div class=mp-rest-list id=mpRestList role=group aria-label="Files to read">`;
6183
+ for(const f of r.files){
6184
+ const miss=rs.missing.includes(f.sha256);
6185
+ h+=`<label class=mp-rest-file><input type=checkbox data-mp-rest-file="${esc(f.sha256)}" data-mp-key="rf:${esc(f.sha256)}" data-command-id="steel.make-precise-read-rest-file#${esc(f.sha256)}" data-command-instance-label="${esc(f.name)}"${rs.chosen.has(f.sha256)?' checked':''}${dis}> <span>${esc(f.name)}</span>${miss?' <span class="chip assumed">Copy missing</span>':''}</label>`;
6186
+ }
6187
+ h+='</div>';
6188
+ }
6189
+ h+='</div>';
6190
+ return h;
6191
+ }
6192
+ function mpRestWire(p,state){
6193
+ const rs=state.rest,r=state.review&&state.review.readRest;if(!rs||!r)return;
6194
+ p.querySelector('[data-mp-rest-go]')?.addEventListener('click',()=>mpRestQueue(state));
6195
+ p.querySelector('[data-mp-rest-retry]')?.addEventListener('click',()=>{state.live='Reading the saved versions again…';state.focus={key:'title'};panel();mpLoad(true);});
6196
+ p.querySelector('[data-mp-rest-choose]')?.addEventListener('click',()=>{rs.open=!rs.open;state.focus={key:'rest-choose'};panel();});
6197
+ p.querySelector('[data-mp-rest-first]')?.addEventListener('click',()=>{rs.chosen=new Set(r.files.slice(0,r.max).map(f=>f.sha256));rs.cap=false;state.focus={key:'rest-first'};panel();});
6198
+ p.querySelector('[data-mp-rest-clear]')?.addEventListener('click',()=>{rs.chosen=new Set();rs.cap=false;state.focus={key:'rest-clear'};panel();});
6199
+ for(const b of p.querySelectorAll('[data-mp-rest-mode]'))b.addEventListener('change',()=>{if(b.checked){rs.mode=b.dataset.mpRestMode==='quick'?'quick':'precise';state.focus={key:'rm:'+rs.mode};}});
6200
+ for(const c of p.querySelectorAll('[data-mp-rest-file]'))c.addEventListener('change',()=>{
6201
+ const sha=c.dataset.mpRestFile;rs.cap=false;
6202
+ if(c.checked){if(rs.chosen.size>=r.max){rs.cap=true;}else rs.chosen.add(sha);}else rs.chosen.delete(sha);
6203
+ state.focus={key:'rf:'+sha};panel();
6204
+ });
6205
+ }
6206
+ async function mpRestQueue(state){
6207
+ const r0=state.rest,r=state.review&&state.review.readRest;if(!r0||!r||r0.busy||state.busy||r.version==null)return;
6208
+ const files=r.files.filter(f=>r0.chosen.has(f.sha256)).map(f=>f.sha256);if(!files.length)return;
6209
+ const isDefault=files.length===Math.min(r.files.length,r.max)&&r.files.slice(0,r.max).every(f=>r0.chosen.has(f.sha256));
6210
+ // The whole panel waits with it (state.busy), so no confirm or refresh rebuilds the offer under a read being queued.
6211
+ r0.busy=true;state.busy=true;r0.msg='';state.restNote=null;state.live='Queuing a read of '+files.length+' file'+(files.length===1?'':'s')+'…';state.focus={key:'rest'};panel();
6212
+ let res=null,body=null;
6213
+ try{
6214
+ res=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/revision-requests',{method:'POST',headers:{'content-type':'application/json'},credentials:'same-origin',
6215
+ body:JSON.stringify({fromCoverage:{version:r.version,...(isDefault?{}:{files})},buildMode:r0.mode})});
6216
+ body=await res.json().catch(()=>null);
6217
+ }catch(e){console.warn('make precise: could not queue Read the rest',String(e&&e.message||e));}
6218
+ r0.busy=false;state.busy=false;if(makePrecise!==state)return;
6219
+ // The answer belongs to the offer that was sent. A refresh that landed meanwhile with another offer keeps its own
6220
+ // controls; the answer is said on the panel's line instead, so it never hides files that are left now.
6221
+ const cur=state.rest,same=!!cur&&mpRestIds(cur.src)===mpRestIds(r);if(cur)cur.busy=false;
6222
+ const rs=same?cur:{...r0,chosen:new Set(r0.chosen)};
6223
+ const left=r.files.length-files.length,moved=' The list of files left for later has changed since; check it before reading more.';
6224
+ if(res&&res.ok&&body&&body.ok){
6225
+ const asked=body.buildModeNotice?' '+body.buildModeNotice:'';
6226
+ rs.queued='A read of '+files.length+' file'+(files.length===1?' is':'s is')+' queued'+(rs.mode==='quick'&&!body.buildModeNotice?' as Quick':'')+'. It waits in Requests until the AI chat reads it, and the review comes back to you there.'+(left?' '+left+' file'+(left===1?' stays':'s stay')+' left for later.':'')+asked;
6227
+ state.live=same?'':rs.queued+moved;state.focus={key:'title'};panel();return; // same offer: the section says it (role=status), once
6228
+ }
6229
+ const code=body&&body.code;
6230
+ // The server's own words, as a sentence: some routes answer in a lower-case fragment with no full stop.
6231
+ const said=body&&typeof body.error==='string'?(t=>(t.charAt(0).toUpperCase()+t.slice(1))+(/[.!?]$/.test(t)?'':'.'))(body.error.trim()):'';
6232
+ if(!said){
6233
+ // No answer FloLess can read: the read may or may not have been queued, so it says exactly that.
6234
+ rs.msg='FloLess could not confirm whether the read was queued. Open Requests in the workspace to check before pressing Read the rest again.';rs.msgKind='alert';
6235
+ }else if(code==='read-rest-file-missing'&&Array.isArray(body.files)){
6236
+ rs.missing=body.files.map(f=>f.sha256);for(const m of rs.missing)rs.chosen.delete(m);rs.open=true;
6237
+ const others=r.files.filter(f=>rs.chosen.has(f.sha256)).length;
6238
+ rs.msg=said+(others?' The other '+others+' are still chosen; press '+(others===1?'Read 1 chosen file':'Read '+others+' chosen files')+' to read them now.':'');rs.msgKind='note';
6239
+ }else if(code==='read-rest-stale'){
6240
+ // Another read published since the panel opened: say why nothing was queued, and refresh. The note is its own state,
6241
+ // and the list read that lands settles it (mpLoad), so nothing here edits words another read may have written. The
6242
+ // panel stays held until that read lets go (mpRestSettle), so a second press cannot start another under it.
6243
+ state.restNote={phase:'refreshing',holds:true};state.live='';state.busy=true;state.focus={key:'rest-note'};panel();
6244
+ mpLoad(true);
6245
+ return;
6246
+ }else if(code==='revision-read-active'){
6247
+ // The server says which: still running, waiting for the person's review, or a failed read to clear first.
6248
+ rs.msg=said+' Open Requests in the workspace to see it; Read the rest is here when it is done.';rs.msgKind='note';
6249
+ }else{
6250
+ rs.msg=said;rs.msgKind='alert';
6251
+ }
6252
+ state.live=same?'':rs.msg+moved;state.focus={key:'rest'};panel(); // same offer: said in the section, as a status or an alert
6253
+ }
6254
+ /* The block on its own, when no Files read decision is left to review: what is still not read, and Read the rest. */
6255
+ function mpRestSection(state){
6256
+ const r=state.review&&state.review.readRest;if(!r)return'';
6257
+ const sentence=mpRestSentence(r);
6258
+ return`<section class="mer-group mp-group" aria-labelledby=mpGRest><div class=mp-ghead><h3 class=mp-gtitle id=mpGRest>Files left for later</h3></div>${sentence?`<p class=mp-cons>${esc(sentence)}</p>`:''}${mpRestHtml(state)}</section>`;
6259
+ }
6260
+ function mpRestSentence(r){
6261
+ const names=(r.files||[]).map(f=>f.name);if(!names.length)return'';
6262
+ return'This model has not read '+mpRestNames(names)+(r.unknown?', and FloLess cannot name every file it left out':'')+'. A later read of these files adds them to the model.';
6263
+ }
6061
6264
  function renderMakePrecisePanel(p){
6062
6265
  const state=makePrecise,review=state.review,prog=review&&review.progress;
6063
6266
  // The rebuild replaces every node: keep focus, the list's scroll and each open "Why?".
6064
6267
  const active=document.activeElement,keepKey=active&&p.contains(active)?active.getAttribute('data-mp-key'):null;
6065
6268
  const oldList=p.querySelector('#mpList'),keepScroll=oldList?oldList.scrollTop:0;
6269
+ const oldRest=p.querySelector('#mpRestList'),keepRestScroll=oldRest?oldRest.scrollTop:0;
6066
6270
  const openWhy=new Set([...p.querySelectorAll('details.mp-why[open]')].map(x=>x.dataset.mpId));
6067
6271
  p.setAttribute('aria-busy',String(!!state.busy));p.setAttribute('aria-labelledby','mpTitle');
6068
6272
  const dis=state.busy?' disabled':'',s=n=>n===1?'':'s';
@@ -6073,11 +6277,13 @@ function renderMakePrecisePanel(p){
6073
6277
  if(state.status==='loading')html+='<div class=mer-empty role=status>Reading the AI decisions…</div>';
6074
6278
  else if(state.status==='error')html+=`<div class=mer-empty>FloLess could not read the AI decisions just now. Your model is unchanged.<div class=mer-toolbar><button id=mpRetry data-mp-key=retry data-command-id="steel.make-precise-retry" class=ghost>Try again</button></div></div>`;
6075
6279
  else if(!prog.remaining){
6076
- html+=`<div class=mp-done id=mpDoneMsg tabindex=-1 data-mp-key=done-msg><b>${prog.total?(prog.total===1?'The AI decision is reviewed.':'All '+prog.total+' AI decisions are reviewed.'):'This model rests on no AI decision.'}</b> This model is no longer labelled Quick model.<div class=hint>Reviewing records your look at each decision. It does not verify the model.</div></div>`;
6280
+ html+=`<div class=mp-done id=mpDoneMsg tabindex=-1 data-mp-key=done-msg><b>${prog.total?(prog.total===1?'The AI decision is reviewed.':'All '+prog.total+' AI decisions are reviewed.'):'This model rests on no AI decision.'}</b> This model is no longer labelled Quick model.<div class=hint>Reviewing records your look at each decision. It does not verify the model.${review.readRest?' It does not read the files left for later either, so the model still says it is part of the set.':''}</div></div>`;
6281
+ if(review.readRest)html+=mpRestSection(state);
6077
6282
  }else{
6078
6283
  if(review.record==='unreadable')html+='<div class=mp-banner role=note>The review record can’t be read, so nothing can be marked reviewed yet. Your model is unchanged.</div>';
6079
6284
  else if(review.record==='absent')html+='<div class=mp-banner role=note>FloLess has no record of how the AI made these decisions, so they can’t be confirmed here, and the model stays a Quick model while it rests on them. Reading the drawings again records them.</div>';
6080
6285
  html+='<div class=mer-list id=mpList>';
6286
+ if(review.readRest&&!review.groups.some(g=>g.id==='scope'))html+=mpRestSection(state); // the choice is reviewed; the files are still not read
6081
6287
  review.groups.forEach((g,gi)=>{
6082
6288
  const items=g.items.slice(0,mpShownIn(g)),hidden=g.items.length-items.length;
6083
6289
  const can=g.items.filter(c=>c.confirmable),gk=esc(g.id),gl=esc(g.title);
@@ -6091,6 +6297,7 @@ function renderMakePrecisePanel(p){
6091
6297
  }
6092
6298
  html+=`<section class="mer-group mp-group" aria-labelledby="mpG${gi}"><div class=mp-ghead><h3 class=mp-gtitle id="mpG${gi}">${gl} <span class=mp-gcount>· ${g.items.length} to review</span></h3>${act}</div>`;
6093
6299
  if(g.consequence)html+=`<p class=mp-cons>${esc(g.consequence)}</p>`;
6300
+ if(g.id==='scope'&&review.readRest)html+=mpRestHtml(state);
6094
6301
  for(const c of items){
6095
6302
  const which=twin.get(c.decisionId)||'';
6096
6303
  const id=esc(c.decisionId),changed=state.changed.has(c.decisionId),q0=c.question||c.chosen||'An AI decision';
@@ -6132,6 +6339,7 @@ function renderMakePrecisePanel(p){
6132
6339
  });
6133
6340
  html+='</div>';
6134
6341
  }
6342
+ if(state.restNote)html+=`<div class=mer-live id=mpRestNote role=status tabindex=-1 data-mp-key=rest-note>${esc(mpRestNoteText(state))}</div>`;
6135
6343
  html+=`<div class=mer-live id=mpLive role=status aria-live=polite>${esc(state.live||'')}</div>`;
6136
6344
  p.innerHTML=html;
6137
6345
  const card=id=>mpCards().find(c=>c.decisionId===id),group=id=>review&&review.groups.find(g=>g.id===id);
@@ -6182,6 +6390,7 @@ function renderMakePrecisePanel(p){
6182
6390
  };
6183
6391
  for(const b of p.querySelectorAll('[data-mp-all-yes]'))b.onclick=()=>{const g=group(b.dataset.mpAllYes);if(g)mpConfirm(g.items.filter(c=>c.confirmable));};
6184
6392
  for(const b of p.querySelectorAll('[data-mp-all-no]'))b.onclick=()=>{clearTimeout(state.armTimer);state.arm=null;state.focus={key:'all:'+b.dataset.mpAllNo};panel();};
6393
+ if(review&&review.readRest)mpRestWire(p,state);
6185
6394
  const list=p.querySelector('#mpList');if(list)list.scrollTop=keepScroll;
6186
6395
  const f=state.focus;state.focus=null;
6187
6396
  const byKey=k=>p.querySelector('[data-mp-key="'+CSS.escape(k)+'"]');
@@ -6190,12 +6399,15 @@ function renderMakePrecisePanel(p){
6190
6399
  else if(f&&f.key)el=byKey(f.key)||(f.orCard?p.querySelector('[data-mp-id="'+CSS.escape(f.orCard)+'"] summary'):null);
6191
6400
  else if(keepKey)el=byKey(keepKey);
6192
6401
  if(el)el.focus({preventScroll:!(f&&(f.after||f.orCard))});
6402
+ const restList=p.querySelector('#mpRestList');if(restList)restList.scrollTop=keepRestScroll;
6193
6403
  }
6194
6404
  const newModelId=()=>`m-v2-${Date.now().toString(36)}-${(v2IdSeq++).toString(36)}`;
6195
6405
  V2_SESSION=V2Commands.createV2CommandSession(C,{
6196
6406
  validate:doc=>V2Validation.validateClientSteelModelV2(doc,V2_SCHEMA),
6197
6407
  mintId:newModelId,
6198
6408
  resolveSection:m=>{const d=profileDimsIn(m&&m.profile);return d?{...d,units:'in'}:null;},
6409
+ // The merge compares sources by effective grade: the environment's default, hollow by catalogue row (EU-0b, #3199).
6410
+ defaultMaterial:p=>profileDefaultMaterial(p),
6199
6411
  // This re-points P after EVERY commit. During ?selftest=1 it must not: the guard swapped P for a CLONE
6200
6412
  // so its fixtures cannot touch the live projection, and re-pointing would hand the live one back on the
6201
6413
  // first commit — after which every `P.members=[…]` fixture writes straight into it and the restore,
@@ -6430,7 +6642,7 @@ async function scanMemberEnds(liveMessage,pinnedScope){ // pinnedScope: re-che
6430
6642
  if(!d.report.findings.length){memberEndReview=null;memberEndGhostSync();memberEndScan={busy:false,error:false,live:'No member ends are short of support centerlines.'};document.body.classList.remove('member-end-review');updateMemberEndStatus();panel();const settled=memberEndScan;if(b){b.classList.add('ok');b.textContent='No short member ends ✓';}setTimeout(()=>{if(memberEndScan===settled){memberEndScan=null;panel();}if(b)b.classList.remove('ok');updateMemberEndStatus();},1500);return;}
6431
6643
  const chosen=memberEndChoicesForReport(d.report,prior&&prior.chosen),selected=new Set();for(const f of d.report.findings){const key=memberEndKey(f);if(prior){if(prior.selected.has(key)&&f.classification==='needs-review'&&chosen.get(key)&&memberEndTargetEqual(chosen.get(key),prior.chosen.get(key)))selected.add(key);}else if(f.classification==='needs-review'&&f.targets&&f.targets.length===1&&!f.geometryOnly)selected.add(key);}
6432
6644
  memberEndScan=null;memberEndReview={report:d.report,scope,chosen,selected,focus:0,query:prior?prior.query||'':'',anchor:null,busy:false,undoToken:d.undo&&d.undo.token||null,undoDirection:d.undo&&d.undo.direction||null,live:typeof liveMessage==='string'?liveMessage:'Check each endpoint against its drawing or model evidence.'};document.body.classList.add('member-end-review');modelSelection.clearMembers();focusMemberEnd(0);memberEndGhostSync();updateMemberEndStatus();
6433
- }catch(e){memberEndReview=null;memberEndGhostSync();memberEndStatus={known:false,count:null,etag:null,revision:null,scopeSig:null};document.body.classList.remove('member-end-review');modelSelection.clearMembers();memberEndScan={busy:false,error:true,live:personErrorText(e,{action:'check member ends',retrySafe:true})};updateMemberEndStatus();panel();toast(memberEndScan.live);}
6645
+ }catch(e){memberEndReview=null;memberEndGhostSync();memberEndStatus={known:false,count:null,etag:null,revision:null,scopeSig:null};document.body.classList.remove('member-end-review');modelSelection.clearMembers();memberEndScan={busy:false,error:true,live:errorText(e,{action:'check member ends',retrySafe:true})};updateMemberEndStatus();panel();toast(memberEndScan.live);}
6434
6646
  }
6435
6647
  function closeMemberEndReview(){if(memberEndReview&&memberEndReview.busy){memberEndReview.live='Finish the current member-end action before closing.';panel();return;}memberEndReview=null;document.body.classList.remove('member-end-review');modelSelection.clearMembers();memberEndGhostSync();render();moreBtn.focus();}
6436
6648
  // Ends Apply would extend right now: ticked, still needing review, with a chosen support. The one thing closing the
@@ -6484,10 +6696,10 @@ function focusMemberEnd(index,opts){
6484
6696
  }
6485
6697
  function chooseMemberEndTarget(key,index){if(!memberEndReview||memberEndReview.busy)return;const f=memberEndReview.report.findings.find(x=>memberEndKey(x)===key);const t=f&&f.targets&&f.targets[index];if(!f||!t)return;memberEndReview.chosen.set(key,t);memberEndReview.selected.add(key);memberEndReview.live='Selected '+memberEndTargetName(t)+' for '+f.memberId+' end '+(f.end+1)+'.';panel();memberEndRepaint();}
6486
6698
  async function applyMemberEndSelection(){if(!memberEndReview||memberEndReview.busy)return;const selections=[];for(const f of memberEndReview.report.findings){const key=memberEndKey(f),target=memberEndReview.chosen.get(key);if(f.classification==='needs-review'&&memberEndReview.selected.has(key)&&target)selections.push({findingId:f.findingId,contextHash:f.contextHash,memberId:f.memberId,end:f.end,target});}if(!selections.length)return;
6487
- const review=memberEndReview;review.busy=true;review.live='Extending selected member ends…';panel();try{const d=await memberEndRequest('apply',{scope:review.scope,selections});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);const previousChosen=review.chosen;review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.selected.clear();review.chosen=memberEndChoicesForReport(d.report,previousChosen);review.busy=false;review.live='Extended '+selections.length+' member end'+(selections.length===1?'':'s')+' to support centerlines.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();undoToast(review.live,()=>undoMemberEndResolution());}catch(e){const said=personErrorText(e,{action:'extend those member ends',unsure:'Check member ends again to see what the model holds now.'});if(memberEndReview===review){review.busy=false;review.live=said;panel();}toast(said);}}
6488
- async function keepMemberEnd(f){if(!memberEndReview||memberEndReview.busy)return;const review=memberEndReview;review.busy=true;panel();try{const d=await memberEndRequest('keep-short',{scope:review.scope,findingId:f.findingId,contextHash:f.contextHash,memberId:f.memberId,end:f.end,reason:'other-reviewed'});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.selected.delete(memberEndKey(f));review.busy=false;review.live='Kept '+f.memberId+' end '+(f.end+1)+' short.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();}catch(e){if(memberEndReview===review){review.busy=false;review.live=personErrorText(e,{action:'keep this member end short',unsure:'Check member ends again to see what the model holds now.'});panel();}}}
6489
- async function restoreMemberEnd(f){if(!memberEndReview||memberEndReview.busy)return;const review=memberEndReview;review.busy=true;panel();try{const d=await memberEndRequest('restore',{scope:review.scope,findingId:f.findingId,contextHash:f.contextHash,memberId:f.memberId,end:f.end});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.busy=false;review.live='Restored the traced endpoint for '+f.memberId+'.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();}catch(e){if(memberEndReview===review){review.busy=false;review.live=personErrorText(e,{action:'restore the traced endpoint',unsure:'Check member ends again to see what the model holds now.'});panel();}}}
6490
- async function undoMemberEndResolution(){if(!memberEndReview||memberEndReview.busy||!memberEndReview.undoToken)return;const review=memberEndReview,token=review.undoToken;review.busy=true;review.live='Updating member-end history…';panel();try{const d=await memberEndRequest('undo',{token});installMemberEndContract(d.contract,d.etag,d.storeRevision);const next=memberEndHistoryAction(d.direction),completed=d.direction==='redo'?'Undid member-end changes':'Redid member-end changes';review.busy=false;await scanMemberEnds(completed+' · '+next.label+' is available',review.scope);}catch(e){if(memberEndReview===review){review.busy=false;if(e.code==='member-end-undo-unavailable'){review.undoToken=null;review.undoDirection=null;review.live='This history action is no longer available. Check member ends again.';}else review.live='Could not confirm the history action. Check member ends again before retrying.';panel();}toast(personErrorText(e,{action:'update member-end history',unsure:'Check member ends again before retrying.'}));}}
6699
+ const review=memberEndReview;review.busy=true;review.live='Extending selected member ends…';panel();try{const d=await memberEndRequest('apply',{scope:review.scope,selections});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);const previousChosen=review.chosen;review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.selected.clear();review.chosen=memberEndChoicesForReport(d.report,previousChosen);review.busy=false;review.live='Extended '+selections.length+' member end'+(selections.length===1?'':'s')+' to support centerlines.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();undoToast(review.live,()=>undoMemberEndResolution());}catch(e){const said=errorText(e,{action:'extend those member ends',unsure:'Check member ends again to see what the model holds now.'});if(memberEndReview===review){review.busy=false;review.live=said;panel();}toast(said);}}
6700
+ async function keepMemberEnd(f){if(!memberEndReview||memberEndReview.busy)return;const review=memberEndReview;review.busy=true;panel();try{const d=await memberEndRequest('keep-short',{scope:review.scope,findingId:f.findingId,contextHash:f.contextHash,memberId:f.memberId,end:f.end,reason:'other-reviewed'});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.selected.delete(memberEndKey(f));review.busy=false;review.live='Kept '+f.memberId+' end '+(f.end+1)+' short.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();}catch(e){if(memberEndReview===review){review.busy=false;review.live=errorText(e,{action:'keep this member end short',unsure:'Check member ends again to see what the model holds now.'});panel();}}}
6701
+ async function restoreMemberEnd(f){if(!memberEndReview||memberEndReview.busy)return;const review=memberEndReview;review.busy=true;panel();try{const d=await memberEndRequest('restore',{scope:review.scope,findingId:f.findingId,contextHash:f.contextHash,memberId:f.memberId,end:f.end});installMemberEndContract(d.contract,d.etag,d.storeRevision);if(memberEndReview!==review)return scanMemberEnds(undefined,review.scope);review.report=d.report;review.undoToken=d.undoToken;review.undoDirection='undo';review.busy=false;review.live='Restored the traced endpoint for '+f.memberId+'.';memberEndStatus={known:true,count:memberEndUnresolved(d.report),etag:d.etag,revision:d.storeRevision,scopeSig:memberEndScopeSig(review.scope)};updateMemberEndStatus();panel();}catch(e){if(memberEndReview===review){review.busy=false;review.live=errorText(e,{action:'restore the traced endpoint',unsure:'Check member ends again to see what the model holds now.'});panel();}}}
6702
+ async function undoMemberEndResolution(){if(!memberEndReview||memberEndReview.busy||!memberEndReview.undoToken)return;const review=memberEndReview,token=review.undoToken;review.busy=true;review.live='Updating member-end history…';panel();try{const d=await memberEndRequest('undo',{token});installMemberEndContract(d.contract,d.etag,d.storeRevision);const next=memberEndHistoryAction(d.direction),completed=d.direction==='redo'?'Undid member-end changes':'Redid member-end changes';review.busy=false;await scanMemberEnds(completed+' · '+next.label+' is available',review.scope);}catch(e){if(memberEndReview===review){review.busy=false;if(e.code==='member-end-undo-unavailable'){review.undoToken=null;review.undoDirection=null;review.live='This history action is no longer available. Check member ends again.';}else review.live='Could not confirm the history action. Check member ends again before retrying.';panel();}toast(errorText(e,{action:'update member-end history',unsure:'Check member ends again before retrying.'}));}}
6491
6703
  // Selection is MODEL-WIDE, not per-sheet: the 3D shows every plan, so a pick / box-select / Ctrl-click can
6492
6704
  // span sheets. byId + selArr therefore search ALL plans (not just the active P) so the inspector + edits see
6493
6705
  // the whole selection — else selecting a roof (S-203) member while S-202 is active shows nothing, and a
@@ -6956,7 +7168,7 @@ function posHDefault(m){return SteelCore.effectiveWidthPosition(m.positionH);}
6956
7168
  // refusal the bake no longer makes: `partFrame`'s degenerate branch hands a plumb member the frame's own X
6957
7169
  // as its width axis (Tekla's column convention), so a plumb column or brace has a determinate left and
6958
7170
  // right after all. KEEP IN LOCK-STEP: the inspector must offer the control exactly where the bake honours it.
6959
- function posEligible(m,dimensions=profileDimsIn(m&&m.profile)){return dimensions!=null||!!(m&&m.section&&m.section.w>0&&m.section.d>0);}
7171
+ function posEligible(m,dimensions=memberDimsIn(m)){if(m&&typeof m.customSectionId==='string'&&CustomSections)return dimensions!=null;return dimensions!=null||!!(m&&m.section&&m.section.w>0&&m.section.d>0);}
6960
7172
  // Profile Position copy, in ONE place so the single- and multi-select panels cannot drift (they already
6961
7173
  // described the same control two different ways). Per-button tips, not one heading tip carrying
6962
7174
  // everything: with two axes under one heading the two "Middle" buttons sit adjacent, and each button
@@ -7022,11 +7234,11 @@ function posStored(m){
7022
7234
  */
7023
7235
  let posSecOpen=false; // survives the panel's innerHTML rebuild — module-scoped, like geoMode and picking
7024
7236
  function posSectionSvg(m){
7025
- const dims=profileDimsIn(m&&m.profile);
7026
- const sec=dims?{w:dims.w,d:dims.d}:((m&&m.section&&m.section.w>0&&m.section.d>0)?{w:m.section.w/25.4,d:m.section.d/25.4}:null);
7237
+ const dims=memberDimsIn(m);
7238
+ const sec=dims?{w:dims.w,d:dims.d}:((m&&!customOf(m)&&m.section&&m.section.w>0&&m.section.d>0)?{w:m.section.w/25.4,d:m.section.d/25.4}:null);
7027
7239
  if(!sec)return '';
7028
7240
  const round=!!(dims&&dims.round);
7029
- const local=sectionShapeComponents(m.profile,sec.w,sec.d,12,round),localAll=local.flat();
7241
+ const local=memberShapeComponents(m,sec.w,sec.d,12,round),localAll=local.flat();
7030
7242
  const ex={lo:[Math.min(...localAll.map(p=>p[0])),Math.min(...localAll.map(p=>p[1]))],hi:[Math.max(...localAll.map(p=>p[0])),Math.max(...localAll.map(p=>p[1]))]};
7031
7243
  const oy=SteelCore.faceOffset(posHDefault(m),ex.lo[0],ex.hi[0])+(+m.positionHOffset||0)/25.4;
7032
7244
  const oz=SteelCore.faceOffset(posDefault(m),ex.lo[1],ex.hi[1])+(+m.positionOffset||0)/25.4;
@@ -7096,6 +7308,8 @@ function refreshPositionFrameUI(){const s=positionAuthoringBasis(),frame=documen
7096
7308
  onPositionAuthoringBasisChange(refreshPositionFrameUI);
7097
7309
  function positionRefuse(message,source){const el=document.getElementById('posPositionStatus');if(el){el.style.display='block';el.style.border='1px solid var(--line)';el.style.borderRadius='6px';el.style.padding='7px 8px';el.textContent=message;}toast(message,false,5200);if(source&&source.focus)source.focus();return false;}
7098
7310
  function positionRebaseInput(m){const c=v2CanonicalMember(m.id),z0=c&&SteelCore.knownZ(c.from&&c.from.z),z1=c&&SteelCore.knownZ(c.to&&c.to.z);if(!c||z0==null||z1==null)return null;
7311
+ // Add-ons S1a: a custom section's extents come from its own outline in mm, as the export computes them.
7312
+ const cs=customOf(c);if(cs)return {canonical:c,from:[c.from.x,c.from.y,z0],to:[c.to.x,c.to.y,z1],extents:cs.usable&&cs.section?SteelCore.sectionExtents({outer:cs.section.outline}):null};
7099
7313
  const dims=profileDimsIn(c.profile),sec=dims?{w:dims.w*25.4,d:dims.d*25.4,round:!!dims.round}:((c.section&&c.section.w>0&&c.section.d>0)?{w:c.section.w,d:c.section.d,round:false}:null);
7100
7314
  const extents=sec?SteelCore.sectionExtents(SteelCore.outlineFor(c.profile,sec.w,sec.d,null,sec.round)):null;
7101
7315
  return {canonical:c,from:[c.from.x,c.from.y,z0],to:[c.to.x,c.to.y,z1],extents};}
@@ -7288,7 +7502,7 @@ function commitMemberEndpointsProvider(id,spec,source){
7288
7502
  // A column is stored base→top, and the model refuses one the other way round. Say so here, in words and
7289
7503
  // before the frame policy: dragging a plumb column's top below its base is ALSO a turn end for end, and
7290
7504
  // the column rule is the reason the user can act on.
7291
- if(input.canonical.role==='column'&&from[2]>to[2])return positionRefuse(COLUMN_ORDER_REFUSAL,source);
7505
+ if(input.canonical.role==='column'&&from[2]-to[2]>V2Validation.COLUMN_LEVEL_TOLERANCE_MM)return positionRefuse(COLUMN_ORDER_REFUSAL,source); // the model's own tolerance (#3208)
7292
7506
  // A gesture that moves the line RIGIDLY (the axial slide, and since the redesign the two lateral
7293
7507
  // translates) must merely KEEP partFrame's branch, in both directions; a swing re-aims the member and
7294
7508
  // has to land on the ordinary branch; the end-node drag may not ENTER the plumb cone, nor turn end for
@@ -7601,13 +7815,19 @@ function parseVec(s){s=String(s==null?'':s).trim();if(!s)return null;
7601
7815
  let defaultTosMm=0, addProfile='', addMaterial='', addType='beam'; // addProfile/addMaterial/addType are independent defaults for newly drawn members
7602
7816
  function nativeElevationModel(){return C&&C.type===MODEL_V2_TYPE;}
7603
7817
  function syncElevationContext(){const value=Number(P&&P.default_tos_mm);defaultTosMm=Number.isFinite(value)?value:0;return defaultTosMm;}
7818
+ // The registry's traits for THIS model's standard. An unstated or unregistered one resolves as the
7819
+ // compatibility fallback, exactly as `catalogProviderFor` does on the server. Nothing on this page
7820
+ // compares an environment id: it asks a trait (`web/steel-environments.js`). Declared HERE, ahead of
7821
+ // its first reader, because it is a `const` inside `main()` and `_catalogEnvironment` below runs at once.
7822
+ const _envTraits=()=>SteelEnv.traitsFor(typeof C!=='undefined'&&C?C.environment:undefined);
7823
+
7604
7824
  // THE MODEL'S OWN CATALOGUE NAMES THE EMPTY DESCRIPTOR, not a literal 'US'.
7605
7825
  //
7606
7826
  // When the fetch fails there are no rows either way — but the descriptor's `environment` is what names
7607
7827
  // the standard and picks the MATERIAL catalogue, so a UK project whose fetch failed presented American
7608
7828
  // grades (A992/A36) as if they were its own. An empty picker that says UK is an honest failure; a
7609
7829
  // populated one offering the wrong country's steel is a wrong answer wearing the right chrome.
7610
- const _catalogEnvironment=(typeof C!=='undefined'&&C&&C.environment==='UK')?'UK':'US';
7830
+ const _catalogEnvironment=_envTraits().id;
7611
7831
  const profileCatalog=window.__STEEL_PROFILE_CATALOG||{environment:_catalogEnvironment,standard:'Profile catalog',families:[],rows:[]};
7612
7832
  const profileCatalogRows=CatalogPicker.buildProfileRows(profileCatalog,window.__STEEL_SECTIONS||{},window.__STEEL_WEIGHTS||{});
7613
7833
  const materialCatalog=CatalogPicker.materialCatalogDescriptorFor(profileCatalog.environment||_catalogEnvironment,window.__STEEL_MATERIAL_CATALOG);
@@ -7630,8 +7850,11 @@ function profileCatalogValues(){return profileCatalogRows.flatMap(r=>[r.designat
7630
7850
  // S355J2H is the hot-finished hollow grade, S355 the modern default for open sections (S275 is the
7631
7851
  // legacy grade and is deliberately NOT the default).
7632
7852
  function profileDefaultMaterial(profile){const p=_canonDes(profile);
7633
- if(_modelEnvironment()==='UK')return /^(CHS|SHS|RHS|EHS)/.test(p)?'S355J2H':'S355';
7634
- return /^W\d/.test(p)?'A992':p.startsWith('HSS')?'A500-GR.B':'A36';}
7853
+ return SteelEnv.defaultGradeFor(_envTraits().id,p,_profileCatalogRow(profile));}
7854
+ // How the section was chosen when the drawing did not say (EU `RHS200*100*5` -> cold-formed KK, labelled by the
7855
+ // catalogue payload), or the reader's own account of a route the drawing DID state (`profileBasis`). '' for an
7856
+ // exact catalogue name and for every US/UK designation.
7857
+ function profileBasisText(m){return (m&&m.profileBasis)||(window.__STEEL_ASSUMED||{})[_canonDes(m&&m.profile)]||'';}
7635
7858
  function applyProfileChoice(ids,value){
7636
7859
  const v=_canonDes(value);if(!v)return;
7637
7860
  edit(()=>{for(const id of ids){const m=byId(id);if(m)ModelCmd.patchMember(m,{profile:v,rfi:_wtPlf(v)==null});}if(!profs.includes(v)){profs.push(v);profs.sort(CatalogPicker.naturalProfileCompare);}});
@@ -7694,7 +7917,7 @@ function snapshot(){
7694
7917
  // `library` is the FIRST key on purpose: prunePictures reads which pictures a step needs from the front of the string without parsing the whole model.
7695
7918
  // `marks` / `rootMarks` (#2211): the sheet's callouts, details and top-of-steel callouts and the root detail anchors, each
7696
7919
  // recorded as present-with-value or ABSENT, so undoing the first mark added to a sheet puts the missing key back.
7697
- return JSON.stringify({library:libraryPrints(),v2:true,members:C.members,provisional_members:C.provisional_members||[],grid:C.grid||null,plans:C.plans.map(p=>({id:p.id,sheet:p.sheet,dims:p.dims||[],memberRefs:p.memberRefs||[],memberObservations:p.memberObservations||[],...(Object.hasOwn(p,'frame')?{frame:p.frame||null}:{}),marks:V2Commands.captureAnnotations(p),datum_ref:p.datum_ref,control2_ref:p.control2_ref})),rootMarks:V2Commands.captureRootAnnotations(C),joints:C.joints||[],connections:C.connections||[],details:C.detail_placements||[],views:C.views||[],member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{},clips:window.Steel3DView?.clipState?.()??null,...(Array.isArray(C.reference_models)?{reference_models:C.reference_models}:{})});
7920
+ return JSON.stringify({library:libraryPrints(),v2:true,members:C.members,provisional_members:C.provisional_members||[],grid:C.grid||null,plans:C.plans.map(p=>({id:p.id,sheet:p.sheet,dims:p.dims||[],memberRefs:p.memberRefs||[],memberObservations:p.memberObservations||[],...(Object.hasOwn(p,'frame')?{frame:p.frame||null}:{}),marks:V2Commands.captureAnnotations(p),datum_ref:p.datum_ref,control2_ref:p.control2_ref})),rootMarks:V2Commands.captureRootAnnotations(C),customSections:V2Commands.captureCustomSections(C),joints:C.joints||[],connections:C.connections||[],details:C.detail_placements||[],views:C.views||[],member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{},clips:window.Steel3DView?.clipState?.()??null,...(Array.isArray(C.reference_models)?{reference_models:C.reference_models}:{})});
7698
7921
  }
7699
7922
  // Undo/redo is a SINGLE GLOBAL stack (not per-plane): snapshot() above captures EVERY plane's
7700
7923
  // members, so one whole-model stack is coherent — undo restores all planes at once, and a cross-
@@ -7892,7 +8115,7 @@ function sanitizeViews(arr){return ViewGen.sanitizeViews(arr);}
7892
8115
  // a refused save, or behind "Show my earlier edits" simply did not come back. The annotation roots the undo snapshot records
7893
8116
  // (`ANNOTATION_ROOT_KEYS`: the moment-frame schedule, detail bubbles) ride along by construction, so the next one added there
7894
8117
  // cannot be forgotten here (#2210 review). `reference_models` and `plans` are written below and restored by their own rules.
7895
- function draftRootKeys(){return ['members','grid','custom_details','profile_colors','member_styles','member_types','target_confidence','dims3d','dim_overlays','dim_style','prop_labels','joints','connections','detail_placements','views',...((V2Commands&&V2Commands.ANNOTATION_ROOT_KEYS)||[])];}
8118
+ function draftRootKeys(){return ['members','grid','custom_details','profile_colors','member_styles','member_types','target_confidence','dims3d','dim_overlays','dim_style','prop_labels','joints','connections','detail_placements','views',...((V2Commands&&V2Commands.CUSTOM_SECTION_ROOT_KEYS)||[]),...((V2Commands&&V2Commands.ANNOTATION_ROOT_KEYS)||[])];}
7896
8119
  // Set once the person changes or resets the "columns below a floor" setting on this page, or a restored draft carried a Reset.
7897
8120
  let reachTouched=false;
7898
8121
  function persist(){try{const draft={sig:dataSig(),baseEtag:serverEtag,ts:Date.now(),active:C.active};
@@ -8674,7 +8897,7 @@ function updUR(){document.getElementById('undoB').disabled=!undo.length;document
8674
8897
  // render() top so it tracks edits without touching every profs.push site.
8675
8898
  let colorRank=null; // the ProfileColours.profileColourContext of the last render
8676
8899
  const canonProfile=s=>ProfileColours.canonicalProfile(s);
8677
- function buildColorRank(){colorRank=ProfileColours.profileColourContext(C,WT,profileColourSpellings);} // rank + per-section member spellings, rebuilt per render (#2877)
8900
+ function buildColorRank(){refreshCustomLabels();customColourLabels=currentCustomLabels();colorRank=ProfileColours.profileColourContext(colourModelNow(),WT,editorColourSpellings());} // rank + per-section member spellings, rebuilt per render (#2877)
8678
8901
  // #2877: every spelling the editor's catalogue lists for a member's section, minus aliases that are another
8679
8902
  // section's own name (ProfileColours.catalogueSpellings, the same rule the scene bake applies to the server
8680
8903
  // catalogue), so a colour keyed `UC305X97` or `UC305*305*97` resolves identically in 2D, the Inspector, the
@@ -8685,8 +8908,12 @@ function profileColourSpellings(p){const k=String(p==null?'':p);if(_colourSpelli
8685
8908
  function colorFor(p){return ProfileColours.profileColour(p,C.profile_colors,colorRank,PAL,message=>console.warn('steel-editor: '+message));}
8686
8909
  // Removes every key a lookup for this section reads (its members' spellings, its catalogue spellings), from a
8687
8910
  // context built now so an edit since the last render cannot leave a stale spelling that outranks the new key.
8688
- function setProfileColour(profile,colour){ProfileColours.setCanonicalProfileColour(C.profile_colors,profile,colour,
8689
- ProfileColours.sectionSpellings(ProfileColours.profileColourContext(C,WT,profileColourSpellings),profile));}
8911
+ function setProfileColour(profile,colour){
8912
+ // A custom section not yet named by FloLess is shown under its stored designation; a colour saved under that would
8913
+ // be read by no 3D group or bill line once its name arrives, so it waits (add-ons S1a).
8914
+ if(customColourPending(profile)){refreshCustomLabels();toast('FloLess is still naming the custom sections in this model. Try the colour again in a moment.');return false;}
8915
+ ProfileColours.setCanonicalProfileColour(C.profile_colors,profile,colour,
8916
+ ProfileColours.sectionSpellings(ProfileColours.profileColourContext(colourModelNow(),WT,editorColourSpellings()),profile));return true;}
8690
8917
  // F5: per member-type 2D line style. Tokens → px; dashes chosen to avoid the reserved semantic patterns
8691
8918
  // (RFI 10 6, brace 30 8 6 8, grid 12 4 2 4). med+solid (or absent) = today's default (line.member stroke-width:6).
8692
8919
  const MS_W={thin:3,med:6,thick:9},MS_D={solid:'',dashed:'14 8',dotted:'2 8',dashdot:'18 7 3 7'};
@@ -8801,13 +9028,12 @@ function _profileDimIn(token){
8801
9028
  // `typeof C` rather than a bare `C`: these functions are sliced out of this page by the geometry
8802
9029
  // harnesses, where the contract is not in scope, and a bare reference is a ReferenceError there rather
8803
9030
  // than a falsy read. Absent means the compatibility fallback, exactly as it does on the server.
8804
- const _modelEnvironment=()=>(typeof C!=='undefined'&&C&&C.environment==='UK')?'UK':'US';
8805
- const _doubleAngleScale=()=>_modelEnvironment()==='UK'?1/IN_TO_MM:1;
9031
+ const _doubleAngleScale=()=>_envTraits().designationTokenUnit==='mm'?1/IN_TO_MM:1;
8806
9032
  // The name to CALL the section table when telling a user their designation is not in it. AISC is the
8807
9033
  // American Institute of Steel Construction, so saying "not in the AISC table" to someone modelling in
8808
9034
  // the UK names the wrong standards body about their own steel — and does it in the RFI list, the
8809
9035
  // confidence panel and the footprint tooltip, i.e. everywhere the tool explains a refusal.
8810
- const _catalogLabel=()=>_modelEnvironment()==='UK'?'UK section':'AISC';
9036
+ const _catalogLabel=()=>_envTraits().catalogueNoun;
8811
9037
  function _parseDoubleAngleIn(profile){
8812
9038
  const p=_canonDes(profile);if(!p.startsWith('2L'))return null;
8813
9039
  const orientation=p.endsWith('SLBB')?'slbb':p.endsWith('LLBB')?'llbb':null;
@@ -8853,7 +9079,7 @@ function profileDimsIn(profile){
8853
9079
  // Gated to a metric model deliberately: the US arms below already consult this same table where they
8854
9080
  // should, and reordering them is a behaviour change to shipped US drawing that this slice has twice
8855
9081
  // been caught making by accident.
8856
- if(_modelEnvironment()==='UK'){
9082
+ if(!_envTraits().aiscInchTable){
8857
9083
  // A SHAPE THE CATALOGUE REFUSES IS REFUSED HERE TOO. An elliptical hollow section (EHS) is marked
8858
9084
  // geometrySupported:false and the server answers 'unsupported-custom' with no drawable geometry —
8859
9085
  // but its row still carries a depth and a width, so falling through to the raw table below drew all
@@ -9125,7 +9351,8 @@ function positionAuthoringRoll(m){
9125
9351
  function columnSectionPoly(m){
9126
9352
  const wp=m&&m.wp;if(!wp||!wp.length)return null;
9127
9353
  const a=wp[0],b=wp[wp.length-1],cx=(a[0]+b[0])/2,cy=(a[1]+b[1])/2;
9128
- const ppf=(P&&P.mm_per_px>0)?ppfOf(P):0,dims=profileDimsIn(m.profile);
9354
+ // Add-ons S1a: a usable custom section is drawn from its own evaluated outline, never a catalogue row of the same name.
9355
+ const ppf=(P&&P.mm_per_px>0)?ppfOf(P):0,dims=memberDimsIn(m);
9129
9356
  // Both arms hand INCHES to the one conversion below. profileDimsIn already returns inches; the
9130
9357
  // reader's traced `section` is MILLIMETRES — contract-to-scene feeds those very numbers into a
9131
9358
  // scene declared `units:'mm'`, and the steel-takeoff skill tells readers to trace in mm. Neither
@@ -9149,7 +9376,7 @@ function columnSectionPoly(m){
9149
9376
  // registration angle). Applied raw here, as it was, the plan drew every section as the MIRROR of the
9150
9377
  // 3D solid and the export — see sectionOutlinePx for the measurement and the algebra.
9151
9378
  const xf=planRegistration(),rotN=positionEffectiveWorldRot(m),wPx=sec.w/12*ppf,dPx=sec.d/12*ppf;if(rotN==null)return null;
9152
- const localComponents=sectionShapeComponents(m.profile,wPx,dPx,ppf,dims&&dims.round);
9379
+ const localComponents=memberShapeComponents(m,wPx,dPx,ppf,dims&&dims.round);
9153
9380
  // A column now takes a Profile Position like every other member, so the FOOTPRINT has to move with it —
9154
9381
  // otherwise the plan draws the section centred on a work point the 3D and the export put it off.
9155
9382
  // The offset is built in the SAME local frame and the SAME px units as the outline and pushed through
@@ -9888,6 +10115,26 @@ function updGridToggle(){const b=document.getElementById('gridToggleB');if(!b)re
9888
10115
  // other grid operation.
9889
10116
  function gridSetVisible(on){if(!C||!gridOf()||on===gridOn())return;
9890
10117
  editGrid(()=>{ModelCmd.patchGrid(gridOf(),{on:!!on});});updGridToggle();refresh3DGrid();if(view3dShown)build3DLegend();} // a list drawn for 3D must reflect the grid change; the 2D list's key tracks the grid, so render() rebuilds that one
10118
+ // #3214 — the grid's levels in the 3D Objects list: one row per level, writing the same `hidden_z` the Grid lines…
10119
+ // panel ticks, named as the 3D tag names them. A level is SHOWN when the grid is on and the level is not hidden, so
10120
+ // a box never claims a level the model is not drawing. Fewer than two levels lists none: "Grid lines" says it all.
10121
+ function gridLegendLevels(){const gc=GC(),g=gridOf();if(!gc||!g||!GridDisplay)return[];
10122
+ const parsed=GridDisplay.readStoredLevels(g);if(parsed.err||parsed.levels.length<2)return[];
10123
+ const units=displayUnits(),hidden=new Set(gc.normalizeHiddenLevels(g.hidden_z,parsed.levels).map(gc.gridLevelKey));
10124
+ return parsed.levels.map(lv=>{const key=gc.gridLevelKey(lv.mm),name=GridDisplay.levelDisplayName(lv,units);
10125
+ return {mm:lv.mm,key,name,instance:name+' at '+GridDisplay.elevationText(lv.mm,units),hidden:hidden.has(key),shown:gridOn()&&!hidden.has(key)};});}
10126
+ function gridLegendState(levels){const n=levels.filter(l=>l.shown).length;return n===0?'off':(n===levels.length?'on':'mixed');}
10127
+ // One undoable edit, then the same repaint gridSetVisible does.
10128
+ function gridLegendPatch(patch){if(!C||!gridOf())return;editGrid(()=>{ModelCmd.patchGrid(gridOf(),patch);});updGridToggle();refresh3DGrid();if(view3dShown)build3DLegend();}
10129
+ // The whole grid on or off, and the level boxes choose WHICH levels: switching off writes only `on`, so switching on
10130
+ // again brings the same levels back. With no level chosen there is nothing to bring back, so on shows every level.
10131
+ function gridLegendToggleAll(levels){
10132
+ if(!levels.some(l=>!l.hidden)){gridLegendPatch({on:true,hidden_z:undefined});return;}
10133
+ gridLegendPatch({on:!gridOn()});}
10134
+ // One level. With the grid off, its box turns the grid on with just this level, so the click does what the box says.
10135
+ function gridLegendToggleLevel(lv,levels){
10136
+ if(!gridOn()){const others=levels.filter(l=>l.key!==lv.key).map(l=>l.mm);gridLegendPatch({on:true,hidden_z:others.length?others:undefined});return;}
10137
+ const hidden=levels.filter(l=>l.key===lv.key?!l.hidden:l.hidden).map(l=>l.mm);gridLegendPatch({hidden_z:hidden.length?hidden:undefined});}
9891
10138
  document.addEventListener('gridcore-ready',()=>{try{if(C)render();}catch(_){}}); // module shim finished after boot → paint the grid layer
9892
10139
  function reflectTakeoverButtons(){for(const [id,on] of [['gridEditB',gridMode],['dimStyleB',dimStyleMode],['csSetB',csaxisMode]]){const b=document.getElementById(id);if(b){b.classList.toggle('on',!!on);b.setAttribute('aria-pressed',String(!!on));}}}
9893
10140
  function setGridMode(on){if(!C)return;if(on&&!gridMode&&!memberEndYieldPanel('Grid lines',()=>{setGridMode(true);render();},'gridEditB'))return; // the member-end review gives way first, or asks (#1412)
@@ -10545,7 +10792,7 @@ function snapEndMulti(ms,tA,tB){const pv=snapshot();let n=0,skipped=0;
10545
10792
  for(const m of ms){
10546
10793
  if(isBrace(m)){skipped++;continue;} // extend/trim never moves a brace work point (it must stay on the column ℄) — matches doSplit
10547
10794
  const I=lineX(m.wp[0],m.wp[1],tA,tB);if(!I)continue;
10548
- const h=len(m.wp[0],I)<=len(m.wp[1],I)?0:1;mc.setEndpoint(m,h,I);ModelCmd.patchMember(m,{rfi:_wtPlf(m.profile)==null});n++;} // h is DATA — the end nearer the intersection
10795
+ const h=len(m.wp[0],I)<=len(m.wp[1],I)?0:1;mc.setEndpoint(m,h,I);ModelCmd.patchMember(m,{rfi:_memberPlf(m)==null});n++;} // h is DATA — the end nearer the intersection
10549
10796
  if(skipped)toast(n?(skipped+' brace'+(skipped>1?'s':'')+' skipped — braces can’t be extended/trimmed'):'Braces can’t be extended/trimmed — edit them in the Properties panel');
10550
10797
  if(n){pushUndo(pv);render();sync3D();}return n;}
10551
10798
  function doSplit(m,pt){if(isBrace(m)){toast('Braces can’t be split — edit them in the Properties panel');return;} // split/extend/trim disabled on braces (offset would create off-℄ WPs · Codex round-2)
@@ -10583,7 +10830,7 @@ function dupFoot(m){if(!m||!m.wp||m.wp.length<2)return null;const r=p=>Math.roun
10583
10830
  function dupElev(m){const q=v=>(typeof v==='number'&&isFinite(v))?Math.round(v/IN_TO_MM):null;
10584
10831
  const sig=(m&&m.role==='column')?[q(m.col&&m.col.tosMm),q(m.col&&m.col.bosMm)]:[q(m&&m.ends&&m.ends[0]&&m.ends[0].tosMm),q(m&&m.ends&&m.ends[1]&&m.ends[1].tosMm)];
10585
10832
  return sig.every(v=>v==null)?'na':sig.map(v=>v==null?'':v).join(':');}
10586
- function dupScore(m){let s=0;if(_wtPlf(m.profile)!=null)s+=2;if(m.profile&&!/^MF/i.test(m.profile))s+=1;return s;} // keep the most-resolved copy
10833
+ function dupScore(m){let s=0;if(_memberPlf(m)!=null)s+=2;if(m.profile&&!/^MF/i.test(m.profile))s+=1;return s;} // keep the most-resolved copy
10587
10834
  // Coincident-member dedupe → the redundant ids. Group by 2D footprint; within a footprint: ≤1 distinct EXPLICIT
10588
10835
  // elevation ⇒ all copies of one member ⇒ keep the best (highest rankFn; an elevation-tagged copy wins ties), rest
10589
10836
  // redundant; ≥2 explicit elevations ⇒ distinct levels ⇒ keep the best per level, unset copies kept (ambiguous).
@@ -10752,6 +10999,43 @@ function reviewSignedOff(jointId){
10752
10999
  already was "what kind of connection is this", and a second chip would make the row say two things.
10753
11000
  Amber only for needs-review: untracked keeps the neutral colours and changes only its leading word, so
10754
11001
  it is distinguishable on read without ever suggesting a fault. */
11002
+ /* #2303 slice A: the person's "AI-assisted connection" label switches (connection-display.json, its own revision).
11003
+ Read once on demand and again whenever the server says they changed; a failed read shows every label (the honest
11004
+ default), and a failed write says so and puts the box back. */
11005
+ let connDisplay={rev:0,model:'shown',joints:{}},connDisplayState='idle',connDisplayBusy=false,ccShowAllChecks=null;
11006
+ /* What a label switch said and where focus belongs, re-applied on each repaint for a moment: the scene refresh a switch
11007
+ starts repaints the panel again, and a repaint must not drop the person's focus or the announcement. */
11008
+ let ccAfterRender=null;
11009
+ // Kept until the person acts again (a click or a key elsewhere), however late the scene refresh's repaint lands.
11010
+ document.addEventListener('pointerdown',e=>{if(ccAfterRender&&!(e.target&&e.target.closest&&e.target.closest('#panel label.gck')))ccAfterRender=null;},true);
11011
+ document.addEventListener('keydown',e=>{if(ccAfterRender&&e.key!=='Tab'&&!(e.target&&e.target.closest&&e.target.closest('#panel label.gck')))ccAfterRender=null;},true);
11012
+ async function loadConnectionDisplay(){
11013
+ if(!PROJECT)return;
11014
+ connDisplayState='loading';
11015
+ try{const r=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/connection-display');const d=await r.json();
11016
+ if(d&&d.ok===true){connDisplay={rev:d.rev,model:d.model,joints:d.joints||{}};connDisplayState=d.unreadable?'unreadable':'ok';}else{connDisplay={rev:connDisplay.rev,model:'shown',joints:{}};connDisplayState='unavailable';}}
11017
+ catch(e){connDisplay={rev:connDisplay.rev,model:'shown',joints:{}};connDisplayState='unavailable';console.warn('steel-editor: could not read the AI-assisted label settings',e&&e.message?e.message:e);}
11018
+ if(selCustomPartsJoint())panel();}
11019
+ window.reloadConnectionDisplay=(rev)=>{if(Number.isInteger(rev)&&rev===connDisplay.rev&&connDisplayState==='ok')return;loadConnectionDisplay();};
11020
+ function selCustomPartsJoint(){const cs=typeof connSelInfo==='function'?connSelInfo():null;return cs&&cs.whole&&cs.joint&&cs.joint.kind==='custom-parts'?cs.joint:null;}
11021
+ function connLabelSaid(change){return change.model?(change.model==='hidden'?'AI-assisted label hidden on every connection.':'AI-assisted label shown on every connection.'):(change.joint&&change.joint.label==='hidden'?'AI-assisted label hidden on this connection.':'AI-assisted label shown on this connection.');}
11022
+ async function setConnectionLabel(change,focusId){
11023
+ if(connDisplayBusy||!PROJECT)return;connDisplayBusy=true;
11024
+ let saved=false;
11025
+ try{const r=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/connection-display',{method:'PUT',headers:{'content-type':'application/json'},body:JSON.stringify(Object.assign({rev:connDisplay.rev},change))});
11026
+ const d=await r.json().catch(()=>null);
11027
+ if(r.ok&&d&&d.ok===true){connDisplay={rev:d.rev,model:d.model,joints:d.joints||{}};connDisplayState='ok';saved=true;}
11028
+ else{await loadConnectionDisplay();toast(r.status===409?'The label settings changed somewhere else. They are shown as they are now; switch again if you still want to.':'FloLess could not save the label setting just now, so it was put back. Try again in a moment.');}
11029
+ }catch(e){toast('FloLess could not save the label setting just now, so it was put back. Try again in a moment.');console.warn('steel-editor: label setting not saved',e&&e.message?e.message:e);}
11030
+ finally{connDisplayBusy=false;}
11031
+ ccAfterRender={focus:focusId,said:saved?connLabelSaid(change):''};
11032
+ panel();
11033
+ if(saved&&typeof sync3D==='function')sync3D();}
11034
+ function applyCcAfterRender(){
11035
+ if(!ccAfterRender)return;
11036
+ const a=document.activeElement;
11037
+ if(!a||a===document.body||!a.isConnected){const f=document.getElementById(ccAfterRender.focus)||document.getElementById('ccLabelModel');if(f)f.focus();}
11038
+ const l=document.getElementById('ccLabelLive');if(l&&ccAfterRender.said)l.textContent=ccAfterRender.said;}
10755
11039
  function reviewChipFor(jointId){
10756
11040
  const st=reviewStateOf(jointId);
10757
11041
  if(st==='needs-review')return '<span class=chip style="border-color:var(--warn-edge);color:var(--warn)" data-tip="The steel this connection is watching has moved since it was placed">Needs review — the steel it sits on moved</span>';
@@ -11061,14 +11345,14 @@ function render(){
11061
11345
  s+=provisionalMembersSvg();
11062
11346
  for(const sg of P.segments) s+=`<line class=seg data-seg="${sg.id}" x1="${sg.a[0]}" y1="${sg.a[1]}" x2="${sg.b[0]}" y2="${sg.b[1]}"/>`;
11063
11347
  for(const m of P.members){if(!visible2d(m))continue; // hidden or isolated away in this sheet's Objects list
11064
- const c=colorFor(m.profile);const sel=selIds.has(m.id);const fh=findHits.has(m.id);const on=sel||fh;const g=on?` style="filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c})"`:'';
11348
+ const c=memberColour(m);const sel=selIds.has(m.id);const fh=findHits.has(m.id);const on=sel||fh;const g=on?` style="filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c})"`:'';
11065
11349
  // RFI is DERIVED here, not read off the member. `m.rfi` is a persisted contract field, written at
11066
11350
  // edit time and never recomputed on load — so every HSS/L/2L/PIPE profiled before the catalogue was
11067
11351
  // completed still carries rfi:true (#627). The RFI pill, the RFI list and the confidence panel all
11068
11352
  // recompute through _wt, so reading the stored flag here drew those members dashed-and-unresolved
11069
11353
  // on a canvas whose own counter said there were none, with no row anywhere to clear it. One source
11070
11354
  // of truth for "is this an RFI", and it is the same one everything else already uses. (code review)
11071
- const rfi=_wtPlf(m.profile)==null;
11355
+ const rfi=_memberPlf(m)==null;
11072
11356
  if(!P.elevationView&&isBrace(m)){s+=braceSymbol(m,c,g);continue;} // (an elevation draws every member as its true line: the plan symbols are plan conventions, #2780) a brace draws as its distinct symbol (dashed=below-floor + hi/lo arrows), not a plain line (B4)
11073
11357
  if(!P.elevationView&&m.role==='column'){const pts=columnSectionPoly(m); // a column draws as its profile-section footprint, not a line
11074
11358
  // A placeholder footprint on a member that is NOT an RFI reads as a real, small section — the size is
@@ -11077,14 +11361,14 @@ function render(){
11077
11361
  // #2214: a column that ends under this sheet's floor is drawn dashed and lighter. It has ONE tooltip, so the
11078
11362
  // below-the-floor sentence and the placeholder sentence are composed rather than competing attributes.
11079
11363
  const _cb=m.belowCut?colBelowInfo(m):null;
11080
- const _tipText=[_cb&&_cb.tip,_phText,aiTipFor(m)].filter(Boolean).join(' ');
11364
+ const _tipText=[_cb&&_cb.tip,_phText,customTipFor(m),aiTipFor(m)].filter(Boolean).join(' ');
11081
11365
  const _ph=_tipText?` data-tip="${esc(_tipText)}"`:'';
11082
11366
  if(pts){const components=pts.components||[pts];s+=components.map((part,index)=>`<polygon class="member${rfi?' rfi':''}${m.belowCut?' colbelow':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}" data-part="${index}" points="${_polyStr(part)}" fill="${c}" stroke="${c}"${g}${_ph}/>`).join('');continue;}}
11083
11367
  const ls=memberLineStyle(m); // F5: category line weight/dash. Inline style (NOT a presentation attr) so it beats line.member/.sel CSS width; the glow still cues selection.
11084
11368
  const _fx=on?`filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c});`:'', _sw=(ls&&ls.w)?`stroke-width:${ls.w}px;`:'', _sd=(ls&&ls.d&&!rfi)?`stroke-dasharray:${ls.d};stroke-linecap:butt;`:''; /* butt WITH a dash: line.member's round cap adds half the stroke width at EACH end of every dash, so at thick (9px) it ate every gap — dashed 14/8 and dotted 2/8 both left -1px of gap and drew solid. Round caps stay on solid lines, where they have nothing to close. */ // RFI keeps its semantic 10 6 dash
11085
11369
  const _sty=(_fx||_sw||_sd)?` style="${_fx}${_sw}${_sd}"`:'';
11086
11370
  // A column below the floor whose footprint cannot be built falls to this line, and must still say what it is (#2214).
11087
- const _lcb=(m.role==='column'&&m.belowCut)?colBelowInfo(m):null,_ltText=[_lcb&&_lcb.tip,aiTipFor(m)].filter(Boolean).join(' '),_lt=_ltText?` data-tip="${esc(_ltText)}"`:'';
11371
+ const _lcb=(m.role==='column'&&m.belowCut)?colBelowInfo(m):null,_ltText=[_lcb&&_lcb.tip,customTipFor(m),aiTipFor(m)].filter(Boolean).join(' '),_lt=_ltText?` data-tip="${esc(_ltText)}"`:'';
11088
11372
  s+=`<line class="member${rfi?' rfi':''}${_lcb?' colbelow':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}"${_lt} x1="${m.wp[0][0]}" y1="${m.wp[0][1]}" x2="${m.wp[1][0]}" y2="${m.wp[1][1]}" stroke="${c}"${_sty}/>`;}
11089
11373
  {const hsel=sel2d().filter(visible2d);if(hsel.length>=1&&!P.elevationView){const HR=epR();for(const sm of hsel)for(let i=0;i<2;i++) s+=`<circle class="handle ${i===0?'ep-start':'ep-end'}" data-mid="${sm.id}" data-h="${i}" cx="${sm.wp[i][0]}" cy="${sm.wp[i][1]}" r="${HR}"/>`;}} // end 1 (start) yellow, end 2 (end) magenta · shown for every selected member · radius grows with zoom (epR) so it stays visible against the thick line
11090
11374
  if(mode==='add'||(picking&&pickKind==='profile')){
@@ -11491,7 +11775,7 @@ function layoutPropLabels2d(){
11491
11775
  function updateHandles(m){svg.querySelectorAll(`circle.handle[data-mid="${m.id}"]`).forEach(h=>{const i=+h.dataset.h;h.setAttribute('cx',m.wp[i][0]);h.setAttribute('cy',m.wp[i][1]);});}
11492
11776
  function updateLine(m){
11493
11777
  if(isBrace(m)){const g=svg.querySelector(`g.bracesym[data-id="${m.id}"]`); // a brace is a symbol group — re-serialize the whole glyph so it follows the drag live (moves off true WPs, redraws offset)
11494
- if(g){const glow=selIds.has(m.id)||findHits.has(m.id);const c=colorFor(m.profile);g.outerHTML=braceSymbol(m,c,glow?` style="filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c})"`:'');}return;}
11778
+ if(g){const glow=selIds.has(m.id)||findHits.has(m.id);const c=memberColour(m);g.outerHTML=braceSymbol(m,c,glow?` style="filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c})"`:'');}return;}
11495
11779
  if(m.role==='column'){const pgs=svg.querySelectorAll(`polygon.member[data-id="${m.id}"]`); // columns may be multi-component polygons (2L) — re-derive every footprint part from the moved centroid
11496
11780
  if(pgs.length){const pts=columnSectionPoly(m),components=pts&&(pts.components||[pts]);if(components)pgs.forEach((pg,index)=>{if(components[index])pg.setAttribute('points',_polyStr(components[index]));});}return;}
11497
11781
  const ln=svg.querySelector(`line.member[data-id="${m.id}"]`);
@@ -11552,7 +11836,7 @@ function stats(){
11552
11836
  const metric=displayUnits()===DisplayUnits.MM;
11553
11837
  // Model scope walks the CANONICAL members: _lenMm/_lenFt resolve through the model by id, so every member weighs,
11554
11838
  // not just the ones projected onto this sheet — and ensureMeta (which mutates) stays out of a read-only repaint.
11555
- let w=0; for(const m of counted){const wpf=_wtBill(m.profile); if(wpf!=null)w+=_propMass(scope==='model'?m:ensureMeta(m),wpf);}
11839
+ let w=0; for(const m of counted){const wpf=_memberBill(m); if(wpf!=null)w+=_propMass(scope==='model'?m:ensureMeta(m),wpf);}
11556
11840
  document.getElementById('wt').textContent=(w/(metric?1000:2000)).toFixed(1);
11557
11841
  document.getElementById('wtlb').textContent=Math.round(w).toLocaleString();
11558
11842
  document.getElementById('wtT').textContent=_uw().tonnage;
@@ -12263,6 +12547,10 @@ function refusedSheetPropsHtml(rows){
12263
12547
  out+=kv('ID',esc(idText(m)));
12264
12548
  out+=kv('Mark',markHtml(m.id));
12265
12549
  out+=kv('Profile',esc(m.profile||'—'));
12550
+ // How the section was chosen, when the drawing did not say (EU `RHS200*100*5` -> cold-formed KK, labelled), or the
12551
+ // reader's own account of a route the drawing DID state. Nothing for an exact catalogue name.
12552
+ {const basis=profileBasisText(m);
12553
+ if(basis)out+=kv('Section basis',esc(basis));}
12266
12554
  out+=kv('Material',m.material?esc(m.material):esc(profileDefaultMaterial(m.profile))+' <span style="color:var(--mut);font-size:11px">· profile default</span>');
12267
12555
  const withheld=[];
12268
12556
  for(const def of PROP_DEFS){
@@ -12595,6 +12883,63 @@ function panel(){
12595
12883
  {const b=document.getElementById('cmpFav');if(b)b.onclick=()=>openFavModalFor(j);}
12596
12884
  return;
12597
12885
  }
12886
+ // #2303 slice A: a custom connection built from standard parts — what it is, how it fits, and its AI-assisted label.
12887
+ if(j.kind==='custom-parts'&&CustomConn){
12888
+ if(connDisplayState==='idle')loadConnectionDisplay();
12889
+ const entry=(C.connection_definitions||[]).find(r=>r&&j.def&&r.id===j.def.id&&r.version===j.def.version)||null;
12890
+ const v=CustomConn.customConnectionView({joint:j,entry,evidence:connectionFitByJoint.get(j.id)||null,parts:connectionPartsByJoint.get(j.id)||[],display:connDisplay,fmt:mm=>fmtDisp(Number(mm))});
12891
+ const kv=(l,val)=>`<div style="display:flex;justify-content:space-between;gap:8px;font-size:12px;margin:3px 0"><span style="color:var(--mut)">${esc(l)}</span><span style="font-variant-numeric:tabular-nums;text-align:right">${val}</span></div>`;
12892
+ const sec=t=>`<div class=divrow><hr><span class=sect style="margin:0">${esc(t)}</span><hr></div>`;
12893
+ const tone={neutral:'border-color:var(--line);color:var(--mut)',warn:'border-color:var(--warn-edge);color:var(--warn)',info:'border-color:var(--cyan-edge);color:var(--cyan);background:var(--cyan-soft)'};
12894
+ const chips=(v.chip?`<span class=chip id=ccAiChip style="${v.labelShown?tone.info:tone.neutral}" data-tip="${esc(v.chip.tip)}">${esc(v.chip.text)}</span>`:'')
12895
+ +`<span class=chip id=ccFitChip style="${tone[v.verdict.tone]||tone.neutral}" data-tip="${esc(v.verdict.tip)}">${esc(v.verdict.text)}</span>`;
12896
+ const onLine=`On <button data-command-id="steel.connection-select-member" class=pilllink id=cmpMember data-tip="Select ${esc(j.main)}">${esc(j.main)}</button> · ${cs.childIds.length} parts${v.source?` · from ${esc(v.source)}`:''}`;
12897
+ const verdictWord=r=>r.verdict==='outside'?'<span style="color:var(--warn)">✗ outside its rule</span>':r.verdict==='unmeasured'?`<span style="color:var(--warn)">not proven${r.estimated?' (estimated face)':''}</span>`:'<span style="color:var(--mut)">✓ within its rule</span>';
12898
+ const failRows=v.notMet.map(r=>kv(r.label,verdictWord(r))).join('');
12899
+ const showPassing=v.passing.length<=6||ccShowAllChecks===j.id;
12900
+ const passRows=v.passing.map(r=>kv(r.label,verdictWord(r))).join('');
12901
+ const passToggle=v.passing.length>6?`<button class=ghostw id=ccChecksToggle data-command-id="steel.connection-fit-checks-toggle" aria-expanded="${showPassing}" aria-controls=ccChecks data-tip="${showPassing?'Show only the checks that need attention':'Show every check FloLess measured'}">${showPassing?'Hide the checks within their rule':`Show ${v.passing.length} checks within their rule`}</button>`:'';
12902
+ const summaryRow=kv(`${v.passing.length} checks`,'<span style="color:var(--mut)">within their rules</span>');
12903
+ const checks=v.notMet.length||v.passing.length
12904
+ ?`<div id=ccChecks>${failRows}${showPassing?passRows:summaryRow}</div>${passToggle?`<div class=row style="margin:4px 0 0">${passToggle}</div>`:''}`
12905
+ :`<div class="row hint" style="margin:0">${v.verdict.tone==='info'?'Checked when the model is rebuilt.':'No placement checks were measured.'}</div>`;
12906
+ const unmeasured=v.unmeasured.length?`<div class="row hint" style="margin:4px 0 0;font-size:11px">Not measured: ${v.unmeasured.map(esc).join('; ')}</div>`:'';
12907
+ const features=v.definitionMissing?`<div class="row hint" style="margin:0;color:var(--warn)">The custom connection this uses is no longer saved with the model, so it cannot be described or built.</div>`
12908
+ :v.features.map(t=>`<div class=row style="margin:2px 0;font-size:12px">${esc(t)}</div>`).join('');
12909
+ const assumptions=v.assumptions.length?sec('Assumed values')+v.assumptions.map(a=>kv(a.param,`${esc(a.value)} <span style="color:var(--mut)">· ${esc(a.clause||a.basis)}</span>`)).join('')
12910
+ +'<div class="row hint" style="margin:2px 0 0;font-size:11px">Only values a detailing rule sets are filled in. Sizes and shapes come from the drawing.</div>':'';
12911
+ const unreadable=connDisplayState==='unreadable'||connDisplayState==='unavailable';
12912
+ const labelBlock=v.aiAssisted?sec('Label')
12913
+ +`<label class=gck style="margin:3px 0"><input type=checkbox id=ccLabelModel data-command-id="steel.connection-ai-label-model" ${v.modelShown?'checked':''}><span>Show the AI-assisted label on every connection in this model</span></label>`
12914
+ +(v.modelShown?`<label class=gck style="margin:3px 0"><input type=checkbox id=ccLabelJoint data-command-id="steel.connection-ai-label-joint" ${v.labelShown?'checked':''}><span>Show it on this connection</span></label>`
12915
+ :'<div class="row hint" style="margin:2px 0;font-size:11px">Hidden for every connection in this model.</div>')
12916
+ +'<div class="row hint" style="margin:2px 0 0;font-size:11px">Turning it off removes the label from exports and part names only. FloLess keeps the record that the AI built it.</div>'
12917
+ +(unreadable?'<div class="row hint" style="margin:2px 0 0;font-size:11px;color:var(--warn)">FloLess could not read the label settings just now, so the label is shown.</div>':'')
12918
+ +'<div id=ccLabelLive class=sr-only aria-live=polite></div>':'';
12919
+ p.innerHTML=`<span class=badge>Custom connection</span>
12920
+ <div class="row f" style="margin:0 0 6px;gap:4px;flex-wrap:wrap">${chips}</div>
12921
+ ${v.verdict.hint?`<div class="row hint" style="margin:0 0 4px;font-size:11px">${esc(v.verdict.hint)}</div>`:''}
12922
+ ${assumptionChipFor(j.id)}
12923
+ <div class="row hint" style="margin:0 0 2px">${onLine}</div>
12924
+ <div class="row hint" style="margin:0 0 6px;font-size:11px">${esc(v.name)} — built from standard parts. <b>Esc</b> steps back.</div>
12925
+ ${sec('What it is')}${features}
12926
+ ${sec('Fit checks')}${checks}${unmeasured}
12927
+ ${assumptions}
12928
+ ${labelBlock}
12929
+ <div class=divrow><hr></div>
12930
+ <div class="row f" style="gap:6px;flex-wrap:wrap">
12931
+ <button data-command-id="steel.connection-modify-request" class=ghostw id=cmpAsk data-tip="Record a request for your terminal AI to change or rebuild this connection">Modify connection…</button>
12932
+ <button data-command-id="steel.connection-delete" class=danger id=cmpDel data-tip="Remove this whole connection (Ctrl+Z puts it back)">Delete connection</button>
12933
+ </div>`;
12934
+ {const b=document.getElementById('cmpMember');if(b)b.onclick=()=>{if(modelEditor.isReady()&&modelEditor.steel.clearConnSel)modelEditor.steel.clearConnSel();modelSelection.replaceMembers([j.main]);selDimIds.clear();sel3dDimIds.clear();modelSelection.clearGrids();render();};}
12935
+ {const b=document.getElementById('ccChecksToggle');if(b)b.onclick=()=>{ccShowAllChecks=ccShowAllChecks===j.id?null:j.id;panel();const t=document.getElementById('ccChecksToggle');if(t)t.focus();};}
12936
+ {const b=document.getElementById('ccLabelModel');if(b)b.onchange=()=>setConnectionLabel({model:b.checked?'shown':'hidden'},'ccLabelModel');}
12937
+ {const b=document.getElementById('ccLabelJoint');if(b)b.onchange=()=>setConnectionLabel({joint:{id:j.id,label:b.checked?'shown':'hidden'}},'ccLabelJoint');}
12938
+ requestAnimationFrame(applyCcAfterRender); // after the frame: the same render pass may rewrite the panel again around this branch
12939
+ {const b=document.getElementById('cmpAsk');if(b)b.onclick=()=>connModifyRequest(j);}
12940
+ {const b=document.getElementById('cmpDel');if(b)b.onclick=()=>edit(()=>{C.joints=(C.joints||[]).filter(x=>x!==j);modelSelection.clearMembers();});}
12941
+ return;
12942
+ }
12598
12943
  const isBP=j.kind==='base-plate',pp=j.params||{};const savedFav=favMatch(j);
12599
12944
  const plate=(partsById||{})[cs.conn+':plate']||(partsById||{})[cs.conn+':plateA']||null; // a gusset carries plateA/plateB, not a single :plate
12600
12945
  const dim=(n)=>(n==null?'<span style="color:var(--mut)">auto</span>':esc(fmtDisp(Number(n))));
@@ -12802,11 +13147,11 @@ function panel(){
12802
13147
  const totalL=fmtLenSummary(displayUnits()===DisplayUnits.MM
12803
13148
  ?arr.reduce((t,m)=>t+_lenMm(m),0)
12804
13149
  :arr.reduce((t,m)=>t+_lenFt(m),0)*FT_TO_MM);
12805
- const allKnown=arr.every(m=>_wtPlf(m.profile)!=null);
13150
+ const allKnown=arr.every(m=>_memberPlf(m)!=null);
12806
13151
  // In the project's own units, through the ONE helper — this line used to inline the conversion and
12807
13152
  // then print the result as `lb` whatever the project was set to, so a UK box-select of twelve beams
12808
13153
  // read "9,340 lb" for 9,340 kg: a 2.2x error on a lifting figure, stated as fact.
12809
- const totalW=allKnown?Math.round(arr.reduce((t,m)=>t+_propMass(m,_wtBill(m.profile)),0)):null;
13154
+ const totalW=allKnown?Math.round(arr.reduce((t,m)=>t+_propMass(m,_memberBill(m)),0)):null;
12810
13155
  const dupSet=new Set(redundantDups()), dupSel=arr.filter(m=>dupSet.has(m.id)).length;
12811
13156
  const profAgg=agg(arr,m=>m.profile), matAgg=agg(arr,m=>m.material||''), allVerified=arr.every(m=>m.verified===true);
12812
13157
  const VV=v=>v===VARIES, valOf=v=>VV(v)||v==null?'':esc(fmtDispElev(v)), decOf=v=>VV(v)||v==null?'':esc(fmtEcho(v));
@@ -12835,7 +13180,7 @@ function panel(){
12835
13180
  // Resolve each distinct designation once in this synchronous refresh; no result survives a repaint.
12836
13181
  const profileDimensions=new Map();
12837
13182
  const dimensionsFor=profile=>{if(!profileDimensions.has(profile))profileDimensions.set(profile,profileDimsIn(profile));return profileDimensions.get(profile);};
12838
- const hOk=arr,hSkip=arr.filter(m=>!posEligible(m,dimensionsFor(m&&m.profile))).length;
13183
+ const hOk=arr,hSkip=arr.filter(m=>!posEligible(m,m&&m.customSectionId?memberDimsIn(m):dimensionsFor(m&&m.profile))).length;
12839
13184
  const posA=hOk.length?agg(hOk,m=>posDefault(m)):null;
12840
13185
  const posHA=hOk.length?agg(hOk,m=>posHDefault(m)):null;
12841
13186
  // A mixed selection must read BLANK, not the first member's value — an offset silently inherited across a
@@ -12865,6 +13210,7 @@ function panel(){
12865
13210
  <div class="row hint" style="margin-top:0">Edits apply to <b>all ${arr.length}</b> selected · a blank <b>Varies</b> field is left unchanged.</div>
12866
13211
  ${memberTypeField('mTypeM',arr)}
12867
13212
  <div class="f"><div class=elab>Profile</div><div style="display:flex;gap:6px"><input data-command-id="steel.selection-profile" aria-label="Profile" id=pf class=combo data-src=profiles placeholder="${VV(profAgg)?'Varies':''}" value="${VV(profAgg)?'':esc(profAgg||'')}" style="flex:1" autocomplete=off><button data-command-id="steel.browse-profile-catalog" id=profileBrowseM class=ghost data-tip="Browse the active environment profile catalog">Browse</button></div></div>
13213
+ ${customSectionPickerHTML(arr,'customSecM')}
12868
13214
  <div class="f"><div class=elab>Material grade</div><div style="display:flex;gap:6px"><input data-command-id="steel.selection-material" aria-label="Material grade" id=mat class=combo data-src=materials placeholder="${VV(matAgg)?'Varies':VV(profAgg)?'Profile default · per member':'Profile default · '+esc(profileDefaultMaterial(profAgg))}" value="${VV(matAgg)?'':esc(matAgg||'')}" style="flex:1" autocomplete=off><button data-command-id="steel.browse-material-catalog" id=materialBrowseM class=ghost data-tip="Browse structural member grades">Browse</button></div></div>
12869
13215
  <div class="row hint">Total length <b>${totalL}</b>${totalW!=null?` · <b>${totalW.toLocaleString()} ${_uw().weight}</b>`:''}${dupSel?` · <span style="color:var(--err)">${dupSel} duplicate${dupSel>1?'s':''}</span> (overlap a kept member — deleting these dedupes)`:''}</div>
12870
13216
  <div class=row><button data-command-id="steel.selection-verified" class=ghostw id=verifyBtn${allVerified?' style="border-color:var(--ok-edge);color:var(--ok)"':''}>${allVerified?'✓ All verified — click to unverify':'Mark all verified'}</button></div>
@@ -12894,6 +13240,7 @@ function panel(){
12894
13240
  wireTypeFilter(p);wirePositionAvailability();
12895
13241
  // wiring — every commit applies to the whole selection; a blank field is a no-op (leaves each member's own value).
12896
13242
  document.getElementById('pf').onchange=e=>{const v=_canonDes(e.target.value);if(!v)return;edit(()=>{for(const m of selArr())ModelCmd.patchMember(m,{profile:v,rfi:_wtPlf(v)==null});if(!profs.includes(v)){profs.push(v);profs.sort();}});};
13243
+ {const cs=document.getElementById('customSecM');if(cs)cs.onchange=e=>{const v=String(e.target.value||'');if(v)applyCustomSectionChoice(arr.map(m=>m.id),v);};}
12897
13244
  document.getElementById('profileBrowseM').onclick=e=>openProfilePicker({ids:arr.map(m=>m.id),current:VV(profAgg)?null:profAgg,scope:`${arr.length} selected members`,invoker:e.currentTarget});
12898
13245
  document.getElementById('mat').onchange=e=>{const v=String(e.target.value||'').trim();if(VV(matAgg)&&!v)return;applyMaterialChoice(arr.map(m=>m.id),v||CatalogPicker.MATERIAL_DEFAULT);};
12899
13246
  document.getElementById('materialBrowseM').onclick=e=>openMaterialPicker({ids:arr.map(m=>m.id),current:VV(matAgg)?null:(matAgg||''),scope:`${arr.length} selected members`,invoker:e.currentTarget});
@@ -12954,7 +13301,7 @@ function panel(){
12954
13301
  if(sk)toast(sk+' brace'+(sk>1?'s':'')+' skipped — matching ends would flatten the slope its arrows encode');};}}
12955
13302
  return;}
12956
13303
  // Same as the multi-selection total above: the imperial reading keeps its old expression exactly.
12957
- const m=ensureMeta(arr[0]), wpf=_wtBill(m.profile),
13304
+ const m=ensureMeta(arr[0]), wpf=_memberBill(m),
12958
13305
  L=fmtLenSummary(displayUnits()===DisplayUnits.MM?_lenMm(m):_lenFt(m)*FT_TO_MM), col=(m.role==='column'), pos=posDefault(m);
12959
13306
  // The named faces are offered only where the bake honours them, and when they are not, the hint names both
12960
13307
  // the reason AND any placement still stored on the member — that placement keeps applying the moment the
@@ -13200,7 +13547,7 @@ function panel(){
13200
13547
  </div>
13201
13548
  </div>`:'';
13202
13549
  const appearanceSect=(_hasProf||_lineCtl)?`<div class=divrow><hr><span class=sect style="margin:0" data-tip="Colour is per profile — recolours everywhere that profile is drawn, 2D and 3D. Line weight and dash are per member type, 2D only.">Appearance</span><hr></div>`
13203
- +(_hasProf?`<div style="display:flex;align-items:center;gap:8px;margin-top:2px"><span class=elab style="margin:0;flex:none">Colour</span><input data-command-id="steel.profile-colour#${esc(m.profile)}" aria-label="Colour for ${esc(m.profile)}" type=color id=msColor class=swc value="${colorFor(m.profile)}" data-tip="Colour for ${esc(m.profile)} — recolours every ${esc(m.profile)} (2D + 3D)"><span class=hint style="margin:0;opacity:.6">${esc(m.profile)} · everywhere</span></div>`:'')
13550
+ +(_hasProf?`<div style="display:flex;align-items:center;gap:8px;margin-top:2px"><span class=elab style="margin:0;flex:none">Colour</span><input data-command-id="steel.profile-colour#${esc(memberShownKey(m))}" aria-label="Colour for ${esc(memberShownKey(m))}" type=color id=msColor class=swc value="${memberColour(m)}" data-tip="Colour for ${esc(memberShownKey(m))} — recolours every ${esc(memberShownKey(m))} (2D + 3D)"><span class=hint style="margin:0;opacity:.6">${esc(memberShownKey(m))} · everywhere</span></div>`:'')
13204
13551
  +_lineCtl:'';
13205
13552
  // ONE size fact, stated where the profile it describes is. The merge left two of this row, which is
13206
13553
  // also why Mark verified and id=verifyBtn appeared twice. The surviving text is master's: L already
@@ -13217,8 +13564,11 @@ function panel(){
13217
13564
  ${typeFilterHTML(arr)}
13218
13565
  ${memberTypeField('mTypeS',[m])}
13219
13566
  <div class="f"><div class=elab>Profile</div><div style="display:flex;gap:6px"><input data-command-id="steel.member-profile" aria-label="Profile" id=pf class=combo data-src=profiles value="${esc(m.profile)}" style="flex:1" autocomplete=off><button data-command-id="steel.browse-profile-catalog" id=profileBrowseS class=ghost aria-label="Search the profile catalog" data-tip="Search the profile catalog — 4,516 profiles, by designation or alias"><svg viewBox="0 0 16 16" aria-hidden=true width=13 height=13 fill=none stroke=currentColor stroke-width=1.4 stroke-linecap=round><circle cx="6.9" cy="6.9" r="4.3"/><path d="M10.1 10.1 13.7 13.7"/></svg></button><button data-command-id="steel.pick-profile" id=pickProf class="ghost${(picking&&pickKind==='profile')?' on':''}" aria-pressed="${(picking&&pickKind==='profile')?'true':'false'}" aria-label="Pick profile from a drawing label" data-tip="Pick profile from drawing labels by click, Enter, or Space">⌖</button></div>${(picking&&pickKind==='profile')?'<div class="hint" data-profile-pick-status role=status aria-live=polite style="margin-top:4px;font-style:italic;color:var(--brand)">'+esc(profilePickGuidance())+'</div>':''}</div>
13567
+ ${customSectionPickerHTML([m],'customSecS')}
13568
+ ${customSectionInspectHTML(m)}
13569
+ ${profileBasisText(m)?`<div class="row hint" id=profileBasis role=note>Section basis: ${esc(profileBasisText(m))}</div>`:''}
13220
13570
  <div class="f"><div class=elab>Material grade</div><div style="display:flex;gap:6px"><input data-command-id="steel.member-material" aria-label="Material grade" id=mat class=combo data-src=materials value="${esc(m.material||'')}" placeholder="Profile default · ${esc(profileDefaultMaterial(m.profile))}" style="flex:1" autocomplete=off data-tip="${m.material?'This member carries its own grade, so it will not follow a profile change':'Empty — follows the profile’s default grade. Type or browse to give this member its own.'}"><button data-command-id="steel.browse-material-catalog" id=materialBrowseS class=ghost aria-label="Search material grades" data-tip="Search the material catalog by name or alias"><svg viewBox="0 0 16 16" aria-hidden=true width=13 height=13 fill=none stroke=currentColor stroke-width=1.4 stroke-linecap=round><circle cx="6.9" cy="6.9" r="4.3"/><path d="M10.1 10.1 13.7 13.7"/></svg></button><span class=pslot aria-hidden=true></span></div></div>
13221
- <div class="row hint">Length <b>${L}</b> · ${wpf==null?'<span id=rfiPill class="pill pill-clickable" role=button tabindex=0 data-tip="Open the RFI list, focused on this member" style="background:var(--err-bg)">RFI — size unresolved</span>':_memberWeightHint(m,wpf)}</div>
13571
+ <div class="row hint">Length <b>${L}</b> · ${wpf==null&&customOf(m)?(customOf(m).assumable===false?'<span class=pill data-tip="FloLess cannot weigh this member’s custom section yet, so the member is left out of weights and quantities. The Custom section above says why and what to do." style="background:var(--err-bg)">No weight — custom section not counted</span>':'<span class=pill data-tip="This member’s custom section is unreadable, so it has no weight until you proceed on an assumption or it is fixed." style="background:var(--err-bg)">No weight — custom section unreadable</span>'):wpf==null?'<span id=rfiPill class="pill pill-clickable" role=button tabindex=0 data-tip="Open the RFI list, focused on this member" style="background:var(--err-bg)">RFI — size unresolved</span>':_memberWeightHint(m,wpf)}</div>
13222
13572
  <div class=elab>Verified</div><span class=vwrap data-panel-control><button data-command-id="steel.member-verified" id=verifyBtn class="vbtn${m.verified?' on':''}" aria-pressed="${m.verified?'true':'false'}" data-tip="Mark this member human-confirmed">${m.verified?'✓ Human-confirmed':'Mark verified'}</button></span>
13223
13573
  ${mfSect}
13224
13574
  ${appearanceSect}
@@ -13248,12 +13598,14 @@ function panel(){
13248
13598
  wireTypeFilter(p);wirePositionAvailability();
13249
13599
  document.getElementById('pf').onchange=e=>edit(()=>{const v=_canonDes(e.target.value);ModelCmd.patchMember(m,{profile:v,rfi:_wtPlf(v)==null});if(v&&!profs.includes(v)){profs.push(v);profs.sort();}});
13250
13600
  document.getElementById('profileBrowseS').onclick=e=>openProfilePicker({ids:[m.id],current:m.profile,scope:`Member ${m.id}`,invoker:e.currentTarget});
13601
+ {const cs=document.getElementById('customSecS');if(cs)cs.onchange=e=>applyCustomSectionChoice([m.id],String(e.target.value||''));}
13602
+ wireCustomSectionInspect(m);
13251
13603
  document.getElementById('mat').onchange=e=>applyMaterialChoice([m.id],String(e.target.value||'').trim()||CatalogPicker.MATERIAL_DEFAULT);
13252
13604
  document.getElementById('materialBrowseS').onclick=e=>openMaterialPicker({ids:[m.id],current:m.material||'',scope:`Member ${m.id}`,invoker:e.currentTarget});
13253
13605
  {const rp=document.getElementById('rfiPill');if(rp){const go=()=>openRFI(m.id);rp.onclick=go;rp.onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();e.stopPropagation();go();}};}} // F12: the RFI pill opens the list focused on THIS member (role=button span → keydown for Enter/Space). stopPropagation so idle Space/Enter doesn't ALSO hit the global repeat-last handler (:3804) — matches the editor's local-keydown convention (:1738,:4212)
13254
13606
  document.getElementById('pickProf').onclick=()=>{if(picking&&pickKind==='profile'){picking=false;}else{picking=true;pickKind='profile';pickEnd=null;}render();};
13255
13607
  document.getElementById('mTypeS').onchange=e=>{const v=e.target.value;if(!normMemberTypeKey(v)){e.target.value=memberTypeLabel(memberTypeOf(m));return;}const live=byId(m.id)||m;if(memberTypeSettled(live,memberTypeKnownKey(v))){e.target.value=memberTypeLabel(memberTypeOf(live));return;}edit(()=>{const k=memberTypeFromInput(v);if(k&&!memberTypeSettled(byId(m.id)||m,k))applyMemberType([m],k);});}; // retype → role + legend recategorize (edit() → sync3D → build3DLegend); undoable. Re-entering the CURRENT type opens no edit(), so it pushes no empty undo step (#1429)
13256
- {const _cc=document.getElementById('msColor');if(_cc)_cc.onchange=e=>{setProfileColour(m.profile,e.target.value);scheduleSave();render();sync3D();};} // F1: recolour this member's profile (same write as the legend swatch) — sync3D() repaints a live 3D scene (no-op in 2D) so colour is truly 2D+3D
13608
+ {const _cc=document.getElementById('msColor');if(_cc)_cc.onchange=e=>{if(!setProfileColour(memberShownKey(m),e.target.value)){render();return;}scheduleSave();render();sync3D();};} // F1: recolour this member's profile (same write as the legend swatch) — sync3D() repaints a live 3D scene (no-op in 2D) so colour is truly 2D+3D
13257
13609
  // Every value-face dropdown in the pane is wired the same way — the Line control and the three
13258
13610
  // placement faces — so this walks .linewrap rather than naming one id.
13259
13611
  for(const wrap of document.querySelectorAll('#panel .linewrap')){
@@ -13983,7 +14335,7 @@ const PROP_DEFS=[
13983
14335
  // popup's aggregate, read one member at a time within a single render, so they never mix systems.
13984
14336
  {key:'length', label:'Length', get:m=>displayUnits()===DisplayUnits.MM?_lenMm(m):_lenFt(m), labelGet:m=>_lenFtLabel(m)==null?undefined:(displayUnits()===DisplayUnits.MM?_lenMm(m):_lenFt(m)),
13985
14337
  fmt:v=>v==null?'':(displayUnits()===DisplayUnits.MM?Math.round(v).toLocaleString('en-US')+' mm':v.toFixed(1)+' ft')},
13986
- {key:'weight', label:'Weight', get:m=>{const w=_wtBill(m.profile);return w==null?undefined:_propMass(m,w);}, labelGet:m=>{const w=_wtBill(m.profile);return (w==null||_lenFtLabel(m)==null)?undefined:_propMass(m,w);}, fmt:v=>v==null?'':Math.round(v).toLocaleString('en-US')+' '+_uw().weight},
14338
+ {key:'weight', label:'Weight', get:m=>{const w=_memberBill(m);return w==null?undefined:_propMass(m,w);}, labelGet:m=>{const w=_memberBill(m);return (w==null||_lenFtLabel(m)==null)?undefined:_propMass(m,w);}, fmt:v=>v==null?'':Math.round(v).toLocaleString('en-US')+' '+_uw().weight},
13987
14339
  // The column suppression is GONE: a column takes the same Profile Position as every other member now
13988
14340
  // (design §4), so hiding its depth face would be the label lying about geometry the bake applies.
13989
14341
  //
@@ -14822,7 +15174,7 @@ function cmPrevSvg(v,cur){const sel=sel2d(),offs=cmOffsetsFor(v);let s='';
14822
15174
  const many=sel.length*offs.length>600,bb=many?cmSelBbox():null;
14823
15175
  for(const off of offs){
14824
15176
  if(many){s+=`<rect class=cmghostbox x="${bb[0]+off[0]}" y="${bb[1]+off[1]}" width="${bb[2]-bb[0]}" height="${bb[3]-bb[1]}"/>`;continue;}
14825
- for(const m of sel)s+=`<line class=cmghost stroke="${esc(colorFor(m.profile))}" x1="${+m.wp[0][0]+off[0]}" y1="${+m.wp[0][1]+off[1]}" x2="${+m.wp[1][0]+off[0]}" y2="${+m.wp[1][1]+off[1]}"/>`;} // + coerces: a malformed contract string can't reach the attribute
15177
+ for(const m of sel)s+=`<line class=cmghost stroke="${esc(memberColour(m))}" x1="${+m.wp[0][0]+off[0]}" y1="${+m.wp[0][1]+off[1]}" x2="${+m.wp[1][0]+off[0]}" y2="${+m.wp[1][1]+off[1]}"/>`;} // + coerces: a malformed contract string can't reach the attribute
14826
15178
  const b=cmDraft.base;
14827
15179
  if(cmArrayMode&&cmDraft.vA)s+=cmRubSvg(b,[b[0]+cmDraft.vA[0],b[1]+cmDraft.vA[1]],true);
14828
15180
  s+=cmRubSvg(b,cur,false);
@@ -15688,10 +16040,9 @@ function syncEnvChip(){
15688
16040
  const b=document.createElement('b');
15689
16041
  b.textContent=label;
15690
16042
  chip.append(b);
15691
- chip.setAttribute('data-tip',stated==='UK'
15692
- ?'This model resolves every section against the UK catalogue (BS EN sections, S355 default grade). Chosen when the project was created and fixed for its life.'
15693
- :stated==='US'
15694
- ?'This model resolves every section against the US catalogue (AISC sections, A992/A36 default grade). Chosen when the project was created and fixed for its life.'
16043
+ const _statedTraits=SteelEnv.traitsOf(stated);
16044
+ chip.setAttribute('data-tip',_statedTraits
16045
+ ?_statedTraits.chipTip
15695
16046
  // Two different sentences for the two unstated cases, because only one of them is a gap. Telling
15696
16047
  // someone on a projectless surface that "projects created since this setting existed state one
15697
16048
  // explicitly" is advice about something they cannot do from here.
@@ -16326,7 +16677,7 @@ let modelShellMount=null;
16326
16677
  const selBar=document.getElementById('selBar'),selFly=document.getElementById('selFly');
16327
16678
  const pointerSelectionListeners=new Set();
16328
16679
  var selFilterReady=false; // armed by the deferred first reflect below; render() checks it so its per-edit reflect only runs once the Select-bar is initialised. In the current flow the first paint runs after this line (reads false); `var` (not let/const) is defensive — render() is defined earlier, so if it ever ran before this line it would read undefined (falsy), not throw a TDZ error.
16329
- const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','brace-gusset':'Gusset plate','custom':'Imported'};
16680
+ const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','brace-gusset':'Gusset plate','custom':'Imported','custom-parts':'Custom connection'};
16330
16681
  // Every connection label in this file goes through here. They used to be open-coded ternaries whose ELSE
16331
16682
  // branch said 'Shear plate', so the moment a third parametric kind existed the inspector announced a
16332
16683
  // brace gusset as a shear plate — the right geometry under the wrong name, which is worse than no label.
@@ -16441,6 +16792,7 @@ document.getElementById('cpLevelB').onclick=()=>openLevelModal('copy');
16441
16792
  // fetches the SAME scene the bake uses (/api/contract/:id/scene) so 2D and 3D show one contract. ---
16442
16793
  // Coped beams (auto, clash-driven) — cache the cut labels per member as the scene is fetched so the
16443
16794
  // member Inspector can show a read-only "Cope (auto)" note (a coped beam otherwise looks like an error).
16795
+ let connectionFitByJoint=new Map(), connectionPartsByJoint=new Map(); // #2303 slice A: a custom connection's fit and built parts, from the last connection bake
16444
16796
  let copesByMember={}, partsById={}, connectionDiagnostics=[], connectionDiagnosticsStatus='pending', connectionDiagnosticsSeq=0, connectionDiagnosticsTimer=null, connectionPreviewJointByEnd=new WeakMap(), shownConnectionDiagnosticSignatures=new Set();
16445
16797
  const connectionDiagnosticSignature=d=>[d.jointId,d.code,d.severity,d.field||'',d.authored==null?'':d.authored,d.built==null?'':d.built,d.supportId||''].join('|');
16446
16798
  function announceConnectionTruth(message,busy){
@@ -16516,7 +16868,10 @@ function connectionRefusalCopy(d,m){
16516
16868
  // is and that this detail does not model it.
16517
16869
  'main-rolled-unsupported':{head:'Not built · This member is rolled off vertical',detail:main+' is turned away from plumb, and this detail is only modelled for an upright section. No geometry or member trim was created.'},
16518
16870
  'support-rolled-unsupported':{head:'Not built · The supporting member is rolled off vertical',detail:support+' is turned away from plumb, so its bearing face cannot be placed by this detail. No geometry or member trim was created.'},
16519
- 'support-positioned-unsupported':{head:'Not built · The supporting member has been moved off its work line',detail:support+' has been moved off its work line, so the face this connection would bear on is no longer where that line puts it. No geometry or member trim was created.'}
16871
+ 'support-positioned-unsupported':{head:'Not built · The supporting member has been moved off its work line',detail:support+' has been moved off its work line, so the face this connection would bear on is no longer where that line puts it. No geometry or member trim was created.'},
16872
+ // Add-ons S1a. A custom section has no designation the connection details know, so a connection on one
16873
+ // is left unbuilt rather than placed against a guessed shape. Say which member and what to do instead.
16874
+ 'custom-section-unsupported':{head:'Not built · Connections on a custom section are not modelled yet',detail:(d.supportId?support:main)+' uses a custom section, and this connection detail is only modelled for catalogue sections. Draw this connection as a custom connection, or use a catalogue section for that member. No geometry or member trim was created.'}
16520
16875
  };
16521
16876
  return byCode[d.code]||{head:'Not built · Connection was refused',detail:'The connection engine refused '+(d.jointId||'this joint')+' ('+(d.code||'unknown reason')+'). No geometry or member trim was created.'};
16522
16877
  }
@@ -16551,6 +16906,8 @@ function updateConnectionDiagnostics(raw,announce=true){
16551
16906
  return fresh.length;
16552
16907
  }
16553
16908
  function applyConnectionBakeTruth(j,announce=true){
16909
+ connectionFitByJoint=new Map((Array.isArray(j&&j.fitEvidence)?j.fitEvidence:[]).filter(e=>e&&e.jointId).map(e=>[e.jointId,e])); // #2303 slice A: Inspect reads a custom connection's fit from the same bake
16910
+ {const byJoint=new Map();for(const el of ((j&&j.scene&&Array.isArray(j.scene.elements))?j.scene.elements:[]))if(el&&el.connKind==='custom-parts'&&el.conn){if(!byJoint.has(el.conn))byJoint.set(el.conn,[]);byJoint.get(el.conn).push(el);}connectionPartsByJoint=byJoint;}
16554
16911
  const fresh=updateConnectionDiagnostics(j&&j.diagnostics,false),sk=Array.isArray(j&&j.skipped)?j.skipped:[];
16555
16912
  const diagnosed=new Set(connectionDiagnostics.map(d=>d.jointId));
16556
16913
  const unreported=sk.filter(s=>String(s).startsWith('joint:')&&!diagnosed.has(String(s).slice(6))).length;
@@ -16565,10 +16922,11 @@ function applyConnectionBakeTruth(j,announce=true){
16565
16922
  }
16566
16923
  async function fetchScenePayload(contract=C){
16567
16924
  const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene'+PROJECT_QS,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract})});
16568
- // #3097: what this throws can reach a toast ("Could not open 3D view: …"). The server's own sentence is marked as
16569
- // one; an unreadable body or a refusal with nothing said keeps its facts (status, body) for the shared sentence.
16925
+ // #3097: what this throws can reach a toast ("Could not open 3D view: …"). It carries the reply (status, body), and
16926
+ // the sentence is read from that reply (threeDOpenFailureText), so the message here is for the console only. 3b: not
16927
+ // marked `forPerson`, because a server's `error` is not a sentence this page wrote (it may be `diagnostic`).
16570
16928
  let j;try{j=await r.json();}catch(e){throw Object.assign(new Error('the scene reply was not readable JSON'),{status:r.status,body:{code:'response-unreadable'},cause:e});}
16571
- if(!j||!j.ok){const said=j&&typeof j.error==='string'&&j.error.trim();throw Object.assign(new Error(said||'scene render failed'),{status:r.status,body:j,forPerson:!!said});}
16929
+ if(!j||!j.ok)throw Object.assign(new Error('the scene render was refused'),{status:r.status,body:j&&typeof j==='object'?j:{}});
16572
16930
  return j;
16573
16931
  }
16574
16932
  function connectionTruthRequest(){
@@ -16631,6 +16989,7 @@ function hostBakeReasonLabel(reason){return ({
16631
16989
  'no-footprint':'No tabulated cross-section',unplaceable:'Geometry could not be placed',
16632
16990
  'unregistered-view':'Source view is not registered to the model','view-scale-invalid':'Source view has no valid drawing scale',
16633
16991
  'cross-view-conflict':'Source views disagree on placement','placement-evidence-conflict':'Invalid scale and conflicting placement evidence',
16992
+ 'custom-section-unverified':'Custom section cannot be checked','custom-section-not-exported':'Custom section is not carried by this send',
16634
16993
  'not-in-model':'No longer in the model'
16635
16994
  })[reason]||'Could not be built';}
16636
16995
 
@@ -17647,7 +18006,7 @@ async function placeConnection(jointId,memberIds,skipped,token){
17647
18006
  // 428 is the client failing to send a precondition, which is a FloLess bug, not something the user
17648
18007
  // can act on — never show its header vocabulary. "Place it again" IS now a real action (the
17649
18008
  // inspector's Place again…), so the sentence names the recovery instead of stopping at the fault.
17650
- const why=(res.status===428||!d.error)?'what it joins could not be recorded':String(d.error);
18009
+ const why=(res.status!==428&&personText(d))||'what it joins could not be recorded';
17651
18010
  toast('“'+name+'” is placed — '+why+', so it is not being watched. Use Place again… to start watching it.');
17652
18011
  return false;
17653
18012
  }
@@ -17746,9 +18105,10 @@ function reviewVerbFailed(e,fallback){
17746
18105
  if(e&&e.status===409){toast('Someone else already reviewed this connection — its status just updated');markReviewDirty({storeRevision:reviewAt.storeRevision,reviewRevision:reviewAt.reviewRevision+1});return;}
17747
18106
  /* The server's own 4xx prose is written FOR the user and names what to do; anything else — a transport
17748
18107
  failure, a 5xx behind an HTML error page — is not, so the caller's sentence wins, because it is the
17749
- only one that names the connection. */
17750
- const speakable=e&&!e.transport&&e.status>=400&&e.status<500&&e.authored!==false&&e.message;
17751
- if(speakable){toast(String(e.message));return;}
18108
+ only one that names the connection. #3097 3b: the prose is read again from the reply (personText), never from
18109
+ the error's message, so a refusal the server marked `diagnostic` is not spoken. */
18110
+ const speakable=e&&!e.transport&&e.status>=400&&e.status<500&&personText(e.body);
18111
+ if(speakable){toast(speakable);return;}
17752
18112
  /* #3097: the why and the next step come from the shared sentence, after the caller's own words (which name the
17753
18113
  connection). A review change whose answer was lost or unexplained may have landed, so it is never told to "try
17754
18114
  again" blindly: the review status refreshes on its own and shows what the server holds. */
@@ -17919,7 +18279,7 @@ async function replaceConnectionAt(jointId,pick){
17919
18279
  captured above is detached, and mutating it would move nothing while the toast claimed it had.
17920
18280
  Cheap, and the alternative is a lie about geometry. (Codex code review.) */
17921
18281
  const live=(Array.isArray(C.joints)?C.joints:[]).find(j=>j&&j.id===jointId);
17922
- if(!live||live.kind!=='custom')throw new Error('the connection is no longer in this model');
18282
+ if(!live||live.kind!=='custom')throw Object.assign(new Error('The connection is no longer in this model; it may have been removed in another window.'),{forPerson:true});
17923
18283
  mutated=true; // only now may C move
17924
18284
  /* `edit()` SOFT-FAILS: a V2CommandError is caught, toasted, and reported by a `false` RETURN rather
17925
18285
  than a throw. Discarding that return was the one hole in the no-rollback argument — the
@@ -17944,7 +18304,9 @@ async function replaceConnectionAt(jointId,pick){
17944
18304
  console.warn('steel-editor: re-placement failed',e);
17945
18305
  toast(mutated
17946
18306
  ? '“'+name+'” was moved but is no longer being watched — use Place again… to start watching it'
17947
- : '“'+name+'” was not moved — '+((e&&e.message)?String(e.message):'the model could not be saved first'));
18307
+ /* #3097 3b: nothing moved yet, so the save before it, the untrack or the check above is what failed. Its
18308
+ sentence is the server's, the page's own (`forPerson`) or the shared one, never the thrown text. */
18309
+ : '“'+name+'” was not moved. '+sentenceCase(errorText(e,{action:'move it',retrySafe:true})));
17948
18310
  }finally{
17949
18311
  /* THE SINGLE MOST IMPORTANT ASSERTION IN THIS FEATURE. A leaked gate disables saving for the rest of
17950
18312
  the session, which is worse than the bug the gate fixes - so it is released on every path,
@@ -18018,10 +18380,10 @@ function legendView(){return view3d?'3d':'2d';}
18018
18380
  function legendVis(){const k=legendView();return k==='3d'&&!window.Steel3DView?null:LEGEND_PORTS[k];}
18019
18381
  function legendMembers(){return legendView()==='3d'?allMembers():(P.members||[]);}
18020
18382
  // The sheet's profile groups, as the 3D scene builds its own: first-seen order, keyed and labelled by the canonical profile.
18021
- function planGroups(){const seen=new Map();for(const m of P.members||[]){const k=profileKeyOf(m);if(!seen.has(k))seen.set(k,{key:k,label:k||'No profile',color:colorFor(m.profile)});}return [...seen.values()];}
18383
+ function planGroups(){const seen=new Map();for(const m of P.members||[]){const k=profileKeyOf(m);if(!seen.has(k))seen.set(k,{key:k,label:k||'No profile',color:memberColour(m)});}return [...seen.values()];}
18022
18384
  // What the 2D list is drawn from, so render() rebuilds it only when that changed (a sheet switch, an edit, a toggle).
18023
18385
  let legendShownKey='';
18024
- function legendKey(){return legendView()==='3d'?'3d':['2d',viewIdOf(P),planGroups().map(g=>g.key+':'+g.color+':'+categoryOfProfile(g.key)).join(','),(P.dims||[]).length,dimsVisible,!!gridOf(),gridOf()?gridOn():''].join('|');}
18386
+ function legendKey(){return legendView()==='3d'?'3d':['2d',viewIdOf(P),planGroups().map(g=>{const c=categoryOfProfile(g.key);return g.key+':'+g.color+':'+(c===MIXED_TYPES?memberTypeSplit(g.key):c);}).join(','),(P.dims||[]).length,dimsVisible,!!gridOf(),gridOf()?gridOn():''].join('|');}
18025
18387
  function syncLegendToPane(){if(legendTab!=='objects'||!C||!P)return;if(legendKey()!==legendShownKey)build3DLegend();else refreshLegendSel();}
18026
18388
  // Explorer-style multi-isolate on dbl-click of a legend group row: plain = isolate just this group; Ctrl = toggle
18027
18389
  // it in/out of the isolated set; Shift = the contiguous range from the anchor row to this one (in displayed order).
@@ -18110,12 +18472,16 @@ function memberTypeSettled(m,k){
18110
18472
  ?!!b&&b.type===p.brace.type&&b.floor===p.brace.floor&&b.offset===p.brace.offset&&b.lowerEnd===p.brace.lowerEnd
18111
18473
  :b===undefined);
18112
18474
  }
18113
- function applyMemberType(ms,k){
18475
+ // `write` is how the patch reaches the model. The default, ModelCmd.patchMember, sends a drawn row to the command session
18476
+ // through its link and patches an object with no link (a member not yet added) in place, so a stored member must not go
18477
+ // through it. A custom write returns false when the model refused the patch; that member keeps its type and connections.
18478
+ // Returns the connections notice it showed (or ''), so a caller that toasts after it can say it too.
18479
+ function applyMemberType(ms,k,write=ModelCmd.patchMember){
18114
18480
  let dropped=0,unsupported=0;
18115
18481
  for(const m of ms){if(!m)continue;
18116
18482
  const wasBrace=isBrace(m);
18117
18483
  const patch=memberTypePatch(m,k),type=patch.memberType;
18118
- ModelCmd.patchMember(m,patch);
18484
+ if(write(m,patch)===false)continue;
18119
18485
  // Becoming a brace ORPHANS any connection hanging off this member: the bake (steel-joints.expandJoints)
18120
18486
  // refuses a brace `main`, so the joint would linger in C.joints, never render, and vanish from 3D with no
18121
18487
  // explanation. Purge it here and say so, rather than leave a recipe that can never bake. (silent-failure review)
@@ -18129,8 +18495,10 @@ function applyMemberType(ms,k){
18129
18495
  j.secondaries=j.secondaries.filter(s=>s!==m.id);unsupported++;}
18130
18496
  }
18131
18497
  }
18132
- if(dropped||unsupported)toast([dropped?dropped+' connection'+(dropped>1?'s':'')+' removed':'',
18133
- unsupported?unsupported+' connection'+(unsupported>1?'s':'')+' lost its support':''].filter(Boolean).join(' · ')+' — a brace can’t carry or support one');
18498
+ const notice=dropped||unsupported?[dropped?dropped+' connection'+(dropped>1?'s':'')+' removed':'',
18499
+ unsupported?unsupported+' connection'+(unsupported>1?'s':'')+' lost its support':''].filter(Boolean).join(' · ')+' — a brace can’t carry or support one':'';
18500
+ if(notice)toast(notice);
18501
+ return notice;
18134
18502
  }
18135
18503
  function memberTypeValueFor(ms){const vals=ms.map(memberTypeOf),one=vals.every(v=>v===vals[0]);return one?memberTypeLabel(vals[0]):'';}
18136
18504
  function memberTypeField(id,ms){
@@ -18182,8 +18550,24 @@ function wireTypeFilter(p){
18182
18550
  b.onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();e.stopPropagation();act(e.altKey);}}; // native button Enter/Space bubbles to the global idle-repeat-last handler (:3838, !inForm) which preventDefaults activation — activate here + stopPropagation, mirroring the F12 RFI pill (:2632). Alt+Enter/Space isolates (keyboard parity).
18183
18551
  });
18184
18552
  }
18185
- function profileKeyOf(m){return canonProfile(m&&m.profile);} // matches the scene group key (contract-to-scene canonProfile)
18186
- function categoryOfProfile(profKey){for(const m of (P.members||[]))if(profileKeyOf(m)===profKey)return memberTypeOf(m);return 'beam';} // a profile-group's category = the type of its member(s)
18553
+ function profileKeyOf(m){return canonProfile(memberShownKey(m));} // the spelling the member carries (UC305X97): the plan's own group key (planGroups)
18554
+ // The key of the Objects row a member sits in. In 3D the rows are the scene's groups, and the bake keys a group by the
18555
+ // catalogue's name for the section (UC305*305*97, #2877) while the member carries the drawing's spelling (UC305X97),
18556
+ // so a 3D row is matched to its members through the scene itself. A member the scene did not draw keeps its own spelling,
18557
+ // as every member did before #2877: it sits in a row only where that spelling is also the scene's key. In 2D the rows
18558
+ // are the plan's own (planGroups). One key on both sides is what lets a row select its members, Follow selection
18559
+ // find a member's row, and By type put a profile under its members' type.
18560
+ function legendKeyOf(m){if(legendView()==='3d'){const el=m&&partsById[m.id];if(el&&el.group)return el.group;}return profileKeyOf(m);}
18561
+ // A profile-group's category is the type its members share, or MIXED_TYPES when they differ (#3208): filing a row by its
18562
+ // first member's type claimed a retype that had only partly happened. The key has a colon, which normMemberTypeKey never
18563
+ // produces, so no custom type can share it. ponytail: a full pass over the members per call, made per row on every build
18564
+ // and every 2D render() (legendKey), and per selected member (Follow selection); index member types by row key once per
18565
+ // model change if rows × members ever shows in a profile.
18566
+ const MIXED_TYPES=':mixed';
18567
+ function categoryOfProfile(profKey){let t=null;for(const m of legendMembers())if(legendKeyOf(m)===profKey){const k=memberTypeOf(m);if(t===null)t=k;else if(k!==t)return MIXED_TYPES;}return t||'beam';}
18568
+ // "Column 6 · Beam 2": how a mixed row's members split, most first.
18569
+ function memberTypeSplit(profKey){const n=new Map();for(const m of legendMembers())if(legendKeyOf(m)===profKey){const k=memberTypeOf(m);n.set(k,(n.get(k)||0)+1);}
18570
+ return [...n].sort((a,b)=>b[1]-a[1]).map(([k,c])=>memberTypeLabel(k)+' '+c).join(' · ');}
18187
18571
  let legendMode=(localStorage.getItem('floless.legendMode')==='type')?'type':'profile';
18188
18572
  // Built on OPEN, not once: profiles come and go as the model is edited. It lives at page scope rather
18189
18573
  // than inside wire3DBar() because building the swatch list needs the MODEL, not the 3D view, so the
@@ -18191,7 +18575,7 @@ let legendMode=(localStorage.getItem('floless.legendMode')==='type')?'type':'pro
18191
18575
  function legBuild(){const legMenu=document.getElementById('m3dLegendMenu');if(!legMenu)return;
18192
18576
  // Count as we go: the tally is the point of a legend, and it costs one pass either way.
18193
18577
  const tally=new Map();
18194
- for(const m of allMembers()){const pr=m.profile; if(pr)tally.set(pr,(tally.get(pr)||0)+1);}
18578
+ for(const m of allMembers()){const pr=memberShownKey(m); if(pr)tally.set(pr,(tally.get(pr)||0)+1);}
18195
18579
  if(!tally.size){legMenu.innerHTML='<div class=mlabel>No profiles in this model yet</div>';return;}
18196
18580
  // A steel designation is a family plus numbers. Sorting the whole string alphabetically put W14X176
18197
18581
  // ahead of W14X22, because '1' < '2' — nonsense to anyone reading section sizes. Compare the numeric
@@ -18249,9 +18633,9 @@ let legendMode=(localStorage.getItem('floless.legendMode')==='type')?'type':'pro
18249
18633
  let collapsedCats=new Set((()=>{try{return JSON.parse(localStorage.getItem('floless.legendCollapsed')||'[]');}catch{return [];}})());
18250
18634
  let legendQuery=''; // transient objects-list search filter (members + connections only) — NOT persisted
18251
18635
  let legendIdHits=[]; // #2998: the member ids the current search matched by id (applyLegendFilter); one → Enter selects it
18252
- // While a search is active, object categories (member types + connections) render EXPANDED so a match inside a
18636
+ // While a search is active, object categories (member types, Mixed types, connections, placed details) render EXPANDED so a match inside a
18253
18637
  // manually-collapsed category still surfaces — WITHOUT mutating the persisted collapsedCats.
18254
- function catForceOpen(cat){return !!legendQuery&&(cat==='placed-details'||memberTypeRecords().some(t=>t.k===cat)||/^conn-/.test(cat));}
18638
+ function catForceOpen(cat){return !!legendQuery&&(cat==='placed-details'||cat===MIXED_TYPES||memberTypeRecords().some(t=>t.k===cat)||/^conn-/.test(cat));}
18255
18639
  function saveLegendPrefs(){try{localStorage.setItem('floless.legendMode',legendMode);localStorage.setItem('floless.legendCollapsed',JSON.stringify([...collapsedCats]));}catch{}}
18256
18640
  // Drag a typed member row onto another type category to retype it. Pointer Events (NOT the HTML5 drag API,
18257
18641
  // which paints a white browser ghost on Windows). A 6px threshold tells a drag from the row's click(hide) /
@@ -18264,7 +18648,8 @@ function wireRowDrag(row,g){const handle=row.querySelector('.drag-handle');if(!h
18264
18648
  if(!started){if(Math.hypot(ev.clientX-sx,ev.clientY-sy)<6)return;started=true;row._dragging=true;clearTimeout(leg3dClickT); // crossed the threshold → it's a drag, not a click
18265
18649
  ghost=document.createElement('div');ghost.className='leg-drag-ghost';const sw=document.createElement('span');sw.className='lsw';sw.style.background=g.color;ghost.append(sw,document.createTextNode(g.label));doc.body.appendChild(ghost);}
18266
18650
  ghost.style.transform=`translate(${ev.clientX+12}px,${ev.clientY-14}px)`;
18267
- const elp=doc.elementFromPoint(ev.clientX,ev.clientY);const hdr=elp&&elp.closest?elp.closest('#m3dLegend .cat-hdr'):null;
18651
+ const elp=doc.elementFromPoint(ev.clientX,ev.clientY);let hdr=elp&&elp.closest?elp.closest('#m3dLegend .cat-hdr'):null;
18652
+ if(hdr&&hdr.dataset.cat===MIXED_TYPES)hdr=null; // Mixed types is not a type to drop onto
18268
18653
  if(hdr!==target){if(target)target.classList.remove('drop-target');target=hdr;if(target)target.classList.add('drop-target');}};
18269
18654
  const up=()=>{doc.removeEventListener('pointermove',move);doc.removeEventListener('pointerup',up);
18270
18655
  if(ghost)ghost.remove();if(target)target.classList.remove('drop-target');
@@ -18272,11 +18657,46 @@ function wireRowDrag(row,g){const handle=row.querySelector('.drag-handle');if(!h
18272
18657
  if(drop)retypeProfile(g.key,drop);};
18273
18658
  doc.addEventListener('pointermove',move);doc.addEventListener('pointerup',up);});}
18274
18659
  // Retype every member of a profile-group to `cat` (undoable); the legend re-categorises on rebuild + flashes the moved row.
18660
+ // The row's members are found the list's way (in 3D the model's own members, by the scene's group) and every one is written
18661
+ // through the command session by its id, so the model validates each change. That includes members no plan draws (read
18662
+ // only from an elevation, #3208): writing through the drawn rows, as the Properties type field does, left those on their
18663
+ // old type while the row filed under the new one. Owner ruling 2026-11-06: member by member — what the model accepts
18664
+ // changes, what it refuses keeps its type and is named, and one undo reverts the drop. Only members not already settled
18665
+ // as that type are written: a settled member's write changes nothing, so it must not turn a drop the model refused into
18666
+ // an undo step and a success flash. When it refuses every write, nothing changed, so edit() puts the model back and
18667
+ // leaves no undo step.
18275
18668
  function retypeProfile(profKey,cat){if(!memberTypeKnown(cat))return;
18276
- const targets=(P.members||[]).filter(m=>profileKeyOf(m)===profKey);
18277
- if(!targets.length||targets.every(m=>memberTypeOf(m)===cat))return; // already that type → no-op (no empty undo step)
18278
- edit(()=>applyMemberType(targets,cat));
18279
- setTimeout(()=>{const r=[...legendBody('root').querySelectorAll('#m3dLegend .lrow[data-key]')].find(r=>r.dataset.key===profKey);if(r){r.classList.add('flash');setTimeout(()=>r.classList.remove('flash'),400);}},250);}
18669
+ const targets=legendMembers().filter(m=>legendKeyOf(m)===profKey),toWrite=targets.filter(m=>!memberTypeSettled(m,cat));
18670
+ if(!toWrite.length)return; // already that type → no-op (no empty undo step)
18671
+ const refused=[];
18672
+ const write=(m,patch)=>{try{V2_SESSION.patchMember(m.id,patch);return true;}catch(err){if(!err||err.name!=='V2CommandError')throw err;refused.push({id:String(m.id),err});return false;}};
18673
+ let notice='';
18674
+ const ok=edit(()=>{notice=applyMemberType(toWrite,cat,write);if(refused.length===toWrite.length)throw refused[0].err;});
18675
+ // After edit(), so it replaces edit()'s own refusal line and applyMemberType's connections notice (which it repeats); held,
18676
+ // so the build status the next bake shows does not replace it. The reasons go to the console for the terminal AI.
18677
+ if(refused.length){for(const r of refused)console.warn('steel: retype refused',r.id,r.err.code,r.err.message,r.err.details);
18678
+ // The members that kept their type are selected, so all of them can be seen in 3D and in Properties however many there are.
18679
+ legendSelecting=true;try{clearWholeReferenceSelection();modelSelection.replaceMembers(refused.map(r=>r.id));modelSelection.clearGrids();selDimIds.clear();sel3dDimIds.clear();legendSelAnchor=null;render();}finally{legendSelecting=false;}
18680
+ answerToast(retypeRefusalText(refused,targets.length,cat)+(notice?' '+notice+'.':''));}
18681
+ if(!ok)return; // nothing moved: no flash on a row that stayed where it was
18682
+ // The row may land under a collapsed header (the type it was dropped on, or Mixed types after a partial drop): open it,
18683
+ // as Follow selection does, so the row is there to see rather than gone.
18684
+ if(collapsedCats.delete(categoryOfProfile(profKey))){saveLegendPrefs();build3DLegend();}
18685
+ setTimeout(()=>{const r=[...legendBody('root').querySelectorAll('#m3dLegend .lrow[data-key]')].find(r=>r.dataset.key===profKey);if(r){r.scrollIntoView({block:'nearest'});r.classList.add('flash');setTimeout(()=>r.classList.remove('flash'),400);}},250);}
18686
+ // What a drop left, which members kept their type and why (up to five named per reason; all of them selected). Each refusal is worded by its reason:
18687
+ // the column rule (a member stored running downward from its start cannot be a column) in words a detailer can act on,
18688
+ // any other as a check only the terminal AI can look into.
18689
+ function retypeRefusalText(refused,total,cat){
18690
+ const reasonOf=err=>err.code==='model-invalid'&&V2Validation.onlyColumnEndpointOrder(err.details)?'order':'other';
18691
+ const why={
18692
+ order:one=>'a column is stored bottom end first, and '+(one?'it runs':'they run')+' downward from '+(one?'its':'their')+' start. Ask your terminal AI to reverse '+(one?'it':'them')+', then drag the row again.',
18693
+ other:one=>'the model’s checks refused that type for '+(one?'it':'them')+'. Ask your terminal AI to look at '+(one?'it':'them')+'.'};
18694
+ const groups=new Map();for(const r of refused){const k=reasonOf(r.err);if(!groups.has(k))groups.set(k,[]);groups.get(k).push(r.id);}
18695
+ const list=ids=>ids.length===1?ids[0]:ids.length>6?ids.slice(0,5).join(', ')+' and '+(ids.length-5)+' more':ids.slice(0,-1).join(', ')+' and '+ids[ids.length-1]; // bounded: they are selected too
18696
+ const done=total-refused.length;
18697
+ return [done?done+' of '+total+' members are '+memberTypeLabel(cat)+'.':'',
18698
+ ...[...groups].map(([k,ids])=>list(ids)+' kept '+(ids.length===1?'its':'their')+' type: '+why[k](ids.length===1)),
18699
+ refused.length===1?'It is selected.':'They are selected.'].filter(Boolean).join(' ');}
18280
18700
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════
18281
18701
  // Panel tabs (Objects | Views | Favourites | References) + the Views Organizer.
18282
18702
  // #m3dLegend holds the four tab bodies the main window shows as panel tabs of its left Model section; only the
@@ -21084,7 +21504,7 @@ async function refRemove(r){
21084
21504
  const mid=newMutationId();claimMutation(mid);
21085
21505
  const res=await fetch(refApi('/'+encodeURIComponent(r.id)),{method:'DELETE',headers:{'x-floless-mutation-id':mid}});
21086
21506
  const d=await res.json().catch(()=>({}));
21087
- if(!res.ok||!d.ok){toast(d.error||'Could not remove that reference');return;}
21507
+ if(!res.ok||!d.ok){toast(refusalText(d,'Could not remove that reference.',{action:'remove that reference'}));return;}
21088
21508
  adoptReferenceWrite(d.etag);
21089
21509
  const i=refList().findIndex(x=>x&&x.id===r.id);if(i>=0)C.reference_models.splice(i,1);
21090
21510
  refGeom.delete(r.id);refRenderedGeom.delete(r.id);refUnresolved.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);
@@ -21437,7 +21857,7 @@ const RI_MAX_BYTES=150*1024*1024;
21437
21857
  // early. File A's storeys would then ride file B's sha, and the reader would select nothing.
21438
21858
  riProbeRows=null;riStoreyPick=null;riTypePick=null;riPopulation=null;
21439
21859
  riClearSoft();
21440
- if(!res.ok||!d.ok){riStage('drop');riErr(d.error||'Could not read that file.');return;}
21860
+ if(!res.ok||!d.ok){riStage('drop');riErr(refusalText(d,'Could not read that file.',{action:'read that file'}));return;}
21441
21861
  riSha=d.sha;riVerdict=d.verdict||null;
21442
21862
  {const bb=d.probe&&d.probe.bbox;riProbeCentre=bb?[0,1,2].map(i=>(bb.min[i]+bb.max[i])/2):null;}
21443
21863
  const said=d.probe&&d.probe.units&&d.probe.units.declared;
@@ -21547,7 +21967,9 @@ const RI_MAX_BYTES=150*1024*1024;
21547
21967
  }
21548
21968
  riClearSoft();
21549
21969
  if(!res.ok||!d.ok){
21550
- if(riBackgrounded)toast('Reference import failed — '+(d.error||'the model could not be added.'));
21970
+ // #3097 3b: the server's sentence only when it wrote one for the person, never a `diagnostic` error.
21971
+ const said=refusalText(d,'',{action:'add that reference'});
21972
+ if(riBackgrounded)toast('Reference import failed — '+(said||'the model could not be added.'));
21551
21973
  // STAY ON CONFIRM for the refusals the picker itself can fix. `riStage('drop')` swaps the whole
21552
21974
  // body back to the dropzone, so telling somebody to "choose fewer storeys or types" would
21553
21975
  // remove every control that lets them. The other failures still go back — there is nothing to
@@ -21558,8 +21980,8 @@ const RI_MAX_BYTES=150*1024*1024;
21558
21980
  ||d.code==='reference-empty-filter'||d.code==='reference-filter-unconfirmed';
21559
21981
  if(actionable&&riStageNow!=='drop'){
21560
21982
  riStage('confirm');
21561
- const e=ri$('riConfirmErr');e.textContent=d.error||'Could not add that reference.';e.style.display='block';
21562
- }else{riStage('drop');riErr(d.error||'Could not add that reference.');}
21983
+ const e=ri$('riConfirmErr');e.textContent=said||'Could not add that reference.';e.style.display='block';
21984
+ }else{riStage('drop');riErr(said||'Could not add that reference.');}
21563
21985
  return;
21564
21986
  }
21565
21987
  adoptReferenceWrite(d.etag);
@@ -21947,11 +22369,11 @@ const RI_MAX_BYTES=150*1024*1024;
21947
22369
  // A REFUSAL PAINTED INTO A HIDDEN PANEL IS A REFUSAL NOBODY READ. Backgrounded, this modal is
21948
22370
  // `display:none`, so the note below would render perfectly and silently.
21949
22371
  if(rvBackgrounded){
21950
- toast('Could not go back to version '+row.n+' of “'+r.name+'” — '+((d&&d.error)||'FloLess could not re-read it.'));
22372
+ toast('Could not go back to version '+row.n+' of “'+r.name+'” — '+refusalText(d,'FloLess could not re-read it.',{action:'go back to that version'}));
21951
22373
  rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
21952
22374
  }
21953
22375
  rvhPaint();rvStage('history');
21954
- rvhNote((d&&d.error)||'FloLess could not go back to that version.');
22376
+ rvhNote(refusalText(d,'FloLess could not go back to that version.',{action:'go back to that version'}));
21955
22377
  return;
21956
22378
  }
21957
22379
  }catch(e){
@@ -22198,7 +22620,7 @@ const RI_MAX_BYTES=150*1024*1024;
22198
22620
  const d=await res.json().catch(()=>({}));
22199
22621
  if(mine!==rvRun)return;
22200
22622
  rvClearSoft();
22201
- if(!res.ok||!d.ok){rvStage('drop');rvErr(d.error||'Could not read that file.');return;}
22623
+ if(!res.ok||!d.ok){rvStage('drop');rvErr(refusalText(d,'Could not read that file.',{action:'read that file'}));return;}
22202
22624
  rvSha=d.sha;
22203
22625
  rvSubmit(mine);
22204
22626
  }catch(e){
@@ -22262,7 +22684,7 @@ const RI_MAX_BYTES=150*1024*1024;
22262
22684
  // display:none — so the state below would render perfectly and silently. Say it out loud and
22263
22685
  // bring the panel back, which is where its remedies live (choose another file, load unfiltered).
22264
22686
  if(rvBackgrounded){
22265
- toast('Could not load a new version of “'+r.name+'” — '+((d&&d.error)||'the comparison could not be made.'));
22687
+ toast('Could not load a new version of “'+r.name+'” — '+refusalText(d,'the comparison could not be made.',{action:'load the new version'}));
22266
22688
  rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
22267
22689
  }
22268
22690
  rvRefusal(d,res.status);return;
@@ -22393,7 +22815,7 @@ const RI_MAX_BYTES=150*1024*1024;
22393
22815
  // dropped, so a read-only comparison gets only the one that applies. THERE IS NO FOURTH.
22394
22816
  actions=readOnly?[{id:'cancel',label:'Close',weight:'primary'}]:core.REFUSAL_ACTIONS;
22395
22817
  }else{
22396
- lead.textContent=(d&&d.error)||'Could not load a new version of this reference.';
22818
+ lead.textContent=refusalText(d,'Could not load a new version of this reference.',{action:'load a new version of this reference'});
22397
22819
  host.appendChild(lead);
22398
22820
  if(code==='reference-filter-unmatched'){
22399
22821
  actions=[{id:'cancel',label:'Cancel',weight:'ghost'},
@@ -22510,7 +22932,7 @@ const RI_MAX_BYTES=150*1024*1024;
22510
22932
  d=await res.json().catch(()=>({}));
22511
22933
  if(mine!==rvRun){releaseMutation(mid);return;}
22512
22934
  rvClearSoft();
22513
- if(!res.ok||!d.ok){releaseMutation(mid);rvStage('drop');rvErr(d.error||'Could not add that reference.');return;}
22935
+ if(!res.ok||!d.ok){releaseMutation(mid);rvStage('drop');rvErr(refusalText(d,'Could not add that reference.',{action:'add that reference'}));return;}
22514
22936
  }catch(e){
22515
22937
  if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
22516
22938
  if(mid)releaseMutation(mid);
@@ -22954,7 +23376,7 @@ const RI_MAX_BYTES=150*1024*1024;
22954
23376
  if(mine!==rcGhostRun)return;
22955
23377
  if(!res.ok||!d.ok){
22956
23378
  rcGhostGaveUp(ids,RC_GHOST_FATAL.has(d&&d.code),
22957
- (d&&d.error)||'The removed objects could not be drawn where they used to be — the list below still stands.');
23379
+ refusalText(d,'The removed objects could not be drawn where they used to be — the list below still stands.',{action:'draw the removed objects',retrySafe:true}));
22958
23380
  return;
22959
23381
  }
22960
23382
  const v=window.Steel3DView;
@@ -23215,15 +23637,17 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23215
23637
  // which row had focus and restore it at the end - ONLY if focus was already in this list, because
23216
23638
  // build3DLegend also runs on tab switches and model loads, where grabbing focus would yank the caret
23217
23639
  // out of whatever the user is actually using.
23218
- const legendRowId=r=>r?(r.dataset.key||r.dataset.connkey||r.dataset.dim||r.getAttribute('aria-label')||''):'';
23640
+ const legendRowId=r=>r?(r.dataset.key||r.dataset.connkey||r.dataset.dim||(r.dataset.gridz&&'gridz:'+r.dataset.gridz)||r.getAttribute('aria-label')||''):'';
23219
23641
  const refocus=(()=>{const a=host.ownerDocument.activeElement;return a&&host.contains(a)&&a.closest?legendRowId(a.closest('.lrow')):'';})();
23642
+ // …and a group header or its box (#3208: Instructor focuses them, and Enter / Space on one rebuilds the list).
23643
+ const refocusHdr=(()=>{const a=host.ownerDocument.activeElement,h=a&&host.contains(a)&&a.closest?a.closest('.cat-hdr'):null;return h?{cat:h.dataset.cat,box:!!(a.classList&&a.classList.contains('cat-tog'))}:null;})();
23220
23644
  const groups=in3d?window.Steel3DView.getGroups():planGroups(),placedDetails=in3d?(C.detail_placements||[]).filter(d=>d&&d.id):[];host.replaceChildren(); // 2D: only what is drawn on this sheet
23221
23645
  const empty=!groups.length&&!placedDetails.length;
23222
23646
  if(empty){host.appendChild(Object.assign(document.createElement('div'),{className:'lsempty',textContent:in3d?'No objects in the model yet.':'No members on this sheet yet.'}));
23223
23647
  if(in3d||!((P.dims||[]).length||gridOf()))return;} // the other tabs are independent of scene parts; a sheet with no members still lists its dimensions and grid
23224
23648
  const hint=document.createElement('div');hint.className='lhint';hint.textContent='click to select · box = show/hide (selection) · dbl-click = isolate (selection) · Ctrl/Shift to multi-select';if(!empty)host.appendChild(hint);
23225
23649
  const addRow=(g,indent,draggable)=>{const row=document.createElement('div');row.className='lrow'+(indent?' typed':'');row.dataset.key=g.key;
23226
- if(draggable){const dh=document.createElement('span');dh.className='drag-handle';dh.textContent='⠿';dh.dataset.tip='Drag onto another type';['click','dblclick'].forEach(ev=>dh.addEventListener(ev,e=>e.stopPropagation()));row.appendChild(dh);} // handle = the only drag initiator; swallow its own clicks so it never toggles the row
23650
+ if(draggable){const dh=document.createElement('span');dh.className='drag-handle';dh.textContent='⠿';dh.dataset.tip='Drag onto another type';dh.dataset.commandId='steel.objects-retype#'+g.label;dh.dataset.commandInstanceLabel=g.label;dh.tabIndex=-1;dh.setAttribute('role','button');dh.setAttribute('aria-label','Drag '+g.label+' onto another type');['click','dblclick'].forEach(ev=>dh.addEventListener(ev,e=>e.stopPropagation()));row.appendChild(dh);} // handle = the only drag initiator; swallow its own clicks so it never toggles the row
23227
23651
  const sw=document.createElement('span');sw.className='lsw';sw.style.setProperty('--sw',g.color);sw.setAttribute('role','checkbox');sw.dataset.tip='Show / hide';
23228
23652
  row.append(sw,document.createTextNode(g.label));
23229
23653
  // Show/hide lives on the BOX; dbl-click a row isolates. When the row is part of a multi-selection, the box toggles
@@ -23240,9 +23664,18 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23240
23664
  host.appendChild(row);return row;};
23241
23665
  // A collapsible legend category: chevron (collapse) + tri-state master on/off (■/□/◪) + label + count.
23242
23666
  // getState()→'on'|'off'|'mixed' drives the master glyph; onToggle() runs the master action (refresh follows).
23243
- const buildCatHeader=(cat,label,count,opts)=>{opts=opts||{};const hdr=document.createElement('div');hdr.className='cat-hdr'+(opts.empty?' empty':'')+(opts.sub?' sub':'');hdr.dataset.cat=cat;hdr._getState=opts.getState;
23244
- const catOpen=!collapsedCats.has(cat)||catForceOpen(cat);const chev=Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:catOpen?'▼':'▶'});
23667
+ const buildCatHeader=(cat,label,count,opts)=>{opts=opts||{};const hdr=document.createElement('div');hdr.className='cat-hdr'+(opts.empty?' empty':'')+(opts.sub?' sub':'');hdr.dataset.cat=cat;hdr.dataset.commandId='steel.objects-category#'+(opts.instance||label);hdr.dataset.commandInstanceLabel=opts.instance||label;hdr._getState=opts.getState;
23668
+ const catOpen=!collapsedCats.has(cat)||catForceOpen(cat);
23669
+ // Instructor's carrier (#3208): a button it can focus and describe, but not a tab stop — the list keeps one. Its sheet
23670
+ // names it (and the box) by data-command-instance-label, not by its text (▼■…(n)) or the box's aria-label.
23671
+ hdr.setAttribute('role','button');hdr.tabIndex=-1;hdr.setAttribute('aria-expanded',String(catOpen));
23672
+ hdr.addEventListener('keydown',e=>{if(e.target!==hdr||(e.key!=='Enter'&&e.key!==' '))return;e.preventDefault();e.stopPropagation();hdr.click();});
23673
+ const chev=Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:catOpen?'▼':'▶'});
23245
23674
  const tog=Object.assign(document.createElement('span'),{className:'cat-tog'});tog.dataset.tip=opts.toggleTitle||('Show / hide all '+label.toLowerCase());if(opts.empty||!opts.onToggle)tog.style.display='none';
23675
+ // The box is a control of its own, so Instructor names it rather than the header around it (#3208): a toggle button,
23676
+ // because Instructor's focus lookup (web/instructor.js focusFor) resolves [role="button"]; updateCatTog keeps aria-pressed.
23677
+ tog.dataset.commandId='steel.objects-category-visibility#'+(opts.instance||label);tog.dataset.commandInstanceLabel=opts.instance||label;tog.setAttribute('role','button');tog.tabIndex=-1;tog.setAttribute('aria-label','Show '+(opts.instance||label));
23678
+ tog.addEventListener('keydown',e=>{if(e.key!=='Enter'&&e.key!==' ')return;e.preventDefault();e.stopPropagation();tog.click();});
23246
23679
  const lab=Object.assign(document.createElement('span'),{className:'cat-label',textContent:label});
23247
23680
  const cnt=Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+count+')'});
23248
23681
  hdr.append(chev,tog,lab,cnt);
@@ -23250,7 +23683,7 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23250
23683
  if(opts.onToggle)tog.addEventListener('click',e=>{e.stopPropagation();opts.onToggle();refresh3DLegend();});
23251
23684
  updateCatTog(hdr);return hdr;};
23252
23685
  // master state/action over a set of part-group keys (members + connection categories share this)
23253
- const grpState=keys=>{const h=new Set(vis.groupState().hidden),sh=new Set(vis.selectionHiddenIds());let shown=0,hiddenCount=0;for(const k of keys){const ids=legendMembers().filter(m=>profileKeyOf(m)===k).map(m=>m.id),n=ids.filter(id=>sh.has(id)).length;if(h.has(k)||(ids.length&&n===ids.length))hiddenCount++;else if(n){}else shown++;}return hiddenCount===keys.length?'off':(shown===keys.length?'on':'mixed');};
23686
+ const grpState=keys=>{const h=new Set(vis.groupState().hidden),sh=new Set(vis.selectionHiddenIds());let shown=0,hiddenCount=0;for(const k of keys){const ids=legendMembers().filter(m=>legendKeyOf(m)===k).map(m=>m.id),n=ids.filter(id=>sh.has(id)).length;if(h.has(k)||(ids.length&&n===ids.length))hiddenCount++;else if(n){}else shown++;}return hiddenCount===keys.length?'off':(shown===keys.length?'on':'mixed');};
23254
23687
  const grpToggle=keys=>{vis.setGroupsHidden(keys,grpState(keys)==='on');}; // all-on → hide all; mixed/off → show all (also clears Hide-selected ids in those groups)
23255
23688
  const members=groups.filter(g=>g.key!=='detail'&&!CONN_ORDER.includes(g.key));
23256
23689
  const conns=groups.filter(g=>CONN_ORDER.includes(g.key)).sort((a,b)=>CONN_ORDER.indexOf(a.key)-CONN_ORDER.indexOf(b.key));
@@ -23269,7 +23702,7 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23269
23702
  const cir=document.createElementNS(NS,'circle');cir.setAttribute('cx','7');cir.setAttribute('cy','7');cir.setAttribute('r','4.5');
23270
23703
  const lin=document.createElementNS(NS,'line');lin.setAttribute('x1','10.6');lin.setAttribute('y1','10.6');lin.setAttribute('x2','14');lin.setAttribute('y2','14');
23271
23704
  svg.append(cir,lin);ico.append(svg);
23272
- const inp=document.createElement('input');inp.id='legSearch';inp.type='text';inp.placeholder='Search objects…';inp.autocomplete='off';inp.value=legendQuery;inp.setAttribute('role','searchbox');inp.setAttribute('aria-label','Search objects in the list');
23705
+ const inp=document.createElement('input');inp.id='legSearch';inp.type='text';inp.placeholder='Search mark, member ID or profile…';inp.dataset.commandId='steel.objects-search';inp.autocomplete='off';inp.value=legendQuery;inp.setAttribute('role','searchbox');inp.setAttribute('aria-label','Search objects in the list');
23273
23706
  const clr=Object.assign(document.createElement('span'),{className:'lsx',textContent:'×'});clr.dataset.tip='Clear';
23274
23707
  inp.addEventListener('input',()=>onLegendSearchInput(inp.value));
23275
23708
  inp.addEventListener('keydown',e=>{if(e.key==='Escape'){e.stopPropagation();if(inp.value){inp.value='';onLegendSearchInput('');}else{inp.blur();}}
@@ -23280,11 +23713,18 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23280
23713
  }
23281
23714
  if(legendMode==='type'&&members.length){ // group the profile-rows under their member-type categories
23282
23715
  const mtypes=memberTypeRecords();
23283
- const byCat=new Map(mtypes.map(t=>[t.k,[]]));
23716
+ const byCat=new Map([...mtypes.map(t=>[t.k,[]]),[MIXED_TYPES,[]]]);
23284
23717
  for(const g of members){(byCat.get(categoryOfProfile(g.key))||byCat.get('beam')).push(g);}
23285
23718
  for(const {k,label} of mtypes){const gs=byCat.get(k)||[],keys=gs.map(g=>g.key);
23286
23719
  host.appendChild(buildCatHeader(k,label,gs.length,{empty:!gs.length,getState:()=>grpState(keys),onToggle:()=>grpToggle(keys),toggleTitle:'Show / hide all '+label.toLowerCase()+'s'}));
23287
23720
  if(!collapsedCats.has(k)||catForceOpen(k))for(const g of gs)addRow(g,true,true);}
23721
+ // #3208: a row whose members are of different types files under none of them. Only shown when there is one: it is not a
23722
+ // type, so it is no place to drop a row. The split rides on the row as CSS content, so a search never matches on it.
23723
+ const mixed=byCat.get(MIXED_TYPES),mixedKeys=mixed.map(g=>g.key);
23724
+ if(mixed.length){const hdr=buildCatHeader(MIXED_TYPES,'Mixed types',mixed.length,{getState:()=>grpState(mixedKeys),onToggle:()=>grpToggle(mixedKeys),toggleTitle:'Show / hide all mixed-type profiles'});
23725
+ hdr.dataset.tip='These profiles hold members of different types. Drag a row onto a type to give all its members that type.';host.appendChild(hdr);
23726
+ if(!collapsedCats.has(MIXED_TYPES)||catForceOpen(MIXED_TYPES))for(const g of mixed){const r=addRow(g,true,true);r.dataset.mix=memberTypeSplit(g.key);
23727
+ r.setAttribute('aria-label',g.label+', mixed types: '+r.dataset.mix);}} // the row's own label overrides its CSS content, so the split is said here too
23288
23728
  } else for(const g of members)addRow(g);
23289
23729
  if(conns.length){ // group connection PARTS under their joint (Phase 2): each part-kind a row, hidden per-id
23290
23730
  if(members.length){host.appendChild(Object.assign(document.createElement('div'),{className:'ldiv'}));}
@@ -23350,7 +23790,7 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23350
23790
  host.appendChild(buildCatHeader('dims','Dimensions',DIM_CATS.length,{getState:dimState,onToggle:dimToggle,toggleTitle:'Show / hide all dimension overlays'}));
23351
23791
  if(!collapsedCats.has('dims')){host.appendChild(Object.assign(document.createElement('div'),{className:'lhint',textContent:'click the box to show / hide'}));
23352
23792
  for(const dc of DIM_CONN){const ck='dims-'+dc.ct; // middle category: overlays grouped by connection
23353
- host.appendChild(buildCatHeader(ck,dc.label,dc.cats.length,{sub:true,getState:()=>dcState(dc.cats),onToggle:()=>dcToggle(dc.cats),toggleTitle:'Show / hide all '+dc.label.toLowerCase()+' dimensions'}));
23793
+ host.appendChild(buildCatHeader(ck,dc.label,dc.cats.length,{sub:true,instance:dc.label+' dimensions',getState:()=>dcState(dc.cats),onToggle:()=>dcToggle(dc.cats),toggleTitle:'Show / hide all '+dc.label.toLowerCase()+' dimensions'}));
23354
23794
  if(!collapsedCats.has(ck))for(const k of dc.cats)addDimRow(k,DIM_LABEL[k],true);}
23355
23795
  }
23356
23796
  }else if((P.dims||[]).length){ // 2D: the dimensions drawn on this sheet, under the same switch as the ⋯ menu's Dimensions
@@ -23363,19 +23803,25 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23363
23803
  legendRowCheckbox(row,sw,label,flip); // no onEnter: a dimension row has no selection to reach
23364
23804
  host.appendChild(row);
23365
23805
  }
23366
- // GRID — the structural grid's visibility (per-plan contract data; same undoable switch as the panel
23367
- // checkbox and the ⋯ menu item). Only shown when this plan has a grid — slate outline swatch to match
23806
+ // GRID — the structural grid's visibility (contract data; the same undoable `on` switch as the panel checkbox
23807
+ // and the ⋯ menu item). Only shown when this plan has a grid — slate outline swatch to match
23368
23808
  // the grid's colour, not the cyan dim overlays.
23809
+ // In 3D a grid with several levels also lists one row per level, highest first (#3214). "Grid lines" stays the
23810
+ // whole-grid on/off switch, and its box shows how many levels are drawn: all, some (mixed) or none.
23369
23811
  if(gridOf()){
23370
23812
  host.appendChild(Object.assign(document.createElement('div'),{className:'ldiv'}));
23371
- const grow=document.createElement('div');grow.className='lrow dim';grow.dataset.tip='Show / hide the structural grid (2D + 3D)';
23372
- const gsw=document.createElement('span');gsw.className='lsw';gsw.style.setProperty('--sw','#64748b');gsw.setAttribute('role','checkbox');gsw.dataset.tip='Show / hide';
23373
- grow.append(gsw,document.createTextNode('Grid lines'));
23374
- grow.classList.toggle('dimoff',!gridOn());
23375
- const gflip=()=>gridSetVisible(!gridOn());
23376
- gsw.addEventListener('click',e=>{e.stopPropagation();gflip();});gsw.addEventListener('dblclick',e=>e.stopPropagation());
23377
- legendRowCheckbox(grow,gsw,'Grid lines',gflip); // no onEnter: the grid row has no selection to reach
23378
- host.appendChild(grow);
23813
+ const levels=in3d?gridLegendLevels():[],st=levels.length?gridLegendState(levels):(gridOn()?'on':'off');
23814
+ const gridRow=(label,tip,indent,state,flip,name)=>{const row=document.createElement('div');row.className='lrow dim'+(indent?' typed':'')+(state==='mixed'?' mixed':'');row.dataset.tip=tip;
23815
+ const sw=document.createElement('span');sw.className='lsw';sw.style.setProperty('--sw','#64748b');sw.setAttribute('role','checkbox');sw.dataset.tip='Show / hide';
23816
+ row.append(sw,document.createTextNode(label));row.classList.toggle('dimoff',state==='off');
23817
+ sw.addEventListener('click',e=>{e.stopPropagation();flip();});sw.addEventListener('dblclick',e=>e.stopPropagation());
23818
+ legendRowCheckbox(row,sw,name||label,flip); // no onEnter: a grid row has no selection to reach. A level's name adds its elevation, so two levels labelled alike are told apart.
23819
+ host.appendChild(row);return row;};
23820
+ const grow=gridRow('Grid lines',levels.length?'Show / hide the grid lines (2D + 3D); the level boxes choose which levels':'Show / hide the structural grid (2D + 3D)',false,st,()=>levels.length?gridLegendToggleAll(levels):gridSetVisible(!gridOn()));
23821
+ grow.dataset.gridz='all';grow.dataset.commandId='steel.objects-grid-lines';
23822
+ for(const lv of levels.slice().reverse()){ // highest first: the list reads as the grid stands in the model
23823
+ const row=gridRow(lv.name,'Show / hide the grid at this level (3D only)',true,lv.shown?'on':'off',()=>gridLegendToggleLevel(lv,levels),lv.instance);
23824
+ row.dataset.gridz=String(lv.key);row.dataset.commandId='steel.objects-grid-level#'+lv.instance;row.dataset.commandInstanceLabel=lv.instance;}
23379
23825
  }
23380
23826
  // CLIP — one provider-neutral list and interaction session is mounted by the shared 3D layer.
23381
23827
  // Steel and Revit therefore share selection, range selection, rename, enable, delete and empty-state behavior.
@@ -23393,7 +23839,9 @@ function build3DLegend(){const host=legendBody('objects'),vis=legendVis(),in3d=l
23393
23839
  const keyRows=[...host.querySelectorAll('.lrow:not(.qhide)')].filter(r=>r.getAttribute('role')==='checkbox');
23394
23840
  if(keyRows.length)refTreeRoving(keyRows,'lsel');
23395
23841
  if(refocus){const back=keyRows.find(r=>legendRowId(r)===refocus); // the rebuilt twin of the row they were on
23396
- if(back){keyRows.forEach(r=>{r.tabIndex=r===back?0:-1;});back.focus();}}} // the Objects body's visibility is owned by the active-tab class, not set here
23842
+ if(back){keyRows.forEach(r=>{r.tabIndex=r===back?0:-1;});back.focus();}}
23843
+ if(refocusHdr){const h=[...host.querySelectorAll('.cat-hdr')].find(x=>x.dataset.cat===refocusHdr.cat),t=h&&(refocusHdr.box?h.querySelector('.cat-tog'):h);
23844
+ if(t&&t.style.display!=='none')t.focus();}} // the Objects body's visibility is owned by the active-tab class, not set here
23397
23845
  // Permanent visibility menu: selection exposes Isolate/Hide; Ghost stays available and active treatment keeps
23398
23846
  // Show all reachable after Hide selected clears that now-invisible selection. Updated on every relevant change.
23399
23847
  function updateIsolateBtn(){return modelEditor?.getState?.()??null;} // compatibility call sites only; shared toolbar chrome owns Visibility DOM
@@ -23425,7 +23873,7 @@ function updateWorkBtn(){const b=document.getElementById('m3dWork'),ck=document.
23425
23873
  // A type category's master toggle reads its profiles' hide state: all visible = ■ on, all hidden = □ off,
23426
23874
  // some = ◪ mixed. Colour comes from data-state (CSS); the glyph from the textContent.
23427
23875
  function updateCatTog(hdr){const tog=hdr&&hdr.querySelector('.cat-tog');if(!tog||!hdr._getState||tog.style.display==='none')return;
23428
- const state=hdr._getState();tog.dataset.state=state;tog.textContent=state==='on'?'■':(state==='off'?'□':'◪');}
23876
+ const state=hdr._getState();tog.dataset.state=state;tog.textContent=state==='on'?'■':(state==='off'?'□':'◪');tog.setAttribute('aria-pressed',state==='on'?'true':state==='off'?'false':'mixed');}
23429
23877
  function refresh3DLegend(){const vis=legendVis();if(!vis)return;const st=vis.groupState(),hidden=new Set(st.hidden),solo=new Set(st.solo),sh=new Set(vis.selectionHiddenIds());
23430
23878
  legendBody('root').querySelectorAll('#m3dLegend .lrow[data-key]').forEach(r=>{const k=r.dataset.key,ids=legRowIds(r),n=ids.filter(id=>sh.has(id)).length;const off=hidden.has(k)||(solo.size>0&&!solo.has(k))||(ids.length>0&&n===ids.length),mixed=!off&&n>0;r.classList.toggle('off',off);r.classList.toggle('mixed',mixed);r.classList.toggle('solo',solo.size>0&&solo.has(k));legendRowChecked(r);}); // PROFILE rows: filled=shown, hollow=hidden, dash=mixed
23431
23879
  const ch=new Set(vis.connHiddenIds()); // per-part connection hide
@@ -23471,7 +23919,7 @@ function followLegendSelection(rows){
23471
23919
  if(!legendFollow||legendTab!=='objects'||!selIds.size){legendFollowKey='';return;}
23472
23920
  const key=[...selIds].sort().join(',');if(key===legendFollowKey)return;
23473
23921
  if(legendSelecting){legendFollowKey=key;return;} // chosen in the list itself: nothing to bring into view
23474
- if(legendMode==='type'){const shut=new Set();for(const m of legendMembers())if(selIds.has(m.id)){const cat=categoryOfProfile(profileKeyOf(m));if(collapsedCats.has(cat))shut.add(cat);}
23922
+ if(legendMode==='type'){const shut=new Set();for(const m of legendMembers())if(selIds.has(m.id)){const cat=categoryOfProfile(legendKeyOf(m));if(collapsedCats.has(cat))shut.add(cat);}
23475
23923
  if(shut.size){shut.forEach(c=>collapsedCats.delete(c));saveLegendPrefs();build3DLegend();return;}} // the rebuild marks the rows and comes back here
23476
23924
  legendFollowKey=key;
23477
23925
  const first=rows.find(r=>r.classList.contains('lfollow'));if(first&&first.scrollIntoView)first.scrollIntoView({block:'nearest'});}
@@ -23516,28 +23964,33 @@ function applyLegendFilter(){
23516
23964
  host.querySelectorAll('.lidhit').forEach(t=>t.remove());legendIdHits=[]; // a row's own text, never last pass's tag, is what it is matched on
23517
23965
  if(!q){rows.forEach(r=>r.classList.remove('qhide'));host.querySelectorAll('.cat-hdr.qhide').forEach(h=>h.classList.remove('qhide'));return;}
23518
23966
  // #2998: a row also matches by the ids of what it holds (a member id such as c-021, the id AI decisions, Make precise,
23519
- // Inspect and the chat all use). A row grouped by profile holds many, so the matched id is shown after its label.
23520
- const byKey=new Map();for(const m of legendMembers())if(m&&m.id!=null){const k=profileKeyOf(m);if(!byKey.has(k))byKey.set(k,[]);byKey.get(k).push(String(m.id));}
23967
+ // Inspect and the chat all use), and by a member's part marks: the marks the drawings gave it (the Mark row in
23968
+ // Properties), which is what an RFI or a fabricator quotes. A row grouped by profile holds many, so what matched is shown
23969
+ // after its label: the id, or the mark with its member's id.
23970
+ const byKey=new Map();for(const m of legendMembers())if(m&&m.id!=null){const k=legendKeyOf(m);if(!byKey.has(k))byKey.set(k,[]);byKey.get(k).push(String(m.id));}
23971
+ const finds=id=>id.toLowerCase().includes(q)||memberMarks(id).some(k=>k.toLowerCase().includes(q));
23972
+ const whole=id=>id.toLowerCase()===q||memberMarks(id).some(k=>k.toLowerCase()===q);
23973
+ const said=id=>id.toLowerCase().includes(q)?id:memberMarks(id).find(k=>k.toLowerCase().includes(q))+' ('+id+')';
23521
23974
  let any=false;const tagged=[];
23522
23975
  rows.forEach(r=>{const textHit=(r.textContent||'').toLowerCase().includes(q);
23523
23976
  const ids=r.dataset.key?(byKey.get(r.dataset.key)||[]):(r._ids||[]).map(String);
23524
- const exactFirst=(a,b)=>(b.toLowerCase()===q)-(a.toLowerCase()===q)||a.localeCompare(b); // a typed whole id leads its row's tag
23525
- // Every member whose id matches is a candidate for Enter, also in a row its label already matched (a member IPE300 in
23526
- // the IPE300 row); only a row found by id alone needs the tag that says why it is shown.
23527
- const idMatches=ids.filter(id=>id.toLowerCase().includes(q)).sort(exactFirst),idHits=textHit?[]:idMatches;
23977
+ const exactFirst=(a,b)=>whole(b)-whole(a)||a.localeCompare(b); // a typed whole id or mark leads its row's tag
23978
+ // Every member whose id or mark matches is a candidate for Enter, also in a row its label already matched (a member
23979
+ // IPE300 in the IPE300 row); only a row found by id or mark alone needs the tag that says why it is shown.
23980
+ const idMatches=ids.filter(finds).sort(exactFirst),idHits=textHit?[]:idMatches;
23528
23981
  if(r.dataset.key)legendIdHits.push(...idMatches);
23529
23982
  const hit=textHit||idHits.length>0;r.classList.toggle('qhide',!hit);if(hit)any=true;
23530
23983
  if(idHits.length)tagged.push([r,idHits]);});
23531
- // A whole id typed is that member, even when it also begins longer ids (m-12 of m-120, m-121).
23532
- const exact=legendIdHits.filter(id=>id.toLowerCase()===q);if(exact.length===1)legendIdHits=exact;
23984
+ // A whole id or mark typed is that member, even when it also begins longer ones (m-12 of m-120, m-121).
23985
+ const exact=legendIdHits.filter(whole);if(exact.length===1)legendIdHits=exact;
23533
23986
  const one=legendIdHits.length===1;
23534
23987
  for(const [r,idHits] of tagged){const t=document.createElement('span');t.className='lidhit';
23535
- t.textContent='· '+idHits[0]+(idHits.length>1?' +'+(idHits.length-1)+' more':'');
23536
- t.dataset.tip=one&&r.dataset.key&&idHits[0]===legendIdHits[0]?'Member '+idHits[0]+' is in this group. Press Enter in the search box to select only it.'
23537
- :'Matched by id: '+idHits.slice(0,8).join(', ')+(idHits.length>8?', …':'')+'. Clicking the row selects the whole group.';
23988
+ t.textContent='· '+said(idHits[0])+(idHits.length>1?' +'+(idHits.length-1)+' more':'');
23989
+ t.dataset.tip=one&&r.dataset.key&&idHits[0]===legendIdHits[0]?'Member '+said(idHits[0])+' is in this group. Press Enter in the search box to select only it.'
23990
+ :'Matched by mark or member ID: '+idHits.slice(0,8).map(said).join(', ')+(idHits.length>8?', …':'')+'. Clicking the row selects the whole group.';
23538
23991
  r.appendChild(t);}
23539
23992
  host.querySelectorAll('.cat-hdr').forEach(h=>{const cat=h.dataset.cat||'';
23540
- if(!(memberTypeRecords().some(t=>t.k===cat)||/^conn-/.test(cat)||cat==='placed-details'))return; // leave the Dimensions/Clip headers untouched
23993
+ if(!(memberTypeRecords().some(t=>t.k===cat)||/^conn-/.test(cat)||cat==='placed-details'||cat===MIXED_TYPES))return; // leave the Dimensions/Clip headers untouched
23541
23994
  let vis=false;
23542
23995
  for(let n=h.nextElementSibling;n&&!n.classList.contains('cat-hdr')&&!n.classList.contains('lsec')&&!n.classList.contains('ldiv');n=n.nextElementSibling){
23543
23996
  if((n.matches('.lrow[data-key]')||n.matches('.lrow[data-connkey]')||n.matches('.lrow[data-detailkey]'))&&!n.classList.contains('qhide')){vis=true;break;}}
@@ -23547,7 +24000,7 @@ function applyLegendFilter(){
23547
24000
  }
23548
24001
  // Resolve a row to the member/connection ids it represents. A member row's data-key is a profile key; a connection
23549
24002
  // row carries its part ids on row._ids. Used by legend click-to-select + the box/isolate SELECTION actions below.
23550
- function legRowIds(row){if(!row)return [];if(row.dataset.connkey||row.dataset.detailkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return legendMembers().filter(m=>profileKeyOf(m)===k).map(m=>m.id);} // 3D: v2's list shows root members, so its lookup uses the format-aware model list; 2D: this sheet's members only
24003
+ function legRowIds(row){if(!row)return [];if(row.dataset.connkey||row.dataset.detailkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return legendMembers().filter(m=>legendKeyOf(m)===k).map(m=>m.id);} // 3D: v2's list shows root members, so its lookup uses the format-aware model list; 2D: this sheet's members only
23551
24004
  let bar3dWired=false;
23552
24005
  function seg3dActive(sel,attr,val){document.querySelectorAll(sel+' button').forEach(b=>{const on=b.getAttribute(attr)===val;b.classList.toggle('on',on);
23553
24006
  // The tick is a CSS ::after on `.on`, which announces nothing. These are EXCLUSIVE choices, so the
@@ -24323,8 +24776,8 @@ function exportPayload(){
24323
24776
  // be a function that carries what it needs.
24324
24777
  const wireEnd=e=>e?{tos:e.tosMm,note:e.note,tosDef:e.tosDef,detail:e.detail,conn:e.conn,connVerified:e.connVerified}:e;
24325
24778
  const wireCol=c=>c?{bos:c.bosMm,tos:c.tosMm,note:c.note,tosDef:c.tosDef,detail:c.detail,conn:c.conn,connVerified:c.connVerified}:c;
24326
- return {mm_per_px:(P&&P.mm_per_px>0)?P.mm_per_px:FT_TO_MM/12,elev_units:'mm',members:P.members.map(m=>{ensureMeta(m);return {profile:m.profile,workpoint:m.wp,role:m.role,rfi:_wtPlf(m.profile)==null,
24327
- length_ft:+_lenFt(m).toFixed(1),weight_plf:_plfWire(_wtPlf(m.profile)), // `_wtPlf`, never `_wtBill`: this field's NAME says pounds per foot // columns measure vertical height (TOS−BOS), not their ~0 plan-point distance
24779
+ return {mm_per_px:(P&&P.mm_per_px>0)?P.mm_per_px:FT_TO_MM/12,elev_units:'mm',members:P.members.map(m=>{ensureMeta(m);return {profile:m.profile,workpoint:m.wp,role:m.role,rfi:_memberPlf(m)==null,
24780
+ length_ft:+_lenFt(m).toFixed(1),weight_plf:_plfWire(_memberPlf(m)), // `_wtPlf`, never `_wtBill`: this field's NAME says pounds per foot // columns measure vertical height (TOS−BOS), not their ~0 plan-point distance
24328
24781
  ends:m.role==='column'?undefined:(m.ends||[]).map(wireEnd), column:m.role==='column'?wireCol(m.col):undefined};})};}
24329
24782
  /* #2521 row 5b: the downloaded file says what the EXACT document it was made from rests on. The live model (unsaved
24330
24783
  edits included) is labelled by the server: the /scene route answers `quick` for a Quick or possibly Quick candidate
@@ -25353,7 +25806,7 @@ document.getElementById('framesLevelNew').onclick=()=>frLevelNew();
25353
25806
  // to it — which is why a member no view can draw gets a sentence instead of them.
25354
25807
  function rfiSymptomMembersIn(scope){
25355
25808
  const src=scope==='sheet'?(P.members||[]):allMembers();
25356
- return src.filter(m=>m&&_wtPlf(m.profile)==null);
25809
+ return src.filter(m=>m&&_memberPlf(m)==null);
25357
25810
  }
25358
25811
  // A European/British designation, correctly spelled and simply not in a US catalogue. Telling its
25359
25812
  // author to "check the designation" sends them hunting a typo that is not there — which became the
@@ -25361,7 +25814,7 @@ function rfiSymptomMembersIn(scope){
25361
25814
  // still fail are mostly these. Prefixes match sectionKindOf's, which already knows them by sight.
25362
25815
  // …and it only means anything while the model resolves against a US catalogue. A UK model resolves
25363
25816
  // these perfectly, so firing there would tell a user their own catalogue cannot hold their own steel.
25364
- const _isEuroSection=p=>_modelEnvironment()!=='UK'&&/^(IPE|HE[ABM]?|UB|UC|UKB|UKC|UKA|PFC|UPN|UPE)\s*\d/i.test(String(p||'').trim());
25817
+ const _isEuroSection=p=>SteelEnv.looksLikeForeignSection(_envTraits().id,p);
25365
25818
  /** The one sentence for a dead section table, shared so `rfiSymptomReason` can recognise it EXACTLY
25366
25819
  * rather than re-testing the flag — see that function for why the difference is load-bearing. */
25367
25820
  const RFI_CATALOG_REASON='The section table could not be loaded — sizes and weights are unavailable. Reload the page.';
@@ -25375,7 +25828,7 @@ function rfiReason(m){if(!m.profile)return 'No profile assigned';
25375
25828
  // after"). Sending its author to check a designation that is perfectly correct is the same
25376
25829
  // misdirection the European case above exists to stop.
25377
25830
  if(_aiscKgM(m.profile)!=null)return 'This model records no weight for that size — the designation itself is a standard '+_catalogLabel()+' shape';
25378
- if(_isEuroSection(m.profile))return 'European/British section — this catalogue holds AISC (US) shapes only, so it can’t resolve here';
25831
+ if(_isEuroSection(m.profile))return _envTraits().foreignSectionNoun.replace(/^./,c=>c.toUpperCase())+' — this catalogue holds '+_envTraits().shapesHeldNote+', so it can’t resolve here';
25379
25832
  return 'Size not in the '+_catalogLabel()+' table — check the designation';}
25380
25833
  // #628. The tooltip on a verified row's ✓ Verified pill. It was shared with a second marker — a green
25381
25834
  // number chip — so the two could never drift apart; that chip's CSS was never emitted after the RFI list
@@ -25769,7 +26222,7 @@ function rfiOutstandingCount(){
25769
26222
  const live=rfiLiveByGap();
25770
26223
  let n=0;
25771
26224
  for(const r of rfiState.records)if(r&&(r.status!=='closed'||rfiRecordHasLiveGap(r)))n++;
25772
- for(const m of allMembers())if(m&&_wtPlf(m.profile)==null&&!live.has(rfiSizeGapKey(m.id)))n++;
26225
+ for(const m of allMembers())if(m&&_memberPlf(m)==null&&!live.has(rfiSizeGapKey(m.id)))n++;
25773
26226
  _rfiCount={key,n};
25774
26227
  return n;
25775
26228
  }
@@ -26080,7 +26533,7 @@ function rfiSubjectOf(r){
26080
26533
  /** Does the model ON SCREEN still say this member has no priceable size? The server checks the STORED
26081
26534
  * contract, so this is the local half of the same question — and it is why Apply and `resolved` are
26082
26535
  * withheld rather than offered-and-refused after somebody blanks the profile on the row itself. */
26083
- const rfiLocallyUnresolved=id=>{const m=allMembers().find(x=>x&&x.id===id);return !!m&&_wtPlf(m.profile)==null;};
26536
+ const rfiLocallyUnresolved=id=>{const m=allMembers().find(x=>x&&x.id===id);return !!m&&_memberPlf(m)==null;};
26084
26537
  /** Both actions the server decides against the model need it readable. */
26085
26538
  const rfiSizeTruthKnown=()=>rfiState.sizeTruth==='known';
26086
26539
  /** RFI correspondence preserves a trailing roll marker even though the accepted contract has already
@@ -28893,7 +29346,7 @@ function rfiRecordRowHtml(r){
28893
29346
  const copy=r.text?'<button data-command-id="steel.rfi-copy#'+esc(r.id)+'" data-command-instance-label="'+esc(r.id+(kind?' — '+kind:''))+'" data-rfi-ctl=copy class=ghost data-rfi-copy="'+esc(r.id)+'" data-tip="Copy the whole RFI as text, to paste into an email">Copy whole RFI</button>':'';
28894
29347
  // A filed SIZE question keeps the control that answers it. See `rfiResolveControls`.
28895
29348
  const sizeOf=ids.length===1&&r.kind==='unknown-size'&&r.gapKey===rfiSizeGapKey(ids[0])?ids[0]:null;
28896
- const unresolved=sizeOf&&(()=>{const m=allMembers().find(x=>x&&x.id===sizeOf);return !!m&&_wtPlf(m.profile)==null;})();
29349
+ const unresolved=sizeOf&&(()=>{const m=allMembers().find(x=>x&&x.id===sizeOf);return !!m&&_memberPlf(m)==null;})();
28897
29350
  const profileMismatch=rfiProfileTruthMismatch(r);
28898
29351
  const answerMismatch=r.status==='answered'&&!r.applied&&r.answerResolution&&r.answerResolution.known===true
28899
29352
  &&r.answerResolution.resolved===false?r.answerResolution:null;
@@ -29496,7 +29949,7 @@ function openRaiseRfi(jointId,checkId,invoker){
29496
29949
  if(rfiFormFor&&rfiOpen())return 'An RFI form is open in the RFI list. Finish or cancel it, then press Raise an RFI again.';
29497
29950
  if(rfiOpen())closeRFI();
29498
29951
  rfiRaiseReturn=invoker&&invoker.isConnected?invoker:(document.activeElement instanceof Element?document.activeElement:null);
29499
- rfiRaise={jointId,checkId:checkId||null,status:'loading',data:null,error:'',useSaved:false,expanded:null,forms:new Map(),outcomes:new Map(),busy:null,generation:-1,seq:++rfiRaiseSeq};
29952
+ rfiRaise={jointId,checkId:checkId||null,status:'loading',data:null,note:'',useSaved:false,expanded:null,forms:new Map(),outcomes:new Map(),busy:null,generation:-1,seq:++rfiRaiseSeq};
29500
29953
  // Bring back every attempt on this connection that is still waiting to be settled, as it was left.
29501
29954
  for(const[key,attempt]of rfiRaiseUnsettled){
29502
29955
  if(attempt.jointId!==jointId)continue;
@@ -29537,10 +29990,10 @@ async function raiseRfiSaved(){
29537
29990
  }
29538
29991
  async function raiseRfiLoad(keepMessage){
29539
29992
  const r=rfiRaise;if(!r)return;const seq=r.seq;
29540
- r.status='loading';if(!keepMessage)r.error='';renderRaiseRfi();
29993
+ r.status='loading';if(!keepMessage)r.note='';renderRaiseRfi();
29541
29994
  const unsaved=await raiseRfiSaved();
29542
29995
  if(rfiRaise!==r||r.seq!==seq)return;
29543
- if(unsaved&&!r.useSaved){r.status='unsaved';r.error=unsaved;renderRaiseRfi();return;}
29996
+ if(unsaved&&!r.useSaved){r.status='unsaved';r.note=unsaved;renderRaiseRfi();return;}
29544
29997
  r.generation=modelEditGeneration;
29545
29998
  const ctl=new AbortController(),timer=setTimeout(()=>ctl.abort(),RFI_RAISE_DEADLINE_MS);
29546
29999
  let res=null,body=null;
@@ -29550,7 +30003,7 @@ async function raiseRfiLoad(keepMessage){
29550
30003
  if(rfiRaise!==r||r.seq!==seq)return;
29551
30004
  if(!res||!res.ok||!body||body.ok!==true){
29552
30005
  r.status='failed';
29553
- r.error=body&&typeof body.error==='string'&&body.error?rfiRaiseCap(body.error):'FloLess could not read the questions for connection '+r.jointId+' just now. Try again in a moment.';
30006
+ r.note=personText(body)?rfiRaiseCap(personText(body)):'FloLess could not read the questions for connection '+r.jointId+' just now. Try again in a moment.';
29554
30007
  renderRaiseRfi();return;
29555
30008
  }
29556
30009
  r.data=body;r.status='ready';
@@ -29592,13 +30045,13 @@ function renderRaiseRfi(){
29592
30045
  if(!r)return;
29593
30046
  if(r.status==='loading'){list.append(rfiRaiseEl('div',{class:'rfiempty'},'Reading this connection’s questions…'));return;}
29594
30047
  if(r.status==='unsaved'){
29595
- banner.hidden=false;banner.append(document.createTextNode(r.error+' '),
30048
+ banner.hidden=false;banner.append(document.createTextNode(r.note+' '),
29596
30049
  rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-use-saved#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'use-saved',onclick:()=>{r.useSaved=true;raiseRfiLoad();}},'Show the saved model’s questions'));
29597
30050
  list.append(rfiRaiseEl('div',{class:'rfiempty'},'Save your edits, or go on with the saved model.'));return;
29598
30051
  }
29599
30052
  if(r.status==='failed'){
29600
30053
  const box=rfiRaiseEl('div',{class:'rfiempty'});
29601
- box.append(rfiRaiseEl('b',null,'The questions for connection '+r.jointId+' could not be read.'),document.createTextNode(r.error),rfiRaiseEl('br'),
30054
+ box.append(rfiRaiseEl('b',null,'The questions for connection '+r.jointId+' could not be read.'),document.createTextNode(r.note),rfiRaiseEl('br'),
29602
30055
  rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-retry#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'retry',onclick:()=>raiseRfiLoad()},'Try again'));
29603
30056
  list.append(box);return;
29604
30057
  }
@@ -29607,7 +30060,7 @@ function renderRaiseRfi(){
29607
30060
  if(r.data&&r.data.rfisUnavailable)notes.push(r.data.rfisUnavailable);
29608
30061
  if(notes.length){banner.hidden=false;banner.textContent=notes.join(' ');}
29609
30062
  const storeBlind=!!(r.data&&r.data.rfisUnavailable);
29610
- if(r.error){const e=rfiRaiseEl('div',{class:'rfifail',role:'alert'},r.error);list.append(e);}
30063
+ if(r.note){const e=rfiRaiseEl('div',{class:'rfifail',role:'alert'},r.note);list.append(e);}
29611
30064
  const qs=raiseRfiOrdered();
29612
30065
  if(!qs.length){
29613
30066
  const box=rfiRaiseEl('div',{class:'rfiempty'});
@@ -29736,7 +30189,7 @@ async function raiseRfiFile(checkId){
29736
30189
  }
29737
30190
  // A definite answer settles the attempt, wherever the person now is.
29738
30191
  rfiRaiseUnsettled.delete(rfiRaiseKey(r.jointId,checkId));
29739
- if(!here){toast(res.ok?'Filed as '+body.rfi.id+'.':rfiRaiseCap(body.error||'This RFI was not filed.'),false,9000);if(res.ok&&typeof refreshRfiRecords==='function')refreshRfiRecords();return;}
30192
+ if(!here){toast(res.ok?'Filed as '+body.rfi.id+'.':rfiRaiseCap(personText(body)||'This RFI was not filed.'),false,9000);if(res.ok&&typeof refreshRfiRecords==='function')refreshRfiRecords();return;}
29740
30193
  if(res.ok&&body&&body.ok===true&&body.rfi&&body.rfi.id){
29741
30194
  const id=body.rfi.id,said='Filed as '+id+(form.action==='send'?' and marked sent.':' with the answer recorded.');
29742
30195
  r.forms.delete(checkId);r.outcomes.set(checkId,{kind:'filed',text:said,rfiId:id});
@@ -29749,7 +30202,7 @@ async function raiseRfiFile(checkId){
29749
30202
  console.error('[steel] an RFI about a connection was refused',{status:res.status,code,error:body&&body.error});
29750
30203
  // A definite answer: this attempt is over, so a fresh key goes with the next one.
29751
30204
  form.opKey=null;form.request=null;
29752
- const said=body&&typeof body.error==='string'&&body.error?rfiRaiseCap(body.error):'FloLess could not file this RFI just now, and did not say why. Try again in a moment.';
30205
+ const said=personText(body)?rfiRaiseCap(personText(body)):'FloLess could not file this RFI just now, and did not say why. Try again in a moment.';
29753
30206
  if(code==='rfi-connection-question-changed'||code==='rfi-connection-question-gone'||code==='rfi-promote-stale'){
29754
30207
  r.outcomes.set(checkId,{kind:'refused',text:said+(code==='rfi-connection-question-changed'?' The question was read again: check it, then file it.':'')});
29755
30208
  await raiseRfiLoad(true);
@@ -29965,6 +30418,123 @@ function _wtKgM(profile){if(!profile)return null;
29965
30418
  function _wtPlf(profile){const kgm=_wtKgM(profile);return kgm==null?null:kgm/LB_PER_FT_TO_KG_PER_M;}
29966
30419
  function _wtBill(profile){const kgm=_wtKgM(profile);
29967
30420
  return kgm==null?null:(displayUnits()===DisplayUnits.MM?kgm:kgm/LB_PER_FT_TO_KG_PER_M);}
30421
+ // Add-ons S1a: a member on a CUSTOM section weighs its own area times its material's density, never a catalogue row
30422
+ // that happens to share its designation (MIRRORS server/member-properties.ts). One FloLess cannot vouch for, and the
30423
+ // person has not accepted as an assumption, has no weight, so it reads as unpriced exactly like an unresolved size.
30424
+ function customOf(m){return m&&typeof m.customSectionId==='string'&&CustomSections?CustomSections.resolveCustomSection(C,m):null;}
30425
+ function _memberKgM(m){const c=customOf(m);if(c)return c.usable&&c.section?CustomSections.customKgPerM(c.section,CustomSections.densityFor(m.material)):null;return _wtKgM(m&&m.profile);}
30426
+ function _memberPlf(m){const kgm=_memberKgM(m);return kgm==null?null:kgm/LB_PER_FT_TO_KG_PER_M;}
30427
+ function _memberBill(m){const kgm=_memberKgM(m);return kgm==null?null:(displayUnits()===DisplayUnits.MM?kgm:kgm/LB_PER_FT_TO_KG_PER_M);}
30428
+ // The plan tooltip for a member whose custom section is not usable.
30429
+ // Placement maths (Profile Position, the frame rebase) reads the same section the export places: a usable custom
30430
+ // section's own outline (inches here, like profileDimsIn), none for one FloLess cannot vouch for, else the catalogue.
30431
+ function memberDimsIn(m){const c=customOf(m);if(c)return c.usable&&c.section?{w:c.section.width/IN_TO_MM,d:c.section.depth/IN_TO_MM,round:false}:null;return profileDimsIn(m&&m.profile);}
30432
+ function memberShapeComponents(m,w,d,scale,round){const c=customOf(m);if(c&&c.usable&&c.section)return [c.section.outline.map(([x,y])=>[x/IN_TO_MM/12*scale,y/IN_TO_MM/12*scale])];return sectionShapeComponents(m.profile,w,d,scale,round);}
30433
+ // A custom member is coloured and grouped by its unique label, never its designation, so two same-name sections
30434
+ // never share a colour or a legend row (the 3D groups use the same labels: server/contract-to-scene.ts).
30435
+ let customColourLabels=new Map();
30436
+ // THE NAMES ARE THE SERVER'S (POST /api/contract/:appId/custom-sections/labels: modelCustomSectionLabels, the one
30437
+ // function the bill and the 3D groups use). The editor never works one out: its catalogue resolves aliases the server's
30438
+ // does not (HSS20.000X0.500 for HSS20X.500), so a name made here could be one no 3D group or bill line carries. The
30439
+ // answer is kept with the model it was asked for (`sig`) and used only while the model still matches; a newer ask
30440
+ // wins over an older answer; a failed ask is retried on a later render, at most every 5 s. Until there is an answer
30441
+ // for this model, a custom member is drawn and listed under its stored designation and cannot be recoloured.
30442
+ let customLabelsState={sig:'',labels:new Map(),currentSig:'',pendingSig:'',seq:0,failedSig:'',failedAt:0};
30443
+ function customLabelFields(){
30444
+ const members=(Array.isArray(C&&C.members)?C.members:[]).filter(m=>m&&typeof m==='object').map(m=>{const o={};if(typeof m.profile==='string')o.profile=m.profile;if(typeof m.customSectionId==='string')o.customSectionId=m.customSectionId;return o;});
30445
+ const sections=(C.custom_sections||[]).filter(s=>s&&typeof s.sectionId==='string').map(s=>({ // a fresh request body, built whole: nothing in the model is written
30446
+ sectionId:s.sectionId,
30447
+ ...(typeof s.designation==='string'?{designation:s.designation}:{}),
30448
+ ...(s.params&&typeof s.params==='object'?{params:s.params}:{}),
30449
+ }));
30450
+ const o={members,custom_sections:sections};if(typeof C.environment==='string')o.environment=C.environment;return o;}
30451
+ function refreshCustomLabels(){
30452
+ const st=customLabelsState;
30453
+ if(!CustomSections||!Array.isArray(C&&C.custom_sections)||!C.custom_sections.length){st.currentSig='';if(st.pendingSig){st.seq++;st.pendingSig='';}return;}
30454
+ const model=customLabelFields(),sig=JSON.stringify(model);st.currentSig=sig;
30455
+ if(sig===st.sig||sig===st.pendingSig)return;
30456
+ if(sig===st.failedSig&&Date.now()-st.failedAt<5000)return;
30457
+ const seq=++st.seq;st.pendingSig=sig;
30458
+ fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/custom-sections/labels'+PROJECT_QS,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({model})})
30459
+ .then(async r=>{let j=null;try{j=await r.json();}catch{}
30460
+ if(seq!==st.seq)return;
30461
+ if(!r.ok||!j||!j.ok||!j.labels||typeof j.labels!=='object')throw new Error((j&&j.error)||('the server answered '+r.status));
30462
+ st.sig=sig;st.pendingSig='';st.labels=new Map(Object.entries(j.labels).filter(([,v])=>typeof v==='string'));render();})
30463
+ .catch(e=>{if(seq!==st.seq)return;st.pendingSig='';st.failedSig=sig;st.failedAt=Date.now();
30464
+ console.warn('steel-editor: FloLess could not name the custom sections in this model; their members show the stored designation until it can.',(e&&e.message)||e);});
30465
+ }
30466
+ // The server's names for THIS model, or none while it has not answered for it.
30467
+ function currentCustomLabels(){const st=customLabelsState;return st.currentSig&&st.sig===st.currentSig?st.labels:new Map();}
30468
+ function editorCustomLabels(){return customColourLabels;}
30469
+ // The model and spellings the colours read: custom members under their names, and no name borrowing or lending a
30470
+ // catalogue spelling (CustomSections.labelSafeSpellings, the same rule the scene colours by).
30471
+ function colourModelNow(){return CustomSections?CustomSections.colourModel(C,customColourLabels):C;}
30472
+ function editorColourSpellings(){return CustomSections?CustomSections.labelSafeSpellings(customColourLabels,profileColourSpellings):profileColourSpellings;}
30473
+ // A custom member's colour key is its name, or null while FloLess has not named its section for this model.
30474
+ function memberColourKey(m){return m&&typeof m.customSectionId==='string'?(customColourLabels.get(m.customSectionId)||null):(m&&m.profile);}
30475
+ function memberShownKey(m){const k=memberColourKey(m);return k==null?(m&&m.profile):k;}
30476
+ // Whether `key` is the stored designation an unnamed custom member is shown under right now.
30477
+ function customColourPending(key){if(!CustomSections||!Array.isArray(C&&C.custom_sections)||!C.custom_sections.length)return false;
30478
+ const k=canonProfile(key);return (C.members||[]).some(m=>m&&typeof m.customSectionId==='string'&&!customColourLabels.has(m.customSectionId)&&canonProfile(m.profile)===k);}
30479
+ function memberColour(m){return colorFor(memberShownKey(m));}
30480
+ function customTipFor(m){const c=customOf(m);return !c||c.usable?'':c.assumable===false?'Custom section shown as a placeholder and not counted yet. Open the member to see why.':'Unreadable custom section. Open the member to proceed on an assumption or ask the AI to fix it.';}
30481
+ // Each custom section's unique label (the one the bill and the 3D legend use), and the reverse lookup.
30482
+ // Only sections FloLess has named for this model are offered: two may share a designation, so before the names arrive
30483
+ // there is no word that picks exactly one of them.
30484
+ function customSectionChoices(){if(!CustomSections||!Array.isArray(C&&C.custom_sections)||!C.custom_sections.length)return [];
30485
+ const labels=editorCustomLabels();return C.custom_sections.filter(x=>x&&labels.has(x.sectionId)).map(x=>({sectionId:x.sectionId,label:labels.get(x.sectionId)}));}
30486
+ const CUSTOM_NONE='— none (catalogue profile) —';
30487
+ // Put a custom section in this model on members (one undo step), or take it off them (the profile text stays).
30488
+ function applyCustomSectionChoice(ids,label){
30489
+ if(label===CUSTOM_NONE){edit(()=>{for(const id of ids){const m=byId(id);if(m&&m.customSectionId)ModelCmd.patchMember(m,{customSectionId:undefined,rfi:_wtPlf(m.profile)==null});}});return;}
30490
+ const pick=customSectionChoices().find(x=>x.label===label);if(!pick)return;
30491
+ const section=C.custom_sections.find(x=>x.sectionId===pick.sectionId),definition=(C.section_definitions||[]).find(d=>d&&d.id===section.definitionId);
30492
+ if(!definition){toast('That custom section has lost its definition, so it cannot be placed. Ask the AI to fix it.');return;}
30493
+ edit(()=>{V2_SESSION.placeCustomSection({definition,section,memberIds:ids});});
30494
+ }
30495
+ function customParamsText(sec){const p=sec&&sec.params||{};return Object.keys(p).sort().map(k=>k+' '+CustomSections.formatValue(p[k])).join(' · ');}
30496
+ // The Inspect block for one member on a custom section (add-ons S1a). Read-only facts plus, for a section FloLess
30497
+ // cannot vouch for, the two ways forward; an accepted assumption is named and can be withdrawn.
30498
+ function customSectionInspectHTML(m){
30499
+ const c=customOf(m);if(!c)return '';
30500
+ const sec=c.section,def=c.definition;
30501
+ const head=sec?`<b>${esc(sec.designation||m.profile||'Custom section')}</b>`:`<b>${esc(m.profile||'Custom section')}</b>`;
30502
+ const src=sec&&sec.definitionId?` · from <span data-tip="Made by the AI chat or an add-on. Nobody has checked this definition.">${esc(sec.definitionId)} · not reviewed</span>`:'';
30503
+ const pill=c.assumed?' <span class=pill data-tip="You chose to proceed on an assumption: this section is used as stored, and every bill and export says so.">Assumption</span>':'';
30504
+ let rows=`<div class=divrow><hr><span class=sect style="margin:0">Custom section</span><hr></div>
30505
+ <div class="row hint" id=customSecHead role=note>${head}${src}${pill}</div>`;
30506
+ if(sec){const d=CustomSections.densityFor(m.material);
30507
+ rows+=`<div class="row hint">${esc(customParamsText(sec))} mm${Number.isFinite(sec.area)?` · Area ${Number(sec.area).toLocaleString()} mm²`:sec.tapered?' · no single area (it tapers)':' · no area stored'}</div>
30508
+ <div class="row hint" role=note>Weight basis: ${esc(d.basis)}</div>`;}
30509
+ if(!c.usable){
30510
+ // A section an assumption cannot help (a parametric section this FloLess checks but does not draw yet, or one missing
30511
+ // a stored value) says why in the shared module's own words, and offers no "Proceed on assumption" that would do nothing.
30512
+ const why=c.assumable===false&&c.label?esc(c.label):'This section comes from a definition this FloLess cannot read (a newer kind or version), or its shape no longer matches its recipe. The member is left out of quantities and exports until you choose.';
30513
+ rows+=`<div class="row hint" id=customSecWhy role=note><span class=pill style="background:var(--err-bg)">${c.assumable===false?'Left out':'Left out — section unreadable'}</span> ${why}</div>
30514
+ <div class=row style="gap:6px;flex-wrap:wrap"><button type=button data-command-id="steel.custom-section-ask-ai" class=ghostw id=customSecAsk>Ask AI to fix</button>${sec&&c.assumable!==false?'<button type=button data-command-id="steel.custom-section-assume" class=ghostw id=customSecAssume data-tip="Use the stored shape as it is. The member counts in quantities and exports, labelled as an assumption.">Proceed on assumption</button>':''}</div>`;
30515
+ }else if(c.assumed){
30516
+ rows+=`<div class=row><button type=button data-command-id="steel.custom-section-withdraw" class=ghostw id=customSecWithdraw data-tip="Stop using this section until it can be checked. The member is left out of quantities and exports again.">Withdraw assumption</button></div>`;
30517
+ }
30518
+ return rows;
30519
+ }
30520
+ function wireCustomSectionInspect(m){
30521
+ const c=customOf(m);if(!c)return;
30522
+ const ask=document.getElementById('customSecAsk');
30523
+ const named=`Member ${m.id} uses the custom section ${(c.section&&c.section.designation)||m.profile} (definition ${(c.section&&c.section.definitionId)||'unknown'})`;
30524
+ if(ask)ask.onclick=()=>askAiOpen({mode:'modify',text:c.assumable===false&&c.label
30525
+ ?`${named}. FloLess says: ${c.label} Please fix it so FloLess can draw and count it, or tell me what is wrong with it.`
30526
+ :`${named}, which FloLess cannot check: its definition is of a kind or version this FloLess cannot read, or its stored shape no longer matches its recipe. Please fix the definition so the section can be checked, or tell me what is wrong with it.`});
30527
+ const setAssumption=accept=>edit(()=>{V2_SESSION.setCustomSectionAssumption(c.sectionId,accept?CustomSections.assumptionFor(c.section,new Date().toISOString()):null);});
30528
+ const assume=document.getElementById('customSecAssume');if(assume)assume.onclick=()=>setAssumption(true);
30529
+ const withdraw=document.getElementById('customSecWithdraw');if(withdraw)withdraw.onclick=()=>setAssumption(false);
30530
+ }
30531
+ // The "Custom section" picker row (only when the model holds custom sections). `members` share the label shown, or it reads "— mixed —".
30532
+ function customSectionPickerHTML(members,id){
30533
+ const choices=customSectionChoices();if(!choices.length)return '';
30534
+ const labels=editorCustomLabels(),of=m=>m.customSectionId?(labels.get(m.customSectionId)||''):CUSTOM_NONE;
30535
+ const vals=[...new Set(members.map(of))],mixed=vals.length>1;
30536
+ return `<div class="f"><div class=elab>Custom section</div><input ${members.length===1?'data-command-id="steel.member-custom-section"':'data-command-id="steel.selection-custom-section"'} aria-label="Custom section" id=${id} class=combo data-src=customsections value="${mixed?'':esc(vals[0]||CUSTOM_NONE)}" placeholder="${mixed?'— mixed —':''}" autocomplete=off data-tip="Pick a custom section in this model for ${members.length===1?'this member':'these members'}. None keeps the profile text."></div>`;
30537
+ }
29968
30538
  // The words a quantity is spelled with, per system — the same spellings `server/bom-units.ts` uses, so
29969
30539
  // a number and the sentence about it cannot disagree. `t` is the SI symbol for a tonne; `T` is a tesla.
29970
30540
  const UNIT_WORDS={'ft-in':{weight:'lb',tonnage:'tons'},
@@ -30615,6 +31185,7 @@ const COMBO_SRC={
30615
31185
  details:()=>detTexts(), // the SAME list the Details modal shows — see detTexts (#397)
30616
31186
  sheets:()=>[...new Set((C.plans||[]).map(p=>p&&p.sheet).filter(Boolean))], // the sheets this model has, for a callout's "Points to sheet" (free text is still allowed)
30617
31187
  favcats:()=>FAV_CAT_SUGGEST[favCatKind]||[],
31188
+ customsections:()=>[CUSTOM_NONE,...customSectionChoices().map(x=>x.label)], // add-ons S1a: pick only
30618
31189
  connrows:()=>['— none —',...(C.connections||[]).map(r=>connLabel(r))],
30619
31190
  framelevels:()=>['Not set',...(FramesCore?FramesCore.levelsOf(C.moment_frames).map(l=>l.name):[])] // the Frames dialog's "which level is this sheet?" picker (#2210): pick only
30620
31191
  };