@eveshipfit/ui-ingame 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1004 @@
1
+ import './style.css';
2
+ import { c } from "react/compiler-runtime";
3
+ import { useEffect, useId, useRef, useState } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { useImages } from "@eveshipfit/react-hooks";
6
+ //#region src/primitives/Dialog/Dialog.module.css
7
+ var Dialog_module_default = {
8
+ "close": "kwi1cG_close",
9
+ "content": "kwi1cG_content",
10
+ "dialog": "kwi1cG_dialog",
11
+ "header": "kwi1cG_header",
12
+ "title": "kwi1cG_title"
13
+ };
14
+ //#endregion
15
+ //#region src/primitives/Dialog/Dialog.tsx
16
+ /** A modal; `onClose` is called when the user closes it, by Escape or the close button. */
17
+ function Dialog(t0) {
18
+ const $ = c(22);
19
+ const { open, title, onClose, children } = t0;
20
+ const dialog = useRef(null);
21
+ const titleId = useId();
22
+ let t1;
23
+ let t2;
24
+ if ($[0] !== open) {
25
+ t1 = () => {
26
+ const element = dialog.current;
27
+ if (element === null) return;
28
+ if (open && !element.open) element.showModal();
29
+ if (!open && element.open) element.close();
30
+ };
31
+ t2 = [open];
32
+ $[0] = open;
33
+ $[1] = t1;
34
+ $[2] = t2;
35
+ } else {
36
+ t1 = $[1];
37
+ t2 = $[2];
38
+ }
39
+ useEffect(t1, t2);
40
+ let t3;
41
+ if ($[3] !== onClose || $[4] !== open) {
42
+ t3 = () => {
43
+ if (open) onClose();
44
+ };
45
+ $[3] = onClose;
46
+ $[4] = open;
47
+ $[5] = t3;
48
+ } else t3 = $[5];
49
+ let t4;
50
+ if ($[6] !== title || $[7] !== titleId) {
51
+ t4 = /* @__PURE__ */ jsx("h2", {
52
+ id: titleId,
53
+ className: Dialog_module_default.title,
54
+ children: title
55
+ });
56
+ $[6] = title;
57
+ $[7] = titleId;
58
+ $[8] = t4;
59
+ } else t4 = $[8];
60
+ let t5;
61
+ if ($[9] !== onClose) {
62
+ t5 = /* @__PURE__ */ jsx("button", {
63
+ type: "button",
64
+ className: Dialog_module_default.close,
65
+ "aria-label": "Close",
66
+ onClick: onClose,
67
+ children: "×"
68
+ });
69
+ $[9] = onClose;
70
+ $[10] = t5;
71
+ } else t5 = $[10];
72
+ let t6;
73
+ if ($[11] !== t4 || $[12] !== t5) {
74
+ t6 = /* @__PURE__ */ jsxs("header", {
75
+ className: Dialog_module_default.header,
76
+ children: [t4, t5]
77
+ });
78
+ $[11] = t4;
79
+ $[12] = t5;
80
+ $[13] = t6;
81
+ } else t6 = $[13];
82
+ let t7;
83
+ if ($[14] !== children || $[15] !== open) {
84
+ t7 = open && /* @__PURE__ */ jsx("div", {
85
+ className: Dialog_module_default.content,
86
+ children
87
+ });
88
+ $[14] = children;
89
+ $[15] = open;
90
+ $[16] = t7;
91
+ } else t7 = $[16];
92
+ let t8;
93
+ if ($[17] !== t3 || $[18] !== t6 || $[19] !== t7 || $[20] !== titleId) {
94
+ t8 = /* @__PURE__ */ jsxs("dialog", {
95
+ ref: dialog,
96
+ className: Dialog_module_default.dialog,
97
+ "aria-labelledby": titleId,
98
+ onClose: t3,
99
+ children: [t6, t7]
100
+ });
101
+ $[17] = t3;
102
+ $[18] = t6;
103
+ $[19] = t7;
104
+ $[20] = titleId;
105
+ $[21] = t8;
106
+ } else t8 = $[21];
107
+ return t8;
108
+ }
109
+ //#endregion
110
+ //#region src/primitives/TypeIcon/TypeIcon.module.css
111
+ var TypeIcon_module_default = {
112
+ "icon": "a4KCwW_icon",
113
+ "marker": "a4KCwW_marker"
114
+ };
115
+ //#endregion
116
+ //#region src/primitives/TypeIcon/TypeIcon.tsx
117
+ function TypeIcon(t0) {
118
+ const $ = c(17);
119
+ const { typeId, size: t1, marker: t2 } = t0;
120
+ const size = t1 === void 0 ? 32 : t1;
121
+ const marker = t2 === void 0 ? true : t2;
122
+ const images = useImages();
123
+ let markerLayer;
124
+ let t3;
125
+ let t4;
126
+ let t5;
127
+ if ($[0] !== images || $[1] !== marker || $[2] !== size || $[3] !== typeId) {
128
+ const layers = images.typeIcon(typeId, { marker: false }) ?? [];
129
+ markerLayer = marker ? images.typeIcon(typeId)?.[layers.length] : void 0;
130
+ t3 = TypeIcon_module_default.icon;
131
+ const t6 = `${size}px`;
132
+ let t7;
133
+ if ($[8] !== t6) {
134
+ t7 = { "--size": t6 };
135
+ $[8] = t6;
136
+ $[9] = t7;
137
+ } else t7 = $[9];
138
+ t4 = t7;
139
+ t5 = layers.map(_temp);
140
+ $[0] = images;
141
+ $[1] = marker;
142
+ $[2] = size;
143
+ $[3] = typeId;
144
+ $[4] = markerLayer;
145
+ $[5] = t3;
146
+ $[6] = t4;
147
+ $[7] = t5;
148
+ } else {
149
+ markerLayer = $[4];
150
+ t3 = $[5];
151
+ t4 = $[6];
152
+ t5 = $[7];
153
+ }
154
+ let t6;
155
+ if ($[10] !== markerLayer) {
156
+ t6 = markerLayer && /* @__PURE__ */ jsx("img", {
157
+ className: TypeIcon_module_default.marker,
158
+ src: markerLayer.src,
159
+ alt: "",
160
+ loading: "lazy",
161
+ draggable: false
162
+ });
163
+ $[10] = markerLayer;
164
+ $[11] = t6;
165
+ } else t6 = $[11];
166
+ let t7;
167
+ if ($[12] !== t3 || $[13] !== t4 || $[14] !== t5 || $[15] !== t6) {
168
+ t7 = /* @__PURE__ */ jsxs("span", {
169
+ className: t3,
170
+ style: t4,
171
+ children: [t5, t6]
172
+ });
173
+ $[12] = t3;
174
+ $[13] = t4;
175
+ $[14] = t5;
176
+ $[15] = t6;
177
+ $[16] = t7;
178
+ } else t7 = $[16];
179
+ return t7;
180
+ }
181
+ function _temp(layer) {
182
+ return /* @__PURE__ */ jsx("img", {
183
+ src: layer.src,
184
+ "data-additive": layer.additive,
185
+ alt: "",
186
+ loading: "lazy",
187
+ draggable: false
188
+ }, layer.src);
189
+ }
190
+ //#endregion
191
+ //#region src/primitives/TreeList/TreeList.module.css
192
+ var TreeList_module_default = {
193
+ "chevron": "ZoSRha_chevron",
194
+ "group": "ZoSRha_group",
195
+ "label": "ZoSRha_label",
196
+ "row": "ZoSRha_row",
197
+ "tree": "ZoSRha_tree"
198
+ };
199
+ //#endregion
200
+ //#region src/primitives/TreeList/TreeList.tsx
201
+ function TreeList(t0) {
202
+ const $ = c(3);
203
+ const { label, children } = t0;
204
+ let t1;
205
+ if ($[0] !== children || $[1] !== label) {
206
+ t1 = /* @__PURE__ */ jsx("ul", {
207
+ className: TreeList_module_default.tree,
208
+ "aria-label": label,
209
+ children
210
+ });
211
+ $[0] = children;
212
+ $[1] = label;
213
+ $[2] = t1;
214
+ } else t1 = $[2];
215
+ return t1;
216
+ }
217
+ function TreeGroup(t0) {
218
+ const $ = c(13);
219
+ const { label, defaultOpen: t1, children } = t0;
220
+ const [open, setOpen] = useState(t1 === void 0 ? false : t1);
221
+ let t2;
222
+ if ($[0] !== open) {
223
+ t2 = () => setOpen(!open);
224
+ $[0] = open;
225
+ $[1] = t2;
226
+ } else t2 = $[1];
227
+ let t3;
228
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
229
+ t3 = /* @__PURE__ */ jsx("svg", {
230
+ className: TreeList_module_default.chevron,
231
+ viewBox: "0 0 12 12",
232
+ width: 12,
233
+ height: 12,
234
+ "aria-hidden": true,
235
+ children: /* @__PURE__ */ jsx("path", {
236
+ d: "M3 1.5 9.5 6 3 10.5Z",
237
+ fill: "currentColor"
238
+ })
239
+ });
240
+ $[2] = t3;
241
+ } else t3 = $[2];
242
+ let t4;
243
+ if ($[3] !== label || $[4] !== open || $[5] !== t2) {
244
+ t4 = /* @__PURE__ */ jsxs("button", {
245
+ type: "button",
246
+ className: TreeList_module_default.row,
247
+ "aria-expanded": open,
248
+ onClick: t2,
249
+ children: [t3, label]
250
+ });
251
+ $[3] = label;
252
+ $[4] = open;
253
+ $[5] = t2;
254
+ $[6] = t4;
255
+ } else t4 = $[6];
256
+ let t5;
257
+ if ($[7] !== children || $[8] !== open) {
258
+ t5 = open && /* @__PURE__ */ jsx("ul", {
259
+ className: TreeList_module_default.group,
260
+ children: children()
261
+ });
262
+ $[7] = children;
263
+ $[8] = open;
264
+ $[9] = t5;
265
+ } else t5 = $[9];
266
+ let t6;
267
+ if ($[10] !== t4 || $[11] !== t5) {
268
+ t6 = /* @__PURE__ */ jsxs("li", { children: [t4, t5] });
269
+ $[10] = t4;
270
+ $[11] = t5;
271
+ $[12] = t6;
272
+ } else t6 = $[12];
273
+ return t6;
274
+ }
275
+ /** Activates on double click, as EVE's own lists do; single clicks are for selecting text and dragging. */
276
+ function TreeLeaf(t0) {
277
+ const $ = c(21);
278
+ const { label, typeId, title, onActivate, onHover, onDragStart, onDragEnd, after } = t0;
279
+ const t1 = onDragStart !== void 0;
280
+ let t2;
281
+ if ($[0] !== onActivate) {
282
+ t2 = (event) => {
283
+ if (event.key === "Enter") onActivate?.();
284
+ };
285
+ $[0] = onActivate;
286
+ $[1] = t2;
287
+ } else t2 = $[1];
288
+ let t3;
289
+ let t4;
290
+ if ($[2] !== onHover) {
291
+ t3 = () => onHover?.(true);
292
+ t4 = () => onHover?.(false);
293
+ $[2] = onHover;
294
+ $[3] = t3;
295
+ $[4] = t4;
296
+ } else {
297
+ t3 = $[3];
298
+ t4 = $[4];
299
+ }
300
+ let t5;
301
+ if ($[5] !== typeId) {
302
+ t5 = typeId !== void 0 && /* @__PURE__ */ jsx(TypeIcon, {
303
+ typeId,
304
+ size: 20
305
+ });
306
+ $[5] = typeId;
307
+ $[6] = t5;
308
+ } else t5 = $[6];
309
+ let t6;
310
+ if ($[7] !== label) {
311
+ t6 = /* @__PURE__ */ jsx("span", {
312
+ className: TreeList_module_default.label,
313
+ children: label
314
+ });
315
+ $[7] = label;
316
+ $[8] = t6;
317
+ } else t6 = $[8];
318
+ let t7;
319
+ if ($[9] !== after || $[10] !== onActivate || $[11] !== onDragEnd || $[12] !== onDragStart || $[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6 || $[19] !== title) {
320
+ t7 = /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("div", {
321
+ role: "button",
322
+ tabIndex: 0,
323
+ className: TreeList_module_default.row,
324
+ title,
325
+ draggable: t1,
326
+ onDoubleClick: onActivate,
327
+ onKeyDown: t2,
328
+ onMouseEnter: t3,
329
+ onMouseLeave: t4,
330
+ onDragStart,
331
+ onDragEnd,
332
+ children: [
333
+ t5,
334
+ t6,
335
+ after
336
+ ]
337
+ }) });
338
+ $[9] = after;
339
+ $[10] = onActivate;
340
+ $[11] = onDragEnd;
341
+ $[12] = onDragStart;
342
+ $[13] = t1;
343
+ $[14] = t2;
344
+ $[15] = t3;
345
+ $[16] = t4;
346
+ $[17] = t5;
347
+ $[18] = t6;
348
+ $[19] = title;
349
+ $[20] = t7;
350
+ } else t7 = $[20];
351
+ return t7;
352
+ }
353
+ //#endregion
354
+ //#region src/primitives/Icon/Icon.module.css
355
+ var Icon_module_default = { "icon": "CUz0fa_icon" };
356
+ //#endregion
357
+ //#region src/primitives/Icon/Icon.tsx
358
+ const textures = {
359
+ "hardpoint-turret": "classes/fitting/iconturrethardpoint",
360
+ "hardpoint-launcher": "classes/fitting/iconlauncherhardpoint",
361
+ "slot-high": "classes/fitting/filtericonhighslot_32",
362
+ "slot-medium": "classes/fitting/filtericonmediumslot_32",
363
+ "slot-low": "classes/fitting/filtericonlowslot",
364
+ "slot-rig": "classes/fitting/filtericonrigslot",
365
+ "slot-subsystem": "windowicons/subsystems"
366
+ };
367
+ const iconNames = Object.keys(textures);
368
+ function Icon(t0) {
369
+ const $ = c(7);
370
+ const { name, size: t1 } = t0;
371
+ const size = t1 === void 0 ? 16 : t1;
372
+ const images = useImages();
373
+ let t2;
374
+ if ($[0] !== images || $[1] !== name) {
375
+ t2 = images.uiTexture(textures[name]);
376
+ $[0] = images;
377
+ $[1] = name;
378
+ $[2] = t2;
379
+ } else t2 = $[2];
380
+ let t3;
381
+ if ($[3] !== name || $[4] !== size || $[5] !== t2) {
382
+ t3 = /* @__PURE__ */ jsx("img", {
383
+ className: Icon_module_default.icon,
384
+ src: t2,
385
+ width: size,
386
+ height: size,
387
+ alt: "",
388
+ "data-icon": name,
389
+ draggable: false
390
+ });
391
+ $[3] = name;
392
+ $[4] = size;
393
+ $[5] = t2;
394
+ $[6] = t3;
395
+ } else t3 = $[6];
396
+ return t3;
397
+ }
398
+ //#endregion
399
+ //#region src/primitives/Wheel/layout.ts
400
+ /** In degrees, measured from EVE's fitting window. */
401
+ const racks = {
402
+ high: {
403
+ size: 8,
404
+ first: -35.1,
405
+ step: 10.25
406
+ },
407
+ medium: {
408
+ size: 8,
409
+ first: 54,
410
+ step: 10.25
411
+ },
412
+ low: {
413
+ size: 8,
414
+ first: 142.9,
415
+ step: 10.25
416
+ },
417
+ rig: {
418
+ size: 3,
419
+ first: -73.25,
420
+ step: 10.25
421
+ },
422
+ subsystem: {
423
+ size: 4,
424
+ first: -126.5,
425
+ step: 12.667
426
+ }
427
+ };
428
+ function rackSize(rack) {
429
+ return racks[rack].size;
430
+ }
431
+ function slotAngle(rack, index) {
432
+ return racks[rack].first + index * racks[rack].step;
433
+ }
434
+ //#endregion
435
+ //#region src/primitives/Wheel/Wheel.module.css
436
+ var Wheel_module_default = {
437
+ "edges": "LIeaFq_edges",
438
+ "rings": "LIeaFq_rings",
439
+ "scales": "LIeaFq_scales",
440
+ "wheel": "LIeaFq_wheel"
441
+ };
442
+ //#endregion
443
+ //#region src/primitives/Wheel/Wheel.tsx
444
+ /** Square, and as wide as `--esf-wheel-size`. */
445
+ function Wheel(t0) {
446
+ const $ = c(14);
447
+ const { label, children } = t0;
448
+ const images = useImages();
449
+ let t1;
450
+ if ($[0] !== images) {
451
+ t1 = (name) => ({ "--texture": `url(${images.uiTexture(name)})` });
452
+ $[0] = images;
453
+ $[1] = t1;
454
+ } else t1 = $[1];
455
+ const texture = t1;
456
+ let t2;
457
+ if ($[2] !== texture) {
458
+ t2 = /* @__PURE__ */ jsx("div", {
459
+ className: Wheel_module_default.rings,
460
+ style: texture("classes/fitting/fittingbase")
461
+ });
462
+ $[2] = texture;
463
+ $[3] = t2;
464
+ } else t2 = $[3];
465
+ let t3;
466
+ if ($[4] !== texture) {
467
+ t3 = /* @__PURE__ */ jsx("div", {
468
+ className: Wheel_module_default.edges,
469
+ style: texture("classes/fitting/fittingbase_dotproduct")
470
+ });
471
+ $[4] = texture;
472
+ $[5] = t3;
473
+ } else t3 = $[5];
474
+ let t4;
475
+ if ($[6] !== texture) {
476
+ t4 = /* @__PURE__ */ jsx("div", {
477
+ className: Wheel_module_default.scales,
478
+ style: texture("classes/fitting/fittingbase_overlay")
479
+ });
480
+ $[6] = texture;
481
+ $[7] = t4;
482
+ } else t4 = $[7];
483
+ let t5;
484
+ if ($[8] !== children || $[9] !== label || $[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
485
+ t5 = /* @__PURE__ */ jsxs("section", {
486
+ className: Wheel_module_default.wheel,
487
+ "aria-label": label,
488
+ children: [
489
+ t2,
490
+ t3,
491
+ children,
492
+ t4
493
+ ]
494
+ });
495
+ $[8] = children;
496
+ $[9] = label;
497
+ $[10] = t2;
498
+ $[11] = t3;
499
+ $[12] = t4;
500
+ $[13] = t5;
501
+ } else t5 = $[13];
502
+ return t5;
503
+ }
504
+ /** `angle` in degrees clockwise from the top, as CSS rotations go. */
505
+ function polar(angle, radius) {
506
+ const radians = angle * Math.PI / 180;
507
+ return {
508
+ x: round(radius * Math.sin(radians)),
509
+ y: round(-radius * Math.cos(radians))
510
+ };
511
+ }
512
+ /** Where an element's centre goes, in percentages of the wheel. */
513
+ function placeAt(angle, radius) {
514
+ const { x, y } = polar(angle, radius);
515
+ return {
516
+ left: `${round(50 + x / 232 * 50)}%`,
517
+ top: `${round(50 + y / 232 * 50)}%`
518
+ };
519
+ }
520
+ function round(value) {
521
+ return Math.round(value * 1e3) / 1e3 + 0;
522
+ }
523
+ //#endregion
524
+ //#region src/primitives/Wheel/WheelRackMarker.module.css
525
+ var WheelRackMarker_module_default = { "marker": "oAgQCG_marker" };
526
+ //#endregion
527
+ //#region src/primitives/Wheel/WheelRackMarker.tsx
528
+ const markers = {
529
+ high: {
530
+ angle: -43,
531
+ texture: "classes/radialmenu/fitting/high"
532
+ },
533
+ medium: {
534
+ angle: 45,
535
+ texture: "classes/radialmenu/fitting/med"
536
+ },
537
+ low: {
538
+ angle: 135,
539
+ texture: "classes/radialmenu/fitting/low"
540
+ }
541
+ };
542
+ function WheelRackMarker(t0) {
543
+ const $ = c(9);
544
+ const { rack } = t0;
545
+ const images = useImages();
546
+ const { angle, texture } = markers[rack];
547
+ let t1;
548
+ if ($[0] !== angle) {
549
+ t1 = placeAt(angle, 197);
550
+ $[0] = angle;
551
+ $[1] = t1;
552
+ } else t1 = $[1];
553
+ let t2;
554
+ if ($[2] !== images || $[3] !== texture) {
555
+ t2 = images.uiTexture(texture);
556
+ $[2] = images;
557
+ $[3] = texture;
558
+ $[4] = t2;
559
+ } else t2 = $[4];
560
+ let t3;
561
+ if ($[5] !== rack || $[6] !== t1 || $[7] !== t2) {
562
+ t3 = /* @__PURE__ */ jsx("img", {
563
+ className: WheelRackMarker_module_default.marker,
564
+ style: t1,
565
+ src: t2,
566
+ alt: "",
567
+ "data-marker": rack,
568
+ draggable: false
569
+ });
570
+ $[5] = rack;
571
+ $[6] = t1;
572
+ $[7] = t2;
573
+ $[8] = t3;
574
+ } else t3 = $[8];
575
+ return t3;
576
+ }
577
+ //#endregion
578
+ //#region src/primitives/Wheel/WheelSlot.module.css
579
+ var WheelSlot_module_default = {
580
+ "ammo": "T6VD6G_ammo",
581
+ "empty": "T6VD6G_empty",
582
+ "fill": "T6VD6G_fill",
583
+ "frame": "T6VD6G_frame",
584
+ "icon": "T6VD6G_icon",
585
+ "slot": "T6VD6G_slot"
586
+ };
587
+ //#endregion
588
+ //#region src/primitives/Wheel/WheelSlot.tsx
589
+ /** Measured from EVE. */
590
+ const box = {
591
+ "--slot-size": 49,
592
+ "--slot-centre": 193,
593
+ "--slot-icon-centre": 195
594
+ };
595
+ const ammoBars = [
596
+ -3.6,
597
+ -1.2,
598
+ 1.2,
599
+ 3.6
600
+ ];
601
+ const emptyIconScale = { rig: 1.2 };
602
+ function WheelSlot(t0) {
603
+ const $ = c(47);
604
+ let angle;
605
+ let chargeTypeId;
606
+ let className;
607
+ let props;
608
+ let rack;
609
+ let style;
610
+ let t1;
611
+ let t2;
612
+ let t3;
613
+ let t4;
614
+ let t5;
615
+ let typeId;
616
+ if ($[0] !== t0) {
617
+ ({rack, angle, typeId, chargeTypeId, chargeable: t1, state: t2, activatable: t3, available: t4, preview: t5, className, style, ...props} = t0);
618
+ $[0] = t0;
619
+ $[1] = angle;
620
+ $[2] = chargeTypeId;
621
+ $[3] = className;
622
+ $[4] = props;
623
+ $[5] = rack;
624
+ $[6] = style;
625
+ $[7] = t1;
626
+ $[8] = t2;
627
+ $[9] = t3;
628
+ $[10] = t4;
629
+ $[11] = t5;
630
+ $[12] = typeId;
631
+ } else {
632
+ angle = $[1];
633
+ chargeTypeId = $[2];
634
+ className = $[3];
635
+ props = $[4];
636
+ rack = $[5];
637
+ style = $[6];
638
+ t1 = $[7];
639
+ t2 = $[8];
640
+ t3 = $[9];
641
+ t4 = $[10];
642
+ t5 = $[11];
643
+ typeId = $[12];
644
+ }
645
+ const chargeable = t1 === void 0 ? false : t1;
646
+ const state = t2 === void 0 ? "online" : t2;
647
+ const activatable = t3 === void 0 ? false : t3;
648
+ const available = t4 === void 0 ? true : t4;
649
+ const preview = t5 === void 0 ? false : t5;
650
+ const images = useImages();
651
+ let t6;
652
+ if ($[13] !== images) {
653
+ t6 = (name) => ({ "--texture": `url(${images.uiTexture(name)})` });
654
+ $[13] = images;
655
+ $[14] = t6;
656
+ } else t6 = $[14];
657
+ const texture = t6;
658
+ const fitted = typeId !== void 0;
659
+ const iconTypeId = chargeTypeId ?? typeId;
660
+ let t7;
661
+ if ($[15] !== className) {
662
+ t7 = [WheelSlot_module_default.slot, className].filter(Boolean);
663
+ $[15] = className;
664
+ $[16] = t7;
665
+ } else t7 = $[16];
666
+ const t8 = t7.join(" ");
667
+ const t9 = `${angle}deg`;
668
+ let t10;
669
+ if ($[17] !== style || $[18] !== t9) {
670
+ t10 = {
671
+ ...box,
672
+ "--angle": t9,
673
+ ...style
674
+ };
675
+ $[17] = style;
676
+ $[18] = t9;
677
+ $[19] = t10;
678
+ } else t10 = $[19];
679
+ const t11 = t10;
680
+ const t12 = fitted ? state : available ? "empty" : "unavailable";
681
+ const t13 = preview || void 0;
682
+ let t14;
683
+ if ($[20] !== fitted || $[21] !== texture) {
684
+ t14 = fitted && /* @__PURE__ */ jsx("span", {
685
+ className: WheelSlot_module_default.fill,
686
+ style: texture("classes/fitting/moduleslotfill")
687
+ });
688
+ $[20] = fitted;
689
+ $[21] = texture;
690
+ $[22] = t14;
691
+ } else t14 = $[22];
692
+ let t15;
693
+ if ($[23] !== activatable || $[24] !== fitted || $[25] !== preview || $[26] !== state || $[27] !== texture) {
694
+ t15 = /* @__PURE__ */ jsx("span", {
695
+ className: WheelSlot_module_default.frame,
696
+ style: texture(frameTexture(fitted, preview, state, activatable))
697
+ });
698
+ $[23] = activatable;
699
+ $[24] = fitted;
700
+ $[25] = preview;
701
+ $[26] = state;
702
+ $[27] = texture;
703
+ $[28] = t15;
704
+ } else t15 = $[28];
705
+ let t16;
706
+ if ($[29] !== chargeTypeId || $[30] !== chargeable || $[31] !== fitted) {
707
+ t16 = fitted && chargeable && ammoBars.map((offset) => /* @__PURE__ */ jsx("span", {
708
+ className: WheelSlot_module_default.ammo,
709
+ style: { "--offset": `${offset}deg` },
710
+ "data-loaded": chargeTypeId !== void 0 || void 0
711
+ }, offset));
712
+ $[29] = chargeTypeId;
713
+ $[30] = chargeable;
714
+ $[31] = fitted;
715
+ $[32] = t16;
716
+ } else t16 = $[32];
717
+ let t17;
718
+ if ($[33] !== available || $[34] !== iconTypeId || $[35] !== rack) {
719
+ t17 = iconTypeId !== void 0 ? /* @__PURE__ */ jsx("span", {
720
+ className: WheelSlot_module_default.icon,
721
+ children: /* @__PURE__ */ jsx(TypeIcon, {
722
+ typeId: iconTypeId,
723
+ size: 64,
724
+ marker: false
725
+ })
726
+ }) : available && /* @__PURE__ */ jsx("span", {
727
+ className: WheelSlot_module_default.empty,
728
+ style: { scale: emptyIconScale[rack] },
729
+ children: /* @__PURE__ */ jsx(Icon, { name: `slot-${rack}` })
730
+ });
731
+ $[33] = available;
732
+ $[34] = iconTypeId;
733
+ $[35] = rack;
734
+ $[36] = t17;
735
+ } else t17 = $[36];
736
+ let t18;
737
+ if ($[37] !== props || $[38] !== t11 || $[39] !== t12 || $[40] !== t13 || $[41] !== t14 || $[42] !== t15 || $[43] !== t16 || $[44] !== t17 || $[45] !== t8) {
738
+ t18 = /* @__PURE__ */ jsxs("div", {
739
+ ...props,
740
+ className: t8,
741
+ style: t11,
742
+ "data-state": t12,
743
+ "data-preview": t13,
744
+ children: [
745
+ t14,
746
+ t15,
747
+ t16,
748
+ t17
749
+ ]
750
+ });
751
+ $[37] = props;
752
+ $[38] = t11;
753
+ $[39] = t12;
754
+ $[40] = t13;
755
+ $[41] = t14;
756
+ $[42] = t15;
757
+ $[43] = t16;
758
+ $[44] = t17;
759
+ $[45] = t8;
760
+ $[46] = t18;
761
+ } else t18 = $[46];
762
+ return t18;
763
+ }
764
+ function frameTexture(fitted, preview, state, activatable) {
765
+ if (!fitted) return "classes/fitting/moduleframe";
766
+ if (preview) return "classes/fitting/moduleframedots";
767
+ if (state === "overload") return "classes/fitting/slotoverheated";
768
+ return activatable ? "classes/fitting/slotactive" : "classes/fitting/slotpassive";
769
+ }
770
+ //#endregion
771
+ //#region src/primitives/Wheel/WheelHardpoints.module.css
772
+ var WheelHardpoints_module_default = {
773
+ "dot": "_-v7zG_dot",
774
+ "dots": "_-v7zG_dots",
775
+ "icon": "_-v7zG_icon"
776
+ };
777
+ //#endregion
778
+ //#region src/primitives/Wheel/WheelHardpoints.tsx
779
+ function WheelHardpoints(t0) {
780
+ const $ = c(10);
781
+ const { turrets, launchers } = t0;
782
+ const label = `Turret hardpoints: ${turrets.used} of ${turrets.total} used. Launcher hardpoints: ${launchers.used} of ${launchers.total} used.`;
783
+ let t1;
784
+ let t2;
785
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
786
+ t1 = /* @__PURE__ */ jsx(HardpointIcon, {
787
+ name: "hardpoint-turret",
788
+ angle: -43
789
+ });
790
+ t2 = /* @__PURE__ */ jsx(HardpointIcon, {
791
+ name: "hardpoint-launcher",
792
+ angle: 45
793
+ });
794
+ $[0] = t1;
795
+ $[1] = t2;
796
+ } else {
797
+ t1 = $[0];
798
+ t2 = $[1];
799
+ }
800
+ let t3;
801
+ if ($[2] !== turrets) {
802
+ t3 = /* @__PURE__ */ jsx(Dots, {
803
+ ...turrets,
804
+ first: -38.5,
805
+ step: 3
806
+ });
807
+ $[2] = turrets;
808
+ $[3] = t3;
809
+ } else t3 = $[3];
810
+ let t4;
811
+ if ($[4] !== launchers) {
812
+ t4 = /* @__PURE__ */ jsx(Dots, {
813
+ ...launchers,
814
+ first: 40.5,
815
+ step: -3
816
+ });
817
+ $[4] = launchers;
818
+ $[5] = t4;
819
+ } else t4 = $[5];
820
+ let t5;
821
+ if ($[6] !== label || $[7] !== t3 || $[8] !== t4) {
822
+ t5 = /* @__PURE__ */ jsxs(Fragment, { children: [
823
+ t1,
824
+ t2,
825
+ /* @__PURE__ */ jsxs("div", {
826
+ className: WheelHardpoints_module_default.dots,
827
+ role: "img",
828
+ "aria-label": label,
829
+ children: [t3, t4]
830
+ })
831
+ ] });
832
+ $[6] = label;
833
+ $[7] = t3;
834
+ $[8] = t4;
835
+ $[9] = t5;
836
+ } else t5 = $[9];
837
+ return t5;
838
+ }
839
+ function HardpointIcon(t0) {
840
+ const $ = c(7);
841
+ const { name, angle } = t0;
842
+ let t1;
843
+ if ($[0] !== angle) {
844
+ t1 = placeAt(angle, 223.5);
845
+ $[0] = angle;
846
+ $[1] = t1;
847
+ } else t1 = $[1];
848
+ let t2;
849
+ if ($[2] !== name) {
850
+ t2 = /* @__PURE__ */ jsx(Icon, { name });
851
+ $[2] = name;
852
+ $[3] = t2;
853
+ } else t2 = $[3];
854
+ let t3;
855
+ if ($[4] !== t1 || $[5] !== t2) {
856
+ t3 = /* @__PURE__ */ jsx("span", {
857
+ className: WheelHardpoints_module_default.icon,
858
+ style: t1,
859
+ children: t2
860
+ });
861
+ $[4] = t1;
862
+ $[5] = t2;
863
+ $[6] = t3;
864
+ } else t3 = $[6];
865
+ return t3;
866
+ }
867
+ function Dots(t0) {
868
+ const $ = c(11);
869
+ const { used, total, first, step } = t0;
870
+ const images = useImages();
871
+ let t1;
872
+ if ($[0] !== first || $[1] !== images || $[2] !== step || $[3] !== total || $[4] !== used) {
873
+ let t2;
874
+ if ($[6] !== first || $[7] !== images || $[8] !== step || $[9] !== used) {
875
+ t2 = (_, index) => /* @__PURE__ */ jsx("img", {
876
+ className: WheelHardpoints_module_default.dot,
877
+ style: placeAt(first + index * step, 224.5),
878
+ src: images.uiTexture(index < used ? "classes/fitting/slottaken" : "classes/fitting/slotleft"),
879
+ alt: "",
880
+ "data-used": index < used || void 0,
881
+ draggable: false
882
+ }, index);
883
+ $[6] = first;
884
+ $[7] = images;
885
+ $[8] = step;
886
+ $[9] = used;
887
+ $[10] = t2;
888
+ } else t2 = $[10];
889
+ t1 = Array.from({ length: total }, t2);
890
+ $[0] = first;
891
+ $[1] = images;
892
+ $[2] = step;
893
+ $[3] = total;
894
+ $[4] = used;
895
+ $[5] = t1;
896
+ } else t1 = $[5];
897
+ return t1;
898
+ }
899
+ //#endregion
900
+ //#region src/primitives/Wheel/WheelGauge.module.css
901
+ var WheelGauge_module_default = { "gauge": "pLDZ2W_gauge" };
902
+ //#endregion
903
+ //#region src/primitives/Wheel/WheelGauge.tsx
904
+ /**
905
+ * EVE has one gauge texture, CPU's; powergrid mirrors it and calibration turns it round. Angles are in the texture's
906
+ * own, measured from EVE; CPU starts half a degree early so its first mark sits beside powergrid's.
907
+ */
908
+ const gauges = {
909
+ cpu: {
910
+ name: "CPU",
911
+ turn: "none",
912
+ from: 134.5,
913
+ sweep: 44.3
914
+ },
915
+ powergrid: {
916
+ name: "Powergrid",
917
+ turn: "matrix(0, 1, 1, 0, 0, 0)",
918
+ from: 135,
919
+ sweep: 45
920
+ },
921
+ calibration: {
922
+ name: "Calibration",
923
+ turn: "rotate(180deg)",
924
+ from: 133,
925
+ sweep: 30.5
926
+ }
927
+ };
928
+ function WheelGauge(t0) {
929
+ const $ = c(14);
930
+ const { resource, used, total, valueText } = t0;
931
+ const images = useImages();
932
+ const { name, turn, from, sweep } = gauges[resource];
933
+ const to = from - sweep * (total > 0 ? Math.min(used / total, 1) : 0);
934
+ let t1;
935
+ if ($[0] !== images) {
936
+ t1 = images.uiTexture("classes/fitting/fittingbase_gauge");
937
+ $[0] = images;
938
+ $[1] = t1;
939
+ } else t1 = $[1];
940
+ const t2 = `url(${t1})`;
941
+ const t3 = `conic-gradient(transparent ${to}deg, black ${to}deg ${from}deg, transparent ${from}deg)`;
942
+ let t4;
943
+ if ($[2] !== t2 || $[3] !== t3 || $[4] !== turn) {
944
+ t4 = {
945
+ "--texture": t2,
946
+ "--used": t3,
947
+ "--turn": turn
948
+ };
949
+ $[2] = t2;
950
+ $[3] = t3;
951
+ $[4] = turn;
952
+ $[5] = t4;
953
+ } else t4 = $[5];
954
+ const t5 = t4;
955
+ const t6 = used > total || void 0;
956
+ let t7;
957
+ if ($[6] !== name || $[7] !== resource || $[8] !== t5 || $[9] !== t6 || $[10] !== total || $[11] !== used || $[12] !== valueText) {
958
+ t7 = /* @__PURE__ */ jsx("div", {
959
+ className: WheelGauge_module_default.gauge,
960
+ style: t5,
961
+ role: "meter",
962
+ "aria-label": name,
963
+ "aria-valuemin": 0,
964
+ "aria-valuemax": total,
965
+ "aria-valuenow": used,
966
+ "aria-valuetext": valueText,
967
+ "data-resource": resource,
968
+ "data-over": t6
969
+ });
970
+ $[6] = name;
971
+ $[7] = resource;
972
+ $[8] = t5;
973
+ $[9] = t6;
974
+ $[10] = total;
975
+ $[11] = used;
976
+ $[12] = valueText;
977
+ $[13] = t7;
978
+ } else t7 = $[13];
979
+ return t7;
980
+ }
981
+ //#endregion
982
+ //#region src/primitives/Wheel/WheelHull.module.css
983
+ var WheelHull_module_default = { "hull": "zDAPCG_hull" };
984
+ //#endregion
985
+ //#region src/primitives/Wheel/WheelHull.tsx
986
+ function WheelHull(t0) {
987
+ const $ = c(2);
988
+ const { typeId } = t0;
989
+ const t1 = `https://images.evetech.net/types/${typeId}/render?size=1024`;
990
+ let t2;
991
+ if ($[0] !== t1) {
992
+ t2 = /* @__PURE__ */ jsx("img", {
993
+ className: WheelHull_module_default.hull,
994
+ src: t1,
995
+ alt: "",
996
+ draggable: false
997
+ });
998
+ $[0] = t1;
999
+ $[1] = t2;
1000
+ } else t2 = $[1];
1001
+ return t2;
1002
+ }
1003
+ //#endregion
1004
+ export { Dialog, Icon, TreeGroup, TreeLeaf, TreeList, TypeIcon, Wheel, WheelGauge, WheelHardpoints, WheelHull, WheelRackMarker, WheelSlot, iconNames, rackSize, slotAngle };