@tscircuit/pcb-viewer 1.10.4 → 1.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -45,10 +45,6 @@ function _async_to_generator(fn) {
45
45
  });
46
46
  };
47
47
  }
48
- function _call_super(_this, derived, args) {
49
- derived = _get_prototype_of(derived);
50
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
51
- }
52
48
  function _class_call_check(instance, Constructor) {
53
49
  if (!(instance instanceof Constructor)) {
54
50
  throw new TypeError("Cannot call a class as a function");
@@ -294,12 +290,28 @@ function _wrap_native_super(Class) {
294
290
  return _wrap_native_super(Class);
295
291
  }
296
292
  function _is_native_reflect_construct() {
293
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
294
+ if (Reflect.construct.sham) return false;
295
+ if (typeof Proxy === "function") return true;
297
296
  try {
298
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
299
- } catch (_) {}
300
- return (_is_native_reflect_construct = function() {
301
- return !!result;
302
- })();
297
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
298
+ return true;
299
+ } catch (e) {
300
+ return false;
301
+ }
302
+ }
303
+ function _create_super(Derived) {
304
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
305
+ return function _createSuperInternal() {
306
+ var Super = _get_prototype_of(Derived), result;
307
+ if (hasNativeReflectConstruct) {
308
+ var NewTarget = _get_prototype_of(this).constructor;
309
+ result = Reflect.construct(Super, arguments, NewTarget);
310
+ } else {
311
+ result = Super.apply(this, arguments);
312
+ }
313
+ return _possible_constructor_return(this, result);
314
+ };
303
315
  }
304
316
  function _ts_generator(thisArg, body) {
305
317
  var f, y, t, g, _ = {
@@ -410,6 +422,41 @@ function _ts_values(o) {
410
422
  };
411
423
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
412
424
  }
425
+ var _loop = function(letter) {
426
+ lineAlphabet[letter] = [];
427
+ var segs = svgAlphabet[letter].split("M").slice(1).map(function(seg) {
428
+ return seg.split("L").map(function(pr) {
429
+ return pr.trim().split(" ").map(parseFloat);
430
+ });
431
+ });
432
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
433
+ try {
434
+ for(var _iterator = segs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
435
+ var seg = _step.value;
436
+ for(var i = 0; i < seg.length - 1; i++){
437
+ lineAlphabet[letter].push({
438
+ x1: seg[i][0],
439
+ y1: 1 - seg[i][1],
440
+ x2: seg[i + 1][0],
441
+ y2: 1 - seg[i + 1][1]
442
+ });
443
+ }
444
+ }
445
+ } catch (err) {
446
+ _didIteratorError = true;
447
+ _iteratorError = err;
448
+ } finally{
449
+ try {
450
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
451
+ _iterator.return();
452
+ }
453
+ } finally{
454
+ if (_didIteratorError) {
455
+ throw _iteratorError;
456
+ }
457
+ }
458
+ }
459
+ };
413
460
  function _templateObject() {
414
461
  var data = _tagged_template_literal([
415
462
  "\n margin-top: 2px;\n padding: 4px;\n padding-left: 8px;\n padding-right: 18px;\n cursor: pointer;\n\n &:hover {\n background-color: rgba(255, 255, 255, 0.1);\n }\n "
@@ -477,7 +524,7 @@ var __export = function(target, all) {
477
524
  });
478
525
  };
479
526
  var __copyProps = function(to, from, except, desc) {
480
- if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
527
+ if (from && typeof from === "object" || typeof from === "function") {
481
528
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
482
529
  try {
483
530
  var _loop = function() {
@@ -2965,7 +3012,7 @@ var require_parsel_min = __commonJS({
2965
3012
  switch(t2){
2966
3013
  case "pseudo-element":
2967
3014
  case "pseudo-class":
2968
- return new RegExp(e[t2].source.replace("(?<argument>\xB6*)", "(?<argument>.*)"), "gu");
3015
+ return new RegExp(e[t2].source.replace("(?<argument>\xb6*)", "(?<argument>.*)"), "gu");
2969
3016
  default:
2970
3017
  return e[t2];
2971
3018
  }
@@ -3069,12 +3116,12 @@ var require_parsel_min = __commonJS({
3069
3116
  return s2.push({
3070
3117
  value: e2,
3071
3118
  offset: t3
3072
- }), "\uE000".repeat(e2.length);
3119
+ }), "".repeat(e2.length);
3073
3120
  })).replace(a, function(e2, t3, n3, o3) {
3074
3121
  return s2.push({
3075
3122
  value: e2,
3076
3123
  offset: o3
3077
- }), "".concat(t3).concat("\uE001".repeat(n3.length)).concat(t3);
3124
+ }), "".concat(t3).concat("".repeat(n3.length)).concat(t3);
3078
3125
  });
3079
3126
  {
3080
3127
  var e2, n3 = 0;
@@ -3083,7 +3130,7 @@ var require_parsel_min = __commonJS({
3083
3130
  s2.push({
3084
3131
  value: o3,
3085
3132
  offset: e2
3086
- }), t2 = "".concat(t2.substring(0, e2), "(").concat("\xB6".repeat(o3.length - 2), ")").concat(t2.substring(e2 + o3.length)), n3 = e2 + o3.length;
3133
+ }), t2 = "".concat(t2.substring(0, e2), "(").concat("\xb6".repeat(o3.length - 2), ")").concat(t2.substring(e2 + o3.length)), n3 = e2 + o3.length;
3087
3134
  }
3088
3135
  }
3089
3136
  var o2 = i(t2, n2), u2 = /* @__PURE__ */ new Set();
@@ -3502,7 +3549,7 @@ var require_dist = __commonJS({
3502
3549
  });
3503
3550
  };
3504
3551
  var __copyProps2 = function(to, from, except, desc) {
3505
- if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
3552
+ if (from && typeof from === "object" || typeof from === "function") {
3506
3553
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3507
3554
  try {
3508
3555
  var _loop = function() {
@@ -3961,7 +4008,7 @@ var require_dist2 = __commonJS({
3961
4008
  });
3962
4009
  };
3963
4010
  var __copyProps2 = function(to, from, except, desc) {
3964
- if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
4011
+ if (from && typeof from === "object" || typeof from === "function") {
3965
4012
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3966
4013
  try {
3967
4014
  var _loop = function() {
@@ -4007,20 +4054,20 @@ var require_dist2 = __commonJS({
4007
4054
  });
4008
4055
  module2.exports = __toCommonJS2(src_exports2);
4009
4056
  var import_transformation_matrix10 = require("transformation-matrix");
4010
- var import_react20 = require("react");
4057
+ var import_react21 = require("react");
4011
4058
  var useMouseMatrixTransform2 = function() {
4012
4059
  var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
4013
- var extRef = (0, import_react20.useRef)(null);
4014
- var _ref = _sliced_to_array((0, import_react20.useState)(0), 2), lastDragCancelTime = _ref[0], setLastDragCancelTime = _ref[1];
4060
+ var extRef = (0, import_react21.useRef)(null);
4061
+ var _ref = _sliced_to_array((0, import_react21.useState)(0), 2), lastDragCancelTime = _ref[0], setLastDragCancelTime = _ref[1];
4015
4062
  var _props_canvasElm;
4016
4063
  var outerCanvasElm = (_props_canvasElm = props.canvasElm) !== null && _props_canvasElm !== void 0 ? _props_canvasElm : extRef.current;
4017
4064
  var _props_initialTransform;
4018
- var _ref1 = _sliced_to_array((0, import_react20.useState)((_props_initialTransform = props.initialTransform) !== null && _props_initialTransform !== void 0 ? _props_initialTransform : (0, import_transformation_matrix10.identity)()), 2), internalTransform = _ref1[0], setInternalTransform = _ref1[1];
4019
- var _ref2 = _sliced_to_array((0, import_react20.useState)(0), 2), waitCounter = _ref2[0], setWaitCounter = _ref2[1];
4020
- var _ref3 = _sliced_to_array((0, import_react20.useReducer)(function(s) {
4065
+ var _ref1 = _sliced_to_array((0, import_react21.useState)((_props_initialTransform = props.initialTransform) !== null && _props_initialTransform !== void 0 ? _props_initialTransform : (0, import_transformation_matrix10.identity)()), 2), internalTransform = _ref1[0], setInternalTransform = _ref1[1];
4066
+ var _ref2 = _sliced_to_array((0, import_react21.useState)(0), 2), waitCounter = _ref2[0], setWaitCounter = _ref2[1];
4067
+ var _ref3 = _sliced_to_array((0, import_react21.useReducer)(function(s) {
4021
4068
  return s + 1;
4022
4069
  }, 0), 2), extChangeCounter = _ref3[0], incExtChangeCounter = _ref3[1];
4023
- var setTransform = (0, import_react20.useCallback)(function(newTransform) {
4070
+ var setTransform = (0, import_react21.useCallback)(function(newTransform) {
4024
4071
  if (props.onSetTransform) {
4025
4072
  props.onSetTransform(newTransform);
4026
4073
  }
@@ -4031,7 +4078,7 @@ var require_dist2 = __commonJS({
4031
4078
  props.onSetTransform,
4032
4079
  setInternalTransform
4033
4080
  ]);
4034
- var setTransformExt = (0, import_react20.useCallback)(function(newTransform) {
4081
+ var setTransformExt = (0, import_react21.useCallback)(function(newTransform) {
4035
4082
  setTransform(newTransform);
4036
4083
  incExtChangeCounter();
4037
4084
  }, [
@@ -4039,10 +4086,10 @@ var require_dist2 = __commonJS({
4039
4086
  ]);
4040
4087
  var _props_transform;
4041
4088
  var transform = (_props_transform = props.transform) !== null && _props_transform !== void 0 ? _props_transform : internalTransform;
4042
- var cancelDrag = (0, import_react20.useCallback)(function() {
4089
+ var cancelDrag = (0, import_react21.useCallback)(function() {
4043
4090
  setLastDragCancelTime(Date.now());
4044
4091
  }, []);
4045
- (0, import_react20.useEffect)(function() {
4092
+ (0, import_react21.useEffect)(function() {
4046
4093
  var handleMouseDown = function handleMouseDown(e) {
4047
4094
  m0 = getMousePos(e);
4048
4095
  if (Date.now() - lastDragCancelTime < 100) return;
@@ -4134,7 +4181,7 @@ var require_dist2 = __commonJS({
4134
4181
  extChangeCounter,
4135
4182
  lastDragCancelTime
4136
4183
  ]);
4137
- var applyTransformToPoint = (0, import_react20.useCallback)(function(obj) {
4184
+ var applyTransformToPoint = (0, import_react21.useCallback)(function(obj) {
4138
4185
  return (0, import_transformation_matrix10.applyToPoint)(transform, obj);
4139
4186
  }, [
4140
4187
  transform
@@ -4165,11 +4212,11 @@ __export(src_exports, {
4165
4212
  });
4166
4213
  module.exports = __toCommonJS(src_exports);
4167
4214
  // src/PCBViewer.tsx
4168
- var import_react19 = require("react");
4215
+ var import_react20 = require("react");
4169
4216
  var import_react_fiber = require("@tscircuit/react-fiber");
4170
4217
  var import_builder = require("@tscircuit/builder");
4171
4218
  // src/components/CanvasElementsRenderer.tsx
4172
- var import_react15 = require("react");
4219
+ var import_react16 = require("react");
4173
4220
  // src/components/CanvasPrimitiveRenderer.tsx
4174
4221
  var import_react_supergrid = require("react-supergrid");
4175
4222
  var import_react4 = require("react");
@@ -4837,41 +4884,7 @@ var svgAlphabet = {
4837
4884
  '"': "M 0.25 0 L 0.25 0.5 M 0.75 0 L 0.75 0.5"
4838
4885
  };
4839
4886
  var lineAlphabet = {};
4840
- for(var letter in svgAlphabet){
4841
- lineAlphabet[letter] = [];
4842
- var segs = svgAlphabet[letter].split("M").slice(1).map(function(seg) {
4843
- return seg.split("L").map(function(pr) {
4844
- return pr.trim().split(" ").map(parseFloat);
4845
- });
4846
- });
4847
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4848
- try {
4849
- for(var _iterator = segs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4850
- var seg = _step.value;
4851
- for(var i = 0; i < seg.length - 1; i++){
4852
- lineAlphabet[letter].push({
4853
- x1: seg[i][0],
4854
- y1: 1 - seg[i][1],
4855
- x2: seg[i + 1][0],
4856
- y2: 1 - seg[i + 1][1]
4857
- });
4858
- }
4859
- }
4860
- } catch (err) {
4861
- _didIteratorError = true;
4862
- _iteratorError = err;
4863
- } finally{
4864
- try {
4865
- if (!_iteratorNormalCompletion && _iterator.return != null) {
4866
- _iterator.return();
4867
- }
4868
- } finally{
4869
- if (_didIteratorError) {
4870
- throw _iteratorError;
4871
- }
4872
- }
4873
- }
4874
- }
4887
+ for(var letter in svgAlphabet)_loop(letter);
4875
4888
  // src/lib/convert-text-to-lines.ts
4876
4889
  var LETTER_HEIGHT_TO_WIDTH_RATIO = 0.6;
4877
4890
  var LETTER_HEIGHT_TO_SPACE_RATIO = 0.2;
@@ -5339,10 +5352,11 @@ var quotelessJson = function(obj) {
5339
5352
  var ZodError = /*#__PURE__*/ function _target(Error1) {
5340
5353
  "use strict";
5341
5354
  _inherits(_ZodError, Error1);
5355
+ var _super = _create_super(_ZodError);
5342
5356
  function _ZodError(issues) {
5343
5357
  _class_call_check(this, _ZodError);
5344
5358
  var _this;
5345
- _this = _call_super(this, _ZodError);
5359
+ _this = _super.call(this);
5346
5360
  _this.issues = [];
5347
5361
  _this.addIssue = function(sub) {
5348
5362
  _this.issues = _to_consumable_array(_this.issues).concat([
@@ -5355,7 +5369,7 @@ var ZodError = /*#__PURE__*/ function _target(Error1) {
5355
5369
  };
5356
5370
  var actualProto = (_instanceof(this, _ZodError) ? this.constructor : void 0).prototype;
5357
5371
  if (Object.setPrototypeOf) {
5358
- Object.setPrototypeOf(_this, actualProto);
5372
+ Object.setPrototypeOf(_assert_this_initialized(_this), actualProto);
5359
5373
  } else {
5360
5374
  _this.__proto__ = actualProto;
5361
5375
  }
@@ -5546,7 +5560,7 @@ var errorMap = function(issue, _ctx) {
5546
5560
  message = "Invalid date";
5547
5561
  break;
5548
5562
  case ZodIssueCode.invalid_string:
5549
- if (_type_of(issue.validation) === "object") {
5563
+ if (typeof issue.validation === "object") {
5550
5564
  if ("includes" in issue.validation) {
5551
5565
  message = 'Invalid input: must include "'.concat(issue.validation.includes, '"');
5552
5566
  if (typeof issue.validation.position === "number") {
@@ -6419,9 +6433,10 @@ function isValidIP(ip, version) {
6419
6433
  var ZodString = /*#__PURE__*/ function(ZodType) {
6420
6434
  "use strict";
6421
6435
  _inherits(_ZodString, ZodType);
6436
+ var _super = _create_super(_ZodString);
6422
6437
  function _ZodString() {
6423
6438
  _class_call_check(this, _ZodString);
6424
- return _call_super(this, _ZodString, arguments);
6439
+ return _super.apply(this, arguments);
6425
6440
  }
6426
6441
  _create_class(_ZodString, [
6427
6442
  {
@@ -7181,10 +7196,13 @@ function floatSafeRemainder(val, step) {
7181
7196
  var ZodNumber = /*#__PURE__*/ function(ZodType) {
7182
7197
  "use strict";
7183
7198
  _inherits(_ZodNumber, ZodType);
7199
+ var _super = _create_super(_ZodNumber);
7184
7200
  function _ZodNumber() {
7185
7201
  _class_call_check(this, _ZodNumber);
7186
7202
  var _this;
7187
- _this = _call_super(this, _ZodNumber, arguments);
7203
+ _this = _super.call.apply(_super, [
7204
+ this
7205
+ ].concat(Array.prototype.slice.call(arguments)));
7188
7206
  _this.min = _this.gte;
7189
7207
  _this.max = _this.lte;
7190
7208
  _this.step = _this.multipleOf;
@@ -7544,10 +7562,13 @@ ZodNumber.create = function(params) {
7544
7562
  var ZodBigInt = /*#__PURE__*/ function(ZodType) {
7545
7563
  "use strict";
7546
7564
  _inherits(_ZodBigInt, ZodType);
7565
+ var _super = _create_super(_ZodBigInt);
7547
7566
  function _ZodBigInt() {
7548
7567
  _class_call_check(this, _ZodBigInt);
7549
7568
  var _this;
7550
- _this = _call_super(this, _ZodBigInt, arguments);
7569
+ _this = _super.call.apply(_super, [
7570
+ this
7571
+ ].concat(Array.prototype.slice.call(arguments)));
7551
7572
  _this.min = _this.gte;
7552
7573
  _this.max = _this.lte;
7553
7574
  return _this;
@@ -7810,9 +7831,10 @@ ZodBigInt.create = function(params) {
7810
7831
  var ZodBoolean = /*#__PURE__*/ function(ZodType) {
7811
7832
  "use strict";
7812
7833
  _inherits(ZodBoolean, ZodType);
7834
+ var _super = _create_super(ZodBoolean);
7813
7835
  function ZodBoolean() {
7814
7836
  _class_call_check(this, ZodBoolean);
7815
- return _call_super(this, ZodBoolean, arguments);
7837
+ return _super.apply(this, arguments);
7816
7838
  }
7817
7839
  _create_class(ZodBoolean, [
7818
7840
  {
@@ -7846,9 +7868,10 @@ ZodBoolean.create = function(params) {
7846
7868
  var ZodDate = /*#__PURE__*/ function(ZodType) {
7847
7869
  "use strict";
7848
7870
  _inherits(_ZodDate, ZodType);
7871
+ var _super = _create_super(_ZodDate);
7849
7872
  function _ZodDate() {
7850
7873
  _class_call_check(this, _ZodDate);
7851
- return _call_super(this, _ZodDate, arguments);
7874
+ return _super.apply(this, arguments);
7852
7875
  }
7853
7876
  _create_class(_ZodDate, [
7854
7877
  {
@@ -8031,9 +8054,10 @@ ZodDate.create = function(params) {
8031
8054
  var ZodSymbol = /*#__PURE__*/ function(ZodType) {
8032
8055
  "use strict";
8033
8056
  _inherits(ZodSymbol, ZodType);
8057
+ var _super = _create_super(ZodSymbol);
8034
8058
  function ZodSymbol() {
8035
8059
  _class_call_check(this, ZodSymbol);
8036
- return _call_super(this, ZodSymbol, arguments);
8060
+ return _super.apply(this, arguments);
8037
8061
  }
8038
8062
  _create_class(ZodSymbol, [
8039
8063
  {
@@ -8063,9 +8087,10 @@ ZodSymbol.create = function(params) {
8063
8087
  var ZodUndefined = /*#__PURE__*/ function(ZodType) {
8064
8088
  "use strict";
8065
8089
  _inherits(ZodUndefined, ZodType);
8090
+ var _super = _create_super(ZodUndefined);
8066
8091
  function ZodUndefined() {
8067
8092
  _class_call_check(this, ZodUndefined);
8068
- return _call_super(this, ZodUndefined, arguments);
8093
+ return _super.apply(this, arguments);
8069
8094
  }
8070
8095
  _create_class(ZodUndefined, [
8071
8096
  {
@@ -8095,9 +8120,10 @@ ZodUndefined.create = function(params) {
8095
8120
  var ZodNull = /*#__PURE__*/ function(ZodType) {
8096
8121
  "use strict";
8097
8122
  _inherits(ZodNull, ZodType);
8123
+ var _super = _create_super(ZodNull);
8098
8124
  function ZodNull() {
8099
8125
  _class_call_check(this, ZodNull);
8100
- return _call_super(this, ZodNull, arguments);
8126
+ return _super.apply(this, arguments);
8101
8127
  }
8102
8128
  _create_class(ZodNull, [
8103
8129
  {
@@ -8127,10 +8153,13 @@ ZodNull.create = function(params) {
8127
8153
  var ZodAny = /*#__PURE__*/ function(ZodType) {
8128
8154
  "use strict";
8129
8155
  _inherits(ZodAny, ZodType);
8156
+ var _super = _create_super(ZodAny);
8130
8157
  function ZodAny() {
8131
8158
  _class_call_check(this, ZodAny);
8132
8159
  var _this;
8133
- _this = _call_super(this, ZodAny, arguments);
8160
+ _this = _super.call.apply(_super, [
8161
+ this
8162
+ ].concat(Array.prototype.slice.call(arguments)));
8134
8163
  _this._any = true;
8135
8164
  return _this;
8136
8165
  }
@@ -8152,10 +8181,13 @@ ZodAny.create = function(params) {
8152
8181
  var ZodUnknown = /*#__PURE__*/ function(ZodType) {
8153
8182
  "use strict";
8154
8183
  _inherits(ZodUnknown, ZodType);
8184
+ var _super = _create_super(ZodUnknown);
8155
8185
  function ZodUnknown() {
8156
8186
  _class_call_check(this, ZodUnknown);
8157
8187
  var _this;
8158
- _this = _call_super(this, ZodUnknown, arguments);
8188
+ _this = _super.call.apply(_super, [
8189
+ this
8190
+ ].concat(Array.prototype.slice.call(arguments)));
8159
8191
  _this._unknown = true;
8160
8192
  return _this;
8161
8193
  }
@@ -8177,9 +8209,10 @@ ZodUnknown.create = function(params) {
8177
8209
  var ZodNever = /*#__PURE__*/ function(ZodType) {
8178
8210
  "use strict";
8179
8211
  _inherits(ZodNever, ZodType);
8212
+ var _super = _create_super(ZodNever);
8180
8213
  function ZodNever() {
8181
8214
  _class_call_check(this, ZodNever);
8182
- return _call_super(this, ZodNever, arguments);
8215
+ return _super.apply(this, arguments);
8183
8216
  }
8184
8217
  _create_class(ZodNever, [
8185
8218
  {
@@ -8205,9 +8238,10 @@ ZodNever.create = function(params) {
8205
8238
  var ZodVoid = /*#__PURE__*/ function(ZodType) {
8206
8239
  "use strict";
8207
8240
  _inherits(ZodVoid, ZodType);
8241
+ var _super = _create_super(ZodVoid);
8208
8242
  function ZodVoid() {
8209
8243
  _class_call_check(this, ZodVoid);
8210
- return _call_super(this, ZodVoid, arguments);
8244
+ return _super.apply(this, arguments);
8211
8245
  }
8212
8246
  _create_class(ZodVoid, [
8213
8247
  {
@@ -8237,9 +8271,10 @@ ZodVoid.create = function(params) {
8237
8271
  var ZodArray = /*#__PURE__*/ function(ZodType) {
8238
8272
  "use strict";
8239
8273
  _inherits(_ZodArray, ZodType);
8274
+ var _super = _create_super(_ZodArray);
8240
8275
  function _ZodArray() {
8241
8276
  _class_call_check(this, _ZodArray);
8242
- return _call_super(this, _ZodArray, arguments);
8277
+ return _super.apply(this, arguments);
8243
8278
  }
8244
8279
  _create_class(_ZodArray, [
8245
8280
  {
@@ -8398,10 +8433,13 @@ function deepPartialify(schema) {
8398
8433
  var ZodObject = /*#__PURE__*/ function(ZodType) {
8399
8434
  "use strict";
8400
8435
  _inherits(_ZodObject, ZodType);
8436
+ var _super = _create_super(_ZodObject);
8401
8437
  function _ZodObject() {
8402
8438
  _class_call_check(this, _ZodObject);
8403
8439
  var _this;
8404
- _this = _call_super(this, _ZodObject, arguments);
8440
+ _this = _super.call.apply(_super, [
8441
+ this
8442
+ ].concat(Array.prototype.slice.call(arguments)));
8405
8443
  _this._cached = null;
8406
8444
  _this.nonstrict = _this.passthrough;
8407
8445
  _this.augment = _this.extend;
@@ -8923,9 +8961,10 @@ ZodObject.lazycreate = function(shape, params) {
8923
8961
  var ZodUnion = /*#__PURE__*/ function(ZodType) {
8924
8962
  "use strict";
8925
8963
  _inherits(ZodUnion, ZodType);
8964
+ var _super = _create_super(ZodUnion);
8926
8965
  function ZodUnion() {
8927
8966
  _class_call_check(this, ZodUnion);
8928
- return _call_super(this, ZodUnion, arguments);
8967
+ return _super.apply(this, arguments);
8929
8968
  }
8930
8969
  _create_class(ZodUnion, [
8931
8970
  {
@@ -8990,7 +9029,7 @@ var ZodUnion = /*#__PURE__*/ function(ZodType) {
8990
9029
  return INVALID;
8991
9030
  }
8992
9031
  if (ctx.common.async) {
8993
- return Promise.all(options.map(/*#__PURE__*/ function() {
9032
+ return Promise.all(options.map(function() {
8994
9033
  var _ref = _async_to_generator(function(option) {
8995
9034
  var childCtx, _tmp;
8996
9035
  return _ts_generator(this, function(_state) {
@@ -9142,9 +9181,10 @@ var getDiscriminator = function(type) {
9142
9181
  var ZodDiscriminatedUnion = /*#__PURE__*/ function(ZodType) {
9143
9182
  "use strict";
9144
9183
  _inherits(_ZodDiscriminatedUnion, ZodType);
9184
+ var _super = _create_super(_ZodDiscriminatedUnion);
9145
9185
  function _ZodDiscriminatedUnion() {
9146
9186
  _class_call_check(this, _ZodDiscriminatedUnion);
9147
- return _call_super(this, _ZodDiscriminatedUnion, arguments);
9187
+ return _super.apply(this, arguments);
9148
9188
  }
9149
9189
  _create_class(_ZodDiscriminatedUnion, [
9150
9190
  {
@@ -9354,9 +9394,10 @@ function mergeValues(a, b) {
9354
9394
  var ZodIntersection = /*#__PURE__*/ function(ZodType) {
9355
9395
  "use strict";
9356
9396
  _inherits(ZodIntersection, ZodType);
9397
+ var _super = _create_super(ZodIntersection);
9357
9398
  function ZodIntersection() {
9358
9399
  _class_call_check(this, ZodIntersection);
9359
- return _call_super(this, ZodIntersection, arguments);
9400
+ return _super.apply(this, arguments);
9360
9401
  }
9361
9402
  _create_class(ZodIntersection, [
9362
9403
  {
@@ -9424,9 +9465,10 @@ ZodIntersection.create = function(left, right, params) {
9424
9465
  var ZodTuple = /*#__PURE__*/ function(ZodType) {
9425
9466
  "use strict";
9426
9467
  _inherits(_ZodTuple, ZodType);
9468
+ var _super = _create_super(_ZodTuple);
9427
9469
  function _ZodTuple() {
9428
9470
  _class_call_check(this, _ZodTuple);
9429
- return _call_super(this, _ZodTuple, arguments);
9471
+ return _super.apply(this, arguments);
9430
9472
  }
9431
9473
  _create_class(_ZodTuple, [
9432
9474
  {
@@ -9509,9 +9551,10 @@ ZodTuple.create = function(schemas, params) {
9509
9551
  var ZodRecord = /*#__PURE__*/ function(ZodType1) {
9510
9552
  "use strict";
9511
9553
  _inherits(_ZodRecord, ZodType1);
9554
+ var _super = _create_super(_ZodRecord);
9512
9555
  function _ZodRecord() {
9513
9556
  _class_call_check(this, _ZodRecord);
9514
- return _call_super(this, _ZodRecord, arguments);
9557
+ return _super.apply(this, arguments);
9515
9558
  }
9516
9559
  _create_class(_ZodRecord, [
9517
9560
  {
@@ -9585,9 +9628,10 @@ var ZodRecord = /*#__PURE__*/ function(ZodType1) {
9585
9628
  var ZodMap = /*#__PURE__*/ function(ZodType) {
9586
9629
  "use strict";
9587
9630
  _inherits(ZodMap, ZodType);
9631
+ var _super = _create_super(ZodMap);
9588
9632
  function ZodMap() {
9589
9633
  _class_call_check(this, ZodMap);
9590
- return _call_super(this, ZodMap, arguments);
9634
+ return _super.apply(this, arguments);
9591
9635
  }
9592
9636
  _create_class(ZodMap, [
9593
9637
  {
@@ -9769,9 +9813,10 @@ ZodMap.create = function(keyType, valueType, params) {
9769
9813
  var ZodSet = /*#__PURE__*/ function(ZodType) {
9770
9814
  "use strict";
9771
9815
  _inherits(_ZodSet, ZodType);
9816
+ var _super = _create_super(_ZodSet);
9772
9817
  function _ZodSet() {
9773
9818
  _class_call_check(this, _ZodSet);
9774
- return _call_super(this, _ZodSet, arguments);
9819
+ return _super.apply(this, arguments);
9775
9820
  }
9776
9821
  _create_class(_ZodSet, [
9777
9822
  {
@@ -9903,10 +9948,13 @@ ZodSet.create = function(valueType, params) {
9903
9948
  var ZodFunction = /*#__PURE__*/ function(ZodType) {
9904
9949
  "use strict";
9905
9950
  _inherits(_ZodFunction, ZodType);
9951
+ var _super = _create_super(_ZodFunction);
9906
9952
  function _ZodFunction() {
9907
9953
  _class_call_check(this, _ZodFunction);
9908
9954
  var _this;
9909
- _this = _call_super(this, _ZodFunction, arguments);
9955
+ _this = _super.call.apply(_super, [
9956
+ this
9957
+ ].concat(Array.prototype.slice.call(arguments)));
9910
9958
  _this.validate = _this.implement;
9911
9959
  return _this;
9912
9960
  }
@@ -10092,9 +10140,10 @@ var ZodFunction = /*#__PURE__*/ function(ZodType) {
10092
10140
  var ZodLazy = /*#__PURE__*/ function(ZodType) {
10093
10141
  "use strict";
10094
10142
  _inherits(ZodLazy, ZodType);
10143
+ var _super = _create_super(ZodLazy);
10095
10144
  function ZodLazy() {
10096
10145
  _class_call_check(this, ZodLazy);
10097
- return _call_super(this, ZodLazy, arguments);
10146
+ return _super.apply(this, arguments);
10098
10147
  }
10099
10148
  _create_class(ZodLazy, [
10100
10149
  {
@@ -10127,9 +10176,10 @@ ZodLazy.create = function(getter, params) {
10127
10176
  var ZodLiteral = /*#__PURE__*/ function(ZodType) {
10128
10177
  "use strict";
10129
10178
  _inherits(ZodLiteral, ZodType);
10179
+ var _super = _create_super(ZodLiteral);
10130
10180
  function ZodLiteral() {
10131
10181
  _class_call_check(this, ZodLiteral);
10132
- return _call_super(this, ZodLiteral, arguments);
10182
+ return _super.apply(this, arguments);
10133
10183
  }
10134
10184
  _create_class(ZodLiteral, [
10135
10185
  {
@@ -10174,11 +10224,14 @@ function createZodEnum(values, params) {
10174
10224
  var ZodEnum = /*#__PURE__*/ function(ZodType) {
10175
10225
  "use strict";
10176
10226
  _inherits(_ZodEnum, ZodType);
10227
+ var _super = _create_super(_ZodEnum);
10177
10228
  function _ZodEnum() {
10178
10229
  _class_call_check(this, _ZodEnum);
10179
10230
  var _this;
10180
- _this = _call_super(this, _ZodEnum, arguments);
10181
- _ZodEnum_cache.set(_this, void 0);
10231
+ _this = _super.call.apply(_super, [
10232
+ this
10233
+ ].concat(Array.prototype.slice.call(arguments)));
10234
+ _ZodEnum_cache.set(_assert_this_initialized(_this), void 0);
10182
10235
  return _this;
10183
10236
  }
10184
10237
  _create_class(_ZodEnum, [
@@ -10322,11 +10375,14 @@ ZodEnum.create = createZodEnum;
10322
10375
  var ZodNativeEnum = /*#__PURE__*/ function(ZodType) {
10323
10376
  "use strict";
10324
10377
  _inherits(ZodNativeEnum, ZodType);
10378
+ var _super = _create_super(ZodNativeEnum);
10325
10379
  function ZodNativeEnum() {
10326
10380
  _class_call_check(this, ZodNativeEnum);
10327
10381
  var _this;
10328
- _this = _call_super(this, ZodNativeEnum, arguments);
10329
- _ZodNativeEnum_cache.set(_this, void 0);
10382
+ _this = _super.call.apply(_super, [
10383
+ this
10384
+ ].concat(Array.prototype.slice.call(arguments)));
10385
+ _ZodNativeEnum_cache.set(_assert_this_initialized(_this), void 0);
10330
10386
  return _this;
10331
10387
  }
10332
10388
  _create_class(ZodNativeEnum, [
@@ -10378,9 +10434,10 @@ ZodNativeEnum.create = function(values, params) {
10378
10434
  var ZodPromise = /*#__PURE__*/ function(ZodType) {
10379
10435
  "use strict";
10380
10436
  _inherits(ZodPromise, ZodType);
10437
+ var _super = _create_super(ZodPromise);
10381
10438
  function ZodPromise() {
10382
10439
  _class_call_check(this, ZodPromise);
10383
- return _call_super(this, ZodPromise, arguments);
10440
+ return _super.apply(this, arguments);
10384
10441
  }
10385
10442
  _create_class(ZodPromise, [
10386
10443
  {
@@ -10423,9 +10480,10 @@ ZodPromise.create = function(schema, params) {
10423
10480
  var ZodEffects = /*#__PURE__*/ function(ZodType) {
10424
10481
  "use strict";
10425
10482
  _inherits(ZodEffects, ZodType);
10483
+ var _super = _create_super(ZodEffects);
10426
10484
  function ZodEffects() {
10427
10485
  _class_call_check(this, ZodEffects);
10428
- return _call_super(this, ZodEffects, arguments);
10486
+ return _super.apply(this, arguments);
10429
10487
  }
10430
10488
  _create_class(ZodEffects, [
10431
10489
  {
@@ -10463,7 +10521,7 @@ var ZodEffects = /*#__PURE__*/ function(ZodType) {
10463
10521
  var processed = effect.transform(ctx.data, checkCtx);
10464
10522
  if (ctx.common.async) {
10465
10523
  var _this = this;
10466
- return Promise.resolve(processed).then(/*#__PURE__*/ function() {
10524
+ return Promise.resolve(processed).then(function() {
10467
10525
  var _ref = _async_to_generator(function(processed2) {
10468
10526
  var result;
10469
10527
  return _ts_generator(this, function(_state) {
@@ -10618,9 +10676,10 @@ ZodEffects.createWithPreprocess = function(preprocess, schema, params) {
10618
10676
  var ZodOptional = /*#__PURE__*/ function(ZodType) {
10619
10677
  "use strict";
10620
10678
  _inherits(ZodOptional, ZodType);
10679
+ var _super = _create_super(ZodOptional);
10621
10680
  function ZodOptional() {
10622
10681
  _class_call_check(this, ZodOptional);
10623
- return _call_super(this, ZodOptional, arguments);
10682
+ return _super.apply(this, arguments);
10624
10683
  }
10625
10684
  _create_class(ZodOptional, [
10626
10685
  {
@@ -10651,9 +10710,10 @@ ZodOptional.create = function(type, params) {
10651
10710
  var ZodNullable = /*#__PURE__*/ function(ZodType) {
10652
10711
  "use strict";
10653
10712
  _inherits(ZodNullable, ZodType);
10713
+ var _super = _create_super(ZodNullable);
10654
10714
  function ZodNullable() {
10655
10715
  _class_call_check(this, ZodNullable);
10656
- return _call_super(this, ZodNullable, arguments);
10716
+ return _super.apply(this, arguments);
10657
10717
  }
10658
10718
  _create_class(ZodNullable, [
10659
10719
  {
@@ -10684,9 +10744,10 @@ ZodNullable.create = function(type, params) {
10684
10744
  var ZodDefault = /*#__PURE__*/ function(ZodType) {
10685
10745
  "use strict";
10686
10746
  _inherits(ZodDefault, ZodType);
10747
+ var _super = _create_super(ZodDefault);
10687
10748
  function ZodDefault() {
10688
10749
  _class_call_check(this, ZodDefault);
10689
- return _call_super(this, ZodDefault, arguments);
10750
+ return _super.apply(this, arguments);
10690
10751
  }
10691
10752
  _create_class(ZodDefault, [
10692
10753
  {
@@ -10725,9 +10786,10 @@ ZodDefault.create = function(type, params) {
10725
10786
  var ZodCatch = /*#__PURE__*/ function(ZodType) {
10726
10787
  "use strict";
10727
10788
  _inherits(ZodCatch, ZodType);
10789
+ var _super = _create_super(ZodCatch);
10728
10790
  function ZodCatch() {
10729
10791
  _class_call_check(this, ZodCatch);
10730
- return _call_super(this, ZodCatch, arguments);
10792
+ return _super.apply(this, arguments);
10731
10793
  }
10732
10794
  _create_class(ZodCatch, [
10733
10795
  {
@@ -10791,9 +10853,10 @@ ZodCatch.create = function(type, params) {
10791
10853
  var ZodNaN = /*#__PURE__*/ function(ZodType) {
10792
10854
  "use strict";
10793
10855
  _inherits(ZodNaN, ZodType);
10856
+ var _super = _create_super(ZodNaN);
10794
10857
  function ZodNaN() {
10795
10858
  _class_call_check(this, ZodNaN);
10796
- return _call_super(this, ZodNaN, arguments);
10859
+ return _super.apply(this, arguments);
10797
10860
  }
10798
10861
  _create_class(ZodNaN, [
10799
10862
  {
@@ -10827,9 +10890,10 @@ var BRAND = Symbol("zod_brand");
10827
10890
  var ZodBranded = /*#__PURE__*/ function(ZodType) {
10828
10891
  "use strict";
10829
10892
  _inherits(ZodBranded, ZodType);
10893
+ var _super = _create_super(ZodBranded);
10830
10894
  function ZodBranded() {
10831
10895
  _class_call_check(this, ZodBranded);
10832
- return _call_super(this, ZodBranded, arguments);
10896
+ return _super.apply(this, arguments);
10833
10897
  }
10834
10898
  _create_class(ZodBranded, [
10835
10899
  {
@@ -10856,9 +10920,10 @@ var ZodBranded = /*#__PURE__*/ function(ZodType) {
10856
10920
  var ZodPipeline = /*#__PURE__*/ function(ZodType) {
10857
10921
  "use strict";
10858
10922
  _inherits(_ZodPipeline, ZodType);
10923
+ var _super = _create_super(_ZodPipeline);
10859
10924
  function _ZodPipeline() {
10860
10925
  _class_call_check(this, _ZodPipeline);
10861
- return _call_super(this, _ZodPipeline, arguments);
10926
+ return _super.apply(this, arguments);
10862
10927
  }
10863
10928
  _create_class(_ZodPipeline, [
10864
10929
  {
@@ -10867,7 +10932,7 @@ var ZodPipeline = /*#__PURE__*/ function(ZodType) {
10867
10932
  var _this__processInputParams = this._processInputParams(input), status = _this__processInputParams.status, ctx = _this__processInputParams.ctx;
10868
10933
  if (ctx.common.async) {
10869
10934
  var _this = this;
10870
- var handleAsync = /*#__PURE__*/ function() {
10935
+ var handleAsync = function() {
10871
10936
  var _ref = _async_to_generator(function() {
10872
10937
  var inResult;
10873
10938
  return _ts_generator(this, function(_state) {
@@ -10954,9 +11019,10 @@ var ZodPipeline = /*#__PURE__*/ function(ZodType) {
10954
11019
  var ZodReadonly = /*#__PURE__*/ function(ZodType) {
10955
11020
  "use strict";
10956
11021
  _inherits(ZodReadonly, ZodType);
11022
+ var _super = _create_super(ZodReadonly);
10957
11023
  function ZodReadonly() {
10958
11024
  _class_call_check(this, ZodReadonly);
10959
- return _call_super(this, ZodReadonly, arguments);
11025
+ return _super.apply(this, arguments);
10960
11026
  }
10961
11027
  _create_class(ZodReadonly, [
10962
11028
  {
@@ -11247,11 +11313,11 @@ var z = /* @__PURE__ */ Object.freeze({
11247
11313
  quotelessJson: quotelessJson,
11248
11314
  ZodError: ZodError
11249
11315
  });
11250
- // node_modules/nanoid/index.js
11316
+ // node_modules/circuit-json/node_modules/nanoid/index.js
11251
11317
  var import_node_crypto = require("crypto");
11252
- // node_modules/nanoid/url-alphabet/index.js
11318
+ // node_modules/circuit-json/node_modules/nanoid/url-alphabet/index.js
11253
11319
  var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
11254
- // node_modules/nanoid/index.js
11320
+ // node_modules/circuit-json/node_modules/nanoid/index.js
11255
11321
  var POOL_SIZE_MULTIPLIER = 128;
11256
11322
  var pool;
11257
11323
  var poolOffset;
@@ -11346,7 +11412,7 @@ var parseAndConvertSiUnit = function(v) {
11346
11412
  value: v,
11347
11413
  unit: null
11348
11414
  };
11349
- if ((typeof v === "undefined" ? "undefined" : _type_of(v)) === "object" && "x" in v && "y" in v) {
11415
+ if (typeof v === "object" && "x" in v && "y" in v) {
11350
11416
  return {
11351
11417
  unit: parseAndConvertSiUnit(v.x).unit,
11352
11418
  value: {
@@ -12193,7 +12259,7 @@ var CanvasPrimitiveRenderer = function(param) {
12193
12259
  });
12194
12260
  };
12195
12261
  // src/components/CanvasElementsRenderer.tsx
12196
- var import_react16 = require("react");
12262
+ var import_react17 = require("react");
12197
12263
  // src/lib/convert-element-to-primitive.ts
12198
12264
  var import_soup_util = __toESM(require_dist());
12199
12265
  // src/lib/util/expand-stroke.ts
@@ -12624,8 +12690,6 @@ var convertElementToPrimitives = function(element, allElements) {
12624
12690
  }
12625
12691
  return primitives;
12626
12692
  }
12627
- // The builder currently outputs these as smtpads and holes, so pcb_via isn't
12628
- // used, but that maybe should be changed
12629
12693
  case "pcb_via":
12630
12694
  {
12631
12695
  var x7 = element.x, y7 = element.y, outer_diameter1 = element.outer_diameter, hole_diameter2 = element.hole_diameter, from_layer = element.from_layer, to_layer = element.to_layer;
@@ -13305,12 +13369,12 @@ var DimensionOverlay = function(param) {
13305
13369
  });
13306
13370
  };
13307
13371
  // src/components/ToolbarOverlay.tsx
13308
- var import_react9 = require("react");
13372
+ var import_react10 = require("react");
13309
13373
  var import_css = require("@emotion/css");
13310
13374
  // package.json
13311
13375
  var package_default = {
13312
13376
  name: "@tscircuit/pcb-viewer",
13313
- version: "1.10.3",
13377
+ version: "1.10.5",
13314
13378
  main: "dist/index.js",
13315
13379
  repository: "tscircuit/pcb-viewer",
13316
13380
  license: "MIT",
@@ -13334,7 +13398,7 @@ var package_default = {
13334
13398
  "@storybook/react": "^8.0.6",
13335
13399
  "@swc/core": "^1.4.12",
13336
13400
  "@tscircuit/builder": "^1.11.4",
13337
- "@tscircuit/core": "^0.0.74",
13401
+ "@tscircuit/core": "^0.0.88",
13338
13402
  "@tscircuit/eagle-xml-converter": "^0.0.6",
13339
13403
  "@tscircuit/props": "^0.0.46",
13340
13404
  "@tscircuit/react-fiber": "^1.1.25",
@@ -13370,6 +13434,27 @@ var package_default = {
13370
13434
  zustand: "^4.5.2"
13371
13435
  }
13372
13436
  };
13437
+ // src/hooks/useHotKey.ts
13438
+ var import_react9 = require("react");
13439
+ var useHotKey = function(key, onUse) {
13440
+ (0, import_react9.useEffect)(function() {
13441
+ var handleKeyDown = function(event) {
13442
+ var keyParts = key.split("+");
13443
+ var ctrlRequired = keyParts.includes("ctrl");
13444
+ var shiftRequired = keyParts.includes("shift");
13445
+ var mainKey = keyParts[keyParts.length - 1];
13446
+ if ((!ctrlRequired || ctrlRequired && event.ctrlKey) && (!shiftRequired || shiftRequired && event.shiftKey) && event.key.toLowerCase() === mainKey.toLowerCase()) {
13447
+ onUse();
13448
+ }
13449
+ };
13450
+ window.addEventListener("keydown", handleKeyDown);
13451
+ return function() {
13452
+ window.removeEventListener("keydown", handleKeyDown);
13453
+ };
13454
+ }, [
13455
+ key
13456
+ ]);
13457
+ };
13373
13458
  // src/components/ToolbarOverlay.tsx
13374
13459
  var import_jsx_runtime6 = require("react/jsx-runtime");
13375
13460
  var LayerButton = function(param) {
@@ -13383,7 +13468,7 @@ var LayerButton = function(param) {
13383
13468
  marginRight: 2,
13384
13469
  opacity: selected ? 1 : 0
13385
13470
  },
13386
- children: "\u2022"
13471
+ children: ""
13387
13472
  }),
13388
13473
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {
13389
13474
  style: {
@@ -13418,9 +13503,9 @@ var ToolbarButton = function(_param) {
13418
13503
  };
13419
13504
  var ToolbarOverlay = function(param) {
13420
13505
  var children = param.children, elements = param.elements;
13421
- var _ref = _sliced_to_array((0, import_react9.useState)(false), 2), isMouseOverContainer = _ref[0], setIsMouseOverContainer = _ref[1];
13422
- var _ref1 = _sliced_to_array((0, import_react9.useState)(false), 2), isLayerMenuOpen = _ref1[0], setLayerMenuOpen = _ref1[1];
13423
- var _ref2 = _sliced_to_array((0, import_react9.useState)(false), 2), isErrorsOpen = _ref2[0], setErrorsOpen = _ref2[1];
13506
+ var _ref = _sliced_to_array((0, import_react10.useState)(false), 2), isMouseOverContainer = _ref[0], setIsMouseOverContainer = _ref[1];
13507
+ var _ref1 = _sliced_to_array((0, import_react10.useState)(false), 2), isLayerMenuOpen = _ref1[0], setLayerMenuOpen = _ref1[1];
13508
+ var _ref2 = _sliced_to_array((0, import_react10.useState)(false), 2), isErrorsOpen = _ref2[0], setErrorsOpen = _ref2[1];
13424
13509
  var _useGlobalStore = _sliced_to_array(useGlobalStore(function(s) {
13425
13510
  return [
13426
13511
  s.selected_layer,
@@ -13440,6 +13525,30 @@ var ToolbarOverlay = function(param) {
13440
13525
  var setIsShowingRatsNest = useGlobalStore(function(s) {
13441
13526
  return s.setIsShowingRatsNest;
13442
13527
  });
13528
+ useHotKey("1", function() {
13529
+ return selectLayer("top");
13530
+ });
13531
+ useHotKey("2", function() {
13532
+ return selectLayer("bottom");
13533
+ });
13534
+ useHotKey("3", function() {
13535
+ return selectLayer("inner1");
13536
+ });
13537
+ useHotKey("4", function() {
13538
+ return selectLayer("inner2");
13539
+ });
13540
+ useHotKey("5", function() {
13541
+ return selectLayer("inner3");
13542
+ });
13543
+ useHotKey("6", function() {
13544
+ return selectLayer("inner4");
13545
+ });
13546
+ useHotKey("7", function() {
13547
+ return selectLayer("inner5");
13548
+ });
13549
+ useHotKey("8", function() {
13550
+ return selectLayer("inner6");
13551
+ });
13443
13552
  var _elements_filter_length;
13444
13553
  var errorCount = (_elements_filter_length = elements === null || elements === void 0 ? void 0 : elements.filter(function(e) {
13445
13554
  return e.type.includes("error");
@@ -13558,7 +13667,7 @@ var ToolbarOverlay = function(param) {
13558
13667
  children: elements === null || elements === void 0 ? void 0 : elements.filter(function(e) {
13559
13668
  return e.type.includes("error");
13560
13669
  }).map(function(e, i) {
13561
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react9.Fragment, {
13670
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react10.Fragment, {
13562
13671
  children: [
13563
13672
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
13564
13673
  children: e.error_type
@@ -13579,7 +13688,7 @@ var ToolbarOverlay = function(param) {
13579
13688
  },
13580
13689
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", {
13581
13690
  children: [
13582
- in_draw_trace_mode ? "\u2716 " : "",
13691
+ in_draw_trace_mode ? " " : "",
13583
13692
  "Edit Traces"
13584
13693
  ]
13585
13694
  })
@@ -13591,7 +13700,7 @@ var ToolbarOverlay = function(param) {
13591
13700
  },
13592
13701
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", {
13593
13702
  children: [
13594
- in_move_footprint_mode ? "\u2716 " : "",
13703
+ in_move_footprint_mode ? " " : "",
13595
13704
  "Move Components"
13596
13705
  ]
13597
13706
  })
@@ -13603,7 +13712,7 @@ var ToolbarOverlay = function(param) {
13603
13712
  },
13604
13713
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", {
13605
13714
  children: [
13606
- is_showing_rats_nest ? "\u2716 " : "",
13715
+ is_showing_rats_nest ? " " : "",
13607
13716
  "Rats Nest"
13608
13717
  ]
13609
13718
  })
@@ -13615,7 +13724,7 @@ var ToolbarOverlay = function(param) {
13615
13724
  };
13616
13725
  // src/components/ErrorOverlay.tsx
13617
13726
  var import_css2 = require("@emotion/css");
13618
- var import_react10 = require("react");
13727
+ var import_react11 = require("react");
13619
13728
  var import_transformation_matrix4 = require("transformation-matrix");
13620
13729
  var import_jsx_runtime7 = require("react/jsx-runtime");
13621
13730
  var ErrorSVG = function(param) {
@@ -13666,7 +13775,7 @@ var ErrorSVG = function(param) {
13666
13775
  var ErrorOverlay = function(param) {
13667
13776
  var children = param.children, transform = param.transform, elements = param.elements;
13668
13777
  if (!transform) transform = (0, import_transformation_matrix4.identity)();
13669
- var containerRef = (0, import_react10.useRef)(null);
13778
+ var containerRef = (0, import_react11.useRef)(null);
13670
13779
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", {
13671
13780
  style: {
13672
13781
  position: "relative"
@@ -13728,7 +13837,7 @@ var ErrorOverlay = function(param) {
13728
13837
  });
13729
13838
  };
13730
13839
  // src/components/EditPlacementOverlay.tsx
13731
- var import_react11 = require("react");
13840
+ var import_react12 = require("react");
13732
13841
  var import_transformation_matrix5 = require("transformation-matrix");
13733
13842
  var import_jsx_runtime8 = require("react/jsx-runtime");
13734
13843
  var isInsideOf = function(pcb_component2, point2) {
@@ -13744,9 +13853,9 @@ var isInsideOf = function(pcb_component2, point2) {
13744
13853
  var EditPlacementOverlay = function(param) {
13745
13854
  var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
13746
13855
  if (!transform) transform = (0, import_transformation_matrix5.identity)();
13747
- var containerRef = (0, import_react11.useRef)(null);
13748
- var _ref = _sliced_to_array((0, import_react11.useState)(null), 2), activePcbComponentId = _ref[0], setActivePcbComponent = _ref[1];
13749
- var _ref1 = _sliced_to_array((0, import_react11.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
13856
+ var containerRef = (0, import_react12.useRef)(null);
13857
+ var _ref = _sliced_to_array((0, import_react12.useState)(null), 2), activePcbComponentId = _ref[0], setActivePcbComponent = _ref[1];
13858
+ var _ref1 = _sliced_to_array((0, import_react12.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
13750
13859
  var isPcbComponentActive = activePcbComponentId !== null;
13751
13860
  var in_edit_mode = useGlobalStore(function(s) {
13752
13861
  return s.in_edit_mode;
@@ -13884,15 +13993,15 @@ var EditPlacementOverlay = function(param) {
13884
13993
  };
13885
13994
  // src/components/EditTraceHintOverlay.tsx
13886
13995
  var import_soup_util2 = __toESM(require_dist());
13887
- var import_react14 = require("react");
13996
+ var import_react15 = require("react");
13888
13997
  var import_transformation_matrix6 = require("transformation-matrix");
13889
13998
  // src/components/HotkeyActionMenu.tsx
13890
13999
  var import_css3 = require("@emotion/css");
13891
- var import_react12 = require("react");
14000
+ var import_react13 = require("react");
13892
14001
  var import_jsx_runtime9 = require("react/jsx-runtime");
13893
14002
  var HotkeyActionMenu = function(param) {
13894
14003
  var hotkeys = param.hotkeys;
13895
- (0, import_react12.useEffect)(function() {
14004
+ (0, import_react13.useEffect)(function() {
13896
14005
  var handleKeyDown = function(event) {
13897
14006
  hotkeys.forEach(function(hotkey) {
13898
14007
  if (event.key === hotkey.key) {
@@ -13928,7 +14037,7 @@ var HotkeyActionMenu = function(param) {
13928
14037
  });
13929
14038
  };
13930
14039
  // src/lib/toast.tsx
13931
- var import_react13 = require("react");
14040
+ var import_react14 = require("react");
13932
14041
  var import_react_toastify = require("react-toastify");
13933
14042
  var import_inject_style = require("react-toastify/dist/inject-style");
13934
14043
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -13950,7 +14059,7 @@ var useToast = function() {
13950
14059
  return toast;
13951
14060
  };
13952
14061
  var ToastContainer = function() {
13953
- (0, import_react13.useEffect)(function() {
14062
+ (0, import_react14.useEffect)(function() {
13954
14063
  (0, import_inject_style.injectStyle)();
13955
14064
  }, []);
13956
14065
  var pcb_viewer_id = useGlobalStore(function(s) {
@@ -13995,12 +14104,12 @@ var EditTraceHintOverlay = function(param) {
13995
14104
  var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
13996
14105
  var _containerRef_current;
13997
14106
  if (!transform) transform = (0, import_transformation_matrix6.identity)();
13998
- var containerRef = (0, import_react14.useRef)(null);
14107
+ var containerRef = (0, import_react15.useRef)(null);
13999
14108
  var containerBounds = (_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect();
14000
- var _ref = _sliced_to_array((0, import_react14.useState)(null), 2), selectedElement = _ref[0], setSelectedElement = _ref[1];
14109
+ var _ref = _sliced_to_array((0, import_react15.useState)(null), 2), selectedElement = _ref[0], setSelectedElement = _ref[1];
14001
14110
  var toast = useToast();
14002
- var _ref1 = _sliced_to_array((0, import_react14.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
14003
- var _ref2 = _sliced_to_array((0, import_react14.useState)(false), 2), shouldCreateAsVia = _ref2[0], setShouldCreateAsVia = _ref2[1];
14111
+ var _ref1 = _sliced_to_array((0, import_react15.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
14112
+ var _ref2 = _sliced_to_array((0, import_react15.useState)(false), 2), shouldCreateAsVia = _ref2[0], setShouldCreateAsVia = _ref2[1];
14004
14113
  var isElementSelected = selectedElement !== null;
14005
14114
  var in_edit_trace_mode = useGlobalStore(function(s) {
14006
14115
  return s.in_draw_trace_mode;
@@ -14011,7 +14120,7 @@ var EditTraceHintOverlay = function(param) {
14011
14120
  ogCenterScreen = (0, import_transformation_matrix6.applyToPoint)(transform, dragState === null || dragState === void 0 ? void 0 : dragState.originalCenter);
14012
14121
  dragEndScreen = (0, import_transformation_matrix6.applyToPoint)(transform, dragState === null || dragState === void 0 ? void 0 : dragState.dragEnd);
14013
14122
  }
14014
- (0, import_react14.useEffect)(function() {
14123
+ (0, import_react15.useEffect)(function() {
14015
14124
  var keyDown = function keyDown(e) {
14016
14125
  if (e.key === "Escape") {
14017
14126
  setSelectedElement(null);
@@ -14174,7 +14283,7 @@ var EditTraceHintOverlay = function(param) {
14174
14283
  }),
14175
14284
  dragState === null || dragState === void 0 ? void 0 : dragState.editEvent.route.map(function(r, i) {
14176
14285
  var rScreen = (0, import_transformation_matrix6.applyToPoint)(transform, r);
14177
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react14.Fragment, {
14286
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Fragment, {
14178
14287
  children: [
14179
14288
  r.via && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", {
14180
14289
  cx: rScreen.x,
@@ -14222,7 +14331,7 @@ var EditTraceHintOverlay = function(param) {
14222
14331
  var route = e.route;
14223
14332
  var pcb_port2 = (0, import_soup_util2.su)(soup).pcb_port.get(e.pcb_port_id);
14224
14333
  var pcb_port_screen = (0, import_transformation_matrix6.applyToPoint)(transform, pcb_port2);
14225
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react14.Fragment, {
14334
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Fragment, {
14226
14335
  children: [
14227
14336
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", {
14228
14337
  x: pcb_port_screen.x - 10,
@@ -14242,7 +14351,7 @@ var EditTraceHintOverlay = function(param) {
14242
14351
  route.map(function(r) {
14243
14352
  return _object_spread({}, r, (0, import_transformation_matrix6.applyToPoint)(transform, r));
14244
14353
  }).map(function(r, i) {
14245
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react14.Fragment, {
14354
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Fragment, {
14246
14355
  children: [
14247
14356
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", {
14248
14357
  cx: r.x,
@@ -14403,7 +14512,7 @@ function addInteractionMetadataToPrimitives(param) {
14403
14512
  var import_jsx_runtime13 = require("react/jsx-runtime");
14404
14513
  var CanvasElementsRenderer = function(props) {
14405
14514
  var transform = props.transform, elements = props.elements;
14406
- var _ref = _sliced_to_array((0, import_react16.useMemo)(function() {
14515
+ var _ref = _sliced_to_array((0, import_react17.useMemo)(function() {
14407
14516
  var primitivesWithoutInteractionMetadata2 = props.elements.flatMap(function(elm) {
14408
14517
  return convertElementToPrimitives(elm, props.elements);
14409
14518
  });
@@ -14415,7 +14524,7 @@ var CanvasElementsRenderer = function(props) {
14415
14524
  }, [
14416
14525
  props.elements
14417
14526
  ]), 2), primitivesWithoutInteractionMetadata = _ref[0], connectivityMap = _ref[1];
14418
- var _ref1 = _sliced_to_array((0, import_react15.useState)(primitivesWithoutInteractionMetadata), 2), primitives = _ref1[0], setPrimitives = _ref1[1];
14527
+ var _ref1 = _sliced_to_array((0, import_react16.useState)(primitivesWithoutInteractionMetadata), 2), primitives = _ref1[0], setPrimitives = _ref1[1];
14419
14528
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MouseElementTracker, {
14420
14529
  transform: transform,
14421
14530
  primitives: primitivesWithoutInteractionMetadata,
@@ -14425,9 +14534,10 @@ var CanvasElementsRenderer = function(props) {
14425
14534
  try {
14426
14535
  for(var _iterator = primitivesHoveredOver[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
14427
14536
  var primitive = _step.value;
14428
- if (primitive._element && "pcb_port_id" in primitive._element) {
14537
+ if (primitive._element) {
14429
14538
  var _primitiveIdsInMousedOverNet;
14430
- var connectedPrimitivesList = connectivityMap.getNetConnectedToId(primitive._element.pcb_port_id);
14539
+ var _primitive__element, _primitive__element1;
14540
+ var connectedPrimitivesList = connectivityMap.getNetConnectedToId("pcb_port_id" in primitive._element ? (_primitive__element = primitive._element) === null || _primitive__element === void 0 ? void 0 : _primitive__element.pcb_port_id : "pcb_trace_id" in primitive._element ? (_primitive__element1 = primitive._element) === null || _primitive__element1 === void 0 ? void 0 : _primitive__element1.pcb_trace_id : "");
14431
14541
  (_primitiveIdsInMousedOverNet = primitiveIdsInMousedOverNet).push.apply(_primitiveIdsInMousedOverNet, _to_consumable_array(connectivityMap.getIdsConnectedToNet(connectedPrimitivesList)));
14432
14542
  }
14433
14543
  }
@@ -14500,11 +14610,11 @@ var import_use_mouse_matrix_transform = __toESM(require_dist2());
14500
14610
  var noop = function noop() {};
14501
14611
  var isBrowser = typeof window !== "undefined";
14502
14612
  // node_modules/react-use/esm/useIsomorphicLayoutEffect.js
14503
- var import_react17 = require("react");
14504
- var useIsomorphicLayoutEffect = isBrowser ? import_react17.useLayoutEffect : import_react17.useEffect;
14613
+ var import_react18 = require("react");
14614
+ var useIsomorphicLayoutEffect = isBrowser ? import_react18.useLayoutEffect : import_react18.useEffect;
14505
14615
  var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
14506
14616
  // node_modules/react-use/esm/useMeasure.js
14507
- var import_react18 = require("react");
14617
+ var import_react19 = require("react");
14508
14618
  var defaultState = {
14509
14619
  x: 0,
14510
14620
  y: 0,
@@ -14516,9 +14626,9 @@ var defaultState = {
14516
14626
  right: 0
14517
14627
  };
14518
14628
  function useMeasure() {
14519
- var _a = (0, import_react18.useState)(null), element = _a[0], ref = _a[1];
14520
- var _b = (0, import_react18.useState)(defaultState), rect = _b[0], setRect = _b[1];
14521
- var observer = (0, import_react18.useMemo)(function() {
14629
+ var _a = (0, import_react19.useState)(null), element = _a[0], ref = _a[1];
14630
+ var _b = (0, import_react19.useState)(defaultState), rect = _b[0], setRect = _b[1];
14631
+ var observer = (0, import_react19.useMemo)(function() {
14522
14632
  return new window.ResizeObserver(function(entries) {
14523
14633
  if (entries[0]) {
14524
14634
  var _a2 = entries[0].contentRect, x = _a2.x, y = _a2.y, width = _a2.width, height = _a2.height, top_1 = _a2.top, left = _a2.left, bottom = _a2.bottom, right = _a2.right;
@@ -14627,16 +14737,16 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
14627
14737
  var defaultTransform = (0, import_transformation_matrix9.compose)((0, import_transformation_matrix9.translate)(400, 300), (0, import_transformation_matrix9.scale)(40, -40));
14628
14738
  var PCBViewer = function(param) {
14629
14739
  var children = param.children, soup = param.soup, _param_height = param.height, height = _param_height === void 0 ? 600 : _param_height, initialState = param.initialState, _param_allowEditing = param.allowEditing, allowEditing = _param_allowEditing === void 0 ? true : _param_allowEditing, editEventsProp = param.editEvents, onEditEventsChanged = param.onEditEventsChanged;
14630
- var _ref = _sliced_to_array((0, import_react19.useState)([]), 2), stateElements = _ref[0], setStateElements = _ref[1];
14740
+ var _ref = _sliced_to_array((0, import_react20.useState)([]), 2), stateElements = _ref[0], setStateElements = _ref[1];
14631
14741
  var _useMeasure_default = _sliced_to_array(useMeasure_default(), 2), ref = _useMeasure_default[0], refDimensions = _useMeasure_default[1];
14632
- var _ref1 = _sliced_to_array((0, import_react19.useState)(defaultTransform), 2), transform = _ref1[0], setTransformInternal = _ref1[1];
14742
+ var _ref1 = _sliced_to_array((0, import_react20.useState)(defaultTransform), 2), transform = _ref1[0], setTransformInternal = _ref1[1];
14633
14743
  var _ref2 = (0, import_use_mouse_matrix_transform.default)({
14634
14744
  transform: transform,
14635
14745
  onSetTransform: setTransformInternal
14636
14746
  }), transformRef = _ref2.ref, setTransform = _ref2.setTransform, cancelPanDrag = _ref2.cancelDrag;
14637
- var _ref3 = _sliced_to_array((0, import_react19.useState)([]), 2), editEvents = _ref3[0], setEditEvents = _ref3[1];
14747
+ var _ref3 = _sliced_to_array((0, import_react20.useState)([]), 2), editEvents = _ref3[0], setEditEvents = _ref3[1];
14638
14748
  editEvents = editEventsProp !== null && editEventsProp !== void 0 ? editEventsProp : editEvents;
14639
- var _ref4 = _sliced_to_array((0, import_react19.useState)(null), 2), error = _ref4[0], setError = _ref4[1];
14749
+ var _ref4 = _sliced_to_array((0, import_react20.useState)(null), 2), error = _ref4[0], setError = _ref4[1];
14640
14750
  var resetTransform = function() {
14641
14751
  var elmBounds = (refDimensions === null || refDimensions === void 0 ? void 0 : refDimensions.width) > 0 ? refDimensions : {
14642
14752
  width: 500,
@@ -14660,7 +14770,7 @@ var PCBViewer = function(param) {
14660
14770
  setTransform((0, import_transformation_matrix9.compose)((0, import_transformation_matrix9.translate)(((_elmBounds_width1 = elmBounds.width) !== null && _elmBounds_width1 !== void 0 ? _elmBounds_width1 : 0) / 2, ((_elmBounds_height1 = elmBounds.height) !== null && _elmBounds_height1 !== void 0 ? _elmBounds_height1 : 0) / 2), // translate(100, 0),
14661
14771
  (0, import_transformation_matrix9.scale)(scaleFactor, -scaleFactor, 0, 0), (0, import_transformation_matrix9.translate)(-center.x, -center.y)));
14662
14772
  };
14663
- (0, import_react19.useEffect)(function() {
14773
+ (0, import_react20.useEffect)(function() {
14664
14774
  var doRender = function doRender() {
14665
14775
  return _doRender.apply(this, arguments);
14666
14776
  };
@@ -14696,7 +14806,7 @@ var PCBViewer = function(param) {
14696
14806
  }, [
14697
14807
  children
14698
14808
  ]);
14699
- (0, import_react19.useEffect)(function() {
14809
+ (0, import_react20.useEffect)(function() {
14700
14810
  if (refDimensions && refDimensions.width !== 0 && (children || soup)) {
14701
14811
  resetTransform();
14702
14812
  }
@@ -14717,7 +14827,7 @@ var PCBViewer = function(param) {
14717
14827
  var pcbElmsPreEdit = (soup !== null && soup !== void 0 ? soup : stateElements).filter(function(e) {
14718
14828
  return e.type.startsWith("pcb_") || e.type.startsWith("source_");
14719
14829
  });
14720
- var elements = (0, import_react19.useMemo)(function() {
14830
+ var elements = (0, import_react20.useMemo)(function() {
14721
14831
  return applyEditEvents(pcbElmsPreEdit, editEvents);
14722
14832
  }, [
14723
14833
  pcbElmsPreEdit,