@wafertools/wafermap 0.35.0 → 0.36.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 (97) hide show
  1. package/AGENTS.md +18 -9
  2. package/CHANGELOG.md +246 -0
  3. package/README.md +7 -4
  4. package/dist/packages/canvas-adapter/chartPrefs.d.ts +16 -0
  5. package/dist/packages/canvas-adapter/chartPrefs.js +1 -0
  6. package/dist/packages/canvas-adapter/charts/boxplot.js +1 -1
  7. package/dist/packages/canvas-adapter/charts/capability.js +1 -1
  8. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  9. package/dist/packages/canvas-adapter/charts/histogram.js +1 -1
  10. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  11. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  12. package/dist/packages/canvas-adapter/index.d.ts +1 -0
  13. package/dist/packages/canvas-adapter/index.js +1 -1
  14. package/dist/packages/canvas-adapter/insightsTab.d.ts +7 -0
  15. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  16. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +20 -5
  17. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  18. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +85 -38
  19. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  20. package/dist/packages/canvas-adapter/summaryPanel.d.ts +38 -12
  21. package/dist/packages/canvas-adapter/summaryPanel.js +4 -2
  22. package/dist/packages/canvas-adapter/summaryToggle.d.ts +11 -0
  23. package/dist/packages/canvas-adapter/summaryToggle.js +1 -0
  24. package/dist/packages/canvas-adapter/testValueOffer.d.ts +14 -0
  25. package/dist/packages/canvas-adapter/testValueOffer.js +1 -0
  26. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  27. package/dist/packages/canvas-adapter/toolbar.d.ts +2 -0
  28. package/dist/packages/canvas-adapter/toolbar.js +2 -2
  29. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  30. package/dist/packages/canvas-adapter/userGuideHtml.js +46 -23
  31. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  32. package/dist/packages/canvas-adapter/version.js +1 -1
  33. package/dist/packages/canvas-adapter/warnings.js +1 -1
  34. package/dist/packages/core/aggregates.d.ts +10 -0
  35. package/dist/packages/core/aggregates.js +1 -1
  36. package/dist/packages/core/classify.d.ts +5 -0
  37. package/dist/packages/core/classify.js +1 -1
  38. package/dist/packages/core/dieTable.d.ts +31 -0
  39. package/dist/packages/core/dieTable.js +1 -1
  40. package/dist/packages/core/passBins.d.ts +6 -0
  41. package/dist/packages/core/passBins.js +1 -1
  42. package/dist/packages/core/wafer.d.ts +10 -1
  43. package/dist/packages/core/wafer.js +1 -1
  44. package/dist/packages/renderer/buildView.d.ts +5 -0
  45. package/dist/packages/renderer/buildView.js +1 -1
  46. package/dist/packages/renderer/buildWaferMap.d.ts +50 -4
  47. package/dist/packages/renderer/buildWaferMap.js +1 -1
  48. package/dist/packages/renderer/derivedTests/parser.js +1 -1
  49. package/dist/packages/renderer/fmt.d.ts +10 -0
  50. package/dist/packages/renderer/fmt.js +1 -1
  51. package/dist/packages/renderer/index.d.ts +1 -0
  52. package/dist/packages/renderer/index.js +1 -1
  53. package/dist/packages/renderer/spec.d.ts +4 -0
  54. package/dist/packages/renderer/spec.js +1 -1
  55. package/dist/packages/renderer/valueFilter.d.ts +55 -0
  56. package/dist/packages/renderer/valueFilter.js +1 -0
  57. package/dist/packages/stats/analyzeWaferLot.d.ts +16 -0
  58. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  59. package/dist/packages/stats/analyzeWaferMap.d.ts +62 -4
  60. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  61. package/dist/packages/stats/capability.d.ts +5 -0
  62. package/dist/packages/stats/capability.js +1 -1
  63. package/dist/packages/stats/clusterDetection.js +1 -1
  64. package/dist/packages/stats/connectedComponents.d.ts +19 -0
  65. package/dist/packages/stats/connectedComponents.js +1 -1
  66. package/dist/packages/stats/correlation.d.ts +36 -4
  67. package/dist/packages/stats/correlation.js +1 -1
  68. package/dist/packages/stats/filterFindings.d.ts +1 -1
  69. package/dist/packages/stats/filterFindings.js +1 -1
  70. package/dist/packages/stats/findingText.d.ts +8 -0
  71. package/dist/packages/stats/findingText.js +2 -2
  72. package/dist/packages/stats/index.d.ts +2 -1
  73. package/dist/packages/stats/index.js +1 -1
  74. package/dist/packages/stats/lotDrift.js +1 -1
  75. package/dist/packages/stats/lotPattern.js +1 -1
  76. package/dist/packages/stats/math.d.ts +25 -3
  77. package/dist/packages/stats/math.js +1 -1
  78. package/dist/packages/stats/mergeTestDefs.js +1 -1
  79. package/dist/packages/stats/patternClassification.d.ts +44 -18
  80. package/dist/packages/stats/patternClassification.js +1 -1
  81. package/dist/packages/stats/plotData.d.ts +11 -0
  82. package/dist/packages/stats/plotData.js +1 -1
  83. package/dist/packages/stats/regions.d.ts +6 -0
  84. package/dist/packages/stats/regions.js +1 -1
  85. package/dist/packages/stats/renderSummaryReport.js +33 -33
  86. package/dist/packages/stats/reportHtml.d.ts +12 -18
  87. package/dist/packages/stats/reportHtml.js +112 -48
  88. package/dist/packages/stats/synthesis.d.ts +48 -17
  89. package/dist/packages/stats/synthesis.js +1 -1
  90. package/dist/packages/stats/testPassRate.js +1 -1
  91. package/dist/packages/stats/testValueBudget.d.ts +15 -0
  92. package/dist/packages/stats/testValueBudget.js +1 -0
  93. package/dist/packages/stats/types.d.ts +89 -22
  94. package/llms.txt +2 -2
  95. package/package.json +1 -1
  96. package/dist/packages/canvas-adapter/summaryRail.d.ts +0 -7
  97. package/dist/packages/canvas-adapter/summaryRail.js +0 -1
@@ -72,7 +72,7 @@ export const USER_GUIDE_HTML=`<div class="wmap-guide">
72
72
  .wmap-guide-toc{display:none!important}
73
73
  }
74
74
  </style>
75
- <h1 id="wafer-map-user-guide">Wafer Map \u2014 User Guide<span class="wmap-guide-version" title="Built 2026-10-06T15:43:33.651Z">v0.35.0</span></h1>
75
+ <h1 id="wafer-map-user-guide">Wafer Map \u2014 User Guide<span class="wmap-guide-version" title="Built 2026-10-13T15:00:36.302Z">v0.36.0</span></h1>
76
76
  <p class="wmap-guide-online-link">This is a quick reference. <a href="https://wafertools.github.io/wafermap/user-guide/" target="_blank" rel="noopener">View the full illustrated guide online \u2197</a></p>
77
77
  <p>This guide describes the display and analysis features of the wafer map viewer.
78
78
  It is written for users who may be semiconductor test engineers, device engineers, and yield engineers
@@ -232,7 +232,9 @@ outside the test limits are marked with a triangle \u2014 pointing <strong>down
232
232
  for above the high limit</strong> \u2014 so they stand out without leaving the distribution. The
233
233
  triangle is drawn black or white per die for contrast against its own colour, so
234
234
  it stays visible under any colour scheme, and its shape (not colour) carries the
235
- below/above-limit meaning.</li>
235
+ below/above-limit meaning. On dies too small to carry one (under 5 pixels, as on a dense
236
+ wafer zoomed out) the triangles are left off and the colour bar says <strong>\u25BD\u25B3 limit marks: zoom
237
+ in</strong>; zoom in and they appear.</li>
236
238
  <li><strong>Limit pass/fail</strong>: when active, dies within the test limits are shown in
237
239
  a pass colour and dies outside them are highlighted \u2014 <strong>blue for below the
238
240
  low limit</strong>, <strong>red for above the high limit</strong>. Both flags apply
@@ -247,6 +249,16 @@ the tester&#39;s own recorded verdict rather than a limit judgement (there is
247
249
  no gradient to fall back to). <strong>Test pass/fail</strong> is also available as an
248
250
  Overlays option on an ordinary parametric test when it carries recorded
249
251
  verdicts, as an alternative to limit judgement.</p>
252
+ <h3 id="values-outside-a-limit-set">Values outside a limit set</h3>
253
+ <p>A tester that runs out of range records its rail instead of a reading: a current held at the compliance clamp, a voltage at the supply, an
254
+ open-circuit value. A test can carry <strong>validity limits</strong>, the range a real measurement lies in, and a value outside them is not a reading. It
255
+ is <strong>missing</strong> for that test on that die: grey on the map, and left out of the statistics and every chart, so one clamp cannot stretch the colour
256
+ scale or move the mean, \u03C3 and Cpk. Which limit set a value must lie inside is the host&#39;s choice. The usual one is the validity limits, which only
257
+ affect tests that have them; a host can instead keep only values inside the specification limits or the test limits, or filter nothing.</p>
258
+ <p>Nothing is hidden. Hover a grey die and the tooltip names the excluded value and the limit set. The Summary panel&#39;s Test Values table shows the
259
+ total beside <strong>N</strong> and an <strong>Excl.</strong> column, and the same count appears in the histogram and box plot captions, the capability tooltip and caption,
260
+ the Plot tab&#39;s footnote, the report and the CSV exports. The build also lists it among the data warnings. The bin map and each die&#39;s pass/fail are
261
+ the tester&#39;s own and do not change, so yield is the same with the filter on or off.</p>
250
262
  <div data-wmap-demo="value-heatmap" class="wmap-demo"></div><div data-wmap-demo="spec-passfail" class="wmap-demo"></div><hr>
251
263
  <h3 id="derived-tests">Derived tests (\u2020)</h3>
252
264
  <p>A test name marked <strong>\u2020</strong> in front is a <em>derived</em> test: its value was calculated
@@ -357,11 +369,6 @@ shows die tooltips \u2014 a separate thing from the toolbar, which is always pre
357
369
  <td>Downloads the current map view as a PNG. Captures the canvas as displayed, including all active overlays and the legend.</td>
358
370
  </tr>
359
371
  <tr>
360
- <td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNOCAydjQiLz48cGF0aCBkPSJNMTIgMnY0Ii8+PHBhdGggZD0iTTE2IDJ2NCIvPjxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxOCIgeD0iNCIgeT0iNCIgcng9IjIiLz48cGF0aCBkPSJNOCAxMGg2Ii8+PHBhdGggZD0iTTggMTRoOCIvPjxwYXRoIGQ9Ik04IDE4aDUiLz48L3N2Zz4K" width="20" height="20"></td>
361
- <td>Findings</td>
362
- <td>Opens or closes the Summary panel (see <a href="#6-summary-panel" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'6-summary-panel\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Section 6</a>).</td>
363
- </tr>
364
- <tr>
365
372
  <td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNMTAuMjkgMy44NiAxLjgyIDE4YTIgMiAwIDAgMCAxLjcxIDNoMTYuOTRhMiAyIDAgMCAwIDEuNzEtM0wxMy43MSAzLjg2YTIgMiAwIDAgMC0zLjQyIDB6Ii8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4K" width="20" height="20"></td>
366
373
  <td>Data warnings</td>
367
374
  <td>Appears <strong>only when there is something to report</strong> about the data behind the map. Click it for the details. A red \u26D4 means the map may be positionally wrong \u2014 usually that wafer geometry was guessed rather than supplied, so dies may not sit where they appear to. An amber \u26A0 means something expected is missing or was skipped, but what is drawn is correct.</td>
@@ -547,11 +554,6 @@ it as a file and send it to whoever supports this software.</p>
547
554
  <td>Test Value mode with test limits only. Toggles all cards between the limit range and the data range. Leave it on the test limits when comparing wafers \u2014 the data range rescales per view.</td>
548
555
  </tr>
549
556
  <tr>
550
- <td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNOCAydjQiLz48cGF0aCBkPSJNMTIgMnY0Ii8+PHBhdGggZD0iTTE2IDJ2NCIvPjxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxOCIgeD0iNCIgeT0iNCIgcng9IjIiLz48cGF0aCBkPSJNOCAxMGg2Ii8+PHBhdGggZD0iTTggMTRoOCIvPjxwYXRoIGQ9Ik04IDE4aDUiLz48L3N2Zz4K" width="20" height="20"></td>
551
- <td>Summary panel</td>
552
- <td>Opens or closes the Summary panel covering every wafer in the gallery.</td>
553
- </tr>
554
- <tr>
555
557
  <td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNMTAuMjkgMy44NiAxLjgyIDE4YTIgMiAwIDAgMCAxLjcxIDNoMTYuOTRhMiAyIDAgMCAwIDEuNzEtM0wxMy43MSAzLjg2YTIgMiAwIDAgMC0zLjQyIDB6Ii8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4K" width="20" height="20"></td>
556
558
  <td>Data warnings</td>
557
559
  <td>Appears only when something is worth reporting about the wafers shown. Collected across every wafer and de-duplicated, so a problem affecting all of them is stated once rather than repeated per card.</td>
@@ -698,6 +700,11 @@ have both a very low adjusted p-value and a large effect size \u2014 they are re
698
700
  important. <em>Notable</em> findings are statistically significant with a meaningful
699
701
  effect but not as extreme. <em>Info</em> findings pass the significance threshold at
700
702
  lower strength and are worth reviewing but may reflect smaller or noisier patterns.</p>
703
+ <p><strong>Test-value findings</strong> (a region reading high or low on a test) take the longest to compute, so
704
+ they are included automatically only when the data is small enough to take about a second. On
705
+ more data the panel says they are not included, with the number of tests and dies and roughly
706
+ how long they would take, and an <strong>Analyse</strong> button that adds them. For a lot, one click analyses
707
+ every wafer. Findings about tests failing their limits are included either way.</p>
701
708
  <div data-wmap-demo="findings" class="wmap-demo"></div><p><em>Findings panel open showing a detected edge-ring pattern. Click any row to
702
709
  highlight the affected dies on the map.</em></p>
703
710
  <h3 id="finding-types">Finding types</h3>
@@ -751,8 +758,10 @@ supporting detail.</p>
751
758
  <h2 id="6-summary-panel">6. Summary panel</h2>
752
759
  <p>The Summary panel docks next to the map and gives you the wafer or lot at a
753
760
  glance, with findings sitting directly under the headline numbers so a clicked
754
- finding can highlight the affected dies right there. Open it from the toolbar, or from
755
- the <strong>Summary</strong> tab on the edge of the map area, which shows while the panel is closed.</p>
761
+ finding can highlight the affected dies right there. The <strong>Summary</strong> button in the row
762
+ above the map, just before Map | Insights, opens and closes it, and shows as pressed while
763
+ it is open. The <strong>\u25B8</strong> button at the end of the panel&#39;s title closes it too, and stays in
764
+ view as the panel scrolls.</p>
756
765
  <div data-wmap-demo="summary-panel" class="wmap-demo"></div><p><em>The Summary panel open alongside a single wafer. Click any finding to
757
766
  highlight the affected dies.</em></p>
758
767
  <p>Sections, top to bottom:</p>
@@ -774,18 +783,29 @@ its shortfall; a test is an item when it is outside its limits (or a functional
774
783
  fails) on a share of the dies that clears the same floor. Its three dots and word (High, Moderate or Low impact) say how
775
784
  much of the lot it costs: the higher of its share of all the dies (2% moderate, 4% high)
776
785
  and its share of the dies that fail (15% moderate, 40% high), so a small area that is most
777
- of a good lot&#39;s loss still reads as high. Click a name to highlight that finding on the map.
786
+ of a good lot&#39;s loss still reads as high.
787
+ A test is costed by the dies it fails that also fail yield: dies outside its limits but binned
788
+ as passing cost nothing. A test whose failures lie mostly in a region is said as part of that
789
+ region&#39;s item rather than listed again beside it.
790
+ <strong>Every item is a row, and every row shows its dies on the map</strong> \u2014 a wafer icon at its end marks
791
+ it. Click a region or wafer to highlight it, or a test to show the test&#39;s values with the dies it
792
+ fails selected; click again to clear. Under the top item&#39;s sentence, chips name its parts (its
793
+ failing bins, with their legend colours, the pattern, and tests failing on the same dies), and
794
+ each chip shows that part alone.
778
795
  A <strong>Watch</strong> line (at most two) follows for things that cost no dies yet: a lot of five or more
779
796
  wafers whose yield, or a test&#39;s mean, trends up or down across the wafers <em>in the order given</em>
780
- (said as &quot;input order&quot;: the order is only a physical one if you know it is), and a test whose
781
- Ppk against its limits is under 1.0.
797
+ (said as &quot;input order&quot;: the order is only a physical one if you know it is), a test outside its
798
+ limits on dies that were binned as passing, and a test whose Ppk against its limits is under 1.0.
799
+ Watch lines are rows too.
782
800
  A wafer or lot with nothing over a yield point says so: &quot;Nothing stands out&quot;.
783
801
  The reports open with the same section, and <strong>Full report</strong> at the foot of it opens the
784
802
  report; in a report opened from the panel, clicking a finding&#39;s row shows it on the map.</li>
785
803
  <li><strong>Findings</strong> \u2014 detected anomalies, most severe first, each group marked with
786
- three dots filled by severity (Unusual, Notable, Minor). Severity chips narrow
787
- the list; Kind and Region dropdowns appear once there are enough findings to
788
- be worth narrowing. <strong>Detail</strong> opens the same sentences above a readable list.</li>
804
+ three dots filled by severity (Unusual, Notable, Minor). The header says how
805
+ many are unusual or notable, even when the section is collapsed, and the
806
+ severity chips narrow the list. Click a finding to show it on the map. A spatial
807
+ pattern has a <strong>Show N supporting findings</strong> line under it that lists the
808
+ regional findings it explains.</li>
789
809
  <li><strong>Bin breakdown</strong> \u2014 bars as a share of dies, pass bins first and then failing
790
810
  bins by descending count, so the dominant failure mode is at the top. It
791
811
  follows the map&#39;s plot mode: a soft-bin map gets a soft-bin breakdown. When a
@@ -823,8 +843,9 @@ table with Cp/Cpk/Pp/Ppk, and the findings list \u2014 and can be saved as a PDF
823
843
  from your browser&#39;s print dialog. It opens with <strong>What stands out</strong>: the yield,
824
844
  up to three regions, fail bins or wafers ranked by how many dies each costs, and a
825
845
  line saying what was compared. An item is listed only when it costs at least one
826
- yield point of the dies analysed; a lot with none says so. Each figure links to its
827
- row in the Findings table below. Severity is drawn as three dots and a word, so it reads in a
846
+ yield point of the dies analysed; a lot with none says so. Each item links to its
847
+ evidence: a finding to its row in the Findings table below, a test to the Test Values
848
+ or Functional Tests section. Severity is drawn as three dots and a word, so it reads in a
828
849
  black-and-white print; yields carry a bar, and a wafer or region is tinted only when it is
829
850
  at least a point below the rest.</p>
830
851
  <p>A <strong>Data tables</strong> button beside it opens the same tables as Insights&#39; Data tab (<a href="#data-tables" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'data-tables\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Data tables</a>) over this wafer, or over the whole lot in a gallery: Statistics, every die, and, for a lot, one row per wafer \u2014 each with Export CSV and Copy. It does not need Insights to be switched on.</p>
@@ -990,6 +1011,8 @@ offer one.</p>
990
1011
  </li>
991
1012
  <li><p><strong>Correlation</strong> \u2014 a test-to-test correlation matrix and a die-level scatter
992
1013
  plot, both stating the sample size the coefficients are computed over.
1014
+ <strong>Max tests</strong> (5 to 100, 20 by default) sets how many tests the matrix shows, and
1015
+ <strong>Correlation CSV</strong> saves the matrix as a table.
993
1016
  Clicking a matrix cell drives the scatter plot onto that pair, where <code>r</code> and
994
1017
  <code>n</code> for that pair are printed and update as you filter the legend. Hover a
995
1018
  point to see which wafer and die it is; <strong>click</strong> it to open that wafer on the
@@ -1082,7 +1105,7 @@ them, for example &quot;412 dies in hard bin 3, across 13 wafers&quot;. A mark t
1082
1105
  Right-click on any wafer&#39;s bar, box or point opens the same menu for the whole wafer.</p>
1083
1106
  <h3 id="data-tables">Data tables</h3>
1084
1107
  <p>The <strong>Data</strong> sub-tab shows the wafers Insights is scoped to as tables, one at a
1085
- time, chosen with the <strong>Statistics | Dies | Wafers</strong> control. It follows the
1108
+ time, chosen with the <strong>Statistics | Wafers | Dies</strong> control. It follows the
1086
1109
  same &quot;Group by&quot; and &quot;Show&quot; scope as the charts.</p>
1087
1110
  <ul>
1088
1111
  <li><strong>Statistics</strong> \u2014 the <strong>Test Values</strong> table (count, min, quartiles, mean, \u03C3,
@@ -1,3 +1,3 @@
1
- export declare const WMAP_VERSION = "0.35.0";
2
- export declare const WMAP_BUILD_TIME = "2026-10-06T15:45:50.394Z";
1
+ export declare const WMAP_VERSION = "0.36.0";
2
+ export declare const WMAP_BUILD_TIME = "2026-10-13T15:03:19.319Z";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- export const WMAP_VERSION="0.35.0",WMAP_BUILD_TIME="2026-10-06T15:45:50.394Z";
1
+ export const WMAP_VERSION="0.36.0",WMAP_BUILD_TIME="2026-10-13T15:03:19.319Z";
@@ -1 +1 @@
1
- import{SHADOW as C,TRACKING as O,SPACE as r,RADIUS as v,FONT as y,CLR as d,Z_BASE as B}from"./toolbar.js";const E={error:0,warning:1,info:2};export function severityOf(t){return t.severity??"warning"}export function collectWarnings(t){const s=[],i=new Set,n=e=>{if(!e?.message)return;const o=`${e.code}\0${e.message}`;i.has(o)||(i.add(o),s.push(e))};for(const e of t.result?.warnings??[])n(e);for(const e of t.statsSummary?.stats.warnings??[])n(e);for(const e of t.lotStatsSummary?.perWafer??[])for(const o of e.summary.stats.warnings??[])n(o);for(const e of t.extra??[])n(e);return s.sort((e,o)=>E[severityOf(e)]-E[severityOf(o)])}function $(t){return t==="error"?{bg:d.errBg,border:d.errBorder,text:d.errText}:{bg:d.warnBg,border:d.warnBorder,text:d.warnText}}function S(t){return t==="error"?"\u26D4":t==="info"?"\u2139":"\u26A0"}export const SHORT_LABEL={"partial-coverage":"Partial wafer coverage","geometry-conflict":"Geometry conflict","non-standard-diameter":"Non-standard wafer diameter","diameter-exceeds-die-extent":"Diameter exceeds die extent","edge-exclusion-exceeds-radius":"Edge exclusion exceeds radius","test-count-capped":"Test analysis skipped","test-def-collision":"Test definitions disagree","analysis-option-corrected":"Analysis option corrected","bin-colors-shared":"Bins share a colour","pass-bins-mixed":"Pass bins differ by wafer","ring-count-mixed":"Ring counts differ by wafer","input-field-removed":"Removed input name ignored","input-values-not-numbers":"Bins or test values are text","input-values-outside-stdf":"Values outside STDF ranges","retests-by-part-id":"Retests matched by part ID","derived-test-invalid":"Derived test not applied"};function w(t){const s=t.code?SHORT_LABEL[t.code]:void 0;if(s)return s;const i=t.message.split(/(?<=\.)\s/)[0]??t.message;return i.length>60?`${i.slice(0,57)}\u2026`:i}export function buildWarningsBanner(t,s=document){const i=s.createElement("div");Object.assign(i.style,{marginBottom:r.lg});for(const n of t){const e=severityOf(n),o=$(e),m=s.createElement("div");Object.assign(m.style,{background:o.bg,border:`1px solid ${o.border}`,borderRadius:v.control,marginBottom:r.sm,fontSize:y.body,color:o.text,lineHeight:"1.5"}),m.setAttribute("role","status");const a=s.createElement("button");a.type="button",Object.assign(a.style,{display:"flex",alignItems:"center",gap:r.sm,width:"100%",background:"none",border:"none",font:"inherit",color:"inherit",textAlign:"left",padding:`${r.sm} ${r.lg}`,cursor:"pointer"});const p=s.createElement("span");Object.assign(p.style,{flex:"1",minWidth:"0"}),p.textContent=`${S(e)} ${w(n)}`;const l=s.createElement("span");Object.assign(l.style,{flexShrink:"0"}),a.append(p,l);const g=s.createElement("div");Object.assign(g.style,{padding:`0 ${r.lg} ${r.sm}`}),g.textContent=n.message;let c=!1;const f=()=>{l.textContent=c?"\u25B4":"\u25BE",g.style.display=c?"block":"none",a.setAttribute("aria-expanded",String(c)),a.setAttribute("aria-label",`${w(n)}. ${c?"Click to collapse.":"Click to expand for detail."}`)};f(),a.addEventListener("click",()=>{c=!c,f()}),a.addEventListener("mouseenter",()=>{l.style.opacity="0.65"}),a.addEventListener("mouseleave",()=>{l.style.opacity="1"}),m.append(a,g),i.appendChild(m)}return i}export function buildWarningsMenuEl(t,s,i=window){const n=i.document,e=n.createElement("div"),o=280,a=t.left+o<=(i.innerWidth??1/0)?t.left:Math.max(4,t.right-o);Object.assign(e.style,{position:"fixed",top:`${t.bottom+4}px`,left:`${a}px`,background:d.menuBg,border:`1px solid ${d.menuBorder}`,borderRadius:v.control,boxShadow:C.menu,zIndex:B,width:`${o}px`,maxHeight:"320px",overflowY:"auto",padding:"4px 0",pointerEvents:"auto"}),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Data warnings");const p=n.createElement("div");Object.assign(p.style,{padding:`${r.sm} ${r.xl} ${r.xs}`,fontSize:y.body,fontWeight:"700",letterSpacing:O,textTransform:"uppercase",color:d.label}),p.textContent=s.length===1?"1 warning":`${s.length} warnings`,e.appendChild(p);for(const l of s){const g=severityOf(l),c=$(g),f=n.createElement("div");Object.assign(f.style,{display:"flex",gap:r.md,padding:`${r.md} ${r.xl}`,fontSize:y.body,lineHeight:"1.5",color:d.text,borderTop:`1px solid ${d.menuBorder}`,alignItems:"flex-start"});const u=n.createElement("span");Object.assign(u.style,{color:c.text,flexShrink:"0"}),u.textContent=S(g),f.appendChild(u);const x=n.createElement("div"),b=n.createElement("div");Object.assign(b.style,{fontWeight:"700",color:c.text,marginBottom:r.xxs}),b.textContent=l.code,x.appendChild(b);const h=n.createElement("div");h.textContent=l.message,x.appendChild(h),f.appendChild(x),e.appendChild(f)}return e}
1
+ import{SHADOW as C,TRACKING as O,SPACE as r,RADIUS as v,FONT as y,CLR as d,Z_BASE as B}from"./toolbar.js";const E={error:0,warning:1,info:2};export function severityOf(t){return t.severity??"warning"}export function collectWarnings(t){const s=[],i=new Set,n=e=>{if(!e?.message)return;const o=`${e.code}\0${e.message}`;i.has(o)||(i.add(o),s.push(e))};for(const e of t.result?.warnings??[])n(e);for(const e of t.statsSummary?.stats.warnings??[])n(e);for(const e of t.lotStatsSummary?.perWafer??[])for(const o of e.summary.stats.warnings??[])n(o);for(const e of t.extra??[])n(e);return s.sort((e,o)=>E[severityOf(e)]-E[severityOf(o)])}function $(t){return t==="error"?{bg:d.errBg,border:d.errBorder,text:d.errText}:{bg:d.warnBg,border:d.warnBorder,text:d.warnText}}function S(t){return t==="error"?"\u26D4":t==="info"?"\u24D8":"\u26A0"}export const SHORT_LABEL={"partial-coverage":"Partial wafer coverage","geometry-conflict":"Geometry conflict","non-standard-diameter":"Non-standard wafer diameter","diameter-exceeds-die-extent":"Diameter exceeds die extent","implausible-center":"Wafer centre ignored","edge-exclusion-exceeds-radius":"Edge exclusion exceeds radius","test-count-capped":"Test-value comparisons skipped","test-def-collision":"Test definitions disagree","analysis-option-corrected":"Analysis option corrected","bin-colors-shared":"Bins share a colour","pass-bins-mixed":"Pass bins differ by wafer","ring-count-mixed":"Ring counts differ by wafer","input-field-removed":"Removed input name ignored","input-values-not-numbers":"Bins or test values are text","input-values-outside-stdf":"Values outside STDF ranges","retests-by-part-id":"Retests matched by part ID","derived-test-invalid":"Derived test not applied","values-excluded":"Values excluded by limits"};function w(t){const s=t.code?SHORT_LABEL[t.code]:void 0;if(s)return s;const i=t.message.split(/(?<=\.)\s/)[0]??t.message;return i.length>60?`${i.slice(0,57)}\u2026`:i}export function buildWarningsBanner(t,s=document){const i=s.createElement("div");Object.assign(i.style,{marginBottom:r.lg});for(const n of t){const e=severityOf(n),o=$(e),u=s.createElement("div");Object.assign(u.style,{background:o.bg,border:`1px solid ${o.border}`,borderRadius:v.control,marginBottom:r.sm,fontSize:y.body,color:o.text,lineHeight:"1.5"}),u.setAttribute("role","status");const a=s.createElement("button");a.type="button",Object.assign(a.style,{display:"flex",alignItems:"center",gap:r.sm,width:"100%",background:"none",border:"none",font:"inherit",color:"inherit",textAlign:"left",padding:`${r.sm} ${r.lg}`,cursor:"pointer"});const p=s.createElement("span");Object.assign(p.style,{flex:"1",minWidth:"0"}),p.textContent=`${S(e)} ${w(n)}`;const l=s.createElement("span");Object.assign(l.style,{flexShrink:"0"}),a.append(p,l);const g=s.createElement("div");Object.assign(g.style,{padding:`0 ${r.lg} ${r.sm}`}),g.textContent=n.message;let c=!1;const f=()=>{l.textContent=c?"\u25B4":"\u25BE",g.style.display=c?"block":"none",a.setAttribute("aria-expanded",String(c)),a.setAttribute("aria-label",`${w(n)}. ${c?"Click to collapse.":"Click to expand for detail."}`)};f(),a.addEventListener("click",()=>{c=!c,f()}),a.addEventListener("mouseenter",()=>{l.style.opacity="0.65"}),a.addEventListener("mouseleave",()=>{l.style.opacity="1"}),u.append(a,g),i.appendChild(u)}return i}export function buildWarningsMenuEl(t,s,i=window){const n=i.document,e=n.createElement("div"),o=280,a=t.left+o<=(i.innerWidth??1/0)?t.left:Math.max(4,t.right-o);Object.assign(e.style,{position:"fixed",top:`${t.bottom+4}px`,left:`${a}px`,background:d.menuBg,border:`1px solid ${d.menuBorder}`,borderRadius:v.control,boxShadow:C.menu,zIndex:B,width:`${o}px`,maxHeight:"320px",overflowY:"auto",padding:"4px 0",pointerEvents:"auto"}),e.setAttribute("role","dialog"),e.setAttribute("aria-label","Data warnings");const p=n.createElement("div");Object.assign(p.style,{padding:`${r.sm} ${r.xl} ${r.xs}`,fontSize:y.body,fontWeight:"700",letterSpacing:O,textTransform:"uppercase",color:d.label}),p.textContent=s.length===1?"1 warning":`${s.length} warnings`,e.appendChild(p);for(const l of s){const g=severityOf(l),c=$(g),f=n.createElement("div");Object.assign(f.style,{display:"flex",gap:r.md,padding:`${r.md} ${r.xl}`,fontSize:y.body,lineHeight:"1.5",color:d.text,borderTop:`1px solid ${d.menuBorder}`,alignItems:"flex-start"});const m=n.createElement("span");Object.assign(m.style,{color:c.text,flexShrink:"0"}),m.textContent=S(g),f.appendChild(m);const x=n.createElement("div"),b=n.createElement("div");Object.assign(b.style,{fontWeight:"700",color:c.text,marginBottom:r.xxs}),b.textContent=l.code,x.appendChild(b);const h=n.createElement("div");h.textContent=l.message,x.appendChild(h),f.appendChild(x),e.appendChild(f)}return e}
@@ -5,6 +5,16 @@ export type AggregationMethod = 'mean' | 'median' | 'stddev' | 'min' | 'max' | '
5
5
  * count is a tally, so the test's limits say nothing about them.
6
6
  */
7
7
  export declare function stackHoldsMeasurements(method: string): boolean;
8
+ /**
9
+ * Whether the bins on a stack's dies are data. On a wafer and on a 'mode' stack
10
+ * (each position's most frequent bin) they are. A bin-occurrence stack
11
+ * ('countBin', 'percent') stamps the counted bin on every die so the map can name
12
+ * it; its data is the count in test 0, so it has no yield and no bin findings.
13
+ * A value stack ('mean' and the rest) keeps its template dies' bins, which
14
+ * describe one wafer, not the stack. The one rule for the build's yield and the
15
+ * analysis.
16
+ */
17
+ export declare function stackBinsAreData(isLotStack: boolean | undefined, method: string | undefined): boolean;
8
18
  /** Minimal die shape required by aggregation functions — satisfied by both Die and DieResult. */
9
19
  export interface DieLike {
10
20
  x: number;
@@ -1 +1 @@
1
- import{copyDie as p,testValue as m}from"./dieTable.js";import{minOf as M,maxOf as V}from"./utils.js";import{positionKey as d}from"./dies.js";export function stackHoldsMeasurements(n){return n!=="stddev"&&n!=="count"}export function aggregateValues(n,o,c=0){if(!n.length)return[];const a=new Map,f=new Map;for(const g of n)for(const t of g){const e=d(t),s=m(t,c);s!==void 0?(a.has(e)||(a.set(e,[]),f.set(e,t)),a.get(e).push(s)):f.has(e)||f.set(e,t)}const r=[];for(const[g,t]of f){const e=a.get(g);if(!e?.length){r.push(p(t,{testValues:void 0,testPass:void 0}));continue}let s;if(o==="mean")s=e.reduce((i,u)=>i+u,0)/e.length;else if(o==="median"){const i=[...e].sort((l,h)=>l-h),u=Math.floor(i.length/2);s=i.length%2?i[u]:(i[u-1]+i[u])/2}else if(o==="stddev"){if(e.length<2){r.push(p(t,{testValues:{0:0},testPass:void 0}));continue}const i=e.reduce((u,l)=>u+l,0)/e.length;s=Math.sqrt(e.reduce((u,l)=>u+(l-i)**2,0)/(e.length-1))}else o==="min"?s=M(e):o==="max"?s=V(e):s=e.length;r.push(p(t,{testValues:{0:s},testPass:void 0}))}return r}export function aggregateBinCounts(n,o,c="hard"){if(!n.length)return[];const a=new Map;for(const f of n)for(const r of f)if((c==="soft"?r.sbin:r.hbin)===o){const t=d(r);a.set(t,(a.get(t)??0)+1)}return(n[0]??[]).map(f=>p(f,{testValues:{0:a.get(d(f))??0},testPass:void 0,...c==="soft"?{sbin:o}:{hbin:o}}))}
1
+ import{copyDie as p,testValue as m}from"./dieTable.js";import{minOf as M,maxOf as x}from"./utils.js";import{positionKey as d}from"./dies.js";export function stackHoldsMeasurements(t){return t!=="stddev"&&t!=="count"}export function stackBinsAreData(t,s){return!t||s==="mode"}export function aggregateValues(t,s,l=0){if(!t.length)return[];const u=new Map,f=new Map;for(const g of t)for(const n of g){const e=d(n),o=m(n,l);o!==void 0?(u.has(e)||(u.set(e,[]),f.set(e,n)),u.get(e).push(o)):f.has(e)||f.set(e,n)}const a=[];for(const[g,n]of f){const e=u.get(g);if(!e?.length){a.push(p(n,{testValues:void 0,testPass:void 0}));continue}let o;if(s==="mean")o=e.reduce((i,r)=>i+r,0)/e.length;else if(s==="median"){const i=[...e].sort((c,h)=>c-h),r=Math.floor(i.length/2);o=i.length%2?i[r]:(i[r-1]+i[r])/2}else if(s==="stddev"){if(e.length<2){a.push(p(n,{testValues:{0:0},testPass:void 0}));continue}const i=e.reduce((r,c)=>r+c,0)/e.length;o=Math.sqrt(e.reduce((r,c)=>r+(c-i)**2,0)/(e.length-1))}else s==="min"?o=M(e):s==="max"?o=x(e):o=e.length;a.push(p(n,{testValues:{0:o},testPass:void 0}))}return a}export function aggregateBinCounts(t,s,l="hard"){if(!t.length)return[];const u=new Map;for(const f of t)for(const a of f)if((l==="soft"?a.sbin:a.hbin)===s){const n=d(a);u.set(n,(u.get(n)??0)+1)}return(t[0]??[]).map(f=>p(f,{testValues:{0:u.get(d(f))??0},testPass:void 0,...l==="soft"?{sbin:s}:{hbin:s}}))}
@@ -9,6 +9,11 @@ export interface ClassifyOptions {
9
9
  /** The map's own ring count (`WaferMapResult.ringCount`). Required: there is no default ring count to classify by. */
10
10
  ringCount: number;
11
11
  }
12
+ /**
13
+ * The ring (1 = innermost, `ringCount` = the edge) of a point `dx, dy` from the wafer centre: equal widths of
14
+ * the radius, a point on a boundary in the outer ring. The one ring rule; the edge ring is `ringCount`.
15
+ */
16
+ export declare function ringOf(dx: number, dy: number, radius: number, ringCount: number): number;
12
17
  /**
13
18
  * Classify a die by its radial ring (1 = innermost) and physical wafer quadrant.
14
19
  *
@@ -1 +1 @@
1
- import{requireRingCount as u}from"./ringCount.js";export function classifyDie(t,e,s){const o=Math.max(1,u(s,"classifyDie")),n=t.physX-e.center.x,r=t.physY-e.center.y,a=Math.sqrt(n*n+r*r)/e.radius,c=Math.min(o,Math.max(1,Math.floor(a*o)+1));let i;return n>=0&&r>=0?i="NE":n<0&&r>=0?i="NW":n<0&&r<0?i="SW":i="SE",{ring:c,quadrant:i}}export function getRingLabel(t,e){return e===1?"Full Wafer":t===1?"Ring 1 (core)":t===e?`Ring ${t} (edge)`:`Ring ${t}`}
1
+ import{requireRingCount as h}from"./ringCount.js";export function ringOf(t,n,e,r){const a=Math.sqrt(t*t+n*n)/e;return Math.min(r,Math.max(1,Math.floor(a*r)+1))}const u=["NE","NW","SW","SE"];export function classifyDie(t,n,e){const r=Math.max(1,h(e,"classifyDie")),a=t.physX-n.center.x,o=t.physY-n.center.y,i=ringOf(a,o,n.radius,r),c=(Math.atan2(o,a)+2*Math.PI)%(2*Math.PI),s=u[Math.min(3,Math.floor(c/(Math.PI/2)))];return{ring:i,quadrant:s}}export function getRingLabel(t,n){return n===1?"Full Wafer":t===1?"Ring 1 (core)":t===n?`Ring ${t} (edge)`:`Ring ${t}`}
@@ -19,6 +19,14 @@ export interface DieTable {
19
19
  * with no verdicts has no `testPass`, exactly as before.
20
20
  */
21
21
  readonly fields: Uint8Array;
22
+ /**
23
+ * Test number → the value that was taken out of `values` by the value filter
24
+ * (`WaferMapInput.valueFilter`), per row; `NaN` = nothing was excluded there.
25
+ * Kept so a tooltip can say what was excluded and why. Absent when nothing was.
26
+ */
27
+ readonly excluded?: ReadonlyMap<number, Float32Array | Float64Array>;
28
+ /** The limit set `excluded` values were outside of (the value filter's mode). */
29
+ readonly excludedBy?: 'validity' | 'spec' | 'test';
22
30
  }
23
31
  /** What the readers need of a die. A `DieResult` qualifies. */
24
32
  export type DieData = Pick<Die, 'testValues' | 'testPass'>;
@@ -47,6 +55,29 @@ export declare function tableFromRows(rows: readonly Row[]): DieTable;
47
55
  export declare function extendTable(table: DieTable, values: ReadonlyMap<number, Float32Array | Float64Array>, verdicts: ReadonlyMap<number, Int8Array>): DieTable & {
48
56
  fields: Uint8Array;
49
57
  };
58
+ /**
59
+ * A copy of `table` with the value filter's outcome: `values` columns replaced
60
+ * (excluded entries now `NaN`) and `excluded` holding what was taken out.
61
+ */
62
+ export declare function withExcluded(table: DieTable, values: ReadonlyMap<number, Float32Array | Float64Array>, excluded: ReadonlyMap<number, Float32Array | Float64Array>, excludedBy: 'validity' | 'spec' | 'test'): DieTable;
63
+ /**
64
+ * How many of `dies`' values the value filter excluded, per test, and the limit set it used.
65
+ * Counts the dies given (so a die a retest policy dropped is not counted). `undefined`
66
+ * when none of them has an excluded value.
67
+ */
68
+ export declare function excludedCounts(dies: readonly DieData[]): {
69
+ counts: Map<number, number>;
70
+ by: 'validity' | 'spec' | 'test';
71
+ } | undefined;
72
+ /** How many of `dies` lost their value for `testNumber` to the value filter, and the limit set; `undefined` when none did. One column, not every test. */
73
+ export declare function excludedCountFor(dies: readonly DieData[], testNumber: number): {
74
+ count: number;
75
+ by: 'validity' | 'spec' | 'test';
76
+ } | undefined;
77
+ /** The limit set the value filter excluded `die`'s values against, when it excluded any in its table. */
78
+ export declare function excludedBy(die: DieData): 'validity' | 'spec' | 'test' | undefined;
79
+ /** The value the filter excluded from `die` for `testNumber`, or `undefined` when none was. */
80
+ export declare function excludedValue(die: DieData, testNumber: number): number | undefined;
50
81
  /**
51
82
  * One reusable die-shaped view over `table`: `at(row)` points it at a row and
52
83
  * returns it, so a rule that takes a die (`getTestPassStatus`) can be applied
@@ -1 +1 @@
1
- import{hasAnyKey as O}from"./utils.js";const k=NaN;export const VERDICT_NONE=-1,VERDICT_FAIL=0,VERDICT_PASS=1,HAS_VALUES=1,HAS_VERDICTS=2;const a=Symbol("wmap.dieTable"),u=Symbol("wmap.dieRow");export function linkDie(e,t,s){return e[a]=t,e[u]=s,e}export function dieLink(e){const t=e[a];return t===void 0?void 0:{table:t,row:e[u]}}export function tableFromRows(e){const t=e.length,s=new Map,r=new Map,o=new Uint8Array(t),n=g(s,()=>new Float64Array(t).fill(k)),i=g(r,()=>new Int8Array(t).fill(VERDICT_NONE));for(let f=0;f<t;f++){const c=e[f].testValues;if(c){o[f]|=HAS_VALUES;const d=n(c),w=Object.values(c);for(let b=0;b<d.length;b++)d[b][f]=w[b]}const l=e[f].testPass;if(l){o[f]|=HAS_VERDICTS;const d=i(l),w=Object.values(l);for(let b=0;b<d.length;b++)d[b][f]=w[b]?VERDICT_PASS:VERDICT_FAIL}}return{rows:t,values:m(s),verdicts:m(r),fields:o}}function g(e,t){let s=[],r=[];return o=>{const n=Object.keys(o);let i=n.length===s.length;for(let f=0;i&&f<n.length;f++)i=n[f]===s[f];return i||(s=n,r=n.map(f=>{let c=e.get(f);return c===void 0&&e.set(f,c=t()),c})),r}}function m(e){return new Map([...e].map(([t,s])=>[Number(t),s]).sort((t,s)=>t[0]-s[0]))}export function extendTable(e,t,s){const r=new Map(e.values),o=new Map(e.verdicts);for(const[n,i]of t)r.set(n,i);for(const[n,i]of s)o.set(n,i);return{rows:e.rows,values:new Map([...r].sort((n,i)=>n[0]-i[0])),verdicts:new Map([...o].sort((n,i)=>n[0]-i[0])),fields:e.fields.slice()}}export function rowView(e){const t=linkDie({},e,0);return s=>(t[u]=s,t)}function v(e,t){const s={},r=[...e.values];for(let o=r.length-1;o>=0;o--){const n=r[o][1][t];Number.isNaN(n)||(s[r[o][0]]=n)}return s}function V(e,t){const s={},r=[...e.verdicts];for(let o=r.length-1;o>=0;o--){const n=r[o][1][t];n!==VERDICT_NONE&&(s[r[o][0]]=n===VERDICT_PASS)}return s}function x(){return Object.freeze(v(this[a],this[u]))}function N(){return Object.freeze(V(this[a],this[u]))}function j(e){return function(){throw new TypeError(`wafermap: die.${e} is read-only on a die built by buildWaferMap (die ${this.id}). Pass the values you want to buildWaferMap, or copy the die: { ...die, ${e}: yours }.`)}}const y={get:x,set:j("testValues"),enumerable:!0,configurable:!0},P={get:N,set:j("testPass"),enumerable:!0,configurable:!0},p=e=>({value:e,writable:!0,enumerable:!1,configurable:!0});export function finaliseDie(e){const t=e[a];if(t===void 0)return e;const s=e[u],r=t.fields[s],o=e.testValues!==void 0&&!(r&HAS_VALUES)||e.testPass!==void 0&&!(r&HAS_VERDICTS),n={};for(const i of Object.keys(e))i==="testValues"&&r&HAS_VALUES||i==="testPass"&&r&HAS_VERDICTS||(n[i]=e[i]);return o?(r&HAS_VALUES&&(n.testValues=v(t,s)),r&HAS_VERDICTS&&(n.testPass=V(t,s)),n):(Object.defineProperty(n,a,p(t)),Object.defineProperty(n,u,p(s)),r&HAS_VALUES&&Object.defineProperty(n,"testValues",y),r&HAS_VERDICTS&&Object.defineProperty(n,"testPass",P),n)}export function copyDie(e,t){const s=e[a];if(s===void 0)return{...e,...t};const r=e[u],o=s.fields[r],n={};for(const i of Object.keys(e))i!=="testValues"&&i!=="testPass"&&(n[i]=e[i]);return"testValues"in t||"testPass"in t?(o&HAS_VALUES&&!("testValues"in t)&&(n.testValues=v(s,r)),o&HAS_VERDICTS&&!("testPass"in t)&&(n.testPass=V(s,r)),Object.assign(n,t)):(Object.assign(n,t),Object.defineProperty(n,a,p(s)),Object.defineProperty(n,u,p(r)),o&HAS_VALUES&&Object.defineProperty(n,"testValues",y),o&HAS_VERDICTS&&Object.defineProperty(n,"testPass",P),n)}export function detachTables(e){const t=[],s=new Map,r=e.reduce((f,c)=>f+c.length,0),o=new Int32Array(r*2);let n=0;for(const f of e)for(const c of f){const l=dieLink(c);if(l===void 0){o[n++]=-1,o[n++]=0;continue}let d=s.get(l.table);d===void 0&&(s.set(l.table,d=t.length),t.push(l.table)),o[n++]=d,o[n++]=l.row,delete c.testValues,delete c.testPass}const i=new Set;for(const f of t){for(const c of f.values.values())i.add(c.buffer);for(const c of f.verdicts.values())i.add(c.buffer);i.add(f.fields.buffer)}return{tables:t,links:o,transfer:[...i]}}export function attachTables(e,t){let s=0;for(const r of e)for(const o of r){const n=t.links[s++],i=t.links[s++];if(n<0)continue;const f=t.tables[n],c=f.fields[i];Object.defineProperty(o,a,p(f)),Object.defineProperty(o,u,p(i)),c&HAS_VALUES&&Object.defineProperty(o,"testValues",y),c&HAS_VERDICTS&&Object.defineProperty(o,"testPass",P)}}export function testValue(e,t){const s=e[a];if(s===void 0)return e.testValues?.[t];const r=s.values.get(t)?.[e[u]];return r===void 0||Number.isNaN(r)?void 0:r}export function recordedVerdict(e,t){const s=e[a];if(s===void 0)return e.testPass?.[t];const r=s.verdicts.get(t)?.[e[u]];return r===void 0||r===VERDICT_NONE?void 0:r===VERDICT_PASS}export function dieHasAnyTestData(e){return dieHasValues(e)||dieHasVerdicts(e)}export function dieHasValues(e){const t=dieLink(e);if(t===void 0)return O(e.testValues);for(const s of t.table.values.values())if(!Number.isNaN(s[t.row]))return!0;return!1}export function dieHasVerdicts(e){const t=dieLink(e);if(t===void 0)return O(e.testPass);for(const s of t.table.verdicts.values())if(s[t.row]!==VERDICT_NONE)return!0;return!1}export function dieValueEntries(e){const t=dieLink(e);if(t===void 0){const r=e.testValues;return r===void 0?[]:Object.keys(r).map(o=>[Number(o),r[Number(o)]])}const s=[];for(const[r,o]of t.table.values){const n=o[t.row];Number.isNaN(n)||s.push([r,n])}return s}export function dieVerdictEntries(e){const t=dieLink(e);if(t===void 0){const r=e.testPass;return r===void 0?[]:Object.keys(r).map(o=>[Number(o),r[Number(o)]])}const s=[];for(const[r,o]of t.table.verdicts){const n=o[t.row];n!==VERDICT_NONE&&s.push([r,n===VERDICT_PASS])}return s}export function testValuesReader(e){let t,s=[];return function(o,n){const i=dieLink(o);if(i===void 0){const f=o.testValues;for(let c=0;c<e.length;c++){const l=f?.[e[c]];n[c]=l===void 0?NaN:l}return n}i.table!==t&&(t=i.table,s=e.map(f=>i.table.values.get(f)));for(let f=0;f<s.length;f++){const c=s[f];n[f]=c===void 0?NaN:c[i.row]}return n}}export function recordedVerdictsReader(e){let t,s=[];return function(o,n){const i=dieLink(o);if(i===void 0){const f=o.testPass;for(let c=0;c<e.length;c++){const l=f?.[e[c]];n[c]=l===void 0?VERDICT_NONE:l?VERDICT_PASS:VERDICT_FAIL}return n}i.table!==t&&(t=i.table,s=e.map(f=>i.table.verdicts.get(f)));for(let f=0;f<s.length;f++){const c=s[f];n[f]=c===void 0?VERDICT_NONE:c[i.row]}return n}}export function testsPresent(e,t="all"){const s=new Set,r=new Map;for(const o of e){const n=dieLink(o);if(n===void 0){if(o.testValues)for(const f in o.testValues)s.add(Number(f));if(t==="all"&&o.testPass)for(const f in o.testPass)s.add(Number(f));continue}let i=r.get(n.table);i===void 0&&r.set(n.table,i=[]),i.push(n.row)}for(const[o,n]of r){for(const[i,f]of o.values)!s.has(i)&&n.some(c=>!Number.isNaN(f[c]))&&s.add(i);if(t!=="values")for(const[i,f]of o.verdicts)!s.has(i)&&n.some(c=>f[c]!==VERDICT_NONE)&&s.add(i)}return[...s].sort((o,n)=>o-n)}
1
+ import{hasAnyKey as N}from"./utils.js";const O=NaN;export const VERDICT_NONE=-1,VERDICT_FAIL=0,VERDICT_PASS=1,HAS_VALUES=1,HAS_VERDICTS=2;const l=Symbol("wmap.dieTable"),a=Symbol("wmap.dieRow");export function linkDie(e,t,s){return e[l]=t,e[a]=s,e}export function dieLink(e){const t=e[l];return t===void 0?void 0:{table:t,row:e[a]}}export function tableFromRows(e){const t=e.length,s=new Map,o=new Map,r=new Uint8Array(t),n=P(s,()=>new Float64Array(t).fill(O)),c=P(o,()=>new Int8Array(t).fill(VERDICT_NONE));for(let u=0;u<t;u++){const f=e[u].testValues;if(f){r[u]|=HAS_VALUES;const d=n(f),x=Object.values(f);for(let b=0;b<d.length;b++)d[b][u]=x[b]}const i=e[u].testPass;if(i){r[u]|=HAS_VERDICTS;const d=c(i),x=Object.values(i);for(let b=0;b<d.length;b++)d[b][u]=x[b]?VERDICT_PASS:VERDICT_FAIL}}return{rows:t,values:g(s),verdicts:g(o),fields:r}}function P(e,t){let s=[],o=[];return r=>{const n=Object.keys(r);let c=n.length===s.length;for(let u=0;c&&u<n.length;u++)c=n[u]===s[u];return c||(s=n,o=n.map(u=>{let f=e.get(u);return f===void 0&&e.set(u,f=t()),f})),o}}function g(e){return new Map([...e].map(([t,s])=>[Number(t),s]).sort((t,s)=>t[0]-s[0]))}export function extendTable(e,t,s){const o=new Map(e.values),r=new Map(e.verdicts);for(const[n,c]of t)o.set(n,c);for(const[n,c]of s)r.set(n,c);return{rows:e.rows,values:new Map([...o].sort((n,c)=>n[0]-c[0])),verdicts:new Map([...r].sort((n,c)=>n[0]-c[0])),fields:e.fields.slice(),...e.excluded?{excluded:e.excluded,excludedBy:e.excludedBy}:{}}}export function withExcluded(e,t,s,o){const r=new Map(e.values);for(const[c,u]of t)r.set(c,u);const n=new Map(e.excluded??[]);for(const[c,u]of s)n.set(c,u);return{...e,values:r,excluded:n,excludedBy:o}}export function excludedCounts(e){const t=new Map;let s;for(const o of e){const r=o[l];if(r?.excluded===void 0)continue;const n=o[a];for(const[c,u]of r.excluded)Number.isNaN(u[n])||(t.set(c,(t.get(c)??0)+1),s??=r.excludedBy)}return t.size===0||s===void 0?void 0:{counts:t,by:s}}export function excludedCountFor(e,t){let s=0,o;for(const r of e){const n=r[l],c=n?.excluded?.get(t);c===void 0||Number.isNaN(c[r[a]])||(s++,o??=n.excludedBy)}return s>0&&o!==void 0?{count:s,by:o}:void 0}export function excludedBy(e){return e[l]?.excludedBy}export function excludedValue(e,t){const o=e[l]?.excluded?.get(t)?.[e[a]];return o===void 0||Number.isNaN(o)?void 0:o}export function rowView(e){const t=linkDie({},e,0);return s=>(t[a]=s,t)}function w(e,t){const s={},o=[...e.values];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];Number.isNaN(n)||(s[o[r][0]]=n)}return s}function v(e,t){const s={},o=[...e.verdicts];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];n!==VERDICT_NONE&&(s[o[r][0]]=n===VERDICT_PASS)}return s}function j(){return Object.freeze(w(this[l],this[a]))}function k(){return Object.freeze(v(this[l],this[a]))}function m(e){return function(){throw new TypeError(`wafermap: die.${e} is read-only on a die built by buildWaferMap (die ${this.id}). Pass the values you want to buildWaferMap, or copy the die: { ...die, ${e}: yours }.`)}}const y={get:j,set:m("testValues"),enumerable:!0,configurable:!0},V={get:k,set:m("testPass"),enumerable:!0,configurable:!0},p=e=>({value:e,writable:!0,enumerable:!1,configurable:!0});export function finaliseDie(e){const t=e[l];if(t===void 0)return e;const s=e[a],o=t.fields[s],r=e.testValues!==void 0&&!(o&HAS_VALUES)||e.testPass!==void 0&&!(o&HAS_VERDICTS),n={};for(const c of Object.keys(e))c==="testValues"&&o&HAS_VALUES||c==="testPass"&&o&HAS_VERDICTS||(n[c]=e[c]);return r?(o&HAS_VALUES&&(n.testValues=w(t,s)),o&HAS_VERDICTS&&(n.testPass=v(t,s)),n):(Object.defineProperty(n,l,p(t)),Object.defineProperty(n,a,p(s)),o&HAS_VALUES&&Object.defineProperty(n,"testValues",y),o&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function copyDie(e,t){const s=e[l];if(s===void 0)return{...e,...t};const o=e[a],r=s.fields[o],n={};for(const c of Object.keys(e))c!=="testValues"&&c!=="testPass"&&(n[c]=e[c]);return"testValues"in t||"testPass"in t?(r&HAS_VALUES&&!("testValues"in t)&&(n.testValues=w(s,o)),r&HAS_VERDICTS&&!("testPass"in t)&&(n.testPass=v(s,o)),Object.assign(n,t)):(Object.assign(n,t),Object.defineProperty(n,l,p(s)),Object.defineProperty(n,a,p(o)),r&HAS_VALUES&&Object.defineProperty(n,"testValues",y),r&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function detachTables(e){const t=[],s=new Map,o=e.reduce((u,f)=>u+f.length,0),r=new Int32Array(o*2);let n=0;for(const u of e)for(const f of u){const i=dieLink(f);if(i===void 0){r[n++]=-1,r[n++]=0;continue}let d=s.get(i.table);d===void 0&&(s.set(i.table,d=t.length),t.push(i.table)),r[n++]=d,r[n++]=i.row,delete f.testValues,delete f.testPass}const c=new Set;for(const u of t){for(const f of u.values.values())c.add(f.buffer);for(const f of u.verdicts.values())c.add(f.buffer);if(c.add(u.fields.buffer),u.excluded)for(const f of u.excluded.values())c.add(f.buffer)}return{tables:t,links:r,transfer:[...c]}}export function attachTables(e,t){let s=0;for(const o of e)for(const r of o){const n=t.links[s++],c=t.links[s++];if(n<0)continue;const u=t.tables[n],f=u.fields[c];Object.defineProperty(r,l,p(u)),Object.defineProperty(r,a,p(c)),f&HAS_VALUES&&Object.defineProperty(r,"testValues",y),f&HAS_VERDICTS&&Object.defineProperty(r,"testPass",V)}}export function testValue(e,t){const s=e[l];if(s===void 0)return e.testValues?.[t];const o=s.values.get(t)?.[e[a]];return o===void 0||Number.isNaN(o)?void 0:o}export function recordedVerdict(e,t){const s=e[l];if(s===void 0)return e.testPass?.[t];const o=s.verdicts.get(t)?.[e[a]];return o===void 0||o===VERDICT_NONE?void 0:o===VERDICT_PASS}export function dieHasAnyTestData(e){return dieHasValues(e)||dieHasVerdicts(e)}export function dieHasValues(e){const t=dieLink(e);if(t===void 0)return N(e.testValues);for(const s of t.table.values.values())if(!Number.isNaN(s[t.row]))return!0;return!1}export function dieHasVerdicts(e){const t=dieLink(e);if(t===void 0)return N(e.testPass);for(const s of t.table.verdicts.values())if(s[t.row]!==VERDICT_NONE)return!0;return!1}export function dieValueEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testValues;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.values){const n=r[t.row];Number.isNaN(n)||s.push([o,n])}return s}export function dieVerdictEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testPass;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.verdicts){const n=r[t.row];n!==VERDICT_NONE&&s.push([o,n===VERDICT_PASS])}return s}export function testValuesReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testValues;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?NaN:i}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.values.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?NaN:f[c.row]}return n}}export function recordedVerdictsReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testPass;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?VERDICT_NONE:i?VERDICT_PASS:VERDICT_FAIL}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.verdicts.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?VERDICT_NONE:f[c.row]}return n}}export function testsPresent(e,t="all"){const s=new Set,o=new Map;for(const r of e){const n=dieLink(r);if(n===void 0){if(r.testValues)for(const u in r.testValues)s.add(Number(u));if(t==="all"&&r.testPass)for(const u in r.testPass)s.add(Number(u));continue}let c=o.get(n.table);c===void 0&&o.set(n.table,c=[]),c.push(n.row)}for(const[r,n]of o){for(const[c,u]of r.values)!s.has(c)&&n.some(f=>!Number.isNaN(u[f]))&&s.add(c);if(t!=="values")for(const[c,u]of r.verdicts)!s.has(c)&&n.some(f=>u[f]!==VERDICT_NONE)&&s.add(c)}return[...s].sort((r,n)=>r-n)}
@@ -36,6 +36,12 @@ export declare function itemPassBins(item: {
36
36
  } | null | undefined, fallback?: readonly number[]): readonly number[];
37
37
  /** Same bins, in any order. */
38
38
  export declare function sameBins(a: readonly number[], b: readonly number[]): boolean;
39
+ /**
40
+ * Whether a hard or soft bin number is a pass bin. Pass bins are hard-bin numbers; they judge a soft bin only
41
+ * when the dies carry no hard bin, when a die's verdict is its soft bin's (`diePassStatus`). Otherwise a soft
42
+ * bin's verdict is not known from the pass bins, and it is not called a pass bin.
43
+ */
44
+ export declare function isPassBin(kind: 'hardBin' | 'softBin', bin: number, passBins: readonly number[], hasHardBins: boolean): boolean;
39
45
  /**
40
46
  * The pass bins every wafer is judged by, or `undefined` when they differ (or there are none to
41
47
  * ask). For a surface that must name one set — a headline, or which bins count as failures — and
@@ -1 +1 @@
1
- const r=[1];export function normalizePassBins(s){return[...s??r]}export function requirePassBins(s,n){const e=s?.passBins;if(!e)throw new Error(`${n}: no pass bins (WaferMapResult.passBins); a map not built by buildWaferMap must state them.`);return e}export function itemPassBins(s,n){return s?.passBins??n??requirePassBins(void 0,"itemPassBins")}export function sameBins(s,n){const e=new Set(s),t=new Set(n);return e.size===t.size&&[...e].every(i=>t.has(i))}export function commonPassBins(s){let n;for(const e of s){if(e===void 0)return;if(n===void 0)n=e;else if(!sameBins(n,e))return}return n}export function passBinsLabel(s){const n=[];for(const t of s)n.some(i=>sameBins(i,t))||n.push(t);const e=t=>t.length===0?"no bins":t.length===1?`bin ${t[0]}`:`bins ${t.join(", ")}`;return n.length===0?"no wafers":n.length===1?e(n[0]):`per wafer: ${n.map(e).join(" \xB7 ")}`}
1
+ const r=[1];export function normalizePassBins(s){return[...s??r]}export function requirePassBins(s,n){const e=s?.passBins;if(!e)throw new Error(`${n}: no pass bins (WaferMapResult.passBins); a map not built by buildWaferMap must state them.`);return e}export function itemPassBins(s,n){return s?.passBins??n??requirePassBins(void 0,"itemPassBins")}export function sameBins(s,n){const e=new Set(s),t=new Set(n);return e.size===t.size&&[...e].every(i=>t.has(i))}export function isPassBin(s,n,e,t){return(s==="hardBin"||!t)&&e.includes(n)}export function commonPassBins(s){let n;for(const e of s){if(e===void 0)return;if(n===void 0)n=e;else if(!sameBins(n,e))return}return n}export function passBinsLabel(s){const n=[];for(const t of s)n.some(i=>sameBins(i,t))||n.push(t);const e=t=>t.length===0?"no bins":t.length===1?`bin ${t[0]}`:`bins ${t.join(", ")}`;return n.length===0?"no wafers":n.length===1?e(n[0]):`per wafer: ${n.map(e).join(" \xB7 ")}`}
@@ -23,6 +23,13 @@ export interface WaferReticle {
23
23
  }
24
24
  export interface WaferSpec {
25
25
  diameter: number;
26
+ /**
27
+ * What `diameter` is measured in. `'normalized'` (die pitches, when no physical
28
+ * size is known) keeps the orientation mark's direction but gives it length 0:
29
+ * the SEMI flat and notch sizes are millimetres, and a millimetre table applied
30
+ * to a pitch count cut a third of a small wafer off. Default `'mm'`.
31
+ */
32
+ units?: 'mm' | 'normalized';
26
33
  center?: {
27
34
  x: number;
28
35
  y: number;
@@ -41,7 +48,9 @@ export interface Wafer {
41
48
  };
42
49
  /**
43
50
  * Resolved orientation mark. `length` is the standard chord length (flat) or
44
- * half-width (V-notch), derived from the wafer diameter by `createWafer`.
51
+ * half-width (V-notch), derived from the wafer diameter by `createWafer`. 0 when
52
+ * the diameter is not in millimetres: the mark's side is known, its size is
53
+ * not, so nothing is cut into the outline (the side is still drawn as a marker).
45
54
  */
46
55
  notch?: {
47
56
  type: 'top' | 'bottom' | 'left' | 'right';
@@ -1 +1 @@
1
- function t(e){return e<=100?32.5:e<=150?57.5:1.75}export function createWafer(e){if(e.diameter<=0)throw new RangeError(`createWafer: diameter must be > 0 (got ${e.diameter})`);return{diameter:e.diameter,radius:e.diameter/2,center:e.center??{x:0,y:0},notch:e.notch?{type:e.notch.type,length:t(e.diameter)}:void 0,orientation:e.orientation??0,metadata:e.metadata,...e.reticle?{reticle:e.reticle}:{}}}
1
+ function t(e){return e<=100?32.5:e<=150?57.5:1.75}export function createWafer(e){if(e.diameter<=0)throw new RangeError(`createWafer: diameter must be > 0 (got ${e.diameter})`);return{diameter:e.diameter,radius:e.diameter/2,center:e.center??{x:0,y:0},notch:e.notch?{type:e.notch.type,length:e.units==="normalized"?0:t(e.diameter)}:void 0,orientation:e.orientation??0,metadata:e.metadata,...e.reticle?{reticle:e.reticle}:{}}}
@@ -115,6 +115,11 @@ export interface ViewOverlay {
115
115
  export interface View {
116
116
  /** Die rectangles to fill, in draw order, already carrying their resolved colour. */
117
117
  rectangles: ViewRect[];
118
+ /**
119
+ * The visual kerf between dies, in mm: each rectangle is its die's pitch less this.
120
+ * The drawer needs it to tile dies edge to edge when the kerf is too small to draw.
121
+ */
122
+ dieGap: number;
118
123
  /**
119
124
  * Transformed centre of each die, index-parallel with {@link dies}. Separate
120
125
  * from `rectangles` because a die always has a centre for hit-testing and
@@ -1 +1 @@
1
- import{requirePassBins as ge}from"../core/passBins.js";import{requireRingCount as ye}from"../core/ringCount.js";import{hasPosition as be}from"../core/dies.js";import{dieValueEntries as xe,dieVerdictEntries as Me,recordedVerdict as Se,testsPresent as Ot}from"../core/dieTable.js";import{getReticleCell as ve}from"../core/reticle.js";import{metadataCategoricalValue as Be,metadataDisplayValue as ke}from"../core/metadata.js";import{affineRotation as bt,affineMirror as wt,affineCompose as st,affinePoint as G,affineVector as $e,affineSwapsAxes as Ie}from"../core/transforms.js";import{contrastTextColor as Q,SPEC_PASS_FILL as xt,SPEC_FAIL_LOW as Te,SPEC_FAIL_HIGH as Mt}from"./colorMap.js";import{resolveValueColorFn as De}from"./colorSchemes.js";import{resolveBinColors as Ce,binColorsCover as Ve}from"./binColors.js";import{NO_DATA_FILL as z}from"./colorMap.js";import{diePassStatus as Fe}from"../core/dies.js";import{compactView as Le}from"./compactView.js";import{buildXYIndicator as Re}from"./xyIndicator.js";import{getDieTestValue as L,getTestPassStatus as U,isParametricTest as St}from"./buildWaferMap.js";import{classifySpec as ot}from"./spec.js";export{ot as classifySpec};import{fmt as vt,fmtColorbarAxis as Bt,fmtAggregationMethod as qt}from"./fmt.js";import{metadataValueColor as Pe}from"./colorMap.js";import{asList as Kt,clamp01 as Wt,compareNatural as Ne,escHtml as R}from"../core/utils.js";import{prettyKey as zt}from"../core/utils.js";import{testLabel as rt,markedTestLabel as lt,derivedTestNote as jt,isDerivedTest as Ee,DERIVED_MARK as Ae,DERIVED_KEY as He}from"./testLabel.js";export function resolveTestNumber(t,e){return e?.length?{testNumber:(findTestDef(e,t)??e[0]).testNumber}:{testNumber:t}}export function collectMetadataValues(t,e){const n=new Set;for(const i of t){if(i.partial||i.edgeExcluded)continue;const s=ct(i,e);s!==void 0&&n.add(s)}return[...n].sort(Ne)}export function findTestDef(t,e){return t?.find(n=>n.testNumber===e)}export function getUniqueTestNumbers(t){return Ot(t,"values")}const _e="#d3d6db",Xt="#e8e9ea",Oe="#aab0ba";function ct(t,e){return e?Be(t.metadata?.[e]):void 0}function we(t,e,n){const{x:i,y:s}=t.center,a=bt(t.orientation,i,s),o=st(wt(e?.x??!1,e?.y??!1,i,s),bt(t.orientation,i,s)),r=st(wt(n?.flipX??!1,n?.flipY??!1,i,s),bt(n?.rotation??0,i,s));return{bakedToScreen:r,physicalToScreen:st(r,a),gridToScreen:st(r,o)}}function Y(t,e=!1){return{points:[t],closed:e}}function qe(t,e){const{center:n,radius:i,notch:s}=t;let a=n.x+i*Math.cos(e),o=n.y+i*Math.sin(e);if(!s)return{x:a,y:o};const r=Math.sqrt(i**2-(s.length/2)**2),d=s.length/2,y=a-n.x,b=o-n.y;return s.type==="bottom"&&b<-r?(o=n.y-r,a=n.x+Math.max(-d,Math.min(d,y))):s.type==="top"&&b>r?(o=n.y+r,a=n.x+Math.max(-d,Math.min(d,y))):s.type==="left"&&y<-r?(a=n.x-r,o=n.y+Math.max(-d,Math.min(d,b))):s.type==="right"&&y>r&&(a=n.x+r,o=n.y+Math.max(-d,Math.min(d,b))),{x:a,y:o}}function Yt(t,e){return t.map(e).join(" / ")}function Ke(t,e=256){const n=Array.from({length:e},(i,s)=>t(s/(e-1)));return i=>n[Math.min(e-1,Math.max(0,Math.round(i*(e-1))))]}function We(t,e){const n=Math.max(1,Math.min(t.width,t.height)),i=t.width/Math.max(e.length,1);return Math.max(8,Math.min(16,Math.round(Math.min(n*.55,i*1.8))))}function ze(t,e,n){if(e?.length){const a=e.flatMap(o=>{const r=o.testNumber;if(!St(o)){const y=U(t,r,o);return y===void 0?[]:[{key:r,label:lt(o,r),value:y?"Pass":"Fail"}]}const d=L(t,r);return d===void 0?[]:[{key:r,label:lt(o,r),value:vt(d,o.unit,n),recordedFail:Se(t,r)===!1}]});if(a.length)return a}const i=xe(t);if(i.length)return i.map(([a,o])=>({key:a,label:rt(void 0,a),value:vt(o,void 0,n)}));const s=Me(t);return s.length?s.map(([a,o])=>({key:a,label:rt(void 0,a),value:o?"Pass":"Fail"})):[]}export function buildHoverText(t,e,n={}){const{testDefs:i,hbinDefs:s,sbinDefs:a,fallbackFormat:o,aggrMethod:r,lotSize:d,activeTest:y,reticleConfig:b,metadataFields:k}=n,D=s?new Map(s.map(f=>[f.bin,f])):null,I=a?new Map(a.map(f=>[f.bin,f])):null,g=[R(`Die (${t.x}, ${t.y})`)];if(b&&be(t)){const f=ve(t,b);g.push(R(`Reticle (${f.column}, ${f.row})`))}if(e==="stackedValues"){const f=L(t,0);if(f!==void 0){const u=i?.[0],m=u?lt(u,u.testNumber):"Value",S=r?` (${r})`:"";g.push(R(`${m}${S}: ${vt(f,u?.unit,o)}`));const h=jt(u);h&&g.push(`<i>${R(h)}</i>`)}}else if(e==="stackedBins"||e==="stackedSoftBins"){const f=L(t,0),u=e==="stackedSoftBins"?t.sbin:t.hbin;if(f!==void 0){const m=e==="stackedSoftBins"?I:D,S=u!==void 0?m?.get(u)?.name?`${u} \xB7 ${m.get(u).name}`:`Bin ${u}`:"Bin";let h;if(r==="percent")h=`${f.toFixed(0)}%`;else{const C=d?` (${(f/d*100).toFixed(0)}% of stacked wafers)`:"";h=`${f}${C}`}const x=r?` [${qt(r)}]`:"";g.push(R(`${S}: ${h}${x}`))}}else{const f=ze(t,i,o);if(e==="value"&&f.length){const{testNumber:u}=resolveTestNumber(y??0,i),m=findTestDef(i,u),S=L(t,u);let h=f.findIndex(A=>A.key===u);h<0&&(h=0);const x=f[h];let C=`<b>${R(`${x.label}: ${x.value}`)}${x.recordedFail?" <i>(recorded fail)</i>":""}</b>`;if(x.key===u&&m){const A=ot(S,m);(A==="failLow"||A==="failHigh")&&(C+=" <i>(outside test limits)</i>")}g.push(C);const E=jt(findTestDef(i,x.key));E&&g.push(`<i>${R(E)}</i>`);const p=f.length-1;p>0&&g.push(`<i>+${p} more test${p===1?"":"s"}</i>`)}else if(f.length){const u=f.length;g.push(`<i>${u} test result${u===1?"":"s"} recorded</i>`)}if(t.hbin!==void 0||t.sbin!==void 0){const u=[];if(t.hbin!==void 0){const m=D?.get(t.hbin)?.name,S=m?`${t.hbin} \xB7 ${m}`:String(t.hbin);u.push(`HBin: ${S}`)}if(t.sbin!==void 0){const m=I?.get(t.sbin)?.name,S=m?`${t.sbin} \xB7 ${m}`:String(t.sbin);u.push(`SBin: ${S}`)}g.push(u.map(R).join(" &nbsp;\xB7&nbsp; "))}}t.retestCount!==void 0&&g.push(R(`Retests: ${t.retestCount}`)),t.siteNum!==void 0&&g.push(R(`Site: ${t.siteNum}`)),t.partId!==void 0&&g.push(R(`Part ID: ${t.partId}`)),t.partial&&g.push("<i>partial die</i>"),t.probeIndex!==void 0&&g.push(R(`Probe: #${t.probeIndex}`));const B={...t.metadata??{}};for(const[f,u]of Object.entries(B)){const m=ke(u);if(m===void 0)continue;const S=k?.find(h=>h.key===f)?.label??zt(f);g.push(R(`${S}: ${m}`))}return g.join("<br>")}function kt(t){return t?.name?lt(t,t.testNumber):void 0}function $t(t){return Ee(t)?{note:`${Ae} ${He}`}:{}}export function buildMapTitle(t,e="engineering",n){const i=t.isLotStack&&t.lotSize!==void 0?`stacked (${t.lotSize} ${t.lotSize===1?"wafer":"wafers"})`:"stacked",s=a=>{const o=n?.length===1?n[0]:void 0;return o===void 0?`${a} Bin`:o.name?`${a} Bin ${o.bin} \xB7 ${o.name}`:`${a} Bin ${o.bin}`};switch(t.plotMode){case"hardBin":return{primary:"Hard Bin",secondary:""};case"softBin":return{primary:"Soft Bin",secondary:""};case"stackedBins":return{primary:s("Hard"),secondary:i};case"stackedSoftBins":return{primary:s("Soft"),secondary:i};case"metadata":{const a=t.metadataFields?.find(r=>r.key===t.activeMetadataKey),o=t.activeMetadataKey?zt(t.activeMetadataKey):"Metadata";return{primary:a?.label??o,secondary:""}}case"stackedValues":{const a=t.testDefs?.[0],o=t.valueRange[1]||t.valueRange[0]||0,{axisLabel:r}=Bt(o,kt(a),a?.unit,e),d=r||"Value",y=t.aggrMethod?` \xB7 ${qt(t.aggrMethod)}`:"";return{primary:`${d}${y}`,secondary:i,...$t(a)}}default:{const a=findTestDef(t.testDefs,t.activeTest),o=t.valueRange[1]||t.valueRange[0]||0,{axisLabel:r}=Bt(o,kt(a),a?.unit,e),d=r||kt(a);if(t.passFailDisplay!=="off"){const y=a?.testNumber??t.activeTest,b=d?`${d} \xB7 #${y}`:rt(void 0,y),k=t.passFailDisplay==="spec"?"Limit pass/fail":a!==void 0&&!St(a)?"Functional pass/fail":"Tester pass/fail";return{primary:b,secondary:k,...$t(a)}}return{primary:d??rt(void 0,t.activeTest),secondary:"",...$t(a)}}}}export function generateTextOverlay(t,e,n){const{plotMode:i,colorFns:s,normalize:a,activeTest:o,valueRange:r,testDefs:d,fallbackFormat:y,passFailDisplay:b="off",activeMetadataKey:k,metadataColorMap:D,allIntegerValues:I}=n,g=findTestDef(d,o),{tickFmt:B}=Bt(r[1],g?.name,g?.unit,y),f=I?m=>String(Math.round(m)):B,{testNumber:u}=resolveTestNumber(o,d);return t.flatMap((m,S)=>{let h="",x="#111111";if(i==="value"&&b==="test"){const p=U(m,u,g);if(p===void 0)return[];h=p?"P":"F",x=Q(p?xt:Mt)}else if(i==="value"){const p=L(m,u);if(p===void 0)return[];h=Yt([p],f),x=Q(s.forValue(a(p)))}else if(i==="hardBin"||i==="softBin"){const p=i==="softBin"?m.sbin:m.hbin;if(p===void 0)return[];h=String(p),x=Q(s.forBin(p))}else if(i==="metadata"){const p=ct(m,k);if(p===void 0)return[];h=p,x=Q(D?.get(h)??z)}else{const p=L(m,0);if(p===void 0)return[];h=Yt([p],f),x=Q(s.forValue(a(p)))}const C=e?e[S*2]:m.physX,E=e?e[S*2+1]:m.physY;return[{x:C,y:E,text:h,fontSize:We(m,h),color:x,align:"center"}]})}function Gt(t){return t==="top"?Math.PI/2:t==="bottom"?-Math.PI/2:t==="left"?Math.PI:0}function je(t,e,n=720){const{center:i,radius:s,notch:a}=t,o=B=>G(e,B.x,B.y);if(!(a!==void 0&&t.diameter>150)){const B=[];for(let f=0;f<=n;f++){const u=2*Math.PI*f/n;B.push(o(qe(t,u)))}return[{kind:"wafer-boundary",...Y(B,!0),lineColor:"#888888",lineWidth:1}]}const d=1.25,y=a.length,b=Gt(a.type),k=Math.atan2(y,s),D=s-d,I=[];let g=!1;for(let B=0;B<=n;B++){const f=2*Math.PI*B/n;let u=f-b;for(;u>Math.PI;)u-=2*Math.PI;for(;u<-Math.PI;)u+=2*Math.PI;if(Math.abs(u)<=k){if(!g){g=!0;const m={x:i.x+s*Math.cos(b-k),y:i.y+s*Math.sin(b-k)},S={x:i.x+D*Math.cos(b),y:i.y+D*Math.sin(b)},h={x:i.x+s*Math.cos(b+k),y:i.y+s*Math.sin(b+k)};I.push(o(m),o(S),o(h))}continue}I.push(o({x:i.x+s*Math.cos(f),y:i.y+s*Math.sin(f)}))}return[{kind:"wafer-boundary",...Y(I,!0),lineColor:"#888888",lineWidth:1}]}function Xe(t,e,n,i=360){const s=[],a=Math.max(1,Math.floor(n));for(let o=1;o<a;o++){const r=t.radius*o/a,d=[];for(let y=0;y<=i;y++){const b=2*Math.PI*y/i,k={x:t.center.x+r*Math.cos(b),y:t.center.y+r*Math.sin(b)};d.push(G(e,k.x,k.y))}s.push({kind:"ring-boundary",...Y(d,!0),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5})}return s}function Ye(t,e,n,i){const{x:s,y:a}=t.center,o=t.radius,r=(f,u)=>G(e,f,u),d=n-s,y=Math.sqrt(Math.max(0,o*o-d*d)),b=r(n,a-y),k=r(n,a+y),D=i-a,I=Math.sqrt(Math.max(0,o*o-D*D)),g=r(s-I,i),B=r(s+I,i);return[{kind:"quadrant-boundary",...Y([b,k]),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5},{kind:"quadrant-boundary",...Y([g,B]),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5}]}function Ge(t,e){return t.map(n=>{const i=n.width/2,s=n.height/2;return{kind:"reticle",points:[[[n.x-i,n.y-s],[n.x+i,n.y-s],[n.x+i,n.y+s],[n.x-i,n.y+s]].map(([o,r])=>G(e,o,r))],closed:!0,lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5,fill:"rgba(0,0,0,0)"}})}function Qe(t){const e=t.filter(n=>n.probeIndex!==void 0).sort((n,i)=>(n.probeIndex??0)-(i.probeIndex??0));return e.length?[{kind:"probe-path",...Y(e.map(n=>({x:n.physX,y:n.physY}))),lineColor:"rgba(220,80,0,0.55)",lineWidth:1}]:[]}function Ue(t,e,n,i,s,a,o,r,d,y,b,k,D,I,g="off",B,f,u){const m=e.width-o,S=e.height-o,h=a?S:m,x=a?m:S,C=M=>s==="softBin"?M.sbin:M.hbin,E=M=>ct(M,B);if(e.partial){t.push({x:n,y:i,width:h,height:x,fill:_e,type:"stacked",metadata:e.metadata});return}if(e.edgeExcluded){t.push({x:n,y:i,width:h,height:x,fill:Oe,type:"stacked",metadata:e.metadata});return}if(d!==void 0&&(s==="hardBin"||s==="softBin")&&!d.has(C(e))){t.push({x:n,y:i,width:h,height:x,fill:Xt,type:"hardBin",metadata:e.metadata});return}if(u!==void 0&&s==="metadata"&&!u.has(E(e))){t.push({x:n,y:i,width:h,height:x,fill:Xt,type:"metadata",metadata:e.metadata});return}if(s==="value"){if(g==="test"){const q=U(e,b,I),ut=q===void 0?z:q?xt:Mt;t.push({x:n,y:i,width:h,height:x,fill:ut,type:"value",metadata:e.metadata});return}const M=L(e,b),P=ot(M,I);let w,J;M===void 0?w=z:g==="spec"?w=P==="failLow"?Te:P==="failHigh"?Mt:xt:(w=r.forValue(y(M)),(P==="failLow"||P==="failHigh")&&(J=P)),t.push({x:n,y:i,width:h,height:x,fill:w,type:"value",specMark:J,metadata:e.metadata});return}if(s==="hardBin"||s==="softBin"){const M=C(e),P=M!=null?r.forBin(M):z,w=M!=null&&Fe(e,D)===!1?!0:void 0;t.push({x:n,y:i,width:h,height:x,fill:P,type:s,binFail:w,metadata:e.metadata});return}if(s==="metadata"){const M=E(e),P=M!==void 0?f?.get(M)??z:z;t.push({x:n,y:i,width:h,height:x,fill:P,type:"metadata",metadata:e.metadata});return}const p=L(e,0),A=p!==void 0?r.forValue(y(p)):z;t.push({x:n,y:i,width:h,height:x,fill:A,type:"value",metadata:e.metadata})}function Je(t,e,n){const i=t.radius;return Re(e,i*.15,(s,a)=>({x:t.center.x+s*i*.9,y:t.center.y+a*i*.9}),n).overlays}export function buildView(t,e,n={},i){const s=n.reticles??[],{plotMode:a="value",showDieLabels:o=!1,showReticle:r=!1,showProbePath:d=!1,ringCount:y,showRingBoundaries:b=!1,showQuadrantBoundaries:k=!1,showXYIndicator:D=!1,binColorScheme:I="default",valueColorScheme:g="default",reverseValueScheme:B=!1,useDefinedBinColors:f=!0,binColors:u,passBins:m,highlightBin:S,highlightMetadataValue:h,interactiveTransform:x,valueRange:C,metadataValueOrder:E,testDefs:p,activeTest:A=0,activeMetadataKey:M,fallbackFormat:P="engineering",aggregationMethod:w,lotSize:J,dataAxisFlip:q,isLotStack:ut=!1,logScale:Qt,colorbarRangeMode:Ut="spec",passFailDisplay:Jt}=n,It=Jt??"off",ft=i?.hbinDefs,dt=i?.sbinDefs,Tt=i?.metadataFields,Zt=Tt?.find(l=>l.key===M),te={x:(q?.x??!1)!==(x?.flipX??!1),y:(q?.y??!1)!==(x?.flipY??!1)},ee=ft?new Map(ft.map(l=>[l.bin,l])):null,ne=dt?new Map(dt.map(l=>[l.bin,l])):null,ae=a==="softBin"?ne:ee,Dt=ge({passBins:m},"buildView"),ie=new Set(Dt),ht=u&&Ve(u,e)?u:Ce(e,{passBins:Dt,binColorScheme:I,hbinDefs:ft,sbinDefs:dt,useDefinedBinColors:f}),se=a==="softBin"?ht.soft:ht.hard,Ct={forValue:Ke(De(g,B)),forBin:l=>se.get(l)??z};let{testNumber:H}=resolveTestNumber(A,p);if(!p?.length&&a==="value"){const l=Ot(e,"values");!l.includes(H)&&l.length&&(H=l[0])}let Z;if(Array.isArray(C))Z=C;else if(C){const{testNumber:l}=resolveTestNumber(C.test,p);Z=l===H?C.range:void 0}const T=findTestDef(p,H),Vt=a==="value"&&T!==void 0&&!St(T),oe=T!==void 0&&(T.limitLow!==void 0||T.limitHigh!==void 0);let O="off";a==="value"&&(Vt?O="test":It==="spec"&&oe?O="spec":It==="test"&&e.some(l=>U(l,H,T)!==void 0)&&(O="test"));const Ft=O==="spec"?"spec":Ut,mt=a==="stackedValues"||a==="stackedBins"||a==="stackedSoftBins";let N,_,tt=!1;if(Z){[N,_]=Z;let l=!0,c=!1;for(const v of e){const F=mt?L(v,0):L(v,H);if(F!==void 0&&(c=!0,!Number.isInteger(F))){l=!1;break}}tt=c&&l}else{const l=!mt&&a==="value"&&Ft==="spec"&&T&&(T.limitLow!==void 0||T.limitHigh!==void 0);let c=1/0,v=-1/0,F=!0;for(const $ of e){const W=mt?L($,0):L($,H);W!==void 0&&(W<c&&(c=W),W>v&&(v=W),Number.isInteger(W)||(F=!1))}isFinite(c)||(F=!1),tt=F,l?(N=T.limitLow!==void 0?T.limitLow:isFinite(c)?c:0,_=T.limitHigh!==void 0?T.limitHigh:isFinite(v)?v:1):(N=isFinite(c)?c:0,_=isFinite(v)?v:1)}N===_&&(_=N+1);const Lt=Vt?!1:Qt??T?.logScale??!1,Rt=Lt&&N>0&&_>0,re=Rt;let et;if(Rt){const l=Math.log10(N),c=Math.log10(_)-l;et=v=>v<=0?0:Wt((Math.log10(v)-l)/c)}else et=l=>Wt((l-N)/(_-N));const V=we(t,q,x);let Pt=null;if(t.notch){const l=Gt(t.notch.type),c=$e(V.physicalToScreen,Math.cos(l)*t.radius,Math.sin(l)*t.radius),v=Math.hypot(c.x,c.y);v>0&&(Pt={x:c.x/v,y:c.y/v})}let j=1/0;for(let l=0;l<e.length;l++){const c=e[l];c.width<j&&(j=c.width),c.height<j&&(j=c.height)}const Nt=1,le=j!==1/0?Math.min(Nt,j*.12):Nt,Et=[],pt=[],ce=V.bakedToScreen.a===1&&V.bakedToScreen.b===0&&V.bakedToScreen.c===0&&V.bakedToScreen.d===1&&V.bakedToScreen.e===0&&V.bakedToScreen.f===0;let K=null;if(!ce){K=new Float64Array(e.length*2);for(let l=0;l<e.length;l++){const c=G(V.bakedToScreen,e[l].physX,e[l].physY);K[l*2]=c.x,K[l*2+1]=c.y}}const ue=Ie(V.gridToScreen),fe=a==="hardBin"||a==="softBin"||a==="stackedBins"||a==="stackedSoftBins",de=a==="softBin"||a==="stackedSoftBins";let nt=fe?new Map:void 0;const gt=a==="value"&&O==="spec"?{pass:0,failHigh:0,failLow:0}:void 0,yt=a==="value"&&O==="test"?{pass:0,fail:0}:void 0,At=a==="metadata";let at=At?new Map:void 0,it=null;if(At&&M){const l=collectMetadataValues(e,M),c=E?.key===M?E.values:void 0,v=c?[...c,...l.filter(F=>!c.includes(F))]:l;it=new Map(v.map((F,$)=>[F,Zt?.values?.find(W=>W.value===F)?.color??Pe($)]))}const he=S===void 0?void 0:new Set(Kt(S)),me=h===void 0?void 0:new Set(Kt(h));for(let l=0;l<e.length;l++){const c=e[l],v=K?K[l*2]:c.physX,F=K?K[l*2+1]:c.physY;if(pt.push({x:v,y:F}),nt&&!c.partial&&!c.edgeExcluded){const $=de?c.sbin:c.hbin;$!=null&&nt.set($,(nt.get($)??0)+1)}if(gt&&!c.partial&&!c.edgeExcluded){const $=ot(L(c,H),T);$&&gt[$]++}if(yt&&!c.partial&&!c.edgeExcluded){const $=U(c,H,T);$!==void 0&&yt[$?"pass":"fail"]++}if(at&&!c.partial&&!c.edgeExcluded){const $=ct(c,M);$!==void 0&&at.set($,(at.get($)??0)+1)}Ue(Et,c,v,F,a,ue,le,Ct,he,et,H,ae,ie,T,O,M,it,me)}const Ht=o?generateTextOverlay(e,K,{plotMode:a,colorFns:Ct,normalize:et,activeTest:A,valueRange:[N,_],testDefs:p,fallbackFormat:P,passFailDisplay:O,activeMetadataKey:M,metadataColorMap:it,allIntegerValues:tt}):[],X=je(t,V.physicalToScreen);b&&X.push(...Xe(t,V.physicalToScreen,ye({ringCount:y},"buildView"))),k&&X.push(...Ye(t,V.physicalToScreen,t.center.x,t.center.y)),r&&X.push(...Ge(s,V.gridToScreen)),d&&X.push(...Qe(e)),D&&X.push(...Je(t,V.gridToScreen,Ht));const pe=pt.length>0?{minX:t.center.x-t.radius,maxX:t.center.x+t.radius,minY:t.center.y-t.radius,maxY:t.center.y+t.radius}:null,_t={rectangles:Et,hoverPoints:pt,texts:Ht,overlays:X,plotMode:a,binColorScheme:I,valueColorScheme:g,reverseValueScheme:B,binColors:ht,metadata:t.metadata??null,dies:e,valueRange:[N,_],allIntegerValues:tt,testDefs:p,activeTest:A,logScale:re,logScaleRequested:Lt,aggrMethod:w,lotSize:J,axisFlip:te,dataAxisFlip:{x:q?.x??!1,y:q?.y??!1},gridToScreen:V.gridToScreen,rotation:((t.orientation+(x?.rotation??0))%360+360)%360,hasReticle:s.length>0,isLotStack:ut,passFailDisplay:O,colorbarRangeMode:Ft,waferCenter:t.center,waferRadius:t.radius,notchDir:Pt,binCounts:nt,metadataCounts:at,metadataColorMap:it,activeMetadataKey:M,metadataFields:Tt,specCounts:gt,passFailCounts:yt,dieBounds:pe};return n.compact?Le(_t,n.compact,{showXYIndicator:D}):_t}export{getDieKey}from"../core/dies.js";
1
+ import{requirePassBins as ge}from"../core/passBins.js";import{requireRingCount as ye}from"../core/ringCount.js";import{hasPosition as be}from"../core/dies.js";import{dieValueEntries as xe,dieVerdictEntries as Me,excludedBy as Se,excludedValue as ve,recordedVerdict as Be,testsPresent as wt}from"../core/dieTable.js";import{limitSetName as $e}from"./valueFilter.js";import{getReticleCell as ke}from"../core/reticle.js";import{metadataCategoricalValue as Ie,metadataDisplayValue as Te}from"../core/metadata.js";import{affineRotation as xt,affineMirror as qt,affineCompose as ot,affinePoint as Y,affineVector as De,affineSwapsAxes as Ve}from"../core/transforms.js";import{contrastTextColor as Q,SPEC_PASS_FILL as Mt,SPEC_FAIL_LOW as Ce,SPEC_FAIL_HIGH as St}from"./colorMap.js";import{resolveValueColorFn as Fe}from"./colorSchemes.js";import{resolveBinColors as Le,binColorsCover as Re}from"./binColors.js";import{NO_DATA_FILL as z}from"./colorMap.js";import{diePassStatus as Pe}from"../core/dies.js";import{compactView as Ne}from"./compactView.js";import{buildXYIndicator as Ee}from"./xyIndicator.js";import{getDieTestValue as L,getTestPassStatus as U,isParametricTest as vt}from"./buildWaferMap.js";import{classifySpec as rt}from"./spec.js";export{rt as classifySpec};import{fmt as lt,fmtColorbarAxis as Bt,fmtAggregationMethod as Kt}from"./fmt.js";import{metadataValueColor as Ae}from"./colorMap.js";import{asList as Wt,clamp01 as zt,compareNatural as He,escHtml as R}from"../core/utils.js";import{prettyKey as jt}from"../core/utils.js";import{testLabel as ct,markedTestLabel as J,derivedTestNote as Gt,isDerivedTest as _e,DERIVED_MARK as Oe,DERIVED_KEY as we}from"./testLabel.js";export function resolveTestNumber(t,e){return e?.length?{testNumber:(findTestDef(e,t)??e[0]).testNumber}:{testNumber:t}}export function collectMetadataValues(t,e){const n=new Set;for(const i of t){if(i.partial||i.edgeExcluded)continue;const s=ut(i,e);s!==void 0&&n.add(s)}return[...n].sort(He)}export function findTestDef(t,e){return t?.find(n=>n.testNumber===e)}export function getUniqueTestNumbers(t){return wt(t,"values")}const qe="#d3d6db",Xt="#e8e9ea",Ke="#aab0ba";function ut(t,e){return e?Ie(t.metadata?.[e]):void 0}function We(t,e,n){const{x:i,y:s}=t.center,a=xt(t.orientation,i,s),o=ot(qt(e?.x??!1,e?.y??!1,i,s),xt(t.orientation,i,s)),r=ot(qt(n?.flipX??!1,n?.flipY??!1,i,s),xt(n?.rotation??0,i,s));return{bakedToScreen:r,physicalToScreen:ot(r,a),gridToScreen:ot(r,o)}}function X(t,e=!1){return{points:[t],closed:e}}function ze(t,e){const{center:n,radius:i,notch:s}=t;let a=n.x+i*Math.cos(e),o=n.y+i*Math.sin(e);if(!s)return{x:a,y:o};const r=Math.sqrt(i**2-(s.length/2)**2),d=s.length/2,p=a-n.x,x=o-n.y;return s.type==="bottom"&&x<-r?(o=n.y-r,a=n.x+Math.max(-d,Math.min(d,p))):s.type==="top"&&x>r?(o=n.y+r,a=n.x+Math.max(-d,Math.min(d,p))):s.type==="left"&&p<-r?(a=n.x-r,o=n.y+Math.max(-d,Math.min(d,x))):s.type==="right"&&p>r&&(a=n.x+r,o=n.y+Math.max(-d,Math.min(d,x))),{x:a,y:o}}function Yt(t,e){return t.map(e).join(" / ")}function je(t,e=256){const n=Array.from({length:e},(i,s)=>t(s/(e-1)));return i=>n[Math.min(e-1,Math.max(0,Math.round(i*(e-1))))]}function Ge(t,e){const n=Math.max(1,Math.min(t.width,t.height)),i=t.width/Math.max(e.length,1);return Math.max(8,Math.min(16,Math.round(Math.min(n*.55,i*1.8))))}function Xe(t,e,n){if(e?.length){const a=e.flatMap(o=>{const r=o.testNumber;if(!vt(o)){const p=U(t,r,o);return p===void 0?[]:[{key:r,label:J(o,r),value:p?"Pass":"Fail"}]}const d=L(t,r);if(d===void 0){const p=ve(t,r);return p===void 0?[]:[{key:r,label:J(o,r),value:lt(p,o.unit,n),excludedBy:Se(t)}]}return[{key:r,label:J(o,r),value:lt(d,o.unit,n),recordedFail:Be(t,r)===!1}]});if(a.length)return a}const i=xe(t);if(i.length)return i.map(([a,o])=>({key:a,label:ct(void 0,a),value:lt(o,void 0,n)}));const s=Me(t);return s.length?s.map(([a,o])=>({key:a,label:ct(void 0,a),value:o?"Pass":"Fail"})):[]}export function buildHoverText(t,e,n={}){const{testDefs:i,hbinDefs:s,sbinDefs:a,fallbackFormat:o,aggrMethod:r,lotSize:d,activeTest:p,reticleConfig:x,metadataFields:$}=n,V=s?new Map(s.map(f=>[f.bin,f])):null,I=a?new Map(a.map(f=>[f.bin,f])):null,y=[R(`Die (${t.x}, ${t.y})`)];if(x&&be(t)){const f=ke(t,x);y.push(R(`Reticle (${f.column}, ${f.row})`))}if(e==="stackedValues"){const f=L(t,0);if(f!==void 0){const u=i?.[0],m=u?J(u,u.testNumber):"Value",S=r?` (${r})`:"";y.push(R(`${m}${S}: ${lt(f,u?.unit,o)}`));const h=Gt(u);h&&y.push(`<i>${R(h)}</i>`)}}else if(e==="stackedBins"||e==="stackedSoftBins"){const f=L(t,0),u=e==="stackedSoftBins"?t.sbin:t.hbin;if(f!==void 0){const m=e==="stackedSoftBins"?I:V,S=u!==void 0?m?.get(u)?.name?`${u} \xB7 ${m.get(u).name}`:`Bin ${u}`:"Bin";let h;if(r==="percent")h=`${f.toFixed(0)}%`;else{const D=d?` (${(f/d*100).toFixed(0)}% of stacked wafers)`:"";h=`${f}${D}`}const b=r?` [${Kt(r)}]`:"";y.push(R(`${S}: ${h}${b}`))}}else{const f=Xe(t,i,o);if(e==="value"&&f.length){const{testNumber:u}=resolveTestNumber(p??0,i),m=findTestDef(i,u),S=L(t,u);let h=f.findIndex(A=>A.key===u);h<0&&(h=0);const b=f[h];let D=`<b>${R(`${b.label}: ${b.value}`)}${b.recordedFail?" <i>(recorded fail)</i>":""}</b>`;if(b.key===u&&m){const A=rt(S,m);(A==="failLow"||A==="failHigh")&&(D+=" <i>(outside test limits)</i>")}b.excludedBy&&(D+=` <i>(outside ${$e(b.excludedBy)}, excluded)</i>`),y.push(D);const E=Gt(findTestDef(i,b.key));E&&y.push(`<i>${R(E)}</i>`);const g=f.length-1;g>0&&y.push(`<i>+${g} more test${g===1?"":"s"}</i>`)}else if(f.length){const u=f.length;y.push(`<i>${u} test result${u===1?"":"s"} recorded</i>`)}if(t.hbin!==void 0||t.sbin!==void 0){const u=[];if(t.hbin!==void 0){const m=V?.get(t.hbin)?.name,S=m?`${t.hbin} \xB7 ${m}`:String(t.hbin);u.push(`HBin: ${S}`)}if(t.sbin!==void 0){const m=I?.get(t.sbin)?.name,S=m?`${t.sbin} \xB7 ${m}`:String(t.sbin);u.push(`SBin: ${S}`)}y.push(u.map(R).join(" &nbsp;\xB7&nbsp; "))}}t.retestCount!==void 0&&y.push(R(`Retests: ${t.retestCount}`)),t.siteNum!==void 0&&y.push(R(`Site: ${t.siteNum}`)),t.partId!==void 0&&y.push(R(`Part ID: ${t.partId}`)),t.partial&&y.push("<i>partial die</i>"),t.probeIndex!==void 0&&y.push(R(`Probe: #${t.probeIndex}`));const B={...t.metadata??{}};for(const[f,u]of Object.entries(B)){const m=Te(u);if(m===void 0)continue;const S=$?.find(h=>h.key===f)?.label??jt(f);y.push(R(`${S}: ${m}`))}return y.join("<br>")}function $t(t){return t?.name?J(t,t.testNumber):void 0}function kt(t){return _e(t)?{note:`${Oe} ${we}`}:{}}export function buildMapTitle(t,e="engineering",n){const i=t.isLotStack&&t.lotSize!==void 0?`stacked (${t.lotSize} ${t.lotSize===1?"wafer":"wafers"})`:"stacked",s=a=>{const o=n?.length===1?n[0]:void 0;return o===void 0?`${a} Bin`:o.name?`${a} Bin ${o.bin} \xB7 ${o.name}`:`${a} Bin ${o.bin}`};switch(t.plotMode){case"hardBin":return{primary:"Hard Bin",secondary:""};case"softBin":return{primary:"Soft Bin",secondary:""};case"stackedBins":return{primary:s("Hard"),secondary:i};case"stackedSoftBins":return{primary:s("Soft"),secondary:i};case"metadata":{const a=t.metadataFields?.find(r=>r.key===t.activeMetadataKey),o=t.activeMetadataKey?jt(t.activeMetadataKey):"Metadata";return{primary:a?.label??o,secondary:""}}case"stackedValues":{const a=t.testDefs?.[0],o=t.valueRange[1]||t.valueRange[0]||0,{axisLabel:r}=Bt(o,$t(a),a?.unit,e),d=r||"Value",p=t.aggrMethod?` \xB7 ${Kt(t.aggrMethod)}`:"";return{primary:`${d}${p}`,secondary:i,...kt(a)}}default:{const a=findTestDef(t.testDefs,t.activeTest),o=t.valueRange[1]||t.valueRange[0]||0,{axisLabel:r}=Bt(o,$t(a),a?.unit,e),d=r||$t(a);if(t.passFailDisplay!=="off"){const p=a?.testNumber??t.activeTest,x=d?`${d} \xB7 #${p}`:ct(void 0,p),$=t.passFailDisplay==="spec"?"Limit pass/fail":a!==void 0&&!vt(a)?"Functional pass/fail":"Tester pass/fail";return{primary:x,secondary:$,...kt(a)}}return{primary:d??ct(void 0,t.activeTest),secondary:"",...kt(a)}}}}export function generateTextOverlay(t,e,n){const{plotMode:i,colorFns:s,normalize:a,activeTest:o,valueRange:r,testDefs:d,fallbackFormat:p,passFailDisplay:x="off",activeMetadataKey:$,metadataColorMap:V,allIntegerValues:I}=n,y=findTestDef(d,o),{tickFmt:B}=Bt(r[1],y?.name,y?.unit,p),f=I?m=>String(Math.round(m)):B,{testNumber:u}=resolveTestNumber(o,d);return t.flatMap((m,S)=>{let h="",b="#111111";if(i==="value"&&x==="test"){const g=U(m,u,y);if(g===void 0)return[];h=g?"P":"F",b=Q(g?Mt:St)}else if(i==="value"){const g=L(m,u);if(g===void 0)return[];h=Yt([g],f),b=Q(s.forValue(a(g)))}else if(i==="hardBin"||i==="softBin"){const g=i==="softBin"?m.sbin:m.hbin;if(g===void 0)return[];h=String(g),b=Q(s.forBin(g))}else if(i==="metadata"){const g=ut(m,$);if(g===void 0)return[];h=g,b=Q(V?.get(h)??z)}else{const g=L(m,0);if(g===void 0)return[];h=Yt([g],f),b=Q(s.forValue(a(g)))}const D=e?e[S*2]:m.physX,E=e?e[S*2+1]:m.physY;return[{x:D,y:E,text:h,fontSize:Ge(m,h),color:b,align:"center"}]})}function Qt(t){return t==="top"?Math.PI/2:t==="bottom"?-Math.PI/2:t==="left"?Math.PI:0}function Ye(t,e,n=720){const{center:i,radius:s,notch:a}=t,o=B=>Y(e,B.x,B.y);if(!(a!==void 0&&a.length>0&&t.diameter>150)){const B=[];for(let f=0;f<=n;f++){const u=2*Math.PI*f/n;B.push(o(ze(t,u)))}return[{kind:"wafer-boundary",...X(B,!0),lineColor:"#888888",lineWidth:1}]}const d=1.25,p=a.length,x=Qt(a.type),$=Math.atan2(p,s),V=s-d,I=[];let y=!1;for(let B=0;B<=n;B++){const f=2*Math.PI*B/n;let u=f-x;for(;u>Math.PI;)u-=2*Math.PI;for(;u<-Math.PI;)u+=2*Math.PI;if(Math.abs(u)<=$){if(!y){y=!0;const m={x:i.x+s*Math.cos(x-$),y:i.y+s*Math.sin(x-$)},S={x:i.x+V*Math.cos(x),y:i.y+V*Math.sin(x)},h={x:i.x+s*Math.cos(x+$),y:i.y+s*Math.sin(x+$)};I.push(o(m),o(S),o(h))}continue}I.push(o({x:i.x+s*Math.cos(f),y:i.y+s*Math.sin(f)}))}return[{kind:"wafer-boundary",...X(I,!0),lineColor:"#888888",lineWidth:1}]}function Qe(t,e,n,i=360){const s=[],a=Math.max(1,Math.floor(n));for(let o=1;o<a;o++){const r=t.radius*o/a,d=[];for(let p=0;p<=i;p++){const x=2*Math.PI*p/i,$={x:t.center.x+r*Math.cos(x),y:t.center.y+r*Math.sin(x)};d.push(Y(e,$.x,$.y))}s.push({kind:"ring-boundary",...X(d,!0),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5})}return s}function Ue(t,e,n,i){const{x:s,y:a}=t.center,o=t.radius,r=(f,u)=>Y(e,f,u),d=n-s,p=Math.sqrt(Math.max(0,o*o-d*d)),x=r(n,a-p),$=r(n,a+p),V=i-a,I=Math.sqrt(Math.max(0,o*o-V*V)),y=r(s-I,i),B=r(s+I,i);return[{kind:"quadrant-boundary",...X([x,$]),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5},{kind:"quadrant-boundary",...X([y,B]),lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5}]}function Je(t,e){return t.map(n=>{const i=n.width/2,s=n.height/2;return{kind:"reticle",points:[[[n.x-i,n.y-s],[n.x+i,n.y-s],[n.x+i,n.y+s],[n.x-i,n.y+s]].map(([o,r])=>Y(e,o,r))],closed:!0,lineColor:"rgba(255,255,255,0.7)",lineWidth:1.5,fill:"rgba(0,0,0,0)"}})}function Ze(t){const e=t.filter(n=>n.probeIndex!==void 0).sort((n,i)=>(n.probeIndex??0)-(i.probeIndex??0));return e.length?[{kind:"probe-path",...X(e.map(n=>({x:n.physX,y:n.physY}))),lineColor:"rgba(220,80,0,0.55)",lineWidth:1}]:[]}function tn(t,e,n,i,s,a,o,r,d,p,x,$,V,I,y="off",B,f,u){const m=e.width-o,S=e.height-o,h=a?S:m,b=a?m:S,D=M=>s==="softBin"?M.sbin:M.hbin,E=M=>ut(M,B);if(e.partial){t.push({x:n,y:i,width:h,height:b,fill:qe,type:"stacked",metadata:e.metadata});return}if(e.edgeExcluded){t.push({x:n,y:i,width:h,height:b,fill:Ke,type:"stacked",metadata:e.metadata});return}if(d!==void 0&&(s==="hardBin"||s==="softBin")&&!d.has(D(e))){t.push({x:n,y:i,width:h,height:b,fill:Xt,type:"hardBin",metadata:e.metadata});return}if(u!==void 0&&s==="metadata"&&!u.has(E(e))){t.push({x:n,y:i,width:h,height:b,fill:Xt,type:"metadata",metadata:e.metadata});return}if(s==="value"){if(y==="test"){const q=U(e,x,I),ft=q===void 0?z:q?Mt:St;t.push({x:n,y:i,width:h,height:b,fill:ft,type:"value",metadata:e.metadata});return}const M=L(e,x),P=rt(M,I);let w,Z;M===void 0?w=z:y==="spec"?w=P==="failLow"?Ce:P==="failHigh"?St:Mt:(w=r.forValue(p(M)),(P==="failLow"||P==="failHigh")&&(Z=P)),t.push({x:n,y:i,width:h,height:b,fill:w,type:"value",specMark:Z,metadata:e.metadata});return}if(s==="hardBin"||s==="softBin"){const M=D(e),P=M!=null?r.forBin(M):z,w=M!=null&&Pe(e,V)===!1?!0:void 0;t.push({x:n,y:i,width:h,height:b,fill:P,type:s,binFail:w,metadata:e.metadata});return}if(s==="metadata"){const M=E(e),P=M!==void 0?f?.get(M)??z:z;t.push({x:n,y:i,width:h,height:b,fill:P,type:"metadata",metadata:e.metadata});return}const g=L(e,0),A=g!==void 0?r.forValue(p(g)):z;t.push({x:n,y:i,width:h,height:b,fill:A,type:"value",metadata:e.metadata})}function en(t,e,n){const i=t.radius;return Ee(e,i*.15,(s,a)=>({x:t.center.x+s*i*.9,y:t.center.y+a*i*.9}),n).overlays}export function buildView(t,e,n={},i){const s=n.reticles??[],{plotMode:a="value",showDieLabels:o=!1,showReticle:r=!1,showProbePath:d=!1,ringCount:p,showRingBoundaries:x=!1,showQuadrantBoundaries:$=!1,showXYIndicator:V=!1,binColorScheme:I="default",valueColorScheme:y="default",reverseValueScheme:B=!1,useDefinedBinColors:f=!0,binColors:u,passBins:m,highlightBin:S,highlightMetadataValue:h,interactiveTransform:b,valueRange:D,metadataValueOrder:E,testDefs:g,activeTest:A=0,activeMetadataKey:M,fallbackFormat:P="engineering",aggregationMethod:w,lotSize:Z,dataAxisFlip:q,isLotStack:ft=!1,logScale:Ut,colorbarRangeMode:Jt="spec",passFailDisplay:Zt}=n,It=Zt??"off",dt=i?.hbinDefs,ht=i?.sbinDefs,Tt=i?.metadataFields,te=Tt?.find(l=>l.key===M),ee={x:(q?.x??!1)!==(b?.flipX??!1),y:(q?.y??!1)!==(b?.flipY??!1)},ne=dt?new Map(dt.map(l=>[l.bin,l])):null,ae=ht?new Map(ht.map(l=>[l.bin,l])):null,ie=a==="softBin"?ae:ne,Dt=ge({passBins:m},"buildView"),se=new Set(Dt),mt=u&&Re(u,e)?u:Le(e,{passBins:Dt,binColorScheme:I,hbinDefs:dt,sbinDefs:ht,useDefinedBinColors:f}),oe=a==="softBin"?mt.soft:mt.hard,Vt={forValue:je(Fe(y,B)),forBin:l=>oe.get(l)??z};let{testNumber:H}=resolveTestNumber(A,g);if(!g?.length&&a==="value"){const l=wt(e,"values");!l.includes(H)&&l.length&&(H=l[0])}let tt;if(Array.isArray(D))tt=D;else if(D){const{testNumber:l}=resolveTestNumber(D.test,g);tt=l===H?D.range:void 0}const T=findTestDef(g,H),Ct=a==="value"&&T!==void 0&&!vt(T),re=T!==void 0&&(T.limitLow!==void 0||T.limitHigh!==void 0);let O="off";a==="value"&&(Ct?O="test":It==="spec"&&re?O="spec":It==="test"&&e.some(l=>U(l,H,T)!==void 0)&&(O="test"));const Ft=O==="spec"?"spec":Jt,pt=a==="stackedValues"||a==="stackedBins"||a==="stackedSoftBins";let N,_,et=!1;if(tt){[N,_]=tt;let l=!0,c=!1;for(const v of e){const F=pt?L(v,0):L(v,H);if(F!==void 0&&(c=!0,!Number.isInteger(F))){l=!1;break}}et=c&&l}else{const l=!pt&&a==="value"&&Ft==="spec"&&T&&(T.limitLow!==void 0||T.limitHigh!==void 0);let c=1/0,v=-1/0,F=!0;for(const k of e){const W=pt?L(k,0):L(k,H);W!==void 0&&(W<c&&(c=W),W>v&&(v=W),Number.isInteger(W)||(F=!1))}isFinite(c)||(F=!1),et=F,l?(N=T.limitLow!==void 0?T.limitLow:isFinite(c)?c:0,_=T.limitHigh!==void 0?T.limitHigh:isFinite(v)?v:1):(N=isFinite(c)?c:0,_=isFinite(v)?v:1)}N===_&&(_=N+1);const Lt=Ct?!1:Ut??T?.logScale??!1,Rt=Lt&&N>0&&_>0,le=Rt;let nt;if(Rt){const l=Math.log10(N),c=Math.log10(_)-l;nt=v=>v<=0?0:zt((Math.log10(v)-l)/c)}else nt=l=>zt((l-N)/(_-N));const C=We(t,q,b);let Pt=null;if(t.notch){const l=Qt(t.notch.type),c=De(C.physicalToScreen,Math.cos(l)*t.radius,Math.sin(l)*t.radius),v=Math.hypot(c.x,c.y);v>0&&(Pt={x:c.x/v,y:c.y/v})}let j=1/0;for(let l=0;l<e.length;l++){const c=e[l];c.width<j&&(j=c.width),c.height<j&&(j=c.height)}const Nt=1,Et=j!==1/0?Math.min(Nt,j*.12):Nt,At=[],gt=[],ce=C.bakedToScreen.a===1&&C.bakedToScreen.b===0&&C.bakedToScreen.c===0&&C.bakedToScreen.d===1&&C.bakedToScreen.e===0&&C.bakedToScreen.f===0;let K=null;if(!ce){K=new Float64Array(e.length*2);for(let l=0;l<e.length;l++){const c=Y(C.bakedToScreen,e[l].physX,e[l].physY);K[l*2]=c.x,K[l*2+1]=c.y}}const ue=Ve(C.gridToScreen),fe=a==="hardBin"||a==="softBin"||a==="stackedBins"||a==="stackedSoftBins",de=a==="softBin"||a==="stackedSoftBins";let at=fe?new Map:void 0;const yt=a==="value"&&O==="spec"?{pass:0,failHigh:0,failLow:0}:void 0,bt=a==="value"&&O==="test"?{pass:0,fail:0}:void 0,Ht=a==="metadata";let it=Ht?new Map:void 0,st=null;if(Ht&&M){const l=collectMetadataValues(e,M),c=E?.key===M?E.values:void 0,v=c?[...c,...l.filter(F=>!c.includes(F))]:l;st=new Map(v.map((F,k)=>[F,te?.values?.find(W=>W.value===F)?.color??Ae(k)]))}const he=S===void 0?void 0:new Set(Wt(S)),me=h===void 0?void 0:new Set(Wt(h));for(let l=0;l<e.length;l++){const c=e[l],v=K?K[l*2]:c.physX,F=K?K[l*2+1]:c.physY;if(gt.push({x:v,y:F}),at&&!c.partial&&!c.edgeExcluded){const k=de?c.sbin:c.hbin;k!=null&&at.set(k,(at.get(k)??0)+1)}if(yt&&!c.partial&&!c.edgeExcluded){const k=rt(L(c,H),T);k&&yt[k]++}if(bt&&!c.partial&&!c.edgeExcluded){const k=U(c,H,T);k!==void 0&&bt[k?"pass":"fail"]++}if(it&&!c.partial&&!c.edgeExcluded){const k=ut(c,M);k!==void 0&&it.set(k,(it.get(k)??0)+1)}tn(At,c,v,F,a,ue,Et,Vt,he,nt,H,ie,se,T,O,M,st,me)}const _t=o?generateTextOverlay(e,K,{plotMode:a,colorFns:Vt,normalize:nt,activeTest:A,valueRange:[N,_],testDefs:g,fallbackFormat:P,passFailDisplay:O,activeMetadataKey:M,metadataColorMap:st,allIntegerValues:et}):[],G=Ye(t,C.physicalToScreen);x&&G.push(...Qe(t,C.physicalToScreen,ye({ringCount:p},"buildView"))),$&&G.push(...Ue(t,C.physicalToScreen,t.center.x,t.center.y)),r&&G.push(...Je(s,C.gridToScreen)),d&&G.push(...Ze(e)),V&&G.push(...en(t,C.gridToScreen,_t));const pe=gt.length>0?{minX:t.center.x-t.radius,maxX:t.center.x+t.radius,minY:t.center.y-t.radius,maxY:t.center.y+t.radius}:null,Ot={rectangles:At,dieGap:Et,hoverPoints:gt,texts:_t,overlays:G,plotMode:a,binColorScheme:I,valueColorScheme:y,reverseValueScheme:B,binColors:mt,metadata:t.metadata??null,dies:e,valueRange:[N,_],allIntegerValues:et,testDefs:g,activeTest:A,logScale:le,logScaleRequested:Lt,aggrMethod:w,lotSize:Z,axisFlip:ee,dataAxisFlip:{x:q?.x??!1,y:q?.y??!1},gridToScreen:C.gridToScreen,rotation:((t.orientation+(b?.rotation??0))%360+360)%360,hasReticle:s.length>0,isLotStack:ft,passFailDisplay:O,colorbarRangeMode:Ft,waferCenter:t.center,waferRadius:t.radius,notchDir:Pt,binCounts:at,metadataCounts:it,metadataColorMap:st,activeMetadataKey:M,metadataFields:Tt,specCounts:yt,passFailCounts:bt,dieBounds:pe};return n.compact?Ne(Ot,n.compact,{showXYIndicator:V}):Ot}export{getDieKey}from"../core/dies.js";