@ni/ok-components 0.2.4 → 0.2.5

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.
@@ -16696,12 +16696,12 @@
16696
16696
  Whitespace intentionally avoided between tags for inline styles */ ''}<span
16697
16697
  part="start"
16698
16698
  ${ref('startContainer')}
16699
- class="${_x => (definition.start ? 'start' : null)}"
16699
+ class="${_x => (definition.start !== undefined ? 'start' : null)}"
16700
16700
  ><slot
16701
16701
  name="start"
16702
16702
  ${ref('start')}
16703
16703
  @slotchange="${x => x.handleStartContentChange()}">
16704
- ${definition.start || ''}
16704
+ ${definition.start ?? ''}
16705
16705
  </slot
16706
16706
  ></span
16707
16707
  ><span
@@ -16714,12 +16714,12 @@
16714
16714
  ><span
16715
16715
  part="end"
16716
16716
  ${ref('endContainer')}
16717
- class=${_x => (definition.end ? 'end' : null)}
16717
+ class=${_x => (definition.end !== undefined ? 'end' : null)}
16718
16718
  ><slot
16719
16719
  name="end"
16720
16720
  ${ref('end')}
16721
16721
  @slotchange="${x => x.handleEndContentChange()}">
16722
- ${definition.end || ''}
16722
+ ${definition.end ?? ''}
16723
16723
  </slot
16724
16724
  ></span></a></div>`;
16725
16725
 
@@ -19012,6 +19012,8 @@
19012
19012
  tab.style[gridHorizontalProperty] = `${index + 1}`;
19013
19013
  });
19014
19014
  if (firstFocusableTab
19015
+ // False positive. See: https://github.com/typescript-eslint/typescript-eslint/issues/12036
19016
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
19015
19017
  && (!this.activetab || !this.isFocusableElement(this.activetab))) {
19016
19018
  firstFocusableTab.setAttribute('tabindex', '0');
19017
19019
  }
@@ -20592,15 +20594,15 @@ so this becomes the fallback color for the slot */ ''}
20592
20594
  <div part="container" class="container">
20593
20595
  <div part="control" class="control">
20594
20596
  <slot name="checked-indicator">
20595
- ${definition.checkedIndicator || ''}
20597
+ ${definition.checkedIndicator ?? ''}
20596
20598
  </slot>
20597
20599
  <slot name="indeterminate-indicator">
20598
- ${definition.indeterminateIndicator || ''}
20600
+ ${definition.indeterminateIndicator ?? ''}
20599
20601
  </slot>
20600
20602
  </div>
20601
20603
  <label
20602
20604
  part="label"
20603
- class="${x => (x.defaultSlottedNodes?.length
20605
+ class="${x => (x.defaultSlottedNodes?.length > 0
20604
20606
  ? 'label'
20605
20607
  : 'label label__hidden')}"
20606
20608
  >
@@ -21322,7 +21324,7 @@ so this becomes the fallback color for the slot */ ''}
21322
21324
  />
21323
21325
  <div class="indicator" part="indicator" aria-hidden="true">
21324
21326
  <slot name="indicator">
21325
- ${definition.indicator || ''}
21327
+ ${definition.indicator ?? ''}
21326
21328
  </slot>
21327
21329
  </div>
21328
21330
  </slot>
@@ -21455,7 +21457,7 @@ so this becomes the fallback color for the slot */ ''}
21455
21457
  set value(next) {
21456
21458
  const prev = this._value;
21457
21459
  let updatedValue = next;
21458
- if (this.$fastController.isConnected && this.options) {
21460
+ if (this.$fastController.isConnected) {
21459
21461
  const selectedIndex = this.findIndexOfValidOption(next);
21460
21462
  const prevSelectedValue = this.options[this.selectedIndex]?.text;
21461
21463
  const nextSelectedValue = this.options[selectedIndex]?.text;
@@ -21481,7 +21483,7 @@ so this becomes the fallback color for the slot */ ''}
21481
21483
  */
21482
21484
  get options() {
21483
21485
  Observable.track(this, 'options');
21484
- return this.filteredOptions && this.filter
21486
+ return this.filter
21485
21487
  ? this.filteredOptions
21486
21488
  : this._options;
21487
21489
  }
@@ -21595,12 +21597,12 @@ so this becomes the fallback color for the slot */ ''}
21595
21597
  if (!this.isAutocompleteInline) {
21596
21598
  this.selectedIndex = this.findIndexOfValidOption(this.control.value);
21597
21599
  }
21598
- if (!e.inputType.includes('deleteContent') && this.filter.length) {
21600
+ if (!e.inputType.includes('deleteContent') && this.filter.length > 0) {
21599
21601
  if (this.isAutocompleteList && !this.open) {
21600
21602
  this.open = true;
21601
21603
  }
21602
21604
  if (this.isAutocompleteInline) {
21603
- if (this.filteredOptions.length) {
21605
+ if (this.filteredOptions.length > 0) {
21604
21606
  this.selectedOptions = [this.filteredOptions[0]];
21605
21607
  this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
21606
21608
  this.setInlineSelection();
@@ -21739,11 +21741,11 @@ so this becomes the fallback color for the slot */ ''}
21739
21741
  * Overrides `Listbox.setDefaultSelectedOption`
21740
21742
  */
21741
21743
  setDefaultSelectedOption() {
21742
- if (this.$fastController.isConnected && this.options) {
21744
+ if (this.$fastController.isConnected) {
21743
21745
  const selectedIndex = this.options.findIndex(el => !el.disabled
21744
21746
  && (el.getAttribute('selected') !== null || el.selected));
21745
21747
  this.selectedIndex = selectedIndex;
21746
- if (!this.dirtyValue && this.firstSelectedOption) {
21748
+ if (!this.dirtyValue && this.firstSelectedOption !== null) {
21747
21749
  this.value = this.firstSelectedOption.text;
21748
21750
  }
21749
21751
  this.setSelectedOptions();
@@ -21860,7 +21862,7 @@ so this becomes the fallback color for the slot */ ''}
21860
21862
  if (this.open) {
21861
21863
  if (this.contains(document.activeElement)) {
21862
21864
  this.control.focus();
21863
- if (this.firstSelectedOption) {
21865
+ if (this.firstSelectedOption !== null) {
21864
21866
  requestAnimationFrame(() => {
21865
21867
  this.firstSelectedOption?.scrollIntoView({
21866
21868
  block: 'nearest'
@@ -21921,12 +21923,12 @@ so this becomes the fallback color for the slot */ ''}
21921
21923
  this.setPositioning();
21922
21924
  }
21923
21925
  regionChanged(_prev, _next) {
21924
- if (this.region && this.controlWrapper) {
21926
+ if (this.region) {
21925
21927
  this.region.anchorElement = this.controlWrapper;
21926
21928
  }
21927
21929
  }
21928
21930
  controlWrapperChanged(_prev, _next) {
21929
- if (this.region && this.controlWrapper) {
21931
+ if (this.region) {
21930
21932
  this.region.anchorElement = this.controlWrapper;
21931
21933
  }
21932
21934
  }
@@ -21950,7 +21952,7 @@ so this becomes the fallback color for the slot */ ''}
21950
21952
  * Focus and set the content of the control based on the first selected option.
21951
21953
  */
21952
21954
  setInputToSelection() {
21953
- if (this.firstSelectedOption) {
21955
+ if (this.firstSelectedOption !== null) {
21954
21956
  this.control.value = this.firstSelectedOption.text;
21955
21957
  this.control.focus();
21956
21958
  }
@@ -21959,7 +21961,7 @@ so this becomes the fallback color for the slot */ ''}
21959
21961
  * Focus, set and select the content of the control based on the first selected option.
21960
21962
  */
21961
21963
  setInlineSelection() {
21962
- if (this.firstSelectedOption) {
21964
+ if (this.firstSelectedOption !== null) {
21963
21965
  this.setInputToSelection();
21964
21966
  this.control.setSelectionRange(this.filter.length, this.control.value.length, 'backward');
21965
21967
  }
@@ -22287,7 +22289,7 @@ so this becomes the fallback color for the slot */ ''}
22287
22289
  this.doResolveShow(reason);
22288
22290
  }
22289
22291
  slottedFooterElementsChanged(_prev, next) {
22290
- this.footerIsEmpty = !next?.length;
22292
+ this.footerIsEmpty = next === undefined || next.length === 0;
22291
22293
  }
22292
22294
  /**
22293
22295
  * @internal
@@ -26282,7 +26284,7 @@ so this becomes the fallback color for the slot */ ''}
26282
26284
  // closing an expanded item without opening another
26283
26285
  if (this.expandedItem !== null
26284
26286
  && changedItem === this.expandedItem
26285
- && changedItem.expanded === false) {
26287
+ && !changedItem.expanded) {
26286
26288
  this.expandedItem = null;
26287
26289
  return;
26288
26290
  }
@@ -26311,7 +26313,7 @@ so this becomes the fallback color for the slot */ ''}
26311
26313
  this.menuItems = newItems;
26312
26314
  const menuItems = this.menuItems.filter(this.isMenuItemElement);
26313
26315
  // if our focus index is not -1 we have items
26314
- if (menuItems.length) {
26316
+ if (menuItems.length > 0) {
26315
26317
  this.focusIndex = 0;
26316
26318
  }
26317
26319
  function elementIndent(el) {
@@ -26354,7 +26356,7 @@ so this becomes the fallback color for the slot */ ''}
26354
26356
  return;
26355
26357
  }
26356
26358
  if (changedMenuItem.role === 'menuitemradio'
26357
- && changedMenuItem.checked === true) {
26359
+ && changedMenuItem.checked) {
26358
26360
  for (let i = changeItemIndex - 1; i >= 0; --i) {
26359
26361
  const item = this.menuItems[i];
26360
26362
  const role = item.getAttribute('role');
@@ -26820,7 +26822,7 @@ so this becomes the fallback color for the slot */ ''}
26820
26822
  // Get the menu that is slotted within the menu-button, taking into account
26821
26823
  // that it may be nested within multiple 'slot' elements, such as when used
26822
26824
  // within a table.
26823
- if (!this.slottedMenus?.length) {
26825
+ if (!this.slottedMenus || this.slottedMenus.length === 0) {
26824
26826
  return undefined;
26825
26827
  }
26826
26828
  let currentItem = this.slottedMenus[0];
@@ -26851,7 +26853,7 @@ so this becomes the fallback color for the slot */ ''}
26851
26853
  }
26852
26854
  focusLastMenuItem() {
26853
26855
  const menuItems = this.getMenu()?.querySelectorAll('[role=menuitem]');
26854
- if (menuItems?.length) {
26856
+ if (menuItems && menuItems.length > 0) {
26855
26857
  const lastMenuItem = menuItems[menuItems.length - 1];
26856
26858
  lastMenuItem.focus();
26857
26859
  }
@@ -27228,7 +27230,7 @@ so this becomes the fallback color for the slot */ ''}
27228
27230
  const labelTemplate$4 = createRequiredVisibleLabelTemplate(html `<label
27229
27231
  part="label"
27230
27232
  for="control"
27231
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
27233
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
27232
27234
  >
27233
27235
  <slot ${slotted('defaultSlottedNodes')}></slot>
27234
27236
  </label>`);
@@ -27293,7 +27295,7 @@ so this becomes the fallback color for the slot */ ''}
27293
27295
  @click="${x => x.stepUp()}"
27294
27296
  >
27295
27297
  <slot name="step-up-glyph">
27296
- ${definition.stepUpGlyph || ''}
27298
+ ${definition.stepUpGlyph ?? ''}
27297
27299
  </slot>
27298
27300
  </div>
27299
27301
  <div
@@ -27302,7 +27304,7 @@ so this becomes the fallback color for the slot */ ''}
27302
27304
  @click="${x => x.stepDown()}"
27303
27305
  >
27304
27306
  <slot name="step-down-glyph">
27305
- ${definition.stepDownGlyph || ''}
27307
+ ${definition.stepDownGlyph ?? ''}
27306
27308
  </slot>
27307
27309
  </div>
27308
27310
  </div>
@@ -46952,7 +46954,7 @@ ${renderedContent}
46952
46954
  */
46953
46955
  get options() {
46954
46956
  Observable.track(this, 'options');
46955
- return this.filteredOptions?.length ? this.filteredOptions : [];
46957
+ return this.filteredOptions?.length > 0 ? this.filteredOptions : [];
46956
46958
  }
46957
46959
  set options(value) {
46958
46960
  this._options = value;
@@ -47022,7 +47024,7 @@ ${renderedContent}
47022
47024
  this._options.forEach(o => {
47023
47025
  o.hidden = !this.filteredOptions.includes(o);
47024
47026
  });
47025
- if (this.filteredOptions.length) {
47027
+ if (this.filteredOptions.length > 0) {
47026
47028
  this.selectedOptions = [this.filteredOptions[0]];
47027
47029
  this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
47028
47030
  }
@@ -47112,7 +47114,7 @@ ${renderedContent}
47112
47114
  * Overrides: `Listbox.focusAndScrollOptionIntoView`
47113
47115
  */
47114
47116
  focusAndScrollOptionIntoView() {
47115
- if (this.open && this.firstSelectedOption) {
47117
+ if (this.open && this.firstSelectedOption !== null) {
47116
47118
  requestAnimationFrame(() => {
47117
47119
  this.firstSelectedOption?.scrollIntoView({ block: 'nearest' });
47118
47120
  });
@@ -56910,7 +56912,7 @@ ${renderedContent}
56910
56912
  * https://github.com/ProseMirror/prosemirror-markdown/blob/b7c1fd2fb74c7564bfe5428c7c8141ded7ebdd9f/src/to_markdown.ts#L94C2-L101C7
56911
56913
  */
56912
56914
  const orderedListNode = function orderedList(state, node) {
56913
- const start = node.attrs.start || 1;
56915
+ const start = node.attrs.start ?? 1;
56914
56916
  const maxW = String(start + node.childCount - 1).length;
56915
56917
  const space = state.repeat(' ', maxW + 2);
56916
56918
  state.renderList(node, space, i => {
@@ -57281,7 +57283,7 @@ ${renderedContent}
57281
57283
  };
57282
57284
  }
57283
57285
  isValid() {
57284
- return Object.values(this.getValidity()).every(x => x === false);
57286
+ return Object.values(this.getValidity()).every(x => !x);
57285
57287
  }
57286
57288
  validate(mentions) {
57287
57289
  this.validateDuplicateMentionConfigurations(mentions);
@@ -63024,7 +63026,7 @@ ${nextLine.slice(indentLevel + 2)}`;
63024
63026
  const updatedNodes = [];
63025
63027
  fragment.forEach(node => {
63026
63028
  if (node.isText && node.marks.length > 0) {
63027
- const linkMark = node.marks.find(mark => mark.type.name === 'link' && mark.attrs);
63029
+ const linkMark = node.marks.find(mark => mark.type.name === 'link');
63028
63030
  if (linkMark) {
63029
63031
  // Checks if the link is valid link or not
63030
63032
  // Needing to separately validate the link on paste is a workaround for a tiptap issue
@@ -63149,7 +63151,7 @@ ${nextLine.slice(indentLevel + 2)}`;
63149
63151
  if (node.type.name.startsWith(mentionPluginPrefix)) {
63150
63152
  hasMention = true;
63151
63153
  }
63152
- const continueDescent = hasMention === false;
63154
+ const continueDescent = !hasMention;
63153
63155
  return continueDescent;
63154
63156
  });
63155
63157
  return !hasMention;
@@ -64213,7 +64215,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64213
64215
  `)}
64214
64216
  <div aria-hidden="true" class="indicator" part="indicator">
64215
64217
  <slot name="indicator">
64216
- ${definition.indicator || ''}
64218
+ ${definition.indicator ?? ''}
64217
64219
  </slot>
64218
64220
  </div>
64219
64221
  </slot>
@@ -64405,7 +64407,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64405
64407
  set value(next) {
64406
64408
  const prev = this._value;
64407
64409
  let newValue = next;
64408
- if (this.options?.length) {
64410
+ if (this.options !== undefined && this.options.length > 0) {
64409
64411
  const newValueIndex = this.options.findIndex(el => el.value === newValue);
64410
64412
  const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;
64411
64413
  const nextSelectedValue = this.options[newValueIndex]?.value ?? null;
@@ -64434,7 +64436,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64434
64436
  * @internal
64435
64437
  */
64436
64438
  anchoredRegionChanged(_prev, _next) {
64437
- if (this.anchoredRegion && this.control) {
64439
+ if (this.anchoredRegion !== undefined && this.control !== undefined) {
64438
64440
  this.anchoredRegion.anchorElement = this.control;
64439
64441
  }
64440
64442
  }
@@ -64442,7 +64444,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64442
64444
  * @internal
64443
64445
  */
64444
64446
  controlChanged(_prev, _next) {
64445
- if (this.anchoredRegion && this.control) {
64447
+ if (this.anchoredRegion !== undefined && this.control !== undefined) {
64446
64448
  this.anchoredRegion.anchorElement = this.control;
64447
64449
  }
64448
64450
  }
@@ -64599,9 +64601,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64599
64601
  */
64600
64602
  multipleChanged(prev, next) {
64601
64603
  super.multipleChanged(prev, next);
64602
- if (this.proxy) {
64603
- this.proxy.multiple = next;
64604
- }
64604
+ this.proxy.multiple = next;
64605
64605
  }
64606
64606
  /**
64607
64607
  * @internal
@@ -64658,7 +64658,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64658
64658
  if (this.filterMode !== FilterMode.none) {
64659
64659
  this.emitFilterInputEvent();
64660
64660
  }
64661
- if (e.inputType.includes('deleteContent') || !this.filter.length) {
64661
+ if (e.inputType.includes('deleteContent') || this.filter.length === 0) {
64662
64662
  return true;
64663
64663
  }
64664
64664
  e.stopPropagation();
@@ -64827,7 +64827,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64827
64827
  typeaheadBufferChanged(_, __) {
64828
64828
  if (this.$fastController.isConnected) {
64829
64829
  const typeaheadMatches = this.getTypeaheadMatches();
64830
- if (typeaheadMatches.length) {
64830
+ if (typeaheadMatches.length > 0) {
64831
64831
  const activeOptionIndex = this.options.indexOf(typeaheadMatches[0]);
64832
64832
  if (!(this.open && this.filterMode !== FilterMode.none)) {
64833
64833
  this.setActiveOption(activeOptionIndex);
@@ -64960,9 +64960,7 @@ ${nextLine.slice(indentLevel + 2)}`;
64960
64960
  */
64961
64961
  sizeChanged(prev, next) {
64962
64962
  super.sizeChanged(prev, next);
64963
- if (this.proxy) {
64964
- this.proxy.size = next;
64965
- }
64963
+ this.proxy.size = next;
64966
64964
  }
64967
64965
  openChanged() {
64968
64966
  if (!this.collapsible) {
@@ -65267,14 +65265,14 @@ ${nextLine.slice(indentLevel + 2)}`;
65267
65265
  * @internal
65268
65266
  */
65269
65267
  setProxyOptions() {
65270
- if (this.proxy instanceof HTMLSelectElement && this.options) {
65268
+ if (this.proxy instanceof HTMLSelectElement && this.options !== null) {
65271
65269
  this.proxy.options.length = 0;
65272
65270
  this.options.forEach(option => {
65273
65271
  const proxyOption = option.proxy
65274
- || (option instanceof HTMLOptionElement
65272
+ ?? (option instanceof HTMLOptionElement
65275
65273
  ? option.cloneNode()
65276
65274
  : null);
65277
- if (proxyOption) {
65275
+ if (proxyOption !== null) {
65278
65276
  this.proxy.options.add(proxyOption);
65279
65277
  }
65280
65278
  });
@@ -65302,7 +65300,7 @@ ${nextLine.slice(indentLevel + 2)}`;
65302
65300
  return;
65303
65301
  }
65304
65302
  const selectedOption = this.firstSelectedOption;
65305
- if (selectedOption) {
65303
+ if (selectedOption !== null) {
65306
65304
  this.selectedOptionObserver?.observe(selectedOption, {
65307
65305
  characterData: true,
65308
65306
  subtree: true,
@@ -65606,7 +65604,7 @@ ${nextLine.slice(indentLevel + 2)}`;
65606
65604
  >
65607
65605
  <label
65608
65606
  part="label"
65609
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
65607
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
65610
65608
  >
65611
65609
  <slot ${slotted('defaultSlottedNodes')}></slot>
65612
65610
  </label>
@@ -69408,7 +69406,7 @@ ${nextLine.slice(indentLevel + 2)}`;
69408
69406
  };
69409
69407
  }
69410
69408
  isValid() {
69411
- return Object.values(this.getValidity()).every(x => x === false);
69409
+ return Object.values(this.getValidity()).every(x => !x);
69412
69410
  }
69413
69411
  areRecordIdsValid() {
69414
69412
  const validity = this.getValidity();
@@ -72135,7 +72133,7 @@ focus outline in that case.
72135
72133
  return this.getVisibleColumns()
72136
72134
  .map(column => {
72137
72135
  const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
72138
- if (currentPixelWidth) {
72136
+ if (currentPixelWidth !== undefined) {
72139
72137
  const coercedPixelWidth = Math.max(minPixelWidth, currentPixelWidth);
72140
72138
  return `${coercedPixelWidth}px`;
72141
72139
  }
@@ -72597,7 +72595,7 @@ focus outline in that case.
72597
72595
  const allRows = [];
72598
72596
  for (const row of topLevelRows) {
72599
72597
  allRows.push(row);
72600
- if (row.subRows?.length) {
72598
+ if (row.subRows?.length > 0) {
72601
72599
  allRows.push(...this.getOrderedRows(row.subRows));
72602
72600
  }
72603
72601
  }
@@ -72852,10 +72850,8 @@ focus outline in that case.
72852
72850
  originalIndex: undefined
72853
72851
  };
72854
72852
  }
72855
- // if we track orphans, delete this item from the orphan set if it is in it
72856
- if (orphanIds) {
72857
- orphanIds.delete(itemId);
72858
- }
72853
+ // delete this item from the orphan set if it is in it
72854
+ orphanIds.delete(itemId);
72859
72855
  // add the current item's data to the item in the lookup table
72860
72856
  lookup[itemId].clientRecord = item;
72861
72857
  const treeItem = lookup[itemId];
@@ -72875,16 +72871,14 @@ focus outline in that case.
72875
72871
  clientRecord: undefined,
72876
72872
  originalIndex: undefined
72877
72873
  };
72878
- // if we track orphans, add the generated parent to the orphan list
72879
- if (orphanIds) {
72880
- orphanIds.add(parentId);
72881
- }
72874
+ // add the generated parent to the orphan list
72875
+ orphanIds.add(parentId);
72882
72876
  }
72883
72877
  // add the current item to the parent
72884
72878
  lookup[parentId].subRows.push(treeItem);
72885
72879
  }
72886
72880
  }
72887
- if (orphanIds?.size) {
72881
+ if (orphanIds.size > 0) {
72888
72882
  const orphans = Array.from(orphanIds.values()).join(',');
72889
72883
  throw new Error(`The items array contains orphans that point to the following parentIds: [${orphans}]. These parentIds do not exist in the items array.`);
72890
72884
  }
@@ -72899,7 +72893,7 @@ focus outline in that case.
72899
72893
  * @returns Number of nodes in the tree
72900
72894
  */
72901
72895
  function countNodes(tree) {
72902
- return tree.reduce((sum, n) => sum + 1 + (n.subRows && countNodes(n.subRows)), 0);
72896
+ return tree.reduce((sum, n) => sum + 1 + (n.subRows ? countNodes(n.subRows) : 0), 0);
72903
72897
  }
72904
72898
 
72905
72899
  /**
@@ -74965,7 +74959,7 @@ focus outline in that case.
74965
74959
  calculateTanStackSortState() {
74966
74960
  const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.columnInternals.currentSortIndex
74967
74961
  - y.columnInternals.currentSortIndex);
74968
- this.firstSortedColumn = sortedColumns.length
74962
+ this.firstSortedColumn = sortedColumns.length > 0
74969
74963
  ? sortedColumns[0]
74970
74964
  : undefined;
74971
74965
  return sortedColumns.map(column => {
@@ -76169,13 +76163,13 @@ focus outline in that case.
76169
76163
  }
76170
76164
  const hours = Math.floor((milliseconds / millisecondsPerHour) % 24);
76171
76165
  remainingTime -= hours * millisecondsPerHour;
76172
- if (hours) {
76166
+ if (hours !== 0) {
76173
76167
  const formattedHours = this.hoursFormatter.format(hours);
76174
76168
  result.push(formattedHours);
76175
76169
  }
76176
76170
  const minutes = Math.floor((milliseconds / millisecondsPerMinute) % 60);
76177
76171
  remainingTime -= minutes * millisecondsPerMinute;
76178
- if (minutes) {
76172
+ if (minutes !== 0) {
76179
76173
  const formattedMinutes = this.minutesFormatter.format(minutes);
76180
76174
  result.push(formattedMinutes);
76181
76175
  }
@@ -78025,7 +78019,7 @@ focus outline in that case.
78025
78019
  <label
78026
78020
  part="label"
78027
78021
  for="control"
78028
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
78022
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
78029
78023
  >
78030
78024
  <slot ${slotted('defaultSlottedNodes')}></slot>
78031
78025
  </label>
@@ -78460,7 +78454,7 @@ focus outline in that case.
78460
78454
  const labelTemplate = createRequiredVisibleLabelTemplate(html `<label
78461
78455
  part="label"
78462
78456
  for="control"
78463
- class="${x => (x.defaultSlottedNodes?.length ? 'label' : 'label label__hidden')}"
78457
+ class="${x => (x.defaultSlottedNodes?.length > 0 ? 'label' : 'label label__hidden')}"
78464
78458
  >
78465
78459
  <slot
78466
78460
  ${slotted({
@@ -95177,7 +95171,7 @@ focus outline in that case.
95177
95171
  }
95178
95172
  const dieWidth = this.wafermap.dataManager.dieDimensions.width;
95179
95173
  const dieHeight = this.wafermap.dataManager.dieDimensions.height;
95180
- const dieSize = dieWidth * dieHeight * (this.wafermap.transform.k || 1);
95174
+ const dieSize = dieWidth * dieHeight * (this.wafermap.transform.k !== 0 ? this.wafermap.transform.k : 1);
95181
95175
  if (dieSize >= this.minDieDim) {
95182
95176
  const fontsize = this.wafermap.dataManager.labelsFontSize;
95183
95177
  const context = this.wafermap.canvasContext;
@@ -95371,7 +95365,7 @@ focus outline in that case.
95371
95365
  };
95372
95366
  }
95373
95367
  isValid() {
95374
- return Object.values(this.getValidity()).every(x => x === false);
95368
+ return Object.values(this.getValidity()).every(x => !x);
95375
95369
  }
95376
95370
  validateGridDimensions() {
95377
95371
  this.invalidGridDimensions = false;
@@ -95766,7 +95760,7 @@ focus outline in that case.
95766
95760
  .join("-");
95767
95761
  }
95768
95762
 
95769
- const workerCode = "var MatrixRenderer = (function (exports) {\n 'use strict';\n\n /**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n const proxyMarker = Symbol(\"Comlink.proxy\");\n const createEndpoint = Symbol(\"Comlink.endpoint\");\n const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n const finalizer = Symbol(\"Comlink.finalizer\");\n const throwMarker = Symbol(\"Comlink.thrown\");\n const isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n /**\n * Internal transfer handle to handle objects marked to proxy.\n */\n const proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n };\n /**\n * Internal transfer handler to handle thrown exceptions.\n */\n const throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n };\n /**\n * Allows customizing the serialization of certain values.\n */\n const transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n }\n function wrap(ep, target) {\n const pendingListeners = new Map();\n ep.addEventListener(\"message\", function handleMessage(ev) {\n const { data } = ev;\n if (!data || !data.id) {\n return;\n }\n const resolver = pendingListeners.get(data.id);\n if (!resolver) {\n return;\n }\n try {\n resolver(data);\n }\n finally {\n pendingListeners.delete(data.id);\n }\n });\n return createProxy(ep, pendingListeners, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, new Map(), {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n }\n const proxyCounter = new WeakMap();\n const proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, pendingListeners, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n pendingListeners.clear();\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, pendingListeners, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, pendingListeners, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, pendingListeners, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, pendingListeners, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n }\n const transferCache = new WeakMap();\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n }\n function requestResponseMessage(ep, pendingListeners, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n pendingListeners.set(id, resolve);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n }\n function generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n }\n\n /**\n * MatrixRenderer class is meant to be used within a Web Worker context,\n * using Comlink to facilitate communication between the main thread and the worker.\n * The MatrixRenderer class manages a matrix of dies, once an instance of MatrixRenderer is created,\n * it is exposed to the main thread using Comlink's `expose` method.\n * This setup is used in the wafer-map component to perform heavy computational duties\n */\n class MatrixRenderer {\n constructor() {\n this.values = Float64Array.from([]);\n this.scaledColumnIndices = Float64Array.from([]);\n this.scaledRowIndices = Float64Array.from([]);\n this.columnIndicesPositions = Int32Array.from([]);\n this.colorIndices = Int32Array.from([]);\n this.colors = [];\n this.colorValues = Float64Array.from([]);\n this.outsideRangeDieColor = 'rgba(218,223,236,1)';\n this.fontSizeFactor = 0.8;\n this.renderConfig = {\n dieDimensions: {\n width: 0,\n height: 0\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n verticalCoefficient: 1,\n horizontalCoefficient: 1,\n horizontalConstant: 0,\n verticalConstant: 0,\n gridMinX: 0,\n gridMaxX: 0,\n gridMinY: 0,\n gridMaxY: 0,\n labelsFontSize: 0,\n colorScale: [],\n dieLabelsSuffix: '',\n maxCharacters: 0\n };\n this.transformConfig = {\n transform: {\n k: 1,\n x: 0,\n y: 0\n },\n topLeftCanvasCorner: {\n x: 0,\n y: 0\n },\n bottomRightCanvasCorner: {\n x: 0,\n y: 0\n }\n };\n }\n setMatrixData(columnIndices, rowIndices, valuesBuffer) {\n const scaledColumnIndex = [];\n const columnPositions = [];\n const scaledRowIndices = [];\n const values = [];\n const colorIndices = [];\n let prevXIndex;\n let dieCount = 0;\n for (let i = 0; i < columnIndices.length; i++) {\n const xIndex = columnIndices[i];\n const yIndex = rowIndices[i];\n if (this.isDieInGrid(xIndex, yIndex)) {\n if (xIndex !== prevXIndex) {\n scaledColumnIndex.push(this.calculateHorizontalScaledIndices(xIndex));\n columnPositions.push(dieCount);\n prevXIndex = xIndex;\n }\n scaledRowIndices.push(this.calculateVerticalScaledIndices(yIndex));\n const value = valuesBuffer[i];\n values.push(value);\n colorIndices.push(this.findColorIndex(value));\n dieCount += 1;\n }\n }\n this.scaledColumnIndices = Float64Array.from(scaledColumnIndex);\n this.columnIndicesPositions = Int32Array.from(columnPositions);\n this.scaledRowIndices = Float64Array.from(scaledRowIndices);\n this.values = Float64Array.from(values);\n this.colorIndices = Int32Array.from(colorIndices);\n }\n setRenderConfig(renderConfig) {\n this.renderConfig = renderConfig;\n this.colors = renderConfig.colorScale.map(marker => marker.color);\n this.colorValues = Float64Array.from(renderConfig.colorScale.map(marker => marker.value));\n }\n setTransformConfig(transformData) {\n this.transformConfig = transformData;\n }\n setCanvas(canvas) {\n this.canvas = canvas;\n this.context = canvas.getContext('2d');\n }\n scaleCanvas() {\n this.context.translate(this.transformConfig.transform.x, this.transformConfig.transform.y);\n this.context.scale(this.transformConfig.transform.k, this.transformConfig.transform.k);\n }\n setCanvasDimensions(data) {\n this.canvas.width = data.width;\n this.canvas.height = data.height;\n }\n getCanvasDimensions() {\n return {\n width: this.canvas.width,\n height: this.canvas.height\n };\n }\n clearCanvas() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n drawWafer() {\n this.context.restore();\n this.context.save();\n this.clearCanvas();\n this.scaleCanvas();\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n // Fill style is temporary green for all dies, will be replaced with a color based on the value of the die in a future implementation\n this.context.fillStyle = this.colors[this.colorIndices[columnStartIndex]]\n ?? this.outsideRangeDieColor;\n this.context.fillRect(scaledX, scaledY, this.renderConfig.dieDimensions.width, this.renderConfig.dieDimensions.height);\n }\n }\n }\n drawText() {\n this.context.font = `${this.renderConfig.labelsFontSize.toString()}px sans-serif`;\n this.context.fillStyle = '#ffffff';\n this.context.textAlign = 'center';\n this.context.lineCap = 'butt';\n const approximateTextHeight = this.context.measureText('M');\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n let label = `${this.values[columnStartIndex] || 'NaN'}${this.renderConfig.dieLabelsSuffix}`;\n if (label.length >= this.renderConfig.maxCharacters) {\n label = `${label.substring(0, this.renderConfig.maxCharacters)}…`;\n }\n this.context.fillText(label, scaledX + this.renderConfig.dieDimensions.width / 2, scaledY\n + this.renderConfig.dieDimensions.height / 2\n + approximateTextHeight.width / 2, this.renderConfig.dieDimensions.width * this.fontSizeFactor);\n }\n }\n }\n isDieInGrid(x, y) {\n return (x >= this.renderConfig.gridMinX\n && x <= this.renderConfig.gridMaxX\n && y >= this.renderConfig.gridMinY\n && y <= this.renderConfig.gridMaxY);\n }\n calculateHorizontalScaledIndices(columnIndex) {\n return (this.renderConfig.horizontalCoefficient * columnIndex\n + this.renderConfig.horizontalConstant\n + this.renderConfig.margin.left);\n }\n calculateVerticalScaledIndices(rowIndex) {\n return (this.renderConfig.verticalCoefficient * rowIndex\n + this.renderConfig.verticalConstant\n + this.renderConfig.margin.top);\n }\n findColorIndex(value) {\n let index = -1;\n if (this.colorValues.length === 0 || this.colorValues[0] >= value) {\n return index;\n }\n for (let i = 0; i < this.colorValues.length; i++) {\n if (value <= this.colorValues[i]) {\n index = i;\n break;\n }\n }\n return index;\n }\n }\n expose(MatrixRenderer);\n\n exports.MatrixRenderer = MatrixRenderer;\n\n return exports;\n\n})({});\n";
95763
+ const workerCode = "var MatrixRenderer = (function (exports) {\n 'use strict';\n\n /**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n const proxyMarker = Symbol(\"Comlink.proxy\");\n const createEndpoint = Symbol(\"Comlink.endpoint\");\n const releaseProxy = Symbol(\"Comlink.releaseProxy\");\n const finalizer = Symbol(\"Comlink.finalizer\");\n const throwMarker = Symbol(\"Comlink.thrown\");\n const isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n /**\n * Internal transfer handle to handle objects marked to proxy.\n */\n const proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n };\n /**\n * Internal transfer handler to handle thrown exceptions.\n */\n const throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n };\n /**\n * Allows customizing the serialization of certain values.\n */\n const transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n ]);\n function isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n }\n function expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n }\n function isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n }\n function closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n }\n function wrap(ep, target) {\n const pendingListeners = new Map();\n ep.addEventListener(\"message\", function handleMessage(ev) {\n const { data } = ev;\n if (!data || !data.id) {\n return;\n }\n const resolver = pendingListeners.get(data.id);\n if (!resolver) {\n return;\n }\n try {\n resolver(data);\n }\n finally {\n pendingListeners.delete(data.id);\n }\n });\n return createProxy(ep, pendingListeners, [], target);\n }\n function throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n }\n function releaseEndpoint(ep) {\n return requestResponseMessage(ep, new Map(), {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n }\n const proxyCounter = new WeakMap();\n const proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\n function registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n }\n function unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n }\n function createProxy(ep, pendingListeners, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n pendingListeners.clear();\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, pendingListeners, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, pendingListeners, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, pendingListeners, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, pendingListeners, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, pendingListeners, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n }\n function myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n }\n function processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n }\n const transferCache = new WeakMap();\n function transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n }\n function proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n }\n function toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n }\n function fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n }\n function requestResponseMessage(ep, pendingListeners, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n pendingListeners.set(id, resolve);\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n }\n function generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n }\n\n /**\n * MatrixRenderer class is meant to be used within a Web Worker context,\n * using Comlink to facilitate communication between the main thread and the worker.\n * The MatrixRenderer class manages a matrix of dies, once an instance of MatrixRenderer is created,\n * it is exposed to the main thread using Comlink's `expose` method.\n * This setup is used in the wafer-map component to perform heavy computational duties\n */\n class MatrixRenderer {\n constructor() {\n this.values = Float64Array.from([]);\n this.scaledColumnIndices = Float64Array.from([]);\n this.scaledRowIndices = Float64Array.from([]);\n this.columnIndicesPositions = Int32Array.from([]);\n this.colorIndices = Int32Array.from([]);\n this.colors = [];\n this.colorValues = Float64Array.from([]);\n this.outsideRangeDieColor = 'rgba(218,223,236,1)';\n this.fontSizeFactor = 0.8;\n this.renderConfig = {\n dieDimensions: {\n width: 0,\n height: 0\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n verticalCoefficient: 1,\n horizontalCoefficient: 1,\n horizontalConstant: 0,\n verticalConstant: 0,\n gridMinX: 0,\n gridMaxX: 0,\n gridMinY: 0,\n gridMaxY: 0,\n labelsFontSize: 0,\n colorScale: [],\n dieLabelsSuffix: '',\n maxCharacters: 0\n };\n this.transformConfig = {\n transform: {\n k: 1,\n x: 0,\n y: 0\n },\n topLeftCanvasCorner: {\n x: 0,\n y: 0\n },\n bottomRightCanvasCorner: {\n x: 0,\n y: 0\n }\n };\n }\n setMatrixData(columnIndices, rowIndices, valuesBuffer) {\n const scaledColumnIndex = [];\n const columnPositions = [];\n const scaledRowIndices = [];\n const values = [];\n const colorIndices = [];\n let prevXIndex;\n let dieCount = 0;\n for (let i = 0; i < columnIndices.length; i++) {\n const xIndex = columnIndices[i];\n const yIndex = rowIndices[i];\n if (this.isDieInGrid(xIndex, yIndex)) {\n if (xIndex !== prevXIndex) {\n scaledColumnIndex.push(this.calculateHorizontalScaledIndices(xIndex));\n columnPositions.push(dieCount);\n prevXIndex = xIndex;\n }\n scaledRowIndices.push(this.calculateVerticalScaledIndices(yIndex));\n const value = valuesBuffer[i];\n values.push(value);\n colorIndices.push(this.findColorIndex(value));\n dieCount += 1;\n }\n }\n this.scaledColumnIndices = Float64Array.from(scaledColumnIndex);\n this.columnIndicesPositions = Int32Array.from(columnPositions);\n this.scaledRowIndices = Float64Array.from(scaledRowIndices);\n this.values = Float64Array.from(values);\n this.colorIndices = Int32Array.from(colorIndices);\n }\n setRenderConfig(renderConfig) {\n this.renderConfig = renderConfig;\n this.colors = renderConfig.colorScale.map(marker => marker.color);\n this.colorValues = Float64Array.from(renderConfig.colorScale.map(marker => marker.value));\n }\n setTransformConfig(transformData) {\n this.transformConfig = transformData;\n }\n setCanvas(canvas) {\n this.canvas = canvas;\n this.context = canvas.getContext('2d');\n }\n scaleCanvas() {\n this.context.translate(this.transformConfig.transform.x, this.transformConfig.transform.y);\n this.context.scale(this.transformConfig.transform.k, this.transformConfig.transform.k);\n }\n setCanvasDimensions(data) {\n this.canvas.width = data.width;\n this.canvas.height = data.height;\n }\n getCanvasDimensions() {\n return {\n width: this.canvas.width,\n height: this.canvas.height\n };\n }\n clearCanvas() {\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n drawWafer() {\n this.context.restore();\n this.context.save();\n this.clearCanvas();\n this.scaleCanvas();\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n // Fill style is temporary green for all dies, will be replaced with a color based on the value of the die in a future implementation\n this.context.fillStyle = this.colors[this.colorIndices[columnStartIndex]]\n ?? this.outsideRangeDieColor;\n this.context.fillRect(scaledX, scaledY, this.renderConfig.dieDimensions.width, this.renderConfig.dieDimensions.height);\n }\n }\n }\n drawText() {\n this.context.font = `${this.renderConfig.labelsFontSize.toString()}px sans-serif`;\n this.context.fillStyle = '#ffffff';\n this.context.textAlign = 'center';\n this.context.lineCap = 'butt';\n const approximateTextHeight = this.context.measureText('M');\n for (let i = 0; i < this.scaledColumnIndices.length; i++) {\n const scaledX = this.scaledColumnIndices[i];\n if (!(scaledX >= this.transformConfig.topLeftCanvasCorner.x\n && scaledX < this.transformConfig.bottomRightCanvasCorner.x)) {\n continue;\n }\n // columnIndexPositions is used to get chunks to determine the start and end index of the column, it looks something like [0, 1, 4, 9, 12]\n // This means that the first column has a start index of 0 and an end index of 1, the second column has a start index of 1 and an end index of 4, and so on\n // scaledRowIndices is used when we reach the end of the columnIndexPositions, when columnIndexPositions is [0, 1, 4, 9, 12], scaledRowIndices is 13\n const columnEndIndex = this.columnIndicesPositions[i + 1] !== undefined\n ? this.columnIndicesPositions[i + 1]\n : this.scaledRowIndices.length;\n for (let columnStartIndex = this.columnIndicesPositions[i]; columnStartIndex < columnEndIndex; columnStartIndex++) {\n const scaledY = this.scaledRowIndices[columnStartIndex];\n if (!(scaledY >= this.transformConfig.topLeftCanvasCorner.y\n && scaledY < this.transformConfig.bottomRightCanvasCorner.y)) {\n continue;\n }\n let label = `${this.values[columnStartIndex] ?? 'NaN'}${this.renderConfig.dieLabelsSuffix}`;\n if (label.length >= this.renderConfig.maxCharacters) {\n label = `${label.substring(0, this.renderConfig.maxCharacters)}…`;\n }\n this.context.fillText(label, scaledX + this.renderConfig.dieDimensions.width / 2, scaledY\n + this.renderConfig.dieDimensions.height / 2\n + approximateTextHeight.width / 2, this.renderConfig.dieDimensions.width * this.fontSizeFactor);\n }\n }\n }\n isDieInGrid(x, y) {\n return (x >= this.renderConfig.gridMinX\n && x <= this.renderConfig.gridMaxX\n && y >= this.renderConfig.gridMinY\n && y <= this.renderConfig.gridMaxY);\n }\n calculateHorizontalScaledIndices(columnIndex) {\n return (this.renderConfig.horizontalCoefficient * columnIndex\n + this.renderConfig.horizontalConstant\n + this.renderConfig.margin.left);\n }\n calculateVerticalScaledIndices(rowIndex) {\n return (this.renderConfig.verticalCoefficient * rowIndex\n + this.renderConfig.verticalConstant\n + this.renderConfig.margin.top);\n }\n findColorIndex(value) {\n let index = -1;\n if (this.colorValues.length === 0 || this.colorValues[0] >= value) {\n return index;\n }\n for (let i = 0; i < this.colorValues.length; i++) {\n if (value <= this.colorValues[i]) {\n index = i;\n break;\n }\n }\n return index;\n }\n }\n expose(MatrixRenderer);\n\n exports.MatrixRenderer = MatrixRenderer;\n\n return exports;\n\n})({});\n";
95770
95764
 
95771
95765
  let url;
95772
95766
  /**
@@ -95827,10 +95821,9 @@ focus outline in that case.
95827
95821
  });
95828
95822
  await this.matrixRenderer.drawWafer();
95829
95823
  if (!snapshot.dieLabelsHidden
95830
- && snapshot.dieDimensions
95831
95824
  && snapshot.dieDimensions.width
95832
95825
  * snapshot.dieDimensions.height
95833
- * (snapshot.transform.k || 1)
95826
+ * (snapshot.transform.k !== 0 ? snapshot.transform.k : 1)
95834
95827
  >= this.minDieDim) {
95835
95828
  await this.matrixRenderer.drawText();
95836
95829
  }
@@ -96788,7 +96781,7 @@ focus outline in that case.
96788
96781
  this.inputEmpty = true;
96789
96782
  }
96790
96783
  slottedInputElementsChanged(_prev, next) {
96791
- this.inputEmpty = !next?.length;
96784
+ this.inputEmpty = next === undefined || next.length === 0;
96792
96785
  }
96793
96786
  }
96794
96787
  __decorate([
@@ -97128,7 +97121,7 @@ focus outline in that case.
97128
97121
  this.footerActionsIsEmpty = true;
97129
97122
  }
97130
97123
  slottedFooterActionsElementsChanged(_prev, next) {
97131
- this.footerActionsIsEmpty = !next?.length;
97124
+ this.footerActionsIsEmpty = next === undefined || next.length === 0;
97132
97125
  }
97133
97126
  }
97134
97127
  __decorate([
@@ -97232,7 +97225,7 @@ focus outline in that case.
97232
97225
  this.footerActionsIsEmpty = true;
97233
97226
  }
97234
97227
  slottedFooterActionsElementsChanged(_prev, next) {
97235
- this.footerActionsIsEmpty = !next?.length;
97228
+ this.footerActionsIsEmpty = next === undefined || next.length === 0;
97236
97229
  }
97237
97230
  }
97238
97231
  __decorate([