@luxonis/depthai-viewer-common 3.8.1 → 3.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +104 -11
  2. package/dist/components/CTASubLabel.d.ts +10 -2
  3. package/dist/components/CTASubLabel.d.ts.map +1 -1
  4. package/dist/components/CTASubLabel.js +3 -0
  5. package/dist/components/CTASubLabel.js.map +1 -1
  6. package/dist/components/DepthAIContext.d.ts +25 -2
  7. package/dist/components/DepthAIContext.d.ts.map +1 -1
  8. package/dist/components/DepthAIContext.js +3 -0
  9. package/dist/components/DepthAIContext.js.map +1 -1
  10. package/dist/components/Pipeline.d.ts +19 -2
  11. package/dist/components/Pipeline.d.ts.map +1 -1
  12. package/dist/components/Pipeline.js +12 -0
  13. package/dist/components/Pipeline.js.map +1 -1
  14. package/dist/components/Resizable.d.ts +20 -0
  15. package/dist/components/Resizable.d.ts.map +1 -1
  16. package/dist/components/Resizable.js +8 -0
  17. package/dist/components/Resizable.js.map +1 -1
  18. package/dist/components/Streams.d.ts +100 -4
  19. package/dist/components/Streams.d.ts.map +1 -1
  20. package/dist/components/Streams.js +78 -17
  21. package/dist/components/Streams.js.map +1 -1
  22. package/dist/components/ThemeToggle.d.ts +8 -0
  23. package/dist/components/ThemeToggle.d.ts.map +1 -1
  24. package/dist/components/ThemeToggle.js +8 -0
  25. package/dist/components/ThemeToggle.js.map +1 -1
  26. package/dist/constants/connection.d.ts +27 -0
  27. package/dist/constants/connection.d.ts.map +1 -1
  28. package/dist/constants/connection.js +12 -0
  29. package/dist/constants/connection.js.map +1 -1
  30. package/dist/constants/streams.d.ts +9 -0
  31. package/dist/constants/streams.d.ts.map +1 -1
  32. package/dist/constants/streams.js +6 -0
  33. package/dist/constants/streams.js.map +1 -1
  34. package/dist/constants/url.d.ts +12 -0
  35. package/dist/constants/url.d.ts.map +1 -1
  36. package/dist/constants/url.js +12 -0
  37. package/dist/constants/url.js.map +1 -1
  38. package/dist/dai-connection/connection.d.ts +189 -2
  39. package/dist/dai-connection/connection.d.ts.map +1 -1
  40. package/dist/dai-connection/connection.js +121 -5
  41. package/dist/dai-connection/connection.js.map +1 -1
  42. package/dist/dai-connection/decoder.worker.d.ts +21 -0
  43. package/dist/dai-connection/decoder.worker.d.ts.map +1 -1
  44. package/dist/dai-connection/decoder.worker.js +6 -0
  45. package/dist/dai-connection/decoder.worker.js.map +1 -1
  46. package/dist/hooks/connection.d.ts +206 -0
  47. package/dist/hooks/connection.d.ts.map +1 -1
  48. package/dist/hooks/connection.js +22 -0
  49. package/dist/hooks/connection.js.map +1 -1
  50. package/dist/hooks/navigation.d.ts +5 -0
  51. package/dist/hooks/navigation.d.ts.map +1 -1
  52. package/dist/hooks/navigation.js +5 -0
  53. package/dist/hooks/navigation.js.map +1 -1
  54. package/dist/hooks/search.d.ts +12 -0
  55. package/dist/hooks/search.d.ts.map +1 -1
  56. package/dist/hooks/search.js +3 -0
  57. package/dist/hooks/search.js.map +1 -1
  58. package/dist/hooks/useFullScreen.d.ts +8 -0
  59. package/dist/hooks/useFullScreen.d.ts.map +1 -1
  60. package/dist/hooks/useFullScreen.js +8 -0
  61. package/dist/hooks/useFullScreen.js.map +1 -1
  62. package/dist/index.css +9 -9
  63. package/dist/index.d.ts +5 -2
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +5 -2
  66. package/dist/index.js.map +1 -1
  67. package/dist/models/device-configuration.d.ts +69 -0
  68. package/dist/models/device-configuration.d.ts.map +1 -1
  69. package/dist/models/device-configuration.js +21 -0
  70. package/dist/models/device-configuration.js.map +1 -1
  71. package/dist/providers/ConnectionProvider.d.ts +56 -2
  72. package/dist/providers/ConnectionProvider.d.ts.map +1 -1
  73. package/dist/providers/ConnectionProvider.js +26 -0
  74. package/dist/providers/ConnectionProvider.js.map +1 -1
  75. package/dist/providers/DataProvider.d.ts +129 -0
  76. package/dist/providers/DataProvider.d.ts.map +1 -1
  77. package/dist/providers/DataProvider.js +21 -0
  78. package/dist/providers/DataProvider.js.map +1 -1
  79. package/dist/providers/ThemeProvider.d.ts +67 -7
  80. package/dist/providers/ThemeProvider.d.ts.map +1 -1
  81. package/dist/providers/ThemeProvider.js +39 -2
  82. package/dist/providers/ThemeProvider.js.map +1 -1
  83. package/dist/providers/VisualizerRuntimeConfigProvider.d.ts +43 -3
  84. package/dist/providers/VisualizerRuntimeConfigProvider.d.ts.map +1 -1
  85. package/dist/providers/VisualizerRuntimeConfigProvider.js +20 -3
  86. package/dist/providers/VisualizerRuntimeConfigProvider.js.map +1 -1
  87. package/dist/utils/arrays.d.ts +7 -0
  88. package/dist/utils/arrays.d.ts.map +1 -1
  89. package/dist/utils/arrays.js +7 -0
  90. package/dist/utils/arrays.js.map +1 -1
  91. package/dist/utils/functions.d.ts +3 -0
  92. package/dist/utils/functions.d.ts.map +1 -1
  93. package/dist/utils/functions.js +3 -0
  94. package/dist/utils/functions.js.map +1 -1
  95. package/dist/utils/local-storage.d.ts +20 -0
  96. package/dist/utils/local-storage.d.ts.map +1 -1
  97. package/dist/utils/local-storage.js +17 -0
  98. package/dist/utils/local-storage.js.map +1 -1
  99. package/dist/utils/logger.d.ts +31 -0
  100. package/dist/utils/logger.d.ts.map +1 -1
  101. package/dist/utils/logger.js +36 -7
  102. package/dist/utils/logger.js.map +1 -1
  103. package/dist/utils/sorting.d.ts +6 -0
  104. package/dist/utils/sorting.d.ts.map +1 -1
  105. package/dist/utils/sorting.js +6 -0
  106. package/dist/utils/sorting.js.map +1 -1
  107. package/dist/utils/topic.d.ts +6 -0
  108. package/dist/utils/topic.d.ts.map +1 -1
  109. package/dist/utils/topic.js +3 -0
  110. package/dist/utils/topic.js.map +1 -1
  111. package/dist/utils/units.d.ts +24 -0
  112. package/dist/utils/units.d.ts.map +1 -1
  113. package/dist/utils/units.js +24 -0
  114. package/dist/utils/units.js.map +1 -1
  115. package/dist/utils/url.d.ts +9 -0
  116. package/dist/utils/url.d.ts.map +1 -1
  117. package/dist/utils/url.js +10 -1
  118. package/dist/utils/url.js.map +1 -1
  119. package/dist/utils/vite-dev-fix.d.ts +13 -0
  120. package/dist/utils/vite-dev-fix.d.ts.map +1 -1
  121. package/dist/utils/vite-dev-fix.js +13 -0
  122. package/dist/utils/vite-dev-fix.js.map +1 -1
  123. package/dist/visualizer/components/Panel.js +1 -1
  124. package/dist/visualizer/components/Panel.js.map +1 -1
  125. package/dist/visualizer/messaging/decoder-fixtures.d.ts.map +1 -1
  126. package/dist/visualizer/messaging/decoder-fixtures.js +8 -2
  127. package/dist/visualizer/messaging/decoder-fixtures.js.map +1 -1
  128. package/dist/visualizer/messaging/deserialization/detections/constants.d.ts +1 -0
  129. package/dist/visualizer/messaging/deserialization/detections/constants.d.ts.map +1 -1
  130. package/dist/visualizer/messaging/deserialization/detections/constants.js +1 -0
  131. package/dist/visualizer/messaging/deserialization/detections/constants.js.map +1 -1
  132. package/dist/visualizer/messaging/deserialization/detections/custom.d.ts.map +1 -1
  133. package/dist/visualizer/messaging/deserialization/detections/custom.js +2 -2
  134. package/dist/visualizer/messaging/deserialization/detections/custom.js.map +1 -1
  135. package/dist/visualizer/messaging/deserialization/detections/detection.d.ts.map +1 -1
  136. package/dist/visualizer/messaging/deserialization/detections/detection.js +2 -2
  137. package/dist/visualizer/messaging/deserialization/detections/detection.js.map +1 -1
  138. package/dist/visualizer/messaging/utils.d.ts +1 -0
  139. package/dist/visualizer/messaging/utils.d.ts.map +1 -1
  140. package/dist/visualizer/messaging/utils.js +8 -6
  141. package/dist/visualizer/messaging/utils.js.map +1 -1
  142. package/dist/visualizer/output.css +18 -18
  143. package/dist/visualizer/panels/image/ImageCanvasRenderer.d.ts.map +1 -1
  144. package/dist/visualizer/panels/image/ImageCanvasRenderer.js +4 -1
  145. package/dist/visualizer/panels/image/ImageCanvasRenderer.js.map +1 -1
  146. package/dist/visualizer/panels/image/annotation-overlay.d.ts.map +1 -1
  147. package/dist/visualizer/panels/image/annotation-overlay.js +16 -5
  148. package/dist/visualizer/panels/image/annotation-overlay.js.map +1 -1
  149. package/package.json +2 -2
  150. package/protobuf-gen.sh +60 -3
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import { DeviceListSchema } from '@luxonis/ui-components';
2
2
  import { z } from 'zod';
3
+ /**
4
+ * Runtime validation schema for camera sensor metadata reported by a DepthAI device.
5
+ */
3
6
  export declare const SensorSchema: z.ZodObject<{
4
7
  boardSocket: z.ZodString;
5
8
  maxFps: z.ZodNumber;
@@ -10,46 +13,112 @@ export declare const SensorSchema: z.ZodObject<{
10
13
  height: z.ZodNumber;
11
14
  }, z.core.$strip>>;
12
15
  }, z.core.$strip>;
16
+ /**
17
+ * Camera sensor metadata reported by a DepthAI device.
18
+ */
13
19
  export type Sensor = z.infer<typeof SensorSchema>;
20
+ /**
21
+ * Runtime validation schema for infrared emitter availability.
22
+ */
14
23
  export declare const IrSchema: z.ZodObject<{
15
24
  floodLight: z.ZodBoolean;
16
25
  dotProjector: z.ZodBoolean;
17
26
  }, z.core.$strip>;
27
+ /**
28
+ * Infrared emitter capabilities reported by a DepthAI device.
29
+ */
18
30
  export type Ir = z.infer<typeof IrSchema>;
31
+ /**
32
+ * Runtime validation schema for supported DepthAI platform identifiers.
33
+ */
19
34
  export declare const PlatformSchema: z.ZodEnum<{
20
35
  UNKNOWN: "UNKNOWN";
21
36
  RVC2: "RVC2";
22
37
  RVC4: "RVC4";
23
38
  }>;
39
+ /**
40
+ * Supported DepthAI platform identifier.
41
+ */
24
42
  export type Platform = z.infer<typeof PlatformSchema>;
43
+ /**
44
+ * Human-readable labels for DepthAI platform identifiers.
45
+ */
25
46
  export declare const PLATFORM_NAMES: {
26
47
  RVC2: string;
27
48
  RVC4: string;
28
49
  UNKNOWN: string;
29
50
  };
51
+ /**
52
+ * UI color intents associated with DepthAI platform identifiers.
53
+ */
30
54
  export declare const PLATFORM_COLORS: {
31
55
  RVC2: string;
32
56
  RVC4: string;
33
57
  UNKNOWN: string;
34
58
  };
59
+ /**
60
+ * Runtime validation schema for device connection transport identifiers.
61
+ */
35
62
  export declare const ConnectionTypeSchema: z.ZodEnum<{
36
63
  UNKNOWN: "UNKNOWN";
37
64
  USB: "USB";
38
65
  ETH: "ETH";
39
66
  }>;
67
+ /**
68
+ * Device connection transport identifier.
69
+ */
40
70
  export type ConnectionType = z.infer<typeof ConnectionTypeSchema>;
71
+ /**
72
+ * Normalized device capability and compatibility data used by Viewer UI surfaces.
73
+ */
41
74
  export type DeviceConfiguration = {
75
+ /**
76
+ * Camera sensors present on the device.
77
+ */
42
78
  cameraSensors: Sensor[];
79
+ /**
80
+ * Infrared emitter capabilities.
81
+ */
43
82
  ir: Ir;
83
+ /**
84
+ * Whether the device has stereo depth support.
85
+ */
44
86
  stereo: boolean;
87
+ /**
88
+ * Whether the device has thermal sensing support.
89
+ */
45
90
  thermal: boolean;
91
+ /**
92
+ * Product identifier recognized by the shared UI device list schema.
93
+ */
46
94
  productName: z.infer<typeof DeviceListSchema>;
95
+ /**
96
+ * DepthAI processing platform.
97
+ */
47
98
  platform: Platform;
99
+ /**
100
+ * Whether the device exposes an IMU.
101
+ */
48
102
  imu: boolean;
103
+ /**
104
+ * Whether the device calibration is available and valid.
105
+ */
49
106
  calibrated: boolean;
107
+ /**
108
+ * Whether dynamic calibration is supported.
109
+ */
50
110
  dynamicCalibration: boolean;
111
+ /**
112
+ * Whether the device is fully compatible with the current application.
113
+ */
51
114
  fullyCompatible: boolean;
115
+ /**
116
+ * Whether the device is connected over an older USB generation.
117
+ */
52
118
  oldUsbGeneration: boolean;
53
119
  };
120
+ /**
121
+ * Runtime validation schema for normalized DepthAI device configuration.
122
+ */
54
123
  export declare const DeviceConfigurationSchema: z.ZodType<DeviceConfiguration>;
55
124
  //# sourceMappingURL=device-configuration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-configuration.d.ts","sourceRoot":"","sources":["../../src/models/device-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;;;;;;iBAMvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,QAAQ;;;iBAGnB,CAAC;AACH,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE1C,eAAO,MAAM,cAAc;;;;EAAsC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,eAAO,MAAM,cAAc;;;;CAI1B,CAAC;AACF,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;EAAoC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG;IACjC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,EAAE,EAAE,EAAE,CAAC;IACP,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,C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AElE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,EAAE,EAAE,EAAE,CAAC;IACP;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC9C;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAYnE,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import { DeviceListSchema } from '@luxonis/ui-components';
2
2
  import { z } from 'zod';
3
+ /**
4
+ * Runtime validation schema for camera sensor metadata reported by a DepthAI device.
5
+ */
3
6
  export const SensorSchema = z.object({
4
7
  boardSocket: z.string(),
5
8
  maxFps: z.number(),
@@ -7,22 +10,40 @@ export const SensorSchema = z.object({
7
10
  type: z.string(),
8
11
  supportedResolutions: z.array(z.object({ width: z.number(), height: z.number() })),
9
12
  });
13
+ /**
14
+ * Runtime validation schema for infrared emitter availability.
15
+ */
10
16
  export const IrSchema = z.object({
11
17
  floodLight: z.boolean(),
12
18
  dotProjector: z.boolean(),
13
19
  });
20
+ /**
21
+ * Runtime validation schema for supported DepthAI platform identifiers.
22
+ */
14
23
  export const PlatformSchema = z.enum(['RVC2', 'RVC4', 'UNKNOWN']);
24
+ /**
25
+ * Human-readable labels for DepthAI platform identifiers.
26
+ */
15
27
  export const PLATFORM_NAMES = {
16
28
  RVC2: 'RVC2',
17
29
  RVC4: 'RVC4',
18
30
  UNKNOWN: 'Unknown',
19
31
  };
32
+ /**
33
+ * UI color intents associated with DepthAI platform identifiers.
34
+ */
20
35
  export const PLATFORM_COLORS = {
21
36
  RVC2: 'active',
22
37
  RVC4: 'success',
23
38
  UNKNOWN: 'gray',
24
39
  };
40
+ /**
41
+ * Runtime validation schema for device connection transport identifiers.
42
+ */
25
43
  export const ConnectionTypeSchema = z.enum(['USB', 'ETH', 'UNKNOWN']);
44
+ /**
45
+ * Runtime validation schema for normalized DepthAI device configuration.
46
+ */
26
47
  export const DeviceConfigurationSchema = z.object({
27
48
  cameraSensors: z.array(SensorSchema),
28
49
  ir: IrSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"device-configuration.js","sourceRoot":"","sources":["../../src/models/device-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;CAClF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;CACzB,C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ACZ,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,WAAW,EAAE,gBAAgB;IAC7B,QAAQ,EAAE,cAAc;IACxB,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC/B,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;CAC7B,CAAC,CAAC"}
@@ -1,13 +1,67 @@
1
1
  import React from 'react';
2
2
  import type { DAIService, MessageHandlerVersion } from '../dai-connection/connection.js';
3
3
  import { type ConnectionData, type TokenRefreshHandler } from '../hooks/connection.js';
4
+ /**
5
+ * React context containing the current DepthAI connection state.
6
+ *
7
+ * @remarks
8
+ * The default value represents a disconnected, idle provider state and is used only
9
+ * before a matching {@link ConnectionProvider} is mounted.
10
+ */
4
11
  export declare const ConnectionContext: React.Context<ConnectionData>;
5
- export declare const ConnectionProvider: React.FC<React.PropsWithChildren<{
12
+ /**
13
+ * Props for the DepthAI connection provider.
14
+ */
15
+ export type ConnectionProviderProps = React.PropsWithChildren<{
16
+ /**
17
+ * DepthAI service names polled while the connection is alive.
18
+ *
19
+ * @defaultValue `[]`
20
+ */
6
21
  activeServices: DAIService[];
22
+ /**
23
+ * Enables verbose connection logging.
24
+ *
25
+ * @defaultValue `false`
26
+ */
7
27
  withDebugLogs?: boolean;
28
+ /**
29
+ * Stream topics opened automatically after connection.
30
+ *
31
+ * @remarks
32
+ * `undefined` preserves the connection/backend default topic behavior.
33
+ */
8
34
  defaultTopics?: string[];
35
+ /**
36
+ * Backend message handling protocol expected by the visualizer connection.
37
+ */
9
38
  messageHandlerVersion?: MessageHandlerVersion;
39
+ /**
40
+ * Controls how refreshed WebRTC tokens are propagated to the host application.
41
+ *
42
+ * @defaultValue `false`
43
+ */
10
44
  tokenRefresh?: TokenRefreshHandler;
11
- }>>;
45
+ }>;
46
+ /**
47
+ * Creates and provides a DepthAI connection based on data provider connection settings.
48
+ *
49
+ * @remarks
50
+ * This provider reads transport settings from {@link DataProvider}, delegates connection
51
+ * creation to {@link useCreateConnection}, and wraps children with the visualizer
52
+ * connection context used by stream panels.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <ConnectionProvider activeServices={[]}>{children}</ConnectionProvider>
57
+ * ```
58
+ */
59
+ export declare const ConnectionProvider: React.FC<ConnectionProviderProps>;
60
+ /**
61
+ * Returns the current DepthAI connection context.
62
+ *
63
+ * @remarks
64
+ * Outside {@link ConnectionProvider}, this hook returns the disconnected default context.
65
+ */
12
66
  export declare const useDaiConnection: () => ConnectionData;
13
67
  //# sourceMappingURL=ConnectionProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,iBAAiB,+BAc5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACxC,KAAK,CAAC,iBAAiB,CAAC;IACvB,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACnC,CAAC,CA4BF,CAAC;AAEF,eAAO,MAAM,gBAAgB,sBAA4C,CAAC"}
1
+ {"version":3,"file":"ConnectionProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,MAAM,wBAAwB,CAAC;AAKhC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,+BAc5B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC7D;;;;OAIG;IACH,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C;;;;OAIG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACnC,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2BhE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,sBAA4C,CAAC"}
@@ -4,6 +4,13 @@ import { useCreateConnection, } from '../hooks/connection.js';
4
4
  import { noop } from '../utils/functions.js';
5
5
  import { VisualizerContext } from '../visualizer/index.js';
6
6
  import { useData } from './DataProvider.js';
7
+ /**
8
+ * React context containing the current DepthAI connection state.
9
+ *
10
+ * @remarks
11
+ * The default value represents a disconnected, idle provider state and is used only
12
+ * before a matching {@link ConnectionProvider} is mounted.
13
+ */
7
14
  export const ConnectionContext = React.createContext({
8
15
  daiConnection: null,
9
16
  connected: false,
@@ -19,6 +26,19 @@ export const ConnectionContext = React.createContext({
19
26
  toggleTopic: noop,
20
27
  isConnectionError: false,
21
28
  });
29
+ /**
30
+ * Creates and provides a DepthAI connection based on data provider connection settings.
31
+ *
32
+ * @remarks
33
+ * This provider reads transport settings from {@link DataProvider}, delegates connection
34
+ * creation to {@link useCreateConnection}, and wraps children with the visualizer
35
+ * connection context used by stream panels.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <ConnectionProvider activeServices={[]}>{children}</ConnectionProvider>
40
+ * ```
41
+ */
22
42
  export const ConnectionProvider = ({ children, activeServices, withDebugLogs, defaultTopics, messageHandlerVersion, tokenRefresh, }) => {
23
43
  const { connectionType, wsUrl, token, clientId } = useData();
24
44
  const connectionData = useCreateConnection({
@@ -34,5 +54,11 @@ export const ConnectionProvider = ({ children, activeServices, withDebugLogs, de
34
54
  });
35
55
  return (_jsx(VisualizerContext, { connections: connectionData.connections, children: _jsx(ConnectionContext.Provider, { value: connectionData, children: children }) }));
36
56
  };
57
+ /**
58
+ * Returns the current DepthAI connection context.
59
+ *
60
+ * @remarks
61
+ * Outside {@link ConnectionProvider}, this hook returns the disconnected default context.
62
+ */
37
63
  export const useDaiConnection = () => React.useContext(ConnectionContext);
38
64
  //# sourceMappingURL=ConnectionProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionProvider.js","sourceRoot":"","sources":["../../src/providers/ConnectionProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGN,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAiB;IACpE,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,EAAE;IACrB,QAAQ,E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2
+ /**
3
+ * Shared UI state derived from URL parameters and connection configuration.
4
+ *
5
+ * @remarks
6
+ * Values come from explicit `connectionConfig` first, then URL parameters, then local
7
+ * defaults. Mutation helpers update both React state and the relevant URL parameters.
8
+ */
2
9
  export type DataContext = {
10
+ /**
11
+ * Number of stream columns requested by the layout state, or `null` for automatic layout.
12
+ *
13
+ * @remarks
14
+ * `null` is persisted as layout `0` in the URL.
15
+ */
3
16
  columns: number | null;
17
+ /**
18
+ * Whether the user is controlling panel layout manually instead of using column layout.
19
+ *
20
+ * @defaultValue `false`
21
+ */
4
22
  customLayout: boolean;
23
+ /**
24
+ * Updates the number of stream columns and persists it to the URL.
25
+ *
26
+ * @remarks
27
+ * Calling this also disables custom layout mode.
28
+ */
5
29
  changeColumns: (columns: number | null) => void;
30
+ /**
31
+ * Enables or disables custom stream layout mode.
32
+ *
33
+ * @remarks
34
+ * Calling this resets `columns` to `null` and persists layout `0` to the URL.
35
+ */
6
36
  changeCustomLayout: (value: boolean) => void;
37
+ /**
38
+ * Updates the WebSocket URL and clears WebRTC URL parameters.
39
+ *
40
+ * @remarks
41
+ * Calling this removes `t` and `cid` from the URL so the next connection uses
42
+ * WebSocket settings.
43
+ */
7
44
  changeWsUrl: (url: string) => void;
45
+ /**
46
+ * Active connection transport selected from props or URL parameters.
47
+ *
48
+ * @remarks
49
+ * WebRTC is selected only when token and client id are available.
50
+ */
8
51
  connectionType: 'ws' | 'webrtc';
52
+ /**
53
+ * WebSocket endpoint used when `connectionType` is `ws`.
54
+ *
55
+ * @remarks
56
+ * Defaults to the local backend URL on localhost/Electron and to the production
57
+ * default URL elsewhere.
58
+ */
9
59
  wsUrl: string;
60
+ /**
61
+ * WebRTC auth token used when `connectionType` is `webrtc`.
62
+ *
63
+ * @remarks
64
+ * Empty when WebRTC parameters are not available.
65
+ */
10
66
  token: string;
67
+ /**
68
+ * WebRTC client id used when `connectionType` is `webrtc`.
69
+ *
70
+ * @remarks
71
+ * Empty when WebRTC parameters are not available.
72
+ */
11
73
  clientId: string;
74
+ /**
75
+ * Selected distance unit system for stream overlays.
76
+ *
77
+ * @defaultValue `'metric'`
78
+ */
12
79
  units: SelectedUnits;
80
+ /**
81
+ * Updates the selected distance unit system.
82
+ */
13
83
  setUnits: (units: SelectedUnits) => void;
14
84
  };
85
+ /**
86
+ * Returns shared URL, layout, connection, and unit preferences for viewer components.
87
+ *
88
+ * @remarks
89
+ * Outside {@link DataProvider}, this hook returns the default WebSocket-based context.
90
+ */
15
91
  export declare const useData: () => DataContext;
92
+ /**
93
+ * Supported unit systems for stream overlay distance values.
94
+ */
16
95
  export type SelectedUnits = 'imperial' | 'metric';
96
+ /**
97
+ * Props for the shared data provider.
98
+ */
17
99
  export type DataProviderProps = React.PropsWithChildren & {
100
+ /**
101
+ * Optional connection configuration supplied by the host application instead of URL parameters.
102
+ *
103
+ * @remarks
104
+ * When omitted, the provider reads WebRTC parameters from `t` and `cid`, or a WebSocket
105
+ * URL from `ws_url`. If no URL parameters are present, it falls back to the default
106
+ * WebSocket URL.
107
+ */
18
108
  connectionConfig?: {
109
+ /**
110
+ * Selects a WebSocket connection.
111
+ */
19
112
  type: 'ws';
113
+ /**
114
+ * WebSocket URL of the DepthAI backend.
115
+ *
116
+ * @remarks
117
+ * This value takes precedence over `ws_url` from the current URL.
118
+ */
20
119
  wsUrl: string;
21
120
  } | {
121
+ /**
122
+ * Selects a WebRTC connection.
123
+ */
22
124
  type: 'webrtc';
125
+ /**
126
+ * WebRTC auth token.
127
+ *
128
+ * @remarks
129
+ * This value takes precedence over `t` from the current URL.
130
+ */
23
131
  token: string;
132
+ /**
133
+ * WebRTC client id.
134
+ *
135
+ * @remarks
136
+ * This value takes precedence over `cid` from the current URL.
137
+ */
24
138
  clientId: string;
25
139
  };
26
140
  };
141
+ /**
142
+ * Provides shared viewer state resolved from explicit connection config and URL parameters.
143
+ *
144
+ * @remarks
145
+ * The provider keeps layout state synchronized with URL search parameters and chooses
146
+ * the active transport in this order: explicit `connectionConfig`, WebRTC URL params,
147
+ * WebSocket URL param, environment default URL.
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * <DataProvider connectionConfig={{ type: 'ws', wsUrl: 'ws://localhost:8765' }}>
152
+ * {children}
153
+ * </DataProvider>
154
+ * ```
155
+ */
27
156
  export declare const DataProvider: React.FC<DataProviderProps>;
28
157
  //# sourceMappingURL=DataProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,cAAc,EAAE,IAAI,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CACzC,CAAC;AAgBF,eAAO,MAAM,OAAO,mBAAsC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACzD,gBAAgB,CAAC,EACd;QACA,IAAI,EAAE,IAAI,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACb,GACD;QACA,IAAI,EAAE,QAAQ,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAA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;;;WAKG;QACH,KAAK,EAAE,MAAM,CAAC;KACb,GACD;QACA;;WAEG;QACH,IAAI,EAAE,QAAQ,CAAC;QACf;;;;;WAKG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;;;;WAKG;QACH,QAAQ,EAAE,MAAM,CAAC;KAChB,CAAC;CACL,CAAC;AAIF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoGpD,CAAC"}
@@ -17,8 +17,29 @@ const DataContext = React.createContext({
17
17
  units: 'metric',
18
18
  setUnits: noop,
19
19
  });
20
+ /**
21
+ * Returns shared URL, layout, connection, and unit preferences for viewer components.
22
+ *
23
+ * @remarks
24
+ * Outside {@link DataProvider}, this hook returns the default WebSocket-based context.
25
+ */
20
26
  export const useData = () => React.useContext(DataContext);
21
27
  const DEFAULT_SEARCH_INIT = { layout: '0', t: '', cid: '' };
28
+ /**
29
+ * Provides shared viewer state resolved from explicit connection config and URL parameters.
30
+ *
31
+ * @remarks
32
+ * The provider keeps layout state synchronized with URL search parameters and chooses
33
+ * the active transport in this order: explicit `connectionConfig`, WebRTC URL params,
34
+ * WebSocket URL param, environment default URL.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <DataProvider connectionConfig={{ type: 'ws', wsUrl: 'ws://localhost:8765' }}>
39
+ * {children}
40
+ * </DataProvider>
41
+ * ```
42
+ */
22
43
  export const DataProvider = ({ children, connectionConfig }) => {
23
44
  const { search, updateSearch } = useFlatSearch({
24
45
  defaultInit: DEFAULT_SEARCH_INIT,
@@ -1 +1 @@
1
- {"version":3,"file":"DataProvider.js","sourceRoot":"","sources":["../../src/providers/DataProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,C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,aAAa;YACb,kBAAkB;YAClB,WAAW;YACX,KAAK;YACL,QAAQ;SACR,YAEA,QAAQ,GACa,CACvB,CAAC;AACH,CAAC,CAAC"}
@@ -1,25 +1,85 @@
1
1
  import React from 'react';
2
- /** What the user picked. `system` follows the OS and keeps following it. */
2
+ /**
3
+ * Theme preference selected by the user.
4
+ *
5
+ * @remarks
6
+ * `system` follows the operating system preference and keeps listening for OS changes.
7
+ */
3
8
  export type ThemePreference = 'light' | 'dark' | 'system';
4
- /** What is actually on screen. `system` has already been resolved. */
9
+ /**
10
+ * Theme that is currently rendered on screen after resolving `system`.
11
+ */
5
12
  export type ResolvedTheme = 'light' | 'dark';
13
+ /**
14
+ * Supported theme preferences shown by the theme picker.
15
+ */
6
16
  export declare const THEME_PREFERENCES: ThemePreference[];
17
+ /**
18
+ * Resolves a user theme preference into the theme currently rendered by the UI.
19
+ *
20
+ * @param preference - User-selected theme preference.
21
+ * @returns Concrete light or dark theme.
22
+ */
7
23
  export declare const resolveTheme: (preference: ThemePreference) => ResolvedTheme;
24
+ /**
25
+ * Reads the stored theme preference from local storage.
26
+ *
27
+ * @returns Stored theme preference, or `system` when the stored value is missing or invalid.
28
+ */
8
29
  export declare const readStoredTheme: () => ThemePreference;
9
30
  /**
10
- * Applied both from React and from the inline bootstrap script in index.html, which
11
- * runs before first paint so the app never flashes the light theme on load.
31
+ * Applies a resolved theme to the document root.
32
+ *
33
+ * @remarks
34
+ * This toggles the `dark` class on `document.documentElement`. It is used both from
35
+ * React and from the inline bootstrap script in `index.html`, which runs before first
36
+ * paint so the app never flashes the light theme on load.
12
37
  */
13
38
  export declare const applyTheme: (theme: ResolvedTheme) => void;
39
+ /**
40
+ * Theme state and actions exposed by {@link ThemeProvider}.
41
+ */
14
42
  export type ThemeContext = {
15
- /** The user's choice, including `system`. */
43
+ /**
44
+ * User-selected preference, including `system`.
45
+ *
46
+ * @defaultValue `'system'`
47
+ */
16
48
  theme: ThemePreference;
17
- /** The theme currently rendered. */
49
+ /**
50
+ * Concrete theme currently rendered on screen.
51
+ *
52
+ * @defaultValue `'light'`
53
+ */
18
54
  resolvedTheme: ResolvedTheme;
55
+ /**
56
+ * Updates the user-selected theme and persists it to local storage.
57
+ */
19
58
  setTheme: (theme: ThemePreference) => void;
20
- /** Flips between light and dark, resolving `system` first. */
59
+ /**
60
+ * Flips between light and dark, resolving `system` first.
61
+ */
21
62
  toggleTheme: () => void;
22
63
  };
64
+ /**
65
+ * Returns the current theme context.
66
+ *
67
+ * @remarks
68
+ * Outside {@link ThemeProvider}, this hook returns the default system/light context.
69
+ */
23
70
  export declare const useTheme: () => ThemeContext;
71
+ /**
72
+ * Provides shared theme state and keeps DOM/local storage in sync.
73
+ *
74
+ * @remarks
75
+ * The provider reads the initial preference from local storage, follows OS theme changes
76
+ * while the preference is `system`, persists explicit user changes, and applies the
77
+ * resolved theme to the document root.
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * <ThemeProvider>{children}</ThemeProvider>
82
+ * ```
83
+ */
24
84
  export declare const ThemeProvider: React.FC<React.PropsWithChildren>;
25
85
  //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,eAAO,MAAM,iBAAiB,EAAE,eAAe,EAAgC,CAAC;AAWhF,eAAO,MAAM,YAAY,GAAI,YAAY,eAAe,KAAG,aACe,CAAC;AAE3E,eAAO,MAAM,eAAe,QAAO,eAGlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,aAAa,SAE9C,CAAC;AAEF,MAAM,MAAM,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