@wordpress/media-editor 0.8.0 → 0.8.1-next.v.202605131032.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 (217) hide show
  1. package/build/components/media-editor/index.cjs +560 -0
  2. package/build/components/media-editor/index.cjs.map +7 -0
  3. package/build/components/media-editor-canvas/index.cjs +14 -2
  4. package/build/components/media-editor-canvas/index.cjs.map +2 -2
  5. package/build/components/media-editor-crop-panel/index.cjs +34 -27
  6. package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
  7. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +162 -0
  8. package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +7 -0
  9. package/build/components/media-editor-modal/index.cjs +42 -430
  10. package/build/components/media-editor-modal/index.cjs.map +3 -3
  11. package/build/components/media-editor-toolbar/index.cjs +143 -75
  12. package/build/components/media-editor-toolbar/index.cjs.map +3 -3
  13. package/build/components/media-form/index.cjs +3 -0
  14. package/build/components/media-form/index.cjs.map +2 -2
  15. package/build/components/rotation-ruler/index.cjs +197 -0
  16. package/build/components/rotation-ruler/index.cjs.map +7 -0
  17. package/build/components/rotation-ruler/use-ruler-drag.cjs +154 -0
  18. package/build/components/rotation-ruler/use-ruler-drag.cjs.map +7 -0
  19. package/build/hooks/use-crop-gesture-handlers.cjs +43 -0
  20. package/build/hooks/use-crop-gesture-handlers.cjs.map +7 -0
  21. package/build/image-editor/core/constants.cjs +9 -0
  22. package/build/image-editor/core/constants.cjs.map +2 -2
  23. package/build/image-editor/core/containment.cjs +7 -13
  24. package/build/image-editor/core/containment.cjs.map +2 -2
  25. package/build/image-editor/core/interaction-controller.cjs +43 -7
  26. package/build/image-editor/core/interaction-controller.cjs.map +2 -2
  27. package/build/image-editor/core/state.cjs +5 -1
  28. package/build/image-editor/core/state.cjs.map +2 -2
  29. package/build/image-editor/core/transform-style.cjs.map +1 -1
  30. package/build/image-editor/core/types.cjs.map +1 -1
  31. package/build/image-editor/core/viewport-state.cjs +50 -0
  32. package/build/image-editor/core/viewport-state.cjs.map +7 -0
  33. package/build/image-editor/react/components/cropper.cjs +192 -72
  34. package/build/image-editor/react/components/cropper.cjs.map +3 -3
  35. package/build/image-editor/react/components/overlays/dimming-overlay.cjs +5 -2
  36. package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +2 -2
  37. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +16 -4
  38. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
  39. package/build/image-editor/react/components/viewport-provider.cjs +51 -0
  40. package/build/image-editor/react/components/viewport-provider.cjs.map +7 -0
  41. package/build/image-editor/react/hooks/use-aria-announcer.cjs +53 -6
  42. package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +2 -2
  43. package/build/image-editor/react/hooks/use-cropper-state.cjs +127 -8
  44. package/build/image-editor/react/hooks/use-cropper-state.cjs.map +2 -2
  45. package/build/image-editor/react/hooks/use-interaction.cjs +26 -5
  46. package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
  47. package/build/image-editor/react/hooks/use-viewport-state.cjs +51 -0
  48. package/build/image-editor/react/hooks/use-viewport-state.cjs.map +7 -0
  49. package/build/image-editor/react/visually-hidden-style.cjs +41 -0
  50. package/build/image-editor/react/visually-hidden-style.cjs.map +7 -0
  51. package/build/private-apis.cjs +2 -0
  52. package/build/private-apis.cjs.map +2 -2
  53. package/build-module/components/media-editor/index.mjs +545 -0
  54. package/build-module/components/media-editor/index.mjs.map +7 -0
  55. package/build-module/components/media-editor-canvas/index.mjs +14 -2
  56. package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
  57. package/build-module/components/media-editor-crop-panel/index.mjs +35 -28
  58. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  59. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +144 -0
  60. package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +7 -0
  61. package/build-module/components/media-editor-modal/index.mjs +46 -455
  62. package/build-module/components/media-editor-modal/index.mjs.map +2 -2
  63. package/build-module/components/media-editor-toolbar/index.mjs +137 -77
  64. package/build-module/components/media-editor-toolbar/index.mjs.map +2 -2
  65. package/build-module/components/media-form/index.mjs +3 -0
  66. package/build-module/components/media-form/index.mjs.map +2 -2
  67. package/build-module/components/rotation-ruler/index.mjs +166 -0
  68. package/build-module/components/rotation-ruler/index.mjs.map +7 -0
  69. package/build-module/components/rotation-ruler/use-ruler-drag.mjs +126 -0
  70. package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +7 -0
  71. package/build-module/hooks/use-crop-gesture-handlers.mjs +17 -0
  72. package/build-module/hooks/use-crop-gesture-handlers.mjs.map +7 -0
  73. package/build-module/image-editor/core/constants.mjs +6 -0
  74. package/build-module/image-editor/core/constants.mjs.map +2 -2
  75. package/build-module/image-editor/core/containment.mjs +6 -12
  76. package/build-module/image-editor/core/containment.mjs.map +2 -2
  77. package/build-module/image-editor/core/interaction-controller.mjs +50 -8
  78. package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
  79. package/build-module/image-editor/core/state.mjs +5 -1
  80. package/build-module/image-editor/core/state.mjs.map +2 -2
  81. package/build-module/image-editor/core/transform-style.mjs.map +1 -1
  82. package/build-module/image-editor/core/viewport-state.mjs +24 -0
  83. package/build-module/image-editor/core/viewport-state.mjs.map +7 -0
  84. package/build-module/image-editor/react/components/cropper.mjs +195 -73
  85. package/build-module/image-editor/react/components/cropper.mjs.map +3 -3
  86. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +5 -2
  87. package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +2 -2
  88. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +26 -5
  89. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
  90. package/build-module/image-editor/react/components/viewport-provider.mjs +27 -0
  91. package/build-module/image-editor/react/components/viewport-provider.mjs.map +7 -0
  92. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +59 -7
  93. package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +2 -2
  94. package/build-module/image-editor/react/hooks/use-cropper-state.mjs +134 -9
  95. package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +2 -2
  96. package/build-module/image-editor/react/hooks/use-interaction.mjs +26 -5
  97. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +2 -2
  98. package/build-module/image-editor/react/hooks/use-viewport-state.mjs +29 -0
  99. package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +7 -0
  100. package/build-module/image-editor/react/visually-hidden-style.mjs +16 -0
  101. package/build-module/image-editor/react/visually-hidden-style.mjs.map +7 -0
  102. package/build-module/private-apis.mjs +2 -0
  103. package/build-module/private-apis.mjs.map +2 -2
  104. package/build-style/style-rtl.css +254 -29
  105. package/build-style/style.css +254 -29
  106. package/build-types/components/media-editor/index.d.ts +34 -0
  107. package/build-types/components/media-editor/index.d.ts.map +1 -0
  108. package/build-types/components/media-editor-canvas/index.d.ts +10 -1
  109. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  110. package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
  111. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  112. package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts +6 -0
  113. package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -0
  114. package/build-types/components/media-editor-modal/index.d.ts +2 -2
  115. package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
  116. package/build-types/components/media-editor-provider/index.d.ts +1 -1
  117. package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
  118. package/build-types/components/media-editor-toolbar/index.d.ts +4 -1
  119. package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -1
  120. package/build-types/components/media-form/index.d.ts +1 -1
  121. package/build-types/components/media-form/index.d.ts.map +1 -1
  122. package/build-types/components/rotation-ruler/index.d.ts +46 -0
  123. package/build-types/components/rotation-ruler/index.d.ts.map +1 -0
  124. package/build-types/components/rotation-ruler/stories/index.story.d.ts +14 -0
  125. package/build-types/components/rotation-ruler/stories/index.story.d.ts.map +1 -0
  126. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts +61 -0
  127. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -0
  128. package/build-types/hooks/use-crop-gesture-handlers.d.ts +42 -0
  129. package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -0
  130. package/build-types/image-editor/core/constants.d.ts +9 -0
  131. package/build-types/image-editor/core/constants.d.ts.map +1 -1
  132. package/build-types/image-editor/core/containment.d.ts +11 -7
  133. package/build-types/image-editor/core/containment.d.ts.map +1 -1
  134. package/build-types/image-editor/core/interaction-controller.d.ts +14 -2
  135. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
  136. package/build-types/image-editor/core/state.d.ts.map +1 -1
  137. package/build-types/image-editor/core/transform-style.d.ts +1 -1
  138. package/build-types/image-editor/core/types.d.ts +25 -0
  139. package/build-types/image-editor/core/types.d.ts.map +1 -1
  140. package/build-types/image-editor/core/viewport-state.d.ts +7 -0
  141. package/build-types/image-editor/core/viewport-state.d.ts.map +1 -0
  142. package/build-types/image-editor/react/components/cropper-provider.d.ts +1 -1
  143. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
  144. package/build-types/image-editor/react/components/cropper.d.ts +2 -1
  145. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  146. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +3 -13
  147. package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -1
  148. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +1 -1
  149. package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -1
  150. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +1 -1
  151. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
  152. package/build-types/image-editor/react/components/viewport-provider.d.ts +9 -0
  153. package/build-types/image-editor/react/components/viewport-provider.d.ts.map +1 -0
  154. package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -1
  155. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +29 -0
  156. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -1
  157. package/build-types/image-editor/react/hooks/use-interaction.d.ts +5 -2
  158. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
  159. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +19 -0
  160. package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +1 -0
  161. package/build-types/image-editor/react/visually-hidden-style.d.ts +6 -0
  162. package/build-types/image-editor/react/visually-hidden-style.d.ts.map +1 -0
  163. package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
  164. package/build-types/private-apis.d.ts.map +1 -1
  165. package/build-types/store/actions.d.ts +3 -3
  166. package/build-types/store/actions.d.ts.map +1 -1
  167. package/package.json +16 -15
  168. package/src/components/media-editor/index.tsx +709 -0
  169. package/src/components/media-editor/style.scss +89 -0
  170. package/src/components/media-editor-canvas/index.tsx +24 -0
  171. package/src/components/media-editor-crop-panel/index.tsx +39 -27
  172. package/src/components/media-editor-crop-panel/test/index.tsx +109 -0
  173. package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +177 -0
  174. package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +53 -0
  175. package/src/components/media-editor-modal/index.tsx +49 -589
  176. package/src/components/media-editor-modal/style.scss +13 -112
  177. package/src/components/media-editor-toolbar/index.tsx +122 -63
  178. package/src/components/media-editor-toolbar/style.scss +39 -11
  179. package/src/components/media-form/index.tsx +5 -0
  180. package/src/components/rotation-ruler/README.md +37 -0
  181. package/src/components/rotation-ruler/index.tsx +266 -0
  182. package/src/components/rotation-ruler/stories/index.story.tsx +54 -0
  183. package/src/components/rotation-ruler/style.scss +147 -0
  184. package/src/components/rotation-ruler/test/index.tsx +109 -0
  185. package/src/components/rotation-ruler/use-ruler-drag.ts +230 -0
  186. package/src/hooks/use-crop-gesture-handlers.ts +54 -0
  187. package/src/image-editor/core/constants.ts +12 -0
  188. package/src/image-editor/core/containment.ts +16 -28
  189. package/src/image-editor/core/interaction-controller.ts +66 -10
  190. package/src/image-editor/core/state.ts +15 -8
  191. package/src/image-editor/core/test/camera.ts +15 -26
  192. package/src/image-editor/core/test/interaction-controller.ts +158 -7
  193. package/src/image-editor/core/test/state.ts +21 -1
  194. package/src/image-editor/core/transform-style.ts +1 -1
  195. package/src/image-editor/core/types.ts +16 -0
  196. package/src/image-editor/core/viewport-state.ts +33 -0
  197. package/src/image-editor/docs/architecture.md +1 -1
  198. package/src/image-editor/docs/recipes.md +2 -2
  199. package/src/image-editor/react/components/cropper.scss +28 -0
  200. package/src/image-editor/react/components/cropper.tsx +268 -72
  201. package/src/image-editor/react/components/overlays/dimming-overlay.tsx +12 -12
  202. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +27 -8
  203. package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +29 -3
  204. package/src/image-editor/react/components/test/cropper.tsx +294 -5
  205. package/src/image-editor/react/components/viewport-provider.tsx +39 -0
  206. package/src/image-editor/react/hooks/test/use-aria-announcer.ts +81 -0
  207. package/src/image-editor/react/hooks/test/use-cropper-state.ts +286 -0
  208. package/src/image-editor/react/hooks/test/use-interaction.ts +1 -0
  209. package/src/image-editor/react/hooks/use-aria-announcer.ts +68 -7
  210. package/src/image-editor/react/hooks/use-cropper-state.ts +230 -11
  211. package/src/image-editor/react/hooks/use-interaction.ts +36 -6
  212. package/src/image-editor/react/hooks/use-viewport-state.ts +48 -0
  213. package/src/image-editor/react/visually-hidden-style.ts +15 -0
  214. package/src/private-apis.ts +2 -0
  215. package/src/style.scss +3 -0
  216. package/tsconfig.json +1 -0
  217. package/tsconfig.tsbuildinfo +1 -1
@@ -4,9 +4,10 @@ import {
4
4
  SelectControl,
5
5
  ToggleControl
6
6
  } from "@wordpress/components";
7
- import { Stack } from "@wordpress/ui";
7
+ import { Stack, VisuallyHidden } from "@wordpress/ui";
8
8
  import { __, sprintf } from "@wordpress/i18n";
9
9
  import { useCropper } from "../../image-editor/index.mjs";
10
+ import { useCropGestureHandlers } from "../../hooks/use-crop-gesture-handlers.mjs";
10
11
  import {
11
12
  DEFAULT_ASPECT_RATIOS,
12
13
  MAX_ZOOM,
@@ -36,12 +37,44 @@ function MediaEditorCropPanel({
36
37
  aspectRatioPresets
37
38
  }) {
38
39
  const { state, setZoom } = useCropper();
40
+ const zoomGestureHandlers = useCropGestureHandlers();
39
41
  const aspectRatioOptions = [
40
42
  ...DEFAULT_ASPECT_RATIOS.filter((preset) => preset.value <= 0),
41
43
  ...aspectRatioPresets ?? DEFAULT_ASPECT_RATIOS.filter((preset) => preset.value > 0)
42
44
  ];
45
+ const handleAspectRatioChange = (value) => {
46
+ onAspectRatioChange(value);
47
+ if (value === "0" && !freeformCrop) {
48
+ onFreeformChange(true);
49
+ }
50
+ };
43
51
  return /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "md", children: [
52
+ /* @__PURE__ */ jsx(VisuallyHidden, { render: /* @__PURE__ */ jsx("h2", {}), children: __("Crop options") }),
44
53
  /* @__PURE__ */ jsx(
54
+ SelectControl,
55
+ {
56
+ __next40pxDefaultSize: true,
57
+ __nextHasNoMarginBottom: true,
58
+ label: __("Aspect ratio"),
59
+ value: aspectRatioValue,
60
+ onChange: handleAspectRatioChange,
61
+ options: aspectRatioOptions.map((preset) => ({
62
+ label: preset.label,
63
+ value: preset.value.toString()
64
+ }))
65
+ }
66
+ ),
67
+ /* @__PURE__ */ jsx(
68
+ ToggleControl,
69
+ {
70
+ __nextHasNoMarginBottom: true,
71
+ label: __("Resize crop area"),
72
+ help: __("Show handles to adjust the crop box."),
73
+ checked: freeformCrop,
74
+ onChange: onFreeformChange
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsx("div", { role: "presentation", ...zoomGestureHandlers, children: /* @__PURE__ */ jsx(
45
78
  RangeControl,
46
79
  {
47
80
  __next40pxDefaultSize: true,
@@ -64,33 +97,7 @@ function MediaEditorCropPanel({
64
97
  );
65
98
  }
66
99
  }
67
- ),
68
- /* @__PURE__ */ jsx(
69
- SelectControl,
70
- {
71
- __next40pxDefaultSize: true,
72
- __nextHasNoMarginBottom: true,
73
- label: __("Aspect ratio"),
74
- value: aspectRatioValue,
75
- onChange: onAspectRatioChange,
76
- options: aspectRatioOptions.map((preset) => ({
77
- label: preset.label,
78
- value: preset.value.toString()
79
- }))
80
- }
81
- ),
82
- /* @__PURE__ */ jsx(
83
- ToggleControl,
84
- {
85
- __nextHasNoMarginBottom: true,
86
- label: __("Freeform crop"),
87
- help: __(
88
- "Drag the crop edges to resize freely. When off, the crop is fixed to the selected ratio."
89
- ),
90
- checked: freeformCrop,
91
- onChange: onFreeformChange
92
- }
93
- )
100
+ ) })
94
101
  ] });
95
102
  }
96
103
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/media-editor-crop-panel/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tRangeControl,\n\tSelectControl,\n\tToggleControl,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCropper } from '../../image-editor';\nimport {\n\tDEFAULT_ASPECT_RATIOS,\n\tMAX_ZOOM,\n\tMIN_ZOOM,\n\tORIGINAL_ASPECT_RATIO,\n} from '../../image-editor/core/constants';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\n\nexport interface MediaEditorCropPanelProps {\n\t/**\n\t * Selected aspect-ratio preset value as a string (so it round-trips\n\t * through `<SelectControl>`). `'0'` = free, `'-1'` = original, any\n\t * positive number = fixed ratio.\n\t */\n\taspectRatioValue: string;\n\t/** Setter for the aspect-ratio preset value. */\n\tonAspectRatioChange: ( value: string ) => void;\n\t/** Whether the cropper is in freeform (resize-handle) mode. */\n\tfreeformCrop: boolean;\n\t/** Setter for freeform mode. */\n\tonFreeformChange: ( value: boolean ) => void;\n\t/** Signal that a placement-oriented control is being adjusted. */\n\tonPlacementControlInteraction?: () => void;\n\t/**\n\t * Fixed aspect-ratio presets to display after Free and Original. When\n\t * omitted, the media editor's default fixed-ratio presets are used.\n\t */\n\taspectRatioPresets?: AspectRatioPreset[];\n}\n\n/**\n * Resolve an aspect-ratio preset value into a number suitable for\n * `<Cropper aspectRatio=...>`. Returns `undefined` for Free (no lock).\n *\n * @param value Preset value as a string.\n * @param imageAspectRatio Image's natural width / height \u2014 used for\n * the Original preset.\n */\nexport function resolveAspectRatio(\n\tvalue: string,\n\timageAspectRatio: number | null\n): number | undefined {\n\tconst num = parseFloat( value );\n\tif ( num === 0 ) {\n\t\treturn undefined;\n\t}\n\tif ( num === ORIGINAL_ASPECT_RATIO && imageAspectRatio ) {\n\t\treturn imageAspectRatio;\n\t}\n\tif ( num > 0 ) {\n\t\treturn num;\n\t}\n\treturn undefined;\n}\n\n/**\n * Sidebar panel for crop-shape controls \u2014 aspect-ratio presets and\n * freeform toggle. The tactile verbs (rotate, flip) live in the\n * bottom toolbar instead.\n * @param props\n * @param props.aspectRatioValue\n * @param props.onAspectRatioChange\n * @param props.freeformCrop\n * @param props.onFreeformChange\n * @param props.onPlacementControlInteraction\n * @param props.aspectRatioPresets\n */\nexport default function MediaEditorCropPanel( {\n\taspectRatioValue,\n\tonAspectRatioChange,\n\tfreeformCrop,\n\tonFreeformChange,\n\tonPlacementControlInteraction,\n\taspectRatioPresets,\n}: MediaEditorCropPanelProps ) {\n\tconst { state, setZoom } = useCropper();\n\tconst aspectRatioOptions = [\n\t\t...DEFAULT_ASPECT_RATIOS.filter( ( preset ) => preset.value <= 0 ),\n\t\t...( aspectRatioPresets ??\n\t\t\tDEFAULT_ASPECT_RATIOS.filter( ( preset ) => preset.value > 0 ) ),\n\t];\n\n\treturn (\n\t\t<Stack direction=\"column\" gap=\"md\">\n\t\t\t<RangeControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Zoom' ) }\n\t\t\t\tmin={ MIN_ZOOM }\n\t\t\t\tmax={ MAX_ZOOM }\n\t\t\t\tstep={ 0.1 }\n\t\t\t\tvalue={ state.zoom }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tonPlacementControlInteraction?.();\n\t\t\t\t\tsetZoom( typeof value === 'number' ? value : MIN_ZOOM );\n\t\t\t\t} }\n\t\t\t\trenderTooltipContent={ ( value ) => {\n\t\t\t\t\tconst zoom = typeof value === 'number' ? value : MIN_ZOOM;\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t/* translators: %d: zoom level as a percentage. */\n\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\tMath.round( zoom * 100 )\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tvalue={ aspectRatioValue }\n\t\t\t\tonChange={ onAspectRatioChange }\n\t\t\t\toptions={ aspectRatioOptions.map( ( preset ) => ( {\n\t\t\t\t\tlabel: preset.label,\n\t\t\t\t\tvalue: preset.value.toString(),\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Freeform crop' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Drag the crop edges to resize freely. When off, the crop is fixed to the selected ratio.'\n\t\t\t\t) }\n\t\t\t\tchecked={ freeformCrop }\n\t\t\t\tonChange={ onFreeformChange }\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n"],
5
- "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa;AACtB,SAAS,IAA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;AAAA,QACvB,OAAQ,GAAI,cAAe;AAAA,QAC3B,OAAQ;AAAA,QACR,UAAW;AAAA,QACX,SAAU,mBAAmB,IAAK,CAAE,YAAc;AAAA,UACjD,OAAO,OAAO;AAAA,UACd,OAAO,OAAO,MAAM,SAAS;AAAA,QAC9B,EAAI;AAAA;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB,OAAQ,GAAI,eAAgB;AAAA,QAC5B,MAAO;AAAA,UACN;AAAA,QACD;AAAA,QACA,SAAU;AAAA,QACV,UAAW;AAAA;AAAA,IACZ;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tRangeControl,\n\tSelectControl,\n\tToggleControl,\n} from '@wordpress/components';\nimport { Stack, VisuallyHidden } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCropper } from '../../image-editor';\nimport { useCropGestureHandlers } from '../../hooks/use-crop-gesture-handlers';\nimport {\n\tDEFAULT_ASPECT_RATIOS,\n\tMAX_ZOOM,\n\tMIN_ZOOM,\n\tORIGINAL_ASPECT_RATIO,\n} from '../../image-editor/core/constants';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\n\nexport interface MediaEditorCropPanelProps {\n\t/**\n\t * Selected aspect-ratio preset value as a string (so it round-trips\n\t * through `<SelectControl>`). `'0'` = free, `'-1'` = original, any\n\t * positive number = fixed ratio.\n\t */\n\taspectRatioValue: string;\n\t/** Setter for the aspect-ratio preset value. */\n\tonAspectRatioChange: ( value: string ) => void;\n\t/** Whether the cropper is in freeform (resize-handle) mode. */\n\tfreeformCrop: boolean;\n\t/** Setter for freeform mode. */\n\tonFreeformChange: ( value: boolean ) => void;\n\t/** Signal that a placement-oriented control is being adjusted. */\n\tonPlacementControlInteraction?: () => void;\n\t/**\n\t * Fixed aspect-ratio presets to display after Free and Original. When\n\t * omitted, the media editor's default fixed-ratio presets are used.\n\t */\n\taspectRatioPresets?: AspectRatioPreset[];\n}\n\n/**\n * Resolve an aspect-ratio preset value into a number suitable for\n * `<Cropper aspectRatio=...>`. Returns `undefined` for Free (no lock).\n *\n * @param value Preset value as a string.\n * @param imageAspectRatio Image's natural width / height \u2014 used for\n * the Original preset.\n */\nexport function resolveAspectRatio(\n\tvalue: string,\n\timageAspectRatio: number | null\n): number | undefined {\n\tconst num = parseFloat( value );\n\tif ( num === 0 ) {\n\t\treturn undefined;\n\t}\n\tif ( num === ORIGINAL_ASPECT_RATIO && imageAspectRatio ) {\n\t\treturn imageAspectRatio;\n\t}\n\tif ( num > 0 ) {\n\t\treturn num;\n\t}\n\treturn undefined;\n}\n\n/**\n * Sidebar panel for crop-shape controls \u2014 aspect-ratio presets and\n * freeform toggle. The tactile verbs (rotate, flip) live in the\n * bottom toolbar instead.\n * @param props\n * @param props.aspectRatioValue\n * @param props.onAspectRatioChange\n * @param props.freeformCrop\n * @param props.onFreeformChange\n * @param props.onPlacementControlInteraction\n * @param props.aspectRatioPresets\n */\nexport default function MediaEditorCropPanel( {\n\taspectRatioValue,\n\tonAspectRatioChange,\n\tfreeformCrop,\n\tonFreeformChange,\n\tonPlacementControlInteraction,\n\taspectRatioPresets,\n}: MediaEditorCropPanelProps ) {\n\tconst { state, setZoom } = useCropper();\n\tconst zoomGestureHandlers = useCropGestureHandlers();\n\tconst aspectRatioOptions = [\n\t\t...DEFAULT_ASPECT_RATIOS.filter( ( preset ) => preset.value <= 0 ),\n\t\t...( aspectRatioPresets ??\n\t\t\tDEFAULT_ASPECT_RATIOS.filter( ( preset ) => preset.value > 0 ) ),\n\t];\n\tconst handleAspectRatioChange = ( value: string ) => {\n\t\tonAspectRatioChange( value );\n\t\tif ( value === '0' && ! freeformCrop ) {\n\t\t\tonFreeformChange( true );\n\t\t}\n\t};\n\n\treturn (\n\t\t<Stack direction=\"column\" gap=\"md\">\n\t\t\t<VisuallyHidden render={ <h2 /> }>\n\t\t\t\t{ __( 'Crop options' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<SelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tvalue={ aspectRatioValue }\n\t\t\t\tonChange={ handleAspectRatioChange }\n\t\t\t\toptions={ aspectRatioOptions.map( ( preset ) => ( {\n\t\t\t\t\tlabel: preset.label,\n\t\t\t\t\tvalue: preset.value.toString(),\n\t\t\t\t} ) ) }\n\t\t\t/>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Resize crop area' ) }\n\t\t\t\thelp={ __( 'Show handles to adjust the crop box.' ) }\n\t\t\t\tchecked={ freeformCrop }\n\t\t\t\tonChange={ onFreeformChange }\n\t\t\t/>\n\t\t\t<div role=\"presentation\" { ...zoomGestureHandlers }>\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Zoom' ) }\n\t\t\t\t\tmin={ MIN_ZOOM }\n\t\t\t\t\tmax={ MAX_ZOOM }\n\t\t\t\t\tstep={ 0.1 }\n\t\t\t\t\tvalue={ state.zoom }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonPlacementControlInteraction?.();\n\t\t\t\t\t\tsetZoom( typeof value === 'number' ? value : MIN_ZOOM );\n\t\t\t\t\t} }\n\t\t\t\t\trenderTooltipContent={ ( value ) => {\n\t\t\t\t\t\tconst zoom =\n\t\t\t\t\t\t\ttypeof value === 'number' ? value : MIN_ZOOM;\n\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t/* translators: %d: zoom level as a percentage. */\n\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\tMath.round( zoom * 100 )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</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AAmB,IAAK,CAAE,YAAc;AAAA,UACjD,OAAO,OAAO;AAAA,UACd,OAAO,OAAO,MAAM,SAAS;AAAA,QAC9B,EAAI;AAAA;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB,OAAQ,GAAI,kBAAmB;AAAA,QAC/B,MAAO,GAAI,sCAAuC;AAAA,QAClD,SAAU;AAAA,QACV,UAAW;AAAA;AAAA,IACZ;AAAA,IACA,oBAAC,SAAI,MAAK,gBAAiB,GAAG,qBAC7B;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,yBAAuB;AAAA,QACvB,OAAQ,GAAI,MAAO;AAAA,QACnB,KAAM;AAAA,QACN,KAAM;AAAA,QACN,MAAO;AAAA,QACP,OAAQ,MAAM;AAAA,QACd,UAAW,CAAE,UAAW;AACvB,0CAAgC;AAChC,kBAAS,OAAO,UAAU,WAAW,QAAQ,QAAS;AAAA,QACvD;AAAA,QACA,sBAAuB,CAAE,UAAW;AACnC,gBAAM,OACL,OAAO,UAAU,WAAW,QAAQ;AACrC,iBAAO;AAAA;AAAA,YAEN,GAAI,MAAO;AAAA,YACX,KAAK,MAAO,OAAO,GAAI;AAAA,UACxB;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,144 @@
1
+ // packages/media-editor/src/components/media-editor-keyboard-shortcuts-modal/index.tsx
2
+ import { Modal } from "@wordpress/components";
3
+ import { Fragment } from "@wordpress/element";
4
+ import { __ } from "@wordpress/i18n";
5
+ import {
6
+ displayShortcutList,
7
+ shortcutAriaLabel
8
+ } from "@wordpress/keycodes";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var SHORTCUTS = [
11
+ {
12
+ description: __("Undo"),
13
+ keyCombination: { modifier: "primary", character: "z" }
14
+ },
15
+ {
16
+ description: __("Redo"),
17
+ keyCombination: { modifier: "primaryShift", character: "z" }
18
+ },
19
+ {
20
+ description: __("Pan"),
21
+ keyCombination: {
22
+ character: ["\u2191", "\u2193", "\u2190", "\u2192"],
23
+ ariaLabel: __("Arrow keys")
24
+ }
25
+ },
26
+ {
27
+ description: __("Zoom in"),
28
+ keyCombination: { character: "+" }
29
+ },
30
+ {
31
+ description: __("Zoom out"),
32
+ keyCombination: { character: "-" }
33
+ },
34
+ {
35
+ description: __("Rotate 90\xB0 clockwise"),
36
+ keyCombination: { character: "R" }
37
+ },
38
+ {
39
+ description: __("Rotate 90\xB0 counter-clockwise"),
40
+ keyCombination: { modifier: "shift", character: "R" }
41
+ },
42
+ {
43
+ description: __("Flip horizontal"),
44
+ keyCombination: { character: "H" }
45
+ },
46
+ {
47
+ description: __("Flip vertical"),
48
+ keyCombination: { character: "V" }
49
+ },
50
+ {
51
+ description: __("Pan or resize crop (large step)"),
52
+ keyCombination: {
53
+ modifier: "shift",
54
+ character: ["\u2191", "\u2193", "\u2190", "\u2192"],
55
+ ariaLabel: __("Shift + Arrow keys")
56
+ }
57
+ }
58
+ ];
59
+ function KeyCombinationDisplay({
60
+ keyCombination
61
+ }) {
62
+ const { modifier, character, ariaLabel } = keyCombination;
63
+ let keys;
64
+ if (Array.isArray(character)) {
65
+ if (modifier) {
66
+ const sample = displayShortcutList[modifier](character[0]);
67
+ keys = [...sample.slice(0, -1), ...character];
68
+ } else {
69
+ keys = character;
70
+ }
71
+ } else {
72
+ keys = modifier ? displayShortcutList[modifier](character) : [character];
73
+ }
74
+ const charString = Array.isArray(character) ? character.join("") : character;
75
+ let label;
76
+ if (ariaLabel) {
77
+ label = ariaLabel;
78
+ } else if (modifier) {
79
+ label = shortcutAriaLabel[modifier](charString);
80
+ } else {
81
+ label = charString;
82
+ }
83
+ return /* @__PURE__ */ jsx(
84
+ "kbd",
85
+ {
86
+ className: "media-editor-keyboard-shortcuts-modal__shortcut-term",
87
+ "aria-label": label,
88
+ children: keys.map(
89
+ (key, index) => key === "+" && modifier ? /* @__PURE__ */ jsx(Fragment, { children: key }, index) : /* @__PURE__ */ jsx(
90
+ "kbd",
91
+ {
92
+ className: "media-editor-keyboard-shortcuts-modal__shortcut-key",
93
+ children: key
94
+ },
95
+ index
96
+ )
97
+ )
98
+ }
99
+ );
100
+ }
101
+ function MediaEditorKeyboardShortcutsModal({
102
+ onClose
103
+ }) {
104
+ return /* @__PURE__ */ jsxs(
105
+ Modal,
106
+ {
107
+ className: "media-editor-keyboard-shortcuts-modal",
108
+ title: __("Keyboard shortcuts"),
109
+ onRequestClose: onClose,
110
+ children: [
111
+ /* @__PURE__ */ jsx("p", { className: "media-editor-keyboard-shortcuts-modal__note", children: __(
112
+ "These shortcuts work when the image editor has focus."
113
+ ) }),
114
+ /* @__PURE__ */ jsx(
115
+ "ul",
116
+ {
117
+ className: "media-editor-keyboard-shortcuts-modal__shortcut-list",
118
+ role: "list",
119
+ children: SHORTCUTS.map(({ description, keyCombination }, index) => /* @__PURE__ */ jsxs(
120
+ "li",
121
+ {
122
+ className: "media-editor-keyboard-shortcuts-modal__shortcut",
123
+ children: [
124
+ /* @__PURE__ */ jsx("span", { className: "media-editor-keyboard-shortcuts-modal__shortcut-description", children: description }),
125
+ /* @__PURE__ */ jsx(
126
+ KeyCombinationDisplay,
127
+ {
128
+ keyCombination
129
+ }
130
+ )
131
+ ]
132
+ },
133
+ index
134
+ ))
135
+ }
136
+ )
137
+ ]
138
+ }
139
+ );
140
+ }
141
+ export {
142
+ MediaEditorKeyboardShortcutsModal as default
143
+ };
144
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/media-editor-keyboard-shortcuts-modal/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { Fragment } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tdisplayShortcutList,\n\tshortcutAriaLabel,\n\ttype WPKeycodeModifier,\n} from '@wordpress/keycodes';\n\ninterface KeyCombination {\n\t/** Modifier for cross-platform display (e.g. 'primary', 'primaryShift', 'shift'). */\n\tmodifier?: WPKeycodeModifier;\n\t/** The key character(s) to display. Pass an array to render each as its own key. */\n\tcharacter: string | string[];\n\t/** Optional aria-label override (used when character is a symbol). */\n\tariaLabel?: string;\n}\n\ninterface ShortcutEntry {\n\tdescription: string;\n\tkeyCombination: KeyCombination;\n}\n\nconst SHORTCUTS: ShortcutEntry[] = [\n\t{\n\t\tdescription: __( 'Undo' ),\n\t\tkeyCombination: { modifier: 'primary', character: 'z' },\n\t},\n\t{\n\t\tdescription: __( 'Redo' ),\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'z' },\n\t},\n\t{\n\t\tdescription: __( 'Pan' ),\n\t\tkeyCombination: {\n\t\t\tcharacter: [ '\u2191', '\u2193', '\u2190', '\u2192' ],\n\t\t\tariaLabel: __( 'Arrow keys' ),\n\t\t},\n\t},\n\t{\n\t\tdescription: __( 'Zoom in' ),\n\t\tkeyCombination: { character: '+' },\n\t},\n\t{\n\t\tdescription: __( 'Zoom out' ),\n\t\tkeyCombination: { character: '-' },\n\t},\n\t{\n\t\tdescription: __( 'Rotate 90\u00B0 clockwise' ),\n\t\tkeyCombination: { character: 'R' },\n\t},\n\t{\n\t\tdescription: __( 'Rotate 90\u00B0 counter-clockwise' ),\n\t\tkeyCombination: { modifier: 'shift', character: 'R' },\n\t},\n\t{\n\t\tdescription: __( 'Flip horizontal' ),\n\t\tkeyCombination: { character: 'H' },\n\t},\n\t{\n\t\tdescription: __( 'Flip vertical' ),\n\t\tkeyCombination: { character: 'V' },\n\t},\n\t{\n\t\tdescription: __( 'Pan or resize crop (large step)' ),\n\t\tkeyCombination: {\n\t\t\tmodifier: 'shift',\n\t\t\tcharacter: [ '\u2191', '\u2193', '\u2190', '\u2192' ],\n\t\t\tariaLabel: __( 'Shift + Arrow keys' ),\n\t\t},\n\t},\n];\n\nfunction KeyCombinationDisplay( {\n\tkeyCombination,\n}: {\n\tkeyCombination: KeyCombination;\n} ) {\n\tconst { modifier, character, ariaLabel } = keyCombination;\n\n\tlet keys: string[];\n\tif ( Array.isArray( character ) ) {\n\t\tif ( modifier ) {\n\t\t\t// Get the modifier prefix (e.g. ['\u21E7', '+']) from the first char,\n\t\t\t// then replace the last element with all the individual chars.\n\t\t\tconst sample = displayShortcutList[ modifier ]( character[ 0 ] );\n\t\t\tkeys = [ ...sample.slice( 0, -1 ), ...character ];\n\t\t} else {\n\t\t\tkeys = character;\n\t\t}\n\t} else {\n\t\tkeys = modifier\n\t\t\t? displayShortcutList[ modifier ]( character )\n\t\t\t: [ character ];\n\t}\n\n\tconst charString = Array.isArray( character )\n\t\t? character.join( '' )\n\t\t: character;\n\tlet label: string;\n\tif ( ariaLabel ) {\n\t\tlabel = ariaLabel;\n\t} else if ( modifier ) {\n\t\tlabel = shortcutAriaLabel[ modifier ]( charString );\n\t} else {\n\t\tlabel = charString;\n\t}\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"media-editor-keyboard-shortcuts-modal__shortcut-term\"\n\t\t\taria-label={ label }\n\t\t>\n\t\t\t{ keys.map( ( key, index ) =>\n\t\t\t\tkey === '+' && modifier ? (\n\t\t\t\t\t<Fragment key={ index }>{ key }</Fragment>\n\t\t\t\t) : (\n\t\t\t\t\t<kbd\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tclassName=\"media-editor-keyboard-shortcuts-modal__shortcut-key\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ key }\n\t\t\t\t\t</kbd>\n\t\t\t\t)\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\ninterface MediaEditorKeyboardShortcutsModalProps {\n\tonClose: () => void;\n}\n\nexport default function MediaEditorKeyboardShortcutsModal( {\n\tonClose,\n}: MediaEditorKeyboardShortcutsModalProps ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"media-editor-keyboard-shortcuts-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<p className=\"media-editor-keyboard-shortcuts-modal__note\">\n\t\t\t\t{ __(\n\t\t\t\t\t'These shortcuts work when the image editor has focus.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */ }\n\t\t\t{ /* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\tclassName=\"media-editor-keyboard-shortcuts-modal__shortcut-list\"\n\t\t\t\trole=\"list\"\n\t\t\t>\n\t\t\t\t{ SHORTCUTS.map( ( { description, keyCombination }, index ) => (\n\t\t\t\t\t<li\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tclassName=\"media-editor-keyboard-shortcuts-modal__shortcut\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"media-editor-keyboard-shortcuts-modal__shortcut-description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<KeyCombinationDisplay\n\t\t\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</Modal>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AA4GF,cA0CA,YA1CA;AA5FL,IAAM,YAA6B;AAAA,EAClC;AAAA,IACC,aAAa,GAAI,MAAO;AAAA,IACxB,gBAAgB,EAAE,UAAU,WAAW,WAAW,IAAI;AAAA,EACvD;AAAA,EACA;AAAA,IACC,aAAa,GAAI,MAAO;AAAA,IACxB,gBAAgB,EAAE,UAAU,gBAAgB,WAAW,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,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