@printwithsynergy/artwork-pdf-editor 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/LICENSE +62 -0
  2. package/dist/components/AccessibilityHintsPanel.d.ts +142 -0
  3. package/dist/components/AccessibilityHintsPanel.d.ts.map +1 -0
  4. package/dist/components/AccessibilityHintsPanel.js +158 -0
  5. package/dist/components/AccessibilityHintsPanel.js.map +1 -0
  6. package/dist/components/AnnotationOverlay.d.ts +142 -0
  7. package/dist/components/AnnotationOverlay.d.ts.map +1 -0
  8. package/dist/components/AnnotationOverlay.js +141 -0
  9. package/dist/components/AnnotationOverlay.js.map +1 -0
  10. package/dist/components/AnnotationsSidebar.d.ts +98 -0
  11. package/dist/components/AnnotationsSidebar.d.ts.map +1 -0
  12. package/dist/components/AnnotationsSidebar.js +100 -0
  13. package/dist/components/AnnotationsSidebar.js.map +1 -0
  14. package/dist/components/BarcodeGeneratorPanel.d.ts +58 -0
  15. package/dist/components/BarcodeGeneratorPanel.d.ts.map +1 -0
  16. package/dist/components/BarcodeGeneratorPanel.js +91 -0
  17. package/dist/components/BarcodeGeneratorPanel.js.map +1 -0
  18. package/dist/components/BraillePanel.d.ts +99 -0
  19. package/dist/components/BraillePanel.d.ts.map +1 -0
  20. package/dist/components/BraillePanel.js +221 -0
  21. package/dist/components/BraillePanel.js.map +1 -0
  22. package/dist/components/BrandAssetsPanel.d.ts +130 -0
  23. package/dist/components/BrandAssetsPanel.d.ts.map +1 -0
  24. package/dist/components/BrandAssetsPanel.js +125 -0
  25. package/dist/components/BrandAssetsPanel.js.map +1 -0
  26. package/dist/components/BrandConsistencyPanel.d.ts +140 -0
  27. package/dist/components/BrandConsistencyPanel.d.ts.map +1 -0
  28. package/dist/components/BrandConsistencyPanel.js +158 -0
  29. package/dist/components/BrandConsistencyPanel.js.map +1 -0
  30. package/dist/components/ComplianceFindingsPanel.d.ts +62 -0
  31. package/dist/components/ComplianceFindingsPanel.d.ts.map +1 -0
  32. package/dist/components/ComplianceFindingsPanel.js +118 -0
  33. package/dist/components/ComplianceFindingsPanel.js.map +1 -0
  34. package/dist/components/DesignSuggestionsPanel.d.ts +148 -0
  35. package/dist/components/DesignSuggestionsPanel.d.ts.map +1 -0
  36. package/dist/components/DesignSuggestionsPanel.js +154 -0
  37. package/dist/components/DesignSuggestionsPanel.js.map +1 -0
  38. package/dist/components/DielineParametersPanel.d.ts +62 -0
  39. package/dist/components/DielineParametersPanel.d.ts.map +1 -0
  40. package/dist/components/DielineParametersPanel.js +170 -0
  41. package/dist/components/DielineParametersPanel.js.map +1 -0
  42. package/dist/components/DielinePreview.d.ts +150 -0
  43. package/dist/components/DielinePreview.d.ts.map +1 -0
  44. package/dist/components/DielinePreview.js +146 -0
  45. package/dist/components/DielinePreview.js.map +1 -0
  46. package/dist/components/EditorApp.d.ts +18 -3
  47. package/dist/components/EditorApp.d.ts.map +1 -1
  48. package/dist/components/EditorApp.js +42 -7
  49. package/dist/components/EditorApp.js.map +1 -1
  50. package/dist/components/EditorCanvas.d.ts +31 -2
  51. package/dist/components/EditorCanvas.d.ts.map +1 -1
  52. package/dist/components/EditorCanvas.js +97 -16
  53. package/dist/components/EditorCanvas.js.map +1 -1
  54. package/dist/components/EmailNotifyPanel.d.ts +165 -0
  55. package/dist/components/EmailNotifyPanel.d.ts.map +1 -0
  56. package/dist/components/EmailNotifyPanel.js +211 -0
  57. package/dist/components/EmailNotifyPanel.js.map +1 -0
  58. package/dist/components/FileDropZone.d.ts +9 -1
  59. package/dist/components/FileDropZone.d.ts.map +1 -1
  60. package/dist/components/FileDropZone.js +53 -5
  61. package/dist/components/FileDropZone.js.map +1 -1
  62. package/dist/components/FoldEditorPanel.d.ts +68 -0
  63. package/dist/components/FoldEditorPanel.d.ts.map +1 -0
  64. package/dist/components/FoldEditorPanel.js +65 -0
  65. package/dist/components/FoldEditorPanel.js.map +1 -0
  66. package/dist/components/FoldPreviewOverlay.d.ts +48 -0
  67. package/dist/components/FoldPreviewOverlay.d.ts.map +1 -0
  68. package/dist/components/FoldPreviewOverlay.js +182 -0
  69. package/dist/components/FoldPreviewOverlay.js.map +1 -0
  70. package/dist/components/Gs1DigitalLinkPanel.d.ts +103 -0
  71. package/dist/components/Gs1DigitalLinkPanel.d.ts.map +1 -0
  72. package/dist/components/Gs1DigitalLinkPanel.js +199 -0
  73. package/dist/components/Gs1DigitalLinkPanel.js.map +1 -0
  74. package/dist/components/HistoryPanel.d.ts +39 -0
  75. package/dist/components/HistoryPanel.d.ts.map +1 -0
  76. package/dist/components/HistoryPanel.js +72 -0
  77. package/dist/components/HistoryPanel.js.map +1 -0
  78. package/dist/components/IccSoftProofOverlay.d.ts +67 -0
  79. package/dist/components/IccSoftProofOverlay.d.ts.map +1 -0
  80. package/dist/components/IccSoftProofOverlay.js +119 -0
  81. package/dist/components/IccSoftProofOverlay.js.map +1 -0
  82. package/dist/components/ImposePanel.d.ts +71 -0
  83. package/dist/components/ImposePanel.d.ts.map +1 -0
  84. package/dist/components/ImposePanel.js +127 -0
  85. package/dist/components/ImposePanel.js.map +1 -0
  86. package/dist/components/InksPanel.d.ts +61 -0
  87. package/dist/components/InksPanel.d.ts.map +1 -0
  88. package/dist/components/InksPanel.js +84 -0
  89. package/dist/components/InksPanel.js.map +1 -0
  90. package/dist/components/JobSetupPanel.d.ts +118 -0
  91. package/dist/components/JobSetupPanel.d.ts.map +1 -0
  92. package/dist/components/JobSetupPanel.js +169 -0
  93. package/dist/components/JobSetupPanel.js.map +1 -0
  94. package/dist/components/LayersPanel.d.ts.map +1 -1
  95. package/dist/components/LayersPanel.js +1 -0
  96. package/dist/components/LayersPanel.js.map +1 -1
  97. package/dist/components/MarkLibraryPanel.d.ts +131 -0
  98. package/dist/components/MarkLibraryPanel.d.ts.map +1 -0
  99. package/dist/components/MarkLibraryPanel.js +184 -0
  100. package/dist/components/MarkLibraryPanel.js.map +1 -0
  101. package/dist/components/MisEstimateButton.d.ts +73 -0
  102. package/dist/components/MisEstimateButton.d.ts.map +1 -0
  103. package/dist/components/MisEstimateButton.js +57 -0
  104. package/dist/components/MisEstimateButton.js.map +1 -0
  105. package/dist/components/NutritionPanel.d.ts +118 -0
  106. package/dist/components/NutritionPanel.d.ts.map +1 -0
  107. package/dist/components/NutritionPanel.js +169 -0
  108. package/dist/components/NutritionPanel.js.map +1 -0
  109. package/dist/components/PageNavigator.d.ts.map +1 -1
  110. package/dist/components/PageNavigator.js +6 -1
  111. package/dist/components/PageNavigator.js.map +1 -1
  112. package/dist/components/PaletteManager.d.ts +32 -0
  113. package/dist/components/PaletteManager.d.ts.map +1 -0
  114. package/dist/components/PaletteManager.js +89 -0
  115. package/dist/components/PaletteManager.js.map +1 -0
  116. package/dist/components/PaletteToSpotPanel.d.ts +122 -0
  117. package/dist/components/PaletteToSpotPanel.d.ts.map +1 -0
  118. package/dist/components/PaletteToSpotPanel.js +160 -0
  119. package/dist/components/PaletteToSpotPanel.js.map +1 -0
  120. package/dist/components/PreflightAutoFixPanel.d.ts +110 -0
  121. package/dist/components/PreflightAutoFixPanel.d.ts.map +1 -0
  122. package/dist/components/PreflightAutoFixPanel.js +119 -0
  123. package/dist/components/PreflightAutoFixPanel.js.map +1 -0
  124. package/dist/components/PreflightDiffPanel.d.ts +127 -0
  125. package/dist/components/PreflightDiffPanel.d.ts.map +1 -0
  126. package/dist/components/PreflightDiffPanel.js +0 -0
  127. package/dist/components/PreflightDiffPanel.js.map +1 -0
  128. package/dist/components/ProcessRulesPanel.d.ts +81 -0
  129. package/dist/components/ProcessRulesPanel.d.ts.map +1 -0
  130. package/dist/components/ProcessRulesPanel.js +143 -0
  131. package/dist/components/ProcessRulesPanel.js.map +1 -0
  132. package/dist/components/SlackNotifyPanel.d.ts +139 -0
  133. package/dist/components/SlackNotifyPanel.d.ts.map +1 -0
  134. package/dist/components/SlackNotifyPanel.js +133 -0
  135. package/dist/components/SlackNotifyPanel.js.map +1 -0
  136. package/dist/components/SmartSpotMatchPanel.d.ts +143 -0
  137. package/dist/components/SmartSpotMatchPanel.d.ts.map +1 -0
  138. package/dist/components/SmartSpotMatchPanel.js +159 -0
  139. package/dist/components/SmartSpotMatchPanel.js.map +1 -0
  140. package/dist/components/StreamingRenderProgress.d.ts +60 -0
  141. package/dist/components/StreamingRenderProgress.d.ts.map +1 -0
  142. package/dist/components/StreamingRenderProgress.js +99 -0
  143. package/dist/components/StreamingRenderProgress.js.map +1 -0
  144. package/dist/components/SwatchesPicker.d.ts +83 -0
  145. package/dist/components/SwatchesPicker.d.ts.map +1 -0
  146. package/dist/components/SwatchesPicker.js +151 -0
  147. package/dist/components/SwatchesPicker.js.map +1 -0
  148. package/dist/components/TacOverlay.d.ts +47 -0
  149. package/dist/components/TacOverlay.d.ts.map +1 -0
  150. package/dist/components/TacOverlay.js +116 -0
  151. package/dist/components/TacOverlay.js.map +1 -0
  152. package/dist/components/TrapEditorPanel.d.ts +52 -0
  153. package/dist/components/TrapEditorPanel.d.ts.map +1 -0
  154. package/dist/components/TrapEditorPanel.js +64 -0
  155. package/dist/components/TrapEditorPanel.js.map +1 -0
  156. package/dist/components/TrapPreviewOverlay.d.ts +64 -0
  157. package/dist/components/TrapPreviewOverlay.d.ts.map +1 -0
  158. package/dist/components/TrapPreviewOverlay.js +120 -0
  159. package/dist/components/TrapPreviewOverlay.js.map +1 -0
  160. package/dist/components/VariantMatrixPanel.d.ts +61 -0
  161. package/dist/components/VariantMatrixPanel.d.ts.map +1 -0
  162. package/dist/components/VariantMatrixPanel.js +97 -0
  163. package/dist/components/VariantMatrixPanel.js.map +1 -0
  164. package/dist/components/VariantMatrixVersionPanel.d.ts +122 -0
  165. package/dist/components/VariantMatrixVersionPanel.d.ts.map +1 -0
  166. package/dist/components/VariantMatrixVersionPanel.js +162 -0
  167. package/dist/components/VariantMatrixVersionPanel.js.map +1 -0
  168. package/dist/components/WebhookNotifyPanel.d.ts +160 -0
  169. package/dist/components/WebhookNotifyPanel.d.ts.map +1 -0
  170. package/dist/components/WebhookNotifyPanel.js +100 -0
  171. package/dist/components/WebhookNotifyPanel.js.map +1 -0
  172. package/dist/components/WhiteUnderbasePanel.d.ts +107 -0
  173. package/dist/components/WhiteUnderbasePanel.d.ts.map +1 -0
  174. package/dist/components/WhiteUnderbasePanel.js +104 -0
  175. package/dist/components/WhiteUnderbasePanel.js.map +1 -0
  176. package/dist/hooks/useEditorMode.d.ts +25 -5
  177. package/dist/hooks/useEditorMode.d.ts.map +1 -1
  178. package/dist/hooks/useEditorMode.js +18 -5
  179. package/dist/hooks/useEditorMode.js.map +1 -1
  180. package/dist/index.d.ts +51 -2
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +51 -2
  183. package/dist/index.js.map +1 -1
  184. package/dist/lens/preflight-findings.d.ts.map +1 -1
  185. package/dist/lens/preflight-findings.js.map +1 -1
  186. package/dist/lib/barcode-scan.d.ts +154 -0
  187. package/dist/lib/barcode-scan.d.ts.map +1 -0
  188. package/dist/lib/barcode-scan.js +152 -0
  189. package/dist/lib/barcode-scan.js.map +1 -0
  190. package/dist/lib/color-math.d.ts +76 -0
  191. package/dist/lib/color-math.d.ts.map +1 -0
  192. package/dist/lib/color-math.js +96 -0
  193. package/dist/lib/color-math.js.map +1 -0
  194. package/dist/lib/dieline-template.d.ts +87 -0
  195. package/dist/lib/dieline-template.d.ts.map +1 -1
  196. package/dist/lib/dieline-template.js +163 -0
  197. package/dist/lib/dieline-template.js.map +1 -1
  198. package/dist/lib/editor-config.d.ts +390 -0
  199. package/dist/lib/editor-config.d.ts.map +1 -1
  200. package/dist/lib/editor-config.js +90 -0
  201. package/dist/lib/editor-config.js.map +1 -1
  202. package/dist/lib/fold-geometry.d.ts +144 -0
  203. package/dist/lib/fold-geometry.d.ts.map +1 -0
  204. package/dist/lib/fold-geometry.js +138 -0
  205. package/dist/lib/fold-geometry.js.map +1 -0
  206. package/dist/lib/merge-tokens.d.ts +81 -0
  207. package/dist/lib/merge-tokens.d.ts.map +1 -0
  208. package/dist/lib/merge-tokens.js +88 -0
  209. package/dist/lib/merge-tokens.js.map +1 -0
  210. package/dist/lib/palette-registry.d.ts +40 -0
  211. package/dist/lib/palette-registry.d.ts.map +1 -0
  212. package/dist/lib/palette-registry.js +50 -0
  213. package/dist/lib/palette-registry.js.map +1 -0
  214. package/dist/lib/panel-anchor.d.ts +101 -0
  215. package/dist/lib/panel-anchor.d.ts.map +1 -0
  216. package/dist/lib/panel-anchor.js +68 -0
  217. package/dist/lib/panel-anchor.js.map +1 -0
  218. package/dist/lib/preflight/checks.d.ts.map +1 -1
  219. package/dist/lib/preflight/checks.js +71 -0
  220. package/dist/lib/preflight/checks.js.map +1 -1
  221. package/dist/lib/preflight/types.d.ts.map +1 -1
  222. package/dist/lib/preflight/types.js +11 -0
  223. package/dist/lib/preflight/types.js.map +1 -1
  224. package/dist/lib/rasterize.d.ts +93 -0
  225. package/dist/lib/rasterize.d.ts.map +1 -0
  226. package/dist/lib/rasterize.js +117 -0
  227. package/dist/lib/rasterize.js.map +1 -0
  228. package/dist/lib/separations-registry.d.ts +99 -0
  229. package/dist/lib/separations-registry.d.ts.map +1 -0
  230. package/dist/lib/separations-registry.js +59 -0
  231. package/dist/lib/separations-registry.js.map +1 -0
  232. package/dist/lib/streaming-render.d.ts +100 -0
  233. package/dist/lib/streaming-render.d.ts.map +1 -0
  234. package/dist/lib/streaming-render.js +132 -0
  235. package/dist/lib/streaming-render.js.map +1 -0
  236. package/dist/lib/unwired.d.ts +29 -0
  237. package/dist/lib/unwired.d.ts.map +1 -0
  238. package/dist/lib/unwired.js +58 -0
  239. package/dist/lib/unwired.js.map +1 -0
  240. package/package.json +20 -11
  241. package/dist/components/SeparationsPanel.d.ts +0 -9
  242. package/dist/components/SeparationsPanel.d.ts.map +0 -1
  243. package/dist/components/SeparationsPanel.js +0 -168
  244. package/dist/components/SeparationsPanel.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Per-page registry of named spot inks the editor has identified.
3
+ *
4
+ * AI4 ("palette → spot") feeds this registry every time the user
5
+ * marks a fill or stroke color as a spot ink. The list rides on the
6
+ * page (see `Page.separations` in `dieline-template.ts`) and gets
7
+ * threaded through to compile-pdf via the
8
+ * `JobSubmitRequest.separationsOverride` field — bypassing the
9
+ * renderer's inference of separations from the document content.
10
+ *
11
+ * Wave 1 PR-7 (C3 SwatchesPicker) adds a "from library" flow that
12
+ * pre-fills `pantone` + `lab` via the compile-pdf spots endpoint.
13
+ * For now, the registry handles ad-hoc registration with whatever
14
+ * metadata the user has (a name, optionally a Pantone code).
15
+ *
16
+ * The helpers in this file are pure — they take an array and return
17
+ * a new array. State is owned by the caller (Page / EditorApp).
18
+ */
19
+ /**
20
+ * Editor-side mirror of `@artworkpdf/document-model`'s `Separation`.
21
+ *
22
+ * Kept structural (not an import from document-model) so the
23
+ * editor-app package stays consumable by hosts that don't pull
24
+ * document-model in. The wire serialization is structurally
25
+ * compatible — when the export builder populates
26
+ * `separationsOverride` on the job request, an `EditorSeparation[]`
27
+ * satisfies the document-model `Separation[]` shape.
28
+ *
29
+ * @public
30
+ */
31
+ export type EditorSeparation = {
32
+ /** Display name and the channel identity (e.g. `"PANTONE 185 C"`). */
33
+ name: string;
34
+ /** PDF color space. Spots use `"Spot"`; process inks use `"CMYK"`. */
35
+ colorSpace: "CMYK" | "Spot" | "DeviceN" | "RGB" | "Gray";
36
+ /** The source hex this spot was registered from (`#fc5102`). */
37
+ hex: string;
38
+ /** Canonical Pantone reference name, when known. */
39
+ pantone?: string;
40
+ /** Measured Lab triplet, when known (filled by C3's SwatchesPicker). */
41
+ lab?: {
42
+ L: number;
43
+ a: number;
44
+ b: number;
45
+ };
46
+ /** Channel type — informs the renderer's downstream handling. */
47
+ type?: "ink" | "varnish" | "foil" | "emboss" | "white";
48
+ };
49
+ /**
50
+ * Options accepted by {@link registerSpot} beyond the required name.
51
+ *
52
+ * @public
53
+ */
54
+ export type RegisterSpotOptions = {
55
+ pantone?: string;
56
+ lab?: {
57
+ L: number;
58
+ a: number;
59
+ b: number;
60
+ };
61
+ type?: EditorSeparation["type"];
62
+ colorSpace?: EditorSeparation["colorSpace"];
63
+ };
64
+ /**
65
+ * Add (or replace) a spot keyed by `hex`. Idempotent — registering
66
+ * the same hex twice updates the existing entry rather than
67
+ * appending a duplicate. Comparison is case-insensitive.
68
+ *
69
+ * @returns A new array with the spot present. The input is not
70
+ * mutated.
71
+ *
72
+ * @public
73
+ */
74
+ export declare function registerSpot(seps: readonly EditorSeparation[], hex: string, name: string, opts?: RegisterSpotOptions): EditorSeparation[];
75
+ /**
76
+ * Remove a spot by hex. No-op if absent.
77
+ *
78
+ * @returns A new array with the matching entry removed.
79
+ *
80
+ * @public
81
+ */
82
+ export declare function unregisterSpot(seps: readonly EditorSeparation[], hex: string): EditorSeparation[];
83
+ /**
84
+ * Lookup a registered spot by hex. Case-insensitive.
85
+ *
86
+ * @returns The matching `EditorSeparation` or `undefined`.
87
+ *
88
+ * @public
89
+ */
90
+ export declare function findSpotByColor(seps: readonly EditorSeparation[], hex: string): EditorSeparation | undefined;
91
+ /**
92
+ * Identity helper — returns the list as-is for symmetry with the
93
+ * other registry verbs. Use this at the export site to thread the
94
+ * page's spots into `JobSubmitRequest.separationsOverride`.
95
+ *
96
+ * @public
97
+ */
98
+ export declare function listSpots(seps: readonly EditorSeparation[]): EditorSeparation[];
99
+ //# sourceMappingURL=separations-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separations-registry.d.ts","sourceRoot":"","sources":["../../src/lib/separations-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;IACzD,gEAAgE;IAChE,GAAG,EAAE,MAAM,C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PL-3.0-or-later
2
+ /**
3
+ * Add (or replace) a spot keyed by `hex`. Idempotent — registering
4
+ * the same hex twice updates the existing entry rather than
5
+ * appending a duplicate. Comparison is case-insensitive.
6
+ *
7
+ * @returns A new array with the spot present. The input is not
8
+ * mutated.
9
+ *
10
+ * @public
11
+ */
12
+ export function registerSpot(seps, hex, name, opts = {}) {
13
+ const normalized = hex.toLowerCase();
14
+ const next = {
15
+ name,
16
+ colorSpace: opts.colorSpace ?? "Spot",
17
+ hex: normalized,
18
+ ...(opts.pantone !== undefined ? { pantone: opts.pantone } : {}),
19
+ ...(opts.lab !== undefined ? { lab: opts.lab } : {}),
20
+ ...(opts.type !== undefined ? { type: opts.type } : {}),
21
+ };
22
+ const existingIdx = seps.findIndex((s) => s.hex.toLowerCase() === normalized);
23
+ if (existingIdx === -1)
24
+ return [...seps, next];
25
+ return seps.map((s, i) => (i === existingIdx ? next : s));
26
+ }
27
+ /**
28
+ * Remove a spot by hex. No-op if absent.
29
+ *
30
+ * @returns A new array with the matching entry removed.
31
+ *
32
+ * @public
33
+ */
34
+ export function unregisterSpot(seps, hex) {
35
+ const normalized = hex.toLowerCase();
36
+ return seps.filter((s) => s.hex.toLowerCase() !== normalized);
37
+ }
38
+ /**
39
+ * Lookup a registered spot by hex. Case-insensitive.
40
+ *
41
+ * @returns The matching `EditorSeparation` or `undefined`.
42
+ *
43
+ * @public
44
+ */
45
+ export function findSpotByColor(seps, hex) {
46
+ const normalized = hex.toLowerCase();
47
+ return seps.find((s) => s.hex.toLowerCase() === normalized);
48
+ }
49
+ /**
50
+ * Identity helper — returns the list as-is for symmetry with the
51
+ * other registry verbs. Use this at the export site to thread the
52
+ * page's spots into `JobSubmitRequest.separationsOverride`.
53
+ *
54
+ * @public
55
+ */
56
+ export function listSpots(seps) {
57
+ return [...seps];
58
+ }
59
+ //# sourceMappingURL=separations-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separations-registry.js","sourceRoot":"","sources":["../../src/lib/separations-registry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AG,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAiC,EACjC,GAAW;IAEX,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAiC;IACzD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Wave 3 O3 — Streaming render: shared types + pure helpers.
3
+ *
4
+ * The compile-pdf side ships a `POST /v1/compose/stream` SSE
5
+ * endpoint that emits one event per page-start, page-done,
6
+ * output-chunk (chunked PDF bytes for progressive download), and a
7
+ * terminal `done` or `error`. The editor side wires an
8
+ * EventSource-style adapter (or a mock for tests) and surfaces
9
+ * progress.
10
+ *
11
+ * This module owns:
12
+ * - The discriminated-union event shape.
13
+ * - `parseStreamingRenderEvent` — pure parser. Returns null on
14
+ * malformed input rather than throwing; the consumer is free to
15
+ * drop unrecognised events.
16
+ * - `summarizeStreamingProgress` — folds an event sequence into a
17
+ * summary suitable for a progress bar.
18
+ *
19
+ * @public
20
+ */
21
+ /**
22
+ * Per-event payload shapes emitted by the streaming compose
23
+ * endpoint. The discriminator is `kind`. `event` exists on the SSE
24
+ * envelope; we lift it onto the parsed type for ergonomics.
25
+ *
26
+ * @public
27
+ */
28
+ export type StreamingRenderEvent = {
29
+ kind: "page-start";
30
+ pageIndex: number;
31
+ totalPages: number;
32
+ } | {
33
+ kind: "page-done";
34
+ pageIndex: number;
35
+ totalPages: number;
36
+ /** Wall-clock duration of the page render, in milliseconds. */
37
+ ms: number;
38
+ } | {
39
+ kind: "output-chunk";
40
+ /** Base64-encoded PDF bytes for this chunk. The consumer
41
+ * concatenates chunks to form the final PDF. */
42
+ chunkB64: string;
43
+ /** Cumulative bytes emitted so far (sum of decoded chunks). */
44
+ bytesEmitted: number;
45
+ } | {
46
+ kind: "done";
47
+ pdfSha256: string;
48
+ cacheKey: string;
49
+ } | {
50
+ kind: "error";
51
+ message: string;
52
+ code: string;
53
+ };
54
+ /**
55
+ * Pure parser — converts one SSE event (raw `event` field name +
56
+ * raw `data` JSON string) into a typed {@link StreamingRenderEvent}.
57
+ * Returns `null` for malformed input (bad JSON, unknown event kind,
58
+ * missing required fields). The consumer is free to drop nulls
59
+ * rather than abort the stream.
60
+ *
61
+ * Pure function.
62
+ *
63
+ * @public
64
+ */
65
+ export declare function parseStreamingRenderEvent(eventName: string, data: string): StreamingRenderEvent | null;
66
+ /**
67
+ * Aggregate progress summary computed from an event sequence.
68
+ * Suitable for driving a progress bar, percentage chip, or
69
+ * per-page badge list.
70
+ *
71
+ * @public
72
+ */
73
+ export type StreamingProgress = {
74
+ /** 0..100. 100 when status is "done". */
75
+ percent: number;
76
+ completedPages: number;
77
+ totalPages: number;
78
+ /** Index of the page currently in-flight, or null when none. */
79
+ currentPage: number | null;
80
+ /** Cumulative decoded bytes received. */
81
+ receivedBytes: number;
82
+ status: "running" | "done" | "error";
83
+ /** Populated when status is "error". */
84
+ errorMessage?: string;
85
+ /** Set of `pageIndex` values that have landed `page-done` —
86
+ * exposed so per-page badge renderers can do O(1) "is page N
87
+ * done?" lookups instead of re-scanning the raw event list. */
88
+ completedPageIndices: ReadonlySet<number>;
89
+ };
90
+ /**
91
+ * Pure helper — folds an event sequence into a single
92
+ * {@link StreamingProgress}. Idempotent and order-tolerant beyond
93
+ * the obvious page-start-before-page-done constraint.
94
+ *
95
+ * Pure function.
96
+ *
97
+ * @public
98
+ */
99
+ export declare function summarizeStreamingProgress(events: readonly StreamingRenderEvent[]): StreamingProgress;
100
+ //# sourceMappingURL=streaming-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-render.d.ts","sourceRoot":"","sources":["../../src/lib/streaming-render.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB;qDACiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,oBAAoB,GAAG,IAAI,CA6C7B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;oEAEgE;IAChE,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,oBAAoB,EAAE,GACtC,iBAAiB,CA0DnB"}
@@ -0,0 +1,132 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ /**
3
+ * Pure parser — converts one SSE event (raw `event` field name +
4
+ * raw `data` JSON string) into a typed {@link StreamingRenderEvent}.
5
+ * Returns `null` for malformed input (bad JSON, unknown event kind,
6
+ * missing required fields). The consumer is free to drop nulls
7
+ * rather than abort the stream.
8
+ *
9
+ * Pure function.
10
+ *
11
+ * @public
12
+ */
13
+ export function parseStreamingRenderEvent(eventName, data) {
14
+ let parsed;
15
+ try {
16
+ parsed = JSON.parse(data);
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ if (!parsed || typeof parsed !== "object")
22
+ return null;
23
+ const p = parsed;
24
+ switch (eventName) {
25
+ case "page-start": {
26
+ const pageIndex = p.pageIndex;
27
+ const totalPages = p.totalPages;
28
+ if (typeof pageIndex !== "number" || typeof totalPages !== "number")
29
+ return null;
30
+ return { kind: "page-start", pageIndex, totalPages };
31
+ }
32
+ case "page-done": {
33
+ const pageIndex = p.pageIndex;
34
+ const totalPages = p.totalPages;
35
+ const ms = p.ms;
36
+ if (typeof pageIndex !== "number" || typeof totalPages !== "number")
37
+ return null;
38
+ if (typeof ms !== "number")
39
+ return null;
40
+ return { kind: "page-done", pageIndex, totalPages, ms };
41
+ }
42
+ case "output-chunk": {
43
+ const chunkB64 = p.chunkB64;
44
+ const bytesEmitted = p.bytesEmitted;
45
+ if (typeof chunkB64 !== "string" || typeof bytesEmitted !== "number")
46
+ return null;
47
+ return { kind: "output-chunk", chunkB64, bytesEmitted };
48
+ }
49
+ case "done": {
50
+ const pdfSha256 = p.pdf_sha256 ?? p.pdfSha256;
51
+ const cacheKey = p.cache_key ?? p.cacheKey;
52
+ if (typeof pdfSha256 !== "string" || typeof cacheKey !== "string")
53
+ return null;
54
+ return { kind: "done", pdfSha256, cacheKey };
55
+ }
56
+ case "error": {
57
+ const message = p.message;
58
+ const code = p.code;
59
+ if (typeof message !== "string" || typeof code !== "string")
60
+ return null;
61
+ return { kind: "error", message, code };
62
+ }
63
+ default:
64
+ return null;
65
+ }
66
+ }
67
+ /**
68
+ * Pure helper — folds an event sequence into a single
69
+ * {@link StreamingProgress}. Idempotent and order-tolerant beyond
70
+ * the obvious page-start-before-page-done constraint.
71
+ *
72
+ * Pure function.
73
+ *
74
+ * @public
75
+ */
76
+ export function summarizeStreamingProgress(events) {
77
+ // Track completion per page index so a duplicate `page-done`
78
+ // (backend retry, replay, etc.) doesn't double-count and push
79
+ // the percent above 100.
80
+ const completed = new Set();
81
+ let totalPages = 0;
82
+ let currentPage = null;
83
+ let receivedBytes = 0;
84
+ let status = "running";
85
+ let errorMessage;
86
+ for (const ev of events) {
87
+ switch (ev.kind) {
88
+ case "page-start":
89
+ totalPages = Math.max(totalPages, ev.totalPages);
90
+ currentPage = ev.pageIndex;
91
+ break;
92
+ case "page-done":
93
+ totalPages = Math.max(totalPages, ev.totalPages);
94
+ completed.add(ev.pageIndex);
95
+ if (currentPage === ev.pageIndex)
96
+ currentPage = null;
97
+ break;
98
+ case "output-chunk":
99
+ receivedBytes = Math.max(receivedBytes, ev.bytesEmitted);
100
+ break;
101
+ case "done":
102
+ status = "done";
103
+ currentPage = null;
104
+ break;
105
+ case "error":
106
+ status = "error";
107
+ errorMessage = ev.message;
108
+ currentPage = null;
109
+ break;
110
+ }
111
+ }
112
+ const completedPages = completed.size;
113
+ const percent = status === "done"
114
+ ? 100
115
+ : totalPages > 0
116
+ ? Math.min(100, Math.round((completedPages / totalPages) * 100))
117
+ : 0;
118
+ return {
119
+ percent,
120
+ completedPages,
121
+ totalPages,
122
+ currentPage,
123
+ receivedBytes,
124
+ status,
125
+ ...(errorMessage !== undefined && { errorMessage }),
126
+ /** Set of pageIndex values that have landed `page-done`.
127
+ * Exposed for consumers that render per-page badges so they
128
+ * don't have to re-scan the raw event list. */
129
+ completedPageIndices: completed,
130
+ };
131
+ }
132
+ //# sourceMappingURL=streaming-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-render.js","sourceRoot":"","sources":["../../src/lib/streaming-render.ts"],"names":[],"mappings":"AAAA,6CAA6C;AA8D7C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAiB,EACjB,IAAY;IAEZ,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,CAAC,GAAG,MAAiC,CAAC;IAC5C,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;YAC9B,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;YAChC,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,UAAU,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YACjF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;QACvD,CAAC;QACD,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;YAC9B,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;YAChC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAA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nB,MAAM;QACV,CAAC;IACH,CAAC;IAED,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC;IACtC,MAAM,OAAO,GACX,MAAM,KAAK,MAAM;QACf,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,UAAU,GAAG,CAAC;YACd,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC,CAAC;IAEV,OAAO;QACL,OAAO;QACP,cAAc;QACd,UAAU;QACV,WAAW;QACX,aAAa;QACb,MAAM;QACN,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;QACnD;;wDAEgD;QAChD,oBAAoB,EAAE,SAAS;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Mark a feature as "flag exists but UI not shipped". Idempotent.
3
+ *
4
+ * Typical call site is at the bottom of the module that *would*
5
+ * render the UI when wired:
6
+ *
7
+ * ```ts
8
+ * // packages/editor-app/src/components/SeparationsPanel.tsx
9
+ * import { markUnwired } from "../lib/unwired";
10
+ * markUnwired("separations"); // wire-up lands in Wave 1
11
+ * ```
12
+ *
13
+ * @public
14
+ */
15
+ export declare function markUnwired(feature: string): void;
16
+ /**
17
+ * Test whether a feature has been marked unwired. Used by
18
+ * {@link import("./editor-config").showFeature}; hosts generally
19
+ * don't need to call this directly.
20
+ *
21
+ * @public
22
+ */
23
+ export declare function isUnwired(feature: string): boolean;
24
+ /**
25
+ * Test-only — clear the unwired set. Not exported through the
26
+ * public barrel.
27
+ */
28
+ export declare function _resetUnwiredForTests(): void;
29
+ //# sourceMappingURL=unwired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwired.d.ts","sourceRoot":"","sources":["../../src/lib/unwired.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
@@ -0,0 +1,58 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ /**
3
+ * Unwired-feature registry.
4
+ *
5
+ * A feature is "unwired" when the *flag* exists in {@link EditorConfig}
6
+ * but the corresponding *UI* isn't shipped in this build yet (typical
7
+ * for forward-compatibility plumb-throughs like `enable_separations`
8
+ * — flag preps the surface; component lands in a later wave).
9
+ *
10
+ * Mirrors the pattern from `lens-pdf`. The set is module-scoped and
11
+ * in-memory only — there's no persistence. Components / packages
12
+ * call {@link markUnwired} at module-init time; {@link showFeature}
13
+ * reads via {@link isUnwired} to suppress UI for features whose flag
14
+ * is on but whose implementation hasn't landed.
15
+ *
16
+ * **The registry itself is the source of truth.** When no module
17
+ * calls `markUnwired(...)`, every flagged feature ships live;
18
+ * adding plumb-only flags in future waves means landing a
19
+ * `markUnwired("<feature>")` call alongside the flag and removing
20
+ * it when the UI ships. `grep -rn 'markUnwired(' packages/editor-app/src`
21
+ * reports the current set without doc maintenance.
22
+ */
23
+ const UNWIRED = new Set();
24
+ /**
25
+ * Mark a feature as "flag exists but UI not shipped". Idempotent.
26
+ *
27
+ * Typical call site is at the bottom of the module that *would*
28
+ * render the UI when wired:
29
+ *
30
+ * ```ts
31
+ * // packages/editor-app/src/components/SeparationsPanel.tsx
32
+ * import { markUnwired } from "../lib/unwired";
33
+ * markUnwired("separations"); // wire-up lands in Wave 1
34
+ * ```
35
+ *
36
+ * @public
37
+ */
38
+ export function markUnwired(feature) {
39
+ UNWIRED.add(feature);
40
+ }
41
+ /**
42
+ * Test whether a feature has been marked unwired. Used by
43
+ * {@link import("./editor-config").showFeature}; hosts generally
44
+ * don't need to call this directly.
45
+ *
46
+ * @public
47
+ */
48
+ export function isUnwired(feature) {
49
+ return UNWIRED.has(feature);
50
+ }
51
+ /**
52
+ * Test-only — clear the unwired set. Not exported through the
53
+ * public barrel.
54
+ */
55
+ export function _resetUnwiredForTests() {
56
+ UNWIRED.clear();
57
+ }
58
+ //# sourceMappingURL=unwired.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwired.js","sourceRoot":"","sources":["../../src/lib/unwired.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@printwithsynergy/artwork-pdf-editor",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "artworkPDF WYSIWYG editor as a host-customizable React component. Drop-in mountable in Next.js, Astro, Remix, etc.",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -16,15 +16,16 @@
16
16
  "import": "./dist/lens/index.js"
17
17
  }
18
18
  },
19
- "files": ["dist", "README.md", "LICENSE"],
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
20
24
  "sideEffects": false,
21
- "scripts": {
22
- "build": "tsc -p tsconfig.build.json",
23
- "typecheck": "tsc --noEmit",
24
- "test": "vitest run --passWithNoTests"
25
- },
26
25
  "dependencies": {
27
- "pdf-lib": "^1.17.1"
26
+ "pdf-lib": "^1.17.1",
27
+ "three": "^0.170.0",
28
+ "@artworkpdf/dieline-parser": "0.1.0"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "react": "^19.0.0",
@@ -34,20 +35,28 @@
34
35
  "@printwithsynergy/lens-pdf": "^0.4.0-beta.17"
35
36
  },
36
37
  "peerDependenciesMeta": {
37
- "@printwithsynergy/lens-pdf": { "optional": true }
38
+ "@printwithsynergy/lens-pdf": {
39
+ "optional": true
40
+ }
38
41
  },
39
42
  "devDependencies": {
40
43
  "@printwithsynergy/lens-pdf": "^0.4.0-beta.17",
41
44
  "@types/react": "^19.0.0",
42
45
  "@types/react-dom": "^19.0.0",
46
+ "@types/three": "^0.170.0",
43
47
  "konva": "^10.3.0",
44
48
  "react": "^19.0.0",
45
49
  "react-dom": "^19.0.0",
46
50
  "react-konva": "^19.0.0",
47
51
  "typescript": "^5.7.0",
48
- "vitest": "^3.2.0"
52
+ "vitest": "^4.1.0"
49
53
  },
50
54
  "publishConfig": {
51
55
  "access": "public"
56
+ },
57
+ "scripts": {
58
+ "build": "tsc -p tsconfig.build.json",
59
+ "typecheck": "tsc --noEmit",
60
+ "test": "vitest run --passWithNoTests"
52
61
  }
53
- }
62
+ }
@@ -1,9 +0,0 @@
1
- import type { CanvasObj } from "./EditorCanvas";
2
- type Props = {
3
- objects: CanvasObj[];
4
- hidden: Set<string>;
5
- onToggle: (color: string) => void;
6
- };
7
- export declare function SeparationsPanel({ objects, hidden, onToggle }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
9
- //# sourceMappingURL=SeparationsPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SeparationsPanel.d.ts","sourceRoot":"","sources":["../../src/components/SeparationsPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AA6HF,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAuGpE"}