@wordpress/media-editor 0.7.1-next.v.202604201441.0 → 0.8.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 (300) hide show
  1. package/build/components/media-editor-canvas/index.cjs +54 -0
  2. package/build/components/media-editor-canvas/index.cjs.map +7 -0
  3. package/build/components/media-editor-crop-panel/index.cjs +116 -0
  4. package/build/components/media-editor-crop-panel/index.cjs.map +7 -0
  5. package/build/components/media-editor-modal/build-modifiers.cjs +91 -0
  6. package/build/components/media-editor-modal/build-modifiers.cjs.map +7 -0
  7. package/build/components/media-editor-modal/index.cjs +497 -0
  8. package/build/components/media-editor-modal/index.cjs.map +7 -0
  9. package/build/components/media-editor-toolbar/index.cjs +146 -0
  10. package/build/components/media-editor-toolbar/index.cjs.map +7 -0
  11. package/build/image-editor/core/camera.cjs +194 -0
  12. package/build/image-editor/core/camera.cjs.map +7 -0
  13. package/build/image-editor/core/constants.cjs +81 -0
  14. package/build/image-editor/core/constants.cjs.map +7 -0
  15. package/build/image-editor/core/containment.cjs +245 -0
  16. package/build/image-editor/core/containment.cjs.map +7 -0
  17. package/build/image-editor/core/export/canvas-renderer.cjs +151 -0
  18. package/build/image-editor/core/export/canvas-renderer.cjs.map +7 -0
  19. package/build/image-editor/core/index.cjs +50 -0
  20. package/build/image-editor/core/index.cjs.map +7 -0
  21. package/build/image-editor/core/interaction-controller.cjs +608 -0
  22. package/build/image-editor/core/interaction-controller.cjs.map +7 -0
  23. package/build/image-editor/core/math/rotation.cjs +41 -0
  24. package/build/image-editor/core/math/rotation.cjs.map +7 -0
  25. package/build/image-editor/core/source-region.cjs +95 -0
  26. package/build/image-editor/core/source-region.cjs.map +7 -0
  27. package/build/image-editor/core/state.cjs +269 -0
  28. package/build/image-editor/core/state.cjs.map +7 -0
  29. package/build/image-editor/core/stencil-math.cjs +197 -0
  30. package/build/image-editor/core/stencil-math.cjs.map +7 -0
  31. package/build/image-editor/core/transform-style.cjs +46 -0
  32. package/build/image-editor/core/transform-style.cjs.map +7 -0
  33. package/build/image-editor/core/transforms/pipeline.cjs +43 -0
  34. package/build/image-editor/core/transforms/pipeline.cjs.map +7 -0
  35. package/build/image-editor/core/types.cjs +19 -0
  36. package/build/image-editor/core/types.cjs.map +7 -0
  37. package/build/image-editor/index.cjs +57 -0
  38. package/build/image-editor/index.cjs.map +7 -0
  39. package/build/image-editor/react/components/cropper-provider.cjs +50 -0
  40. package/build/image-editor/react/components/cropper-provider.cjs.map +7 -0
  41. package/build/image-editor/react/components/cropper.cjs +365 -0
  42. package/build/image-editor/react/components/cropper.cjs.map +7 -0
  43. package/build/image-editor/react/components/index.cjs +36 -0
  44. package/build/image-editor/react/components/index.cjs.map +7 -0
  45. package/build/image-editor/react/components/overlays/dimming-overlay.cjs +58 -0
  46. package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +7 -0
  47. package/build/image-editor/react/components/overlays/grid-overlay.cjs +91 -0
  48. package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +7 -0
  49. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +351 -0
  50. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +7 -0
  51. package/build/image-editor/react/hooks/index.cjs +31 -0
  52. package/build/image-editor/react/hooks/index.cjs.map +7 -0
  53. package/build/image-editor/react/hooks/use-aria-announcer.cjs +68 -0
  54. package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +7 -0
  55. package/build/image-editor/react/hooks/use-cropper-state.cjs +158 -0
  56. package/build/image-editor/react/hooks/use-cropper-state.cjs.map +7 -0
  57. package/build/image-editor/react/hooks/use-interaction.cjs +161 -0
  58. package/build/image-editor/react/hooks/use-interaction.cjs.map +7 -0
  59. package/build/image-editor/react/hooks/use-transform-style.cjs +38 -0
  60. package/build/image-editor/react/hooks/use-transform-style.cjs.map +7 -0
  61. package/build/index.cjs +5 -2
  62. package/build/index.cjs.map +2 -2
  63. package/build/lock-unlock.cjs +37 -0
  64. package/build/lock-unlock.cjs.map +7 -0
  65. package/build/private-apis.cjs +38 -0
  66. package/build/private-apis.cjs.map +7 -0
  67. package/build/store/actions.cjs +45 -0
  68. package/build/store/actions.cjs.map +7 -0
  69. package/build/store/constants.cjs +31 -0
  70. package/build/store/constants.cjs.map +7 -0
  71. package/build/store/index.cjs +51 -0
  72. package/build/store/index.cjs.map +7 -0
  73. package/build/store/reducer.cjs +51 -0
  74. package/build/store/reducer.cjs.map +7 -0
  75. package/build/store/selectors.cjs +43 -0
  76. package/build/store/selectors.cjs.map +7 -0
  77. package/build-module/components/media-editor-canvas/index.mjs +33 -0
  78. package/build-module/components/media-editor-canvas/index.mjs.map +7 -0
  79. package/build-module/components/media-editor-crop-panel/index.mjs +100 -0
  80. package/build-module/components/media-editor-crop-panel/index.mjs.map +7 -0
  81. package/build-module/components/media-editor-modal/build-modifiers.mjs +66 -0
  82. package/build-module/components/media-editor-modal/build-modifiers.mjs.map +7 -0
  83. package/build-module/components/media-editor-modal/index.mjs +483 -0
  84. package/build-module/components/media-editor-modal/index.mjs.map +7 -0
  85. package/build-module/components/media-editor-toolbar/index.mjs +130 -0
  86. package/build-module/components/media-editor-toolbar/index.mjs.map +7 -0
  87. package/build-module/image-editor/core/camera.mjs +163 -0
  88. package/build-module/image-editor/core/camera.mjs.map +7 -0
  89. package/build-module/image-editor/core/constants.mjs +51 -0
  90. package/build-module/image-editor/core/constants.mjs.map +7 -0
  91. package/build-module/image-editor/core/containment.mjs +218 -0
  92. package/build-module/image-editor/core/containment.mjs.map +7 -0
  93. package/build-module/image-editor/core/export/canvas-renderer.mjs +120 -0
  94. package/build-module/image-editor/core/export/canvas-renderer.mjs.map +7 -0
  95. package/build-module/image-editor/core/index.mjs +24 -0
  96. package/build-module/image-editor/core/index.mjs.map +7 -0
  97. package/build-module/image-editor/core/interaction-controller.mjs +583 -0
  98. package/build-module/image-editor/core/interaction-controller.mjs.map +7 -0
  99. package/build-module/image-editor/core/math/rotation.mjs +15 -0
  100. package/build-module/image-editor/core/math/rotation.mjs.map +7 -0
  101. package/build-module/image-editor/core/source-region.mjs +69 -0
  102. package/build-module/image-editor/core/source-region.mjs.map +7 -0
  103. package/build-module/image-editor/core/state.mjs +242 -0
  104. package/build-module/image-editor/core/state.mjs.map +7 -0
  105. package/build-module/image-editor/core/stencil-math.mjs +169 -0
  106. package/build-module/image-editor/core/stencil-math.mjs.map +7 -0
  107. package/build-module/image-editor/core/transform-style.mjs +21 -0
  108. package/build-module/image-editor/core/transform-style.mjs.map +7 -0
  109. package/build-module/image-editor/core/transforms/pipeline.mjs +17 -0
  110. package/build-module/image-editor/core/transforms/pipeline.mjs.map +7 -0
  111. package/build-module/image-editor/core/types.mjs +1 -0
  112. package/build-module/image-editor/core/types.mjs.map +7 -0
  113. package/build-module/image-editor/index.mjs +30 -0
  114. package/build-module/image-editor/index.mjs.map +7 -0
  115. package/build-module/image-editor/react/components/cropper-provider.mjs +26 -0
  116. package/build-module/image-editor/react/components/cropper-provider.mjs.map +7 -0
  117. package/build-module/image-editor/react/components/cropper.mjs +337 -0
  118. package/build-module/image-editor/react/components/cropper.mjs.map +7 -0
  119. package/build-module/image-editor/react/components/index.mjs +9 -0
  120. package/build-module/image-editor/react/components/index.mjs.map +7 -0
  121. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +33 -0
  122. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +7 -0
  123. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +66 -0
  124. package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +7 -0
  125. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +330 -0
  126. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +7 -0
  127. package/build-module/image-editor/react/hooks/index.mjs +6 -0
  128. package/build-module/image-editor/react/hooks/index.mjs.map +7 -0
  129. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +43 -0
  130. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +7 -0
  131. package/build-module/image-editor/react/hooks/use-cropper-state.mjs +137 -0
  132. package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +7 -0
  133. package/build-module/image-editor/react/hooks/use-interaction.mjs +138 -0
  134. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +7 -0
  135. package/build-module/image-editor/react/hooks/use-transform-style.mjs +13 -0
  136. package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +7 -0
  137. package/build-module/index.mjs +3 -1
  138. package/build-module/index.mjs.map +2 -2
  139. package/build-module/lock-unlock.mjs +11 -0
  140. package/build-module/lock-unlock.mjs.map +7 -0
  141. package/build-module/private-apis.mjs +13 -0
  142. package/build-module/private-apis.mjs.map +7 -0
  143. package/build-module/store/actions.mjs +19 -0
  144. package/build-module/store/actions.mjs.map +7 -0
  145. package/build-module/store/constants.mjs +6 -0
  146. package/build-module/store/constants.mjs.map +7 -0
  147. package/build-module/store/index.mjs +16 -0
  148. package/build-module/store/index.mjs.map +7 -0
  149. package/build-module/store/reducer.mjs +26 -0
  150. package/build-module/store/reducer.mjs.map +7 -0
  151. package/build-module/store/selectors.mjs +16 -0
  152. package/build-module/store/selectors.mjs.map +7 -0
  153. package/build-style/style-rtl.css +315 -0
  154. package/build-style/style.css +315 -0
  155. package/build-types/components/media-editor-canvas/index.d.ts +22 -0
  156. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -0
  157. package/build-types/components/media-editor-crop-panel/index.d.ts +45 -0
  158. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -0
  159. package/build-types/components/media-editor-modal/build-modifiers.d.ts +83 -0
  160. package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -0
  161. package/build-types/components/media-editor-modal/index.d.ts +20 -0
  162. package/build-types/components/media-editor-modal/index.d.ts.map +1 -0
  163. package/build-types/components/media-editor-toolbar/index.d.ts +21 -0
  164. package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -0
  165. package/build-types/image-editor/core/camera.d.ts +107 -0
  166. package/build-types/image-editor/core/camera.d.ts.map +1 -0
  167. package/build-types/image-editor/core/constants.d.ts +46 -0
  168. package/build-types/image-editor/core/constants.d.ts.map +1 -0
  169. package/build-types/image-editor/core/containment.d.ts +61 -0
  170. package/build-types/image-editor/core/containment.d.ts.map +1 -0
  171. package/build-types/image-editor/core/export/canvas-renderer.d.ts +106 -0
  172. package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +1 -0
  173. package/build-types/image-editor/core/index.d.ts +8 -0
  174. package/build-types/image-editor/core/index.d.ts.map +1 -0
  175. package/build-types/image-editor/core/interaction-controller.d.ts +178 -0
  176. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -0
  177. package/build-types/image-editor/core/math/rotation.d.ts +18 -0
  178. package/build-types/image-editor/core/math/rotation.d.ts.map +1 -0
  179. package/build-types/image-editor/core/source-region.d.ts +75 -0
  180. package/build-types/image-editor/core/source-region.d.ts.map +1 -0
  181. package/build-types/image-editor/core/state.d.ts +42 -0
  182. package/build-types/image-editor/core/state.d.ts.map +1 -0
  183. package/build-types/image-editor/core/stencil-math.d.ts +79 -0
  184. package/build-types/image-editor/core/stencil-math.d.ts.map +1 -0
  185. package/build-types/image-editor/core/transform-style.d.ts +23 -0
  186. package/build-types/image-editor/core/transform-style.d.ts.map +1 -0
  187. package/build-types/image-editor/core/transforms/pipeline.d.ts +27 -0
  188. package/build-types/image-editor/core/transforms/pipeline.d.ts.map +1 -0
  189. package/build-types/image-editor/core/types.d.ts +211 -0
  190. package/build-types/image-editor/core/types.d.ts.map +1 -0
  191. package/build-types/image-editor/index.d.ts +16 -0
  192. package/build-types/image-editor/index.d.ts.map +1 -0
  193. package/build-types/image-editor/react/components/cropper-provider.d.ts +37 -0
  194. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -0
  195. package/build-types/image-editor/react/components/cropper.d.ts +59 -0
  196. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -0
  197. package/build-types/image-editor/react/components/index.d.ts +4 -0
  198. package/build-types/image-editor/react/components/index.d.ts.map +1 -0
  199. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +30 -0
  200. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -0
  201. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +30 -0
  202. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -0
  203. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +32 -0
  204. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -0
  205. package/build-types/image-editor/react/hooks/index.d.ts +3 -0
  206. package/build-types/image-editor/react/hooks/index.d.ts.map +1 -0
  207. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +16 -0
  208. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -0
  209. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +68 -0
  210. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -0
  211. package/build-types/image-editor/react/hooks/use-interaction.d.ts +60 -0
  212. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -0
  213. package/build-types/image-editor/react/hooks/use-transform-style.d.ts +16 -0
  214. package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +1 -0
  215. package/build-types/image-editor/stories/rectangle-crop.story.d.ts +16 -0
  216. package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -0
  217. package/build-types/index.d.ts +1 -0
  218. package/build-types/index.d.ts.map +1 -1
  219. package/build-types/lock-unlock.d.ts +2 -0
  220. package/build-types/lock-unlock.d.ts.map +1 -0
  221. package/build-types/private-apis.d.ts +2 -0
  222. package/build-types/private-apis.d.ts.map +1 -0
  223. package/build-types/store/actions.d.ts +27 -0
  224. package/build-types/store/actions.d.ts.map +1 -0
  225. package/build-types/store/constants.d.ts +2 -0
  226. package/build-types/store/constants.d.ts.map +1 -0
  227. package/build-types/store/index.d.ts +4 -0
  228. package/build-types/store/index.d.ts.map +1 -0
  229. package/build-types/store/reducer.d.ts +23 -0
  230. package/build-types/store/reducer.d.ts.map +1 -0
  231. package/build-types/store/selectors.d.ts +8 -0
  232. package/build-types/store/selectors.d.ts.map +1 -0
  233. package/package.json +21 -7
  234. package/src/components/media-editor-canvas/index.tsx +56 -0
  235. package/src/components/media-editor-canvas/style.scss +9 -0
  236. package/src/components/media-editor-crop-panel/index.tsx +143 -0
  237. package/src/components/media-editor-modal/build-modifiers.ts +164 -0
  238. package/src/components/media-editor-modal/index.tsx +639 -0
  239. package/src/components/media-editor-modal/style.scss +139 -0
  240. package/src/components/media-editor-modal/test/build-modifiers.test.ts +343 -0
  241. package/src/components/media-editor-toolbar/index.tsx +150 -0
  242. package/src/components/media-editor-toolbar/style.scss +21 -0
  243. package/src/image-editor/README.md +162 -0
  244. package/src/image-editor/core/camera.ts +352 -0
  245. package/src/image-editor/core/constants.ts +93 -0
  246. package/src/image-editor/core/containment.ts +435 -0
  247. package/src/image-editor/core/export/canvas-renderer.ts +253 -0
  248. package/src/image-editor/core/export/test/canvas-renderer.ts +813 -0
  249. package/src/image-editor/core/index.ts +35 -0
  250. package/src/image-editor/core/interaction-controller.ts +889 -0
  251. package/src/image-editor/core/math/rotation.ts +26 -0
  252. package/src/image-editor/core/source-region.ts +166 -0
  253. package/src/image-editor/core/state.ts +428 -0
  254. package/src/image-editor/core/stencil-math.ts +330 -0
  255. package/src/image-editor/core/test/camera.ts +593 -0
  256. package/src/image-editor/core/test/interaction-controller.ts +996 -0
  257. package/src/image-editor/core/test/preview-export-parity.ts +242 -0
  258. package/src/image-editor/core/test/render-camera-bridge.ts +348 -0
  259. package/src/image-editor/core/test/state.ts +762 -0
  260. package/src/image-editor/core/test/stencil-math.ts +321 -0
  261. package/src/image-editor/core/transform-style.ts +44 -0
  262. package/src/image-editor/core/transforms/pipeline.ts +43 -0
  263. package/src/image-editor/core/transforms/test/pipeline.ts +269 -0
  264. package/src/image-editor/core/types.ts +177 -0
  265. package/src/image-editor/docs/architecture.md +96 -0
  266. package/src/image-editor/docs/recipes.md +720 -0
  267. package/src/image-editor/docs/roadmap.md +66 -0
  268. package/src/image-editor/index.ts +43 -0
  269. package/src/image-editor/react/components/cropper-provider.tsx +73 -0
  270. package/src/image-editor/react/components/cropper.scss +195 -0
  271. package/src/image-editor/react/components/cropper.tsx +534 -0
  272. package/src/image-editor/react/components/index.ts +3 -0
  273. package/src/image-editor/react/components/overlays/dimming-overlay.tsx +57 -0
  274. package/src/image-editor/react/components/overlays/grid-overlay.tsx +80 -0
  275. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +513 -0
  276. package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +265 -0
  277. package/src/image-editor/react/components/test/cropper.tsx +140 -0
  278. package/src/image-editor/react/hooks/index.ts +2 -0
  279. package/src/image-editor/react/hooks/test/use-cropper-state.ts +913 -0
  280. package/src/image-editor/react/hooks/test/use-interaction.ts +218 -0
  281. package/src/image-editor/react/hooks/test/use-transform-style.ts +146 -0
  282. package/src/image-editor/react/hooks/use-aria-announcer.ts +64 -0
  283. package/src/image-editor/react/hooks/use-cropper-state.ts +238 -0
  284. package/src/image-editor/react/hooks/use-interaction.ts +223 -0
  285. package/src/image-editor/react/hooks/use-transform-style.ts +30 -0
  286. package/src/image-editor/stories/rectangle-crop.story.tsx +1085 -0
  287. package/src/image-editor/stories/style.css +94 -0
  288. package/src/image-editor/style.scss +1 -0
  289. package/src/index.ts +3 -0
  290. package/src/lock-unlock.ts +10 -0
  291. package/src/private-apis.ts +12 -0
  292. package/src/store/actions.ts +33 -0
  293. package/src/store/constants.ts +1 -0
  294. package/src/store/index.ts +20 -0
  295. package/src/store/reducer.ts +48 -0
  296. package/src/store/selectors.ts +16 -0
  297. package/src/store/test/reducer.ts +57 -0
  298. package/src/style.scss +4 -0
  299. package/tsconfig.json +10 -2
  300. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CropperState, NormalizedPoint, Size } from './types';
5
+ /**
6
+ * Status reported by the interaction controller when drag/zoom state changes.
7
+ */
8
+ export interface InteractionStatus {
9
+ /** Whether a drag (pan) interaction is in progress. */
10
+ isDragging: boolean;
11
+ /** Whether a double-tap zoom animation is in progress. */
12
+ isZooming: boolean;
13
+ }
14
+ /**
15
+ * State updates the interaction controller can request from its host UI.
16
+ */
17
+ export interface CropperInteractionActions {
18
+ /** Set the image pan offset in normalized coordinates. */
19
+ setPan: (pan: NormalizedPoint) => void;
20
+ /** Set the zoom level. */
21
+ setZoom: (zoom: number) => void;
22
+ /** Set zoom and pan together for focal-point zoom. */
23
+ setZoomAtPoint: (zoom: number, pan: NormalizedPoint) => void;
24
+ /** Snap rotate by 90 degrees. */
25
+ snapRotate90: (direction: 1 | -1) => void;
26
+ }
27
+ /**
28
+ * Options for creating an InteractionController.
29
+ *
30
+ * Scalar options (minZoom, maxZoom, etc.) are read lazily on each
31
+ * interaction, so changes to the options object take effect immediately
32
+ * without recreating the controller.
33
+ */
34
+ export interface InteractionControllerOptions {
35
+ /** Returns the current cropper state. Called on every interaction. */
36
+ getState: () => CropperState;
37
+ /** State updates the interaction controller can request from its host UI. */
38
+ actions: CropperInteractionActions;
39
+ /** Returns the container dimensions in pixels. */
40
+ getContainerSize: () => Size;
41
+ /** Returns the rendered image dimensions in pixels, if available. */
42
+ getImageSize: () => Size | undefined;
43
+ /** Minimum zoom level. Defaults to MIN_ZOOM. Read lazily. */
44
+ minZoom?: number;
45
+ /** Maximum zoom level. Defaults to MAX_ZOOM. Read lazily. */
46
+ maxZoom?: number;
47
+ /** Zoom speed multiplier for wheel events. Defaults to 0.01. Read lazily. */
48
+ zoomSpeed?: number;
49
+ /** Pan step size in normalized coords for keyboard events. Defaults to 0.05. Read lazily. */
50
+ keyboardStep?: number;
51
+ /** Zoom level for double-tap zoom. Defaults to 2. Read lazily. */
52
+ doubleTapZoom?: number;
53
+ /** Fires when a continuous gesture begins (pan drag, pinch zoom). */
54
+ onGestureStart?: () => void;
55
+ /** Fires when a continuous gesture ends (pointer release). */
56
+ onGestureEnd?: () => void;
57
+ /** Called when isDragging or isZooming changes. */
58
+ onStatusChange?: (status: InteractionStatus) => void;
59
+ }
60
+ /**
61
+ * Framework-agnostic imperative controller for image cropper interactions.
62
+ *
63
+ * Handles mouse, touch, and keyboard event processing for pan, zoom,
64
+ * and crop manipulation. Uses requestAnimationFrame for drag/pinch
65
+ * updates to avoid layout thrashing.
66
+ *
67
+ * The controller does not register DOM event listeners itself — that is the
68
+ * responsibility of the UI layer (React hook, Vue directive, or vanilla JS).
69
+ * Instead it exposes `handlePointerDown`, `handleWheel`, `handleTouchStart`,
70
+ * and `handleKeyDown` methods that the UI layer calls with native DOM events.
71
+ *
72
+ * Scalar options (minZoom, maxZoom, zoomSpeed, keyboardStep, doubleTapZoom)
73
+ * are read lazily from `this.options` on each interaction, so the UI layer
74
+ * can update them without recreating the controller.
75
+ *
76
+ * Call `destroy()` to clean up timers and pending animation frames.
77
+ */
78
+ export declare class InteractionController {
79
+ private readonly options;
80
+ /** Current drag/zoom status. */
81
+ private isDragging;
82
+ private isZooming;
83
+ /** Active drag state during pointer interactions. */
84
+ private drag;
85
+ /** Active touch state during touch interactions. */
86
+ private touch;
87
+ /** Cleanup function for active touch listeners on document. */
88
+ private touchCleanup;
89
+ /**
90
+ * Cleanup function for active pointer-drag listeners on the
91
+ * captured element. Set while a pointer drag is in progress so
92
+ * `destroy()` can tear the drag down cleanly if the consumer
93
+ * unmounts mid-drag. Cleared on pointerup/lostpointercapture.
94
+ */
95
+ private pointerCleanup;
96
+ /** Last tap info for double-tap detection. */
97
+ private lastTap;
98
+ /** Timer for the zoom animation state (double-tap). */
99
+ private zoomTimer;
100
+ /** Timer for wheel gesture debounce. */
101
+ private wheelGestureTimer;
102
+ /** Whether a wheel gesture is currently active. */
103
+ private wheelGestureActive;
104
+ /** Current requestAnimationFrame ID. */
105
+ private rafId;
106
+ constructor(options: InteractionControllerOptions);
107
+ /** Read minZoom lazily so option changes take effect immediately. */
108
+ private get minZoom();
109
+ /** Read maxZoom lazily so option changes take effect immediately. */
110
+ private get maxZoom();
111
+ /** Read zoomSpeed lazily so option changes take effect immediately. */
112
+ private get zoomSpeed();
113
+ /** Read keyboardStep lazily so option changes take effect immediately. */
114
+ private get keyboardStep();
115
+ /** Read doubleTapZoom lazily so option changes take effect immediately. */
116
+ private get doubleTapZoom();
117
+ /**
118
+ * Update the drag/zoom status and notify via callback if changed.
119
+ *
120
+ * @param update Partial status with isDragging and/or isZooming.
121
+ */
122
+ private setStatus;
123
+ /**
124
+ * Handle a pointer-down event on the container element.
125
+ *
126
+ * Initiates a drag (pan) interaction. Captures the pointer on the
127
+ * provided element and registers pointermove/pointerup/lostpointercapture
128
+ * listeners for the duration of the drag.
129
+ *
130
+ * @param e The native PointerEvent.
131
+ * @param el The DOM element to capture the pointer on.
132
+ */
133
+ handlePointerDown(e: PointerEvent, el: HTMLElement): void;
134
+ /**
135
+ * Handle a wheel event on the container element.
136
+ *
137
+ * Implements focal-point zoom: the point under the cursor stays
138
+ * stationary on screen while the zoom level changes.
139
+ *
140
+ * Must be registered with `{ passive: false }` to allow preventDefault.
141
+ *
142
+ * @param e The native WheelEvent.
143
+ */
144
+ handleWheel(e: WheelEvent): void;
145
+ /**
146
+ * Handle a touch-start event on the container element.
147
+ *
148
+ * Supports single-finger pan, two-finger pinch zoom, and
149
+ * double-tap to toggle between fit and 2x zoom. Registers
150
+ * touchmove/touchend/touchcancel on the provided document for the
151
+ * duration of the gesture.
152
+ *
153
+ * @param e The native TouchEvent.
154
+ * @param containerRect The bounding rect of the container element.
155
+ * @param doc The document to register move/end listeners on.
156
+ * Defaults to globalThis.document. Pass the iframe's
157
+ * contentDocument when running inside an iframe.
158
+ */
159
+ handleTouchStart(e: TouchEvent, containerRect: DOMRect, doc?: Document): void;
160
+ private handleTouchMove;
161
+ private tryDoubleTap;
162
+ /**
163
+ * Handle a keydown event on the container element.
164
+ *
165
+ * Supports arrow keys for panning, +/- for zoom, and r/R for rotation.
166
+ *
167
+ * @param e The native KeyboardEvent.
168
+ */
169
+ handleKeyDown(e: KeyboardEvent): void;
170
+ /**
171
+ * Clean up all timers, animation frames, and active touch listeners.
172
+ *
173
+ * Must be called when the controller is no longer needed (e.g., on
174
+ * component unmount or element removal).
175
+ */
176
+ destroy(): void;
177
+ }
178
+ //# sourceMappingURL=interaction-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Normalizes a rotation value to the range [0, 360).
3
+ *
4
+ * Negative rotations are converted to their positive clockwise equivalent.
5
+ * For example, -90 becomes 270, -45 becomes 315, and 450 becomes 90.
6
+ *
7
+ * @param degrees The rotation value in degrees.
8
+ * @return The normalized rotation in the range [0, 360).
9
+ */
10
+ export declare function normalizeRotation(degrees: number): number;
11
+ /**
12
+ * Converts an angle from degrees to radians.
13
+ *
14
+ * @param degrees The angle in degrees.
15
+ * @return The angle in radians.
16
+ */
17
+ export declare function degreesToRadians(degrees: number): number;
18
+ //# sourceMappingURL=rotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotation.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/core/math/rotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAE,OAAO,EAAE,MAAM,GAAI,MAAM,CAM3D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,MAAM,GAAI,MAAM,CAE1D"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CropperState, Size } from './types';
5
+ /**
6
+ * The selected image region in source-pixel coordinates.
7
+ */
8
+ export interface SourceRegion {
9
+ /** X offset in source pixels. */
10
+ x: number;
11
+ /** Y offset in source pixels. */
12
+ y: number;
13
+ /** Width in source pixels. */
14
+ width: number;
15
+ /** Height in source pixels. */
16
+ height: number;
17
+ /** Rotation in degrees (0-360). */
18
+ rotation: number;
19
+ /** Flip state. */
20
+ flip: {
21
+ horizontal: boolean;
22
+ vertical: boolean;
23
+ };
24
+ /** Zoom factor applied. */
25
+ zoom: number;
26
+ }
27
+ /**
28
+ * Get the selected image region in source-pixel coordinates.
29
+ *
30
+ * Converts the current crop state (normalized visual space) to the actual
31
+ * region of the original image that's selected. This is the bridge between
32
+ * the cropper's internal coordinate system and external tools (image
33
+ * processing libraries, AI APIs, server-side processing) that work in
34
+ * source-pixel coordinates.
35
+ *
36
+ * The returned rectangle accounts for pan, zoom, and the crop rect position,
37
+ * but expresses the crop in the unrotated image's coordinate space. Rotation
38
+ * and flip are included as separate fields since they represent transforms,
39
+ * not a region.
40
+ *
41
+ * @param state The current cropper state.
42
+ * @param imageSize The natural dimensions of the source image.
43
+ * @return The selected region in source pixels plus rotation/flip metadata.
44
+ */
45
+ export declare function getSourceRegion(state: CropperState, imageSize: Size): SourceRegion;
46
+ /**
47
+ * The selected crop region expressed as percentages of the source image.
48
+ */
49
+ export interface SourceRegionPercent {
50
+ /** X offset as a percentage (0–100) of the source image width. */
51
+ x: number;
52
+ /** Y offset as a percentage (0–100) of the source image height. */
53
+ y: number;
54
+ /** Width as a percentage (0–100) of the source image width. */
55
+ width: number;
56
+ /** Height as a percentage (0–100) of the source image height. */
57
+ height: number;
58
+ }
59
+ /**
60
+ * Get the selected image region as percentages of the source image dimensions.
61
+ *
62
+ * Returns `{ x, y, width, height }` where each value is a percentage (0–100)
63
+ * of the source image's natural width or height. This format is compatible
64
+ * with the WordPress REST API attachments `/edit` endpoint and CSS-based
65
+ * crop workflows.
66
+ *
67
+ * Internally delegates to `getSourceRegion` and divides by the image
68
+ * dimensions, so accuracy is identical.
69
+ *
70
+ * @param state The current cropper state.
71
+ * @param imageSize The natural dimensions of the source image.
72
+ * @return The crop region as percentages (0–100).
73
+ */
74
+ export declare function getSourceRegionPercent(state: CropperState, imageSize: Size): SourceRegionPercent;
75
+ //# sourceMappingURL=source-region.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-region.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/source-region.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,IAAI,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,YAAY,CAoEd;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,kEAAkE;IAClE,CAAC,EAAE,MAAM,CAAC;IACV,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,mBAAmB,CAWrB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CropperAction, CropperState } from './types';
5
+ /**
6
+ * Enforces containment: restricts the crop rect to fit within the
7
+ * rotated image, computes minimum zoom, clamps zoom, and restricts
8
+ * the pan position so the image always covers the crop area.
9
+ * Called after every relevant state transition.
10
+ *
11
+ * @param state The state to enforce containment on.
12
+ * @return The state with cropRect, zoom, and position restricted.
13
+ */
14
+ export declare function enforceContainment(state: CropperState): CropperState;
15
+ /**
16
+ * Reducer function for cropper state management.
17
+ *
18
+ * Every state transition that could invalidate the containment invariant
19
+ * (crop, zoom, rotation, cropRect, flip) is followed by enforceContainment
20
+ * to ensure the image always covers the crop area.
21
+ *
22
+ * Committing actions (everything except SET_ROTATION) also call
23
+ * `commitBase` to snapshot the post-containment state as the new
24
+ * base pose. SET_ROTATION derives from that base without mutating
25
+ * it, which prevents accumulated-clamp drift during continuous fine
26
+ * rotation.
27
+ *
28
+ * @param state The current cropper state.
29
+ * @param action The action to process.
30
+ * @return The new cropper state.
31
+ */
32
+ export declare function cropperReducer(state: CropperState, action: CropperAction): CropperState;
33
+ /**
34
+ * Shallow comparison of key cropper state fields to determine if
35
+ * the state has been modified from an initial snapshot.
36
+ *
37
+ * @param current The current cropper state.
38
+ * @param initial The initial cropper state snapshot.
39
+ * @return True if any tracked field differs.
40
+ */
41
+ export declare function isStateDirty(current: CropperState, initial: CropperState): boolean;
42
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/state.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAsD/E;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAE,KAAK,EAAE,YAAY,GAAI,YAAY,CAgDtE;AAgCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,aAAa,GACnB,YAAY,CA2Od;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACnB,OAAO,CAaT"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { NormalizedRect, Size } from './types';
5
+ /** Minimum crop rect dimension in normalized space (5% of visual area). */
6
+ export declare const MIN_CROP_SIZE = 0.05;
7
+ /**
8
+ * Handle position identifiers for the 8 resize handles.
9
+ */
10
+ export type HandlePosition = 'n' | 's' | 'e' | 'w' | 'nw' | 'ne' | 'sw' | 'se';
11
+ /**
12
+ * Bounds within which the crop rect must stay.
13
+ */
14
+ export interface CropBounds {
15
+ minX: number;
16
+ minY: number;
17
+ maxX: number;
18
+ maxY: number;
19
+ }
20
+ /**
21
+ * Drag state for tracking a resize interaction.
22
+ */
23
+ export interface ResizeDragState {
24
+ /** Which handle is being dragged. */
25
+ handle: HandlePosition;
26
+ /** The mouse position (pixels) when the drag started. */
27
+ startX: number;
28
+ startY: number;
29
+ /** The crop rect (normalized) when the drag started. */
30
+ startRect: NormalizedRect;
31
+ }
32
+ /**
33
+ * Compute the new crop rect for a free (no aspect ratio) resize.
34
+ *
35
+ * Each edge moves independently based on the handle being dragged.
36
+ * Edges are clamped to the provided bounds and maintain a minimum size.
37
+ *
38
+ * @param drag The current drag state.
39
+ * @param clientX Current mouse/touch X position in pixels.
40
+ * @param clientY Current mouse/touch Y position in pixels.
41
+ * @param imageSize The rendered image dimensions in pixels.
42
+ * @param bounds The allowed crop area bounds.
43
+ * @return The new crop rect in normalized coordinates.
44
+ */
45
+ export declare function computeFreeResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds): NormalizedRect;
46
+ /**
47
+ * Compute the new crop rect for a locked-aspect-ratio corner resize.
48
+ *
49
+ * The opposite corner is the anchor. The dragged corner moves freely
50
+ * but the result is clamped to maintain the aspect ratio and stay
51
+ * within bounds.
52
+ *
53
+ * @param drag The current drag state.
54
+ * @param clientX Current mouse/touch X position in pixels.
55
+ * @param clientY Current mouse/touch Y position in pixels.
56
+ * @param imageSize The rendered image dimensions in pixels.
57
+ * @param bounds The allowed crop area bounds.
58
+ * @param normalizedRatio The locked aspect ratio (width / height in normalized space).
59
+ * @return The new crop rect in normalized coordinates.
60
+ */
61
+ export declare function computeLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, normalizedRatio: number): NormalizedRect;
62
+ /**
63
+ * Compute the new crop rect for a resize that temporarily locks the
64
+ * aspect ratio to `drag.startRect`'s ratio (e.g. while Shift is held).
65
+ *
66
+ * Corner handles delegate to {@link computeLockedResizeRect}. Edge
67
+ * handles size the dragged axis freely, then expand the perpendicular
68
+ * axis symmetrically around the rect's center to preserve the ratio,
69
+ * clamping symmetrically so the rect stays within bounds.
70
+ *
71
+ * @param drag The current drag state.
72
+ * @param clientX Current mouse/touch X position in pixels.
73
+ * @param clientY Current mouse/touch Y position in pixels.
74
+ * @param imageSize The rendered image dimensions in pixels.
75
+ * @param bounds The allowed crop area bounds.
76
+ * @return The new crop rect in normalized coordinates.
77
+ */
78
+ export declare function computeShiftLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds): NormalizedRect;
79
+ //# sourceMappingURL=stencil-math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stencil-math.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/stencil-math.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpD,2EAA2E;AAC3E,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,SAAS,EAAE,cAAc,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,GAChB,cAAc,CA6ChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,EAClB,eAAe,EAAE,MAAM,GACrB,cAAc,CAiFhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,GAChB,cAAc,CAoGhB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CropperState, Size } from './types';
5
+ /**
6
+ * Computes a CSS matrix() transform string from the cropper state.
7
+ *
8
+ * The combined transform is: translate(tx, ty) * scale(sx, sy) * rotate(r) * scale(z)
9
+ * expressed as a 2D CSS matrix(a, b, c, d, tx, ty).
10
+ *
11
+ * Flip is composed outside rotation so it is viewport-relative — horizontal
12
+ * flip mirrors across the viewport's vertical axis regardless of rotation.
13
+ * Must match the matrix order in `createCamera` / `getCropBounds`.
14
+ *
15
+ * This is a pure function with no framework dependencies. The React hook
16
+ * `useTransformStyle` wraps this in `useMemo` for memoization.
17
+ *
18
+ * @param state The current cropper state.
19
+ * @param imageSize The rendered image dimensions in pixels.
20
+ * @return A CSS transform string.
21
+ */
22
+ export declare function computeTransformStyle(state: CropperState, imageSize: Size): string;
23
+ //# sourceMappingURL=transform-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-style.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/transform-style.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGlD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,MAAM,CAiBR"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { TransformOperation, CropperState } from '../types';
5
+ /**
6
+ * Apply a single transform operation to a cropper state, returning
7
+ * a new state with the containment invariant enforced.
8
+ *
9
+ * Delegates to the reducer via APPLY_OPERATION so pipeline replay
10
+ * produces identical bounded state to UI interaction or setter
11
+ * calls. The same logical operation yields the same result
12
+ * regardless of entrypoint.
13
+ *
14
+ * @param state The current cropper state.
15
+ * @param op The operation to apply.
16
+ * @return A new cropper state with the operation applied.
17
+ */
18
+ export declare function applyOperationToState(state: CropperState, op: TransformOperation): CropperState;
19
+ /**
20
+ * Replay all operations from an initial state to produce the final state.
21
+ *
22
+ * @param pipeline The array of transform operations to replay.
23
+ * @param initialState The starting state. Defaults to DEFAULT_STATE.
24
+ * @return The resulting cropper state after all operations are applied.
25
+ */
26
+ export declare function stateFromPipeline(pipeline: TransformOperation[], initialState?: CropperState): CropperState;
27
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/core/transforms/pipeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIjE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,kBAAkB,GACpB,YAAY,CAEd;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,YAAY,GAAE,YAAmC,GAC/C,YAAY,CAKd"}